From 12f23113f5ad815f332b359ee5e4e27657e04d4a Mon Sep 17 00:00:00 2001 From: odain-cbd <56586767+odain-cbd@users.noreply.github.com> Date: Fri, 7 Nov 2025 15:12:03 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=20N=C2=B08796=20-=20Add=20PHP=20code=20sty?= =?UTF-8?q?le=20validation=20in=20iTop=20and=20extensions=20(#757)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * poc php-cs-fixer * PSR2 for now * PSR12 + array short * move php-cs-fixer stuff in tests/php-code-style * add README * fix php-cs-fixer move into php-code-style * illustrate code reformatting on webservices folder * phpstan: change composer php requirements * indent with tabs + inception style applied everywhere even php-cs-fixer itself * use tabs for code style indentation * format concat with spaces * finalize included/excluded folders to formatting tool * add trailing_comma_in_multiline option * adapt composer.json requirements * Revert changes on webservices folder --- tests/php-code-style/.php-cs-fixer.dist.php | 25 + tests/php-code-style/README.md | 17 + tests/php-code-style/composer.json | 7 + tests/php-code-style/composer.lock | 2792 +++++++++++++++++++ 4 files changed, 2841 insertions(+) create mode 100644 tests/php-code-style/.php-cs-fixer.dist.php create mode 100644 tests/php-code-style/README.md create mode 100644 tests/php-code-style/composer.json create mode 100644 tests/php-code-style/composer.lock diff --git a/tests/php-code-style/.php-cs-fixer.dist.php b/tests/php-code-style/.php-cs-fixer.dist.php new file mode 100644 index 000000000..1478f735c --- /dev/null +++ b/tests/php-code-style/.php-cs-fixer.dist.php @@ -0,0 +1,25 @@ +in($APPROOT) + ->exclude(['oql', 'data', 'extensions']) + ->notPath(['/env-*/', '/cache-*/', 'lib', 'vendor', 'node_modules']) +; + +$config = new PhpCsFixer\Config(); +return $config->setRiskyAllowed(true) + ->setRules([ + '@PSR12' => true, + 'indentation_type' => true, + 'no_extra_blank_lines' => true, + 'array_syntax' => ['syntax' => 'short'], + 'concat_space' => true, + 'trailing_comma_in_multiline' => true, + ]) + ->setIndent("\t") + ->setLineEnding("\n") + ->setFinder($finder) +; \ No newline at end of file diff --git a/tests/php-code-style/README.md b/tests/php-code-style/README.md new file mode 100644 index 000000000..cc063439b --- /dev/null +++ b/tests/php-code-style/README.md @@ -0,0 +1,17 @@ +Code formatting tool used by iTop is PHP-CS-Fixer: +https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/master + + +to check code style issues (no path provided means whole iTop code base): + +``` +cd tests/php-code-style/; composer install; cd - +tests/php-code-style/vendor/bin/php-cs-fixer check --config tests/php-code-style/.php-cs-fixer.dist.php [PATH] +``` + +to respect iTop code standards and re-format (no path provided means whole iTop code base): + +``` +tests/php-code-style/vendor/bin/php-cs-fixer fix --config tests/php-code-style/.php-cs-fixer.dist.php [PATH] + +``` \ No newline at end of file diff --git a/tests/php-code-style/composer.json b/tests/php-code-style/composer.json new file mode 100644 index 000000000..b5c397bde --- /dev/null +++ b/tests/php-code-style/composer.json @@ -0,0 +1,7 @@ +{ + "require-dev": { + "php": "^7.0 || ^8.0", + "friendsofphp/php-cs-fixer": "^3.89", + "phpstan/phpstan": "^2.1" + } +} diff --git a/tests/php-code-style/composer.lock b/tests/php-code-style/composer.lock new file mode 100644 index 000000000..0584bac3a --- /dev/null +++ b/tests/php-code-style/composer.lock @@ -0,0 +1,2792 @@ +{ + "_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#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "316ab7e70be8ef55aca6979d178f56d5", + "packages": [], + "packages-dev": [ + { + "name": "clue/ndjson-react", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/clue/reactphp-ndjson.git", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Clue\\React\\NDJson\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + } + ], + "description": "Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.", + "homepage": "https://github.com/clue/reactphp-ndjson", + "keywords": [ + "NDJSON", + "json", + "jsonlines", + "newline", + "reactphp", + "streaming" + ], + "support": { + "issues": "https://github.com/clue/reactphp-ndjson/issues", + "source": "https://github.com/clue/reactphp-ndjson/tree/v1.3.0" + }, + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-12-23T10:58:28+00:00" + }, + { + "name": "composer/pcre", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, + "require-dev": { + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" + }, + "type": "library", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-11-12T16:29:46+00:00" + }, + { + "name": "composer/semver", + "version": "3.4.4", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.4" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2025-08-20T19:15:30+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.5", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-05-06T16:37:16+00:00" + }, + { + "name": "evenement/evenement", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/igorw/evenement.git", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^9 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Evenement\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "Événement is a very simple event dispatching library for PHP", + "keywords": [ + "event-dispatcher", + "event-emitter" + ], + "support": { + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/v3.0.2" + }, + "time": "2023-08-08T05:53:35+00:00" + }, + { + "name": "fidry/cpu-core-counter", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "db9508f7b1474469d9d3c53b86f817e344732678" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/db9508f7b1474469d9d3c53b86f817e344732678", + "reference": "db9508f7b1474469d9d3c53b86f817e344732678", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-deprecation-rules": "^2.0.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.3.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2025-08-14T07:29:31+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v3.89.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "4dd6768cb7558440d27d18f54909eee417317ce9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/4dd6768cb7558440d27d18f54909eee417317ce9", + "reference": "4dd6768cb7558440d27d18f54909eee417317ce9", + "shasum": "" + }, + "require": { + "clue/ndjson-react": "^1.3", + "composer/semver": "^3.4", + "composer/xdebug-handler": "^3.0.5", + "ext-filter": "*", + "ext-hash": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "fidry/cpu-core-counter": "^1.3", + "php": "^7.4 || ^8.0", + "react/child-process": "^0.6.6", + "react/event-loop": "^1.5", + "react/socket": "^1.16", + "react/stream": "^1.4", + "sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0", + "symfony/console": "^5.4.47 || ^6.4.24 || ^7.0", + "symfony/event-dispatcher": "^5.4.45 || ^6.4.24 || ^7.0", + "symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.0", + "symfony/finder": "^5.4.45 || ^6.4.24 || ^7.0", + "symfony/options-resolver": "^5.4.45 || ^6.4.24 || ^7.0", + "symfony/polyfill-mbstring": "^1.33", + "symfony/polyfill-php80": "^1.33", + "symfony/polyfill-php81": "^1.33", + "symfony/polyfill-php84": "^1.33", + "symfony/process": "^5.4.47 || ^6.4.24 || ^7.2", + "symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0" + }, + "require-dev": { + "facile-it/paraunit": "^1.3.1 || ^2.7", + "infection/infection": "^0.31.0", + "justinrainbow/json-schema": "^6.5", + "keradus/cli-executor": "^2.2", + "mikey179/vfsstream": "^1.6.12", + "php-coveralls/php-coveralls": "^2.8", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6", + "phpunit/phpunit": "^9.6.25 || ^10.5.53 || ^11.5.34", + "symfony/var-dumper": "^5.4.48 || ^6.4.24 || ^7.3.2", + "symfony/yaml": "^5.4.45 || ^6.4.24 || ^7.3.2" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + }, + "exclude-from-classmap": [ + "src/Fixer/Internal/*" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.89.0" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2025-10-18T19:30:16+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "2.1.31", + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ead89849d879fe203ce9292c6ef5e7e76f867b96", + "reference": "ead89849d879fe203ce9292c6ef5e7e76f867b96", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2025-10-10T14:14:11+00:00" + }, + { + "name": "psr/container", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + }, + { + "name": "react/cache", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2022-11-30T15:59:55+00:00" + }, + { + "name": "react/child-process", + "version": "v0.6.6", + "source": { + "type": "git", + "url": "https://github.com/reactphp/child-process.git", + "reference": "1721e2b93d89b745664353b9cfc8f155ba8a6159" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/1721e2b93d89b745664353b9cfc8f155ba8a6159", + "reference": "1721e2b93d89b745664353b9cfc8f155ba8a6159", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/socket": "^1.16", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\ChildProcess\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven library for executing child processes with ReactPHP.", + "keywords": [ + "event-driven", + "process", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.6" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-01-01T16:37:48+00:00" + }, + { + "name": "react/dns", + "version": "v1.13.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.13.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-13T14:18:03+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.5.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-11-13T13:48:05+00:00" + }, + { + "name": "react/promise", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/23444f53a813a3296c1368bb104793ce8d88f04a", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.12.28 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-08-19T18:57:03+00:00" + }, + { + "name": "react/socket", + "version": "v1.16.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.13", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3.3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.16.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-07-26T10:38:09+00:00" + }, + { + "name": "react/stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-11T12:45:25+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:30:58+00:00" + }, + { + "name": "symfony/console", + "version": "v5.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", + "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" + }, + "conflict": { + "psr/log": ">=3", + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-06T11:30:55+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918", + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "2.5-dev" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:11:13+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v5.4.45", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "72982eb416f61003e9bb6e91f8b3213600dcf9e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/72982eb416f61003e9bb6e91f8b3213600dcf9e9", + "reference": "72982eb416f61003e9bb6e91f8b3213600dcf9e9", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/dependency-injection": "<4.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.45" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:11:13+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v2.5.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f", + "reference": "e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/event-dispatcher": "^1" + }, + "suggest": { + "symfony/event-dispatcher-implementation": "" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:11:13+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v5.4.45", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "57c8294ed37d4a055b77057827c67f9558c95c54" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/57c8294ed37d4a055b77057827c67f9558c95c54", + "reference": "57c8294ed37d4a055b77057827c67f9558c95c54", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "symfony/process": "^5.4|^6.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v5.4.45" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-22T13:05:35+00:00" + }, + { + "name": "symfony/finder", + "version": "v5.4.45", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "63741784cd7b9967975eec610b256eed3ede022b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/63741784cd7b9967975eec610b256eed3ede022b", + "reference": "63741784cd7b9967975eec610b256eed3ede022b", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v5.4.45" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-28T13:32:08+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v5.4.45", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6", + "reference": "74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v5.4.45" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:11:13+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70", + "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://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 intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-06-27T09:58:17+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "3833d7255cc303546435cb650316bff708a1c75c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://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 intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-12-23T08:48:59+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608", + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-01-02T08:10:11+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php84", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php84.git", + "reference": "d8ced4d875142b6a7426000426b8abc631d6b191" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/d8ced4d875142b6a7426000426b8abc631d6b191", + "reference": "d8ced4d875142b6a7426000426b8abc631d6b191", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php84\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php84/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-06-24T13:30:11+00:00" + }, + { + "name": "symfony/process", + "version": "v5.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "5d1662fb32ebc94f17ddb8d635454a776066733d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/5d1662fb32ebc94f17ddb8d635454a776066733d", + "reference": "5d1662fb32ebc94f17ddb8d635454a776066733d", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v5.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-06T11:36:42+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.5.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "f37b419f7aea2e9abf10abd261832cace12e3300" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f37b419f7aea2e9abf10abd261832cace12e3300", + "reference": "f37b419f7aea2e9abf10abd261832cace12e3300", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.5.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:11:13+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v5.4.45", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "fb2c199cf302eb207f8c23e7ee174c1c31a5c004" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/fb2c199cf302eb207f8c23e7ee174c1c31a5c004", + "reference": "fb2c199cf302eb207f8c23e7ee174c1c31a5c004", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/service-contracts": "^1|^2|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a way to profile code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v5.4.45" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:11:13+00:00" + }, + { + "name": "symfony/string", + "version": "v5.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "136ca7d72f72b599f2631aca474a4f8e26719799" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/136ca7d72f72b599f2631aca474a4f8e26719799", + "reference": "136ca7d72f72b599f2631aca474a4f8e26719799", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" + }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0|^6.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v5.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-10T20:33:58+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": {}, + "platform-dev": { + "php": "^7.0 || ^8.0" + }, + "plugin-api-version": "2.6.0" +} From 890a2568c8c069af7450d0bdab9d9862d22b2a49 Mon Sep 17 00:00:00 2001 From: odain Date: Fri, 7 Nov 2025 15:39:53 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=20N=C2=B08796=20-=20Add=20PHP=20code=20sty?= =?UTF-8?q?le=20validation=20in=20iTop=20and=20extensions=20-=20format=20w?= =?UTF-8?q?hole=20code=20base?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../userrights/userrightsmatrix.class.inc.php | 147 +- .../userrights/userrightsnull.class.inc.php | 7 +- .../userrightsprofile.class.inc.php | 424 +- .../userrightsprofile.db.class.inc.php | 650 ++- .../userrightsprojection.class.inc.php | 844 ++-- app.php | 3 +- application/DBSearchHelper.php | 6 +- application/ajaxwebpage.class.inc.php | 4 +- application/application.inc.php | 1 + application/applicationcontext.class.inc.php | 242 +- application/applicationextension.inc.php | 331 +- application/audit.category.class.inc.php | 43 +- application/audit.domain.class.inc.php | 67 +- application/audit.rule.class.inc.php | 34 +- application/capturewebpage.class.inc.php | 3 +- application/clipage.class.inc.php | 3 +- application/cmdbabstract.class.inc.php | 2021 ++++---- application/compilecssservice.class.inc.php | 6 +- application/csvpage.class.inc.php | 3 +- application/dashboard.class.inc.php | 423 +- application/dashboardlayout.class.inc.php | 67 +- application/dashlet.class.inc.php | 628 +-- application/datatable.class.inc.php | 368 +- application/displayblock.class.inc.php | 398 +- application/errorpage.class.inc.php | 3 +- application/excelexporter.class.inc.php | 507 +- .../exceptions/ApplicationException.php | 1 + .../exceptions/ArchivedObjectException.php | 1 + .../exceptions/BulkChangeException.php | 3 +- application/exceptions/CSVParserException.php | 3 +- application/exceptions/ConfigException.php | 3 +- .../CoreCannotSaveObjectException.php | 8 +- application/exceptions/CoreException.php | 7 +- .../CorePortalInvalidActionRuleException.php | 2 +- .../exceptions/CoreTemplateException.php | 3 +- .../exceptions/CoreUnexpectedValue.php | 1 + application/exceptions/CoreWarning.php | 1 + application/exceptions/DeleteException.php | 3 +- .../InvalidConfigParamException.php | 1 + .../InvalidExternalKeyValueException.php | 4 +- ...InvalidPasswordAttributeOneWayPassword.php | 3 +- .../exceptions/PageNotFoundException.php | 3 +- application/exceptions/SecurityException.php | 1 + .../exceptions/SynchroExceptionNotStarted.php | 3 +- application/exceptions/UserRightException.php | 3 +- application/exceptions/dict/DictException.php | 3 +- .../dict/DictExceptionMissingString.php | 5 +- .../dict/DictExceptionUnknownLanguage.php | 5 +- application/exceptions/iTopXmlException.php | 4 +- .../exceptions/mysql/MySQLException.php | 5 +- .../mysql/MySQLHasGoneAwayException.php | 7 +- .../mysql/MySQLNoTransactionException.php | 4 +- .../mysql/MySQLQueryHasNoResultException.php | 4 +- .../MySQLTransactionNotClosedException.php | 4 +- .../exceptions/process/ProcessException.php | 3 +- .../process/ProcessFatalException.php | 3 +- .../process/ProcessInvalidConfigException.php | 3 +- .../findstylesheetobject.class.inc.php | 12 +- application/forms.class.inc.php | 755 ++- application/iotask.class.inc.php | 43 +- application/itopwebpage.class.inc.php | 3 +- application/itopwizardwebpage.class.inc.php | 3 +- application/loginbasic.class.inc.php | 69 +- application/logindefault.class.inc.php | 45 +- application/loginexternal.class.inc.php | 33 +- application/loginform.class.inc.php | 42 +- application/logintwig.class.inc.php | 45 +- application/loginurl.class.inc.php | 26 +- application/loginwebpage.class.inc.php | 482 +- application/maintenancemsg.php | 17 +- application/menunode.class.inc.php | 318 +- application/newsroomprovider.class.inc.php | 39 +- application/nicewebpage.class.inc.php | 3 +- application/pdfpage.class.inc.php | 3 +- application/portaldispatcher.class.inc.php | 35 +- application/query.class.inc.php | 231 +- application/shortcut.class.inc.php | 110 +- application/startup.inc.php | 50 +- application/template.class.inc.php | 263 +- application/themehandler.class.inc.php | 307 +- application/themehandlerservice.class.inc.php | 6 +- application/transaction.class.inc.php | 100 +- application/twigextension.class.inc.php | 36 +- application/ui.extkeywidget.class.inc.php | 367 +- application/ui.htmleditorwidget.class.inc.php | 11 +- .../ui.linksdirectwidget.class.inc.php | 173 +- application/ui.linkswidget.class.inc.php | 89 +- application/ui.passwordwidget.class.inc.php | 12 +- .../ui.searchformforeignkeys.class.inc.php | 39 +- application/uiwizard.class.inc.php | 219 +- application/user.dashboard.class.inc.php | 34 +- application/user.preferences.class.inc.php | 30 +- application/utils.inc.php | 582 +-- application/webpage.class.inc.php | 3 +- application/wizardhelper.class.inc.php | 242 +- application/xlsxwriter.class.php | 453 +- application/xmlpage.class.inc.php | 3 +- bootstrap.inc.php | 11 +- conf/index.php | 1 + core/DbConnectionWrapper.php | 6 +- core/MyHelpers.class.inc.php | 236 +- core/TemporaryObjectDescriptor.php | 54 +- core/action.class.inc.php | 305 +- core/apc-compat.php | 22 +- core/apc-emulation.php | 141 +- core/apc-service.class.inc.php | 14 +- core/asynctask.class.inc.php | 353 +- core/attributedef.class.inc.php | 4199 +++++++---------- core/autoload.php | 4 +- core/background.inc.php | 12 +- core/backgroundprocess.inc.php | 63 +- core/backgroundtask.class.inc.php | 58 +- core/bulkchange.class.inc.php | 637 +-- core/bulkexport.class.inc.php | 209 +- core/cmdbchange.class.inc.php | 39 +- core/cmdbchangeop.class.inc.php | 504 +- core/cmdbobject.class.inc.php | 55 +- core/cmdbsource.class.inc.php | 601 ++- core/computing.inc.php | 24 +- core/config.class.inc.php | 418 +- core/contexttag.class.inc.php | 26 +- core/coreexception.class.inc.php | 3 +- core/counter.class.inc.php | 105 +- core/csvbulkexport.class.inc.php | 128 +- core/csvparser.class.inc.php | 165 +- core/customfieldshandler.class.inc.php | 29 +- core/data.generator.class.inc.php | 146 +- core/datetimeformat.class.inc.php | 196 +- core/dbobject.class.php | 3587 +++++++------- core/dbobjectiterator.php | 6 +- core/dbobjectsearch.class.php | 1032 ++-- core/dbobjectset.class.php | 1597 +++---- core/dbproperty.class.inc.php | 87 +- core/dbsearch.class.php | 1350 +++--- core/dbunionsearch.class.php | 331 +- core/deletionplan.class.inc.php | 141 +- core/designdocument.class.inc.php | 72 +- core/dict.class.inc.php | 135 +- core/displayablegraph.class.inc.php | 653 +-- core/email.class.inc.php | 30 +- core/event.class.inc.php | 299 +- core/excelbulkexport.class.inc.php | 198 +- core/expression.class.inc.php | 1 + core/filterdef.class.inc.php | 100 +- core/htmlbulkexport.class.inc.php | 67 +- core/htmlsanitizer.class.inc.php | 161 +- core/iTopConfigParser.php | 34 +- core/inlineimage.class.inc.php | 411 +- core/introspection.class.inc.php | 35 +- core/kpi.class.inc.php | 430 +- core/log.class.inc.php | 193 +- core/metamodel.class.php | 2299 ++++----- core/metamodelmodifier.inc.php | 8 +- core/modelreflection.class.inc.php | 86 +- core/moduledesign.class.inc.php | 28 +- core/modulehandler.class.inc.php | 19 +- core/mutex.class.inc.php | 112 +- core/oqlactualclasstreeresolver.class.inc.php | 94 +- core/oqlclassnode.class.inc.php | 99 +- core/oqlclasstreebuilder.class.inc.php | 173 +- core/oqlclasstreeoptimizer.class.inc.php | 26 +- core/ormStyle.class.inc.php | 3 +- core/ormcaselog.class.inc.php | 307 +- core/ormcustomfieldsvalue.class.inc.php | 2 +- core/ormdocument.class.inc.php | 58 +- core/ormlinkset.class.inc.php | 389 +- core/ormpassword.class.inc.php | 25 +- core/ormset.class.inc.php | 104 +- core/ormstopwatch.class.inc.php | 277 +- core/ormtagset.class.inc.php | 172 +- core/ownershiplock.class.inc.php | 162 +- core/pdfbulkexport.class.inc.php | 57 +- core/plugininstanciationmanager.class.inc.php | 16 +- core/pluginmanager.class.inc.php | 34 +- core/querybuildercontext.class.inc.php | 52 +- core/querybuilderexpressions.class.inc.php | 77 +- core/querymodifier.class.inc.php | 7 +- core/relationgraph.class.inc.php | 311 +- core/restservices.class.inc.php | 992 ++-- core/simplecrypt.class.inc.php | 379 +- core/simplegraph.class.inc.php | 341 +- core/spreadsheetbulkexport.class.inc.php | 142 +- core/sqlobjectquery.class.inc.php | 351 +- core/sqlobjectquerybuilder.class.inc.php | 97 +- core/sqlquery.class.inc.php | 65 +- core/sqlunionquery.class.inc.php | 92 +- core/stimulus.class.inc.php | 41 +- core/tabularbulkexport.class.inc.php | 342 +- core/tagsetfield.class.inc.php | 163 +- core/tar-itop.class.inc.php | 3 +- core/templatestring.class.inc.php | 68 +- core/trigger.class.inc.php | 274 +- core/userrights.class.inc.php | 836 ++-- core/valuesetdef.class.inc.php | 165 +- core/xmlbulkexport.class.inc.php | 100 +- .../dictionaries/cs.dict.authent-cas.php | 7 +- .../dictionaries/da.dict.authent-cas.php | 7 +- .../dictionaries/de.dict.authent-cas.php | 7 +- .../dictionaries/en.dict.authent-cas.php | 5 +- .../dictionaries/en_gb.dict.authent-cas.php | 5 +- .../dictionaries/es_cr.dict.authent-cas.php | 7 +- .../dictionaries/fr.dict.authent-cas.php | 7 +- .../dictionaries/hu.dict.authent-cas.php | 7 +- .../dictionaries/it.dict.authent-cas.php | 7 +- .../dictionaries/ja.dict.authent-cas.php | 7 +- .../dictionaries/nl.dict.authent-cas.php | 7 +- .../dictionaries/pl.dict.authent-cas.php | 7 +- .../dictionaries/pt_br.dict.authent-cas.php | 7 +- .../dictionaries/ru.dict.authent-cas.php | 7 +- .../dictionaries/sk.dict.authent-cas.php | 7 +- .../dictionaries/tr.dict.authent-cas.php | 7 +- .../dictionaries/zh_cn.dict.authent-cas.php | 5 +- .../2.x/authent-cas/module.authent-cas.php | 37 +- datamodels/2.x/authent-cas/src/CASLog.php | 4 +- datamodels/2.x/authent-cas/src/CASLogger.php | 21 +- .../2.x/authent-cas/src/CASLoginExtension.php | 208 +- datamodels/2.x/authent-cas/src/Config.php | 9 +- .../dictionaries/cs.dict.authent-external.php | 7 +- .../dictionaries/da.dict.authent-external.php | 7 +- .../dictionaries/de.dict.authent-external.php | 7 +- .../dictionaries/en.dict.authent-external.php | 5 +- .../en_gb.dict.authent-external.php | 5 +- .../es_cr.dict.authent-external.php | 7 +- .../dictionaries/fr.dict.authent-external.php | 7 +- .../dictionaries/hu.dict.authent-external.php | 7 +- .../dictionaries/it.dict.authent-external.php | 7 +- .../dictionaries/ja.dict.authent-external.php | 7 +- .../dictionaries/nl.dict.authent-external.php | 7 +- .../dictionaries/pl.dict.authent-external.php | 7 +- .../pt_br.dict.authent-external.php | 7 +- .../dictionaries/ru.dict.authent-external.php | 7 +- .../dictionaries/sk.dict.authent-external.php | 7 +- .../dictionaries/tr.dict.authent-external.php | 7 +- .../zh_cn.dict.authent-external.php | 5 +- .../model.authent-external.php | 41 +- .../module.authent-external.php | 28 +- .../dictionaries/cs.dict.authent-ldap.php | 11 +- .../dictionaries/da.dict.authent-ldap.php | 11 +- .../dictionaries/de.dict.authent-ldap.php | 11 +- .../dictionaries/en.dict.authent-ldap.php | 9 +- .../dictionaries/en_gb.dict.authent-ldap.php | 5 +- .../dictionaries/es_cr.dict.authent-ldap.php | 11 +- .../dictionaries/fr.dict.authent-ldap.php | 11 +- .../dictionaries/hu.dict.authent-ldap.php | 11 +- .../dictionaries/it.dict.authent-ldap.php | 11 +- .../dictionaries/ja.dict.authent-ldap.php | 11 +- .../dictionaries/nl.dict.authent-ldap.php | 11 +- .../dictionaries/pl.dict.authent-ldap.php | 11 +- .../dictionaries/pt_br.dict.authent-ldap.php | 11 +- .../dictionaries/ru.dict.authent-ldap.php | 11 +- .../dictionaries/sk.dict.authent-ldap.php | 11 +- .../dictionaries/tr.dict.authent-ldap.php | 11 +- .../dictionaries/zh_cn.dict.authent-ldap.php | 9 +- .../2.x/authent-ldap/module.authent-ldap.php | 130 +- .../dictionaries/cs.dict.authent-local.php | 7 +- .../dictionaries/da.dict.authent-local.php | 7 +- .../dictionaries/de.dict.authent-local.php | 7 +- .../dictionaries/en.dict.authent-local.php | 5 +- .../dictionaries/en_gb.dict.authent-local.php | 5 +- .../dictionaries/es_cr.dict.authent-local.php | 7 +- .../dictionaries/fr.dict.authent-local.php | 7 +- .../dictionaries/hu.dict.authent-local.php | 7 +- .../dictionaries/it.dict.authent-local.php | 7 +- .../dictionaries/ja.dict.authent-local.php | 7 +- .../dictionaries/nl.dict.authent-local.php | 7 +- .../dictionaries/pl.dict.authent-local.php | 7 +- .../dictionaries/pt_br.dict.authent-local.php | 7 +- .../dictionaries/ru.dict.authent-local.php | 7 +- .../dictionaries/sk.dict.authent-local.php | 7 +- .../dictionaries/tr.dict.authent-local.php | 7 +- .../dictionaries/zh_cn.dict.authent-local.php | 5 +- .../2.x/authent-local/model.authent-local.php | 164 +- .../authent-local/module.authent-local.php | 27 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 5 +- ...dict.combodo-backoffice-darkmoon-theme.php | 5 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 7 +- ...dict.combodo-backoffice-darkmoon-theme.php | 5 +- ...dule.combodo-backoffice-darkmoon-theme.php | 40 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 7 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 5 +- ...ackoffice-fullmoon-high-contrast-theme.php | 40 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 9 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 7 +- ...fullmoon-protanopia-deuteranopia-theme.php | 40 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 7 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 5 +- ...o-backoffice-fullmoon-tritanopia-theme.php | 40 +- .../2.x/combodo-db-tools/bin/rebuildhk.php | 15 +- .../2.x/combodo-db-tools/bin/report.php | 6 +- .../db_analyzer.class.inc.php | 165 +- datamodels/2.x/combodo-db-tools/dbtools.php | 23 +- .../dictionaries/cs.dict.combodo-db-tools.php | 17 +- .../dictionaries/da.dict.combodo-db-tools.php | 17 +- .../dictionaries/de.dict.combodo-db-tools.php | 17 +- .../dictionaries/en.dict.combodo-db-tools.php | 15 +- .../en_gb.dict.combodo-db-tools.php | 15 +- .../es_cr.dict.combodo-db-tools.php | 17 +- .../dictionaries/fr.dict.combodo-db-tools.php | 17 +- .../dictionaries/hu.dict.combodo-db-tools.php | 17 +- .../dictionaries/it.dict.combodo-db-tools.php | 17 +- .../dictionaries/ja.dict.combodo-db-tools.php | 17 +- .../dictionaries/nl.dict.combodo-db-tools.php | 17 +- .../dictionaries/pl.dict.combodo-db-tools.php | 17 +- .../pt_br.dict.combodo-db-tools.php | 17 +- .../dictionaries/ru.dict.combodo-db-tools.php | 17 +- .../dictionaries/sk.dict.combodo-db-tools.php | 17 +- .../dictionaries/tr.dict.combodo-db-tools.php | 17 +- .../zh_cn.dict.combodo-db-tools.php | 15 +- .../module.combodo-db-tools.php | 23 +- .../src/Service/DBAnalyzerUtils.php | 16 +- .../src/Service/DBToolsUtils.php | 97 +- .../itop-attachments/ajax.itop-attachment.php | 49 +- .../dictionaries/cs.dict.itop-attachments.php | 24 +- .../dictionaries/da.dict.itop-attachments.php | 24 +- .../dictionaries/de.dict.itop-attachments.php | 24 +- .../dictionaries/en.dict.itop-attachments.php | 22 +- .../en_gb.dict.itop-attachments.php | 22 +- .../es_cr.dict.itop-attachments.php | 24 +- .../dictionaries/fr.dict.itop-attachments.php | 24 +- .../dictionaries/hu.dict.itop-attachments.php | 24 +- .../dictionaries/it.dict.itop-attachments.php | 24 +- .../dictionaries/ja.dict.itop-attachments.php | 24 +- .../dictionaries/nl.dict.itop-attachments.php | 24 +- .../dictionaries/pl.dict.itop-attachments.php | 24 +- .../pt_br.dict.itop-attachments.php | 24 +- .../dictionaries/ru.dict.itop-attachments.php | 24 +- .../dictionaries/sk.dict.itop-attachments.php | 24 +- .../dictionaries/tr.dict.itop-attachments.php | 24 +- .../zh_cn.dict.itop-attachments.php | 22 +- .../main.itop-attachments.php | 329 +- .../module.itop-attachments.php | 71 +- .../renderers.itop-attachments.php | 99 +- .../src/Hook/EventListener.php | 4 +- datamodels/2.x/itop-backup/ajax.backup.php | 86 +- datamodels/2.x/itop-backup/backup.php | 64 +- datamodels/2.x/itop-backup/check-backup.php | 172 +- .../2.x/itop-backup/common.cli-execution.php | 55 +- .../2.x/itop-backup/dbrestore.class.inc.php | 43 +- .../dictionaries/cs.dict.itop-backup.php | 7 +- .../dictionaries/da.dict.itop-backup.php | 7 +- .../dictionaries/de.dict.itop-backup.php | 7 +- .../dictionaries/en.dict.itop-backup.php | 5 +- .../dictionaries/en_gb.dict.itop-backup.php | 5 +- .../dictionaries/es_cr.dict.itop-backup.php | 7 +- .../dictionaries/fr.dict.itop-backup.php | 7 +- .../dictionaries/hu.dict.itop-backup.php | 7 +- .../dictionaries/it.dict.itop-backup.php | 7 +- .../dictionaries/ja.dict.itop-backup.php | 7 +- .../dictionaries/nl.dict.itop-backup.php | 7 +- .../dictionaries/pl.dict.itop-backup.php | 7 +- .../dictionaries/pt_br.dict.itop-backup.php | 7 +- .../dictionaries/ru.dict.itop-backup.php | 7 +- .../dictionaries/sk.dict.itop-backup.php | 7 +- .../dictionaries/tr.dict.itop-backup.php | 7 +- .../dictionaries/zh_cn.dict.itop-backup.php | 5 +- .../2.x/itop-backup/main.itop-backup.php | 69 +- .../2.x/itop-backup/module.itop-backup.php | 37 +- datamodels/2.x/itop-backup/restore.php | 56 +- datamodels/2.x/itop-backup/status.php | 91 +- .../cs.dict.itop-bridge-cmdb-services.php | 19 +- .../da.dict.itop-bridge-cmdb-services.php | 19 +- .../de.dict.itop-bridge-cmdb-services.php | 19 +- .../en.dict.itop-bridge-cmdb-services.php | 17 +- .../en_gb.dict.itop-bridge-cmdb-services.php | 17 +- .../es_cr.dict.itop-bridge-cmdb-services.php | 19 +- .../fr.dict.itop-bridge-cmdb-services.php | 19 +- .../hu.dict.itop-bridge-cmdb-services.php | 19 +- .../it.dict.itop-bridge-cmdb-services.php | 19 +- .../ja.dict.itop-bridge-cmdb-services.php | 19 +- .../nl.dict.itop-bridge-cmdb-services.php | 19 +- .../pl.dict.itop-bridge-cmdb-services.php | 19 +- .../pt_br.dict.itop-bridge-cmdb-services.php | 19 +- .../ru.dict.itop-bridge-cmdb-services.php | 19 +- .../sk.dict.itop-bridge-cmdb-services.php | 19 +- .../tr.dict.itop-bridge-cmdb-services.php | 19 +- .../zh_cn.dict.itop-bridge-cmdb-services.php | 17 +- .../module.itop-bridge-cmdb-services.php | 38 +- .../cs.dict.itop-bridge-cmdb-ticket.php | 11 +- .../da.dict.itop-bridge-cmdb-ticket.php | 11 +- .../de.dict.itop-bridge-cmdb-ticket.php | 11 +- .../en.dict.itop-bridge-cmdb-ticket.php | 9 +- .../en_gb.dict.itop-bridge-cmdb-ticket.php | 9 +- .../es_cr.dict.itop-bridge-cmdb-ticket.php | 11 +- .../fr.dict.itop-bridge-cmdb-ticket.php | 11 +- .../hu.dict.itop-bridge-cmdb-ticket.php | 11 +- .../it.dict.itop-bridge-cmdb-ticket.php | 11 +- .../ja.dict.itop-bridge-cmdb-ticket.php | 11 +- .../nl.dict.itop-bridge-cmdb-ticket.php | 11 +- .../pl.dict.itop-bridge-cmdb-ticket.php | 11 +- .../pt_br.dict.itop-bridge-cmdb-ticket.php | 11 +- .../ru.dict.itop-bridge-cmdb-ticket.php | 11 +- .../sk.dict.itop-bridge-cmdb-ticket.php | 11 +- .../tr.dict.itop-bridge-cmdb-ticket.php | 11 +- .../zh_cn.dict.itop-bridge-cmdb-ticket.php | 9 +- .../module.itop-bridge-cmdb-ticket.php | 38 +- ...e.itop-bridge-datacenter-mgmt-services.php | 32 +- ....itop-bridge-endusers-devices-services.php | 32 +- ...dule.itop-bridge-storage-mgmt-services.php | 32 +- ...op-bridge-virtualization-mgmt-services.php | 32 +- ...ule.itop-bridge-virtualization-storage.php | 27 +- .../cs.dict.itop-change-mgmt-itil.php | 28 +- .../da.dict.itop-change-mgmt-itil.php | 28 +- .../de.dict.itop-change-mgmt-itil.php | 28 +- .../en.dict.itop-change-mgmt-itil.php | 26 +- .../en_gb.dict.itop-change-mgmt-itil.php | 26 +- .../es_cr.dict.itop-change-mgmt-itil.php | 28 +- .../fr.dict.itop-change-mgmt-itil.php | 30 +- .../hu.dict.itop-change-mgmt-itil.php | 28 +- .../it.dict.itop-change-mgmt-itil.php | 28 +- .../ja.dict.itop-change-mgmt-itil.php | 28 +- .../nl.dict.itop-change-mgmt-itil.php | 28 +- .../pl.dict.itop-change-mgmt-itil.php | 28 +- .../pt_br.dict.itop-change-mgmt-itil.php | 28 +- .../ru.dict.itop-change-mgmt-itil.php | 28 +- .../sk.dict.itop-change-mgmt-itil.php | 28 +- .../tr.dict.itop-change-mgmt-itil.php | 28 +- .../zh_cn.dict.itop-change-mgmt-itil.php | 26 +- .../module.itop-change-mgmt-itil.php | 27 +- .../dictionaries/cs.dict.itop-change-mgmt.php | 12 +- .../dictionaries/da.dict.itop-change-mgmt.php | 12 +- .../dictionaries/de.dict.itop-change-mgmt.php | 12 +- .../dictionaries/en.dict.itop-change-mgmt.php | 10 +- .../en_gb.dict.itop-change-mgmt.php | 10 +- .../es_cr.dict.itop-change-mgmt.php | 12 +- .../dictionaries/fr.dict.itop-change-mgmt.php | 14 +- .../dictionaries/hu.dict.itop-change-mgmt.php | 12 +- .../dictionaries/it.dict.itop-change-mgmt.php | 12 +- .../dictionaries/ja.dict.itop-change-mgmt.php | 12 +- .../dictionaries/nl.dict.itop-change-mgmt.php | 12 +- .../dictionaries/pl.dict.itop-change-mgmt.php | 12 +- .../pt_br.dict.itop-change-mgmt.php | 12 +- .../dictionaries/ru.dict.itop-change-mgmt.php | 12 +- .../dictionaries/sk.dict.itop-change-mgmt.php | 12 +- .../dictionaries/tr.dict.itop-change-mgmt.php | 12 +- .../zh_cn.dict.itop-change-mgmt.php | 10 +- .../module.itop-change-mgmt.php | 32 +- .../dictionaries/cs.dict.itop-config-mgmt.php | 339 +- .../dictionaries/da.dict.itop-config-mgmt.php | 339 +- .../dictionaries/de.dict.itop-config-mgmt.php | 339 +- .../dictionaries/en.dict.itop-config-mgmt.php | 338 +- .../en_gb.dict.itop-config-mgmt.php | 335 +- .../es_cr.dict.itop-config-mgmt.php | 339 +- .../dictionaries/fr.dict.itop-config-mgmt.php | 389 +- .../dictionaries/hu.dict.itop-config-mgmt.php | 339 +- .../dictionaries/it.dict.itop-config-mgmt.php | 339 +- .../dictionaries/ja.dict.itop-config-mgmt.php | 339 +- .../dictionaries/nl.dict.itop-config-mgmt.php | 339 +- .../dictionaries/pl.dict.itop-config-mgmt.php | 339 +- .../pt_br.dict.itop-config-mgmt.php | 339 +- .../dictionaries/ru.dict.itop-config-mgmt.php | 339 +- .../dictionaries/sk.dict.itop-config-mgmt.php | 339 +- .../dictionaries/tr.dict.itop-config-mgmt.php | 339 +- .../zh_cn.dict.itop-config-mgmt.php | 337 +- .../main.itop-config-mgmt.php | 6 +- .../module.itop-config-mgmt.php | 35 +- datamodels/2.x/itop-config/config.php | 11 +- .../dictionaries/cs.dict.itop-config.php | 9 +- .../dictionaries/da.dict.itop-config.php | 7 +- .../dictionaries/de.dict.itop-config.php | 7 +- .../dictionaries/en.dict.itop-config.php | 5 +- .../dictionaries/en_gb.dict.itop-config.php | 5 +- .../dictionaries/es_cr.dict.itop-config.php | 7 +- .../dictionaries/fr.dict.itop-config.php | 7 +- .../dictionaries/hu.dict.itop-config.php | 7 +- .../dictionaries/it.dict.itop-config.php | 7 +- .../dictionaries/ja.dict.itop-config.php | 7 +- .../dictionaries/nl.dict.itop-config.php | 7 +- .../dictionaries/pl.dict.itop-config.php | 7 +- .../dictionaries/pt_br.dict.itop-config.php | 7 +- .../dictionaries/ru.dict.itop-config.php | 7 +- .../dictionaries/sk.dict.itop-config.php | 7 +- .../dictionaries/tr.dict.itop-config.php | 7 +- .../dictionaries/zh_cn.dict.itop-config.php | 5 +- .../2.x/itop-config/module.itop-config.php | 25 +- .../src/Validator/ConfigNodesVisitor.php | 38 +- .../src/Validator/iTopConfigAstValidator.php | 10 +- .../Validator/iTopConfigSyntaxValidator.php | 27 +- .../dictionaries/cs.dict.itop-core-update.php | 9 +- .../dictionaries/da.dict.itop-core-update.php | 9 +- .../dictionaries/de.dict.itop-core-update.php | 9 +- .../dictionaries/en.dict.itop-core-update.php | 87 +- .../en_gb.dict.itop-core-update.php | 15 +- .../es_cr.dict.itop-core-update.php | 9 +- .../dictionaries/fr.dict.itop-core-update.php | 9 +- .../dictionaries/hu.dict.itop-core-update.php | 9 +- .../dictionaries/it.dict.itop-core-update.php | 9 +- .../dictionaries/ja.dict.itop-core-update.php | 9 +- .../dictionaries/nl.dict.itop-core-update.php | 9 +- .../dictionaries/pl.dict.itop-core-update.php | 11 +- .../pt_br.dict.itop-core-update.php | 11 +- .../dictionaries/ru.dict.itop-core-update.php | 9 +- .../dictionaries/sk.dict.itop-core-update.php | 9 +- .../dictionaries/tr.dict.itop-core-update.php | 9 +- .../zh_cn.dict.itop-core-update.php | 9 +- .../module.itop-core-update.php | 5 +- .../src/Controller/AjaxController.php | 76 +- .../src/Controller/UpdateController.php | 30 +- .../src/Service/CoreUpdater.php | 236 +- .../Service/RunTimeEnvironmentCoreUpdater.php | 41 +- .../cs.dict.itop-datacenter-mgmt.php | 5 +- .../da.dict.itop-datacenter-mgmt.php | 5 +- .../de.dict.itop-datacenter-mgmt.php | 5 +- .../en.dict.itop-datacenter-mgmt.php | 5 +- .../en_gb.dict.itop-datacenter-mgmt.php | 5 +- .../es_cr.dict.itop-datacenter-mgmt.php | 7 +- .../fr.dict.itop-datacenter-mgmt.php | 5 +- .../hu.dict.itop-datacenter-mgmt.php | 5 +- .../it.dict.itop-datacenter-mgmt.php | 5 +- .../ja.dict.itop-datacenter-mgmt.php | 5 +- .../nl.dict.itop-datacenter-mgmt.php | 5 +- .../pl.dict.itop-datacenter-mgmt.php | 5 +- .../pt_br.dict.itop-datacenter-mgmt.php | 5 +- .../ru.dict.itop-datacenter-mgmt.php | 7 +- .../sk.dict.itop-datacenter-mgmt.php | 5 +- .../tr.dict.itop-datacenter-mgmt.php | 5 +- .../zh_cn.dict.itop-datacenter-mgmt.php | 5 +- .../module.itop-datacenter-mgmt.php | 38 +- .../cs.dict.itop-endusers-devices.php | 5 +- .../da.dict.itop-endusers-devices.php | 5 +- .../de.dict.itop-endusers-devices.php | 5 +- .../en.dict.itop-endusers-devices.php | 5 +- .../en_gb.dict.itop-endusers-devices.php | 5 +- .../es_cr.dict.itop-endusers-devices.php | 7 +- .../fr.dict.itop-endusers-devices.php | 5 +- .../hu.dict.itop-endusers-devices.php | 5 +- .../it.dict.itop-endusers-devices.php | 5 +- .../ja.dict.itop-endusers-devices.php | 5 +- .../nl.dict.itop-endusers-devices.php | 5 +- .../pl.dict.itop-endusers-devices.php | 5 +- .../pt_br.dict.itop-endusers-devices.php | 5 +- .../ru.dict.itop-endusers-devices.php | 7 +- .../sk.dict.itop-endusers-devices.php | 5 +- .../tr.dict.itop-endusers-devices.php | 5 +- .../zh_cn.dict.itop-endusers-devices.php | 5 +- .../module.itop-endusers-devices.php | 46 +- .../dictionaries/cs.dict.itop-faq-light.php | 15 +- .../dictionaries/da.dict.itop-faq-light.php | 15 +- .../dictionaries/de.dict.itop-faq-light.php | 15 +- .../dictionaries/en.dict.itop-faq-light.php | 13 +- .../en_gb.dict.itop-faq-light.php | 13 +- .../es_cr.dict.itop-faq-light.php | 15 +- .../dictionaries/fr.dict.itop-faq-light.php | 17 +- .../dictionaries/hu.dict.itop-faq-light.php | 15 +- .../dictionaries/it.dict.itop-faq-light.php | 15 +- .../dictionaries/ja.dict.itop-faq-light.php | 15 +- .../dictionaries/nl.dict.itop-faq-light.php | 15 +- .../dictionaries/pl.dict.itop-faq-light.php | 15 +- .../pt_br.dict.itop-faq-light.php | 15 +- .../dictionaries/ru.dict.itop-faq-light.php | 15 +- .../dictionaries/sk.dict.itop-faq-light.php | 15 +- .../dictionaries/tr.dict.itop-faq-light.php | 15 +- .../zh_cn.dict.itop-faq-light.php | 13 +- .../itop-faq-light/module.itop-faq-light.php | 35 +- .../cs.dict.itop-files-information.php | 9 +- .../da.dict.itop-files-information.php | 9 +- .../de.dict.itop-files-information.php | 9 +- .../en.dict.itop-files-information.php | 7 +- .../en_gb.dict.itop-files-information.php | 7 +- .../es_cr.dict.itop-files-information.php | 9 +- .../fr.dict.itop-files-information.php | 9 +- .../hu.dict.itop-files-information.php | 9 +- .../it.dict.itop-files-information.php | 9 +- .../ja.dict.itop-files-information.php | 9 +- .../nl.dict.itop-files-information.php | 9 +- .../pl.dict.itop-files-information.php | 9 +- .../pt_br.dict.itop-files-information.php | 9 +- .../ru.dict.itop-files-information.php | 9 +- .../sk.dict.itop-files-information.php | 9 +- .../tr.dict.itop-files-information.php | 9 +- .../zh_cn.dict.itop-files-information.php | 7 +- .../module.itop-files-information.php | 25 +- .../src/Service/FilesInformation.php | 206 +- .../src/Service/FilesInformationException.php | 5 +- .../src/Service/FilesInformationUtils.php | 299 +- .../src/Service/FilesIntegrity.php | 64 +- .../itop-full-itil/module.itop-full-itil.php | 24 +- .../itop-hub-connector/TokenValidation.php | 4 +- datamodels/2.x/itop-hub-connector/ajax.php | 196 +- .../cs.dict.itop-hub-connector.php | 9 +- .../da.dict.itop-hub-connector.php | 9 +- .../de.dict.itop-hub-connector.php | 9 +- .../en.dict.itop-hub-connector.php | 7 +- .../en_gb.dict.itop-hub-connector.php | 7 +- .../es_cr.dict.itop-hub-connector.php | 9 +- .../fr.dict.itop-hub-connector.php | 9 +- .../hu.dict.itop-hub-connector.php | 9 +- .../it.dict.itop-hub-connector.php | 9 +- .../ja.dict.itop-hub-connector.php | 9 +- .../nl.dict.itop-hub-connector.php | 9 +- .../pl.dict.itop-hub-connector.php | 9 +- .../pt_br.dict.itop-hub-connector.php | 9 +- .../ru.dict.itop-hub-connector.php | 9 +- .../sk.dict.itop-hub-connector.php | 9 +- .../tr.dict.itop-hub-connector.php | 9 +- .../zh_cn.dict.itop-hub-connector.php | 7 +- .../hubconnectorpage.class.inc.php | 6 +- .../hubnewsroomprovider.class.inc.php | 36 +- datamodels/2.x/itop-hub-connector/land.php | 43 +- datamodels/2.x/itop-hub-connector/launch.php | 86 +- datamodels/2.x/itop-hub-connector/menus.php | 9 +- .../module.itop-hub-connector.php | 33 +- .../2.x/itop-hub-connector/myextensions.php | 12 +- .../cs.dict.itop-incident-mgmt-itil.php | 12 +- .../da.dict.itop-incident-mgmt-itil.php | 12 +- .../de.dict.itop-incident-mgmt-itil.php | 12 +- .../en.dict.itop-incident-mgmt-itil.php | 10 +- .../en_gb.dict.itop-incident-mgmt-itil.php | 10 +- .../es_cr.dict.itop-incident-mgmt-itil.php | 12 +- .../fr.dict.itop-incident-mgmt-itil.php | 14 +- .../hu.dict.itop-incident-mgmt-itil.php | 12 +- .../it.dict.itop-incident-mgmt-itil.php | 12 +- .../ja.dict.itop-incident-mgmt-itil.php | 12 +- .../nl.dict.itop-incident-mgmt-itil.php | 12 +- .../pl.dict.itop-incident-mgmt-itil.php | 12 +- .../pt_br.dict.itop-incident-mgmt-itil.php | 12 +- .../ru.dict.itop-incident-mgmt-itil.php | 12 +- .../sk.dict.itop-incident-mgmt-itil.php | 12 +- .../tr.dict.itop-incident-mgmt-itil.php | 12 +- .../zh_cn.dict.itop-incident-mgmt-itil.php | 10 +- .../module.itop-incident-mgmt-itil.php | 27 +- .../cs.dict.itop-knownerror-mgmt.php | 19 +- .../da.dict.itop-knownerror-mgmt.php | 19 +- .../de.dict.itop-knownerror-mgmt.php | 19 +- .../en.dict.itop-knownerror-mgmt.php | 17 +- .../en_gb.dict.itop-knownerror-mgmt.php | 17 +- .../es_cr.dict.itop-knownerror-mgmt.php | 19 +- .../fr.dict.itop-knownerror-mgmt.php | 19 +- .../hu.dict.itop-knownerror-mgmt.php | 19 +- .../it.dict.itop-knownerror-mgmt.php | 19 +- .../ja.dict.itop-knownerror-mgmt.php | 19 +- .../nl.dict.itop-knownerror-mgmt.php | 19 +- .../pl.dict.itop-knownerror-mgmt.php | 19 +- .../pt_br.dict.itop-knownerror-mgmt.php | 19 +- .../ru.dict.itop-knownerror-mgmt.php | 19 +- .../sk.dict.itop-knownerror-mgmt.php | 19 +- .../tr.dict.itop-knownerror-mgmt.php | 19 +- .../zh_cn.dict.itop-knownerror-mgmt.php | 17 +- .../module.itop-knownerror-mgmt.php | 27 +- datamodels/2.x/itop-oauth-client/ajax.php | 5 +- .../cs.dict.itop-oauth-client.php | 13 +- .../da.dict.itop-oauth-client.php | 13 +- .../de.dict.itop-oauth-client.php | 11 +- .../en.dict.itop-oauth-client.php | 13 +- .../en_gb.dict.itop-oauth-client.php | 9 +- .../es_cr.dict.itop-oauth-client.php | 11 +- .../fr.dict.itop-oauth-client.php | 11 +- .../hu.dict.itop-oauth-client.php | 11 +- .../it.dict.itop-oauth-client.php | 11 +- .../ja.dict.itop-oauth-client.php | 13 +- .../nl.dict.itop-oauth-client.php | 13 +- .../pl.dict.itop-oauth-client.php | 15 +- .../pt_br.dict.itop-oauth-client.php | 13 +- .../ru.dict.itop-oauth-client.php | 13 +- .../sk.dict.itop-oauth-client.php | 11 +- .../tr.dict.itop-oauth-client.php | 13 +- .../zh_cn.dict.itop-oauth-client.php | 9 +- datamodels/2.x/itop-oauth-client/index.php | 5 +- .../module.itop-oauth-client.php | 36 +- .../Controller/AjaxOauthClientController.php | 22 +- .../src/Controller/OAuthClientController.php | 5 +- .../src/Service/ApplicationUIExtension.php | 4 +- .../src/Service/PopupMenuExtension.php | 5 +- .../dictionaries/cs.dict.itop-portal-base.php | 43 +- .../dictionaries/da.dict.itop-portal-base.php | 43 +- .../dictionaries/de.dict.itop-portal-base.php | 43 +- .../dictionaries/en.dict.itop-portal-base.php | 41 +- .../en_gb.dict.itop-portal-base.php | 41 +- .../es_cr.dict.itop-portal-base.php | 43 +- .../dictionaries/fr.dict.itop-portal-base.php | 43 +- .../dictionaries/hu.dict.itop-portal-base.php | 43 +- .../dictionaries/it.dict.itop-portal-base.php | 43 +- .../dictionaries/ja.dict.itop-portal-base.php | 43 +- .../dictionaries/nl.dict.itop-portal-base.php | 43 +- .../dictionaries/pl.dict.itop-portal-base.php | 43 +- .../pt_br.dict.itop-portal-base.php | 43 +- .../dictionaries/ru.dict.itop-portal-base.php | 43 +- .../dictionaries/sk.dict.itop-portal-base.php | 43 +- .../dictionaries/tr.dict.itop-portal-base.php | 43 +- .../zh_cn.dict.itop-portal-base.php | 41 +- datamodels/2.x/itop-portal-base/index.php | 7 +- .../module.itop-portal-base.php | 34 +- .../portal/config/bootstrap.php | 42 +- .../itop-portal-base/portal/config/bridge.php | 2 +- .../portal/config/bundles.php | 1 + .../config/legacy_silex_compat_layer.php | 31 +- .../config/routes/extensions_extra_routes.php | 6 +- .../portal/config/services.php | 3 +- .../itop-portal-base/portal/public/index.php | 6 +- .../portal/src/Brick/AbstractBrick.php | 144 +- .../portal/src/Brick/AggregatePageBrick.php | 41 +- .../portal/src/Brick/BrickCollection.php | 61 +- .../src/Brick/BrickNotFoundException.php | 4 +- .../portal/src/Brick/BrowseBrick.php | 328 +- .../portal/src/Brick/CreateBrick.php | 39 +- .../portal/src/Brick/FilterBrick.php | 94 +- .../portal/src/Brick/ManageBrick.php | 407 +- .../portal/src/Brick/PortalBrick.php | 97 +- .../src/Brick/PropertyNotFoundException.php | 3 +- .../portal/src/Brick/UserProfileBrick.php | 34 +- .../src/Controller/AbstractController.php | 9 +- .../AggregatePageBrickController.php | 39 +- .../portal/src/Controller/BrickController.php | 1 - .../src/Controller/BrowseBrickController.php | 275 +- .../src/Controller/CreateBrickController.php | 11 +- .../src/Controller/DefaultController.php | 29 +- .../src/Controller/ManageBrickController.php | 523 +- .../src/Controller/ObjectController.php | 703 ++- .../Controller/SessionMessageController.php | 9 +- .../Controller/UserProfileBrickController.php | 235 +- .../src/DataCollector/PortalCollector.php | 7 +- .../AbstractConfiguration.php | 2 +- .../PortalXmlConfiguration/Basic.php | 95 +- .../PortalXmlConfiguration/Forms.php | 215 +- .../PortalXmlConfiguration/Lists.php | 53 +- ...plicationContextSetPluginPropertyClass.php | 3 +- .../ApplicationContextSetUrlMakerClass.php | 21 +- .../src/EventListener/CssFromSassCompiler.php | 15 +- .../src/EventListener/ExceptionListener.php | 28 +- .../portal/src/EventListener/UserProvider.php | 10 +- .../portal/src/Form/ObjectFormManager.php | 412 +- .../portal/src/Form/PasswordFormManager.php | 102 +- .../src/Form/PreferencesFormManager.php | 40 +- .../portal/src/Helper/ApplicationHelper.php | 152 +- .../src/Helper/BrickControllerHelper.php | 8 +- .../portal/src/Helper/BrowseBrickHelper.php | 263 +- .../src/Helper/ContextManipulatorHelper.php | 228 +- .../portal/src/Helper/ExtensibilityHelper.php | 3 +- .../src/Helper/LifecycleValidatorHelper.php | 129 +- .../src/Helper/NavigationRuleHelper.php | 209 +- .../src/Helper/ObjectFormHandlerHelper.php | 215 +- .../src/Helper/RequestManipulatorHelper.php | 20 +- .../src/Helper/ScopeValidatorHelper.php | 234 +- .../portal/src/Helper/SecurityHelper.php | 105 +- .../src/Helper/SessionMessageHelper.php | 48 +- .../portal/src/Helper/UIExtensionsHelper.php | 65 +- .../iAbstractPortalTabContentExtension.php | 3 +- .../src/Hook/iAbstractPortalTabExtension.php | 3 +- .../Hook/iUserProfileTabContentExtension.php | 4 +- .../src/Hook/iUserProfileTabExtension.php | 4 +- .../itop-portal-base/portal/src/Kernel.php | 26 +- .../src/Routing/ItopExtensionsExtraRoutes.php | 8 +- .../portal/src/Routing/UrlGenerator.php | 3 +- .../TemplateDefinitionDto.php | 7 +- .../TemplatesProviderInterface.php | 2 +- .../TemplatesProviderService.php | 5 +- .../TemplatesProvider/TemplatesRegister.php | 6 +- .../portal/src/Twig/AppExtension.php | 4 +- .../portal/src/Twig/AppGlobal.php | 5 +- .../portal/src/Twig/AppVariable.php | 148 +- .../portal/src/Twig/CKEditorExtension.php | 13 +- .../portal/src/Twig/CurrentUserAccessor.php | 3 +- .../portal/src/Twig/PortalBlockExtension.php | 3 +- .../portal/src/Twig/PortalTwigContext.php | 6 +- .../src/Twig/TemplatesTwigExtension.php | 5 +- .../src/UrlMaker/AbstractPortalUrlMaker.php | 52 +- .../AbstractStringVariableAccessor.php | 3 +- .../AbstractVariableAccessor.php | 29 +- .../CombodoCurrentContactPhotoUrl.php | 7 +- .../CombodoPortalInstanceConf.php | 4 +- .../dictionaries/cs.dict.itop-portal.php | 7 +- .../dictionaries/da.dict.itop-portal.php | 7 +- .../dictionaries/de.dict.itop-portal.php | 7 +- .../dictionaries/en.dict.itop-portal.php | 5 +- .../dictionaries/en_gb.dict.itop-portal.php | 5 +- .../dictionaries/es_cr.dict.itop-portal.php | 7 +- .../dictionaries/fr.dict.itop-portal.php | 7 +- .../dictionaries/hu.dict.itop-portal.php | 7 +- .../dictionaries/it.dict.itop-portal.php | 7 +- .../dictionaries/ja.dict.itop-portal.php | 7 +- .../dictionaries/nl.dict.itop-portal.php | 7 +- .../dictionaries/pl.dict.itop-portal.php | 7 +- .../dictionaries/pt_br.dict.itop-portal.php | 7 +- .../dictionaries/ru.dict.itop-portal.php | 7 +- .../dictionaries/sk.dict.itop-portal.php | 7 +- .../dictionaries/tr.dict.itop-portal.php | 7 +- .../dictionaries/zh_cn.dict.itop-portal.php | 5 +- datamodels/2.x/itop-portal/index.php | 10 +- .../2.x/itop-portal/main.itop-portal.php | 4 +- .../2.x/itop-portal/module.itop-portal.php | 32 +- .../cs.dict.itop-problem-mgmt.php | 11 +- .../da.dict.itop-problem-mgmt.php | 11 +- .../de.dict.itop-problem-mgmt.php | 11 +- .../en.dict.itop-problem-mgmt.php | 10 +- .../en_gb.dict.itop-problem-mgmt.php | 10 +- .../es_cr.dict.itop-problem-mgmt.php | 11 +- .../fr.dict.itop-problem-mgmt.php | 13 +- .../hu.dict.itop-problem-mgmt.php | 11 +- .../it.dict.itop-problem-mgmt.php | 11 +- .../ja.dict.itop-problem-mgmt.php | 11 +- .../nl.dict.itop-problem-mgmt.php | 11 +- .../pl.dict.itop-problem-mgmt.php | 11 +- .../pt_br.dict.itop-problem-mgmt.php | 11 +- .../ru.dict.itop-problem-mgmt.php | 11 +- .../sk.dict.itop-problem-mgmt.php | 11 +- .../tr.dict.itop-problem-mgmt.php | 11 +- .../zh_cn.dict.itop-problem-mgmt.php | 9 +- .../module.itop-problem-mgmt.php | 27 +- .../module.itop-profiles-itil.php | 34 +- .../cs.dict.itop-request-mgmt-itil.php | 16 +- .../da.dict.itop-request-mgmt-itil.php | 16 +- .../de.dict.itop-request-mgmt-itil.php | 16 +- .../en.dict.itop-request-mgmt-itil.php | 14 +- .../en_gb.dict.itop-request-mgmt-itil.php | 14 +- .../es_cr.dict.itop-request-mgmt-itil.php | 16 +- .../fr.dict.itop-request-mgmt-itil.php | 18 +- .../hu.dict.itop-request-mgmt-itil.php | 16 +- .../it.dict.itop-request-mgmt-itil.php | 16 +- .../ja.dict.itop-request-mgmt-itil.php | 16 +- .../nl.dict.itop-request-mgmt-itil.php | 16 +- .../pl.dict.itop-request-mgmt-itil.php | 16 +- .../pt_br.dict.itop-request-mgmt-itil.php | 16 +- .../ru.dict.itop-request-mgmt-itil.php | 16 +- .../sk.dict.itop-request-mgmt-itil.php | 16 +- .../tr.dict.itop-request-mgmt-itil.php | 16 +- .../zh_cn.dict.itop-request-mgmt-itil.php | 14 +- .../module.itop-request-mgmt-itil.php | 27 +- .../cs.dict.itop-request-mgmt.php | 21 +- .../da.dict.itop-request-mgmt.php | 21 +- .../de.dict.itop-request-mgmt.php | 21 +- .../en.dict.itop-request-mgmt.php | 19 +- .../en_gb.dict.itop-request-mgmt.php | 19 +- .../es_cr.dict.itop-request-mgmt.php | 21 +- .../fr.dict.itop-request-mgmt.php | 23 +- .../hu.dict.itop-request-mgmt.php | 21 +- .../it.dict.itop-request-mgmt.php | 21 +- .../ja.dict.itop-request-mgmt.php | 21 +- .../nl.dict.itop-request-mgmt.php | 21 +- .../pl.dict.itop-request-mgmt.php | 21 +- .../pt_br.dict.itop-request-mgmt.php | 21 +- .../ru.dict.itop-request-mgmt.php | 21 +- .../sk.dict.itop-request-mgmt.php | 21 +- .../tr.dict.itop-request-mgmt.php | 21 +- .../zh_cn.dict.itop-request-mgmt.php | 19 +- .../module.itop-request-mgmt.php | 27 +- .../cs.dict.itop-service-mgmt-provider.php | 106 +- .../da.dict.itop-service-mgmt-provider.php | 106 +- .../de.dict.itop-service-mgmt-provider.php | 106 +- .../en.dict.itop-service-mgmt-provider.php | 104 +- .../en_gb.dict.itop-service-mgmt-provider.php | 92 +- .../es_cr.dict.itop-service-mgmt-provider.php | 106 +- .../fr.dict.itop-service-mgmt-provider.php | 112 +- .../hu.dict.itop-service-mgmt-provider.php | 106 +- .../it.dict.itop-service-mgmt-provider.php | 106 +- .../ja.dict.itop-service-mgmt-provider.php | 106 +- .../nl.dict.itop-service-mgmt-provider.php | 106 +- .../pl.dict.itop-service-mgmt-provider.php | 106 +- .../pt_br.dict.itop-service-mgmt-provider.php | 106 +- .../ru.dict.itop-service-mgmt-provider.php | 106 +- .../sk.dict.itop-service-mgmt-provider.php | 106 +- .../tr.dict.itop-service-mgmt-provider.php | 106 +- .../zh_cn.dict.itop-service-mgmt-provider.php | 104 +- .../main.itop-service-mgmt-provider.php | 6 +- .../module.itop-service-mgmt-provider.php | 37 +- .../cs.dict.itop-service-mgmt.php | 102 +- .../da.dict.itop-service-mgmt.php | 102 +- .../de.dict.itop-service-mgmt.php | 102 +- .../en.dict.itop-service-mgmt.php | 98 +- .../en_gb.dict.itop-service-mgmt.php | 82 +- .../es_cr.dict.itop-service-mgmt.php | 102 +- .../fr.dict.itop-service-mgmt.php | 106 +- .../hu.dict.itop-service-mgmt.php | 102 +- .../it.dict.itop-service-mgmt.php | 100 +- .../ja.dict.itop-service-mgmt.php | 100 +- .../nl.dict.itop-service-mgmt.php | 100 +- .../pl.dict.itop-service-mgmt.php | 100 +- .../pt_br.dict.itop-service-mgmt.php | 100 +- .../ru.dict.itop-service-mgmt.php | 100 +- .../sk.dict.itop-service-mgmt.php | 100 +- .../tr.dict.itop-service-mgmt.php | 100 +- .../zh_cn.dict.itop-service-mgmt.php | 98 +- .../main.itop-service-mgmt.php | 6 +- .../module.itop-service-mgmt.php | 35 +- .../cs.dict.itop-sla-computation.php | 5 +- .../da.dict.itop-sla-computation.php | 5 +- .../de.dict.itop-sla-computation.php | 5 +- .../en.dict.itop-sla-computation.php | 5 +- .../en_gb.dict.itop-sla-computation.php | 5 +- .../es_cr.dict.itop-sla-computation.php | 7 +- .../fr.dict.itop-sla-computation.php | 5 +- .../hu.dict.itop-sla-computation.php | 5 +- .../it.dict.itop-sla-computation.php | 5 +- .../ja.dict.itop-sla-computation.php | 5 +- .../nl.dict.itop-sla-computation.php | 5 +- .../pl.dict.itop-sla-computation.php | 5 +- .../pt_br.dict.itop-sla-computation.php | 5 +- .../ru.dict.itop-sla-computation.php | 7 +- .../sk.dict.itop-sla-computation.php | 5 +- .../tr.dict.itop-sla-computation.php | 5 +- .../zh_cn.dict.itop-sla-computation.php | 5 +- .../main.itop-sla-computation.php | 32 +- .../module.itop-sla-computation.php | 39 +- .../cs.dict.itop-storage-mgmt.php | 17 +- .../da.dict.itop-storage-mgmt.php | 17 +- .../de.dict.itop-storage-mgmt.php | 17 +- .../en.dict.itop-storage-mgmt.php | 17 +- .../en_gb.dict.itop-storage-mgmt.php | 5 +- .../es_cr.dict.itop-storage-mgmt.php | 19 +- .../fr.dict.itop-storage-mgmt.php | 17 +- .../hu.dict.itop-storage-mgmt.php | 17 +- .../it.dict.itop-storage-mgmt.php | 17 +- .../ja.dict.itop-storage-mgmt.php | 17 +- .../nl.dict.itop-storage-mgmt.php | 17 +- .../pl.dict.itop-storage-mgmt.php | 17 +- .../pt_br.dict.itop-storage-mgmt.php | 17 +- .../ru.dict.itop-storage-mgmt.php | 19 +- .../sk.dict.itop-storage-mgmt.php | 17 +- .../tr.dict.itop-storage-mgmt.php | 17 +- .../zh_cn.dict.itop-storage-mgmt.php | 17 +- .../module.itop-storage-mgmt.php | 51 +- .../dictionaries/cs.dict.itop-structure.php | 67 +- .../dictionaries/da.dict.itop-structure.php | 67 +- .../dictionaries/de.dict.itop-structure.php | 67 +- .../dictionaries/en.dict.itop-structure.php | 70 +- .../en_gb.dict.itop-structure.php | 70 +- .../es_cr.dict.itop-structure.php | 67 +- .../dictionaries/fr.dict.itop-structure.php | 73 +- .../dictionaries/hu.dict.itop-structure.php | 67 +- .../dictionaries/it.dict.itop-structure.php | 67 +- .../dictionaries/ja.dict.itop-structure.php | 67 +- .../dictionaries/nl.dict.itop-structure.php | 67 +- .../dictionaries/pl.dict.itop-structure.php | 67 +- .../pt_br.dict.itop-structure.php | 67 +- .../dictionaries/ru.dict.itop-structure.php | 67 +- .../dictionaries/sk.dict.itop-structure.php | 67 +- .../dictionaries/tr.dict.itop-structure.php | 67 +- .../zh_cn.dict.itop-structure.php | 65 +- .../itop-structure/main.itop-structure.php | 6 +- .../itop-structure/module.itop-structure.php | 49 +- .../cs.dict.itop-themes-compat.php | 7 +- .../da.dict.itop-themes-compat.php | 7 +- .../de.dict.itop-themes-compat.php | 7 +- .../en.dict.itop-themes-compat.php | 5 +- .../en_gb.dict.itop-themes-compat.php | 5 +- .../es_cr.dict.itop-themes-compat.php | 7 +- .../fr.dict.itop-themes-compat.php | 7 +- .../hu.dict.itop-themes-compat.php | 7 +- .../it.dict.itop-themes-compat.php | 7 +- .../ja.dict.itop-themes-compat.php | 7 +- .../nl.dict.itop-themes-compat.php | 7 +- .../pl.dict.itop-themes-compat.php | 7 +- .../pt_br.dict.itop-themes-compat.php | 7 +- .../ru.dict.itop-themes-compat.php | 7 +- .../sk.dict.itop-themes-compat.php | 7 +- .../tr.dict.itop-themes-compat.php | 7 +- .../zh_cn.dict.itop-themes-compat.php | 5 +- .../module.itop-themes-compat.php | 35 +- .../dictionaries/cs.dict.itop-tickets.php | 26 +- .../dictionaries/da.dict.itop-tickets.php | 26 +- .../dictionaries/de.dict.itop-tickets.php | 26 +- .../dictionaries/en.dict.itop-tickets.php | 25 +- .../dictionaries/en_gb.dict.itop-tickets.php | 21 +- .../dictionaries/es_cr.dict.itop-tickets.php | 26 +- .../dictionaries/fr.dict.itop-tickets.php | 30 +- .../dictionaries/hu.dict.itop-tickets.php | 26 +- .../dictionaries/it.dict.itop-tickets.php | 26 +- .../dictionaries/ja.dict.itop-tickets.php | 26 +- .../dictionaries/nl.dict.itop-tickets.php | 26 +- .../dictionaries/pl.dict.itop-tickets.php | 26 +- .../dictionaries/pt_br.dict.itop-tickets.php | 26 +- .../dictionaries/ru.dict.itop-tickets.php | 26 +- .../dictionaries/sk.dict.itop-tickets.php | 26 +- .../dictionaries/tr.dict.itop-tickets.php | 26 +- .../dictionaries/zh_cn.dict.itop-tickets.php | 24 +- .../2.x/itop-tickets/main.itop-tickets.php | 239 +- .../2.x/itop-tickets/module.itop-tickets.php | 40 +- .../cs.dict.itop-virtualization-mgmt.php | 9 +- .../da.dict.itop-virtualization-mgmt.php | 9 +- .../de.dict.itop-virtualization-mgmt.php | 9 +- .../en.dict.itop-virtualization-mgmt.php | 9 +- .../en_gb.dict.itop-virtualization-mgmt.php | 5 +- .../es_cr.dict.itop-virtualization-mgmt.php | 11 +- .../fr.dict.itop-virtualization-mgmt.php | 9 +- .../hu.dict.itop-virtualization-mgmt.php | 9 +- .../it.dict.itop-virtualization-mgmt.php | 9 +- .../ja.dict.itop-virtualization-mgmt.php | 9 +- .../nl.dict.itop-virtualization-mgmt.php | 11 +- .../pl.dict.itop-virtualization-mgmt.php | 9 +- .../pt_br.dict.itop-virtualization-mgmt.php | 9 +- .../ru.dict.itop-virtualization-mgmt.php | 11 +- .../sk.dict.itop-virtualization-mgmt.php | 9 +- .../tr.dict.itop-virtualization-mgmt.php | 9 +- .../zh_cn.dict.itop-virtualization-mgmt.php | 9 +- .../module.itop-virtualization-mgmt.php | 37 +- .../cs.dict.itop-welcome-itil.php | 2 +- .../da.dict.itop-welcome-itil.php | 2 +- .../de.dict.itop-welcome-itil.php | 2 +- .../en.dict.itop-welcome-itil.php | 2 +- .../en_gb.dict.itop-welcome-itil.php | 2 +- .../es_cr.dict.itop-welcome-itil.php | 2 +- .../fr.dict.itop-welcome-itil.php | 2 +- .../hu.dict.itop-welcome-itil.php | 2 +- .../it.dict.itop-welcome-itil.php | 2 +- .../ja.dict.itop-welcome-itil.php | 2 +- .../nl.dict.itop-welcome-itil.php | 2 +- .../pl.dict.itop-welcome-itil.php | 2 +- .../pt_br.dict.itop-welcome-itil.php | 2 +- .../ru.dict.itop-welcome-itil.php | 2 +- .../sk.dict.itop-welcome-itil.php | 2 +- .../tr.dict.itop-welcome-itil.php | 2 +- .../zh_cn.dict.itop-welcome-itil.php | 2 +- .../module.itop-welcome-itil.php | 31 +- .../cs.dictionary.itop.orm-document.php | 3 +- .../da.dictionary.itop.orm-document.php | 3 +- .../de.dictionary.itop.orm-document.php | 3 +- .../en.dictionary.itop.orm-document.php | 1 + .../en_gb.dictionary.itop.orm-document.php | 1 + .../es_cr.dictionary.itop.orm-document.php | 3 +- .../fr.dictionary.itop.orm-document.php | 3 +- .../hu.dictionary.itop.orm-document.php | 3 +- .../it.dictionary.itop.orm-document.php | 3 +- .../ja.dictionary.itop.orm-document.php | 3 +- .../nl.dictionary.itop.orm-document.php | 3 +- .../pl.dictionary.itop.orm-document.php | 3 +- .../pt_br.dictionary.itop.orm-document.php | 3 +- .../ru.dictionary.itop.orm-document.php | 3 +- .../sk.dictionary.itop.orm-document.php | 3 +- .../tr.dictionary.itop.orm-document.php | 3 +- .../zh_cn.dictionary.itop.orm-document.php | 1 + .../cs.dictionary.itop.uniqueness-rule.php | 3 +- .../da.dictionary.itop.uniqueness-rule.php | 3 +- .../de.dictionary.itop.uniqueness-rule.php | 3 +- .../en.dictionary.itop.uniqueness-rule.php | 1 + .../en_gb.dictionary.itop.uniqueness-rule.php | 1 + .../es_cr.dictionary.itop.uniqueness-rule.php | 3 +- .../fr.dictionary.itop.uniqueness-rule.php | 3 +- .../hu.dictionary.itop.uniqueness-rule.php | 3 +- .../it.dictionary.itop.uniqueness-rule.php | 3 +- .../ja.dictionary.itop.uniqueness-rule.php | 3 +- .../nl.dictionary.itop.uniqueness-rule.php | 3 +- .../pl.dictionary.itop.uniqueness-rule.php | 3 +- .../pt_br.dictionary.itop.uniqueness-rule.php | 3 +- .../ru.dictionary.itop.uniqueness-rule.php | 3 +- .../sk.dictionary.itop.uniqueness-rule.php | 3 +- .../tr.dictionary.itop.uniqueness-rule.php | 3 +- .../zh_cn.dictionary.itop.uniqueness-rule.php | 1 + dictionaries/cs.dictionary.itop.core.php | 186 +- dictionaries/cs.dictionary.itop.ui.php | 93 +- dictionaries/da.dictionary.itop.core.php | 186 +- dictionaries/da.dictionary.itop.ui.php | 93 +- dictionaries/de.dictionary.itop.core.php | 186 +- dictionaries/de.dictionary.itop.ui.php | 93 +- dictionaries/en.dictionary.itop.core.php | 186 +- dictionaries/en.dictionary.itop.ui.php | 90 +- dictionaries/en_gb.dictionary.itop.core.php | 182 +- dictionaries/en_gb.dictionary.itop.ui.php | 90 +- dictionaries/es_cr.dictionary.itop.core.php | 188 +- dictionaries/es_cr.dictionary.itop.ui.php | 93 +- dictionaries/fr.dictionary.itop.core.php | 186 +- dictionaries/fr.dictionary.itop.ui.php | 93 +- dictionaries/hu.dictionary.itop.core.php | 186 +- dictionaries/hu.dictionary.itop.ui.php | 93 +- dictionaries/it.dictionary.itop.core.php | 186 +- dictionaries/it.dictionary.itop.ui.php | 93 +- dictionaries/ja.dictionary.itop.core.php | 186 +- dictionaries/ja.dictionary.itop.ui.php | 93 +- dictionaries/nl.dictionary.itop.core.php | 186 +- dictionaries/nl.dictionary.itop.ui.php | 93 +- dictionaries/pl.dictionary.itop.core.php | 186 +- dictionaries/pl.dictionary.itop.ui.php | 93 +- dictionaries/pt_br.dictionary.itop.core.php | 186 +- dictionaries/pt_br.dictionary.itop.ui.php | 93 +- dictionaries/ru.dictionary.itop.core.php | 186 +- dictionaries/ru.dictionary.itop.ui.php | 93 +- dictionaries/sk.dictionary.itop.core.php | 184 +- dictionaries/sk.dictionary.itop.ui.php | 89 +- dictionaries/tr.dictionary.itop.core.php | 186 +- dictionaries/tr.dictionary.itop.ui.php | 93 +- .../bulk/cs.dictionary.itop.bulk.php | 7 +- .../bulk/da.dictionary.itop.bulk.php | 7 +- .../bulk/de.dictionary.itop.bulk.php | 7 +- .../bulk/en.dictionary.itop.bulk.php | 5 +- .../bulk/en_gb.dictionary.itop.bulk.php | 5 +- .../bulk/es_cr.dictionary.itop.bulk.php | 7 +- .../bulk/fr.dictionary.itop.bulk.php | 7 +- .../bulk/hu.dictionary.itop.bulk.php | 7 +- .../bulk/it.dictionary.itop.bulk.php | 7 +- .../bulk/ja.dictionary.itop.bulk.php | 7 +- .../bulk/nl.dictionary.itop.bulk.php | 7 +- .../bulk/pl.dictionary.itop.bulk.php | 7 +- .../bulk/pt_br.dictionary.itop.bulk.php | 7 +- .../bulk/ru.dictionary.itop.bulk.php | 7 +- .../bulk/sk.dictionary.itop.bulk.php | 7 +- .../bulk/tr.dictionary.itop.bulk.php | 7 +- .../bulk/zh_cn.dictionary.itop.bulk.php | 5 +- .../cs.dictionary.itop.display-block.php | 7 +- .../da.dictionary.itop.display-block.php | 7 +- .../de.dictionary.itop.display-block.php | 7 +- .../en.dictionary.itop.display-block.php | 5 +- .../en_gb.dictionary.itop.display-block.php | 5 +- .../es_cr.dictionary.itop.display-block.php | 7 +- .../fr.dictionary.itop.display-block.php | 7 +- .../hu.dictionary.itop.display-block.php | 7 +- .../it.dictionary.itop.display-block.php | 7 +- .../ja.dictionary.itop.display-block.php | 7 +- .../nl.dictionary.itop.display-block.php | 7 +- .../pl.dictionary.itop.display-block.php | 7 +- .../pt_br.dictionary.itop.display-block.php | 7 +- .../ru.dictionary.itop.display-block.php | 7 +- .../sk.dictionary.itop.display-block.php | 7 +- .../tr.dictionary.itop.display-block.php | 7 +- .../zh_cn.dictionary.itop.display-block.php | 5 +- .../links/cs.dictionary.itop.links.php | 7 +- .../links/da.dictionary.itop.links.php | 7 +- .../links/de.dictionary.itop.links.php | 7 +- .../links/en.dictionary.itop.links.php | 5 +- .../links/en_gb.dictionary.itop.links.php | 5 +- .../links/es_cr.dictionary.itop.links.php | 7 +- .../links/fr.dictionary.itop.links.php | 7 +- .../links/hu.dictionary.itop.links.php | 7 +- .../links/it.dictionary.itop.links.php | 7 +- .../links/ja.dictionary.itop.links.php | 7 +- .../links/nl.dictionary.itop.links.php | 7 +- .../links/pl.dictionary.itop.links.php | 7 +- .../links/pt_br.dictionary.itop.links.php | 7 +- .../links/ru.dictionary.itop.links.php | 7 +- .../links/sk.dictionary.itop.links.php | 7 +- .../links/tr.dictionary.itop.links.php | 7 +- .../links/zh_cn.dictionary.itop.links.php | 5 +- .../newsroom/cs.dictionary.itop.newsroom.php | 5 +- .../newsroom/da.dictionary.itop.newsroom.php | 5 +- .../newsroom/de.dictionary.itop.newsroom.php | 5 +- .../newsroom/en.dictionary.itop.newsroom.php | 9 +- .../en_gb.dictionary.itop.newsroom.php | 9 +- .../es_cr.dictionary.itop.newsroom.php | 5 +- .../newsroom/fr.dictionary.itop.newsroom.php | 7 +- .../newsroom/hu.dictionary.itop.newsroom.php | 5 +- .../newsroom/it.dictionary.itop.newsroom.php | 5 +- .../newsroom/ja.dictionary.itop.newsroom.php | 5 +- .../newsroom/nl.dictionary.itop.newsroom.php | 5 +- .../newsroom/pl.dictionary.itop.newsroom.php | 5 +- .../pt_br.dictionary.itop.newsroom.php | 5 +- .../newsroom/ru.dictionary.itop.newsroom.php | 5 +- .../newsroom/sk.dictionary.itop.newsroom.php | 5 +- .../newsroom/tr.dictionary.itop.newsroom.php | 5 +- .../zh_cn.dictionary.itop.newsroom.php | 5 +- .../object/cs.dictionary.itop.object.php | 7 +- .../object/da.dictionary.itop.object.php | 7 +- .../object/de.dictionary.itop.object.php | 7 +- .../object/en.dictionary.itop.object.php | 5 +- .../object/en_gb.dictionary.itop.object.php | 5 +- .../object/es_cr.dictionary.itop.object.php | 7 +- .../object/fr.dictionary.itop.object.php | 7 +- .../object/hu.dictionary.itop.object.php | 7 +- .../object/it.dictionary.itop.object.php | 7 +- .../object/ja.dictionary.itop.object.php | 7 +- .../object/nl.dictionary.itop.object.php | 7 +- .../object/pl.dictionary.itop.object.php | 7 +- .../object/pt_br.dictionary.itop.object.php | 7 +- .../object/ru.dictionary.itop.object.php | 7 +- .../object/sk.dictionary.itop.object.php | 7 +- .../object/tr.dictionary.itop.object.php | 7 +- .../object/zh_cn.dictionary.itop.object.php | 5 +- .../cs.dictionary.itop.welcome-popup.php | 1 + .../da.dictionary.itop.welcome-popup.php | 1 + .../de.dictionary.itop.welcome-popup.php | 1 + .../en.dictionary.itop.welcome-popup.php | 11 +- .../en_gb.dictionary.itop.welcome-popup.php | 11 +- .../es_cr.dictionary.itop.welcome-popup.php | 3 +- .../fr.dictionary.itop.welcome-popup.php | 3 +- .../hu.dictionary.itop.welcome-popup.php | 1 + .../it.dictionary.itop.welcome-popup.php | 1 + .../ja.dictionary.itop.welcome-popup.php | 1 + .../nl.dictionary.itop.welcome-popup.php | 1 + .../pl.dictionary.itop.welcome-popup.php | 1 + .../pt_br.dictionary.itop.welcome-popup.php | 1 + .../ru.dictionary.itop.welcome-popup.php | 1 + .../sk.dictionary.itop.welcome-popup.php | 1 + .../tr.dictionary.itop.welcome-popup.php | 1 + .../zh_cn.dictionary.itop.welcome-popup.php | 1 + .../cs.dictionary.itop.breadcrumbs.php | 7 +- .../da.dictionary.itop.breadcrumbs.php | 7 +- .../de.dictionary.itop.breadcrumbs.php | 7 +- .../en.dictionary.itop.breadcrumbs.php | 5 +- .../en_gb.dictionary.itop.breadcrumbs.php | 5 +- .../es_cr.dictionary.itop.breadcrumbs.php | 7 +- .../fr.dictionary.itop.breadcrumbs.php | 7 +- .../hu.dictionary.itop.breadcrumbs.php | 7 +- .../it.dictionary.itop.breadcrumbs.php | 7 +- .../ja.dictionary.itop.breadcrumbs.php | 7 +- .../nl.dictionary.itop.breadcrumbs.php | 7 +- .../pl.dictionary.itop.breadcrumbs.php | 7 +- .../pt_br.dictionary.itop.breadcrumbs.php | 7 +- .../ru.dictionary.itop.breadcrumbs.php | 7 +- .../sk.dictionary.itop.breadcrumbs.php | 7 +- .../tr.dictionary.itop.breadcrumbs.php | 7 +- .../zh_cn.dictionary.itop.breadcrumbs.php | 5 +- .../cs.dictionary.itop.datatable.php | 7 +- .../da.dictionary.itop.datatable.php | 7 +- .../de.dictionary.itop.datatable.php | 7 +- .../en.dictionary.itop.datatable.php | 5 +- .../en_gb.dictionary.itop.datatable.php | 5 +- .../es_cr.dictionary.itop.datatable.php | 7 +- .../fr.dictionary.itop.datatable.php | 7 +- .../hu.dictionary.itop.datatable.php | 7 +- .../it.dictionary.itop.datatable.php | 7 +- .../ja.dictionary.itop.datatable.php | 7 +- .../nl.dictionary.itop.datatable.php | 7 +- .../pl.dictionary.itop.datatable.php | 7 +- .../pt_br.dictionary.itop.datatable.php | 7 +- .../ru.dictionary.itop.datatable.php | 7 +- .../sk.dictionary.itop.datatable.php | 7 +- .../tr.dictionary.itop.datatable.php | 7 +- .../zh_cn.dictionary.itop.datatable.php | 5 +- .../field/cs.dictionary.itop.field.php | 7 +- .../field/da.dictionary.itop.field.php | 7 +- .../field/de.dictionary.itop.field.php | 7 +- .../field/en.dictionary.itop.field.php | 5 +- .../field/en_gb.dictionary.itop.field.php | 5 +- .../field/es_cr.dictionary.itop.field.php | 7 +- .../field/fr.dictionary.itop.field.php | 7 +- .../field/hu.dictionary.itop.field.php | 7 +- .../field/it.dictionary.itop.field.php | 7 +- .../field/ja.dictionary.itop.field.php | 7 +- .../field/nl.dictionary.itop.field.php | 7 +- .../field/pl.dictionary.itop.field.php | 7 +- .../field/pt_br.dictionary.itop.field.php | 7 +- .../field/ru.dictionary.itop.field.php | 7 +- .../field/sk.dictionary.itop.field.php | 7 +- .../field/tr.dictionary.itop.field.php | 7 +- .../field/zh_cn.dictionary.itop.field.php | 5 +- .../cs.dictionary.itop.global-search.php | 7 +- .../da.dictionary.itop.global-search.php | 7 +- .../de.dictionary.itop.global-search.php | 7 +- .../en.dictionary.itop.global-search.php | 5 +- .../en_gb.dictionary.itop.global-search.php | 5 +- .../es_cr.dictionary.itop.global-search.php | 7 +- .../fr.dictionary.itop.global-search.php | 7 +- .../hu.dictionary.itop.global-search.php | 7 +- .../it.dictionary.itop.global-search.php | 7 +- .../ja.dictionary.itop.global-search.php | 7 +- .../nl.dictionary.itop.global-search.php | 7 +- .../pl.dictionary.itop.global-search.php | 7 +- .../pt_br.dictionary.itop.global-search.php | 7 +- .../ru.dictionary.itop.global-search.php | 7 +- .../sk.dictionary.itop.global-search.php | 7 +- .../tr.dictionary.itop.global-search.php | 7 +- .../zh_cn.dictionary.itop.global-search.php | 5 +- .../input/cs.dictionary.itop.input.php | 7 +- .../input/da.dictionary.itop.input.php | 7 +- .../input/de.dictionary.itop.input.php | 7 +- .../input/en.dictionary.itop.input.php | 5 +- .../input/en_gb.dictionary.itop.input.php | 5 +- .../input/es_cr.dictionary.itop.input.php | 7 +- .../input/fr.dictionary.itop.input.php | 7 +- .../input/hu.dictionary.itop.input.php | 7 +- .../input/it.dictionary.itop.input.php | 7 +- .../input/ja.dictionary.itop.input.php | 7 +- .../input/nl.dictionary.itop.input.php | 7 +- .../input/pl.dictionary.itop.input.php | 7 +- .../input/pt_br.dictionary.itop.input.php | 7 +- .../input/ru.dictionary.itop.input.php | 7 +- .../input/sk.dictionary.itop.input.php | 7 +- .../input/tr.dictionary.itop.input.php | 7 +- .../input/zh_cn.dictionary.itop.input.php | 5 +- .../modal/cs.dictionary.itop.modal.php | 7 +- .../modal/da.dictionary.itop.modal.php | 7 +- .../modal/de.dictionary.itop.modal.php | 7 +- .../modal/en.dictionary.itop.modal.php | 5 +- .../modal/en_gb.dictionary.itop.modal.php | 5 +- .../modal/es_cr.dictionary.itop.modal.php | 7 +- .../modal/fr.dictionary.itop.modal.php | 7 +- .../modal/hu.dictionary.itop.modal.php | 7 +- .../modal/it.dictionary.itop.modal.php | 7 +- .../modal/ja.dictionary.itop.modal.php | 7 +- .../modal/nl.dictionary.itop.modal.php | 7 +- .../modal/pl.dictionary.itop.modal.php | 7 +- .../modal/pt_br.dictionary.itop.modal.php | 7 +- .../modal/ru.dictionary.itop.modal.php | 7 +- .../modal/sk.dictionary.itop.modal.php | 7 +- .../modal/tr.dictionary.itop.modal.php | 7 +- .../modal/zh_cn.dictionary.itop.modal.php | 5 +- .../cs.dictionary.itop.quick-create.php | 7 +- .../da.dictionary.itop.quick-create.php | 7 +- .../de.dictionary.itop.quick-create.php | 7 +- .../en.dictionary.itop.quick-create.php | 5 +- .../en_gb.dictionary.itop.quick-create.php | 5 +- .../es_cr.dictionary.itop.quick-create.php | 7 +- .../fr.dictionary.itop.quick-create.php | 7 +- .../hu.dictionary.itop.quick-create.php | 7 +- .../it.dictionary.itop.quick-create.php | 7 +- .../ja.dictionary.itop.quick-create.php | 7 +- .../nl.dictionary.itop.quick-create.php | 7 +- .../pl.dictionary.itop.quick-create.php | 7 +- .../pt_br.dictionary.itop.quick-create.php | 7 +- .../ru.dictionary.itop.quick-create.php | 7 +- .../sk.dictionary.itop.quick-create.php | 7 +- .../tr.dictionary.itop.quick-create.php | 7 +- .../zh_cn.dictionary.itop.quick-create.php | 7 +- .../cs.dictionary.itop.activity-panel.php | 7 +- .../da.dictionary.itop.activity-panel.php | 7 +- .../de.dictionary.itop.activity-panel.php | 7 +- .../en.dictionary.itop.activity-panel.php | 5 +- .../en_gb.dictionary.itop.activity-panel.php | 5 +- .../es_cr.dictionary.itop.activity-panel.php | 7 +- .../fr.dictionary.itop.activity-panel.php | 7 +- .../hu.dictionary.itop.activity-panel.php | 7 +- .../it.dictionary.itop.activity-panel.php | 7 +- .../ja.dictionary.itop.activity-panel.php | 7 +- .../nl.dictionary.itop.activity-panel.php | 7 +- .../pl.dictionary.itop.activity-panel.php | 7 +- .../pt_br.dictionary.itop.activity-panel.php | 7 +- .../ru.dictionary.itop.activity-panel.php | 7 +- .../sk.dictionary.itop.activity-panel.php | 7 +- .../tr.dictionary.itop.activity-panel.php | 7 +- .../zh_cn.dictionary.itop.activity-panel.php | 5 +- .../cs.dictionary.itop.navigation-menu.php | 7 +- .../da.dictionary.itop.navigation-menu.php | 7 +- .../de.dictionary.itop.navigation-menu.php | 7 +- .../en.dictionary.itop.navigation-menu.php | 5 +- .../en_gb.dictionary.itop.navigation-menu.php | 5 +- .../es_cr.dictionary.itop.navigation-menu.php | 7 +- .../fr.dictionary.itop.navigation-menu.php | 7 +- .../hu.dictionary.itop.navigation-menu.php | 7 +- .../it.dictionary.itop.navigation-menu.php | 7 +- .../ja.dictionary.itop.navigation-menu.php | 7 +- .../nl.dictionary.itop.navigation-menu.php | 7 +- .../pl.dictionary.itop.navigation-menu.php | 7 +- .../pt_br.dictionary.itop.navigation-menu.php | 7 +- .../ru.dictionary.itop.navigation-menu.php | 7 +- .../sk.dictionary.itop.navigation-menu.php | 7 +- .../tr.dictionary.itop.navigation-menu.php | 7 +- .../zh_cn.dictionary.itop.navigation-menu.php | 5 +- .../cs.dictionary.itop.object-details.php | 3 +- .../da.dictionary.itop.object-details.php | 3 +- .../de.dictionary.itop.object-details.php | 3 +- .../en.dictionary.itop.object-details.php | 1 + .../en_gb.dictionary.itop.object-details.php | 1 + .../es_cr.dictionary.itop.object-details.php | 3 +- .../fr.dictionary.itop.object-details.php | 3 +- .../hu.dictionary.itop.object-details.php | 3 +- .../it.dictionary.itop.object-details.php | 3 +- .../ja.dictionary.itop.object-details.php | 3 +- .../nl.dictionary.itop.object-details.php | 3 +- .../pl.dictionary.itop.object-details.php | 3 +- .../pt_br.dictionary.itop.object-details.php | 3 +- .../ru.dictionary.itop.object-details.php | 3 +- .../sk.dictionary.itop.object-details.php | 3 +- .../tr.dictionary.itop.object-details.php | 3 +- .../zh_cn.dictionary.itop.object-details.php | 1 + .../cs.dictionary.itop.page-content.php | 3 +- .../da.dictionary.itop.page-content.php | 3 +- .../de.dictionary.itop.page-content.php | 3 +- .../en.dictionary.itop.page-content.php | 1 + .../en_gb.dictionary.itop.page-content.php | 1 + .../es_cr.dictionary.itop.page-content.php | 3 +- .../fr.dictionary.itop.page-content.php | 3 +- .../hu.dictionary.itop.page-content.php | 3 +- .../it.dictionary.itop.page-content.php | 3 +- .../ja.dictionary.itop.page-content.php | 3 +- .../nl.dictionary.itop.page-content.php | 3 +- .../pl.dictionary.itop.page-content.php | 3 +- .../pt_br.dictionary.itop.page-content.php | 3 +- .../ru.dictionary.itop.page-content.php | 3 +- .../sk.dictionary.itop.page-content.php | 3 +- .../tr.dictionary.itop.page-content.php | 3 +- .../zh_cn.dictionary.itop.page-content.php | 1 + .../cs.dictionary.itop.tab-container.php | 3 +- .../da.dictionary.itop.tab-container.php | 3 +- .../de.dictionary.itop.tab-container.php | 3 +- .../en.dictionary.itop.tab-container.php | 1 + .../en_gb.dictionary.itop.tab-container.php | 1 + .../es_cr.dictionary.itop.tab-container.php | 3 +- .../fr.dictionary.itop.tab-container.php | 3 +- .../hu.dictionary.itop.tab-container.php | 3 +- .../it.dictionary.itop.tab-container.php | 3 +- .../ja.dictionary.itop.tab-container.php | 3 +- .../nl.dictionary.itop.tab-container.php | 3 +- .../pl.dictionary.itop.tab-container.php | 3 +- .../pt_br.dictionary.itop.tab-container.php | 3 +- .../ru.dictionary.itop.tab-container.php | 3 +- .../sk.dictionary.itop.tab-container.php | 3 +- .../tr.dictionary.itop.tab-container.php | 3 +- .../zh_cn.dictionary.itop.tab-container.php | 1 + .../cs.dictionary.itop.ui-content-block.php | 3 +- .../da.dictionary.itop.ui-content-block.php | 3 +- .../de.dictionary.itop.ui-content-block.php | 3 +- .../en.dictionary.itop.ui-content-block.php | 1 + ...en_gb.dictionary.itop.ui-content-block.php | 1 + ...es_cr.dictionary.itop.ui-content-block.php | 3 +- .../fr.dictionary.itop.ui-content-block.php | 3 +- .../hu.dictionary.itop.ui-content-block.php | 3 +- .../it.dictionary.itop.ui-content-block.php | 3 +- .../ja.dictionary.itop.ui-content-block.php | 3 +- .../nl.dictionary.itop.ui-content-block.php | 3 +- .../pl.dictionary.itop.ui-content-block.php | 3 +- ...pt_br.dictionary.itop.ui-content-block.php | 3 +- .../ru.dictionary.itop.ui-content-block.php | 3 +- .../sk.dictionary.itop.ui-content-block.php | 3 +- .../tr.dictionary.itop.ui-content-block.php | 3 +- ...zh_cn.dictionary.itop.ui-content-block.php | 1 + .../cs.dictionary.itop.errorpage.php | 7 +- .../da.dictionary.itop.errorpage.php | 7 +- .../de.dictionary.itop.errorpage.php | 7 +- .../en.dictionary.itop.errorpage.php | 5 +- .../en_gb.dictionary.itop.errorpage.php | 5 +- .../es_cr.dictionary.itop.errorpage.php | 7 +- .../fr.dictionary.itop.errorpage.php | 7 +- .../hu.dictionary.itop.errorpage.php | 7 +- .../it.dictionary.itop.errorpage.php | 7 +- .../ja.dictionary.itop.errorpage.php | 7 +- .../nl.dictionary.itop.errorpage.php | 7 +- .../pl.dictionary.itop.errorpage.php | 7 +- .../pt_br.dictionary.itop.errorpage.php | 7 +- .../ru.dictionary.itop.errorpage.php | 7 +- .../sk.dictionary.itop.errorpage.php | 7 +- .../tr.dictionary.itop.errorpage.php | 7 +- .../zh_cn.dictionary.itop.errorpage.php | 5 +- ...s.dictionary.itop.notifications-center.php | 5 +- ...a.dictionary.itop.notifications-center.php | 5 +- ...e.dictionary.itop.notifications-center.php | 5 +- ...n.dictionary.itop.notifications-center.php | 5 +- ...b.dictionary.itop.notifications-center.php | 5 +- ...r.dictionary.itop.notifications-center.php | 5 +- ...r.dictionary.itop.notifications-center.php | 7 +- ...u.dictionary.itop.notifications-center.php | 5 +- ...t.dictionary.itop.notifications-center.php | 5 +- ...a.dictionary.itop.notifications-center.php | 5 +- ...l.dictionary.itop.notifications-center.php | 5 +- ...l.dictionary.itop.notifications-center.php | 5 +- ...r.dictionary.itop.notifications-center.php | 5 +- ...u.dictionary.itop.notifications-center.php | 5 +- ...k.dictionary.itop.notifications-center.php | 5 +- ...r.dictionary.itop.notifications-center.php | 5 +- ...n.dictionary.itop.notifications-center.php | 5 +- .../cs.dictionary.itop.oauth.landing.php | 5 +- .../da.dictionary.itop.oauth.landing.php | 5 +- .../de.dictionary.itop.oauth.landing.php | 5 +- .../en.dictionary.itop.oauth.landing.php | 5 +- .../en_gb.dictionary.itop.oauth.landing.php | 5 +- .../es_cr.dictionary.itop.oauth.landing.php | 7 +- .../fr.dictionary.itop.oauth.landing.php | 7 +- .../hu.dictionary.itop.oauth.landing.php | 5 +- .../it.dictionary.itop.oauth.landing.php | 5 +- .../ja.dictionary.itop.oauth.landing.php | 5 +- .../nl.dictionary.itop.oauth.landing.php | 5 +- .../pl.dictionary.itop.oauth.landing.php | 5 +- .../pt_br.dictionary.itop.oauth.landing.php | 5 +- .../ru.dictionary.itop.oauth.landing.php | 5 +- .../sk.dictionary.itop.oauth.landing.php | 5 +- .../tr.dictionary.itop.oauth.landing.php | 5 +- .../zh_cn.dictionary.itop.oauth.landing.php | 5 +- .../cs.dictionary.itop.preferences.php | 9 +- .../da.dictionary.itop.preferences.php | 9 +- .../de.dictionary.itop.preferences.php | 9 +- .../en.dictionary.itop.preferences.php | 7 +- .../en_gb.dictionary.itop.preferences.php | 7 +- .../es_cr.dictionary.itop.preferences.php | 9 +- .../fr.dictionary.itop.preferences.php | 9 +- .../hu.dictionary.itop.preferences.php | 9 +- .../it.dictionary.itop.preferences.php | 9 +- .../ja.dictionary.itop.preferences.php | 9 +- .../nl.dictionary.itop.preferences.php | 9 +- .../pl.dictionary.itop.preferences.php | 9 +- .../pt_br.dictionary.itop.preferences.php | 9 +- .../ru.dictionary.itop.preferences.php | 9 +- .../sk.dictionary.itop.preferences.php | 9 +- .../tr.dictionary.itop.preferences.php | 9 +- .../zh_cn.dictionary.itop.preferences.php | 7 +- dictionaries/zh_cn.dictionary.itop.core.php | 186 +- dictionaries/zh_cn.dictionary.itop.ui.php | 91 +- index.php | 30 +- log/index.php | 1 + pages/UI.php | 1429 +++--- pages/UniversalSearch.php | 41 +- pages/ajax.csvimport.php | 81 +- pages/ajax.document.php | 32 +- pages/ajax.render.php | 435 +- pages/ajax.searchform.php | 55 +- pages/audit.php | 328 +- pages/csvimport.php | 229 +- pages/exec.php | 4 +- pages/graphviz.php | 64 +- pages/index.php | 2 +- pages/logoff.php | 36 +- pages/notifications.php | 23 +- pages/oauth.landing.php | 1 - pages/preferences.php | 189 +- pages/run_query.php | 93 +- pages/schema.php | 411 +- pages/tagadmin.php | 47 +- portal/index.php | 26 +- resources/symfony/config/bundles.php | 8 +- .../packages/itop_configuration_bridge.php | 1 + resources/symfony/config/preload.php | 4 +- setup/ajax.dataloader.php | 122 +- setup/applicationinstaller.class.inc.php | 428 +- setup/appupgradecopy.php | 5 +- setup/backup.class.inc.php | 183 +- setup/compat/domcompat.php | 25 +- setup/compiler.class.inc.php | 1424 +++--- setup/email.test.php | 209 +- setup/extensionsmap.class.inc.php | 1721 ++++--- setup/index.php | 2 +- setup/itopdesignformat.class.inc.php | 296 +- setup/modelfactory.class.inc.php | 705 ++- setup/modulediscovery.class.inc.php | 265 +- setup/moduleinstallation.class.inc.php | 64 +- setup/moduleinstaller.class.inc.php | 179 +- setup/parameters.class.inc.php | 150 +- setup/phpcheck.php | 3 +- setup/phpinfo.php | 2 +- setup/setuppage.class.inc.php | 41 +- setup/setuputils.class.inc.php | 841 ++-- .../InstallationFileService.php | 131 +- .../unattended-install/unattended-install.php | 190 +- setup/wizard.php | 7 +- setup/wizardcontroller.class.inc.php | 182 +- setup/wizardsteps.class.inc.php | 880 ++-- setup/xmldataloader.class.inc.php | 248 +- sources/Application/Branding.php | 5 +- .../EventRegister/ApplicationEvents.php | 8 +- sources/Application/Helper/CKEditorHelper.php | 88 +- sources/Application/Helper/ExportHelper.php | 3 +- sources/Application/Helper/FormHelper.php | 43 +- sources/Application/Helper/Session.php | 2 +- .../Application/Helper/WebResourcesHelper.php | 4 +- .../Newsroom/iTopNewsroomProvider.php | 11 +- .../criteriontooql.class.inc.php | 233 +- .../criteriontosearchform.class.inc.php | 357 +- .../Search/ajaxsearchexception.class.inc.php | 5 +- .../criterionconversionabstract.class.inc.php | 29 +- .../Search/criterionparser.class.inc.php | 36 +- .../Search/searchform.class.inc.php | 380 +- sources/Application/Status/Status.php | 3 +- .../TwigBase/Controller/Controller.php | 113 +- .../Application/TwigBase/Twig/Extension.php | 47 +- .../Application/TwigBase/Twig/TwigHelper.php | 11 +- .../TwigBase/UI/UIBlockExtension.php | 5 +- .../Application/TwigBase/UI/UIBlockNode.php | 5 +- .../Application/TwigBase/UI/UIBlockParser.php | 7 +- .../UI/Base/AbstractUIBlockFactory.php | 5 +- .../UI/Base/Component/Alert/Alert.php | 9 +- .../Component/Alert/AlertUIBlockFactory.php | 3 +- .../Component/Breadcrumbs/Breadcrumbs.php | 7 +- .../UI/Base/Component/Button/Button.php | 6 +- .../UI/Base/Component/Button/ButtonJS.php | 31 +- .../Component/Button/ButtonUIBlockFactory.php | 117 +- .../UI/Base/Component/Button/ButtonURL.php | 42 +- .../Component/ButtonGroup/ButtonGroup.php | 4 +- .../ButtonGroup/ButtonGroupUIBlockFactory.php | 3 +- .../CollapsibleSection/CollapsibleSection.php | 4 +- .../CollapsibleSectionUIBlockFactory.php | 5 +- .../Base/Component/Dashlet/DashletBadge.php | 20 +- .../Component/Dashlet/DashletContainer.php | 5 +- .../Base/Component/Dashlet/DashletFactory.php | 5 +- .../Component/Dashlet/DashletHeaderStatic.php | 6 +- .../Component/Dashlet/DashletPlainText.php | 5 +- .../UI/Base/Component/DataTable/DataTable.php | 12 +- .../DataTableConfig/DataTableConfig.php | 2 +- .../Component/DataTable/DataTableSettings.php | 656 +-- .../DataTable/DataTableUIBlockFactory.php | 134 +- .../StaticTable/FormTable/FormTable.php | 4 +- .../StaticTable/FormTableRow/FormTableRow.php | 4 +- .../DataTable/StaticTable/StaticTable.php | 2 +- .../Component/DataTable/tTableRowActions.php | 5 +- .../UI/Base/Component/Field/Field.php | 4 +- .../Component/Field/FieldUIBlockFactory.php | 4 +- .../Base/Component/FieldBadge/FieldBadge.php | 4 +- .../FieldBadge/FieldBadgeUIBlockFactory.php | 5 +- .../UI/Base/Component/FieldSet/FieldSet.php | 6 +- .../FieldSet/FieldSetUIBlockFactory.php | 5 +- .../UI/Base/Component/Form/Form.php | 4 +- .../Component/Form/FormUIBlockFactory.php | 5 +- .../Component/GlobalSearch/GlobalSearch.php | 4 +- .../GlobalSearch/GlobalSearchFactory.php | 4 +- .../GlobalSearch/GlobalSearchHelper.php | 27 +- .../UI/Base/Component/Html/Html.php | 4 +- .../UI/Base/Component/Html/HtmlFactory.php | 4 +- .../UI/Base/Component/Input/AbstractInput.php | 4 +- .../Component/Input/FileSelect/FileSelect.php | 7 +- .../FileSelect/FileSelectUIBlockFactory.php | 5 +- .../UI/Base/Component/Input/Input.php | 6 +- .../Component/Input/InputUIBlockFactory.php | 15 +- .../Base/Component/Input/InputWithLabel.php | 5 +- .../Component/Input/RichText/RichText.php | 7 +- .../UI/Base/Component/Input/Select/Select.php | 6 +- .../Component/Input/Select/SelectOption.php | 9 +- .../Select/SelectOptionUIBlockFactory.php | 5 +- .../Input/Select/SelectUIBlockFactory.php | 5 +- .../Set/DataProvider/AbstractDataProvider.php | 4 +- .../Set/DataProvider/AjaxDataProvider.php | 6 +- .../DataProvider/AjaxDataProviderForOQL.php | 4 +- .../Set/DataProvider/SimpleDataProvider.php | 3 +- .../Input/Set/DataProvider/iDataProvider.php | 3 +- .../UI/Base/Component/Input/Set/Set.php | 4 +- .../Component/Input/Set/SetUIBlockFactory.php | 3 +- .../UI/Base/Component/Input/TextArea.php | 5 +- .../UI/Base/Component/Input/Toggler.php | 11 +- .../UI/Base/Component/Input/tInputLabel.php | 4 +- .../Component/MedallionIcon/MedallionIcon.php | 10 +- .../Modal/DoNotShowAgainOptionBlock.php | 3 +- .../UI/Base/Component/Panel/Panel.php | 32 +- .../Component/Panel/PanelUIBlockFactory.php | 3 +- .../UI/Base/Component/Pill/Pill.php | 5 +- .../UI/Base/Component/Pill/PillFactory.php | 5 +- .../PopoverMenu/NewsroomMenu/NewsroomMenu.php | 4 +- .../NewsroomMenu/NewsroomMenuFactory.php | 25 +- .../Component/PopoverMenu/PopoverMenu.php | 24 +- .../PopoverMenu/PopoverMenuFactory.php | 28 +- .../PopoverMenuItem/JsPopoverMenuItem.php | 6 +- .../PopoverMenuItem/PopoverMenuItem.php | 10 +- .../PopoverMenuItemFactory.php | 16 +- .../SeparatorPopoverMenuItem.php | 4 +- .../PopoverMenuItem/UrlPopoverMenuItem.php | 6 +- .../Component/QuickCreate/QuickCreate.php | 12 +- .../QuickCreate/QuickCreateFactory.php | 4 +- .../QuickCreate/QuickCreateHelper.php | 28 +- .../UI/Base/Component/Spinner/Spinner.php | 10 +- .../Spinner/SpinnerUIBlockFactory.php | 7 +- .../UI/Base/Component/Template/Template.php | 1 + .../Template/TemplateUIBlockFactory.php | 3 +- .../UI/Base/Component/Text/Text.php | 5 +- .../UI/Base/Component/Title/Title.php | 4 +- .../Component/Title/TitleUIBlockFactory.php | 13 +- .../Toolbar/Separator/AbstractSeparator.php | 4 +- .../ToolbarSeparatorUIBlockFactory.php | 5 +- .../Toolbar/Separator/VerticalSeparator.php | 4 +- .../UI/Base/Component/Toolbar/Toolbar.php | 4 +- .../Toolbar/ToolbarSpacer/ToolbarSpacer.php | 4 +- .../ToolbarSpacerUIBlockFactory.php | 5 +- .../Toolbar/ToolbarUIBlockFactory.php | 5 +- .../ActivityEntry/ActivityEntry.php | 6 +- .../ActivityEntry/ActivityEntryFactory.php | 6 +- .../CMDBChangeOpAttachmentAddedFactory.php | 4 +- .../CMDBChangeOpAttachmentRemovedFactory.php | 4 +- .../CMDBChangeOpCreateFactory.php | 7 +- .../CMDBChangeOpDeleteFactory.php | 7 +- .../CMDBChangeOp/CMDBChangeOpFactory.php | 10 +- .../CMDBChangeOpSetAttributeFactory.php | 4 +- .../CMDBChangeOpSetAttributeScalarFactory.php | 8 +- .../ActivityEntry/CaseLogEntry.php | 14 +- .../ActivityEntry/EditsEntry.php | 13 +- .../EventNotificationEmailFactory.php | 4 +- .../EventNotificationFactory.php | 4 +- .../ActivityEntry/NotificationEntry.php | 4 +- .../ActivityEntry/TransitionEntry.php | 10 +- .../Layout/ActivityPanel/ActivityPanel.php | 72 +- .../ActivityPanel/ActivityPanelFactory.php | 10 +- .../ActivityPanel/ActivityPanelHelper.php | 11 +- .../ActivityPanel/ActivityPanelPrint.php | 3 +- .../CaseLogEntryForm/CaseLogEntryForm.php | 8 +- .../CaseLogEntryFormFactory.php | 10 +- .../Base/Layout/Dashboard/DashboardColumn.php | 5 +- .../Base/Layout/Dashboard/DashboardLayout.php | 4 +- .../UI/Base/Layout/Dashboard/DashboardRow.php | 4 +- .../Base/Layout/MultiColumn/Column/Column.php | 7 +- .../Column/ColumnUIBlockFactory.php | 5 +- .../Base/Layout/MultiColumn/MultiColumn.php | 4 +- .../MultiColumn/MultiColumnUIBlockFactory.php | 2 +- .../Layout/NavigationMenu/NavigationMenu.php | 61 +- .../NavigationMenu/NavigationMenuFactory.php | 16 +- .../UI/Base/Layout/Object/ObjectDetails.php | 8 +- .../UI/Base/Layout/Object/ObjectFactory.php | 4 +- .../UI/Base/Layout/Object/ObjectSummary.php | 47 +- .../Base/Layout/PageContent/PageContent.php | 35 +- .../Layout/PageContent/PageContentFactory.php | 4 +- .../PageContentWithSideContent.php | 22 +- .../Base/Layout/TabContainer/Tab/AjaxTab.php | 36 +- .../UI/Base/Layout/TabContainer/Tab/Tab.php | 2 +- .../Base/Layout/TabContainer/TabContainer.php | 21 +- .../UI/Base/Layout/TopBar/TopBar.php | 9 +- .../UI/Base/Layout/TopBar/TopBarFactory.php | 4 +- .../UI/Base/Layout/UIContentBlock.php | 5 +- .../Layout/UIContentBlockUIBlockFactory.php | 5 +- .../UIContentBlockWithJSRefreshCallback .php | 1 + .../UI/Base/Layout/iUIContentBlock.php | 5 +- sources/Application/UI/Base/UIBlock.php | 16 +- sources/Application/UI/Base/UIException.php | 3 +- sources/Application/UI/Base/iUIBlock.php | 5 +- .../Application/UI/Base/iUIBlockFactory.php | 5 +- .../UI/Base/tJSRefreshCallback.php | 2 +- .../Application/UI/Base/tUIContentAreas.php | 16 +- .../UI/DisplayBlock/BlockChart/BlockChart.php | 7 +- .../BlockChartAjaxBars/BlockChartAjaxBars.php | 4 +- .../BlockChartAjaxPie/BlockChartAjaxPie.php | 4 +- .../UI/DisplayBlock/BlockCsv/BlockCsv.php | 4 +- .../UI/DisplayBlock/BlockList/BlockList.php | 4 +- sources/Application/UI/Helper/UIHelper.php | 5 +- .../Application/UI/Hook/iKeyboardShortcut.php | 2 +- .../Links/AbstractBlockLinkSetViewTable.php | 25 +- .../Direct/BlockDirectLinkSetEditTable.php | 78 +- .../Direct/BlockDirectLinkSetViewTable.php | 89 +- .../BlockIndirectLinkSetEditTable.php | 88 +- .../BlockIndirectLinkSetViewTable.php | 22 +- .../Indirect/BlockObjectPickerDialog.php | 3 +- .../Set/BlockLinkSetDisplayAsProperty.php | 6 +- .../UI/Links/Set/LinkSetUIBlockFactory.php | 4 +- .../BlockShortcuts/BlockShortcuts.php | 4 +- .../BlockPrintHeader/BlockPrintHeader.php | 4 +- sources/Application/WebPage/AjaxPage.php | 11 +- .../Application/WebPage/CLILikeWebPage.php | 3 +- sources/Application/WebPage/CLIPage.php | 54 +- sources/Application/WebPage/CSVPage.php | 83 +- .../Application/WebPage/CaptureWebPage.php | 10 +- sources/Application/WebPage/DownloadPage.php | 1 + sources/Application/WebPage/ErrorPage.php | 6 +- sources/Application/WebPage/JsonPPage.php | 5 +- sources/Application/WebPage/JsonPage.php | 5 +- sources/Application/WebPage/NiceWebPage.php | 34 +- sources/Application/WebPage/PDFPage.php | 10 +- sources/Application/WebPage/Page.php | 3 +- sources/Application/WebPage/TabManager.php | 8 +- .../WebPage/UnauthenticatedWebPage.php | 45 +- sources/Application/WebPage/WebPage.php | 177 +- sources/Application/WebPage/XMLPage.php | 27 +- sources/Application/WebPage/iTopPDF.php | 49 +- sources/Application/WebPage/iTopWebPage.php | 105 +- .../Application/WebPage/iTopWizardWebPage.php | 48 +- sources/Application/WelcomePopup/Message.php | 7 +- .../WelcomePopup/MessageFactory.php | 7 +- .../WelcomePopup/Provider/DefaultProvider.php | 22 +- .../WelcomePopup/WelcomePopupService.php | 41 +- sources/Controller/AbstractAppController.php | 5 +- sources/Controller/AbstractController.php | 3 +- sources/Controller/AjaxRenderController.php | 110 +- .../Base/Layout/ActivityPanelController.php | 4 +- .../Base/Layout/ObjectController.php | 253 +- .../Controller/Links/LinkSetController.php | 41 +- .../Newsroom/iTopNewsroomController.php | 93 +- .../Notifications/ActionController.php | 8 +- .../NotificationsCenterController.php | 52 +- .../OAuth/OAuthLandingController.php | 2 +- sources/Controller/PreferencesController.php | 7 +- .../TemporaryObjectController.php | 3 +- sources/Controller/WelcomePopupController.php | 7 +- sources/Controller/iController.php | 1 + .../Client/OAuth/IOAuthClientProvider.php | 6 +- .../OAuth/OAuthClientProviderAbstract.php | 4 +- .../Client/OAuth/OAuthClientProviderAzure.php | 4 +- .../OAuth/OAuthClientProviderFactory.php | 2 +- .../OAuth/OAuthClientProviderGoogle.php | 4 +- sources/Core/CMDBChange/CMDBChangeOrigin.php | 4 +- sources/Core/Email/EmailFactory.php | 2 +- sources/Core/Email/EmailSymfony.php | 85 +- .../Email/Transport/SymfonyFileTransport.php | 3 +- .../Email/Transport/SymfonyOAuthTransport.php | 12 +- .../Transport/SymfonyPHPMailTransport.php | 9 +- sources/Core/Email/iEMail.php | 4 +- .../AttributeBlobEventListener.php | 11 +- sources/Core/Kpi/KpiLogData.php | 209 +- sources/Core/MetaModel/FriendlyNameType.php | 4 +- sources/Core/MetaModel/HierarchicalKey.php | 7 +- .../Core/Trigger/Enum/SubscriptionPolicy.php | 3 +- .../Dependencies/AbstractFolderAnalyzer.php | 20 +- .../Dependencies/Composer/iTopComposer.php | 5 +- sources/Dependencies/NPM/iTopNPM.php | 5 +- sources/Form/Field/AbstractSimpleField.php | 3 +- sources/Form/Field/BlobField.php | 9 +- sources/Form/Field/CaseLogField.php | 2 +- sources/Form/Field/CheckboxField.php | 4 +- sources/Form/Field/DateField.php | 3 +- sources/Form/Field/DateTimeField.php | 17 +- sources/Form/Field/DurationField.php | 3 +- sources/Form/Field/EmailField.php | 23 +- sources/Form/Field/Field.php | 122 +- sources/Form/Field/FileUploadField.php | 12 +- sources/Form/Field/HiddenField.php | 4 +- sources/Form/Field/ImageField.php | 9 +- sources/Form/Field/LabelField.php | 3 +- sources/Form/Field/LinkedSetField.php | 44 +- sources/Form/Field/MultipleChoicesField.php | 114 +- sources/Form/Field/MultipleSelectField.php | 4 +- sources/Form/Field/PasswordField.php | 3 +- sources/Form/Field/PhoneField.php | 23 +- sources/Form/Field/RadioField.php | 4 +- sources/Form/Field/SelectField.php | 23 +- sources/Form/Field/SelectObjectField.php | 19 +- sources/Form/Field/SetField.php | 3 +- sources/Form/Field/StringField.php | 3 +- sources/Form/Field/SubFormField.php | 84 +- sources/Form/Field/TagSetField.php | 3 +- sources/Form/Field/TextAreaField.php | 21 +- sources/Form/Field/TextField.php | 3 +- sources/Form/Field/UrlField.php | 61 +- sources/Form/Form.php | 314 +- sources/Form/FormManager.php | 42 +- sources/Form/Helper/FieldHelper.php | 9 +- .../Validator/AbstractRegexpValidator.php | 43 +- sources/Form/Validator/AbstractValidator.php | 6 +- .../Form/Validator/CustomRegexpValidator.php | 3 +- sources/Form/Validator/IntegerValidator.php | 2 +- sources/Form/Validator/LinkedSetValidator.php | 70 +- sources/Form/Validator/MandatoryValidator.php | 2 +- .../Validator/MultipleChoicesValidator.php | 79 +- .../Validator/NotEmptyExtKeyValidator.php | 2 +- .../Form/Validator/SelectObjectValidator.php | 49 +- sources/Form/Validator/Validator.php | 3 +- sources/Kernel.php | 9 +- sources/Renderer/BlockRenderer.php | 17 +- .../Bootstrap/BsFieldRendererMappings.php | 4 +- sources/Renderer/Bootstrap/BsFormRenderer.php | 4 +- .../FieldRenderer/BsFieldRenderer.php | 1 - .../BsFileUploadFieldRenderer.php | 63 +- .../BsLinkedSetFieldRenderer.php | 86 +- .../BsSelectObjectFieldRenderer.php | 117 +- .../FieldRenderer/BsSetFieldRenderer.php | 51 +- .../FieldRenderer/BsSimpleFieldRenderer.php | 285 +- .../FieldRenderer/BsSubFormFieldRenderer.php | 41 +- .../Renderer/Console/ConsoleBlockRenderer.php | 7 +- .../Console/ConsoleFieldRendererMappings.php | 4 +- .../Renderer/Console/ConsoleFormRenderer.php | 5 +- .../ConsoleSelectObjectFieldRenderer.php | 95 +- .../ConsoleSimpleFieldRenderer.php | 154 +- .../ConsoleSubFormFieldRenderer.php | 15 +- sources/Renderer/FieldRenderer.php | 24 +- sources/Renderer/FormRenderer.php | 216 +- sources/Renderer/RenderingOutput.php | 83 +- sources/Service/Base/ObjectRepository.php | 22 +- sources/Service/Base/iDataPostProcessor.php | 3 +- .../Service/Cache/DataModelDependantCache.php | 16 +- .../Description/EventDataDescription.php | 3 +- .../Events/Description/EventDescription.php | 3 +- sources/Service/Events/EventData.php | 2 +- sources/Service/Events/EventException.php | 4 +- sources/Service/Events/EventHelper.php | 3 +- sources/Service/Events/EventService.php | 15 +- sources/Service/Events/EventServiceLog.php | 5 +- sources/Service/Events/iEventServiceSetup.php | 3 +- .../Service/Import/CSVImportPageProcessor.php | 69 +- .../InterfaceDiscovery/InterfaceDiscovery.php | 21 +- .../Service/Links/LinkSetDataTransformer.php | 17 +- sources/Service/Links/LinkSetModel.php | 6 +- sources/Service/Links/LinkSetRepository.php | 9 +- .../Links/LinksBulkDataPostProcessor.php | 10 +- sources/Service/Module/ModuleService.php | 328 +- .../Event/EventNotificationNewsroomGC.php | 11 +- .../EventNotificationNewsroomService.php | 9 +- .../Notification/NotificationsRepository.php | 10 +- .../Notification/NotificationsService.php | 13 +- .../Exception/RouteNotFoundException.php | 4 +- .../Router/Exception/RouterException.php | 4 +- sources/Service/Router/Router.php | 11 +- .../SummaryCard/SummaryCardService.php | 27 +- .../TemporaryObjectConfig.php | 4 +- .../TemporaryObjects/TemporaryObjectGC.php | 3 +- .../TemporaryObjectHelper.php | 15 +- .../TemporaryObjectManager.php | 25 +- .../TemporaryObjectRepository.php | 9 +- .../TemporaryObjectsEvents.php | 9 +- sources/SessionTracker/SessionHandler.php | 66 +- .../iSessionHandlerExtension.php | 21 +- sources/alias.php | 2 +- synchro/priv_sync_chunk.php | 50 +- synchro/replica.php | 76 +- synchro/synchro_exec.php | 71 +- synchro/synchro_import.php | 469 +- synchro/synchrodatasource.class.inc.php | 1840 ++++---- .../Backoffice/RenderAllUiBlocks.php | 92 +- tests/manual-visual-tests/sanitize_test.php | 11 +- .../runClassInSeparateProcessTest.php | 16 +- .../experiments/tearDownAfterFailureTest.php | 11 +- .../CompiledDictionariesConsistencyTest.php | 10 +- .../DetectStaticPollutionTest.php | 4 +- .../DictionariesConsistencyAfterSetupTest.php | 70 +- .../DictionariesConsistencyTest.php | 113 +- .../fr.dictionary.itop.core.OK.php | 4 +- .../iTopModulesPhpVersionChecklistTest.php | 24 +- .../iTopModulesXmlVersionChecklistTest.php | 16 +- .../iTopXmlVersionChecklistTest.php | 3 +- .../itop-hub-connector/AjaxPageTest.php | 18 +- .../legacy-tests/GroupByAndFunctions.php | 132 +- .../php-unit-tests/legacy-tests/VerifyOQL.php | 138 +- .../php-unit-tests/legacy-tests/benchmark.php | 433 +- .../legacy-tests/build_test_oql.php | 33 +- .../legacy-tests/config-test-farm.php | 22 +- .../legacy-tests/replay_query_log.php | 310 +- .../legacy-tests/test.class.inc.php | 255 +- tests/php-unit-tests/legacy-tests/test.php | 71 +- .../legacy-tests/testlist.inc.php | 2502 +++++----- .../SetupCssIntegrityChecklistTest.php | 24 +- .../iTopDesignFormatChecklistTest.php | 108 +- ...iTopModuleXmlInstallationChecklistTest.php | 59 +- .../ItopCustomDatamodelTestCase.php | 24 +- .../src/BaseTestCase/ItopDataTestCase.php | 197 +- .../src/BaseTestCase/ItopTestCase.php | 111 +- .../Service/UnitTestRunTimeEnvironment.php | 117 +- .../tools/run_class_by_class.php | 6 +- .../ApplicationObjectExtensionTest.php | 6 +- .../application/DashboardLayoutTest.php | 31 +- .../application/DesignerFormFieldTest.php | 1 + .../DisplayBlock/DisplayBlockTest.php | 7 +- .../unitary-tests/application/LoginTest.php | 21 +- .../application/MenuNodeTest.php | 14 +- .../application/SCSSCompilationTest.php | 2 +- .../application/Session/SessionTest.php | 1 - .../application/ThemeHandlerTest.php | 200 +- .../UI/Base/Layout/NavigationMenuTest.php | 17 +- .../WelcomePopup/WelcomePopupTest.php | 31 +- .../ApplicationContextTest.php | 2 +- .../MockApplicationContext.php | 3 +- .../ApplicationExtensionTest.php | 3 +- ...MockApplicationObjectExtensionForTest1.php | 4 +- ...MockApplicationObjectExtensionForTest2.php | 4 +- .../application/privUITransactionFileTest.php | 18 +- .../application/query/QueryTest.php | 23 +- .../application/twigbase/ControllerTest.php | 16 +- .../application/twigbase/FakeController.php | 4 +- .../unitary-tests/application/utilsTest.php | 81 +- .../unitary-tests/core/ActionEmailTest.php | 66 +- .../core/AttributeDefinitionTest.php | 22 +- .../unitary-tests/core/AttributeImageTest.php | 3 +- .../core/AttributeURLDefaultPattern.php | 3 +- .../unitary-tests/core/AttributeURLTest.php | 5 +- .../unitary-tests/core/BulkChangeTest.php | 492 +- .../unitary-tests/core/BulkExportTest.php | 48 +- .../core/CMDBSource/CMDBSourceTest.php | 69 +- .../core/CMDBSource/DeadLockInjection.php | 6 +- .../core/CMDBSource/TransactionsTest.php | 14 +- .../unitary-tests/core/CSVParserTest.php | 38 +- .../core/DBObject/CMDBObjectTest.php | 124 +- .../core/DBObject/CRUDEventTest.php | 17 +- .../CRUDEventWithModifiedDataModelTest.php | 12 +- .../DBObject/CheckToWritePropagationTest.php | 1 + .../core/DBObject/CustomCheckToWriteTest.php | 1 + .../core/DBObject/DBObjectTest.php | 215 +- .../DBObjectWithModifiedDataModelTest.php | 8 +- .../core/DBObject/Utils/CRUDEventReceiver.php | 3 +- .../core/DBObject/Utils/ClassesWithDebug.php | 6 +- .../core/DBObject/Utils/EventTest.php | 3 +- .../core/DBSearchAddConditionPointingTo.php | 4 +- .../unitary-tests/core/DBSearchCommitTest.php | 5 +- .../core/DBSearchIntersectTest.php | 180 +- .../unitary-tests/core/DBSearchJoinTest.php | 46 +- .../unitary-tests/core/DBSearchTest.php | 511 +- .../core/DBSearchUpdateRealiasingMapTest.php | 17 +- .../unitary-tests/core/DBUnionSearchTest.php | 3 +- .../unitary-tests/core/EMailTest.php | 14 +- .../unitary-tests/core/EventIssueTest.php | 5 +- .../core/ExpressionEvaluateTest.php | 420 +- .../unitary-tests/core/ExpressionTest.php | 9 +- .../core/GetSelectFilterTest.php | 63 +- .../unitary-tests/core/InlineImageTest.php | 2 +- .../DeprecatedCallsLogErrorHandlerTest.php | 13 +- .../core/Log/DeprecatedCallsLogTest.php | 6 +- .../core/Log/ExceptionLogTest.php | 20 +- .../core/Log/ExceptionLogTest/Exceptions.php | 13 +- .../unitary-tests/core/Log/LogAPITest.php | 22 +- .../core/Log/LogFileNameBuilderTest.php | 57 +- .../core/MetaModelMagicPlaceholderTest.php | 8 +- .../unitary-tests/core/MetaModelTest.php | 194 +- .../core/MockValueSetObjects.php | 10 +- .../unitary-tests/core/OQLParserTest.php | 45 +- .../unitary-tests/core/OQLTest.php | 501 +- .../core/RestServicesSanitizeOutputTest.php | 58 +- .../unitary-tests/core/RestServicesTest.php | 15 +- .../unitary-tests/core/SympleCryptTest.php | 87 +- .../core/TagSetFieldDataTest.php | 86 +- .../core/TriggerOnStateEnterTest.php | 4 +- .../unitary-tests/core/TriggerTest.php | 24 +- .../core/UniquenessConstraintTest.php | 40 +- .../core/UniquenessMessageTest.php | 6 +- .../unitary-tests/core/UserRightsTest.php | 23 +- .../core/ValueSetDefinitionTest.php | 4 +- .../core/ValueSetEnum/ABCEnum.php | 4 +- .../unitary-tests/core/ValueSetEnumTest.php | 8 +- .../core/ValueSetObjectsTest.php | 22 +- .../core/WeeklyScheduledProcessMockConfig.php | 2 +- .../core/WeeklyScheduledProcessTest.php | 3 +- .../unitary-tests/core/XMLDataLoaderTest.php | 8 +- .../unitary-tests/core/apcEmulationTest.php | 34 +- .../unitary-tests/core/dictApcuTest.php | 24 +- .../unitary-tests/core/dictTest.php | 1 + .../core/iTopConfigParserTest.php | 97 +- .../unitary-tests/core/ormCaseLogTest.php | 3 +- .../unitary-tests/core/ormDocumentTest.php | 26 +- .../unitary-tests/core/ormLinkSetTest.php | 44 +- .../unitary-tests/core/ormPasswordTest.php | 18 +- .../unitary-tests/core/ormStyleTest.php | 2 +- .../unitary-tests/core/ormTagSetTest.php | 178 +- .../ExpressionTranslateTest.php | 26 +- .../QueryBuilderExpressionsTest.php | 10 +- .../sanitizer/AbstractDOMSanitizerTest.php | 9 +- .../core/sanitizer/HTMLDOMSanitizerTest.php | 194 +- .../core/sanitizer/InlineImageMock.php | 3 +- .../core/sanitizer/SvgDOMSanitizerTest.php | 3 - .../2.x/authent-local/UserLocalTest.php | 258 +- .../UserLocalPasswordPolicyMock.php | 13 +- .../2.x/itop-attachments/TestAttachment.php | 4 +- .../2.x/itop-config/BulkChangeExtKeyTest.php | 131 +- .../2.x/itop-config/CRUD/DBObjectTest.php | 11 +- .../ConfigPlaceholdersResolverTest.php | 142 +- .../datamodels/2.x/itop-config/ConfigTest.php | 35 +- .../ConfigTest/config-itop-joker.php | 18 +- .../ConfigTest/config-itop-var.php | 20 +- .../Validator/iTopConfigAstValidatorTest.php | 65 +- .../iTopConfigSyntaxValidatorTest.php | 5 +- .../TokenValidationTest.php | 61 +- .../ApplicationHelperTest.php | 8 +- .../RequestManipulatorTest.php | 5 +- .../itop-tickets/UpdateImpactedItemsTest.php | 46 +- .../unitary-tests/setup/DBBackupDataTest.php | 50 +- .../unitary-tests/setup/DBBackupTest.php | 18 +- .../unitary-tests/setup/MFCompilerTest.php | 98 +- .../unitary-tests/setup/ModelFactoryTest.php | 68 +- .../setup/ModuleInstallerAPITest.php | 28 +- .../unitary-tests/setup/SetupUtilsTest.php | 23 +- .../unitary-tests/setup/SubMFCompiler.php | 11 +- .../iTopDesignFormat/iTopDesignFormatTest.php | 46 +- .../InstallationFileServiceTest.php | 203 +- .../UnattendedInstallTest.php | 41 +- .../Application/Helper/CKEditorHelperTest.php | 111 +- .../Application/Helper/TestDOMSanitizer.php | 13 +- .../Helper/WebResourcesHelperTest.php | 1 + .../Application/RuntimeDashboardTest.php | 11 +- .../Search/CriterionConversionTest.php | 636 ++- .../Search/CriterionParserTest.php | 1 + .../Application/Search/SearchFormTest.php | 67 +- .../Application/Status/StatusIncTest.php | 95 +- .../sources/Application/Status/StatusTest.php | 2 +- .../sources/Application/Status/status.php | 19 +- .../sources/Application/TestAutoload.php | 2 +- .../Application/TwigBase/Twig/TwigTest.php | 10 +- .../Application/WebPage/WebPageMock.php | 4 +- .../Application/WebPage/WebPageTest.php | 3 +- .../Composer/iTopComposerTest.php | 8 +- .../sources/Dependencies/NPM/iTopNPMTest.php | 1 - .../sources/Form/Field/FieldTest.php | 8 +- .../sources/Form/LinkedSetFieldTest.php | 9 +- .../sources/Form/MultipleChoicesFieldTest.php | 3 +- .../sources/Form/SelectObjectFieldTest.php | 12 +- .../sources/Form/Validator/ValidatorTest.php | 3 +- .../Cache/DataModelDependantCacheTest.php | 14 +- .../sources/Service/Events/EventTest.php | 68 +- .../InterfaceDiscoveryTest.php | 20 +- .../Notification/NotificationsServiceTest.php | 10 +- .../sources/Service/Router/RouterTest.php | 9 +- .../TemporaryObjectManagerTest.php | 10 +- .../TemporaryObjectRepositoryTest.php | 5 +- .../SessionTracker/SessionHandlerTest.php | 2 +- .../iSessionHandlerExtensionExamples.php | 10 +- .../sources/core/Email/EmailSymfonyTest.php | 2 +- .../unitary-tests/synchro/DataSynchroTest.php | 227 +- .../php-unit-tests/BootSymfonyKernelTest.php | 1 - .../php-unit-tests/GivenObjectInDBTest.php | 31 +- .../webservices/CliResetSessionTest.php | 52 +- .../unitary-tests/webservices/ImportTest.php | 63 +- .../unitary-tests/webservices/RestTest.php | 32 +- webservices/backoffice.dataloader.php | 50 +- webservices/createfrommail.php | 61 +- webservices/cron.php | 275 +- webservices/export-v2.php | 141 +- webservices/export.php | 244 +- webservices/import.php | 642 +-- webservices/itop.wsdl.php | 11 +- webservices/itoprest.examples.php | 273 +- webservices/itopsoap.examples.php | 77 +- webservices/itopsoaptypes.class.inc.php | 29 +- webservices/rest.php | 190 +- webservices/soapserver.php | 55 +- webservices/status.php | 19 +- webservices/webservices.basic.php | 121 +- webservices/webservices.class.inc.php | 284 +- 2110 files changed, 53099 insertions(+), 63885 deletions(-) diff --git a/addons/userrights/userrightsmatrix.class.inc.php b/addons/userrights/userrightsmatrix.class.inc.php index acc9fe33e..1d5cc1ffa 100644 --- a/addons/userrights/userrightsmatrix.class.inc.php +++ b/addons/userrights/userrightsmatrix.class.inc.php @@ -1,9 +1,10 @@ "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_ur_matrixclasses", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass"=>"User", "jointype"=> "", "allowed_values"=>null, "sql"=>"userid", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("login", array("allowed_values"=>null, "extkey_attcode"=> 'userid', "target_attcode"=>"login"))); - MetaModel::Init_AddAttribute(new AttributeString("class", array("allowed_values"=>null, "sql"=>"class", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", ["targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("login", ["allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"])); + MetaModel::Init_AddAttribute(new AttributeString("class", ["allowed_values" => null, "sql" => "class", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeString("action", array("allowed_values"=>null, "sql"=>"action", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("permission", array("allowed_values"=>new ValueSetEnum('yes,no'), "sql"=>"permission", "default_value"=>"yes", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("action", ["allowed_values" => null, "sql" => "action", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("permission", ["allowed_values" => new ValueSetEnum('yes,no'), "sql" => "permission", "default_value" => "yes", "is_null_allowed" => false, "depends_on" => []])); } } @@ -54,25 +54,25 @@ class UserRightsMatrixClassStimulusGrant extends DBObject { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_ur_matrixclassesstimulus", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass"=>"User", "jointype"=> "", "allowed_values"=>null, "sql"=>"userid", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("login", array("allowed_values"=>null, "extkey_attcode"=> 'userid', "target_attcode"=>"login"))); - MetaModel::Init_AddAttribute(new AttributeString("class", array("allowed_values"=>null, "sql"=>"class", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", ["targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("login", ["allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"])); + MetaModel::Init_AddAttribute(new AttributeString("class", ["allowed_values" => null, "sql" => "class", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeString("stimulus", array("allowed_values"=>null, "sql"=>"action", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("permission", array("allowed_values"=>new ValueSetEnum('yes,no'), "sql"=>"permission", "default_value"=>"yes", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("stimulus", ["allowed_values" => null, "sql" => "action", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("permission", ["allowed_values" => new ValueSetEnum('yes,no'), "sql" => "permission", "default_value" => "yes", "is_null_allowed" => false, "depends_on" => []])); } } @@ -80,42 +80,39 @@ class UserRightsMatrixAttributeGrant extends DBObject { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_ur_matrixattributes", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass"=>"User", "jointype"=> "", "allowed_values"=>null, "sql"=>"userid", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("login", array("allowed_values"=>null, "extkey_attcode"=> 'userid', "target_attcode"=>"login"))); - MetaModel::Init_AddAttribute(new AttributeString("class", array("allowed_values"=>null, "sql"=>"class", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("attcode", array("allowed_values"=>null, "sql"=>"attcode", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", ["targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("login", ["allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"])); + MetaModel::Init_AddAttribute(new AttributeString("class", ["allowed_values" => null, "sql" => "class", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("attcode", ["allowed_values" => null, "sql" => "attcode", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeString("action", array("allowed_values"=>null, "sql"=>"action", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("permission", array("allowed_values"=>new ValueSetEnum('yes,no'), "sql"=>"permission", "default_value"=>"yes", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("action", ["allowed_values" => null, "sql" => "action", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("permission", ["allowed_values" => new ValueSetEnum('yes,no'), "sql" => "permission", "default_value" => "yes", "is_null_allowed" => false, "depends_on" => []])); } } - - - class UserRightsMatrix extends UserRightsAddOnAPI { - static public $m_aActionCodes = array( + public static $m_aActionCodes = [ UR_ACTION_READ => 'read', UR_ACTION_MODIFY => 'modify', UR_ACTION_DELETE => 'delete', UR_ACTION_BULK_READ => 'bulk read', UR_ACTION_BULK_MODIFY => 'bulk modify', UR_ACTION_BULK_DELETE => 'bulk delete', - ); + ]; // Installation: create the very first user public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US') @@ -149,8 +146,7 @@ class UserRightsMatrix extends UserRightsAddOnAPI // Users must be added manually // This procedure will then update the matrix when a new user is found or a new class/attribute appears $oUserSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT User")); - while ($oUser = $oUserSet->Fetch()) - { + while ($oUser = $oUserSet->Fetch()) { $this->SetupUser($oUser->GetKey()); } return true; @@ -158,23 +154,16 @@ class UserRightsMatrix extends UserRightsAddOnAPI protected function SetupUser($iUserId, $bNewUser = false) { - foreach(array('bizmodel', 'application', 'gui', 'core/cmdb') as $sCategory) - { - foreach (MetaModel::GetClasses($sCategory) as $sClass) - { - foreach (self::$m_aActionCodes as $iActionCode => $sAction) - { - if ($bNewUser) - { + foreach (['bizmodel', 'application', 'gui', 'core/cmdb'] as $sCategory) { + foreach (MetaModel::GetClasses($sCategory) as $sClass) { + foreach (self::$m_aActionCodes as $iActionCode => $sAction) { + if ($bNewUser) { $bAddCell = true; - } - else - { + } else { $oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixClassGrant WHERE class = '$sClass' AND action = '$sAction' AND userid = $iUserId")); $bAddCell = ($oSet->Count() < 1); } - if ($bAddCell) - { + if ($bAddCell) { // Create a new entry $oMyClassGrant = MetaModel::NewObject("UserRightsMatrixClassGrant"); $oMyClassGrant->Set("userid", $iUserId); @@ -184,19 +173,14 @@ class UserRightsMatrix extends UserRightsAddOnAPI $iId = $oMyClassGrant->DBInsertNoReload(); } } - foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus) - { - if ($bNewUser) - { + foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus) { + if ($bNewUser) { $bAddCell = true; - } - else - { + } else { $oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixClassStimulusGrant WHERE class = '$sClass' AND stimulus = '$sStimulusCode' AND userid = $iUserId")); $bAddCell = ($oSet->Count() < 1); } - if ($bAddCell) - { + if ($bAddCell) { // Create a new entry $oMyClassGrant = MetaModel::NewObject("UserRightsMatrixClassStimulusGrant"); $oMyClassGrant->Set("userid", $iUserId); @@ -206,21 +190,15 @@ class UserRightsMatrix extends UserRightsAddOnAPI $iId = $oMyClassGrant->DBInsertNoReload(); } } - foreach (MetaModel::GetAttributesList($sClass) as $sAttCode) - { - if ($bNewUser) - { + foreach (MetaModel::GetAttributesList($sClass) as $sAttCode) { + if ($bNewUser) { $bAddCell = true; - } - else - { + } else { $oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixAttributeGrant WHERE class = '$sClass' AND attcode = '$sAttCode' AND userid = $iUserId")); $bAddCell = ($oSet->Count() < 1); } - if ($bAddCell) - { - foreach (array('read', 'modify') as $sAction) - { + if ($bAddCell) { + foreach (['read', 'modify'] as $sAction) { // Create a new entry $oMyAttGrant = MetaModel::NewObject("UserRightsMatrixAttributeGrant"); $oMyAttGrant->Set("userid", $iUserId); @@ -261,14 +239,13 @@ class UserRightsMatrix extends UserRightsAddOnAPI */ } - public function Init() { // Could be loaded in a shared memory (?) return true; } - public function GetSelectFilter($oUser, $sClass, $aSettings = array()) + public function GetSelectFilter($oUser, $sClass, $aSettings = []) { $oNullFilter = new DBObjectSearch($sClass); return $oNullFilter; @@ -276,21 +253,18 @@ class UserRightsMatrix extends UserRightsAddOnAPI public function IsActionAllowed($oUser, $sClass, $iActionCode, $oInstanceSet = null) { - if (!array_key_exists($iActionCode, self::$m_aActionCodes)) - { + if (!array_key_exists($iActionCode, self::$m_aActionCodes)) { return UR_ALLOWED_NO; } $sAction = self::$m_aActionCodes[$iActionCode]; $oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixClassGrant WHERE class = '$sClass' AND action = '$sAction' AND userid = '{$oUser->GetKey()}'")); - if ($oSet->Count() < 1) - { + if ($oSet->Count() < 1) { return UR_ALLOWED_NO; } $oGrantRecord = $oSet->Fetch(); - switch ($oGrantRecord->Get('permission')) - { + switch ($oGrantRecord->Get('permission')) { case 'yes': $iRetCode = UR_ALLOWED_YES; break; @@ -304,21 +278,18 @@ class UserRightsMatrix extends UserRightsAddOnAPI public function IsActionAllowedOnAttribute($oUser, $sClass, $sAttCode, $iActionCode, $oInstanceSet = null) { - if (!array_key_exists($iActionCode, self::$m_aActionCodes)) - { + if (!array_key_exists($iActionCode, self::$m_aActionCodes)) { return UR_ALLOWED_NO; } $sAction = self::$m_aActionCodes[$iActionCode]; $oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixAttributeGrant WHERE class = '$sClass' AND attcode = '$sAttCode' AND action = '$sAction' AND userid = '{$oUser->GetKey()}'")); - if ($oSet->Count() < 1) - { + if ($oSet->Count() < 1) { return UR_ALLOWED_NO; } $oGrantRecord = $oSet->Fetch(); - switch ($oGrantRecord->Get('permission')) - { + switch ($oGrantRecord->Get('permission')) { case 'yes': $iRetCode = UR_ALLOWED_YES; break; @@ -333,14 +304,12 @@ class UserRightsMatrix extends UserRightsAddOnAPI public function IsStimulusAllowed($oUser, $sClass, $sStimulusCode, $oInstanceSet = null) { $oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixClassStimulusGrant WHERE class = '$sClass' AND stimulus = '$sStimulusCode' AND userid = '{$oUser->GetKey()}'")); - if ($oSet->Count() < 1) - { + if ($oSet->Count() < 1) { return UR_ALLOWED_NO; } $oGrantRecord = $oSet->Fetch(); - switch ($oGrantRecord->Get('permission')) - { + switch ($oGrantRecord->Get('permission')) { case 'yes': $iRetCode = UR_ALLOWED_YES; break; @@ -358,5 +327,3 @@ class UserRightsMatrix extends UserRightsAddOnAPI } UserRights::SelectModule('UserRightsMatrix'); - -?> diff --git a/addons/userrights/userrightsnull.class.inc.php b/addons/userrights/userrightsnull.class.inc.php index 5cfcee2ab..5186baf35 100644 --- a/addons/userrights/userrightsnull.class.inc.php +++ b/addons/userrights/userrightsnull.class.inc.php @@ -1,9 +1,10 @@ diff --git a/addons/userrights/userrightsprofile.class.inc.php b/addons/userrights/userrightsprofile.class.inc.php index 366630510..04cebe587 100644 --- a/addons/userrights/userrightsprofile.class.inc.php +++ b/addons/userrights/userrightsprofile.class.inc.php @@ -1,4 +1,5 @@ "addon/userrights,grant_by_profile,filter", "key_type" => "autoincrement", "name_attcode" => "name", - "complementary_name_attcode" => array('description'), + "complementary_name_attcode" => ['description'], "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_profiles", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("name", ["allowed_values" => null, "sql" => "name", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("user_list", array("linked_class"=>"URP_UserProfile", "ext_key_to_me"=>"profileid", "ext_key_to_remote"=>"userid", "allowed_values"=>null, "count_min"=>1, "count_max"=>0, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("user_list", ["linked_class" => "URP_UserProfile", "ext_key_to_me" => "profileid", "ext_key_to_remote" => "userid", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('name', 'description', 'user_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['name', 'description', 'user_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['description']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('name','description')); // Criteria of the std search form - MetaModel::Init_SetZListItems('default_search', array ('name','description')); + MetaModel::Init_SetZListItems('standard_search', ['name','description']); // Criteria of the std search form + MetaModel::Init_SetZListItems('default_search', ['name','description']); } protected static $m_aCacheProfiles = null; public static function DoCreateProfile($sName, $sDescription) { - if (is_null(self::$m_aCacheProfiles)) - { - self::$m_aCacheProfiles = array(); + if (is_null(self::$m_aCacheProfiles)) { + self::$m_aCacheProfiles = []; $oFilterAll = new DBObjectSearch('URP_Profiles'); $oSet = new DBObjectSet($oFilterAll); - while ($oProfile = $oSet->Fetch()) - { + while ($oProfile = $oSet->Fetch()) { self::$m_aCacheProfiles[$oProfile->Get('name')] = $oProfile->GetKey(); } } $sCacheKey = $sName; - if (isset(self::$m_aCacheProfiles[$sCacheKey])) - { + if (isset(self::$m_aCacheProfiles[$sCacheKey])) { return self::$m_aCacheProfiles[$sCacheKey]; } $oNewObj = MetaModel::NewObject("URP_Profiles"); @@ -89,27 +86,21 @@ class URP_Profiles extends UserRightsBaseClassGUI return $iId; } - function GetGrantAsHtml($oUserRights, $sClass, $sAction) + public function GetGrantAsHtml($oUserRights, $sClass, $sAction) { $bGrant = $oUserRights->GetProfileActionGrant($this->GetKey(), $sClass, $sAction); - if (is_null($bGrant)) - { + if (is_null($bGrant)) { return ''.Dict::S('UI:UserManagement:ActionAllowed:No').''; - } - elseif ($bGrant) - { + } elseif ($bGrant) { return ''.Dict::S('UI:UserManagement:ActionAllowed:Yes').''; - } - else - { + } else { return ''.Dict::S('UI:UserManagement:ActionAllowed:No').''; } } - function DoShowGrantSumary($oPage) + public function DoShowGrantSumary($oPage) { - if ($this->GetRawName() == "Administrator") - { + if ($this->GetRawName() == "Administrator") { // Looks dirty, but ok that's THE ONE $oPage->p(Dict::S('UI:UserManagement:AdminProfile+')); return; @@ -118,21 +109,18 @@ class URP_Profiles extends UserRightsBaseClassGUI // Note: for sure, we assume that the instance is derived from UserRightsProfile $oUserRights = UserRights::GetModuleInstance(); - $aDisplayData = array(); - foreach (MetaModel::GetClasses('bizmodel,grant_by_profile') as $sClass) - { - $aStimuli = array(); - foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus) - { + $aDisplayData = []; + foreach (MetaModel::GetClasses('bizmodel,grant_by_profile') as $sClass) { + $aStimuli = []; + foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus) { $bGrant = $oUserRights->GetClassStimulusGrant($this->GetKey(), $sClass, $sStimulusCode); - if ($bGrant === true) - { + if ($bGrant === true) { $aStimuli[] = ''.utils::EscapeHtml($oStimulus->GetLabel()).''; } } $sStimuli = implode(', ', $aStimuli); - $aDisplayData[] = array( + $aDisplayData[] = [ 'class' => MetaModel::GetName($sClass), 'read' => $this->GetGrantAsHtml($oUserRights, $sClass, 'r'), 'bulkread' => $this->GetGrantAsHtml($oUserRights, $sClass, 'br'), @@ -141,22 +129,22 @@ class URP_Profiles extends UserRightsBaseClassGUI 'delete' => $this->GetGrantAsHtml($oUserRights, $sClass, 'd'), 'bulkdelete' => $this->GetGrantAsHtml($oUserRights, $sClass, 'bd'), 'stimuli' => $sStimuli, - ); + ]; } - $aDisplayConfig = array(); - $aDisplayConfig['class'] = array('label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+')); - $aDisplayConfig['read'] = array('label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+')); - $aDisplayConfig['bulkread'] = array('label' => Dict::S('UI:UserManagement:Action:BulkRead'), 'description' => Dict::S('UI:UserManagement:Action:BulkRead+')); - $aDisplayConfig['write'] = array('label' => Dict::S('UI:UserManagement:Action:Modify'), 'description' => Dict::S('UI:UserManagement:Action:Modify+')); - $aDisplayConfig['bulkwrite'] = array('label' => Dict::S('UI:UserManagement:Action:BulkModify'), 'description' => Dict::S('UI:UserManagement:Action:BulkModify+')); - $aDisplayConfig['delete'] = array('label' => Dict::S('UI:UserManagement:Action:Delete'), 'description' => Dict::S('UI:UserManagement:Action:Delete+')); - $aDisplayConfig['bulkdelete'] = array('label' => Dict::S('UI:UserManagement:Action:BulkDelete'), 'description' => Dict::S('UI:UserManagement:Action:BulkDelete+')); - $aDisplayConfig['stimuli'] = array('label' => Dict::S('UI:UserManagement:Action:Stimuli'), 'description' => Dict::S('UI:UserManagement:Action:Stimuli+')); + $aDisplayConfig = []; + $aDisplayConfig['class'] = ['label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+')]; + $aDisplayConfig['read'] = ['label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+')]; + $aDisplayConfig['bulkread'] = ['label' => Dict::S('UI:UserManagement:Action:BulkRead'), 'description' => Dict::S('UI:UserManagement:Action:BulkRead+')]; + $aDisplayConfig['write'] = ['label' => Dict::S('UI:UserManagement:Action:Modify'), 'description' => Dict::S('UI:UserManagement:Action:Modify+')]; + $aDisplayConfig['bulkwrite'] = ['label' => Dict::S('UI:UserManagement:Action:BulkModify'), 'description' => Dict::S('UI:UserManagement:Action:BulkModify+')]; + $aDisplayConfig['delete'] = ['label' => Dict::S('UI:UserManagement:Action:Delete'), 'description' => Dict::S('UI:UserManagement:Action:Delete+')]; + $aDisplayConfig['bulkdelete'] = ['label' => Dict::S('UI:UserManagement:Action:BulkDelete'), 'description' => Dict::S('UI:UserManagement:Action:BulkDelete+')]; + $aDisplayConfig['stimuli'] = ['label' => Dict::S('UI:UserManagement:Action:Stimuli'), 'description' => Dict::S('UI:UserManagement:Action:Stimuli+')]; $oPage->table($aDisplayConfig, $aDisplayData); } - function DisplayBareRelations(WebPage $oPage, $bEditMode = false) + public function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); @@ -166,10 +154,9 @@ class URP_Profiles extends UserRightsBaseClassGUI public static function GetReadOnlyAttributes() { - return array('name', 'description'); + return ['name', 'description']; } - // returns an array of id => array of column => php value(so-called "real value") public static function GetPredefinedObjects() { @@ -181,15 +168,13 @@ class URP_Profiles extends UserRightsBaseClassGUI protected function OnDelete() { // Don't remove admin profile - if ($this->Get('name') === ADMIN_PROFILE_NAME) - { + if ($this->Get('name') === ADMIN_PROFILE_NAME) { throw new SecurityException(Dict::Format('UI:Login:Error:AccessAdmin')); } // Note: this may break the rule that says: "a user must have at least ONE profile" ! $oLnkSet = $this->Get('user_list'); - while($oLnk = $oLnkSet->Fetch()) - { + while ($oLnk = $oLnkSet->Fetch()) { $oLnk->DBDelete(); } } @@ -202,11 +187,10 @@ class URP_Profiles extends UserRightsBaseClassGUI * @param $sTargetState string The target state in which to evalutate the flags, if empty the current state will be used * @return integer Flags: the binary combination of the flags applicable to this attribute */ - public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '') + public function GetAttributeFlags($sAttCode, &$aReasons = [], $sTargetState = '') { $iFlags = parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState); - if (MetaModel::GetConfig()->Get('demo_mode')) - { + if (MetaModel::GetConfig()->Get('demo_mode')) { $aReasons[] = 'Sorry, profiles are read-only in the demonstration mode!'; $iFlags |= OPT_ATT_READONLY; } @@ -214,52 +198,52 @@ class URP_Profiles extends UserRightsBaseClassGUI } } - - class URP_UserProfile extends UserRightsBaseClassGUI { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights,grant_by_profile,filter", "key_type" => "autoincrement", - "name_attcode" => array("userlogin", "profile"), + "name_attcode" => ["userlogin", "profile"], "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_userprofile", "db_key_field" => "id", "db_finalclass_field" => "", "is_link" => true, /** @since 3.1.0 N°6482 */ - 'uniqueness_rules' => array( - 'no_duplicate' => array( - 'attributes' => array( + 'uniqueness_rules' => [ + 'no_duplicate' => [ + 'attributes' => [ 0 => 'userid', 1 => 'profileid', - ), + ], 'filter' => '', 'disabled' => false, 'is_blocking' => true, - ), - ), - ); + ], + ], + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", ["targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", ["allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"])); - MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", - array("targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array(), "allow_target_creation" => false))); - MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey( + "profileid", + ["targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => [], "allow_target_creation" => false] + )); + MetaModel::Init_AddAttribute(new AttributeExternalField("profile", ["allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name"])); - MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeString("reason", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('userid', 'profileid', 'reason')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('userid', 'profileid', 'reason')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['userid', 'profileid', 'reason']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['userid', 'profileid', 'reason']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('userid', 'profileid')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('userid', 'profileid')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['userid', 'profileid']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['userid', 'profileid']); // Criteria of the advanced search form } public function CheckToDelete(&$oDeletionPlan) @@ -267,15 +251,14 @@ class URP_UserProfile extends UserRightsBaseClassGUI if (MetaModel::GetConfig()->Get('demo_mode')) { // Users deletion is NOT allowed in demo mode $oDeletionPlan->AddToDelete($this, null); - $oDeletionPlan->SetDeletionIssues($this, array('deletion not allowed in demo mode.'), true); + $oDeletionPlan->SetDeletionIssues($this, ['deletion not allowed in demo mode.'], true); $oDeletionPlan->ComputeResults(); return false; } try { $this->CheckIfProfileIsAllowed(UR_ACTION_DELETE); - } - catch (SecurityException $e) { + } catch (SecurityException $e) { // Users deletion is NOT allowed $oDeletionPlan->AddToDelete($this, null); $oDeletionPlan->SetDeletionIssues($this, [$e->getMessage()], true); @@ -292,15 +275,14 @@ class URP_UserProfile extends UserRightsBaseClassGUI if (MetaModel::GetConfig()->Get('demo_mode')) { // Users deletion is NOT allowed in demo mode $oDeletionPlan->AddToDelete($this, null); - $oDeletionPlan->SetDeletionIssues($this, array('deletion not allowed in demo mode.'), true); + $oDeletionPlan->SetDeletionIssues($this, ['deletion not allowed in demo mode.'], true); $oDeletionPlan->ComputeResults(); return false; } try { $this->CheckIfProfileIsAllowed(UR_ACTION_DELETE); - } - catch (SecurityException $e) { + } catch (SecurityException $e) { // Users deletion is NOT allowed $oDeletionPlan->AddToDelete($this, null); $oDeletionPlan->SetDeletionIssues($this, [$e->getMessage()], true); @@ -336,29 +318,26 @@ class URP_UserProfile extends UserRightsBaseClassGUI protected function CheckIfProfileIsAllowed($iActionCode) { // When initializing or admin, we need to let everything pass trough - if (!UserRights::IsLoggedIn() || UserRights::IsAdministrator()) { return; } + if (!UserRights::IsLoggedIn() || UserRights::IsAdministrator()) { + return; + } // Only administrators can manage administrators $iOrigUserId = $this->GetOriginal('userid'); - if (!empty($iOrigUserId)) - { + if (!empty($iOrigUserId)) { $oUser = MetaModel::GetObject('User', $iOrigUserId, true, true); - if (UserRights::IsAdministrator($oUser) && !UserRights::IsAdministrator()) - { + if (UserRights::IsAdministrator($oUser) && !UserRights::IsAdministrator()) { throw new SecurityException(Dict::Format('UI:Login:Error:AccessRestricted')); } } $oUser = MetaModel::GetObject('User', $this->Get('userid'), true, true); - if (UserRights::IsAdministrator($oUser) && !UserRights::IsAdministrator()) - { + if (UserRights::IsAdministrator($oUser) && !UserRights::IsAdministrator()) { throw new SecurityException(Dict::Format('UI:Login:Error:AccessRestricted')); } - if (!UserRights::IsActionAllowed(get_class($this), $iActionCode, DBObjectSet::FromObject($this))) - { + if (!UserRights::IsActionAllowed(get_class($this), $iActionCode, DBObjectSet::FromObject($this))) { throw new SecurityException(Dict::Format('UI:Error:ObjectCannotBeUpdated')); } - if (!UserRights::IsAdministrator() && ($this->Get('profile') === ADMIN_PROFILE_NAME)) - { + if (!UserRights::IsAdministrator() && ($this->Get('profile') === ADMIN_PROFILE_NAME)) { throw new SecurityException(Dict::Format('UI:Login:Error:AccessAdmin')); } } @@ -369,33 +348,33 @@ class URP_UserOrg extends UserRightsBaseClassGUI { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights,grant_by_profile", "key_type" => "autoincrement", - "name_attcode" => array("userlogin", "allowed_org_name"), + "name_attcode" => ["userlogin", "allowed_org_name"], "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_userorg", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass"=>"User", "jointype"=> "", "allowed_values"=>null, "sql"=>"userid", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values"=>null, "extkey_attcode"=> 'userid', "target_attcode"=>"login"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", ["targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", ["allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"])); - MetaModel::Init_AddAttribute(new AttributeExternalKey("allowed_org_id", array("targetclass"=>"Organization", "jointype"=> "", "allowed_values"=>null, "sql"=>"allowed_org_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("allowed_org_name", array("allowed_values"=>null, "extkey_attcode"=> 'allowed_org_id', "target_attcode"=>"name"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("allowed_org_id", ["targetclass" => "Organization", "jointype" => "", "allowed_values" => null, "sql" => "allowed_org_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("allowed_org_name", ["allowed_values" => null, "extkey_attcode" => 'allowed_org_id', "target_attcode" => "name"])); - MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values"=>null, "sql"=>"reason", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("reason", ["allowed_values" => null, "sql" => "reason", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('userid', 'allowed_org_id', 'reason')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('allowed_org_id', 'reason')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['userid', 'allowed_org_id', 'reason']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['allowed_org_id', 'reason']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('userid', 'allowed_org_id')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('userid', 'allowed_org_id')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['userid', 'allowed_org_id']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['userid', 'allowed_org_id']); // Criteria of the advanced search form } protected function OnInsert() @@ -418,40 +397,37 @@ class URP_UserOrg extends UserRightsBaseClassGUI */ protected function CheckIfOrgIsAllowed() { - if (!UserRights::IsLoggedIn() || UserRights::IsAdministrator()) { return; } + if (!UserRights::IsLoggedIn() || UserRights::IsAdministrator()) { + return; + } $oUser = UserRights::GetUserObject(); $oAddon = UserRights::GetModuleInstance(); $aOrgs = $oAddon->GetUserOrgs($oUser, ''); - if (count($aOrgs) > 0) - { + if (count($aOrgs) > 0) { $iOrigOrgId = $this->GetOriginal('allowed_org_id'); - if ((!empty($iOrigOrgId) && !in_array($iOrigOrgId, $aOrgs)) || !in_array($this->Get('allowed_org_id'), $aOrgs)) - { + if ((!empty($iOrigOrgId) && !in_array($iOrigOrgId, $aOrgs)) || !in_array($this->Get('allowed_org_id'), $aOrgs)) { throw new SecurityException(Dict::Format('Class:User/Error:OrganizationNotAllowed')); } } } } - - - class UserRightsProfile extends UserRightsAddOnAPI { - static public $m_aActionCodes = array( + public static $m_aActionCodes = [ UR_ACTION_READ => 'r', UR_ACTION_MODIFY => 'w', UR_ACTION_DELETE => 'd', UR_ACTION_BULK_READ => 'br', UR_ACTION_BULK_MODIFY => 'bw', UR_ACTION_BULK_DELETE => 'bd', - ); + ]; - /** - * @var array $aUsersProfilesList Cache of users' profiles. Hash array of user ID => [profile ID => profile friendlyname, profile ID => profile friendlyname, ...] - * @since 2.7.10 3.0.4 3.1.1 3.2.0 N°6887 - */ + /** + * @var array $aUsersProfilesList Cache of users' profiles. Hash array of user ID => [profile ID => profile friendlyname, profile ID => profile friendlyname, ...] + * @since 2.7.10 3.0.4 3.1.1 3.2.0 N°6887 + */ private $aUsersProfilesList = []; // Installation: create the very first user @@ -472,8 +448,7 @@ class UserRightsProfile extends UserRightsAddOnAPI $oContact = MetaModel::NewObject('Person'); $oContact->Set('name', 'My last name'); $oContact->Set('first_name', 'My first name'); - if (MetaModel::IsValidAttCode('Person', 'org_id')) - { + if (MetaModel::IsValidAttCode('Person', 'org_id')) { $oContact->Set('org_id', $iOrgId); } $oContact->Set('email', 'my.email@foo.org'); @@ -481,20 +456,17 @@ class UserRightsProfile extends UserRightsAddOnAPI } } - $oUser = new UserLocal(); $oUser->Set('login', $sAdminUser); $oUser->Set('password', $sAdminPwd); - if (MetaModel::IsValidAttCode('UserLocal', 'contactid') && ($iContactId != 0)) - { + if (MetaModel::IsValidAttCode('UserLocal', 'contactid') && ($iContactId != 0)) { $oUser->Set('contactid', $iContactId); } $oUser->Set('language', $sLanguage); // Language was chosen during the installation // Add this user to the very specific 'admin' profile - $oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => ADMIN_PROFILE_NAME), true /*all data*/); - if (is_object($oAdminProfile)) - { + $oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => ADMIN_PROFILE_NAME], true /*all data*/); + if (is_object($oAdminProfile)) { $oUserProfile = new URP_UserProfile(); $oUserProfile->Set('profileid', $oAdminProfile->GetKey()); $oUserProfile->Set('reason', 'By definition, the administrator must have the administrator profile'); @@ -509,11 +481,11 @@ class UserRightsProfile extends UserRightsAddOnAPI { } - protected $m_aUserOrgs = array(); // userid -> array of orgid + protected $m_aUserOrgs = []; // userid -> array of orgid protected $m_aAdministrators = null; // [user id] // Built on demand, could be optimized if necessary (doing a query for each attribute that needs to be read) - protected $m_aObjectActionGrants = array(); + protected $m_aObjectActionGrants = []; /** * Read and cache organizations allowed to the given user @@ -528,31 +500,25 @@ class UserRightsProfile extends UserRightsAddOnAPI public function GetUserOrgs($oUser, $sClass) { $iUser = $oUser->GetKey(); - if (!array_key_exists($iUser, $this->m_aUserOrgs)) - { - $this->m_aUserOrgs[$iUser] = array(); + if (!array_key_exists($iUser, $this->m_aUserOrgs)) { + $this->m_aUserOrgs[$iUser] = []; $sHierarchicalKeyCode = MetaModel::IsHierarchicalClass('Organization'); - if ($sHierarchicalKeyCode !== false) - { + if ($sHierarchicalKeyCode !== false) { $sUserOrgQuery = 'SELECT UserOrg, Org FROM Organization AS Org JOIN Organization AS Root ON Org.'.$sHierarchicalKeyCode.' BELOW Root.id JOIN URP_UserOrg AS UserOrg ON UserOrg.allowed_org_id = Root.id WHERE UserOrg.userid = :userid'; - $oUserOrgSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData($sUserOrgQuery), array(), array('userid' => $iUser)); - while ($aRow = $oUserOrgSet->FetchAssoc()) - { + $oUserOrgSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData($sUserOrgQuery), [], ['userid' => $iUser]); + while ($aRow = $oUserOrgSet->FetchAssoc()) { $oOrg = $aRow['Org']; $this->m_aUserOrgs[$iUser][] = $oOrg->GetKey(); } - } - else - { + } else { $oSearch = new DBObjectSearch('URP_UserOrg'); $oSearch->AllowAllData(); $oCondition = new BinaryExpression(new FieldExpression('userid'), '=', new VariableExpression('userid')); $oSearch->AddConditionExpression($oCondition); - $oUserOrgSet = new DBObjectSet($oSearch, array(), array('userid' => $iUser)); - while ($oUserOrg = $oUserOrgSet->Fetch()) - { + $oUserOrgSet = new DBObjectSet($oSearch, [], ['userid' => $iUser]); + while ($oUserOrg = $oUserOrgSet->Fetch()) { $this->m_aUserOrgs[$iUser][] = $oUserOrg->Get('allowed_org_id'); } } @@ -563,21 +529,19 @@ class UserRightsProfile extends UserRightsAddOnAPI public function ResetCache() { // Loaded by Load cache - $this->m_aUserOrgs = array(); + $this->m_aUserOrgs = []; // Cache - $this->m_aObjectActionGrants = array(); + $this->m_aObjectActionGrants = []; $this->m_aAdministrators = null; } public function LoadCache() { static $bSharedObjectInitialized = false; - if (!$bSharedObjectInitialized) - { + if (!$bSharedObjectInitialized) { $bSharedObjectInitialized = true; - if (self::HasSharing()) - { + if (self::HasSharing()) { SharedObject::InitSharedClassProperties(); } } @@ -615,45 +579,40 @@ class UserRightsProfile extends UserRightsAddOnAPI */ public function ListProfiles($oUser) { - $aRet = array(); + $aRet = []; $oSearch = new DBObjectSearch('URP_UserProfile'); $oSearch->AllowAllData(); $oSearch->NoContextParameters(); $oSearch->Addcondition('userid', $oUser->GetKey(), '='); $oProfiles = new DBObjectSet($oSearch); - while ($oUserProfile = $oProfiles->Fetch()) - { + while ($oUserProfile = $oProfiles->Fetch()) { $aRet[$oUserProfile->Get('profileid')] = $oUserProfile->Get('profileid_friendlyname'); } return $aRet; } - public function GetSelectFilter($oUser, $sClass, $aSettings = array()) + public function GetSelectFilter($oUser, $sClass, $aSettings = []) { $this->LoadCache(); // Let us pass an administrator for bypassing the grant matrix check in order to test this method without the need to set up a complex profile // In the nominal case Administrators never end up here (since they completely bypass GetSelectFilter) - if (!static::IsAdministrator($oUser) && (MetaModel::HasCategory($sClass, 'silo') || MetaModel::HasCategory($sClass, 'bizmodel'))) - { + if (!static::IsAdministrator($oUser) && (MetaModel::HasCategory($sClass, 'silo') || MetaModel::HasCategory($sClass, 'bizmodel'))) { // N°4354 - Categories 'silo' and 'bizmodel' do check the grant matrix. Whereas 'filter' always allows to read (but the result can be filtered) $aObjectPermissions = $this->GetUserActionGrant($oUser, $sClass, UR_ACTION_READ); - if ($aObjectPermissions['permission'] == UR_ALLOWED_NO) - { + if ($aObjectPermissions['permission'] == UR_ALLOWED_NO) { return false; } } $oFilter = true; - $aConditions = array(); + $aConditions = []; // Determine if this class is part of a silo and build the filter for it $sAttCode = self::GetOwnerOrganizationAttCode($sClass); - if (!is_null($sAttCode)) - { + if (!is_null($sAttCode)) { $aUserOrgs = $this->GetUserOrgs($oUser, $sClass); - if (count($aUserOrgs) > 0) - { + if (count($aUserOrgs) > 0) { $oFilter = $this->MakeSelectFilter($sClass, $aUserOrgs, $aSettings, $sAttCode); } // else: No org means 'any org' @@ -662,20 +621,15 @@ class UserRightsProfile extends UserRightsAddOnAPI // Specific conditions to hide, for non-administrators, the Administrator Users, the Administrator Profile and related links // Note: when logged as an administrator, GetSelectFilter is completely bypassed. - if ($this->AdministratorsAreHidden()) - { - if ($sClass == 'URP_Profiles') - { + if ($this->AdministratorsAreHidden()) { + if ($sClass == 'URP_Profiles') { $oExpression = new FieldExpression('id', $sClass); $oScalarExpr = new ScalarExpression(1); $aConditions[] = new BinaryExpression($oExpression, '!=', $oScalarExpr); - } - else if (($sClass == 'URP_UserProfile') || ($sClass == 'User') || (is_subclass_of($sClass, 'User'))) - { + } elseif (($sClass == 'URP_UserProfile') || ($sClass == 'User') || (is_subclass_of($sClass, 'User'))) { $aAdministrators = $this->GetAdministrators(); - if (count($aAdministrators) > 0) - { + if (count($aAdministrators) > 0) { $sAttCode = ($sClass == 'URP_UserProfile') ? 'userid' : 'id'; $oExpression = new FieldExpression($sAttCode, $sClass); $oListExpr = ListExpression::FromScalars($aAdministrators); @@ -685,17 +639,14 @@ class UserRightsProfile extends UserRightsAddOnAPI } // Handling of the added conditions - if (count($aConditions) > 0) - { - if($oFilter === true) - { + if (count($aConditions) > 0) { + if ($oFilter === true) { // No 'silo' filter, let's build a clean one $oFilter = new DBObjectSearch($sClass); } // Add the conditions to the filter - foreach($aConditions as $oCondition) - { + foreach ($aConditions as $oCondition) { $oFilter->AddConditionExpression($oCondition); } } @@ -710,10 +661,9 @@ class UserRightsProfile extends UserRightsAddOnAPI */ private function GetAdministrators() { - if ($this->m_aAdministrators === null) - { + if ($this->m_aAdministrators === null) { // Find all administrators - $this->m_aAdministrators = array(); + $this->m_aAdministrators = []; $oAdministratorsFilter = new DBObjectSearch('User'); $oLnkFilter = new DBObjectSearch('URP_UserProfile'); $oExpression = new FieldExpression('profileid', 'URP_UserProfile'); @@ -723,9 +673,8 @@ class UserRightsProfile extends UserRightsAddOnAPI $oAdministratorsFilter->AddCondition_ReferencedBy($oLnkFilter, 'userid'); $oAdministratorsFilter->AllowAllData(true); // Mandatory to prevent infinite recursion !! $oSet = new DBObjectSet($oAdministratorsFilter); - $oSet->OptimizeColumnLoad(array('User' => array('login'))); - while($oUser = $oSet->Fetch()) - { + $oSet->OptimizeColumnLoad(['User' => ['login']]); + while ($oUser = $oSet->Fetch()) { $this->m_aAdministrators[] = $oUser->GetKey(); } } @@ -741,7 +690,6 @@ class UserRightsProfile extends UserRightsAddOnAPI return ((bool)MetaModel::GetConfig()->Get('security.hide_administrators')); } - // This verb has been made public to allow the development of an accurate feedback for the current configuration public function GetProfileActionGrant($iProfile, $sClass, $sAction) { @@ -758,33 +706,29 @@ class UserRightsProfile extends UserRightsAddOnAPI // load and cache permissions for the current user on the given class // $iUser = $oUser->GetKey(); - if (isset($this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode])){ + if (isset($this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode])) { $aTest = $this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode]; - if (is_array($aTest)) return $aTest; + if (is_array($aTest)) { + return $aTest; + } } $sAction = self::$m_aActionCodes[$iActionCode]; $bStatus = null; - // Cache user's profiles - if(false === array_key_exists($iUser, $this->aUsersProfilesList)){ - $this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser); + // Cache user's profiles + if (false === array_key_exists($iUser, $this->aUsersProfilesList)) { + $this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser); } // Call the API of UserRights because it caches the list for us - foreach($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile) - { + foreach ($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile) { $bGrant = $this->GetProfileActionGrant($iProfile, $sClass, $sAction); - if (!is_null($bGrant)) - { - if ($bGrant) - { - if (is_null($bStatus)) - { + if (!is_null($bGrant)) { + if ($bGrant) { + if (is_null($bStatus)) { $bStatus = true; } - } - else - { + } else { $bStatus = false; } } @@ -792,9 +736,9 @@ class UserRightsProfile extends UserRightsAddOnAPI $iPermission = $bStatus ? UR_ALLOWED_YES : UR_ALLOWED_NO; - $aRes = array( + $aRes = [ 'permission' => $iPermission, - ); + ]; $this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode] = $aRes; return $aRes; } @@ -809,20 +753,13 @@ class UserRightsProfile extends UserRightsAddOnAPI // Note: In most cases the object set is ignored because it was interesting to optimize for huge data sets // and acceptable to consider only the root class of the object set - if ($iPermission != UR_ALLOWED_YES) - { + if ($iPermission != UR_ALLOWED_YES) { // It is already NO for everyone... that's the final word! - } - elseif ($iActionCode == UR_ACTION_READ) - { + } elseif ($iActionCode == UR_ACTION_READ) { // We are protected by GetSelectFilter: the object set contains objects allowed or shared for reading - } - elseif ($iActionCode == UR_ACTION_BULK_READ) - { + } elseif ($iActionCode == UR_ACTION_BULK_READ) { // We are protected by GetSelectFilter: the object set contains objects allowed or shared for reading - } - elseif ($oInstanceSet) - { + } elseif ($oInstanceSet) { // We are protected by GetSelectFilter: the object set contains objects allowed or shared for reading // We have to answer NO for objects shared for reading purposes if (self::HasSharing() && SharedObject::GetSharedClassProperties($sClass)) { @@ -886,8 +823,8 @@ class UserRightsProfile extends UserRightsAddOnAPI // Note: this code is VERY close to the code of IsActionAllowed() $iUser = $oUser->GetKey(); - // Cache user's profiles - if(false === array_key_exists($iUser, $this->aUsersProfilesList)){ + // Cache user's profiles + if (false === array_key_exists($iUser, $this->aUsersProfilesList)) { $this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser); } @@ -895,20 +832,14 @@ class UserRightsProfile extends UserRightsAddOnAPI // and acceptable to consider only the root class of the object set $bStatus = null; // Call the API of UserRights because it caches the list for us - foreach($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile) - { + foreach ($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile) { $bGrant = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode); - if (!is_null($bGrant)) - { - if ($bGrant) - { - if (is_null($bStatus)) - { + if (!is_null($bGrant)) { + if ($bGrant) { + if (is_null($bStatus)) { $bStatus = true; } - } - else - { + } else { $bStatus = false; } } @@ -932,22 +863,16 @@ class UserRightsProfile extends UserRightsAddOnAPI { $sAttCode = null; - $aCallSpec = array($sClass, 'MapContextParam'); - if (($sClass == 'Organization') || is_subclass_of($sClass, 'Organization')) - { + $aCallSpec = [$sClass, 'MapContextParam']; + if (($sClass == 'Organization') || is_subclass_of($sClass, 'Organization')) { $sAttCode = 'id'; - } - elseif (is_callable($aCallSpec)) - { + } elseif (is_callable($aCallSpec)) { $sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter - if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) { // Skip silently. The data model checker will tell you something about this... $sAttCode = null; } - } - elseif(MetaModel::IsValidAttCode($sClass, 'org_id')) - { + } elseif (MetaModel::IsValidAttCode($sClass, 'org_id')) { $sAttCode = 'org_id'; } @@ -960,14 +885,11 @@ class UserRightsProfile extends UserRightsAddOnAPI protected static function HasSharing() { static $bHasSharing; - if (!isset($bHasSharing)) - { + if (!isset($bHasSharing)) { $bHasSharing = class_exists('SharedObject'); } return $bHasSharing; } } - UserRights::SelectModule('UserRightsProfile'); - diff --git a/addons/userrights/userrightsprofile.db.class.inc.php b/addons/userrights/userrightsprofile.db.class.inc.php index cba755342..f34f9135d 100644 --- a/addons/userrights/userrightsprofile.db.class.inc.php +++ b/addons/userrights/userrightsprofile.db.class.inc.php @@ -1,4 +1,5 @@ "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "name", - "complementary_name_attcode" => array('description'), + "complementary_name_attcode" => ['description'], "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_profiles", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("name", ["allowed_values" => null, "sql" => "name", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("user_list", array("linked_class"=>"URP_UserProfile", "ext_key_to_me"=>"profileid", "ext_key_to_remote"=>"userid", "allowed_values"=>null, "count_min"=>1, "count_max"=>0, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("user_list", ["linked_class" => "URP_UserProfile", "ext_key_to_me" => "profileid", "ext_key_to_remote" => "userid", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('name', 'description', 'user_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['name', 'description', 'user_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['description']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('name', 'description')); // Criteria of the std search form - MetaModel::Init_SetZListItems('default_search', array ('name', 'description')); + MetaModel::Init_SetZListItems('standard_search', ['name', 'description']); // Criteria of the std search form + MetaModel::Init_SetZListItems('default_search', ['name', 'description']); } protected $m_bCheckReservedNames = true; @@ -102,68 +100,60 @@ class URP_Profiles extends UserRightsBaseClassGUI $this->m_bCheckReservedNames = false; } - - protected static $m_aActions = array( + protected static $m_aActions = [ UR_ACTION_READ => 'Read', UR_ACTION_MODIFY => 'Modify', UR_ACTION_DELETE => 'Delete', UR_ACTION_BULK_READ => 'Bulk Read', UR_ACTION_BULK_MODIFY => 'Bulk Modify', UR_ACTION_BULK_DELETE => 'Bulk Delete', - ); + ]; protected static $m_aCacheActionGrants = null; protected static $m_aCacheStimulusGrants = null; protected static $m_aCacheProfiles = null; - + public static function DoCreateProfile($sName, $sDescription, $bReservedName = false) { - if (is_null(self::$m_aCacheProfiles)) - { - self::$m_aCacheProfiles = array(); + if (is_null(self::$m_aCacheProfiles)) { + self::$m_aCacheProfiles = []; $oFilterAll = new DBObjectSearch('URP_Profiles'); $oSet = new DBObjectSet($oFilterAll); - while ($oProfile = $oSet->Fetch()) - { + while ($oProfile = $oSet->Fetch()) { self::$m_aCacheProfiles[$oProfile->Get('name')] = $oProfile->GetKey(); } - } + } $sCacheKey = $sName; - if (isset(self::$m_aCacheProfiles[$sCacheKey])) - { + if (isset(self::$m_aCacheProfiles[$sCacheKey])) { return self::$m_aCacheProfiles[$sCacheKey]; } $oNewObj = MetaModel::NewObject("URP_Profiles"); $oNewObj->Set('name', $sName); $oNewObj->Set('description', $sDescription); - if ($bReservedName) - { - $oNewObj->DisableCheckOnReservedNames(); + if ($bReservedName) { + $oNewObj->DisableCheckOnReservedNames(); } $iId = $oNewObj->DBInsertNoReload(); - self::$m_aCacheProfiles[$sCacheKey] = $iId; + self::$m_aCacheProfiles[$sCacheKey] = $iId; return $iId; } - + public static function DoCreateActionGrant($iProfile, $iAction, $sClass, $bPermission = true) { $sAction = self::$m_aActions[$iAction]; - - if (is_null(self::$m_aCacheActionGrants)) - { - self::$m_aCacheActionGrants = array(); + + if (is_null(self::$m_aCacheActionGrants)) { + self::$m_aCacheActionGrants = []; $oFilterAll = new DBObjectSearch('URP_ActionGrant'); $oSet = new DBObjectSet($oFilterAll); - while ($oGrant = $oSet->Fetch()) - { + while ($oGrant = $oSet->Fetch()) { self::$m_aCacheActionGrants[$oGrant->Get('profileid').'-'.$oGrant->Get('action').'-'.$oGrant->Get('class')] = $oGrant->GetKey(); } - } + } $sCacheKey = "$iProfile-$sAction-$sClass"; - if (isset(self::$m_aCacheActionGrants[$sCacheKey])) - { + if (isset(self::$m_aCacheActionGrants[$sCacheKey])) { return self::$m_aCacheActionGrants[$sCacheKey]; } @@ -173,26 +163,23 @@ class URP_Profiles extends UserRightsBaseClassGUI $oNewObj->Set('class', $sClass); $oNewObj->Set('action', $sAction); $iId = $oNewObj->DBInsertNoReload(); - self::$m_aCacheActionGrants[$sCacheKey] = $iId; + self::$m_aCacheActionGrants[$sCacheKey] = $iId; return $iId; } - + public static function DoCreateStimulusGrant($iProfile, $sStimulusCode, $sClass) { - if (is_null(self::$m_aCacheStimulusGrants)) - { - self::$m_aCacheStimulusGrants = array(); + if (is_null(self::$m_aCacheStimulusGrants)) { + self::$m_aCacheStimulusGrants = []; $oFilterAll = new DBObjectSearch('URP_StimulusGrant'); $oSet = new DBObjectSet($oFilterAll); - while ($oGrant = $oSet->Fetch()) - { + while ($oGrant = $oSet->Fetch()) { self::$m_aCacheStimulusGrants[$oGrant->Get('profileid').'-'.$oGrant->Get('stimulus').'-'.$oGrant->Get('class')] = $oGrant->GetKey(); } - } + } $sCacheKey = "$iProfile-$sStimulusCode-$sClass"; - if (isset(self::$m_aCacheStimulusGrants[$sCacheKey])) - { + if (isset(self::$m_aCacheStimulusGrants[$sCacheKey])) { return self::$m_aCacheStimulusGrants[$sCacheKey]; } $oNewObj = MetaModel::NewObject("URP_StimulusGrant"); @@ -201,13 +188,13 @@ class URP_Profiles extends UserRightsBaseClassGUI $oNewObj->Set('class', $sClass); $oNewObj->Set('stimulus', $sStimulusCode); $iId = $oNewObj->DBInsertNoReload(); - self::$m_aCacheStimulusGrants[$sCacheKey] = $iId; + self::$m_aCacheStimulusGrants[$sCacheKey] = $iId; return $iId; } - + /* * Create the built-in Administrator profile with its reserved name - */ + */ public static function DoCreateAdminProfile() { self::DoCreateProfile(ADMIN_PROFILE_NAME, 'Has the rights on everything (bypassing any control)', true /* reserved name */); @@ -215,53 +202,40 @@ class URP_Profiles extends UserRightsBaseClassGUI /* * Overload the standard behavior to preserve reserved names - */ + */ public function DoCheckToWrite() { parent::DoCheckToWrite(); - if ($this->m_bCheckReservedNames) - { + if ($this->m_bCheckReservedNames) { $aChanges = $this->ListChanges(); - if (array_key_exists('name', $aChanges)) - { - if ($this->GetOriginal('name') == ADMIN_PROFILE_NAME) - { + if (array_key_exists('name', $aChanges)) { + if ($this->GetOriginal('name') == ADMIN_PROFILE_NAME) { $this->m_aCheckIssues[] = "The name of the Administrator profile must not be changed"; - } - elseif ($this->Get('name') == ADMIN_PROFILE_NAME) - { + } elseif ($this->Get('name') == ADMIN_PROFILE_NAME) { $this->m_aCheckIssues[] = ADMIN_PROFILE_NAME." is a reserved to the built-in Administrator profile"; - } - elseif ($this->GetOriginal('name') == PORTAL_PROFILE_NAME) - { + } elseif ($this->GetOriginal('name') == PORTAL_PROFILE_NAME) { $this->m_aCheckIssues[] = "The name of the User Portal profile must not be changed"; - } - elseif ($this->Get('name') == PORTAL_PROFILE_NAME) - { + } elseif ($this->Get('name') == PORTAL_PROFILE_NAME) { $this->m_aCheckIssues[] = PORTAL_PROFILE_NAME." is a reserved to the built-in User Portal profile"; } } } } - function GetGrantAsHtml($oUserRights, $sClass, $sAction) + public function GetGrantAsHtml($oUserRights, $sClass, $sAction) { $iGrant = $oUserRights->GetProfileActionGrant($this->GetKey(), $sClass, $sAction); - if (!is_null($iGrant)) - { + if (!is_null($iGrant)) { return ''.Dict::S('UI:UserManagement:ActionAllowed:Yes').''; - } - else - { + } else { return ''.Dict::S('UI:UserManagement:ActionAllowed:No').''; } } - - function DoShowGrantSumary($oPage) + + public function DoShowGrantSumary($oPage) { - if ($this->GetRawName() == "Administrator") - { + if ($this->GetRawName() == "Administrator") { // Looks dirty, but ok that's THE ONE $oPage->p(Dict::S('UI:UserManagement:AdminProfile+')); return; @@ -269,25 +243,24 @@ class URP_Profiles extends UserRightsBaseClassGUI // Note: for sure, we assume that the instance is derived from UserRightsProfile $oUserRights = UserRights::GetModuleInstance(); - - $aDisplayData = array(); - foreach (MetaModel::GetClasses('bizmodel') as $sClass) - { - // Skip non instantiable classes - if (MetaModel::IsAbstract($sClass)) continue; - $aStimuli = array(); - foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus) - { + $aDisplayData = []; + foreach (MetaModel::GetClasses('bizmodel') as $sClass) { + // Skip non instantiable classes + if (MetaModel::IsAbstract($sClass)) { + continue; + } + + $aStimuli = []; + foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus) { $oGrant = $oUserRights->GetClassStimulusGrant($this->GetKey(), $sClass, $sStimulusCode); - if (is_object($oGrant) && ($oGrant->Get('permission') == 'yes')) - { + if (is_object($oGrant) && ($oGrant->Get('permission') == 'yes')) { $aStimuli[] = ''.utils::EscapeHtml($oStimulus->GetLabel()).''; } } $sStimuli = implode(', ', $aStimuli); - - $aDisplayData[] = array( + + $aDisplayData[] = [ 'class' => MetaModel::GetName($sClass), 'read' => $this->GetGrantAsHtml($oUserRights, $sClass, 'Read'), 'bulkread' => $this->GetGrantAsHtml($oUserRights, $sClass, 'Bulk Read'), @@ -296,22 +269,22 @@ class URP_Profiles extends UserRightsBaseClassGUI 'delete' => $this->GetGrantAsHtml($oUserRights, $sClass, 'Delete'), 'bulkdelete' => $this->GetGrantAsHtml($oUserRights, $sClass, 'Bulk Delete'), 'stimuli' => $sStimuli, - ); + ]; } - - $aDisplayConfig = array(); - $aDisplayConfig['class'] = array('label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+')); - $aDisplayConfig['read'] = array('label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+')); - $aDisplayConfig['bulkread'] = array('label' => Dict::S('UI:UserManagement:Action:BulkRead'), 'description' => Dict::S('UI:UserManagement:Action:BulkRead+')); - $aDisplayConfig['write'] = array('label' => Dict::S('UI:UserManagement:Action:Modify'), 'description' => Dict::S('UI:UserManagement:Action:Modify+')); - $aDisplayConfig['bulkwrite'] = array('label' => Dict::S('UI:UserManagement:Action:BulkModify'), 'description' => Dict::S('UI:UserManagement:Action:BulkModify+')); - $aDisplayConfig['delete'] = array('label' => Dict::S('UI:UserManagement:Action:Delete'), 'description' => Dict::S('UI:UserManagement:Action:Delete+')); - $aDisplayConfig['bulkdelete'] = array('label' => Dict::S('UI:UserManagement:Action:BulkDelete'), 'description' => Dict::S('UI:UserManagement:Action:BulkDelete+')); - $aDisplayConfig['stimuli'] = array('label' => Dict::S('UI:UserManagement:Action:Stimuli'), 'description' => Dict::S('UI:UserManagement:Action:Stimuli+')); + + $aDisplayConfig = []; + $aDisplayConfig['class'] = ['label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+')]; + $aDisplayConfig['read'] = ['label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+')]; + $aDisplayConfig['bulkread'] = ['label' => Dict::S('UI:UserManagement:Action:BulkRead'), 'description' => Dict::S('UI:UserManagement:Action:BulkRead+')]; + $aDisplayConfig['write'] = ['label' => Dict::S('UI:UserManagement:Action:Modify'), 'description' => Dict::S('UI:UserManagement:Action:Modify+')]; + $aDisplayConfig['bulkwrite'] = ['label' => Dict::S('UI:UserManagement:Action:BulkModify'), 'description' => Dict::S('UI:UserManagement:Action:BulkModify+')]; + $aDisplayConfig['delete'] = ['label' => Dict::S('UI:UserManagement:Action:Delete'), 'description' => Dict::S('UI:UserManagement:Action:Delete+')]; + $aDisplayConfig['bulkdelete'] = ['label' => Dict::S('UI:UserManagement:Action:BulkDelete'), 'description' => Dict::S('UI:UserManagement:Action:BulkDelete+')]; + $aDisplayConfig['stimuli'] = ['label' => Dict::S('UI:UserManagement:Action:Stimuli'), 'description' => Dict::S('UI:UserManagement:Action:Stimuli+')]; $oPage->table($aDisplayConfig, $aDisplayData); } - function DisplayBareRelations(WebPage $oPage, $bEditMode = false) + public function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); @@ -320,41 +293,41 @@ class URP_Profiles extends UserRightsBaseClassGUI } } - - class URP_UserProfile extends UserRightsBaseClassGUI { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", - "name_attcode" => array("userlogin", "profile"), + "name_attcode" => ["userlogin", "profile"], "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_userprofile", "db_key_field" => "id", "db_finalclass_field" => "", "is_link" => true, /** @since 3.1.0 N°6482 */ - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", ["targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", ["allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"])); - MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", - array("targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array(), "allow_target_creation" => false))); - MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey( + "profileid", + ["targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => [], "allow_target_creation" => false] + )); + MetaModel::Init_AddAttribute(new AttributeExternalField("profile", ["allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name"])); - MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeString("reason", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('userid', 'profileid', 'reason')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('userid', 'profileid', 'reason')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['userid', 'profileid', 'reason']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['userid', 'profileid', 'reason']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('userid', 'profileid')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('userid', 'profileid')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['userid', 'profileid']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['userid', 'profileid']); // Criteria of the advanced search form } } @@ -362,152 +335,146 @@ class URP_UserOrg extends UserRightsBaseClassGUI { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", - "name_attcode" => array("userlogin", "allowed_org_name"), + "name_attcode" => ["userlogin", "allowed_org_name"], "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_userorg", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass"=>"User", "jointype"=> "", "allowed_values"=>null, "sql"=>"userid", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values"=>null, "extkey_attcode"=> 'userid', "target_attcode"=>"login"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", ["targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", ["allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"])); - MetaModel::Init_AddAttribute(new AttributeExternalKey("allowed_org_id", array("targetclass"=>"Organization", "jointype"=> "", "allowed_values"=>null, "sql"=>"allowed_org_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("allowed_org_name", array("allowed_values"=>null, "extkey_attcode"=> 'allowed_org_id', "target_attcode"=>"name"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("allowed_org_id", ["targetclass" => "Organization", "jointype" => "", "allowed_values" => null, "sql" => "allowed_org_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("allowed_org_name", ["allowed_values" => null, "extkey_attcode" => 'allowed_org_id', "target_attcode" => "name"])); - MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values"=>null, "sql"=>"reason", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("reason", ["allowed_values" => null, "sql" => "reason", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('userid', 'allowed_org_id', 'reason')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('allowed_org_id', 'reason')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['userid', 'allowed_org_id', 'reason']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['allowed_org_id', 'reason']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('userid', 'allowed_org_id')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('userid', 'allowed_org_id')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['userid', 'allowed_org_id']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['userid', 'allowed_org_id']); // Criteria of the advanced search form } } - class URP_ActionGrant extends UserRightsBaseClass { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "profileid", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_grant_actions", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); // Common to all grant classes (could be factorized by class inheritence, but this has to be benchmarked) - MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", array("targetclass"=>"URP_Profiles", "jointype"=> "", "allowed_values"=>null, "sql"=>"profileid", "is_null_allowed"=>false, "on_target_delete"=>DEL_SILENT, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values"=>null, "extkey_attcode"=> 'profileid', "target_attcode"=>"name"))); - MetaModel::Init_AddAttribute(new AttributeClass("class", array("class_category"=>"", "more_values"=>"", "sql"=>"class", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("permission", array("allowed_values"=>new ValueSetEnum('yes,no'), "sql"=>"permission", "default_value"=>"yes", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", ["targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_SILENT, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("profile", ["allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name"])); + MetaModel::Init_AddAttribute(new AttributeClass("class", ["class_category" => "", "more_values" => "", "sql" => "class", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("permission", ["allowed_values" => new ValueSetEnum('yes,no'), "sql" => "permission", "default_value" => "yes", "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeString("action", array("allowed_values"=>null, "sql"=>"action", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("action", ["allowed_values" => null, "sql" => "action", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('profileid', 'class', 'permission', 'action')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('class', 'permission', 'action')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['profileid', 'class', 'permission', 'action']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['class', 'permission', 'action']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('profileid', 'class', 'permission', 'action')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('profileid', 'class', 'permission', 'action')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['profileid', 'class', 'permission', 'action']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['profileid', 'class', 'permission', 'action']); // Criteria of the advanced search form } } - class URP_StimulusGrant extends UserRightsBaseClass { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "profileid", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_grant_stimulus", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); // Common to all grant classes (could be factorized by class inheritence, but this has to be benchmarked) - MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", array("targetclass"=>"URP_Profiles", "jointype"=> "", "allowed_values"=>null, "sql"=>"profileid", "is_null_allowed"=>false, "on_target_delete"=>DEL_SILENT, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values"=>null, "extkey_attcode"=> 'profileid', "target_attcode"=>"name"))); - MetaModel::Init_AddAttribute(new AttributeClass("class", array("class_category"=>"", "more_values"=>"", "sql"=>"class", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("permission", array("allowed_values"=>new ValueSetEnum('yes,no'), "sql"=>"permission", "default_value"=>"yes", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", ["targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_SILENT, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("profile", ["allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name"])); + MetaModel::Init_AddAttribute(new AttributeClass("class", ["class_category" => "", "more_values" => "", "sql" => "class", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("permission", ["allowed_values" => new ValueSetEnum('yes,no'), "sql" => "permission", "default_value" => "yes", "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeString("stimulus", array("allowed_values"=>null, "sql"=>"action", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("stimulus", ["allowed_values" => null, "sql" => "action", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('profileid', 'class', 'permission', 'stimulus')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('class', 'permission', 'stimulus')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['profileid', 'class', 'permission', 'stimulus']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['class', 'permission', 'stimulus']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('profileid', 'class', 'permission', 'stimulus')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('profileid', 'class', 'permission', 'stimulus')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['profileid', 'class', 'permission', 'stimulus']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['profileid', 'class', 'permission', 'stimulus']); // Criteria of the advanced search form } } - class URP_AttributeGrant extends UserRightsBaseClass { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "actiongrantid", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_grant_attributes", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("actiongrantid", array("targetclass"=>"URP_ActionGrant", "jointype"=> "", "allowed_values"=>null, "sql"=>"actiongrantid", "is_null_allowed"=>false, "on_target_delete"=>DEL_SILENT, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("attcode", array("allowed_values"=>null, "sql"=>"attcode", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("actiongrantid", ["targetclass" => "URP_ActionGrant", "jointype" => "", "allowed_values" => null, "sql" => "actiongrantid", "is_null_allowed" => false, "on_target_delete" => DEL_SILENT, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("attcode", ["allowed_values" => null, "sql" => "attcode", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('actiongrantid', 'attcode')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('attcode')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['actiongrantid', 'attcode']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['attcode']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('actiongrantid', 'attcode')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('actiongrantid', 'attcode')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['actiongrantid', 'attcode']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['actiongrantid', 'attcode']); // Criteria of the advanced search form } } - - - class UserRightsProfile extends UserRightsAddOnAPI { - static public $m_aActionCodes = array( + public static $m_aActionCodes = [ UR_ACTION_READ => 'read', UR_ACTION_MODIFY => 'modify', UR_ACTION_DELETE => 'delete', UR_ACTION_BULK_READ => 'bulk read', UR_ACTION_BULK_MODIFY => 'bulk modify', UR_ACTION_BULK_DELETE => 'bulk delete', - ); + ]; // Installation: create the very first user public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US') @@ -528,8 +495,7 @@ class UserRightsProfile extends UserRightsAddOnAPI $oContact = MetaModel::NewObject('Person'); $oContact->Set('name', 'My last name'); $oContact->Set('first_name', 'My first name'); - if (MetaModel::IsValidAttCode('Person', 'org_id')) - { + if (MetaModel::IsValidAttCode('Person', 'org_id')) { $oContact->Set('org_id', $iOrgId); } $oContact->Set('email', 'my.email@foo.org'); @@ -537,7 +503,6 @@ class UserRightsProfile extends UserRightsAddOnAPI } } - $oUser = new UserLocal(); $oUser->Set('login', $sAdminUser); $oUser->Set('password', $sAdminPwd); @@ -547,7 +512,7 @@ class UserRightsProfile extends UserRightsAddOnAPI $oUser->Set('language', $sLanguage); // Language was chosen during the installation // Add this user to the very specific 'admin' profile - $oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => ADMIN_PROFILE_NAME), true /*all data*/); + $oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => ADMIN_PROFILE_NAME], true /*all data*/); if (is_object($oAdminProfile)) { $oUserProfile = new URP_UserProfile(); $oUserProfile->Set('profileid', $oAdminProfile->GetKey()); @@ -564,20 +529,19 @@ class UserRightsProfile extends UserRightsAddOnAPI { } - - protected $m_aAdmins = array(); // id -> bool, true if the user has the well-known admin profile - protected $m_aPortalUsers = array(); // id -> bool, true if the user has the well-known portal user profile + protected $m_aAdmins = []; // id -> bool, true if the user has the well-known admin profile + protected $m_aPortalUsers = []; // id -> bool, true if the user has the well-known portal user profile protected $m_aProfiles; // id -> object - protected $m_aUserProfiles = array(); // userid,profileid -> object - protected $m_aUserOrgs = array(); // userid -> array of orgid + protected $m_aUserProfiles = []; // userid,profileid -> object + protected $m_aUserOrgs = []; // userid -> array of orgid // Those arrays could be completed on demand (inheriting parent permissions) protected $m_aClassActionGrants = null; // profile, class, action -> actiongrantid (or false if NO, or null/missing if undefined) - protected $m_aClassStimulusGrants = array(); // profile, class, stimulus -> permission + protected $m_aClassStimulusGrants = []; // profile, class, stimulus -> permission // Built on demand, could be optimized if necessary (doing a query for each attribute that needs to be read) - protected $m_aObjectActionGrants = array(); + protected $m_aObjectActionGrants = []; /** * Read and cache organizations allowed to the given user @@ -592,31 +556,25 @@ class UserRightsProfile extends UserRightsAddOnAPI public function GetUserOrgs($oUser, $sClass) { $iUser = $oUser->GetKey(); - if (!array_key_exists($iUser, $this->m_aUserOrgs)) - { - $this->m_aUserOrgs[$iUser] = array(); + if (!array_key_exists($iUser, $this->m_aUserOrgs)) { + $this->m_aUserOrgs[$iUser] = []; $sHierarchicalKeyCode = MetaModel::IsHierarchicalClass('Organization'); - if ($sHierarchicalKeyCode !== false) - { + if ($sHierarchicalKeyCode !== false) { $sUserOrgQuery = 'SELECT UserOrg, Org FROM Organization AS Org JOIN Organization AS Root ON Org.'.$sHierarchicalKeyCode.' BELOW Root.id JOIN URP_UserOrg AS UserOrg ON UserOrg.allowed_org_id = Root.id WHERE UserOrg.userid = :userid'; - $oUserOrgSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData($sUserOrgQuery), array(), array('userid' => $iUser)); - while ($aRow = $oUserOrgSet->FetchAssoc()) - { + $oUserOrgSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData($sUserOrgQuery), [], ['userid' => $iUser]); + while ($aRow = $oUserOrgSet->FetchAssoc()) { $oOrg = $aRow['Org']; $this->m_aUserOrgs[$iUser][] = $oOrg->GetKey(); } - } - else - { + } else { $oSearch = new DBObjectSearch('URP_UserOrg'); $oSearch->AllowAllData(); $oCondition = new BinaryExpression(new FieldExpression('userid'), '=', new VariableExpression('userid')); $oSearch->AddConditionExpression($oCondition); - - $oUserOrgSet = new DBObjectSet($oSearch, array(), array('userid' => $iUser)); - while ($oUserOrg = $oUserOrgSet->Fetch()) - { + + $oUserOrgSet = new DBObjectSet($oSearch, [], ['userid' => $iUser]); + while ($oUserOrg = $oUserOrgSet->Fetch()) { $this->m_aUserOrgs[$iUser][] = $oUserOrg->Get('allowed_org_id'); } } @@ -629,17 +587,15 @@ class UserRightsProfile extends UserRightsAddOnAPI */ protected function GetUserProfiles($iUser) { - if (!array_key_exists($iUser, $this->m_aUserProfiles)) - { + if (!array_key_exists($iUser, $this->m_aUserProfiles)) { $oSearch = new DBObjectSearch('URP_UserProfile'); $oSearch->AllowAllData(); $oCondition = new BinaryExpression(new FieldExpression('userid'), '=', new VariableExpression('userid')); $oSearch->AddConditionExpression($oCondition); - - $this->m_aUserProfiles[$iUser] = array(); - $oUserProfileSet = new DBObjectSet($oSearch, array(), array('userid' => $iUser)); - while ($oUserProfile = $oUserProfileSet->Fetch()) - { + + $this->m_aUserProfiles[$iUser] = []; + $oUserProfileSet = new DBObjectSet($oSearch, [], ['userid' => $iUser]); + while ($oUserProfile = $oUserProfileSet->Fetch()) { $this->m_aUserProfiles[$iUser][$oUserProfile->Get('profileid')] = $oUserProfile; } } @@ -650,18 +606,18 @@ class UserRightsProfile extends UserRightsAddOnAPI public function ResetCache() { // Loaded by Load cache - $this->m_aProfiles = null; - $this->m_aUserProfiles = array(); - $this->m_aUserOrgs = array(); + $this->m_aProfiles = null; + $this->m_aUserProfiles = []; + $this->m_aUserOrgs = []; - $this->m_aAdmins = array(); - $this->m_aPortalUsers = array(); + $this->m_aAdmins = []; + $this->m_aPortalUsers = []; // Loaded on demand (time consuming as compared to the others) $this->m_aClassActionGrants = null; $this->m_aClassStimulusGrants = null; - - $this->m_aObjectActionGrants = array(); + + $this->m_aObjectActionGrants = []; } // Separate load: this cache is much more time consuming while loading @@ -669,14 +625,15 @@ class UserRightsProfile extends UserRightsAddOnAPI // Could be improved by specifying the profile id public function LoadActionGrantCache() { - if (!is_null($this->m_aClassActionGrants)) return; + if (!is_null($this->m_aClassActionGrants)) { + return; + } $oKPI = new ExecutionKPI(); $oFilter = DBObjectSearch::FromOQL_AllData("SELECT URP_ActionGrant AS p WHERE p.permission = 'yes'"); $aGrants = $oFilter->ToDataArray(); - foreach($aGrants as $aGrant) - { + foreach ($aGrants as $aGrant) { $this->m_aClassActionGrants[$aGrant['profileid']][$aGrant['class']][strtolower($aGrant['action'])] = $aGrant['id']; } @@ -685,43 +642,42 @@ class UserRightsProfile extends UserRightsAddOnAPI public function LoadCache() { - if (!is_null($this->m_aProfiles)) return false; + if (!is_null($this->m_aProfiles)) { + return false; + } // Could be loaded in a shared memory (?) $oKPI = new ExecutionKPI(); - if (self::HasSharing()) - { + if (self::HasSharing()) { SharedObject::InitSharedClassProperties(); } $oProfileSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData("SELECT URP_Profiles")); - $this->m_aProfiles = array(); - while ($oProfile = $oProfileSet->Fetch()) - { - $this->m_aProfiles[$oProfile->GetKey()] = $oProfile; + $this->m_aProfiles = []; + while ($oProfile = $oProfileSet->Fetch()) { + $this->m_aProfiles[$oProfile->GetKey()] = $oProfile; } - $this->m_aClassStimulusGrants = array(); + $this->m_aClassStimulusGrants = []; $oStimGrantSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData("SELECT URP_StimulusGrant")); - $this->m_aStimGrants = array(); - while ($oStimGrant = $oStimGrantSet->Fetch()) - { + $this->m_aStimGrants = []; + while ($oStimGrant = $oStimGrantSet->Fetch()) { $this->m_aClassStimulusGrants[$oStimGrant->Get('profileid')][$oStimGrant->Get('class')][$oStimGrant->Get('stimulus')] = $oStimGrant; } $oKPI->ComputeAndReport('Load of user management cache (excepted Action Grants)'); -/* - echo "
\n";
-		print_r($this->m_aProfiles);
-		print_r($this->m_aUserProfiles);
-		print_r($this->m_aUserOrgs);
-		print_r($this->m_aClassActionGrants);
-		print_r($this->m_aClassStimulusGrants);
-		echo "
\n"; -exit; -*/ + /* + echo "
\n";
+				print_r($this->m_aProfiles);
+				print_r($this->m_aUserProfiles);
+				print_r($this->m_aUserOrgs);
+				print_r($this->m_aClassActionGrants);
+				print_r($this->m_aClassStimulusGrants);
+				echo "
\n"; + exit; + */ return true; } @@ -730,17 +686,14 @@ exit; { //$this->LoadCache(); $iUser = $oUser->GetKey(); - if (!array_key_exists($iUser, $this->m_aAdmins)) - { + if (!array_key_exists($iUser, $this->m_aAdmins)) { $bIsAdmin = false; - foreach($this->GetUserProfiles($iUser) as $oUserProfile) - { - if ($oUserProfile->Get('profile') == ADMIN_PROFILE_NAME) - { + foreach ($this->GetUserProfiles($iUser) as $oUserProfile) { + if ($oUserProfile->Get('profile') == ADMIN_PROFILE_NAME) { $bIsAdmin = true; break; - } - } + } + } $this->m_aAdmins[$iUser] = $bIsAdmin; } return $this->m_aAdmins[$iUser]; @@ -750,45 +703,39 @@ exit; { //$this->LoadCache(); $iUser = $oUser->GetKey(); - if (!array_key_exists($iUser, $this->m_aPortalUsers)) - { + if (!array_key_exists($iUser, $this->m_aPortalUsers)) { $bIsPortalUser = false; - foreach($this->GetUserProfiles($iUser) as $oUserProfile) - { - if ($oUserProfile->Get('profile') == PORTAL_PROFILE_NAME) - { + foreach ($this->GetUserProfiles($iUser) as $oUserProfile) { + if ($oUserProfile->Get('profile') == PORTAL_PROFILE_NAME) { $bIsPortalUser = true; break; - } - } + } + } $this->m_aPortalUsers[$iUser] = $bIsPortalUser; } return $this->m_aPortalUsers[$iUser]; } - public function GetSelectFilter($oUser, $sClass, $aSettings = array()) + public function GetSelectFilter($oUser, $sClass, $aSettings = []) { $this->LoadCache(); $aObjectPermissions = $this->GetUserActionGrant($oUser, $sClass, UR_ACTION_READ); - if ($aObjectPermissions['permission'] == UR_ALLOWED_NO) - { + if ($aObjectPermissions['permission'] == UR_ALLOWED_NO) { return false; } // Determine how to position the objects of this class // $sAttCode = self::GetOwnerOrganizationAttCode($sClass); - if (is_null($sAttCode)) - { + if (is_null($sAttCode)) { // No filtering for this object return true; } // Position the user // $aUserOrgs = $this->GetUserOrgs($oUser, $sClass); - if (count($aUserOrgs) == 0) - { + if (count($aUserOrgs) == 0) { // No org means 'any org' return true; } @@ -803,19 +750,15 @@ exit; // Note: action is forced lowercase to be more flexible (historical bug) $sAction = strtolower($sAction); - if (isset($this->m_aClassActionGrants[$iProfile][$sClass][$sAction])) - { + if (isset($this->m_aClassActionGrants[$iProfile][$sClass][$sAction])) { return $this->m_aClassActionGrants[$iProfile][$sClass][$sAction]; } // Recursively look for the grant record in the class hierarchy $sParentClass = MetaModel::GetParentPersistentClass($sClass); - if (empty($sParentClass)) - { + if (empty($sParentClass)) { $iGrant = null; - } - else - { + } else { // Recursively look for the grant record in the class hierarchy $iGrant = $this->GetProfileActionGrant($iProfile, $sParentClass, $sAction); } @@ -832,48 +775,43 @@ exit; // $iUser = $oUser->GetKey(); $aTest = @$this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode]; - if (is_array($aTest)) return $aTest; + if (is_array($aTest)) { + return $aTest; + } $sAction = self::$m_aActionCodes[$iActionCode]; $iPermission = UR_ALLOWED_NO; - $aAttributes = array(); - foreach($this->GetUserProfiles($iUser) as $iProfile => $oProfile) - { - $iGrant = $this->GetProfileActionGrant($iProfile, $sClass, $sAction); - if (is_null($iGrant) || !$iGrant) - { - continue; // loop to the next profile - } - else - { - $iPermission = UR_ALLOWED_YES; + $aAttributes = []; + foreach ($this->GetUserProfiles($iUser) as $iProfile => $oProfile) { + $iGrant = $this->GetProfileActionGrant($iProfile, $sClass, $sAction); + if (is_null($iGrant) || !$iGrant) { + continue; // loop to the next profile + } else { + $iPermission = UR_ALLOWED_YES; - // update the list of attributes with those allowed for this profile - // - $oSearch = DBObjectSearch::FromOQL_AllData("SELECT URP_AttributeGrant WHERE actiongrantid = :actiongrantid"); - $oSet = new DBObjectSet($oSearch, array(), array('actiongrantid' => $iGrant)); - $aProfileAttributes = $oSet->GetColumnAsArray('attcode', false); - if (count($aProfileAttributes) == 0) - { - $aAllAttributes = array_keys(MetaModel::ListAttributeDefs($sClass)); - $aAttributes = array_merge($aAttributes, $aAllAttributes); - } - else - { - $aAttributes = array_merge($aAttributes, $aProfileAttributes); - } + // update the list of attributes with those allowed for this profile + // + $oSearch = DBObjectSearch::FromOQL_AllData("SELECT URP_AttributeGrant WHERE actiongrantid = :actiongrantid"); + $oSet = new DBObjectSet($oSearch, [], ['actiongrantid' => $iGrant]); + $aProfileAttributes = $oSet->GetColumnAsArray('attcode', false); + if (count($aProfileAttributes) == 0) { + $aAllAttributes = array_keys(MetaModel::ListAttributeDefs($sClass)); + $aAttributes = array_merge($aAttributes, $aAllAttributes); + } else { + $aAttributes = array_merge($aAttributes, $aProfileAttributes); } } + } - $aRes = array( + $aRes = [ 'permission' => $iPermission, 'attributes' => $aAttributes, - ); + ]; $this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode] = $aRes; return $aRes; } - + public function IsActionAllowed($oUser, $sClass, $iActionCode, $oInstanceSet = null) { $this->LoadCache(); @@ -884,62 +822,42 @@ exit; // Note: In most cases the object set is ignored because it was interesting to optimize for huge data sets // and acceptable to consider only the root class of the object set - if ($iPermission != UR_ALLOWED_YES) - { + if ($iPermission != UR_ALLOWED_YES) { // It is already NO for everyone... that's the final word! - } - elseif ($iActionCode == UR_ACTION_READ) - { + } elseif ($iActionCode == UR_ACTION_READ) { // We are protected by GetSelectFilter: the object set contains objects allowed or shared for reading - } - elseif ($iActionCode == UR_ACTION_BULK_READ) - { + } elseif ($iActionCode == UR_ACTION_BULK_READ) { // We are protected by GetSelectFilter: the object set contains objects allowed or shared for reading - } - elseif ($oInstanceSet) - { + } elseif ($oInstanceSet) { // We are protected by GetSelectFilter: the object set contains objects allowed or shared for reading // We have to answer NO for objects shared for reading purposes - if (self::HasSharing()) - { + if (self::HasSharing()) { $aClassProps = SharedObject::GetSharedClassProperties($sClass); - if ($aClassProps) - { + if ($aClassProps) { // This class is shared, GetSelectFilter may allow some objects for read only // But currently we are checking wether the objects might be written... // Let's exclude the objects based on the relevant criteria $sOrgAttCode = self::GetOwnerOrganizationAttCode($sClass); - if (!is_null($sOrgAttCode)) - { + if (!is_null($sOrgAttCode)) { $aUserOrgs = $this->GetUserOrgs($oUser, $sClass); - if (!is_null($aUserOrgs) && count($aUserOrgs) > 0) - { + if (!is_null($aUserOrgs) && count($aUserOrgs) > 0) { $iCountNO = 0; $iCountYES = 0; $oInstanceSet->Rewind(); - while($oObject = $oInstanceSet->Fetch()) - { + while ($oObject = $oInstanceSet->Fetch()) { $iOrg = $oObject->Get($sOrgAttCode); - if (in_array($iOrg, $aUserOrgs)) - { + if (in_array($iOrg, $aUserOrgs)) { $iCountYES++; - } - else - { + } else { $iCountNO++; } } - if ($iCountNO == 0) - { + if ($iCountNO == 0) { $iPermission = UR_ALLOWED_YES; - } - elseif ($iCountYES == 0) - { + } elseif ($iCountYES == 0) { $iPermission = UR_ALLOWED_NO; - } - else - { + } else { $iPermission = UR_ALLOWED_DEPENDS; } } @@ -958,12 +876,9 @@ exit; // and acceptable to consider only the root class of the object set $aObjectPermissions = $this->GetUserActionGrant($oUser, $sClass, $iActionCode); $aAttributes = $aObjectPermissions['attributes']; - if (in_array($sAttCode, $aAttributes)) - { + if (in_array($sAttCode, $aAttributes)) { return $aObjectPermissions['permission']; - } - else - { + } else { return UR_ALLOWED_NO; } } @@ -973,12 +888,9 @@ exit; { $this->LoadCache(); - if (isset($this->m_aClassStimulusGrants[$iProfile][$sClass][$sStimulusCode])) - { + if (isset($this->m_aClassStimulusGrants[$iProfile][$sClass][$sStimulusCode])) { return $this->m_aClassStimulusGrants[$iProfile][$sClass][$sStimulusCode]; - } - else - { + } else { return null; } } @@ -992,15 +904,13 @@ exit; // Note: The object set is ignored because it was interesting to optimize for huge data sets // and acceptable to consider only the root class of the object set $iPermission = UR_ALLOWED_NO; - foreach($this->GetUserProfiles($iUser) as $iProfile => $oProfile) - { - $oGrantRecord = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode); - if (!is_null($oGrantRecord)) - { - // no need to fetch the record, we've requested the records having permission = 'yes' - $iPermission = UR_ALLOWED_YES; - } + foreach ($this->GetUserProfiles($iUser) as $iProfile => $oProfile) { + $oGrantRecord = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode); + if (!is_null($oGrantRecord)) { + // no need to fetch the record, we've requested the records having permission = 'yes' + $iPermission = UR_ALLOWED_YES; } + } return $iPermission; } @@ -1011,28 +921,22 @@ exit; /** * Find out which attribute is corresponding the the dimension 'owner org' - * returns null if no such attribute has been found (no filtering should occur) - */ + * returns null if no such attribute has been found (no filtering should occur) + */ public static function GetOwnerOrganizationAttCode($sClass) { $sAttCode = null; - $aCallSpec = array($sClass, 'MapContextParam'); - if (($sClass == 'Organization') || is_subclass_of($sClass, 'Organization')) - { + $aCallSpec = [$sClass, 'MapContextParam']; + if (($sClass == 'Organization') || is_subclass_of($sClass, 'Organization')) { $sAttCode = 'id'; - } - elseif (is_callable($aCallSpec)) - { + } elseif (is_callable($aCallSpec)) { $sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter - if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) { // Skip silently. The data model checker will tell you something about this... $sAttCode = null; } - } - elseif(MetaModel::IsValidAttCode($sClass, 'org_id')) - { + } elseif (MetaModel::IsValidAttCode($sClass, 'org_id')) { $sAttCode = 'org_id'; } @@ -1045,15 +949,11 @@ exit; protected static function HasSharing() { static $bHasSharing; - if (!isset($bHasSharing)) - { + if (!isset($bHasSharing)) { $bHasSharing = class_exists('SharedObject'); } return $bHasSharing; } } - UserRights::SelectModule('UserRightsProfile'); - -?> diff --git a/addons/userrights/userrightsprojection.class.inc.php b/addons/userrights/userrightsprojection.class.inc.php index 3f41725ef..4aa8fe564 100644 --- a/addons/userrights/userrightsprojection.class.inc.php +++ b/addons/userrights/userrightsprojection.class.inc.php @@ -1,4 +1,5 @@ "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "name", - "complementary_name_attcode" => array('description'), + "complementary_name_attcode" => ['description'], "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_profiles", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("name", ["allowed_values" => null, "sql" => "name", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("user_list", array("linked_class"=>"URP_UserProfile", "ext_key_to_me"=>"profileid", "ext_key_to_remote"=>"userid", "allowed_values"=>null, "count_min"=>1, "count_max"=>0, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("user_list", ["linked_class" => "URP_UserProfile", "ext_key_to_me" => "profileid", "ext_key_to_remote" => "userid", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('name', 'description', 'user_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['name', 'description', 'user_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['description']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('name', 'description')); // Criteria of the std search form - MetaModel::Init_SetZListItems('default_search', array ('name', 'description')); + MetaModel::Init_SetZListItems('standard_search', ['name', 'description']); // Criteria of the std search form + MetaModel::Init_SetZListItems('default_search', ['name', 'description']); } - function GetGrantAsHtml($oUserRights, $sClass, $sAction) + public function GetGrantAsHtml($oUserRights, $sClass, $sAction) { $oGrant = $oUserRights->GetClassActionGrant($this->GetKey(), $sClass, $sAction); - if (is_object($oGrant) && ($oGrant->Get('permission') == 'yes')) - { + if (is_object($oGrant) && ($oGrant->Get('permission') == 'yes')) { return ''.Dict::S('UI:UserManagement:ActionAllowed:Yes').''; - } - else - { + } else { return ''.Dict::S('UI:UserManagement:ActionAllowed:No').''; } } - - function DoShowGrantSumary($oPage) + + public function DoShowGrantSumary($oPage) { - if ($this->GetRawName() == "Administrator") - { + if ($this->GetRawName() == "Administrator") { // Looks dirty, but ok that's THE ONE $oPage->p(Dict::S('UI:UserManagement:AdminProfile+')); return; @@ -101,25 +95,24 @@ class URP_Profiles extends UserRightsBaseClass // Note: for sure, we assume that the instance is derived from UserRightsProjection $oUserRights = UserRights::GetModuleInstance(); - - $aDisplayData = array(); - foreach (MetaModel::GetClasses('bizmodel') as $sClass) - { - // Skip non instantiable classes - if (MetaModel::IsAbstract($sClass)) continue; - $aStimuli = array(); - foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus) - { + $aDisplayData = []; + foreach (MetaModel::GetClasses('bizmodel') as $sClass) { + // Skip non instantiable classes + if (MetaModel::IsAbstract($sClass)) { + continue; + } + + $aStimuli = []; + foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus) { $oGrant = $oUserRights->GetClassStimulusGrant($this->GetKey(), $sClass, $sStimulusCode); - if (is_object($oGrant) && ($oGrant->Get('permission') == 'yes')) - { + if (is_object($oGrant) && ($oGrant->Get('permission') == 'yes')) { $aStimuli[] = ''.utils::EscapeHtml($oStimulus->GetLabel()).''; } } $sStimuli = implode(', ', $aStimuli); - - $aDisplayData[] = array( + + $aDisplayData[] = [ 'class' => MetaModel::GetName($sClass), 'read' => $this->GetGrantAsHtml($oUserRights, $sClass, 'Read'), 'bulkread' => $this->GetGrantAsHtml($oUserRights, $sClass, 'Bulk Read'), @@ -128,22 +121,22 @@ class URP_Profiles extends UserRightsBaseClass 'delete' => $this->GetGrantAsHtml($oUserRights, $sClass, 'Delete'), 'bulkdelete' => $this->GetGrantAsHtml($oUserRights, $sClass, 'Bulk Delete'), 'stimuli' => $sStimuli, - ); + ]; } - - $aDisplayConfig = array(); - $aDisplayConfig['class'] = array('label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+')); - $aDisplayConfig['read'] = array('label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+')); - $aDisplayConfig['bulkread'] = array('label' => Dict::S('UI:UserManagement:Action:BulkRead'), 'description' => Dict::S('UI:UserManagement:Action:BulkRead+')); - $aDisplayConfig['write'] = array('label' => Dict::S('UI:UserManagement:Action:Modify'), 'description' => Dict::S('UI:UserManagement:Action:Modify+')); - $aDisplayConfig['bulkwrite'] = array('label' => Dict::S('UI:UserManagement:Action:BulkModify'), 'description' => Dict::S('UI:UserManagement:Action:BulkModify+')); - $aDisplayConfig['delete'] = array('label' => Dict::S('UI:UserManagement:Action:Delete'), 'description' => Dict::S('UI:UserManagement:Action:Delete+')); - $aDisplayConfig['bulkdelete'] = array('label' => Dict::S('UI:UserManagement:Action:BulkDelete'), 'description' => Dict::S('UI:UserManagement:Action:BulkDelete+')); - $aDisplayConfig['stimuli'] = array('label' => Dict::S('UI:UserManagement:Action:Stimuli'), 'description' => Dict::S('UI:UserManagement:Action:Stimuli+')); + + $aDisplayConfig = []; + $aDisplayConfig['class'] = ['label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+')]; + $aDisplayConfig['read'] = ['label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+')]; + $aDisplayConfig['bulkread'] = ['label' => Dict::S('UI:UserManagement:Action:BulkRead'), 'description' => Dict::S('UI:UserManagement:Action:BulkRead+')]; + $aDisplayConfig['write'] = ['label' => Dict::S('UI:UserManagement:Action:Modify'), 'description' => Dict::S('UI:UserManagement:Action:Modify+')]; + $aDisplayConfig['bulkwrite'] = ['label' => Dict::S('UI:UserManagement:Action:BulkModify'), 'description' => Dict::S('UI:UserManagement:Action:BulkModify+')]; + $aDisplayConfig['delete'] = ['label' => Dict::S('UI:UserManagement:Action:Delete'), 'description' => Dict::S('UI:UserManagement:Action:Delete+')]; + $aDisplayConfig['bulkdelete'] = ['label' => Dict::S('UI:UserManagement:Action:BulkDelete'), 'description' => Dict::S('UI:UserManagement:Action:BulkDelete+')]; + $aDisplayConfig['stimuli'] = ['label' => Dict::S('UI:UserManagement:Action:Stimuli'), 'description' => Dict::S('UI:UserManagement:Action:Stimuli+')]; $oPage->table($aDisplayConfig, $aDisplayData); } - function DisplayBareRelations(WebPage $oPage, $bEditMode = false) + public function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); @@ -152,34 +145,33 @@ class URP_Profiles extends UserRightsBaseClass } } - class URP_Dimensions extends UserRightsBaseClass { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "name", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_dimensions", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeClass("type", array("class_category"=>"bizmodel", "more_values"=>"String,Integer", "sql"=>"type", "default_value"=>'String', "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("name", ["allowed_values" => null, "sql" => "name", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeClass("type", ["class_category" => "bizmodel", "more_values" => "String,Integer", "sql" => "type", "default_value" => 'String', "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('name', 'description', 'type')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['name', 'description', 'type']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['description']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['name']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['name']); // Criteria of the advanced search form } public function CheckProjectionSpec($oProjectionSpec, $sProjectedClass) @@ -188,191 +180,162 @@ class URP_Dimensions extends UserRightsBaseClass $sAttribute = $oProjectionSpec->Get('attribute'); // Shortcut: "any value" or "no value" means no projection - if (empty($sExpression)) return; - if ($sExpression == '') return; + if (empty($sExpression)) { + return; + } + if ($sExpression == '') { + return; + } // 1st - compute the data type for the dimension // $sType = $this->Get('type'); - if (MetaModel::IsValidClass($sType)) - { + if (MetaModel::IsValidClass($sType)) { $sExpectedType = $sType; - } - else - { + } else { $sExpectedType = '_scalar_'; } // 2nd - compute the data type for the projection // $sTargetClass = ''; - if (($sExpression == '') || ($sExpression == '')) - { + if (($sExpression == '') || ($sExpression == '')) { $sTargetClass = $sProjectedClass; - } - elseif ($sExpression == '') - { + } elseif ($sExpression == '') { $sTargetClass = ''; - } - else - { + } else { // Evaluate wether it is a constant or not - try - { + try { $oObjectSearch = DBObjectSearch::FromOQL_AllData($sExpression); $sTargetClass = $oObjectSearch->GetClass(); - } - catch (OqlException $e) - { + } catch (OqlException $e) { } } - if (empty($sTargetClass)) - { + if (empty($sTargetClass)) { $sFoundType = '_void_'; - } - else - { - if (empty($sAttribute)) - { + } else { + if (empty($sAttribute)) { $sFoundType = $sTargetClass; - } - else - { - if (!MetaModel::IsValidAttCode($sTargetClass, $sAttribute)) - { - throw new CoreException('Unkown attribute code in projection specification', array('found' => $sAttribute, 'expecting' => MetaModel::GetAttributesList($sTargetClass), 'class' => $sTargetClass, 'projection' => $oProjectionSpec)); + } else { + if (!MetaModel::IsValidAttCode($sTargetClass, $sAttribute)) { + throw new CoreException('Unkown attribute code in projection specification', ['found' => $sAttribute, 'expecting' => MetaModel::GetAttributesList($sTargetClass), 'class' => $sTargetClass, 'projection' => $oProjectionSpec]); } $oAttDef = MetaModel::GetAttributeDef($sTargetClass, $sAttribute); - if ($oAttDef->IsExternalKey()) - { + if ($oAttDef->IsExternalKey()) { $sFoundType = $oAttDef->GetTargetClass(); - } - else - { + } else { $sFoundType = '_scalar_'; } } } // Compare the dimension type and projection type - if (($sFoundType != '_void_') && ($sFoundType != $sExpectedType)) - { - throw new CoreException('Wrong type in projection specification', array('found' => $sFoundType, 'expecting' => $sExpectedType, 'expression' => $sExpression, 'attribute' => $sAttribute, 'projection' => $oProjectionSpec)); + if (($sFoundType != '_void_') && ($sFoundType != $sExpectedType)) { + throw new CoreException('Wrong type in projection specification', ['found' => $sFoundType, 'expecting' => $sExpectedType, 'expression' => $sExpression, 'attribute' => $sAttribute, 'projection' => $oProjectionSpec]); } } } - class URP_UserProfile extends UserRightsBaseClass { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", - "name_attcode" => array("userlogin", "profile"), + "name_attcode" => ["userlogin", "profile"], "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_userprofile", "db_key_field" => "id", "db_finalclass_field" => "", "is_link" => true, /** @since 3.1.0 N°6482 */ - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", ["targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", ["allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"])); - MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", - array("targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array(), "allow_target_creation" => false))); - MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey( + "profileid", + ["targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => [], "allow_target_creation" => false] + )); + MetaModel::Init_AddAttribute(new AttributeExternalField("profile", ["allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name"])); - MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeString("reason", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('userid', 'profileid', 'reason')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('profileid', 'reason')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['userid', 'profileid', 'reason']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['profileid', 'reason']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('userid', 'profileid')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('userid', 'profileid')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['userid', 'profileid']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['userid', 'profileid']); // Criteria of the advanced search form } } - class URP_ProfileProjection extends UserRightsBaseClass { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "profileid", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_profileprojection", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("dimensionid", array("targetclass"=>"URP_Dimensions", "jointype"=> "", "allowed_values"=>null, "sql"=>"dimensionid", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("dimension", array("allowed_values"=>null, "extkey_attcode"=> 'dimensionid', "target_attcode"=>"name"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("dimensionid", ["targetclass" => "URP_Dimensions", "jointype" => "", "allowed_values" => null, "sql" => "dimensionid", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("dimension", ["allowed_values" => null, "extkey_attcode" => 'dimensionid', "target_attcode" => "name"])); - MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", array("targetclass"=>"URP_Profiles", "jointype"=> "", "allowed_values"=>null, "sql"=>"profileid", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values"=>null, "extkey_attcode"=> 'profileid', "target_attcode"=>"name"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", ["targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("profile", ["allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name"])); - MetaModel::Init_AddAttribute(new AttributeString("value", array("allowed_values"=>null, "sql"=>"value", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("attribute", array("allowed_values"=>null, "sql"=>"attribute", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("value", ["allowed_values" => null, "sql" => "value", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("attribute", ["allowed_values" => null, "sql" => "attribute", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('dimensionid', 'profileid', 'value', 'attribute')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('profileid', 'value', 'attribute')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['dimensionid', 'profileid', 'value', 'attribute']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['profileid', 'value', 'attribute']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('dimensionid', 'profileid')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('dimensionid', 'profileid')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['dimensionid', 'profileid']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['dimensionid', 'profileid']); // Criteria of the advanced search form } protected $m_aUserProjections; // cache public function ProjectUser(User $oUser) { - if (is_array($this->m_aUserProjections)) - { + if (is_array($this->m_aUserProjections)) { // Hit! return $this->m_aUserProjections; } $sExpr = $this->Get('value'); - if ($sExpr == '') - { + if ($sExpr == '') { $sColumn = $this->Get('attribute'); - if (empty($sColumn)) - { - $aRes = array($oUser->GetKey()); + if (empty($sColumn)) { + $aRes = [$oUser->GetKey()]; + } else { + $aRes = [$oUser->Get($sColumn)]; } - else - { - $aRes = array($oUser->Get($sColumn)); - } - - } - elseif (($sExpr == '') || ($sExpr == '')) - { + + } elseif (($sExpr == '') || ($sExpr == '')) { $aRes = null; - } - elseif (strtolower(substr($sExpr, 0, 6)) == 'select') - { + } elseif (strtolower(substr($sExpr, 0, 6)) == 'select') { $sColumn = $this->Get('attribute'); // SELECT... - $oValueSetDef = new ValueSetObjects($sExpr, $sColumn, array(), true /*allow all data*/); - $aRes = $oValueSetDef->GetValues(array('user' => $oUser), ''); - } - else - { + $oValueSetDef = new ValueSetObjects($sExpr, $sColumn, [], true /*allow all data*/); + $aRes = $oValueSetDef->GetValues(['user' => $oUser], ''); + } else { // Constant value(s) $aRes = explode(';', trim($sExpr)); } @@ -381,69 +344,58 @@ class URP_ProfileProjection extends UserRightsBaseClass } } - class URP_ClassProjection extends UserRightsBaseClass { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "dimensionid", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_classprojection", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("dimensionid", array("targetclass"=>"URP_Dimensions", "jointype"=> "", "allowed_values"=>null, "sql"=>"dimensionid", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("dimension", array("allowed_values"=>null, "extkey_attcode"=> 'dimensionid', "target_attcode"=>"name"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("dimensionid", ["targetclass" => "URP_Dimensions", "jointype" => "", "allowed_values" => null, "sql" => "dimensionid", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("dimension", ["allowed_values" => null, "extkey_attcode" => 'dimensionid', "target_attcode" => "name"])); - MetaModel::Init_AddAttribute(new AttributeClass("class", array("class_category"=>"", "more_values"=>"", "sql"=>"class", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeClass("class", ["class_category" => "", "more_values" => "", "sql" => "class", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeString("value", array("allowed_values"=>null, "sql"=>"value", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("attribute", array("allowed_values"=>null, "sql"=>"attribute", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("value", ["allowed_values" => null, "sql" => "value", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("attribute", ["allowed_values" => null, "sql" => "attribute", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('dimensionid', 'class', 'value', 'attribute')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('class', 'value', 'attribute')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['dimensionid', 'class', 'value', 'attribute']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['class', 'value', 'attribute']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('dimensionid', 'class')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('dimensionid', 'class')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['dimensionid', 'class']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['dimensionid', 'class']); // Criteria of the advanced search form } public function ProjectObject($oObject) { $sExpr = $this->Get('value'); - if ($sExpr == '') - { + if ($sExpr == '') { $sColumn = $this->Get('attribute'); - if (empty($sColumn)) - { - $aRes = array($oObject->GetKey()); + if (empty($sColumn)) { + $aRes = [$oObject->GetKey()]; + } else { + $aRes = [$oObject->Get($sColumn)]; } - else - { - $aRes = array($oObject->Get($sColumn)); - } - - } - elseif (($sExpr == '') || ($sExpr == '')) - { + + } elseif (($sExpr == '') || ($sExpr == '')) { $aRes = null; - } - elseif (strtolower(substr($sExpr, 0, 6)) == 'select') - { + } elseif (strtolower(substr($sExpr, 0, 6)) == 'select') { $sColumn = $this->Get('attribute'); // SELECT... - $oValueSetDef = new ValueSetObjects($sExpr, $sColumn, array(), true /*allow all data*/); - $aRes = $oValueSetDef->GetValues(array('this' => $oObject), ''); - } - else - { + $oValueSetDef = new ValueSetObjects($sExpr, $sColumn, [], true /*allow all data*/); + $aRes = $oValueSetDef->GetValues(['this' => $oObject], ''); + } else { // Constant value(s) $aRes = explode(';', trim($sExpr)); } @@ -452,122 +404,116 @@ class URP_ClassProjection extends UserRightsBaseClass } - class URP_ActionGrant extends UserRightsBaseClass { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "profileid", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_grant_actions", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); // Common to all grant classes (could be factorized by class inheritence, but this has to be benchmarked) - MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", array("targetclass"=>"URP_Profiles", "jointype"=> "", "allowed_values"=>null, "sql"=>"profileid", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values"=>null, "extkey_attcode"=> 'profileid', "target_attcode"=>"name"))); - MetaModel::Init_AddAttribute(new AttributeClass("class", array("class_category"=>"", "more_values"=>"", "sql"=>"class", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("permission", array("allowed_values"=>new ValueSetEnum('yes,no'), "sql"=>"permission", "default_value"=>"yes", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", ["targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("profile", ["allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name"])); + MetaModel::Init_AddAttribute(new AttributeClass("class", ["class_category" => "", "more_values" => "", "sql" => "class", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("permission", ["allowed_values" => new ValueSetEnum('yes,no'), "sql" => "permission", "default_value" => "yes", "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeString("action", array("allowed_values"=>null, "sql"=>"action", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("action", ["allowed_values" => null, "sql" => "action", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('profileid', 'class', 'permission', 'action')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('class', 'permission', 'action')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['profileid', 'class', 'permission', 'action']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['class', 'permission', 'action']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('profileid', 'class', 'permission', 'action')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('profileid', 'class', 'permission', 'action')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['profileid', 'class', 'permission', 'action']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['profileid', 'class', 'permission', 'action']); // Criteria of the advanced search form } } - class URP_StimulusGrant extends UserRightsBaseClass { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "profileid", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_grant_stimulus", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); // Common to all grant classes (could be factorized by class inheritence, but this has to be benchmarked) - MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", array("targetclass"=>"URP_Profiles", "jointype"=> "", "allowed_values"=>null, "sql"=>"profileid", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values"=>null, "extkey_attcode"=> 'profileid', "target_attcode"=>"name"))); - MetaModel::Init_AddAttribute(new AttributeClass("class", array("class_category"=>"", "more_values"=>"", "sql"=>"class", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("permission", array("allowed_values"=>new ValueSetEnum('yes,no'), "sql"=>"permission", "default_value"=>"yes", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", ["targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("profile", ["allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name"])); + MetaModel::Init_AddAttribute(new AttributeClass("class", ["class_category" => "", "more_values" => "", "sql" => "class", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("permission", ["allowed_values" => new ValueSetEnum('yes,no'), "sql" => "permission", "default_value" => "yes", "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeString("stimulus", array("allowed_values"=>null, "sql"=>"action", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("stimulus", ["allowed_values" => null, "sql" => "action", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('profileid', 'class', 'permission', 'stimulus')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('class', 'permission', 'stimulus')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['profileid', 'class', 'permission', 'stimulus']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['class', 'permission', 'stimulus']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('profileid', 'class', 'permission', 'stimulus')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('profileid', 'class', 'permission', 'stimulus')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['profileid', 'class', 'permission', 'stimulus']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['profileid', 'class', 'permission', 'stimulus']); // Criteria of the advanced search form } } - class URP_AttributeGrant extends UserRightsBaseClass { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/userrights", "key_type" => "autoincrement", "name_attcode" => "actiongrantid", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_urp_grant_attributes", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("actiongrantid", array("targetclass"=>"URP_ActionGrant", "jointype"=> "", "allowed_values"=>null, "sql"=>"actiongrantid", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("attcode", array("allowed_values"=>null, "sql"=>"attcode", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("actiongrantid", ["targetclass" => "URP_ActionGrant", "jointype" => "", "allowed_values" => null, "sql" => "actiongrantid", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("attcode", ["allowed_values" => null, "sql" => "attcode", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('actiongrantid', 'attcode')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('attcode')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['actiongrantid', 'attcode']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['attcode']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('actiongrantid', 'attcode')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('actiongrantid', 'attcode')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['actiongrantid', 'attcode']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['actiongrantid', 'attcode']); // Criteria of the advanced search form } } - - - class UserRightsProjection extends UserRightsAddOnAPI { - static public $m_aActionCodes = array( + public static $m_aActionCodes = [ UR_ACTION_READ => 'read', UR_ACTION_MODIFY => 'modify', UR_ACTION_DELETE => 'delete', UR_ACTION_BULK_READ => 'bulk read', UR_ACTION_BULK_MODIFY => 'bulk modify', UR_ACTION_BULK_DELETE => 'bulk delete', - ); + ]; // Installation: create the very first user public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US') @@ -587,14 +533,14 @@ class UserRightsProjection extends UserRightsAddOnAPI $oContact->Set('org_id', $iOrgId); $oContact->Set('email', 'my.email@foo.org'); $iContactId = $oContact->DBInsertNoReload(); - + $oUser = new UserLocal(); $oUser->Set('login', $sAdminUser); $oUser->Set('password', $sAdminPwd); $oUser->Set('contactid', $iContactId); $oUser->Set('language', $sLanguage); // Language was chosen during the installation $iUserId = $oUser->DBInsertNoReload(); - + // Add this user to the very specific 'admin' profile $oUserProfile = new URP_UserProfile(); $oUserProfile->Set('userid', $iUserId); @@ -606,12 +552,9 @@ class UserRightsProjection extends UserRightsAddOnAPI public function IsAdministrator($oUser) { - if (in_array($oUser->GetKey(), $this->m_aAdmins)) - { + if (in_array($oUser->GetKey(), $this->m_aAdmins)) { return true; - } - else - { + } else { return false; } } @@ -628,136 +571,113 @@ class UserRightsProjection extends UserRightsAddOnAPI //MetaModel::RegisterPlugin('userrights', 'ACbyProfile', array($this, 'CacheData')); } - protected $m_aDimensions = array(); // id -> object - protected $m_aClassProj = array(); // class,dimensionid -> object - protected $m_aProfiles = array(); // id -> object - protected $m_aUserProfiles = array(); // userid,profileid -> object - protected $m_aProPro = array(); // profileid,dimensionid -> object + protected $m_aDimensions = []; // id -> object + protected $m_aClassProj = []; // class,dimensionid -> object + protected $m_aProfiles = []; // id -> object + protected $m_aUserProfiles = []; // userid,profileid -> object + protected $m_aProPro = []; // profileid,dimensionid -> object - protected $m_aAdmins = array(); // id of users being linked to the well-known admin profile + protected $m_aAdmins = []; // id of users being linked to the well-known admin profile - protected $m_aClassActionGrants = array(); // profile, class, action -> permission - protected $m_aClassStimulusGrants = array(); // profile, class, stimulus -> permission - protected $m_aObjectActionGrants = array(); // userid, class, id, action -> permission, list of attributes + protected $m_aClassActionGrants = []; // profile, class, action -> permission + protected $m_aClassStimulusGrants = []; // profile, class, stimulus -> permission + protected $m_aObjectActionGrants = []; // userid, class, id, action -> permission, list of attributes public function CacheData() { // Could be loaded in a shared memory (?) $oDimensionSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData("SELECT URP_Dimensions")); - $this->m_aDimensions = array(); - while ($oDimension = $oDimensionSet->Fetch()) - { - $this->m_aDimensions[$oDimension->GetKey()] = $oDimension; + $this->m_aDimensions = []; + while ($oDimension = $oDimensionSet->Fetch()) { + $this->m_aDimensions[$oDimension->GetKey()] = $oDimension; } - + $oClassProjSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData("SELECT URP_ClassProjection")); - $this->m_aClassProjs = array(); - while ($oClassProj = $oClassProjSet->Fetch()) - { - $this->m_aClassProjs[$oClassProj->Get('class')][$oClassProj->Get('dimensionid')] = $oClassProj; + $this->m_aClassProjs = []; + while ($oClassProj = $oClassProjSet->Fetch()) { + $this->m_aClassProjs[$oClassProj->Get('class')][$oClassProj->Get('dimensionid')] = $oClassProj; } $oProfileSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData("SELECT URP_Profiles")); - $this->m_aProfiles = array(); - while ($oProfile = $oProfileSet->Fetch()) - { - $this->m_aProfiles[$oProfile->GetKey()] = $oProfile; + $this->m_aProfiles = []; + while ($oProfile = $oProfileSet->Fetch()) { + $this->m_aProfiles[$oProfile->GetKey()] = $oProfile; } $oUserProfileSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData("SELECT URP_UserProfile")); - $this->m_aUserProfiles = array(); - $this->m_aAdmins = array(); - while ($oUserProfile = $oUserProfileSet->Fetch()) - { + $this->m_aUserProfiles = []; + $this->m_aAdmins = []; + while ($oUserProfile = $oUserProfileSet->Fetch()) { $this->m_aUserProfiles[$oUserProfile->Get('userid')][$oUserProfile->Get('profileid')] = $oUserProfile; - if ($oUserProfile->Get('profileid') == ADMIN_PROFILE_ID) - { + if ($oUserProfile->Get('profileid') == ADMIN_PROFILE_ID) { $this->m_aAdmins[] = $oUserProfile->Get('userid'); } } $oProProSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData("SELECT URP_ProfileProjection")); - $this->m_aProPros = array(); - while ($oProPro = $oProProSet->Fetch()) - { - $this->m_aProPros[$oProPro->Get('profileid')][$oProPro->Get('dimensionid')] = $oProPro; + $this->m_aProPros = []; + while ($oProPro = $oProProSet->Fetch()) { + $this->m_aProPros[$oProPro->Get('profileid')][$oProPro->Get('dimensionid')] = $oProPro; } -/* - echo "
\n";
-		print_r($this->m_aDimensions);
-		print_r($this->m_aClassProjs);
-		print_r($this->m_aProfiles);
-		print_r($this->m_aUserProfiles);
-		print_r($this->m_aProPros);
-		echo "
\n"; -exit; -*/ + /* + echo "
\n";
+				print_r($this->m_aDimensions);
+				print_r($this->m_aClassProjs);
+				print_r($this->m_aProfiles);
+				print_r($this->m_aUserProfiles);
+				print_r($this->m_aProPros);
+				echo "
\n"; + exit; + */ return true; } - public function GetSelectFilter($oUser, $sClass, $aSettings = array()) + public function GetSelectFilter($oUser, $sClass, $aSettings = []) { - $aConditions = array(); - foreach ($this->m_aDimensions as $iDimension => $oDimension) - { + $aConditions = []; + foreach ($this->m_aDimensions as $iDimension => $oDimension) { $oClassProj = @$this->m_aClassProjs[$sClass][$iDimension]; - if (is_null($oClassProj)) - { + if (is_null($oClassProj)) { // Authorize any for this dimension, then no additional criteria is required continue; } - + // 1 - Get class projection info // $oExpression = null; $sExpr = $oClassProj->Get('value'); - if ($sExpr == '') - { + if ($sExpr == '') { $sColumn = $oClassProj->Get('attribute'); - if (empty($sColumn)) - { + if (empty($sColumn)) { $oExpression = new FieldExpression('id', $sClass); - } - else - { + } else { $oExpression = new FieldExpression($sColumn, $sClass); } - } - elseif (($sExpr == '') || ($sExpr == '')) - { + } elseif (($sExpr == '') || ($sExpr == '')) { // Authorize any for this dimension, then no additional criteria is required continue; - } - elseif (strtolower(substr($sExpr, 0, 6)) == 'select') - { - throw new CoreException('Sorry, projections by the mean of OQL are not supported currently, please specify an attribute instead', array('class' => $sClass, 'expression' => $sExpr)); - } - else - { + } elseif (strtolower(substr($sExpr, 0, 6)) == 'select') { + throw new CoreException('Sorry, projections by the mean of OQL are not supported currently, please specify an attribute instead', ['class' => $sClass, 'expression' => $sExpr]); + } else { // Constant value(s) // unsupported - throw new CoreException('Sorry, constant projections are not supported currently, please specify an attribute instead', array('class' => $sClass, 'expression' => $sExpr)); -// $aRes = explode(';', trim($sExpr)); + throw new CoreException('Sorry, constant projections are not supported currently, please specify an attribute instead', ['class' => $sClass, 'expression' => $sExpr]); + // $aRes = explode(';', trim($sExpr)); } // 2 - Get profile projection info and use it if needed // $aProjections = self::GetReadableProjectionsByDim($oUser, $sClass, $oDimension); - if (is_null($aProjections)) - { + if (is_null($aProjections)) { // Authorize any for this dimension, then no additional criteria is required continue; - } - elseif (count($aProjections) == 0) - { + } elseif (count($aProjections) == 0) { // Authorize none, then exit as quickly as possible return false; - } - else - { + } else { // Authorize the given set of values $oListExpr = ListExpression::FromScalars($aProjections); $oCondition = new BinaryExpression($oExpression, 'IN', $oListExpr); @@ -765,16 +685,12 @@ exit; } } - if (count($aConditions) == 0) - { + if (count($aConditions) == 0) { // allow all return true; - } - else - { + } else { $oFilter = new DBObjectSearch($sClass); - foreach($aConditions as $oCondition) - { + foreach ($aConditions as $oCondition) { $oFilter->AddConditionExpression($oCondition); } //return true; @@ -785,27 +701,20 @@ exit; // This verb has been made public to allow the development of an accurate feedback for the current configuration public function GetClassActionGrant($iProfile, $sClass, $sAction) { - if (isset($this->m_aClassActionGrants[$iProfile][$sClass][$sAction])) - { + if (isset($this->m_aClassActionGrants[$iProfile][$sClass][$sAction])) { return $this->m_aClassActionGrants[$iProfile][$sClass][$sAction]; } // Get the permission for this profile/class/action $oSearch = DBObjectSearch::FromOQL_AllData("SELECT URP_ActionGrant WHERE class = :class AND action = :action AND profileid = :profile AND permission = 'yes'"); - $oSet = new DBObjectSet($oSearch, array(), array('class'=>$sClass, 'action'=>$sAction, 'profile'=>$iProfile)); - if ($oSet->Count() >= 1) - { + $oSet = new DBObjectSet($oSearch, [], ['class' => $sClass, 'action' => $sAction, 'profile' => $iProfile]); + if ($oSet->Count() >= 1) { $oGrantRecord = $oSet->Fetch(); - } - else - { + } else { $sParentClass = MetaModel::GetParentPersistentClass($sClass); - if (empty($sParentClass)) - { + if (empty($sParentClass)) { $oGrantRecord = null; - } - else - { + } else { $oGrantRecord = $this->GetClassActionGrant($iProfile, $sParentClass, $sAction); } } @@ -816,149 +725,117 @@ exit; protected function GetObjectActionGrant($oUser, $sClass, $iActionCode, /*DBObject*/ $oObject = null) { - if(is_null($oObject)) - { + if (is_null($oObject)) { $iObjectRef = -999; - } - else - { + } else { $iObjectRef = $oObject->GetKey(); } // load and cache permissions for the current user on the given object // $aTest = @$this->m_aObjectActionGrants[$oUser->GetKey()][$sClass][$iObjectRef][$iActionCode]; - if (is_array($aTest)) return $aTest; + if (is_array($aTest)) { + return $aTest; + } $sAction = self::$m_aActionCodes[$iActionCode]; $iInstancePermission = UR_ALLOWED_NO; - $aAttributes = array(); - foreach($this->GetMatchingProfiles($oUser, $sClass, $oObject) as $iProfile) - { + $aAttributes = []; + foreach ($this->GetMatchingProfiles($oUser, $sClass, $oObject) as $iProfile) { $oGrantRecord = $this->GetClassActionGrant($iProfile, $sClass, $sAction); - if (is_null($oGrantRecord)) - { + if (is_null($oGrantRecord)) { continue; // loop to the next profile - } - else - { + } else { $iInstancePermission = UR_ALLOWED_YES; // update the list of attributes with those allowed for this profile // $oSearch = DBObjectSearch::FromOQL_AllData("SELECT URP_AttributeGrant WHERE actiongrantid = :actiongrantid"); - $oSet = new DBObjectSet($oSearch, array(), array('actiongrantid' => $oGrantRecord->GetKey())); + $oSet = new DBObjectSet($oSearch, [], ['actiongrantid' => $oGrantRecord->GetKey()]); $aProfileAttributes = $oSet->GetColumnAsArray('attcode', false); - if (count($aProfileAttributes) == 0) - { + if (count($aProfileAttributes) == 0) { $aAllAttributes = array_keys(MetaModel::ListAttributeDefs($sClass)); $aAttributes = array_merge($aAttributes, $aAllAttributes); - } - else - { + } else { $aAttributes = array_merge($aAttributes, $aProfileAttributes); } } } - $aRes = array( + $aRes = [ 'permission' => $iInstancePermission, 'attributes' => $aAttributes, - ); + ]; $this->m_aObjectActionGrants[$oUser->GetKey()][$sClass][$iObjectRef][$iActionCode] = $aRes; return $aRes; } - + public function IsActionAllowed($oUser, $sClass, $iActionCode, $oInstanceSet = null) { - if (is_null($oInstanceSet)) - { + if (is_null($oInstanceSet)) { $aObjectPermissions = $this->GetObjectActionGrant($oUser, $sClass, $iActionCode); return $aObjectPermissions['permission']; } $oInstanceSet->Rewind(); - while($oObject = $oInstanceSet->Fetch()) - { + while ($oObject = $oInstanceSet->Fetch()) { $aObjectPermissions = $this->GetObjectActionGrant($oUser, $sClass, $iActionCode, $oObject); $iInstancePermission = $aObjectPermissions['permission']; - if (isset($iGlobalPermission)) - { - if ($iInstancePermission != $iGlobalPermission) - { + if (isset($iGlobalPermission)) { + if ($iInstancePermission != $iGlobalPermission) { $iGlobalPermission = UR_ALLOWED_DEPENDS; break; } - } - else - { + } else { $iGlobalPermission = $iInstancePermission; } } $oInstanceSet->Rewind(); - if (isset($iGlobalPermission)) - { + if (isset($iGlobalPermission)) { return $iGlobalPermission; - } - else - { + } else { return UR_ALLOWED_NO; } } public function IsActionAllowedOnAttribute($oUser, $sClass, $sAttCode, $iActionCode, $oInstanceSet = null) { - if (is_null($oInstanceSet)) - { + if (is_null($oInstanceSet)) { $aObjectPermissions = $this->GetObjectActionGrant($oUser, $sClass, $iActionCode); $aAttributes = $aObjectPermissions['attributes']; - if (in_array($sAttCode, $aAttributes)) - { + if (in_array($sAttCode, $aAttributes)) { return $aObjectPermissions['permission']; - } - else - { + } else { return UR_ALLOWED_NO; } } $oInstanceSet->Rewind(); - while($oObject = $oInstanceSet->Fetch()) - { + while ($oObject = $oInstanceSet->Fetch()) { $aObjectPermissions = $this->GetObjectActionGrant($oUser, $sClass, $iActionCode, $oObject); $aAttributes = $aObjectPermissions['attributes']; - if (in_array($sAttCode, $aAttributes)) - { + if (in_array($sAttCode, $aAttributes)) { $iInstancePermission = $aObjectPermissions['permission']; - } - else - { - $iInstancePermission = UR_ALLOWED_NO; + } else { + $iInstancePermission = UR_ALLOWED_NO; } - if (isset($iGlobalPermission)) - { - if ($iInstancePermission != $iGlobalPermission) - { + if (isset($iGlobalPermission)) { + if ($iInstancePermission != $iGlobalPermission) { $iGlobalPermission = UR_ALLOWED_DEPENDS; } - } - else - { + } else { $iGlobalPermission = $iInstancePermission; } } $oInstanceSet->Rewind(); - if (isset($iGlobalPermission)) - { + if (isset($iGlobalPermission)) { return $iGlobalPermission; - } - else - { + } else { return UR_ALLOWED_NO; } } @@ -966,20 +843,16 @@ exit; // This verb has been made public to allow the development of an accurate feedback for the current configuration public function GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode) { - if (isset($this->m_aClassStimulusGrants[$iProfile][$sClass][$sStimulusCode])) - { + if (isset($this->m_aClassStimulusGrants[$iProfile][$sClass][$sStimulusCode])) { return $this->m_aClassStimulusGrants[$iProfile][$sClass][$sStimulusCode]; } // Get the permission for this profile/class/stimulus $oSearch = DBObjectSearch::FromOQL_AllData("SELECT URP_StimulusGrant WHERE class = :class AND stimulus = :stimulus AND profileid = :profile AND permission = 'yes'"); - $oSet = new DBObjectSet($oSearch, array(), array('class'=>$sClass, 'stimulus'=>$sStimulusCode, 'profile'=>$iProfile)); - if ($oSet->Count() >= 1) - { + $oSet = new DBObjectSet($oSearch, [], ['class' => $sClass, 'stimulus' => $sStimulusCode, 'profile' => $iProfile]); + if ($oSet->Count() >= 1) { $oGrantRecord = $oSet->Fetch(); - } - else - { + } else { $oGrantRecord = null; } @@ -991,14 +864,11 @@ exit; { // Note: this code is VERY close to the code of IsActionAllowed() - if (is_null($oInstanceSet)) - { + if (is_null($oInstanceSet)) { $iInstancePermission = UR_ALLOWED_NO; - foreach($this->GetMatchingProfiles($oUser, $sClass) as $iProfile) - { + foreach ($this->GetMatchingProfiles($oUser, $sClass) as $iProfile) { $oGrantRecord = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode); - if (!is_null($oGrantRecord)) - { + if (!is_null($oGrantRecord)) { // no need to fetch the record, we've requested the records having permission = 'yes' $iInstancePermission = UR_ALLOWED_YES; } @@ -1007,38 +877,28 @@ exit; } $oInstanceSet->Rewind(); - while($oObject = $oInstanceSet->Fetch()) - { + while ($oObject = $oInstanceSet->Fetch()) { $iInstancePermission = UR_ALLOWED_NO; - foreach($this->GetMatchingProfiles($oUser, $sClass, $oObject) as $iProfile) - { + foreach ($this->GetMatchingProfiles($oUser, $sClass, $oObject) as $iProfile) { $oGrantRecord = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode); - if (!is_null($oGrantRecord)) - { + if (!is_null($oGrantRecord)) { // no need to fetch the record, we've requested the records having permission = 'yes' $iInstancePermission = UR_ALLOWED_YES; } } - if (isset($iGlobalPermission)) - { - if ($iInstancePermission != $iGlobalPermission) - { + if (isset($iGlobalPermission)) { + if ($iInstancePermission != $iGlobalPermission) { $iGlobalPermission = UR_ALLOWED_DEPENDS; } - } - else - { + } else { $iGlobalPermission = $iInstancePermission; } } $oInstanceSet->Rewind(); - if (isset($iGlobalPermission)) - { + if (isset($iGlobalPermission)) { return $iGlobalPermission; - } - else - { + } else { return UR_ALLOWED_NO; } } @@ -1056,21 +916,17 @@ exit; $iUser = $oUser->GetKey(); $iDimension = $oDimension->GetKey(); - $aRes = array(); - if (array_key_exists($iUser, $this->m_aUserProfiles)) - { - foreach ($this->m_aUserProfiles[$iUser] as $iProfile => $oProfile) - { + $aRes = []; + if (array_key_exists($iUser, $this->m_aUserProfiles)) { + foreach ($this->m_aUserProfiles[$iUser] as $iProfile => $oProfile) { // user projection to be cached on a given page ! - if (!isset($this->m_aProPros[$iProfile][$iDimension])) - { + if (!isset($this->m_aProPros[$iProfile][$iDimension])) { // No projection for a given profile: default to 'any' return null; } $aUserProjection = $this->m_aProPros[$iProfile][$iDimension]->ProjectUser($oUser); - if (is_null($aUserProjection)) - { + if (is_null($aUserProjection)) { // No projection for a given profile: default to 'any' return null; } @@ -1091,47 +947,32 @@ exit; $iPKey = $oObject->GetKey(); $iDimension = $oDimension->GetKey(); - if (isset($this->m_aClassProjs[$sClass][$iDimension])) - { + if (isset($this->m_aClassProjs[$sClass][$iDimension])) { $aObjectProjection = $this->m_aClassProjs[$sClass][$iDimension]->ProjectObject($oObject); - } - else - { + } else { // No projection for a given class: default to 'any' $aObjectProjection = null; } - $aRes = array(); - if (array_key_exists($iUser, $this->m_aUserProfiles)) - { - foreach ($this->m_aUserProfiles[$iUser] as $iProfile => $oProfile) - { - if (is_null($aObjectProjection)) - { + $aRes = []; + if (array_key_exists($iUser, $this->m_aUserProfiles)) { + foreach ($this->m_aUserProfiles[$iUser] as $iProfile => $oProfile) { + if (is_null($aObjectProjection)) { $aRes[] = $iProfile; - } - else - { + } else { // user projection to be cached on a given page ! - if (isset($this->m_aProPros[$iProfile][$iDimension])) - { + if (isset($this->m_aProPros[$iProfile][$iDimension])) { $aUserProjection = $this->m_aProPros[$iProfile][$iDimension]->ProjectUser($oUser); - } - else - { + } else { // No projection for a given profile: default to 'any' $aUserProjection = null; } - if (is_null($aUserProjection)) - { + if (is_null($aUserProjection)) { $aRes[] = $iProfile; - } - else - { + } else { $aMatchingValues = array_intersect($aObjectProjection, $aUserProjection); - if (count($aMatchingValues) > 0) - { + if (count($aMatchingValues) > 0) { $aRes[] = $iProfile; } } @@ -1141,18 +982,15 @@ exit; return $aRes; } - protected $m_aMatchingProfiles = array(); // cache of the matching profiles for a given user/object - + protected $m_aMatchingProfiles = []; // cache of the matching profiles for a given user/object + protected function GetMatchingProfiles($oUser, $sClass, /*DBObject*/ $oObject = null) { $iUser = $oUser->GetKey(); - if(is_null($oObject)) - { + if (is_null($oObject)) { $iObjectRef = -999; - } - else - { + } else { $iObjectRef = $oObject->GetKey(); } @@ -1161,40 +999,29 @@ exit; // Caches the result // $aTest = @$this->m_aMatchingProfiles[$iUser][$sClass][$iObjectRef]; - if (is_array($aTest)) - { + if (is_array($aTest)) { return $aTest; } - if (is_null($oObject)) - { - if (array_key_exists($iUser, $this->m_aUserProfiles)) - { + if (is_null($oObject)) { + if (array_key_exists($iUser, $this->m_aUserProfiles)) { $aRes = array_keys($this->m_aUserProfiles[$iUser]); - } - else - { + } else { // no profile has been defined for this user - $aRes = array(); + $aRes = []; } - } - else - { - $aProfileRes = array(); - foreach ($this->m_aDimensions as $iDimension => $oDimension) - { - foreach ($this->GetMatchingProfilesByDim($oUser, $oObject, $oDimension) as $iProfile) - { + } else { + $aProfileRes = []; + foreach ($this->m_aDimensions as $iDimension => $oDimension) { + foreach ($this->GetMatchingProfilesByDim($oUser, $oObject, $oDimension) as $iProfile) { @$aProfileRes[$iProfile] += 1; } } - - $aRes = array(); + + $aRes = []; $iDimCount = count($this->m_aDimensions); - foreach ($aProfileRes as $iProfile => $iMatches) - { - if ($iMatches == $iDimCount) - { + foreach ($aProfileRes as $iProfile => $iMatches) { + if ($iMatches == $iDimCount) { $aRes[] = $iProfile; } } @@ -1202,7 +1029,7 @@ exit; // store into the cache $this->m_aMatchingProfiles[$iUser][$sClass][$iObjectRef] = $aRes; - return $aRes; + return $aRes; } public function FlushPrivileges() @@ -1211,7 +1038,4 @@ exit; } } - UserRights::SelectModule('UserRightsProjection'); - -?> diff --git a/app.php b/app.php index ab1bc8ef0..4b7a8f6ea 100644 --- a/app.php +++ b/app.php @@ -1,4 +1,5 @@ AddCondition_PointingTo($oFilter, $sHierarchicalKeyCode, TREE_OPERATOR_BELOW); $oSearch->AddCondition_PointingTo($oHKFilter, $sAttCode); } - } - catch (Exception $e) { + } catch (Exception $e) { // If filtering fails just ignore it } } @@ -57,4 +57,4 @@ class DBSearchHelper } } } -} \ No newline at end of file +} diff --git a/application/ajaxwebpage.class.inc.php b/application/ajaxwebpage.class.inc.php index 5317cba9a..63c3bec57 100644 --- a/application/ajaxwebpage.class.inc.php +++ b/application/ajaxwebpage.class.inc.php @@ -1,4 +1,5 @@ - /** * Class ApplicationContext * @@ -47,16 +47,16 @@ interface iDBObjectURLMaker /** * Direct end-users to the standard iTop application: UI.php - */ + */ class iTopStandardURLMaker implements iDBObjectURLMaker { - /** - * @param string $sClass - * @param string $iId - * - * @return string - * @throws \Exception - */ + /** + * @param string $sClass + * @param string $iId + * + * @return string + * @throws \Exception + */ public static function MakeObjectURL($sClass, $iId) { $sPage = DBObject::ComputeStandardUIPage($sClass); @@ -68,16 +68,16 @@ class iTopStandardURLMaker implements iDBObjectURLMaker /** * Direct end-users to the standard Portal application - */ + */ class PortalURLMaker implements iDBObjectURLMaker { - /** - * @param string $sClass - * @param string $iId - * - * @return string - * @throws \Exception - */ + /** + * @param string $sClass + * @param string $iId + * + * @return string + * @throws \Exception + */ public static function MakeObjectURL($sClass, $iId) { $sAbsoluteUrl = utils::GetAbsoluteUrlAppRoot(); @@ -86,7 +86,6 @@ class PortalURLMaker implements iDBObjectURLMaker } } - /** * Helper class to store and manipulate the parameters that make the application's context * @@ -99,99 +98,90 @@ class PortalURLMaker implements iDBObjectURLMaker */ class ApplicationContext { - public static $m_sUrlMakerClass = null; - protected static $m_aPluginProperties = null; - protected static $aDefaultValues; // Cache shared among all instances + public static $m_sUrlMakerClass = null; + protected static $m_aPluginProperties = null; + protected static $aDefaultValues; // Cache shared among all instances protected $aNames; protected $aValues; - /** - * ApplicationContext constructor. - * - * @param bool $bReadContext - * - * @throws \Exception - */ + /** + * ApplicationContext constructor. + * + * @param bool $bReadContext + * + * @throws \Exception + */ public function __construct($bReadContext = true) { - $this->aNames = array( - 'org_id', 'menu' - ); - if ($bReadContext) - { - $this->ReadContext(); + $this->aNames = [ + 'org_id', 'menu', + ]; + if ($bReadContext) { + $this->ReadContext(); } } - /** - * Read the context directly in the PHP parameters (either POST or GET) - * return nothing - * - * @throws \Exception - */ + /** + * Read the context directly in the PHP parameters (either POST or GET) + * return nothing + * + * @throws \Exception + */ protected function ReadContext() { - if (!isset(self::$aDefaultValues)) - { - self::$aDefaultValues = array(); - $aContext = utils::ReadParam('c', array(), false, 'context_param'); - foreach($this->aNames as $sName) - { + if (!isset(self::$aDefaultValues)) { + self::$aDefaultValues = []; + $aContext = utils::ReadParam('c', [], false, 'context_param'); + foreach ($this->aNames as $sName) { $sValue = isset($aContext[$sName]) ? $aContext[$sName] : ''; // TO DO: check if some of the context parameters are mandatory (or have default values) - if (!empty($sValue)) - { + if (!empty($sValue)) { self::$aDefaultValues[$sName] = $sValue; } // Hmm, there must be a better (more generic) way to handle the case below: // When there is only one possible (allowed) organization, the context must be // fixed to this org unless there is only one organization in the system then // no filter is applied - if ($sName == 'org_id') - { - if (MetaModel::IsValidClass('Organization')) - { + if ($sName == 'org_id') { + if (MetaModel::IsValidClass('Organization')) { $oSearchFilter = new DBObjectSearch('Organization'); $oSet = new CMDBObjectSet($oSearchFilter); $iCount = $oSet->CountWithLimit(2); - if ($iCount > 1) - { + if ($iCount > 1) { $oSearchFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', true); $oSet = new CMDBObjectSet($oSearchFilter); $iCount = $oSet->CountWithLimit(2); - if ($iCount == 1) - { + if ($iCount == 1) { // Only one possible value for org_id, set it in the context $oOrg = $oSet->Fetch(); self::$aDefaultValues[$sName] = $oOrg->GetKey(); } } - } + } } } } $this->aValues = self::$aDefaultValues; } - /** - * Returns the current value for the given parameter - * - * @param string $sParamName Name of the parameter to read - * @param string $defaultValue - * - * @return mixed The value for this parameter - */ + /** + * Returns the current value for the given parameter + * + * @param string $sParamName Name of the parameter to read + * @param string $defaultValue + * + * @return mixed The value for this parameter + */ public function GetCurrentValue($sParamName, $defaultValue = '') { - if (isset($this->aValues[$sParamName])) - { + if (isset($this->aValues[$sParamName])) { return $this->aValues[$sParamName]; } return $defaultValue; } - + /** * Returns the context as string with the format name1=value1&name2=value2.... * @return string The context as a string to be appended to an href property @@ -200,21 +190,20 @@ class ApplicationContext public function GetForLink(bool $bWithLeadingAmpersand = false) { // If there are no parameters, return an empty string - if(empty($this->aValues)){ + if (empty($this->aValues)) { return ''; } // Build the query string with ampersand separated parameters - $aParams = array(); - foreach($this->aValues as $sName => $sValue) - { + $aParams = []; + foreach ($this->aValues as $sName => $sValue) { $aParams[] = "c[$sName]".'='.urlencode($sValue); } $sReturnValue = implode('&', $aParams); // add the leading ampersand if requested - if($bWithLeadingAmpersand){ - $sReturnValue = '&' . $sReturnValue; + if ($bWithLeadingAmpersand) { + $sReturnValue = '&'.$sReturnValue; } return $sReturnValue; @@ -278,14 +267,13 @@ class ApplicationContext */ public function GetAsHash() { - $aReturn = array(); - foreach($this->aValues as $sName => $sValue) - { + $aReturn = []; + foreach ($this->aValues as $sName => $sValue) { $aReturn["c[$sName]"] = $sValue; } return $aReturn; } - + /** * Returns an array of the context parameters NAMEs * @return array The list of context parameters @@ -298,11 +286,10 @@ class ApplicationContext * Removes the specified parameter from the context, for example when the same parameter * is already a search parameter * @param string $sParamName Name of the parameter to remove - */ + */ public function Reset($sParamName) { - if (isset($this->aValues[$sParamName])) - { + if (isset($this->aValues[$sParamName])) { unset($this->aValues[$sParamName]); } } @@ -318,27 +305,22 @@ class ApplicationContext public function InitObjectFromContext(DBObject &$oObj) { $sClass = get_class($oObj); - foreach($this->GetNames() as $key) - { - $aCallSpec = array($sClass, 'MapContextParam'); - if (is_callable($aCallSpec)) - { - $sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter + foreach ($this->GetNames() as $key) { + $aCallSpec = [$sClass, 'MapContextParam']; + if (is_callable($aCallSpec)) { + $sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter - if (MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + if (MetaModel::IsValidAttCode($sClass, $sAttCode)) { $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - if ($oAttDef->IsWritable()) - { + if ($oAttDef->IsWritable()) { $value = $this->GetCurrentValue($key, null); - if (!is_null($value)) - { + if (!is_null($value)) { $oObj->Set($sAttCode, $value); } } } } - } + } } /** @@ -362,14 +344,10 @@ class ApplicationContext */ public static function GetUrlMakerClass() { - if (is_null(self::$m_sUrlMakerClass)) - { - if (Session::IsSet('UrlMakerClass')) - { + if (is_null(self::$m_sUrlMakerClass)) { + if (Session::IsSet('UrlMakerClass')) { self::$m_sUrlMakerClass = Session::Get('UrlMakerClass'); - } - else - { + } else { self::$m_sUrlMakerClass = 'iTopStandardURLMaker'; } } @@ -387,23 +365,23 @@ class ApplicationContext * @return string the name of the class * @throws \Exception */ - public static function MakeObjectUrl($sObjClass, $sObjKey, $sUrlMakerClass = null, $bWithNavigationContext = true) - { - $oAppContext = new ApplicationContext(); + public static function MakeObjectUrl($sObjClass, $sObjKey, $sUrlMakerClass = null, $bWithNavigationContext = true) + { + $oAppContext = new ApplicationContext(); - if (is_null($sUrlMakerClass)) { - $sUrlMakerClass = self::GetUrlMakerClass(); - } - $sUrl = call_user_func(array($sUrlMakerClass, 'MakeObjectUrl'), $sObjClass, $sObjKey); - if (utils::StrLen($sUrl) > 0) { - if ($bWithNavigationContext) { - return $sUrl.$oAppContext->GetForLink(true); - } else { - return $sUrl; - } - } else { - return ''; - } + if (is_null($sUrlMakerClass)) { + $sUrlMakerClass = self::GetUrlMakerClass(); + } + $sUrl = call_user_func([$sUrlMakerClass, 'MakeObjectUrl'], $sObjClass, $sObjKey); + if (utils::StrLen($sUrl) > 0) { + if ($bWithNavigationContext) { + return $sUrl.$oAppContext->GetForLink(true); + } else { + return $sUrl; + } + } else { + return ''; + } } /** @@ -412,13 +390,10 @@ class ApplicationContext */ protected static function LoadPluginProperties() { - if (Session::IsSet('PluginProperties')) - { + if (Session::IsSet('PluginProperties')) { self::$m_aPluginProperties = Session::Get('PluginProperties'); - } - else - { - self::$m_aPluginProperties = array(); + } else { + self::$m_aPluginProperties = []; } } @@ -431,7 +406,9 @@ class ApplicationContext */ public static function SetPluginProperty($sPluginClass, $sProperty, $value) { - if (is_null(self::$m_aPluginProperties)) self::LoadPluginProperties(); + if (is_null(self::$m_aPluginProperties)) { + self::LoadPluginProperties(); + } self::$m_aPluginProperties[$sPluginClass][$sProperty] = $value; Session::Set(['PluginProperties', $sPluginClass, $sProperty], $value); @@ -444,15 +421,14 @@ class ApplicationContext */ public static function GetPluginProperties($sPluginClass) { - if (is_null(self::$m_aPluginProperties)) self::LoadPluginProperties(); - - if (array_key_exists($sPluginClass, self::$m_aPluginProperties)) - { - return self::$m_aPluginProperties[$sPluginClass]; + if (is_null(self::$m_aPluginProperties)) { + self::LoadPluginProperties(); } - else - { - return array(); + + if (array_key_exists($sPluginClass, self::$m_aPluginProperties)) { + return self::$m_aPluginProperties[$sPluginClass]; + } else { + return []; } } diff --git a/application/applicationextension.inc.php b/application/applicationextension.inc.php index 2370f1a47..d9ebefe94 100644 --- a/application/applicationextension.inc.php +++ b/application/applicationextension.inc.php @@ -524,7 +524,7 @@ abstract class AbstractApplicationUIExtension implements iApplicationUIExtension */ public function EnumUsedAttributes($oObject) { - return array(); + return []; } /** @@ -548,7 +548,7 @@ abstract class AbstractApplicationUIExtension implements iApplicationUIExtension */ public function EnumAllowedActions(DBObjectSet $oSet) { - return array(); + return []; } } @@ -686,7 +686,7 @@ abstract class AbstractApplicationObjectExtension implements iApplicationObjectE */ public function OnCheckToWrite($oObject) { - return array(); + return []; } /** @@ -694,7 +694,7 @@ abstract class AbstractApplicationObjectExtension implements iApplicationObjectE */ public function OnCheckToDelete($oObject) { - return array(); + return []; } /** @@ -739,21 +739,21 @@ interface iPopupMenuExtension * $param is a DBObjectSet containing the list of objects * @api */ - const MENU_OBJLIST_ACTIONS = 1; + public const MENU_OBJLIST_ACTIONS = 1; /** * Insert an item into the Toolkit menu of a list * * $param is a DBObjectSet containing the list of objects * @api */ - const MENU_OBJLIST_TOOLKIT = 2; + public const MENU_OBJLIST_TOOLKIT = 2; /** * Insert an item into the Actions menu on an object details page * * $param is a DBObject instance: the object currently displayed * @api */ - const MENU_OBJDETAILS_ACTIONS = 3; + public const MENU_OBJDETAILS_ACTIONS = 3; /** * Insert an item into the Dashboard menu * @@ -763,14 +763,14 @@ interface iPopupMenuExtension * $param is a Dashboard instance: the dashboard currently displayed * @api */ - const MENU_DASHBOARD_ACTIONS = 4; + public const MENU_DASHBOARD_ACTIONS = 4; /** * Insert an item into the User menu (upper right corner) * * $param is null * @api */ - const MENU_USER_ACTIONS = 5; + public const MENU_USER_ACTIONS = 5; /** * Insert an item into the Action menu on an object item in an objects list in the portal * @@ -778,7 +778,7 @@ interface iPopupMenuExtension * the current line) * @api */ - const PORTAL_OBJLISTITEM_ACTIONS = 7; + public const PORTAL_OBJLISTITEM_ACTIONS = 7; /** * Insert an item into the Action menu on an object details page in the portal * @@ -786,7 +786,7 @@ interface iPopupMenuExtension * currently displayed) * @api */ - const PORTAL_OBJDETAILS_ACTIONS = 8; + public const PORTAL_OBJDETAILS_ACTIONS = 8; /** * Insert an item into the Actions menu of a list in the portal @@ -796,7 +796,7 @@ interface iPopupMenuExtension * * @todo */ - const PORTAL_OBJLIST_ACTIONS = 6; + public const PORTAL_OBJLIST_ACTIONS = 6; /** * Insert an item into the user menu of the portal * Note: This is not implemented yet ! @@ -805,7 +805,7 @@ interface iPopupMenuExtension * * @todo */ - const PORTAL_USER_ACTIONS = 9; + public const PORTAL_USER_ACTIONS = 9; /** * Insert an item into the navigation menu of the portal * Note: This is not implemented yet ! @@ -814,7 +814,7 @@ interface iPopupMenuExtension * * @todo */ - const PORTAL_MENU_ACTIONS = 10; + public const PORTAL_MENU_ACTIONS = 10; /** * Get the list of items to be added to a menu. @@ -864,7 +864,7 @@ abstract class ApplicationPopupMenuItem $this->sLabel = $sLabel; $this->sTooltip = ''; $this->sIconClass = ''; - $this->aCssClasses = array(); + $this->aCssClasses = []; } /** @@ -920,7 +920,6 @@ abstract class ApplicationPopupMenuItem $this->aCssClasses[] = $sCssClass; } - /** * @param $sTooltip * @@ -976,7 +975,7 @@ abstract class ApplicationPopupMenuItem /** @ignore */ public function GetLinkedScripts() { - return array(); + return []; } } @@ -1015,13 +1014,13 @@ class URLPopupMenuItem extends ApplicationPopupMenuItem /** @ignore */ public function GetMenuItem() { - return array('label' => $this->GetLabel(), + return ['label' => $this->GetLabel(), 'url' => $this->GetUrl(), 'target' => $this-> GetTarget(), 'css_classes' => $this->aCssClasses, 'icon_class' => $this->sIconClass, - 'tooltip' => $this->sTooltip - ); + 'tooltip' => $this->sTooltip, + ]; } /** @ignore */ @@ -1065,7 +1064,7 @@ class JSPopupMenuItem extends ApplicationPopupMenuItem * ans $sTarget will be ignored * @param array $aIncludeJSFiles An array of file URLs to be included (once) to provide some JS libraries for the page. */ - public function __construct($sUID, $sLabel, $sJSCode, $aIncludeJSFiles = array()) + public function __construct($sUID, $sLabel, $sJSCode, $aIncludeJSFiles = []) { parent::__construct($sUID, $sLabel); $this->sJsCode = $sJSCode; @@ -1077,14 +1076,14 @@ class JSPopupMenuItem extends ApplicationPopupMenuItem public function GetMenuItem() { // Note: the semicolumn is a must here! - return array( + return [ 'label' => $this->GetLabel(), 'onclick' => $this->GetJsCode().'; return false;', 'url' => $this->GetUrl(), 'css_classes' => $this->GetCssClasses(), 'icon_class' => $this->sIconClass, - 'tooltip' => $this->sTooltip - ); + 'tooltip' => $this->sTooltip, + ]; } /** @ignore */ @@ -1116,7 +1115,7 @@ class JSPopupMenuItem extends ApplicationPopupMenuItem */ class SeparatorPopupMenuItem extends ApplicationPopupMenuItem { - static $idx = 0; + public static $idx = 0; /** * Constructor @@ -1130,7 +1129,7 @@ class SeparatorPopupMenuItem extends ApplicationPopupMenuItem /** @ignore */ public function GetMenuItem() { - return array('label' => '', 'url' => '', 'css_classes' => $this->aCssClasses); + return ['label' => '', 'url' => '', 'css_classes' => $this->aCssClasses]; } } @@ -1143,7 +1142,6 @@ class SeparatorPopupMenuItem extends ApplicationPopupMenuItem */ class URLButtonItem extends URLPopupMenuItem { - } /** @@ -1155,7 +1153,6 @@ class URLButtonItem extends URLPopupMenuItem */ class JSButtonItem extends JSPopupMenuItem { - } /** @@ -1504,9 +1501,9 @@ interface iBackofficeDictEntriesPrefixesExtension */ interface iPortalUIExtension { - const ENUM_PORTAL_EXT_UI_BODY = 'Body'; - const ENUM_PORTAL_EXT_UI_NAVIGATION_MENU = 'NavigationMenu'; - const ENUM_PORTAL_EXT_UI_MAIN_CONTENT = 'MainContent'; + public const ENUM_PORTAL_EXT_UI_BODY = 'Body'; + public const ENUM_PORTAL_EXT_UI_NAVIGATION_MENU = 'NavigationMenu'; + public const ENUM_PORTAL_EXT_UI_MAIN_CONTENT = 'MainContent'; /** * Returns an array of CSS file urls @@ -1593,7 +1590,7 @@ abstract class AbstractPortalUIExtension implements iPortalUIExtension */ public function GetCSSFiles(Container $oContainer) { - return array(); + return []; } /** @@ -1609,7 +1606,7 @@ abstract class AbstractPortalUIExtension implements iPortalUIExtension */ public function GetJSFiles(Container $oContainer) { - return array(); + return []; } /** @@ -1729,62 +1726,62 @@ class RestResult * Result: no issue has been encountered * @api */ - const OK = 0; + public const OK = 0; /** * Result: missing/wrong credentials or the user does not have enough rights to perform the requested operation * @api */ - const UNAUTHORIZED = 1; + public const UNAUTHORIZED = 1; /** * Result: the parameter 'version' is missing * @api */ - const MISSING_VERSION = 2; + public const MISSING_VERSION = 2; /** * Result: the parameter 'json_data' is missing * @api */ - const MISSING_JSON = 3; + public const MISSING_JSON = 3; /** * Result: the input structure is not a valid JSON string * @api */ - const INVALID_JSON = 4; + public const INVALID_JSON = 4; /** * Result: the parameter 'auth_user' is missing, authentication aborted * @api */ - const MISSING_AUTH_USER = 5; + public const MISSING_AUTH_USER = 5; /** * Result: the parameter 'auth_pwd' is missing, authentication aborted * @api */ - const MISSING_AUTH_PWD = 6; + public const MISSING_AUTH_PWD = 6; /** * Result: no operation is available for the specified version * @api */ - const UNSUPPORTED_VERSION = 10; + public const UNSUPPORTED_VERSION = 10; /** * Result: the requested operation is not valid for the specified version * @api */ - const UNKNOWN_OPERATION = 11; + public const UNKNOWN_OPERATION = 11; /** * Result: the requested operation cannot be performed because it can cause data (integrity) loss * @api */ - const UNSAFE = 12; + public const UNSAFE = 12; /** * Result: the request page number is not valid. It must be an integer greater than 0 * @api */ - const INVALID_PAGE = 13; + public const INVALID_PAGE = 13; /** * Result: the operation could not be performed, see the message for troubleshooting * @api */ - const INTERNAL_ERROR = 100; + public const INTERNAL_ERROR = 100; /** * Default constructor - ok! @@ -1807,7 +1804,7 @@ class RestResult * @api */ public $message; - + /** * Sanitize the content of this result to hide sensitive information */ @@ -1854,17 +1851,13 @@ class RestUtils */ public static function GetMandatoryParam($oData, $sParamName) { - if (isset($oData->$sParamName)) - { + if (isset($oData->$sParamName)) { return $oData->$sParamName; - } - else - { + } else { throw new Exception("Missing parameter '$sParamName'"); } } - /** * Read an optional parameter from a Rest/Json structure. * @@ -1879,17 +1872,13 @@ class RestUtils */ public static function GetOptionalParam($oData, $sParamName, $default) { - if (isset($oData->$sParamName)) - { + if (isset($oData->$sParamName)) { return $oData->$sParamName; - } - else - { + } else { return $default; } } - /** * Read a class from a Rest/Json structure. * @@ -1903,15 +1892,13 @@ class RestUtils public static function GetClass($oData, $sParamName) { $sClass = self::GetMandatoryParam($oData, $sParamName); - if (!MetaModel::IsValidClass($sClass)) - { + if (!MetaModel::IsValidClass($sClass)) { throw new Exception("$sParamName: '$sClass' is not a valid class'"); } return $sClass; } - /** * Read a list of attribute codes from a Rest/Json structure. * @@ -1927,31 +1914,21 @@ class RestUtils public static function GetFieldList($sClass, $oData, $sParamName) { $sFields = self::GetOptionalParam($oData, $sParamName, '*'); - $aShowFields = array(); - if ($sFields == '*') - { - foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { + $aShowFields = []; + if ($sFields == '*') { + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { $aShowFields[$sClass][] = $sAttCode; } - } - elseif ($sFields == '*+') - { - foreach (MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL) as $sRefClass) - { - foreach (MetaModel::ListAttributeDefs($sRefClass) as $sAttCode => $oAttDef) - { + } elseif ($sFields == '*+') { + foreach (MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL) as $sRefClass) { + foreach (MetaModel::ListAttributeDefs($sRefClass) as $sAttCode => $oAttDef) { $aShowFields[$sRefClass][] = $sAttCode; } } - } - else - { - foreach (explode(',', $sFields) as $sAttCode) - { + } else { + foreach (explode(',', $sFields) as $sAttCode) { $sAttCode = trim($sAttCode); - if (($sAttCode != 'id') && (!MetaModel::IsValidAttCode($sClass, $sAttCode))) - { + if (($sAttCode != 'id') && (!MetaModel::IsValidAttCode($sClass, $sAttCode))) { throw new Exception("$sParamName: invalid attribute code '$sAttCode'"); } $aShowFields[$sClass][] = $sAttCode; @@ -1974,38 +1951,30 @@ class RestUtils */ protected static function FindObjectFromCriteria($sClass, $oCriteria) { - $aCriteriaReport = array(); - if (isset($oCriteria->finalclass)) - { - if (!MetaModel::IsValidClass($oCriteria->finalclass)) - { + $aCriteriaReport = []; + if (isset($oCriteria->finalclass)) { + if (!MetaModel::IsValidClass($oCriteria->finalclass)) { throw new Exception("finalclass: Unknown class '".$oCriteria->finalclass."'"); } - if (!MetaModel::IsParentClass($sClass, $oCriteria->finalclass)) - { + if (!MetaModel::IsParentClass($sClass, $oCriteria->finalclass)) { throw new Exception("finalclass: '".$oCriteria->finalclass."' is not a child class of '$sClass'"); } $sClass = $oCriteria->finalclass; } $oSearch = new DBObjectSearch($sClass); - foreach ($oCriteria as $sAttCode => $value) - { + foreach ($oCriteria as $sAttCode => $value) { $realValue = static::MakeValue($sClass, $sAttCode, $value); $oSearch->AddCondition($sAttCode, $realValue, '='); - if (is_object($value) || is_array($value)) - { + if (is_object($value) || is_array($value)) { $value = json_encode($value); } $aCriteriaReport[] = "$sAttCode: $value ($realValue)"; } $oSet = new DBObjectSet($oSearch); $iCount = $oSet->Count(); - if ($iCount == 0) - { + if ($iCount == 0) { throw new Exception("No item found with criteria: ".implode(', ', $aCriteriaReport)); - } - elseif ($iCount > 1) - { + } elseif ($iCount > 1) { throw new Exception("Several items found ($iCount) with criteria: ".implode(', ', $aCriteriaReport)); } $res = $oSet->Fetch(); @@ -2013,7 +1982,6 @@ class RestUtils return $res; } - /** * Find an object from a polymorph search specification (Rest/Json) * @@ -2029,43 +1997,29 @@ class RestUtils */ public static function FindObjectFromKey($sClass, $key, $bAllowNullValue = false) { - if (is_object($key)) - { + if (is_object($key)) { $res = static::FindObjectFromCriteria($sClass, $key); - } - elseif (is_numeric($key)) - { - if ($bAllowNullValue && ($key == 0)) - { + } elseif (is_numeric($key)) { + if ($bAllowNullValue && ($key == 0)) { $res = null; - } - else - { + } else { $res = MetaModel::GetObject($sClass, $key, false); - if (is_null($res)) - { + if (is_null($res)) { throw new Exception("Invalid object $sClass::$key"); } } - } - elseif (is_string($key)) - { + } elseif (is_string($key)) { // OQL $oSearch = DBObjectSearch::FromOQL($key); $oSet = new DBObjectSet($oSearch); $iCount = $oSet->Count(); - if ($iCount == 0) - { + if ($iCount == 0) { throw new Exception("No item found for query: $key"); - } - elseif ($iCount > 1) - { + } elseif ($iCount > 1) { throw new Exception("Several items found ($iCount) for query: $key"); } $res = $oSet->Fetch(); - } - else - { + } else { throw new Exception("Wrong format for key"); } @@ -2086,47 +2040,37 @@ class RestUtils */ public static function GetObjectSetFromKey($sClass, $key, $iLimit = 0, $iOffset = 0) { - if (is_object($key)) - { - if (isset($key->finalclass)) - { + if (is_object($key)) { + if (isset($key->finalclass)) { $sClass = $key->finalclass; - if (!MetaModel::IsValidClass($sClass)) - { + if (!MetaModel::IsValidClass($sClass)) { throw new Exception("finalclass: Unknown class '$sClass'"); } } $oSearch = new DBObjectSearch($sClass); - foreach ($key as $sAttCode => $value) - { + foreach ($key as $sAttCode => $value) { $realValue = static::MakeValue($sClass, $sAttCode, $value); $oSearch->AddCondition($sAttCode, $realValue, '='); } - } - elseif (is_numeric($key)) - { + } elseif (is_numeric($key)) { $oSearch = new DBObjectSearch($sClass); $oSearch->AddCondition('id', $key); - } - elseif (is_string($key)) - { + } elseif (is_string($key)) { // OQL - try { - $oSearch = DBObjectSearch::FromOQL($key); - } catch (Exception $e) { - throw new CoreOqlException('Query failed to execute', [ - 'query' => $key, - 'exception_class' => get_class($e), - 'exception_message' => $e->getMessage(), - ]); - } - } - else - { + try { + $oSearch = DBObjectSearch::FromOQL($key); + } catch (Exception $e) { + throw new CoreOqlException('Query failed to execute', [ + 'query' => $key, + 'exception_class' => get_class($e), + 'exception_message' => $e->getMessage(), + ]); + } + } else { throw new Exception("Wrong format for key"); } - $oObjectSet = new DBObjectSet($oSearch, array(), array(), null, $iLimit, $iOffset); + $oObjectSet = new DBObjectSet($oSearch, [], [], null, $iLimit, $iOffset); return $oObjectSet; } @@ -2144,53 +2088,38 @@ class RestUtils */ public static function MakeValue($sClass, $sAttCode, $value) { - try - { - if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + try { + if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) { throw new Exception("Unknown attribute"); } $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - if ($oAttDef instanceof AttributeExternalKey) - { + if ($oAttDef instanceof AttributeExternalKey) { $oExtKeyObject = static::FindObjectFromKey($oAttDef->GetTargetClass(), $value, true /* allow null */); $value = ($oExtKeyObject != null) ? $oExtKeyObject->GetKey() : 0; - } - elseif ($oAttDef instanceof AttributeLinkedSet) - { - if (!is_array($value)) - { + } elseif ($oAttDef instanceof AttributeLinkedSet) { + if (!is_array($value)) { throw new Exception("A link set must be defined by an array of objects"); } $sLnkClass = $oAttDef->GetLinkedClass(); - $aLinks = array(); - foreach ($value as $oValues) - { + $aLinks = []; + foreach ($value as $oValues) { $oLnk = static::MakeObjectFromFields($sLnkClass, $oValues); // Fix for N°1939 - if (($oAttDef instanceof AttributeLinkedSetIndirect) && ($oLnk->Get($oAttDef->GetExtKeyToRemote()) == 0)) - { + if (($oAttDef instanceof AttributeLinkedSetIndirect) && ($oLnk->Get($oAttDef->GetExtKeyToRemote()) == 0)) { continue; } $aLinks[] = $oLnk; } $value = DBObjectSet::FromArray($sLnkClass, $aLinks); - } - elseif ($oAttDef instanceof AttributeTagSet) - { - if (!is_array($value)) - { + } elseif ($oAttDef instanceof AttributeTagSet) { + if (!is_array($value)) { throw new Exception("A tag set must be defined by an array of tag codes"); } $value = $oAttDef->FromJSONToValue($value); - } - else - { + } else { $value = $oAttDef->FromJSONToValue($value); } - } - catch (Exception $e) - { + } catch (Exception $e) { throw new Exception("$sAttCode: ".$e->getMessage(), $e->getCode()); } @@ -2210,15 +2139,11 @@ class RestUtils public static function MakeObjectFromFields($sClass, $aFields) { $oObject = MetaModel::NewObject($sClass); - foreach ($aFields as $sAttCode => $value) - { + foreach ($aFields as $sAttCode => $value) { $realValue = static::MakeValue($sClass, $sAttCode, $value); - try - { + try { $oObject->Set($sAttCode, $realValue); - } - catch (Exception $e) - { + } catch (Exception $e) { throw new Exception("$sAttCode: ".$e->getMessage(), $e->getCode()); } } @@ -2239,15 +2164,11 @@ class RestUtils public static function UpdateObjectFromFields($oObject, $aFields) { $sClass = get_class($oObject); - foreach ($aFields as $sAttCode => $value) - { + foreach ($aFields as $sAttCode => $value) { $realValue = static::MakeValue($sClass, $sAttCode, $value); - try - { + try { $oObject->Set($sAttCode, $realValue); - } - catch (Exception $e) - { + } catch (Exception $e) { throw new Exception("$sAttCode: ".$e->getMessage(), $e->getCode()); } } @@ -2256,7 +2177,6 @@ class RestUtils } } - /** * Helpers for modules extensibility, with discover performed by the MetaModel. * @@ -2279,21 +2199,21 @@ interface iModuleExtension */ interface iKPILoggerExtension { - /** - * Init the statistics collected - * - * @return void - */ - public function InitStats(); + /** + * Init the statistics collected + * + * @return void + */ + public function InitStats(); - /** - * Add a new KPI to the stats - * - * @param \Combodo\iTop\Core\Kpi\KpiLogData $oKpiLogData - * - * @return mixed - */ - public function LogOperation($oKpiLogData); + /** + * Add a new KPI to the stats + * + * @param \Combodo\iTop\Core\Kpi\KpiLogData $oKpiLogData + * + * @return mixed + */ + public function LogOperation($oKpiLogData); } /** @@ -2311,7 +2231,6 @@ interface iBackupExtraFilesExtension public function GetExtraFilesRelPaths(): array; } - /** * Interface to provide messages to be displayed in the "Welcome Popup" * @@ -2372,7 +2291,7 @@ abstract class AbstractWelcomePopupExtension implements iWelcomePopupExtension { return []; } - + /** * @inheritDoc */ @@ -2381,4 +2300,4 @@ abstract class AbstractWelcomePopupExtension implements iWelcomePopupExtension // No need to process the acknowledgment notice by default return; } -} \ No newline at end of file +} diff --git a/application/audit.category.class.inc.php b/application/audit.category.class.inc.php index 2ffeb2d58..d5549b8f8 100644 --- a/application/audit.category.class.inc.php +++ b/application/audit.category.class.inc.php @@ -1,9 +1,10 @@ - /** * This class manages the audit "categories". Each category defines a set of objects * to check and is linked to a set of rules that determine the valid or invalid objects @@ -32,34 +32,36 @@ class AuditCategory extends cmdbAbstractObject { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "application,grant_by_profile", "key_type" => "autoincrement", "name_attcode" => "name", "state_attcode" => "", - "reconc_keys" => array('name'), + "reconc_keys" => ['name'], "db_table" => "priv_auditcategory", "db_key_field" => "id", "db_finalclass_field" => "", 'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-audit-folder.svg'), - ); + ]; MetaModel::Init_Params($aParams); - MetaModel::Init_AddAttribute(new AttributeString("name", array("description"=>"Short name for this category", "allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeOQL("definition_set", array("allowed_values"=>null, "sql"=>"definition_set", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeLinkedSet("rules_list", array("linked_class"=>"AuditRule", "ext_key_to_me"=>"category_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array(), "edit_mode" => LINKSET_EDITMODE_INPLACE, "tracking_level" => LINKSET_TRACKING_ALL))); - MetaModel::Init_AddAttribute(new AttributeInteger("ok_error_tolerance", array("allowed_values"=>null, "sql"=>"ok_error_tolerance", "default_value"=>5, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeInteger("warning_error_tolerance", array("allowed_values" => null, "sql" => "warning_error_tolerance", "default_value" => 25, "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("domains_list", - array("linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "category_id", "ext_key_to_remote" => "domain_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array(), "display_style" => 'property'))); + MetaModel::Init_AddAttribute(new AttributeString("name", ["description" => "Short name for this category", "allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeOQL("definition_set", ["allowed_values" => null, "sql" => "definition_set", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeLinkedSet("rules_list", ["linked_class" => "AuditRule", "ext_key_to_me" => "category_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => [], "edit_mode" => LINKSET_EDITMODE_INPLACE, "tracking_level" => LINKSET_TRACKING_ALL])); + MetaModel::Init_AddAttribute(new AttributeInteger("ok_error_tolerance", ["allowed_values" => null, "sql" => "ok_error_tolerance", "default_value" => 5, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeInteger("warning_error_tolerance", ["allowed_values" => null, "sql" => "warning_error_tolerance", "default_value" => 25, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect( + "domains_list", + ["linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "category_id", "ext_key_to_remote" => "domain_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => [], "display_style" => 'property'] + )); // Display lists - MetaModel::Init_SetZListItems('details', array('name', 'description', 'definition_set', 'ok_error_tolerance', 'warning_error_tolerance', 'rules_list', 'domains_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('description', )); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['name', 'description', 'definition_set', 'ok_error_tolerance', 'warning_error_tolerance', 'rules_list', 'domains_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['description', ]); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('description', 'definition_set')); // Criteria of the std search form - MetaModel::Init_SetZListItems('default_search', array('name', 'description')); // Criteria of the default search form + MetaModel::Init_SetZListItems('standard_search', ['description', 'definition_set']); // Criteria of the std search form + MetaModel::Init_SetZListItems('default_search', ['name', 'description']); // Criteria of the default search form } /** @@ -74,9 +76,9 @@ class AuditCategory extends cmdbAbstractObject public function GetReportColor($iTotal, $iErrors) { $sResult = 'red'; - if ( ($iTotal == 0) || ($iErrors / $iTotal) <= ($this->Get('ok_error_tolerance') / 100) ) { + if (($iTotal == 0) || ($iErrors / $iTotal) <= ($this->Get('ok_error_tolerance') / 100)) { $sResult = 'green'; - } else if (($iErrors / $iTotal) <= ($this->Get('warning_error_tolerance') / 100)) { + } elseif (($iErrors / $iTotal) <= ($this->Get('warning_error_tolerance') / 100)) { $sResult = 'orange'; } @@ -93,4 +95,3 @@ class AuditCategory extends cmdbAbstractObject return $aShortcutActions; } } -?> diff --git a/application/audit.domain.class.inc.php b/application/audit.domain.class.inc.php index 5e8f56e5f..8da740a82 100644 --- a/application/audit.domain.class.inc.php +++ b/application/audit.domain.class.inc.php @@ -1,4 +1,5 @@ - /** * This class manages the audit "categories". Each category defines a set of objects * to check and is linked to a set of rules that determine the valid or invalid objects @@ -33,32 +33,34 @@ class AuditDomain extends cmdbAbstractObject { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "application,grant_by_profile", "key_type" => "autoincrement", "name_attcode" => "name", - "complementary_name_attcode" => array('description'), + "complementary_name_attcode" => ['description'], "state_attcode" => "", - "reconc_keys" => array('name'), + "reconc_keys" => ['name'], "db_table" => "priv_auditdomain", "db_key_field" => "id", "db_finalclass_field" => "", 'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-audit-album.svg'), - ); + ]; MetaModel::Init_Params($aParams); - MetaModel::Init_AddAttribute(new AttributeString("name", array("description" => "Short name for this category", "allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeImage("icon", array("is_null_allowed" => true, "depends_on" => array(), "display_max_width" => 96, "display_max_height" => 96, "storage_max_width" => 256, "storage_max_height" => 256, "default_image" => null, "always_load_in_tables" => false))); - MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("categories_list", - array("linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "domain_id", "ext_key_to_remote" => "category_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeString("name", ["description" => "Short name for this category", "allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeImage("icon", ["is_null_allowed" => true, "depends_on" => [], "display_max_width" => 96, "display_max_height" => 96, "storage_max_width" => 256, "storage_max_height" => 256, "default_image" => null, "always_load_in_tables" => false])); + MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect( + "categories_list", + ["linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "domain_id", "ext_key_to_remote" => "category_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => []] + )); // Display lists - MetaModel::Init_SetZListItems('details', array('name', 'description', 'icon', 'categories_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('description',)); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['name', 'description', 'icon', 'categories_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['description',]); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('description')); // Criteria of the std search form - MetaModel::Init_SetZListItems('default_search', array('name', 'description')); // Criteria of the default search form + MetaModel::Init_SetZListItems('standard_search', ['description']); // Criteria of the std search form + MetaModel::Init_SetZListItems('default_search', ['name', 'description']); // Criteria of the default search form } public static function GetShortcutActions($sFinalClass) @@ -84,40 +86,39 @@ class lnkAuditCategoryToAuditDomain extends cmdbAbstractObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "application,grant_by_profile", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array('category_id', 'domain_id'), + "reconc_keys" => ['category_id', 'domain_id'], "db_table" => "priv_link_audit_category_domain", "db_key_field" => "id", "db_finalclass_field" => "", "is_link" => true, - 'uniqueness_rules' => array( - 'no_duplicate' => array( - 'attributes' => array( + 'uniqueness_rules' => [ + 'no_duplicate' => [ + 'attributes' => [ 0 => 'category_id', 1 => 'domain_id', - ), + ], 'filter' => '', 'disabled' => false, 'is_blocking' => true, - ), - ), - ); + ], + ], + ]; MetaModel::Init_Params($aParams); - MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", array("targetclass" => "AuditCategory", "jointype" => '', "allowed_values" => null, "sql" => "category_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", array("allowed_values" => null, "extkey_attcode" => 'category_id', "target_attcode" => "name"))); - MetaModel::Init_AddAttribute(new AttributeExternalKey("domain_id", array("targetclass" => "AuditDomain", "jointype" => '', "allowed_values" => null, "sql" => "domain_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("domain_name", array("allowed_values" => null, "extkey_attcode" => 'domain_id', "target_attcode" => "name"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", ["targetclass" => "AuditCategory", "jointype" => '', "allowed_values" => null, "sql" => "category_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", ["allowed_values" => null, "extkey_attcode" => 'category_id', "target_attcode" => "name"])); + MetaModel::Init_AddAttribute(new AttributeExternalKey("domain_id", ["targetclass" => "AuditDomain", "jointype" => '', "allowed_values" => null, "sql" => "domain_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("domain_name", ["allowed_values" => null, "extkey_attcode" => 'domain_id', "target_attcode" => "name"])); // Display lists - MetaModel::Init_SetZListItems('details', array('category_id', 'domain_id')); - MetaModel::Init_SetZListItems('list', array('category_id', 'domain_id')); + MetaModel::Init_SetZListItems('details', ['category_id', 'domain_id']); + MetaModel::Init_SetZListItems('list', ['category_id', 'domain_id']); // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('category_id', 'domain_id')); + MetaModel::Init_SetZListItems('standard_search', ['category_id', 'domain_id']); } } - diff --git a/application/audit.rule.class.inc.php b/application/audit.rule.class.inc.php index af3cb093a..2da2e28ef 100644 --- a/application/audit.rule.class.inc.php +++ b/application/audit.rule.class.inc.php @@ -1,9 +1,10 @@ - /** * This class manages the audit "rule" linked to a given audit category. * Each rule is based on an OQL expression that returns either the "good" objects @@ -33,35 +33,34 @@ class AuditRule extends cmdbAbstractObject { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "application,grant_by_profile", "key_type" => "autoincrement", "name_attcode" => "name", "state_attcode" => "", - "reconc_keys" => array('name'), + "reconc_keys" => ['name'], "db_table" => "priv_auditrule", "db_key_field" => "id", "db_finalclass_field" => "", 'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-audit.svg'), - ); + ]; MetaModel::Init_Params($aParams); - MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeOQL("query", array("allowed_values" => null, "sql" => "query", "default_value" => "", "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("valid_flag", array("allowed_values" => new ValueSetEnum('true,false'), "sql" => "valid_flag", "default_value" => "true", "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", array("allowed_values" => null, "sql" => "category_id", "targetclass" => "AuditCategory", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", array("allowed_values" => null, "extkey_attcode" => 'category_id', "target_attcode" => "name"))); + MetaModel::Init_AddAttribute(new AttributeString("name", ["allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeOQL("query", ["allowed_values" => null, "sql" => "query", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("valid_flag", ["allowed_values" => new ValueSetEnum('true,false'), "sql" => "valid_flag", "default_value" => "true", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", ["allowed_values" => null, "sql" => "category_id", "targetclass" => "AuditCategory", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", ["allowed_values" => null, "extkey_attcode" => 'category_id', "target_attcode" => "name"])); // Display lists - MetaModel::Init_SetZListItems('details', array('category_id', 'name', 'description', 'query', 'valid_flag')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('category_id', 'description', 'valid_flag')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['category_id', 'name', 'description', 'query', 'valid_flag']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['category_id', 'description', 'valid_flag']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('category_id', 'name', 'description', 'valid_flag', 'query')); // Criteria of the std search form - MetaModel::Init_SetZListItems('default_search', array('name', 'description', 'category_id')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['category_id', 'name', 'description', 'valid_flag', 'query']); // Criteria of the std search form + MetaModel::Init_SetZListItems('default_search', ['name', 'description', 'category_id']); // Criteria of the advanced search form } - public static function GetShortcutActions($sFinalClass) { $aShortcutActions = parent::GetShortcutActions($sFinalClass); @@ -72,4 +71,3 @@ class AuditRule extends cmdbAbstractObject return $aShortcutActions; } } -?> diff --git a/application/capturewebpage.class.inc.php b/application/capturewebpage.class.inc.php index e87a6f14d..87b762f16 100644 --- a/application/capturewebpage.class.inc.php +++ b/application/capturewebpage.class.inc.php @@ -1,8 +1,9 @@ value) * @@ -307,12 +304,12 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay // Note 3: we use the toggle of a flag in the sessionStorage object to prevent an infinite loop of reloads in case the object is actually locked by another window $sSessionStorageKey = get_class($oObj).'_'.$oObj->GetKey(); $sParams = ''; - foreach($aParams as $sName => $value) - { + foreach ($aParams as $sName => $value) { $sParams .= $sName.'='.urlencode($value).'&'; // Always add a trailing & } $sUrl = utils::GetAbsoluteUrlAppRoot().'pages/'.$oObj->GetUIPage().'?'.$sParams.'class='.get_class($oObj).'&id='.$oObj->getKey().$oAppContext->GetForLink(true).'&a=1'; - $oPage->add_early_script(<<add_early_script( + <<GetId()] = $oActionMenuBlock; } - $aTags = array(); + $aTags = []; // Master data sources if (!$oPage->IsPrintableVersion()) { $oCreatorTask = null; $bCanBeDeletedByTask = false; $bCanBeDeletedByUser = true; - $aMasterSources = array(); + $aMasterSources = []; $aSyncData = $this->GetSynchroData(MetaModel::GetConfig()->Get('synchro_obsolete_replica_locks_object')); if (count($aSyncData) > 0) { foreach ($aSyncData as $iSourceId => $aSourceData) { @@ -460,33 +457,24 @@ JS $sApplicationURL = $oDataSource->GetApplicationUrl($this, $oReplica); $sLink = $oDataSource->GetName(); - if (!empty($sApplicationURL)) - { + if (!empty($sApplicationURL)) { $sLink = "".$oDataSource->GetName().""; } - if ($oReplica->Get('status_dest_creator') == 1) - { + if ($oReplica->Get('status_dest_creator') == 1) { $oCreatorTask = $oDataSource; $bCreatedByTask = true; - } - else - { + } else { $bCreatedByTask = false; } - if ($bCreatedByTask) - { + if ($bCreatedByTask) { $sDeletePolicy = $oDataSource->Get('delete_policy'); - if (($sDeletePolicy == 'delete') || ($sDeletePolicy == 'update_then_delete')) - { + if (($sDeletePolicy == 'delete') || ($sDeletePolicy == 'update_then_delete')) { $bCanBeDeletedByTask = true; } $sUserDeletePolicy = $oDataSource->Get('user_delete_policy'); - if ($sUserDeletePolicy == 'nobody') - { + if ($sUserDeletePolicy == 'nobody') { $bCanBeDeletedByUser = false; - } - elseif (($sUserDeletePolicy == 'administrators') && !UserRights::IsAdministrator()) - { + } elseif (($sUserDeletePolicy == 'administrators') && !UserRights::IsAdministrator()) { $bCanBeDeletedByUser = false; } } @@ -495,31 +483,25 @@ JS $aMasterSources[$iSourceId]['last_synchro'] = $oReplica->Get('status_last_seen'); } - if (is_object($oCreatorTask)) - { + if (is_object($oCreatorTask)) { $sTaskUrl = $aMasterSources[$oCreatorTask->GetKey()]['url']; - if (!$bCanBeDeletedByUser) - { - $sTip = "
".Dict::Format('Core:Synchro:TheObjectCannotBeDeletedByUser_Source', - $sTaskUrl)."
"; - } - else - { + if (!$bCanBeDeletedByUser) { + $sTip = "
".Dict::Format( + 'Core:Synchro:TheObjectCannotBeDeletedByUser_Source', + $sTaskUrl + )."
"; + } else { $sTip = "
".Dict::Format('Core:Synchro:TheObjectWasCreatedBy_Source', $sTaskUrl)."
"; } - if ($bCanBeDeletedByTask) - { + if ($bCanBeDeletedByTask) { $sTip .= "
".Dict::Format('Core:Synchro:TheObjectCanBeDeletedBy_Source', $sTaskUrl)."
"; } - } - else - { + } else { $sTip = "
".Dict::S('Core:Synchro:ThisObjectIsSynchronized')."
"; } $sTip .= "
".Dict::S('Core:Synchro:ListOfDataSources')."
"; - foreach($aMasterSources as $aStruct) - { + foreach ($aMasterSources as $aStruct) { // Formatting last synchro date $oDateTime = DateTime::createFromFormat('Y-m-d H:i:s', $aStruct['last_synchro']); $oDateTimeFormat = AttributeDateTime::GetFormat(); @@ -548,7 +530,8 @@ JS foreach ($aTags as $sIconId => $aIconData) { $sTagTooltipContent = utils::EscapeHtml($aIconData['title']); - $aHeaderBlocks['subtitle'][static::HEADER_BLOCKS_SUBTITLE_TAG_PREFIX.$sIconId] = new Html(<<{$aIconData['label']} HTML ); @@ -570,16 +553,13 @@ HTML * * @since 3.0.0 $bEditMode is deprecated and no longer used */ - public function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '', $aExtraParams = array()) + public function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '', $aExtraParams = []) { $aFieldsMap = $this->GetBareProperties($oPage, $bEditMode, $sPrefix, $aExtraParams); - - if (!isset($aExtraParams['disable_plugins']) || !$aExtraParams['disable_plugins']) - { + if (!isset($aExtraParams['disable_plugins']) || !$aExtraParams['disable_plugins']) { /** @var iApplicationUIExtension $oExtensionInstance */ - foreach (MetaModel::EnumPlugins('iApplicationUIExtension') as $oExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iApplicationUIExtension') as $oExtensionInstance) { $oExtensionInstance->OnDisplayProperties($this, $oPage, $bEditMode); } } @@ -631,10 +611,10 @@ HTML $oPage->AddUiBlock(AlertUIBlockFactory::MakeForInformation(Dict::S('UI:Dashboard:NotUpToDateUntilContainerSaved'))); } $oPage->add('
'); - $aExtraParams = array( + $aExtraParams = [ 'query_params' => $this->ToArgsForQuery(), 'dashboard_div_id' => $sDivId, - ); + ]; $oDashboard->Render($oPage, false, $aExtraParams, $bCanEdit); $oPage->add('
'); } @@ -661,13 +641,12 @@ HTML // Related objects: display all the linkset attributes, each as a separate tab // In the order described by the 'display' ZList $aList = $this->FlattenZList(MetaModel::GetZListItems(get_class($this), 'details')); - if (count($aList) == 0) - { + if (count($aList) == 0) { // Empty ZList defined, display all the linkedset attributes defined $aList = array_keys(MetaModel::ListAttributeDefs(get_class($this))); } $sClass = get_class($this); - foreach($aList as $sAttCode) { + foreach ($aList as $sAttCode) { $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); if ($oAttDef instanceof AttributeDashboard) { if (!$this->IsNew()) { @@ -708,39 +687,35 @@ HTML $iFlags = $this->GetAttributeFlags($sAttCode); } // Adjust the flags according to user rights - if ($oAttDef->IsIndirect()) - { + if ($oAttDef->IsIndirect()) { $oLinkingAttDef = MetaModel::GetAttributeDef($sLinkedClass, $oAttDef->GetExtKeyToRemote()); $sTargetClass = $oLinkingAttDef->GetTargetClass(); // n:n links => must be allowed to modify the linking class AND read the target class in order to edit the linkedset - if (!UserRights::IsActionAllowed($sLinkedClass, - UR_ACTION_MODIFY) || !UserRights::IsActionAllowed($sTargetClass, UR_ACTION_READ)) - { + if (!UserRights::IsActionAllowed( + $sLinkedClass, + UR_ACTION_MODIFY + ) || !UserRights::IsActionAllowed($sTargetClass, UR_ACTION_READ)) { $iFlags |= OPT_ATT_READONLY; } // n:n links => must be allowed to read the linking class AND the target class in order to display the linkedset - if (!UserRights::IsActionAllowed($sLinkedClass, - UR_ACTION_READ) || !UserRights::IsActionAllowed($sTargetClass, UR_ACTION_READ)) - { + if (!UserRights::IsActionAllowed( + $sLinkedClass, + UR_ACTION_READ + ) || !UserRights::IsActionAllowed($sTargetClass, UR_ACTION_READ)) { $iFlags |= OPT_ATT_HIDDEN; } - } - else - { + } else { // 1:n links => must be allowed to modify the linked class in order to edit the linkedset - if (!UserRights::IsActionAllowed($sLinkedClass, UR_ACTION_MODIFY)) - { + if (!UserRights::IsActionAllowed($sLinkedClass, UR_ACTION_MODIFY)) { $iFlags |= OPT_ATT_READONLY; } // 1:n links => must be allowed to read the linked class in order to display the linkedset - if (!UserRights::IsActionAllowed($sLinkedClass, UR_ACTION_READ)) - { + if (!UserRights::IsActionAllowed($sLinkedClass, UR_ACTION_READ)) { $iFlags |= OPT_ATT_HIDDEN; } } // Non-readable/hidden linkedset... don't display anything - if ($iFlags & OPT_ATT_HIDDEN) - { + if ($iFlags & OPT_ATT_HIDDEN) { continue; } @@ -749,19 +724,29 @@ HTML $sCount = ($iCount != 0) ? " ($iCount)" : ""; $oPage->SetCurrentTab($sTabCode, $oAttDef->GetLabel().$sCount, $sTabDescription); - $aArgs = array('this' => $this); - + $aArgs = ['this' => $this]; + $sEditWhen = $oAttDef->GetEditWhen(); // Calculate if edit_when allows to edit based on current $bEditMode - $bIsEditableBasedOnEditWhen = ($sEditWhen === LINKSET_EDITWHEN_ALWAYS) || + $bIsEditableBasedOnEditWhen = ($sEditWhen === LINKSET_EDITWHEN_ALWAYS) || ($bEditMode ? $sEditWhen === LINKSET_EDITWHEN_ON_HOST_EDITION : $sEditWhen === LINKSET_EDITWHEN_ON_HOST_DISPLAY); $bReadOnly = ($iFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE)) || !$bIsEditableBasedOnEditWhen; if ($bEditMode && (!$bReadOnly)) { $sInputId = $this->m_iFormId.'_'.$sAttCode; $sDisplayValue = ''; // not used - $sHTMLValue = "".self::GetFormElementForField($oPage, $sClass, $sAttCode, - $oAttDef, $oLinkSet, $sDisplayValue, $sInputId, '', $iFlags, $aArgs).''; + $sHTMLValue = "".self::GetFormElementForField( + $oPage, + $sClass, + $sAttCode, + $oAttDef, + $oLinkSet, + $sDisplayValue, + $sInputId, + '', + $iFlags, + $aArgs + ).''; $this->AddToFieldsMap($sAttCode, $sInputId); $oPage->add($sHTMLValue); } else { @@ -785,9 +770,18 @@ HTML if ($bEditMode && (!$bRedundancyReadOnly)) { $sInputId = $this->m_iFormId.'_'.$sRedundancyAttCode; - $oFieldSet->AddSubBlock(new Html("".self::GetFormElementForField($oPage, $sClass, - $sRedundancyAttCode, $oRedundancyAttDef, $sValue, '', $sInputId, '', $iFlags, - $aArgs).'')); + $oFieldSet->AddSubBlock(new Html("".self::GetFormElementForField( + $oPage, + $sClass, + $sRedundancyAttCode, + $oRedundancyAttDef, + $sValue, + '', + $sInputId, + '', + $iFlags, + $aArgs + ).'')); } else { $oFieldSet->AddSubBlock(new Html($oRedundancyAttDef->GetDisplayForm($sValue, $oPage, false, $this->m_iFormId))); } @@ -809,14 +803,14 @@ HTML $aTriggers = $this->GetRelatedTriggersIDs(); if (count($aTriggers) > 0) { $iId = $this->GetKey(); - $aParams = array('triggers' => $aTriggers, 'id' => $iId); - $aNotifSearches = array(); + $aParams = ['triggers' => $aTriggers, 'id' => $iId]; + $aNotifSearches = []; $iNotifsCount = 0; $aNotificationClasses = MetaModel::EnumChildClasses('EventNotification'); foreach ($aNotificationClasses as $sNotifClass) { $aNotifSearches[$sNotifClass] = DBObjectSearch::FromOQL("SELECT $sNotifClass AS Ev JOIN Trigger AS T ON Ev.trigger_id = T.id WHERE T.id IN (:triggers) AND Ev.object_id = :id"); $aNotifSearches[$sNotifClass]->SetInternalParams($aParams); - $oNotifSet = new DBObjectSet($aNotifSearches[$sNotifClass], array()); + $oNotifSet = new DBObjectSet($aNotifSearches[$sNotifClass], []); $iNotifsCount += $oNotifSet->Count(); } // Display notifications regarding the object: on block per subclass to have the interesting columns @@ -883,15 +877,15 @@ HTML * * @since 3.0.0 $bEditMode is deprecated and no longer used */ - public function GetBareProperties(WebPage $oPage, $bEditMode, $sPrefix, $aExtraParams = array()) + public function GetBareProperties(WebPage $oPage, $bEditMode, $sPrefix, $aExtraParams = []) { $sStateAttCode = MetaModel::GetStateAttributeCode(get_class($this)); $sClass = get_class($this); $aDetailsList = MetaModel::GetZListItems($sClass, 'details'); - $aDetailsStruct = self::ProcessZlist($aDetailsList, array('UI:PropertiesTab' => array()), 'UI:PropertiesTab', 'col1', ''); - $aFieldsMap = array(); - $aFieldsComments = (isset($aExtraParams['fieldsComments'])) ? $aExtraParams['fieldsComments'] : array(); - $aExtraFlags = (isset($aExtraParams['fieldsFlags'])) ? $aExtraParams['fieldsFlags'] : array(); + $aDetailsStruct = self::ProcessZlist($aDetailsList, ['UI:PropertiesTab' => []], 'UI:PropertiesTab', 'col1', ''); + $aFieldsMap = []; + $aFieldsComments = (isset($aExtraParams['fieldsComments'])) ? $aExtraParams['fieldsComments'] : []; + $aExtraFlags = (isset($aExtraParams['fieldsFlags'])) ? $aExtraParams['fieldsFlags'] : []; $bHasFieldsWithRichTextEditor = false; foreach ($aDetailsStruct as $sTab => $aCols) { @@ -937,23 +931,23 @@ HTML if (($sStateAttCode === $sAttCode) && (MetaModel::HasLifecycle($sClass))) { // State attribute is always read-only from the UI $sHTMLValue = $this->GetAsHTML($sAttCode); - $val = array( + $val = [ 'label' => '', 'value' => $sHTMLValue, 'input_id' => $sInputId, 'comments' => $sComments, 'infos' => $sInfos, - ); + ]; } else { if ($iFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE)) { // Check if the attribute is not read-only because of a synchro... if ($iFlags & OPT_ATT_SLAVE) { - $aReasons = array(); + $aReasons = []; $this->GetSynchroReplicaFlags($sAttCode, $aReasons); $sTip = ''; foreach ($aReasons as $aRow) { $sDescription = utils::EscapeHtml($aRow['description']); - $sDescription = str_replace(array("\r\n", "\n"), "
", $sDescription); + $sDescription = str_replace(["\r\n", "\n"], "
", $sDescription); $sTip .= "
"; $sTip .= "
Synchronized with {$aRow['name']}
"; $sTip .= "
$sDescription
"; @@ -969,15 +963,24 @@ HTML $sValue = $this->Get($sAttCode); $sDisplayValue = $this->GetEditValue($sAttCode); // transfer bulk context to components as it can be needed (linked set) - $aArgs = array('this' => $this, 'formPrefix' => $sPrefix); + $aArgs = ['this' => $this, 'formPrefix' => $sPrefix]; if (array_key_exists('bulk_context', $aExtraParams)) { $aArgs['bulk_context'] = $aExtraParams['bulk_context']; } $sHTMLValue = "".self::GetFormElementForField( - $oPage, $sClass, $sAttCode, $oAttDef, $sValue, - $sDisplayValue, $sInputId, '', $iFlags, $aArgs, - true, $sInputType - ).''; + $oPage, + $sClass, + $sAttCode, + $oAttDef, + $sValue, + $sDisplayValue, + $sInputId, + '', + $iFlags, + $aArgs, + true, + $sInputType + ).''; } $aFieldsMap[$sAttCode] = $sInputId; @@ -986,45 +989,38 @@ HTML $sDescriptionForHTMLTag = utils::HtmlEntities($sDescription); $sDescriptionHTMLTag = (empty($sDescriptionForHTMLTag) || $sDescription === $oAttDef->GetLabel()) ? '' : 'class="ibo-has-description" data-tooltip-content="'.$sDescriptionForHTMLTag.'" data-tooltip-max-width="600px"'; - $val = array( + $val = [ 'label' => ''.$oAttDef->GetLabel().'', 'value' => $sHTMLValue, 'input_id' => $sInputId, 'input_type' => $sInputType, 'comments' => $sComments, 'infos' => $sInfos, - ); + ]; } - } - else - { + } else { // Attribute description $sDescription = $oAttDef->GetDescription(); $sDescriptionForHTMLTag = utils::HtmlEntities($sDescription); $sDescriptionHTMLTag = (empty($sDescriptionForHTMLTag) || $sDescription === $oAttDef->GetLabel()) ? '' : 'class="ibo-has-description" data-tooltip-content="'.$sDescriptionForHTMLTag.' "data-tooltip-max-width="600px"'; - $val = array( + $val = [ 'label' => ''.$oAttDef->GetLabel().'', 'value' => "".$this->GetAsHTML($sAttCode)."", 'comments' => $sComments, 'infos' => $sInfos, - ); + ]; $aFieldsMap[$sAttCode] = $sInputId; } - } - else - { + } else { $val = null; // Skip this field } - } - else - { + } else { // !bEditMode $val = $this->GetFieldAsHtml($sClass, $sAttCode, $sStateAttCode); } - if ($val != null) - { + if ($val != null) { // Add extra data for markup generation // - Attribute code and AttributeDef. class $val['attcode'] = $sAttCode; @@ -1064,7 +1060,6 @@ HTML return $aFieldsMap; } - /** * @param WebPage $oPage * @param bool $bEditMode Note that this parameter is no longer used in this method, {@see static::$sDisplayMode} is used instead, but we cannot remove it as it part of the base interface (iDisplay)... @@ -1099,7 +1094,7 @@ HTML // the lock may be released by 'onunload' which is called AFTER loading the current page. //$bTryAgain = $oOwner->GetKey() == UserRights::GetUserId(); $bBlockReentrance = true; - self::ReloadAndDisplay($oPage, $this, array('operation' => 'details')); + self::ReloadAndDisplay($oPage, $this, ['operation' => 'details']); return; } @@ -1136,7 +1131,6 @@ HTML $this->DisplayBareRelations($oPage, $bEditMode); $oKPI->ComputeStatsForExtension($this, 'DisplayBareRelations'); - // Note: Adding the JS snippet which enables the image upload should have been done directly by the ActivityPanel which would have kept the independance principle // of the UIBlock. For now we keep it this way in order to move on and trace this known limitation in N°3736. // @@ -1163,15 +1157,14 @@ HTML */ public function DisplayPreview(WebPage $oPage) { - $aDetails = array(); + $aDetails = []; $sClass = get_class($this); $aList = MetaModel::GetZListItems($sClass, 'preview'); - foreach($aList as $sAttCode) - { - $aDetails[] = array( + foreach ($aList as $sAttCode) { + $aDetails[] = [ 'label' => MetaModel::GetLabel($sClass, $sAttCode), 'value' => $this->GetAsHTML($sAttCode), - ); + ]; } $oPage->details($aDetails); } @@ -1184,7 +1177,7 @@ HTML * @throws \ApplicationException * @throws \CoreException */ - public static function DisplaySet(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = array()) + public static function DisplaySet(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = []) { $oPage->AddUiBlock(self::GetDisplaySetBlock($oPage, $oSet, $aExtraParams)); } @@ -1200,9 +1193,10 @@ HTML * @return string The HTML representation of the table * @throws \CoreException */ - public static function GetDisplaySetForPrinting(WebPage $oPage, DBObjectSet $oSet, $aExtraParams = array()) + public static function GetDisplaySetForPrinting(WebPage $oPage, DBObjectSet $oSet, $aExtraParams = []) { - $sTableId = isset($aExtraParams['table_id']) ? $aExtraParams['table_id'] : utils::GetUniqueId();; + $sTableId = isset($aExtraParams['table_id']) ? $aExtraParams['table_id'] : utils::GetUniqueId(); + ; $aExtraParams['view_link'] = true; $aExtraParams['select_mode'] = 'none'; @@ -1230,7 +1224,7 @@ HTML * * @deprecated 3.0.0 use GetDisplaySetBlock */ - public static function GetDisplaySet(WebPage $oPage, DBObjectSet $oSet, $aExtraParams = array()) + public static function GetDisplaySet(WebPage $oPage, DBObjectSet $oSet, $aExtraParams = []) { DeprecatedCallsLog::NotifyDeprecatedPhpMethod('use GetDisplaySetBlock'); $oPage->AddUiBlock(static::GetDisplaySetBlock($oPage, $oSet, $aExtraParams)); @@ -1257,7 +1251,7 @@ HTML * * @since 3.0.0 */ - public static function GetDisplaySetBlock(WebPage $oPage, DBObjectSet $oSet, $aExtraParams = array()) + public static function GetDisplaySetBlock(WebPage $oPage, DBObjectSet $oSet, $aExtraParams = []) { if ($oPage->IsPrintableVersion() || $oPage->is_pdf()) { return self::GetDisplaySetForPrinting($oPage, $oSet, $aExtraParams); @@ -1271,7 +1265,7 @@ HTML return DataTableUIBlockFactory::MakeForResult($oPage, $iListId, $oSet, $aExtraParams); } - public static function GetDataTableFromDBObjectSet(DBObjectSet $oSet, $aParams = array()) + public static function GetDataTableFromDBObjectSet(DBObjectSet $oSet, $aParams = []) { $aFields = null; if (isset($aParams['fields']) && (strlen($aParams['fields']) > 0)) { @@ -1288,18 +1282,18 @@ HTML $bLocalize = (bool)$aParams['localize_values']; } - $aList = array(); + $aList = []; $aClasses = $oSet->GetFilter()->GetSelectedClasses(); - $aAuthorizedClasses = array(); + $aAuthorizedClasses = []; foreach ($aClasses as $sAlias => $sClassName) { if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) { $aAuthorizedClasses[$sAlias] = $sClassName; } } - $aHeader = array(); + $aHeader = []; foreach ($aAuthorizedClasses as $sAlias => $sClassName) { - $aList[$sAlias] = array(); + $aList[$sAlias] = []; foreach (MetaModel::GetZListItems($sClassName, 'list') as $sAttCode) { $oAttDef = Metamodel::GetAttributeDef($sClassName, $sAttCode); @@ -1313,8 +1307,10 @@ HTML if ($bFieldsAdvanced && $oAttDef->IsExternalKey(EXTKEY_RELATIVE)) { $sRemoteClass = $oAttDef->GetTargetClass(); foreach (MetaModel::GetReconcKeys($sRemoteClass) as $sRemoteAttCode) { - $aList[$sAlias][$sAttCode.'->'.$sRemoteAttCode] = MetaModel::GetAttributeDef($sRemoteClass, - $sRemoteAttCode); + $aList[$sAlias][$sAttCode.'->'.$sRemoteAttCode] = MetaModel::GetAttributeDef( + $sRemoteClass, + $sRemoteAttCode + ); } } } @@ -1330,14 +1326,16 @@ HTML if ($oAttDef->IsExternalKey()) { unset($aList[$sAlias][$sAttCode]); $sFriendlyNameAttCode = $sAttCode.'_friendlyname'; - if (!array_key_exists($sFriendlyNameAttCode, - $aList[$sAlias]) && MetaModel::IsValidAttCode($sClassName, $sFriendlyNameAttCode)) { + if (!array_key_exists( + $sFriendlyNameAttCode, + $aList[$sAlias] + ) && MetaModel::IsValidAttCode($sClassName, $sFriendlyNameAttCode)) { $oFriendlyNameAtt = MetaModel::GetAttributeDef($sClassName, $sFriendlyNameAttCode); $aList[$sAlias][$sFriendlyNameAttCode] = $oFriendlyNameAtt; } } } - $aHeader['friendlyname'] = ['label' => MetaModel::GetName($sClassName)]; + $aHeader['friendlyname'] = ['label' => MetaModel::GetName($sClassName)]; foreach ($aList[$sAlias] as $sAttCodeEx => $oAttDef) { $sColLabel = $bLocalize ? MetaModel::GetLabel($sClassName, $sAttCodeEx) : $sAttCodeEx; @@ -1351,14 +1349,13 @@ HTML } } - $oSet->Seek(0); $aRows = []; while ($aObjects = $oSet->FetchAssoc()) { $aRow = []; foreach ($aAuthorizedClasses as $sAlias => $sClassName) { $oObj = $aObjects[$sAlias]; - $aRow["friendlyname"] = $oObj->Get('friendlyname'); + $aRow["friendlyname"] = $oObj->Get('friendlyname'); foreach ($aList[$sAlias] as $sAttCodeEx => $oAttDef) { if (is_null($oObj)) { $aRow[$oAttDef->GetCode()] = ''; @@ -1431,7 +1428,7 @@ HTML * @throws \MySQLHasGoneAwayException * @deprecated 3.0.0 */ - public static function GetDisplayExtendedSet(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = array()) + public static function GetDisplayExtendedSet(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = []) { DeprecatedCallsLog::NotifyDeprecatedPhpMethod(); if (empty($aExtraParams['currentId'])) { @@ -1439,78 +1436,67 @@ HTML } else { $iListId = $aExtraParams['currentId']; } - $aList = array(); + $aList = []; // Initialize and check the parameters $bViewLink = isset($aExtraParams['view_link']) ? $aExtraParams['view_link'] : true; $bDisplayMenu = isset($aExtraParams['menu']) ? $aExtraParams['menu'] == true : true; // Check if there is a list of aliases to limit the display to... - $aDisplayAliases = isset($aExtraParams['display_aliases']) ? explode(',', - $aExtraParams['display_aliases']) : array(); + $aDisplayAliases = isset($aExtraParams['display_aliases']) ? explode( + ',', + $aExtraParams['display_aliases'] + ) : []; $sZListName = isset($aExtraParams['zlist']) ? ($aExtraParams['zlist']) : 'list'; - $aExtraFieldsRaw = isset($aExtraParams['extra_fields']) ? explode(',', - trim($aExtraParams['extra_fields'])) : array(); - $aExtraFields = array(); + $aExtraFieldsRaw = isset($aExtraParams['extra_fields']) ? explode( + ',', + trim($aExtraParams['extra_fields']) + ) : []; + $aExtraFields = []; $sAttCode = ''; - foreach($aExtraFieldsRaw as $sFieldName) - { + foreach ($aExtraFieldsRaw as $sFieldName) { // Ignore attributes not of the main queried class - if (preg_match('/^(.*)\.(.*)$/', $sFieldName, $aMatches)) - { + if (preg_match('/^(.*)\.(.*)$/', $sFieldName, $aMatches)) { $sClassAlias = $aMatches[1]; $sAttCode = $aMatches[2]; - if (array_key_exists($sClassAlias, $oSet->GetSelectedClasses())) - { + if (array_key_exists($sClassAlias, $oSet->GetSelectedClasses())) { $aExtraFields[$sClassAlias][] = $sAttCode; } - } - else - { + } else { $aExtraFields['*'] = $sAttCode; } } $aClasses = $oSet->GetFilter()->GetSelectedClasses(); - $aAuthorizedClasses = array(); - foreach($aClasses as $sAlias => $sClassName) - { + $aAuthorizedClasses = []; + foreach ($aClasses as $sAlias => $sClassName) { if ((UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) && - ((count($aDisplayAliases) == 0) || (in_array($sAlias, $aDisplayAliases)))) - { + ((count($aDisplayAliases) == 0) || (in_array($sAlias, $aDisplayAliases)))) { $aAuthorizedClasses[$sAlias] = $sClassName; } } - foreach($aAuthorizedClasses as $sAlias => $sClassName) - { - if (array_key_exists($sAlias, $aExtraFields)) - { + foreach ($aAuthorizedClasses as $sAlias => $sClassName) { + if (array_key_exists($sAlias, $aExtraFields)) { $aList[$sAlias] = $aExtraFields[$sAlias]; + } else { + $aList[$sAlias] = []; } - else - { - $aList[$sAlias] = array(); - } - if ($sZListName !== false) - { + if ($sZListName !== false) { $aDefaultList = self::FlattenZList(MetaModel::GetZListItems($sClassName, $sZListName)); $aList[$sAlias] = array_merge($aDefaultList, $aList[$sAlias]); } // Filter the list to removed linked set since we are not able to display them here - foreach ($aList[$sAlias] as $index => $sAttCode) - { + foreach ($aList[$sAlias] as $index => $sAttCode) { $oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode); - if ($oAttDef instanceof AttributeLinkedSet) - { + if ($oAttDef instanceof AttributeLinkedSet) { // Removed from the display list unset($aList[$sAlias][$index]); } } - if (empty($aList[$sAlias])) - { + if (empty($aList[$sAlias])) { unset($aList[$sAlias], $aAuthorizedClasses[$sAlias]); } } @@ -1522,10 +1508,11 @@ HTML $oSettings = DataTableSettings::GetDataModelSettings($aAuthorizedClasses, $bViewLink, $aList); $bDisplayLimit = isset($aExtraParams['display_limit']) ? $aExtraParams['display_limit'] : true; - if ($bDisplayLimit) - { - $iDefaultPageSize = appUserPreferences::GetPref('default_page_size', - MetaModel::GetConfig()->GetMinDisplayLimit()); + if ($bDisplayLimit) { + $iDefaultPageSize = appUserPreferences::GetPref( + 'default_page_size', + MetaModel::GetConfig()->GetMinDisplayLimit() + ); $oSettings->iDefaultPageSize = $iDefaultPageSize; } @@ -1546,7 +1533,7 @@ HTML * @throws \MySQLException * @throws \MySQLHasGoneAwayException */ - public static function DisplaySetAsCSV(WebPage $oPage, CMDBObjectSet $oSet, $aParams = array(), $sCharset = 'UTF-8') + public static function DisplaySetAsCSV(WebPage $oPage, CMDBObjectSet $oSet, $aParams = [], $sCharset = 'UTF-8') { $oPage->add(self::GetSetAsCSV($oSet, $aParams, $sCharset)); } @@ -1564,123 +1551,98 @@ HTML * @throws \MySQLHasGoneAwayException * @throws \Exception */ - public static function GetSetAsCSV(DBObjectSet $oSet, $aParams = array(), $sCharset = 'UTF-8') + public static function GetSetAsCSV(DBObjectSet $oSet, $aParams = [], $sCharset = 'UTF-8') { $sSeparator = isset($aParams['separator']) ? $aParams['separator'] : ','; // default separator is comma $sTextQualifier = isset($aParams['text_qualifier']) ? $aParams['text_qualifier'] : '"'; // default text qualifier is double quote $aFields = null; - if (isset($aParams['fields']) && (strlen($aParams['fields']) > 0)) - { + if (isset($aParams['fields']) && (strlen($aParams['fields']) > 0)) { $aFields = explode(',', $aParams['fields']); } $bFieldsAdvanced = false; - if (isset($aParams['fields_advanced'])) - { + if (isset($aParams['fields_advanced'])) { $bFieldsAdvanced = (bool)$aParams['fields_advanced']; } $bLocalize = true; - if (isset($aParams['localize_values'])) - { + if (isset($aParams['localize_values'])) { $bLocalize = (bool)$aParams['localize_values']; } - $aList = array(); + $aList = []; $aClasses = $oSet->GetFilter()->GetSelectedClasses(); - $aAuthorizedClasses = array(); - foreach($aClasses as $sAlias => $sClassName) - { - if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) - { + $aAuthorizedClasses = []; + foreach ($aClasses as $sAlias => $sClassName) { + if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) { $aAuthorizedClasses[$sAlias] = $sClassName; } } - $aHeader = array(); - foreach($aAuthorizedClasses as $sAlias => $sClassName) - { - $aList[$sAlias] = array(); + $aHeader = []; + foreach ($aAuthorizedClasses as $sAlias => $sClassName) { + $aList[$sAlias] = []; - foreach(MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) - { - if (is_null($aFields) || (count($aFields) == 0)) - { + foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) { + if (is_null($aFields) || (count($aFields) == 0)) { // Standard list of attributes (no link sets) - if ($oAttDef->IsScalar() && ($oAttDef->IsWritable() || $oAttDef->IsExternalField())) - { + if ($oAttDef->IsScalar() && ($oAttDef->IsWritable() || $oAttDef->IsExternalField())) { $sAttCodeEx = $oAttDef->IsExternalField() ? $oAttDef->GetKeyAttCode().'->'.$oAttDef->GetExtAttCode() : $sAttCode; - if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) - { - if ($bFieldsAdvanced) - { + if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) { + if ($bFieldsAdvanced) { $aList[$sAlias][$sAttCodeEx] = $oAttDef; - if ($oAttDef->IsExternalKey(EXTKEY_RELATIVE)) - { + if ($oAttDef->IsExternalKey(EXTKEY_RELATIVE)) { $sRemoteClass = $oAttDef->GetTargetClass(); - foreach(MetaModel::GetReconcKeys($sRemoteClass) as $sRemoteAttCode) - { - $aList[$sAlias][$sAttCode.'->'.$sRemoteAttCode] = MetaModel::GetAttributeDef($sRemoteClass, - $sRemoteAttCode); + foreach (MetaModel::GetReconcKeys($sRemoteClass) as $sRemoteAttCode) { + $aList[$sAlias][$sAttCode.'->'.$sRemoteAttCode] = MetaModel::GetAttributeDef( + $sRemoteClass, + $sRemoteAttCode + ); } } } - } - else - { + } else { // Any other attribute $aList[$sAlias][$sAttCodeEx] = $oAttDef; } } - } - else - { + } else { // User defined list of attributes - if (in_array($sAttCode, $aFields) || in_array($sAlias.'.'.$sAttCode, $aFields)) - { + if (in_array($sAttCode, $aFields) || in_array($sAlias.'.'.$sAttCode, $aFields)) { $aList[$sAlias][$sAttCode] = $oAttDef; } } } - if ($bFieldsAdvanced) - { + if ($bFieldsAdvanced) { $aHeader[] = 'id'; } - foreach($aList[$sAlias] as $sAttCodeEx => $oAttDef) - { - $aHeader[] = $bLocalize ? MetaModel::GetLabel($sClassName, $sAttCodeEx, - isset($aParams['showMandatoryFields'])) : $sAttCodeEx; + foreach ($aList[$sAlias] as $sAttCodeEx => $oAttDef) { + $aHeader[] = $bLocalize ? MetaModel::GetLabel( + $sClassName, + $sAttCodeEx, + isset($aParams['showMandatoryFields']) + ) : $sAttCodeEx; } } $sHtml = implode($sSeparator, $aHeader)."\n"; $oSet->Seek(0); - while ($aObjects = $oSet->FetchAssoc()) - { - $aRow = array(); - foreach($aAuthorizedClasses as $sAlias => $sClassName) - { + while ($aObjects = $oSet->FetchAssoc()) { + $aRow = []; + foreach ($aAuthorizedClasses as $sAlias => $sClassName) { $oObj = $aObjects[$sAlias]; - if ($bFieldsAdvanced) - { - if (is_null($oObj)) - { + if ($bFieldsAdvanced) { + if (is_null($oObj)) { $aRow[] = ''; - } - else - { + } else { $aRow[] = $oObj->GetKey(); } } - foreach($aList[$sAlias] as $sAttCodeEx => $oAttDef) - { - if (is_null($oObj)) - { + foreach ($aList[$sAlias] as $sAttCodeEx => $oAttDef) { + if (is_null($oObj)) { $aRow[] = ''; - } - else - { + } else { $value = $oObj->Get($sAttCodeEx); $sCSVValue = $oAttDef->GetAsCSV($value, $sSeparator, $sTextQualifier, $oObj, $bLocalize); $aRow[] = iconv('UTF-8', $sCharset.'//IGNORE//TRANSLIT', $sCSVValue); @@ -1703,7 +1665,7 @@ HTML * * @internal Only to be used by `/webservices/export.php` : this is a legacy method that produces wrong HTML (no TR on table body rows) */ - public static function DisplaySetAsHTMLSpreadsheet(WebPage $oPage, CMDBObjectSet $oSet, $aParams = array()) + public static function DisplaySetAsHTMLSpreadsheet(WebPage $oPage, CMDBObjectSet $oSet, $aParams = []) { $oPage->add(self::GetSetAsHTMLSpreadsheet($oSet, $aParams)); } @@ -1722,174 +1684,145 @@ HTML * @throws \MySQLException * @throws \MySQLHasGoneAwayException * @throws \Exception - * + * * @internal Only to be used by `/webservices/export.php` : this is a legacy method that produces wrong HTML (no TR on table body rows) */ - public static function GetSetAsHTMLSpreadsheet(DBObjectSet $oSet, $aParams = array()) + public static function GetSetAsHTMLSpreadsheet(DBObjectSet $oSet, $aParams = []) { $aFields = null; - if (isset($aParams['fields']) && (strlen($aParams['fields']) > 0)) - { + if (isset($aParams['fields']) && (strlen($aParams['fields']) > 0)) { $aFields = explode(',', $aParams['fields']); } $bFieldsAdvanced = false; - if (isset($aParams['fields_advanced'])) - { + if (isset($aParams['fields_advanced'])) { $bFieldsAdvanced = (bool)$aParams['fields_advanced']; } $bLocalize = true; - if (isset($aParams['localize_values'])) - { + if (isset($aParams['localize_values'])) { $bLocalize = (bool)$aParams['localize_values']; } - $aList = array(); + $aList = []; $aClasses = $oSet->GetFilter()->GetSelectedClasses(); - $aAuthorizedClasses = array(); - foreach($aClasses as $sAlias => $sClassName) - { - if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) - { + $aAuthorizedClasses = []; + foreach ($aClasses as $sAlias => $sClassName) { + if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) { $aAuthorizedClasses[$sAlias] = $sClassName; } } - $aHeader = array(); - foreach($aAuthorizedClasses as $sAlias => $sClassName) - { - $aList[$sAlias] = array(); + $aHeader = []; + foreach ($aAuthorizedClasses as $sAlias => $sClassName) { + $aList[$sAlias] = []; - foreach(MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) - { - if (is_null($aFields) || (count($aFields) == 0)) - { + foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) { + if (is_null($aFields) || (count($aFields) == 0)) { // Standard list of attributes (no link sets) - if ($oAttDef->IsScalar() && ($oAttDef->IsWritable() || $oAttDef->IsExternalField())) - { + if ($oAttDef->IsScalar() && ($oAttDef->IsWritable() || $oAttDef->IsExternalField())) { $sAttCodeEx = $oAttDef->IsExternalField() ? $oAttDef->GetKeyAttCode().'->'.$oAttDef->GetExtAttCode() : $sAttCode; $aList[$sAlias][$sAttCodeEx] = $oAttDef; - if ($bFieldsAdvanced && $oAttDef->IsExternalKey(EXTKEY_RELATIVE)) - { + if ($bFieldsAdvanced && $oAttDef->IsExternalKey(EXTKEY_RELATIVE)) { $sRemoteClass = $oAttDef->GetTargetClass(); - foreach(MetaModel::GetReconcKeys($sRemoteClass) as $sRemoteAttCode) - { - $aList[$sAlias][$sAttCode.'->'.$sRemoteAttCode] = MetaModel::GetAttributeDef($sRemoteClass, - $sRemoteAttCode); + foreach (MetaModel::GetReconcKeys($sRemoteClass) as $sRemoteAttCode) { + $aList[$sAlias][$sAttCode.'->'.$sRemoteAttCode] = MetaModel::GetAttributeDef( + $sRemoteClass, + $sRemoteAttCode + ); } } } - } - else - { + } else { // User defined list of attributes - if (in_array($sAttCode, $aFields) || in_array($sAlias.'.'.$sAttCode, $aFields)) - { + if (in_array($sAttCode, $aFields) || in_array($sAlias.'.'.$sAttCode, $aFields)) { $aList[$sAlias][$sAttCode] = $oAttDef; } } } // Replace external key by the corresponding friendly name (if not already in the list) - foreach($aList[$sAlias] as $sAttCode => $oAttDef) - { - if ($oAttDef->IsExternalKey()) - { + foreach ($aList[$sAlias] as $sAttCode => $oAttDef) { + if ($oAttDef->IsExternalKey()) { unset($aList[$sAlias][$sAttCode]); $sFriendlyNameAttCode = $sAttCode.'_friendlyname'; - if (!array_key_exists($sFriendlyNameAttCode, - $aList[$sAlias]) && MetaModel::IsValidAttCode($sClassName, $sFriendlyNameAttCode)) - { + if (!array_key_exists( + $sFriendlyNameAttCode, + $aList[$sAlias] + ) && MetaModel::IsValidAttCode($sClassName, $sFriendlyNameAttCode)) { $oFriendlyNameAtt = MetaModel::GetAttributeDef($sClassName, $sFriendlyNameAttCode); $aList[$sAlias][$sFriendlyNameAttCode] = $oFriendlyNameAtt; } } } - foreach($aList[$sAlias] as $sAttCodeEx => $oAttDef) - { + foreach ($aList[$sAlias] as $sAttCodeEx => $oAttDef) { $sColLabel = $bLocalize ? MetaModel::GetLabel($sClassName, $sAttCodeEx) : $sAttCodeEx; $oFinalAttDef = $oAttDef->GetFinalAttDef(); - if (get_class($oFinalAttDef) == 'AttributeDateTime') - { + if (get_class($oFinalAttDef) == 'AttributeDateTime') { $aHeader[] = $sColLabel.' ('.Dict::S('UI:SplitDateTime-Date').')'; $aHeader[] = $sColLabel.' ('.Dict::S('UI:SplitDateTime-Time').')'; - } - else - { + } else { $aHeader[] = $sColLabel; } } } - $sHtml = "\n"; $sHtml .= "\n"; $sHtml .= "\n"; $sHtml .= "\n"; $oSet->Seek(0); - while ($aObjects = $oSet->FetchAssoc()) - { - $aRow = array(); - foreach($aAuthorizedClasses as $sAlias => $sClassName) - { + while ($aObjects = $oSet->FetchAssoc()) { + $aRow = []; + foreach ($aAuthorizedClasses as $sAlias => $sClassName) { $oObj = $aObjects[$sAlias]; - foreach($aList[$sAlias] as $sAttCodeEx => $oAttDef) - { - if (is_null($oObj)) - { + foreach ($aList[$sAlias] as $sAttCodeEx => $oAttDef) { + if (is_null($oObj)) { $aRow[] = ''; - } - else - { + } else { $oFinalAttDef = $oAttDef->GetFinalAttDef(); - if (get_class($oFinalAttDef) == 'AttributeDateTime') - { + if (get_class($oFinalAttDef) == 'AttributeDateTime') { $sDate = $oObj->Get($sAttCodeEx); - if ($sDate === null) - { + if ($sDate === null) { $aRow[] = ''; $aRow[] = ''; - } - else - { + } else { $iDate = AttributeDateTime::GetAsUnixSeconds($sDate); - $aRow[] = ''; // Format kept as-is for 100% backward compatibility of the exports - $aRow[] = ''; // Format kept as-is for 100% backward compatibility of the exports + $aRow[] = ''; // Format kept as-is for 100% backward compatibility of the exports + $aRow[] = ''; // Format kept as-is for 100% backward compatibility of the exports } - } - else - { - if ($oAttDef instanceof AttributeCaseLog) - { + } else { + if ($oAttDef instanceof AttributeCaseLog) { $rawValue = $oObj->Get($sAttCodeEx); - $outputValue = str_replace("\n", "
", - utils::EscapeHtml($rawValue->__toString())); + $outputValue = str_replace( + "\n", + "
", + utils::EscapeHtml($rawValue->__toString()) + ); // Trick for Excel: treat the content as text even if it begins with an equal sign $aRow[] = ''; - } - else - { + } else { $rawValue = $oObj->Get($sAttCodeEx); // Due to custom formatting rules, empty friendlynames may be rendered as non-empty strings // let's fix this and make sure we render an empty string if the key == 0 - if ($oAttDef instanceof AttributeExternalField && $oAttDef->IsFriendlyName()) - { + if ($oAttDef instanceof AttributeExternalField && $oAttDef->IsFriendlyName()) { $sKeyAttCode = $oAttDef->GetKeyAttCode(); - if ($oObj->Get($sKeyAttCode) == 0) - { + if ($oObj->Get($sKeyAttCode) == 0) { $rawValue = ''; } } if ($bLocalize) { $outputValue = utils::EscapeHtml($oFinalAttDef->GetEditValue($rawValue)); - } - else { + } else { $outputValue = utils::EscapeHtml($rawValue); } $aRow[] = ''; @@ -1917,57 +1850,42 @@ HTML * @throws \MySQLException * @throws \MySQLHasGoneAwayException */ - public static function DisplaySetAsXML(WebPage $oPage, CMDBObjectSet $oSet, $aParams = array()) + public static function DisplaySetAsXML(WebPage $oPage, CMDBObjectSet $oSet, $aParams = []) { $bLocalize = true; - if (isset($aParams['localize_values'])) - { + if (isset($aParams['localize_values'])) { $bLocalize = (bool)$aParams['localize_values']; } $aClasses = $oSet->GetFilter()->GetSelectedClasses(); - $aAuthorizedClasses = array(); - foreach($aClasses as $sAlias => $sClassName) - { - if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) - { + $aAuthorizedClasses = []; + foreach ($aClasses as $sAlias => $sClassName) { + if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) { $aAuthorizedClasses[$sAlias] = $sClassName; } } - $aList = array(); + $aList = []; $aList[$sAlias] = MetaModel::GetZListItems($sClassName, 'details'); $oPage->add("\n"); $oSet->Seek(0); - while ($aObjects = $oSet->FetchAssoc()) - { - if (count($aAuthorizedClasses) > 1) - { + while ($aObjects = $oSet->FetchAssoc()) { + if (count($aAuthorizedClasses) > 1) { $oPage->add("\n"); } - foreach($aAuthorizedClasses as $sAlias => $sClassName) - { + foreach ($aAuthorizedClasses as $sAlias => $sClassName) { $oObj = $aObjects[$sAlias]; - if (is_null($oObj)) - { + if (is_null($oObj)) { $oPage->add("<$sClassName alias=\"$sAlias\" id=\"null\">\n"); - } - else - { + } else { $sClassName = get_class($oObj); $oPage->add("<$sClassName alias=\"$sAlias\" id=\"".$oObj->GetKey()."\">\n"); } - foreach(MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) - { - if (is_null($oObj)) - { + foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) { + if (is_null($oObj)) { $oPage->add("<$sAttCode>null\n"); - } - else - { - if ($oAttDef->IsWritable()) - { - if (!$oAttDef->IsLinkSet()) - { + } else { + if ($oAttDef->IsWritable()) { + if (!$oAttDef->IsLinkSet()) { $sValue = $oObj->GetAsXML($sAttCode, $bLocalize); $oPage->add("<$sAttCode>$sValue\n"); } @@ -1976,8 +1894,7 @@ HTML } $oPage->add("\n"); } - if (count($aAuthorizedClasses) > 1) - { + if (count($aAuthorizedClasses) > 1) { $oPage->add("\n"); } } @@ -1992,7 +1909,7 @@ HTML * @throws \CoreException * @throws \DictExceptionMissingString */ - public static function DisplaySearchForm(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = array()) + public static function DisplaySearchForm(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = []) { $oPage->add(self::GetSearchForm($oPage, $oSet, $aExtraParams)); @@ -2007,14 +1924,13 @@ HTML * @throws CoreException * @throws DictExceptionMissingString */ - public static function GetSearchForm(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = array()) + public static function GetSearchForm(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = []) { $oSearchForm = new SearchForm(); return $oSearchForm->GetSearchForm($oPage, $oSet, $aExtraParams); } - /** * @param WebPage $oPage * @param string $sClass @@ -2044,7 +1960,7 @@ HTML * @throws \Twig\Error\SyntaxError * @throws \Exception */ - public static function GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $value = '', $sDisplayValue = '', $iId = '', $sNameSuffix = '', $iFlags = 0, $aArgs = array(), $bPreserveCurrentValue = true, &$sInputType = '') + public static function GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $value = '', $sDisplayValue = '', $iId = '', $sNameSuffix = '', $iFlags = 0, $aArgs = [], $bPreserveCurrentValue = true, &$sInputType = '') { $sFormPrefix = isset($aArgs['formPrefix']) ? $aArgs['formPrefix'] : ''; $sFieldPrefix = isset($aArgs['prefix']) ? $sFormPrefix.$aArgs['prefix'] : $sFormPrefix; @@ -2082,7 +1998,7 @@ HTML $sHelpText = utils::EscapeHtml($oAttDef->GetHelpOnEdition()); // mandatory field control vars - $aEventsList = array(); // contains any native event (like change), plus 'validate' for the form submission + $aEventsList = []; // contains any native event (like change), plus 'validate' for the form submission $sNullValue = $oAttDef->GetNullValue(); // used for the ValidateField() call in js/forms-json-utils.js $sFieldToValidateId = $iId; // can be different than the displayed field (for example in TagSet) @@ -2160,7 +2076,7 @@ HTML; $sEditValueForHtml = utils::EscapeHtml($sEditValue); $sFullscreenLabelForHtml = utils::EscapeHtml(Dict::S('UI:ToggleFullScreen')); - $aStyles = array(); + $aStyles = []; $sStyle = ''; $sWidth = $oAttDef->GetWidth(); if (!empty($sWidth)) { @@ -2200,7 +2116,8 @@ JS $sAdditionalStuff = $oPredefQueryRenderer->RenderHtml(); $oPage->add_ready_script($oPredefQueryRenderer->RenderJsInline($oPredefQueryButton::ENUM_JS_TYPE_ON_INIT)); - $oPage->add_ready_script(<<add_ready_script( + <<GetWidth(); if (!empty($sWidth)) { @@ -2305,7 +2222,7 @@ JS $sHeader = '
'; // will be hidden in CSS (via :empty) if it remains empty $sEditValue = is_object($value) ? $value->GetModifiedEntry('html') : ''; - $sPreviousLog = is_object($value) ? $value->GetAsHTML($oPage, true /* bEditMode */, array('AttributeText', 'RenderWikiHtml')) : ''; + $sPreviousLog = is_object($value) ? $value->GetAsHTML($oPage, true /* bEditMode */, ['AttributeText', 'RenderWikiHtml']) : ''; $iEntriesCount = is_object($value) ? count($value->GetIndex()) : 0; $sHidden = ""; // To know how many entries the case log already contains @@ -2331,8 +2248,16 @@ JS case 'HTML': $sInputType = self::ENUM_INPUT_TYPE_HTML_EDITOR; $sEditValue = $oAttDef->GetEditValue($value); - $oWidget = new UIHTMLEditorWidget($iId, $oAttDef, $sNameSuffix, $sFieldPrefix, $sHelpText, - $sValidationSpan.$sReloadSpan, $sEditValue, $bMandatory); + $oWidget = new UIHTMLEditorWidget( + $iId, + $oAttDef, + $sNameSuffix, + $sFieldPrefix, + $sHelpText, + $sValidationSpan.$sReloadSpan, + $sEditValue, + $bMandatory + ); $sHTMLValue = $oWidget->Display($oPage, $aArgs); break; @@ -2352,14 +2277,19 @@ JS $sInputType = self::ENUM_INPUT_TYPE_LINKEDSET; $oObj = $aArgs['this'] ?? null; if ($oAttDef->IsIndirect()) { - $oWidget = new UILinksWidget($sClass, $sAttCode, $iId, $sNameSuffix, - $oAttDef->DuplicatesAllowed()); + $oWidget = new UILinksWidget( + $sClass, + $sAttCode, + $iId, + $sNameSuffix, + $oAttDef->DuplicatesAllowed() + ); } else { $oWidget = new UILinksWidgetDirect($sClass, $sAttCode, $iId, $sNameSuffix); } $aEventsList[] = 'validate'; $aEventsList[] = 'change'; - $sHTMLValue = $oWidget->Display($oPage, $value, array(), $sFormPrefix, $oObj); + $sHTMLValue = $oWidget->Display($oPage, $value, [], $sFormPrefix, $oObj); } break; @@ -2415,19 +2345,19 @@ HTML; $sHTMLValue = "
\n"; $sHTMLValue .= "{$sValidationSpan}{$sReloadSpan}\n"; - $aEditImage = array( + $aEditImage = [ 'input_name' => 'attr_'.$sFieldPrefix.$sAttCode.$sNameSuffix, 'max_file_size' => utils::ConvertToBytes(ini_get('upload_max_filesize')), 'max_width_px' => $oAttDef->Get('display_max_width'), 'max_height_px' => $oAttDef->Get('display_max_height'), 'current_image_url' => $sUrl, 'default_image_url' => $sDefaultUrl, - 'labels' => array( + 'labels' => [ 'reset_button' => utils::EscapeHtml(Dict::S('UI:Button:ResetImage')), 'remove_button' => utils::EscapeHtml(Dict::S('UI:Button:RemoveImage')), 'upload_button' => !empty($sHelpText) ? $sHelpText : utils::EscapeHtml(Dict::S('UI:Button:UploadImage')), - ), - ); + ], + ]; $sEditImageOptions = json_encode($aEditImage); $oPage->add_ready_script("$('#edit_$iInputId').edit_image($sEditImageOptions);"); break; @@ -2463,8 +2393,21 @@ HTML; $aExtKeyParams = $aArgs; $aExtKeyParams['iFieldSize'] = $oAttDef->GetMaxSize(); $aExtKeyParams['iMinChars'] = $oAttDef->GetMinAutoCompleteChars(); - $sHTMLValue = UIExtKeyWidget::DisplayFromAttCode($oPage, $sAttCode, $sClass, $oAttDef->GetLabel(), - $oAllowedValues, $value, $iId, $bMandatory, $sFieldName, $sFormPrefix, $aExtKeyParams, false, $sInputType); + $sHTMLValue = UIExtKeyWidget::DisplayFromAttCode( + $oPage, + $sAttCode, + $sClass, + $oAttDef->GetLabel(), + $oAllowedValues, + $value, + $iId, + $bMandatory, + $sFieldName, + $sFormPrefix, + $aExtKeyParams, + false, + $sInputType + ); $sHTMLValue .= "\n"; $bHasExtKeyUpdatingRemoteClassFields = ( @@ -2493,25 +2436,25 @@ HTML; if ($sAttDefEditClass === 'CustomFields') { /** @var \ormCustomFieldsValue $value */ $oForm = $value->GetForm($sFormPrefix); - } else if ($sAttDefEditClass === 'FormField') { + } elseif ($sAttDefEditClass === 'FormField') { $oForm = $oAttDef->GetForm($aArgs['this'], $sFormPrefix); } $oFormRenderer = new ConsoleFormRenderer($oForm); $aFormRenderedContent = $oFormRenderer->Render(); - $aFieldSetOptions = array( + $aFieldSetOptions = [ 'field_identifier_attr' => 'data-field-id', // convention: fields are rendered into a div and are identified by this attribute 'fields_list' => $aFormRenderedContent, 'fields_impacts' => $oForm->GetFieldsImpacts(), 'form_path' => $oForm->GetId(), - ); + ]; $sFieldSetOptions = json_encode($aFieldSetOptions); - $aFormHandlerOptions = array( + $aFormHandlerOptions = [ 'wizard_helper_var_name' => 'oWizardHelper'.$sFormPrefix, 'custom_field_attcode' => $sAttCode, - ); + ]; $sFormHandlerOptions = json_encode($aFormHandlerOptions); $sHTMLValue .= '
'; @@ -2580,19 +2523,17 @@ JS // #@# todo - add context information (depending on dimensions) $aAllowedValues = $oAttDef->GetAllowedValues($aArgs); $iFieldSize = $oAttDef->GetMaxSize(); - if ($aAllowedValues !== null) - { + if ($aAllowedValues !== null) { // convert AttributeBoolean value due to issue with radio style when value is false // @see N°2443 - Boolean don't accept yes/no value - if($oAttDef instanceof AttributeBoolean){ + if ($oAttDef instanceof AttributeBoolean) { $value = $value === false ? 0 : 1; } // Discrete list of values, use a SELECT or RADIO buttons depending on the config $sDisplayStyle = $oAttDef->GetDisplayStyle(); - switch ($sDisplayStyle) - { + switch ($sDisplayStyle) { case 'radio': case 'radio_horizontal': case 'radio_vertical': @@ -2600,8 +2541,15 @@ JS $aEventsList[] = 'change'; $sHTMLValue = "
"; $bVertical = ($sDisplayStyle != 'radio_horizontal'); - $sHTMLValue .= $oPage->GetRadioButtons($aAllowedValues, $value, $iId, - "attr_{$sFieldPrefix}{$sAttCode}{$sNameSuffix}", $bMandatory, $bVertical, ''); + $sHTMLValue .= $oPage->GetRadioButtons( + $aAllowedValues, + $value, + $iId, + "attr_{$sFieldPrefix}{$sAttCode}{$sNameSuffix}", + $bMandatory, + $bVertical, + '' + ); $sHTMLValue .= "
{$sValidationSpan}{$sReloadSpan}\n"; break; @@ -2630,17 +2578,16 @@ EOF $sHTMLValue .= "
{$sValidationSpan}{$sReloadSpan}\n"; break; } - } - else - { + } else { $sInputType = self::ENUM_INPUT_TYPE_SINGLE_INPUT; $sDisplayValueForHtml = utils::EscapeHtml($sDisplayValue); // Adding tooltip so we can read the whole value when its very long (eg. URL) - $sTip = ''; + $sTip = ''; if (!empty($sDisplayValue)) { $sTip = 'data-tooltip-content="'.$sDisplayValueForHtml.'"'; - $oPage->add_ready_script(<<add_ready_script( + << @@ -2673,16 +2619,15 @@ HTML; } break; } - $sPattern = addslashes($oAttDef->GetValidationPattern()); //'^([0-9]+)$'; - if (!empty($aEventsList)) - { - if (!is_numeric($sNullValue)) - { + $sPattern = addslashes($oAttDef->GetValidationPattern()); //'^([0-9]+)$'; + if (!empty($aEventsList)) { + if (!is_numeric($sNullValue)) { $sNullValue = "'$sNullValue'"; // Add quotes to turn this into a JS string if it's not a number } $sOriginalValue = ($iFlags & OPT_ATT_MUSTCHANGE) ? json_encode($value) : 'undefined'; $sEventList = implode(' ', $aEventsList); - $oPage->add_ready_script(<<add_ready_script( + << 0) - { + if (count($aDependencies) > 0) { //--- Add an event handler to launch a custom event: validate // * Unbind first to avoid duplicate event handlers in case of reload of the whole (or part of the) form // * We were using off/on directly on the node before, but that was causing an issue when adding dynamically new nodes @@ -2703,7 +2647,8 @@ JS // So we're adding the handler on a node above, and we're using a selector to catch only the event we're interested in ! $sDependencies = implode("','", $aDependencies); - $oPage->add_ready_script(<<add_ready_script( + <<GetKey(); @@ -2755,31 +2700,23 @@ JS $this->SetDisplayMode(($iKey > 0) ? static::ENUM_DISPLAY_MODE_EDIT : static::ENUM_DISPLAY_MODE_CREATE); $sDisplayMode = $this->GetDisplayMode(); - if ($this->GetDisplayMode() === static::ENUM_DISPLAY_MODE_EDIT) - { + if ($this->GetDisplayMode() === static::ENUM_DISPLAY_MODE_EDIT) { // The concurrent access lock makes sense only for already existing objects $LockEnabled = MetaModel::GetConfig()->Get('concurrent_lock_enabled'); - if ($LockEnabled) - { + if ($LockEnabled) { $sOwnershipToken = utils::ReadPostedParam('ownership_token', null, 'raw_data'); - if ($sOwnershipToken !== null) - { + if ($sOwnershipToken !== null) { // We're probably inside something like "apply_modify" where the validation failed and we must prompt the user again to edit the object // let's extend our lock - } - else - { + } else { $aLockInfo = iTopOwnershipLock::AcquireLock($sClass, $iKey); - if ($aLockInfo['success']) - { + if ($aLockInfo['success']) { $sOwnershipToken = $aLockInfo['token']; - } - else - { + } else { // If the object is locked by the current user, it's worth trying again, since // the lock may be released by 'onunload' which is called AFTER loading the current page. //$bTryAgain = $oOwner->GetKey() == UserRights::GetUserId(); - self::ReloadAndDisplay($oPage, $this, array('operation' => 'modify')); + self::ReloadAndDisplay($oPage, $this, ['operation' => 'modify']); return; } @@ -2788,7 +2725,7 @@ JS } self::$iGlobalFormId++; - $this->aFieldsMap = array(); + $this->aFieldsMap = []; $sPrefix = ''; if (isset($aExtraParams['formPrefix'])) { $sPrefix = $aExtraParams['formPrefix']; @@ -2812,33 +2749,33 @@ JS } } // Custom operation for the form ? - if (isset($aExtraParams['custom_operation'])) { - $sOperation = $aExtraParams['custom_operation']; - } else { - if ($this->GetDisplayMode() === static::ENUM_DISPLAY_MODE_EDIT) { - $sOperation = 'apply_modify'; - } else { - $sOperation = 'apply_new'; - } - } + if (isset($aExtraParams['custom_operation'])) { + $sOperation = $aExtraParams['custom_operation']; + } else { + if ($this->GetDisplayMode() === static::ENUM_DISPLAY_MODE_EDIT) { + $sOperation = 'apply_modify'; + } else { + $sOperation = 'apply_new'; + } + } - $oContentBlock = new UIContentBlock(); - $oPage->AddUiBlock($oContentBlock); + $oContentBlock = new UIContentBlock(); + $oPage->AddUiBlock($oContentBlock); - $oForm = new Form("form_{$this->m_iFormId}"); - $oForm->SetAction($sFormAction); - $sOnSubmitForm = "let bOnSubmitForm = OnSubmit('form_{$this->m_iFormId}');"; - if (isset($aExtraParams['js_handlers']['form_on_submit'])) { - $oForm->SetOnSubmitJsCode($sOnSubmitForm . $aExtraParams['js_handlers']['form_on_submit']); - } else { - $oForm->SetOnSubmitJsCode($sOnSubmitForm . "return bOnSubmitForm;"); - } - $oContentBlock->AddSubBlock($oForm); + $oForm = new Form("form_{$this->m_iFormId}"); + $oForm->SetAction($sFormAction); + $sOnSubmitForm = "let bOnSubmitForm = OnSubmit('form_{$this->m_iFormId}');"; + if (isset($aExtraParams['js_handlers']['form_on_submit'])) { + $oForm->SetOnSubmitJsCode($sOnSubmitForm.$aExtraParams['js_handlers']['form_on_submit']); + } else { + $oForm->SetOnSubmitJsCode($sOnSubmitForm."return bOnSubmitForm;"); + } + $oContentBlock->AddSubBlock($oForm); - if ($this->GetDisplayMode() === static::ENUM_DISPLAY_MODE_EDIT) { - // The object already exists in the database, it's a modification - $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('id', $iKey, "{$sPrefix}_id")); - } + if ($this->GetDisplayMode() === static::ENUM_DISPLAY_MODE_EDIT) { + // The object already exists in the database, it's a modification + $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('id', $iKey, "{$sPrefix}_id")); + } $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', $sOperation)); $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $sClass)); @@ -2862,34 +2799,37 @@ JS } } - $oToolbarButtons = ToolbarUIBlockFactory::MakeStandard(null); + $oToolbarButtons = ToolbarUIBlockFactory::MakeStandard(null); - $oCancelButton = ButtonUIBlockFactory::MakeForCancel(); - $oCancelButton->AddCSSClasses(['action', 'cancel']); - $oToolbarButtons->AddSubBlock($oCancelButton); - $oApplyButton = ButtonUIBlockFactory::MakeForPrimaryAction($sApplyButton, null, null, true); - $oApplyButton->AddCSSClass('action'); - $oToolbarButtons->AddSubBlock($oApplyButton); - $bAreTransitionsHidden = isset($aExtraParams['hide_transitions']) && $aExtraParams['hide_transitions'] === true; - $aTransitions = $this->EnumTransitions(); - if (!isset($aExtraParams['custom_operation']) && !$bAreTransitionsHidden && count($aTransitions)) { - // Transitions are displayed only for the standard new/modify actions, not for modify_all or any other case... - $oSetToCheckRights = DBObjectSet::FromObject($this); + $oCancelButton = ButtonUIBlockFactory::MakeForCancel(); + $oCancelButton->AddCSSClasses(['action', 'cancel']); + $oToolbarButtons->AddSubBlock($oCancelButton); + $oApplyButton = ButtonUIBlockFactory::MakeForPrimaryAction($sApplyButton, null, null, true); + $oApplyButton->AddCSSClass('action'); + $oToolbarButtons->AddSubBlock($oApplyButton); + $bAreTransitionsHidden = isset($aExtraParams['hide_transitions']) && $aExtraParams['hide_transitions'] === true; + $aTransitions = $this->EnumTransitions(); + if (!isset($aExtraParams['custom_operation']) && !$bAreTransitionsHidden && count($aTransitions)) { + // Transitions are displayed only for the standard new/modify actions, not for modify_all or any other case... + $oSetToCheckRights = DBObjectSet::FromObject($this); - $oTransitionPopoverMenu = new PopoverMenu(); - $sTPMSectionId = 'transitions'; - $oTransitionPopoverMenu->AddSection($sTPMSectionId); - $aStimuli = Metamodel::EnumStimuli($sClass); - foreach ($aTransitions as $sStimulusCode => $aTransitionDef) { - $iActionAllowed = (get_class($aStimuli[$sStimulusCode]) == 'StimulusUserAction') ? UserRights::IsStimulusAllowed($sClass, - $sStimulusCode, $oSetToCheckRights) : UR_ALLOWED_NO; - switch ($iActionAllowed) { - case UR_ALLOWED_YES: - // Button to be displayed on its own on large screens - $oButton = ButtonUIBlockFactory::MakeForPrimaryAction($aStimuli[$sStimulusCode]->GetLabel(), 'next_action', $sStimulusCode, true); - $oButton->AddCSSClass('action'); - $oButton->SetColor(Button::ENUM_COLOR_SCHEME_NEUTRAL); - $oToolbarButtons->AddSubBlock($oButton); + $oTransitionPopoverMenu = new PopoverMenu(); + $sTPMSectionId = 'transitions'; + $oTransitionPopoverMenu->AddSection($sTPMSectionId); + $aStimuli = Metamodel::EnumStimuli($sClass); + foreach ($aTransitions as $sStimulusCode => $aTransitionDef) { + $iActionAllowed = (get_class($aStimuli[$sStimulusCode]) == 'StimulusUserAction') ? UserRights::IsStimulusAllowed( + $sClass, + $sStimulusCode, + $oSetToCheckRights + ) : UR_ALLOWED_NO; + switch ($iActionAllowed) { + case UR_ALLOWED_YES: + // Button to be displayed on its own on large screens + $oButton = ButtonUIBlockFactory::MakeForPrimaryAction($aStimuli[$sStimulusCode]->GetLabel(), 'next_action', $sStimulusCode, true); + $oButton->AddCSSClass('action'); + $oButton->SetColor(Button::ENUM_COLOR_SCHEME_NEUTRAL); + $oToolbarButtons->AddSubBlock($oButton); // Button to be displayed in a grouped button on smaller screens $oTPMPopupMenuItem = new JSPopupMenuItem('next_action--'.$oButton->GetId(), $oButton->GetLabel(), "$(`#{$oButton->GetId()}`).trigger(`click`);"); @@ -2911,26 +2851,28 @@ JS } $sStatesSelection = ''; - if (!isset($aExtraParams['custom_operation']) && $this->IsNew()) - { + if (!isset($aExtraParams['custom_operation']) && $this->IsNew()) { $aInitialStates = MetaModel::EnumInitialStates($sClass); //$aInitialStates = array('new' => 'foo', 'closed' => 'bar'); - if (count($aInitialStates) > 1) - { - $sStatesSelection = Dict::Format('UI:Create_Class_InState', - MetaModel::GetName($sClass)).''; + foreach ($aInitialStates as $sStateCode => $sStateData) { $sSelected = ''; if ($sStateCode == $this->GetState()) { $sSelected = ' selected'; } - $sStatesSelection .= ''; + $sStatesSelection .= ''; } $sStatesSelection .= ''; $sStatesSelection .= ''; - $oPage->add_ready_script(<<add_ready_script( + <<m_iFormId}').change( function() { if ($('#obj_state_orig').val() != $(this).val()) { $('.state_select_{$this->m_iFormId}').val($(this).val()); @@ -2946,7 +2888,8 @@ JS // Prepare blocker protection to avoid loosing data $sBlockerId = $sClass.':'.$iKey; // Important: This must have the synthax format as in js/layouts/activity-panel/activity-panel.js $sJSToken = json_encode($sOwnershipToken); - $oPage->add_ready_script(<<add_ready_script( + <<GetDisplayMode() === static::ENUM_DISPLAY_MODE_EDIT) { $aFieldsMap['id'] = $sPrefix.'_id'; @@ -3048,13 +2991,13 @@ JS $aWizardHelperStaticValues = []; // Add as hidden inputs values that we want displayed if they're readonly - if(isset($aExtraParams['forceFieldsSubmission'])){ + if (isset($aExtraParams['forceFieldsSubmission'])) { $aExtraFlags = $aExtraParams['fieldsFlags'] ?? []; foreach ($aExtraParams['forceFieldsSubmission'] as $sAttCode) { - if(FormHelper::GetAttributeFlagsForObject($this, $sAttCode, $aExtraFlags) & OPT_ATT_READONLY) { - $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('attr_'.$sPrefix.$sAttCode, $this->Get($sAttCode))); - $aWizardHelperStaticValues[$sAttCode] = $this->Get($sAttCode); - } + if (FormHelper::GetAttributeFlagsForObject($this, $sAttCode, $aExtraFlags) & OPT_ATT_READONLY) { + $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('attr_'.$sPrefix.$sAttCode, $this->Get($sAttCode))); + $aWizardHelperStaticValues[$sAttCode] = $this->Get($sAttCode); + } } } $sWizardHelperStaticValues = json_encode($aWizardHelperStaticValues); @@ -3075,7 +3018,7 @@ JS $sDefaultUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=search_form&class='.$sClass.$oAppContext->GetForLink(true); $sCancelButtonOnClickScript = "let fOnClick{$this->m_iFormId}CancelButton = "; - if(isset($aExtraParams['js_handlers']['cancel_button_on_click'])){ + if (isset($aExtraParams['js_handlers']['cancel_button_on_click'])) { $sCancelButtonOnClickScript .= $aExtraParams['js_handlers']['cancel_button_on_click']; } else { $sCancelButtonOnClickScript .= "function() { BackToDetails('$sClass', $iKey, '$sDefaultUrl', $sJSToken)};"; @@ -3112,18 +3055,16 @@ EOF EOF ); - if ($sOwnershipToken !== null) - { + if ($sOwnershipToken !== null) { $this->GetOwnershipJSHandler($oPage, $sOwnershipToken); - } - else - { + } else { // Probably a new object (or no concurrent lock), let's add a watchdog so that the session is kept open while editing $iInterval = MetaModel::GetConfig()->Get('concurrent_lock_expiration_delay') * 1000 / 2; - if ($iInterval > 0) - { - $iInterval = max(MIN_WATCHDOG_INTERVAL * 1000, - $iInterval); // Minimum interval for the watchdog is MIN_WATCHDOG_INTERVAL + if ($iInterval > 0) { + $iInterval = max( + MIN_WATCHDOG_INTERVAL * 1000, + $iInterval + ); // Minimum interval for the watchdog is MIN_WATCHDOG_INTERVAL $oPage->add_ready_script( << $value) { if (is_array($value)) { foreach ($value as $key2 => $value2) { @@ -3216,9 +3157,9 @@ EOF * @return UIContentBlock * @throws \CoreException */ - public static function DisplayBlockSelectClassToCreate( string $sClass, string $sClassLabel,array $aPossibleClasses): UIContentBlock + public static function DisplayBlockSelectClassToCreate(string $sClass, string $sClassLabel, array $aPossibleClasses): UIContentBlock { - $oBlock= UIContentBlockUIBlockFactory::MakeStandard(); + $oBlock = UIContentBlockUIBlockFactory::MakeStandard(); $oBlock->AddSubBlock(HtmlFactory::MakeRaw(Dict::Format('UI:SelectTheTypeOf_Class_ToCreate', $sClassLabel))); $oSelect = SelectUIBlockFactory::MakeForSelect('class'); $oBlock->AddSubBlock($oSelect); @@ -3251,7 +3192,7 @@ EOF * @throws \MySQLException * @throws \MySQLHasGoneAwayException */ - public static function DisplayCreationForm(WebPage $oPage, $sClass, $oSourceObject = null, $aArgs = array(), $aExtraParams = array()) + public static function DisplayCreationForm(WebPage $oPage, $sClass, $oSourceObject = null, $aArgs = [], $aExtraParams = []) { $sClass = ($oSourceObject == null) ? $sClass : get_class($oSourceObject); @@ -3269,43 +3210,32 @@ EOF $aArgs['this'] = $oObj; $aDetailsList = self::FLattenZList(MetaModel::GetZListItems($sClass, 'details')); // Order the fields based on their dependencies - $aDeps = array(); - foreach($aDetailsList as $sAttCode) - { + $aDeps = []; + foreach ($aDetailsList as $sAttCode) { $aDeps[$sAttCode] = MetaModel::GetPrerequisiteAttributes($sClass, $sAttCode); } $aList = self::OrderDependentFields($aDeps); // Now fill-in the fields with default/supplied values - foreach($aList as $sAttCode) - { - if (isset($aArgs['default'][$sAttCode])) - { + foreach ($aList as $sAttCode) { + if (isset($aArgs['default'][$sAttCode])) { $oObj->Set($sAttCode, $aArgs['default'][$sAttCode]); - } - else - { + } else { $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); // If the field is mandatory, set it to the only possible value $iFlags = $oObj->GetInitialStateAttributeFlags($sAttCode); - if ((!$oAttDef->IsNullAllowed()) || ($iFlags & OPT_ATT_MANDATORY)) - { - if ($oAttDef->IsExternalKey()) - { + if ((!$oAttDef->IsNullAllowed()) || ($iFlags & OPT_ATT_MANDATORY)) { + if ($oAttDef->IsExternalKey()) { /** @var DBObjectSet $oAllowedValues */ $oAllowedValues = MetaModel::GetAllowedValuesAsObjectSet($sClass, $sAttCode, $aArgs); - if ($oAllowedValues->CountWithLimit(2) == 1) - { + if ($oAllowedValues->CountWithLimit(2) == 1) { $oRemoteObj = $oAllowedValues->Fetch(); $oObj->Set($sAttCode, $oRemoteObj->GetKey()); } - } - else - { + } else { $aAllowedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, $aArgs); - if (is_array($aAllowedValues) && (count($aAllowedValues) == 1)) - { + if (is_array($aAllowedValues) && (count($aAllowedValues) == 1)) { $aValues = array_keys($aAllowedValues); $oObj->Set($sAttCode, $aValues[0]); } @@ -3344,29 +3274,28 @@ EOF $aTransitions = $this->EnumTransitions(); $aStimuli = MetaModel::EnumStimuli($sClass); - if (!isset($aTransitions[$sStimulus])) - { + if (!isset($aTransitions[$sStimulus])) { // Invalid stimulus - throw new ApplicationException(Dict::Format('UI:Error:Invalid_Stimulus_On_Object_In_State', $sStimulus, - $this->GetName(), $this->GetStateLabel())); + throw new ApplicationException(Dict::Format( + 'UI:Error:Invalid_Stimulus_On_Object_In_State', + $sStimulus, + $this->GetName(), + $this->GetStateLabel() + )); } // Check for concurrent access lock $LockEnabled = MetaModel::GetConfig()->Get('concurrent_lock_enabled'); $sOwnershipToken = null; - if ($LockEnabled) - { + if ($LockEnabled) { $aLockInfo = iTopOwnershipLock::AcquireLock($sClass, $iKey); - if ($aLockInfo['success']) - { + if ($aLockInfo['success']) { $sOwnershipToken = $aLockInfo['token']; - } - else - { + } else { // If the object is locked by the current user, it's worth trying again, since // the lock may be released by 'onunload' which is called AFTER loading the current page. //$bTryAgain = $oOwner->GetKey() == UserRights::GetUserId(); - self::ReloadAndDisplay($oPage, $this, array('operation' => 'stimulus', 'stimulus' => $sStimulus)); + self::ReloadAndDisplay($oPage, $this, ['operation' => 'stimulus', 'stimulus' => $sStimulus]); return; } @@ -3379,14 +3308,13 @@ EOF $sTargetState = $aTransitions[$sStimulus]['target_state']; $aExpectedAttributes = $this->GetTransitionAttributes($sStimulus /*, current state*/); - if ($aPrefillFormParam != null) - { + if ($aPrefillFormParam != null) { $aPrefillFormParam['expected_attributes'] = $aExpectedAttributes; $this->PrefillForm('state_change', $aPrefillFormParam); $aExpectedAttributes = $aPrefillFormParam['expected_attributes']; } - $aDetails = array(); + $aDetails = []; $iFieldIndex = 0; $aFieldsMap = [ 'id' => 'id', @@ -3414,20 +3342,24 @@ EOF // - or the field is mandatory and currently empty if (($iExpectCode & (OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) || (($iExpectCode & OPT_ATT_MANDATORY) && (false === $this->HasAValue($sAttCode)))) { - $aArgs = array('this' => $this); + $aArgs = ['this' => $this]; $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); // If the field is mandatory, set it to the only possible value if ((!$oAttDef->IsNullAllowed()) || ($iExpectCode & OPT_ATT_MANDATORY)) { if ($oAttDef->IsExternalKey()) { /** @var DBObjectSet $oAllowedValues */ - $oAllowedValues = MetaModel::GetAllowedValuesAsObjectSet($sClass, $sAttCode, $aArgs, '', - $this->Get($sAttCode)); + $oAllowedValues = MetaModel::GetAllowedValuesAsObjectSet( + $sClass, + $sAttCode, + $aArgs, + '', + $this->Get($sAttCode) + ); if ($oAllowedValues->CountWithLimit(2) == 1) { $oRemoteObj = $oAllowedValues->Fetch(); $this->Set($sAttCode, $oRemoteObj->GetKey()); } - } else - { + } else { if ($oAttDef instanceof \AttributeCaseLog) { // Add JS files for display caselog // Dummy collapsible section created in order to get JS files @@ -3437,8 +3369,7 @@ EOF } } $aAllowedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, $aArgs); - if (is_array($aAllowedValues) && count($aAllowedValues) == 1) - { + if (is_array($aAllowedValues) && count($aAllowedValues) == 1) { $aValues = array_keys($aAllowedValues); $this->Set($sAttCode, $aValues[0]); } @@ -3456,13 +3387,24 @@ EOF $sDisplayValue = $this->GetEditValue($sAttCode); } } - $sHTMLValue = cmdbAbstractObject::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, - $value, $sDisplayValue, $sInputId, '', $iExpectCode, - $aArgs, true, $sInputType); - $aAttrib = array( + $sHTMLValue = cmdbAbstractObject::GetFormElementForField( + $oPage, + $sClass, + $sAttCode, + $oAttDef, + $value, + $sDisplayValue, + $sInputId, + '', + $iExpectCode, + $aArgs, + true, + $sInputType + ); + $aAttrib = [ 'label' => ''.$oAttDef->GetLabel().'', 'value' => "$sHTMLValue", - ); + ]; //add attrib for data-attribute // Prepare metadata attributes @@ -3500,7 +3442,8 @@ EOF if ($bExistFieldToDisplay || MetaModel::GetConfig()->Get('force_transition_confirmation')) { $oPage->set_title($sActionLabel); - $oPage->add(<<add( + <<
HTML @@ -3548,7 +3491,8 @@ HTML $oSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction($sActionLabel, 'submit', 'submit', true); $oForm->AddSubBlock($oSubmitButton); - $oPage->add(<<add( + <<
HTML @@ -3585,14 +3529,12 @@ EOF //we can directly apply the stimuli $sExceptionMessage = null; try { - $bApplyStimulus = $this->ApplyStimulus($sStimulus); // will write the object in the DB - } - catch (Exception $oException) { + $bApplyStimulus = $this->ApplyStimulus($sStimulus); // will write the object in the DB + } catch (Exception $oException) { // Catch any exception happening during the stimulus $bApplyStimulus = false; $sExceptionMessage = ($oException instanceof CoreCannotSaveObjectException) ? $oException->getHtmlMessage() : $oException->getMessage(); - } - finally { + } finally { if ($sOwnershipToken !== null) { // Release the concurrent lock, if any iTopOwnershipLock::ReleaseLock($sClass, $iKey, $sOwnershipToken); @@ -3612,51 +3554,39 @@ EOF public static function ProcessZlist($aList, $aDetails, $sCurrentTab, $sCurrentCol, $sCurrentSet) { $index = 0; - foreach($aList as $sKey => $value) - { - if (is_array($value)) - { - if (preg_match('/^(.*):(.*)$/U', $sKey, $aMatches)) - { + foreach ($aList as $sKey => $value) { + if (is_array($value)) { + if (preg_match('/^(.*):(.*)$/U', $sKey, $aMatches)) { $sCode = $aMatches[1]; $sName = $aMatches[2]; - switch ($sCode) - { + switch ($sCode) { case 'tab': - if (!isset($aDetails[$sName])) - { - $aDetails[$sName] = array('col1' => array()); + if (!isset($aDetails[$sName])) { + $aDetails[$sName] = ['col1' => []]; } $aDetails = self::ProcessZlist($value, $aDetails, $sName, 'col1', ''); break; case 'fieldset': - if (!isset($aDetailsStruct[$sCurrentTab][$sCurrentCol][$sName])) - { - $aDetails[$sCurrentTab][$sCurrentCol][$sName] = array(); + if (!isset($aDetailsStruct[$sCurrentTab][$sCurrentCol][$sName])) { + $aDetails[$sCurrentTab][$sCurrentCol][$sName] = []; } $aDetails = self::ProcessZlist($value, $aDetails, $sCurrentTab, $sCurrentCol, $sName); break; default: case 'col': - if (!isset($aDetails[$sCurrentTab][$sName])) - { - $aDetails[$sCurrentTab][$sName] = array(); + if (!isset($aDetails[$sCurrentTab][$sName])) { + $aDetails[$sCurrentTab][$sName] = []; } $aDetails = self::ProcessZlist($value, $aDetails, $sCurrentTab, $sName, ''); break; } } - } - else - { - if (empty($sCurrentSet)) - { + } else { + if (empty($sCurrentSet)) { $aDetails[$sCurrentTab][$sCurrentCol]['_'.$index][] = $value; - } - else - { + } else { $aDetails[$sCurrentTab][$sCurrentCol][$sCurrentSet][] = $value; } } @@ -3668,15 +3598,11 @@ EOF public static function FlattenZList($aList) { - $aResult = array(); - foreach($aList as $value) - { - if (!is_array($value)) - { + $aResult = []; + foreach ($aList as $value) { + if (!is_array($value)) { $aResult[] = $value; - } - else - { + } else { $aResult = array_merge($aResult, self::FlattenZList($value)); } } @@ -3764,8 +3690,7 @@ HTML; $sClass = get_class($this); $sId = $this->GetKey(); $sDisplayUrl = $oDoc->GetDisplayURL($sClass, $sId, $sAttCode); - switch ($oDoc->GetMainMimeType()) - { + switch ($oDoc->GetMainMimeType()) { case 'text': case 'html': $data = $oDoc->GetData(); @@ -3780,8 +3705,7 @@ HTML; break; case 'application': - switch ($oDoc->GetMimeType()) - { + switch ($oDoc->GetMimeType()) { case 'application/pdf': $oPage->add("\n"); break; @@ -3802,32 +3726,32 @@ HTML; } // $m_highlightComparison[previous][new] => next value - protected static $m_highlightComparison = array( - HILIGHT_CLASS_CRITICAL => array( + protected static $m_highlightComparison = [ + HILIGHT_CLASS_CRITICAL => [ HILIGHT_CLASS_CRITICAL => HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING => HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_OK => HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_NONE => HILIGHT_CLASS_CRITICAL, - ), - HILIGHT_CLASS_WARNING => array( + ], + HILIGHT_CLASS_WARNING => [ HILIGHT_CLASS_CRITICAL => HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING => HILIGHT_CLASS_WARNING, HILIGHT_CLASS_OK => HILIGHT_CLASS_WARNING, HILIGHT_CLASS_NONE => HILIGHT_CLASS_WARNING, - ), - HILIGHT_CLASS_OK => array( + ], + HILIGHT_CLASS_OK => [ HILIGHT_CLASS_CRITICAL => HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING => HILIGHT_CLASS_WARNING, HILIGHT_CLASS_OK => HILIGHT_CLASS_OK, HILIGHT_CLASS_NONE => HILIGHT_CLASS_OK, - ), - HILIGHT_CLASS_NONE => array( + ], + HILIGHT_CLASS_NONE => [ HILIGHT_CLASS_CRITICAL => HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING => HILIGHT_CLASS_WARNING, HILIGHT_CLASS_OK => HILIGHT_CLASS_OK, HILIGHT_CLASS_NONE => HILIGHT_CLASS_NONE, - ), - ); + ], + ]; /** * This function returns a 'hilight' CSS class, used to hilight a given row in a table @@ -3842,13 +3766,12 @@ HTML; public function GetHilightClass() { // Possible return values are: - // HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING, HILIGHT_CLASS_OK, HILIGHT_CLASS_NONE + // HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING, HILIGHT_CLASS_OK, HILIGHT_CLASS_NONE $current = parent::GetHilightClass(); // Default computation // Invoke extensions before the deletion (the deletion will do some cleanup and we might loose some information /** @var \iApplicationUIExtension $oExtensionInstance */ - foreach(MetaModel::EnumPlugins('iApplicationUIExtension') as $oExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iApplicationUIExtension') as $oExtensionInstance) { $new = $oExtensionInstance->GetHilightClass($this); @$current = self::$m_highlightComparison[$current][$new]; } @@ -3867,33 +3790,25 @@ HTML; */ public static function OrderDependentFields($aFields) { - $aResult = array(); + $aResult = []; $iCount = 0; - do - { + do { $bSet = false; $iCount++; - foreach($aFields as $sFieldCode => $aDeps) - { - foreach($aDeps as $key => $sDependency) - { - if (in_array($sDependency, $aResult)) - { + foreach ($aFields as $sFieldCode => $aDeps) { + foreach ($aDeps as $key => $sDependency) { + if (in_array($sDependency, $aResult)) { // Dependency is resolved, remove it unset($aFields[$sFieldCode][$key]); - } - else - { - if (!array_key_exists($sDependency, $aFields)) - { + } else { + if (!array_key_exists($sDependency, $aFields)) { // The current fields depends on a field not present in the form // let's ignore it (since it cannot change) unset($aFields[$sFieldCode][$key]); } } } - if (count($aFields[$sFieldCode]) == 0) - { + if (count($aFields[$sFieldCode]) == 0) { // No more pending depencies for this field, add it to the list $aResult[] = $sFieldCode; unset($aFields[$sFieldCode]); @@ -3902,8 +3817,7 @@ HTML; } } while ($bSet && (count($aFields) > 0)); - if (count($aFields) > 0) - { + if (count($aFields) > 0) { $sMessage = "Error: Circular dependencies between the fields!
".print_r($aFields, true)."
"; throw(new Exception($sMessage)); } @@ -3939,12 +3853,9 @@ HTML; */ public static function MapContextParam($sContextParam) { - if ($sContextParam == 'menu') - { + if ($sContextParam == 'menu') { return null; - } - else - { + } else { return $sContextParam; } } @@ -3959,69 +3870,48 @@ HTML; * @return array of attcodes that can be used for writing on the current object * @throws \CoreException */ - public function GetWriteableAttList($aAttList, &$aErrors, $aAttFlags = array()) + public function GetWriteableAttList($aAttList, &$aErrors, $aAttFlags = []) { - if (!is_array($aAttList)) - { + if (!is_array($aAttList)) { $aAttList = $this->FlattenZList(MetaModel::GetZListItems(get_class($this), 'details')); // Special case to process the case log, if any... // WARNING: if you change this also check the functions DisplayModifyForm and DisplayCaseLog - foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) - { + foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { - if (array_key_exists($sAttCode, $aAttFlags)) - { + if (array_key_exists($sAttCode, $aAttFlags)) { $iFlags = $aAttFlags[$sAttCode]; - } - elseif ($this->IsNew()) - { + } elseif ($this->IsNew()) { $iFlags = $this->GetInitialStateAttributeFlags($sAttCode); - } - else - { - $aVoid = array(); + } else { + $aVoid = []; $iFlags = $this->GetAttributeFlags($sAttCode, $aVoid); } - if ($oAttDef instanceof AttributeCaseLog) - { - if (!($iFlags & (OPT_ATT_HIDDEN | OPT_ATT_SLAVE | OPT_ATT_READONLY))) - { + if ($oAttDef instanceof AttributeCaseLog) { + if (!($iFlags & (OPT_ATT_HIDDEN | OPT_ATT_SLAVE | OPT_ATT_READONLY))) { // The case log is editable, append it to the list of fields to retrieve $aAttList[] = $sAttCode; } } } } - $aWriteableAttList = array(); - foreach($aAttList as $sAttCode) - { + $aWriteableAttList = []; + foreach ($aAttList as $sAttCode) { $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); - if (array_key_exists($sAttCode, $aAttFlags)) - { + if (array_key_exists($sAttCode, $aAttFlags)) { $iFlags = $aAttFlags[$sAttCode]; - } - elseif ($this->IsNew()) - { + } elseif ($this->IsNew()) { $iFlags = $this->GetInitialStateAttributeFlags($sAttCode); - } - else - { - $aVoid = array(); + } else { + $aVoid = []; $iFlags = $this->GetAttributeFlags($sAttCode, $aVoid); } - if ($oAttDef->IsWritable()) - { - if ($iFlags & (OPT_ATT_HIDDEN | OPT_ATT_READONLY)) - { + if ($oAttDef->IsWritable()) { + if ($iFlags & (OPT_ATT_HIDDEN | OPT_ATT_READONLY)) { // Non-visible, or read-only attribute, do nothing - } - elseif ($iFlags & OPT_ATT_SLAVE) - { + } elseif ($iFlags & OPT_ATT_SLAVE) { $aErrors[$sAttCode] = Dict::Format('UI:AttemptingToSetASlaveAttribute_Name', $oAttDef->GetLabel(), $sAttCode); - } - else - { + } else { $aWriteableAttList[$sAttCode] = $oAttDef; } } @@ -4035,16 +3925,12 @@ HTML; */ public function GetFormAttributeFlags($sAttCode) { - if ($this->IsNew()) - { + if ($this->IsNew()) { $iFlags = $this->GetInitialStateAttributeFlags($sAttCode); - } - else - { + } else { $iFlags = $this->GetAttributeFlags($sAttCode); } - if (($iFlags & OPT_ATT_MANDATORY) && $this->IsNew()) - { + if (($iFlags & OPT_ATT_MANDATORY) && $this->IsNew()) { $iFlags = $iFlags & ~OPT_ATT_READONLY; // Mandatory fields cannot be read-only when creating an object } @@ -4063,23 +3949,17 @@ HTML; */ public function UpdateObjectFromArray($aValues) { - foreach($aValues as $sAttCode => $value) - { + foreach ($aValues as $sAttCode => $value) { $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); - switch ($oAttDef->GetEditClass()) - { + switch ($oAttDef->GetEditClass()) { case 'Document': case 'Image': // There should be an uploaded file with the named attr_ - if ($value['remove']) - { + if ($value['remove']) { $this->Set($sAttCode, null); - } - else - { + } else { $oDocument = $value['fcontents']; - if (!$oDocument->IsEmpty()) - { + if (!$oDocument->IsEmpty()) { // A new file has been uploaded $this->Set($sAttCode, $oDocument); } @@ -4088,24 +3968,21 @@ HTML; case 'One Way Password': // Check if the password was typed/changed $aPwdData = $value; - if (!is_null($aPwdData) && $aPwdData['changed']) - { + if (!is_null($aPwdData) && $aPwdData['changed']) { // The password has been changed or set $this->Set($sAttCode, $aPwdData['value']); } break; case 'Duration': $aDurationData = $value; - if (!is_array($aDurationData)) - { + if (!is_array($aDurationData)) { break; } $iValue = (((24 * $aDurationData['d']) + $aDurationData['h']) * 60 + $aDurationData['m']) * 60 + $aDurationData['s']; $this->Set($sAttCode, $iValue); $previousValue = $this->Get($sAttCode); - if ($previousValue !== $iValue) - { + if ($previousValue !== $iValue) { $this->Set($sAttCode, $iValue); } break; @@ -4113,15 +3990,12 @@ HTML; $this->Set($sAttCode, $value); break; case 'LinkedSet': - if ($this->IsValueModified($value)) - { + if ($this->IsValueModified($value)) { $oLinkSet = $this->Get($sAttCode); $sLinkedClass = $oAttDef->GetLinkedClass(); - if (array_key_exists('to_be_created', $value) && (count($value['to_be_created']) > 0)) - { + if (array_key_exists('to_be_created', $value) && (count($value['to_be_created']) > 0)) { // Now handle the links to be created - foreach ($value['to_be_created'] as $aData) - { + foreach ($value['to_be_created'] as $aData) { $sSubClass = $aData['class']; if (($sLinkedClass == $sSubClass) || (is_subclass_of($sSubClass, $sLinkedClass))) { $aObjData = $aData['data']; @@ -4141,45 +4015,35 @@ HTML; $oLinkSet->AddItem($oLink); } } + } } - } - if (array_key_exists('to_be_added', $value) && (count($value['to_be_added']) > 0)) - { + if (array_key_exists('to_be_added', $value) && (count($value['to_be_added']) > 0)) { // Now handle the links to be added by making the remote object point to self - foreach ($value['to_be_added'] as $iObjKey) - { + foreach ($value['to_be_added'] as $iObjKey) { $oLink = MetaModel::GetObject($sLinkedClass, $iObjKey, false); - if ($oLink) - { + if ($oLink) { $oLinkSet->AddItem($oLink); } } } - if (array_key_exists('to_be_modified', $value) && (count($value['to_be_modified']) > 0)) - { + if (array_key_exists('to_be_modified', $value) && (count($value['to_be_modified']) > 0)) { // Now handle the links to be added by making the remote object point to self - foreach ($value['to_be_modified'] as $iObjKey => $aData) - { + foreach ($value['to_be_modified'] as $iObjKey => $aData) { $oLink = MetaModel::GetObject($sLinkedClass, $iObjKey, false); - if ($oLink) - { + if ($oLink) { $aObjData = $aData['data']; $oLink->UpdateObjectFromArray($aObjData); $oLinkSet->ModifyItem($oLink); } } } - if (array_key_exists('to_be_removed', $value) && (count($value['to_be_removed']) > 0)) - { - foreach ($value['to_be_removed'] as $iObjKey) - { + if (array_key_exists('to_be_removed', $value) && (count($value['to_be_removed']) > 0)) { + foreach ($value['to_be_removed'] as $iObjKey) { $oLinkSet->RemoveItem($iObjKey); } } - if (array_key_exists('to_be_deleted', $value) && (count($value['to_be_deleted']) > 0)) - { - foreach ($value['to_be_deleted'] as $iObjKey) - { + if (array_key_exists('to_be_deleted', $value) && (count($value['to_be_deleted']) > 0)) { + foreach ($value['to_be_deleted'] as $iObjKey) { $oLinkSet->RemoveItem($iObjKey); } } @@ -4190,8 +4054,7 @@ HTML; case 'TagSet': /** @var ormTagSet $oTagSet */ $oTagSet = $this->Get($sAttCode); - if (is_null($oTagSet)) - { + if (is_null($oTagSet)) { $oTagSet = new ormTagSet(get_class($this), $sAttCode, $oAttDef->GetMaxItems()); } $oTagSet->ApplyDelta($value); @@ -4201,8 +4064,7 @@ HTML; case 'Set': /** @var ormSet $oSet */ $oSet = $this->Get($sAttCode); - if (is_null($oSet)) - { + if (is_null($oSet)) { $oSet = new ormSet(get_class($this), $sAttCode, $oAttDef->GetMaxItems()); } $oSet->ApplyDelta($value); @@ -4210,12 +4072,10 @@ HTML; break; default: - if (!is_null($value)) - { + if (!is_null($value)) { $aAttributes[$sAttCode] = trim($value); $previousValue = $this->Get($sAttCode); - if ($previousValue !== $aAttributes[$sAttCode]) - { + if ($previousValue !== $aAttributes[$sAttCode]) { $this->Set($sAttCode, $aAttributes[$sAttCode]); } } @@ -4227,8 +4087,7 @@ HTML; { $aModifiedKeys = ['to_be_created', 'to_be_added', 'to_be_modified', 'to_be_removed', 'to_be_deleted']; foreach ($aModifiedKeys as $sModifiedKey) { - if (array_key_exists( $sModifiedKey, $value) && (count($value[$sModifiedKey]) > 0)) - { + if (array_key_exists($sModifiedKey, $value) && (count($value[$sModifiedKey]) > 0)) { return true; } } @@ -4238,45 +4097,36 @@ HTML; /** * Updates the object from the POSTed parameters (form) */ - public function UpdateObjectFromPostedForm($sFormPrefix = '', $aAttList = null, $aAttFlags = array()) + public function UpdateObjectFromPostedForm($sFormPrefix = '', $aAttList = null, $aAttFlags = []) { - if (is_null($aAttList)) - { + if (is_null($aAttList)) { $aAttList = array_keys(MetaModel::ListAttributeDefs(get_class($this))); } - $aValues = array(); - foreach($aAttList as $sAttCode) - { + $aValues = []; + foreach ($aAttList as $sAttCode) { $value = $this->PrepareValueFromPostedForm($sFormPrefix, $sAttCode); - if (!is_null($value)) - { + if (!is_null($value)) { $aValues[$sAttCode] = $value; } } - $aErrors = array(); - $aFinalValues = array(); - foreach($this->GetWriteableAttList(array_keys($aValues), $aErrors, $aAttFlags) as $sAttCode => $oAttDef) - { + $aErrors = []; + $aFinalValues = []; + foreach ($this->GetWriteableAttList(array_keys($aValues), $aErrors, $aAttFlags) as $sAttCode => $oAttDef) { $aFinalValues[$sAttCode] = $aValues[$sAttCode]; } - try - { + try { $this->UpdateObjectFromArray($aFinalValues); - } - catch (CoreException $e) - { + } catch (CoreException $e) { $aErrors[] = $e->getMessage(); } - if (!$this->IsNew()) // for new objects this is performed in DBInsertNoReload() - { + if (!$this->IsNew()) { // for new objects this is performed in DBInsertNoReload() InlineImage::FinalizeInlineImages($this); } // Invoke extensions after the update of the object from the form /** @var \iApplicationUIExtension $oExtensionInstance */ - foreach(MetaModel::EnumPlugins('iApplicationUIExtension') as $oExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iApplicationUIExtension') as $oExtensionInstance) { $oExtensionInstance->OnFormSubmit($this, $sFormPrefix); } @@ -4294,31 +4144,27 @@ HTML; */ protected function PrepareValueFromPostedForm($sFormPrefix, $sAttCode, $sClass = null, $aPostedData = null) { - if ($sClass === null) - { + if ($sClass === null) { $sClass = get_class($this); } $value = null; $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - switch ($oAttDef->GetEditClass()) - { - case 'Document': + switch ($oAttDef->GetEditClass()) { + case 'Document': $aOtherData = utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}", null, 'raw_data'); if (is_array($aOtherData) && array_key_exists('remove', $aOtherData)) { - $value = array('fcontents' => utils::ReadPostedDocument("attr_{$sFormPrefix}{$sAttCode}", 'fcontents'), 'remove' => $aOtherData['remove']); + $value = ['fcontents' => utils::ReadPostedDocument("attr_{$sFormPrefix}{$sAttCode}", 'fcontents'), 'remove' => $aOtherData['remove']]; } break; case 'Image': $value = null; $oImage = utils::ReadPostedDocument("attr_{$sFormPrefix}{$sAttCode}", 'fcontents'); - if (!is_null($oImage->GetData())) - { + if (!is_null($oImage->GetData())) { $aSize = utils::GetImageSize($oImage->GetData()); - if (is_array($aSize) && $aSize[0] > 0 && $aSize[1] > 0) - { + if (is_array($aSize) && $aSize[0] > 0 && $aSize[1] > 0) { $oImage = utils::ResizeImageToFit( $oImage, $aSize[0], @@ -4326,16 +4172,13 @@ HTML; $oAttDef->Get('storage_max_width'), $oAttDef->Get('storage_max_height') ); - } - else - { - IssueLog::Warning($sClass . ':' . $this->GetKey() . '/' . $sAttCode . ': Image could not be resized. Mimetype: ' . $oImage->GetMimeType() . ', filename: ' . $oImage->GetFileName()); + } else { + IssueLog::Warning($sClass.':'.$this->GetKey().'/'.$sAttCode.': Image could not be resized. Mimetype: '.$oImage->GetMimeType().', filename: '.$oImage->GetFileName()); } } $aOtherData = utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}", null, 'raw_data'); - if (is_array($aOtherData)) - { - $value = array('fcontents' => $oImage, 'remove' => $aOtherData['remove']); + if (is_array($aOtherData)) { + $value = ['fcontents' => $oImage, 'remove' => $aOtherData['remove']]; } break; @@ -4357,107 +4200,117 @@ HTML; $value = LinkSetDataTransformer::Encode($aOperations, $sLinkedClass, $sTargetField); break; } - $aRawToBeCreated = json_decode(utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}_tbc", '{}', - 'raw_data'), true); - $aToBeCreated = array(); + $aRawToBeCreated = json_decode(utils::ReadPostedParam( + "attr_{$sFormPrefix}{$sAttCode}_tbc", + '{}', + 'raw_data' + ), true); + $aToBeCreated = []; foreach ($aRawToBeCreated as $aData) { $sSubFormPrefix = $aData['formPrefix']; $sObjClass = isset($aData['class']) ? $aData['class'] : $oAttDef->GetLinkedClass(); - $aObjData = array(); + $aObjData = []; foreach ($aData as $sKey => $value) { if (preg_match("/^attr_$sSubFormPrefix(.*)$/", $sKey, $aMatches)) { $oLinkAttDef = MetaModel::GetAttributeDef($sObjClass, $aMatches[1]); // Recursing over n:n link datetime attributes // Note: We might need to do it with other attribute types, like Document or redundancy setting. if ($oLinkAttDef instanceof AttributeDateTime) { - $aObjData[$aMatches[1]] = $this->PrepareValueFromPostedForm($sSubFormPrefix, - $aMatches[1], $sObjClass, $aData); + $aObjData[$aMatches[1]] = $this->PrepareValueFromPostedForm( + $sSubFormPrefix, + $aMatches[1], + $sObjClass, + $aData + ); } else { $aObjData[$aMatches[1]] = $value; } } } - $aToBeCreated[] = array('class' => $sObjClass, 'data' => $aObjData); + $aToBeCreated[] = ['class' => $sObjClass, 'data' => $aObjData]; } - $aRawToBeModified = json_decode(utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}_tbm", '{}', - 'raw_data'), true); - $aToBeModified = array(); - foreach($aRawToBeModified as $iObjKey => $aData) { + $aRawToBeModified = json_decode(utils::ReadPostedParam( + "attr_{$sFormPrefix}{$sAttCode}_tbm", + '{}', + 'raw_data' + ), true); + $aToBeModified = []; + foreach ($aRawToBeModified as $iObjKey => $aData) { $sSubFormPrefix = $aData['formPrefix']; $sObjClass = isset($aData['class']) ? $aData['class'] : $oAttDef->GetLinkedClass(); - $aObjData = array(); - foreach($aData as $sKey => $value) { + $aObjData = []; + foreach ($aData as $sKey => $value) { if (preg_match("/^attr_$sSubFormPrefix(.*)$/", $sKey, $aMatches)) { $oLinkAttDef = MetaModel::GetAttributeDef($sObjClass, $aMatches[1]); // Recursing over n:n link datetime attributes // Note: We might need to do it with other attribute types, like Document or redundancy setting. if ($oLinkAttDef instanceof AttributeDateTime) { - $aObjData[$aMatches[1]] = $this->PrepareValueFromPostedForm($sSubFormPrefix, - $aMatches[1], $sObjClass, $aData); + $aObjData[$aMatches[1]] = $this->PrepareValueFromPostedForm( + $sSubFormPrefix, + $aMatches[1], + $sObjClass, + $aData + ); } else { $aObjData[$aMatches[1]] = $value; } } } - $aToBeModified[$iObjKey] = array('data' => $aObjData); + $aToBeModified[$iObjKey] = ['data' => $aObjData]; } - $value = array( + $value = [ 'to_be_created' => $aToBeCreated, 'to_be_modified' => $aToBeModified, - 'to_be_deleted' => json_decode(utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}_tbd", '[]', - 'raw_data'), true), - 'to_be_added' => json_decode(utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}_tba", '[]', - 'raw_data'), true), - 'to_be_removed' => json_decode(utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}_tbr", '[]', - 'raw_data'), true), - ); + 'to_be_deleted' => json_decode(utils::ReadPostedParam( + "attr_{$sFormPrefix}{$sAttCode}_tbd", + '[]', + 'raw_data' + ), true), + 'to_be_added' => json_decode(utils::ReadPostedParam( + "attr_{$sFormPrefix}{$sAttCode}_tba", + '[]', + 'raw_data' + ), true), + 'to_be_removed' => json_decode(utils::ReadPostedParam( + "attr_{$sFormPrefix}{$sAttCode}_tbr", + '[]', + 'raw_data' + ), true), + ]; break; case 'Set': case 'TagSet': $sTagSetJson = utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}", null, 'raw_data'); - if ($sTagSetJson !== null) { // bulk modify, direct linked set not handled - $value = json_decode($sTagSetJson, true); - } + if ($sTagSetJson !== null) { // bulk modify, direct linked set not handled + $value = json_decode($sTagSetJson, true); + } break; default: - if ($oAttDef instanceof AttributeDateTime) // AttributeDate is derived from AttributeDateTime - { + if ($oAttDef instanceof AttributeDateTime) { // AttributeDate is derived from AttributeDateTime // Retrieving value from array when present (means what we are in a recursion) - if ($aPostedData !== null && isset($aPostedData['attr_'.$sFormPrefix.$sAttCode])) - { + if ($aPostedData !== null && isset($aPostedData['attr_'.$sFormPrefix.$sAttCode])) { $value = $aPostedData['attr_'.$sFormPrefix.$sAttCode]; - } - else - { + } else { $value = utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}", null, 'raw_data'); } - if ($value != null) - { + if ($value != null) { $oDate = $oAttDef->GetFormat()->Parse($value); - if ($oDate instanceof DateTime) - { + if ($oDate instanceof DateTime) { $value = $oDate->format($oAttDef->GetInternalFormat()); - } - else - { + } else { $value = null; } } - } - else - { + } else { // Retrieving value from array when present (means what we are in a recursion) - if ($aPostedData !== null && isset($aPostedData['attr_'.$sFormPrefix.$sAttCode])) - { + if ($aPostedData !== null && isset($aPostedData['attr_'.$sFormPrefix.$sAttCode])) { $value = $aPostedData['attr_'.$sFormPrefix.$sAttCode]; - } - else - { + } else { $value = utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}", null, 'raw_data'); } } @@ -4489,41 +4342,31 @@ HTML; * @uses utils::ReadParam() * @uses self::UpdateObjectFromArray */ - public function UpdateObjectFromArg($sArgName, $aAttList = null, $aAttFlags = array()) + public function UpdateObjectFromArg($sArgName, $aAttList = null, $aAttFlags = []) { - if (is_null($aAttList)) - { + if (is_null($aAttList)) { $aAttList = array_keys(MetaModel::ListAttributeDefs(get_class($this))); } - $aRawValues = utils::ReadParam($sArgName, array(), '', 'raw_data'); - $aValues = array(); - foreach($aAttList as $sAttCode) - { - if (isset($aRawValues[$sAttCode])) - { + $aRawValues = utils::ReadParam($sArgName, [], '', 'raw_data'); + $aValues = []; + foreach ($aAttList as $sAttCode) { + if (isset($aRawValues[$sAttCode])) { $aValues[$sAttCode] = $aRawValues[$sAttCode]; } } - $aErrors = array(); - $aFinalValues = array(); - foreach($this->GetWriteableAttList(array_keys($aValues), $aErrors, $aAttFlags) as $sAttCode => $oAttDef) - { - if ($oAttDef->IsLinkSet()) - { + $aErrors = []; + $aFinalValues = []; + foreach ($this->GetWriteableAttList(array_keys($aValues), $aErrors, $aAttFlags) as $sAttCode => $oAttDef) { + if ($oAttDef->IsLinkSet()) { $aFinalValues[$sAttCode] = json_decode($aValues[$sAttCode], true); - } - else - { + } else { $aFinalValues[$sAttCode] = $aValues[$sAttCode]; } } - try - { + try { $this->UpdateObjectFromArray($aFinalValues); - } - catch (CoreException $e) - { + } catch (CoreException $e) { $aErrors[] = $e->getMessage(); } return $aErrors; @@ -4580,18 +4423,17 @@ HTML; */ protected function DBCloneTracked_Internal($newKey = null) { - /** @var cmdbAbstractObject $oNewObj */ - $oNewObj = MetaModel::GetObject(get_class($this), parent::DBCloneTracked_Internal($newKey)); + /** @var cmdbAbstractObject $oNewObj */ + $oNewObj = MetaModel::GetObject(get_class($this), parent::DBCloneTracked_Internal($newKey)); // Invoke extensions after insertion (the object must exist, have an id, etc.) /** @var \iApplicationObjectExtension $oExtensionInstance */ - foreach(MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) { $sExtensionClass = get_class($oExtensionInstance); $this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnDBInsert()"); - $oKPI = new ExecutionKPI(); + $oKPI = new ExecutionKPI(); $oExtensionInstance->OnDBInsert($oNewObj, self::GetCurrentChange()); - $oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnDBInsert'); + $oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnDBInsert'); } return $oNewObj; @@ -4657,7 +4499,7 @@ HTML; $this->LogCRUDEnter(__METHOD__); try { parent::DBDelete($oDeletionPlan); - } finally { + } finally { if (static::IsCrudStackEmpty()) { // Avoid signaling the current object that links were modified static::RemoveObjectAwaitingEventDbLinksChanged(get_class($this), $this->GetKey()); @@ -4673,8 +4515,7 @@ HTML; final protected function PreDeleteActions(): void { /** @var \iApplicationObjectExtension $oExtensionInstance */ - foreach(MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) { $sExtensionClass = get_class($oExtensionInstance); $this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnDBDelete()"); $oKPI = new ExecutionKPI(); @@ -4697,13 +4538,12 @@ HTML; { // Invoke extensions before the deletion (the deletion will do some cleanup and we might loose some information /** @var \iApplicationObjectExtension $oExtensionInstance */ - foreach(MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) { $sExtensionClass = get_class($oExtensionInstance); $this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnDBDelete()"); - $oKPI = new ExecutionKPI(); + $oKPI = new ExecutionKPI(); $oExtensionInstance->OnDBDelete($this, self::GetCurrentChange()); - $oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnDBDelete'); + $oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnDBDelete'); } return parent::DBDeleteTracked_Internal($oDeletionPlan); @@ -4711,16 +4551,14 @@ HTML; public function IsModified() { - if (parent::IsModified()) - { + if (parent::IsModified()) { return true; } // Plugins // /** @var \iApplicationObjectExtension $oExtensionInstance */ - foreach(MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) { $sExtensionClass = get_class($oExtensionInstance); $this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnIsModified()"); $oKPI = new ExecutionKPI(); @@ -4780,43 +4618,42 @@ HTML; // Plugins // /** @var \iApplicationObjectExtension $oExtensionInstance */ - foreach(MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) { $sExtensionClass = get_class($oExtensionInstance); $this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnCheckToWrite()"); - $oKPI = new ExecutionKPI(); + $oKPI = new ExecutionKPI(); $aNewIssues = $oExtensionInstance->OnCheckToWrite($this); - $oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnCheckToWrite'); - if (is_array($aNewIssues) && (count($aNewIssues) > 0)) // Some extensions return null instead of an empty array - { + $oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnCheckToWrite'); + if (is_array($aNewIssues) && (count($aNewIssues) > 0)) { // Some extensions return null instead of an empty array $this->m_aCheckIssues = array_merge($this->m_aCheckIssues, $aNewIssues); } } // User rights // - if (!$this->bAllowWrite) - { + if (!$this->bAllowWrite) { $aChanges = $this->ListChanges(); - if (count($aChanges) > 0) - { - $aForbiddenFields = array(); - foreach($this->ListChanges() as $sAttCode => $value) - { - $bUpdateAllowed = UserRights::IsActionAllowedOnAttribute(get_class($this), $sAttCode, - UR_ACTION_MODIFY, DBObjectSet::FromObject($this)); - if (!$bUpdateAllowed) - { + if (count($aChanges) > 0) { + $aForbiddenFields = []; + foreach ($this->ListChanges() as $sAttCode => $value) { + $bUpdateAllowed = UserRights::IsActionAllowedOnAttribute( + get_class($this), + $sAttCode, + UR_ACTION_MODIFY, + DBObjectSet::FromObject($this) + ); + if (!$bUpdateAllowed) { $oAttCode = MetaModel::GetAttributeDef(get_class($this), $sAttCode); $aForbiddenFields[] = $oAttCode->GetLabel(); } } - if (count($aForbiddenFields) > 0) - { + if (count($aForbiddenFields) > 0) { // Security issue $this->m_bSecurityIssue = true; - $this->m_aCheckIssues[] = Dict::Format('UI:Delete:NotAllowedToUpdate_Fields', - implode(', ', $aForbiddenFields)); + $this->m_aCheckIssues[] = Dict::Format( + 'UI:Delete:NotAllowedToUpdate_Fields', + implode(', ', $aForbiddenFields) + ); } } } @@ -4832,27 +4669,23 @@ HTML; // Plugins // /** @var \iApplicationObjectExtension $oExtensionInstance */ - foreach(MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) { $sExtensionClass = get_class($oExtensionInstance); $this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnCheckToDelete()"); - $oKPI = new ExecutionKPI(); + $oKPI = new ExecutionKPI(); $aNewIssues = $oExtensionInstance->OnCheckToDelete($this); - $oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnCheckToDelete'); - if (is_array($aNewIssues) && count($aNewIssues) > 0) - { + $oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnCheckToDelete'); + if (is_array($aNewIssues) && count($aNewIssues) > 0) { $this->m_aDeleteIssues = array_merge($this->m_aDeleteIssues, $aNewIssues); } } // User rights // - if (! $this->bAllowDelete) - { + if (! $this->bAllowDelete) { $bDeleteAllowed = UserRights::IsActionAllowed(get_class($this), UR_ACTION_DELETE, DBObjectSet::FromObject($this)); - if (!$bDeleteAllowed) - { + if (!$bDeleteAllowed) { // Security issue $this->m_bSecurityIssue = true; $this->m_aDeleteIssues[] = Dict::S('UI:Delete:NotAllowedToDelete'); @@ -4892,8 +4725,7 @@ HTML; if ($iFlags & OPT_ATT_HIDDEN) { // The case log is hidden do nothing - } else - { + } else { $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); $sAttDefClass = get_class($oAttDef); $sAttLabel = $oAttDef->GetLabel(); @@ -4907,16 +4739,14 @@ HTML; $sInputId = $this->m_iFormId.'_'.$sAttCode; - if ((!$bEditMode) || ($iFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE))) - { + if ((!$bEditMode) || ($iFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE))) { // Check if the attribute is not read-only because of a synchro... - if ($iFlags & OPT_ATT_SLAVE) - { - $aReasons = array(); + if ($iFlags & OPT_ATT_SLAVE) { + $aReasons = []; $sTip = ''; - foreach($aReasons as $aRow) { + foreach ($aReasons as $aRow) { $sDescription = utils::EscapeHtml($aRow['description']); - $sDescription = str_replace(array("\r\n", "\n"), "
", $sDescription); + $sDescription = str_replace(["\r\n", "\n"], "
", $sDescription); $sTip .= "
"; $sTip .= "
Synchronized with {$aRow['name']}
"; $sTip .= "
$sDescription
"; @@ -4929,12 +4759,10 @@ HTML; $sHTMLValue = $this->GetAsHTML($sAttCode); $sHTMLValue .= ''; $aFieldsMap[$sAttCode] = $sInputId; - } - else - { + } else { $sValue = $this->Get($sAttCode); $sDisplayValue = $this->GetEditValue($sAttCode); - $aArgs = array('this' => $this, 'formPrefix' => $sPrefix); + $aArgs = ['this' => $this, 'formPrefix' => $sPrefix]; $sCommentAsHtml = ($sComment != '') ? ''.$sComment.'
' : ''; $sFieldAsHtml = self::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $sValue, $sDisplayValue, $sInputId, '', $iFlags, $aArgs); @@ -4950,7 +4778,8 @@ HTML; $aFieldsMap[$sAttCode] = $sInputId; } - $oPage->add(<<add( + << {$sAttLabel}
Get($sAttCode); $sDisplayValue = $this->GetEditValue($sAttCode); - $aArgs = array('this' => $this, 'formPrefix' => $sPrefix); + $aArgs = ['this' => $this, 'formPrefix' => $sPrefix]; $aFieldsMap[$sAttCode] = $sInputId; @@ -5044,8 +4873,12 @@ HTML $aTransitions = $this->EnumTransitions(); if (!isset($aTransitions[$sStimulus])) { // Invalid stimulus - throw new ApplicationException(Dict::Format('UI:Error:Invalid_Stimulus_On_Object_In_State', $sStimulus, - $this->GetName(), $this->GetStateLabel())); + throw new ApplicationException(Dict::Format( + 'UI:Error:Invalid_Stimulus_On_Object_In_State', + $sStimulus, + $this->GetName(), + $this->GetStateLabel() + )); } $aTransition = $aTransitions[$sStimulus]; $sTargetState = $aTransition['target_state']; @@ -5055,22 +4888,16 @@ HTML $aExpectedAttributes = $aTargetState['attribute_list']; $aCurrentAttributes = $aCurrentState['attribute_list']; - $aComputedAttributes = array(); - foreach($aExpectedAttributes as $sAttCode => $iExpectCode) - { - if (!array_key_exists($sAttCode, $aCurrentAttributes)) - { + $aComputedAttributes = []; + foreach ($aExpectedAttributes as $sAttCode => $iExpectCode) { + if (!array_key_exists($sAttCode, $aCurrentAttributes)) { $aComputedAttributes[$sAttCode] = $iExpectCode; - } - else - { - if (!($aCurrentAttributes[$sAttCode] & (OPT_ATT_HIDDEN | OPT_ATT_READONLY))) - { + } else { + if (!($aCurrentAttributes[$sAttCode] & (OPT_ATT_HIDDEN | OPT_ATT_READONLY))) { $iExpectCode = $iExpectCode & ~(OPT_ATT_MUSTPROMPT | OPT_ATT_MUSTCHANGE); // Already prompted/changed, reset the flags } // Later: better check if the attribute is not *null* - if (($iExpectCode & OPT_ATT_MANDATORY) && ($this->Get($sAttCode) != '')) - { + if (($iExpectCode & OPT_ATT_MANDATORY) && ($this->Get($sAttCode) != '')) { $iExpectCode = $iExpectCode & ~(OPT_ATT_MANDATORY); // If the attribute is present, then no need to request its presence } @@ -5079,8 +4906,7 @@ HTML $aComputedAttributes[$sAttCode] = $aComputedAttributes[$sAttCode] & ~(OPT_ATT_READONLY | OPT_ATT_HIDDEN); // Don't care about this form now - if ($aComputedAttributes[$sAttCode] == 0) - { + if ($aComputedAttributes[$sAttCode] == 0) { unset($aComputedAttributes[$sAttCode]); } } @@ -5105,10 +4931,9 @@ HTML * @throws \MySQLException * @throws \OQLException */ - public static function DisplayBulkModifyForm($oP, $sClass, $aSelectedObj, $sCustomOperation, $sCancelUrl, $aExcludeAttributes = array(), $aContextData = array()) + public static function DisplayBulkModifyForm($oP, $sClass, $aSelectedObj, $sCustomOperation, $sCancelUrl, $aExcludeAttributes = [], $aContextData = []) { - if (count($aSelectedObj) > 0) - { + if (count($aSelectedObj) > 0) { $iAllowedCount = count($aSelectedObj); $sSelectedObj = implode(',', $aSelectedObj); @@ -5117,17 +4942,14 @@ HTML // Compute the distribution of the values for each field to determine which of the "scalar or linked set" fields are homogeneous $aList = MetaModel::ListAttributeDefs($sClass); - $aValues = array(); - foreach($aList as $sAttCode => $oAttDef) - { + $aValues = []; + foreach ($aList as $sAttCode => $oAttDef) { if ($oAttDef->IsBulkModifyCompatible()) { - $aValues[$sAttCode] = array(); + $aValues[$sAttCode] = []; } } - while ($oObj = $oSet->Fetch()) - { - foreach($aList as $sAttCode => $oAttDef) - { + while ($oObj = $oSet->Fetch()) { + foreach ($aList as $sAttCode => $oAttDef) { if ($oAttDef->IsBulkModifyCompatible() && $oAttDef->IsWritable()) { $currValue = $oObj->Get($sAttCode); $editValue = ''; @@ -5135,7 +4957,7 @@ HTML $currValue = ''; // Put a single scalar value to force caselog to mock a new entry. For more info see N°1059. } elseif ($currValue instanceof ormSet) { $currValue = $oAttDef->GetEditValue($currValue, $oObj); - } else if ($currValue instanceof ormLinkSet) { + } elseif ($currValue instanceof ormLinkSet) { $sHtmlValue = $oAttDef->GetAsHTML($currValue); $editValue = $oAttDef->GetEditValue($currValue, $oObj); $currValue = $sHtmlValue; @@ -5143,16 +4965,13 @@ HTML if (is_object($currValue)) { continue; } // Skip non scalar values... - if (!array_key_exists($currValue, $aValues[$sAttCode])) - { - $aValues[$sAttCode][$currValue] = array( + if (!array_key_exists($currValue, $aValues[$sAttCode])) { + $aValues[$sAttCode][$currValue] = [ 'count' => 1, 'display' => $oObj->GetAsHTML($sAttCode), 'edit_value' => $editValue, - ); - } - else - { + ]; + } else { $aValues[$sAttCode][$currValue]['count']++; } } @@ -5162,7 +4981,7 @@ HTML /** @var \cmdbAbstractObject $oDummyObj */ $oDummyObj = new $sClass(); // @@ What if the class is abstract ? $oDummyObj->SetDisplayMode(static::ENUM_DISPLAY_MODE_BULK_EDIT); - $aComments = array(); + $aComments = []; function MyComparison($a, $b) // Sort descending { if ($a['count'] == $b['count']) { @@ -5176,15 +4995,19 @@ HTML $sReadyScript = ''; $sFormPrefix = '2_'; foreach ($aList as $sAttCode => $oAttDef) { - $aPrerequisites = MetaModel::GetPrerequisiteAttributes($sClass, - $sAttCode); // List of attributes that are needed for the current one + $aPrerequisites = MetaModel::GetPrerequisiteAttributes( + $sClass, + $sAttCode + ); // List of attributes that are needed for the current one if (count($aPrerequisites) > 0) { // When 'enabling' a field, all its prerequisites must be enabled too $sFieldList = "['{$sFormPrefix}".implode("','{$sFormPrefix}", $aPrerequisites)."']"; $oP->add_ready_script("$('#enable_{$sFormPrefix}{$sAttCode}').on('change', function(evt, sFormId) { return PropagateCheckBox( this.checked, $sFieldList, true); } );\n"); } - $aDependents = MetaModel::GetDependentAttributes($sClass, - $sAttCode); // List of attributes that are needed for the current one + $aDependents = MetaModel::GetDependentAttributes( + $sClass, + $sAttCode + ); // List of attributes that are needed for the current one if (count($aDependents) > 0) { // When 'disabling' a field, all its dependent fields must be disabled too $sFieldList = "['{$sFormPrefix}".implode("','{$sFormPrefix}", $aDependents)."']"; @@ -5227,16 +5050,21 @@ HTML $sTip = "

".Dict::Format('UI:BulkModify_Count_DistinctValues', $iCount)."

    "; $index = 0; foreach ($aMultiValues as $sCurrValue => $aVal) { - $sDisplayValue = empty($aVal['display']) ? ''.Dict::S('Enum:Undefined').'' : str_replace(array( + $sDisplayValue = empty($aVal['display']) ? ''.Dict::S('Enum:Undefined').'' : str_replace([ "\n", "\r", - ), " ", $aVal['display']); - $sTip .= "
  • ".Dict::Format('UI:BulkModify:Value_Exists_N_Times', $sDisplayValue, - $aVal['count'])."
  • "; + ], " ", $aVal['display']); + $sTip .= "
  • ".Dict::Format( + 'UI:BulkModify:Value_Exists_N_Times', + $sDisplayValue, + $aVal['count'] + )."
  • "; $index++; if ($iMaxCount == $index) { - $sTip .= "
  • ".Dict::Format('UI:BulkModify:N_MoreValues', - count($aMultiValues) - $iMaxCount)."
  • "; + $sTip .= "
  • ".Dict::Format( + 'UI:BulkModify:N_MoreValues', + count($aMultiValues) - $iMaxCount + )."
  • "; break; } } @@ -5260,7 +5088,7 @@ HTML $oTagSet->GenerateDiffFromArray($aTagCodes); } $oDummyObj->Set($sAttCode, $oTagSet); - } else if ($oAttDef->GetEditClass() == 'LinkedSet') { + } elseif ($oAttDef->GetEditClass() == 'LinkedSet') { $oOrmLinkSet = $oDummyObj->Get($sAttCode); foreach ($aMultiValues as $key => $sValue) { LinkSetDataTransformer::StringToOrmLinkSet($sValue['edit_value'], $oOrmLinkSet); @@ -5299,8 +5127,8 @@ HTML $oP->add("
    \n"); $sDisableFields = json_encode($aExcludeAttributes); - $aParams = array - ( + $aParams = + [ 'fieldsComments' => $aComments, 'noRelations' => true, 'custom_operation' => $sCustomOperation, @@ -5313,7 +5141,7 @@ HTML 'bulk_context' => [ 'oql' => $sOQL, ], - ); + ]; $aParams = $aParams + $aContextData; // merge keeping associations $oDummyObj->DisplayModifyForm($oP, $aParams); @@ -5327,8 +5155,7 @@ EOF ); } // Else no object selected ??? - else - { + else { $oP->p("No object selected !, nothing to do"); } } @@ -5350,27 +5177,25 @@ EOF * @throws \DictExceptionMissingString * @throws \OQLException */ - public static function DoBulkModify($oP, $sClass, $aSelectedObj, $sCustomOperation, $bPreview, $sCancelUrl, $aContextData = array()) + public static function DoBulkModify($oP, $sClass, $aSelectedObj, $sCustomOperation, $bPreview, $sCancelUrl, $aContextData = []) { /** @var string[] $aHeaders */ - $aHeaders = array( - 'object' => array('label' => MetaModel::GetName($sClass), 'description' => Dict::S('UI:ModifiedObject')), - 'status' => array( + $aHeaders = [ + 'object' => ['label' => MetaModel::GetName($sClass), 'description' => Dict::S('UI:ModifiedObject')], + 'status' => [ 'label' => Dict::S('UI:BulkModifyStatus'), 'description' => Dict::S('UI:BulkModifyStatus+'), - ), - 'errors' => array( + ], + 'errors' => [ 'label' => Dict::S('UI:BulkModifyErrors'), 'description' => Dict::S('UI:BulkModifyErrors+'), - ), - ); - $aRows = array(); - + ], + ]; + $aRows = []; $sHeaderTitle = Dict::Format('UI:Modify_N_ObjectsOf_Class', count($aSelectedObj), MetaModel::GetName($sClass)); $sClassIcon = MetaModel::GetClassIcon($sClass, false); - $oP->set_title(Dict::Format('UI:Modify_N_ObjectsOf_Class', count($aSelectedObj), $sClass)); if (!$bPreview) { // Not in preview mode, do the update for real @@ -5400,14 +5225,14 @@ EOF $sStatus = $bResult ? Dict::S('UI:BulkModifyStatusModified') : Dict::S('UI:BulkModifyStatusSkipped'); } - $aErrorsToDisplay = array_map(function($sError) { + $aErrorsToDisplay = array_map(function ($sError) { return utils::HtmlEntities($sError); }, $aErrors); - $aRows[] = array( + $aRows[] = [ 'object' => $oObj->GetHyperlink(), 'status' => $sStatus, 'errors' => '

    '.($bResult ? '' : implode('

    ', $aErrorsToDisplay)).'

    ', - ); + ]; if ($bResult && (!$bPreview)) { // doing the check will load multiple times same objects :/ // but it shouldn't cost too much on execution time @@ -5431,7 +5256,6 @@ EOF $oPanel->AddCSSClass('ibo-datatable-panel'); $oPanel->AddSubBlock($oTable); - if ($bPreview) { $sFormAction = utils::GetAbsoluteUrlAppRoot().'pages/UI.php'; // No parameter in the URL, the only parameter will be the ones passed through the form // Form to submit: @@ -5487,7 +5311,7 @@ EOF * @throws \DictExceptionMissingString * @throws \Exception */ - public static function DeleteObjects(WebPage $oP, $sClass, $aObjects, $bPreview, $sCustomOperation, $aContextData = array()) + public static function DeleteObjects(WebPage $oP, $sClass, $aObjects, $bPreview, $sCustomOperation, $aContextData = []) { $oDeletionPlan = new DeletionPlan(); @@ -5512,119 +5336,106 @@ EOF $oObj = $aObjects[0]; $sTitle = Dict::Format('UI:Delete:ConfirmDeletionOf_Name', $oObj->GetRawName()); } else { - $sTitle = Dict::Format('UI:Delete:ConfirmDeletionOf_Count_ObjectsOf_Class', count($aObjects), - MetaModel::GetName($sClass)); + $sTitle = Dict::Format( + 'UI:Delete:ConfirmDeletionOf_Count_ObjectsOf_Class', + count($aObjects), + MetaModel::GetName($sClass) + ); } $oP->AddUiBlock(TitleUIBlockFactory::MakeForPage($sTitle)); // Explain what should be done // - $aDisplayData = array(); + $aDisplayData = []; foreach ($oDeletionPlan->ListDeletes() as $sTargetClass => $aDeletes) { foreach ($aDeletes as $iId => $aData) { $oToDelete = $aData['to_delete']; $bAutoDel = (($aData['mode'] == DEL_SILENT) || ($aData['mode'] == DEL_AUTO)); $sRowCssClass = ''; - if (array_key_exists('issue', $aData)) - { - if ($bAutoDel) - { - if (isset($aData['requested_explicitely'])) - { + if (array_key_exists('issue', $aData)) { + if ($bAutoDel) { + if (isset($aData['requested_explicitely'])) { $sConsequence = Dict::Format('UI:Delete:CannotDeleteBecause', $aData['issue']); + } else { + $sConsequence = Dict::Format( + 'UI:Delete:ShouldBeDeletedAtomaticallyButNotPossible', + $aData['issue'] + ); } - else - { - $sConsequence = Dict::Format('UI:Delete:ShouldBeDeletedAtomaticallyButNotPossible', - $aData['issue']); - } - } - else - { - $sConsequence = Dict::Format('UI:Delete:MustBeDeletedManuallyButNotPossible', - $aData['issue']); + } else { + $sConsequence = Dict::Format( + 'UI:Delete:MustBeDeletedManuallyButNotPossible', + $aData['issue'] + ); } $sRowCssClass = 'ibo-is-alert'; - } - else - { - if ($bAutoDel) - { - if (isset($aData['requested_explicitely'])) - { + } else { + if ($bAutoDel) { + if (isset($aData['requested_explicitely'])) { $sConsequence = ''; // not applicable - } - else - { + } else { $sConsequence = Dict::S('UI:Delete:WillBeDeletedAutomatically'); } - } - else - { + } else { $sConsequence = Dict::S('UI:Delete:MustBeDeletedManually'); $sRowCssClass = 'ibo-is-warning'; } } - $aDisplayData[] = array( + $aDisplayData[] = [ '@class' => $sRowCssClass, 'class' => MetaModel::GetName(get_class($oToDelete)), 'object' => $oToDelete->GetHyperLink(), 'consequence' => $sConsequence, - ); + ]; } } - foreach($oDeletionPlan->ListUpdates() as $sRemoteClass => $aToUpdate) - { - foreach($aToUpdate as $iId => $aData) - { + foreach ($oDeletionPlan->ListUpdates() as $sRemoteClass => $aToUpdate) { + foreach ($aToUpdate as $iId => $aData) { $oToUpdate = $aData['to_reset']; $sRowCssClass = ''; - if (array_key_exists('issue', $aData)) - { + if (array_key_exists('issue', $aData)) { $sConsequence = Dict::Format('UI:Delete:CannotUpdateBecause_Issue', $aData['issue']); $sRowCssClass = 'ibo-is-alert'; + } else { + $sConsequence = Dict::Format( + 'UI:Delete:WillAutomaticallyUpdate_Fields', + $aData['attributes_list'] + ); } - else - { - $sConsequence = Dict::Format('UI:Delete:WillAutomaticallyUpdate_Fields', - $aData['attributes_list']); - } - $aDisplayData[] = array( + $aDisplayData[] = [ '@class' => $sRowCssClass, 'class' => MetaModel::GetName(get_class($oToUpdate)), 'object' => $oToUpdate->GetHyperLink(), 'consequence' => $sConsequence, - ); + ]; } } $iImpactedIndirectly = $oDeletionPlan->GetTargetCount() - count($aObjects); $sImpactedTableTitle = ''; $sImpactedTableSubtitle = ''; - if ($iImpactedIndirectly > 0) - { - if (count($aObjects) == 1) - { + if ($iImpactedIndirectly > 0) { + if (count($aObjects) == 1) { $oObj = $aObjects[0]; - $sImpactedTableTitle = Dict::Format('UI:Delete:Count_Objects/LinksReferencing_Object', $iImpactedIndirectly, - $oObj->GetName()); - } - else - { + $sImpactedTableTitle = Dict::Format( + 'UI:Delete:Count_Objects/LinksReferencing_Object', + $iImpactedIndirectly, + $oObj->GetName() + ); + } else { $sImpactedTableTitle = Dict::Format('UI:Delete:Count_Objects/LinksReferencingTheObjects', $iImpactedIndirectly); } $sImpactedTableSubtitle = Dict::S('UI:Delete:ReferencesMustBeDeletedToEnsureIntegrity'); } - if (($iImpactedIndirectly > 0) || $oDeletionPlan->FoundStopper()) - { - $aDisplayConfig = array(); - $aDisplayConfig['class'] = array('label' => 'Class', 'description' => ''); - $aDisplayConfig['object'] = array('label' => 'Object', 'description' => ''); - $aDisplayConfig['consequence'] = array( + if (($iImpactedIndirectly > 0) || $oDeletionPlan->FoundStopper()) { + $aDisplayConfig = []; + $aDisplayConfig['class'] = ['label' => 'Class', 'description' => '']; + $aDisplayConfig['object'] = ['label' => 'Object', 'description' => '']; + $aDisplayConfig['consequence'] = [ 'label' => 'Consequence', 'description' => Dict::S('UI:Delete:Consequence+'), - ); + ]; $oBlock = PanelUIBlockFactory::MakeNeutral($sImpactedTableTitle, $sImpactedTableSubtitle); $oDataTable = DataTableUIBlockFactory::MakeForForm(utils::Sanitize(uniqid('form_', true), '', utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER), $aDisplayConfig, $aDisplayData); @@ -5637,8 +5448,7 @@ EOF $oFailAlertBlock = AlertUIBlockFactory::MakeForDanger('', Dict::S('UI:Delete:SorryDeletionNotAllowed')); $oFailAlertBlock->SetIsClosable(false); $oP->AddUiBlock($oFailAlertBlock); - } - else { + } else { $oWarningAlertBlock = AlertUIBlockFactory::MakeForWarning('', Dict::S('UI:Delete:PleaseDoTheManualOperations')); $oWarningAlertBlock->SetIsClosable(false); $oP->AddUiBlock($oWarningAlertBlock); @@ -5654,14 +5464,16 @@ EOF $oToolbarButtons->AddSubBlock(ButtonUIBlockFactory::MakeForDestructiveAction(Dict::S('UI:Button:Delete'), null, null, true)->SetIsDisabled(true)); $oAppContext = new ApplicationContext(); $oForm->AddSubBlock($oAppContext->GetForFormBlock()); - } - else { + } else { if (count($aObjects) == 1) { $oObj = $aObjects[0]; $sSubtitle = Dict::Format('UI:Delect:Confirm_Object', $oObj->GetHyperLink()); } else { - $sSubtitle = Dict::Format('UI:Delect:Confirm_Count_ObjectsOf_Class', count($aObjects), - MetaModel::GetName($sClass)); + $sSubtitle = Dict::Format( + 'UI:Delect:Confirm_Count_ObjectsOf_Class', + count($aObjects), + MetaModel::GetName($sClass) + ); } foreach ($aObjects as $oObj) { @@ -5672,7 +5484,7 @@ EOF $oSet = new CMDBobjectSet($oFilter); $oDisplaySet = UIContentBlockUIBlockFactory::MakeStandard("0"); $oP->AddSubBlock($oDisplaySet); - $oDisplaySet->AddSubBlock(CMDBAbstractObject::GetDisplaySetBlock($oP, $oSet, array( + $oDisplaySet->AddSubBlock(CMDBAbstractObject::GetDisplaySetBlock($oP, $oSet, [ 'display_limit' => false, 'menu' => false, 'surround_with_panel' => true, @@ -5680,7 +5492,7 @@ EOF 'panel_title_is_html' => true, 'panel_icon' => MetaModel::GetClassIcon($sClass, false), 'panel_class' => $sClass, - ))); + ])); $oForm = FormUIBlockFactory::MakeStandard(''); $oP->AddSubBlock($oForm); @@ -5704,9 +5516,7 @@ EOF $oForm->AddSubBlock($oAppContext->GetForFormBlock()); } - } - else // if ($bPreview)... - { + } else { // if ($bPreview)... // Execute the deletion // if (count($aObjects) == 1) { @@ -5724,48 +5534,40 @@ EOF if ($oDeletionPlan->FoundManualOperation()) { throw new CoreException(Dict::S('UI:Error:CannotDeleteBecauseManualOpNeeded')); } - if ($oDeletionPlan->FoundManualDelete()) - { + if ($oDeletionPlan->FoundManualDelete()) { throw new CoreException(Dict::S('UI:Error:CannotDeleteBecauseOfDepencies')); } // Report deletions // - $aDisplayData = array(); - foreach($oDeletionPlan->ListDeletes() as $sTargetClass => $aDeletes) - { - foreach($aDeletes as $iId => $aData) - { + $aDisplayData = []; + foreach ($oDeletionPlan->ListDeletes() as $sTargetClass => $aDeletes) { + foreach ($aDeletes as $iId => $aData) { $oToDelete = $aData['to_delete']; - if (isset($aData['requested_explicitely'])) - { + if (isset($aData['requested_explicitely'])) { $sMessage = Dict::S('UI:Delete:Deleted'); - } - else - { + } else { $sMessage = Dict::S('UI:Delete:AutomaticallyDeleted'); } - $aDisplayData[] = array( + $aDisplayData[] = [ 'class' => MetaModel::GetName(get_class($oToDelete)), 'object' => $oToDelete->GetName(), 'consequence' => $sMessage, - ); + ]; } } // Report updates // - foreach($oDeletionPlan->ListUpdates() as $sTargetClass => $aToUpdate) - { - foreach($aToUpdate as $iId => $aData) - { + foreach ($oDeletionPlan->ListUpdates() as $sTargetClass => $aToUpdate) { + foreach ($aToUpdate as $iId => $aData) { $oToUpdate = $aData['to_reset']; - $aDisplayData[] = array( + $aDisplayData[] = [ 'class' => MetaModel::GetName(get_class($oToUpdate)), 'object' => $oToUpdate->GetHyperLink(), 'consequence' => Dict::Format('UI:Delete:AutomaticResetOf_Fields', $aData['attributes_list']), - ); + ]; } } @@ -5776,14 +5578,17 @@ EOF $oObj = $aObjects[0]; $sSubtitle = Dict::Format('UI:Delete:CleaningUpRefencesTo_Object', $oObj->GetName()); } else { - $sSubtitle = Dict::Format('UI:Delete:CleaningUpRefencesTo_Several_ObjectsOf_Class', count($aObjects), - MetaModel::GetName($sClass)); + $sSubtitle = Dict::Format( + 'UI:Delete:CleaningUpRefencesTo_Several_ObjectsOf_Class', + count($aObjects), + MetaModel::GetName($sClass) + ); } - $aDisplayConfig = array(); - $aDisplayConfig['class'] = array('label' => 'Class', 'description' => ''); - $aDisplayConfig['object'] = array('label' => 'Object', 'description' => ''); - $aDisplayConfig['consequence'] = array('label' => 'Done', 'description' => Dict::S('UI:Delete:Done+')); + $aDisplayConfig = []; + $aDisplayConfig['class'] = ['label' => 'Class', 'description' => '']; + $aDisplayConfig['object'] = ['label' => 'Object', 'description' => '']; + $aDisplayConfig['consequence'] = ['label' => 'Done', 'description' => Dict::S('UI:Delete:Done+')]; $oResultsPanel = PanelUIBlockFactory::MakeForInformation($sSubtitle); $oP->AddUiBlock($oResultsPanel); @@ -5801,21 +5606,18 @@ EOF */ protected function FindVisibleRedundancySettings() { - $aRet = array(); - foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) - { - if ($oAttDef instanceof AttributeRedundancySettings) - { - if ($oAttDef->IsVisible()) - { + $aRet = []; + foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { + if ($oAttDef instanceof AttributeRedundancySettings) { + if ($oAttDef->IsVisible()) { $aQueryInfo = $oAttDef->GetRelationQueryData(); - if (isset($aQueryInfo['sAttribute'])) - { - $oUpperAttDef = MetaModel::GetAttributeDef($aQueryInfo['sFromClass'], - $aQueryInfo['sAttribute']); + if (isset($aQueryInfo['sAttribute'])) { + $oUpperAttDef = MetaModel::GetAttributeDef( + $aQueryInfo['sFromClass'], + $aQueryInfo['sAttribute'] + ); $oHostAttDef = $oUpperAttDef->GetMirrorLinkAttribute(); - if ($oHostAttDef) - { + if ($oHostAttDef) { $sHostAttCode = $oHostAttDef->GetCode(); $aRet[$sHostAttCode][] = $oAttDef; } @@ -5835,8 +5637,10 @@ EOF */ protected function GetOwnershipJSHandler($oPage, $sOwnershipToken) { - $iInterval = max(MIN_WATCHDOG_INTERVAL, - MetaModel::GetConfig()->Get('concurrent_lock_expiration_delay')) * 1000 / 2; // Minimum interval for the watchdog is MIN_WATCHDOG_INTERVAL + $iInterval = max( + MIN_WATCHDOG_INTERVAL, + MetaModel::GetConfig()->Get('concurrent_lock_expiration_delay') + ) * 1000 / 2; // Minimum interval for the watchdog is MIN_WATCHDOG_INTERVAL $sJSClass = json_encode(get_class($this)); $iKey = (int)$this->GetKey(); $sJSToken = json_encode($sOwnershipToken); @@ -5896,14 +5700,15 @@ JS * @return array * @since 2.7.0 */ - protected static function GetAttEditClassesToRenderAsLargeField(){ - return array( + protected static function GetAttEditClassesToRenderAsLargeField() + { + return [ 'CaseLog', 'CustomFields', 'HTML', 'OQLExpression', 'Text', - ); + ]; } /** @@ -5915,8 +5720,9 @@ JS * * @internal Do NOT use, this is experimental and most likely to be moved elsewhere when we find its rightful place. */ - public static function GetAttDefClassesToExcludeFromMarkupMetadataRawValue(){ - return array( + public static function GetAttDefClassesToExcludeFromMarkupMetadataRawValue() + { + return [ 'AttributeBlob', 'AttributeCustomFields', 'AttributeDashboard', @@ -5927,7 +5733,7 @@ JS 'AttributeText', 'AttributePassword', 'AttributeOneWayPassword', - ); + ]; } ////////////////// @@ -6051,7 +5857,7 @@ JS { /** @var AttributeLinkedSet $oAttDefMirrorLink */ $oAttDefMirrorLink = $oAttDef->GetMirrorLinkAttribute(); - if (is_null($oAttDefMirrorLink) || false === $oAttDefMirrorLink->HasPHPComputation()){ + if (is_null($oAttDefMirrorLink) || false === $oAttDefMirrorLink->HasPHPComputation()) { return false; } @@ -6284,7 +6090,6 @@ JS return $iFlags; } - /** * Append $iFlags to $sAttCode attribute in initial state * diff --git a/application/compilecssservice.class.inc.php b/application/compilecssservice.class.inc.php index a6831e30e..1dc3a2be0 100644 --- a/application/compilecssservice.class.inc.php +++ b/application/compilecssservice.class.inc.php @@ -1,4 +1,5 @@ sLayoutClass = 'DashboardLayoutOneCol'; $this->bAutoReload = false; $this->iAutoReloadSec = MetaModel::GetConfig()->GetStandardReloadInterval(); - $this->aCells = array(); + $this->aCells = []; $this->oDOMNode = null; $this->sId = $sId; } @@ -65,8 +66,8 @@ abstract class Dashboard */ public function FromXml($sXml) { - $this->aCells = array(); // reset the content of the dashboard - set_error_handler(array('Dashboard', 'ErrorHandler')); + $this->aCells = []; // reset the content of the dashboard + set_error_handler(['Dashboard', 'ErrorHandler']); $oDoc = new DOMDocument(); $oDoc->loadXML($sXml); restore_error_handler(); @@ -79,87 +80,69 @@ abstract class Dashboard public function FromDOMDocument(DOMDocument $oDoc) { $this->oDOMNode = $oDoc->getElementsByTagName('dashboard')->item(0); - - if ($oLayoutNode = $this->oDOMNode->getElementsByTagName('layout')->item(0)) - { + + if ($oLayoutNode = $this->oDOMNode->getElementsByTagName('layout')->item(0)) { $this->sLayoutClass = $oLayoutNode->textContent; - } - else - { + } else { $this->sLayoutClass = 'DashboardLayoutOneCol'; } - - if ($oTitleNode = $this->oDOMNode->getElementsByTagName('title')->item(0)) - { + + if ($oTitleNode = $this->oDOMNode->getElementsByTagName('title')->item(0)) { $this->sTitle = $oTitleNode->textContent; - } - else - { + } else { $this->sTitle = ''; } - + $this->bAutoReload = false; $this->iAutoReloadSec = MetaModel::GetConfig()->GetStandardReloadInterval(); - if ($oAutoReloadNode = $this->oDOMNode->getElementsByTagName('auto_reload')->item(0)) - { - if ($oAutoReloadEnabled = $oAutoReloadNode->getElementsByTagName('enabled')->item(0)) - { + if ($oAutoReloadNode = $this->oDOMNode->getElementsByTagName('auto_reload')->item(0)) { + if ($oAutoReloadEnabled = $oAutoReloadNode->getElementsByTagName('enabled')->item(0)) { $this->bAutoReload = ($oAutoReloadEnabled->textContent == 'true'); } - if ($oAutoReloadInterval = $oAutoReloadNode->getElementsByTagName('interval')->item(0)) - { + if ($oAutoReloadInterval = $oAutoReloadNode->getElementsByTagName('interval')->item(0)) { $this->iAutoReloadSec = max(MetaModel::GetConfig()->Get('min_reload_interval'), (int)$oAutoReloadInterval->textContent); } } - if ($oCellsNode = $this->oDOMNode->getElementsByTagName('cells')->item(0)) - { + if ($oCellsNode = $this->oDOMNode->getElementsByTagName('cells')->item(0)) { $oCellsList = $oCellsNode->getElementsByTagName('cell'); - $aCellOrder = array(); + $aCellOrder = []; $iCellRank = 0; /** @var \DOMElement $oCellNode */ - foreach($oCellsList as $oCellNode) - { + foreach ($oCellsList as $oCellNode) { $oCellRank = $oCellNode->getElementsByTagName('rank')->item(0); - if ($oCellRank) - { + if ($oCellRank) { $iCellRank = (float)$oCellRank->textContent; } $oDashletsNode = $oCellNode->getElementsByTagName('dashlets')->item(0); { $oDashletList = $oDashletsNode->getElementsByTagName('dashlet'); $iRank = 0; - $aDashletOrder = array(); + $aDashletOrder = []; /** @var \DOMElement $oDomNode */ - foreach($oDashletList as $oDomNode) - { + foreach ($oDashletList as $oDomNode) { $oRank = $oDomNode->getElementsByTagName('rank')->item(0); - if ($oRank) - { + if ($oRank) { $iRank = (float)$oRank->textContent; } $oNewDashlet = $this->InitDashletFromDOMNode($oDomNode); - $aDashletOrder[] = array('rank' => $iRank, 'dashlet' => $oNewDashlet); + $aDashletOrder[] = ['rank' => $iRank, 'dashlet' => $oNewDashlet]; } - usort($aDashletOrder, array(get_class($this), 'SortOnRank')); - $aDashletList = array(); - foreach($aDashletOrder as $aItem) - { + usort($aDashletOrder, [get_class($this), 'SortOnRank']); + $aDashletList = []; + foreach ($aDashletOrder as $aItem) { $aDashletList[] = $aItem['dashlet']; } - $aCellOrder[] = array('rank' => $iCellRank, 'dashlets' => $aDashletList); + $aCellOrder[] = ['rank' => $iCellRank, 'dashlets' => $aDashletList]; } } - usort($aCellOrder, array(get_class($this), 'SortOnRank')); - foreach($aCellOrder as $aItem) - { + usort($aCellOrder, [get_class($this), 'SortOnRank']); + foreach ($aCellOrder as $aItem) { $this->aCells[] = $aItem['dashlets']; } - } - else - { - $this->aCells = array(); + } else { + $this->aCells = []; } } @@ -169,20 +152,20 @@ abstract class Dashboard * @return mixed */ protected function InitDashletFromDOMNode($oDomNode) - { - $sId = $oDomNode->getAttribute('id'); + { + $sId = $oDomNode->getAttribute('id'); - $sDashletType = $oDomNode->getAttribute('xsi:type'); + $sDashletType = $oDomNode->getAttribute('xsi:type'); - // Test if dashlet can be instantiated, otherwise (uninstalled, broken, ...) we display a placeholder - $sClass = static::GetDashletClassFromType($sDashletType); - /** @var \Dashlet $oNewDashlet */ - $oNewDashlet = new $sClass($this->oMetaModel, $sId); - $oNewDashlet->SetDashletType($sDashletType); - $oNewDashlet->FromDOMNode($oDomNode); + // Test if dashlet can be instantiated, otherwise (uninstalled, broken, ...) we display a placeholder + $sClass = static::GetDashletClassFromType($sDashletType); + /** @var \Dashlet $oNewDashlet */ + $oNewDashlet = new $sClass($this->oMetaModel, $sId); + $oNewDashlet->SetDashletType($sDashletType); + $oNewDashlet->FromDOMNode($oDomNode); - return $oNewDashlet; - } + return $oNewDashlet; + } /** * @param array $aItem1 @@ -208,12 +191,9 @@ abstract class Dashboard */ public static function ErrorHandler($errno, $errstr, $errfile, $errline) { - if ($errno == E_WARNING && (substr_count($errstr,"DOMDocument::loadXML()")>0)) - { + if ($errno == E_WARNING && (substr_count($errstr, "DOMDocument::loadXML()") > 0)) { throw new DOMException($errstr); - } - else - { + } else { return false; } } @@ -231,7 +211,7 @@ abstract class Dashboard $oMainNode = $oDoc->createElement('dashboard'); $oMainNode->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); $oDoc->appendChild($oMainNode); - + $this->ToDOMNode($oMainNode); $sXml = $oDoc->saveXML(); @@ -261,23 +241,21 @@ abstract class Dashboard $oCellsNode = $oDoc->createElement('cells'); $oDefinition->appendChild($oCellsNode); - + $iCellRank = 0; - foreach ($this->aCells as $aCell) - { + foreach ($this->aCells as $aCell) { $oCellNode = $oDoc->createElement('cell'); $oCellNode->setAttribute('id', $iCellRank); $oCellsNode->appendChild($oCellNode); $oCellRank = $oDoc->createElement('rank', $iCellRank); $oCellNode->appendChild($oCellRank); $iCellRank++; - + $iDashletRank = 0; $oDashletsNode = $oDoc->createElement('dashlets'); $oCellNode->appendChild($oDashletsNode); /** @var \Dashlet $oDashlet */ - foreach ($aCell as $oDashlet) - { + foreach ($aCell as $oDashlet) { $oNode = $oDoc->createElement('dashlet'); $oDashletsNode->appendChild($oNode); $oNode->setAttribute('id', $oDashlet->GetID()); @@ -299,18 +277,15 @@ abstract class Dashboard $this->sTitle = $aParams['title']; $this->bAutoReload = $aParams['auto_reload'] == 'true'; $this->iAutoReloadSec = max(MetaModel::GetConfig()->Get('min_reload_interval'), (int) $aParams['auto_reload_sec']); - - foreach($aParams['cells'] as $aCell) - { - $aCellDashlets = array(); - foreach($aCell as $aDashletParams) - { + + foreach ($aParams['cells'] as $aCell) { + $aCellDashlets = []; + foreach ($aCell as $aDashletParams) { $sDashletClass = $aDashletParams['dashlet_class']; $sId = $aDashletParams['dashlet_id']; /** @var \Dashlet $oNewDashlet */ $oNewDashlet = new $sDashletClass($this->oMetaModel, $sId); - if (isset($aDashletParams['dashlet_type'])) - { + if (isset($aDashletParams['dashlet_type'])) { $oNewDashlet->SetDashletType($aDashletParams['dashlet_type']); } $oForm = $oNewDashlet->GetForm(); @@ -322,12 +297,12 @@ abstract class Dashboard } $this->aCells[] = $aCellDashlets; } - + } public function Save() { - + } /** @@ -420,7 +395,7 @@ abstract class Dashboard { $sId = $this->GetNewDashletId(); $oDashlet->SetId($sId); - $this->aCells[] = array($oDashlet); + $this->aCells[] = [$oDashlet]; } /** @@ -430,7 +405,7 @@ abstract class Dashboard * @throws \ReflectionException * @throws \Exception */ - public function RenderProperties($oPage, $aExtraParams = array()) + public function RenderProperties($oPage, $aExtraParams = []) { // menu to pick a layout and edit other properties of the dashboard $oPage->add('
    '.Dict::S('UI:DashboardEdit:Properties').'
    '); @@ -442,7 +417,7 @@ abstract class Dashboard if (is_subclass_of($sLayoutClass, 'DashboardLayout')) { $oReflection = new ReflectionClass($sLayoutClass); if (!$oReflection->isAbstract()) { - $aCallSpec = array($sLayoutClass, 'GetInfo'); + $aCallSpec = [$sLayoutClass, 'GetInfo']; $aInfo = call_user_func($aCallSpec); $sChecked = ($this->sLayoutClass == $sLayoutClass) ? 'checked' : ''; $oPage->add(''); // title="" on either the img or the label does nothing ! @@ -466,7 +441,6 @@ abstract class Dashboard $oField->SetBoundaries(MetaModel::GetConfig()->Get('min_reload_interval'), null); // no upper limit $oForm->AddField($oField); - $this->SetFormParams($oForm, $aExtraParams); $oForm->RenderAsPropertySheet($oPage, false, '.itop-dashboard'); @@ -474,7 +448,7 @@ abstract class Dashboard $sRateTitle = addslashes(Dict::Format('UI:DashboardEdit:AutoReloadSec+', MetaModel::GetConfig()->Get('min_reload_interval'))); $oPage->add_ready_script( -<<GetId(), utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER); @@ -551,7 +525,8 @@ EOF $oToolbar->AddHtml($sHtml); } else { - $oPage->add_script(<<add_script( + <<').html("$sTitleForHTML").text()); JS ); @@ -595,7 +570,7 @@ JS * @param WebPage $oPage * @param array $aExtraParams */ - public function RenderDashletsProperties(WebPage $oPage, $aExtraParams = array()) + public function RenderDashletsProperties(WebPage $oPage, $aExtraParams = []) { // Toolbox/palette to edit the properties of each dashlet $oPage->add('
    '.Dict::S('UI:DashboardEdit:DashletProperties').'
    '); @@ -604,13 +579,10 @@ JS $oLayout = new $this->sLayoutClass(); $oPage->add('
    '); - foreach($this->aCells as $iCellIdx => $aCell) - { + foreach ($this->aCells as $iCellIdx => $aCell) { /** @var \Dashlet $oDashlet */ - foreach($aCell as $oDashlet) - { - if ($oDashlet->IsVisible()) - { + foreach ($aCell as $oDashlet) { + if ($oDashlet->IsVisible()) { $oPage->add(''); - + $sDialogTitle = Dict::S('UI:DashletCreation:Title'); $sOkButtonLabel = Dict::S('UI:Button:Ok'); $sCancelButtonLabel = Dict::S('UI:Button:Cancel'); - + $oPage->add_ready_script( <<GetID(); $sDashboardSanitizedId = $this->GetSanitizedId(); @@ -1630,31 +1569,27 @@ JS private function UpdateDashletUserPrefs(Dashlet $oDashlet, $sDashletIdOrig, array $aExtraParams) { $bIsDashletWithListPref = ($oDashlet instanceof DashletObjectList); - if (!$bIsDashletWithListPref) - { + if (!$bIsDashletWithListPref) { return; } /** @var \DashletObjectList $oDashlet */ $bDashletIdInNewFormat = ($sDashletIdOrig === $oDashlet->GetID()); - if ($bDashletIdInNewFormat) - { + if ($bDashletIdInNewFormat) { return; } $sNewPrefKey = $this->GetDashletObjectListAppUserPreferencesPrefix($oDashlet, $aExtraParams, $oDashlet->GetID()); $sPrefValueForNewKey = appUserPreferences::GetPref($sNewPrefKey, null); $bHasPrefInNewFormat = ($sPrefValueForNewKey !== null); - if ($bHasPrefInNewFormat) - { + if ($bHasPrefInNewFormat) { return; } $sOldPrefKey = $this->GetDashletObjectListAppUserPreferencesPrefix($oDashlet, $aExtraParams, $sDashletIdOrig); $sPrefValueForOldKey = appUserPreferences::GetPref($sOldPrefKey, null); $bHasPrefInOldFormat = ($sPrefValueForOldKey !== null); - if (!$bHasPrefInOldFormat) - { + if (!$bHasPrefInOldFormat) { return; } @@ -1673,7 +1608,7 @@ JS private function GetDashletObjectListAppUserPreferencesPrefix(DashletObjectList $oDashlet, $aExtraParams, $sDashletId) { $sDataTableId = Dashlet::APPUSERPREFERENCES_PREFIX.$sDashletId; - $aClassAliases = array(); + $aClassAliases = []; try { $oFilter = $oDashlet->GetDBSearch($aExtraParams); $aClassAliases = $oFilter->GetSelectedClasses(); diff --git a/application/dashboardlayout.class.inc.php b/application/dashboardlayout.class.inc.php index fd1d98b2d..ec8601797 100644 --- a/application/dashboardlayout.class.inc.php +++ b/application/dashboardlayout.class.inc.php @@ -1,9 +1,10 @@ '', 'icon' => '', 'description' => '', - ); + ]; } } abstract class DashboardLayoutMultiCol extends DashboardLayout { protected $iNbCols; - + public function __construct() { $this->iNbCols = 1; @@ -63,47 +64,38 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout $aKeys = array_reverse(array_keys($aDashlets)); $idx = 0; $bNoVisibleFound = true; - while($idx < count($aKeys) && $bNoVisibleFound) - { + while ($idx < count($aKeys) && $bNoVisibleFound) { /** @var \Dashlet $oDashlet */ $oDashlet = $aDashlets[$aKeys[$idx]]; - if ($oDashlet::IsVisible()) - { + if ($oDashlet::IsVisible()) { $bNoVisibleFound = false; - } - else - { + } else { unset($aDashlets[$aKeys[$idx]]); } $idx++; } return $aDashlets; } - + protected function TrimCellsArray($aCells) { - foreach($aCells as $key => $aDashlets) - { + foreach ($aCells as $key => $aDashlets) { $aCells[$key] = $this->TrimCell($aDashlets); } $aKeys = array_reverse(array_keys($aCells)); $idx = 0; $bNoVisibleFound = true; - while($idx < count($aKeys) && $bNoVisibleFound) - { + while ($idx < count($aKeys) && $bNoVisibleFound) { $aDashlets = $aCells[$aKeys[$idx]]; - if (count($aDashlets) > 0) - { + if (count($aDashlets) > 0) { $bNoVisibleFound = false; - } - else - { + } else { unset($aCells[$aKeys[$idx]]); } $idx++; } - return $aCells; - + return $aCells; + } /** @@ -112,7 +104,7 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout * @param bool $bEditMode * @param array $aExtraParams */ - public function Render($oPage, $aCells, $bEditMode = false, $aExtraParams = array()) + public function Render($oPage, $aCells, $bEditMode = false, $aExtraParams = []) { // Trim the list of cells to remove the invisible/empty ones at the end of the array $aCells = $this->TrimCellsArray($aCells); @@ -157,8 +149,7 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout $oPage->add_script("function updateDashboard".$aExtraParams['dashboard_div_id']."(){".$sJSReload."}"); - if ($bEditMode) // Add one row for extensibility - { + if ($bEditMode) { // Add one row for extensibility $oDashboardRow = new DashboardRow(); $oDashboardLayout->AddDashboardRow($oDashboardRow); @@ -180,7 +171,7 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout $iColNumber = (int) $iCellIdx % $this->iNbCols; $iRowNumber = (int) floor($iCellIdx / $this->iNbCols); - return array($iColNumber, $iRowNumber); + return [$iColNumber, $iRowNumber]; } } @@ -191,13 +182,13 @@ class DashboardLayoutOneCol extends DashboardLayoutMultiCol parent::__construct(); $this->iNbCols = 1; } - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => 'One Column', 'icon' => 'images/layout_1col.png', 'description' => '', - ); + ]; } } @@ -208,13 +199,13 @@ class DashboardLayoutTwoCols extends DashboardLayoutMultiCol parent::__construct(); $this->iNbCols = 2; } - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => 'Two Columns', 'icon' => 'images/layout_2col.png', 'description' => '', - ); + ]; } } @@ -225,12 +216,12 @@ class DashboardLayoutThreeCols extends DashboardLayoutMultiCol parent::__construct(); $this->iNbCols = 3; } - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => 'Two Columns', 'icon' => 'images/layout_3col.png', 'description' => '', - ); + ]; } -} \ No newline at end of file +} diff --git a/application/dashlet.class.inc.php b/application/dashlet.class.inc.php index e25766268..c0a67b24b 100644 --- a/application/dashlet.class.inc.php +++ b/application/dashlet.class.inc.php @@ -1,9 +1,10 @@ sId = $sId; $this->bRedrawNeeded = true; // By default: redraw each time a property changes $this->bFormRedrawNeeded = false; // By default: no need to redraw the form (independent fields) - $this->aProperties = array(); // By default: there is no property - $this->aCSSClasses = array('ibo-dashlet'); + $this->aProperties = []; // By default: there is no property + $this->aCSSClasses = ['ibo-dashlet']; $this->sDashletType = get_class($this); } @@ -100,16 +101,11 @@ abstract class Dashlet public function Prop2Str($value) { $sType = gettype($value); - if ($sType == 'boolean') - { + if ($sType == 'boolean') { $sRet = $value ? 'true' : 'false'; - } - elseif ($sType == 'array') - { + } elseif ($sType == 'array') { $sRet = implode(',', $value); - } - else - { + } else { $sRet = (string) $value; } return $sRet; @@ -124,11 +120,9 @@ abstract class Dashlet */ public function FromDOMNode($oDOMNode) { - foreach ($this->aProperties as $sProperty => $value) - { + foreach ($this->aProperties as $sProperty => $value) { $oPropNode = $oDOMNode->getElementsByTagName($sProperty)->item(0); - if ($oPropNode != null) - { + if ($oPropNode != null) { $this->aProperties[$sProperty] = $this->PropertyFromDOMNode($oPropNode, $sProperty); } } @@ -140,8 +134,7 @@ abstract class Dashlet */ public function ToDOMNode($oDOMNode) { - foreach ($this->aProperties as $sProperty => $value) - { + foreach ($this->aProperties as $sProperty => $value) { $oPropNode = $oDOMNode->ownerDocument->createElement($sProperty); $oDOMNode->appendChild($oPropNode); $this->PropertyToDOMNode($oPropNode, $sProperty, $value); @@ -183,8 +176,7 @@ abstract class Dashlet libxml_clear_errors(); $oDomDoc->loadXml($sXml); $aErrors = libxml_get_errors(); - if (count($aErrors) > 0) - { + if (count($aErrors) > 0) { throw new DOMException("Malformed XML"); } @@ -228,7 +220,7 @@ abstract class Dashlet * @param bool $bEnclosingDiv * @param array $aExtraParams */ - public function DoRender($oPage, $bEditMode = false, $bEnclosingDiv = true, $aExtraParams = array()): UIBlock + public function DoRender($oPage, $bEditMode = false, $bEnclosingDiv = true, $aExtraParams = []): UIBlock { $sId = $this->GetID(); @@ -305,7 +297,7 @@ EOF * * @return iUIBlock */ - abstract public function Render($oPage, $bEditMode = false, $aExtraParams = array()); + abstract public function Render($oPage, $bEditMode = false, $aExtraParams = []); /** * Rendering without the real data @@ -316,7 +308,7 @@ EOF * * @return iUIBlock */ - public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array()) + public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = []) { return $this->Render($oPage, $bEditMode, $aExtraParams); } @@ -344,10 +336,8 @@ EOF */ public function Update($aValues, $aUpdatedFields) { - foreach($aUpdatedFields as $sProp) - { - if (array_key_exists($sProp, $this->aProperties)) - { + foreach ($aUpdatedFields as $sProp) { + if (array_key_exists($sProp, $this->aProperties)) { $this->aProperties[$sProp] = $this->Str2Prop($sProp, $aValues[$sProp]); } } @@ -374,13 +364,13 @@ EOF /** * @return array */ - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => '', 'icon' => '', 'description' => '', - ); + ]; } /** @@ -388,7 +378,7 @@ EOF * * @return \DesignerForm */ - public function GetForm($aInfo = array()) + public function GetForm($aInfo = []) { $oForm = new DesignerForm(); $sPrefix = "dashlet_".$this->GetID(); @@ -413,7 +403,7 @@ EOF /** * @return bool */ - static public function IsVisible() + public static function IsVisible() { return true; } @@ -421,7 +411,7 @@ EOF /** * @return bool */ - static public function CanCreateFromOQL() + public static function CanCreateFromOQL() { return false; } @@ -442,18 +432,15 @@ EOF */ protected function GetGroupByOptions($sOql) { - $aGroupBy = array(); - try - { + $aGroupBy = []; + try { $oQuery = $this->oModelReflection->GetQuery($sOql); $sClass = $oQuery->GetClass(); - foreach($this->oModelReflection->ListAttributes($sClass) as $sAttCode => $sAttType) - { + foreach ($this->oModelReflection->ListAttributes($sClass) as $sAttCode => $sAttType) { // For external fields, find the real type of the target $sExtFieldAttCode = $sAttCode; $sTargetClass = $sClass; - while (is_a($sAttType, 'AttributeExternalField', true)) - { + while (is_a($sAttType, 'AttributeExternalField', true)) { $sExtKeyAttCode = $this->oModelReflection->GetAttributeProperty($sTargetClass, $sExtFieldAttCode, 'extkey_attcode'); $sTargetAttCode = $this->oModelReflection->GetAttributeProperty($sTargetClass, $sExtFieldAttCode, 'target_attcode'); $sTargetClass = $this->oModelReflection->GetAttributeProperty($sTargetClass, $sExtKeyAttCode, 'targetclass'); @@ -472,19 +459,16 @@ EOF 'AttributePassword', ]; foreach ($aForbidenAttType as $sForbidenAttType) { - if (is_a($sAttType, $sForbidenAttType, true)) - { + if (is_a($sAttType, $sForbidenAttType, true)) { continue 2; } } $sLabel = $this->oModelReflection->GetLabel($sClass, $sAttCode); - if (!in_array($sLabel, $aGroupBy)) - { + if (!in_array($sLabel, $aGroupBy)) { $aGroupBy[$sAttCode] = $sLabel; - if (is_a($sAttType, 'AttributeDateTime', true)) - { + if (is_a($sAttType, 'AttributeDateTime', true)) { $aGroupBy[$sAttCode.':hour'] = Dict::Format('UI:DashletGroupBy:Prop-GroupBy:Select-Hour', $sLabel); $aGroupBy[$sAttCode.':month'] = Dict::Format('UI:DashletGroupBy:Prop-GroupBy:Select-Month', $sLabel); $aGroupBy[$sAttCode.':day_of_week'] = Dict::Format('UI:DashletGroupBy:Prop-GroupBy:Select-DayOfWeek', $sLabel); @@ -493,9 +477,7 @@ EOF } } asort($aGroupBy); - } - catch (Exception $e) - { + } catch (Exception $e) { // Fallback in case of OQL problem } return $aGroupBy; @@ -527,7 +509,7 @@ EOF */ class DashletUnknown extends Dashlet { - static protected $aClassList = null; + protected static $aClassList = null; protected $sOriginalDashletXML; @@ -550,22 +532,19 @@ class DashletUnknown extends Dashlet parent::FromDOMNode($oDOMNode); // Build properties from XML - $this->sOriginalDashletXML = ""; - foreach($oDOMNode->childNodes as $oDOMChildNode) - { - if($oDOMChildNode instanceof DOMElement) - { + $this->sOriginalDashletXML = ""; + foreach ($oDOMNode->childNodes as $oDOMChildNode) { + if ($oDOMChildNode instanceof DOMElement) { $sProperty = $oDOMChildNode->tagName; // For all properties but "rank" as it is handle by the dashboard. - if($sProperty !== 'rank') - { + if ($sProperty !== 'rank') { // We need to initialize the property before setting it, otherwise it will guessed as NULL and not used. $this->aProperties[$sProperty] = ''; $this->aProperties[$sProperty] = $this->PropertyFromDOMNode($oDOMChildNode, $sProperty); // And build the original XML - $this->sOriginalDashletXML .= $oDOMChildNode->ownerDocument->saveXML($oDOMChildNode)."\n"; + $this->sOriginalDashletXML .= $oDOMChildNode->ownerDocument->saveXML($oDOMChildNode)."\n"; } } } @@ -585,12 +564,10 @@ class DashletUnknown extends Dashlet libxml_clear_errors(); $oDoc->loadXML(''.$this->sOriginalDashletXML.''); $aErrors = libxml_get_errors(); - if (count($aErrors) > 0) - { + if (count($aErrors) > 0) { throw new DOMFormatException('Dashlet definition not correctly formatted!'); } - foreach($oDoc->documentElement->childNodes as $oDOMChildNode) - { + foreach ($oDoc->documentElement->childNodes as $oDOMChildNode) { $oPropNode = $oDOMNode->ownerDocument->importNode($oDOMChildNode, true); $oDOMNode->appendChild($oPropNode); } @@ -602,23 +579,22 @@ class DashletUnknown extends Dashlet * @throws \DOMException */ public function FromParams($aParams) - { - // For unknown dashlet, parameters are not parsed but passed as a raw xml - if(array_key_exists('xml', $aParams)) - { - // A namespace must be present for the "xsi:type" attribute, otherwise a warning will be thrown. - $sXML = ''.$aParams['xml'].''; - $this->FromXml($sXML); - } - $this->OnUpdate(); - } + { + // For unknown dashlet, parameters are not parsed but passed as a raw xml + if (array_key_exists('xml', $aParams)) { + // A namespace must be present for the "xsi:type" attribute, otherwise a warning will be thrown. + $sXML = ''.$aParams['xml'].''; + $this->FromXml($sXML); + } + $this->OnUpdate(); + } /** * @inheritdoc * * @throws \Exception */ - public function Render($oPage, $bEditMode = false, $aExtraParams = array()) + public function Render($oPage, $bEditMode = false, $aExtraParams = []) { $aInfos = static::GetInfo(); @@ -637,7 +613,7 @@ class DashletUnknown extends Dashlet * * @throws \Exception */ - public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array()) + public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = []) { $aInfos = static::GetInfo(); @@ -654,10 +630,9 @@ class DashletUnknown extends Dashlet /** * @inheritdoc */ - public function GetForm($aInfo = array()) + public function GetForm($aInfo = []) { - if (isset($aInfo['configuration']) && empty($this->sOriginalDashletXML)) - { + if (isset($aInfo['configuration']) && empty($this->sOriginalDashletXML)) { $this->sOriginalDashletXML = $aInfo['configuration']; } return parent::GetForm($aInfo); @@ -678,23 +653,18 @@ class DashletUnknown extends Dashlet protected function PropertyFromDOMNode($oDOMNode, $sProperty) { $bHasSubProperties = false; - foreach($oDOMNode->childNodes as $oDOMChildNode) - { - if($oDOMChildNode->nodeType === XML_ELEMENT_NODE) - { + foreach ($oDOMNode->childNodes as $oDOMChildNode) { + if ($oDOMChildNode->nodeType === XML_ELEMENT_NODE) { $bHasSubProperties = true; break; } } - if($bHasSubProperties) - { + if ($bHasSubProperties) { $sTmp = $oDOMNode->ownerDocument->saveXML($oDOMNode, LIBXML_NOENT); $sTmp = trim(preg_replace("/(<".$oDOMNode->tagName."[^>]*>|<\/".$oDOMNode->tagName.">)/", "", $sTmp)); return $sTmp; - } - else - { + } else { return parent::PropertyFromDOMNode($oDOMNode, $sProperty); } } @@ -705,15 +675,12 @@ class DashletUnknown extends Dashlet protected function PropertyToDOMNode($oDOMNode, $sProperty, $value) { // Save subnodes - if(preg_match('/<(.*)>/', $value)) - { + if (preg_match('/<(.*)>/', $value)) { /** @var \DOMDocumentFragment $oDOMFragment */ $oDOMFragment = $oDOMNode->ownerDocument->createDocumentFragment(); $oDOMFragment->appendXML($value); $oDOMNode->appendChild($oDOMFragment); - } - else - { + } else { parent::PropertyToDOMNode($oDOMNode, $sProperty, $value); } } @@ -724,22 +691,22 @@ class DashletUnknown extends Dashlet * @throws \DOMException */ public function Update($aValues, $aUpdatedFields) - { - $this->FromParams($aValues); - // OnUpdate() already done in FromParams() - return $this; - } + { + $this->FromParams($aValues); + // OnUpdate() already done in FromParams() + return $this; + } /** * @inheritdoc */ - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => Dict::S('UI:DashletUnknown:Label'), 'icon' => 'images/dashlet-unknown.png', 'description' => Dict::S('UI:DashletUnknown:Description'), - ); + ]; } } @@ -753,10 +720,9 @@ class DashletProxy extends DashletUnknown parent::__construct($oModelReflection, $sId); // Remove DashletUnknown class - if( ($key = array_search('dashlet-unknown', $this->aCSSClasses)) !== false ) - { - unset($this->aCSSClasses[$key]); - } + if (($key = array_search('dashlet-unknown', $this->aCSSClasses)) !== false) { + unset($this->aCSSClasses[$key]); + } $this->aCSSClasses[] = 'dashlet-proxy'; } @@ -764,7 +730,7 @@ class DashletProxy extends DashletUnknown /** * @inheritdoc */ - public function Render($oPage, $bEditMode = false, $aExtraParams = array()) + public function Render($oPage, $bEditMode = false, $aExtraParams = []) { // This should never be called. $oDashletContainer = new DashletContainer(null, ['dashlet-content']); @@ -777,7 +743,7 @@ class DashletProxy extends DashletUnknown * * @throws \Exception */ - public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array()) + public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = []) { $aInfos = static::GetInfo(); @@ -797,13 +763,13 @@ class DashletProxy extends DashletUnknown /** * @inheritdoc */ - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => Dict::S('UI:DashletProxy:Label'), 'icon' => 'images/dashlet-proxy.png', 'description' => Dict::S('UI:DashletProxy:Description'), - ); + ]; } } @@ -820,7 +786,7 @@ class DashletEmptyCell extends Dashlet /** * @inheritdoc */ - public function Render($oPage, $bEditMode = false, $aExtraParams = array()) + public function Render($oPage, $bEditMode = false, $aExtraParams = []) { return new Html(' '); } @@ -835,19 +801,19 @@ class DashletEmptyCell extends Dashlet /** * @inheritdoc */ - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => 'Empty Cell', 'icon' => 'images/dashlet-text.png', 'description' => 'Empty Cell Dashlet Placeholder', - ); + ]; } /** * @inheritdoc */ - static public function IsVisible() + public static function IsVisible() { return false; } @@ -867,11 +833,11 @@ class DashletPlainText extends Dashlet /** * @inheritdoc */ - public function Render($oPage, $bEditMode = false, $aExtraParams = array()) + public function Render($oPage, $bEditMode = false, $aExtraParams = []) { $sText = $this->aProperties['text']; $sText = utils::EscapeHtml(Dict::S($sText)); - $sText = str_replace(array("\r\n", "\n", "\r"), "
    ", $sText); + $sText = str_replace(["\r\n", "\n", "\r"], "
    ", $sText); $sId = 'plaintext_'.($bEditMode ? 'edit_' : '').$this->sId; @@ -891,13 +857,13 @@ class DashletPlainText extends Dashlet /** * @inheritdoc */ - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => Dict::S('UI:DashletPlainText:Label'), 'icon' => 'images/dashlets/icons8-text-box-48.png', 'description' => Dict::S('UI:DashletPlainText:Description'), - ); + ]; } } @@ -921,7 +887,7 @@ class DashletObjectList extends Dashlet * @throws \CoreException * @throws \ArchivedObjectException */ - public function Render($oPage, $bEditMode = false, $aExtraParams = array()) + public function Render($oPage, $bEditMode = false, $aExtraParams = []) { $sTitle = $this->aProperties['title']; $sShowMenu = $this->aProperties['menu'] ? '1' : '0'; @@ -931,14 +897,14 @@ class DashletObjectList extends Dashlet // ->AddCSSClass('ibo-datatable-panel'); $oBlock = new DisplayBlock($oFilter, 'list'); - $aParams = array( + $aParams = [ 'menu' => $sShowMenu, 'table_id' => self::APPUSERPREFERENCES_PREFIX.$this->sId, 'surround_with_panel' => true, 'max_height' => '500px', "panel_title" => Dict::S($sTitle), "panel_class" => $sClass, - ); + ]; $sBlockId = 'block_'.$this->sId.($bEditMode ? '_edit' : ''); // make a unique id (edition occurring in the same DOM) //$oBlock->DisplayIntoContentBlock($oPanel, $oPage, $sBlockId, array_merge($aExtraParams, $aParams)); @@ -950,7 +916,7 @@ class DashletObjectList extends Dashlet /** * @inheritdoc */ - public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array()) + public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = []) { $oDashletContainer = new DashletContainer($this->sId, ['dashlet-content']); $sTitle = $this->aProperties['title']; @@ -984,7 +950,7 @@ HTML; return $oDashletContainer; } - public function GetDBSearch($aExtraParams = array()) + public function GetDBSearch($aExtraParams = []) { $sQuery = $this->aProperties['query']; if (isset($aExtraParams['query_params'])) { @@ -993,7 +959,7 @@ HTML; $oObj = MetaModel::GetObject($aExtraParams['this->class'], $aExtraParams['this->id']); $aQueryParams = $oObj->ToArgsForQuery(); } else { - $aQueryParams = array(); + $aQueryParams = []; } return DBObjectSearch::FromOQL($sQuery, $aQueryParams); @@ -1020,19 +986,19 @@ HTML; /** * @inheritdoc */ - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => Dict::S('UI:DashletObjectList:Label'), 'icon' => 'images/dashlets/icons8-list-48.png', 'description' => Dict::S('UI:DashletObjectList:Description'), - ); + ]; } /** * @inheritdoc */ - static public function CanCreateFromOQL() + public static function CanCreateFromOQL() { return true; } @@ -1104,72 +1070,52 @@ abstract class DashletGroupBy extends Dashlet $this->sLimit = $this->aProperties['limit']; $this->sOrderBy = $this->aProperties['order_by']; - if (empty($this->sOrderBy)) - { - if ($this->aProperties['style'] == 'pie') - { + if (empty($this->sOrderBy)) { + if ($this->aProperties['style'] == 'pie') { $this->sOrderBy = 'function'; - } - else - { + } else { $this->sOrderBy = 'attribute'; } } // First perform the query - if the OQL is not ok, it will generate an exception : no need to go further - try - { + try { $oQuery = $this->oModelReflection->GetQuery($sQuery); $this->sClass = $oQuery->GetClass(); $sClassAlias = $oQuery->GetClassAlias(); - } - catch(Exception $e) - { + } catch (Exception $e) { // Invalid query, let the user edit the dashlet/dashboard anyhow $this->sClass = null; $sClassAlias = ''; } // Check groupby... it can be wrong at this stage - if (preg_match('/^(.*):(.*)$/', $sGroupBy, $aMatches)) - { + if (preg_match('/^(.*):(.*)$/', $sGroupBy, $aMatches)) { $this->sGroupByAttCode = $aMatches[1]; $this->sFunction = $aMatches[2]; - } - else - { + } else { $this->sGroupByAttCode = $sGroupBy; $this->sFunction = null; } - if ((!is_null($this->sClass)) && empty($this->aProperties['order_direction'])) - { + if ((!is_null($this->sClass)) && empty($this->aProperties['order_direction'])) { $aAttributeTypes = $this->oModelReflection->ListAttributes($this->sClass); - if (isset($aAttributeTypes[$this->sGroupByAttCode])) - { + if (isset($aAttributeTypes[$this->sGroupByAttCode])) { $sAttributeType = $aAttributeTypes[$this->sGroupByAttCode]; - if (is_subclass_of($sAttributeType, 'AttributeDateTime') || $sAttributeType == 'AttributeDateTime') - { + if (is_subclass_of($sAttributeType, 'AttributeDateTime') || $sAttributeType == 'AttributeDateTime') { $this->sOrderDirection = 'asc'; - } - else - { + } else { $this->sOrderDirection = 'desc'; } } - } - else - { + } else { $this->sOrderDirection = $this->aProperties['order_direction']; } - if ((!is_null($this->sClass)) && $this->oModelReflection->IsValidAttCode($this->sClass, $this->sGroupByAttCode)) - { + if ((!is_null($this->sClass)) && $this->oModelReflection->IsValidAttCode($this->sClass, $this->sGroupByAttCode)) { $sAttLabel = $this->oModelReflection->GetLabel($this->sClass, $this->sGroupByAttCode); - if (!is_null($this->sFunction)) - { - switch($this->sFunction) - { + if (!is_null($this->sFunction)) { + switch ($this->sFunction) { case 'hour': $this->sGroupByLabel = Dict::Format('UI:DashletGroupBy:Prop-GroupBy:Hour', $sAttLabel); $this->sGroupByExpr = "DATE_FORMAT($sClassAlias.{$this->sGroupByAttCode}, '%H')"; // 0 -> 23 @@ -1194,15 +1140,11 @@ abstract class DashletGroupBy extends Dashlet $this->sGroupByLabel = 'Unknown group by function '.$this->sFunction; $this->sGroupByExpr = $sClassAlias.'.'.$this->sGroupByAttCode; } - } - else - { + } else { $this->sGroupByExpr = $sClassAlias.'.'.$this->sGroupByAttCode; $this->sGroupByLabel = $sAttLabel; } - } - else - { + } else { $this->sGroupByAttCode = null; } } @@ -1213,7 +1155,7 @@ abstract class DashletGroupBy extends Dashlet * @throws \CoreException * @throws \ArchivedObjectException */ - public function Render($oPage, $bEditMode = false, $aExtraParams = array()) + public function Render($oPage, $bEditMode = false, $aExtraParams = []) { $sTitle = $this->aProperties['title']; $sQuery = $this->aProperties['query']; @@ -1226,7 +1168,7 @@ abstract class DashletGroupBy extends Dashlet $oObj = MetaModel::GetObject($aExtraParams['this->class'], $aExtraParams['this->id']); $aQueryParams = $oObj->ToArgsForQuery(); } else { - $aQueryParams = array(); + $aQueryParams = []; } $oFilter = DBObjectSearch::FromOQL($sQuery, $aQueryParams); $oFilter->SetShowObsoleteData(utils::ShowObsoleteData()); @@ -1239,7 +1181,7 @@ abstract class DashletGroupBy extends Dashlet switch ($sStyle) { case 'bars': $sType = 'chart'; - $aParams = array( + $aParams = [ 'chart_type' => 'bars', 'chart_title' => $sTitle, 'group_by' => $this->sGroupByExpr, @@ -1249,13 +1191,13 @@ abstract class DashletGroupBy extends Dashlet 'limit' => $this->sLimit, 'order_direction' => $this->sOrderDirection, 'order_by' => $this->sOrderBy, - ); + ]; $sHtmlTitle = ''; // done in the itop block break; case 'pie': $sType = 'chart'; - $aParams = array( + $aParams = [ 'chart_type' => 'pie', 'chart_title' => $sTitle, 'group_by' => $this->sGroupByExpr, @@ -1265,7 +1207,7 @@ abstract class DashletGroupBy extends Dashlet 'limit' => $this->sLimit, 'order_direction' => $this->sOrderDirection, 'order_by' => $this->sOrderBy, - ); + ]; $sHtmlTitle = ''; // done in the itop block break; @@ -1273,7 +1215,7 @@ abstract class DashletGroupBy extends Dashlet default: $sHtmlTitle = utils::HtmlEntities(Dict::S($sTitle)); // done in the itop block $sType = 'count'; - $aParams = array( + $aParams = [ 'group_by' => $this->sGroupByExpr, 'group_by_label' => $this->sGroupByLabel, 'aggregation_function' => $this->sAggregationFunction, @@ -1281,14 +1223,13 @@ abstract class DashletGroupBy extends Dashlet 'limit' => $this->sLimit, 'order_direction' => $this->sOrderDirection, 'order_by' => $this->sOrderBy, - ); + ]; break; } //$oPanel = \Combodo\iTop\Application\UI\Base\Layout\UIContentBlockUIBlockFactory::MakeStandard(); //PanelUIBlockFactory::MakeForClass($sClass, Dict::S($sTitle)); - $sBlockId = 'block_'.$this->sId.($bEditMode ? '_edit' : ''); // make a unique id (edition occurring in the same DOM) $oBlock = new DisplayBlock($oFilter, $sType); //$oBlock->DisplayIntoContentBlock($oPanel, $oPage, $sBlockId, array_merge($aExtraParams, $aParams)); @@ -1313,13 +1254,11 @@ abstract class DashletGroupBy extends Dashlet $oQuery = $this->oModelReflection->GetQuery($sQuery); $sClass = $oQuery->GetClass(); - $aDisplayValues = array(); - if ($this->oModelReflection->IsValidAttCode($sClass, $this->sGroupByAttCode)) - { + $aDisplayValues = []; + if ($this->oModelReflection->IsValidAttCode($sClass, $this->sGroupByAttCode)) { $aAttributeTypes = $this->oModelReflection->ListAttributes($sClass); $sAttributeType = $aAttributeTypes[$this->sGroupByAttCode]; - if (is_subclass_of($sAttributeType, 'AttributeDateTime') || $sAttributeType == 'AttributeDateTime') - { + if (is_subclass_of($sAttributeType, 'AttributeDateTime') || $sAttributeType == 'AttributeDateTime') { // Note: an alternative to this somewhat hardcoded way of doing things would be to implement... //$oExpr = Expression::FromOQL($this->sGroupByExpr); //$aTranslationData = array($oQuery->GetClassAlias() => array($this->sGroupByAttCode => new ScalarExpression(date('Y-m-d H:i:s', $iTime)))); @@ -1329,50 +1268,42 @@ abstract class DashletGroupBy extends Dashlet // - an update to the prototype of MakeValueLabel() so that it takes ModelReflection parameters // - propose clever date/times samples - $aValues = array(); - switch($this->sFunction) - { + $aValues = []; + switch ($this->sFunction) { case 'hour': - $aValues = array(8, 9, 15, 18); + $aValues = [8, 9, 15, 18]; break; case 'month': - $aValues = array('2013 '.Dict::S('Month-11'), '2013 '.Dict::S('Month-12'), '2014 '.Dict::S('Month-01'), '2014 '.Dict::S('Month-02'), '2014 '.Dict::S('Month-03')); + $aValues = ['2013 '.Dict::S('Month-11'), '2013 '.Dict::S('Month-12'), '2014 '.Dict::S('Month-01'), '2014 '.Dict::S('Month-02'), '2014 '.Dict::S('Month-03')]; break; case 'day_of_week': - $aValues = array(Dict::S('DayOfWeek-Monday'), Dict::S('DayOfWeek-Wednesday'), Dict::S('DayOfWeek-Thursday'), Dict::S('DayOfWeek-Friday')); + $aValues = [Dict::S('DayOfWeek-Monday'), Dict::S('DayOfWeek-Wednesday'), Dict::S('DayOfWeek-Thursday'), Dict::S('DayOfWeek-Friday')]; break; case 'day_of_month': - $aValues = array(Dict::S('Month-03'). ' 30', Dict::S('Month-03'). ' 31', Dict::S('Month-04'). ' 01', Dict::S('Month-04'). ' 02', Dict::S('Month-04'). ' 03'); + $aValues = [Dict::S('Month-03').' 30', Dict::S('Month-03').' 31', Dict::S('Month-04').' 01', Dict::S('Month-04').' 02', Dict::S('Month-04').' 03']; break; } - foreach ($aValues as $sValue) - { - $aDisplayValues[] = array('label' => $sValue, 'value' => (int)rand(1, 15)); + foreach ($aValues as $sValue) { + $aDisplayValues[] = ['label' => $sValue, 'value' => (int)rand(1, 15)]; } - } - elseif (is_subclass_of($sAttributeType, 'AttributeEnum') || $sAttributeType == 'AttributeEnum') - { + } elseif (is_subclass_of($sAttributeType, 'AttributeEnum') || $sAttributeType == 'AttributeEnum') { $aAllowed = $this->oModelReflection->GetAllowedValues_att($sClass, $this->sGroupByAttCode); - if ($aAllowed) // null for non enums - { - foreach ($aAllowed as $sValue => $sValueLabel) - { + if ($aAllowed) { // null for non enums + foreach ($aAllowed as $sValue => $sValueLabel) { $iCount = (int) rand(2, 100); - $aDisplayValues[] = array( + $aDisplayValues[] = [ 'label' => $sValueLabel, - 'value' => $iCount - ); + 'value' => $iCount, + ]; } } - } - else - { - $aDisplayValues[] = array('label' => 'a', 'value' => 123); - $aDisplayValues[] = array('label' => 'b', 'value' => 321); - $aDisplayValues[] = array('label' => 'c', 'value' => 456); + } else { + $aDisplayValues[] = ['label' => 'a', 'value' => 123]; + $aDisplayValues[] = ['label' => 'b', 'value' => 321]; + $aDisplayValues[] = ['label' => 'c', 'value' => 456]; } } return $aDisplayValues; @@ -1381,7 +1312,7 @@ abstract class DashletGroupBy extends Dashlet /** * @inheritdoc */ - public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array()) + public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = []) { $oDashletContainer = new DashletContainer(null, ['dashlet-content']); $oDashletContainer->AddHtml('error!'); @@ -1409,20 +1340,18 @@ abstract class DashletGroupBy extends Dashlet $oField = new DesignerComboField('group_by', Dict::S('UI:DashletGroupBy:Prop-GroupBy'), $this->aProperties['group_by']); $oField->SetMandatory(); $oField->SetAllowedValues($aGroupBy); - } - catch(Exception $e) - { + } catch (Exception $e) { $oField = new DesignerTextField('group_by', Dict::S('UI:DashletGroupBy:Prop-GroupBy'), $this->aProperties['group_by']); $oField->SetReadOnly(); - $aGroupBy = array(); + $aGroupBy = []; } $oForm->AddField($oField); - $aStyles = array( + $aStyles = [ 'pie' => Dict::S('UI:DashletGroupByPie:Label'), 'bars' => Dict::S('UI:DashletGroupByBars:Label'), 'table' => Dict::S('UI:DashletGroupByTable:Label'), - ); + ]; $oField = new DesignerComboField('style', Dict::S('UI:DashletGroupBy:Prop-Style'), $this->aProperties['style']); $oField->SetMandatory(); @@ -1437,8 +1366,7 @@ abstract class DashletGroupBy extends Dashlet // Count sub-menu $oSubForm = new DesignerForm(); $oSelectorField->AddSubForm($oSubForm, Dict::S('UI:GroupBy:count'), 'count'); - foreach($aFunctions as $sFct => $sLabel) - { + foreach ($aFunctions as $sFct => $sLabel) { $oSubForm = new DesignerForm(); $oField = new DesignerComboField('aggregation_attribute', Dict::S('UI:DashletGroupBy:Prop-FunctionAttribute'), $this->aProperties['aggregation_attribute']); $oField->SetMandatory(); @@ -1447,39 +1375,33 @@ abstract class DashletGroupBy extends Dashlet $oSelectorField->AddSubForm($oSubForm, $sLabel, $sFct); } - $aOrderField = array(); + $aOrderField = []; - if (isset($this->aProperties['group_by']) && isset($aGroupBy[$this->aProperties['group_by']])) - { + if (isset($this->aProperties['group_by']) && isset($aGroupBy[$this->aProperties['group_by']])) { $aOrderField['attribute'] = $aGroupBy[$this->aProperties['group_by']]; } - if ($this->aProperties['aggregation_function'] == 'count') - { + if ($this->aProperties['aggregation_function'] == 'count') { $aOrderField['function'] = Dict::S('UI:GroupBy:count'); - } - else - { + } else { $aOrderField['function'] = $aFunctions[$this->aProperties['aggregation_function']]; } $oSelectorField = new DesignerFormSelectorField('order_by', Dict::S('UI:DashletGroupBy:Prop-OrderField'), $this->aProperties['order_by']); $oForm->AddField($oSelectorField); $oSelectorField->SetMandatory(); - foreach($aOrderField as $sField => $sLabel) - { + foreach ($aOrderField as $sField => $sLabel) { $oSubForm = new DesignerForm(); - if ($sField == 'function') - { + if ($sField == 'function') { $oField = new DesignerIntegerField('limit', Dict::S('UI:DashletGroupBy:Prop-Limit'), $this->aProperties['limit']); $oSubForm->AddField($oField); } $oSelectorField->AddSubForm($oSubForm, $sLabel, $sField); } - $aOrderDirections = array( + $aOrderDirections = [ 'asc' => Dict::S('UI:DashletGroupBy:Order:asc'), 'desc' => Dict::S('UI:DashletGroupBy:Order:desc'), - ); + ]; $sOrderDirection = empty($this->aProperties['order_direction']) ? $this->sOrderDirection : $this->aProperties['order_direction']; $oField = new DesignerComboField('order_direction', Dict::S('UI:DashletGroupBy:Prop-OrderDirection'), $sOrderDirection); $oField->SetMandatory(); @@ -1493,13 +1415,12 @@ abstract class DashletGroupBy extends Dashlet */ protected function GetOrderBy() { - if (is_null($this->sClass)) - { - return array(); + if (is_null($this->sClass)) { + return []; } - return array( + return [ $this->aProperties['group_by'] => $this->oModelReflection->GetLabel($this->sClass, $this->aProperties['group_by']), - '_itop_'.$this->aProperties['aggregation_function'].'_' => Dict::S('UI:GroupBy:'.$this->aProperties['aggregation_function'])); + '_itop_'.$this->aProperties['aggregation_function'].'_' => Dict::S('UI:GroupBy:'.$this->aProperties['aggregation_function'])]; } /** @@ -1509,10 +1430,9 @@ abstract class DashletGroupBy extends Dashlet */ protected function GetAllowedFunctions($aFunctionAttributes) { - $aFunctions = array(); + $aFunctions = []; - if (!empty($aFunctionAttributes) || is_null($this->sClass)) - { + if (!empty($aFunctionAttributes) || is_null($this->sClass)) { $aFunctions['sum'] = Dict::S('UI:GroupBy:sum'); $aFunctions['avg'] = Dict::S('UI:GroupBy:avg'); $aFunctions['min'] = Dict::S('UI:GroupBy:min'); @@ -1529,19 +1449,15 @@ abstract class DashletGroupBy extends Dashlet */ protected function GetNumericAttributes($sOql) { - $aFunctionAttributes = array(); - try - { + $aFunctionAttributes = []; + try { $oQuery = $this->oModelReflection->GetQuery($sOql); $sClass = $oQuery->GetClass(); - if (is_null($sClass)) - { + if (is_null($sClass)) { return $aFunctionAttributes; } - foreach($this->oModelReflection->ListAttributes($sClass) as $sAttCode => $sAttType) - { - switch ($sAttType) - { + foreach ($this->oModelReflection->ListAttributes($sClass) as $sAttCode => $sAttType) { + switch ($sAttType) { case 'AttributeDecimal': case 'AttributeDuration': case 'AttributeInteger': @@ -1552,9 +1468,7 @@ abstract class DashletGroupBy extends Dashlet break; } } - } - catch (Exception $e) - { + } catch (Exception $e) { // In case the OQL is bad } @@ -1566,10 +1480,8 @@ abstract class DashletGroupBy extends Dashlet */ public function Update($aValues, $aUpdatedFields) { - if (in_array('query', $aUpdatedFields)) - { - try - { + if (in_array('query', $aUpdatedFields)) { + try { $sCurrQuery = $aValues['query']; $oCurrSearch = $this->oModelReflection->GetQuery($sCurrQuery); $sCurrClass = $oCurrSearch->GetClass(); @@ -1578,24 +1490,19 @@ abstract class DashletGroupBy extends Dashlet $oPrevSearch = $this->oModelReflection->GetQuery($sPrevQuery); $sPrevClass = $oPrevSearch->GetClass(); - if ($sCurrClass != $sPrevClass) - { + if ($sCurrClass != $sPrevClass) { $this->bFormRedrawNeeded = true; // wrong but not necessary - unset($aUpdatedFields['group_by']); $this->aProperties['group_by'] = ''; } - } - catch(Exception $e) - { + } catch (Exception $e) { $this->bFormRedrawNeeded = true; } } $oDashlet = parent::Update($aValues, $aUpdatedFields); - if (in_array('style', $aUpdatedFields)) - { - switch($aValues['style']) - { + if (in_array('style', $aUpdatedFields)) { + switch ($aValues['style']) { // Style changed, mutate to the specified type of chart case 'pie': $oDashlet = new DashletGroupByPie($this->oModelReflection, $this->sId); @@ -1613,12 +1520,10 @@ abstract class DashletGroupBy extends Dashlet $oDashlet->bRedrawNeeded = true; $oDashlet->bFormRedrawNeeded = true; } - if (in_array('aggregation_attribute', $aUpdatedFields) || in_array('order_direction', $aUpdatedFields) || in_array('order_by', $aUpdatedFields) || in_array('limit', $aUpdatedFields)) - { + if (in_array('aggregation_attribute', $aUpdatedFields) || in_array('order_direction', $aUpdatedFields) || in_array('order_by', $aUpdatedFields) || in_array('limit', $aUpdatedFields)) { $oDashlet->bRedrawNeeded = true; } - if (in_array('group_by', $aUpdatedFields) || in_array('aggregation_function', $aUpdatedFields)) - { + if (in_array('group_by', $aUpdatedFields) || in_array('aggregation_function', $aUpdatedFields)) { $oDashlet->bRedrawNeeded = true; $oDashlet->bFormRedrawNeeded = true; } @@ -1628,20 +1533,20 @@ abstract class DashletGroupBy extends Dashlet /** * @inheritdoc */ - static public function GetInfo() + public static function GetInfo() { // Note: no need to translate, should never be visible to the end-user! - return array( + return [ 'label' => 'Objects grouped by...', 'icon' => 'images/dashlets/icons8-transaction-list-48.png', 'description' => 'Grouped objects dashlet (abstract)', - ); + ]; } /** * @inheritdoc */ - static public function CanCreateFromOQL() + public static function CanCreateFromOQL() { return true; } @@ -1692,13 +1597,13 @@ class DashletGroupByPie extends DashletGroupBy /** * @inheritdoc */ - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => Dict::S('UI:DashletGroupByPie:Label'), 'icon' => 'images/dashlets/icons8-pie-chart-48.png', 'description' => Dict::S('UI:DashletGroupByPie:Description'), - ); + ]; } /** @@ -1726,7 +1631,7 @@ class DashletGroupByPie extends DashletGroupBy /** * @inheritdoc */ - public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array()) + public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = []) { $oDashletContainer = new DashletContainer(null, ['dashlet-content']); @@ -1739,10 +1644,10 @@ class DashletGroupByPie extends DashletGroupBy $aDisplayValues = $this->MakeSimulatedData(); - $aColumns = array(); - $aNames = array(); + $aColumns = []; + $aNames = []; foreach ($aDisplayValues as $idx => $aValue) { - $aColumns[] = array('series_'.$idx, (int)$aValue['value']); + $aColumns[] = ['series_'.$idx, (int)$aValue['value']]; $aNames['series_'.$idx] = $aValue['label']; } $sJSColumns = json_encode($aColumns); @@ -1774,7 +1679,6 @@ EOF } } - class DashletGroupByBars extends DashletGroupBy { /** @@ -1789,19 +1693,19 @@ class DashletGroupByBars extends DashletGroupBy /** * @inheritdoc */ - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => Dict::S('UI:DashletGroupByBars:Label'), 'icon' => 'images/dashlets/icons8-bar-chart-48.png', 'description' => Dict::S('UI:DashletGroupByBars:Description'), - ); + ]; } /** * @inheritdoc */ - public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array()) + public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = []) { $oDashletContainer = new DashletContainer(null, ['dashlet-content']); @@ -1814,7 +1718,7 @@ class DashletGroupByBars extends DashletGroupBy $aDisplayValues = $this->MakeSimulatedData(); - $aNames = array(); + $aNames = []; foreach ($aDisplayValues as $idx => $aValue) { $aNames[$idx] = $aValue['label']; } @@ -1889,19 +1793,19 @@ class DashletGroupByTable extends DashletGroupBy /** * @inheritdoc */ - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => Dict::S('UI:DashletGroupByTable:Label'), 'description' => Dict::S('UI:DashletGroupByTable:Description'), 'icon' => 'images/dashlets/icons8-transaction-list-48.png', - ); + ]; } /** * @inheritdoc */ - public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array()) + public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = []) { $oDashletContainer = new DashletContainer(); @@ -1911,7 +1815,6 @@ class DashletGroupByTable extends DashletGroupBy $iTotal += $aDisplayData['value']; } - $sBlockId = 'block_fake_'.$this->sId.($bEditMode ? '_edit' : ''); // make a unique id (edition occuring in the same DOM) $sHtml = ''; @@ -1944,7 +1847,6 @@ class DashletGroupByTable extends DashletGroupBy } } - class DashletHeaderStatic extends Dashlet { /** @@ -1961,7 +1863,7 @@ class DashletHeaderStatic extends Dashlet /** * @inheritdoc */ - public function Render($oPage, $bEditMode = false, $aExtraParams = array()) + public function Render($oPage, $bEditMode = false, $aExtraParams = []) { $sTitle = $this->aProperties['title']; $sIcon = $this->aProperties['icon']; @@ -1989,13 +1891,10 @@ class DashletHeaderStatic extends Dashlet */ protected function PropertyFromDOMNode($oDOMNode, $sProperty) { - if ($sProperty == 'icon') - { + if ($sProperty == 'icon') { $oIconField = $this->oModelReflection->GetIconSelectionField('icon'); return $oIconField->ValueFromDOMNode($oDOMNode); - } - else - { + } else { return parent::PropertyFromDOMNode($oDOMNode, $sProperty); } } @@ -2005,13 +1904,10 @@ class DashletHeaderStatic extends Dashlet */ protected function PropertyToDOMNode($oDOMNode, $sProperty, $value) { - if ($sProperty == 'icon') - { + if ($sProperty == 'icon') { $oIconField = $this->oModelReflection->GetIconSelectionField('icon'); $oIconField->ValueToDOMNode($oDOMNode, $value); - } - else - { + } else { parent::PropertyToDOMNode($oDOMNode, $sProperty, $value); } } @@ -2019,17 +1915,16 @@ class DashletHeaderStatic extends Dashlet /** * @inheritdoc */ - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => Dict::S('UI:DashletHeaderStatic:Label'), 'icon' => 'images/dashlets/icons8-header-48.png', 'description' => Dict::S('UI:DashletHeaderStatic:Description'), - ); + ]; } } - class DashletHeaderDynamic extends Dashlet { /** @@ -2044,7 +1939,7 @@ class DashletHeaderDynamic extends Dashlet $this->aProperties['subtitle'] = Dict::S('UI:DashletHeaderDynamic:Prop-Subtitle:Default'); $this->aProperties['query'] = 'SELECT Contact'; $this->aProperties['group_by'] = 'status'; - $this->aProperties['values'] = array('active', 'inactive'); + $this->aProperties['values'] = ['active', 'inactive']; } /** @@ -2056,21 +1951,17 @@ class DashletHeaderDynamic extends Dashlet $sGroupBy = $this->aProperties['group_by']; $aValues = $this->aProperties['values']; - if (empty($aValues)) - { - $aValues = array(); + if (empty($aValues)) { + $aValues = []; } $oQuery = $this->oModelReflection->GetQuery($sQuery); $sClass = $oQuery->GetClass(); - if ($this->oModelReflection->IsValidAttCode($sClass, $sGroupBy)) - { - if (count($aValues) == 0) - { + if ($this->oModelReflection->IsValidAttCode($sClass, $sGroupBy)) { + if (count($aValues) == 0) { $aAllowed = $this->oModelReflection->GetAllowedValues_att($sClass, $sGroupBy); - if (is_array($aAllowed)) - { + if (is_array($aAllowed)) { $aValues = array_keys($aAllowed); } } @@ -2084,7 +1975,7 @@ class DashletHeaderDynamic extends Dashlet * @throws \CoreException * @throws \ArchivedObjectException */ - public function Render($oPage, $bEditMode = false, $aExtraParams = array()) + public function Render($oPage, $bEditMode = false, $aExtraParams = []) { $sTitle = utils::HtmlEntities($this->aProperties['title']); $sIcon = $this->aProperties['icon']; @@ -2099,20 +1990,20 @@ class DashletHeaderDynamic extends Dashlet if (count($aValues) > 0) { // Stats grouped by $sCSV = implode(',', $aValues); - $aParams = array( + $aParams = [ 'title[block]' => $sTitle, 'label[block]' => $sSubtitle, 'status[block]' => $sGroupBy, 'status_codes[block]' => $sCSV, 'context_filter' => 1, - ); + ]; } else { // Simple stats - $aParams = array( + $aParams = [ 'title[block]' => $sTitle, 'label[block]' => $sSubtitle, 'context_filter' => 1, - ); + ]; } if (isset($aExtraParams['query_params'])) { @@ -2121,7 +2012,7 @@ class DashletHeaderDynamic extends Dashlet $oObj = MetaModel::GetObject($aExtraParams['this->class'], $aExtraParams['this->id']); $aQueryParams = $oObj->ToArgsForQuery(); } else { - $aQueryParams = array(); + $aQueryParams = []; } $oFilter = DBObjectSearch::FromOQL($sQuery, $aQueryParams); $oFilter->SetShowObsoleteData(utils::ShowObsoleteData()); @@ -2147,7 +2038,7 @@ class DashletHeaderDynamic extends Dashlet /** * @inheritdoc */ - public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array()) + public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = []) { $sTitle = utils::HtmlEntities($this->aProperties['title']); $sIcon = $this->aProperties['icon']; @@ -2164,8 +2055,7 @@ class DashletHeaderDynamic extends Dashlet foreach ($aValues as $sValue) { $aValueLabels[] = $this->oModelReflection->GetValueLabel($sClass, $sGroupBy, $sValue); } - } - catch (UnknownClassOqlException $e) { + } catch (UnknownClassOqlException $e) { $aValueLabels[] = $e->GetUserFriendlyDescription(); $aValues[] = 1; } @@ -2207,7 +2097,6 @@ class DashletHeaderDynamic extends Dashlet $sHtml .= ''.utils::HtmlEntities($sSubtitle).''; $sHtml .= '
    '; - $oDashletContainer->AddHtml($sHtml); return $oDashletContainer; @@ -2234,8 +2123,7 @@ class DashletHeaderDynamic extends Dashlet $oField->AddCSSClass("ibo-is-code"); $oForm->AddField($oField); - try - { + try { // Group by field: build the list of possible values (attribute codes + ...) $oQuery = $this->oModelReflection->GetQuery($this->aProperties['query']); $sClass = $oQuery->GetClass(); @@ -2243,9 +2131,7 @@ class DashletHeaderDynamic extends Dashlet $oField = new DesignerComboField('group_by', Dict::S('UI:DashletHeaderDynamic:Prop-GroupBy'), $this->aProperties['group_by']); $oField->SetMandatory(); $oField->SetAllowedValues($aGroupBy); - } - catch(Exception $e) - { + } catch (Exception $e) { $oField = new DesignerTextField('group_by', Dict::S('UI:DashletHeaderDynamic:Prop-GroupBy'), $this->aProperties['group_by']); $oField->SetReadOnly(); } @@ -2253,13 +2139,10 @@ class DashletHeaderDynamic extends Dashlet $oField = new DesignerComboField('values', Dict::S('UI:DashletHeaderDynamic:Prop-Values'), $this->aProperties['values']); $oField->MultipleSelection(true); - if (isset($sClass) && $this->oModelReflection->IsValidAttCode($sClass, $this->aProperties['group_by'])) - { + if (isset($sClass) && $this->oModelReflection->IsValidAttCode($sClass, $this->aProperties['group_by'])) { $aValues = $this->oModelReflection->GetAllowedValues_att($sClass, $this->aProperties['group_by']); $oField->SetAllowedValues($aValues); - } - else - { + } else { $oField->SetReadOnly(); } $oForm->AddField($oField); @@ -2270,10 +2153,8 @@ class DashletHeaderDynamic extends Dashlet */ public function Update($aValues, $aUpdatedFields) { - if (in_array('query', $aUpdatedFields)) - { - try - { + if (in_array('query', $aUpdatedFields)) { + try { $sCurrQuery = $aValues['query']; $oCurrSearch = $this->oModelReflection->GetQuery($sCurrQuery); $sCurrClass = $oCurrSearch->GetClass(); @@ -2282,23 +2163,19 @@ class DashletHeaderDynamic extends Dashlet $oPrevSearch = $this->oModelReflection->GetQuery($sPrevQuery); $sPrevClass = $oPrevSearch->GetClass(); - if ($sCurrClass != $sPrevClass) - { + if ($sCurrClass != $sPrevClass) { $this->bFormRedrawNeeded = true; // wrong but not necessary - unset($aUpdatedFields['group_by']); $this->aProperties['group_by'] = ''; - $this->aProperties['values'] = array(); + $this->aProperties['values'] = []; } - } - catch(Exception $e) - { + } catch (Exception $e) { $this->bFormRedrawNeeded = true; } } - if (in_array('group_by', $aUpdatedFields)) - { + if (in_array('group_by', $aUpdatedFields)) { $this->bFormRedrawNeeded = true; - $this->aProperties['values'] = array(); + $this->aProperties['values'] = []; } return parent::Update($aValues, $aUpdatedFields); } @@ -2308,13 +2185,10 @@ class DashletHeaderDynamic extends Dashlet */ protected function PropertyFromDOMNode($oDOMNode, $sProperty) { - if ($sProperty == 'icon') - { + if ($sProperty == 'icon') { $oIconField = $this->oModelReflection->GetIconSelectionField('icon'); return $oIconField->ValueFromDOMNode($oDOMNode); - } - else - { + } else { return parent::PropertyFromDOMNode($oDOMNode, $sProperty); } } @@ -2324,13 +2198,10 @@ class DashletHeaderDynamic extends Dashlet */ protected function PropertyToDOMNode($oDOMNode, $sProperty, $value) { - if ($sProperty == 'icon') - { + if ($sProperty == 'icon') { $oIconField = $this->oModelReflection->GetIconSelectionField('icon'); $oIconField->ValueToDOMNode($oDOMNode, $value); - } - else - { + } else { parent::PropertyToDOMNode($oDOMNode, $sProperty, $value); } } @@ -2338,17 +2209,16 @@ class DashletHeaderDynamic extends Dashlet /** * @inheritdoc */ - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => Dict::S('UI:DashletHeaderDynamic:Label'), 'icon' => 'images/dashlets/icons8-header-altered-48.png', 'description' => Dict::S('UI:DashletHeaderDynamic:Description'), - ); + ]; } } - class DashletBadge extends Dashlet { /** @@ -2367,7 +2237,7 @@ class DashletBadge extends Dashlet * * @throws \Exception */ - public function Render($oPage, $bEditMode = false, $aExtraParams = array()) + public function Render($oPage, $bEditMode = false, $aExtraParams = []) { $oDashletContainer = new DashletContainer($this->sId, ['dashlet-content']); @@ -2385,7 +2255,7 @@ class DashletBadge extends Dashlet /** * @inheritdoc */ - public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array()) + public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = []) { $oDashletContainer = new DashletContainer($this->sId, ['dashlet-content']); @@ -2409,7 +2279,7 @@ HTML; return $oDashletContainer; } - static protected $aClassList = null; + protected static $aClassList = null; /** * @inheritdoc @@ -2418,28 +2288,24 @@ HTML; */ public function GetPropertiesFields(DesignerForm $oForm) { - if (is_null(self::$aClassList)) - { + if (is_null(self::$aClassList)) { // Cache the ordered list of classes (ordered on the label) // (has a significant impact when editing a page with lots of badges) // - $aClasses = array(); - foreach($this->oModelReflection->GetClasses('bizmodel', true /*exclude links*/) as $sClass) - { + $aClasses = []; + foreach ($this->oModelReflection->GetClasses('bizmodel', true /*exclude links*/) as $sClass) { $aClasses[$sClass] = $this->oModelReflection->GetName($sClass); } asort($aClasses); - self::$aClassList = array(); - foreach($aClasses as $sClass => $sLabel) - { + self::$aClassList = []; + foreach ($aClasses as $sClass => $sLabel) { $sIconUrl = $this->oModelReflection->GetClassIcon($sClass, false); - if ($sIconUrl == '') - { + if ($sIconUrl == '') { // The icon does not exist, let's use a transparent one of the same size. $sIconUrl = utils::GetAbsoluteUrlAppRoot().'images/transparent_32_32.png'; } - self::$aClassList[] = array('value' => $sClass, 'label' => $sLabel, 'icon' => $sIconUrl); + self::$aClassList[] = ['value' => $sClass, 'label' => $sLabel, 'icon' => $sIconUrl]; } } @@ -2452,12 +2318,12 @@ HTML; /** * @inheritdoc */ - static public function GetInfo() + public static function GetInfo() { - return array( + return [ 'label' => Dict::S('UI:DashletBadge:Label'), 'icon' => 'images/dashlets/icons8-badge-48.png', 'description' => Dict::S('UI:DashletBadge:Description'), - ); + ]; } } diff --git a/application/datatable.class.inc.php b/application/datatable.class.inc.php index 4a01b1be5..3d78889cb 100644 --- a/application/datatable.class.inc.php +++ b/application/datatable.class.inc.php @@ -80,42 +80,31 @@ class DataTable // Identified tables can have their own specific settings $oCustomSettings = DataTableSettings::GetTableSettings($this->aClassAliases, $this->sTableId); - - if ($oCustomSettings != null) - { + + if ($oCustomSettings != null) { // Custom settings overload the default ones $this->bUseCustomSettings = true; - if ($this->oDefaultSettings->iDefaultPageSize == 0) - { + if ($this->oDefaultSettings->iDefaultPageSize == 0) { $oCustomSettings->iDefaultPageSize = 0; } - } - else - { + } else { $oCustomSettings = $oSettings; } - if ($oCustomSettings->iDefaultPageSize > 0) - { + if ($oCustomSettings->iDefaultPageSize > 0) { $this->oSet->SetLimit($oCustomSettings->iDefaultPageSize); } $this->oSet->SetOrderBy($oCustomSettings->GetSortOrder()); // Load only the requested columns - $aColumnsToLoad = array(); - foreach($oCustomSettings->aColumns as $sAlias => $aColumnsInfo) - { - foreach($aColumnsInfo as $sAttCode => $aData) - { - if ($sAttCode != '_key_') - { - if ($aData['checked']) - { + $aColumnsToLoad = []; + foreach ($oCustomSettings->aColumns as $sAlias => $aColumnsInfo) { + foreach ($aColumnsInfo as $sAttCode => $aData) { + if ($sAttCode != '_key_') { + if ($aData['checked']) { $aColumnsToLoad[$sAlias][] = $sAttCode; - } - else - { - // See if this column is a must to load + } else { + // See if this column is a must to load $sClass = $this->aClassAliases[$sAlias]; $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); if ($oAttDef->AlwaysLoadInTables()) { @@ -127,18 +116,15 @@ class DataTable } $this->oSet->OptimizeColumnLoad($aColumnsToLoad); - $bToolkitMenu = true; - if (isset($aExtraParams['toolkit_menu'])) - { + if (isset($aExtraParams['toolkit_menu'])) { $bToolkitMenu = (bool) $aExtraParams['toolkit_menu']; } - if (UserRights::IsPortalUser()) - { + if (UserRights::IsPortalUser()) { // Portal users have a limited access to data, for now they can only see what's configured for them $bToolkitMenu = false; } - + return $this->GetAsHTML($oPage, $oCustomSettings->iDefaultPageSize, $oCustomSettings->iDefaultPageSize, 0, $oCustomSettings->aColumns, $bActionsMenu, $bToolkitMenu, $sSelectMode, $bViewLink, $aExtraParams); } @@ -167,10 +153,10 @@ class DataTable if ($bActionsMenu) { $sActionsMenu = $this->GetActionsMenu($oPage, $aExtraParams); } -// if ($bToolkitMenu) -// { -// $sToolkitMenu = $this->GetToolkitMenu($oPage, $aExtraParams); -// } + // if ($bToolkitMenu) + // { + // $sToolkitMenu = $this->GetToolkitMenu($oPage, $aExtraParams); + // } $sDataTable = $this->GetHTMLTable($oPage, $aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams); $sConfigDlg = $this->GetTableConfigDlg($oPage, $aColumns, $bViewLink, $iDefaultPageSize); @@ -188,7 +174,7 @@ class DataTable $aExtraParams['show_obsolete_data'] = $this->bShowObsoleteData; - $aOptions = array( + $aOptions = [ 'sPersistentId' => '', 'sFilter' => $this->oSet->GetFilter()->serialize(), 'oColumns' => $aColumns, @@ -202,12 +188,11 @@ class DataTable 'sTableId' => $this->sTableId, 'oExtraParams' => $aExtraParams, 'sRenderUrl' => utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php', - 'oRenderParameters' => array('str' => ''), // Forces JSON to encode this as a object... - 'oDefaultSettings' => array('str' => ''), // Forces JSON to encode this as a object... - 'oLabels' => array('moveup' => Dict::S('UI:Button:MoveUp'), 'movedown' => Dict::S('UI:Button:MoveDown')), - ); - if($this->oDefaultSettings != null) - { + 'oRenderParameters' => ['str' => ''], // Forces JSON to encode this as a object... + 'oDefaultSettings' => ['str' => ''], // Forces JSON to encode this as a object... + 'oLabels' => ['moveup' => Dict::S('UI:Button:MoveUp'), 'movedown' => Dict::S('UI:Button:MoveDown')], + ]; + if ($this->oDefaultSettings != null) { $aOptions['oDefaultSettings'] = $this->GetAsHash($this->oDefaultSettings); } $sJSOptions = json_encode($aOptions); @@ -222,16 +207,14 @@ class DataTable */ public function GetAsHTMLTableRows(WebPage $oPage, $iPageSize, $aColumns, $sSelectMode, $bViewLink, $aExtraParams) { - if ($iPageSize < 1) - { + if ($iPageSize < 1) { $iPageSize = -1; // convention: no pagination } $aAttribs = $this->GetHTMLTableConfig($aColumns, $sSelectMode, $bViewLink); $aValues = $this->GetHTMLTableValues($aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams); - + $sHtml = ''; - foreach($aValues as $aRow) - { + foreach ($aValues as $aRow) { $sHtml .= $oPage->GetTableRow($aRow, $aAttribs); } return $sHtml; @@ -245,15 +228,12 @@ class DataTable */ protected function GetObjectCount(WebPage $oPage, $sSelectMode) { - if (($sSelectMode == 'single') || ($sSelectMode == 'multiple')) - { + if (($sSelectMode == 'single') || ($sSelectMode == 'multiple')) { $sHtml = '
    '.Dict::Format('UI:Pagination:HeaderSelection', ''.$this->iNbObjects.'', '0').'
    '; - } - else - { + } else { $sHtml = '
    '.Dict::Format('UI:Pagination:HeaderNoSelection', ''.$this->iNbObjects.'').'
    '; } - return $sHtml; + return $sHtml; } /** @@ -267,26 +247,19 @@ class DataTable protected function GetPager(WebPage $oPage, $iPageSize, $iDefaultPageSize, $iPageIndex) { $sHtml = ''; - if ($iPageSize < 1) // Display all - { + if ($iPageSize < 1) { // Display all $sPagerStyle = 'style="display:none"'; // no limit: display the full table, so hide the "pager" UI - // WARNING: mPDF does not take the "display" style into account - // when applied to a
'; } return ''; } - + public function EndRow() { return ''; } - + public function RenderAsDialog($oPage, $sDialogId, $sDialogTitle, $iDialogWidth, $sOkButtonLabel, $sIntroduction = null, $bAutoOpen = true) { $this->SetPrefix('dlg_'); // To make sure that the controls have different IDs that the property sheet which may be displayed at the same time - + $sDialogTitle = addslashes($sDialogTitle); $sOkButtonLabel = addslashes($sOkButtonLabel); $sCancelButtonLabel = Dict::S('UI:Button:Cancel'); $oPage->add("
"); - if ($sIntroduction != null) - { + if ($sIntroduction != null) { $oPage->add('
'.$sIntroduction.'
'); } $this->Render($oPage); $oPage->add('
'); - + $sAutoOpen = $bAutoOpen ? 'true' : 'false'; $oPage->add_ready_script( -<<aFieldSets as $sLabel => $aFields) - { - foreach($aFields as $oField) - { + foreach ($this->aFieldSets as $sLabel => $aFields) { + foreach ($aFields as $oField) { /** @var \DesignerFormField $oField */ $oField->ReadParam($aValues); } } return $aValues; } - + public function SetPrefix($sPrefix) { $this->sFormPrefix = $sPrefix; } - + public function GetPrefix() { - $sPrefix = ''; - if ($this->oParentForm != null) - { + $sPrefix = ''; + if ($this->oParentForm != null) { $sPrefix = $this->oParentForm->GetPrefix(); } return $sPrefix.$this->sFormPrefix; @@ -416,89 +385,80 @@ EOF { $this->sFieldsSuffix = $sSuffix; } - + public function GetSuffix() { $sSuffix = ''; - if ($this->oParentForm != null) - { + if ($this->oParentForm != null) { $sSuffix = $this->oParentForm->GetSuffix(); } return $sSuffix.$this->sFieldsSuffix; } - + public function SetReadOnly($bReadOnly = true) { $this->bReadOnly = $bReadOnly; } - + public function IsReadOnly() { - if ($this->oParentForm == null) - { + if ($this->oParentForm == null) { return $this->bReadOnly; - } - else - { + } else { return $this->oParentForm->IsReadOnly(); } } - + public function SetParamsContainer($sParamsContainer) { $this->sParamsContainer = $sParamsContainer; } - + public function GetParamsContainer() { - if ($this->oParentForm == null) - { + if ($this->oParentForm == null) { return $this->sParamsContainer; - } - else - { + } else { return $this->oParentForm->GetParamsContainer(); } } - + public function SetParentForm($oParentForm) { $this->oParentForm = $oParentForm; } - + public function SetDefaultValues($aDefaultValues) { - if (!is_array($aDefaultValues)) return; - - foreach($this->aFieldSets as $sLabel => $aFields) - { - foreach($aFields as $oField) - { + if (!is_array($aDefaultValues)) { + return; + } + + foreach ($this->aFieldSets as $sLabel => $aFields) { + foreach ($aFields as $oField) { $oField->SetDefaultValueFrom($aDefaultValues); } } } - + public function GetDefaultValues() { return $this->aDefaultValues; } - - + public function GetParentForm() { return $this->oParentForm; } - + public function GetFormId() { - if ($this->oParentForm) - { + if ($this->oParentForm) { $this->oParentForm->GetFormId(); } return $this->sFormId; } - + public function SetDisplayed($bDisplayed) { $this->bDisplayed = $bDisplayed; @@ -506,41 +466,38 @@ EOF public function IsDisplayed() { - if ($this->oParentForm == null) - { + if ($this->oParentForm == null) { return $this->bDisplayed; - } - else - { + } else { return ($this->bDisplayed && $this->oParentForm->IsDisplayed()); } } - + public function AddScript($sScript) { $this->sScript .= $sScript; } - + public function AddReadyScript($sScript) { $this->sReadyScript .= $sScript; } - + public function GetFieldId($sCode) { return $this->GetPrefix().'attr_'.utils::GetSafeId($sCode.$this->GetSuffix()); } - + public function GetFieldName($sCode) { return 'attr_'.$sCode.$this->GetSuffix(); } - + public function GetParamName($sCode) { return 'attr_'.$sCode.$this->GetSuffix(); } - + public function GetValidationArea($sId, $sContent = '') { return "$sContent"; @@ -549,31 +506,33 @@ EOF { return $this->sAsyncActionClass; } - + public function FindField($sFieldCode) { $oFoundField = false; - foreach($this->aFieldSets as $sLabel => $aFields) - { - foreach($aFields as $oField) - { + foreach ($this->aFieldSets as $sLabel => $aFields) { + foreach ($aFields as $oField) { $oFoundField = $oField->FindField($sFieldCode); - if ($oFoundField !== false) break; + if ($oFoundField !== false) { + break; + } + } + if ($oFoundField !== false) { + break; } - if ($oFoundField !== false) break; } - return $oFoundField; + return $oFoundField; } } class DesignerTabularForm extends DesignerForm { protected $aTable; - + public function __construct() { parent::__construct(); - $this->aTable = array(); + $this->aTable = []; } public function AddRow($aRow) { @@ -584,50 +543,37 @@ class DesignerTabularForm extends DesignerForm { return $this->Render($oP, $bReturnHTML); } - + public function Render($oP, $bReturnHTML = false) { $sReturn = ''; - if ($this->oParentForm == null) - { + if ($this->oParentForm == null) { $sFormId = $this->sFormId; $sReturn = '
'; - } - else - { + } else { $sFormId = $this->oParentForm->sFormId; } $sHiddenFields = ''; $sReturn .= '
".implode("", $aHeader)."
'.date('Y-m-d', - $iDate).''.date('H:i:s', - $iDate).''.date( + 'Y-m-d', + $iDate + ).''.date( + 'H:i:s', + $iDate + ).''.$outputValue.''.$outputValue.' or a tag, so make sure you apply this to a div - } - else - { + // WARNING: mPDF does not take the "display" style into account + // when applied to a '.$this->EndRow(); } - foreach ($aFields as $oField) { $aRow = $oField->Render($oP, $sFormId, 'property'); if ($oField->IsVisible()) { @@ -249,44 +235,37 @@ class DesignerForm $sWidgetClass = $oField->GetWidgetClass(); $sJSExtraParams = ''; - if (count($oField->GetWidgetExtraParams()) > 0) - { - $aExtraParams = array(); - foreach($oField->GetWidgetExtraParams() as $key=> $value) - { + if (count($oField->GetWidgetExtraParams()) > 0) { + $aExtraParams = []; + foreach ($oField->GetWidgetExtraParams() as $key => $value) { $aExtraParams[] = "'$key': ".json_encode($value); } - $sJSExtraParams = ', '.implode(', ', $aExtraParams); + $sJSExtraParams = ', '.implode(', ', $aExtraParams); } $this->AddReadyScript( -<<oParentForm == null) - { + + if ($this->oParentForm == null) { $sFormId = $this->sFormId; $sReturn .= ''; $sReturn .= '
or a tag, so make sure you apply this to a div + } else { $sPagerStyle = ''; } - + $sCombo = ''; - + $sPages = Dict::S('UI:Pagination:PagesLabel'); $sPageSizeCombo = Dict::Format('UI:Pagination:PageSize', $sCombo); - + $iNbPages = ($iPageSize < 1) ? 1 : ceil($this->iNbObjects / $iPageSize); - if ($iNbPages == 1) - { + if ($iNbPages == 1) { // No need to display the pager $sPagerStyle = 'style="display:none"'; } - $aPagesToDisplay = array(); - for($idx = 0; $idx <= min(4, $iNbPages-1); $idx++) - { - if ($idx == 0) - { + $aPagesToDisplay = []; + for ($idx = 0; $idx <= min(4, $iNbPages - 1); $idx++) { + if ($idx == 0) { $aPagesToDisplay[$idx] = '1'; - } - else - { - $aPagesToDisplay[$idx] = "".(1+$idx).""; + } else { + $aPagesToDisplay[$idx] = "".(1 + $idx).""; } } $iLastPageIdx = $iNbPages - 1; - if (!isset($aPagesToDisplay[$iLastPageIdx])) - { + if (!isset($aPagesToDisplay[$iLastPageIdx])) { unset($aPagesToDisplay[$idx - 1]); // remove the last page added to make room for the very last page $aPagesToDisplay[$iLastPageIdx] = "... $iNbPages"; } @@ -386,22 +353,19 @@ EOF; */ protected function GetToolkitMenu(WebPage $oPage, $aExtraParams) { - if (!$oPage->IsPrintableVersion()) - { + if (!$oPage->IsPrintableVersion()) { $sMenuTitle = Dict::S('UI:ConfigureThisList'); $sHtml = '
    • '; - + $oMenuItem1 = new JSPopupMenuItem('iTop::ConfigureList', $sMenuTitle, "$('#datatable_dlg_".$this->iListId."').dialog('open');"); - $aActions = array( + $aActions = [ $oMenuItem1->GetUID() => $oMenuItem1->GetMenuItem(), - ); + ]; $this->oSet->Rewind(); utils::GetPopupMenuItems($oPage, iPopupMenuExtension::MENU_OBJLIST_TOOLKIT, $this->oSet, $aActions, $this->sTableId, $this->iListId); $this->oSet->Rewind(); $sHtml .= $oPage->RenderPopupMenuItems($aActions); - } - else - { + } else { $sHtml = ''; } return $sHtml; @@ -422,10 +386,10 @@ EOF; $sChecked = ($this->bUseCustomSettings) ? '' : 'checked'; $sHtml .= "

      iListId}\" type=\"radio\" name=\"settings\" $sChecked value=\"defaults\">

      '; $sHtml .= "
      "; - $sChecked = ($this->bUseCustomSettings) ? 'checked': ''; + $sChecked = ($this->bUseCustomSettings) ? 'checked' : ''; $sHtml .= "iListId}\" type=\"radio\" class=\"specific_settings\" name=\"settings\" $sChecked value=\"specific\">"; $sHtml .= Dict::S('UI:ColumnsAndSortOrder').'
        '; - + $sHtml .= '

        '.Dict::Format('UI:Display_X_ItemsPerPage', '').'

        '; $sHtml .= "
        "; $sHtml .= "
        "; @@ -444,7 +408,7 @@ EOF; $sHtml .= '
    '; $sHtml .= ""; $sHtml .= ""; - + $sDlgTitle = addslashes(Dict::S('UI:ListConfigurationTitle')); $oPage->add_ready_script("$('#datatable_dlg_{$this->iListId}').dialog({autoOpen: false, title: '$sDlgTitle', width: 500, close: function() { $('#{$this->sDatatableContainerId}').datatable('onDlgCancel'); } });"); @@ -458,7 +422,7 @@ EOF; */ public function GetAsHash($oSetting) { - $aSettings = array('iDefaultPageSize' => $oSetting->iDefaultPageSize, 'oColumns' => $oSetting->aColumns); + $aSettings = ['iDefaultPageSize' => $oSetting->iDefaultPageSize, 'oColumns' => $oSetting->aColumns]; return $aSettings; } @@ -474,55 +438,46 @@ EOF; */ protected function GetHTMLTableConfig($aColumns, $sSelectMode, $bViewLink) { - $aAttribs = array(); - if ($sSelectMode == 'multiple') - { - $aAttribs['form::select'] = array( + $aAttribs = []; + if ($sSelectMode == 'multiple') { + $aAttribs['form::select'] = [ 'label' => "iListId}:not(:disabled)', this.checked);\" class=\"checkAll\">", 'description' => Dict::S('UI:SelectAllToggle+'), - 'metadata' => array(), - ); - } - else if ($sSelectMode == 'single') - { - $aAttribs['form::select'] = array('label' => '', 'description' => '', 'metadata' => array()); + 'metadata' => [], + ]; + } elseif ($sSelectMode == 'single') { + $aAttribs['form::select'] = ['label' => '', 'description' => '', 'metadata' => []]; } - foreach($this->aClassAliases as $sAlias => $sClassName) - { - foreach($aColumns[$sAlias] as $sAttCode => $aData) - { - if ($aData['checked']) - { - if ($sAttCode == '_key_') - { + foreach ($this->aClassAliases as $sAlias => $sClassName) { + foreach ($aColumns[$sAlias] as $sAttCode => $aData) { + if ($aData['checked']) { + if ($sAttCode == '_key_') { $sAttLabel = MetaModel::GetName($sClassName); - $aAttribs['key_'.$sAlias] = array( + $aAttribs['key_'.$sAlias] = [ 'label' => $sAttLabel, 'description' => '', - 'metadata' => array( + 'metadata' => [ 'object_class' => $sClassName, 'attribute_label' => $sAttLabel, - ), - ); - } - else - { + ], + ]; + } else { $oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode); $sAttDefClass = get_class($oAttDef); $sAttLabel = MetaModel::GetLabel($sClassName, $sAttCode); - $aAttribs[$sAttCode.'_'.$sAlias] = array( + $aAttribs[$sAttCode.'_'.$sAlias] = [ 'label' => $sAttLabel, 'description' => $oAttDef->GetOrderByHint(), - 'metadata' => array( + 'metadata' => [ 'object_class' => $sClassName, 'attribute_code' => $sAttCode, 'attribute_type' => $sAttDefClass, 'attribute_label' => $sAttLabel, - ), - ); + ], + ]; } } } @@ -530,7 +485,6 @@ EOF; return $aAttribs; } - /** * @param $aColumns * @param $sSelectMode @@ -549,104 +503,74 @@ EOF; protected function GetHTMLTableValues($aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams) { $bLocalize = true; - if (isset($aExtraParams['localize_values'])) - { + if (isset($aExtraParams['localize_values'])) { $bLocalize = (bool) $aExtraParams['localize_values']; } - $aValues = array(); - $aAttDefsCache = array(); + $aValues = []; + $aAttDefsCache = []; $this->oSet->Seek(0); $iMaxObjects = $iPageSize; - while (($aObjects = $this->oSet->FetchAssoc()) && ($iMaxObjects != 0)) - { + while (($aObjects = $this->oSet->FetchAssoc()) && ($iMaxObjects != 0)) { $bFirstObject = true; - $aRow = array(); - foreach($this->aClassAliases as $sAlias => $sClassName) - { - if (is_object($aObjects[$sAlias])) - { + $aRow = []; + foreach ($this->aClassAliases as $sAlias => $sClassName) { + if (is_object($aObjects[$sAlias])) { $sHilightClass = MetaModel::GetHilightClass($sClassName, $aObjects[$sAlias]); - if ($sHilightClass != '') - { - $aRow['@class'] = $sHilightClass; + if ($sHilightClass != '') { + $aRow['@class'] = $sHilightClass; } - if ((($sSelectMode == 'single') || ($sSelectMode == 'multiple')) && $bFirstObject) - { - if (array_key_exists('selection_enabled', $aExtraParams) && isset($aExtraParams['selection_enabled'][$aObjects[$sAlias]->GetKey()])) - { + if ((($sSelectMode == 'single') || ($sSelectMode == 'multiple')) && $bFirstObject) { + if (array_key_exists('selection_enabled', $aExtraParams) && isset($aExtraParams['selection_enabled'][$aObjects[$sAlias]->GetKey()])) { $sDisabled = ($aExtraParams['selection_enabled'][$aObjects[$sAlias]->GetKey()]) ? '' : ' disabled="disabled"'; - } - else - { + } else { $sDisabled = ''; } - if ($sSelectMode == 'single') - { + if ($sSelectMode == 'single') { $aRow['form::select'] = "iListId}\" name=\"selectObject\" value=\"".$aObjects[$sAlias]->GetKey()."\">"; - } - else - { + } else { $aRow['form::select'] = "iListId}\" name=\"selectObject[]\" value=\"".$aObjects[$sAlias]->GetKey()."\">"; } } - foreach($aColumns[$sAlias] as $sAttCode => $aData) - { - if ($aData['checked']) - { - if ($sAttCode == '_key_') - { - $aRow['key_'.$sAlias] = array( + foreach ($aColumns[$sAlias] as $sAttCode => $aData) { + if ($aData['checked']) { + if ($sAttCode == '_key_') { + $aRow['key_'.$sAlias] = [ 'value_raw' => $aObjects[$sAlias]->GetKey(), 'value_html' => $aObjects[$sAlias]->GetHyperLink(), - ); - } - else - { + ]; + } else { // Prepare att. def. classes cache to avoid retrieving AttDef for each row - if(!isset($aAttDefsCache[$sClassName][$sAttCode])) - { + if (!isset($aAttDefsCache[$sClassName][$sAttCode])) { $aAttDefClassesCache[$sClassName][$sAttCode] = get_class(MetaModel::GetAttributeDef($sClassName, $sAttCode)); } // Only retrieve raw (stored) value for simple fields $bExcludeRawValue = false; - foreach (cmdbAbstractObject::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) - { - if (is_a($aAttDefClassesCache[$sClassName][$sAttCode], $sAttDefClassToExclude, true)) - { + foreach (cmdbAbstractObject::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) { + if (is_a($aAttDefClassesCache[$sClassName][$sAttCode], $sAttDefClassToExclude, true)) { $bExcludeRawValue = true; break; } } - if($bExcludeRawValue) - { + if ($bExcludeRawValue) { $aRow[$sAttCode.'_'.$sAlias] = $aObjects[$sAlias]->GetAsHTML($sAttCode, $bLocalize); - } - else - { - $aRow[$sAttCode.'_'.$sAlias] = array( + } else { + $aRow[$sAttCode.'_'.$sAlias] = [ 'value_raw' => $aObjects[$sAlias]->Get($sAttCode), 'value_html' => $aObjects[$sAlias]->GetAsHTML($sAttCode, $bLocalize), - ); + ]; } } } } - } - else - { - foreach($aColumns[$sAlias] as $sAttCode => $aData) - { - if ($aData['checked']) - { - if ($sAttCode == '_key_') - { + } else { + foreach ($aColumns[$sAlias] as $sAttCode => $aData) { + if ($aData['checked']) { + if ($sAttCode == '_key_') { $aRow['key_'.$sAlias] = ''; - } - else - { + } else { $aRow[$sAttCode.'_'.$sAlias] = ''; } } @@ -681,8 +605,7 @@ EOF; public function GetHTMLTable(WebPage $oPage, $aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams) { $iNbPages = ($iPageSize < 1) ? 1 : ceil($this->iNbObjects / $iPageSize); - if ($iPageSize < 1) - { + if ($iPageSize < 1) { $iPageSize = -1; // convention: no pagination } $aAttribs = $this->GetHTMLTableConfig($aColumns, $sSelectMode, $bViewLink); @@ -691,8 +614,7 @@ EOF; $sHtml = ''; - foreach($this->oSet->GetFilter()->GetInternalParams() as $sName => $sValue) - { + foreach ($this->oSet->GetFilter()->GetInternalParams() as $sName => $sValue) { $aExtraParams['query_params'][$sName] = $sValue; } $aExtraParams['show_obsolete_data'] = $this->bShowObsoleteData; @@ -707,20 +629,16 @@ EOF; $sExtraParams = addslashes(str_replace('"', "'", json_encode(array_merge($aExtraParams, $aArgs)))); // JSON encode, change the style of the quotes and escape them $sSelectModeJS = ''; $sHeaders = ''; - if (($sSelectMode == 'single') || ($sSelectMode == 'multiple')) - { + if (($sSelectMode == 'single') || ($sSelectMode == 'multiple')) { $sSelectModeJS = $sSelectMode; $sHeaders = 'headers: { 0: {sorter: false}},'; } $sDisplayKey = ($bViewLink) ? 'true' : 'false'; // Protect against duplicate elements in the Zlist - $aUniqueOrderedList = array(); - foreach($this->aClassAliases as $sAlias => $sClassName) - { - foreach($aColumns[$sAlias] as $sAttCode => $aData) - { - if ($aData['checked']) - { + $aUniqueOrderedList = []; + foreach ($this->aClassAliases as $sAlias => $sClassName) { + foreach ($aColumns[$sAlias] as $sAttCode => $aData) { + if ($aData['checked']) { $aUniqueOrderedList[$sAttCode] = true; } } @@ -732,41 +650,32 @@ EOF; $this->oSet->ApplyParameters(); // Display the actual sort order of the table $aRealSortOrder = $this->oSet->GetRealSortOrder(); - $aDefaultSort = array(); + $aDefaultSort = []; $iColOffset = 0; - if (($sSelectMode == 'single') || ($sSelectMode == 'multiple')) - { + if (($sSelectMode == 'single') || ($sSelectMode == 'multiple')) { $iColOffset += 1; } - if ($bViewLink) - { -// $iColOffset += 1; + if ($bViewLink) { + // $iColOffset += 1; } - foreach($aRealSortOrder as $sColCode => $bAscending) - { + foreach ($aRealSortOrder as $sColCode => $bAscending) { $iPos = array_search($sColCode, $aUniqueOrderedList); - if ($iPos !== false) - { - $aDefaultSort[] = "[".($iColOffset+$iPos).",".($bAscending ? '0' : '1')."]"; - } - else if (($iPos = array_search(preg_replace('/_friendlyname$/', '', $sColCode), $aUniqueOrderedList)) !== false) - { + if ($iPos !== false) { + $aDefaultSort[] = "[".($iColOffset + $iPos).",".($bAscending ? '0' : '1')."]"; + } elseif (($iPos = array_search(preg_replace('/_friendlyname$/', '', $sColCode), $aUniqueOrderedList)) !== false) { // if sorted on the friendly name of an external key, then consider it sorted on the column that shows the links - $aDefaultSort[] = "[".($iColOffset+$iPos).",".($bAscending ? '0' : '1')."]"; - } - else if($sColCode == 'friendlyname' && $bViewLink) - { + $aDefaultSort[] = "[".($iColOffset + $iPos).",".($bAscending ? '0' : '1')."]"; + } elseif ($sColCode == 'friendlyname' && $bViewLink) { $aDefaultSort[] = "[".($iColOffset).",".($bAscending ? '0' : '1')."]"; } } $sFakeSortList = ''; - if (count($aDefaultSort) > 0) - { + if (count($aDefaultSort) > 0) { $sFakeSortList = '['.implode(',', $aDefaultSort).']'; } $sOQL = addslashes($this->oSet->GetFilter()->serialize()); $oPage->add_ready_script( -<<sDatatableContainerId} table.listResults'); oTable.tableHover(); oTable @@ -784,9 +693,8 @@ oTable class_aliases: $sJSClassAliases $sCssCount }); JS - ); - if ($sFakeSortList != '') - { + ); + if ($sFakeSortList != '') { $oPage->add_ready_script("oTable.trigger(\"fakesorton\", [$sFakeSortList]);"); } return $sHtml; @@ -803,12 +711,9 @@ JS $iPageIndex = 0; $sHtml = $this->GetPager($oPage, $iPageSize, $iDefaultPageSize, $iPageIndex); $oPage->add_ready_script("$('#pager{$this->iListId}').html('".json_encode($sHtml)."');"); - if ($iDefaultPageSize < 1) - { + if ($iDefaultPageSize < 1) { $oPage->add_ready_script("$('#pager{$this->iListId}').parent().hide()"); - } - else - { + } else { $oPage->add_ready_script("$('#pager{$this->iListId}').parent().show()"); } } @@ -865,16 +770,15 @@ class PrintableDataTable extends DataTable public function GetHTMLTable(WebPage $oPage, $aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams) { $iNbPages = ($iPageSize < 1) ? 1 : ceil($this->iNbObjects / $iPageSize); - if ($iPageSize < 1) - { + if ($iPageSize < 1) { $iPageSize = -1; // convention: no pagination } $aAttribs = $this->GetHTMLTableConfig($aColumns, $sSelectMode, $bViewLink); - + $aValues = $this->GetHTMLTableValues($aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams); - + $sHtml = $oPage->GetTable($aAttribs, $aValues); - + return $sHtml; } } diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 0c0e5d0c5..01d3872c0 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -1,4 +1,5 @@ avoid duplicate conditions @@ -137,20 +138,18 @@ class DisplayBlock * * @throws \ApplicationException */ - public function __construct(DBSearch $oFilter, $sStyle = self::ENUM_STYLE_LIST, $bAsynchronous = false, $aParams = array(), $oSet = null) + public function __construct(DBSearch $oFilter, $sStyle = self::ENUM_STYLE_LIST, $bAsynchronous = false, $aParams = [], $oSet = null) { $this->m_oFilter = $oFilter->DeepClone(); - $this->m_aConditions = array(); + $this->m_aConditions = []; $this->m_sStyle = $sStyle; $this->m_bAsynchronous = $bAsynchronous; $this->m_aParams = $aParams; $this->m_oSet = $oSet; - if (array_key_exists('show_obsolete_data', $aParams)) - { + if (array_key_exists('show_obsolete_data', $aParams)) { $this->m_bShowObsoleteData = $aParams['show_obsolete_data']; } - if ($this->m_bShowObsoleteData === null) - { + if ($this->m_bShowObsoleteData === null) { // User defined $this->m_bShowObsoleteData = utils::ShowObsoleteData(); } @@ -410,22 +409,18 @@ class DisplayBlock * @throws \CoreException * @throws \Exception */ - public static function FromObjectSet(DBObjectSet $oSet, $sStyle, $aParams = array()) + public static function FromObjectSet(DBObjectSet $oSet, $sStyle, $aParams = []) { $oDummyFilter = new DBObjectSearch($oSet->GetClass()); - $aKeys = array(); - $oSet->OptimizeColumnLoad(array($oSet->GetClassAlias() => array())); // No need to load all the columns just to get the id - while($oObject = $oSet->Fetch()) - { - $aKeys[] = $oObject->GetKey(); + $aKeys = []; + $oSet->OptimizeColumnLoad([$oSet->GetClassAlias() => []]); // No need to load all the columns just to get the id + while ($oObject = $oSet->Fetch()) { + $aKeys[] = $oObject->GetKey(); } $oSet->Rewind(); - if (count($aKeys) > 0) - { + if (count($aKeys) > 0) { $oDummyFilter->AddCondition('id', $aKeys, 'IN'); - } - else - { + } else { $oDummyFilter->AddCondition('id', 0, '='); } $oBlock = new DisplayBlock($oDummyFilter, $sStyle, false, $aParams); // DisplayBlocks built this way are synchronous @@ -446,7 +441,7 @@ class DisplayBlock $iStartPos = stripos($sTemplate, '<'.self::TAG_BLOCK.' ', 0); $iEndPos = stripos($sTemplate, '', $iStartPos); $iEndTag = stripos($sTemplate, '>', $iStartPos); - $aParams = array(); + $aParams = []; if (($iStartPos === false) || ($iEndPos === false)) { return null; @@ -454,7 +449,7 @@ class DisplayBlock $sITopData = substr($sTemplate, 1 + $iEndTag, $iEndPos - $iEndTag - 1); $sITopTag = substr($sTemplate, $iStartPos + strlen('<'.self::TAG_BLOCK), $iEndTag - $iStartPos - strlen('<'.self::TAG_BLOCK)); - $aMatches = array(); + $aMatches = []; $sBlockClass = "DisplayBlock"; $bAsynchronous = false; $sBlockType = 'list'; @@ -520,25 +515,28 @@ class DisplayBlock return new $sBlockClass($oFilter, $sBlockType, $bAsynchronous, $aParams); } - public function DisplayIntoContentBlock(UIContentBlock $oContentBlock, WebPage $oPage, $sId, $aExtraParams = array()) + public function DisplayIntoContentBlock(UIContentBlock $oContentBlock, WebPage $oPage, $sId, $aExtraParams = []) { $oContentBlock->AddSubBlock($this->GetDisplay($oPage, $sId, $aExtraParams)); } - public function Display(WebPage $oPage, $sId, $aExtraParams = array()) + public function Display(WebPage $oPage, $sId, $aExtraParams = []) { $oPage->AddUiBlock($this->GetDisplay($oPage, $sId, $aExtraParams)); } - public function GetDisplay(WebPage $oPage, $sId, $aExtraParams = array()): UIContentBlock + public function GetDisplay(WebPage $oPage, $sId, $aExtraParams = []): UIContentBlock { $oHtml = new UIContentBlock($sId); $oHtml->AddCSSClass("display_block"); $aExtraParams = array_merge($aExtraParams, $this->m_aParams); $aExtraParams['currentId'] = $sId; - $sExtraParams = addslashes(str_replace('"', "'", - json_encode($aExtraParams))); // JSON encode, change the style of the quotes and escape them + $sExtraParams = addslashes(str_replace( + '"', + "'", + json_encode($aExtraParams) + )); // JSON encode, change the style of the quotes and escape them if (isset($aExtraParams['query_params'])) { $aQueryParams = $aExtraParams['query_params']; @@ -547,9 +545,9 @@ class DisplayBlock $sClass = $aExtraParams['this->class']; $iKey = $aExtraParams['this->id']; $oObj = MetaModel::GetObject($sClass, $iKey); - $aQueryParams = array('this->object()' => $oObj); + $aQueryParams = ['this->object()' => $oObj]; } else { - $aQueryParams = array(); + $aQueryParams = []; } } @@ -585,8 +583,7 @@ class DisplayBlock '); } - if ($this->m_sStyle == static::ENUM_STYLE_LIST) // Search form need to extract result list extra data, the simplest way is to expose this configuration - { + if ($this->m_sStyle == static::ENUM_STYLE_LIST) { // Search form need to extract result list extra data, the simplest way is to expose this configuration $listJsonExtraParams = json_encode(json_encode($aExtraParams)); $oPage->add_ready_script(" $('#$sId').data('sExtraParams', ".$listJsonExtraParams."); @@ -606,7 +603,7 @@ class DisplayBlock * @throws \DictExceptionMissingString * @throws \MySQLException */ - public function RenderContent(WebPage $oPage, $aExtraParams = array()) + public function RenderContent(WebPage $oPage, $aExtraParams = []) { if (!isset($aExtraParams['currentId'])) { $sId = utils::GetUniqueId(); // Works only if the page is not an Ajax one ! @@ -638,7 +635,7 @@ class DisplayBlock $this->CheckParams($this->m_sStyle, $aExtraParams); // Add the extra params into the filter if they make sense for such a filter $bDoSearch = utils::ReadParam('dosearch', false); - $aQueryParams = array(); + $aQueryParams = []; if (isset($aExtraParams['query_params'])) { $aQueryParams = $aExtraParams['query_params']; } else { @@ -646,7 +643,7 @@ class DisplayBlock $sClass = $aExtraParams['this->class']; $iKey = $aExtraParams['this->id']; $oObj = MetaModel::GetObject($sClass, $iKey); - $aQueryParams = array('this->object()' => $oObj); + $aQueryParams = ['this->object()' => $oObj]; } } if ($this->m_oSet == null) { @@ -656,7 +653,7 @@ class DisplayBlock $oAppContext = new ApplicationContext(); $sClass = $this->m_oFilter->GetClass(); $aFilterCodes = MetaModel::GetFiltersList($sClass); - $aCallSpec = array($sClass, 'MapContextParam'); + $aCallSpec = [$sClass, 'MapContextParam']; if (is_callable($aCallSpec)) { foreach ($oAppContext->GetNames() as $sContextParam) { $sParamCode = call_user_func($aCallSpec, $sContextParam); //Map context parameter to the value/filter code depending on the class @@ -691,11 +688,9 @@ class DisplayBlock } } - if (!is_null($condition)) - { + if (!is_null($condition)) { $sOpCode = null; // default operator - if (is_array($condition)) - { + if (is_array($condition)) { // Multiple values, add them as AND X IN (v1, v2, v3...) $sOpCode = 'IN'; } @@ -703,26 +698,22 @@ class DisplayBlock $this->AddCondition($sFilterCode, $condition, $sOpCode, $bParseSearchString); } } - if ($bDoSearch) - { + if ($bDoSearch) { // Keep the table_id identifying this table if we're performing a search $sTableId = utils::ReadParam('_table_id_', null, false, utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER); - if ($sTableId != null) - { + if ($sTableId != null) { $aExtraParams['table_id'] = $sTableId; } } } - $aOrderBy = array(); - if (isset($aExtraParams['order_by'])) - { + $aOrderBy = []; + if (isset($aExtraParams['order_by'])) { // Convert the string describing the order_by parameter into an array // The syntax is +attCode1,-attCode2 // attCode1 => ascending, attCode2 => descending $aTemp = explode(',', $aExtraParams['order_by']); - foreach($aTemp as $sTemp) - { - $aMatches = array(); + foreach ($aTemp as $sTemp) { + $aMatches = []; if (preg_match('/^([+-])?(.+)$/', $sTemp, $aMatches)) { $bAscending = true; if ($aMatches[1] == '-') { @@ -738,7 +729,7 @@ class DisplayBlock } $this->m_oSet->SetShowObsoleteData($this->m_bShowObsoleteData); - switch($this->m_sStyle) { + switch ($this->m_sStyle) { case static::ENUM_STYLE_LIST_SEARCH: case static::ENUM_STYLE_LIST: break; @@ -768,7 +759,7 @@ class DisplayBlock case static::ENUM_STYLE_LIST: case static::ENUM_STYLE_LIST_IN_OBJECT: $oBlock = $this->RenderList($aExtraParams, $oPage); - break; + break; case 'links': $oBlock = $this->RenderLinks($oPage, $aExtraParams); @@ -793,53 +784,45 @@ class DisplayBlock case static::ENUM_STYLE_CHART: $oBlock = $this->RenderChart($sId, $aQueryParams, $aExtraParams); break; - + case static::ENUM_STYLE_CHART_AJAX: $oBlock = $this->RenderChartAjax($aExtraParams); break; - + default: - // Unsupported style, do nothing. - $sHtml .= Dict::format('UI:Error:UnsupportedStyleOfBlock', $this->m_sStyle); + // Unsupported style, do nothing. + $sHtml .= Dict::format('UI:Error:UnsupportedStyleOfBlock', $this->m_sStyle); } - $bAutoReload = false; - if (isset($aExtraParams['auto_reload'])) - { - if ($aExtraParams['auto_reload'] === true) - { + if (isset($aExtraParams['auto_reload'])) { + if ($aExtraParams['auto_reload'] === true) { // Note: does not work in the switch (case true) because a positive number evaluates to true!!! $aExtraParams['auto_reload'] = 'standard'; } - switch($aExtraParams['auto_reload']) - { + switch ($aExtraParams['auto_reload']) { case 'fast': $bAutoReload = true; - $iReloadInterval = MetaModel::GetConfig()->GetFastReloadInterval()*1000; + $iReloadInterval = MetaModel::GetConfig()->GetFastReloadInterval() * 1000; break; case 'standard': case 'true': $bAutoReload = true; - $iReloadInterval = MetaModel::GetConfig()->GetStandardReloadInterval()*1000; + $iReloadInterval = MetaModel::GetConfig()->GetStandardReloadInterval() * 1000; break; default: - if (is_numeric($aExtraParams['auto_reload']) && ($aExtraParams['auto_reload'] > 0)) - { + if (is_numeric($aExtraParams['auto_reload']) && ($aExtraParams['auto_reload'] > 0)) { $bAutoReload = true; - $iReloadInterval = max(MetaModel::GetConfig()->Get('min_reload_interval'), $aExtraParams['auto_reload'])*1000; - } - else - { + $iReloadInterval = max(MetaModel::GetConfig()->Get('min_reload_interval'), $aExtraParams['auto_reload']) * 1000; + } else { // incorrect config, ignore it $bAutoReload = false; } } } - if (($bAutoReload) && ($this->m_sStyle != static::ENUM_STYLE_SEARCH)) // Search form do NOT auto-reload - { + if (($bAutoReload) && ($this->m_sStyle != static::ENUM_STYLE_SEARCH)) { // Search form do NOT auto-reload // Used either for asynchronous or auto_reload // does a json_encode twice to get a string usable as function parameter $sFilterBefore = $this->m_oFilter->serialize(); @@ -886,8 +869,7 @@ JS { // Workaround to an issue revealed whenever a condition on org_id is applied twice (with a hierarchy of organizations) // Moreover, it keeps the query as simple as possible - if (isset($this->m_aConditions[$sFilterCode]) && $condition == $this->m_aConditions[$sFilterCode]) - { + if (isset($this->m_aConditions[$sFilterCode]) && $condition == $this->m_aConditions[$sFilterCode]) { // Skip return; } @@ -895,59 +877,48 @@ JS $sClass = $this->m_oFilter->GetClass(); $bConditionAdded = false; - + // If the condition is an external key with a class having a hierarchy, use a "below" criteria - if (MetaModel::IsValidAttCode($sClass, $sFilterCode)) - { + if (MetaModel::IsValidAttCode($sClass, $sFilterCode)) { $oAttDef = MetaModel::GetAttributeDef($sClass, $sFilterCode); - if ($oAttDef->IsExternalKey()) - { + if ($oAttDef->IsExternalKey()) { $sHierarchicalKeyCode = MetaModel::IsHierarchicalClass($oAttDef->GetTargetClass()); - - if ($sHierarchicalKeyCode !== false) - { + + if ($sHierarchicalKeyCode !== false) { $oFilter = new DBObjectSearch($oAttDef->GetTargetClass()); - if (($sOpCode == 'IN') && is_array($condition)) - { - $oFilter->AddConditionExpression(self::GetConditionIN($oFilter, 'id', $condition)); - } - else - { + if (($sOpCode == 'IN') && is_array($condition)) { + $oFilter->AddConditionExpression(self::GetConditionIN($oFilter, 'id', $condition)); + } else { $oFilter->AddCondition('id', $condition); } $oHKFilter = new DBObjectSearch($oAttDef->GetTargetClass()); $oHKFilter->AddCondition_PointingTo($oFilter, $sHierarchicalKeyCode, TREE_OPERATOR_BELOW); // Use the 'below' operator by default $this->m_oFilter->AddCondition_PointingTo($oHKFilter, $sFilterCode); $bConditionAdded = true; - } - else if (($sOpCode == 'IN') && is_array($condition)) - { + } elseif (($sOpCode == 'IN') && is_array($condition)) { $this->m_oFilter->AddConditionExpression(self::GetConditionIN($this->m_oFilter, $sFilterCode, $condition)); $bConditionAdded = true; } - } - else if (($sOpCode == 'IN') && is_array($condition)) - { + } elseif (($sOpCode == 'IN') && is_array($condition)) { $this->m_oFilter->AddConditionExpression(self::GetConditionIN($this->m_oFilter, $sFilterCode, $condition)); $bConditionAdded = true; } } - + // In all other cases, just add the condition directly - if (!$bConditionAdded) - { + if (!$bConditionAdded) { $this->m_oFilter->AddCondition($sFilterCode, $condition, null); // Use the default 'loose' operator } } - - static protected function GetConditionIN($oFilter, $sFilterCode, $condition) + + protected static function GetConditionIN($oFilter, $sFilterCode, $condition) { - $oField = new FieldExpression($sFilterCode, $oFilter->GetClassAlias()); + $oField = new FieldExpression($sFilterCode, $oFilter->GetClassAlias()); $sListExpr = '('.implode(', ', CMDBSource::Quote($condition)).')'; $sOQLCondition = $oField->RenderExpression()." IN $sListExpr"; $oNewCondition = Expression::FromOQL($sOQLCondition); - return $oNewCondition; + return $oNewCondition; } /** @@ -974,13 +945,10 @@ JS protected function MakeGroupByQuery(&$aExtraParams, &$oGroupByExp, &$sGroupByLabel, &$aGroupBy, &$sAggregationFunction, &$sFctVar, &$sAggregationAttr, &$sSql) { $sAlias = $this->m_oFilter->GetClassAlias(); - if (isset($aExtraParams['group_by_label'])) - { + if (isset($aExtraParams['group_by_label'])) { $oGroupByExp = Expression::FromOQL($aExtraParams['group_by']); $sGroupByLabel = $aExtraParams['group_by_label']; - } - else - { + } else { // Backward compatibility: group_by is simply a field id $oGroupByExp = new FieldExpression($aExtraParams['group_by'], $sAlias); $sGroupByLabel = MetaModel::GetLabel($this->m_oFilter->GetClass(), $aExtraParams['group_by']); @@ -988,61 +956,52 @@ JS // Security filtering $aFields = $oGroupByExp->ListRequiredFields(); - foreach($aFields as $sFieldAlias) - { - $aMatches = array(); - if (preg_match('/^([^.]+)\\.([^.]+)$/', $sFieldAlias, $aMatches)) - { + foreach ($aFields as $sFieldAlias) { + $aMatches = []; + if (preg_match('/^([^.]+)\\.([^.]+)$/', $sFieldAlias, $aMatches)) { $sFieldClass = $this->m_oFilter->GetClassName($aMatches[1]); $oAttDef = MetaModel::GetAttributeDef($sFieldClass, $aMatches[2]); - if ($oAttDef instanceof AttributeOneWayPassword) - { + if ($oAttDef instanceof AttributeOneWayPassword) { throw new Exception('Grouping on password fields is not supported.'); } } } - $aGroupBy = array(); + $aGroupBy = []; $aGroupBy['grouped_by_1'] = $oGroupByExp; - $aQueryParams = array(); - if (isset($aExtraParams['query_params'])) - { + $aQueryParams = []; + if (isset($aExtraParams['query_params'])) { $aQueryParams = $aExtraParams['query_params']; } - $aFunctions = array(); + $aFunctions = []; $sAggregationFunction = 'count'; $sFctVar = '_itop_count_'; $sAggregationAttr = ''; - if (isset($aExtraParams['aggregation_function']) && !empty($aExtraParams['aggregation_attribute'])) - { + if (isset($aExtraParams['aggregation_function']) && !empty($aExtraParams['aggregation_attribute'])) { $sAggregationFunction = $aExtraParams['aggregation_function']; $sAggregationAttr = $aExtraParams['aggregation_attribute']; $oAttrExpr = Expression::FromOQL('`'.$sAlias.'`.`'.$sAggregationAttr.'`'); - $oFctExpr = new FunctionExpression(strtoupper($sAggregationFunction), array($oAttrExpr)); + $oFctExpr = new FunctionExpression(strtoupper($sAggregationFunction), [$oAttrExpr]); $sFctVar = '_itop_'.$sAggregationFunction.'_'; - $aFunctions = array($sFctVar => $oFctExpr); + $aFunctions = [$sFctVar => $oFctExpr]; } - if (!empty($sAggregationAttr)) - { + if (!empty($sAggregationAttr)) { $sClass = $this->m_oFilter->GetClass(); $sAggregationAttr = MetaModel::GetLabel($sClass, $sAggregationAttr); } $iLimit = 0; - if (isset($aExtraParams['limit'])) - { + if (isset($aExtraParams['limit'])) { $iLimit = intval($aExtraParams['limit']); } - $aOrderBy = array(); - if (isset($aExtraParams['order_direction']) && isset($aExtraParams['order_by'])) - { - switch ($aExtraParams['order_by']) - { + $aOrderBy = []; + if (isset($aExtraParams['order_direction']) && isset($aExtraParams['order_by'])) { + switch ($aExtraParams['order_by']) { case 'attribute': - $aOrderBy = array('grouped_by_1' => ($aExtraParams['order_direction'] === 'asc')); + $aOrderBy = ['grouped_by_1' => ($aExtraParams['order_direction'] === 'asc')]; break; case 'function': - $aOrderBy = array($sFctVar => ($aExtraParams['order_direction'] === 'asc')); + $aOrderBy = [$sFctVar => ($aExtraParams['order_direction'] === 'asc')]; break; } } @@ -1078,31 +1037,31 @@ JS $this->AddCondition($sFilterCode, $sContextParamValue); } } - $aQueryParams = array(); + $aQueryParams = []; if (isset($aExtraParams['query_params'])) { $aQueryParams = $aExtraParams['query_params']; } - $this->m_oSet = new CMDBObjectSet($this->m_oFilter, array(), $aQueryParams); + $this->m_oSet = new CMDBObjectSet($this->m_oFilter, [], $aQueryParams); $this->m_oSet->SetShowObsoleteData($this->m_bShowObsoleteData); } // Summary details - $aCounts = array(); - $aStateLabels = array(); + $aCounts = []; + $aStateLabels = []; if (!empty($sStateAttrCode) && !empty($sStatesList)) { $aStates = explode(',', $sStatesList); // Generate one count + group by query [#1330] $sClassAlias = $this->m_oFilter->GetClassAlias(); $oGroupByExpr = Expression::FromOQL($sClassAlias.'.'.$sStateAttrCode); - $aGroupBy = array('group1' => $oGroupByExpr); + $aGroupBy = ['group1' => $oGroupByExpr]; $oGroupBySearch = $this->m_oFilter->DeepClone(); if (isset($this->m_bShowObsoleteData)) { $oGroupBySearch->SetShowObsoleteData($this->m_bShowObsoleteData); } $sCountGroupByQuery = $oGroupBySearch->MakeGroupByQuery($aQueryParams, $aGroupBy, false); $aCountGroupByResults = CMDBSource::QueryToArray($sCountGroupByQuery); - $aCountsQueryResults = array(); + $aCountsQueryResults = []; foreach ($aCountGroupByResults as $aCountGroupBySingleResult) { $aCountsQueryResults[$aCountGroupBySingleResult[0]] = $aCountGroupBySingleResult[1]; } @@ -1116,7 +1075,8 @@ JS : 0; if ($aCounts[$sStateValue] == 0) { - $aCounts[$sStateValue] = ['link' => '-', 'label' => $aCounts[$sStateValue]];; + $aCounts[$sStateValue] = ['link' => '-', 'label' => $aCounts[$sStateValue]]; + ; } else { $oSingleGroupByValueFilter = $this->m_oFilter->DeepClone(); $oSingleGroupByValueFilter->AddCondition($sStateAttrCode, $sStateValue, '='); @@ -1166,7 +1126,7 @@ JS $oBlock->AddSubBlock($oPill); } $aExtraParams['query_params'] = $this->m_oFilter->GetInternalParams(); - if(isset($aExtraParams['query_params']['this->object()'])){ + if (isset($aExtraParams['query_params']['this->object()'])) { $aExtraParams['query_params']['this->class'] = get_class($aExtraParams['query_params']['this->object()']); $aExtraParams['query_params']['this->id'] = $aExtraParams['query_params']['this->object()']->GetKey(); unset($aExtraParams['query_params']['this->object()']); @@ -1180,7 +1140,8 @@ JS $('#".$oBlock->GetId()."').html(data); $('#".$oBlock->GetId()."').unblock(); }); - $('#".$oBlock->GetId()."').unblock();"); + $('#".$oBlock->GetId()."').unblock();" + ); return $oBlock; } @@ -1190,7 +1151,7 @@ JS * * @return string[] */ - protected function GetAllowedActionsParams(array $aExtraParams) + protected function GetAllowedActionsParams(array $aExtraParams) { return [ 'context_filter', /** int if != 0 filter with user context */ @@ -1222,11 +1183,11 @@ JS $this->AddCondition($sFilterCode, $sContextParamValue); } } - $aQueryParams = array(); + $aQueryParams = []; if (isset($aExtraParams['query_params'])) { $aQueryParams = $aExtraParams['query_params']; } - $this->m_oSet = new CMDBObjectSet($this->m_oFilter, array(), $aQueryParams); + $this->m_oSet = new CMDBObjectSet($this->m_oFilter, [], $aQueryParams); $this->m_oSet->SetShowObsoleteData($this->m_bShowObsoleteData); } $iCount = $this->m_oSet->Count(); @@ -1243,8 +1204,15 @@ JS if (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY)) { $sCreateActionUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=new&class='.$sClass.$oAppContext->GetForLink(true); $sCreateActionLabel = Dict::Format('UI:Button:Create'); - $oBlock = DashletFactory::MakeForDashletBadge($sClassIconUrl, $sHyperlink, $iCount, $sClassLabel, $sCreateActionUrl, - $sCreateActionLabel, $aRefreshParams); + $oBlock = DashletFactory::MakeForDashletBadge( + $sClassIconUrl, + $sHyperlink, + $iCount, + $sClassLabel, + $sCreateActionUrl, + $sCreateActionLabel, + $aRefreshParams + ); } else { $oBlock = DashletFactory::MakeForDashletBadge($sClassIconUrl, $sHyperlink, $iCount, $sClassLabel, null, null, $aRefreshParams); } @@ -1274,9 +1242,9 @@ JS $aRes = CMDBSource::QueryToArray($sSql); - $aGroupBy = array(); - $aLabels = array(); - $aValues = array(); + $aGroupBy = []; + $aLabels = []; + $aValues = []; $iTotalCount = 0; foreach ($aRes as $iRow => $aRow) { $sValue = $aRow['grouped_by_1']; @@ -1287,7 +1255,7 @@ JS $iTotalCount += $aRow['_itop_count_']; } - $aData = array(); + $aData = []; $oAppContext = new ApplicationContext(); $sParams = $oAppContext->GetForLink(true); foreach ($aGroupBy as $iRow => $iCount) { @@ -1298,22 +1266,22 @@ JS if (isset($aExtraParams['query_params'])) { $aQueryParams = $aExtraParams['query_params']; } else { - $aQueryParams = array(); + $aQueryParams = []; } $sFilter = rawurlencode($oSubsetSearch->serialize(false, $aQueryParams)); - $aData[] = array( + $aData[] = [ 'group' => $aLabels[$iRow], - 'value' => "$iCount" - ); // TO DO: add the context information + 'value' => "$iCount", + ]; // TO DO: add the context information } - $aAttribs = array( - 'group' => array('label' => $sGroupByLabel, 'description' => ''), - 'value' => array( + $aAttribs = [ + 'group' => ['label' => $sGroupByLabel, 'description' => ''], + 'value' => [ 'label' => Dict::S('UI:GroupBy:'.$sAggregationFunction), 'description' => Dict::Format('UI:GroupBy:'.$sAggregationFunction.'+', $sAggregationAttr), - ), - ); + ], + ]; $sFormat = isset($aExtraParams['format']) ? $aExtraParams['format'] : 'UI:Pagination:HeaderNoSelection'; $aExtraParams['query_params'] = $this->m_oFilter->GetInternalParams(); @@ -1324,7 +1292,7 @@ JS $oBlock = PanelUIBlockFactory::MakeForClass($aExtraParams["panel_class"], $aExtraParams["panel_title"]); $oBlock->AddSubTitleBlock(new Html($sTitle)); $oBlock->AddCSSClass('ibo-datatable-panel'); - if(isset($aExtraParams["panel_icon"]) && strlen($aExtraParams["panel_icon"]) > 0){ + if (isset($aExtraParams["panel_icon"]) && strlen($aExtraParams["panel_icon"]) > 0) { $oBlock->SetIcon($aExtraParams["panel_icon"]); } $oDataTable = DataTableUIBlockFactory::MakeForStaticData("", $aAttribs, $aData, null, $aExtraParams, $this->m_oFilter->ToOQL(), $aOption); @@ -1343,7 +1311,7 @@ JS } if (isset($aExtraParams["surround_with_panel"]) && $aExtraParams["surround_with_panel"]) { $oBlock = PanelUIBlockFactory::MakeForClass($aExtraParams["panel_class"], $aExtraParams["panel_title"]); - if(isset($aExtraParams["panel_icon"]) && strlen($aExtraParams["panel_icon"]) > 0){ + if (isset($aExtraParams["panel_icon"]) && strlen($aExtraParams["panel_icon"]) > 0) { $oBlock->SetIcon($aExtraParams["panel_icon"]); } $oBlock->AddSubBlock(new Html('

    '.Dict::Format($sFormat, $iCount).'

    ')); @@ -1353,7 +1321,7 @@ JS } return $oBlock; -} + } /** * @param WebPage $oPage @@ -1411,7 +1379,6 @@ JS $oBlock->aExtraParams = $aExtraParams; $oBlock->sFilter = $this->m_oFilter->ToOQL(); - // Check the classes that can be read (i.e authorized) by this user... foreach ($aClasses as $sAlias => $sClassName) { if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $this->m_oSet) != UR_ALLOWED_NO) { @@ -1433,7 +1400,7 @@ JS $sSearchFilter = $this->m_oSet->GetFilter()->serialize(); // Limit the size of the URL (N°1585 - request uri too long) if (strlen($sSearchFilter) < SERVER_MAX_URL_LENGTH) { - $oBlock->sEventAttachedData = json_encode(array( + $oBlock->sEventAttachedData = json_encode([ 'filter' => $sSearchFilter, 'breadcrumb_id' => "ui-search-".$this->m_oSet->GetClass(), 'breadcrumb_label' => MetaModel::GetName($this->m_oSet->GetClass()), @@ -1441,7 +1408,7 @@ JS 'breadcrumb_instance_id' => MetaModel::GetConfig()->GetItopInstanceid(), 'breadcrumb_icon' => 'fas fa-search', 'breadcrumb_icon_type' => iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES, - )); + ]); } } @@ -1474,25 +1441,25 @@ JS $oContentBlock = new UIContentBlock(); $oHtml = new Html(); $oContentBlock->AddSubBlock($oHtml); - $aDisplayAliases = isset($aExtraParams['display_aliases']) ? explode(',', $aExtraParams['display_aliases']) : array(); + $aDisplayAliases = isset($aExtraParams['display_aliases']) ? explode(',', $aExtraParams['display_aliases']) : []; if (!isset($aExtraParams['group_by'])) { $oHtml->AddHtml('

    '.Dict::S('UI:Error:MandatoryTemplateParameter_group_by').'

    '); } else { - $aGroupByFields = array(); + $aGroupByFields = []; $aGroupBy = explode(',', $aExtraParams['group_by']); foreach ($aGroupBy as $sGroupBy) { - $aMatches = array(); + $aMatches = []; if (preg_match('/^(.+)\.(.+)$/', $sGroupBy, $aMatches) > 0) { - $aGroupByFields[] = array('alias' => $aMatches[1], 'att_code' => $aMatches[2]); + $aGroupByFields[] = ['alias' => $aMatches[1], 'att_code' => $aMatches[2]]; } } if (count($aGroupByFields) == 0) { $oHtml->AddHtml('

    '.Dict::Format('UI:Error:InvalidGroupByFields', $aExtraParams['group_by']).'

    '); } else { - $aResults = array(); - $aCriteria = array(); + $aResults = []; + $aCriteria = []; while ($aObjects = $this->m_oSet->FetchAssoc()) { - $aKeys = array(); + $aKeys = []; foreach ($aGroupByFields as $aField) { $sAlias = $aField['alias']; if (is_null($aObjects[$sAlias])) { @@ -1509,7 +1476,7 @@ JS $oHtml->AddHtml("
    \n"); // Construct a new (parametric) query that will return the content of this block $oBlockFilter = $this->m_oFilter->DeepClone(); - $aExpressions = array(); + $aExpressions = []; $index = 0; foreach ($aGroupByFields as $aField) { $aExpressions[] = '`'.$aField['alias'].'`.`'.$aField['att_code'].'` = :param'.$index++; @@ -1521,7 +1488,7 @@ JS foreach ($aResults as $sCategory => $aObjects) { $oHtml->AddHtml("\n"); if (count($aDisplayAliases) == 1) { - $aSimpleArray = array(); + $aSimpleArray = []; foreach ($aObjects as $aRow) { $oObj = $aRow[$aDisplayAliases[0]]; if (!is_null($oObj)) { @@ -1537,12 +1504,12 @@ JS $oHtml->AddHtml("\n"); } else { $index = 0; - $aArgs = array(); + $aArgs = []; foreach ($aGroupByFields as $aField) { $aArgs['param'.$index] = $aCriteria[$sCategory][$aField['alias'].'.'.$aField['att_code']]; $index++; } - $oSet = new CMDBObjectSet($oBlockFilter, array(), $aArgs); + $oSet = new CMDBObjectSet($oBlockFilter, [], $aArgs); if (empty($aExtraParams['currentId'])) { $iListId = utils::GetUniqueId(); // Works only if not in an Ajax page !! } else { @@ -1603,8 +1570,10 @@ JS $sDefaults .= '&'.urlencode($sName).'='.urlencode($sValue); } } - $oBlock->AddHtml("

    ".Dict::Format('UI:ClickToCreateNew', - Metamodel::GetName($sClass))."

    \n"); + $oBlock->AddHtml("

    ".Dict::Format( + 'UI:ClickToCreateNew', + Metamodel::GetName($sClass) + )."

    \n"); } } } @@ -1653,7 +1622,7 @@ JS if (isset($aExtraParams["surround_with_panel"]) && $aExtraParams["surround_with_panel"]) { $oPanel = PanelUIBlockFactory::MakeForClass($aExtraParams["panel_class"], $aExtraParams["panel_title"]); - if(isset($aExtraParams["panel_icon"]) && strlen($aExtraParams["panel_icon"]) > 0){ + if (isset($aExtraParams["panel_icon"]) && strlen($aExtraParams["panel_icon"]) > 0) { $oPanel->SetIcon($aExtraParams["panel_icon"]); } $oPanel->AddSubBlock($oBlock); @@ -1677,7 +1646,7 @@ JS { $sChartType = isset($aExtraParams['chart_type']) ? $aExtraParams['chart_type'] : 'pie'; $sId = utils::ReadParam('id', ''); - $aValues = array(); + $aValues = []; $oBlock = null; $sJSURLs = ''; @@ -1688,21 +1657,18 @@ JS $this->MakeGroupByQuery($aExtraParams, $oGroupByExp, $sGroupByLabel, $aGroupBy, $sAggregationFunction, $sFctVar, $sAggregationAttr, $sSql); $aRes = CMDBSource::QueryToArray($sSql); - - $iTotalCount = 0; - $aURLs = array(); + $aURLs = []; foreach ($aRes as $iRow => $aRow) { $sValue = $aRow['grouped_by_1']; $sHtmlValue = $oGroupByExp->MakeValueLabel($this->m_oFilter, $sValue, $sValue); $iTotalCount += $aRow['_itop_count_']; - $aValues[] = array( + $aValues[] = [ 'label' => html_entity_decode(strip_tags($sHtmlValue), ENT_QUOTES, 'UTF-8'), 'label_html' => $sHtmlValue, 'value' => (float)$aRow[$sFctVar], - ); - + ]; // Build the search for this subset $oSubsetSearch = $this->m_oFilter->DeepClone(); @@ -1741,7 +1707,7 @@ JS $aColumns = []; $aNames = []; foreach ($aValues as $idx => $aValue) { - $aColumns[] = array('series_'.$idx, (float)$aValue['value']); + $aColumns[] = ['series_'.$idx, (float)$aValue['value']]; $aNames['series_'.$idx] = $aValue['label']; } @@ -1763,7 +1729,7 @@ JS } if (isset($aExtraParams["surround_with_panel"]) && $aExtraParams["surround_with_panel"]) { $oPanel = PanelUIBlockFactory::MakeForClass($aExtraParams["panel_class"], $aExtraParams["panel_title"]); - if(isset($aExtraParams["panel_icon"]) && strlen($aExtraParams["panel_icon"]) > 0){ + if (isset($aExtraParams["panel_icon"]) && strlen($aExtraParams["panel_icon"]) > 0) { $oPanel->SetIcon($aExtraParams["panel_icon"]); } $oPanel->AddSubBlock($oBlock); @@ -1790,12 +1756,12 @@ JS $oBlock->sDownloadLink = utils::GetAbsoluteUrlAppRoot().'webservices/export.php?expression='.urlencode($this->m_oFilter->ToOQL(true)).'&format=csv&filename='.urlencode($oBlock->sCsvFile); $oBlock->sLinkToToggle = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=search'.$oAppContext->GetForLink(true).'&filter='.rawurlencode($this->m_oFilter->serialize()).'&format=csv'; // Pass the parameters via POST, since expression may be very long - $aParamsToPost = array( + $aParamsToPost = [ 'expression' => $this->m_oFilter->ToOQL(true), 'format' => 'csv', 'filename' => $oBlock->sCsvFile, 'charset' => 'UTF-8', - ); + ]; if ($oBlock->bAdvancedMode) { $oBlock->sDownloadLink .= '&fields_advanced=1'; $aParamsToPost['fields_advanced'] = 1; @@ -1854,8 +1820,7 @@ class MenuBlock extends DisplayBlock $oRouter = Router::GetInstance(); $oRenderBlock = new UIContentBlock(); - if ($this->m_sStyle == 'popup') // popup is a synonym of 'list' for backward compatibility - { + if ($this->m_sStyle == 'popup') { // popup is a synonym of 'list' for backward compatibility $this->m_sStyle = static::ENUM_STYLE_LIST; } @@ -1890,7 +1855,6 @@ class MenuBlock extends DisplayBlock $oAppContext = new ApplicationContext(); $sContext = $oAppContext->GetForLink(true); - $sFilter = $this->GetFilter()->serialize(); $sUIPage = cmdbAbstractObject::ComputeStandardUIPage($sClass); $sRootUrl = utils::GetAbsoluteUrlAppRoot(); @@ -1948,7 +1912,7 @@ class MenuBlock extends DisplayBlock $iLimit = MetaModel::GetConfig()->Get('complex_actions_limit'); if ( ($iSetCount > 0) && (false === $bLocked) && MetaModel::HasLifecycle($sClass) && - ( ($iLimit == 0) || ($iSetCount < $iLimit) ) + (($iLimit == 0) || ($iSetCount < $iLimit)) ) { $aTransitions = []; // Processing (optimizations) and endpoints are not exactly the same depending on if there is only 1 object or a set @@ -1968,8 +1932,8 @@ class MenuBlock extends DisplayBlock // Life cycle actions may be available... if all objects are in the same state // Group by $oGroupByExp = new FieldExpression(MetaModel::GetStateAttributeCode($sClass), $this->m_oFilter->GetClassAlias()); - $aGroupBy = array('__state__' => $oGroupByExp); - $aQueryParams = array(); + $aGroupBy = ['__state__' => $oGroupByExp]; + $aQueryParams = []; if (isset($aExtraParams['query_params'])) { $aQueryParams = $aExtraParams['query_params']; } @@ -2001,10 +1965,10 @@ class MenuBlock extends DisplayBlock switch ($iActionAllowed) { case UR_ALLOWED_YES: case UR_ALLOWED_DEPENDS: - $aTransitionActions[$sStimulusCode] = array( + $aTransitionActions[$sStimulusCode] = [ 'label' => $aStimuli[$sStimulusCode]->GetLabel(), 'url' => "{$sRootUrl}pages/UI.php?stimulus=$sStimulusCode&class=$sLifecycleClass&{$sUrlQueryString}", - ) + $aActionParams; + ] + $aActionParams; break; default: @@ -2066,16 +2030,16 @@ class MenuBlock extends DisplayBlock // Just one object in the set, possible actions are "new / clone / modify and delete" if (!isset($aExtraParams['link_attr'])) { if ($bIsModifyAllowed) { - $aRegularActions['UI:Menu:Modify'] = array( + $aRegularActions['UI:Menu:Modify'] = [ 'label' => Dict::S('UI:Menu:Modify'), - 'url' => $oRouter->GenerateUrl('object.modify', ['class' => $sClass, 'id' => $id]) . "{$sContext}#", - ) + $aActionParams; + 'url' => $oRouter->GenerateUrl('object.modify', ['class' => $sClass, 'id' => $id])."{$sContext}#", + ] + $aActionParams; } if ($bIsDeleteAllowed) { - $aRegularActions['UI:Menu:Delete'] = array( + $aRegularActions['UI:Menu:Delete'] = [ 'label' => Dict::S('UI:Menu:Delete'), 'url' => "{$sRootUrl}pages/$sUIPage?operation=delete&class=$sClass&id=$id{$sContext}", - ) + $aActionParams; + ] + $aActionParams; } // Relations... @@ -2084,16 +2048,16 @@ class MenuBlock extends DisplayBlock $this->AddMenuSeparator($aRegularActions); foreach ($aRelations as $sRelationCode => $aRelationInfo) { if (array_key_exists('down', $aRelationInfo)) { - $aRegularActions[$sRelationCode.'_down'] = array( + $aRegularActions[$sRelationCode.'_down'] = [ 'label' => $aRelationInfo['down'], 'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=down&class=$sClass&id=$id{$sContext}", - ) + $aActionParams; + ] + $aActionParams; } if (array_key_exists('up', $aRelationInfo)) { - $aRegularActions[$sRelationCode.'_up'] = array( + $aRegularActions[$sRelationCode.'_up'] = [ 'label' => $aRelationInfo['up'], 'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=up&class=$sClass&id=$id{$sContext}", - ) + $aActionParams; + ] + $aActionParams; } } } @@ -2105,7 +2069,7 @@ class MenuBlock extends DisplayBlock $bCanKill = false; $oUser = UserRights::GetUserObject(); - $aUserProfiles = array(); + $aUserProfiles = []; if (!is_null($oUser)) { $oProfileSet = $oUser->Get('profile_list'); while ($oProfile = $oProfileSet->Fetch()) { @@ -2127,10 +2091,10 @@ class MenuBlock extends DisplayBlock if ($bCanKill) { $this->AddMenuSeparator($aRegularActions); - $aRegularActions['concurrent_lock_unlock'] = array( + $aRegularActions['concurrent_lock_unlock'] = [ 'label' => Dict::S('UI:Menu:KillConcurrentLock'), 'url' => "{$sRootUrl}pages/$sUIPage?operation=kill_lock&class=$sClass&id=$id{$sContext}", - ); + ]; } } } @@ -2138,7 +2102,7 @@ class MenuBlock extends DisplayBlock $this->AddMenuSeparator($aRegularActions); $this->GetEnumAllowedActions($oSet, function ($sLabel, $data) use (&$aRegularActions, $aActionParams) { - $aRegularActions[$sLabel] = array('label' => $sLabel, 'url' => $data) + $aActionParams; + $aRegularActions[$sLabel] = ['label' => $sLabel, 'url' => $data] + $aActionParams; }); } break; @@ -2474,13 +2438,11 @@ class MenuBlock extends DisplayBlock protected function AddMenuSeparator(&$aActions) { $sSeparator = ''; - if (count($aActions) > 0) // Make sure that the separator is not the first item in the menu - { + if (count($aActions) > 0) { // Make sure that the separator is not the first item in the menu $aKeys = array_keys($aActions); $sLastKey = array_pop($aKeys); - if ($aActions[$sLastKey]['label'] != $sSeparator) // Make sure there are no 2 consecutive separators - { - $aActions['sep_'.(count($aActions)-1)] = array('label' => $sSeparator, 'url' => ''); + if ($aActions[$sLastKey]['label'] != $sSeparator) { // Make sure there are no 2 consecutive separators + $aActions['sep_'.(count($aActions) - 1)] = ['label' => $sSeparator, 'url' => '']; } } } @@ -2540,10 +2502,10 @@ class MenuBlock extends DisplayBlock */ protected function AddBulkDeleteObjectsMenuAction(array &$aActions, string $sClass, string $sFilter, string $sActionIdentifier = 'UI:Menu:BulkDelete', $sActionLabel = 'UI:Menu:BulkDelete') { - $aActions[$sActionIdentifier] = array( + $aActions[$sActionIdentifier] = [ 'label' => Dict::S($sActionLabel), 'url' => $this->PrepareUrlForStandardMenuAction($sClass, "operation=select_for_deletion&filter=".urlencode($sFilter)), - ) + $this->GetDefaultParamsForMenuAction(); + ] + $this->GetDefaultParamsForMenuAction(); } /** @@ -2580,6 +2542,6 @@ class MenuBlock extends DisplayBlock $oAppContext = new ApplicationContext(); $sContext = $oAppContext->GetForLink(true); - return $sUrl . $sContext; + return $sUrl.$sContext; } } diff --git a/application/errorpage.class.inc.php b/application/errorpage.class.inc.php index 9811de337..ecf84a17b 100644 --- a/application/errorpage.class.inc.php +++ b/application/errorpage.class.inc.php @@ -1,8 +1,9 @@ aStatistics = array( + $this->aStatistics = [ 'objects_count' => 0, 'total_duration' => 0, 'data_retrieval_duration' => 0, 'excel_build_duration' => 0, 'excel_write_duration' => 0, - 'peak_memory_usage' => 0, - ); + 'peak_memory_usage' => 0, + ]; $this->fStartTime = microtime(true); $this->oSearch = null; - + $this->sState = 'new'; - $this->aObjectsIDs = array(); + $this->aObjectsIDs = []; $this->iPosition = 0; $this->aAuthorizedClasses = null; $this->aTableHeaders = null; $this->sOutputFilePath = null; $this->bAdvancedMode = false; $this->CheckDataDir(); - if ($sToken == null) - { + if ($sToken == null) { $this->sToken = $this->GetNewToken(); - } - else - { + } else { $this->sToken = $sToken; $this->ReloadState(); } } - + public function __destruct() { - if (($this->sState != 'done') && ($this->sState != 'error') && ($this->sToken != null)) - { + if (($this->sState != 'done') && ($this->sState != 'error') && ($this->sToken != null)) { // Operation in progress, save the state $this->SaveState(); - } - else - { + } else { // Operation completed, cleanup the temp files @unlink($this->GetStateFile()); @unlink($this->GetDataFile()); } - self::CleanupOldFiles(); + self::CleanupOldFiles(); } - + public function SetChunkSize($iChunkSize) { - $this->iChunkSize = $iChunkSize; + $this->iChunkSize = $iChunkSize; } - + public function SetOutputFilePath($sDestFilePath) { $this->sOutputFilePath = $sDestFilePath; } - + public function SetAdvancedMode($bAdvanced) { $this->bAdvancedMode = $bAdvanced; } - + public function SaveState() { - $aState = array( + $aState = [ 'state' => $this->sState, 'statistics' => $this->aStatistics, 'filter' => $this->oSearch->serialize(), @@ -94,31 +88,28 @@ class ExcelExporter 'object_ids' => $this->aObjectsIDs, 'output_file_path' => $this->sOutputFilePath, 'advanced_mode' => $this->bAdvancedMode, - ); - + ]; + file_put_contents($this->GetStateFile(), json_encode($aState)); - + return $this->sToken; } - + public function ReloadState() { - if ($this->sToken == null) - { + if ($this->sToken == null) { throw new Exception('ExcelExporter not initialized with a token, cannot reload state'); } - - if (!file_exists($this->GetStateFile())) - { + + if (!file_exists($this->GetStateFile())) { throw new Exception("ExcelExporter: missing status file '".$this->GetStateFile()."', cannot reload state."); } $sJson = file_get_contents($this->GetStateFile()); $aState = json_decode($sJson, true); - if ($aState === null) - { + if ($aState === null) { throw new Exception("ExcelExporter:corrupted status file '".$this->GetStateFile()."', not a JSON, cannot reload state."); } - + $this->sState = $aState['state']; $this->aStatistics = $aState['statistics']; $this->oSearch = DBObjectSearch::unserialize($aState['filter']); @@ -128,206 +119,183 @@ class ExcelExporter $this->sOutputFilePath = $aState['output_file_path']; $this->bAdvancedMode = $aState['advanced_mode']; } - + public function SetObjectList($oSearch) { $this->oSearch = $oSearch; } - + public function Run() { $sCode = 'error'; $iPercentage = 100; $sMessage = Dict::Format('ExcelExporter:ErrorUnexpected_State', $this->sState); $fTime = microtime(true); - - try - { - switch($this->sState) - { + + try { + switch ($this->sState) { case 'new': - $oIDSet = new DBObjectSet($this->oSearch); - $oIDSet->OptimizeColumnLoad(array('id')); - $this->aObjectsIDs = array(); - while($oObj = $oIDSet->Fetch()) - { - $this->aObjectsIDs[] = $oObj->GetKey(); - } - $sCode = 'retrieving-data'; - $iPercentage = 5; - $sMessage = Dict::S('ExcelExporter:RetrievingData'); - $this->iPosition = 0; - $this->aStatistics['objects_count'] = count($this->aObjectsIDs); - $this->aStatistics['data_retrieval_duration'] += microtime(true) - $fTime; - - // The first line of the file is the "headers" specifying the label and the type of each column - $this->GetFieldsList($oIDSet, $this->bAdvancedMode); - $sRow = json_encode($this->aTableHeaders); - $hFile = @fopen($this->GetDataFile(), 'ab'); - if ($hFile === false) - { - throw new Exception('ExcelExporter: Failed to open temporary data file: "'.$this->GetDataFile().'" for writing.'); - } - fwrite($hFile, $sRow."\n"); - fclose($hFile); - - // Next state - $this->sState = 'retrieving-data'; - break; - - case 'retrieving-data': - $oCurrentSearch = clone $this->oSearch; - $aIDs = array_slice($this->aObjectsIDs, $this->iPosition, $this->iChunkSize); - - $oCurrentSearch->AddCondition('id', $aIDs, 'IN'); - $hFile = @fopen($this->GetDataFile(), 'ab'); - if ($hFile === false) - { - throw new Exception('ExcelExporter: Failed to open temporary data file: "'.$this->GetDataFile().'" for writing.'); - } - $oSet = new DBObjectSet($oCurrentSearch); - $this->GetFieldsList($oSet, $this->bAdvancedMode); - while($aObjects = $oSet->FetchAssoc()) - { - $aRow = array(); - foreach($this->aAuthorizedClasses as $sAlias => $sClassName) - { - $oObj = $aObjects[$sAlias]; - if ($this->bAdvancedMode) - { - $aRow[] = $oObj->GetKey(); - } - foreach($this->aFieldsList[$sAlias] as $sAttCodeEx => $oAttDef) - { - $value = $oObj->Get($sAttCodeEx); - if ($value instanceOf ormCaseLog) - { - // Extract the case log as text and remove the "===" which make Excel think that the cell contains a formula the next time you edit it! - $sExcelVal = trim(preg_replace('/========== ([^=]+) ============/', '********** $1 ************', $value->GetText())); - } - else - { - $sExcelVal = $oAttDef->GetEditValue($value, $oObj); - } - $aRow[] = $sExcelVal; - } + $oIDSet = new DBObjectSet($this->oSearch); + $oIDSet->OptimizeColumnLoad(['id']); + $this->aObjectsIDs = []; + while ($oObj = $oIDSet->Fetch()) { + $this->aObjectsIDs[] = $oObj->GetKey(); } - $sRow = json_encode($aRow); - fwrite($hFile, $sRow."\n"); - } - fclose($hFile); - - if (($this->iPosition + $this->iChunkSize) > count($this->aObjectsIDs)) - { - // Next state - $this->sState = 'building-excel'; - $sCode = 'building-excel'; - $iPercentage = 80; - $sMessage = Dict::S('ExcelExporter:BuildingExcelFile'); - } - else - { $sCode = 'retrieving-data'; - $this->iPosition += $this->iChunkSize; - $iPercentage = 5 + round(75 * ($this->iPosition / count($this->aObjectsIDs))); - $sMessage = Dict::S('ExcelExporter:RetrievingData'); - } - break; - + $iPercentage = 5; + $sMessage = Dict::S('ExcelExporter:RetrievingData'); + $this->iPosition = 0; + $this->aStatistics['objects_count'] = count($this->aObjectsIDs); + $this->aStatistics['data_retrieval_duration'] += microtime(true) - $fTime; + + // The first line of the file is the "headers" specifying the label and the type of each column + $this->GetFieldsList($oIDSet, $this->bAdvancedMode); + $sRow = json_encode($this->aTableHeaders); + $hFile = @fopen($this->GetDataFile(), 'ab'); + if ($hFile === false) { + throw new Exception('ExcelExporter: Failed to open temporary data file: "'.$this->GetDataFile().'" for writing.'); + } + fwrite($hFile, $sRow."\n"); + fclose($hFile); + + // Next state + $this->sState = 'retrieving-data'; + break; + + case 'retrieving-data': + $oCurrentSearch = clone $this->oSearch; + $aIDs = array_slice($this->aObjectsIDs, $this->iPosition, $this->iChunkSize); + + $oCurrentSearch->AddCondition('id', $aIDs, 'IN'); + $hFile = @fopen($this->GetDataFile(), 'ab'); + if ($hFile === false) { + throw new Exception('ExcelExporter: Failed to open temporary data file: "'.$this->GetDataFile().'" for writing.'); + } + $oSet = new DBObjectSet($oCurrentSearch); + $this->GetFieldsList($oSet, $this->bAdvancedMode); + while ($aObjects = $oSet->FetchAssoc()) { + $aRow = []; + foreach ($this->aAuthorizedClasses as $sAlias => $sClassName) { + $oObj = $aObjects[$sAlias]; + if ($this->bAdvancedMode) { + $aRow[] = $oObj->GetKey(); + } + foreach ($this->aFieldsList[$sAlias] as $sAttCodeEx => $oAttDef) { + $value = $oObj->Get($sAttCodeEx); + if ($value instanceof ormCaseLog) { + // Extract the case log as text and remove the "===" which make Excel think that the cell contains a formula the next time you edit it! + $sExcelVal = trim(preg_replace('/========== ([^=]+) ============/', '********** $1 ************', $value->GetText())); + } else { + $sExcelVal = $oAttDef->GetEditValue($value, $oObj); + } + $aRow[] = $sExcelVal; + } + } + $sRow = json_encode($aRow); + fwrite($hFile, $sRow."\n"); + } + fclose($hFile); + + if (($this->iPosition + $this->iChunkSize) > count($this->aObjectsIDs)) { + // Next state + $this->sState = 'building-excel'; + $sCode = 'building-excel'; + $iPercentage = 80; + $sMessage = Dict::S('ExcelExporter:BuildingExcelFile'); + } else { + $sCode = 'retrieving-data'; + $this->iPosition += $this->iChunkSize; + $iPercentage = 5 + round(75 * ($this->iPosition / count($this->aObjectsIDs))); + $sMessage = Dict::S('ExcelExporter:RetrievingData'); + } + break; + case 'building-excel': - $hFile = @fopen($this->GetDataFile(), 'rb'); - if ($hFile === false) - { - throw new Exception('ExcelExporter: Failed to open temporary data file: "'.$this->GetDataFile().'" for reading.'); - } - $sHeaders = fgets($hFile); - $aHeaders = json_decode($sHeaders, true); - - $aData = array(); - while($sLine = fgets($hFile)) - { - $aRow = json_decode($sLine); - $aData[] = $aRow; - } - fclose($hFile); - @unlink($this->GetDataFile()); - - $fStartExcel = microtime(true); - $writer = new XLSXWriter(); - $writer->setAuthor(UserRights::GetUserFriendlyName()); - $writer->writeSheet($aData,'Sheet1', $aHeaders); - $fExcelTime = microtime(true) - $fStartExcel; - $this->aStatistics['excel_build_duration'] = $fExcelTime; - - $fTime = microtime(true); - $writer->writeToFile($this->GetExcelFilePath()); - $fExcelSaveTime = microtime(true) - $fTime; - $this->aStatistics['excel_write_duration'] = $fExcelSaveTime; - - // Next state - $this->sState = 'done'; - $sCode = 'done'; - $iPercentage = 100; - $sMessage = Dict::S('ExcelExporter:Done'); - break; - + $hFile = @fopen($this->GetDataFile(), 'rb'); + if ($hFile === false) { + throw new Exception('ExcelExporter: Failed to open temporary data file: "'.$this->GetDataFile().'" for reading.'); + } + $sHeaders = fgets($hFile); + $aHeaders = json_decode($sHeaders, true); + + $aData = []; + while ($sLine = fgets($hFile)) { + $aRow = json_decode($sLine); + $aData[] = $aRow; + } + fclose($hFile); + @unlink($this->GetDataFile()); + + $fStartExcel = microtime(true); + $writer = new XLSXWriter(); + $writer->setAuthor(UserRights::GetUserFriendlyName()); + $writer->writeSheet($aData, 'Sheet1', $aHeaders); + $fExcelTime = microtime(true) - $fStartExcel; + $this->aStatistics['excel_build_duration'] = $fExcelTime; + + $fTime = microtime(true); + $writer->writeToFile($this->GetExcelFilePath()); + $fExcelSaveTime = microtime(true) - $fTime; + $this->aStatistics['excel_write_duration'] = $fExcelSaveTime; + + // Next state + $this->sState = 'done'; + $sCode = 'done'; + $iPercentage = 100; + $sMessage = Dict::S('ExcelExporter:Done'); + break; + case 'done': - $this->sState = 'done'; - $sCode = 'done'; - $iPercentage = 100; - $sMessage = Dict::S('ExcelExporter:Done'); - break; + $this->sState = 'done'; + $sCode = 'done'; + $iPercentage = 100; + $sMessage = Dict::S('ExcelExporter:Done'); + break; } - } - catch(Exception $e) - { + } catch (Exception $e) { $sCode = 'error'; $sMessage = $e->getMessage(); } - + $this->aStatistics['total_duration'] += microtime(true) - $fTime; $peak_memory = memory_get_peak_usage(true); - if ($peak_memory > $this->aStatistics['peak_memory_usage']) - { + if ($peak_memory > $this->aStatistics['peak_memory_usage']) { $this->aStatistics['peak_memory_usage'] = $peak_memory; } - - return array( + + return [ 'code' => $sCode, 'message' => $sMessage, 'percentage' => $iPercentage, - ); + ]; } - + public function GetExcelFilePath() { - if ($this->sOutputFilePath == null) - { + if ($this->sOutputFilePath == null) { return APPROOT.'data/bulk_export/'.$this->sToken.'.xlsx'; - } - else - { + } else { return $this->sOutputFilePath; } } - + public static function GetExcelFileFromToken($sToken) { return @file_get_contents(APPROOT.'data/bulk_export/'.$sToken.'.xlsx'); } - + public static function CleanupFromToken($sToken) { @unlink(APPROOT.'data/bulk_export/'.$sToken.'.status'); @unlink(APPROOT.'data/bulk_export/'.$sToken.'.data'); @unlink(APPROOT.'data/bulk_export/'.$sToken.'.xlsx'); } - + public function Cleanup() { self::CleanupFromToken($this->sToken); } - + /** * Delete all files in the data/bulk_export directory which are older than 1 day * unless a different delay is configured. @@ -336,15 +304,12 @@ class ExcelExporter { $aFiles = glob(APPROOT.'data/bulk_export/*.*'); $iDelay = MetaModel::GetConfig()->Get('xlsx_exporter_cleanup_old_files_delay'); - - if($iDelay > 0) - { - foreach($aFiles as $sFile) - { + + if ($iDelay > 0) { + foreach ($aFiles as $sFile) { $iModificationTime = filemtime($sFile); - - if($iModificationTime < (time() - $iDelay)) - { + + if ($iModificationTime < (time() - $iDelay)) { // Temporary files older than one day are deleted //echo "Supposed to delete: '".$sFile." (Unix Modification Time: $iModificationTime)'\n"; @unlink($sFile); @@ -352,189 +317,155 @@ class ExcelExporter } } } - + public function DisplayStatistics(Page $oPage) { - $aStats = array( + $aStats = [ 'Number of objects exported' => $this->aStatistics['objects_count'], 'Total export duration' => sprintf('%.3f s', $this->aStatistics['total_duration']), 'Data retrieval duration' => sprintf('%.3f s', $this->aStatistics['data_retrieval_duration']), 'Excel build duration' => sprintf('%.3f s', $this->aStatistics['excel_build_duration']), 'Excel write duration' => sprintf('%.3f s', $this->aStatistics['excel_write_duration']), 'Peak memory usage' => self::HumanDisplay($this->aStatistics['peak_memory_usage']), - ); - - if ($oPage instanceof CLIPage) - { + ]; + + if ($oPage instanceof CLIPage) { $oPage->add($this->GetStatistics('text')); - } - else - { + } else { $oPage->add($this->GetStatistics('html')); } } - + public function GetStatistics($sFormat = 'html') { $sStats = ''; - $aStats = array( + $aStats = [ 'Number of objects exported' => $this->aStatistics['objects_count'], 'Total export duration' => sprintf('%.3f s', $this->aStatistics['total_duration']), 'Data retrieval duration' => sprintf('%.3f s', $this->aStatistics['data_retrieval_duration']), 'Excel build duration' => sprintf('%.3f s', $this->aStatistics['excel_build_duration']), 'Excel write duration' => sprintf('%.3f s', $this->aStatistics['excel_write_duration']), 'Peak memory usage' => self::HumanDisplay($this->aStatistics['peak_memory_usage']), - ); - - if ($sFormat == 'text') - { - foreach($aStats as $sLabel => $sValue) - { + ]; + + if ($sFormat == 'text') { + foreach ($aStats as $sLabel => $sValue) { $sStats .= "+------------------------------+----------+\n"; $sStats .= sprintf("|%-30s|%10s|\n", $sLabel, $sValue); } $sStats .= "+------------------------------+----------+"; - } - else - { + } else { $sStats .= '

    $sCategory

    '; - foreach($aStats as $sLabel => $sValue) - { + foreach ($aStats as $sLabel => $sValue) { $sStats .= ""; } $sStats .= '
    $sLabel$sValue
    '; - + } return $sStats; } - + public static function HumanDisplay($iSize) { - $aUnits = array('B','KB','MB','GB','TB','PB'); - return @round($iSize/pow(1024,($i=floor(log($iSize,1024)))),2).' '.$aUnits[$i]; + $aUnits = ['B','KB','MB','GB','TB','PB']; + return @round($iSize / pow(1024, ($i = floor(log($iSize, 1024)))), 2).' '.$aUnits[$i]; } - + protected function CheckDataDir() { - if(!is_dir(APPROOT."data/bulk_export")) - { + if (!is_dir(APPROOT."data/bulk_export")) { @mkdir(APPROOT."data/bulk_export", 0777, true /* recursive */); clearstatcache(); } - if (!is_writable(APPROOT."data/bulk_export")) - { + if (!is_writable(APPROOT."data/bulk_export")) { throw new Exception('Data directory "'.APPROOT.'data/bulk_export" could not be written.'); } } - + protected function GetStateFile($sToken = null) { - if ($sToken == null) - { + if ($sToken == null) { $sToken = $this->sToken; } return APPROOT."data/bulk_export/$sToken.status"; } - + protected function GetDataFile() { return APPROOT.'data/bulk_export/'.$this->sToken.'.data'; } - + protected function GetNewToken() { $iNum = rand(); - do - { + do { $iNum++; $sToken = sprintf("%08x", $iNum); $sFileName = $this->GetStateFile($sToken); $hFile = @fopen($sFileName, 'x'); - } - while($hFile === false); - + } while ($hFile === false); + fclose($hFile); return $sToken; } - + protected function GetFieldsList($oSet, $bFieldsAdvanced = false, $bLocalize = true, $aFields = null) { - $this->aFieldsList = array(); - + $this->aFieldsList = []; + $oAppContext = new ApplicationContext(); $aClasses = $oSet->GetFilter()->GetSelectedClasses(); - $this->aAuthorizedClasses = array(); - foreach($aClasses as $sAlias => $sClassName) - { - if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) - { + $this->aAuthorizedClasses = []; + foreach ($aClasses as $sAlias => $sClassName) { + if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) { $this->aAuthorizedClasses[$sAlias] = $sClassName; } } - $aAttribs = array(); - $this->aTableHeaders = array(); - foreach($this->aAuthorizedClasses as $sAlias => $sClassName) - { - $aList[$sAlias] = array(); - - foreach(MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) - { - if (is_null($aFields) || (count($aFields) == 0)) - { + $aAttribs = []; + $this->aTableHeaders = []; + foreach ($this->aAuthorizedClasses as $sAlias => $sClassName) { + $aList[$sAlias] = []; + + foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) { + if (is_null($aFields) || (count($aFields) == 0)) { // Standard list of attributes (no link sets) - if ($oAttDef->IsScalar() && ($oAttDef->IsWritable() || $oAttDef->IsExternalField())) - { + if ($oAttDef->IsScalar() && ($oAttDef->IsWritable() || $oAttDef->IsExternalField())) { $sAttCodeEx = $oAttDef->IsExternalField() ? $oAttDef->GetKeyAttCode().'->'.$oAttDef->GetExtAttCode() : $sAttCode; - - if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) - { - if ($bFieldsAdvanced) - { + + if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) { + if ($bFieldsAdvanced) { $aList[$sAlias][$sAttCodeEx] = $oAttDef; - - if ($oAttDef->IsExternalKey(EXTKEY_RELATIVE)) - { - $sRemoteClass = $oAttDef->GetTargetClass(); - foreach(MetaModel::GetReconcKeys($sRemoteClass) as $sRemoteAttCode) - { + + if ($oAttDef->IsExternalKey(EXTKEY_RELATIVE)) { + $sRemoteClass = $oAttDef->GetTargetClass(); + foreach (MetaModel::GetReconcKeys($sRemoteClass) as $sRemoteAttCode) { $this->aFieldsList[$sAlias][$sAttCode.'->'.$sRemoteAttCode] = MetaModel::GetAttributeDef($sRemoteClass, $sRemoteAttCode); - } + } } } - } - else - { + } else { // Any other attribute $this->aFieldsList[$sAlias][$sAttCodeEx] = $oAttDef; } } - } - else - { + } else { // User defined list of attributes - if (in_array($sAttCode, $aFields) || in_array($sAlias.'.'.$sAttCode, $aFields)) - { + if (in_array($sAttCode, $aFields) || in_array($sAlias.'.'.$sAttCode, $aFields)) { $this->aFieldsList[$sAlias][$sAttCode] = $oAttDef; } } } - if ($bFieldsAdvanced) - { + if ($bFieldsAdvanced) { $this->aTableHeaders['id'] = '0'; } - foreach($this->aFieldsList[$sAlias] as $sAttCodeEx => $oAttDef) - { + foreach ($this->aFieldsList[$sAlias] as $sAttCodeEx => $oAttDef) { $sLabel = $bLocalize ? MetaModel::GetLabel($sClassName, $sAttCodeEx, isset($aParams['showMandatoryFields'])) : $sAttCodeEx; - if($oAttDef instanceof AttributeDateTime) - { + if ($oAttDef instanceof AttributeDateTime) { $this->aTableHeaders[$sLabel] = 'datetime'; - } - else - { + } else { $this->aTableHeaders[$sLabel] = 'string'; } } } } } - diff --git a/application/exceptions/ApplicationException.php b/application/exceptions/ApplicationException.php index 6a390a3f5..e9c7f59f2 100644 --- a/application/exceptions/ApplicationException.php +++ b/application/exceptions/ApplicationException.php @@ -1,4 +1,5 @@ aIssues) == 1) { $sIssue = reset($this->aIssues); - $sContent .= $sIssue; + $sContent .= $sIssue; } else { foreach ($this->aIssues as $sError) { - $sContent .= " " . $sError . ", "; + $sContent .= " ".$sError.", "; } } return $sContent; } - public function getIssues() { return $this->aIssues; diff --git a/application/exceptions/CoreException.php b/application/exceptions/CoreException.php index 178b5397d..6751665aa 100644 --- a/application/exceptions/CoreException.php +++ b/application/exceptions/CoreException.php @@ -1,4 +1,5 @@ m_aContextData) > 0) { $sMessage .= ": "; - $aContextItems = array(); + $aContextItems = []; foreach ($this->m_aContextData as $sKey => $value) { if (is_array($value)) { - $aPairs = array(); + $aPairs = []; foreach ($value as $key => $val) { if (is_array($val)) { $aPairs[] = $key.'=>('.implode(', ', $val).')'; @@ -109,4 +110,4 @@ class CoreException extends Exception { return $this->m_aContextData; } -} \ No newline at end of file +} diff --git a/application/exceptions/CorePortalInvalidActionRuleException.php b/application/exceptions/CorePortalInvalidActionRuleException.php index 598fd3253..1b5015117 100644 --- a/application/exceptions/CorePortalInvalidActionRuleException.php +++ b/application/exceptions/CorePortalInvalidActionRuleException.php @@ -1,4 +1,5 @@ getMessage(); parent::__construct($sMessage, null, '', $oTwigException); } -} \ No newline at end of file +} diff --git a/application/exceptions/CoreUnexpectedValue.php b/application/exceptions/CoreUnexpectedValue.php index 78a3f8b4c..5dd6371a2 100644 --- a/application/exceptions/CoreUnexpectedValue.php +++ b/application/exceptions/CoreUnexpectedValue.php @@ -1,4 +1,5 @@ GetKey(); + $aContextData[self::ENUM_PARAMS_OBJECT] = get_class($oObject).'::'.$oObject->GetKey(); $aContextData[self::ENUM_PARAMS_ATTCODE] = $sAttCode; $aContextData[self::ENUM_PARAMS_ATTVALUE] = $oObject->Get($sAttCode); $oCurrentUser = UserRights::GetUserObject(); if (false === is_null($oCurrentUser)) { - $aContextData[self::ENUM_PARAMS_USER] = get_class($oCurrentUser) . '::' . $oCurrentUser->GetKey(); + $aContextData[self::ENUM_PARAMS_USER] = get_class($oCurrentUser).'::'.$oCurrentUser->GetKey(); } parent::__construct('Attribute pointing to an object that is either non existing or not readable by the current user', $aContextData, '', $oPrevious); diff --git a/application/exceptions/InvalidPasswordAttributeOneWayPassword.php b/application/exceptions/InvalidPasswordAttributeOneWayPassword.php index 9239f7363..19638a909 100644 --- a/application/exceptions/InvalidPasswordAttributeOneWayPassword.php +++ b/application/exceptions/InvalidPasswordAttributeOneWayPassword.php @@ -1,4 +1,5 @@ getCode(); $this->code = $oException->getCode(); $aContext['mysql_error'] = $oException->getMessage(); - } else if ($oMysqli != null) { + } elseif ($oMysqli != null) { $aContext['mysql_errno'] = $oMysqli->errno; $this->code = $oMysqli->errno; $aContext['mysql_error'] = $oMysqli->error; @@ -36,4 +37,4 @@ class MySQLException extends CoreException error_reporting(0); } } -} \ No newline at end of file +} diff --git a/application/exceptions/mysql/MySQLHasGoneAwayException.php b/application/exceptions/mysql/MySQLHasGoneAwayException.php index cb16e6840..b830a92c1 100644 --- a/application/exceptions/mysql/MySQLHasGoneAwayException.php +++ b/application/exceptions/mysql/MySQLHasGoneAwayException.php @@ -1,4 +1,5 @@ * @since 3.0.0 N°3588 */ -class FindStylesheetObject{ - +class FindStylesheetObject +{ //file URIs private $aStylesheetFileURIs; @@ -64,7 +65,7 @@ class FindStylesheetObject{ return $this->aStylesheetFileURIs; } - public function GetLastModified() : int + public function GetLastModified(): int { return $this->iLastModified; } @@ -92,7 +93,8 @@ class FindStylesheetObject{ $this->sLastStyleSheetPath = $sStylesheetFilePath; } - public function AlreadyFetched(string $sStylesheetFilePath) : bool { + public function AlreadyFetched(string $sStylesheetFilePath): bool + { return in_array($sStylesheetFilePath, $this->aAllStylesheetFilePaths); } @@ -111,4 +113,4 @@ class FindStylesheetObject{ { $this->sLastStyleSheetPath = ""; } -} \ No newline at end of file +} diff --git a/application/forms.class.inc.php b/application/forms.class.inc.php index 890475e4f..4cac5ea9c 100644 --- a/application/forms.class.inc.php +++ b/application/forms.class.inc.php @@ -1,9 +1,10 @@ aFieldSets = array(); + $this->aFieldSets = []; $this->sCurrentFieldSet = ''; $this->sScript = ''; $this->sReadyScript = ''; @@ -61,62 +62,55 @@ class DesignerForm $this->sHierarchySelector = ''; $this->StartFieldSet($this->sCurrentFieldSet); $this->bDisplayed = true; - $this->aDefaultValues = array(); + $this->aDefaultValues = []; } - + public function AddField(DesignerFormField $oField) { - if (!is_array($this->aFieldSets[$this->sCurrentFieldSet])) - { - $this->aFieldSets[$this->sCurrentFieldSet] = array(); + if (!is_array($this->aFieldSets[$this->sCurrentFieldSet])) { + $this->aFieldSets[$this->sCurrentFieldSet] = []; } $this->aFieldSets[$this->sCurrentFieldSet][] = $oField; $oField->SetForm($this); } - + public function StartFieldSet($sLabel) { $this->sCurrentFieldSet = $sLabel; - if (!array_key_exists($this->sCurrentFieldSet, $this->aFieldSets)) - { - $this->aFieldSets[$this->sCurrentFieldSet] = array(); + if (!array_key_exists($this->sCurrentFieldSet, $this->aFieldSets)) { + $this->aFieldSets[$this->sCurrentFieldSet] = []; } } - + public function Render($oP, $bReturnHTML = false) { $sFormId = $this->GetFormId(); - if ($this->oParentForm == null) - { + if ($this->oParentForm == null) { $sReturn = '
    '; - } - else - { + } else { $sReturn = ''; } $sHiddenFields = ''; - foreach($this->aFieldSets as $sLabel => $aFields) - { - $aDetails = array(); - if ($sLabel != '') - { + foreach ($this->aFieldSets as $sLabel => $aFields) { + $aDetails = []; + if ($sLabel != '') { $sReturn .= '
    '; $sReturn .= ''.$sLabel.''; } /** @var \DesignerFormField $oField */ - foreach($aFields as $oField) { + foreach ($aFields as $oField) { $aRow = $oField->Render($oP, $sFormId); if ($oField->IsVisible()) { $sValidation = ''.$this->GetValidationArea($oField->GetFieldId()).''; $sField = $aRow['value'].$sValidation; - $aDetails[] = array( + $aDetails[] = [ 'label' => $aRow['label'], 'value' => $sField, 'attcode' => $oField->GetCode(), 'attlabel' => $aRow['label'], 'inputid' => $this->GetFieldId($oField->GetCode()), 'inputtype' => $oField->GetInputType(), - ); + ]; } else { $sHiddenFields .= $aRow['value']; } @@ -128,29 +122,23 @@ class DesignerForm } } $sReturn .= $sHiddenFields; - - if ($this->oParentForm == null) - { + + if ($this->oParentForm == null) { $sReturn .= ''; } - if($this->sScript != '') - { + if ($this->sScript != '') { $oP->add_script($this->sScript); } - if($this->sReadyScript != '') - { + if ($this->sReadyScript != '') { $oP->add_ready_script($this->sReadyScript); } - if ($bReturnHTML) - { + if ($bReturnHTML) { return $sReturn; - } - else - { + } else { $oP->add($sReturn); } } - + public function GetFieldSets() { return $this->aFieldSets; @@ -161,51 +149,50 @@ class DesignerForm $this->sSubmitTo = $sSubmitToUrl; $this->aSubmitParams = $aSubmitParams; } - + public function CopySubmitParams($oParentForm) { $this->sSubmitTo = $oParentForm->sSubmitTo; $this->aSubmitParams = $oParentForm->aSubmitParams; } - + public function GetSubmitParams() { - return array( 'url' => $this->sSubmitTo, 'params' => $this->aSubmitParams); + return [ 'url' => $this->sSubmitTo, 'params' => $this->aSubmitParams]; } - + /** - * Helper to handle subforms hide/show - */ + * Helper to handle subforms hide/show + */ public function SetHierarchyPath($sHierarchy) { $this->sHierarchyPath = $sHierarchy; } - + /** - * Helper to handle subforms hide/show - */ + * Helper to handle subforms hide/show + */ public function GetHierarchyPath() { return $this->sHierarchyPath; } - + /** - * Helper to handle subforms hide/show - */ + * Helper to handle subforms hide/show + */ public function SetHierarchyParent($sHierarchy) { $this->sHierarchyParent = $sHierarchy; } - + /** - * Helper to handle subforms hide/show - */ + * Helper to handle subforms hide/show + */ public function GetHierarchyParent() { return $this->sHierarchyParent; } - - + public function RenderAsPropertySheet($oP, $bReturnHTML = false, $sNotifyParentSelector = null) { $sReturn = ''; @@ -220,12 +207,11 @@ class DesignerForm $sHiddenFields = ''; foreach ($this->aFieldSets as $sLabel => $aFields) { - $aDetails = array(); + $aDetails = []; if ($sLabel != '') { $sReturn .= $this->StartRow().'
    '.$sLabel.'
    '; $sReturn .= $sHiddenFields; $sReturn .= ''; $sReturn .= '
    '; // for the return of the submit operation - } - else - { + } else { $sReturn .= $sHiddenFields; } $this->AddReadyScript( -<<sScript != '') - { + + if ($this->sScript != '') { $oP->add_script($this->sScript); } - if($this->sReadyScript != '') - { + if ($this->sReadyScript != '') { $oP->add_ready_script($this->sReadyScript); } - if ($bReturnHTML) - { + if ($bReturnHTML) { return $sReturn; - } - else - { + } else { $oP->add($sReturn); } } - + public function StartRow($sFieldId = null) { - if ($sFieldId != null) - { + if ($sFieldId != null) { return '
    '; - foreach($this->aTable as $aRow) - { + foreach ($this->aTable as $aRow) { $sReturn .= ''; - foreach($aRow as $field) - { - if (!is_object($field)) - { + foreach ($aRow as $field) { + if (!is_object($field)) { // Shortcut: pass a string for a cell containing just a label $sReturn .= ''; - } - else - { + } else { $field->SetForm($this); $aFieldData = $field->Render($oP, $sFormId); - if ($field->IsVisible()) - { + if ($field->IsVisible()) { // put the label and value separated by a non-breaking space if needed - $aData = array(); - foreach(array('label', 'value') as $sCode ) - { - if ($aFieldData[$sCode] != '') - { + $aData = []; + foreach (['label', 'value'] as $sCode) { + if ($aFieldData[$sCode] != '') { $aData[] = $aFieldData[$sCode]; - } + } } $sReturn .= ''; - } - else - { + } else { $sHiddenFields .= $aRow['value']; } } @@ -635,35 +581,27 @@ class DesignerTabularForm extends DesignerForm $sReturn .= ''; } $sReturn .= '
    '.$field.''.implode(' ', $aData).'
    '; - + $sReturn .= $sHiddenFields; - - if($this->sScript != '') - { + + if ($this->sScript != '') { $oP->add_script($this->sScript); } - if($this->sReadyScript != '') - { + if ($this->sReadyScript != '') { $oP->add_ready_script($this->sReadyScript); } - if ($bReturnHTML) - { + if ($bReturnHTML) { return $sReturn; - } - else - { + } else { $oP->add($sReturn); } } - - public function ReadParams(&$aValues = array()) + + public function ReadParams(&$aValues = []) { - foreach($this->aTable as $aRow) - { - foreach($aRow as $field) - { - if (is_object($field)) - { + foreach ($this->aTable as $aRow) { + foreach ($aRow as $field) { + if (is_object($field)) { $field->SetForm($this); $field->ReadParam($aValues); } @@ -716,7 +654,7 @@ class DesignerFormField $this->aCSSClasses[] = 'ibo-input'; } $this->bDisplayed = true; - $this->aWidgetExtraParams = array(); + $this->aWidgetExtraParams = []; } /** @@ -740,9 +678,9 @@ class DesignerFormField return $this->sCode; } - /** - * @param \DesignerForm $oForm - */ + /** + * @param \DesignerForm $oForm + */ public function SetForm(DesignerForm $oForm) { $this->oForm = $oForm; @@ -835,12 +773,12 @@ class DesignerFormField * * @return array */ - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { $sId = $this->oForm->GetFieldId($this->sCode); $sName = $this->oForm->GetFieldName($this->sCode); - return array('label' => $this->sLabel, 'value' => "defaultValue)."\">"); + return ['label' => $this->sLabel, 'value' => "defaultValue)."\">"]; } /** @@ -848,26 +786,17 @@ class DesignerFormField */ public function ReadParam(&$aValues) { - if ($this->IsReadOnly()) - { + if ($this->IsReadOnly()) { $aValues[$this->sCode] = $this->defaultValue; - } - else - { - if ($this->oForm->GetParamsContainer() != '') - { - $aParams = utils::ReadParam($this->oForm->GetParamsContainer(), array(), false, 'raw_data'); - if (array_key_exists($this->oForm->GetParamName($this->sCode), $aParams)) - { + } else { + if ($this->oForm->GetParamsContainer() != '') { + $aParams = utils::ReadParam($this->oForm->GetParamsContainer(), [], false, 'raw_data'); + if (array_key_exists($this->oForm->GetParamName($this->sCode), $aParams)) { $aValues[$this->sCode] = $aParams[$this->oForm->GetParamName($this->sCode)]; - } - else - { + } else { $aValues[$this->sCode] = $this->defaultValue; } - } - else - { + } else { $aValues[$this->sCode] = utils::ReadParam($this->oForm->GetParamName($this->sCode), $this->defaultValue, false, 'raw_data'); } } @@ -888,7 +817,7 @@ class DesignerFormField { $this->aCSSClasses[] = $sCSSClass; } - + /** * A way to set/change the default value after constructing the field * @@ -896,8 +825,7 @@ class DesignerFormField */ public function SetDefaultValueFrom($aAllDefaultValue) { - if (array_key_exists($this->GetCode(), $aAllDefaultValue)) - { + if (array_key_exists($this->GetCode(), $aAllDefaultValue)) { $this->defaultValue = $aAllDefaultValue[$this->GetCode()]; } } @@ -909,8 +837,7 @@ class DesignerFormField */ public function FindField($sFieldCode) { - if ($this->sCode == $sFieldCode) - { + if ($this->sCode == $sFieldCode) { return $this; } return false; @@ -948,18 +875,18 @@ class DesignerLabelField extends DesignerFormField // Increase counter static::$iCount++; - parent::__construct('label_number_' . static::$iCount, $sLabel, ''); + parent::__construct('label_number_'.static::$iCount, $sLabel, ''); $this->sDescription = $sDescription; } /** * @inheritdoc */ - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { $sId = $this->oForm->GetFieldId($this->sCode); $sName = $this->oForm->GetFieldName($this->sCode); - return array('label' => $this->sLabel, 'value' => $this->sDescription); + return ['label' => $this->sLabel, 'value' => $this->sDescription]; } /** @@ -986,9 +913,9 @@ class DesignerTextField extends DesignerFormField { parent::__construct($sCode, $sLabel, $defaultValue); $this->sValidationPattern = ''; - $this->aForbiddenValues = array(); + $this->aForbiddenValues = []; } - + public function SetValidationPattern($sValidationPattern) { $this->sValidationPattern = $sValidationPattern; @@ -997,40 +924,34 @@ class DesignerTextField extends DesignerFormField public function SetForbiddenValues($aValues, $sExplain, $bCaseSensitive = true) { $aForbiddenValues = $aValues; - + $iDefaultKey = array_search($this->defaultValue, $aForbiddenValues); - if ($iDefaultKey !== false) - { + if ($iDefaultKey !== false) { // The default (current) value is always allowed... unset($aForbiddenValues[$iDefaultKey]); - + } - - $this->aForbiddenValues[] = array('values' => $aForbiddenValues, 'message' => $sExplain, 'case_sensitive' => $bCaseSensitive); + + $this->aForbiddenValues[] = ['values' => $aForbiddenValues, 'message' => $sExplain, 'case_sensitive' => $bCaseSensitive]; } - - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { $sId = $this->oForm->GetFieldId($this->sCode); - + $sName = $this->oForm->GetFieldName($this->sCode); if ($this->IsReadOnly()) { $sHtmlValue = "".utils::EscapeHtml($this->defaultValue)."defaultValue)."\"/>"; - } - else - { + } else { $sPattern = addslashes($this->sValidationPattern); - if (is_array($this->aForbiddenValues)) - { + if (is_array($this->aForbiddenValues)) { $sForbiddenValues = json_encode($this->aForbiddenValues); - } - else - { + } else { $sForbiddenValues = '[]'; //Empty JS array } - $sMandatory = $this->bMandatory ? 'true' : 'false'; + $sMandatory = $this->bMandatory ? 'true' : 'false'; $oP->add_ready_script( -<<defaultValue)."\">"; } - return array('label' => $this->sLabel, 'value' => $sHtmlValue); + return ['label' => $this->sLabel, 'value' => $sHtmlValue]; } public function ReadParam(&$aValues) { parent::ReadParam($aValues); $sPattern = '/'.str_replace('/', '\/', $this->sValidationPattern).'/'; // Escape the forward slashes since they are used as delimiters for preg_match - if (($this->sValidationPattern != '') && (!preg_match($sPattern, $aValues[$this->sCode])) ) - { + if (($this->sValidationPattern != '') && (!preg_match($sPattern, $aValues[$this->sCode]))) { $aValues[$this->sCode] = $this->defaultValue; - } - else if(($this->aForbiddenValues != null) && in_array($aValues[$this->sCode], $this->aForbiddenValues)) - { + } elseif (($this->aForbiddenValues != null) && in_array($aValues[$this->sCode], $this->aForbiddenValues)) { // Reject the value... $aValues[$this->sCode] = $this->defaultValue; } @@ -1082,23 +1000,19 @@ class DesignerLongTextField extends DesignerTextField return cmdbAbstractObject::ENUM_INPUT_TYPE_TEXTAREA; } - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { $sId = $this->oForm->GetFieldId($this->sCode); $sName = $this->oForm->GetFieldName($this->sCode); $sPattern = addslashes($this->sValidationPattern); - if (is_array($this->aForbiddenValues)) - { + if (is_array($this->aForbiddenValues)) { $sForbiddenValues = json_encode($this->aForbiddenValues); - } - else - { + } else { $sForbiddenValues = '[]'; //Empty JS array } - $sMandatory = $this->bMandatory ? 'true' : 'false'; + $sMandatory = $this->bMandatory ? 'true' : 'false'; $sCSSClasses = ''; - if (count($this->aCSSClasses) > 0) - { + if (count($this->aCSSClasses) > 0) { $sCSSClasses = 'class="'.implode(' ', $this->aCSSClasses).'"'; } if (!$this->IsReadOnly()) { @@ -1112,11 +1026,10 @@ $('#$sId').on('change keyup validate', function() { ValidateWithPattern('$sId', EOF ); $sValue = ""; - } - else { + } else { $sValue = "
    ".$this->PrepareValueForRendering()."
    "; } - return array('label' => $this->sLabel, 'value' => $sValue); + return ['label' => $this->sLabel, 'value' => $sValue]; } /** @@ -1165,22 +1078,20 @@ class DesignerIntegerField extends DesignerFormField $this->iMin = $iMin; $this->iMax = $iMax; } - - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { $sId = $this->oForm->GetFieldId($this->sCode); - + $sName = $this->oForm->GetFieldName($this->sCode); if ($this->IsReadOnly()) { $sHtmlValue = "".utils::EscapeHtml($this->defaultValue)."defaultValue)."\"/>"; - } - else - { + } else { $sMin = json_encode($this->iMin); $sMax = json_encode($this->iMax); - $sMandatory = $this->bMandatory ? 'true' : 'false'; + $sMandatory = $this->bMandatory ? 'true' : 'false'; $oP->add_ready_script( -<<defaultValue)."\">"; } - return array('label' => $this->sLabel, 'value' => $sHtmlValue); + return ['label' => $this->sLabel, 'value' => $sHtmlValue]; } public function ReadParam(&$aValues) { parent::ReadParam($aValues); - if (!is_null($this->iMin) && ($aValues[$this->sCode] < $this->iMin)) - { + if (!is_null($this->iMin) && ($aValues[$this->sCode] < $this->iMin)) { // Reject the value... $aValues[$this->sCode] = $this->defaultValue; } - if (!is_null($this->iMax) && ($aValues[$this->sCode] > $this->iMax)) - { + if (!is_null($this->iMax) && ($aValues[$this->sCode] > $this->iMax)) { // Reject the value... $aValues[$this->sCode] = $this->defaultValue; } @@ -1221,11 +1130,11 @@ class DesignerComboField extends DesignerFormField protected $bOtherChoices; protected $sNullLabel; protected $bSorted; - + public function __construct($sCode, $sLabel = '', $defaultValue = '') { parent::__construct($sCode, $sLabel, $defaultValue); - $this->aAllowedValues = array(); + $this->aAllowedValues = []; $this->bMultipleSelection = false; $this->bOtherChoices = false; $this->sNullLabel = Dict::S('UI:SelectOne'); @@ -1245,8 +1154,7 @@ class DesignerComboField extends DesignerFormField { if ($this->bMultipleSelection) { return cmdbAbstractObject::ENUM_INPUT_TYPE_DROPDOWN_MULTIPLE_CHOICES; - } - else { + } else { return cmdbAbstractObject::ENUM_INPUT_TYPE_DROPDOWN_RAW; } } @@ -1260,12 +1168,12 @@ class DesignerComboField extends DesignerFormField $this->aAllowedValues = $aAllowedValues; } - + public function MultipleSelection($bMultipleSelection = true) { $this->bMultipleSelection = $bMultipleSelection; } - + public function OtherChoices($bOtherChoices = true) { $this->bOtherChoices = $bOtherChoices; @@ -1273,47 +1181,42 @@ class DesignerComboField extends DesignerFormField /** * An empty label will disable the default empty value - */ + */ public function SetNullLabel($sLabel) { $this->sNullLabel = $sLabel; } - + public function IsSorted() { return $this->bSorted; } - + public function SetSorted($bSorted) { $this->bSorted = $bSorted; } - - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { $sId = $this->oForm->GetFieldId($this->sCode); $sName = $this->oForm->GetFieldName($this->sCode); $sChecked = $this->defaultValue ? 'checked' : ''; - $sMandatory = $this->bMandatory ? 'true' : 'false'; - $sReadOnly = $this->IsReadOnly() ? 'disabled="disabled"' : ''; - if ($this->IsSorted() ) - { + $sMandatory = $this->bMandatory ? 'true' : 'false'; + $sReadOnly = $this->IsReadOnly() ? 'disabled="disabled"' : ''; + if ($this->IsSorted()) { asort($this->aAllowedValues); } $sCSSClasses = ''; - if (count($this->aCSSClasses) > 0) - { + if (count($this->aCSSClasses) > 0) { $sCSSClasses = 'class="'.implode(' ', $this->aCSSClasses).'"'; } - if ($this->IsReadOnly()) - { - $aSelected = array(); - $aHiddenValues = array(); - foreach($this->aAllowedValues as $sKey => $sDisplayValue) - { - if ($this->bMultipleSelection) - { - if(in_array($sKey, $this->defaultValue)) { + if ($this->IsReadOnly()) { + $aSelected = []; + $aHiddenValues = []; + foreach ($this->aAllowedValues as $sKey => $sDisplayValue) { + if ($this->bMultipleSelection) { + if (in_array($sKey, $this->defaultValue)) { $aSelected[] = $sDisplayValue; $aHiddenValues[] = ""; } @@ -1325,19 +1228,13 @@ class DesignerComboField extends DesignerFormField } } $sHtml = "".utils::EscapeHtml(implode(', ', $aSelected)).implode($aHiddenValues).""; - } - else - { - if ($this->bMultipleSelection) - { + } else { + if ($this->bMultipleSelection) { $iSize = max(1, min(8, count($this->aAllowedValues))); $sHtml = ""; - if ($this->sNullLabel != '') - { + if ($this->sNullLabel != '') { $sHtml .= ""; } } @@ -1352,26 +1249,24 @@ class DesignerComboField extends DesignerFormField $sHtml .= ""; } $sHtml .= ""; - if ($this->bOtherChoices) - { - $sHtml .= '
     '; + if ($this->bOtherChoices) { + $sHtml .= '
     '; } $oP->add_ready_script( -<< $this->sLabel, 'value' => $sHtml); + return ['label' => $this->sLabel, 'value' => $sHtml]; } public function ReadParam(&$aValues) { parent::ReadParam($aValues); - if ($aValues[$this->sCode] == 'null') - { - $aValues[$this->sCode] = array(); + if ($aValues[$this->sCode] == 'null') { + $aValues[$this->sCode] = []; } } } @@ -1394,8 +1289,8 @@ class DesignerBooleanField extends DesignerFormField { return cmdbAbstractObject::ENUM_INPUT_TYPE_CHECKBOX; } - - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { $sId = $this->oForm->GetFieldId($this->sCode); $sName = $this->oForm->GetFieldName($this->sCode); @@ -1403,42 +1298,30 @@ class DesignerBooleanField extends DesignerFormField if ($this->IsReadOnly()) { $sLabel = $this->defaultValue ? Dict::S('UI:UserManagement:ActionAllowed:Yes') : Dict::S('UI:UserManagement:ActionAllowed:No'); //TODO use our own yes/no translations $sHtmlValue = "".utils::EscapeHtml($sLabel)."defaultValue)."\"/>"; - } - else - { + } else { $sCSSClasses = ''; - if (count($this->aCSSClasses) > 0) - { + if (count($this->aCSSClasses) > 0) { $sCSSClasses = 'class="'.implode(' ', $this->aCSSClasses).'"'; } $sHtmlValue = ""; } - return array('label' => $this->sLabel, 'value' => $sHtmlValue); + return ['label' => $this->sLabel, 'value' => $sHtmlValue]; } - + public function ReadParam(&$aValues) { - if ($this->IsReadOnly()) - { + if ($this->IsReadOnly()) { $aValues[$this->sCode] = $this->defaultValue; - } - else - { + } else { $sParamsContainer = $this->oForm->GetParamsContainer(); - if ($sParamsContainer != '') - { - $aParams = utils::ReadParam($sParamsContainer, array(), false, 'raw_data'); - if (array_key_exists($this->oForm->GetParamName($this->sCode), $aParams)) - { + if ($sParamsContainer != '') { + $aParams = utils::ReadParam($sParamsContainer, [], false, 'raw_data'); + if (array_key_exists($this->oForm->GetParamName($this->sCode), $aParams)) { $sValue = $aParams[$this->oForm->GetParamName($this->sCode)]; - } - else - { + } else { $sValue = 'false'; } - } - else - { + } else { $sValue = utils::ReadParam($this->oForm->GetParamName($this->sCode), 'false', false, 'raw_data'); } $aValues[$this->sCode] = ($sValue == 'true'); @@ -1460,27 +1343,26 @@ class DesignerHiddenField extends DesignerFormField { return null; } - + public function IsVisible() { return false; } - - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { $sId = $this->oForm->GetFieldId($this->sCode); $sName = $this->oForm->GetFieldName($this->sCode); - return array('label' => '', 'value' => "defaultValue)."\">"); + return ['label' => '', 'value' => "defaultValue)."\">"]; } } - class DesignerIconSelectionField extends DesignerFormField { protected $sUploadUrl; protected $aAllowedValues; - + public function __construct($sCode, $sLabel = '', $defaultValue = '') { parent::__construct($sCode, $sLabel, $defaultValue); @@ -1495,7 +1377,7 @@ class DesignerIconSelectionField extends DesignerFormField { return cmdbAbstractObject::ENUM_INPUT_TYPE_DROPDOWN_DECORATED; } - + public function SetAllowedValues($aAllowedValues) { $this->aAllowedValues = $aAllowedValues; @@ -1506,7 +1388,7 @@ class DesignerIconSelectionField extends DesignerFormField $this->sUploadUrl = $sIconUploadUrl; } - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { $sId = $this->oForm->GetFieldId($this->sCode); $sName = $this->oForm->GetFieldName($this->sCode); @@ -1541,14 +1423,14 @@ EOF $sValue = ' '.utils::EscapeHtml($this->aAllowedValues[$idx]['label']).''; } $sReadOnly = $this->IsReadOnly() ? 'disabled' : ''; - return array('label' => $this->sLabel, 'value' => $sValue); + return ['label' => $this->sLabel, 'value' => $sValue]; } } class RunTimeIconSelectionField extends DesignerIconSelectionField { - static $aAllIcons = array(); - + public static $aAllIcons = []; + public function __construct($sCode, $sLabel = '', $defaultValue = '') { parent::__construct($sCode, $sLabel, $defaultValue); @@ -1562,30 +1444,27 @@ class RunTimeIconSelectionField extends DesignerIconSelectionField ksort($aIcons); foreach ($aIcons as $sFilePath) { - self::$aAllIcons[] = array('value' => $sFilePath, 'label' => basename($sFilePath), 'icon' => $sUrlPrefix.$sFilePath); + self::$aAllIcons[] = ['value' => $sFilePath, 'label' => basename($sFilePath), 'icon' => $sUrlPrefix.$sFilePath]; } } } $this->SetAllowedValues(self::$aAllIcons); } - static protected function FindIconsOnDisk($sBaseDir, $sDir = '') + protected static function FindIconsOnDisk($sBaseDir, $sDir = '') { $aFiles = null; $sKey = $sBaseDir.'/'.$sDir; $sShortKey = abs(crc32($sKey)); $sCacheFile = utils::GetCachePath().'available-icons-'.$sShortKey.'.php'; $sCacheClass = 'AvailableIcons_'.$sShortKey; - if (file_exists($sCacheFile)) - { + if (file_exists($sCacheFile)) { require_once($sCacheFile); - if ($sCacheClass::$sKey === $sKey) // crc32 collision detection - { + if ($sCacheClass::$sKey === $sKey) { // crc32 collision detection $aFiles = $sCacheClass::$aIconFiles; } } - if ($aFiles === null) - { + if ($aFiles === null) { $aFiles = self::_FindIconsOnDisk($sBaseDir, $sDir); $sAvailableIcons = 'aAllowedValues = array(); + $this->aAllowedValues = []; } /** @@ -1673,20 +1549,19 @@ class DesignerSortableField extends DesignerFormField { return null; } - + public function SetAllowedValues($aAllowedValues) { $this->aAllowedValues = $aAllowedValues; } - - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { $bOpen = false; $sId = $this->oForm->GetFieldId($this->sCode); $sName = $this->oForm->GetFieldName($this->sCode); $sReadOnly = $this->IsReadOnly() ? 'readonly="readonly"' : ''; - $aResult = array('label' => $this->sLabel, 'value' => "defaultValue)."\">"); - + $aResult = ['label' => $this->sLabel, 'value' => "defaultValue)."\">"]; $sJSFields = json_encode(array_keys($this->aAllowedValues)); $oP->add_ready_script( @@ -1702,12 +1577,12 @@ class DesignerFormSelectorField extends DesignerFormField protected $aSubForms; protected $defaultRealValue; // What's stored as default value is actually the index protected $bSorted; - + public function __construct($sCode, $sLabel = '', $defaultValue = '') { parent::__construct($sCode, $sLabel, 0); $this->defaultRealValue = $defaultValue; - $this->aSubForms = array(); + $this->aSubForms = []; $this->bSorted = true; if (ContextTag::Check(ContextTag::TAG_CONSOLE)) { $this->aCSSClasses[] = 'ibo-input-select'; @@ -1726,39 +1601,38 @@ class DesignerFormSelectorField extends DesignerFormField { return $this->bSorted; } - + public function SetSorted($bSorted) { $this->bSorted = $bSorted; } - + /** * Callback for sorting an array of $aFormData based ont he labels of the subforms * @param unknown $aItem1 * @param unknown $aItem2 * @return number */ - static function SortOnFormLabel($aItem1, $aItem2) + public static function SortOnFormLabel($aItem1, $aItem2) { return strcasecmp($aItem1['label'], $aItem2['label']); } - + public function GetWidgetClass() { return 'selector_property_field'; } - + public function AddSubForm($oSubForm, $sLabel, $sValue) { - $this->aSubForms[] = array('form' => $oSubForm, 'label' => $sLabel, 'value' => $sValue); - if ($sValue == $this->defaultRealValue) - { + $this->aSubForms[] = ['form' => $oSubForm, 'label' => $sLabel, 'value' => $sValue]; + if ($sValue == $this->defaultRealValue) { // Store the index of the selected/default form $this->defaultValue = count($this->aSubForms) - 1; } } - - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { $sId = $this->oForm->GetFieldId($this->sCode); $sName = $this->oForm->GetFieldName($this->sCode); @@ -1772,15 +1646,14 @@ class DesignerFormSelectorField extends DesignerFormField } if ($this->IsSorted()) { - uasort($this->aSubForms, array(get_class($this), 'SortOnFormLabel')); + uasort($this->aSubForms, [get_class($this), 'SortOnFormLabel']); } if ($this->IsReadOnly()) { $sDisplayValue = ''; $sHiddenValue = ''; foreach ($this->aSubForms as $iKey => $aFormData) { - if ($iKey == $this->defaultValue) // Default value is actually the index - { + if ($iKey == $this->defaultValue) { // Default value is actually the index $sDisplayValue = utils::EscapeHtml($aFormData['label']); $sHiddenValue = ""; break; @@ -1825,29 +1698,24 @@ class DesignerFormSelectorField extends DesignerFormField $oSubForm->SetDisplayed($sKey == $this->defaultValue); $sHtml .= $oSubForm->RenderAsPropertySheet($oP, true); - } - else - { + } else { $sHtml .= "
    "; $sHtml .= $oSubForm->Render($oP, true); $sHtml .= "
    "; } } - if ($sRenderMode == 'property') - { + if ($sRenderMode == 'property') { $sSelector = $this->oForm->GetHierarchyPath().'/'.$this->sCode.$this->oForm->GetSuffix(); $this->aWidgetExtraParams['data_selector'] = $sSelector; - } - else - { + } else { $oP->add_ready_script( -<< $this->sLabel, 'value' => $sHtml); + return ['label' => $this->sLabel, 'value' => $sHtml]; } public function ReadParam(&$aValues) @@ -1855,42 +1723,36 @@ EOF parent::ReadParam($aValues); $sKey = $aValues[$this->sCode]; $aValues[$this->sCode] = $this->aSubForms[$sKey]['value']; - + $this->aSubForms[$sKey]['form']->SetPrefix($this->oForm->GetPrefix().$sKey.'_'); $this->aSubForms[$sKey]['form']->SetParentForm($this->oForm); $this->aSubForms[$sKey]['form']->ReadParams($aValues); } - + public function SetDefaultValueFrom($aAllDefaultValues) { - if (array_key_exists($this->GetCode(), $aAllDefaultValues)) - { + if (array_key_exists($this->GetCode(), $aAllDefaultValues)) { $selectedValue = $aAllDefaultValues[$this->GetCode()]; - foreach($this->aSubForms as $iKey => $aFormData) - { + foreach ($this->aSubForms as $iKey => $aFormData) { $sId = $this->oForm->GetFieldId($this->sCode); - if ($selectedValue == $aFormData['value']) - { - $this->defaultValue =$iKey; + if ($selectedValue == $aFormData['value']) { + $this->defaultValue = $iKey; $oSubForm = $aFormData['form']; $oSubForm->SetDefaultValues($aAllDefaultValues); } - } + } } } - + public function FindField($sFieldCode) { $oField = parent::FindField($sFieldCode); - if ($oField === false) - { + if ($oField === false) { // Look in the subforms - foreach($this->aSubForms as $sKey => $aFormData) - { + foreach ($this->aSubForms as $sKey => $aFormData) { $oSubForm = $aFormData['form']; $oField = $oSubForm->FindField($sFieldCode); - if ($oField !== false) - { + if ($oField !== false) { break; } } @@ -1915,34 +1777,30 @@ class DesignerSubFormField extends DesignerFormField { return null; } - - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { $this->oSubForm->SetParentForm($this->oForm); $this->oSubForm->CopySubmitParams($this->oForm); - - if ($sRenderMode == 'property') - { + + if ($sRenderMode == 'property') { $sHtml = $this->oSubForm->RenderAsPropertySheet($oP, true); - } - else - { + } else { $sHtml = $this->oSubForm->Render($oP, true); } - return array('label' => $this->sLabel, 'value' => $sHtml); + return ['label' => $this->sLabel, 'value' => $sHtml]; } public function ReadParam(&$aValues) - { + { $this->oSubForm->SetParentForm($this->oForm); $this->oSubForm->ReadParams($aValues); } - + public function FindField($sFieldCode) { $oField = parent::FindField($sFieldCode); - if ($oField === false) - { + if ($oField === false) { // Look in the subform $oField = $this->oSubForm->FindField($sFieldCode); } @@ -1950,8 +1808,6 @@ class DesignerSubFormField extends DesignerFormField } } - - class DesignerStaticTextField extends DesignerFormField { public function __construct($sCode, $sLabel = '', $defaultValue = '') @@ -1967,9 +1823,8 @@ class DesignerStaticTextField extends DesignerFormField return null; } - public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog') + public function Render(WebPage $oP, $sFormId, $sRenderMode = 'dialog') { - return array('label' => $this->sLabel, 'value' => $this->defaultValue); + return ['label' => $this->sLabel, 'value' => $this->defaultValue]; } } - diff --git a/application/iotask.class.inc.php b/application/iotask.class.inc.php index bdbaad318..35b842d62 100644 --- a/application/iotask.class.inc.php +++ b/application/iotask.class.inc.php @@ -1,9 +1,10 @@ - /** * Persistent class InputOutputTask * @@ -28,41 +28,40 @@ require_once(APPROOT.'/application/cmdbabstract.class.inc.php'); /** * This class manages the input/output tasks - * for synchronizing information with external data sources + * for synchronizing information with external data sources */ class InputOutputTask extends cmdbAbstractObject { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "application", "key_type" => "autoincrement", "name_attcode" => "name", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_iotask", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); - MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("category", array("allowed_values"=>new ValueSetEnum('Input, Ouput'), "sql"=>"category", "default_value"=>"Input", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("source_type", array("allowed_values"=>new ValueSetEnum('File, Database, Web Service'), "sql"=>"source_type", "default_value"=>"File", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("source_subtype", array("allowed_values"=>new ValueSetEnum('Oracle, MySQL, Postgress, MSSQL, SOAP, HTTP-Get, HTTP-Post, XML/RPC, CSV, XML, Excel'), "sql"=>"source_subtype", "default_value"=>"CSV", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("source_path", array("allowed_values"=>null, "sql"=>"source_path", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeClass("objects_class", array("class_category"=>"", "more_values"=>"", "sql"=>"objects_class", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("test_mode", array("allowed_values"=>new ValueSetEnum('Yes,No'), "sql"=>"test_mode", "default_value"=>'No', "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("verbose_mode", array("allowed_values"=>new ValueSetEnum('Yes,No'), "sql"=>"verbose_mode", "default_value" => 'No', "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("options", array("allowed_values"=>new ValueSetEnum('Full, Update Only, Creation Only'), "sql"=>"options", "default_value"=> 'Full', "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("name", ["allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("category", ["allowed_values" => new ValueSetEnum('Input, Ouput'), "sql" => "category", "default_value" => "Input", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("source_type", ["allowed_values" => new ValueSetEnum('File, Database, Web Service'), "sql" => "source_type", "default_value" => "File", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("source_subtype", ["allowed_values" => new ValueSetEnum('Oracle, MySQL, Postgress, MSSQL, SOAP, HTTP-Get, HTTP-Post, XML/RPC, CSV, XML, Excel'), "sql" => "source_subtype", "default_value" => "CSV", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("source_path", ["allowed_values" => null, "sql" => "source_path", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeClass("objects_class", ["class_category" => "", "more_values" => "", "sql" => "objects_class", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("test_mode", ["allowed_values" => new ValueSetEnum('Yes,No'), "sql" => "test_mode", "default_value" => 'No', "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("verbose_mode", ["allowed_values" => new ValueSetEnum('Yes,No'), "sql" => "verbose_mode", "default_value" => 'No', "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("options", ["allowed_values" => new ValueSetEnum('Full, Update Only, Creation Only'), "sql" => "options", "default_value" => 'Full', "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('name', 'description', 'category', 'objects_class', 'source_type', 'source_subtype', 'source_path' , 'options', 'test_mode', 'verbose_mode')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('description', 'category', 'objects_class', 'source_type', 'source_subtype', 'options')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['name', 'description', 'category', 'objects_class', 'source_type', 'source_subtype', 'source_path' , 'options', 'test_mode', 'verbose_mode']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['description', 'category', 'objects_class', 'source_type', 'source_subtype', 'options']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('name', 'category', 'objects_class', 'source_type', 'source_subtype')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('name', 'description', 'category', 'objects_class', 'source_type', 'source_subtype')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['name', 'category', 'objects_class', 'source_type', 'source_subtype']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['name', 'description', 'category', 'objects_class', 'source_type', 'source_subtype']); // Criteria of the advanced search form } } -?> diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php index d657f0562..d05f2f1e4 100644 --- a/application/itopwebpage.class.inc.php +++ b/application/itopwebpage.class.inc.php @@ -1,4 +1,5 @@ GetAuthUserAndPassword(); Session::Set('login_temp_auth_user', $sAuthUser); } return LoginWebPage::LOGIN_FSM_CONTINUE; } - protected function OnCheckCredentials(&$iErrorCode) { - if (Session::Get('login_mode') == 'basic') - { + if (Session::Get('login_mode') == 'basic') { list($sAuthUser, $sAuthPwd) = $this->GetAuthUserAndPassword(); - if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, Session::Get('login_mode'), 'internal')) - { + if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, Session::Get('login_mode'), 'internal')) { $iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS; return LoginWebPage::LOGIN_FSM_ERROR; } @@ -69,8 +59,7 @@ class LoginBasic extends AbstractLoginFSMExtension protected function OnCredentialsOK(&$iErrorCode) { - if (Session::Get('login_mode') == 'basic') - { + if (Session::Get('login_mode') == 'basic') { LoginWebPage::OnLoginSuccess(Session::Get('auth_user'), 'internal', Session::Get('login_mode')); } return LoginWebPage::LOGIN_FSM_CONTINUE; @@ -78,13 +67,11 @@ class LoginBasic extends AbstractLoginFSMExtension protected function OnError(&$iErrorCode) { - if (Session::Get('login_mode') == 'basic') - { - $iOnExit = LoginWebPage::getIOnExit(); - if ($iOnExit === LoginWebPage::EXIT_RETURN) - { - return LoginWebPage::LOGIN_FSM_RETURN; // Error, exit FSM - } + if (Session::Get('login_mode') == 'basic') { + $iOnExit = LoginWebPage::getIOnExit(); + if ($iOnExit === LoginWebPage::EXIT_RETURN) { + return LoginWebPage::LOGIN_FSM_RETURN; // Error, exit FSM + } LoginWebPage::HTTP401Error(); } return LoginWebPage::LOGIN_FSM_CONTINUE; @@ -92,8 +79,7 @@ class LoginBasic extends AbstractLoginFSMExtension protected function OnConnected(&$iErrorCode) { - if (Session::Get('login_mode') == 'basic') - { + if (Session::Get('login_mode') == 'basic') { Session::Set('can_logoff', true); return LoginWebPage::CheckLoggedUser($iErrorCode); } @@ -105,42 +91,33 @@ class LoginBasic extends AbstractLoginFSMExtension $sAuthUser = ''; $sAuthPwd = null; $sAuthorization = ''; - if (isset($_SERVER['HTTP_AUTHORIZATION']) && !empty($_SERVER['HTTP_AUTHORIZATION'])) - { + if (isset($_SERVER['HTTP_AUTHORIZATION']) && !empty($_SERVER['HTTP_AUTHORIZATION'])) { $sAuthorization = $_SERVER['HTTP_AUTHORIZATION']; - } - elseif (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && !empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) - { + } elseif (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && !empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { $sAuthorization = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; } - if (!empty($sAuthorization)) - { + if (!empty($sAuthorization)) { list($sAuthUser, $sAuthPwd) = explode(':', base64_decode(substr($sAuthorization, 6))); - } - else - { - if (isset($_SERVER['PHP_AUTH_USER'])) - { + } else { + if (isset($_SERVER['PHP_AUTH_USER'])) { $sAuthUser = $_SERVER['PHP_AUTH_USER']; // Unfortunately, the RFC is not clear about the encoding... // IE and FF supply the user and password encoded in ISO-8859-1 whereas Chrome provides them encoded in UTF-8 // So let's try to guess if it's an UTF-8 string or not... fortunately all encodings share the same ASCII base - if (!LoginWebPage::LooksLikeUTF8($sAuthUser)) - { + if (!LoginWebPage::LooksLikeUTF8($sAuthUser)) { // Does not look like and UTF-8 string, try to convert it from iso-8859-1 to UTF-8 // Supposed to be harmless in case of a plain ASCII string... $sAuthUser = iconv('iso-8859-1', 'utf-8', $sAuthUser); } $sAuthPwd = $_SERVER['PHP_AUTH_PW']; - if (!LoginWebPage::LooksLikeUTF8($sAuthPwd)) - { + if (!LoginWebPage::LooksLikeUTF8($sAuthPwd)) { // Does not look like and UTF-8 string, try to convert it from iso-8859-1 to UTF-8 // Supposed to be harmless in case of a plain ASCII string... $sAuthPwd = iconv('iso-8859-1', 'utf-8', $sAuthPwd); } } } - return array($sAuthUser, $sAuthPwd); + return [$sAuthUser, $sAuthPwd]; } } diff --git a/application/logindefault.class.inc.php b/application/logindefault.class.inc.php index c0bd7dc95..24b0ec24e 100644 --- a/application/logindefault.class.inc.php +++ b/application/logindefault.class.inc.php @@ -1,4 +1,5 @@ GetAllowedLoginTypes(); $sProposedLoginMode = utils::ReadParam('login_mode', ''); $index = array_search($sProposedLoginMode, $aAllowedLoginTypes); - if ($index !== false) - { + if ($index !== false) { // Force login mode Session::Set('login_mode', $sProposedLoginMode); - } - else - { + } else { Session::Unset('login_mode'); } return LoginWebPage::LOGIN_FSM_CONTINUE; @@ -49,8 +47,7 @@ class LoginDefaultBefore extends AbstractLoginFSMExtension $aAllowedLoginTypes = MetaModel::GetConfig()->GetAllowedLoginTypes(); $sProposedLoginMode = utils::ReadParam('login_mode', ''); $index = array_search($sProposedLoginMode, $aAllowedLoginTypes); - if ($index !== false) - { + if ($index !== false) { // Force login mode LoginWebPage::SetLoginModeAndReload($sProposedLoginMode); } else { @@ -69,8 +66,6 @@ class LoginDefaultBefore extends AbstractLoginFSMExtension */ class LoginDefaultAfter extends AbstractLoginFSMExtension implements iLogoutExtension { - - /** * Must be executed after the other login plugins * @@ -78,19 +73,16 @@ class LoginDefaultAfter extends AbstractLoginFSMExtension implements iLogoutExte */ public function ListSupportedLoginModes() { - return array('after'); + return ['after']; } protected function OnError(&$iErrorCode) { self::ResetLoginSession(); $iOnExit = LoginWebPage::getIOnExit(); - if ($iOnExit === LoginWebPage::EXIT_RETURN) - { + if ($iOnExit === LoginWebPage::EXIT_RETURN) { return LoginWebPage::LOGIN_FSM_RETURN; // Error, exit FSM - } - elseif ($iOnExit == LoginWebPage::EXIT_HTTP_401) - { + } elseif ($iOnExit == LoginWebPage::EXIT_HTTP_401) { LoginWebPage::HTTP401Error(); // Error, exit } // LoginWebPage::EXIT_PROMPT @@ -99,13 +91,12 @@ class LoginDefaultAfter extends AbstractLoginFSMExtension implements iLogoutExte protected function OnCredentialsOk(&$iErrorCode) { - if (!Session::IsSet('login_mode')) - { - // N°6358 - if EXIT_RETURN was asked, send an error - if (LoginWebPage::getIOnExit() === LoginWebPage::EXIT_RETURN) { - $iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS; - return LoginWebPage::LOGIN_FSM_ERROR; - } + if (!Session::IsSet('login_mode')) { + // N°6358 - if EXIT_RETURN was asked, send an error + if (LoginWebPage::getIOnExit() === LoginWebPage::EXIT_RETURN) { + $iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS; + return LoginWebPage::LOGIN_FSM_ERROR; + } // If no plugin validated the user, exit self::ResetLoginSession(); @@ -125,7 +116,7 @@ class LoginDefaultAfter extends AbstractLoginFSMExtension implements iLogoutExte protected function OnConnected(&$iErrorCode) { Session::Unset('login_temp_auth_user'); - if (is_null(UserRights::GetUserObject())){ + if (is_null(UserRights::GetUserObject())) { //N°7085 avoid infinite loop IssueLog::Error("No user logged in. exit"); exit(-1); @@ -137,10 +128,8 @@ class LoginDefaultAfter extends AbstractLoginFSMExtension implements iLogoutExte private static function ResetLoginSession() { LoginWebPage::ResetSession(); - foreach (Session::ListVariables() as $sKey) - { - if (utils::StartsWith($sKey, 'login_')) - { + foreach (Session::ListVariables() as $sKey) { + if (utils::StartsWith($sKey, 'login_')) { Session::Unset($sKey); } } diff --git a/application/loginexternal.class.inc.php b/application/loginexternal.class.inc.php index e4d1d2d03..d07869595 100644 --- a/application/loginexternal.class.inc.php +++ b/application/loginexternal.class.inc.php @@ -11,7 +11,6 @@ use Combodo\iTop\Application\Helper\Session; class LoginExternal extends AbstractLoginFSMExtension { - /** * Return the list of supported login modes for this plugin * @@ -19,16 +18,14 @@ class LoginExternal extends AbstractLoginFSMExtension */ public function ListSupportedLoginModes() { - return array('external'); + return ['external']; } protected function OnModeDetection(&$iErrorCode) { - if (!Session::IsSet('login_mode')) - { + if (!Session::IsSet('login_mode')) { $sAuthUser = $this->GetAuthUser(); - if ($sAuthUser && (strlen($sAuthUser) > 0)) - { + if ($sAuthUser && (strlen($sAuthUser) > 0)) { Session::Set('login_mode', 'external'); } } @@ -37,11 +34,9 @@ class LoginExternal extends AbstractLoginFSMExtension protected function OnCheckCredentials(&$iErrorCode) { - if (Session::Get('login_mode') == 'external') - { + if (Session::Get('login_mode') == 'external') { $sAuthUser = $this->GetAuthUser(); - if (!UserRights::CheckCredentials($sAuthUser, '', Session::Get('login_mode'), 'external')) - { + if (!UserRights::CheckCredentials($sAuthUser, '', Session::Get('login_mode'), 'external')) { $iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS; return LoginWebPage::LOGIN_FSM_ERROR; } @@ -52,8 +47,7 @@ class LoginExternal extends AbstractLoginFSMExtension protected function OnCredentialsOK(&$iErrorCode) { - if (Session::Get('login_mode') == 'external') - { + if (Session::Get('login_mode') == 'external') { LoginWebPage::OnLoginSuccess(Session::Get('auth_user'), 'external', Session::Get('login_mode')); } return LoginWebPage::LOGIN_FSM_CONTINUE; @@ -61,8 +55,7 @@ class LoginExternal extends AbstractLoginFSMExtension protected function OnConnected(&$iErrorCode) { - if (Session::Get('login_mode') == 'external') - { + if (Session::Get('login_mode') == 'external') { Session::Set('can_logoff', false); return LoginWebPage::CheckLoggedUser($iErrorCode); } @@ -71,13 +64,11 @@ class LoginExternal extends AbstractLoginFSMExtension protected function OnError(&$iErrorCode) { - if (Session::Get('login_mode') == 'external') - { - $iOnExit = LoginWebPage::getIOnExit(); - if ($iOnExit === LoginWebPage::EXIT_RETURN) - { - return LoginWebPage::LOGIN_FSM_RETURN; // Error, exit FSM - } + if (Session::Get('login_mode') == 'external') { + $iOnExit = LoginWebPage::getIOnExit(); + if ($iOnExit === LoginWebPage::EXIT_RETURN) { + return LoginWebPage::LOGIN_FSM_RETURN; // Error, exit FSM + } LoginWebPage::HTTP401Error(); } return LoginWebPage::LOGIN_FSM_CONTINUE; diff --git a/application/loginform.class.inc.php b/application/loginform.class.inc.php index e10a97af4..5fa94c0e7 100644 --- a/application/loginform.class.inc.php +++ b/application/loginform.class.inc.php @@ -23,7 +23,7 @@ class LoginForm extends AbstractLoginFSMExtension implements iLoginUIExtension */ public function ListSupportedLoginModes() { - return array('form'); + return ['form']; } /** @@ -34,19 +34,17 @@ class LoginForm extends AbstractLoginFSMExtension implements iLoginUIExtension if (!Session::IsSet('login_mode') || Session::Get('login_mode') == 'form') { $sAuthUser = utils::ReadPostedParam('auth_user', '', 'raw_data'); $sAuthPwd = utils::ReadPostedParam('auth_pwd', null, 'raw_data'); - if ($this->bForceFormOnError || empty($sAuthUser) || empty($sAuthPwd)) - { - if (array_key_exists('HTTP_X_COMBODO_AJAX', $_SERVER)) - { + if ($this->bForceFormOnError || empty($sAuthUser) || empty($sAuthPwd)) { + if (array_key_exists('HTTP_X_COMBODO_AJAX', $_SERVER)) { // X-Combodo-Ajax is a special header automatically added to all ajax requests // Let's reply that we're currently logged-out header('HTTP/1.0 401 Unauthorized'); exit; } - if (LoginWebPage::getIOnExit() === LoginWebPage::EXIT_RETURN) { - return LoginWebPage::LOGIN_FSM_CONTINUE; - } + if (LoginWebPage::getIOnExit() === LoginWebPage::EXIT_RETURN) { + return LoginWebPage::LOGIN_FSM_CONTINUE; + } // No credentials yet, display the form $oPage = LoginWebPage::NewLoginWebPage(); @@ -66,12 +64,10 @@ class LoginForm extends AbstractLoginFSMExtension implements iLoginUIExtension */ protected function OnCheckCredentials(&$iErrorCode) { - if (Session::Get('login_mode') == 'form') - { + if (Session::Get('login_mode') == 'form') { $sAuthUser = utils::ReadPostedParam('auth_user', '', 'raw_data'); $sAuthPwd = utils::ReadPostedParam('auth_pwd', null, 'raw_data'); - if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, Session::Get('login_mode'), 'internal')) - { + if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, Session::Get('login_mode'), 'internal')) { $iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS; return LoginWebPage::LOGIN_FSM_ERROR; } @@ -85,8 +81,7 @@ class LoginForm extends AbstractLoginFSMExtension implements iLoginUIExtension */ protected function OnCredentialsOK(&$iErrorCode) { - if (Session::Get('login_mode') == 'form') - { + if (Session::Get('login_mode') == 'form') { // Store 'auth_user' in session for further use LoginWebPage::OnLoginSuccess(Session::Get('auth_user'), 'internal', Session::Get('login_mode')); } @@ -98,8 +93,7 @@ class LoginForm extends AbstractLoginFSMExtension implements iLoginUIExtension */ protected function OnError(&$iErrorCode) { - if (Session::Get('login_mode') == 'form') - { + if (Session::Get('login_mode') == 'form') { $this->bForceFormOnError = true; } return LoginWebPage::LOGIN_FSM_CONTINUE; @@ -110,8 +104,7 @@ class LoginForm extends AbstractLoginFSMExtension implements iLoginUIExtension */ protected function OnConnected(&$iErrorCode) { - if (Session::Get('login_mode') == 'form') - { + if (Session::Get('login_mode') == 'form') { Session::Set('can_logoff', true); return LoginWebPage::CheckLoggedUser($iErrorCode); } @@ -131,24 +124,23 @@ class LoginForm extends AbstractLoginFSMExtension implements iLoginUIExtension $sAuthUser = utils::ReadParam('auth_user', '', true, 'raw_data'); $sAuthPwd = utils::ReadParam('suggest_pwd', '', true, 'raw_data'); - $aData = array( + $aData = [ 'sAuthUser' => $sAuthUser, 'sAuthPwd' => $sAuthPwd, - ); + ]; $oLoginContext->AddBlockExtension('login_input', new LoginBlockExtension('extensionblock/loginforminput.html.twig', $aData)); $oLoginContext->AddBlockExtension('login_submit', new LoginBlockExtension('extensionblock/loginformsubmit.html.twig')); $oLoginContext->AddBlockExtension('login_form_footer', new LoginBlockExtension('extensionblock/loginformfooter.html.twig')); $bEnableResetPassword = MetaModel::GetConfig()->Get('forgot_password'); $sResetPasswordUrl = MetaModel::GetConfig()->Get('forgot_password.url'); - if ($sResetPasswordUrl == '') - { - $sResetPasswordUrl = utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?loginop=forgot_pwd'; + if ($sResetPasswordUrl == '') { + $sResetPasswordUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?loginop=forgot_pwd'; } - $aData = array( + $aData = [ 'bEnableResetPassword' => $bEnableResetPassword, 'sResetPasswordUrl' => $sResetPasswordUrl, - ); + ]; $oLoginContext->AddBlockExtension('login_links', new LoginBlockExtension('extensionblock/loginformlinks.html.twig', $aData)); return $oLoginContext; diff --git a/application/logintwig.class.inc.php b/application/logintwig.class.inc.php index a172501dd..da111eb8e 100644 --- a/application/logintwig.class.inc.php +++ b/application/logintwig.class.inc.php @@ -6,7 +6,6 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - use Combodo\iTop\Application\Branding; use Combodo\iTop\Application\TwigBase\Twig\Extension; use Combodo\iTop\Application\WebPage\NiceWebPage; @@ -41,11 +40,11 @@ class LoginTwigContext */ public function __construct() { - $this->aBlockExtension = array(); - $this->aPostedVars = array(); + $this->aBlockExtension = []; + $this->aPostedVars = []; $this->sTwigLoaderPath = null; - $this->aCSSFiles = array(); - $this->aJsFiles = array(); + $this->aCSSFiles = []; + $this->aJsFiles = []; $this->sTwigNameSpace = null; } @@ -179,7 +178,7 @@ class LoginBlockExtension * @param array $aData Data given to the twig template (into the variable {{ aData }}) * @api */ - public function __construct($sTwig, $aData = array()) + public function __construct($sTwig, $aData = []) { $this->sTwig = $sTwig; $this->aData = $aData; @@ -210,21 +209,18 @@ class LoginTwigRenderer public function __construct() { $this->aLoginPluginList = LoginWebPage::GetLoginPluginList('iLoginUIExtension', false); - $this->aPluginFormData = array(); - $aTwigLoaders = array(); - $this->aPostedVars = array(); - foreach ($this->aLoginPluginList as $oLoginPlugin) - { + $this->aPluginFormData = []; + $aTwigLoaders = []; + $this->aPostedVars = []; + foreach ($this->aLoginPluginList as $oLoginPlugin) { /** @var \iLoginUIExtension $oLoginPlugin */ $oLoginContext = $oLoginPlugin->GetTwigContext(); - if (is_null($oLoginContext)) - { + if (is_null($oLoginContext)) { continue; } $this->aPluginFormData[] = $oLoginContext; $sTwigLoaderPath = $oLoginContext->GetTwigLoaderPath(); - if ($sTwigLoaderPath != null) - { + if ($sTwigLoaderPath != null) { $oExtensionLoader = new FilesystemLoader(); $oExtensionLoader->setPaths($sTwigLoaderPath); $aTwigLoaders[] = $oExtensionLoader; @@ -232,8 +228,8 @@ class LoginTwigRenderer $this->aPostedVars = array_merge($this->aPostedVars, $oLoginContext->GetPostedVars()); } - $oCoreLoader = new FilesystemLoader(array(), APPROOT.'templates'); - $aCoreTemplatesPaths = array('pages/login', 'pages/login/password'); + $oCoreLoader = new FilesystemLoader([], APPROOT.'templates'); + $aCoreTemplatesPaths = ['pages/login', 'pages/login/password']; // Having this path declared after the plugins let the plugins replace the core templates $oCoreLoader->setPaths($aCoreTemplatesPaths); // Having the core templates accessible within a different namespace offer the possibility to extend them while replacing them @@ -251,19 +247,19 @@ class LoginTwigRenderer $sIconUrl = Utils::GetConfig()->Get('app_icon_url'); $sDisplayIcon = Branding::GetLoginLogoAbsoluteUrl(); - $aVars = array( + $aVars = [ 'sAppRootUrl' => utils::GetAbsoluteUrlAppRoot(), 'aPluginFormData' => $this->GetPluginFormData(), 'sItopVersion' => ITOP_VERSION, 'sVersionShort' => $sVersionShort, 'sIconUrl' => $sIconUrl, 'sDisplayIcon' => $sDisplayIcon, - ); + ]; return $aVars; } - public function Render(NiceWebPage $oPage, $sTwigFile, $aVars = array()) + public function Render(NiceWebPage $oPage, $sTwigFile, $aVars = []) { $oTemplate = $this->GetTwig()->load($sTwigFile); $oPage->add($oTemplate->renderBlock('body', $aVars)); @@ -272,17 +268,14 @@ class LoginTwigRenderer $oPage->add_style($oTemplate->renderBlock('css', $aVars)); // Render CSS links - foreach ($this->aPluginFormData as $oFormData) - { + foreach ($this->aPluginFormData as $oFormData) { /** @var \LoginTwigContext $oFormData */ $aCSSFiles = $oFormData->GetCSSFiles(); - foreach ($aCSSFiles as $sCSSFile) - { + foreach ($aCSSFiles as $sCSSFile) { $oPage->LinkStylesheetFromURI($sCSSFile); } $aJsFiles = $oFormData->GetJsFiles(); - foreach ($aJsFiles as $sJsFile) - { + foreach ($aJsFiles as $sJsFile) { $oPage->LinkScriptFromURI($sJsFile); } diff --git a/application/loginurl.class.inc.php b/application/loginurl.class.inc.php index 616f88af4..8e4f66d53 100644 --- a/application/loginurl.class.inc.php +++ b/application/loginurl.class.inc.php @@ -23,17 +23,15 @@ class LoginURL extends AbstractLoginFSMExtension */ public function ListSupportedLoginModes() { - return array('url'); + return ['url']; } protected function OnModeDetection(&$iErrorCode) { - if (!Session::IsSet('login_mode') && !$this->bErrorOccurred) - { + if (!Session::IsSet('login_mode') && !$this->bErrorOccurred) { $sAuthUser = utils::ReadParam('auth_user', '', false, 'raw_data'); $sAuthPwd = utils::ReadParam('auth_pwd', null, false, 'raw_data'); - if (!empty($sAuthUser) && !empty($sAuthPwd)) - { + if (!empty($sAuthUser) && !empty($sAuthPwd)) { Session::Set('login_mode', 'url'); } } @@ -42,8 +40,7 @@ class LoginURL extends AbstractLoginFSMExtension protected function OnReadCredentials(&$iErrorCode) { - if (Session::Get('login_mode') == 'url') - { + if (Session::Get('login_mode') == 'url') { Session::Set('login_temp_auth_user', utils::ReadParam('auth_user', '', false, 'raw_data')); } return LoginWebPage::LOGIN_FSM_CONTINUE; @@ -51,12 +48,10 @@ class LoginURL extends AbstractLoginFSMExtension protected function OnCheckCredentials(&$iErrorCode) { - if (Session::Get('login_mode') == 'url') - { + if (Session::Get('login_mode') == 'url') { $sAuthUser = utils::ReadParam('auth_user', '', false, 'raw_data'); $sAuthPwd = utils::ReadParam('auth_pwd', null, false, 'raw_data'); - if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, Session::Get('login_mode'), 'internal')) - { + if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, Session::Get('login_mode'), 'internal')) { $iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS; return LoginWebPage::LOGIN_FSM_ERROR; } @@ -67,8 +62,7 @@ class LoginURL extends AbstractLoginFSMExtension protected function OnCredentialsOK(&$iErrorCode) { - if (Session::Get('login_mode') == 'url') - { + if (Session::Get('login_mode') == 'url') { LoginWebPage::OnLoginSuccess(Session::Get('auth_user'), 'internal', Session::Get('login_mode')); } return LoginWebPage::LOGIN_FSM_CONTINUE; @@ -76,8 +70,7 @@ class LoginURL extends AbstractLoginFSMExtension protected function OnError(&$iErrorCode) { - if (Session::Get('login_mode') == 'url') - { + if (Session::Get('login_mode') == 'url') { $this->bErrorOccurred = true; } return LoginWebPage::LOGIN_FSM_CONTINUE; @@ -85,8 +78,7 @@ class LoginURL extends AbstractLoginFSMExtension protected function OnConnected(&$iErrorCode) { - if (Session::Get('login_mode') == 'url') - { + if (Session::Get('login_mode') == 'url') { Session::Set('can_logoff', true); return LoginWebPage::CheckLoggedUser($iErrorCode); } diff --git a/application/loginwebpage.class.inc.php b/application/loginwebpage.class.inc.php index e047cf761..d5cf26b31 100644 --- a/application/loginwebpage.class.inc.php +++ b/application/loginwebpage.class.inc.php @@ -1,9 +1,10 @@ - /** * Class LoginWebPage * @@ -37,33 +37,33 @@ use Combodo\iTop\Service\Events\EventService; class LoginWebPage extends NiceWebPage { - const EXIT_PROMPT = 0; - const EXIT_HTTP_401 = 1; - const EXIT_RETURN = 2; - - const EXIT_CODE_OK = 0; - const EXIT_CODE_MISSINGLOGIN = 1; - const EXIT_CODE_MISSINGPASSWORD = 2; - const EXIT_CODE_WRONGCREDENTIALS = 3; - const EXIT_CODE_MUSTBEADMIN = 4; - const EXIT_CODE_PORTALUSERNOTAUTHORIZED = 5; - const EXIT_CODE_NOTAUTHORIZED = 6; + public const EXIT_PROMPT = 0; + public const EXIT_HTTP_401 = 1; + public const EXIT_RETURN = 2; + + public const EXIT_CODE_OK = 0; + public const EXIT_CODE_MISSINGLOGIN = 1; + public const EXIT_CODE_MISSINGPASSWORD = 2; + public const EXIT_CODE_WRONGCREDENTIALS = 3; + public const EXIT_CODE_MUSTBEADMIN = 4; + public const EXIT_CODE_PORTALUSERNOTAUTHORIZED = 5; + public const EXIT_CODE_NOTAUTHORIZED = 6; // Login FSM States - const LOGIN_STATE_START = 'start'; // Entry state - const LOGIN_STATE_MODE_DETECTION = 'login mode detection'; // Detect which login plugin to use - const LOGIN_STATE_READ_CREDENTIALS = 'read credentials'; // Read the credentials - const LOGIN_STATE_CHECK_CREDENTIALS = 'check credentials'; // Check if the credentials are valid - const LOGIN_STATE_CREDENTIALS_OK = 'credentials ok'; // User provisioning - const LOGIN_STATE_USER_OK = 'user ok'; // Additional check (2FA) - const LOGIN_STATE_CONNECTED = 'connected'; // User connected - const LOGIN_STATE_SET_ERROR = 'prepare for error'; // Internal state to trigger ERROR state - const LOGIN_STATE_ERROR = 'error'; // An error occurred, next state will be NONE + public const LOGIN_STATE_START = 'start'; // Entry state + public const LOGIN_STATE_MODE_DETECTION = 'login mode detection'; // Detect which login plugin to use + public const LOGIN_STATE_READ_CREDENTIALS = 'read credentials'; // Read the credentials + public const LOGIN_STATE_CHECK_CREDENTIALS = 'check credentials'; // Check if the credentials are valid + public const LOGIN_STATE_CREDENTIALS_OK = 'credentials ok'; // User provisioning + public const LOGIN_STATE_USER_OK = 'user ok'; // Additional check (2FA) + public const LOGIN_STATE_CONNECTED = 'connected'; // User connected + public const LOGIN_STATE_SET_ERROR = 'prepare for error'; // Internal state to trigger ERROR state + public const LOGIN_STATE_ERROR = 'error'; // An error occurred, next state will be NONE // Login FSM Returns - const LOGIN_FSM_RETURN = 0; // End the FSM OK (connected) - const LOGIN_FSM_ERROR = 1; // Error signaled - const LOGIN_FSM_CONTINUE = 2; // Continue FSM + public const LOGIN_FSM_RETURN = 0; // End the FSM OK (connected) + public const LOGIN_FSM_ERROR = 1; // Error signaled + public const LOGIN_FSM_CONTINUE = 2; // Continue FSM protected static $sHandlerClass = __class__; private static $iOnExit; @@ -78,7 +78,7 @@ class LoginWebPage extends NiceWebPage */ public static function NewLoginWebPage() { - return new self::$sHandlerClass; + return new self::$sHandlerClass(); } protected static $m_sLoginFailedMessage = ''; @@ -94,7 +94,7 @@ class LoginWebPage extends NiceWebPage $this->no_cache(); $this->add_http_headers(); } - + public function SetStyleSheet() { $this->LinkStylesheetFromAppRoot('css/login.css'); @@ -128,23 +128,18 @@ class LoginWebPage extends NiceWebPage $oProfilesSet = $oUser->Get('profile_list'); //delete old profiles $aExistingProfiles = []; - while ($oProfile = $oProfilesSet->Fetch()) - { + while ($oProfile = $oProfilesSet->Fetch()) { array_push($aExistingProfiles, $oProfile->Get('profileid')); $iArrayKey = array_search($oProfile->Get('profileid'), $aProfiles); - if (!$iArrayKey) - { + if (!$iArrayKey) { $oProfilesSet->RemoveItem($oProfile->Get('profileid')); - } - else - { + } else { unset($aProfiles[$iArrayKey]); } } //add profiles not already linked with user - foreach ($aProfiles as $iProfileId) - { - $oProfilesSet->AddItem(MetaModel::NewObject('URP_UserProfile', array('profileid' => $iProfileId, 'reason' => $sOrigin))); + foreach ($aProfiles as $iProfileId) { + $oProfilesSet->AddItem(MetaModel::NewObject('URP_UserProfile', ['profileid' => $iProfileId, 'reason' => $sOrigin])); } $oUser->Set('profile_list', $oProfilesSet); } @@ -154,56 +149,49 @@ class LoginWebPage extends NiceWebPage $sVersionShort = Dict::Format('UI:iTopVersion:Short', ITOP_APPLICATION, ITOP_VERSION); $sIconUrl = Utils::GetConfig()->Get('app_icon_url'); $sDisplayIcon = Branding::GetLoginLogoAbsoluteUrl(); - $this->add("
    \n"); + $this->add("
    \n"); } public function DisplayLoginForm($bFailedLogin = false) { $oTwigContext = new LoginTwigRenderer(); - $aPostedVars = array_merge(array('login_mode', 'loginop'), $oTwigContext->GetPostedVars()); + $aPostedVars = array_merge(['login_mode', 'loginop'], $oTwigContext->GetPostedVars()); $sMessage = Dict::S('UI:Login:IdentifyYourself'); // Error message - if ($bFailedLogin) - { - if (self::$m_sLoginFailedMessage != '') - { + if ($bFailedLogin) { + if (self::$m_sLoginFailedMessage != '') { $sMessage = self::$m_sLoginFailedMessage; - } - else - { + } else { $sMessage = Dict::S('UI:Login:IncorrectLoginPassword'); } } // Keep the OTHER parameters posted - $aPreviousPostedVars = array(); - foreach($_POST as $sPostedKey => $postedValue) - { - if (!in_array($sPostedKey, $aPostedVars)) - { - if (is_array($postedValue)) - { - foreach($postedValue as $sKey => $sValue) - { + $aPreviousPostedVars = []; + foreach ($_POST as $sPostedKey => $postedValue) { + if (!in_array($sPostedKey, $aPostedVars)) { + if (is_array($postedValue)) { + foreach ($postedValue as $sKey => $sValue) { $sName = "{$sPostedKey}[{$sKey}]"; $aPreviousPostedVars[$sName] = $sValue; } - } - else - { + } else { $aPreviousPostedVars[$sPostedKey] = $postedValue; } } } - $aVars = array( + $aVars = [ 'bFailedLogin' => $bFailedLogin, 'sMessage' => $sMessage, 'aPreviousPostedVars' => $aPreviousPostedVars, - ); + ]; $aVars = array_merge($aVars, $oTwigContext->GetDefaultVars()); $oTwigContext->Render($this, 'login.html.twig', $aVars); @@ -226,26 +214,21 @@ class LoginWebPage extends NiceWebPage { $sAuthUser = utils::ReadParam('auth_user', '', true, 'raw_data'); - try - { + try { UserRights::Login($sAuthUser); // Set the user's language (if possible!) - /** @var UserInternal $oUser */ - $oUser = UserRights::GetUserObject(); + /** @var UserInternal $oUser */ + $oUser = UserRights::GetUserObject(); - if ($oUser != null) - { - if (!MetaModel::IsValidAttCode(get_class($oUser), 'reset_pwd_token')) - { + if ($oUser != null) { + if (!MetaModel::IsValidAttCode(get_class($oUser), 'reset_pwd_token')) { throw new Exception(Dict::S('UI:ResetPwd-Error-NotPossible')); } - if (!$oUser->CanChangePassword()) - { + if (!$oUser->CanChangePassword()) { throw new Exception(Dict::S('UI:ResetPwd-Error-FixedPwd')); } $sTo = $oUser->GetResetPasswordEmail(); // throws Exceptions if not allowed - if ($sTo == '') - { + if ($sTo == '') { throw new Exception(Dict::S('UI:ResetPwd-Error-NoEmail')); } @@ -265,8 +248,7 @@ class LoginWebPage extends NiceWebPage $sResetUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?loginop=reset_pwd&auth_user='.urlencode($oUser->Get('login')).'&token='.urlencode($sToken); $oEmail->SetBody(Dict::Format('UI:ResetPwd-EmailBody', $sResetUrl, $oUser->Get('login'))); $iRes = $oEmail->Send($aIssues, true /* force synchronous exec */); - switch ($iRes) - { + switch ($iRes) { //case EMAIL_SEND_PENDING: case EMAIL_SEND_OK: break; @@ -278,13 +260,10 @@ class LoginWebPage extends NiceWebPage } } - $oTwigContext = new LoginTwigRenderer(); $aVars = $oTwigContext->GetDefaultVars(); $oTwigContext->Render($this, 'forgotpwdsent.html.twig', $aVars); - } - catch(Exception $e) - { + } catch (Exception $e) { $this->DisplayForgotPwdForm(true, $e->getMessage()); } } @@ -304,22 +283,16 @@ class LoginWebPage extends NiceWebPage $aVars['sToken'] = $sToken; $aVars['sErrorMessage'] = $sErrorMessage; - if (($oUser == null)) - { + if (($oUser == null)) { $aVars['bNoUser'] = true; - } - else - { + } else { $aVars['bNoUser'] = false; $aVars['sUserName'] = $oUser->GetFriendlyName(); $oEncryptedToken = $oUser->Get('reset_pwd_token'); - if (!$oEncryptedToken->CheckPassword($sToken)) - { + if (!$oEncryptedToken->CheckPassword($sToken)) { $aVars['bBadToken'] = true; - } - else - { + } else { $aVars['bBadToken'] = false; } } @@ -342,21 +315,15 @@ class LoginWebPage extends NiceWebPage $aVars['sAuthUser'] = $sAuthUser; $aVars['sToken'] = $sToken; - if (($oUser == null)) - { + if (($oUser == null)) { $aVars['bNoUser'] = true; - } - else - { + } else { $aVars['bNoUser'] = false; $oEncryptedToken = $oUser->Get('reset_pwd_token'); - if (!$oEncryptedToken->CheckPassword($sToken)) - { + if (!$oEncryptedToken->CheckPassword($sToken)) { $aVars['bBadToken'] = true; - } - else - { + } else { $aVars['bBadToken'] = false; // Trash the token and change the password $oUser->Set('reset_pwd_token', new ormPassword()); @@ -413,7 +380,7 @@ class LoginWebPage extends NiceWebPage // Note: This will destroy the session, and not just the session data! } - static function SecureConnectionRequired() + public static function SecureConnectionRequired() { return MetaModel::GetConfig()->GetSecureConnectionRequired(); } @@ -423,7 +390,7 @@ class LoginWebPage extends NiceWebPage * @param string $sString * @return bool True if the string contains some typical UTF-8 multi-byte sequences */ - static function LooksLikeUTF8($sString) + public static function LooksLikeUTF8($sString) { return preg_match('%(?: [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte @@ -446,22 +413,19 @@ class LoginWebPage extends NiceWebPage protected static function Login($iOnExit) { self::$iOnExit = $iOnExit; - if (self::SecureConnectionRequired() && !utils::IsConnectionSecure()) - { + if (self::SecureConnectionRequired() && !utils::IsConnectionSecure()) { // Non secured URL... request for a secure connection throw new Exception('Secure connection required!'); } $bLoginDebug = MetaModel::GetConfig()->Get('login_debug'); - if (Session::Get('login_state') == self::LOGIN_STATE_ERROR) - { + if (Session::Get('login_state') == self::LOGIN_STATE_ERROR) { Session::Set('login_state', self::LOGIN_STATE_START); } $sLoginState = Session::Get('login_state'); $sSessionLog = ''; - if ($bLoginDebug) - { + if ($bLoginDebug) { IssueLog::Info("---------------------------------"); IssueLog::Info($_SERVER['REQUEST_URI']); IssueLog::Info("--> Entering Login FSM with state: [$sLoginState]"); @@ -472,38 +436,30 @@ class LoginWebPage extends NiceWebPage $iErrorCode = self::EXIT_CODE_OK; // Finite state machine loop - while (true) - { - try - { + while (true) { + try { $aLoginPlugins = self::GetLoginPluginList(); - if (empty($aLoginPlugins)) - { + if (empty($aLoginPlugins)) { throw new Exception("Missing login classes"); } /** @var iLoginFSMExtension $oLoginFSMExtensionInstance */ - foreach ($aLoginPlugins as $oLoginFSMExtensionInstance) - { - if ($bLoginDebug) - { + foreach ($aLoginPlugins as $oLoginFSMExtensionInstance) { + if ($bLoginDebug) { $sCurrSessionLog = session_id().' '.utils::GetSessionLog(); - if ($sCurrSessionLog != $sSessionLog) - { + if ($sCurrSessionLog != $sSessionLog) { $sSessionLog = $sCurrSessionLog; IssueLog::Info("SESSION: $sSessionLog"); } IssueLog::Info("Login: state: [$sLoginState] call: ".get_class($oLoginFSMExtensionInstance)); } $iResponse = $oLoginFSMExtensionInstance->LoginAction($sLoginState, $iErrorCode); - if ($iResponse == self::LOGIN_FSM_RETURN) - { + if ($iResponse == self::LOGIN_FSM_RETURN) { EventService::FireEvent(new EventData(EVENT_LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState])); Session::WriteClose(); return $iErrorCode; // Asked to exit FSM, generally login OK } - if ($iResponse == self::LOGIN_FSM_ERROR) - { + if ($iResponse == self::LOGIN_FSM_ERROR) { EventService::FireEvent(new EventData(EVENT_LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState])); $sLoginState = self::LOGIN_STATE_SET_ERROR; // Next state will be error // An error was detected, skip the other plugins turn @@ -515,9 +471,7 @@ class LoginWebPage extends NiceWebPage // Every plugin has nothing else to do in this state, go forward $sLoginState = self::AdvanceLoginFSMState($sLoginState); Session::Set('login_state', $sLoginState); - } - catch (Exception $e) - { + } catch (Exception $e) { EventService::FireEvent(new EventData(EVENT_LOGIN, null, ['state' => $_SESSION['login_state']])); IssueLog::Error($e->getTraceAsString()); static::ResetSession(); @@ -537,30 +491,23 @@ class LoginWebPage extends NiceWebPage */ public static function GetLoginPluginList($sInterface = 'iLoginFSMExtension', $bFilterWithMode = true) { - $aAllPlugins = array(); + $aAllPlugins = []; - if ($bFilterWithMode) - { + if ($bFilterWithMode) { $sCurrentLoginMode = Session::Get('login_mode', ''); - } - else - { + } else { $sCurrentLoginMode = ''; } /** @var iLoginExtension $oLoginExtensionInstance */ - foreach (MetaModel::EnumPlugins($sInterface) as $oLoginExtensionInstance) - { + foreach (MetaModel::EnumPlugins($sInterface) as $oLoginExtensionInstance) { $aLoginModes = $oLoginExtensionInstance->ListSupportedLoginModes(); - $aLoginModes = (is_array($aLoginModes) ? $aLoginModes : array()); - foreach ($aLoginModes as $sLoginMode) - { + $aLoginModes = (is_array($aLoginModes) ? $aLoginModes : []); + foreach ($aLoginModes as $sLoginMode) { // Keep only the plugins for the current login mode + before + after - if (empty($sCurrentLoginMode) || ($sLoginMode == $sCurrentLoginMode) || ($sLoginMode == 'before') || ($sLoginMode == 'after')) - { - if (!isset($aAllPlugins[$sLoginMode])) - { - $aAllPlugins[$sLoginMode] = array(); + if (empty($sCurrentLoginMode) || ($sLoginMode == $sCurrentLoginMode) || ($sLoginMode == 'before') || ($sLoginMode == 'after')) { + if (!isset($aAllPlugins[$sLoginMode])) { + $aAllPlugins[$sLoginMode] = []; } $aAllPlugins[$sLoginMode][] = $oLoginExtensionInstance; break; // Stop here to avoid registering a plugin twice @@ -569,12 +516,10 @@ class LoginWebPage extends NiceWebPage } // Order and filter by the config list of allowed types (allowed_login_types) - $aAllowedLoginModes = array_merge(array('before'), MetaModel::GetConfig()->GetAllowedLoginTypes(), array('after')); - $aPlugins = array(); - foreach ($aAllowedLoginModes as $sAllowedMode) - { - if (isset($aAllPlugins[$sAllowedMode])) - { + $aAllowedLoginModes = array_merge(['before'], MetaModel::GetConfig()->GetAllowedLoginTypes(), ['after']); + $aPlugins = []; + foreach ($aAllowedLoginModes as $sAllowedMode) { + if (isset($aAllPlugins[$sAllowedMode])) { $aPlugins = array_merge($aPlugins, $aAllPlugins[$sAllowedMode]); } } @@ -590,8 +535,7 @@ class LoginWebPage extends NiceWebPage */ private static function AdvanceLoginFSMState($sLoginState) { - switch ($sLoginState) - { + switch ($sLoginState) { case self::LOGIN_STATE_START: return self::LOGIN_STATE_MODE_DETECTION; @@ -638,8 +582,7 @@ class LoginWebPage extends NiceWebPage public static function CheckUser($sAuthUser, $sAuthPassword = '', $sAuthentication = 'external') { $oUser = self::FindUser($sAuthUser, true, ucfirst(strtolower($sAuthentication))); - if (is_null($oUser)) - { + if (is_null($oUser)) { return false; } @@ -668,8 +611,7 @@ class LoginWebPage extends NiceWebPage { // User is Ok, let's save it in the session and proceed with normal login $bLoginSuccess = UserRights::Login($sAuthUser, $sAuthentication); // Login & set the user's language - if (!$bLoginSuccess) - { + if (!$bLoginSuccess) { throw new Exception("Bad user"); } if (MetaModel::GetConfig()->Get('log_usage')) { @@ -696,12 +638,10 @@ class LoginWebPage extends NiceWebPage */ public static function CheckLoggedUser(&$iErrorCode) { - if (Session::IsSet('auth_user')) - { + if (Session::IsSet('auth_user')) { // Already authenticated $bRet = UserRights::Login(Session::Get('auth_user')); // Login & set the user's language - if ($bRet) - { + if ($bRet) { $iErrorCode = self::EXIT_CODE_OK; return self::LOGIN_FSM_RETURN; } @@ -727,8 +667,7 @@ class LoginWebPage extends NiceWebPage public static function SetLoginModeAndReload($sNewLoginMode) { - if (Session::Get('login_mode') == $sNewLoginMode) - { + if (Session::Get('login_mode') == $sNewLoginMode) { return; } Session::Set('login_mode', $sNewLoginMode); @@ -738,8 +677,7 @@ class LoginWebPage extends NiceWebPage public static function HTTPReload() { $sOriginURL = utils::GetCurrentAbsoluteUrl(); - if (!utils::StartsWith($sOriginURL, utils::GetAbsoluteUrlAppRoot())) - { + if (!utils::StartsWith($sOriginURL, utils::GetAbsoluteUrlAppRoot())) { // If the found URL does not start with the configured AppRoot URL $sOriginURL = utils::GetAbsoluteUrlAppRoot().'pages/UI.php'; } @@ -753,7 +691,6 @@ class LoginWebPage extends NiceWebPage exit; } - /** * Provisioning API: Find a User * @@ -767,33 +704,28 @@ class LoginWebPage extends NiceWebPage */ public static function FindUser($sAuthUser, $bMustBeValid = true, $sType = 'External') { - try - { - $aArgs = array('login' => $sAuthUser); + try { + $aArgs = ['login' => $sAuthUser]; $sUserClass = "User$sType"; $oSearch = DBObjectSearch::FromOQL("SELECT $sUserClass WHERE login = :login"); - if ($bMustBeValid) - { + if ($bMustBeValid) { $oSearch->AddCondition('status', 'enabled'); } - $oSet = new DBObjectSet($oSearch, array(), $aArgs); - if ($oSet->CountExceeds(0)) - { + $oSet = new DBObjectSet($oSearch, [], $aArgs); + if ($oSet->CountExceeds(0)) { /** @var User $oUser */ $oUser = $oSet->Fetch(); return $oUser; } - } - catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Error($e->getMessage()); } return null; } /** - * Provisioning API: Find a Person by email + * Provisioning API: Find a Person by email * * @api * @@ -805,19 +737,15 @@ class LoginWebPage extends NiceWebPage { /** @var \Person $oPerson */ $oPerson = null; - try - { + try { $oSearch = new DBObjectSearch('Person'); $oSearch->AddCondition('email', $sEmail); $oSet = new DBObjectSet($oSearch); - if ($oSet->CountExceeds(1)) - { + if ($oSet->CountExceeds(1)) { throw new Exception(Dict::S('UI:Login:Error:MultipleContactsHaveSameEmail')); } $oPerson = $oSet->Fetch(); - } - catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Error($e->getMessage()); } return $oPerson; @@ -836,16 +764,14 @@ class LoginWebPage extends NiceWebPage * * @return \Person */ - public static function ProvisionPerson($sFirstName, $sLastName, $sEmail, $sOrganization, $aAdditionalParams = array()) + public static function ProvisionPerson($sFirstName, $sLastName, $sEmail, $sOrganization, $aAdditionalParams = []) { /** @var Person $oPerson */ $oPerson = null; - try - { + try { CMDBObject::SetTrackOrigin('custom-extension'); $sInfo = 'External User provisioning'; - if (Session::IsSet('login_mode')) - { + if (Session::IsSet('login_mode')) { $sInfo .= " (".Session::Get('login_mode').")"; } CMDBObject::SetTrackInfo($sInfo); @@ -855,19 +781,15 @@ class LoginWebPage extends NiceWebPage $oPerson->Set('name', $sLastName); $oPerson->Set('email', $sEmail); $oOrg = MetaModel::GetObjectByName('Organization', $sOrganization, false); - if (is_null($oOrg)) - { + if (is_null($oOrg)) { throw new Exception(Dict::S('UI:Login:Error:WrongOrganizationName')); } $oPerson->Set('org_id', $oOrg->GetKey()); - foreach ($aAdditionalParams as $sAttCode => $sValue) - { + foreach ($aAdditionalParams as $sAttCode => $sValue) { $oPerson->Set($sAttCode, $sValue); } $oPerson->DBInsert(); - } - catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Error($e->getMessage()); } return $oPerson; @@ -886,27 +808,23 @@ class LoginWebPage extends NiceWebPage */ public static function ProvisionUser($sAuthUser, $oPerson, $aRequestedProfiles) { - if (!MetaModel::IsValidClass('URP_Profiles')) - { + if (!MetaModel::IsValidClass('URP_Profiles')) { IssueLog::Error("URP_Profiles is not a valid class. Automatic creation of Users is not supported in this context, sorry."); return null; } /** @var UserExternal $oUser */ $oUser = null; - try - { + try { CMDBObject::SetTrackOrigin('custom-extension'); $sInfo = 'External User provisioning'; - if (Session::IsSet('login_mode')) - { + if (Session::IsSet('login_mode')) { $sInfo .= " (".Session::Get('login_mode').")"; } CMDBObject::SetTrackInfo($sInfo); $oUser = MetaModel::GetObjectByName('UserExternal', $sAuthUser, false); - if (is_null($oUser)) - { + if (is_null($oUser)) { $oUser = MetaModel::NewObject('UserExternal'); $oUser->Set('login', $sAuthUser); $oUser->Set('contactid', $oPerson->GetKey()); @@ -916,41 +834,33 @@ class LoginWebPage extends NiceWebPage // read all the existing profiles $oProfilesSearch = new DBObjectSearch('URP_Profiles'); $oProfilesSet = new DBObjectSet($oProfilesSearch); - $aAllProfiles = array(); - while ($oProfile = $oProfilesSet->Fetch()) - { + $aAllProfiles = []; + while ($oProfile = $oProfilesSet->Fetch()) { $aAllProfiles[mb_strtolower($oProfile->GetName())] = $oProfile->GetKey(); } - $aProfiles = array(); - foreach ($aRequestedProfiles as $sRequestedProfile) - { + $aProfiles = []; + foreach ($aRequestedProfiles as $sRequestedProfile) { $sRequestedProfile = mb_strtolower($sRequestedProfile); - if (isset($aAllProfiles[$sRequestedProfile])) - { + if (isset($aAllProfiles[$sRequestedProfile])) { $aProfiles[] = $aAllProfiles[$sRequestedProfile]; } } - if (empty($aProfiles)) - { + if (empty($aProfiles)) { throw new Exception(Dict::S('UI:Login:Error:NoValidProfiles')); } // Now synchronize the profiles $sOrigin = 'External User provisioning'; - if (Session::IsSet('login_mode')) - { + if (Session::IsSet('login_mode')) { $sOrigin .= " (".Session::Get('login_mode').")"; } $aExistingProfiles = self::SynchronizeProfiles($oUser, $aProfiles, $sOrigin); - if ($oUser->IsModified()) - { + if ($oUser->IsModified()) { $oUser->DBWrite(); } - } - catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Error($e->getMessage()); } @@ -961,26 +871,18 @@ class LoginWebPage extends NiceWebPage * Overridable: depending on the user, head toward a dedicated portal * @param string|null $sRequestedPortalId * @param int $iOnExit How to complete the call: redirect or return a code - */ + */ protected static function ChangeLocation($sRequestedPortalId = null, $iOnExit = self::EXIT_PROMPT) { - $ret = call_user_func(array(self::$sHandlerClass, 'Dispatch'), $sRequestedPortalId); - if ($ret === true) - { + $ret = call_user_func([self::$sHandlerClass, 'Dispatch'], $sRequestedPortalId); + if ($ret === true) { return self::EXIT_CODE_OK; - } - else if($ret === false) - { + } elseif ($ret === false) { throw new Exception('Nowhere to go: Your combination of user Profiles denies you access to any '.ITOP_APPLICATION_SHORT.' portal. Please contact your administrator'); - } - else - { - if ($iOnExit == self::EXIT_RETURN) - { + } else { + if ($iOnExit == self::EXIT_RETURN) { return self::EXIT_CODE_PORTALUSERNOTAUTHORIZED; - } - else - { + } else { // No rights to be here, redirect to the portal header('Location: '.$ret); die(); @@ -1002,7 +904,7 @@ class LoginWebPage extends NiceWebPage * @return int|mixed|string * @throws \Exception */ - static function DoLogin($bMustBeAdmin = false, $bIsAllowedToPortalUsers = false, $iOnExit = self::EXIT_PROMPT) + public static function DoLogin($bMustBeAdmin = false, $bIsAllowedToPortalUsers = false, $iOnExit = self::EXIT_PROMPT) { $sRequestedPortalId = $bIsAllowedToPortalUsers ? 'legacy_portal' : 'backoffice'; return self::DoLoginEx($sRequestedPortalId, $bMustBeAdmin, $iOnExit); @@ -1019,23 +921,18 @@ class LoginWebPage extends NiceWebPage * @return int|mixed|string * @throws \Exception */ - static function DoLoginEx($sRequestedPortalId = null, $bMustBeAdmin = false, $iOnExit = self::EXIT_PROMPT) + public static function DoLoginEx($sRequestedPortalId = null, $bMustBeAdmin = false, $iOnExit = self::EXIT_PROMPT) { $operation = utils::ReadParam('loginop', ''); - + $sMessage = self::HandleOperations($operation); // May exit directly - + $iRet = self::Login($iOnExit); - if ($iRet == self::EXIT_CODE_OK) - { - if ($bMustBeAdmin && !UserRights::IsAdministrator()) - { - if ($iOnExit == self::EXIT_RETURN) - { + if ($iRet == self::EXIT_CODE_OK) { + if ($bMustBeAdmin && !UserRights::IsAdministrator()) { + if ($iOnExit == self::EXIT_RETURN) { return self::EXIT_CODE_MUSTBEADMIN; - } - else - { + } else { require_once(APPROOT.'/setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); $oP->add("

    ".Dict::S('UI:Login:Error:AccessAdmin')."

    \n"); @@ -1044,69 +941,52 @@ class LoginWebPage extends NiceWebPage exit; } } - $iRet = call_user_func(array(self::$sHandlerClass, 'ChangeLocation'), $sRequestedPortalId, $iOnExit); + $iRet = call_user_func([self::$sHandlerClass, 'ChangeLocation'], $sRequestedPortalId, $iOnExit); } - if ($iOnExit == self::EXIT_RETURN) - { + if ($iOnExit == self::EXIT_RETURN) { return $iRet; - } - else - { + } else { return $sMessage; } - } + } protected static function HandleOperations($operation) { $sMessage = ''; // most of the operations never return, but some can return a message to be displayed - if ($operation == 'logoff') - { + if ($operation == 'logoff') { self::ResetSession(); $oPage = self::NewLoginWebPage(); $oPage->DisplayLoginForm(false /* not a failed attempt */); $oPage->output(); exit; - } - else if ($operation == 'forgot_pwd') - { + } elseif ($operation == 'forgot_pwd') { $oPage = self::NewLoginWebPage(); $oPage->DisplayForgotPwdForm(); $oPage->output(); exit; - } - else if ($operation == 'forgot_pwd_go') - { + } elseif ($operation == 'forgot_pwd_go') { $oPage = self::NewLoginWebPage(); $oPage->ForgotPwdGo(); $oPage->output(); exit; - } - else if ($operation == 'reset_pwd') - { + } elseif ($operation == 'reset_pwd') { $oPage = self::NewLoginWebPage(); $oPage->DisplayResetPwdForm(); $oPage->output(); exit; - } - else if ($operation == 'do_reset_pwd') - { + } elseif ($operation == 'do_reset_pwd') { try { $oPage = self::NewLoginWebPage(); $oPage->DoResetPassword(); - } - catch (CoreCannotSaveObjectException $e) - { + } catch (CoreCannotSaveObjectException $e) { $oPage = self::NewLoginWebPage(); $oPage->DisplayResetPwdForm($e->getIssue()); } $oPage->output(); exit; - } - else if ($operation == 'change_pwd') - { - if (Session::IsSet('auth_user')) - { + } elseif ($operation == 'change_pwd') { + if (Session::IsSet('auth_user')) { $sAuthUser = Session::Get('auth_user'); $sIssue = Session::Get('pwd_issue'); Session::Unset('pwd_issue'); @@ -1118,16 +998,13 @@ class LoginWebPage extends NiceWebPage $oPage->output(); exit; } - } - else if ($operation == 'check_pwd_policy') - { + } elseif ($operation == 'check_pwd_policy') { $sAuthUser = Session::Get('auth_user'); UserRights::Login($sAuthUser); // Set the user's language - $aPwdMap = array(); + $aPwdMap = []; - foreach (array('new_pwd', 'retype_new_pwd') as $postedPwd) - { + foreach (['new_pwd', 'retype_new_pwd'] as $postedPwd) { $oUser = new UserLocal(); $oUser->ValidatePassword($_POST[$postedPwd]); @@ -1137,27 +1014,21 @@ class LoginWebPage extends NiceWebPage echo json_encode($aPwdMap); die(); } - if ($operation == 'do_change_pwd') - { - if (Session::IsSet('auth_user')) - { + if ($operation == 'do_change_pwd') { + if (Session::IsSet('auth_user')) { $sAuthUser = Session::Get('auth_user'); UserRights::Login($sAuthUser); // Set the user's language $sOldPwd = utils::ReadPostedParam('old_pwd', '', 'raw_data'); $sNewPwd = utils::ReadPostedParam('new_pwd', '', 'raw_data'); - try - { - if (UserRights::CanChangePassword() && ((!UserRights::CheckCredentials($sAuthUser, $sOldPwd)) || (!UserRights::ChangePassword($sOldPwd, $sNewPwd)))) - { + try { + if (UserRights::CanChangePassword() && ((!UserRights::CheckCredentials($sAuthUser, $sOldPwd)) || (!UserRights::ChangePassword($sOldPwd, $sNewPwd)))) { $oPage = self::NewLoginWebPage(); $oPage->DisplayChangePwdForm(true); // old pwd was wrong $oPage->output(); exit; } - } - catch (CoreCannotSaveObjectException $e) - { + } catch (CoreCannotSaveObjectException $e) { $oPage = self::NewLoginWebPage(); $oPage->DisplayChangePwdForm(true, $e->getIssue()); // password policy was not met. $oPage->output(); @@ -1168,26 +1039,27 @@ class LoginWebPage extends NiceWebPage } return $sMessage; } - + protected static function Dispatch($sRequestedPortalId) { - if ($sRequestedPortalId === null) return true; // allowed to any portal => return true - + if ($sRequestedPortalId === null) { + return true; + } // allowed to any portal => return true + $aPortalsConf = PortalDispatcherData::GetData(); - $aDispatchers = array(); - foreach($aPortalsConf as $sPortalId => $aConf) - { + $aDispatchers = []; + foreach ($aPortalsConf as $sPortalId => $aConf) { $sHandlerClass = $aConf['handler']; $aDispatchers[$sPortalId] = new $sHandlerClass($sPortalId); } - - if (array_key_exists($sRequestedPortalId, $aDispatchers) && $aDispatchers[$sRequestedPortalId]->IsUserAllowed()) - { + + if (array_key_exists($sRequestedPortalId, $aDispatchers) && $aDispatchers[$sRequestedPortalId]->IsUserAllowed()) { return true; } - foreach($aDispatchers as $sPortalId => $oDispatcher) - { - if ($oDispatcher->IsUserAllowed()) return $oDispatcher->GetUrl(); + foreach ($aDispatchers as $sPortalId => $oDispatcher) { + if ($oDispatcher->IsUserAllowed()) { + return $oDispatcher->GetUrl(); + } } return false; // nothing matched !! } diff --git a/application/maintenancemsg.php b/application/maintenancemsg.php index 8d9054042..ded478e2f 100644 --- a/application/maintenancemsg.php +++ b/application/maintenancemsg.php @@ -1,4 +1,5 @@ p("

    $sMessage

    "); $oP->add_ready_script( -<<output(); - } - else - { + } else { _MaintenanceTextMessage($sMessage); } } @@ -78,14 +74,13 @@ function _MaintenanceHtmlMessage($sMessage) */ function _MaintenanceJsonMessage($sTitle, $sMessage) { - if (class_exists('JsonPage')) - { + if (class_exists('JsonPage')) { $oP = new JsonPage($sTitle); $oP->add_header('Access-Control-Allow-Origin: *'); $aMessage = [ 'code' => 100, - 'message' =>$sMessage + 'message' => $sMessage, ]; $oP->AddData($aMessage); diff --git a/application/menunode.class.inc.php b/application/menunode.class.inc.php index 32a039e18..0071b5532 100644 --- a/application/menunode.class.inc.php +++ b/application/menunode.class.inc.php @@ -1,4 +1,5 @@ PopulateChildMenus(); } @@ -125,8 +122,7 @@ class ApplicationMenu */ public static function CheckMenuIdEnabled($sMenuId) { - if (self::IsMenuIdEnabled($sMenuId) === false) - { + if (self::IsMenuIdEnabled($sMenuId) === false) { require_once(APPROOT.'/setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); $oP->add("

    ".Dict::S('UI:Login:Error:AccessRestricted')."

    \n"); @@ -142,7 +138,7 @@ class ApplicationMenu * @return bool true if the menu exists and current user is allowed to see the menu * @since 3.2.0 */ - public static function IsMenuIdEnabled($sMenuId):bool + public static function IsMenuIdEnabled($sMenuId): bool { self::LoadAdditionalMenus(); $oMenuNode = self::GetMenuNode(self::GetMenuIndexById($sMenuId)); @@ -160,22 +156,18 @@ class ApplicationMenu public static function InsertMenu(MenuNode $oMenuNode, $iParentIndex, $fRank) { $index = self::GetMenuIndexById($oMenuNode->GetMenuId()); - if ($index == -1) - { + if ($index == -1) { // The menu does not already exist, insert it $index = count(self::$aMenusIndex); - if ($iParentIndex == -1) - { + if ($iParentIndex == -1) { $sParentId = ''; - self::$aRootMenus[] = array ('rank' => $fRank, 'index' => $index); - } - else - { + self::$aRootMenus[] = ['rank' => $fRank, 'index' => $index]; + } else { /** @var \MenuNode $oNode */ $oNode = self::$aMenusIndex[$iParentIndex]['node']; $sParentId = $oNode->GetMenuId(); - self::$aMenusIndex[$iParentIndex]['children'][] = array ('rank' => $fRank, 'index' => $index); + self::$aMenusIndex[$iParentIndex]['children'][] = ['rank' => $fRank, 'index' => $index]; } // Note: At the time when 'parent', 'rank' and 'source_file' have been added for the reflection API, @@ -183,11 +175,9 @@ class ApplicationMenu // $aBacktrace = debug_backtrace(); $sFile = isset($aBacktrace[2]["file"]) ? $aBacktrace[2]["file"] : $aBacktrace[1]["file"]; - self::$aMenusIndex[$index] = array('node' => $oMenuNode, 'children' => array(), 'parent' => $sParentId, 'rank' => $fRank, 'source_file' => $sFile); + self::$aMenusIndex[$index] = ['node' => $oMenuNode, 'children' => [], 'parent' => $sParentId, 'rank' => $fRank, 'source_file' => $sFile]; self::$aMenusById[$oMenuNode->GetMenuId()] = $index; - } - else - { + } else { // the menu already exists, let's combine the conditions that make it visible /** @var \MenuNode $oNode */ $oNode = self::$aMenusIndex[$index]['node']; @@ -217,7 +207,7 @@ class ApplicationMenu * @throws \DictExceptionMissingString * @since 3.0.0 */ - public static function GetMenusCount($aExtraParams = array()) + public static function GetMenusCount($aExtraParams = []) { $aMenuGroups = static::GetMenuGroups($aExtraParams); @@ -260,18 +250,16 @@ class ApplicationMenu * @throws \DictExceptionMissingString * @since 3.0.0 */ - public static function GetMenuGroups($aExtraParams = array()) + public static function GetMenuGroups($aExtraParams = []) { self::LoadAdditionalMenus(); // Sort the root menu based on the rank - usort(self::$aRootMenus, array('ApplicationMenu', 'CompareOnRank')); + usort(self::$aRootMenus, ['ApplicationMenu', 'CompareOnRank']); $aMenuGroups = []; - foreach(static::$aRootMenus as $aMenuGroup) - { - if(!static::CanDisplayMenu($aMenuGroup)) - { + foreach (static::$aRootMenus as $aMenuGroup) { + if (!static::CanDisplayMenu($aMenuGroup)) { continue; } @@ -322,26 +310,23 @@ class ApplicationMenu * @throws \Exception * @since 3.0.0 */ - public static function GetSubMenuNodes($sMenuGroupIdx, $aExtraParams = array()) + public static function GetSubMenuNodes($sMenuGroupIdx, $aExtraParams = []) { $aSubMenuItems = self::GetChildren($sMenuGroupIdx); // Sort the children based on the rank - usort($aSubMenuItems, array('ApplicationMenu', 'CompareOnRank')); + usort($aSubMenuItems, ['ApplicationMenu', 'CompareOnRank']); $aSubMenuNodes = []; - foreach($aSubMenuItems as $aSubMenuItem) - { - if(!static::CanDisplayMenu($aSubMenuItem)) - { + foreach ($aSubMenuItems as $aSubMenuItem) { + if (!static::CanDisplayMenu($aSubMenuItem)) { continue; } $sSubMenuItemIdx = $aSubMenuItem['index']; $oSubMenuNode = static::GetMenuNode($sSubMenuItemIdx); - if(!$oSubMenuNode->IsEnabled()) - { + if (!$oSubMenuNode->IsEnabled()) { continue; } @@ -372,7 +357,7 @@ class ApplicationMenu DeprecatedCallsLog::NotifyDeprecatedPhpMethod('use static::GetMenuGroups() instead'); self::LoadAdditionalMenus(); // Sort the root menu based on the rank - usort(self::$aRootMenus, array('ApplicationMenu', 'CompareOnRank')); + usort(self::$aRootMenus, ['ApplicationMenu', 'CompareOnRank']); $iAccordion = 0; $iActiveAccordion = $iAccordion; $iActiveMenu = self::GetMenuIndexById(self::GetActiveNodeId()); @@ -387,8 +372,7 @@ class ApplicationMenu $aChildren = self::GetChildren($aMenu['index']); $bActive = self::DisplaySubMenu($oPage, $aChildren, $aExtraParams, $iActiveMenu); $oPage->AddToMenu(''); - if ($bActive) - { + if ($bActive) { $iActiveAccordion = $iAccordion; } $oPage->AddToMenu('
    '); @@ -396,7 +380,7 @@ class ApplicationMenu } $oPage->add_ready_script( -<<IsEnabled()) - { + if ($oMenuNode->IsEnabled()) { $aChildren = self::GetChildren($aMenu['index']); - if (count($aChildren) > 0) - { - foreach($aChildren as $aSubMenu) - { - if (self::CanDisplayMenu($aSubMenu)) - { + if (count($aChildren) > 0) { + foreach ($aChildren as $aSubMenu) { + if (self::CanDisplayMenu($aSubMenu)) { return true; } } - } - else - { + } else { return true; } } @@ -450,46 +428,38 @@ EOF DeprecatedCallsLog::NotifyDeprecatedPhpMethod('use static::GetSubMenuNodes() instead'); // Sort the menu based on the rank $bActive = false; - usort($aMenus, array('ApplicationMenu', 'CompareOnRank')); + usort($aMenus, ['ApplicationMenu', 'CompareOnRank']); foreach ($aMenus as $aMenu) { if (!self::CanDisplayMenu($aMenu)) { continue; } $index = $aMenu['index']; $oMenu = self::GetMenuNode($index); - if ($oMenu->IsEnabled()) - { + if ($oMenu->IsEnabled()) { $aChildren = self::GetChildren($index); - $aCSSClasses = array('navigation-menu-item'); - if (count($aChildren) > 0) - { + $aCSSClasses = ['navigation-menu-item']; + if (count($aChildren) > 0) { $aCSSClasses[] = 'submenu'; } $sHyperlink = $oMenu->GetHyperlink($aExtraParams); $sItemHtml = '
  • '; - if ($sHyperlink != '') - { + if ($sHyperlink != '') { $sLinkTarget = ''; - if ($oMenu->IsHyperLinkInNewWindow()) - { + if ($oMenu->IsHyperLinkInNewWindow()) { $sLinkTarget .= ' target="_blank"'; } $sURL = '"'.$oMenu->GetHyperlink($aExtraParams).'"'.$sLinkTarget; $sTitle = utils::HtmlEntities($oMenu->GetTitle()); $sItemHtml .= "{$sTitle}"; - } - else - { + } else { $sItemHtml .= $oMenu->GetTitle(); } $sItemHtml .= '
  • '; $oPage->AddToMenu($sItemHtml); - if ($iActiveMenu == $index) - { + if ($iActiveMenu == $index) { $bActive = true; } - if (count($aChildren) > 0) - { + if (count($aChildren) > 0) { $oPage->AddToMenu('
      '); $bActive |= self::DisplaySubMenu($oPage, $aChildren, $aExtraParams, $iActiveMenu); $oPage->AddToMenu('
    '); @@ -508,12 +478,10 @@ EOF public static function CompareOnRank($a, $b) { $result = 1; - if ($a['rank'] == $b['rank']) - { + if ($a['rank'] == $b['rank']) { $result = 0; } - if ($a['rank'] < $b['rank']) - { + if ($a['rank'] < $b['rank']) { $result = -1; } return $result; @@ -561,8 +529,7 @@ EOF { $oAppContext = new ApplicationContext(); $sMenuId = $oAppContext->GetCurrentValue('menu', null); - if ($sMenuId === null) - { + if ($sMenuId === null) { $sMenuId = self::GetDefaultMenuId(); } return $sMenuId; @@ -574,13 +541,12 @@ EOF public static function GetDefaultMenuId() { static $sDefaultMenuId = null; - if (is_null($sDefaultMenuId)) - { + if (is_null($sDefaultMenuId)) { // Make sure the root menu is sorted on 'rank' - usort(self::$aRootMenus, array('ApplicationMenu', 'CompareOnRank')); + usort(self::$aRootMenus, ['ApplicationMenu', 'CompareOnRank']); $oFirstGroup = self::GetMenuNode(self::$aRootMenus[0]['index']); $aChildren = self::$aMenusIndex[$oFirstGroup->GetIndex()]['children']; - usort($aChildren, array('ApplicationMenu', 'CompareOnRank')); + usort($aChildren, ['ApplicationMenu', 'CompareOnRank']); $oMenuNode = self::GetMenuNode($aChildren[0]['index']); $sDefaultMenuId = $oMenuNode->GetMenuId(); } @@ -594,13 +560,11 @@ EOF public static function GetRootMenuId($sMenuId) { $iMenuIndex = self::GetMenuIndexById($sMenuId); - if ($iMenuIndex == -1) - { + if ($iMenuIndex == -1) { return ''; } $oMenu = ApplicationMenu::GetMenuNode($iMenuIndex); - while ($oMenu->GetParentIndex() != -1) - { + while ($oMenu->GetParentIndex() != -1) { $oMenu = ApplicationMenu::GetMenuNode($oMenu->GetParentIndex()); } return $oMenu->GetMenuId(); @@ -687,17 +651,17 @@ abstract class MenuNode { $this->sMenuId = $sMenuId; $this->iParentIndex = $iParentIndex; - $this->aReflectionProperties = array(); + $this->aReflectionProperties = []; if (utils::IsNotNullOrEmptyString($sEnableClass)) { $this->aReflectionProperties['enable_class'] = $sEnableClass; $this->aReflectionProperties['enable_action'] = $iActionCode; $this->aReflectionProperties['enable_permission'] = $iAllowedResults; $this->aReflectionProperties['enable_stimulus'] = $sEnableStimulus; } - $this->m_aEnableClasses = array($sEnableClass); - $this->m_aEnableActions = array($iActionCode); - $this->m_aEnableActionResults = array($iAllowedResults); - $this->m_aEnableStimuli = array($sEnableStimulus); + $this->m_aEnableClasses = [$sEnableClass]; + $this->m_aEnableActions = [$iActionCode]; + $this->m_aEnableActionResults = [$iAllowedResults]; + $this->m_aEnableStimuli = [$sEnableStimulus]; $this->index = ApplicationMenu::InsertMenu($this, $iParentIndex, $fRank); } @@ -751,7 +715,6 @@ abstract class MenuNode $oSearch->SetShowObsoleteData(utils::ShowObsoleteData()); DBSearchHelper::AddContextFilter($oSearch); - $oSet = new DBObjectSet($oSearch); $iCount = $oSet->CountWithLimit(99); if ($iCount > 99) { @@ -802,8 +765,7 @@ abstract class MenuNode */ public function PopulateChildMenus() { - foreach (ApplicationMenu::GetChildren($this->GetIndex()) as $aMenu) - { + foreach (ApplicationMenu::GetChildren($this->GetIndex()) as $aMenu) { $index = $aMenu['index']; $oMenu = ApplicationMenu::GetMenuNode($index); $oMenu->PopulateChildMenus(); @@ -838,8 +800,7 @@ abstract class MenuNode */ public function AddCondition(MenuNode $oMenuNode) { - foreach($oMenuNode->m_aEnableClasses as $index => $sClass ) - { + foreach ($oMenuNode->m_aEnableClasses as $index => $sClass) { $this->m_aEnableClasses[] = $sClass; $this->m_aEnableActions[] = $oMenuNode->m_aEnableActions[$index]; $this->m_aEnableActionResults[] = $oMenuNode->m_aEnableActionResults[$index]; @@ -852,33 +813,24 @@ abstract class MenuNode */ public function IsEnabled() { - foreach($this->m_aEnableClasses as $index => $sClass) - { - if ($sClass != null) - { - if (MetaModel::IsValidClass($sClass)) - { - if ($this->m_aEnableStimuli[$index] != null) - { - if (!UserRights::IsStimulusAllowed($sClass, $this->m_aEnableStimuli[$index])) - { + foreach ($this->m_aEnableClasses as $index => $sClass) { + if ($sClass != null) { + if (MetaModel::IsValidClass($sClass)) { + if ($this->m_aEnableStimuli[$index] != null) { + if (!UserRights::IsStimulusAllowed($sClass, $this->m_aEnableStimuli[$index])) { return false; } } - if ($this->m_aEnableActions[$index] != null) - { + if ($this->m_aEnableActions[$index] != null) { // Menus access rights ignore the archive mode utils::PushArchiveMode(false); $iResult = UserRights::IsActionAllowed($sClass, $this->m_aEnableActions[$index]); utils::PopArchiveMode(); - if (!($iResult & $this->m_aEnableActionResults[$index])) - { + if (!($iResult & $this->m_aEnableActionResults[$index])) { return false; } } - } - else - { + } else { return false; } } @@ -891,7 +843,7 @@ abstract class MenuNode * @param array $aExtraParams * @return mixed */ - public abstract function RenderContent(WebPage $oPage, $aExtraParams = array()); + abstract public function RenderContent(WebPage $oPage, $aExtraParams = []); /** * @param string $sHyperlink @@ -900,16 +852,13 @@ abstract class MenuNode */ protected function AddParams($sHyperlink, $aExtraParams) { - if (count($aExtraParams) > 0) - { - $aQuery = array(); + if (count($aExtraParams) > 0) { + $aQuery = []; $sSeparator = '?'; - if (strpos($sHyperlink, '?') !== false) - { + if (strpos($sHyperlink, '?') !== false) { $sSeparator = '&'; } - foreach($aExtraParams as $sName => $sValue) - { + foreach ($aExtraParams as $sName => $sValue) { $aQuery[] = urlencode($sName).'='.urlencode($sValue); } $sHyperlink .= $sSeparator.implode('&', $aQuery); @@ -925,7 +874,7 @@ abstract class MenuNode class MenuGroup extends MenuNode { /** @var string DEFAULT_DECORATION_CLASSES Set to null by default so it is replaced by initials when none is specified */ - const DEFAULT_DECORATION_CLASSES = null; + public const DEFAULT_DECORATION_CLASSES = null; /** @var string The CSS classes used to display the menu group's icon */ protected $sDecorationClasses = self::DEFAULT_DECORATION_CLASSES; @@ -945,8 +894,7 @@ class MenuGroup extends MenuNode { parent::__construct($sMenuId, -1 /* no parent, groups are at root level */, $fRank, $sEnableClass, $iActionCode, $iAllowedResults, $sEnableStimulus); - if(!empty($sDecorationClasses)) - { + if (!empty($sDecorationClasses)) { $this->sDecorationClasses = $sDecorationClasses; } } @@ -987,7 +935,7 @@ class MenuGroup extends MenuNode /** * @inheritDoc */ - public function RenderContent(WebPage $oPage, $aExtraParams = array()) + public function RenderContent(WebPage $oPage, $aExtraParams = []) { assert(false); // Shall never be called, groups do not display any content } @@ -1027,7 +975,9 @@ class TemplateMenuNode extends MenuNode */ public function GetHyperlink($aExtraParams) { - if ($this->sTemplateFile == '') return ''; + if ($this->sTemplateFile == '') { + return ''; + } return parent::GetHyperlink($aExtraParams); } @@ -1035,18 +985,15 @@ class TemplateMenuNode extends MenuNode * @inheritDoc * @throws \Exception */ - public function RenderContent(WebPage $oPage, $aExtraParams = array()) + public function RenderContent(WebPage $oPage, $aExtraParams = []) { ApplicationMenu::CheckMenuIdEnabled($this->GetMenuId()); $sTemplate = @file_get_contents($this->sTemplateFile); - if ($sTemplate !== false) - { + if ($sTemplate !== false) { $aExtraParams['table_id'] = 'Menu_'.$this->GetMenuId(); $oTemplate = new DisplayTemplate($sTemplate); $oTemplate->Render($oPage, $aExtraParams); - } - else - { + } else { $oPage->p("Error: failed to load template file: '{$this->sTemplateFile}'"); // No need to translate ? } } @@ -1080,7 +1027,6 @@ class OQLMenuNode extends MenuNode */ protected $m_aParams; - /** * Create a menu item based on an OQL query and inserts it into the application's main menu * @param string $sMenuId Unique identifier of the menu (used to identify the menu for bookmarking, and for getting the labels from the dictionary) @@ -1101,7 +1047,7 @@ class OQLMenuNode extends MenuNode $this->sOQL = $sOQL; $this->bSearch = $bSearch; $this->bSearchFormOpen = $bSearchFormOpen; - $this->m_aParams = array(); + $this->m_aParams = []; $this->aReflectionProperties['oql'] = $sOQL; $this->aReflectionProperties['do_search'] = $bSearch; // Enhancement: we could set as the "enable" condition that the user has enough rights to "read" the objects @@ -1115,8 +1061,7 @@ class OQLMenuNode extends MenuNode public function SetParameters($aParams) { $this->m_aParams = $aParams; - foreach($aParams as $sKey => $value) - { + foreach ($aParams as $sKey => $value) { $this->aReflectionProperties[$sKey] = $value; } } @@ -1125,12 +1070,11 @@ class OQLMenuNode extends MenuNode * @inheritDoc * @throws \Exception */ - public function RenderContent(WebPage $oPage, $aExtraParams = array()) + public function RenderContent(WebPage $oPage, $aExtraParams = []) { $oTag = new ContextTag(ContextTag::TAG_OBJECT_SEARCH); ApplicationMenu::CheckMenuIdEnabled($this->GetMenuId()); - OQLMenuNode::RenderOQLSearch - ( + OQLMenuNode::RenderOQLSearch( $this->sOQL, Dict::S($this->sPageTitle), 'Menu_'.$this->GetMenuId(), @@ -1155,26 +1099,25 @@ class OQLMenuNode extends MenuNode * @throws DictExceptionMissingString * @throws OQLException */ - public static function RenderOQLSearch($sOql, $sTitle, $sUsageId, $bSearchPane, $bSearchOpen, WebPage $oPage, $aExtraParams = array(), $bEnableBreadcrumb = false) + public static function RenderOQLSearch($sOql, $sTitle, $sUsageId, $bSearchPane, $bSearchOpen, WebPage $oPage, $aExtraParams = [], $bEnableBreadcrumb = false) { $sUsageId = utils::GetSafeId($sUsageId); $oSearch = DBObjectSearch::FromOQL($sOql); - $sClass= $oSearch->GetClass(); + $sClass = $oSearch->GetClass(); $sIcon = MetaModel::GetClassIcon($sClass, false); if ($bSearchPane) { $aParams = array_merge(['open' => $bSearchOpen, 'table_id' => $sUsageId, 'submit_on_load' => false], $aExtraParams); $oBlock = new DisplayBlock($oSearch, DisplayBlock::ENUM_STYLE_SEARCH, false /* Asynchronous */, $aParams); $oBlock->Display($oPage, 0); $oPage->add("
    "); - } - else { + } else { $oPage->add("
    "); } - $aExtraParams['panel_class'] =$sClass; + $aExtraParams['panel_class'] = $sClass; $aExtraParams['panel_title'] = $sTitle; $aExtraParams['panel_icon'] = $sIcon; - $aParams = array_merge(array('table_id' => $sUsageId), $aExtraParams); + $aParams = array_merge(['table_id' => $sUsageId], $aExtraParams); $oBlock = new DisplayBlock($oSearch, 'list', false /* Asynchronous */, $aParams); $oBlock->Display($oPage, $sUsageId); @@ -1239,14 +1182,14 @@ class SearchMenuNode extends MenuNode * @throws \DictExceptionMissingString * @throws \Exception */ - public function RenderContent(WebPage $oPage, $aExtraParams = array()) + public function RenderContent(WebPage $oPage, $aExtraParams = []) { ApplicationMenu::CheckMenuIdEnabled($this->GetMenuId()); $oPage->SetBreadCrumbEntry("menu-".$this->sMenuId, $this->GetTitle(), '', '', 'fas fa-search', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); $oSearch = new DBObjectSearch($this->sClass); $sUsageId = 'Menu_'.utils::GetSafeId($this->GetMenuId()); - $aParams = array_merge(array('table_id' =>$sUsageId), $aExtraParams); + $aParams = array_merge(['table_id' => $sUsageId], $aExtraParams); $oBlock = new DisplayBlock($oSearch, 'search', false /* Asynchronous */, $aParams); $oBlock->Display($oPage, 0); } @@ -1283,10 +1226,16 @@ class WebPageMenuNode extends MenuNode * @param bool $bIsLinkInNewWindow for the {@link WebPageMenuNode::IsHyperLinkInNewWindow} method */ public function __construct( - $sMenuId, $sHyperlink, $iParentIndex, $fRank = 0.0, $sEnableClass = null, $iActionCode = null, - $iAllowedResults = UR_ALLOWED_YES, $sEnableStimulus = null, $bIsLinkInNewWindow = false - ) - { + $sMenuId, + $sHyperlink, + $iParentIndex, + $fRank = 0.0, + $sEnableClass = null, + $iActionCode = null, + $iAllowedResults = UR_ALLOWED_YES, + $sEnableStimulus = null, + $bIsLinkInNewWindow = false + ) { parent::__construct($sMenuId, $iParentIndex, $fRank, $sEnableClass, $iActionCode, $iAllowedResults, $sEnableStimulus); $this->sHyperlink = $sHyperlink; $this->aReflectionProperties['url'] = $sHyperlink; @@ -1299,7 +1248,7 @@ class WebPageMenuNode extends MenuNode public function GetHyperlink($aExtraParams) { $aExtraParams['c[menu]'] = $this->GetMenuId(); - return $this->AddParams( $this->sHyperlink, $aExtraParams); + return $this->AddParams($this->sHyperlink, $aExtraParams); } /** @@ -1313,7 +1262,7 @@ class WebPageMenuNode extends MenuNode /** * @inheritDoc */ - public function RenderContent(WebPage $oPage, $aExtraParams = array()) + public function RenderContent(WebPage $oPage, $aExtraParams = []) { assert(false); // Shall never be called, the external web page will handle the display by itself } @@ -1374,10 +1323,8 @@ class NewObjectMenuNode extends MenuNode $aSubClasses = MetaModel::EnumChildClasses($this->sClass, ENUM_CHILD_CLASSES_ALL); // Including the specified class itself $bActionIsAllowed = false; - foreach($aSubClasses as $sCandidateClass) - { - if (!MetaModel::IsAbstract($sCandidateClass) && (UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) - { + foreach ($aSubClasses as $sCandidateClass) { + if (!MetaModel::IsAbstract($sCandidateClass) && (UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) { $bActionIsAllowed = true; break; // Enough for now } @@ -1388,7 +1335,7 @@ class NewObjectMenuNode extends MenuNode /** * @inheritDoc */ - public function RenderContent(WebPage $oPage, $aExtraParams = array()) + public function RenderContent(WebPage $oPage, $aExtraParams = []) { assert(false); // Shall never be called, the external web page will handle the display by itself } @@ -1428,7 +1375,9 @@ class DashboardMenuNode extends MenuNode */ public function GetHyperlink($aExtraParams) { - if ($this->sDashboardFile == '') return ''; + if ($this->sDashboardFile == '') { + return ''; + } return parent::GetHyperlink($aExtraParams); } @@ -1446,12 +1395,11 @@ class DashboardMenuNode extends MenuNode * @inheritDoc * @throws \Exception */ - public function RenderContent(WebPage $oPage, $aExtraParams = array()) + public function RenderContent(WebPage $oPage, $aExtraParams = []) { ApplicationMenu::CheckMenuIdEnabled($this->GetMenuId()); $oDashboard = $this->GetDashboard(); - if ($oDashboard != null) - { + if ($oDashboard != null) { WebResourcesHelper::EnableC3JSToWebPage($oPage); $sDivId = utils::Sanitize($this->sMenuId, '', 'element_identifier'); @@ -1482,9 +1430,7 @@ class DashboardMenuNode extends MenuNode } $oPage->SetBreadCrumbEntry("ui-dashboard-".$this->sMenuId, $this->GetTitle(), $sDescription, '', $sIcon, iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); } - } - else - { + } else { $oPage->p("Error: failed to load dashboard file: '{$this->sDashboardFile}'"); } } @@ -1497,12 +1443,9 @@ class DashboardMenuNode extends MenuNode public function RenderEditor(WebPage $oPage) { $oDashboard = $this->GetDashboard(); - if ($oDashboard != null) - { + if ($oDashboard != null) { $oDashboard->RenderEditor($oPage); - } - else - { + } else { $oPage->p("Error: failed to load dashboard file: '{$this->sDashboardFile}'"); } } @@ -1514,13 +1457,10 @@ class DashboardMenuNode extends MenuNode public function AddDashlet($oDashlet) { $oDashboard = $this->GetDashboard(); - if ($oDashboard != null) - { + if ($oDashboard != null) { $oDashboard->AddDashlet($oDashlet); $oDashboard->Save(); - } - else - { + } else { throw new Exception("Error: failed to load dashboard file: '{$this->sDashboardFile}'"); } } @@ -1543,7 +1483,7 @@ class ShortcutContainerMenuNode extends MenuNode /** * @inheritDoc */ - public function RenderContent(WebPage $oPage, $aExtraParams = array()) + public function RenderContent(WebPage $oPage, $aExtraParams = []) { } @@ -1558,10 +1498,9 @@ class ShortcutContainerMenuNode extends MenuNode // $oBMSearch = new DBObjectSearch('Shortcut'); $oBMSearch->AddCondition('user_id', UserRights::GetUserId(), '='); - $oBMSet = new DBObjectSet($oBMSearch, array('friendlyname' => true)); // ascending on friendlyname + $oBMSet = new DBObjectSet($oBMSearch, ['friendlyname' => true]); // ascending on friendlyname $fRank = 1; - while ($oShortcut = $oBMSet->Fetch()) - { + while ($oShortcut = $oBMSet->Fetch()) { $sName = $this->GetMenuId().'_'.$oShortcut->GetKey(); new ShortcutMenuNode($sName, $oShortcut, $this->GetIndex(), $fRank++); } @@ -1572,7 +1511,6 @@ class ShortcutContainerMenuNode extends MenuNode } } - require_once(APPROOT.'application/shortcut.class.inc.php'); /** * This class defines a menu item which content is a shortcut. @@ -1609,12 +1547,10 @@ class ShortcutMenuNode extends MenuNode { $sContext = $this->oShortcut->Get('context'); $aContext = unserialize($sContext); - if (isset($aContext['menu'])) - { + if (isset($aContext['menu'])) { unset($aContext['menu']); } - foreach ($aContext as $sArgName => $sArgValue) - { + foreach ($aContext as $sArgName => $sArgValue) { $aExtraParams[$sArgName] = $sArgValue; } return parent::GetHyperlink($aExtraParams); @@ -1624,7 +1560,7 @@ class ShortcutMenuNode extends MenuNode * @inheritDoc * @throws \Exception */ - public function RenderContent(WebPage $oPage, $aExtraParams = array()) + public function RenderContent(WebPage $oPage, $aExtraParams = []) { ApplicationMenu::CheckMenuIdEnabled($this->GetMenuId()); $this->oShortcut->RenderContent($oPage, $aExtraParams); @@ -1661,11 +1597,9 @@ class ShortcutMenuNode extends MenuNode return true; } - public function GetEntriesCount() { return $this->GetEntriesCountFromOQL($this->oShortcut->Get('oql')); } } - diff --git a/application/newsroomprovider.class.inc.php b/application/newsroomprovider.class.inc.php index 8d5ae669d..dcdbf8b54 100644 --- a/application/newsroomprovider.class.inc.php +++ b/application/newsroomprovider.class.inc.php @@ -1,4 +1,5 @@ value to be replaced in URL of the messages * Example: '%itop_root%' => utils::GetAbsoluteUrlAppRoot(); * @return string[] */ public function GetPlaceholders(); - + /** * The duration between to refreshes of the cache (in seconds) * @return int @@ -90,19 +91,19 @@ abstract class NewsroomProviderBase implements iNewsroomProvider * @var Config */ protected $oConfig; - + public function __construct() { $this->oConfig = null; } - + /** * {@inheritDoc} * @see iNewsroomProvider::SetConfig() */ public function SetConfig(Config $oConfig) { - $this->oConfig = $oConfig; + $this->oConfig = $oConfig; } /** @@ -118,42 +119,42 @@ abstract class NewsroomProviderBase implements iNewsroomProvider * {@inheritDoc} * @see iNewsroomProvider::GetLabel() */ - public abstract function GetLabel(); - + abstract public function GetLabel(); + /** * {@inheritDoc} * @see iNewsroomProvider::GetFetchURL() */ - public abstract function GetFetchURL(); + abstract public function GetFetchURL(); /** * {@inheritDoc} * @see iNewsroomProvider::GetMarkAllURL() */ - public abstract function GetMarkAllAsReadURL(); + abstract public function GetMarkAllAsReadURL(); /** * {@inheritDoc} * @see iNewsroomProvider::GetViewAllURL() */ - public abstract function GetViewAllURL(); + abstract public function GetViewAllURL(); public function IsApplicable(User $oUser = null) { return false; } - + /** * {@inheritDoc} * @see iNewsroomProvider::GetPlaceholders() */ public function GetPlaceholders() { - return array(); // By default, empty set of placeholders + return []; // By default, empty set of placeholders } - + public function GetTTL() { - return 10*60; // Refresh every 10 minutes + return 10 * 60; // Refresh every 10 minutes } } diff --git a/application/nicewebpage.class.inc.php b/application/nicewebpage.class.inc.php index 7f7a5d814..3e9d734c3 100644 --- a/application/nicewebpage.class.inc.php +++ b/application/nicewebpage.class.inc.php @@ -1,8 +1,9 @@ sPortalid = $sPortalId; @@ -20,53 +21,45 @@ class PortalDispatcher { $bRet = true; $aProfiles = UserRights::ListProfiles($oUser); - - foreach($this->aData['deny'] as $sDeniedProfile) - { + + foreach ($this->aData['deny'] as $sDeniedProfile) { // If one denied profile is present, it's enough => return false - if (in_array($sDeniedProfile, $aProfiles)) - { + if (in_array($sDeniedProfile, $aProfiles)) { return false; } } // If there are some "allow" profiles, then by default the result is false // since the user must have at least one of the profiles to be allowed - if (count($this->aData['allow']) > 0) - { + if (count($this->aData['allow']) > 0) { $bRet = false; } - foreach($this->aData['allow'] as $sAllowProfile) - { + foreach ($this->aData['allow'] as $sAllowProfile) { // If one "allow" profile is present, it's enough => return true - if (in_array($sAllowProfile, $aProfiles)) - { + if (in_array($sAllowProfile, $aProfiles)) { return true; } } return $bRet; } - + public function GetURL() { $aOverloads = MetaModel::GetConfig()->Get('portal_dispatch_urls'); - if (array_key_exists($this->sPortalid, $aOverloads)) - { + if (array_key_exists($this->sPortalid, $aOverloads)) { $sRet = $aOverloads[$this->sPortalid]; - } - else - { + } else { $sRet = utils::GetAbsoluteUrlAppRoot().$this->aData['url']; } return $sRet; } - + public function GetLabel() { return Dict::S('portal:'.$this->sPortalid); } - + public function GetRank() { return $this->aData['rank']; } -} \ No newline at end of file +} diff --git a/application/query.class.inc.php b/application/query.class.inc.php index 0cddb2e82..67e2cfd83 100644 --- a/application/query.class.inc.php +++ b/application/query.class.inc.php @@ -1,4 +1,5 @@ "core/cmdb,view_in_gui,application,grant_by_profile", "key_type" => "autoincrement", "name_attcode" => "name", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_query", "db_key_field" => "id", "db_finalclass_field" => "realclass", - ); + ]; MetaModel::Init_Params($aParams); - MetaModel::Init_AddAttribute(new AttributeString("name", array( + MetaModel::Init_AddAttribute(new AttributeString("name", [ "allowed_values" => null, "sql" => "name", "default_value" => null, "is_null_allowed" => false, - "depends_on" => array(), - ))); + "depends_on" => [], + ])); - MetaModel::Init_AddAttribute(new AttributeText("description", array( + MetaModel::Init_AddAttribute(new AttributeText("description", [ "allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => false, - "depends_on" => array(), - ))); + "depends_on" => [], + ])); - MetaModel::Init_AddAttribute(new AttributeEnum("is_template", array( + MetaModel::Init_AddAttribute(new AttributeEnum("is_template", [ 'allowed_values' => new ValueSetEnum('yes,no'), 'sql' => 'is_template', 'default_value' => 'no', 'is_null_allowed' => false, 'depends_on' => [], 'display_style' => 'radio_horizontal', - ))); + ])); - MetaModel::Init_AddAttribute(new AttributeInteger("export_count", array( + MetaModel::Init_AddAttribute(new AttributeInteger("export_count", [ "allowed_values" => null, "sql" => "export_count", "default_value" => 0, "is_null_allowed" => false, - "depends_on" => array(), + "depends_on" => [], "tracking_level" => ATTRIBUTE_TRACKING_NONE, - ))); + ])); - MetaModel::Init_AddAttribute(new AttributeDateTime("export_last_date", array( + MetaModel::Init_AddAttribute(new AttributeDateTime("export_last_date", [ "allowed_values" => null, "sql" => "export_last_date", "default_value" => null, "is_null_allowed" => true, - "depends_on" => array(), + "depends_on" => [], "tracking_level" => ATTRIBUTE_TRACKING_NONE, - ))); + ])); - MetaModel::Init_AddAttribute(new AttributeExternalKey("export_last_user_id", - array( - "targetclass"=>'User', - "allowed_values"=>null, - "sql"=>'user_id', - "is_null_allowed"=>true, - "depends_on"=>array(), - "display_style"=>'select', - "always_load_in_tables"=>false, - "on_target_delete"=>DEL_SILENT, + MetaModel::Init_AddAttribute(new AttributeExternalKey( + "export_last_user_id", + [ + "targetclass" => 'User', + "allowed_values" => null, + "sql" => 'user_id', + "is_null_allowed" => true, + "depends_on" => [], + "display_style" => 'select', + "always_load_in_tables" => false, + "on_target_delete" => DEL_SILENT, "tracking_level" => ATTRIBUTE_TRACKING_NONE, - ))); + ] + )); - MetaModel::Init_AddAttribute(new AttributeExternalField("export_last_user_contact", - array( - "allowed_values"=>null, - "extkey_attcode"=> "export_last_user_id", - "target_attcode"=>"contactid", + MetaModel::Init_AddAttribute(new AttributeExternalField( + "export_last_user_contact", + [ + "allowed_values" => null, + "extkey_attcode" => "export_last_user_id", + "target_attcode" => "contactid", "tracking_level" => ATTRIBUTE_TRACKING_NONE, - ))); + ] + )); // Display lists - MetaModel::Init_SetZListItems('details', - array('name', 'is_template', 'description')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems( + 'details', + ['name', 'is_template', 'description'] + ); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['description']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('name', 'description', 'is_template')); // Criteria of the std search form - MetaModel::Init_SetZListItems('default_search', - array('name', 'description', 'is_template')); // Criteria of the default search form + MetaModel::Init_SetZListItems('standard_search', ['name', 'description', 'is_template']); // Criteria of the std search form + MetaModel::Init_SetZListItems( + 'default_search', + ['name', 'description', 'is_template'] + ); // Criteria of the default search form // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } - /** * @inheritdoc * * @since 3.1.0 */ - public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '') + public function GetAttributeFlags($sAttCode, &$aReasons = [], $sTargetState = '') { // read only attribute - if (in_array($sAttCode, ['export_count', 'export_last_date', 'export_last_user_id'])){ + if (in_array($sAttCode, ['export_count', 'export_last_date', 'export_last_user_id'])) { return OPT_ATT_READONLY; } return parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState); } - /** * Return export url. * @@ -144,7 +151,7 @@ abstract class Query extends cmdbAbstractObject * @return string|null * @since 3.1.0 */ - abstract public function GetExportUrl(array $aValues = null) : ?string; + abstract public function GetExportUrl(array $aValues = null): ?string; /** * Update last export information. @@ -156,7 +163,7 @@ abstract class Query extends cmdbAbstractObject * @throws \MySQLException * @since 3.1.0 */ - public function UpdateLastExportInformation() : void + public function UpdateLastExportInformation(): void { // last export information $this->Set('export_last_date', date(AttributeDateTime::GetSQLFormat())); @@ -173,53 +180,56 @@ class QueryOQL extends Query { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb,view_in_gui,application,grant_by_profile", "key_type" => "autoincrement", "name_attcode" => "name", "state_attcode" => "", - "reconc_keys" => array('oql', 'is_template'), + "reconc_keys" => ['oql', 'is_template'], "db_table" => "priv_query_oql", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeOQL("oql", array( + MetaModel::Init_AddAttribute(new AttributeOQL("oql", [ "allowed_values" => null, "sql" => "oql", "default_value" => null, "is_null_allowed" => false, - "depends_on" => array(), - ))); - MetaModel::Init_AddAttribute(new AttributeText("fields", array( + "depends_on" => [], + ])); + MetaModel::Init_AddAttribute(new AttributeText("fields", [ "allowed_values" => null, "sql" => "fields", "default_value" => null, "is_null_allowed" => true, - "depends_on" => array(), - ))); + "depends_on" => [], + ])); // Rolled back to AttributeText until AttributeQueryAttCodeSet can manage fields order correctly //MetaModel::Init_AddAttribute(new AttributeQueryAttCodeSet("fields", array("allowed_values"=>null,"max_items" => 1000, "query_field" => "oql", "sql"=>"fields", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array('oql')))); // Display lists - MetaModel::Init_SetZListItems('details', - array( - 'col:col1' => array('fieldset:Query:baseinfo' => array('name', 'is_template', 'description', 'oql', 'fields')), - 'col:col2' => array('fieldset:Query:exportInfo' => array('export_count', 'export_last_date', 'export_last_user_id', 'export_last_user_contact')) - ) + MetaModel::Init_SetZListItems( + 'details', + [ + 'col:col1' => ['fieldset:Query:baseinfo' => ['name', 'is_template', 'description', 'oql', 'fields']], + 'col:col2' => ['fieldset:Query:exportInfo' => ['export_count', 'export_last_date', 'export_last_user_id', 'export_last_user_contact']], + ] ); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('list', ['description']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', - array('name', 'description', 'is_template', 'fields', 'oql')); // Criteria of the std search form + MetaModel::Init_SetZListItems( + 'standard_search', + ['name', 'description', 'is_template', 'fields', 'oql'] + ); // Criteria of the std search form } /** @inheritdoc */ - public function GetExportUrl(array $aValues = null) : ?string + public function GetExportUrl(array $aValues = null): ?string { - try{ + try { // retrieve attributes $sFields = trim($this->Get('fields')); $sOql = $this->Get('oql'); @@ -228,8 +238,7 @@ class QueryOQL extends Query $bExportV1Recommended = ($sFields == ''); if ($bExportV1Recommended) { $sUrl = utils::GetAbsoluteUrlAppRoot().'webservices/export.php?format=spreadsheet&login_mode=basic&query='.$this->GetKey(); - } - else{ + } else { $sUrl = utils::GetAbsoluteUrlAppRoot().'webservices/export-v2.php?format=spreadsheet&login_mode=basic&date_format='.urlencode((string)AttributeDateTime::GetFormat()).'&query='.$this->GetKey(); } @@ -240,17 +249,16 @@ class QueryOQL extends Query $aParameters = $oSearch->GetQueryParams(); foreach ($aParameters as $sParam => $val) { $paramValue = ($aValues === null || $aValues[$sParam] === null) ? $sParam : $aValues[$sParam]; - $sUrl .= '&arg_' . $sParam . '=' . $paramValue; + $sUrl .= '&arg_'.$sParam.'='.$paramValue; } return $sUrl; - } - catch(Exception $e){ + } catch (Exception $e) { return null; } } - function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '', $aExtraParams = array()) + public function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '', $aExtraParams = []) { $aFieldsMap = parent::DisplayBareProperties($oPage, $bEditMode, $sPrefix, $aExtraParams); $oPage->add_script("$('[name=\"attr_oql\"]').addClass('ibo-query-oql ibo-is-code'); $('[data-attribute-code=\"oql\"]').addClass('ibo-query-oql ibo-is-code');"); @@ -287,16 +295,14 @@ class QueryOQL extends Query if (count($aParameters) == 0) { $oBlock = new DisplayBlock($oSearch, 'list'); - $aExtraParams = array( + $aExtraParams = [ //'menu' => $sShowMenu, 'table_id' => 'query_preview_'.$this->getKey(), - ); + ]; $sBlockId = 'block_query_preview_'.$this->GetKey(); // make a unique id (edition occuring in the same DOM) $oBlock->Display($oPage, $sBlockId, $aExtraParams); } - } - catch - (OQLException $e) { + } catch (OQLException $e) { $oAlert = AlertUIBlockFactory::MakeForFailure(Dict::S('UI:RunQuery:Error'), $e->getHtmlDesc()) ->SetIsClosable(false) ->SetIsCollapsible(false); @@ -307,41 +313,38 @@ class QueryOQL extends Query return $aFieldsMap; } - -// Rolled back until 'fields' can be properly managed by AttributeQueryAttCodeSet -// -// public function ComputeValues() -// { -// parent::ComputeValues(); -// -// // Remove unwanted attribute codes -// $aChanges = $this->ListChanges(); -// if (isset($aChanges['fields'])) -// { -// $oAttDef = MetaModel::GetAttributeDef(get_class($this), 'fields'); -// $aArgs = array('this' => $this); -// $aAllowedValues = $oAttDef->GetAllowedValues($aArgs); -// -// /** @var \ormSet $oValue */ -// $oValue = $this->Get('fields'); -// $aValues = $oValue->GetValues(); -// $bChanged = false; -// foreach($aValues as $key => $sValue) -// { -// if (!isset($aAllowedValues[$sValue])) -// { -// unset($aValues[$key]); -// $bChanged = true; -// } -// } -// if ($bChanged) -// { -// $oValue->SetValues($aValues); -// $this->Set('fields', $oValue); -// } -// } -// } + // Rolled back until 'fields' can be properly managed by AttributeQueryAttCodeSet + // + // public function ComputeValues() + // { + // parent::ComputeValues(); + // + // // Remove unwanted attribute codes + // $aChanges = $this->ListChanges(); + // if (isset($aChanges['fields'])) + // { + // $oAttDef = MetaModel::GetAttributeDef(get_class($this), 'fields'); + // $aArgs = array('this' => $this); + // $aAllowedValues = $oAttDef->GetAllowedValues($aArgs); + // + // /** @var \ormSet $oValue */ + // $oValue = $this->Get('fields'); + // $aValues = $oValue->GetValues(); + // $bChanged = false; + // foreach($aValues as $key => $sValue) + // { + // if (!isset($aAllowedValues[$sValue])) + // { + // unset($aValues[$key]); + // $bChanged = true; + // } + // } + // if ($bChanged) + // { + // $oValue->SetValues($aValues); + // $this->Set('fields', $oValue); + // } + // } + // } } - -?> diff --git a/application/shortcut.class.inc.php b/application/shortcut.class.inc.php index a213cb8cd..7867b5d59 100644 --- a/application/shortcut.class.inc.php +++ b/application/shortcut.class.inc.php @@ -1,9 +1,10 @@ "gui,view_in_gui", "key_type" => "autoincrement", "name_attcode" => "name", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_shortcut", "db_key_field" => "id", "db_finalclass_field" => "realclass", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("user_id", array("targetclass"=>"User", "allowed_values"=>null, "sql"=>"user_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("context", array("allowed_values"=>null, "sql"=>"context", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("user_id", ["targetclass" => "User", "allowed_values" => null, "sql" => "user_id", "is_null_allowed" => true, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("name", ["allowed_values" => null, "sql" => "name", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("context", ["allowed_values" => null, "sql" => "context", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('name', 'context')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('name')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['name', 'context']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['name']); // Attributes to be displayed for a list // Search criteria -// MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form -// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + // MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form + // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } - abstract public function RenderContent(WebPage $oPage, $aExtraParams = array()); + abstract public function RenderContent(WebPage $oPage, $aExtraParams = []); protected function OnInsert() { @@ -74,14 +74,14 @@ abstract class Shortcut extends DBObject implements iDisplay $oForm->AddField($oField); $oForm->Render($oPage); $oPage->add('
    '); - + $sDialogTitle = Dict::S('UI:ShortcutRenameDlg:Title'); $sOkButtonLabel = Dict::S('UI:Button:Ok'); $sCancelButtonLabel = Dict::S('UI:Button:Cancel'); $iShortcut = $this->GetKey(); - + $oPage->add_ready_script( -<< "gui,view_in_gui", "key_type" => "autoincrement", "name_attcode" => "name", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_shortcut_oql", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeOQL("oql", array("allowed_values"=>null, "sql"=>"oql", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("auto_reload", array("allowed_values"=>new ValueSetEnum('none,custom'), "sql"=>"auto_reload", "default_value"=>"none", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeInteger("auto_reload_sec", array("allowed_values"=>null, "sql"=>"auto_reload_sec", "default_value"=>60, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeOQL("oql", ["allowed_values" => null, "sql" => "oql", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("auto_reload", ["allowed_values" => new ValueSetEnum('none,custom'), "sql" => "auto_reload", "default_value" => "none", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeInteger("auto_reload_sec", ["allowed_values" => null, "sql" => "auto_reload_sec", "default_value" => 60, "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('name', 'context', 'oql')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('name')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['name', 'context', 'oql']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['name']); // Attributes to be displayed for a list // Search criteria -// MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form -// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + // MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form + // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } - public function RenderContent(WebPage $oPage, $aExtraParams = array()) + public function RenderContent(WebPage $oPage, $aExtraParams = []) { $oPage->set_title($this->Get('name')); - switch($this->Get('auto_reload')) - { - case 'custom': - $iRate = (int)$this->Get('auto_reload_sec'); - if ($iRate > 0) - { - // Must a string otherwise it can be evaluated to 'true' and defaults to "standard" refresh rate! - $aExtraParams['auto_reload'] = (string)$iRate; - } - break; + switch ($this->Get('auto_reload')) { + case 'custom': + $iRate = (int)$this->Get('auto_reload_sec'); + if ($iRate > 0) { + // Must a string otherwise it can be evaluated to 'true' and defaults to "standard" refresh rate! + $aExtraParams['auto_reload'] = (string)$iRate; + } + break; - default: - case 'none': + default: + case 'none': } $bSearchPane = true; $bSearchOpen = true; - try - { + try { OQLMenuNode::RenderOQLSearch($this->Get('oql'), $this->Get('name'), 'shortcut_'.$this->GetKey(), $bSearchPane, $bSearchOpen, $oPage, $aExtraParams, true); - } - catch (Exception $e) - { + } catch (Exception $e) { throw new Exception("The OQL shortcut '".$this->Get('name')."' (id: ".$this->GetKey().") could not be displayed: ".$e->getMessage()); } - + } public function CloneTableSettings($sTableSettings) @@ -226,17 +221,14 @@ class ShortcutOQL extends Shortcut // Find a unique default name // -> The class of the query + an index if necessary - if ($sOQL == null) - { + if ($sOQL == null) { $sDefault = ''; - } - else - { + } else { $oBMSearch = new DBObjectSearch('Shortcut'); $oBMSearch->AddCondition('user_id', UserRights::GetUserId(), '='); $oBMSet = new DBObjectSet($oBMSearch); $aNames = $oBMSet->GetColumnAsArray('name'); - $oSearch = DBObjectSearch::FromOQL($sOQL); + $oSearch = DBObjectSearch::FromOQL($sOQL); $sDefault = utils::MakeUniqueName($oSearch->GetClass(), $aNames); } @@ -276,18 +268,18 @@ class ShortcutOQL extends Shortcut $oForm->Render($oPage); $oPage->add('
    '); - + $sDialogTitle = Dict::S('UI:ShortcutListDlg:Title'); $sOkButtonLabel = Dict::S('UI:Button:Ok'); $sCancelButtonLabel = Dict::S('UI:Button:Cancel'); - + $oAppContext = new ApplicationContext(); $sContext = $oAppContext->GetForLink(); $sRateTitle = addslashes(Dict::Format('Class:ShortcutOQL/Attribute:auto_reload_sec/tip', MetaModel::GetConfig()->Get('min_reload_interval'))); $oPage->add_ready_script( -<<ComputeAndReport("Session Start"); $sSwitchEnv = utils::ReadParam('switch_env', null); $bAllowCache = true; -if (($sSwitchEnv != null) && file_exists(APPCONF.$sSwitchEnv.'/'.ITOP_CONFIG_FILE) &&( Session::Get('itop_env') !== $sSwitchEnv)) -{ +if (($sSwitchEnv != null) && file_exists(APPCONF.$sSwitchEnv.'/'.ITOP_CONFIG_FILE) && (Session::Get('itop_env') !== $sSwitchEnv)) { Session::Set('itop_env', $sSwitchEnv); $sEnv = $sSwitchEnv; - $bAllowCache = false; - // Reset the opcache since otherwise the PHP "model" files may still be cached !! - if (function_exists('opcache_reset')) - { - // Zend opcode cache - opcache_reset(); - } - if (function_exists('apc_clear_cache')) - { - // APC(u) cache - apc_clear_cache(); - } + $bAllowCache = false; + // Reset the opcache since otherwise the PHP "model" files may still be cached !! + if (function_exists('opcache_reset')) { + // Zend opcode cache + opcache_reset(); + } + if (function_exists('apc_clear_cache')) { + // APC(u) cache + apc_clear_cache(); + } // TODO: reset the credentials as well ?? -} -else if (Session::IsSet('itop_env')) -{ +} elseif (Session::IsSet('itop_env')) { $sEnv = Session::Get('itop_env'); -} -else -{ +} else { $sEnv = ITOP_DEFAULT_ENV; Session::Set('itop_env', ITOP_DEFAULT_ENV); } $sConfigFile = APPCONF.$sEnv.'/'.ITOP_CONFIG_FILE; try { - MetaModel::Startup($sConfigFile, false /* $bModelOnly */, $bAllowCache, false /* $bTraceSourceFiles */, $sEnv); + MetaModel::Startup($sConfigFile, false /* $bModelOnly */, $bAllowCache, false /* $bTraceSourceFiles */, $sEnv); +} catch (MySQLException $e) { + IssueLog::Debug($e->getMessage()); + throw new MySQLException('Could not connect to the DB server', []); } -catch (MySQLException $e) { - IssueLog::Debug($e->getMessage()); - throw new MySQLException('Could not connect to the DB server', []); -} \ No newline at end of file diff --git a/application/template.class.inc.php b/application/template.class.inc.php index c03998b52..07e5441ba 100644 --- a/application/template.class.inc.php +++ b/application/template.class.inc.php @@ -1,4 +1,5 @@ m_aTags = array( + $this->m_aTags = [ 'itopblock', 'itopcheck', 'itoptabs', @@ -43,11 +44,11 @@ class DisplayTemplate 'itoptoggle', 'itopstring', 'sqlblock', - ); + ]; $this->m_sTemplate = $sTemplate; } - - public function Render(WebPage $oPage, $aParams = array()) + + public function Render(WebPage $oPage, $aParams = []) { $this->m_sTemplate = MetaModel::ApplyParams($this->m_sTemplate, $aParams); $iStart = 0; @@ -55,70 +56,55 @@ class DisplayTemplate $iCount = 0; $iBeforeTagPos = $iStart; $iAfterTagPos = $iStart; - while($sTag = $this->GetNextTag($iStart, $iEnd)) - { + while ($sTag = $this->GetNextTag($iStart, $iEnd)) { $sContent = $this->GetTagContent($sTag, $iStart, $iEnd); $iAfterTagPos = $iEnd + strlen(''); $sOuterTag = substr($this->m_sTemplate, $iStart, $iAfterTagPos - $iStart); $oPage->add(substr($this->m_sTemplate, $iBeforeTagPos, $iStart - $iBeforeTagPos)); - if ($sTag == DisplayBlock::TAG_BLOCK) - { - try - { + if ($sTag == DisplayBlock::TAG_BLOCK) { + try { $oBlock = DisplayBlock::FromTemplate($sOuterTag); - if (is_object($oBlock)) - { + if (is_object($oBlock)) { $oBlock->Display($oPage, 'block_'.self::$iBlockCount, $aParams); } - } - catch(OQLException $e) - { + } catch (OQLException $e) { $oPage->p('Error in template (please contact your administrator) - Invalid query'); - } - catch(Exception $e) - { + } catch (Exception $e) { $oPage->p('Error in template (please contact your administrator)'); } - + self::$iBlockCount++; - } - else - { + } else { $aAttributes = $this->GetTagAttributes($sTag, $iStart, $iEnd); //$oPage->p("Tag: $sTag - ($iStart, $iEnd)"); $this->RenderTag($oPage, $sTag, $aAttributes, $sContent); - + } $iAfterTagPos = $iEnd + strlen(''); $iBeforeTagPos = $iAfterTagPos; $iStart = $iEnd; - $iEnd = strlen($this->m_sTemplate); + $iEnd = strlen($this->m_sTemplate); $iCount++; } $oPage->add(substr($this->m_sTemplate, $iAfterTagPos)); } - + public function GetNextTag(&$iStartPos, &$iEndPos) { $iChunkStartPos = $iStartPos; $sNextTag = null; $iStartPos = $iEndPos; - foreach($this->m_aTags as $sTag) - { + foreach ($this->m_aTags as $sTag) { // Search for the opening tag $iOpeningPos = stripos($this->m_sTemplate, '<'.$sTag.' ', $iChunkStartPos); - if ($iOpeningPos === false) - { + if ($iOpeningPos === false) { $iOpeningPos = stripos($this->m_sTemplate, '<'.$sTag.'>', $iChunkStartPos); } - if ($iOpeningPos !== false) - { + if ($iOpeningPos !== false) { $iClosingPos = stripos($this->m_sTemplate, '', $iOpeningPos); } - if ( ($iOpeningPos !== false) && ($iClosingPos !== false)) - { - if ($iOpeningPos < $iStartPos) - { + if (($iOpeningPos !== false) && ($iClosingPos !== false)) { + if ($iOpeningPos < $iStartPos) { // This is the next tag $iStartPos = $iOpeningPos; $iEndPos = $iClosingPos; @@ -128,108 +114,100 @@ class DisplayTemplate } return $sNextTag; } - + public function GetTagContent($sTag, $iStartPos, $iEndPos) { $sContent = ""; $iContentStart = strpos($this->m_sTemplate, '>', $iStartPos); // Content of tag start immediatly after the first closing bracket - if ($iContentStart !== false) - { - $sContent = substr($this->m_sTemplate, 1+$iContentStart, $iEndPos - $iContentStart - 1); + if ($iContentStart !== false) { + $sContent = substr($this->m_sTemplate, 1 + $iContentStart, $iEndPos - $iContentStart - 1); } return $sContent; } public function GetTagAttributes($sTag, $iStartPos, $iEndPos) { - $aAttr = array(); + $aAttr = []; $iAttrStart = strpos($this->m_sTemplate, ' ', $iStartPos); // Attributes start just after the first space $iAttrEnd = strpos($this->m_sTemplate, '>', $iStartPos); // Attributes end just before the first closing bracket - if ( ($iAttrStart !== false) && ($iAttrEnd !== false) && ($iAttrEnd > $iAttrStart)) - { - $sAttributes = substr($this->m_sTemplate, 1+$iAttrStart, $iAttrEnd - $iAttrStart - 1); + if (($iAttrStart !== false) && ($iAttrEnd !== false) && ($iAttrEnd > $iAttrStart)) { + $sAttributes = substr($this->m_sTemplate, 1 + $iAttrStart, $iAttrEnd - $iAttrStart - 1); $aAttributes = explode(' ', $sAttributes); - foreach($aAttributes as $sAttr) - { - if ( preg_match('/(.+) *= *"(.+)"$/', $sAttr, $aMatches) ) - { + foreach ($aAttributes as $sAttr) { + if (preg_match('/(.+) *= *"(.+)"$/', $sAttr, $aMatches)) { $aAttr[strtolower($aMatches[1])] = $aMatches[2]; } } } return $aAttr; } - + protected function RenderTag($oPage, $sTag, $aAttributes, $sContent) { static $iTabContainerCount = 0; - switch($sTag) - { + switch ($sTag) { case 'itoptabs': $oPage->AddTabContainer('Tabs_'.$iTabContainerCount); $oPage->SetCurrentTabContainer('Tabs_'.$iTabContainerCount); $iTabContainerCount++; //$oPage->p('Content:
    '.htmlentities($sContent, ENT_QUOTES, 'UTF-8').'
    '); $oTemplate = new DisplayTemplate($sContent); - $oTemplate->Render($oPage, array()); // no params to apply, they have already been applied + $oTemplate->Render($oPage, []); // no params to apply, they have already been applied $oPage->SetCurrentTabContainer(''); - break; - + break; + case 'itopcheck': $sClassName = $aAttributes['class']; - if (MetaModel::IsValidClass($sClassName) && UserRights::IsActionAllowed($sClassName, UR_ACTION_READ)) - { + if (MetaModel::IsValidClass($sClassName) && UserRights::IsActionAllowed($sClassName, UR_ACTION_READ)) { $oTemplate = new DisplayTemplate($sContent); - $oTemplate->Render($oPage, array()); // no params to apply, they have already been applied - } - else - { + $oTemplate->Render($oPage, []); // no params to apply, they have already been applied + } else { // Leave a trace for those who'd like to understand why nothing is displayed $oPage->add("\n"); } - break; - + break; + case 'itoptab': $oPage->SetCurrentTab($aAttributes['name'], str_replace('_', ' ', $aAttributes['name'])); $oTemplate = new DisplayTemplate($sContent); - $oTemplate->Render($oPage, array()); // no params to apply, they have already been applied + $oTemplate->Render($oPage, []); // no params to apply, they have already been applied //$oPage->p('iTop Tab Content:
    '.htmlentities($sContent, ENT_QUOTES, 'UTF-8').'
    '); $oPage->SetCurrentTab(''); - break; - + break; + case 'itoptoggle': $sName = isset($aAttributes['name']) ? $aAttributes['name'] : 'Tagada'; $bOpen = isset($aAttributes['open']) ? $aAttributes['open'] : true; $oPage->StartCollapsibleSection(Dict::S($sName), $bOpen); $oTemplate = new DisplayTemplate($sContent); - $oTemplate->Render($oPage, array()); // no params to apply, they have already been applied + $oTemplate->Render($oPage, []); // no params to apply, they have already been applied //$oPage->p('iTop Tab Content:
    '.htmlentities($sContent, ENT_QUOTES, 'UTF-8').'
    '); $oPage->EndCollapsibleSection(); - break; - + break; + case 'itopstring': $oPage->add(Dict::S($sContent)); - break; - + break; + case 'sqlblock': $oBlock = SqlBlock::FromTemplate($sContent); $oBlock->RenderContent($oPage); - break; - + break; + case 'itopblock': // No longer used, handled by DisplayBlock::FromTemplate see above $oPage->add(""); - break; - + break; + default: // Unknown tag, just ignore it or now -- output an HTML comment $oPage->add(""); } } - + /** * Unit test */ - static public function UnitTest() + public static function UnitTest() { require_once(APPROOT.'/application/startup.inc.php'); @@ -250,11 +228,11 @@ class DisplayTemplate SELECT Document AS d JOIN lnkDocumentToCI as l ON l.document_id = d.id WHERE l.ci_id = $id$) '; - + $oPage = new iTopWebPage('Unit Test'); //$oPage->add("Template content:
    ".htmlentities($sTemplate, ENT_QUOTES, 'UTF-8')."
    \n"); $oTemplate = new DisplayTemplate($sTemplate); - $oTemplate->Render($oPage, array('class'=>'Network device','pkey'=> 271, 'name' => 'deliversw01.mecanorama.fr', 'org_id' => 3)); + $oTemplate->Render($oPage, ['class' => 'Network device','pkey' => 271, 'name' => 'deliversw01.mecanorama.fr', 'org_id' => 3]); $oPage->output(); } } @@ -275,89 +253,68 @@ class ObjectDetailsTemplate extends DisplayTemplate $this->m_oObj = $oObj; $this->m_sPrefix = $sFormPrefix; } - - public function Render(WebPage $oPage, $aParams = array(), $bEditMode = false) + + public function Render(WebPage $oPage, $aParams = [], $bEditMode = false) { - $sStateAttCode = MetaModel :: GetStateAttributeCode(get_class($this->m_oObj)); - $aTemplateFields = array(); + $sStateAttCode = MetaModel::GetStateAttributeCode(get_class($this->m_oObj)); + $aTemplateFields = []; preg_match_all('/\\$this->([a-z0-9_]+)\\$/', $this->m_sTemplate, $aMatches); - foreach ($aMatches[1] as $sAttCode) - { - if (MetaModel::IsValidAttCode(get_class($this->m_oObj), $sAttCode)) - { + foreach ($aMatches[1] as $sAttCode) { + if (MetaModel::IsValidAttCode(get_class($this->m_oObj), $sAttCode)) { $aTemplateFields[] = $sAttCode; - } - else - { - $aParams['this->'.$sAttCode] = ""; + } else { + $aParams['this->'.$sAttCode] = ""; } } preg_match_all('/\\$this->field\\(([a-z0-9_]+)\\)\\$/', $this->m_sTemplate, $aMatches); - foreach ($aMatches[1] as $sAttCode) - { - if (MetaModel::IsValidAttCode(get_class($this->m_oObj), $sAttCode)) - { + foreach ($aMatches[1] as $sAttCode) { + if (MetaModel::IsValidAttCode(get_class($this->m_oObj), $sAttCode)) { $aTemplateFields[] = $sAttCode; - } - else - { + } else { $aParams['this->field('.$sAttCode.')'] = ""; } } - $aFieldsComments = (isset($aParams['fieldsComments'])) ? $aParams['fieldsComments'] : array(); - $aFieldsMap = array(); + $aFieldsComments = (isset($aParams['fieldsComments'])) ? $aParams['fieldsComments'] : []; + $aFieldsMap = []; $sClass = get_class($this->m_oObj); // Renders the fields used in the template - foreach(MetaModel::ListAttributeDefs(get_class($this->m_oObj)) as $sAttCode => $oAttDef) - { + foreach (MetaModel::ListAttributeDefs(get_class($this->m_oObj)) as $sAttCode => $oAttDef) { $aParams['this->label('.$sAttCode.')'] = $oAttDef->GetLabel(); $aParams['this->comments('.$sAttCode.')'] = isset($aFieldsComments[$sAttCode]) ? $aFieldsComments[$sAttCode] : ''; $iInputId = '2_'.$sAttCode; // TODO: generate a real/unique prefix... - if (in_array($sAttCode, $aTemplateFields)) - { - if ($this->m_oObj->IsNew()) - { + if (in_array($sAttCode, $aTemplateFields)) { + if ($this->m_oObj->IsNew()) { $iFlags = $this->m_oObj->GetInitialStateAttributeFlags($sAttCode); + } else { + $iFlags = $this->m_oObj->GetAttributeFlags($sAttCode); } - else - { - $iFlags = $this->m_oObj->GetAttributeFlags($sAttCode); - } - if (($iFlags & OPT_ATT_MANDATORY) && $this->m_oObj->IsNew()) - { + if (($iFlags & OPT_ATT_MANDATORY) && $this->m_oObj->IsNew()) { $iFlags = $iFlags & ~OPT_ATT_READONLY; // Mandatory fields cannot be read-only when creating an object } - - if ((!$oAttDef->IsWritable()) || ($sStateAttCode == $sAttCode)) - { + + if ((!$oAttDef->IsWritable()) || ($sStateAttCode == $sAttCode)) { $iFlags = $iFlags | OPT_ATT_READONLY; } - if ($iFlags & OPT_ATT_HIDDEN) - { + if ($iFlags & OPT_ATT_HIDDEN) { $aParams['this->label('.$sAttCode.')'] = ''; $aParams['this->field('.$sAttCode.')'] = ''; $aParams['this->comments('.$sAttCode.')'] = ''; $aParams['this->'.$sAttCode] = ''; - } - else - { - if ($bEditMode && ($iFlags & (OPT_ATT_READONLY|OPT_ATT_SLAVE))) - { + } else { + if ($bEditMode && ($iFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE))) { // Check if the attribute is not read-only because of a synchro... - $aReasons = array(); + $aReasons = []; $sSynchroIcon = ''; - if ($iFlags & OPT_ATT_SLAVE) - { + if ($iFlags & OPT_ATT_SLAVE) { $iSynchroFlags = $this->m_oObj->GetSynchroReplicaFlags($sAttCode, $aReasons); $sAppRooturl = utils::GetAbsoluteUrlAppRoot(); $sSynchroIcon = " "; $sTip = ''; - foreach($aReasons as $aRow) - { + foreach ($aReasons as $aRow) { $sDescription = utils::EscapeHtml($aRow['description']); - $sDescription = str_replace(array("\r\n", "\n"), "
    ", $sDescription); + $sDescription = str_replace(["\r\n", "\n"], "
    ", $sDescription); $sTip .= "
    "; $sTip .= "
    Synchronized with {$aRow['name']}
    "; $sTip .= "
    $sDescription
    "; @@ -371,46 +328,43 @@ class ObjectDetailsTemplate extends DisplayTemplate $aFieldsMap[$sAttCode] = $iInputId; $aParams['this->comments('.$sAttCode.')'] = $sSynchroIcon; } - - if ($bEditMode && !($iFlags & OPT_ATT_READONLY)) //TODO: check the data synchro status... - { - $aParams['this->field('.$sAttCode.')'] = "".$this->m_oObj->GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, - $this->m_oObj->Get($sAttCode), - $this->m_oObj->GetEditValue($sAttCode), - $iInputId, // InputID - '', - $iFlags, - array('this' => $this->m_oObj) // aArgs - ).''; - $aFieldsMap[$sAttCode] = $iInputId; - } - else - { + + if ($bEditMode && !($iFlags & OPT_ATT_READONLY)) { //TODO: check the data synchro status... + $aParams['this->field('.$sAttCode.')'] = "".$this->m_oObj->GetFormElementForField( + $oPage, + $sClass, + $sAttCode, + $oAttDef, + $this->m_oObj->Get($sAttCode), + $this->m_oObj->GetEditValue($sAttCode), + $iInputId, // InputID + '', + $iFlags, + ['this' => $this->m_oObj] // aArgs + ).''; + $aFieldsMap[$sAttCode] = $iInputId; + } else { $aParams['this->field('.$sAttCode.')'] = $this->m_oObj->GetAsHTML($sAttCode); } - $aParams['this->'.$sAttCode] = "
    ".$aParams['this->label('.$sAttCode.')'].":".$aParams['this->field('.$sAttCode.')']."".$aParams['this->comments('.$sAttCode.')']."
    "; + $aParams['this->'.$sAttCode] = "
    ".$aParams['this->label('.$sAttCode.')'].":".$aParams['this->field('.$sAttCode.')']."".$aParams['this->comments('.$sAttCode.')']."
    "; } } } - + // Renders the PlugIns used in the template preg_match_all('/\\$PlugIn:([A-Za-z0-9_]+)->properties\\(\\)\\$/', $this->m_sTemplate, $aMatches); $aPlugInProperties = $aMatches[1]; - foreach($aPlugInProperties as $sPlugInClass) - { + foreach ($aPlugInProperties as $sPlugInClass) { /** @var \iApplicationUIExtension $oInstance */ $oInstance = MetaModel::GetPlugins('iApplicationUIExtension', $sPlugInClass); - if ($oInstance != null) // Safety check... - { + if ($oInstance != null) { // Safety check... $offset = $oPage->start_capture(); $oInstance->OnDisplayProperties($this->m_oObj, $oPage, $bEditMode); $sContent = $oPage->end_capture($offset); - $aParams["PlugIn:{$sPlugInClass}->properties()"]= $sContent; + $aParams["PlugIn:{$sPlugInClass}->properties()"] = $sContent; + } else { + $aParams["PlugIn:{$sPlugInClass}->properties()"] = "Missing PlugIn: $sPlugInClass"; } - else - { - $aParams["PlugIn:{$sPlugInClass}->properties()"]= "Missing PlugIn: $sPlugInClass"; - } } $offset = $oPage->start_capture(); @@ -424,4 +378,3 @@ class ObjectDetailsTemplate extends DisplayTemplate } //DisplayTemplate::UnitTest(); -?> diff --git a/application/themehandler.class.inc.php b/application/themehandler.class.inc.php index a9d0887ea..5dc901bbe 100644 --- a/application/themehandler.class.inc.php +++ b/application/themehandler.class.inc.php @@ -1,4 +1,5 @@ [], 'stylesheets' => [ 'main' => '../css/backoffice/main.scss', - ] + ], ], ]; } @@ -75,8 +76,7 @@ class ThemeHandler { try { $sThemeId = utils::GetConfig()->Get('backoffice_default_theme'); - } - catch (CoreException $oCompileException) { + } catch (CoreException $oCompileException) { // Fallback on our default theme in case the config. is not available yet $aDefaultTheme = ThemeHandler::GetDefaultThemeInformation(); $sThemeId = $aDefaultTheme['name']; @@ -97,8 +97,7 @@ class ThemeHandler if (true === utils::GetConfig()->Get('user_preferences.allow_backoffice_theme_override')) { $sThemeId = appUserPreferences::GetPref('backoffice_theme', null); } - } - catch (Exception $oException) { + } catch (Exception $oException) { // Do nothing, already handled by $sThemeId null by default } @@ -213,8 +212,7 @@ class ThemeHandler if (static::ShouldThemeSignatureCheckBeForced($sThemeId)) { static::CompileTheme($sThemeId); } - } - catch (CoreException $oCompileException) { + } catch (CoreException $oCompileException) { // Fallback on our default theme (should always be compilable) in case the previous theme doesn't exists $aDefaultTheme = ThemeHandler::GetDefaultThemeInformation(); $sThemeId = $aDefaultTheme['name']; @@ -270,13 +268,16 @@ class ThemeHandler * @throws \CoreException * @return boolean: indicate whether theme compilation occured */ - public static function CompileTheme($sThemeId, $bSetup=false, $sSetupCompilationTimestamp="", $aThemeParameters = null, $aImportsPaths = null, $sWorkingPath = null) { + public static function CompileTheme($sThemeId, $bSetup = false, $sSetupCompilationTimestamp = "", $aThemeParameters = null, $aImportsPaths = null, $sWorkingPath = null) + { if ($sSetupCompilationTimestamp === "") { $sSetupCompilationTimestamp = microtime(true); } - $sSetupCompilationTimestampInSecunds = (strpos($sSetupCompilationTimestamp, '.') !== false) ? explode('.', - $sSetupCompilationTimestamp)[0] : $sSetupCompilationTimestamp; + $sSetupCompilationTimestampInSecunds = (strpos($sSetupCompilationTimestamp, '.') !== false) ? explode( + '.', + $sSetupCompilationTimestamp + )[0] : $sSetupCompilationTimestamp; $sEnv = APPROOT.'env-'.utils::GetCurrentEnvironment().'/'; @@ -329,7 +330,7 @@ class ThemeHandler } } - foreach ($oFindStylesheetObject->GetStylesheetFileURIs() as $sStylesheet){ + foreach ($oFindStylesheetObject->GetStylesheetFileURIs() as $sStylesheet) { $sTmpThemeScssContent .= '@import "'.$sStylesheet.'";'."\n"; } @@ -341,11 +342,9 @@ class ThemeHandler $iStyleLastModified = $oFindStylesheetObject->GetLastModified(); - $aIncludedImages=static::GetIncludedImages($aThemeParametersWithVersion, $oFindStylesheetObject->GetAllStylesheetPaths(), $sThemeId); - foreach ($aIncludedImages as $sImage) - { - if (is_file($sImage)) - { + $aIncludedImages = static::GetIncludedImages($aThemeParametersWithVersion, $oFindStylesheetObject->GetAllStylesheetPaths(), $sThemeId); + foreach ($aIncludedImages as $sImage) { + if (is_file($sImage)) { $iStylesheetLastModified = @filemtime($sImage); $iStyleLastModified = $iStyleLastModified < $iStylesheetLastModified ? $iStylesheetLastModified : $iStyleLastModified; } @@ -354,34 +353,28 @@ class ThemeHandler // Checking if our compiled css is outdated $iFilemetime = @filemtime($sThemeCssPath); $bFileExists = file_exists($sThemeCssPath); - $bVarSignatureChanged=false; - if ($bFileExists && $bSetup) - { + $bVarSignatureChanged = false; + if ($bFileExists && $bSetup) { $sPrecompiledSignature = static::GetSignature($sThemeCssPath); //check variable signature has changed which is independant from any file modification - if (!empty($sPrecompiledSignature)){ + if (!empty($sPrecompiledSignature)) { $sPreviousVariableSignature = static::GetVarSignature($sPrecompiledSignature); $sCurrentVariableSignature = md5(json_encode($aThemeParameters['variables'])); - $bVarSignatureChanged= ($sPreviousVariableSignature!==$sCurrentVariableSignature); + $bVarSignatureChanged = ($sPreviousVariableSignature !== $sCurrentVariableSignature); } } - if (!$bFileExists || $bVarSignatureChanged || (is_writable($sThemeFolderPath) && ($iFilemetime < $iStyleLastModified))) - { + if (!$bFileExists || $bVarSignatureChanged || (is_writable($sThemeFolderPath) && ($iFilemetime < $iStyleLastModified))) { // Dates don't match. Second chance: check if the already compiled stylesheet exists and is consistent based on its signature $sActualSignature = static::ComputeSignature($aThemeParameters, $aImportsPaths, $aIncludedImages); - if ($bFileExists && !$bSetup) - { + if ($bFileExists && !$bSetup) { $sPrecompiledSignature = static::GetSignature($sThemeCssPath); } - if (!empty($sPrecompiledSignature) && $sActualSignature == $sPrecompiledSignature) - { + if (!empty($sPrecompiledSignature) && $sActualSignature == $sPrecompiledSignature) { touch($sThemeCssPath); // Stylesheet is up to date, mark it as more recent to speedup next time - } - else - { + } else { // Alas, we really need to recompile // Add the signature to the generated CSS file so that the file can be used as a precompiled stylesheet if needed $sSignatureComment = @@ -393,14 +386,16 @@ $sActualSignature */ CSS; - if (!static::$oCompileCSSService) - { + if (!static::$oCompileCSSService) { static::$oCompileCSSService = new CompileCSSService(); } //store it again to change $version with latest compiled time SetupLog::Info("Compiling theme $sThemeId..."); - $sTmpThemeCssContent = static::$oCompileCSSService->CompileCSSFromSASS($sTmpThemeScssContent, $aImportsPaths, - $aThemeParametersWithVersion); + $sTmpThemeCssContent = static::$oCompileCSSService->CompileCSSFromSASS( + $sTmpThemeScssContent, + $aImportsPaths, + $aThemeParametersWithVersion + ); SetupLog::Info("$sThemeId theme compilation done."); file_put_contents($sThemeFolderPath.'/theme-parameters.json', json_encode($aThemeParameters)); file_put_contents($sThemeCssPath, $sSignatureComment.$sTmpThemeCssContent); @@ -425,13 +420,14 @@ CSS; * @return string * @throws \Exception */ - public static function ComputeSignature($aThemeParameters, $aImportsPaths, $aIncludedImages) { + public static function ComputeSignature($aThemeParameters, $aImportsPaths, $aIncludedImages) + { $aSignature = [ 'variables' => md5(json_encode($aThemeParameters['variables'])), 'stylesheets' => [], 'variable_imports' => [], 'images' => [], - 'utility_imports' => [] + 'utility_imports' => [], ]; $oFindStylesheetObject = new FindStylesheetObject(); @@ -473,8 +469,7 @@ CSS; } } - foreach ($aIncludedImages as $sImage) - { + foreach ($aIncludedImages as $sImage) { if (is_file($sImage)) { $sUri = str_replace(self::GetAppRootWithSlashes(), '', $sImage); $aSignature['images'][$sUri] = md5_file($sImage); @@ -501,7 +496,7 @@ CSS; $aCompleteUrls = []; $aToCompleteUrls = []; $aMissingVariables = []; - $aFoundVariables = ['version'=>'']; + $aFoundVariables = ['version' => '']; $aMap = [ 'aCompleteUrls' => $aCompleteUrls, 'aToCompleteUrls' => $aToCompleteUrls, @@ -509,14 +504,11 @@ CSS; 'aFoundVariables' => $aFoundVariables, ]; - foreach ($aStylesheetFiles as $sStylesheetFile) - { + foreach ($aStylesheetFiles as $sStylesheetFile) { $aRes = static::GetAllUrlFromScss($aThemeParametersVariables, $sStylesheetFile); /** @var array $aVal */ - foreach($aMap as $key => $aVal) - { - if (array_key_exists($key, $aMap)) - { + foreach ($aMap as $key => $aVal) { + if (array_key_exists($key, $aMap)) { $aMap[$key] = array_merge($aVal, $aRes[$key]); } } @@ -525,17 +517,14 @@ CSS; $aMap = static::ResolveUncompleteUrlsFromScss($aMap, $aThemeParametersVariables, $aStylesheetFiles); $aImages = []; - foreach ($aMap ['aCompleteUrls'] as $sUri => $sUrl) - { + foreach ($aMap ['aCompleteUrls'] as $sUri => $sUrl) { $sImg = $sUrl; - if (preg_match("/(.*)\?/", $sUrl, $aMatches)) - { - $sImg=$aMatches[1]; + if (preg_match("/(.*)\?/", $sUrl, $aMatches)) { + $sImg = $aMatches[1]; } if (static::HasImageExtension($sImg) - && ! array_key_exists($sImg, $aImages)) - { + && ! array_key_exists($sImg, $aImages)) { $sFilePath = utils::RealPath($sImg, APPROOT); if ($sFilePath !== false) { $sFilePathWithSlashes = str_replace('\\', '/', $sFilePath); @@ -566,8 +555,8 @@ CSS; */ public static function CanonicalizePath($path) { - $path = explode('/', str_replace('//','/', $path)); - $stack = array(); + $path = explode('/', str_replace('//', '/', $path)); + $stack = []; foreach ($path as $seg) { if ($seg == '..') { // Ignore this segment, remove last segment from stack @@ -597,25 +586,23 @@ CSS; */ public static function ResolveUncompleteUrlsFromScss($aMap, $aThemeParametersVariables, $aStylesheetFile) { - $sContent=""; - foreach ($aStylesheetFile as $sStylesheetFile) - { - if (is_file($sStylesheetFile)) - { - $sContent .= '\n' . file_get_contents($sStylesheetFile); + $sContent = ""; + foreach ($aStylesheetFile as $sStylesheetFile) { + if (is_file($sStylesheetFile)) { + $sContent .= '\n'.file_get_contents($sStylesheetFile); } } - $aMissingVariables=$aMap['aMissingVariables']; - $aFoundVariables=$aMap['aFoundVariables']; - $aToCompleteUrls=$aMap['aToCompleteUrls']; - $aCompleteUrls=$aMap['aCompleteUrls']; + $aMissingVariables = $aMap['aMissingVariables']; + $aFoundVariables = $aMap['aFoundVariables']; + $aToCompleteUrls = $aMap['aToCompleteUrls']; + $aCompleteUrls = $aMap['aCompleteUrls']; list($aMissingVariables, $aFoundVariables) = static::FindMissingVariables($aThemeParametersVariables, $aMissingVariables, $aFoundVariables, $sContent, true); list($aToCompleteUrls, $aCompleteUrls) = static::ResolveUrls($aFoundVariables, $aToCompleteUrls, $aCompleteUrls); - $aMap['aMissingVariables']=$aMissingVariables; - $aMap['aFoundVariables']=$aFoundVariables; - $aMap['aToCompleteUrls']=$aToCompleteUrls; - $aMap['aCompleteUrls']=$aCompleteUrls; + $aMap['aMissingVariables'] = $aMissingVariables; + $aMap['aFoundVariables'] = $aFoundVariables; + $aMap['aToCompleteUrls'] = $aToCompleteUrls; + $aMap['aCompleteUrls'] = $aCompleteUrls; return $aMap; } @@ -631,43 +618,29 @@ CSS; * * @return array */ - public static function FindMissingVariables($aThemeParametersVariables, $aMissingVariables, $aFoundVariables, $sContent, $bForceEmptyValueWhenNotFound=false) + public static function FindMissingVariables($aThemeParametersVariables, $aMissingVariables, $aFoundVariables, $sContent, $bForceEmptyValueWhenNotFound = false) { $aNewMissingVars = []; - if (!empty($aMissingVariables)) - { - foreach ($aMissingVariables as $var) - { - if (array_key_exists($var, $aThemeParametersVariables)) - { + if (!empty($aMissingVariables)) { + foreach ($aMissingVariables as $var) { + if (array_key_exists($var, $aThemeParametersVariables)) { $aFoundVariables[$var] = $aThemeParametersVariables[$var]; - } - else - { - if (preg_match_all("/\\\$$var\s*:\s*[\"']{0,1}(.*)[\"']{0,1};/", $sContent, $aValues)) - { + } else { + if (preg_match_all("/\\\$$var\s*:\s*[\"']{0,1}(.*)[\"']{0,1};/", $sContent, $aValues)) { $sValue = $aValues[1][0]; - if (preg_match_all("/([^!]+)!/", $sValue, $aSubValues)) - { + if (preg_match_all("/([^!]+)!/", $sValue, $aSubValues)) { $sValue = trim($aSubValues[1][0], ' "\''); } - if (strpos($sValue, '$') === false) - { + if (strpos($sValue, '$') === false) { $aFoundVariables[$var] = $sValue; - } - else{ + } else { $aNewMissingVars[] = $var; } - } - else - { - if ($bForceEmptyValueWhenNotFound) - { + } else { + if ($bForceEmptyValueWhenNotFound) { $aFoundVariables[$var] = ''; - } - else - { + } else { $aNewMissingVars[] = $var; } } @@ -688,32 +661,23 @@ CSS; */ public static function ResolveUrls($aFoundVariables, array $aToCompleteUrls, array $aCompleteUrls) { - if (!empty($aFoundVariables)) - { + if (!empty($aFoundVariables)) { $aFoundVariablesWithEmptyValue = []; - foreach ($aFoundVariables as $aFoundVariable => $sValue) - { + foreach ($aFoundVariables as $aFoundVariable => $sValue) { $aFoundVariablesWithEmptyValue[$aFoundVariable] = ''; } - foreach ($aToCompleteUrls as $sUrlTemplate) - { + foreach ($aToCompleteUrls as $sUrlTemplate) { unset($aToCompleteUrls[$sUrlTemplate]); $sResolvedUrl = static::ResolveUrl($sUrlTemplate, $aFoundVariables); - if ($sResolvedUrl == false) - { + if ($sResolvedUrl == false) { $aToCompleteUrls[$sUrlTemplate] = $sUrlTemplate; - } - else - { + } else { $sUri = static::ResolveUrl($sUrlTemplate, $aFoundVariablesWithEmptyValue); $aExplodedUri = explode('?', $sUri); - if (empty($aExplodedUri)) - { + if (empty($aExplodedUri)) { $aCompleteUrls[$sUri] = $sResolvedUrl; - } - else - { + } else { $aCompleteUrls[$aExplodedUri[0]] = $sResolvedUrl; } } @@ -738,41 +702,31 @@ CSS; $aMissingVariables = []; $aFoundVariables = []; - if (is_file($sStylesheetFile)) - { + if (is_file($sStylesheetFile)) { $sContent = file_get_contents($sStylesheetFile); - if (preg_match_all("/url\s*\((.*)\)/", $sContent, $aMatches)) - { - foreach ($aMatches[1] as $path) - { + if (preg_match_all("/url\s*\((.*)\)/", $sContent, $aMatches)) { + foreach ($aMatches[1] as $path) { $iRemainingClosingParenthesisPos = strpos($path, ')'); - if ($iRemainingClosingParenthesisPos !== false){ + if ($iRemainingClosingParenthesisPos !== false) { $path = substr($path, 0, $iRemainingClosingParenthesisPos); } if (!array_key_exists($path, $aCompleteUrls) - && !array_key_exists($path, $aToCompleteUrls)) - { - if (preg_match_all("/\\$([\w\-_]+)/", $path, $aCurrentVars)) - { + && !array_key_exists($path, $aToCompleteUrls)) { + if (preg_match_all("/\\$([\w\-_]+)/", $path, $aCurrentVars)) { /** @var string $aCurrentVars */ - foreach ($aCurrentVars[1] as $var) - { - if (!array_key_exists($var, $aMissingVariables)) - { + foreach ($aCurrentVars[1] as $var) { + if (!array_key_exists($var, $aMissingVariables)) { $aMissingVariables[$var] = $var; } } $aToCompleteUrls[$path] = $path; - } - else - { + } else { $aCompleteUrls[$path] = trim($path, "\"'"); } } } } - if (!empty($aMissingVariables)) - { + if (!empty($aMissingVariables)) { list($aMissingVariables, $aFoundVariables) = static::FindMissingVariables($aThemeParametersVariables, $aMissingVariables, $aFoundVariables, $sContent); list($aToCompleteUrls, $aCompleteUrls) = static::ResolveUrls($aFoundVariables, $aToCompleteUrls, $aCompleteUrls); } @@ -782,7 +736,7 @@ CSS; 'aCompleteUrls' => $aCompleteUrls, 'aToCompleteUrls' => $aToCompleteUrls, 'aMissingVariables' => $aMissingVariables, - 'aFoundVariables' => $aFoundVariables + 'aFoundVariables' => $aFoundVariables, ]; } @@ -796,23 +750,21 @@ CSS; */ public static function ResolveUrl($sUrlTemplate, $aFoundVariables) { - $aPattern= []; - $aReplacement= []; - foreach ($aFoundVariables as $aFoundVariable => $aFoundVariableValue) - { + $aPattern = []; + $aReplacement = []; + foreach ($aFoundVariables as $aFoundVariable => $aFoundVariableValue) { //XX + $key + YY - $aPattern[]="/['\"]\s*\+\s*\\\$" . $aFoundVariable . "[\s\+]+\s*['\"]/"; - $aReplacement[]=$aFoundVariableValue; + $aPattern[] = "/['\"]\s*\+\s*\\\$".$aFoundVariable."[\s\+]+\s*['\"]/"; + $aReplacement[] = $aFoundVariableValue; //$key + YY - $aPattern[]="/\\\$" . $aFoundVariable. "[\s\+]+\s*['\"]/"; - $aReplacement[]=$aFoundVariableValue; + $aPattern[] = "/\\\$".$aFoundVariable."[\s\+]+\s*['\"]/"; + $aReplacement[] = $aFoundVariableValue; //XX + $key - $aPattern[]="/['\"]\s*[\+\s]+\\\$" . $aFoundVariable . "$/"; - $aReplacement[]=$aFoundVariableValue; + $aPattern[] = "/['\"]\s*[\+\s]+\\\$".$aFoundVariable."$/"; + $aReplacement[] = $aFoundVariableValue; } - $sResolvedUrl=preg_replace($aPattern, $aReplacement, $sUrlTemplate); - if (strpos($sResolvedUrl, "+")!==false) - { + $sResolvedUrl = preg_replace($aPattern, $aReplacement, $sUrlTemplate); + if (strpos($sResolvedUrl, "+") !== false) { return false; } return trim($sResolvedUrl, "\"'"); @@ -826,17 +778,14 @@ CSS; */ private static function HasImageExtension($path) { - foreach (static::IMAGE_EXTENSIONS as $sExt) - { - if (endsWith($path, $sExt)) - { + foreach (static::IMAGE_EXTENSIONS as $sExt) { + if (endsWith($path, $sExt)) { return true; } } return false; } - /** * @since 3.0.0 N°2982 * Extract the signature for a generated CSS file. @@ -855,16 +804,13 @@ CSS; $iCount = 0; $sPreviousLine = ''; $hFile = @fopen($sFilepath, "r"); - if ($hFile !== false) - { + if ($hFile !== false) { $sLine = ''; - do - { + do { $iCount++; $sPreviousLine = $sLine; $sLine = rtrim(fgets($hFile)); // Remove the trailing \n - } - while (($sLine !== false) && ($sLine != '=== SIGNATURE END ===') && ($iCount <= 100)); + } while (($sLine !== false) && ($sLine != '=== SIGNATURE END ===') && ($iCount <= 100)); fclose($hFile); } return $sPreviousLine; @@ -879,8 +825,7 @@ CSS; public static function GetVarSignature($JsonSignature) { $aJsonArray = json_decode($JsonSignature, true); - if (array_key_exists('variables', $aJsonArray)) - { + if (array_key_exists('variables', $aJsonArray)) { return $aJsonArray['variables']; } return false; @@ -904,23 +849,22 @@ CSS; $oFindStylesheetObject->ResetLastStyleSheet(); } - foreach($aImportsPaths as $sPath) - { + foreach ($aImportsPaths as $sPath) { $sAlterableFileURI = $sFileURI; $sFilePath = $sPath.'/'.$sAlterableFileURI; $sImportedFile = realpath($sFilePath); - if ($sImportedFile === false){ + if ($sImportedFile === false) { // Handle shortcut syntax : @import "typo" ; // file matched: typo.scss $sFilePath2 = "$sFilePath.scss"; $sImportedFile = realpath($sFilePath2); - if ($sImportedFile){ + if ($sImportedFile) { self::FindStylesheetFile("$sAlterableFileURI.scss", [ $sPath ], $oFindStylesheetObject, $bImports); $sImportedFile = false; } } - if ($sImportedFile === false){ + if ($sImportedFile === false) { // Handle shortcut syntax : @import "typo" ; // file matched: _typo.scss $sShortCut = substr($sFilePath, strrpos($sFilePath, '/') + 1); @@ -930,11 +874,10 @@ CSS; } if ((file_exists($sImportedFile)) - && (!$oFindStylesheetObject->AlreadyFetched($sImportedFile))) - { - if ($bImports){ + && (!$oFindStylesheetObject->AlreadyFetched($sImportedFile))) { + if ($bImports) { $oFindStylesheetObject->AddImport($sAlterableFileURI, $sImportedFile); - }else{ + } else { $oFindStylesheetObject->AddStylesheet($sAlterableFileURI, $sImportedFile); } $oFindStylesheetObject->UpdateLastModified($sImportedFile); @@ -942,8 +885,8 @@ CSS; //Regexp matching on all included scss files : @import 'XXX.scss'; $sDirUri = dirname($sAlterableFileURI); preg_match_all('/@import \s*[\"\']([^\"\']*)\s*[\"\']\s*;/', file_get_contents($sImportedFile), $aMatches); - if ( (is_array($aMatches)) && (count($aMatches)!==0) ){ - foreach ($aMatches[1] as $sImportedFile){ + if ((is_array($aMatches)) && (count($aMatches) !== 0)) { + foreach ($aMatches[1] as $sImportedFile) { self::FindStylesheetFile("$sDirUri/$sImportedFile", [ $sPath ], $oFindStylesheetObject, true); } } @@ -964,8 +907,7 @@ CSS; { $iPos = strrpos($sSubject, $sSearch); - if($iPos !== false) - { + if ($iPos !== false) { $sSubject = substr_replace($sSubject, $sReplace, $iPos, strlen($sSearch)); } @@ -994,18 +936,14 @@ CSS; public static function CloneThemeParameterAndIncludeVersion($aThemeParameters, $bSetupCompilationTimestamp, $aImportsPaths) { $aThemeParametersVariable = []; - if (array_key_exists('variables', $aThemeParameters)) - { - if (is_array($aThemeParameters['variables'])) - { + if (array_key_exists('variables', $aThemeParameters)) { + if (is_array($aThemeParameters['variables'])) { $aThemeParametersVariable = array_merge([], $aThemeParameters['variables']); } } - if (array_key_exists('variable_imports', $aThemeParameters)) - { - if (is_array($aThemeParameters['variable_imports'])) - { + if (array_key_exists('variable_imports', $aThemeParameters)) { + if (is_array($aThemeParameters['variable_imports'])) { $aThemeParametersVariable = array_merge($aThemeParametersVariable, static::GetVariablesFromFile($aThemeParameters['variable_imports'], $aImportsPaths)); } } @@ -1021,11 +959,11 @@ CSS; * @return array * @since 3.0.0 N°3593 */ - public static function GetVariablesFromFile($aVariableFiles, $aImportsPaths){ + public static function GetVariablesFromFile($aVariableFiles, $aImportsPaths) + { $aVariablesResults = []; - foreach ($aVariableFiles as $sVariableFile) - { - foreach($aImportsPaths as $sPath) { + foreach ($aVariableFiles as $sVariableFile) { + foreach ($aImportsPaths as $sPath) { $sFilePath = $sPath.'/'.$sVariableFile; $sImportedFile = realpath($sFilePath); if ($sImportedFile !== false) { @@ -1041,9 +979,8 @@ CSS; } } } - array_map( function($sVariableValue) { return ltrim($sVariableValue); }, $aVariablesResults ); + array_map(function ($sVariableValue) { return ltrim($sVariableValue); }, $aVariablesResults); return $aVariablesResults; } } - diff --git a/application/themehandlerservice.class.inc.php b/application/themehandlerservice.class.inc.php index cc06c93fe..837c176c3 100644 --- a/application/themehandlerservice.class.inc.php +++ b/application/themehandlerservice.class.inc.php @@ -1,4 +1,5 @@ Get('transactions_enabled'); - if (!$bTransactionsEnabled) - { + if (!$bTransactionsEnabled) { return 'notransactions'; // Any value will do } $sClass = 'privUITransaction'.MetaModel::GetConfig()->Get('transaction_storage'); - if (!class_exists($sClass, false)) - { + if (!class_exists($sClass, false)) { IssueLog::Error("Incorrect value '".MetaModel::GetConfig()->Get('transaction_storage')."' for 'transaction_storage', the class '$sClass' does not exists. Using privUITransactionSession instead for storing sessions."); $sClass = 'privUITransactionSession'; } @@ -62,16 +61,14 @@ class privUITransaction public static function IsTransactionValid($id, $bRemoveTransaction = true) { $bTransactionsEnabled = MetaModel::GetConfig()->Get('transactions_enabled'); - if (!$bTransactionsEnabled) - { + if (!$bTransactionsEnabled) { return true; // All values are valid } $sClass = 'privUITransaction'.MetaModel::GetConfig()->Get('transaction_storage'); - if (!class_exists($sClass, false)) - { + if (!class_exists($sClass, false)) { $sClass = 'privUITransactionSession'; } - + return $sClass::IsTransactionValid($id, $bRemoveTransaction); } @@ -83,16 +80,14 @@ class privUITransaction public static function RemoveTransaction($id) { $bTransactionsEnabled = MetaModel::GetConfig()->Get('transactions_enabled'); - if (!$bTransactionsEnabled) - { + if (!$bTransactionsEnabled) { return; // Nothing to do } $sClass = 'privUITransaction'.MetaModel::GetConfig()->Get('transaction_storage'); - if (!class_exists($sClass, false)) - { + if (!class_exists($sClass, false)) { $sClass = 'privUITransactionSession'; } - + $sClass::RemoveTransaction($id); } } @@ -114,17 +109,16 @@ class privUITransactionSession */ public static function GetNewTransactionId() { - if (!Session::IsSet('transactions')) - { + if (!Session::IsSet('transactions')) { Session::Set('transactions', []); } // Strictly speaking, the two lines below should be grouped together // by a critical section // sem_acquire($rSemIdentified); - $id = static::GetUserPrefix() . str_replace(array('.', ' '), '', microtime()); + $id = static::GetUserPrefix().str_replace(['.', ' '], '', microtime()); Session::Set(['transactions', $id], true); // sem_release($rSemIdentified); - + return (string)$id; } @@ -135,20 +129,17 @@ class privUITransactionSession * @param int $id Identifier of the transaction, as returned by GetNewTransactionId * @param bool $bRemoveTransaction True if the transaction must be removed * @return bool True if the transaction is valid, false otherwise - */ + */ public static function IsTransactionValid($id, $bRemoveTransaction = true) { $bResult = false; - if (Session::IsSet('transactions')) - { + if (Session::IsSet('transactions')) { // Strictly speaking, the eight lines below should be grouped together // inside the same critical section as above // sem_acquire($rSemIdentified); - if (Session::IsSet(['transactions', $id])) - { + if (Session::IsSet(['transactions', $id])) { $bResult = true; - if ($bRemoveTransaction) - { + if ($bRemoveTransaction) { Session::Unset(['transactions', $id]); } } @@ -156,7 +147,7 @@ class privUITransactionSession } return $bResult; } - + /** * Removes the transaction specified by its id * @param int $id The Identifier (as returned by GetNewTranscationId) of the transaction to be removed. @@ -164,17 +155,15 @@ class privUITransactionSession */ public static function RemoveTransaction($id) { - if (Session::IsSet('transactions')) - { + if (Session::IsSet('transactions')) { // Strictly speaking, the three lines below should be grouped together // inside the same critical section as above // sem_acquire($rSemIdentified); - if (Session::IsSet(['transactions', $id])) - { + if (Session::IsSet(['transactions', $id])) { Session::Unset(['transactions', $id]); } // sem_release($rSemIdentified); - } + } } /** @@ -197,7 +186,7 @@ class privUITransactionSession class privUITransactionFile { /** @var int Value to use when no user logged */ - const UNAUTHENTICATED_USER_ID = -666; + public const UNAUTHENTICATED_USER_ID = -666; /** * @return int current user id, or {@see self::UNAUTHENTICATED_USER_ID} if no user logged @@ -228,22 +217,18 @@ class privUITransactionFile */ public static function GetNewTransactionId() { - if (!is_dir(APPROOT.'data/transactions')) - { - if (!is_writable(APPROOT.'data')) - { + if (!is_dir(APPROOT.'data/transactions')) { + if (!is_writable(APPROOT.'data')) { throw new Exception('The directory "'.APPROOT.'data" must be writable to the application.'); } // condition avoids race condition N°2345 // See https://github.com/kalessil/phpinspectionsea/blob/master/docs/probable-bugs.md#mkdir-race-condition - if (!mkdir($concurrentDirectory = APPROOT.'data/transactions') && !is_dir($concurrentDirectory)) - { + if (!mkdir($concurrentDirectory = APPROOT.'data/transactions') && !is_dir($concurrentDirectory)) { throw new Exception('Failed to create the directory "'.APPROOT.'data/transactions". Ajust the rights on the parent directory or let an administrator create the transactions directory and give the web sever enough rights to write into it.'); } } - if (!is_writable(APPROOT.'data/transactions')) - { + if (!is_writable(APPROOT.'data/transactions')) { throw new Exception('The directory "'.APPROOT.'data/transactions" must be writable to the application.'); } @@ -277,8 +262,7 @@ class privUITransactionFile // Constraint the transaction file within APPROOT.'data/transactions' $sTransactionDir = realpath(APPROOT.'data/transactions'); $sFilepath = utils::RealPath($sTransactionDir.'/'.$id, $sTransactionDir); - if (($sFilepath === false) || (strlen($sTransactionDir) == strlen($sFilepath))) - { + if (($sFilepath === false) || (strlen($sTransactionDir) == strlen($sFilepath))) { return false; } @@ -297,15 +281,11 @@ class privUITransactionFile return false; } - if ($bRemoveTransaction) - { + if ($bRemoveTransaction) { $bResult = @unlink($sFilepath); - if (!$bResult) - { + if (!$bResult) { self::Error('IsTransactionValid: FAILED to remove transaction '.$id); - } - else - { + } else { self::Info('IsTransactionValid: OK. Removed transaction: '.$id); } } @@ -347,13 +327,11 @@ class privUITransactionFile } clearstatcache(); - $iLimit = time() - 24*3600; + $iLimit = time() - 24 * 3600; $sPattern = $sTransactionDir ? "$sTransactionDir/*" : APPROOT.'data/transactions/*'; $aTransactions = glob($sPattern); - foreach($aTransactions as $sFileName) - { - if (filemtime($sFileName) < $iLimit) - { + foreach ($aTransactions as $sFileName) { + if (filemtime($sFileName) < $iLimit) { @unlink($sFileName); self::Info('CleanupOldTransactions: Deleted transaction: '.$sFileName); } @@ -367,10 +345,9 @@ class privUITransactionFile protected static function GetPendingTransactions() { clearstatcache(); - $aResult = array(); + $aResult = []; $aTransactions = glob(APPROOT.'data/transactions/'.self::GetUserPrefix().'*'); - foreach($aTransactions as $sFileName) - { + foreach ($aTransactions as $sFileName) { $aResult[] = date('Y-m-d H:i:s', filemtime($sFileName)).' - '.basename($sFileName); } sort($aResult); @@ -398,13 +375,14 @@ class privUITransactionFile { self::Write('Warning | '.$sText); } - + protected static function Error($sText) { self::Write('Error | '.$sText); } - protected static function IsLogEnabled() { + protected static function IsLogEnabled() + { $oConfig = MetaModel::GetConfig(); if (is_null($oConfig)) { return false; diff --git a/application/twigextension.class.inc.php b/application/twigextension.class.inc.php index ed045862e..dd47bee48 100644 --- a/application/twigextension.class.inc.php +++ b/application/twigextension.class.inc.php @@ -34,24 +34,32 @@ class TwigExtension { // Filter to translate a string via the Dict::S function // Usage in twig: {{ 'String:ToTranslate'|dict_s }} - $oTwigEnv->addFilter(new TwigFilter('dict_s', + $oTwigEnv->addFilter( + new TwigFilter( + 'dict_s', function ($sStringCode, $sDefault = null, $bUserLanguageOnly = false) { return Dict::S($sStringCode, $sDefault, $bUserLanguageOnly); - }) + } + ) ); // Filter to format a string via the Dict::Format function // Usage in twig: {{ 'String:ToTranslate'|dict_format() }} - $oTwigEnv->addFilter(new TwigFilter('dict_format', + $oTwigEnv->addFilter( + new TwigFilter( + 'dict_format', function ($sStringCode, $sParam01 = null, $sParam02 = null, $sParam03 = null, $sParam04 = null) { return Dict::Format($sStringCode, $sParam01, $sParam02, $sParam03, $sParam04); - }) + } + ) ); // Filter to format output // example a DateTime is converted to user format // Usage in twig: {{ 'String:ToFormat'|output_format }} - $oTwigEnv->addFilter(new TwigFilter('date_format', + $oTwigEnv->addFilter( + new TwigFilter( + 'date_format', function ($sDate) { try { if (preg_match('@^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d$@', trim($sDate))) { @@ -60,22 +68,23 @@ class TwigExtension if (preg_match('@^\d\d\d\d-\d\d-\d\d$@', trim($sDate))) { return AttributeDate::GetFormat()->Format($sDate); } - } - catch (Exception $e) - { + } catch (Exception $e) { } return $sDate; - }) + } + ) ); - // Filter to format output // example a DateTime is converted to user format // Usage in twig: {{ 'String:ToFormat'|output_format }} - $oTwigEnv->addFilter(new TwigFilter('size_format', + $oTwigEnv->addFilter( + new TwigFilter( + 'size_format', function ($sSize) { return utils::BytesToFriendlyFormat($sSize); - }) + } + ) ); // Filter to enable base64 encode/decode @@ -85,7 +94,8 @@ class TwigExtension // Filter to enable json decode (encode already exists) // Usage in twig: {{ aSomeArray|json_decode }} - $oTwigEnv->addFilter(new TwigFilter('json_decode', function ($sJsonString, $bAssoc = false) { + $oTwigEnv->addFilter( + new TwigFilter('json_decode', function ($sJsonString, $bAssoc = false) { return json_decode($sJsonString, $bAssoc); }) ); diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php index ed74e86f9..45c077972 100644 --- a/application/ui.extkeywidget.class.inc.php +++ b/application/ui.extkeywidget.class.inc.php @@ -1,4 +1,5 @@ GetTargetClass(); $iMaxComboLength = $oAttDef->GetMaximumComboLength(); @@ -102,8 +113,7 @@ class UIExtKeyWidget } $oWidget = new UIExtKeyWidget($sTargetClass, $iInputId, $sAttCode, $bSearchMode); if (!$bSearchMode) { - switch ($sDisplayStyle) - { + switch ($sDisplayStyle) { case 'radio': case 'radio_horizontal': case 'radio_vertical': @@ -114,12 +124,38 @@ class UIExtKeyWidget case 'select': case 'list': default: - return $oWidget->DisplaySelect($oPage, $iMaxComboLength, $bAllowTargetCreation, $sTitle, $oAllowedValues, $value, - $bMandatory, $sFieldName, $sFormPrefix, $aArgs, $sInputType); + return $oWidget->DisplaySelect( + $oPage, + $iMaxComboLength, + $bAllowTargetCreation, + $sTitle, + $oAllowedValues, + $value, + $bMandatory, + $sFieldName, + $sFormPrefix, + $aArgs, + $sInputType + ); } } else { - return $oWidget->Display($oPage, $iMaxComboLength, $bAllowTargetCreation, $sTitle, $oAllowedValues, $value, $iInputId, - $bMandatory, $sFieldName, $sFormPrefix, $aArgs, null, $sDisplayStyle, true, $sInputType); + return $oWidget->Display( + $oPage, + $iMaxComboLength, + $bAllowTargetCreation, + $sTitle, + $oAllowedValues, + $value, + $iInputId, + $bMandatory, + $sFieldName, + $sFormPrefix, + $aArgs, + null, + $sDisplayStyle, + true, + $sInputType + ); } } @@ -158,7 +194,7 @@ class UIExtKeyWidget * @since 3.0.0 N°2508 - Include Obsolescence icon within list and autocomplete * @since 3.0.0 N°3750 new $sInputType parameter */ - public function DisplaySelect(WebPage $oPage, $iMaxComboLength, $bAllowTargetCreation, $sTitle, DBObjectset $oAllowedValues, $value, $bMandatory, $sFieldName, $sFormPrefix = '', $aArgs = array(), &$sInputType = '') + public function DisplaySelect(WebPage $oPage, $iMaxComboLength, $bAllowTargetCreation, $sTitle, DBObjectset $oAllowedValues, $value, $bMandatory, $sFieldName, $sFormPrefix = '', $aArgs = [], &$sInputType = '') { $sTitle = addslashes($sTitle); $oPage->LinkScriptFromAppRoot('js/extkeywidget.js'); @@ -194,7 +230,7 @@ class UIExtKeyWidget $bIsAutocomplete = $oAllowedValues->CountExceeds($iMaxComboLength); $sWrapperCssClass = $bIsAutocomplete ? 'ibo-input-select-autocomplete-wrapper' : 'ibo-input-select-wrapper'; $sHTMLValue = "
    sAttCode."\" data-validation=\"untouched\" data-accessibility-selectize-label=\"$sTitle\">"; - + // We just need to compare the number of entries with MaxComboLength, so no need to get the real count. if (!$bIsAutocomplete) { // Discrete list of values, use a SELECT or RADIO buttons depending on the config @@ -281,21 +317,17 @@ EOF $oPage->add_ready_script("$('#$this->iId').one('validate', function() { $(this).trigger('change'); } );"); } $sHTMLValue .= "
    "; - } - else - { + } else { // Too many choices, use an autocomplete // Check that the given value is allowed $oSearch = $oAllowedValues->GetFilter(); $oSearch->AddCondition('id', $value); $oSet = new DBObjectSet($oSearch); - if ($oSet->Count() == 0) - { + if ($oSet->Count() == 0) { $value = null; } - if (is_null($value) || ($value == 0)) // Null values are displayed as '' - { + if (is_null($value) || ($value == 0)) { // Null values are displayed as '' $sDisplayValue = isset($aArgs['sDefaultValue']) ? $aArgs['sDefaultValue'] : ''; } else { $sDisplayValue = $this->GetObjectName($value); @@ -376,36 +408,30 @@ JS $sHTMLValue = "
    "; - if (is_null($oAllowedValues)) - { + if (is_null($oAllowedValues)) { throw new Exception('Implementation: null value for allowed values definition'); } $oAllowedValues->SetShowObsoleteData(utils::ShowObsoleteData()); // We just need to compare the number of entries with MaxComboLength, so no need to get the real count. - if (!$oAllowedValues->CountExceeds($iMaxComboLength)) - { + if (!$oAllowedValues->CountExceeds($iMaxComboLength)) { // Discrete list of values, use a SELECT or RADIO buttons depending on the config $sValidationField = null; $bVertical = ($sDisplayStyle != 'radio_horizontal'); $bExtensions = false; $oAllowedValues->Rewind(); - $aAllowedValues = array(); - while($oObj = $oAllowedValues->Fetch()) - { + $aAllowedValues = []; + while ($oObj = $oAllowedValues->Fetch()) { $aAllowedValues[$oObj->GetKey()] = $oObj->GetName(); } $sHTMLValue .= $oPage->GetRadioButtons($aAllowedValues, $value, $this->iId, "{$sAttrFieldPrefix}{$sFieldName}", false /* $bMandatory will be placed manually */, $bVertical, $sValidationField); - $aEventsList[] ='change'; - } - else - { + $aEventsList[] = 'change'; + } else { $sHTMLValue .= "unable to display. Too much values"; } $sHTMLValue .= '
    '; - if ($bExtensions && MetaModel::IsHierarchicalClass($this->sTargetClass) !== false) - { + if ($bExtensions && MetaModel::IsHierarchicalClass($this->sTargetClass) !== false) { $sHTMLValue .= "
    iId}\" onClick=\"oACWidget_{$this->iId}.HKDisplay();\">
    "; $oPage->add_ready_script( <<sTargetClass)) ? 'SelectObjectClass' : 'CreateObject'; $sHTMLValue .= "
    iId}\" onClick=\"oACWidget_{$this->iId}.{$sCallbackName}();\">
    "; @@ -471,7 +496,7 @@ JS * * @since 3.0.0 N°3750 new $sInputType parameter */ - public function Display(WebPage $oPage, $iMaxComboLength, $bAllowTargetCreation, $sTitle, DBObjectset $oAllowedValues, $value, $iInputId, $bMandatory, $sFieldName, $sFormPrefix = '', $aArgs = array(), $bSearchMode = null, $sDisplayStyle = 'select', $bSearchMultiple = true, &$sInputType = '') + public function Display(WebPage $oPage, $iMaxComboLength, $bAllowTargetCreation, $sTitle, DBObjectset $oAllowedValues, $value, $iInputId, $bMandatory, $sFieldName, $sFormPrefix = '', $aArgs = [], $bSearchMode = null, $sDisplayStyle = 'select', $bSearchMultiple = true, &$sInputType = '') { if (!is_null($bSearchMode)) { $this->bSearchMode = $bSearchMode; @@ -521,7 +546,7 @@ JS $bVertical = ($sDisplayStyle != 'radio_horizontal'); $bExtensions = false; $oAllowedValues->Rewind(); - $aAllowedValues = array(); + $aAllowedValues = []; while ($oObj = $oAllowedValues->Fetch()) { $aAllowedValues[$oObj->GetKey()] = $oObj->GetName(); } @@ -568,22 +593,22 @@ EOF } $sHTMLValue .= "\n"; } - $sHTMLValue .= "\n"; - $sHTMLValue .= "
    \n"; + $sHTMLValue .= "\n"; + $sHTMLValue .= "
    \n"; - $sInputType = CmdbAbstractObject::ENUM_INPUT_TYPE_DROPDOWN_RAW; - if (($this->bSearchMode) && $bSearchMultiple) { - $sInputType = CmdbAbstractObject::ENUM_INPUT_TYPE_DROPDOWN_MULTIPLE_CHOICES; - $aOptions = array( - 'header' => true, - 'checkAllText' => Dict::S('UI:SearchValue:CheckAll'), - 'uncheckAllText' => Dict::S('UI:SearchValue:UncheckAll'), - 'noneSelectedText' => Dict::S('UI:SearchValue:Any'), - 'selectedText' => Dict::S('UI:SearchValue:NbSelected'), - 'selectedList' => 1, - ); - $sJSOptions = json_encode($aOptions); - $oPage->add_ready_script("$('.multiselect').multiselect($sJSOptions);"); + $sInputType = CmdbAbstractObject::ENUM_INPUT_TYPE_DROPDOWN_RAW; + if (($this->bSearchMode) && $bSearchMultiple) { + $sInputType = CmdbAbstractObject::ENUM_INPUT_TYPE_DROPDOWN_MULTIPLE_CHOICES; + $aOptions = [ + 'header' => true, + 'checkAllText' => Dict::S('UI:SearchValue:CheckAll'), + 'uncheckAllText' => Dict::S('UI:SearchValue:UncheckAll'), + 'noneSelectedText' => Dict::S('UI:SearchValue:Any'), + 'selectedText' => Dict::S('UI:SearchValue:NbSelected'), + 'selectedList' => 1, + ]; + $sJSOptions = json_encode($aOptions); + $oPage->add_ready_script("$('.multiselect').multiselect($sJSOptions);"); } $oPage->add_ready_script( <<GetObjectName($value); @@ -673,20 +697,22 @@ JS $oAttDef = MetaModel::GetAttributeDef(get_class($oCurrObject), $this->sAttCode); /** @var \DBObject $oCurrObject */ $aArgs = $oCurrObject->ToArgsForQuery(); - $aParams = array('query_params' => $aArgs); + $aParams = ['query_params' => $aArgs]; $oSet = $oAttDef->GetAllowedValuesAsObjectSet($aArgs); $oFilter = $oSet->GetFilter(); - } else if (!empty($this->sFilter)) { - $aParams = array(); + } elseif (!empty($this->sFilter)) { + $aParams = []; $oFilter = DBObjectSearch::FromOQL($this->sFilter); } else { - $aParams = array(); + $aParams = []; $oFilter = new DBObjectSearch($this->sTargetClass); } $oFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode); $oBlock = new DisplayBlock($oFilter, 'search', false, $aParams); - $oPage->AddUiBlock($oBlock->GetDisplay($oPage, 'dtc_'.$this->iId, - array( + $oPage->AddUiBlock($oBlock->GetDisplay( + $oPage, + 'dtc_'.$this->iId, + [ 'menu' => false, 'currentId' => $this->iId, 'table_id' => "dr_{$this->iId}", @@ -694,12 +720,13 @@ JS 'selection_mode' => true, 'selection_type' => 'single', 'cssCount' => '#count_'.$this->iId.'_results', - ) + ] )); $sCancel = Dict::S('UI:Button:Cancel'); $sOK = Dict::S('UI:Button:Ok'); $sEmptyList = Dict::S('UI:Message:EmptyList:UseSearchForm'); - $oPage->add(<<add( + <<

    {$sEmptyList}

    @@ -711,7 +738,8 @@ HTML ); $sDialogTitleSanitized = addslashes(utils::HtmlToText($sTitle)); - $oPage->add_ready_script(<<add_ready_script( + <<iId}').dialog({ width: $(window).width()*0.8, height: $(window).height()*0.8, @@ -751,14 +779,12 @@ JS */ public function SearchObjectsToSelect(WebPage $oP, $sFilter, $sRemoteClass = '', $oObj = null) { - if (is_null($sFilter)) - { + if (is_null($sFilter)) { throw new Exception('Implementation: null value for allowed values definition'); } $oFilter = DBObjectSearch::FromOQL($sFilter); - if (strlen($sRemoteClass) > 0) - { + if (strlen($sRemoteClass) > 0) { $oFilter->ChangeClass($sRemoteClass); } $oFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode); @@ -766,26 +792,26 @@ JS // Current extkey value, so we can display event if it is not available anymore (eg. archived). $iCurrentExtKeyId = (is_null($oObj)) ? 0 : $oObj->Get($this->sAttCode); - $oBlock = new DisplayBlock($oFilter, 'list_search', false, array('query_params' => array('this' => $oObj, 'current_extkey_id' => $iCurrentExtKeyId))); - $oBlock->Display($oP, $this->iId.'_results', array('this' => $oObj, 'cssCount'=> '#count_'.$this->iId.'_results', 'menu' => false, 'selection_mode' => true, 'selection_type' => 'single', 'table_id' => 'select_'.$this->sAttCode)); // Don't display the 'Actions' menu on the results + $oBlock = new DisplayBlock($oFilter, 'list_search', false, ['query_params' => ['this' => $oObj, 'current_extkey_id' => $iCurrentExtKeyId]]); + $oBlock->Display($oP, $this->iId.'_results', ['this' => $oObj, 'cssCount' => '#count_'.$this->iId.'_results', 'menu' => false, 'selection_mode' => true, 'selection_type' => 'single', 'table_id' => 'select_'.$this->sAttCode]); // Don't display the 'Actions' menu on the results } - /** - * Search for objects to be selected - * - * @param WebPage $oP The page used for the output (usually an AjaxWebPage) - * @param string $sFilter The OQL expression used to define/limit limit the scope of possible values - * @param DBObject $oObj The current object for the OQL context - * @param string $sContains The text of the autocomplete to filter the results - * @param string $sOutputFormat - * @param null $sOperation for the values @see ValueSetObjects->LoadValues() not used since 3.0.0 - * - * @throws CoreException - * @throws OQLException - * - * @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value for $oObj for PHP 8.0 compatibility - */ - public function AutoComplete(WebPage $oP, $sFilter, $oObj, $sContains, $sOutputFormat = self::ENUM_OUTPUT_FORMAT_CSV, $sOperation = null ) + /** + * Search for objects to be selected + * + * @param WebPage $oP The page used for the output (usually an AjaxWebPage) + * @param string $sFilter The OQL expression used to define/limit limit the scope of possible values + * @param DBObject $oObj The current object for the OQL context + * @param string $sContains The text of the autocomplete to filter the results + * @param string $sOutputFormat + * @param null $sOperation for the values @see ValueSetObjects->LoadValues() not used since 3.0.0 + * + * @throws CoreException + * @throws OQLException + * + * @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value for $oObj for PHP 8.0 compatibility + */ + public function AutoComplete(WebPage $oP, $sFilter, $oObj, $sContains, $sOutputFormat = self::ENUM_OUTPUT_FORMAT_CSV, $sOperation = null) { if (is_null($sFilter)) { throw new Exception('Implementation: null value for allowed values definition'); @@ -799,38 +825,32 @@ JS $oValuesSet->SetSort(false); $oValuesSet->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode); $oValuesSet->SetLimit($iMax); - $aValuesStartWith = $oValuesSet->GetValuesForAutocomplete(array('this' => $oObj, 'current_extkey_id' => $iCurrentExtKeyId), $sContains, 'start_with'); + $aValuesStartWith = $oValuesSet->GetValuesForAutocomplete(['this' => $oObj, 'current_extkey_id' => $iCurrentExtKeyId], $sContains, 'start_with'); asort($aValuesStartWith); $aValues = $aValuesStartWith; if (sizeof($aValues) < $iMax) { - $aValuesContains = $oValuesSet->GetValuesForAutocomplete(array('this' => $oObj, 'current_extkey_id' => $iCurrentExtKeyId), $sContains, 'contains'); + $aValuesContains = $oValuesSet->GetValuesForAutocomplete(['this' => $oObj, 'current_extkey_id' => $iCurrentExtKeyId], $sContains, 'contains'); asort($aValuesContains); $iSize = sizeof($aValues); - foreach ($aValuesContains as $sKey => $sFriendlyName) - { - if (!isset($aValues[$sKey])) - { + foreach ($aValuesContains as $sKey => $sFriendlyName) { + if (!isset($aValues[$sKey])) { $aValues[$sKey] = $sFriendlyName; - if (++$iSize >= $iMax) - { + if (++$iSize >= $iMax) { break; } } } - } - elseif (!in_array($sContains, $aValues)) - { - $aValuesEquals = $oValuesSet->GetValuesForAutocomplete(array('this' => $oObj, 'current_extkey_id' => $iCurrentExtKeyId), $sContains, 'equals'); + } elseif (!in_array($sContains, $aValues)) { + $aValuesEquals = $oValuesSet->GetValuesForAutocomplete(['this' => $oObj, 'current_extkey_id' => $iCurrentExtKeyId], $sContains, 'equals'); // Note: Here we cannot use array_merge as it would reindex the numeric keys starting from 0 when keys are actually the objects ID. // As a workaround we use array_replace as it does preserve numeric keys. It's ok if some values from $aValuesEquals are replaced with values from $aValues as they contain the same data. $aValues = array_replace($aValuesEquals, $aValues); } - switch($sOutputFormat) - { + switch ($sOutputFormat) { case static::ENUM_OUTPUT_FORMAT_JSON: - $aJsonMap = array(); + $aJsonMap = []; foreach ($aValues as $sKey => $aValue) { $aElt = ['value' => $sKey, 'label' => utils::EscapeHtml($aValue['label']), 'obsolescence_flag' => $aValue['obsolescence_flag']]; if ($aValue['additional_field'] != '') { @@ -851,8 +871,7 @@ JS break; case static::ENUM_OUTPUT_FORMAT_CSV: - foreach($aValues as $sKey => $aValue) - { + foreach ($aValues as $sKey => $aValue) { $oP->add(trim($aValue['label'])."\t".$sKey."\n"); } break; @@ -874,7 +893,7 @@ JS */ public function GetObjectName($iObjId, $sFormAttCode = null) { - $aModifierProps = array(); + $aModifierProps = []; $aModifierProps['UserRightsGetSelectFilter']['bSearchMode'] = $this->bSearchMode; $oObj = MetaModel::GetObject($this->sTargetClass, $iObjId, false, false, $aModifierProps); @@ -884,9 +903,7 @@ JS } else { return $oObj->Get($sFormAttCode); } - } - else - { + } else { return ''; } } @@ -902,30 +919,29 @@ JS */ public function GetClassSelectionForm(WebPage $oPage) { - // For security reasons: check that the "proposed" class is actually a subclass of the linked class - // and that the current user is allowed to create objects of this class - $aSubClasses = MetaModel::EnumChildClasses($this->sTargetClass, ENUM_CHILD_CLASSES_ALL); - $aPossibleClasses = array(); - foreach($aSubClasses as $sCandidateClass) - { - if (!MetaModel::IsAbstract($sCandidateClass) && (UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) - { - $aPossibleClasses[$sCandidateClass] = MetaModel::GetName($sCandidateClass); - } - } + // For security reasons: check that the "proposed" class is actually a subclass of the linked class + // and that the current user is allowed to create objects of this class + $aSubClasses = MetaModel::EnumChildClasses($this->sTargetClass, ENUM_CHILD_CLASSES_ALL); + $aPossibleClasses = []; + foreach ($aSubClasses as $sCandidateClass) { + if (!MetaModel::IsAbstract($sCandidateClass) && (UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) { + $aPossibleClasses[$sCandidateClass] = MetaModel::GetName($sCandidateClass); + } + } $sClassLabel = MetaModel::GetName($this->sTargetClass); - $sDialogTitle = Dict::Format('UI:CreationTitle_Class', $sClassLabel);; - $oBlock = UIContentBlockUIBlockFactory::MakeStandard('ac_create_'.$this->iId,['ibo-is-visible']); + $sDialogTitle = Dict::Format('UI:CreationTitle_Class', $sClassLabel); + ; + $oBlock = UIContentBlockUIBlockFactory::MakeStandard('ac_create_'.$this->iId, ['ibo-is-visible']); $oPage->AddSubBlock($oBlock); $oClassForm = FormUIBlockFactory::MakeStandard(); $oBlock->AddSubBlock($oClassForm); - $oClassForm->AddSubBlock(cmdbAbstractObject::DisplayBlockSelectClassToCreate( $sClassLabel, $this->sTargetClass, $aPossibleClasses)); + $oClassForm->AddSubBlock(cmdbAbstractObject::DisplayBlockSelectClassToCreate($sClassLabel, $this->sTargetClass, $aPossibleClasses)); $sDialogTitleEscaped = addslashes($sDialogTitle); - $oPage->add_ready_script("$('#ac_create_$this->iId').dialog({ width: 'auto', height: 'auto', maxHeight: $(window).height() - 50, autoOpen: false, modal: true, title: '$sDialogTitleEscaped'});\n"); - $oPage->add_ready_script("$('#ac_create_{$this->iId} form').removeAttr('onsubmit');"); - $oPage->add_ready_script("$('#ac_create_{$this->iId} form').find('select').attr('id', 'ac_create_{$this->iId}_select');"); - $oPage->add_ready_script("$('#ac_create_{$this->iId} form').on('submit.uilinksWizard', oACWidget_{$this->iId}.DoSelectObjectClass);"); + $oPage->add_ready_script("$('#ac_create_$this->iId').dialog({ width: 'auto', height: 'auto', maxHeight: $(window).height() - 50, autoOpen: false, modal: true, title: '$sDialogTitleEscaped'});\n"); + $oPage->add_ready_script("$('#ac_create_{$this->iId} form').removeAttr('onsubmit');"); + $oPage->add_ready_script("$('#ac_create_{$this->iId} form').find('select').attr('id', 'ac_create_{$this->iId}_select');"); + $oPage->add_ready_script("$('#ac_create_{$this->iId} form').on('submit.uilinksWizard', oACWidget_{$this->iId}.DoSelectObjectClass);"); } /** @@ -941,16 +957,14 @@ JS $oAppContext->InitObjectFromContext($oNewObj); $oNewObj->PrefillForm('creation_from_extkey', $aPrefillFormParam); // 2nd set the default values from the constraint on the external key... if any - if ( ($oCurrObject != null) && ($this->sAttCode != '')) - { + if (($oCurrObject != null) && ($this->sAttCode != '')) { $oAttDef = MetaModel::GetAttributeDef(get_class($oCurrObject), $this->sAttCode); - $aParams = array('this' => $oCurrObject); + $aParams = ['this' => $oCurrObject]; $oSet = $oAttDef->GetAllowedValuesAsObjectSet($aParams); $aConsts = $oSet->ListConstantFields(); $sClassAlias = $oSet->GetFilter()->GetClassAlias(); - if (isset($aConsts[$sClassAlias])) - { - foreach($aConsts[$sClassAlias] as $sAttCode => $value) { + if (isset($aConsts[$sClassAlias])) { + foreach ($aConsts[$sClassAlias] as $sAttCode => $value) { $oNewObj->Set($sAttCode, $value); } } @@ -962,32 +976,35 @@ JS $sClassLabel = MetaModel::GetName($this->sTargetClass); $sHeaderTitleEscaped = utils::EscapeHtml(Dict::Format('UI:CreationTitle_Class', $sClassLabel)); - $oPage->add(<<add( + <<
    HTML ); - $aFormExtraParams = array( + $aFormExtraParams = [ 'formPrefix' => $this->iId, 'noRelations' => true, - ); + ]; // Remove blob edition from creation form @see N°5863 to allow blob edition in modal context FormHelper::DisableAttributeBlobInputs($this->sTargetClass, $aFormExtraParams); - if(FormHelper::HasMandatoryAttributeBlobInputs($oNewObj)){ + if (FormHelper::HasMandatoryAttributeBlobInputs($oNewObj)) { $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE)); } - - cmdbAbstractObject::DisplayCreationForm($oPage, $this->sTargetClass, $oNewObj, array(), $aFormExtraParams); - $oPage->add(<<sTargetClass, $oNewObj, [], $aFormExtraParams); + $oPage->add( + <<
    HTML ); - $oPage->add_ready_script(<<add_ready_script( + <<iId}').dialog({ width: $(window).width() * 0.6, height: 'auto', maxHeight: $(window).height() - 50, autoOpen: false, modal: true}); $('#dcr_{$this->iId} form').removeAttr('onsubmit'); $('#dcr_{$this->iId} form').find('button[type="submit"]').on('click', oACWidget_{$this->iId}.DoCreateObject); @@ -1003,14 +1020,13 @@ JS $sDialogTitle = addslashes(Dict::Format('UI:HierarchyOf_Class', MetaModel::GetName($this->sTargetClass))); $oPage->add('
    '); $oPage->add('
    '); - if (is_null($sFilter)) - { + if (is_null($sFilter)) { throw new Exception('Implementation: null value for allowed values definition'); } - $oFilter = DBObjectSearch::FromOQL($sFilter); + $oFilter = DBObjectSearch::FromOQL($sFilter); $oFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode); - $oSet = new DBObjectSet($oFilter, array(), array('this' => $oObj, 'current_extkey_id' => $currValue)); + $oSet = new DBObjectSet($oFilter, [], ['this' => $oObj, 'current_extkey_id' => $currValue]); $oSet->SetShowObsoleteData(utils::ShowObsoleteData()); @@ -1020,17 +1036,17 @@ JS $oPage->add('
    '); $oPage->add('
    '); - if ($bHasChildLeafs) - { + if ($bHasChildLeafs) { $oPage->add(''.Dict::S("UI:Treeview:CollapseAll").''.Dict::S("UI:Treeview:ExpandAll").''); } - + $oPage->add('
    '); - + $sOkButtonLabel = Dict::S('UI:Button:Ok'); $sCancelButtonLabel = Dict::S('UI:Button:Cancel'); $oPage->add_ready_script("\$('#tree_$this->iId ul').treeview({ control: '#treecontrolid', persist: 'false'});\n"); - $oPage->add_ready_script(<<add_ready_script( + <<iId').dialog({ width: 'auto', height: 'auto', @@ -1069,8 +1085,7 @@ JS */ public function DoCreateObject($oPage) { - try - { + try { $oObj = MetaModel::NewObject($this->sTargetClass); $aErrors = $oObj->UpdateObjectFromPostedForm($this->iId); if (count($aErrors) == 0) { @@ -1088,13 +1103,12 @@ JS ]); $oObj->DBInsertNoReload(); - return array('name' => $oObj->GetName(), 'id' => $oObj->GetKey()); + return ['name' => $oObj->GetName(), 'id' => $oObj->GetKey()]; } else { - return array('error' => implode(' ', $aErrors), 'id' => 0); + return ['error' => implode(' ', $aErrors), 'id' => 0]; } - } - catch (Exception $e) { - return array('error' => $e->getMessage(), 'id' => 0); + } catch (Exception $e) { + return ['error' => $e->getMessage(), 'id' => 0]; } } @@ -1110,32 +1124,27 @@ JS * @throws \CoreUnexpectedValue * @throws \MySQLException */ - function DumpTree($oP, $oSet, $sParentAttCode, $currValue) + public function DumpTree($oP, $oSet, $sParentAttCode, $currValue) { - $aTree = array(); - $aNodes = array(); - while($oObj = $oSet->Fetch()) - { + $aTree = []; + $aNodes = []; + while ($oObj = $oSet->Fetch()) { $iParentId = $oObj->Get($sParentAttCode); - if (!isset($aTree[$iParentId])) - { - $aTree[$iParentId] = array(); + if (!isset($aTree[$iParentId])) { + $aTree[$iParentId] = []; } $aTree[$iParentId][$oObj->GetKey()] = $oObj->GetName(); $aNodes[$oObj->GetKey()] = $oObj; } $aParents = array_keys($aTree); - $aRoots = array(); - foreach($aParents as $id) - { - if (!array_key_exists($id, $aNodes)) - { + $aRoots = []; + foreach ($aParents as $id) { + if (!array_key_exists($id, $aNodes)) { $aRoots[] = $id; } } - foreach($aRoots as $iRootId) - { + foreach ($aRoots as $iRootId) { $this->DumpNodes($oP, $iRootId, $aTree, $aNodes, $currValue); } @@ -1143,28 +1152,22 @@ JS return !$bHasOnlyRootNodes; } - function DumpNodes($oP, $iRootId, $aTree, $aNodes, $currValue) + public function DumpNodes($oP, $iRootId, $aTree, $aNodes, $currValue) { $bSelect = true; $bMultiple = false; $sSelect = ''; - if (array_key_exists($iRootId, $aTree)) - { + if (array_key_exists($iRootId, $aTree)) { $aSortedRoots = $aTree[$iRootId]; asort($aSortedRoots); $oP->add("
      \n"); $fUniqueId = microtime(true); - foreach($aSortedRoots as $id => $sName) - { - if ($bSelect) - { + foreach ($aSortedRoots as $id => $sName) { + if ($bSelect) { $sChecked = ($aNodes[$id]->GetKey() == $currValue) ? 'checked' : ''; - if ($bMultiple) - { + if ($bMultiple) { $sSelect = ' '; - } - else - { + } else { $sSelect = ' '; } } diff --git a/application/ui.htmleditorwidget.class.inc.php b/application/ui.htmleditorwidget.class.inc.php index 898a82968..1d336cf24 100644 --- a/application/ui.htmleditorwidget.class.inc.php +++ b/application/ui.htmleditorwidget.class.inc.php @@ -1,9 +1,10 @@ m_iId = $iInputId; @@ -54,7 +55,7 @@ class UIHTMLEditorWidget $this->m_sMandatory = $sMandatory; $this->m_sFieldPrefix = $sFieldPrefix; } - + /** * Get the HTML fragment corresponding to the HTML editor widget * @@ -63,7 +64,7 @@ class UIHTMLEditorWidget * * @return string The HTML fragment to be inserted into the page */ - public function Display(WebPage $oPage, array $aArgs = array()) : string + public function Display(WebPage $oPage, array $aArgs = []): string { $iId = $this->m_iId; $sCode = $this->m_sAttCode.$this->m_sNameSuffix; diff --git a/application/ui.linksdirectwidget.class.inc.php b/application/ui.linksdirectwidget.class.inc.php index 4f7cafd99..aebb5d710 100644 --- a/application/ui.linksdirectwidget.class.inc.php +++ b/application/ui.linksdirectwidget.class.inc.php @@ -1,4 +1,5 @@ sAttCode = $sAttCode; $this->sInputid = $sInputId; $this->sNameSuffix = $sNameSuffix; - $this->aZlist = array(); + $this->aZlist = []; $this->sLinkedClass = ''; - + // Compute the list of attributes visible from the given objet: // All the attributes from the "list" Zlist of the Link class except // the ExternalKey that points to the current object and its related external fields $oLinksetDef = MetaModel::GetAttributeDef($sClass, $sAttCode); $this->sLinkedClass = $oLinksetDef->GetLinkedClass(); $sExtKeyToMe = $oLinksetDef->GetExtKeyToMe(); - switch($oLinksetDef->GetEditMode()) - { + switch ($oLinksetDef->GetEditMode()) { case LINKSET_EDITMODE_INPLACE: // The whole linkset can be edited 'in-place' - $aZList = MetaModel::FlattenZList(MetaModel::GetZListItems($this->sLinkedClass, 'details')); - break; - + $aZList = MetaModel::FlattenZList(MetaModel::GetZListItems($this->sLinkedClass, 'details')); + break; + default: - $aZList = MetaModel::FlattenZList(MetaModel::GetZListItems($this->sLinkedClass, 'list')); - array_unshift($aZList, 'friendlyname'); + $aZList = MetaModel::FlattenZList(MetaModel::GetZListItems($this->sLinkedClass, 'list')); + array_unshift($aZList, 'friendlyname'); } - foreach($aZList as $sLinkedAttCode) - { - if ($sLinkedAttCode != $sExtKeyToMe) - { + foreach ($aZList as $sLinkedAttCode) { + if ($sLinkedAttCode != $sExtKeyToMe) { $oAttDef = MetaModel::GetAttributeDef($this->sLinkedClass, $sLinkedAttCode); - + if ((!$oAttDef->IsExternalField() || ($oAttDef->GetKeyAttCode() != $sExtKeyToMe)) && - (!$oAttDef->IsLinkSet()) ) - { + (!$oAttDef->IsLinkSet())) { $this->aZlist[] = $sLinkedAttCode; } } } - + } /** @@ -101,21 +98,17 @@ class UILinksWidgetDirect $sRealClass = ''; //$oPage->add('
      '); $aSubClasses = MetaModel::EnumChildClasses($this->sLinkedClass, ENUM_CHILD_CLASSES_ALL); // Including the specified class itself - $aPossibleClasses = array(); - foreach($aSubClasses as $sCandidateClass) - { - if (!MetaModel::IsAbstract($sCandidateClass) && (UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) - { - if ($sCandidateClass == $sProposedRealClass) - { + $aPossibleClasses = []; + foreach ($aSubClasses as $sCandidateClass) { + if (!MetaModel::IsAbstract($sCandidateClass) && (UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) { + if ($sCandidateClass == $sProposedRealClass) { $sRealClass = $sProposedRealClass; } $aPossibleClasses[$sCandidateClass] = MetaModel::GetName($sCandidateClass); } } // Only one of the subclasses can be instantiated... - if (count($aPossibleClasses) == 1) - { + if (count($aPossibleClasses) == 1) { $aKeys = array_keys($aPossibleClasses); $sRealClass = $aKeys[0]; } @@ -123,11 +116,11 @@ class UILinksWidgetDirect if ($sRealClass != '') { $oLinksetDef = MetaModel::GetAttributeDef($this->sClass, $this->sAttCode); $sExtKeyToMe = $oLinksetDef->GetExtKeyToMe(); - $aFieldsFlags = array($sExtKeyToMe => OPT_ATT_HIDDEN); + $aFieldsFlags = [$sExtKeyToMe => OPT_ATT_HIDDEN]; $oObj = DBObject::MakeDefaultInstance($sRealClass); - $aPrefillParam = array('source_obj' => $oSourceObj); + $aPrefillParam = ['source_obj' => $oSourceObj]; $oObj->PrefillForm('creation_from_editinplace', $aPrefillParam); - $aFormExtraParams = array( + $aFormExtraParams = [ 'formPrefix' => $this->sInputid, 'noRelations' => true, 'fieldsFlags' => $aFieldsFlags, @@ -140,25 +133,22 @@ class UILinksWidgetDirect JS , ], - ); + ]; // Remove blob edition from creation form @see N°5863 to allow blob edition in modal context FormHelper::DisableAttributeBlobInputs($sRealClass, $aFormExtraParams); - - if(FormHelper::HasMandatoryAttributeBlobInputs($oObj)){ + + if (FormHelper::HasMandatoryAttributeBlobInputs($oObj)) { $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE)); } - cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, $oObj, array(), $aFormExtraParams); - } - else - { + cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, $oObj, [], $aFormExtraParams); + } else { $sClassLabel = MetaModel::GetName($this->sLinkedClass); $oPage->add('

      '.Dict::Format('UI:SelectTheTypeOf_Class_ToCreate', $sClassLabel)); $oPage->add(''); @@ -178,7 +168,7 @@ JS * @throws \MissingQueryArgument * @throws \OQLException */ - public function GetObjectsSelectionDlg($oPage, $oCurrentObj, $aAlreadyLinked, $aPrefillFormParam = array()) + public function GetObjectsSelectionDlg($oPage, $oCurrentObj, $aAlreadyLinked, $aPrefillFormParam = []) { //$oPage->add("

      \n"); @@ -199,8 +189,7 @@ JS $oLinkSetDef = MetaModel::GetAttributeDef($this->sClass, $this->sAttCode); $valuesDef = $oLinkSetDef->GetValuesDef(); - if ($valuesDef === null) - { + if ($valuesDef === null) { $oFilter = new DBObjectSearch($this->sLinkedClass); } else { if (!$valuesDef instanceof ValueSetObjects) { @@ -218,8 +207,10 @@ JS $oCurrentObj->PrefillForm('search', $aPrefillFormParam); } $oBlock = new DisplayBlock($oFilter, 'search', false); - $oPage->AddUiBlock($oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->sInputid}", - array( + $oPage->AddUiBlock($oBlock->GetDisplay( + $oPage, + "SearchFormToAdd_{$this->sInputid}", + [ 'result_list_outer_selector' => "SearchResultsToAdd_{$this->sInputid}", 'table_id' => "add_{$this->sInputid}", 'table_inner_id' => "ResultsToAdd_{$this->sInputid}", @@ -227,13 +218,14 @@ JS 'cssCount' => "#count_{$this->sInputid}", 'query_params' => $oFilter->GetInternalParams(), 'hidden_criteria' => $sHiddenCriteria, - ) + ] )); $sEmptyList = Dict::S('UI:Message:EmptyList:UseSearchForm'); $sCancel = Dict::S('UI:Button:Cancel'); $sAdd = Dict::S('UI:Button:Add'); - $oPage->add(<<add( + <<

      {$sEmptyList}

      @@ -256,52 +248,43 @@ HTML * @throws \CoreException * @throws \OQLException */ - public function SearchObjectsToAdd(WebPage $oP, $sRemoteClass = '', $aAlreadyLinked = array(), $oCurrentObj = null, $aPrefillFormParam = array()) + public function SearchObjectsToAdd(WebPage $oP, $sRemoteClass = '', $aAlreadyLinked = [], $oCurrentObj = null, $aPrefillFormParam = []) { - if ($sRemoteClass == '') - { + if ($sRemoteClass == '') { $sRemoteClass = $this->sLinkedClass; } $oLinkSetDef = MetaModel::GetAttributeDef($this->sClass, $this->sAttCode); $valuesDef = $oLinkSetDef->GetValuesDef(); - if ($valuesDef === null) - { + if ($valuesDef === null) { $oFilter = new DBObjectSearch($sRemoteClass); - } - else - { - if (!$valuesDef instanceof ValueSetObjects) - { + } else { + if (!$valuesDef instanceof ValueSetObjects) { throw new Exception('Error: only ValueSetObjects are supported for "allowed_values" in AttributeLinkedSet ('.$this->sClass.'/'.$this->sAttCode.').'); } $oFilter = DBObjectSearch::FromOQL($valuesDef->GetFilterExpression()); } - - if (($oCurrentObj != null) && MetaModel::IsSameFamilyBranch($sRemoteClass, $this->sClass)) - { + + if (($oCurrentObj != null) && MetaModel::IsSameFamilyBranch($sRemoteClass, $this->sClass)) { // Prevent linking to self if the linked object is of the same family // and already present in the database - if (!$oCurrentObj->IsNew()) - { + if (!$oCurrentObj->IsNew()) { $oFilter->AddCondition('id', $oCurrentObj->GetKey(), '!='); } } - if ($oCurrentObj != null) - { + if ($oCurrentObj != null) { $this->SetSearchDefaultFromContext($oCurrentObj, $oFilter); $aArgs = array_merge($oCurrentObj->ToArgs('this'), $oFilter->GetInternalParams()); $oFilter->SetInternalParams($aArgs); - + $aPrefillFormParam['filter'] = $oFilter; $oCurrentObj->PrefillForm('search', $aPrefillFormParam); } - if (count($aAlreadyLinked) > 0) - { + if (count($aAlreadyLinked) > 0) { $oFilter->AddCondition('id', $aAlreadyLinked, 'NOTIN'); } $oBlock = new DisplayBlock($oFilter, 'list', false); - $oBlock->Display($oP, "ResultsToAdd_{$this->sInputid}", array('menu' => false, 'cssCount'=> '#count_'.$this->sInputid , 'selection_mode' => true, 'table_id' => 'add_'.$this->sInputid)); // Don't display the 'Actions' menu on the results + $oBlock->Display($oP, "ResultsToAdd_{$this->sInputid}", ['menu' => false, 'cssCount' => '#count_'.$this->sInputid , 'selection_mode' => true, 'table_id' => 'add_'.$this->sInputid]); // Don't display the 'Actions' menu on the results } /** @@ -311,29 +294,28 @@ HTML public function DoAddObjects(WebPage $oP, $oFullSetFilter) { $aLinkedObjectIds = utils::ReadMultipleSelection($oFullSetFilter); - foreach($aLinkedObjectIds as $iObjectId) - { + foreach ($aLinkedObjectIds as $iObjectId) { $oLinkObj = MetaModel::GetObject($this->sLinkedClass, $iObjectId); $oP->add($this->GetObjectRow($oP, $oLinkObj, $oLinkObj->GetKey())); } } - + public function GetObjectModificationDlg() { - + } public function GetTableConfig() { - $aAttribs = array(); - $aAttribs['form::select'] = array( + $aAttribs = []; + $aAttribs['form::select'] = [ 'label' => "sInputid}:not(:disabled)', this.checked);oWidget".$this->sInputid.".directlinks('instance')._onSelectChange();\" class=\"checkAll\">", 'description' => Dict::S('UI:SelectAllToggle+'), - ); + ]; foreach ($this->aZlist as $sLinkedAttCode) { $oAttDef = MetaModel::GetAttributeDef($this->sLinkedClass, $sLinkedAttCode); - $aAttribs[$sLinkedAttCode] = array('label' => MetaModel::GetLabel($this->sLinkedClass, $sLinkedAttCode), 'description' => $oAttDef->GetOrderByHint()); + $aAttribs[$sLinkedAttCode] = ['label' => MetaModel::GetLabel($this->sLinkedClass, $sLinkedAttCode), 'description' => $oAttDef->GetOrderByHint()]; } return $aAttribs; @@ -348,13 +330,12 @@ HTML */ public function GetRow($oPage, $sRealClass, $aValues, $iTempId) { - if ($sRealClass == '') - { + if ($sRealClass == '') { $sRealClass = $this->sLinkedClass; } $oLinkObj = new $sRealClass(); $oLinkObj->UpdateObjectFromPostedForm($this->sInputid); - + return $this->GetObjectRow($oPage, $oLinkObj, $iTempId); } @@ -367,13 +348,12 @@ HTML protected function GetObjectRow($oPage, $oLinkObj, $iTempId) { $aAttribs = $this->GetTableConfig(); - $aRow = array(); + $aRow = []; $aRow['form::select'] = ''; - foreach($this->aZlist as $sLinkedAttCode) - { + foreach ($this->aZlist as $sLinkedAttCode) { $aRow[$sLinkedAttCode] = $oLinkObj->GetAsHTML($sLinkedAttCode); } - return $oPage->GetTableRow($aRow, $aAttribs); + return $oPage->GetTableRow($aRow, $aAttribs); } /** @@ -386,23 +366,21 @@ HTML */ public function GetFormRow($oPage, $sRealClass, $aValues, $iTempId) { - if ($sRealClass == '') - { + if ($sRealClass == '') { $sRealClass = $this->sLinkedClass; } $oLinkObj = new $sRealClass(); $oLinkObj->UpdateObjectFromPostedForm($this->sInputid); $aAttribs = $this->GetTableConfig(); - $aRow = array(); + $aRow = []; $aRow[] = ''; - foreach($this->aZlist as $sLinkedAttCode) - { + foreach ($this->aZlist as $sLinkedAttCode) { $aRow[] = $oLinkObj->GetAsHTML($sLinkedAttCode); } return $aRow; } - + /** * Initializes the default search parameters based on 1) a 'current' object and 2) the silos defined by the context * @param DBObject $oSourceObj @@ -413,27 +391,23 @@ HTML $oAppContext = new ApplicationContext(); $sSrcClass = get_class($oSourceObj); $sDestClass = $oSearch->GetClass(); - foreach($oAppContext->GetNames() as $key) - { + foreach ($oAppContext->GetNames() as $key) { // Find the value of the object corresponding to each 'context' parameter - $aCallSpec = array($sSrcClass, 'MapContextParam'); + $aCallSpec = [$sSrcClass, 'MapContextParam']; $sAttCode = ''; - if (is_callable($aCallSpec)) - { - $sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter + if (is_callable($aCallSpec)) { + $sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter } - if (MetaModel::IsValidAttCode($sSrcClass, $sAttCode)) - { + if (MetaModel::IsValidAttCode($sSrcClass, $sAttCode)) { $defaultValue = $oSourceObj->Get($sAttCode); // Find the attcode for the same 'context' parameter in the destination class // and sets its value as the default value for the search condition - $aCallSpec = array($sDestClass, 'MapContextParam'); + $aCallSpec = [$sDestClass, 'MapContextParam']; $sAttCode = ''; - if (is_callable($aCallSpec)) - { - $sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter + if (is_callable($aCallSpec)) { + $sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter } if (MetaModel::IsValidAttCode($sDestClass, $sAttCode) && !empty($defaultValue)) { @@ -443,7 +417,6 @@ HTML } } - public function GetClass(): string { return $this->sClass; diff --git a/application/ui.linkswidget.class.inc.php b/application/ui.linkswidget.class.inc.php index 0f754b84e..33e4c8eca 100644 --- a/application/ui.linkswidget.class.inc.php +++ b/application/ui.linkswidget.class.inc.php @@ -1,4 +1,5 @@ m_sNameSuffix = $sNameSuffix; $this->m_bDuplicatesAllowed = $bDuplicatesAllowed; - $this->m_aEditableFields = array(); + $this->m_aEditableFields = []; /** @var AttributeLinkedSetIndirect $oAttDef */ $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $this->m_sAttCode); @@ -67,34 +68,33 @@ class UILinksWidget $oLinkingAttDef = MetaModel::GetAttributeDef($this->m_sLinkedClass, $this->m_sExtKeyToRemote); $this->m_sRemoteClass = $oLinkingAttDef->GetTargetClass(); - $this->m_aEditableFields = array(); - $this->m_aTableConfig = array(); - $this->m_aTableConfig['form::checkbox'] = array( + $this->m_aEditableFields = []; + $this->m_aTableConfig = []; + $this->m_aTableConfig['form::checkbox'] = [ 'label' => "m_sAttCode}{$this->m_sNameSuffix} .selection', this.checked); oWidget".$this->m_sInputId.".OnSelectChange();\">", 'description' => Dict::S('UI:SelectAllToggle+'), - ); + ]; $aLnkAttDefsToDisplay = MetaModel::GetZListAttDefsFilteredForIndirectLinkClass($sClass, $sAttCode); - foreach ($aLnkAttDefsToDisplay as $oLnkAttDef) - { + foreach ($aLnkAttDefsToDisplay as $oLnkAttDef) { $sLnkAttCode = $oLnkAttDef->GetCode(); $this->m_aEditableFields[] = $sLnkAttCode; - $this->m_aTableConfig[$sLnkAttCode] = array('label' => $oLnkAttDef->GetLabel(), 'description' => $oLnkAttDef->GetDescription()); + $this->m_aTableConfig[$sLnkAttCode] = ['label' => $oLnkAttDef->GetLabel(), 'description' => $oLnkAttDef->GetDescription()]; } - $this->m_aTableConfig['static::key'] = array( + $this->m_aTableConfig['static::key'] = [ 'label' => MetaModel::GetName($this->m_sRemoteClass), 'description' => MetaModel::GetClassDescription($this->m_sRemoteClass), - ); + ]; $this->m_aEditableFields[] = $this->m_sExtKeyToRemote; $aRemoteAttDefsToDisplay = MetaModel::GetZListAttDefsFilteredForIndirectRemoteClass($this->m_sRemoteClass); foreach ($aRemoteAttDefsToDisplay as $oRemoteAttDef) { $sRemoteAttCode = $oRemoteAttDef->GetCode(); - $this->m_aTableConfig['static::'.$sRemoteAttCode] = array( + $this->m_aTableConfig['static::'.$sRemoteAttCode] = [ 'label' => $oRemoteAttDef->GetLabel(), 'description' => $oRemoteAttDef->GetDescription(), - ); + ]; } } @@ -105,7 +105,6 @@ class UILinksWidget return ($bSafe) ? utils::GetSafeId($sFieldId) : $sFieldId; } - /** * Display the table with the form for editing all the links at once * @@ -119,7 +118,6 @@ class UILinksWidget return DataTableUIBlockFactory::MakeForForm("{$this->m_sAttCode}{$this->m_sNameSuffix}", $aConfig, $aData); } - /** * Get the HTML fragment corresponding to the linkset editing widget * @@ -157,7 +155,7 @@ class UILinksWidget * @throws DictExceptionMissingString * @throws Exception */ - public function GetObjectPickerDialog($oPage, $oCurrentObj, $sJson, $aAlreadyLinkedIds = array(), $aPrefillFormParam = array()) + public function GetObjectPickerDialog($oPage, $oCurrentObj, $sJson, $aAlreadyLinkedIds = [], $aPrefillFormParam = []) { $oAlreadyLinkedFilter = new DBObjectSearch($this->m_sRemoteClass); if (!$this->m_bDuplicatesAllowed && count($aAlreadyLinkedIds) > 0) { @@ -183,7 +181,9 @@ class UILinksWidget $sLinkedSetId = $oBlock->oUILinksWidget->GetLinkedSetId(); $oDisplayBlock = new DisplayBlock($oFilter, 'search', false); - $oBlock->AddSubBlock($oDisplayBlock->GetDisplay($oPage, "SearchFormToAdd_{$sLinkedSetId}", + $oBlock->AddSubBlock($oDisplayBlock->GetDisplay( + $oPage, + "SearchFormToAdd_{$sLinkedSetId}", [ 'menu' => false, 'result_list_outer_selector' => "SearchResultsToAdd_{$sLinkedSetId}", @@ -195,7 +195,8 @@ class UILinksWidget 'query_params' => $oFilter->GetInternalParams(), 'hidden_criteria' => $sAlreadyLinkedExpression, 'submit_on_load' => false, - ])); + ] + )); $oBlock->AddForm(); } @@ -212,25 +213,21 @@ class UILinksWidget * @throws \CoreException * @throws \Exception */ - public function SearchObjectsToAdd(WebPage $oP, $sRemoteClass = '', $aAlreadyLinkedIds = array(), $oCurrentObj = null) + public function SearchObjectsToAdd(WebPage $oP, $sRemoteClass = '', $aAlreadyLinkedIds = [], $oCurrentObj = null) { - if ($sRemoteClass != '') - { + if ($sRemoteClass != '') { // assert(MetaModel::IsParentClass($this->m_sRemoteClass, $sRemoteClass)); $oFilter = new DBObjectSearch($sRemoteClass); - } - else - { + } else { // No remote class specified use the one defined in the linkedset - $oFilter = new DBObjectSearch($this->m_sRemoteClass); + $oFilter = new DBObjectSearch($this->m_sRemoteClass); } - if (!$this->m_bDuplicatesAllowed && count($aAlreadyLinkedIds) > 0) - { + if (!$this->m_bDuplicatesAllowed && count($aAlreadyLinkedIds) > 0) { $oFilter->AddCondition('id', $aAlreadyLinkedIds, 'NOTIN'); } $this->SetSearchDefaultFromContext($oCurrentObj, $oFilter); $oBlock = new DisplayBlock($oFilter, 'list', false); - $oBlock->Display($oP, "ResultsToAdd_{$this->m_sAttCode}", array('menu' => false, 'cssCount'=> '#count_'.$this->m_sAttCode.$this->m_sNameSuffix , 'selection_mode' => true, 'table_id' => 'add_'.$this->m_sAttCode)); // Don't display the 'Actions' menu on the results + $oBlock->Display($oP, "ResultsToAdd_{$this->m_sAttCode}", ['menu' => false, 'cssCount' => '#count_'.$this->m_sAttCode.$this->m_sNameSuffix , 'selection_mode' => true, 'table_id' => 'add_'.$this->m_sAttCode]); // Don't display the 'Actions' menu on the results } /** @@ -251,7 +248,7 @@ class UILinksWidget $oLinkedObj = MetaModel::GetObject($this->m_sRemoteClass, $iObjectId, false); if (is_object($oLinkedObj)) { $oBlock = new BlockIndirectLinkSetEditTable($this); - $aRow = $oBlock->GetFormRow($oP, $oLinkedObj, $iObjectId, array(), $oCurrentObj, $iAdditionId); // Not yet created link get negative Ids + $aRow = $oBlock->GetFormRow($oP, $oLinkedObj, $iObjectId, [], $oCurrentObj, $iAdditionId); // Not yet created link get negative Ids $oRow = new FormTableRow("{$this->m_sAttCode}{$this->m_sNameSuffix}", $this->m_aTableConfig, $aRow, -$iAdditionId); $oP->AddUiBlock($oRow); $iAdditionId++; @@ -280,7 +277,7 @@ class UILinksWidget $oLinkedObj = MetaModel::GetObject($this->m_sRemoteClass, $iObjectId, false); if (is_object($oLinkedObj)) { $oBlock = new BlockIndirectLinkSetEditTable($this); - $aRow = $oBlock->GetFormRow($oP, $oLinkedObj, $iObjectId, array(), $oCurrentObj, $iAdditionId, false /* Default value */, $bAllowRemoteExtKeyEdit); // Not yet created link get negative Ids + $aRow = $oBlock->GetFormRow($oP, $oLinkedObj, $iObjectId, [], $oCurrentObj, $iAdditionId, false /* Default value */, $bAllowRemoteExtKeyEdit); // Not yet created link get negative Ids $aData = []; foreach ($aRow as $item) { $aData[] = $item; @@ -307,37 +304,30 @@ class UILinksWidget $oAppContext = new ApplicationContext(); $sSrcClass = get_class($oSourceObj); $sDestClass = $oSearch->GetClass(); - foreach($oAppContext->GetNames() as $key) - { + foreach ($oAppContext->GetNames() as $key) { // Find the value of the object corresponding to each 'context' parameter - $aCallSpec = array($sSrcClass, 'MapContextParam'); + $aCallSpec = [$sSrcClass, 'MapContextParam']; $sAttCode = ''; - if (is_callable($aCallSpec)) - { - $sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter + if (is_callable($aCallSpec)) { + $sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter } - if (MetaModel::IsValidAttCode($sSrcClass, $sAttCode)) - { + if (MetaModel::IsValidAttCode($sSrcClass, $sAttCode)) { $defaultValue = $oSourceObj->Get($sAttCode); // Find the attcode for the same 'context' parameter in the destination class // and sets its value as the default value for the search condition - $aCallSpec = array($sDestClass, 'MapContextParam'); + $aCallSpec = [$sDestClass, 'MapContextParam']; $sAttCode = ''; - if (is_callable($aCallSpec)) - { - $sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter + if (is_callable($aCallSpec)) { + $sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter } - - if (MetaModel::IsValidAttCode($sDestClass, $sAttCode) && !empty($defaultValue)) - { + + if (MetaModel::IsValidAttCode($sDestClass, $sAttCode) && !empty($defaultValue)) { // Add Hierarchical condition if hierarchical key $oAttDef = MetaModel::GetAttributeDef($sDestClass, $sAttCode); - if (isset($oAttDef) && ($oAttDef->IsExternalKey())) - { - try - { + if (isset($oAttDef) && ($oAttDef->IsExternalKey())) { + try { /** @var AttributeExternalKey $oAttDef */ $sTargetClass = $oAttDef->GetTargetClass(); $sHierarchicalKeyCode = MetaModel::IsHierarchicalClass($sTargetClass); @@ -348,8 +338,7 @@ class UILinksWidget $oHKFilter->AddCondition_PointingTo($oFilter, $sHierarchicalKeyCode, TREE_OPERATOR_BELOW); $oSearch->AddCondition_PointingTo($oHKFilter, $sAttCode); } - } - catch (Exception $e) { + } catch (Exception $e) { } } else { $oSearch->AddCondition($sAttCode, $defaultValue); diff --git a/application/ui.passwordwidget.class.inc.php b/application/ui.passwordwidget.class.inc.php index 29315b069..138627bd0 100644 --- a/application/ui.passwordwidget.class.inc.php +++ b/application/ui.passwordwidget.class.inc.php @@ -1,9 +1,10 @@ sNameSuffix = $sNameSuffix; $this->iId = $iInputId; } - + /** * Get the HTML fragment corresponding to the linkset editing widget * @param WebPage $oP The web page used for all the output * @param Hash $aArgs Extra context arguments * @return string The HTML fragment to be inserted into the page */ - public function Display(WebPage $oPage, $aArgs = array()) + public function Display(WebPage $oPage, $aArgs = []) { $oPage->add_dict_entry('UI:Component:Input:Password:DoesNotMatch'); @@ -94,4 +95,3 @@ class UIPasswordWidget return $sHtmlValue; } } -?> diff --git a/application/ui.searchformforeignkeys.class.inc.php b/application/ui.searchformforeignkeys.class.inc.php index 1c140b3f8..4be179c3e 100644 --- a/application/ui.searchformforeignkeys.class.inc.php +++ b/application/ui.searchformforeignkeys.class.inc.php @@ -1,4 +1,5 @@ m_sRemoteClass); $oBlock = new DisplayBlock($oFilter, 'search', false); - $oPage->AddUiBlock($oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->m_iInputId}", - array( + $oPage->AddUiBlock($oBlock->GetDisplay( + $oPage, + "SearchFormToAdd_{$this->m_iInputId}", + [ 'menu' => false, 'result_list_outer_selector' => "SearchResultsToAdd_{$this->m_iInputId}", 'table_id' => "add_{$this->m_iInputId}", @@ -55,12 +57,14 @@ class UISearchFormForeignKeys 'selection_mode' => true, 'cssCount' => "#count_{$this->m_iInputId}", 'query_params' => $oFilter->GetInternalParams(), - ))); + ] + )); $sEmptyList = Dict::S('UI:Message:EmptyList:UseSearchForm'); $sCancel = Dict::S('UI:Button:Cancel'); $sAdd = Dict::S('UI:Button:Add'); - $oPage->add(<<add( + <<

      {$sEmptyList}

      @@ -101,20 +105,17 @@ $('#dlg_{$this->m_iInputId}').dialog('option', {title:'$sTitle'}); $('#SearchFormToAdd_{$this->m_iInputId} form').on('submit.uilinksWizard', oForeignKeysWidget{$this->m_iInputId}.SearchObjectsToAdd); $('#SearchFormToAdd_{$this->m_iInputId}').on('resize', oForeignKeysWidget{$this->m_iInputId}.UpdateSizes); JS -); + ); } public function GetFullListForeignKeysFromSelection($oPage, $oFullSetFilter) { - try - { + try { $aLinkedObjects = utils::ReadMultipleSelectionWithFriendlyname($oFullSetFilter); $oPage->add(json_encode($aLinkedObjects)); - } - catch (CoreException $e) - { + } catch (CoreException $e) { http_response_code(500); - $oPage->add(json_encode(array('error' => $e->GetMessage()))); + $oPage->add(json_encode(['error' => $e->GetMessage()])); IssueLog::Error($e->getMessage()."\nDebug trace:\n".$e->getTraceAsString()); } } @@ -129,20 +130,20 @@ JS */ public function ListResultsSearchForeignKeys(WebPage $oP, $sRemoteClass = '') { - if ($sRemoteClass != '') - { + if ($sRemoteClass != '') { // assert(MetaModel::IsParentClass($this->m_sRemoteClass, $sRemoteClass)); $oFilter = new DBObjectSearch($sRemoteClass); - } - else - { + } else { // No remote class specified use the one defined in the linkedset $oFilter = new DBObjectSearch($this->m_sRemoteClass); } $oBlock = new DisplayBlock($oFilter, 'list', false); - $oBlock->Display($oP, "ResultsToAdd_{$this->m_iInputId}", - array('menu' => false, 'cssCount' => "#count_{$this->m_iInputId}", 'selection_mode' => true, 'table_id' => "add_{$this->m_iInputId}")); + $oBlock->Display( + $oP, + "ResultsToAdd_{$this->m_iInputId}", + ['menu' => false, 'cssCount' => "#count_{$this->m_iInputId}", 'selection_mode' => true, 'table_id' => "add_{$this->m_iInputId}"] + ); } } diff --git a/application/uiwizard.class.inc.php b/application/uiwizard.class.inc.php index 47472643a..a5ba088f9 100644 --- a/application/uiwizard.class.inc.php +++ b/application/uiwizard.class.inc.php @@ -1,9 +1,10 @@ use Combodo\iTop\Application\WebPage\iTopWebPage; - /** * Class UIWizard * @@ -31,74 +31,73 @@ class UIWizard protected $m_sClass; protected $m_sTargetState; protected $m_aWizardSteps; - + public function __construct($oPage, $sClass, $sTargetState = '') { $this->m_oPage = $oPage; $this->m_sClass = $sClass; - if (empty($sTargetState)) - { + if (empty($sTargetState)) { $sTargetState = MetaModel::GetDefaultState($sClass); } $this->m_sTargetState = $sTargetState; $this->m_aWizardSteps = $this->ComputeWizardStructure(); } - - public function GetObjectClass() { return $this->m_sClass; } - public function GetTargetState() { return $this->m_sTargetState; } - public function GetWizardStructure() { return $this->m_aWizardSteps; } - + + public function GetObjectClass() + { + return $this->m_sClass; + } + public function GetTargetState() + { + return $this->m_sTargetState; + } + public function GetWizardStructure() + { + return $this->m_aWizardSteps; + } + /** * Displays one step of the wizard - */ - public function DisplayWizardStep($aStep, $iStepIndex, &$iMaxInputId, &$aFieldsMap, $bFinishEnabled = false, $aArgs = array()) + */ + public function DisplayWizardStep($aStep, $iStepIndex, &$iMaxInputId, &$aFieldsMap, $bFinishEnabled = false, $aArgs = []) { - if ($iStepIndex == 1) // one big form that contains everything, to make sure that the uploaded files are posted too - { + if ($iStepIndex == 1) { // one big form that contains everything, to make sure that the uploaded files are posted too $this->m_oPage->add("\n"); } $this->m_oPage->add("
      \n"); $this->m_oPage->add("\n"); $aStates = MetaModel::EnumStates($this->m_sClass); - $aDetails = array(); + $aDetails = []; $sJSHandlerCode = ''; // Javascript code to be executed each time this step of the wizard is entered - foreach($aStep as $sAttCode) - { + foreach ($aStep as $sAttCode) { $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode); - if ($oAttDef->IsWritable()) - { + if ($oAttDef->IsWritable()) { $sAttLabel = $oAttDef->GetLabel(); $iOptions = isset($aStates[$this->m_sTargetState]['attribute_list'][$sAttCode]) ? $aStates[$this->m_sTargetState]['attribute_list'][$sAttCode] : 0; - + $aPrerequisites = $oAttDef->GetPrerequisiteAttributes(); - if ($iOptions & (OPT_ATT_MANDATORY | OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) - { - $aFields[$sAttCode] = array(); - foreach($aPrerequisites as $sCode) - { + if ($iOptions & (OPT_ATT_MANDATORY | OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) { + $aFields[$sAttCode] = []; + foreach ($aPrerequisites as $sCode) { $aFields[$sAttCode][$sCode] = ''; } } - if (count($aPrerequisites) > 0) - { + if (count($aPrerequisites) > 0) { $aOptions[] = 'Prerequisites: '.implode(', ', $aPrerequisites); } - - $sFieldFlag = (($iOptions & (OPT_ATT_MANDATORY | OPT_ATT_MUSTCHANGE)) || (!$oAttDef->IsNullAllowed()) )? ' *' : ''; + + $sFieldFlag = (($iOptions & (OPT_ATT_MANDATORY | OPT_ATT_MUSTCHANGE)) || (!$oAttDef->IsNullAllowed())) ? ' *' : ''; $oDefaultValuesSet = $oAttDef->GetDefaultValue(/* $oObject->ToArgs() */); // @@@ TO DO: get the object's current value if the object exists $sHTMLValue = cmdbAbstractObject::GetFormElementForField($this->m_oPage, $this->m_sClass, $sAttCode, $oAttDef, $oDefaultValuesSet, '', "att_$iMaxInputId", '', $iOptions, $aArgs); $aFieldsMap["att_$iMaxInputId"] = $sAttCode; - $aDetails[] = array('label' => ''.$oAttDef->GetLabel().$sFieldFlag.'', 'value' => "$sHTMLValue"); - if ($oAttDef->GetValuesDef() != null) - { + $aDetails[] = ['label' => ''.$oAttDef->GetLabel().$sFieldFlag.'', 'value' => "$sHTMLValue"]; + if ($oAttDef->GetValuesDef() != null) { $sJSHandlerCode .= "\toWizardHelper.RequestAllowedValues('$sAttCode');\n"; } - if ($oAttDef->GetDefaultValue() != null) - { + if ($oAttDef->GetDefaultValue() != null) { $sJSHandlerCode .= "\toWizardHelper.RequestDefaultValue('$sAttCode');\n"; } - if ($oAttDef->IsLinkSet()) - { + if ($oAttDef->IsLinkSet()) { $sJSHandlerCode .= "\toLinkWidgetatt_$iMaxInputId.Init();"; } $iMaxInputId++; @@ -126,11 +125,11 @@ $sJSHandlerCode } "); $this->m_oPage->add("
      \n\n"); - } + } /** * Display the final step of the wizard: a confirmation screen - */ + */ public function DisplayFinalStep($iStepIndex, $aFieldsMap) { $oAppContext = new ApplicationContext(); @@ -141,136 +140,116 @@ $sJSHandlerCode $this->m_oPage->add("\n"); $this->m_oPage->add("\n"); $sScript = "function OnEnterStep$iStepIndex() {\n"; - foreach($aFieldsMap as $iInputId => $sAttCode) - { - $sScript .= "\toWizardHelper.UpdateCurrentValue('$sAttCode');\n"; + foreach ($aFieldsMap as $iInputId => $sAttCode) { + $sScript .= "\toWizardHelper.UpdateCurrentValue('$sAttCode');\n"; } - $sScript .= "\toWizardHelper.Preview('object_preview');\n"; - $sScript .= "\t$('#wizard_json_obj').val(oWizardHelper.ToJSON());\n"; + $sScript .= "\toWizardHelper.Preview('object_preview');\n"; + $sScript .= "\t$('#wizard_json_obj').val(oWizardHelper.ToJSON());\n"; $sScript .= "}\n"; $this->m_oPage->add_script($sScript); $this->m_oPage->add("
      \n"); $this->m_oPage->add("
      \n"); - $this->m_oPage->add($oAppContext->GetForForm()); + $this->m_oPage->add($oAppContext->GetForForm()); $this->m_oPage->add(""); $this->m_oPage->add("m_sClass)."\" />\n"); $this->m_oPage->add("
      \n"); $this->m_oPage->add("\n"); - } + } /** * Compute the order of the fields & pages in the wizard - * @param $oPage iTopWebPage The current page (used to display error messages) + * @param $oPage iTopWebPage The current page (used to display error messages) * @param $sClass string Name of the class * @param $sStateCode string Code of the target state of the object - * @return hash Two dimensional array: each element represents the list of fields for a given page + * @return hash Two dimensional array: each element represents the list of fields for a given page */ protected function ComputeWizardStructure() { - $aWizardSteps = array( 'mandatory' => array(), 'optional' => array()); - $aFieldsDone = array(); // Store all the fields that are already covered by a previous step of the wizard - + $aWizardSteps = [ 'mandatory' => [], 'optional' => []]; + $aFieldsDone = []; // Store all the fields that are already covered by a previous step of the wizard + $aStates = MetaModel::EnumStates($this->m_sClass); $sStateAttCode = MetaModel::GetStateAttributeCode($this->m_sClass); - - $aMandatoryAttributes = array(); - // Some attributes are always mandatory independently of the state machine (if any) - foreach(MetaModel::GetAttributesList($this->m_sClass) as $sAttCode) - { - $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode); - if (!$oAttDef->IsExternalField() && !$oAttDef->IsNullAllowed() && - $oAttDef->IsWritable() && ($sAttCode != $sStateAttCode) ) - { - $aMandatoryAttributes[$sAttCode] = OPT_ATT_MANDATORY; - } - } - // Now check the attributes that are mandatory in the specified state - if ( (!empty($this->m_sTargetState)) && (count($aStates[$this->m_sTargetState]['attribute_list']) > 0) ) - { + $aMandatoryAttributes = []; + // Some attributes are always mandatory independently of the state machine (if any) + foreach (MetaModel::GetAttributesList($this->m_sClass) as $sAttCode) { + $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode); + if (!$oAttDef->IsExternalField() && !$oAttDef->IsNullAllowed() && + $oAttDef->IsWritable() && ($sAttCode != $sStateAttCode)) { + $aMandatoryAttributes[$sAttCode] = OPT_ATT_MANDATORY; + } + } + + // Now check the attributes that are mandatory in the specified state + if ((!empty($this->m_sTargetState)) && (count($aStates[$this->m_sTargetState]['attribute_list']) > 0)) { // Check all the fields that *must* be included in the wizard for this // particular target state - $aFields = array(); - foreach($aStates[$this->m_sTargetState]['attribute_list'] as $sAttCode => $iOptions) - { - if ( (isset($aMandatoryAttributes[$sAttCode])) && - ($aMandatoryAttributes[$sAttCode] & (OPT_ATT_MANDATORY | OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) ) - { + $aFields = []; + foreach ($aStates[$this->m_sTargetState]['attribute_list'] as $sAttCode => $iOptions) { + if ((isset($aMandatoryAttributes[$sAttCode])) && + ($aMandatoryAttributes[$sAttCode] & (OPT_ATT_MANDATORY | OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT))) { $aMandatoryAttributes[$sAttCode] |= $iOptions; - } - else - { + } else { $aMandatoryAttributes[$sAttCode] = $iOptions; } } } - + // Check all the fields that *must* be included in the wizard // i.e. all mandatory, must-change or must-prompt fields that are // not also read-only or hidden. // Some fields may be required (null not allowed) from the database - // perspective, but hidden or read-only from the user interface perspective - $aFields = array(); - foreach($aMandatoryAttributes as $sAttCode => $iOptions) - { - if ( ($iOptions & (OPT_ATT_MANDATORY | OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) && - !($iOptions & (OPT_ATT_READONLY | OPT_ATT_HIDDEN)) ) - { + // perspective, but hidden or read-only from the user interface perspective + $aFields = []; + foreach ($aMandatoryAttributes as $sAttCode => $iOptions) { + if (($iOptions & (OPT_ATT_MANDATORY | OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) && + !($iOptions & (OPT_ATT_READONLY | OPT_ATT_HIDDEN))) { $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode); $aPrerequisites = $oAttDef->GetPrerequisiteAttributes(); - $aFields[$sAttCode] = array(); - foreach($aPrerequisites as $sCode) - { + $aFields[$sAttCode] = []; + foreach ($aPrerequisites as $sCode) { $aFields[$sAttCode][$sCode] = ''; } } } - + // Now use the dependencies between the fields to order them // Start from the order of the 'details' $aList = MetaModel::FlattenZlist(MetaModel::GetZListItems($this->m_sClass, 'details')); $index = 0; - $aOrder = array(); - foreach($aFields as $sAttCode => $void) - { - $aOrder[$sAttCode] = 999; // At the end of the list... + $aOrder = []; + foreach ($aFields as $sAttCode => $void) { + $aOrder[$sAttCode] = 999; // At the end of the list... } - foreach($aList as $sAttCode) - { - if (array_key_exists($sAttCode, $aFields)) - { + foreach ($aList as $sAttCode) { + if (array_key_exists($sAttCode, $aFields)) { $aOrder[$sAttCode] = $index; } $index++; } - foreach($aFields as $sAttCode => $aDependencies) - { + foreach ($aFields as $sAttCode => $aDependencies) { // All fields with no remaining dependencies can be entered at this // step of the wizard - if (count($aDependencies) > 0) - { + if (count($aDependencies) > 0) { $iMaxPos = 0; // Remove this field from the dependencies of the other fields - foreach($aDependencies as $sDependentAttCode => $void) - { + foreach ($aDependencies as $sDependentAttCode => $void) { // position the current field after the ones it depends on - $iMaxPos = max($iMaxPos, 1+$aOrder[$sDependentAttCode]); + $iMaxPos = max($iMaxPos, 1 + $aOrder[$sDependentAttCode]); } } } asort($aOrder); - $aCurrentStep = array(); - foreach($aOrder as $sAttCode => $rank) - { + $aCurrentStep = []; + foreach ($aOrder as $sAttCode => $rank) { $aCurrentStep[] = $sAttCode; $aFieldsDone[$sAttCode] = ''; } $aWizardSteps['mandatory'][] = $aCurrentStep; - // Now computes the steps to fill the optional fields - $aFields = array(); // reset - foreach(MetaModel::ListAttributeDefs($this->m_sClass) as $sAttCode=>$oAttDef) - { + $aFields = []; // reset + foreach (MetaModel::ListAttributeDefs($this->m_sClass) as $sAttCode => $oAttDef) { $iOptions = (isset($aStates[$this->m_sTargetState]['attribute_list'][$sAttCode])) ? $aStates[$this->m_sTargetState]['attribute_list'][$sAttCode] : 0; if (($sStateAttCode != $sAttCode) && (!$oAttDef->IsExternalField()) && @@ -282,7 +261,7 @@ $sJSHandlerCode // are removed from the 'optional' part of the wizard $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode); $aPrerequisites = $oAttDef->GetPrerequisiteAttributes(); - $aFields[$sAttCode] = array(); + $aFields[$sAttCode] = []; foreach ($aPrerequisites as $sCode) { if (!isset($aFieldsDone[$sCode])) { // retain only the dependencies that were not covered @@ -293,28 +272,23 @@ $sJSHandlerCode } } // Now use the dependencies between the fields to order them - while(count($aFields) > 0) - { - $aCurrentStep = array(); - foreach($aFields as $sAttCode => $aDependencies) - { + while (count($aFields) > 0) { + $aCurrentStep = []; + foreach ($aFields as $sAttCode => $aDependencies) { // All fields with no remaining dependencies can be entered at this // step of the wizard - if (count($aDependencies) == 0) - { + if (count($aDependencies) == 0) { $aCurrentStep[] = $sAttCode; $aFieldsDone[$sAttCode] = ''; unset($aFields[$sAttCode]); // Remove this field from the dependencies of the other fields - foreach($aFields as $sUpdatedCode => $aDummy) - { + foreach ($aFields as $sUpdatedCode => $aDummy) { // remove the dependency unset($aFields[$sUpdatedCode][$sAttCode]); } } } - if (count($aCurrentStep) == 0) - { + if (count($aCurrentStep) == 0) { // This step of the wizard would contain NO field ! $this->m_oPage->add(Dict::S('UI:Error:WizardCircularReferenceInDependencies')); print_r($aFields); @@ -323,7 +297,6 @@ $sJSHandlerCode $aWizardSteps['optional'][] = $aCurrentStep; } return $aWizardSteps; - - } + + } } -?> diff --git a/application/user.dashboard.class.inc.php b/application/user.dashboard.class.inc.php index 1ccc98c6e..ab3178040 100644 --- a/application/user.dashboard.class.inc.php +++ b/application/user.dashboard.class.inc.php @@ -1,9 +1,10 @@ "gui", "key_type" => "autoincrement", - "name_attcode" => array('user_id', 'menu_code'), + "name_attcode" => ['user_id', 'menu_code'], "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_app_dashboards", "db_key_field" => "id", "db_finalclass_field" => "", - ); - - MetaModel::Init_Params($aParams); - MetaModel::Init_AddAttribute(new AttributeExternalKey("user_id", array("targetclass"=>"User", "allowed_values"=>null, "sql"=>"user_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("menu_code", array("allowed_values"=>null, "sql"=>"menu_code", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("contents", array("allowed_values"=>null, "sql"=>"contents", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + ]; - MetaModel::Init_SetZListItems('default_search', array ( + MetaModel::Init_Params($aParams); + MetaModel::Init_AddAttribute(new AttributeExternalKey("user_id", ["targetclass" => "User", "allowed_values" => null, "sql" => "user_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("menu_code", ["allowed_values" => null, "sql" => "menu_code", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("contents", ["allowed_values" => null, "sql" => "contents", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + + MetaModel::Init_SetZListItems('default_search', [ 0 => 'user_id', 1 => 'menu_code', - )); - MetaModel::Init_SetZListItems('list', array ( + ]); + MetaModel::Init_SetZListItems('list', [ 0 => 'user_id', 1 => 'menu_code', - )); + ]); } /** * Overloading this function here to secure a fix done right before the release - * The real fix should be to implement this verb in DBObject + * The real fix should be to implement this verb in DBObject */ public function DBDeleteTracked(CMDBChange $oChange, $bSkipStrongSecurity = null, &$oDeletionPlan = null) { $this->DBDelete($oDeletionPlan); } } -?> diff --git a/application/user.preferences.class.inc.php b/application/user.preferences.class.inc.php index dd1c8f322..40cc48876 100644 --- a/application/user.preferences.class.inc.php +++ b/application/user.preferences.class.inc.php @@ -1,9 +1,10 @@ Set('userid', $sUserId); - $oObj->Set('preferences', array()); // Default preferences: an empty array + $oObj->Set('preferences', []); // Default preferences: an empty array try { utils::PushArchiveMode(false); $oObj->DBInsert(); utils::PopArchiveMode(); - } - catch (Exception $e) { + } catch (Exception $e) { // Ignore errors } } @@ -245,25 +245,25 @@ class appUserPreferences extends DBObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "gui", "key_type" => "autoincrement", "name_attcode" => "login", "state_attcode" => "", - "reconc_keys" => array("userid","login"), + "reconc_keys" => ["userid","login"], "db_table" => "priv_app_preferences", "db_key_field" => "id", "db_finalclass_field" => "", - ); - + ]; + MetaModel::Init_Params($aParams); - MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass"=>"User", "allowed_values"=>null, "sql"=>"userid", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributePropertySet("preferences", array("allowed_values"=>null, "sql"=>"preferences", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("org_id", array("allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "org_id"))); - MetaModel::Init_AddAttribute(new AttributeExternalField("login", array("allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"))); - MetaModel::Init_SetZListItems('list', array('org_id','preferences')); - MetaModel::Init_SetZListItems('default_search', array('userid','login','org_id')); + MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", ["targetclass" => "User", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributePropertySet("preferences", ["allowed_values" => null, "sql" => "preferences", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("org_id", ["allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "org_id"])); + MetaModel::Init_AddAttribute(new AttributeExternalField("login", ["allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login"])); + MetaModel::Init_SetZListItems('list', ['org_id','preferences']); + MetaModel::Init_SetZListItems('default_search', ['userid','login','org_id']); } /** diff --git a/application/utils.inc.php b/application/utils.inc.php index ce2669ef9..65849236b 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -1,4 +1,5 @@ 0) - { + if (count(self::$aModes) > 0) { $bRet = end(self::$aModes); - } - else - { - if (self::$bPageMode === null) - { + } else { + if (self::$bPageMode === null) { self::InitArchiveMode(); } $bRet = self::$bPageMode; @@ -340,8 +322,7 @@ class utils { $bDefault = MetaModel::GetConfig()->Get('obsolescence.show_obsolete_data'); // default is false $bShow = appUserPreferences::GetPref('show_obsolete_data', $bDefault); - if (static::IsArchiveMode()) - { + if (static::IsArchiveMode()) { $bShow = true; } return $bShow; @@ -352,24 +333,17 @@ class utils global $argv; $retValue = $defaultValue; - if (!is_null(self::$m_aParamsFromFile)) - { - if (isset(self::$m_aParamsFromFile[$sName])) - { + if (!is_null(self::$m_aParamsFromFile)) { + if (isset(self::$m_aParamsFromFile[$sName])) { $retValue = self::$m_aParamsFromFile[$sName]; } } - if (isset($_REQUEST[$sName])) - { + if (isset($_REQUEST[$sName])) { $retValue = $_REQUEST[$sName]; - } - elseif ($bAllowCLI && isset($argv)) - { - foreach($argv as $iArg => $sArg) - { - if (preg_match('/^--'.$sName.'=(.*)$/', $sArg, $aMatches)) - { + } elseif ($bAllowCLI && isset($argv)) { + foreach ($argv as $iArg => $sArg) { + if (preg_match('/^--'.$sName.'=(.*)$/', $sArg, $aMatches)) { $retValue = $aMatches[1]; } } @@ -385,16 +359,12 @@ class utils public static function Sanitize($value, $defaultValue, $sSanitizationFilter) { - if ($value === $defaultValue) - { + if ($value === $defaultValue) { // Preserve the real default value (can be used to detect missing mandatory parameters) $retValue = $value; - } - else - { + } else { $retValue = self::Sanitize_Internal($value, $sSanitizationFilter); - if ($retValue === false) - { + if ($retValue === false) { $retValue = $defaultValue; } } @@ -425,22 +395,18 @@ class utils */ protected static function Sanitize_Internal($value, $sSanitizationFilter) { - if (is_array($value)) - { - $retValue = array(); - foreach ($value as $key => $val) - { + if (is_array($value)) { + $retValue = []; + foreach ($value as $key => $val) { $retValue[$key] = self::Sanitize_Internal($val, $sSanitizationFilter); // recursively check arrays - if ($retValue[$key] === false) - { + if ($retValue[$key] === false) { return false; } } return $retValue; } - switch ($sSanitizationFilter) - { + switch ($sSanitizationFilter) { case static::ENUM_SANITIZATION_FILTER_INTEGER: $retValue = filter_var($value, FILTER_SANITIZE_NUMBER_INT); break; @@ -469,57 +435,62 @@ class utils case static::ENUM_SANITIZATION_FILTER_PARAMETER: case static::ENUM_SANITIZATION_FILTER_FIELD_NAME: case static::ENUM_SANITIZATION_FILTER_TRANSACTION_ID: - switch ($sSanitizationFilter) - { + switch ($sSanitizationFilter) { case static::ENUM_SANITIZATION_FILTER_TRANSACTION_ID: // Same as parameter type but keep the dot character // transaction_id, the dot is mostly for Windows servers when using file storage as the tokens are named *.tmp // - See N°1835 // - Note: It must be included at the regexp beginning otherwise you'll get an invalid character error - $retValue = filter_var($value, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => '/^[\. A-Za-z0-9_=-]*$/'))); + $retValue = filter_var($value, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => '/^[\. A-Za-z0-9_=-]*$/']]); break; case static::ENUM_SANITIZATION_FILTER_ROUTE: case static::ENUM_SANITIZATION_FILTER_OPERATION: // - Routes should be of the "controller_namespace_code.controller_method_name" form // - Operations should be allowed to be namespaced as well even though then don't have dedicated controller yet - $retValue = filter_var($value, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => '/^[\.A-Za-z0-9_-]*$/'))); + $retValue = filter_var($value, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => '/^[\.A-Za-z0-9_-]*$/']]); break; case static::ENUM_SANITIZATION_FILTER_PARAMETER: - $retValue = filter_var($value, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => '/^[ A-Za-z0-9_=-]*$/'))); // the '=', '%3D, '%2B', '%2F' + $retValue = filter_var($value, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => '/^[ A-Za-z0-9_=-]*$/']]); // the '=', '%3D, '%2B', '%2F' // Characters are used in serialized filters (starting 2.5, only the url encoded versions are presents, but the "=" is kept for BC) break; case static::ENUM_SANITIZATION_FILTER_FIELD_NAME: - $retValue = filter_var($value, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => '/^[A-Za-z0-9_]+(->[A-Za-z0-9_]+)*$/'))); // att_code or att_code->name or AttCode->Name or AttCode->Key2->Name + $retValue = filter_var($value, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => '/^[A-Za-z0-9_]+(->[A-Za-z0-9_]+)*$/']]); // att_code or att_code->name or AttCode->Name or AttCode->Key2->Name break; case static::ENUM_SANITIZATION_FILTER_CONTEXT_PARAM: - $retValue = filter_var($value, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => '/^[ A-Za-z0-9_=%:+-]*$/'))); + $retValue = filter_var($value, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => '/^[ A-Za-z0-9_=%:+-]*$/']]); break; } break; - // For XML / HTML node identifiers + // For XML / HTML node identifiers case static::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER: $retValue = preg_replace('/[^a-zA-Z0-9_-]/', '', $value); - $retValue = filter_var($retValue, FILTER_VALIDATE_REGEXP, - ['options' => ['regexp' => '/^[A-Za-z0-9][A-Za-z0-9_-]*$/']]); + $retValue = filter_var( + $retValue, + FILTER_VALIDATE_REGEXP, + ['options' => ['regexp' => '/^[A-Za-z0-9][A-Za-z0-9_-]*$/']] + ); break; - // For XML / HTML node id selector + // For XML / HTML node id selector case static::ENUM_SANITIZATION_FILTER_ELEMENT_SELECTOR: - $retValue = filter_var($value, FILTER_VALIDATE_REGEXP, - ['options' => ['regexp' => '/^[#\.][A-Za-z0-9][A-Za-z0-9_-]*$/']]); + $retValue = filter_var( + $value, + FILTER_VALIDATE_REGEXP, + ['options' => ['regexp' => '/^[#\.][A-Za-z0-9][A-Za-z0-9_-]*$/']] + ); break; case static::ENUM_SANITIZATION_FILTER_VARIABLE_NAME: $retValue = preg_replace('/[^a-zA-Z0-9_]/', '', $value); break; - // For URL + // For URL case static::ENUM_SANITIZATION_FILTER_URL: $retValue = filter_var($value, FILTER_SANITIZE_URL); $retValue = filter_var($retValue, FILTER_VALIDATE_URL); @@ -528,7 +499,7 @@ class utils default: case static::ENUM_SANITIZATION_FILTER_RAW_DATA: $retValue = $value; - // Do nothing + // Do nothing } return $retValue; @@ -543,55 +514,53 @@ class utils * @return ormDocument The uploaded file (can be 'empty' if nothing was uploaded) * @throws \FileUploadException */ - public static function ReadPostedDocument($sName, $sIndex = null) + public static function ReadPostedDocument($sName, $sIndex = null) { $oDocument = new ormDocument(); // an empty document - if(isset($_FILES[$sName])) - { + if (isset($_FILES[$sName])) { $aFileInfo = $_FILES[$sName]; $sError = is_null($sIndex) ? $aFileInfo['error'] : $aFileInfo['error'][$sIndex]; - switch($sError) - { + switch ($sError) { case UPLOAD_ERR_OK: - $sTmpName = is_null($sIndex) ? $aFileInfo['tmp_name'] : $aFileInfo['tmp_name'][$sIndex]; - $sMimeType = is_null($sIndex) ? $aFileInfo['type'] : $aFileInfo['type'][$sIndex]; - $sName = is_null($sIndex) ? $aFileInfo['name'] : $aFileInfo['name'][$sIndex]; + $sTmpName = is_null($sIndex) ? $aFileInfo['tmp_name'] : $aFileInfo['tmp_name'][$sIndex]; + $sMimeType = is_null($sIndex) ? $aFileInfo['type'] : $aFileInfo['type'][$sIndex]; + $sName = is_null($sIndex) ? $aFileInfo['name'] : $aFileInfo['name'][$sIndex]; - $doc_content = file_get_contents($sTmpName); + $doc_content = file_get_contents($sTmpName); $sMimeType = self::GetFileMimeType($sTmpName); $oDocument = new ormDocument($doc_content, $sMimeType, $sName); - break; + break; case UPLOAD_ERR_NO_FILE: - // no file to load, it's a normal case, just return an empty document - break; + // no file to load, it's a normal case, just return an empty document + break; case UPLOAD_ERR_FORM_SIZE: case UPLOAD_ERR_INI_SIZE: - throw new FileUploadException(Dict::Format('UI:Error:UploadedFileTooBig', ini_get('upload_max_filesize'))); - break; + throw new FileUploadException(Dict::Format('UI:Error:UploadedFileTooBig', ini_get('upload_max_filesize'))); + break; case UPLOAD_ERR_PARTIAL: - throw new FileUploadException(Dict::S('UI:Error:UploadedFileTruncated.')); - break; + throw new FileUploadException(Dict::S('UI:Error:UploadedFileTruncated.')); + break; case UPLOAD_ERR_NO_TMP_DIR: - throw new FileUploadException(Dict::S('UI:Error:NoTmpDir')); - break; + throw new FileUploadException(Dict::S('UI:Error:NoTmpDir')); + break; case UPLOAD_ERR_CANT_WRITE: - throw new FileUploadException(Dict::Format('UI:Error:CannotWriteToTmp_Dir', ini_get('upload_tmp_dir'))); - break; + throw new FileUploadException(Dict::Format('UI:Error:CannotWriteToTmp_Dir', ini_get('upload_tmp_dir'))); + break; case UPLOAD_ERR_EXTENSION: - $sName = is_null($sIndex) ? $aFileInfo['name'] : $aFileInfo['name'][$sIndex]; - throw new FileUploadException(Dict::Format('UI:Error:UploadStoppedByExtension_FileName', $sName)); - break; + $sName = is_null($sIndex) ? $aFileInfo['name'] : $aFileInfo['name'][$sIndex]; + throw new FileUploadException(Dict::Format('UI:Error:UploadStoppedByExtension_FileName', $sName)); + break; default: - throw new FileUploadException(Dict::Format('UI:Error:UploadFailedUnknownCause_Code', $sError)); - break; + throw new FileUploadException(Dict::Format('UI:Error:UploadFailedUnknownCause_Code', $sError)); + break; } } @@ -610,26 +579,22 @@ class utils */ public static function ReadMultipleSelection($oFullSetFilter) { - $aSelectedObj = utils::ReadParam('selectObject', array()); + $aSelectedObj = utils::ReadParam('selectObject', []); $sSelectionMode = utils::ReadParam('selectionMode', ''); if ($sSelectionMode != '') { // Paginated selection - $aExceptions = utils::ReadParam('storedSelection', array()); + $aExceptions = utils::ReadParam('storedSelection', []); if ($sSelectionMode == 'positive') { // Only the explicitely listed items are selected $aSelectedObj = $aExceptions; - } - else - { + } else { // All items of the set are selected, except the one explicitely listed - $aSelectedObj = array(); + $aSelectedObj = []; $oFullSet = new DBObjectSet($oFullSetFilter); $sClassAlias = $oFullSetFilter->GetClassAlias(); - $oFullSet->OptimizeColumnLoad(array($sClassAlias => array('friendlyname'))); // We really need only the IDs but it does not work since id is not a real field - while($oObj = $oFullSet->Fetch()) - { - if (!in_array($oObj->GetKey(), $aExceptions)) - { + $oFullSet->OptimizeColumnLoad([$sClassAlias => ['friendlyname']]); // We really need only the IDs but it does not work since id is not a real field + while ($oObj = $oFullSet->Fetch()) { + if (!in_array($oObj->GetKey(), $aExceptions)) { $aSelectedObj[] = $oObj->GetKey(); } } @@ -650,45 +615,37 @@ class utils { $sSelectionMode = utils::ReadParam('selectionMode', ''); - if ($sSelectionMode != 'positive' && $sSelectionMode != 'negative') - { + if ($sSelectionMode != 'positive' && $sSelectionMode != 'negative') { throw new CoreException('selectionMode must be either positive or negative'); } // Paginated selection - $aSelectedIds = utils::ReadParam('storedSelection', array()); - $aSelectedObjIds = utils::ReadParam('selectObject', array()); + $aSelectedIds = utils::ReadParam('storedSelection', []); + $aSelectedObjIds = utils::ReadParam('selectObject', []); //it means that the user has selected all the results of the search query - if (count($aSelectedObjIds) > 0 ) - { - $sFilter=utils::ReadParam("sFilter",'',false,'raw_data'); - if ($sFilter!='') - { - $oFullSetFilter=DBSearch::unserialize($sFilter); + if (count($aSelectedObjIds) > 0) { + $sFilter = utils::ReadParam("sFilter", '', false, 'raw_data'); + if ($sFilter != '') { + $oFullSetFilter = DBSearch::unserialize($sFilter); } } - if (count($aSelectedIds) > 0 ) - { - if ($sSelectionMode == 'positive') - { + if (count($aSelectedIds) > 0) { + if ($sSelectionMode == 'positive') { // Only the explicitly listed items are selected $oFullSetFilter->AddCondition('id', $aSelectedIds, 'IN'); - } - else - { + } else { // All items of the set are selected, except the one explicitly listed $oFullSetFilter->AddCondition('id', $aSelectedIds, 'NOTIN'); } } - $aSelectedObj = array(); + $aSelectedObj = []; $oFullSet = new DBObjectSet($oFullSetFilter); $sClassAlias = $oFullSetFilter->GetClassAlias(); - $oFullSet->OptimizeColumnLoad(array($sClassAlias => array('friendlyname'))); // We really need only the IDs but it does not work since id is not a real field - while ($oObj = $oFullSet->Fetch()) - { + $oFullSet->OptimizeColumnLoad([$sClassAlias => ['friendlyname']]); // We really need only the IDs but it does not work since id is not a real field + while ($oObj = $oFullSet->Fetch()) { $aSelectedObj[$oObj->GetKey()] = $oObj->Get('friendlyname'); } @@ -719,8 +676,7 @@ class utils */ public static function GetUploadTempId($sTransactionId = null) { - if ($sTransactionId === null) - { + if ($sTransactionId === null) { $sTransactionId = static::GetNewTransactionId(); } return $sTransactionId; @@ -753,8 +709,10 @@ class utils switch ($sUnit) { case 'G': $iReturn *= 1024; + // no break case 'M': $iReturn *= 1024; + // no break case 'K': $iReturn *= 1024; } @@ -828,8 +786,7 @@ class utils { $sReturn = ''; // Kilobytes - if ($value >= 1024) - { + if ($value >= 1024) { $sReturn = 'K'; $value = $value / 1024; if ($iPrecision === 0) { @@ -837,27 +794,24 @@ class utils } } // Megabytes - if ($value >= 1024) - { + if ($value >= 1024) { $sReturn = 'M'; $value = $value / 1024; } // Gigabytes - if ($value >= 1024) - { + if ($value >= 1024) { $sReturn = 'G'; $value = $value / 1024; } // Terabytes - if ($value >= 1024) - { + if ($value >= 1024) { $sReturn = 'T'; $value = $value / 1024; } $value = round($value, $iPrecision); - return $value . '' . $sReturn . 'B'; + return $value.''.$sReturn.'B'; } /** @@ -876,7 +830,7 @@ class utils static $aDateTokens = null; static $aDateRegexps = null; if (is_null($aDateTokens)) { - $aSpec = array( + $aSpec = [ '%d' => '(?[0-9]{2})', '%m' => '(?[0-9]{2})', '%y' => '(?[0-9]{2})', @@ -884,15 +838,14 @@ class utils '%H' => '(?[0-2][0-9])', '%i' => '(?[0-5][0-9])', '%s' => '(?[0-5][0-9])', - ); + ]; $aDateTokens = array_keys($aSpec); $aDateRegexps = array_values($aSpec); } - $sDateRegexp = str_replace($aDateTokens, $aDateRegexps, $sFormat); + $sDateRegexp = str_replace($aDateTokens, $aDateRegexps, $sFormat); - if (preg_match('!^(?)'.$sDateRegexp.'(?)$!', $sDate, $aMatches)) - { + if (preg_match('!^(?)'.$sDateRegexp.'(?)$!', $sDate, $aMatches)) { $sYear = isset($aMatches['year']) ? $aMatches['year'] : 0; $sMonth = isset($aMatches['month']) ? $aMatches['month'] : 1; $sDay = isset($aMatches['day']) ? $aMatches['day'] : 1; @@ -900,12 +853,10 @@ class utils $sMinute = isset($aMatches['minute']) ? $aMatches['minute'] : 0; $sSecond = isset($aMatches['second']) ? $aMatches['second'] : 0; return strtotime("$sYear-$sMonth-$sDay $sHour:$sMinute:$sSecond"); + } else { + return false; } - else - { - return false; - } - // http://www.spaweditor.com/scripts/regex/index.php + // http://www.spaweditor.com/scripts/regex/index.php } /** @@ -1008,8 +959,7 @@ class utils } $sProductionEnvConfigPath = self::GetConfigFilePath('production'); - if (file_exists($sProductionEnvConfigPath)) - { + if (file_exists($sProductionEnvConfigPath)) { $oProductionEnvDiskConfig = new Config($sProductionEnvConfigPath); self::SetConfig($oProductionEnvDiskConfig); return self::$oConfig; @@ -1020,13 +970,11 @@ class utils public static function InitTimeZone($oConfig = null) { - if (is_null($oConfig)) - { + if (is_null($oConfig)) { $oConfig = self::GetConfig(); } $sItopTimeZone = $oConfig->Get('timezone'); - if (!empty($sItopTimeZone)) - { + if (!empty($sItopTimeZone)) { date_default_timezone_set($sItopTimeZone); } // else @@ -1065,21 +1013,14 @@ class utils */ public static function GetAbsoluteUrlAppRoot($bForceTrustProxy = false) { - if (static::$sAbsoluteUrlAppRootCache === null || $bForceTrustProxy) - { + if (static::$sAbsoluteUrlAppRootCache === null || $bForceTrustProxy) { static::$sAbsoluteUrlAppRootCache = self::GetConfig()->Get('app_root_url'); - if (static::$sAbsoluteUrlAppRootCache == '') - { + if (static::$sAbsoluteUrlAppRootCache == '') { static::$sAbsoluteUrlAppRootCache = self::GetDefaultUrlAppRoot($bForceTrustProxy); - } - elseif (strpos(static::$sAbsoluteUrlAppRootCache, SERVER_NAME_PLACEHOLDER) > -1) - { - if (isset($_SERVER['SERVER_NAME'])) - { + } elseif (strpos(static::$sAbsoluteUrlAppRootCache, SERVER_NAME_PLACEHOLDER) > -1) { + if (isset($_SERVER['SERVER_NAME'])) { $sServerName = $_SERVER['SERVER_NAME']; - } - else - { + } else { // CLI mode ? $sServerName = php_uname('n'); } @@ -1112,7 +1053,6 @@ class utils return self::GetAppRootUrl($sCurrentScript, $sAppRoot, $sAbsoluteUrl); } - /** * Build the current absolute URL from the server's variables. * @@ -1203,11 +1143,9 @@ class utils { // $_SERVER['REQUEST_URI'] is empty when running on IIS // Let's use Ivan Tcholakov's fix (found on www.dokeos.com) - if (empty($_SERVER['REQUEST_URI'])) - { + if (empty($_SERVER['REQUEST_URI'])) { $sPath = $_SERVER['SCRIPT_NAME']; - if (!empty($_SERVER['QUERY_STRING'])) - { + if (!empty($_SERVER['QUERY_STRING'])) { $sPath .= '?'.$_SERVER['QUERY_STRING']; } $_SERVER['REQUEST_URI'] = $sPath; @@ -1232,21 +1170,15 @@ class utils $sCurrentRelativePath = str_ireplace($sAppRoot, '', $sCurrentScript); $sAppRootPos = strpos($sAbsoluteUrl, $sCurrentRelativePath); - if ($sAppRootPos !== false) - { + if ($sAppRootPos !== false) { $sAppRootUrl = substr($sAbsoluteUrl, 0, $sAppRootPos); // remove the current page and path - } - else - { + } else { // Second attempt without index.php at the end... $sCurrentRelativePath = str_ireplace('index.php', '', $sCurrentRelativePath); $sAppRootPos = strpos($sAbsoluteUrl, $sCurrentRelativePath); - if ($sAppRootPos !== false) - { + if ($sAppRootPos !== false) { $sAppRootUrl = substr($sAbsoluteUrl, 0, $sAppRootPos); // remove the current page and path - } - else - { + } else { // No luck... throw new Exception("Failed to determine application root path $sAbsoluteUrl ($sCurrentRelativePath) APPROOT:'$sAppRoot'"); } @@ -1263,13 +1195,10 @@ class utils */ public static function GetAppRevisionNumber() { - if (ITOP_REVISION == 'svn') - { + if (ITOP_REVISION == 'svn') { // This is NOT a version built using the build system, just display the main version $sRevisionNumber = Dict::Format('UI:iTopVersion:Short', ITOP_APPLICATION, ITOP_VERSION); - } - else - { + } else { // This is a build made from SVN, let display the full information $sRevisionNumber = Dict::Format('UI:iTopVersion:Long', ITOP_APPLICATION, ITOP_VERSION, ITOP_REVISION, ITOP_BUILD_DATE); } @@ -1297,16 +1226,11 @@ class utils $bTrustProxy = $bForceTrustProxy || self::IsProxyTrusted(); - if ($bTrustProxy && !empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) - { + if ($bTrustProxy && !empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) { $bSecured = ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'); - } - elseif ($bTrustProxy && !empty($_SERVER['HTTP_X_FORWARDED_PROTOCOL'])) - { + } elseif ($bTrustProxy && !empty($_SERVER['HTTP_X_FORWARDED_PROTOCOL'])) { $bSecured = ($_SERVER['HTTP_X_FORWARDED_PROTOCOL'] === 'https'); - } - elseif ((!empty($_SERVER['HTTPS'])) && (strtolower($_SERVER['HTTPS']) != 'off')) - { + } elseif ((!empty($_SERVER['HTTPS'])) && (strtolower($_SERVER['HTTPS']) != 'off')) { $bSecured = (strcasecmp($_SERVER['HTTPS'], 'off') !== 0); } @@ -1320,7 +1244,7 @@ class utils * 2) the user did not log-in using the "basic" mode (i.e basic authentication) or by passing credentials in the URL * @return boolean True if logoff is supported, false otherwise */ - static function CanLogOff() + public static function CanLogOff() { return Session::Get('can_logoff', false); } @@ -1334,16 +1258,15 @@ class utils return Session::GetLog(); } - static function DebugBacktrace($iLimit = 5) - { + public static function DebugBacktrace($iLimit = 5) + { $aFullTrace = debug_backtrace(); - $aLightTrace = array(); - for($i=1; ($i<=$iLimit && $i < count($aFullTrace)); $i++) // Skip the last function call... which is the call to this function ! - { + $aLightTrace = []; + for ($i = 1; ($i <= $iLimit && $i < count($aFullTrace)); $i++) { // Skip the last function call... which is the call to this function ! $aLightTrace[$i] = $aFullTrace[$i]['function'].'(), called from line '.$aFullTrace[$i]['line'].' in '.$aFullTrace[$i]['file']; } echo "

      ".print_r($aLightTrace, true)."

      \n"; - } + } /** * Execute the given iTop PHP script, passing it the current credentials @@ -1385,7 +1308,7 @@ class utils $aArguments['param_file'] = $sParamFile; } - $aArgs = array(); + $aArgs = []; foreach ($aArguments as $sName => $value) { // Note: See comment from the 23-Apr-2004 03:30 in the PHP documentation // It suggests to rely on pctnl_* function instead of using escapeshellargs @@ -1416,7 +1339,7 @@ class utils throw new Exception(Dict::S('Core:ExecProcess:Code255')." - ".$sCommand.":\n".$sErrors); } - return array($iRes, $aOutput); + return [$iRes, $aOutput]; } /** @@ -1434,7 +1357,7 @@ class utils */ public static function GetCompiledEnvironmentPath(): string { - return APPROOT . 'env-' . MetaModel::GetEnvironment() . '/'; + return APPROOT.'env-'.MetaModel::GetEnvironment().'/'; } /** @@ -1507,8 +1430,7 @@ class utils // 1st - add standard built-in menu items // - switch($iMenuId) - { + switch ($iMenuId) { case iPopupMenuExtension::MENU_OBJLIST_ACTIONS: // No native action there yet break; @@ -1538,8 +1460,10 @@ class utils if (strlen($sUrl) < SERVER_MAX_URL_LENGTH) { // Static menus: Email this page, CSV Export & Add to Dashboard - $aResult[] = new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'), - "mailto:?body=".urlencode($sUrl).' ' // Add an extra space to make it work in Outlook + $aResult[] = new URLPopupMenuItem( + 'UI:Menu:EMail', + Dict::S('UI:Menu:EMail'), + "mailto:?body=".urlencode($sUrl).' ' // Add an extra space to make it work in Outlook ); } @@ -1547,18 +1471,17 @@ class utils // Bulk export actions $aResult[] = new JSPopupMenuItem('UI:Menu:CSVExport', Dict::S('UI:Menu:CSVExport'), "ExportListDlg('$sOQL', '$sDataTableId', 'csv', ".json_encode(Dict::S('UI:Menu:CSVExport')).")"); $aResult[] = new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('$sOQL', '$sDataTableId', 'xlsx', ".json_encode(Dict::S('ExcelExporter:ExportMenu')).")"); - if (extension_loaded('gd')) - { + if (extension_loaded('gd')) { // PDF export requires GD $aResult[] = new JSPopupMenuItem('UI:Menu:ExportPDF', Dict::S('UI:Menu:ExportPDF'), "ExportListDlg('$sOQL', '$sDataTableId', 'pdf', ".json_encode(Dict::S('UI:Menu:ExportPDF')).")"); } } $aResult[] = new JSPopupMenuItem('UI:Menu:AddToDashboard', Dict::S('UI:Menu:AddToDashboard'), "DashletCreationDlg('$sOQL', '$sContext')"); $aResult[] = new JSPopupMenuItem('UI:Menu:ShortcutList', Dict::S('UI:Menu:ShortcutList'), "ShortcutListDlg('$sOQL', '$sDataTableId', '$sContext')"); - if (ApplicationMenu::IsMenuIdEnabled('RunQueriesMenu')) { - $oMenuItemPlay = new JSPopupMenuItem('UI:Menu:OpenOQL', Dict::S('UI:Menu:OpenOQL'), "OpenOql('$sOQL')"); - $aResult[] = $oMenuItemPlay; - } + if (ApplicationMenu::IsMenuIdEnabled('RunQueriesMenu')) { + $oMenuItemPlay = new JSPopupMenuItem('UI:Menu:OpenOQL', Dict::S('UI:Menu:OpenOQL'), "OpenOql('$sOQL')"); + $aResult[] = $oMenuItemPlay; + } break; @@ -1574,7 +1497,7 @@ class utils $oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js'); $oContainerBlock->AddCssFileRelPath('css/dragtable.css'); - $aResult = array( + $aResult = [ new SeparatorPopupMenuItem(), // Static menus: Email this page & CSV Export new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'), "mailto:?subject=".urlencode($oObj->GetRawName())."&body=".urlencode($sUrl).' '), // Add an extra space to make it work in Outlook @@ -1582,7 +1505,7 @@ class utils new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('$sOQL', '', 'xlsx', ".json_encode(Dict::S('ExcelExporter:ExportMenu')).")"), new SeparatorPopupMenuItem(), new URLPopupMenuItem('UI:Menu:PrintableVersion', Dict::S('UI:Menu:PrintableVersion'), $sUrl.'&printable=1', '_blank'), - ); + ]; break; case iPopupMenuExtension::MENU_DASHBOARD_ACTIONS: @@ -1598,11 +1521,11 @@ class utils $sDashboardFileJS = addslashes($sDashboardFileRelative); $sDashboardFileURL = urlencode($sDashboardFileRelative); $sUploadDashboardTransactId = utils::GetNewTransactionId(); - $aResult = array( + $aResult = [ new SeparatorPopupMenuItem(), new URLPopupMenuItem('UI:ExportDashboard', Dict::S('UI:ExportDashBoard'), utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?operation=export_dashboard&id='.$sDashboardId.'&file='.$sDashboardFileURL), new JSPopupMenuItem('UI:ImportDashboard', Dict::S('UI:ImportDashBoard'), "UploadDashboard({dashboard_id: '$sDashboardId', file: '$sDashboardFileJS', title: '$sDlgTitle', text: '$sDlgText', close_btn: '$sCloseBtn', transaction: '$sUploadDashboardTransactId' })"), - ); + ]; if ($oDashboard->GetReloadURL()) { $aResult[] = new SeparatorPopupMenuItem(); $aResult[] = new URLPopupMenuItem('UI:Menu:PrintableVersion', Dict::S('UI:Menu:PrintableVersion'), $oDashboard->GetReloadURL().'&printable=1', '_blank'); @@ -1789,8 +1712,7 @@ SQL; */ public static function GetConfigFilePathRelative($sEnvironment = null) { - if (is_null($sEnvironment)) - { + if (is_null($sEnvironment)) { $sEnvironment = self::GetCurrentEnvironment(); } return "conf/".$sEnvironment.'/'.ITOP_CONFIG_FILE; @@ -1827,7 +1749,7 @@ SQL; * * @throws \Exception */ - public static function GetAbsoluteUrlModulePage($sModule, $sPage, $aArguments = array(), $sEnvironment = null) + public static function GetAbsoluteUrlModulePage($sModule, $sPage, $aArguments = [], $sEnvironment = null) { $aArgs = self::GetExecPageArguments($sModule, $sPage, $aArguments, $sEnvironment); $sArgs = http_build_query($aArgs); @@ -1844,17 +1766,15 @@ SQL; * @return string[] key/value pair for the exec page query string. Warning : values are not url encoded ! * @throws \Exception if one of the argument has a reserved name */ - public static function GetExecPageArguments($sModule, $sPage, $aArguments = array(), $sEnvironment = null) + public static function GetExecPageArguments($sModule, $sPage, $aArguments = [], $sEnvironment = null) { $sEnvironment = is_null($sEnvironment) ? self::GetCurrentEnvironment() : $sEnvironment; - $aArgs = array(); + $aArgs = []; $aArgs['exec_module'] = $sModule; $aArgs['exec_page'] = $sPage; $aArgs['exec_env'] = $sEnvironment; - foreach($aArguments as $sName => $sValue) - { - if (($sName == 'exec_module') || ($sName == 'exec_page') || ($sName == 'exec_env')) - { + foreach ($aArguments as $sName => $sValue) { + if (($sName == 'exec_module') || ($sName == 'exec_page') || ($sName == 'exec_env')) { throw new Exception("Module page: $sName is a reserved page argument name"); } $aArgs[$sName] = $sValue; @@ -1880,17 +1800,13 @@ SQL; */ public static function MakeUniqueName($sProposed, $aExisting) { - if (in_array($sProposed, $aExisting)) - { + if (in_array($sProposed, $aExisting)) { $i = 1; - while (in_array($sProposed.$i, $aExisting) && ($i < 50)) - { + while (in_array($sProposed.$i, $aExisting) && ($i < 50)) { $i++; } return $sProposed.$i; - } - else - { + } else { return $sProposed; } } @@ -1902,7 +1818,7 @@ SQL; */ public static function GetSafeId($sId) { - return str_replace(array(':', '[', ']', '+', '-', ' '), '_', $sId); + return str_replace([':', '[', ']', '+', '-', ' '], '_', $sId); } /** @@ -1928,7 +1844,7 @@ SQL; * * @since 3.1.0 N°6172 as curl ext is now mandatory, method will crash with a ApplicationException if this PHP extension isn't available */ - public static function DoPostRequest($sUrl, $aData, $sOptionnalHeaders = null, &$aResponseHeaders = null, $aCurlOptions = array()) + public static function DoPostRequest($sUrl, $aData, $sOptionnalHeaders = null, &$aResponseHeaders = null, $aCurlOptions = []) { if (false === function_exists('curl_init')) { throw new ApplicationException('\utils::DoPostRequest method called whereas the CURL PHP extension isn\'t available !'); @@ -1941,12 +1857,12 @@ SQL; $aHeaders = explode("\n", $sOptionnalHeaders ?? ''); // N°3267 - Webservices: Fix optional headers not being taken into account // See https://www.php.net/curl_setopt CURLOPT_HTTPHEADER - $aHTTPHeaders = array(); + $aHTTPHeaders = []; foreach ($aHeaders as $sHeaderString) { $aHTTPHeaders[] = trim($sHeaderString); } // Default options, can be overloaded/extended with the 4th parameter of this method, see above $aCurlOptions - $aOptions = array( + $aOptions = [ CURLOPT_RETURNTRANSFER => true, // return the content of the request CURLOPT_HEADER => false, // don't return the headers in the output CURLOPT_FOLLOWLOCATION => true, // follow redirects @@ -1963,7 +1879,7 @@ SQL; CURLOPT_POST => count($aData), CURLOPT_POSTFIELDS => http_build_query($aData), CURLOPT_HTTPHEADER => $aHTTPHeaders, - ); + ]; $aAllOptions = $aCurlOptions + $aOptions; $ch = curl_init($sUrl); @@ -1990,22 +1906,22 @@ SQL; /** * Get a standard list of character sets * - * @param array $aAdditionalEncodings Additional values + * @param array $aAdditionalEncodings Additional values * @return array of iconv code => english label, sorted by label */ - public static function GetPossibleEncodings($aAdditionalEncodings = array()) + public static function GetPossibleEncodings($aAdditionalEncodings = []) { // Encodings supported: // ICONV_CODE => Display Name // Each iconv installation supports different encodings // Some reasonably common and useful encodings are listed here - $aPossibleEncodings = array( + $aPossibleEncodings = [ 'UTF-8' => 'Unicode (UTF-8)', 'ISO-8859-1' => 'Western (ISO-8859-1)', 'WINDOWS-1251' => 'Cyrilic (Windows 1251)', 'WINDOWS-1252' => 'Western (Windows 1252)', 'ISO-8859-15' => 'Western (ISO-8859-15)', - ); + ]; $aPossibleEncodings = array_merge($aPossibleEncodings, $aAdditionalEncodings); asort($aPossibleEncodings); return $aPossibleEncodings; @@ -2137,7 +2053,7 @@ SQL; } // else log the error if needed if ($bLogErrors) { - IssueLog::Warning("Format string requires $iExpectedCount arguments, but only $iActualCount provided. Format: '$sFormat'" ); + IssueLog::Warning("Format string requires $iExpectedCount arguments, but only $iActualCount provided. Format: '$sFormat'"); } // Create a replacement map @@ -2162,7 +2078,7 @@ SQL; } // Remove any remaining nulls (for positions that weren't referenced) - $aReplacements = array_filter($aReplacements, static function($val) { return $val !== null; }); + $aReplacements = array_filter($aReplacements, static function ($val) { return $val !== null; }); } else { // For non-positional, we need to map each position $aReplacements = []; @@ -2212,8 +2128,7 @@ SQL; try { //return ''.$sHtml; return Html2Text::convert(''.$sHtml, ['ignore_errors' => true]); - } - catch (Exception $e) { + } catch (Exception $e) { return $e->getMessage(); } } @@ -2226,7 +2141,7 @@ SQL; */ public static function TextToHtml($sText) { - if (static::IsNullOrEmptyString($sText)){ + if (static::IsNullOrEmptyString($sText)) { return ''; } $sText = str_replace("\r\n", "\n", $sText); @@ -2245,24 +2160,21 @@ SQL; public static function GetCSSFromSASS($sSassRelPath, $aImportPaths = null) { // Avoiding compilation if file is already a css file. - if (preg_match('/\.css(\?.*)?$/', $sSassRelPath)) - { + if (preg_match('/\.css(\?.*)?$/', $sSassRelPath)) { return $sSassRelPath; } // Setting import paths - if ($aImportPaths === null) - { - $aImportPaths = array(); + if ($aImportPaths === null) { + $aImportPaths = []; } - $aImportPaths[] = APPROOT . '/css'; + $aImportPaths[] = APPROOT.'/css'; $sSassPath = APPROOT.$sSassRelPath; $sCssRelPath = preg_replace('/\.scss$/', '.css', $sSassRelPath); $sCssPath = APPROOT.$sCssRelPath; clearstatcache(); - if (!file_exists($sCssPath) || (is_writable($sCssPath) && (filemtime($sCssPath) < filemtime($sSassPath)))) - { + if (!file_exists($sCssPath) || (is_writable($sCssPath) && (filemtime($sCssPath) < filemtime($sSassPath)))) { $sCss = static::CompileCSSFromSASS(file_get_contents($sSassPath), $aImportPaths); file_put_contents($sCssPath, $sCss); } @@ -2280,7 +2192,7 @@ SQL; * * @since 2.7.0 */ - public static function CompileCSSFromSASS($sSassContent, $aImportPaths = array(), $aVariables = array()) + public static function CompileCSSFromSASS($sSassContent, $aImportPaths = [], $aVariables = []) { $oSass = new Compiler(); $oSass->setOutputStyle(OutputStyle::COMPRESSED); @@ -2327,40 +2239,32 @@ SQL; public static function ResizeImageToFit(ormDocument $oImage, $iWidth, $iHeight, $iMaxImageWidth, $iMaxImageHeight) { // If image size smaller than maximums, we do nothing - if (($iWidth <= $iMaxImageWidth) && ($iHeight <= $iMaxImageHeight)) - { + if (($iWidth <= $iMaxImageWidth) && ($iHeight <= $iMaxImageHeight)) { return $oImage; } - // If gd extension is not loaded, we put a warning in the log and return the image as is - if (extension_loaded('gd') === false) - { - IssueLog::Warning('Image could not be resized as the "gd" extension does not seem to be loaded. It will remain as ' . $iWidth . 'x' . $iHeight . ' instead of ' . $iMaxImageWidth . 'x' . $iMaxImageHeight); + if (extension_loaded('gd') === false) { + IssueLog::Warning('Image could not be resized as the "gd" extension does not seem to be loaded. It will remain as '.$iWidth.'x'.$iHeight.' instead of '.$iMaxImageWidth.'x'.$iMaxImageHeight); return $oImage; } - - switch($oImage->GetMimeType()) - { + switch ($oImage->GetMimeType()) { case 'image/gif': case 'image/jpeg': case 'image/png': - $img = @imagecreatefromstring($oImage->GetData()); - break; + $img = @imagecreatefromstring($oImage->GetData()); + break; default: - // Unsupported image type, return the image as-is - //throw new Exception("Unsupported image type: '".$oImage->GetMimeType()."'. Cannot resize the image, original image will be used."); - return $oImage; + // Unsupported image type, return the image as-is + //throw new Exception("Unsupported image type: '".$oImage->GetMimeType()."'. Cannot resize the image, original image will be used."); + return $oImage; } - if ($img === false) - { + if ($img === false) { //throw new Exception("Warning: corrupted image: '".$oImage->GetFileName()." / ".$oImage->GetMimeType()."'. Cannot resize the image, original image will be used."); return $oImage; - } - else - { + } else { // Let's scale the image, preserving the transparency for GIFs and PNGs $fScale = min($iMaxImageWidth / $iWidth, $iMaxImageHeight / $iHeight); @@ -2371,8 +2275,7 @@ SQL; $new = imagecreatetruecolor($iNewWidth, $iNewHeight); // Preserve transparency - if(($oImage->GetMimeType() == "image/gif") || ($oImage->GetMimeType() == "image/png")) - { + if (($oImage->GetMimeType() == "image/gif") || ($oImage->GetMimeType() == "image/png")) { imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127)); imagealphablending($new, false); imagesavealpha($new, true); @@ -2381,19 +2284,18 @@ SQL; imagecopyresampled($new, $img, 0, 0, 0, 0, $iNewWidth, $iNewHeight, $iWidth, $iHeight); ob_start(); - switch ($oImage->GetMimeType()) - { + switch ($oImage->GetMimeType()) { case 'image/gif': - imagegif($new); // send image to output buffer - break; + imagegif($new); // send image to output buffer + break; case 'image/jpeg': - imagejpeg($new, null, 80); // null = send image to output buffer, 80 = good quality - break; + imagejpeg($new, null, 80); // null = send image to output buffer, 80 = good quality + break; case 'image/png': - imagepng($new, null, 5); // null = send image to output buffer, 5 = medium compression - break; + imagepng($new, null, 5); // null = send image to output buffer, 5 = medium compression + break; } $oResampledImage = new ormDocument(ob_get_contents(), $oImage->GetMimeType(), $oImage->GetFileName()); @ob_end_clean(); @@ -2421,17 +2323,17 @@ SQL; $data = $sPrefix; $data .= __FILE__; $data .= mt_rand(); - $hash = strtoupper(hash('ripemd128', $uid . md5($data))); - $sUUID = '{' . - substr($hash, 0, 8) . - '-' . - substr($hash, 8, 4) . - '-' . - substr($hash, 12, 4) . - '-' . - substr($hash, 16, 4) . - '-' . - substr($hash, 20, 12) . + $hash = strtoupper(hash('ripemd128', $uid.md5($data))); + $sUUID = '{'. + substr($hash, 0, 8). + '-'. + substr($hash, 8, 4). + '-'. + substr($hash, 12, 4). + '-'. + substr($hash, 16, 4). + '-'. + substr($hash, 20, 12). '}'; return $sUUID; } @@ -2444,7 +2346,7 @@ SQL; */ public static function GetCurrentModuleName($iCallDepth = 0) { - return ModuleService::GetInstance()->GetCurrentModuleName($iCallDepth + 1); + return ModuleService::GetInstance()->GetCurrentModuleName($iCallDepth + 1); } /** @@ -2491,7 +2393,7 @@ SQL; */ public static function GetCurrentModuleSetting($sProperty, $defaultvalue = null) { - return ModuleService::GetInstance()->GetCurrentModuleSetting($sProperty, $defaultvalue); + return ModuleService::GetInstance()->GetCurrentModuleSetting($sProperty, $defaultvalue); } /** @@ -2500,7 +2402,7 @@ SQL; */ public static function GetCompiledModuleVersion($sModuleName) { - return ModuleService::GetInstance()->GetCompiledModuleVersion($sModuleName); + return ModuleService::GetInstance()->GetCompiledModuleVersion($sModuleName); } /** @@ -2511,8 +2413,7 @@ SQL; public static function IsURL($sPath) { $bRet = false; - if ((substr($sPath, 0, 7) == 'http://') || (substr($sPath, 0, 8) == 'https://') || (substr($sPath, 0, 8) == 'ftp://')) - { + if ((substr($sPath, 0, 7) == 'http://') || (substr($sPath, 0, 8) == 'https://') || (substr($sPath, 0, 8) == 'ftp://')) { $bRet = true; } return $bRet; @@ -2549,7 +2450,7 @@ SQL; // extract the "query" part of the URL and analyze it $sQuery = parse_url($sPath, PHP_URL_QUERY); if ($sQuery !== null) { - $aParams = array(); + $aParams = []; foreach (explode('&', $sQuery) as $sChunk) { $aParts = explode('=', $sChunk ?? ''); if (count($aParts) != 2) { @@ -2662,22 +2563,17 @@ TXT protected static function ParseHeaders($aHeaders) { - $aCleanHeaders = array(); - foreach( $aHeaders as $sKey => $sValue ) - { + $aCleanHeaders = []; + foreach ($aHeaders as $sKey => $sValue) { $aTokens = explode(':', $sValue ?? '', 2); - if(isset($aTokens[1])) - { + if (isset($aTokens[1])) { $aCleanHeaders[trim($aTokens[0])] = trim($aTokens[1]); - } - else - { + } else { // The header is not in the form Header-Code: Value $aCleanHeaders[] = $sValue; // Store the value as-is - $aMatches = array(); + $aMatches = []; // Check if it's not the HTTP response code - if( preg_match("|HTTP/[0-9\.]+\s+([0-9]+)|", $sValue, $aMatches) ) - { + if (preg_match("|HTTP/[0-9\.]+\s+([0-9]+)|", $sValue, $aMatches)) { $aCleanHeaders['reponse_code'] = intval($aMatches[1]); } } @@ -2726,8 +2622,7 @@ TXT */ public static function IsHighCardinality($sClass) { - if (utils::GetConfig()->Get('search_manual_submit')) - { + if (utils::GetConfig()->Get('search_manual_submit')) { return true; } $aHugeClasses = MetaModel::GetConfig()->Get('high_cardinality_classes'); @@ -2746,20 +2641,17 @@ TXT */ public static function GetFileMimeType($sFilePath, $sDefaultMimeType = 'application/octet-stream') { - if (!function_exists('finfo_file')) - { + if (!function_exists('finfo_file')) { return $sDefaultMimeType; } $sMimeType = $sDefaultMimeType; $rInfo = @finfo_open(FILEINFO_MIME_TYPE); - if ($rInfo !== false) - { + if ($rInfo !== false) { $sType = @finfo_file($rInfo, $sFilePath); if (($sType !== false) && is_string($sType) - && ($sType !== '')) - { + && ($sType !== '')) { $sMimeType = $sType; } } @@ -2789,14 +2681,12 @@ TXT final public static function RealPath($sPath, $sBasePath) { $sFileRealPath = realpath($sPath); - if ($sFileRealPath === false) - { + if ($sFileRealPath === false) { return false; } $sRealBasePath = realpath($sBasePath); // avoid problems when having '/' on Windows for example - if (!self::StartsWith($sFileRealPath, $sRealBasePath)) - { + if (!self::StartsWith($sFileRealPath, $sRealBasePath)) { return false; } @@ -2817,8 +2707,7 @@ TXT { $sRootPath = realpath($sBasePath); $sFullPath = realpath($sAbsolutePath); - if (($sFullPath === false) || !self::StartsWith($sFullPath, $sRootPath)) - { + if (($sFullPath === false) || !self::StartsWith($sFullPath, $sRootPath)) { return false; } $sLocalPath = substr($sFullPath, strlen($sRootPath.DIRECTORY_SEPARATOR)); @@ -2837,8 +2726,7 @@ TXT { $sRootPath = realpath(APPROOT); $sFullPath = realpath($sRootPath.DIRECTORY_SEPARATOR.$sPath); - if (($sFullPath === false) || !self::StartsWith($sFullPath, $sRootPath)) - { + if (($sFullPath === false) || !self::StartsWith($sFullPath, $sRootPath)) { return false; } return $sFullPath; @@ -2851,8 +2739,7 @@ TXT public static function GetCurrentUserName() { - if (function_exists('posix_getpwuid')) - { + if (function_exists('posix_getpwuid')) { return posix_getpwuid(posix_geteuid())['name']; } @@ -2874,13 +2761,12 @@ TXT public static function EnrichRaisedException($oCmdbAbstract, $oException) { if (is_null($oCmdbAbstract) || - ! is_a($oCmdbAbstract, \cmdbAbstractObject::class)) - { + ! is_a($oCmdbAbstract, \cmdbAbstractObject::class)) { throw $oException; } - $sCmdbAbstractInfo = str_replace("\n", '', "" . $oCmdbAbstract); - $sMessage = $oException->getMessage() . " (" . $sCmdbAbstractInfo . ")"; + $sCmdbAbstractInfo = str_replace("\n", '', "".$oCmdbAbstract); + $sMessage = $oException->getMessage()." (".$sCmdbAbstractInfo.")"; $e = new CoreException($sMessage, null, '', $oException); throw $e; @@ -3241,7 +3127,7 @@ TXT // Prepare array for matched class if not already present if (!array_key_exists($sMatchedClass, $aMentionedObjects)) { - $aMentionedObjects[$sMatchedClass] = array(); + $aMentionedObjects[$sMatchedClass] = []; } // Add matched ID if not already there if (!in_array($sMatchedId, $aMentionedObjects[$sMatchedClass])) { diff --git a/application/webpage.class.inc.php b/application/webpage.class.inc.php index 4bf375ea4..5632ee287 100644 --- a/application/webpage.class.inc.php +++ b/application/webpage.class.inc.php @@ -1,8 +1,9 @@ - /** * Class WizardHelper * @@ -31,7 +31,7 @@ require_once(APPROOT.'/application/uiwizard.class.inc.php'); class WizardHelper { protected $m_aData; - + public function __construct() { } @@ -39,26 +39,20 @@ class WizardHelper * Constructs the PHP target object from the parameters sent to the web page by the wizard * @param boolean $bReadUploadedFiles True to also read any uploaded file (for blob/document fields) * @return object - */ + */ public function GetTargetObject($bReadUploadedFiles = false) { - if (isset($this->m_aData['m_oCurrentValues']['id'])) - { + if (isset($this->m_aData['m_oCurrentValues']['id'])) { $oObj = MetaModel::GetObject($this->m_aData['m_sClass'], $this->m_aData['m_oCurrentValues']['id']); - } - else - { + } else { $oObj = MetaModel::NewObject($this->m_aData['m_sClass']); } - foreach($this->m_aData['m_oCurrentValues'] as $sAttCode => $value) - { + foreach ($this->m_aData['m_oCurrentValues'] as $sAttCode => $value) { // Because this is stored in a Javascript array, unused indexes // are filled with null values and unused keys (stored as strings) contain $$NULL$$ - if ( ($sAttCode !='id') && ($value !== '$$NULL$$')) - { + if (($sAttCode != 'id') && ($value !== '$$NULL$$')) { $oAttDef = MetaModel::GetAttributeDef($this->m_aData['m_sClass'], $sAttCode); - if (($oAttDef->IsLinkSet()) && ($value != '') ) - { + if (($oAttDef->IsLinkSet()) && ($value != '')) { // special handling for lists // assumes this is handled as an array of objects // thus encoded in json like: [ { name:'link1', 'id': 123}, { name:'link2', 'id': 124}...] @@ -71,47 +65,35 @@ class WizardHelper // Check what are the meaningful attributes $aFields = $this->GetLinkedWizardStructure($oAttDef); $sLinkedClass = $oAttDef->GetLinkedClass(); - $aLinkedObjectsArray = array(); + $aLinkedObjectsArray = []; if (!is_array($aData)) { echo("aData: '$aData' (value: '$value')\n"); } - foreach ($aData as $aLinkedObject) - { + foreach ($aData as $aLinkedObject) { $oLinkedObj = MetaModel::NewObject($sLinkedClass); - foreach($aFields as $sLinkedAttCode) - { - if ( isset($aLinkedObject[$sLinkedAttCode]) && ($aLinkedObject[$sLinkedAttCode] !== null) ) - { + foreach ($aFields as $sLinkedAttCode) { + if (isset($aLinkedObject[$sLinkedAttCode]) && ($aLinkedObject[$sLinkedAttCode] !== null)) { $sLinkedAttDef = MetaModel::GetAttributeDef($sLinkedClass, $sLinkedAttCode); - if (($sLinkedAttDef->IsExternalKey()) && ($aLinkedObject[$sLinkedAttCode] != '') && ($aLinkedObject[$sLinkedAttCode] > 0) ) - { + if (($sLinkedAttDef->IsExternalKey()) && ($aLinkedObject[$sLinkedAttCode] != '') && ($aLinkedObject[$sLinkedAttCode] > 0)) { // For external keys: load the target object so that external fields // get filled too $oTargetObj = MetaModel::GetObject($sLinkedAttDef->GetTargetClass(), $aLinkedObject[$sLinkedAttCode]); $oLinkedObj->Set($sLinkedAttCode, $oTargetObj); - } - elseif($sLinkedAttDef instanceof AttributeDateTime) - { - $sDateClass = get_class($sLinkedAttDef); - $sDate = $aLinkedObject[$sLinkedAttCode]; - if($sDate !== null && $sDate !== '') - { - $oDateTimeFormat = $sDateClass::GetFormat(); - $oDate = $oDateTimeFormat->Parse($sDate); - if ($sDateClass == "AttributeDate") - { - $sDate = $oDate->format('Y-m-d'); - } - else - { - $sDate = $oDate->format('Y-m-d H:i:s'); - } - } + } elseif ($sLinkedAttDef instanceof AttributeDateTime) { + $sDateClass = get_class($sLinkedAttDef); + $sDate = $aLinkedObject[$sLinkedAttCode]; + if ($sDate !== null && $sDate !== '') { + $oDateTimeFormat = $sDateClass::GetFormat(); + $oDate = $oDateTimeFormat->Parse($sDate); + if ($sDateClass == "AttributeDate") { + $sDate = $oDate->format('Y-m-d'); + } else { + $sDate = $oDate->format('Y-m-d H:i:s'); + } + } - $oLinkedObj->Set($sLinkedAttCode, $sDate); - } - else - { + $oLinkedObj->Set($sLinkedAttCode, $sDate); + } else { $oLinkedObj->Set($sLinkedAttCode, $aLinkedObject[$sLinkedAttCode]); } } @@ -120,189 +102,147 @@ class WizardHelper } $oSet = DBObjectSet::FromArray($sLinkedClass, $aLinkedObjectsArray); $oObj->Set($sAttCode, $oSet); - } - else if ( $oAttDef->GetEditClass() == 'Document' ) - { - if ($bReadUploadedFiles) - { + } elseif ($oAttDef->GetEditClass() == 'Document') { + if ($bReadUploadedFiles) { $oDocument = utils::ReadPostedDocument('attr_'.$sAttCode, 'fcontents'); $oObj->Set($sAttCode, $oDocument); - } - else - { + } else { // Create a new empty document, just for displaying the file name $oDocument = new ormDocument(null, '', $value); $oObj->Set($sAttCode, $oDocument); } - } - else if ( $oAttDef->GetEditClass() == 'Image' ) - { - if ($bReadUploadedFiles) - { + } elseif ($oAttDef->GetEditClass() == 'Image') { + if ($bReadUploadedFiles) { $oDocument = utils::ReadPostedDocument('attr_'.$sAttCode, 'fcontents'); $oObj->Set($sAttCode, $oDocument); - } - else - { + } else { // Create a new empty document, just for displaying the file name $oDocument = new ormDocument(null, '', $value); $oObj->Set($sAttCode, $oDocument); } - } - else if (($oAttDef->IsExternalKey()) && (!empty($value)) && ($value > 0) ) - { + } elseif (($oAttDef->IsExternalKey()) && (!empty($value)) && ($value > 0)) { // For external keys: load the target object so that external fields // get filled too $oTargetObj = MetaModel::GetObject($oAttDef->GetTargetClass(), $value, false); - if ($oTargetObj) - { + if ($oTargetObj) { $oObj->Set($sAttCode, $oTargetObj); - } - else - { + } else { // May happen for security reasons (portal, see ticket N°1074) $oObj->Set($sAttCode, $value); } - } - else if ($oAttDef instanceof AttributeDateTime) // AttributeDate is derived from AttributeDateTime - { - if ($value != null) - { + } elseif ($oAttDef instanceof AttributeDateTime) { // AttributeDate is derived from AttributeDateTime + if ($value != null) { $oDate = $oAttDef->GetFormat()->Parse($value); - if ($oDate instanceof DateTime) - { + if ($oDate instanceof DateTime) { $value = $oDate->format($oAttDef->GetInternalFormat()); - } - else - { + } else { $value = null; } } $oObj->Set($sAttCode, $value); - } - else if ($oAttDef instanceof AttributeTagSet) // AttributeDate is derived from AttributeDateTime - { - if (is_null($value)) - { + } elseif ($oAttDef instanceof AttributeTagSet) { // AttributeDate is derived from AttributeDateTime + if (is_null($value)) { // happens if field is hidden (see N°1827) - $value = array(); - } - else - { + $value = []; + } else { $value = json_decode($value, true); } $oTagSet = new ormTagSet(get_class($oObj), $sAttCode, $oAttDef->GetMaxItems()); $oTagSet->SetValues($value['orig_value']); $oTagSet->ApplyDelta($value); $oObj->Set($sAttCode, $oTagSet); - } - else if ($oAttDef instanceof AttributeSet) // AttributeDate is derived from AttributeDateTime - { + } elseif ($oAttDef instanceof AttributeSet) { // AttributeDate is derived from AttributeDateTime $value = json_decode($value, true); $oTagSet = new ormSet(get_class($oObj), $sAttCode, $oAttDef->GetMaxItems()); $oTagSet->SetValues($value['orig_value']); $oTagSet->ApplyDelta($value); $oObj->Set($sAttCode, $oTagSet); - } - else - { + } else { $oObj->Set($sAttCode, $value); - } + } } } - if (isset($this->m_aData['m_sState']) && !empty($this->m_aData['m_sState'])) - { + if (isset($this->m_aData['m_sState']) && !empty($this->m_aData['m_sState'])) { $oObj->Set(MetaModel::GetStateAttributeCode($this->m_aData['m_sClass']), $this->m_aData['m_sState']); } $oObj->DoComputeValues(); return $oObj; } - + public function GetFieldsForDefaultValue() { return $this->m_aData['m_aDefaultValueRequested']; } - + public function SetDefaultValue($sAttCode, $value) { // Protect against a request for a non existing field - if (isset($this->m_aData['m_oFieldsMap'][$sAttCode])) - { + if (isset($this->m_aData['m_oFieldsMap'][$sAttCode])) { $oAttDef = MetaModel::GetAttributeDef($this->m_aData['m_sClass'], $sAttCode); - if ($oAttDef->GetEditClass() == 'List') - { + if ($oAttDef->GetEditClass() == 'List') { // special handling for lists // this as to be handled as an array of objects // thus encoded in json like: [ { name:'link1', 'id': 123}, { name:'link2', 'id': 124}...] // NOT YET IMPLEMENTED !! $oSet = $value; - $aData = array(); + $aData = []; $aFields = $this->GetLinkedWizardStructure($oAttDef); - while($oLinkedObj = $oSet->fetch()) - { - foreach($aFields as $sLinkedAttCode) - { + while ($oLinkedObj = $oSet->fetch()) { + foreach ($aFields as $sLinkedAttCode) { $aRow[$sAttCode] = $oLinkedObj->Get($sLinkedAttCode); } $aData[] = $aRow; } $this->m_aData['m_oDefaultValue'][$sAttCode] = json_encode($aData); - - } - else - { + + } else { // Normal handling for all other scalar attributes $this->m_aData['m_oDefaultValue'][$sAttCode] = $value; } } } - + public function GetFieldsForAllowedValues() { return $this->m_aData['m_aAllowedValuesRequested']; } - + public function SetAllowedValuesHtml($sAttCode, $sHtml) { // Protect against a request for a non existing field - if (isset($this->m_aData['m_oFieldsMap'][$sAttCode])) - { + if (isset($this->m_aData['m_oFieldsMap'][$sAttCode])) { $this->m_aData['m_oAllowedValues'][$sAttCode] = $sHtml; } } - + public function ToJSON() { return json_encode($this->m_aData); } - - static public function FromJSON($sJSON) + + public static function FromJSON($sJSON) { $oWizHelper = new WizardHelper(); $aData = json_decode($sJSON, true); // true means hash array instead of object $oWizHelper->m_aData = $aData; return $oWizHelper; } - + protected function GetLinkedWizardStructure($oAttDef) { $oWizard = new UIWizard(null, $oAttDef->GetLinkedClass()); $aWizardSteps = $oWizard->GetWizardStructure(); - $aFields = array(); + $aFields = []; $sExtKeyToMeCode = $oAttDef->GetExtKeyToMe(); // Retrieve as a flat list, all the attributes that are needed to create // an object of the linked class and put them into a flat array, except // the attribute 'ext_key_to_me' which is a constant in our case - foreach($aWizardSteps as $sDummy => $aMainSteps) - { + foreach ($aWizardSteps as $sDummy => $aMainSteps) { // 2 entries: 'mandatory' and 'optional' - foreach($aMainSteps as $aSteps) - { + foreach ($aMainSteps as $aSteps) { // One entry for each step of the wizard - foreach($aSteps as $sAttCode) - { - if ($sAttCode != $sExtKeyToMeCode) - { + foreach ($aSteps as $sAttCode) { + if ($sAttCode != $sExtKeyToMeCode) { $aFields[] = $sAttCode; } } @@ -310,35 +250,34 @@ class WizardHelper } return $aFields; } - + public function GetTargetClass() { return $this->m_aData['m_sClass']; } - public function GetFormPrefix() - { - return $this->m_aData['m_sFormPrefix']; - } + public function GetFormPrefix() + { + return $this->m_aData['m_sFormPrefix']; + } - public function GetInitialState() - { - return isset($this->m_aData['m_sInitialState']) ? $this->m_aData['m_sInitialState'] : null; - } + public function GetInitialState() + { + return isset($this->m_aData['m_sInitialState']) ? $this->m_aData['m_sInitialState'] : null; + } + + public function GetStimulus() + { + return isset($this->m_aData['m_sStimulus']) ? $this->m_aData['m_sStimulus'] : null; + } - public function GetStimulus() - { - return isset($this->m_aData['m_sStimulus']) ? $this->m_aData['m_sStimulus'] : null; - } - public function GetIdForField($sFieldName) { $sResult = ''; // It may happen that the field we'd like to update does not // exist in the form. For example, if the field should be hidden/read-only // in the current state of the object - if (isset($this->m_aData['m_oFieldsMap'][$sFieldName])) - { + if (isset($this->m_aData['m_oFieldsMap'][$sFieldName])) { $sResult = $this->m_aData['m_oFieldsMap'][$sFieldName]; } @@ -378,12 +317,14 @@ JS; $sWizardHelperJsVar = (!is_null($this->m_aData['m_sWizHelperJsVarName'])) ? utils::Sanitize($this->m_aData['m_sWizHelperJsVarName'], '', utils::ENUM_SANITIZATION_FILTER_PARAMETER) : 'oWizardHelper'.$this->GetFormPrefix(); $sWizardHelperJson = $this->ToJSON(); - $oPage->add_script(<<add_script( + <<add_ready_script(<<add_ready_script( + << $value) { $oAttDef = MetaModel::GetAttributeDef($sLinkClass, $sAttCode); - if (($oAttDef->IsExternalKey()) && ($value != '') && ($value > 0)) - { + if (($oAttDef->IsExternalKey()) && ($value != '') && ($value > 0)) { // For external keys: load the target object so that external fields // get filled too $oTargetObj = MetaModel::GetObject($oAttDef->GetTargetClass(), $value); diff --git a/application/xlsxwriter.class.php b/application/xlsxwriter.class.php index 853adc1a0..528d61d4f 100644 --- a/application/xlsxwriter.class.php +++ b/application/xlsxwriter.class.php @@ -1,43 +1,51 @@ author=$author; } + public function __construct() + { + } + public function setAuthor($author = '') + { + $this->author = $author; + } public function __destruct() { if (!empty($this->temp_files)) { - foreach($this->temp_files as $temp_file) { + foreach ($this->temp_files as $temp_file) { @unlink($temp_file); } } } - + public function setDateFormat($date_format) { $this->date_format = $date_format; } - + public function setDateTimeFormat($date_time_format) { $this->date_time_format = $date_time_format; } - + protected function tempFilename() { $filename = tempnam(SetupUtils::GettmpDir(), 'xlsx_writer_'); @@ -64,120 +72,123 @@ Class XLSXWriter { @unlink($filename);//if the zip already exists, overwrite it $zip = new ZipArchive(); - if (empty($this->sheets_meta)) { self::log("Error in ".__CLASS__."::".__FUNCTION__.", no worksheets defined."); return; } - if (!$zip->open($filename, ZipArchive::CREATE)) { self::log("Error in ".__CLASS__."::".__FUNCTION__.", unable to create zip."); return; } - + if (empty($this->sheets_meta)) { + self::log("Error in ".__CLASS__."::".__FUNCTION__.", no worksheets defined."); + return; + } + if (!$zip->open($filename, ZipArchive::CREATE)) { + self::log("Error in ".__CLASS__."::".__FUNCTION__.", unable to create zip."); + return; + } + $zip->addEmptyDir("docProps/"); - $zip->addFromString("docProps/app.xml" , self::buildAppXML() ); + $zip->addFromString("docProps/app.xml", self::buildAppXML()); $zip->addFromString("docProps/core.xml", self::buildCoreXML()); $zip->addEmptyDir("_rels/"); $zip->addFromString("_rels/.rels", self::buildRelationshipsXML()); $zip->addEmptyDir("xl/worksheets/"); - foreach($this->sheets_meta as $sheet_meta) { - $zip->addFile($sheet_meta['filename'], "xl/worksheets/".$sheet_meta['xmlname'] ); + foreach ($this->sheets_meta as $sheet_meta) { + $zip->addFile($sheet_meta['filename'], "xl/worksheets/".$sheet_meta['xmlname']); } if (!empty($this->shared_strings)) { - $zip->addFile($this->writeSharedStringsXML(), "xl/sharedStrings.xml" ); //$zip->addFromString("xl/sharedStrings.xml", self::buildSharedStringsXML() ); + $zip->addFile($this->writeSharedStringsXML(), "xl/sharedStrings.xml"); //$zip->addFromString("xl/sharedStrings.xml", self::buildSharedStringsXML() ); } - $zip->addFromString("xl/workbook.xml" , self::buildWorkbookXML() ); - $zip->addFile($this->writeStylesXML(), "xl/styles.xml" ); //$zip->addFromString("xl/styles.xml" , self::buildStylesXML() ); - $zip->addFromString("[Content_Types].xml" , self::buildContentTypesXML() ); + $zip->addFromString("xl/workbook.xml", self::buildWorkbookXML()); + $zip->addFile($this->writeStylesXML(), "xl/styles.xml"); //$zip->addFromString("xl/styles.xml" , self::buildStylesXML() ); + $zip->addFromString("[Content_Types].xml", self::buildContentTypesXML()); $zip->addEmptyDir("xl/_rels/"); - $zip->addFromString("xl/_rels/workbook.xml.rels", self::buildWorkbookRelsXML() ); + $zip->addFromString("xl/_rels/workbook.xml.rels", self::buildWorkbookRelsXML()); $zip->close(); } - - public function writeSheet(array $data, $sheet_name='', array $header_types=array(), array $header_row=array() ) + public function writeSheet(array $data, $sheet_name = '', array $header_types = [], array $header_row = []) { - $data = empty($data) ? array( array('') ) : $data; - + $data = empty($data) ? [ [''] ] : $data; + $sheet_filename = $this->tempFilename(); - $sheet_default = 'Sheet'.(count($this->sheets_meta)+1); + $sheet_default = 'Sheet'.(count($this->sheets_meta) + 1); $sheet_name = !empty($sheet_name) ? $sheet_name : $sheet_default; - $this->sheets_meta[] = array('filename'=>$sheet_filename, 'sheetname'=>$sheet_name ,'xmlname'=>strtolower($sheet_default).".xml" ); + $this->sheets_meta[] = ['filename' => $sheet_filename, 'sheetname' => $sheet_name ,'xmlname' => strtolower($sheet_default).".xml" ]; $header_offset = empty($header_types) ? 0 : 1; $row_count = count($data) + $header_offset; $column_count = count($data[self::array_first_key($data)]); - $max_cell = self::xlsCell( $row_count-1, $column_count-1 ); + $max_cell = self::xlsCell($row_count - 1, $column_count - 1); - $tabselected = count($this->sheets_meta)==1 ? 'true' : 'false';//only first sheet is selected + $tabselected = count($this->sheets_meta) == 1 ? 'true' : 'false';//only first sheet is selected $cell_formats_arr = empty($header_types) ? array_fill(0, $column_count, 'string') : array_values($header_types); - if (empty($header_row) && !empty($header_types)) - { - $header_row = empty($header_types) ? array() : array_keys($header_types); + if (empty($header_row) && !empty($header_types)) { + $header_row = empty($header_types) ? [] : array_keys($header_types); } $fd = fopen($sheet_filename, "w+"); - if ($fd===false) { self::log("write failed in ".__CLASS__."::".__FUNCTION__."."); return; } - - fwrite($fd,''."\n"); - fwrite($fd,''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - if (!empty($header_row)) - { + if ($fd === false) { + self::log("write failed in ".__CLASS__."::".__FUNCTION__."."); + return; + } + + fwrite($fd, ''."\n"); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + if (!empty($header_row)) { fwrite($fd, ''); } - foreach($data as $i=>$row) - { - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, '&C&"Times New Roman,Regular"&12&A'); - fwrite($fd, '&C&"Times New Roman,Regular"&12Page &P'); - fwrite($fd, ''); - fwrite($fd,''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, '&C&"Times New Roman,Regular"&12&A'); + fwrite($fd, '&C&"Times New Roman,Regular"&12Page &P'); + fwrite($fd, ''); + fwrite($fd, ''); fclose($fd); } protected function writeCell($fd, $row_number, $column_number, $value, $cell_format) { - static $styles = array('money'=>1,'dollar'=>1,'datetime'=>2,'date'=>3,'string'=>0); + static $styles = ['money' => 1,'dollar' => 1,'datetime' => 2,'date' => 3,'string' => 0]; $cell = self::xlsCell($row_number, $column_number); $s = isset($styles[$cell_format]) && ($value !== '') ? $styles[$cell_format] : '0'; - + if (is_int($value) || is_float($value)) { - fwrite($fd,''.($value*1).'');//int,float, etc - } else if (($cell_format=='date') && ($value != '')) { - fwrite($fd,''.intval(self::convert_date_time($value)).''); - } else if (($cell_format=='datetime') && ($value != '')) { - fwrite($fd,''.self::convert_date_time($value).''); - } else if ($value==''){ - fwrite($fd,''); - } else if ($value[0]=='='){ - fwrite($fd,''.self::xmlspecialchars($value).''); - } else if ($value!==''){ - fwrite($fd,''.self::xmlspecialchars($this->setSharedString($value)).''); + fwrite($fd, ''.($value * 1).'');//int,float, etc + } elseif (($cell_format == 'date') && ($value != '')) { + fwrite($fd, ''.intval(self::convert_date_time($value)).''); + } elseif (($cell_format == 'datetime') && ($value != '')) { + fwrite($fd, ''.self::convert_date_time($value).''); + } elseif ($value == '') { + fwrite($fd, ''); + } elseif ($value[0] == '=') { + fwrite($fd, ''.self::xmlspecialchars($value).''); + } elseif ($value !== '') { + fwrite($fd, ''.self::xmlspecialchars($this->setSharedString($value)).''); } } @@ -185,62 +196,65 @@ Class XLSXWriter { $tempfile = $this->tempFilename(); $fd = fopen($tempfile, "w+"); - if ($fd===false) { self::log("write failed in ".__CLASS__."::".__FUNCTION__."."); return; } + if ($fd === false) { + self::log("write failed in ".__CLASS__."::".__FUNCTION__."."); + return; + } fwrite($fd, ''."\n"); fwrite($fd, ''); fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); fwrite($fd, ''); fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); fwrite($fd, ''); fwrite($fd, ''); fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); //fwrite($fd, ''); //fwrite($fd, ''); //fwrite($fd, ''); //fwrite($fd, ''); //fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); - fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); + fwrite($fd, ''); //fwrite($fd, ''); //fwrite($fd, ''); //fwrite($fd, ''); //fwrite($fd, ''); //fwrite($fd, ''); - fwrite($fd, ''); + fwrite($fd, ''); fwrite($fd, ''); fclose($fd); return $tempfile; @@ -250,12 +264,9 @@ Class XLSXWriter { // Strip control characters which Excel does not seem to like... $v = preg_replace('/[\x00-\x09\x0B\x0C\x0E-\x1F]/u', '', $v); - if (isset($this->shared_strings[$v])) - { + if (isset($this->shared_strings[$v])) { $string_value = $this->shared_strings[$v]; - } - else - { + } else { $string_value = count($this->shared_strings); $this->shared_strings[$v] = $string_value; } @@ -267,13 +278,15 @@ Class XLSXWriter { $tempfile = $this->tempFilename(); $fd = fopen($tempfile, "w+"); - if ($fd===false) { self::log("write failed in ".__CLASS__."::".__FUNCTION__."."); return; } - - fwrite($fd,''."\n"); - fwrite($fd,''); - foreach($this->shared_strings as $s=>$c) - { - fwrite($fd,''.self::xmlspecialchars($s).''); + if ($fd === false) { + self::log("write failed in ".__CLASS__."::".__FUNCTION__."."); + return; + } + + fwrite($fd, ''."\n"); + fwrite($fd, ''); + foreach ($this->shared_strings as $s => $c) { + fwrite($fd, ''.self::xmlspecialchars($s).''); } fwrite($fd, ''); fclose($fd); @@ -282,89 +295,89 @@ Class XLSXWriter protected function buildAppXML() { - $app_xml=""; - $app_xml.=''."\n"; - $app_xml.='0'; + $app_xml = ""; + $app_xml .= ''."\n"; + $app_xml .= '0'; return $app_xml; } protected function buildCoreXML() { - $core_xml=""; - $core_xml.=''."\n"; - $core_xml.=''; - $core_xml.=''.date("Y-m-d\TH:i:s.00\Z").'';//$date_time = '2013-07-25T15:54:37.00Z'; - $core_xml.=''.self::xmlspecialchars($this->author).''; - $core_xml.='0'; - $core_xml.=''; + $core_xml = ""; + $core_xml .= ''."\n"; + $core_xml .= ''; + $core_xml .= ''.date("Y-m-d\TH:i:s.00\Z").'';//$date_time = '2013-07-25T15:54:37.00Z'; + $core_xml .= ''.self::xmlspecialchars($this->author).''; + $core_xml .= '0'; + $core_xml .= ''; return $core_xml; } protected function buildRelationshipsXML() { - $rels_xml=""; - $rels_xml.=''."\n"; - $rels_xml.=''; - $rels_xml.=''; - $rels_xml.=''; - $rels_xml.=''; - $rels_xml.="\n"; - $rels_xml.=''; + $rels_xml = ""; + $rels_xml .= ''."\n"; + $rels_xml .= ''; + $rels_xml .= ''; + $rels_xml .= ''; + $rels_xml .= ''; + $rels_xml .= "\n"; + $rels_xml .= ''; return $rels_xml; } protected function buildWorkbookXML() { - $workbook_xml=""; - $workbook_xml.=''."\n"; - $workbook_xml.=''; - $workbook_xml.=''; - $workbook_xml.=''; - $workbook_xml.=''; - foreach($this->sheets_meta as $i=>$sheet_meta) { - $workbook_xml.=''; + $workbook_xml = ""; + $workbook_xml .= ''."\n"; + $workbook_xml .= ''; + $workbook_xml .= ''; + $workbook_xml .= ''; + $workbook_xml .= ''; + foreach ($this->sheets_meta as $i => $sheet_meta) { + $workbook_xml .= ''; } - $workbook_xml.=''; - $workbook_xml.=''; + $workbook_xml .= ''; + $workbook_xml .= ''; return $workbook_xml; } protected function buildWorkbookRelsXML() { - $wkbkrels_xml=""; - $wkbkrels_xml.=''."\n"; - $wkbkrels_xml.=''; - $wkbkrels_xml.=''; - foreach($this->sheets_meta as $i=>$sheet_meta) { - $wkbkrels_xml.=''; + $wkbkrels_xml = ""; + $wkbkrels_xml .= ''."\n"; + $wkbkrels_xml .= ''; + $wkbkrels_xml .= ''; + foreach ($this->sheets_meta as $i => $sheet_meta) { + $wkbkrels_xml .= ''; } if (!empty($this->shared_strings)) { - $wkbkrels_xml.=''; + $wkbkrels_xml .= ''; } - $wkbkrels_xml.="\n"; - $wkbkrels_xml.=''; + $wkbkrels_xml .= "\n"; + $wkbkrels_xml .= ''; return $wkbkrels_xml; } protected function buildContentTypesXML() { - $content_types_xml=""; - $content_types_xml.=''."\n"; - $content_types_xml.=''; - $content_types_xml.=''; - $content_types_xml.=''; - foreach($this->sheets_meta as $i=>$sheet_meta) { - $content_types_xml.=''; + $content_types_xml = ""; + $content_types_xml .= ''."\n"; + $content_types_xml .= ''; + $content_types_xml .= ''; + $content_types_xml .= ''; + foreach ($this->sheets_meta as $i => $sheet_meta) { + $content_types_xml .= ''; } if (!empty($this->shared_strings)) { - $content_types_xml.=''; + $content_types_xml .= ''; } - $content_types_xml.=''; - $content_types_xml.=''; - $content_types_xml.=''; - $content_types_xml.=''; - $content_types_xml.="\n"; - $content_types_xml.=''; + $content_types_xml .= ''; + $content_types_xml .= ''; + $content_types_xml .= ''; + $content_types_xml .= ''; + $content_types_xml .= "\n"; + $content_types_xml .= ''; return $content_types_xml; } @@ -377,10 +390,10 @@ Class XLSXWriter public static function xlsCell($row_number, $column_number) { $n = $column_number; - for($r = ""; $n >= 0; $n = intval($n / 26) - 1) { - $r = chr($n%26 + 0x41) . $r; + for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) { + $r = chr($n % 26 + 0x41).$r; } - return $r . ($row_number+1); + return $r.($row_number + 1); } //------------------------------------------------------------------ public static function log($string) @@ -404,26 +417,30 @@ Class XLSXWriter { $days = 0; # Number of days since epoch $seconds = 0; # Time expressed as fraction of 24h hours in seconds - $year=$month=$day=0; - $hour=$min =$sec=0; + $year = $month = $day = 0; + $hour = $min = $sec = 0; $date_time = $date_input; - if (preg_match("/(\d{4})\-(\d{2})\-(\d{2})/", $date_time, $matches)) - { - list($junk,$year,$month,$day) = $matches; + if (preg_match("/(\d{4})\-(\d{2})\-(\d{2})/", $date_time, $matches)) { + list($junk, $year, $month, $day) = $matches; } - if (preg_match("/(\d{2}):(\d{2}):(\d{2})/", $date_time, $matches)) - { - list($junk,$hour,$min,$sec) = $matches; - $seconds = ( $hour * 60 * 60 + $min * 60 + $sec ) / ( 24 * 60 * 60 ); + if (preg_match("/(\d{2}):(\d{2}):(\d{2})/", $date_time, $matches)) { + list($junk, $hour, $min, $sec) = $matches; + $seconds = ($hour * 60 * 60 + $min * 60 + $sec) / (24 * 60 * 60); } //using 1900 as epoch, not 1904, ignoring 1904 special case - + # Special cases for Excel. - if ("$year-$month-$day"=='1899-12-31') return $seconds ; # Excel 1900 epoch - if ("$year-$month-$day"=='1900-01-00') return $seconds ; # Excel 1900 epoch - if ("$year-$month-$day"=='1900-02-29') return 60 + $seconds ; # Excel false leapday + if ("$year-$month-$day" == '1899-12-31') { + return $seconds ; + } # Excel 1900 epoch + if ("$year-$month-$day" == '1900-01-00') { + return $seconds ; + } # Excel 1900 epoch + if ("$year-$month-$day" == '1900-02-29') { + return 60 + $seconds ; + } # Excel false leapday # We calculate the date by calculating the number of days since the epoch # and adjust for the number of leap days. We calculate the number of leap @@ -435,33 +452,35 @@ Class XLSXWriter $range = $year - $epoch; # Set month days and check for leap year. - $leap = (($year % 400 == 0) || (($year % 4 == 0) && ($year % 100)) ) ? 1 : 0; - $mdays = array( 31, ($leap ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); + $leap = (($year % 400 == 0) || (($year % 4 == 0) && ($year % 100))) ? 1 : 0; + $mdays = [ 31, ($leap ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]; # Some boundary checks - if($year < $epoch || $year > 9999) return 0; - if($month < 1 || $month > 12) return 0; - if($day < 1 || $day > $mdays[ $month - 1 ]) return 0; + if ($year < $epoch || $year > 9999) { + return 0; + } + if ($month < 1 || $month > 12) { + return 0; + } + if ($day < 1 || $day > $mdays[ $month - 1 ]) { + return 0; + } # Accumulate the number of days since the epoch. $days = $day; # Add days for current month - $days += array_sum( array_slice($mdays, 0, $month-1 ) ); # Add days for past months + $days += array_sum(array_slice($mdays, 0, $month - 1)); # Add days for past months $days += $range * 365; # Add days for past years - $days += intval( ( $range ) / 4 ); # Add leapdays - $days -= intval( ( $range + $offset ) / 100 ); # Subtract 100 year leapdays - $days += intval( ( $range + $offset + $norm ) / 400 ); # Add 400 year leapdays + $days += intval(($range) / 4); # Add leapdays + $days -= intval(($range + $offset) / 100); # Subtract 100 year leapdays + $days += intval(($range + $offset + $norm) / 400); # Add 400 year leapdays $days -= $leap; # Already counted above # Adjust for Excel erroneously treating 1900 as a leap year. - if ($days > 59) { $days++;} + if ($days > 59) { + $days++; + } return $days + $seconds; } //------------------------------------------------------------------ } - - - - - - diff --git a/application/xmlpage.class.inc.php b/application/xmlpage.class.inc.php index 0faec73b9..c9093e12b 100644 --- a/application/xmlpage.class.inc.php +++ b/application/xmlpage.class.inc.php @@ -1,8 +1,9 @@ = 7) { exit(-1); } - define('ITOP_DEFAULT_ENV', 'production'); define('MAINTENANCE_MODE_FILE', APPROOT.'data/.maintenance'); define('READONLY_MODE_FILE', APPROOT.'data/.readonly'); @@ -60,8 +58,7 @@ if (!isset($bBypassMaintenance)) { $bBypassMaintenance = isset($_REQUEST['maintenance']) ? boolval($_REQUEST['maintenance']) : false; } -if (file_exists(MAINTENANCE_MODE_FILE) && !$bBypassMaintenance) -{ +if (file_exists(MAINTENANCE_MODE_FILE) && !$bBypassMaintenance) { $sTitle = 'Maintenance'; $sMessage = 'This application is currently under maintenance.'; @@ -70,8 +67,7 @@ if (file_exists(MAINTENANCE_MODE_FILE) && !$bBypassMaintenance) include(APPROOT.'application/maintenancemsg.php'); $sSAPIName = strtoupper(trim(PHP_SAPI)); - switch (true) - { + switch (true) { case isset($_SERVER['REQUEST_URI']) && EndsWith($_SERVER['REQUEST_URI'], '/pages/ajax.searchform.php'): _MaintenanceHtmlMessage($sMessage); break; @@ -102,6 +98,7 @@ if (file_exists(MAINTENANCE_MODE_FILE) && !$bBypassMaintenance) * * @return bool */ -function EndsWith($haystack, $needle) { +function EndsWith($haystack, $needle) +{ return substr_compare($haystack, $needle, -strlen($needle)) === 0; } diff --git a/conf/index.php b/conf/index.php index 112807643..fcb6f20af 100644 --- a/conf/index.php +++ b/conf/index.php @@ -1,2 +1,3 @@ - /** * Various dev/debug helpers * TODO: cleanup or at least re-organize @@ -25,7 +25,6 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - /** * MyHelpers * @@ -35,28 +34,23 @@ class MyHelpers { public static function CheckValueInArray($sDescription, $value, $aData) { - if (!in_array($value, $aData)) - { + if (!in_array($value, $aData)) { self::HandleWrongValue($sDescription, $value, $aData); } } public static function CheckKeyInArray($sDescription, $key, $aData) { - if (!array_key_exists($key, $aData)) - { + if (!array_key_exists($key, $aData)) { self::HandleWrongValue($sDescription, $key, array_keys($aData)); } } public static function HandleWrongValue($sDescription, $value, $aData) { - if (count($aData) == 0) - { + if (count($aData) == 0) { $sArrayDesc = "{}"; - } - else - { + } else { $sArrayDesc = "{".implode(", ", $aData)."}"; } // exit! @@ -64,7 +58,7 @@ class MyHelpers } // getmicrotime() - // format sss.mmmuuupppnnn + // format sss.mmmuuupppnnn public static function getmicrotime() { return microtime(true); @@ -74,14 +68,15 @@ class MyHelpers * MakeSQLComment * converts hash into text comment which we can use in a (mySQL) query */ - public static function MakeSQLComment ($aHash) + public static function MakeSQLComment($aHash) { - if (empty($aHash)) return ""; + if (empty($aHash)) { + return ""; + } $sComment = ""; { - foreach($aHash as $sKey=>$sValue) - { - $sComment .= "\n-- ". $sKey ."=>" . $sValue; + foreach ($aHash as $sKey => $sValue) { + $sComment .= "\n-- ".$sKey."=>".$sValue; } } return $sComment; @@ -90,12 +85,9 @@ class MyHelpers public static function var_dump_html($aWords, $bFullDisplay = false) { echo "
      \n";
      -		if ($bFullDisplay)
      -		{
      +		if ($bFullDisplay) {
       			print_r($aWords); // full dump!
      -		}
      -		else
      -		{
      +		} else {
       			var_dump($aWords); // truncate things when they are too big
       		}
       		echo "\n
      \n"; @@ -123,9 +115,10 @@ class MyHelpers { $aLines1 = explode("\n", $s1); $aLines2 = explode("\n", $s2); - for ($i = 0 ; $i < min(count($aLines1), count($aLines2)) ; $i++) - { - if ($aLines1[$i] != $aLines2[$i]) return $i; + for ($i = 0 ; $i < min(count($aLines1), count($aLines2)) ; $i++) { + if ($aLines1[$i] != $aLines2[$i]) { + return $i; + } } return false; } @@ -142,9 +135,10 @@ class MyHelpers // do not work fine with multiline strings $iLen1 = strlen($s1); $iLen2 = strlen($s2); - for ($i = 0 ; $i < min($iLen1, $iLen2) ; $i++) - { - if ($s1[$i] !== $s2[$i]) return $i; + for ($i = 0 ; $i < min($iLen1, $iLen2) ; $i++) { + if ($s1[$i] !== $s2[$i]) { + return $i; + } } return false; } @@ -154,9 +148,10 @@ class MyHelpers // do not work fine with multiline strings $iLen1 = strlen($s1); $iLen2 = strlen($s2); - for ($i = 0 ; $i < min(strlen($s1), strlen($s2)) ; $i++) - { - if ($s1[$iLen1 - $i - 1] !== $s2[$iLen2 - $i - 1]) return array($iLen1 - $i, $iLen2 - $i); + for ($i = 0 ; $i < min(strlen($s1), strlen($s2)) ; $i++) { + if ($s1[$iLen1 - $i - 1] !== $s2[$iLen2 - $i - 1]) { + return [$iLen1 - $i, $iLen2 - $i]; + } } return false; } @@ -177,8 +172,7 @@ class MyHelpers protected static function string_cmp_html($s1, $s2, $sHighlight) { $iDiffPos = self::first_diff($s1, $s2); - if ($iDiffPos === false) - { + if ($iDiffPos === false) { echo "strings are identical"; return; } @@ -189,7 +183,7 @@ class MyHelpers $sMiddle1 = substr($s1, $iDiffPos, $aLastDiff[0] - $iDiffPos); $sMiddle2 = substr($s2, $iDiffPos, $aLastDiff[1] - $iDiffPos); - + echo "

      $sStart$sMiddle1$sEnd

      \n"; echo "

      $sStart$sMiddle2$sEnd

      \n"; } @@ -203,40 +197,34 @@ class MyHelpers public static function var_cmp_html($var1, $var2, $sHighlight = 'color:red; font-weight:bold;') { - if (is_object($var1)) - { + if (is_object($var1)) { return self::object_cmp_html($var1, $var2, $sHighlight); - } - else if (count(explode("\n", $var1)) > 1) - { + } elseif (count(explode("\n", $var1)) > 1) { // multiline string return self::text_cmp_html($var1, $var2, $sHighlight); - } - else - { + } else { return self::string_cmp_html($var1, $var2, $sHighlight); } } public static function get_callstack($iLevelsToIgnore = 0, $aCallStack = null) { - if ($aCallStack == null) $aCallStack = debug_backtrace(); - + if ($aCallStack == null) { + $aCallStack = debug_backtrace(); + } + $aCallStack = array_slice($aCallStack, $iLevelsToIgnore); - - $aDigestCallStack = array(); - $bFirstLine = true; - foreach ($aCallStack as $aCallInfo) - { + + $aDigestCallStack = []; + $bFirstLine = true; + foreach ($aCallStack as $aCallInfo) { $sLine = empty($aCallInfo['line']) ? "" : $aCallInfo['line']; $sFile = empty($aCallInfo['file']) ? "" : $aCallInfo['file']; - if ($sFile != '') - { + if ($sFile != '') { $sFile = str_replace('\\', '/', $sFile); $sAppRoot = str_replace('\\', '/', APPROOT); $iPos = strpos($sFile, $sAppRoot); - if ($iPos !== false) - { + if ($iPos !== false) { $sFile = substr($sFile, strlen($sAppRoot)); } } @@ -244,55 +232,51 @@ class MyHelpers $sType = empty($aCallInfo['type']) ? "" : $aCallInfo['type']; $sFunction = empty($aCallInfo['function']) ? "" : $aCallInfo['function']; - if ($bFirstLine) - { + if ($bFirstLine) { $bFirstLine = false; // For this line do not display the "function name" because // that will be the name of our error handler for sure ! $sFunctionInfo = "N/A"; - } - else - { + } else { $args = ''; - if (empty($aCallInfo['args'])) $aCallInfo['args'] = array(); - foreach ($aCallInfo['args'] as $a) - { - if (!empty($args)) - { + if (empty($aCallInfo['args'])) { + $aCallInfo['args'] = []; + } + foreach ($aCallInfo['args'] as $a) { + if (!empty($args)) { $args .= ', '; } - switch (gettype($a)) - { + switch (gettype($a)) { case 'integer': case 'double': - $args .= $a; - break; + $args .= $a; + break; case 'string': - $a = Str::pure2html(self::beautifulstr($a, 64, true, false)); - $args .= "\"$a\""; - break; - case 'array': - $args .= 'array('.count($a).')'; - break; - case 'object': - $args .= 'Object('.get_class($a).')'; - break; - case 'resource': - $args .= 'Resource('.strstr($a, '#').')'; - break; - case 'boolean': - $args .= $a ? 'true' : 'false'; - break; - case 'NULL': - $args .= 'null'; - break; - default: - $args .= 'Unknown'; + $a = Str::pure2html(self::beautifulstr($a, 64, true, false)); + $args .= "\"$a\""; + break; + case 'array': + $args .= 'array('.count($a).')'; + break; + case 'object': + $args .= 'Object('.get_class($a).')'; + break; + case 'resource': + $args .= 'Resource('.strstr($a, '#').')'; + break; + case 'boolean': + $args .= $a ? 'true' : 'false'; + break; + case 'NULL': + $args .= 'null'; + break; + default: + $args .= 'Unknown'; } } $sFunctionInfo = "$sClass$sType$sFunction($args)"; } - $aDigestCallStack[] = array('File'=>$sFile, 'Line'=>$sLine, 'Function'=>$sFunctionInfo); + $aDigestCallStack[] = ['File' => $sFile, 'Line' => $sLine, 'Function' => $sFunctionInfo]; } return $aDigestCallStack; } @@ -311,9 +295,8 @@ class MyHelpers public static function get_callstack_text($iLevelsToIgnore = 0, $aCallStack = null) { $aDigestCallStack = self::get_callstack($iLevelsToIgnore, $aCallStack); - $aRes = array(); - foreach ($aDigestCallStack as $aCall) - { + $aRes = []; + foreach ($aDigestCallStack as $aCall) { $aRes[] = $aCall['File'].' at '.$aCall['Line'].', '.$aCall['Function']; } return implode("\n", $aRes); @@ -325,21 +308,27 @@ class MyHelpers /////////////////////////////////////////////////////////////////////////////// public static function make_table_from_assoc_array(&$aData) { - if (!is_array($aData)) throw new CoreException("make_table_from_assoc_array: Error - the passed argument is not an array"); + if (!is_array($aData)) { + throw new CoreException("make_table_from_assoc_array: Error - the passed argument is not an array"); + } $aFirstRow = reset($aData); - if (count($aData) == 0) return ''; - if (!is_array($aFirstRow)) throw new CoreException("make_table_from_assoc_array: Error - the passed argument is not a bi-dimensional array"); + if (count($aData) == 0) { + return ''; + } + if (!is_array($aFirstRow)) { + throw new CoreException("make_table_from_assoc_array: Error - the passed argument is not a bi-dimensional array"); + } $sOutput = ""; $sOutput .= "\n"; - + // Table header // $sOutput .= " \n"; - foreach ($aFirstRow as $fieldname=>$trash) { + foreach ($aFirstRow as $fieldname => $trash) { $sOutput .= " \n"; } $sOutput .= " \n"; - + // Table contents // $iCount = 0; @@ -354,7 +343,7 @@ class MyHelpers } $sOutput .= " \n"; } - + $sOutput .= "
      ".$fieldname."
      \n"; return $sOutput; } @@ -368,7 +357,9 @@ class MyHelpers } public static function debug_breakpoint_notempty($arg) { - if (empty($arg)) return; + if (empty($arg)) { + return; + } echo "

      Debug breakpoint (triggered on non-empty value)

      \n"; MyHelpers::var_dump_html($arg); MyHelpers::dump_callstack(); @@ -381,7 +372,7 @@ class MyHelpers */ public static function xmlentities($string) { - return str_replace( array( '&', '"', "'", '<', '>' ), array ( '&' , '"', ''' , '<' , '>' ), $string ); + return str_replace([ '&', '"', "'", '<', '>' ], [ '&' , '"', ''' , '<' , '>' ], $string); } /** @@ -390,20 +381,24 @@ class MyHelpers */ public static function xmlencode($string) { - return xmlentities(iconv("UTF-8", "UTF-8//IGNORE",$string)); + return xmlentities(iconv("UTF-8", "UTF-8//IGNORE", $string)); } /////////////////////////////////////////////////////////////////////////////// // Source: New - format strings for output // Last modif: 2005/01/18 RQU /////////////////////////////////////////////////////////////////////////////// - public static function beautifulstr($sLongString, $iMaxLen, $bShowLen=false, $bShowTooltip=true) + public static function beautifulstr($sLongString, $iMaxLen, $bShowLen = false, $bShowTooltip = true) { - if (!is_string($sLongString)) throw new CoreException("beautifulstr: expect a string as 1st argument"); - + if (!is_string($sLongString)) { + throw new CoreException("beautifulstr: expect a string as 1st argument"); + } + // Nothing to do if the string is short - if (strlen($sLongString) <= $iMaxLen) return $sLongString; - + if (strlen($sLongString) <= $iMaxLen) { + return $sLongString; + } + // Truncate the string $sSuffix = "..."; if ($bShowLen) { @@ -411,7 +406,7 @@ class MyHelpers } $sOutput = substr($sLongString, 0, $iMaxLen - strlen($sSuffix)).$sSuffix; $sOutput = htmlspecialchars($sOutput); - + // Add tooltip if required //if ($bShowTooltip) { // $oTooltip = new gui_tooltip($sLongString); @@ -427,11 +422,11 @@ Utility class: static methods for cleaning & escaping untrusted (i.e. user-supplied) strings. Any string can (usually) be thought of as being in one of these 'modes': pure = what the user actually typed / what you want to see on the page / - what is actually stored in the DB + what is actually stored in the DB gpc = incoming GET, POST or COOKIE data sql = escaped for passing safely to RDBMS via SQL (also, data from DB - queries and file reads if you have magic_quotes_runtime on--which - is rare) + queries and file reads if you have magic_quotes_runtime on--which + is rare) html = safe for html display (htmlentities applied) Always knowing what mode your string is in--using these methods to convert between modes--will prevent SQL injection and cross-site scripting. @@ -456,8 +451,11 @@ class Str } public static function gpc2pure($gpc) { - if (ini_get('magic_quotes_sybase')) $pure = str_replace("''", "'", $gpc); - else $pure = $gpc; + if (ini_get('magic_quotes_sybase')) { + $pure = str_replace("''", "'", $gpc); + } else { + $pure = $gpc; + } return $pure; } public static function html2pure($html) @@ -477,7 +475,9 @@ class Str } public static function pure2sql($pure, $maxLength = false) { - if ($maxLength) $pure = substr($pure, 0, $maxLength); + if ($maxLength) { + $pure = substr($pure, 0, $maxLength); + } return (STR_SYBASE) ? str_replace("'", "''", $pure) : addslashes($pure); @@ -485,7 +485,9 @@ class Str public static function sql2html($sql, $maxLength = false) { $pure = self::sql2pure($sql); - if ($maxLength) $pure = substr($pure, 0, $maxLength); + if ($maxLength) { + $pure = substr($pure, 0, $maxLength); + } return self::pure2html($pure); } public static function sql2pure($sql) @@ -507,7 +509,7 @@ class Str protected static function xmlentities($string) { - return str_replace( array( '&', '"', "'", '<', '>' ), array ( '&' , '"', ''' , '<' , '>' ), $string ); + return str_replace([ '&', '"', "'", '<', '>' ], [ '&' , '"', ''' , '<' , '>' ], $string); } /** @@ -516,7 +518,7 @@ class Str */ protected static function xmlencode($string) { - return self::xmlentities(iconv("UTF-8", "UTF-8//IGNORE",$string)); + return self::xmlentities(iconv("UTF-8", "UTF-8//IGNORE", $string)); } public static function islowcase($sString) diff --git a/core/TemporaryObjectDescriptor.php b/core/TemporaryObjectDescriptor.php index 9631fe2e6..5a0fd3a48 100644 --- a/core/TemporaryObjectDescriptor.php +++ b/core/TemporaryObjectDescriptor.php @@ -1,4 +1,5 @@ 'core', 'key_type' => 'autoincrement', - 'name_attcode' => array('item_class', 'temp_id'), + 'name_attcode' => ['item_class', 'temp_id'], 'image_attcode' => '', 'state_attcode' => '', - 'reconc_keys' => array(''), + 'reconc_keys' => [''], 'db_table' => 'priv_temporary_object_descriptor', 'db_key_field' => 'id', 'db_finalclass_field' => '', 'style' => new ormStyle(null, null, null, null, null, null), - 'indexes' => array( + 'indexes' => [ 1 => - array( + [ 0 => 'temp_id', - ), + ], 2 => - array( + [ 0 => 'item_class', 1 => 'item_id', - ), - ), - ); + ], + ], + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeDateTime('expiration_date', array('sql' => 'expiration_date', 'is_null_allowed' => false, 'default_value' => '', 'allowed_values' => null, 'depends_on' => array(), 'always_load_in_tables' => false))); - MetaModel::Init_AddAttribute(new AttributeString('temp_id', array('sql' => 'temp_id', 'is_null_allowed' => true, 'default_value' => '', 'allowed_values' => null, 'depends_on' => array(), 'always_load_in_tables' => false))); - MetaModel::Init_AddAttribute(new AttributeString('item_class', array('sql' => 'item_class', 'is_null_allowed' => false, 'default_value' => '', 'allowed_values' => null, 'depends_on' => array(), 'always_load_in_tables' => false))); - MetaModel::Init_AddAttribute(new AttributeObjectKey('item_id', array('class_attcode' => 'item_class', 'sql' => 'item_id', 'is_null_allowed' => true, 'allowed_values' => null, 'depends_on' => array(), 'always_load_in_tables' => false))); - MetaModel::Init_AddAttribute(new AttributeDateTime('creation_date', array('sql' => 'creation_date', 'is_null_allowed' => true, 'default_value' => '', 'allowed_values' => null, 'depends_on' => array(), 'always_load_in_tables' => false))); - MetaModel::Init_AddAttribute(new AttributeString('host_class', array('sql' => 'host_class', 'is_null_allowed' => true, 'default_value' => '', 'allowed_values' => null, 'depends_on' => array(), 'always_load_in_tables' => false))); - MetaModel::Init_AddAttribute(new AttributeObjectKey('host_id', array('class_attcode' => 'host_class', 'sql' => 'host_id', 'is_null_allowed' => true, 'allowed_values' => null, 'depends_on' => array(), 'always_load_in_tables' => false))); - MetaModel::Init_AddAttribute(new AttributeString('host_att_code', array('sql' => 'host_att_code', 'is_null_allowed' => true, 'default_value' => '', 'allowed_values' => null, 'depends_on' => array(), 'always_load_in_tables' => false))); - MetaModel::Init_AddAttribute(new AttributeEnum("operation", array("allowed_values" => new ValueSetEnum('create,delete'), "sql" => "operation", "default_value" => "create", "is_null_allowed" => true, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeDateTime('expiration_date', ['sql' => 'expiration_date', 'is_null_allowed' => false, 'default_value' => '', 'allowed_values' => null, 'depends_on' => [], 'always_load_in_tables' => false])); + MetaModel::Init_AddAttribute(new AttributeString('temp_id', ['sql' => 'temp_id', 'is_null_allowed' => true, 'default_value' => '', 'allowed_values' => null, 'depends_on' => [], 'always_load_in_tables' => false])); + MetaModel::Init_AddAttribute(new AttributeString('item_class', ['sql' => 'item_class', 'is_null_allowed' => false, 'default_value' => '', 'allowed_values' => null, 'depends_on' => [], 'always_load_in_tables' => false])); + MetaModel::Init_AddAttribute(new AttributeObjectKey('item_id', ['class_attcode' => 'item_class', 'sql' => 'item_id', 'is_null_allowed' => true, 'allowed_values' => null, 'depends_on' => [], 'always_load_in_tables' => false])); + MetaModel::Init_AddAttribute(new AttributeDateTime('creation_date', ['sql' => 'creation_date', 'is_null_allowed' => true, 'default_value' => '', 'allowed_values' => null, 'depends_on' => [], 'always_load_in_tables' => false])); + MetaModel::Init_AddAttribute(new AttributeString('host_class', ['sql' => 'host_class', 'is_null_allowed' => true, 'default_value' => '', 'allowed_values' => null, 'depends_on' => [], 'always_load_in_tables' => false])); + MetaModel::Init_AddAttribute(new AttributeObjectKey('host_id', ['class_attcode' => 'host_class', 'sql' => 'host_id', 'is_null_allowed' => true, 'allowed_values' => null, 'depends_on' => [], 'always_load_in_tables' => false])); + MetaModel::Init_AddAttribute(new AttributeString('host_att_code', ['sql' => 'host_att_code', 'is_null_allowed' => true, 'default_value' => '', 'allowed_values' => null, 'depends_on' => [], 'always_load_in_tables' => false])); + MetaModel::Init_AddAttribute(new AttributeEnum("operation", ["allowed_values" => new ValueSetEnum('create,delete'), "sql" => "operation", "default_value" => "create", "is_null_allowed" => true, "depends_on" => []])); - MetaModel::Init_SetZListItems('details', array( + MetaModel::Init_SetZListItems('details', [ 0 => 'temp_id', 1 => 'item_class', 2 => 'item_id', 3 => 'creation_date', 4 => 'expiration_date', 5 => 'meta', - )); - MetaModel::Init_SetZListItems('standard_search', array( + ]); + MetaModel::Init_SetZListItems('standard_search', [ 0 => 'temp_id', 1 => 'item_class', 2 => 'item_id', - )); - MetaModel::Init_SetZListItems('list', array( + ]); + MetaModel::Init_SetZListItems('list', [ 0 => 'temp_id', 1 => 'item_class', 2 => 'item_id', 3 => 'creation_date', 4 => 'expiration_date', - ));; + ]); + ; } - public function DBInsertNoReload() { $this->SetCurrentDateIfNull('creation_date'); @@ -82,7 +83,6 @@ class TemporaryObjectDescriptor extends DBObject return parent::DBInsertNoReload(); } - /** * Set/Update all of the '_item' fields * diff --git a/core/action.class.inc.php b/core/action.class.inc.php index 8adc62c6d..744d54224 100644 --- a/core/action.class.inc.php +++ b/core/action.class.inc.php @@ -1,9 +1,10 @@ "grant_by_profile,core/cmdb", "key_type" => "autoincrement", "name_attcode" => "name", @@ -59,14 +59,14 @@ abstract class Action extends cmdbAbstractObject "db_key_field" => "id", "db_finalclass_field" => "realclass", "style" => new ormStyle("ibo-dm-class--Action", "ibo-dm-class-alt--Action", "var(--ibo-dm-class--Action--main-color)", "var(--ibo-dm-class--Action--complementary-color)", null, '../images/icons/icons8-in-transit.svg'), - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values" => null, "sql" => "name", "default_value" => null, "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeString("name", ["allowed_values" => null, "sql" => "name", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeEnum("status", array( - "allowed_values" => new ValueSetEnum(array('test' => 'Being tested', 'enabled' => 'In production', 'disabled' => 'Inactive')), + MetaModel::Init_AddAttribute(new AttributeEnum("status", [ + "allowed_values" => new ValueSetEnum(['test' => 'Being tested', 'enabled' => 'In production', 'disabled' => 'Inactive']), "styled_values" => [ 'test' => new ormStyle('ibo-dm-enum--Action-status-test', 'ibo-dm-enum-alt--Action-status-test', 'var(--ibo-dm-enum--Action-status-test--main-color)', 'var(--ibo-dm-enum--Action-status-test--complementary-color)', null, null), 'enabled' => new ormStyle('ibo-dm-enum--Action-status-enabled', 'ibo-dm-enum-alt--Action-status-enabled', 'var(--ibo-dm-enum--Action-status-enabled--main-color)', 'var(--ibo-dm-enum--Action-status-enabled--complementary-color)', 'fas fa-check', null), @@ -76,21 +76,23 @@ abstract class Action extends cmdbAbstractObject "sql" => "status", "default_value" => "test", "is_null_allowed" => false, - "depends_on" => array(), - ))); + "depends_on" => [], + ])); - MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("trigger_list", - array("linked_class" => "lnkTriggerAction", "ext_key_to_me" => "action_id", "ext_key_to_remote" => "trigger_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array(), "display_style" => 'property'))); - MetaModel::Init_AddAttribute(new AttributeEnum("asynchronous", array("allowed_values" => new ValueSetEnum(['use_global_setting' => 'Use global settings','yes' => 'Yes' ,'no' => 'No']), "sql" => "asynchronous", "default_value" => 'use_global_setting', "is_null_allowed" => false, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect( + "trigger_list", + ["linked_class" => "lnkTriggerAction", "ext_key_to_me" => "action_id", "ext_key_to_remote" => "trigger_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => [], "display_style" => 'property'] + )); + MetaModel::Init_AddAttribute(new AttributeEnum("asynchronous", ["allowed_values" => new ValueSetEnum(['use_global_setting' => 'Use global settings','yes' => 'Yes' ,'no' => 'No']), "sql" => "asynchronous", "default_value" => 'use_global_setting', "is_null_allowed" => false, "depends_on" => []])); // Display lists // - Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('details', array('name', 'description', 'status', 'trigger_list')); + MetaModel::Init_SetZListItems('details', ['name', 'description', 'status', 'trigger_list']); // - Attributes to be displayed for a list - MetaModel::Init_SetZListItems('list', array('finalclass', 'name', 'description', 'status')); + MetaModel::Init_SetZListItems('list', ['finalclass', 'name', 'description', 'status']); // Search criteria // - Default criteria of the search form - MetaModel::Init_SetZListItems('default_search', array('name', 'description', 'status')); + MetaModel::Init_SetZListItems('default_search', ['name', 'description', 'status']); } @@ -111,8 +113,7 @@ abstract class Action extends cmdbAbstractObject */ public function IsActive() { - switch($this->Get('status')) - { + switch ($this->Get('status')) { case 'enabled': case 'test': return true; @@ -131,8 +132,7 @@ abstract class Action extends cmdbAbstractObject */ public function IsBeingTested() { - switch($this->Get('status')) - { + switch ($this->Get('status')) { case 'test': return true; @@ -220,7 +220,7 @@ abstract class Action extends cmdbAbstractObject $iLastExecutionDays = $oConfig->Get($sLastExecutionDaysConfigParamName); if ($iLastExecutionDays < 0) { - throw new InvalidConfigParamException("Invalid value for {$sLastExecutionDaysConfigParamName} config parameter. Param desc: " . $oConfig->GetDescription($sLastExecutionDaysConfigParamName)); + throw new InvalidConfigParamException("Invalid value for {$sLastExecutionDaysConfigParamName} config parameter. Param desc: ".$oConfig->GetDescription($sLastExecutionDaysConfigParamName)); } $sActionQueryOql = 'SELECT EventNotification WHERE action_id = :action_id'; @@ -250,7 +250,7 @@ abstract class Action extends cmdbAbstractObject */ public static function GetAsynchronousGlobalSetting(): bool { - return false; + return false; } /** @@ -270,7 +270,7 @@ abstract class Action extends cmdbAbstractObject } /** - * A notification + * A notification * * @package iTopORM */ @@ -282,8 +282,8 @@ abstract class ActionNotification extends Action */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb", "key_type" => "autoincrement", "name_attcode" => "name", @@ -293,22 +293,22 @@ abstract class ActionNotification extends Action "db_table" => "priv_action_notification", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); // Display lists // - Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('details', array('name', 'description', 'status', 'trigger_list')); + MetaModel::Init_SetZListItems('details', ['name', 'description', 'status', 'trigger_list']); // - Attributes to be displayed for a list - MetaModel::Init_SetZListItems('list', array('finalclass', 'description', 'status')); - MetaModel::Init_AddAttribute(new AttributeApplicationLanguage("language", array("sql"=>"language", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_SetZListItems('list', ['finalclass', 'description', 'status']); + MetaModel::Init_AddAttribute(new AttributeApplicationLanguage("language", ["sql" => "language", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Search criteria // - Criteria of the std search form -// MetaModel::Init_SetZListItems('standard_search', array('name')); + // MetaModel::Init_SetZListItems('standard_search', array('name')); // - Default criteria of the search form -// MetaModel::Init_SetZListItems('default_search', array('name')); + // MetaModel::Init_SetZListItems('default_search', array('name')); } /** @@ -321,7 +321,8 @@ abstract class ActionNotification extends Action * @throws \DictExceptionUnknownLanguage * @since 3.2.0 */ - public function SetNotificationLanguage($sLanguage = null, $sLanguageCode = null){ + public function SetNotificationLanguage($sLanguage = null, $sLanguageCode = null) + { $sPreviousLanguage = Dict::GetUserLanguage(); $aPreviousPluginProperties = ApplicationContext::GetPluginProperties('QueryLocalizerPlugin'); $sLanguage = $sLanguage ?? $this->Get('language'); @@ -338,7 +339,7 @@ abstract class ActionNotification extends Action } /** - * An email notification + * An email notification * * @package iTopORM */ @@ -348,69 +349,68 @@ class ActionEmail extends ActionNotification * @var string * @since 3.0.1 */ - const ENUM_HEADER_NAME_MESSAGE_ID = 'Message-ID'; + public const ENUM_HEADER_NAME_MESSAGE_ID = 'Message-ID'; /** * @var string * @since 3.0.1 */ - const ENUM_HEADER_NAME_REFERENCES = 'References'; + public const ENUM_HEADER_NAME_REFERENCES = 'References'; /** * @var string * @since 3.1.0 */ - const TEMPLATE_BODY_CONTENT = '$content$'; + public const TEMPLATE_BODY_CONTENT = '$content$'; /** * Wraps the 'body' of the message for previewing inside an IFRAME -- i.e. without any of the iTop stylesheets being applied * @var string * @since 3.1.0 */ - const CONTENT_HIGHLIGHT = '
      $content$
      %s
      '; + public const CONTENT_HIGHLIGHT = '
      $content$
      %s
      '; /** * Wraps a placeholder of the email's body for previewing inside an IFRAME -- i.e. without any of the iTop stylesheets being applied * @var string */ - const FIELD_HIGHLIGHT = '\\$$1\\$'; + public const FIELD_HIGHLIGHT = '\\$$1\\$'; /** * @inheritDoc */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb,application", "key_type" => "autoincrement", "name_attcode" => "name", "state_attcode" => "", - "reconc_keys" => array('name'), + "reconc_keys" => ['name'], "db_table" => "priv_action_email", "db_key_field" => "id", "db_finalclass_field" => "", 'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-mailing.svg'), - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeEmailAddress("test_recipient", array("allowed_values" => null, "sql" => "test_recipient", "default_value" => "", "is_null_allowed" => true, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeEmailAddress("test_recipient", ["allowed_values" => null, "sql" => "test_recipient", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeString("from", array("allowed_values" => null, "sql" => "from", "default_value" => null, "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeString("from_label", array("allowed_values" => null, "sql" => "from_label", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeString("reply_to", array("allowed_values" => null, "sql" => "reply_to", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeString("reply_to_label", array("allowed_values" => null, "sql" => "reply_to_label", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeOQL("to", array("allowed_values" => null, "sql" => "to", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeOQL("cc", array("allowed_values" => null, "sql" => "cc", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeOQL("bcc", array("allowed_values" => null, "sql" => "bcc", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeTemplateString("subject", array("allowed_values" => null, "sql" => "subject", "default_value" => null, "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeTemplateHTML("body", array("allowed_values" => null, "sql" => "body", "default_value" => null, "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("importance", array("allowed_values" => new ValueSetEnum('low,normal,high'), "sql" => "importance", "default_value" => 'normal', "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeBlob("html_template", array("is_null_allowed"=>true, "depends_on"=>array(), "always_load_in_tables"=>false))); - MetaModel::Init_AddAttribute(new AttributeEnum("ignore_notify", array("allowed_values" => new ValueSetEnum('yes,no'), "sql" => "ignore_notify", "default_value" => 'yes', "is_null_allowed" => false, "depends_on" => array()))); - + MetaModel::Init_AddAttribute(new AttributeString("from", ["allowed_values" => null, "sql" => "from", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("from_label", ["allowed_values" => null, "sql" => "from_label", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("reply_to", ["allowed_values" => null, "sql" => "reply_to", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("reply_to_label", ["allowed_values" => null, "sql" => "reply_to_label", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeOQL("to", ["allowed_values" => null, "sql" => "to", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeOQL("cc", ["allowed_values" => null, "sql" => "cc", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeOQL("bcc", ["allowed_values" => null, "sql" => "bcc", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeTemplateString("subject", ["allowed_values" => null, "sql" => "subject", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeTemplateHTML("body", ["allowed_values" => null, "sql" => "body", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("importance", ["allowed_values" => new ValueSetEnum('low,normal,high'), "sql" => "importance", "default_value" => 'normal', "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeBlob("html_template", ["is_null_allowed" => true, "depends_on" => [], "always_load_in_tables" => false])); + MetaModel::Init_AddAttribute(new AttributeEnum("ignore_notify", ["allowed_values" => new ValueSetEnum('yes,no'), "sql" => "ignore_notify", "default_value" => 'yes', "is_null_allowed" => false, "depends_on" => []])); // Display lists // - Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('details', array( - 'col:col1' => array( - 'fieldset:ActionEmail:main' => array( + MetaModel::Init_SetZListItems('details', [ + 'col:col1' => [ + 'fieldset:ActionEmail:main' => [ 0 => 'name', 1 => 'description', 2 => 'status', @@ -419,14 +419,14 @@ class ActionEmail extends ActionNotification 5 => 'subject', 6 => 'body', // 5 => 'importance', not handled when sending the mail, better hide it then - ), - 'fieldset:ActionEmail:trigger' => array( + ], + 'fieldset:ActionEmail:trigger' => [ 0 => 'trigger_list', - 1 => 'asynchronous' - ), - ), - 'col:col2' => array( - 'fieldset:ActionEmail:recipients' => array( + 1 => 'asynchronous', + ], + ], + 'col:col2' => [ + 'fieldset:ActionEmail:recipients' => [ 0 => 'from', 1 => 'from_label', 2 => 'reply_to', @@ -436,17 +436,17 @@ class ActionEmail extends ActionNotification 6 => 'to', 7 => 'cc', 8 => 'bcc', - ), - ), - )); + ], + ], + ]); // - Attributes to be displayed for a list - MetaModel::Init_SetZListItems('list', array('status', 'to', 'subject', 'language')); + MetaModel::Init_SetZListItems('list', ['status', 'to', 'subject', 'language']); // Search criteria // - Standard criteria of the search - MetaModel::Init_SetZListItems('standard_search', array('name', 'description', 'status', 'subject', 'language')); + MetaModel::Init_SetZListItems('standard_search', ['name', 'description', 'status', 'subject', 'language']); // - Default criteria for the search - MetaModel::Init_SetZListItems('default_search', array('name', 'description', 'status', 'subject', 'language')); + MetaModel::Init_SetZListItems('default_search', ['name', 'description', 'status', 'subject', 'language']); } // count the recipients found @@ -477,10 +477,11 @@ class ActionEmail extends ActionNotification { $oTrigger = $aArgs['trigger->object()'] ?? null; $sOQL = $this->Get($sRecipAttCode); - if (utils::IsNullOrEmptyString($sOQL)) return ''; + if (utils::IsNullOrEmptyString($sOQL)) { + return ''; + } - try - { + try { $oSearch = DBObjectSearch::FromOQL($sOQL); if ($this->Get('ignore_notify') === 'no') { // In theory, it is possible to notify *any* kind of object, @@ -492,31 +493,26 @@ class ActionEmail extends ActionNotification } } $oSearch->AllowAllData(); - } - catch (OQLException $e) - { + } catch (OQLException $e) { $this->m_aMailErrors[] = "query syntax error for recipient '$sRecipAttCode'"; return $e->getMessage(); } $sClass = $oSearch->GetClass(); // Determine the email attribute (the first one will be our choice) - foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - if ($oAttDef instanceof AttributeEmailAddress) - { + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if ($oAttDef instanceof AttributeEmailAddress) { $sEmailAttCode = $sAttCode; // we've got one, exit the loop break; } } - if (!isset($sEmailAttCode)) - { + if (!isset($sEmailAttCode)) { $this->m_aMailErrors[] = "wrong target for recipient '$sRecipAttCode'"; return "The objects of the class '$sClass' do not have any email attribute"; } - if($oTrigger !== null && in_array('Contact', MetaModel::EnumParentClasses($sClass, ENUM_CHILD_CLASSES_ALL), true)) { + if ($oTrigger !== null && in_array('Contact', MetaModel::EnumParentClasses($sClass, ENUM_CHILD_CLASSES_ALL), true)) { $aArgs['trigger_id'] = $oTrigger->GetKey(); $aArgs['action_id'] = $this->GetKey(); @@ -526,13 +522,11 @@ class ActionEmail extends ActionNotification $oSearch->AddConditionExpression(Expression::FromOQL("`$sAlias`.id NOT IN ($sSubscribedContactsOQL)")); } - $oSet = new DBObjectSet($oSearch, array() /* order */, $aArgs); - $aRecipients = array(); - while ($oObj = $oSet->Fetch()) - { + $oSet = new DBObjectSet($oSearch, [] /* order */, $aArgs); + $aRecipients = []; + while ($oObj = $oSet->Fetch()) { $sAddress = trim($oObj->Get($sEmailAttCode)); - if (utils::IsNotNullOrEmptyString($sAddress)) - { + if (utils::IsNotNullOrEmptyString($sAddress)) { $aRecipients[] = $sAddress; $this->m_iRecipients++; } @@ -551,15 +545,11 @@ class ActionEmail extends ActionNotification */ public function DoExecute($oTrigger, $aContextArgs) { - if (MetaModel::IsLogEnabledNotification()) - { + if (MetaModel::IsLogEnabledNotification()) { $oLog = new EventNotificationEmail(); - if ($this->IsBeingTested()) - { + if ($this->IsBeingTested()) { $oLog->Set('message', 'TEST - Notification sent ('.$this->Get('test_recipient').')'); - } - else - { + } else { $oLog->Set('message', 'Notification pending'); } $oLog->Set('userinfo', UserRights::GetUser()); @@ -569,49 +559,36 @@ class ActionEmail extends ActionNotification // Must be inserted now so that it gets a valid id that will make the link // between an eventual asynchronous task (queued) and the log $oLog->DBInsertNoReload(); - } - else - { + } else { $oLog = null; } - try - { + try { $sRes = $this->_DoExecute($oTrigger, $aContextArgs, $oLog); - if ($this->IsBeingTested()) - { + if ($this->IsBeingTested()) { $sPrefix = 'TEST ('.$this->Get('test_recipient').') - '; - } - else - { + } else { $sPrefix = ''; } - if ($oLog) - { - $oLog->Set('message', $sPrefix . $sRes); - $oLog->DBUpdate(); - } + if ($oLog) { + $oLog->Set('message', $sPrefix.$sRes); + $oLog->DBUpdate(); + } - } - catch (Exception $e) - { - if ($oLog) - { + } catch (Exception $e) { + if ($oLog) { $oLog->Set('message', 'Error: '.$e->getMessage()); - try - { - $oLog->DBUpdate(); - } - catch (Exception $eSecondTryUpdate) - { - IssueLog::Error("Failed to process email ".$oLog->GetKey()." - reason: ".$e->getMessage()."\nTrace:\n".$e->getTraceAsString()); + try { + $oLog->DBUpdate(); + } catch (Exception $eSecondTryUpdate) { + IssueLog::Error("Failed to process email ".$oLog->GetKey()." - reason: ".$e->getMessage()."\nTrace:\n".$e->getTraceAsString()); - $oLog->Set('message', 'Error: more details in the log for email "'.$oLog->GetKey().'"'); - $oLog->DBUpdate(); - } + $oLog->Set('message', 'Error: more details in the log for email "'.$oLog->GetKey().'"'); + $oLog->DBUpdate(); + } } } @@ -628,11 +605,11 @@ class ActionEmail extends ActionNotification */ protected function _DoExecute($oTrigger, $aContextArgs, &$oLog) { - $sStyles = file_get_contents(APPROOT . utils::GetCSSFromSASS("css/email.scss")); + $sStyles = file_get_contents(APPROOT.utils::GetCSSFromSASS("css/email.scss")); $sStyles .= MetaModel::GetConfig()->Get('email_css'); - + $oEmail = new EMail(); - + $aEmailContent = $this->PrepareMessageContent($aContextArgs, $oLog); $oEmail->SetSubject($aEmailContent['subject']); $oEmail->SetBody($aEmailContent['body'], 'text/html', $sStyles); @@ -644,23 +621,18 @@ class ActionEmail extends ActionNotification $oEmail->SetReferences($aEmailContent['references']); $oEmail->SetMessageId($aEmailContent['message_id']); $oEmail->SetInReplyTo($aEmailContent['in_reply_to']); - - foreach($aEmailContent['attachments'] as $aAttachment) { + + foreach ($aEmailContent['attachments'] as $aAttachment) { $oEmail->AddAttachment($aAttachment['data'], $aAttachment['filename'], $aAttachment['mime_type']); } - - if (empty($this->m_aMailErrors)) - { - if ($this->m_iRecipients == 0) - { + + if (empty($this->m_aMailErrors)) { + if ($this->m_iRecipients == 0) { return 'No recipient'; - } - else - { + } else { $aErrors = []; $iRes = $oEmail->Send($aErrors, $this->IsAsynchronous() ? Email::ENUM_SEND_FORCE_ASYNCHRONOUS : Email::ENUM_SEND_FORCE_SYNCHRONOUS, $oLog); - switch ($iRes) - { + switch ($iRes) { case EMAIL_SEND_OK: return "Sent"; @@ -720,39 +692,36 @@ class ActionEmail extends ActionNotification $sPreviousUrlMaker = ApplicationContext::SetUrlMakerClass(); [$sPreviousLanguage, $aPreviousPluginProperties] = $this->SetNotificationLanguage(); - try - { + try { $this->m_iRecipients = 0; - $this->m_aMailErrors = array(); - + $this->m_aMailErrors = []; + // Determine recipients // $aMessageContent['to'] = $this->FindRecipients('to', $aContextArgs); $aMessageContent['cc'] = $this->FindRecipients('cc', $aContextArgs); $aMessageContent['bcc'] = $this->FindRecipients('bcc', $aContextArgs); - + $aMessageContent['from'] = MetaModel::ApplyParams($this->Get('from'), $aContextArgs); $aMessageContent['from_label'] = MetaModel::ApplyParams($this->Get('from_label'), $aContextArgs); $aMessageContent['reply_to'] = MetaModel::ApplyParams($this->Get('reply_to'), $aContextArgs); $aMessageContent['reply_to_label'] = MetaModel::ApplyParams($this->Get('reply_to_label'), $aContextArgs); - + $aMessageContent['subject'] = MetaModel::ApplyParams($this->Get('subject'), $aContextArgs); $sBody = $this->BuildMessageBody(false); $aMessageContent['body'] = MetaModel::ApplyParams($sBody, $aContextArgs); - + $oObj = $aContextArgs['this->object()']; $aMessageContent['message_id'] = $this->GenerateIdentifierForHeaders($oObj, static::ENUM_HEADER_NAME_MESSAGE_ID); $aMessageContent['references'] = $this->GenerateIdentifierForHeaders($oObj, static::ENUM_HEADER_NAME_REFERENCES); - } - catch (Exception $e) { + } catch (Exception $e) { /** @noinspection PhpUnhandledExceptionInspection */ throw $e; - } - finally { + } finally { ApplicationContext::SetUrlMakerClass($sPreviousUrlMaker); $this->SetNotificationLanguage($sPreviousLanguage, $aPreviousPluginProperties['language_code'] ?? null); } - + if (!is_null($oLog)) { // Note: we have to secure this because those values are calculated // inside the try statement, and we would like to keep track of as @@ -801,19 +770,17 @@ class ActionEmail extends ActionNotification } // Note: N°4849 We pass the "References" identifier instead of the "Message-ID" on purpose as we want notifications emails to group around the triggering iTop object, not just the users' replies to the notification $aMessageContent['in_reply_to'] = $aMessageContent['references']; - - if (isset($aContextArgs['attachments'])) - { - $aAttachmentReport = array(); + + if (isset($aContextArgs['attachments'])) { + $aAttachmentReport = []; /** @var \ormDocument $oDocument */ - foreach($aContextArgs['attachments'] as $oDocument) - { + foreach ($aContextArgs['attachments'] as $oDocument) { $aMessageContent['attachments'][] = ['data' => $oDocument->GetData(), 'filename' => $oDocument->GetFileName(), 'mime_type' => $oDocument->GetMimeType()]; - $aAttachmentReport[] = array($oDocument->GetFileName(), $oDocument->GetMimeType(), strlen($oDocument->GetData() ?? '')); + $aAttachmentReport[] = [$oDocument->GetFileName(), $oDocument->GetMimeType(), strlen($oDocument->GetData() ?? '')]; } $oLog->Set('attachments', $aAttachmentReport); } - + return $aMessageContent; } @@ -858,11 +825,11 @@ class ActionEmail extends ActionNotification ]); throw new Exception($sErrorMessage); } - + /** * Compose the body of the message from the 'body' attribute and the HTML template (if any) * @since 3.1.0 N°4849 - * @param bool $bHighlightPlaceholders If true add some extra HTML around placeholders to highlight them + * @param bool $bHighlightPlaceholders If true add some extra HTML around placeholders to highlight them * @return string */ protected function BuildMessageBody(bool $bHighlightPlaceholders = false): string @@ -888,13 +855,13 @@ HTML; $sBody = $oHtmlTemplate->GetData(); } } - if($bHighlightPlaceholders) { + if ($bHighlightPlaceholders) { // Highlight all placeholders $sBody = preg_replace('/\\$([^$]+)\\$/', static::FIELD_HIGHLIGHT, $sBody); } return $sBody; } - + /** * @since 3.1.0 N°4849 * @inheritDoc diff --git a/core/apc-compat.php b/core/apc-compat.php index 6412a2673..0e0488fc9 100644 --- a/core/apc-compat.php +++ b/core/apc-compat.php @@ -1,9 +1,10 @@ getNumberOfParameters() != 2) - { + if ($oFunction->getNumberOfParameters() != 2) { // Beware: APCu behaves slightly differently from APC !! // Worse: the compatibility layer integrated into APC differs from apcu-bc (testing the number of parameters is a must) // In CLI mode (PHP > 7) apc_cache_info returns null and outputs an error message. $aCacheUserData = @apc_cache_info(); - } - else - { + } else { $aCacheUserData = @apc_cache_info('user'); } return $aCacheUserData; } // Cache emulation -if (!function_exists('apc_store')) -{ +if (!function_exists('apc_store')) { require_once(APPROOT.'core/apc-emulation.php'); -} \ No newline at end of file +} diff --git a/core/apc-emulation.php b/core/apc-emulation.php index 33214a911..a1bcad7bb 100644 --- a/core/apc-emulation.php +++ b/core/apc-emulation.php @@ -1,4 +1,5 @@ $value) - { + if (is_array($key)) { + $aResult = []; + foreach ($key as $sKey => $value) { $aResult[] = apcFile::StoreOneFile($sKey, $value, $ttl); } return $aResult; @@ -89,8 +88,7 @@ function apc_clear_cache($cache_type = '') */ function apc_delete($key) { - if (empty($key)) - { + if (empty($key)) { return false; } $bRet1 = apcFile::DeleteEntry(apcFile::GetCacheFileName($key)); @@ -126,17 +124,17 @@ function apc_exists($keys) class apcFile { // Check only once per request - static public $aFilesByTime = null; - static public $iFileCount = 0; + public static $aFilesByTime = null; + public static $iFileCount = 0; /** Get the file name corresponding to the cache entry. * If an empty key is provided, the root of the cache is returned. * @param $sKey * @return string */ - static public function GetCacheFileName($sKey = '') + public static function GetCacheFileName($sKey = '') { - $sPath = str_replace(array(' ', '/', '\\', '.'), '-', $sKey ?? ''); + $sPath = str_replace([' ', '/', '\\', '.'], '-', $sKey ?? ''); return utils::GetCachePath().'apc-emul/'.$sPath; } @@ -144,26 +142,21 @@ class apcFile * @param $sEntry string starting folder. * @return array list of entries stored into array of key 'info' */ - static public function GetCacheEntries($sEntry) + public static function GetCacheEntries($sEntry) { - $aResult = array(); - if (is_dir($sEntry)) - { - $aFiles = array_diff(scandir($sEntry), array('.', '..')); - foreach($aFiles as $sFile) - { + $aResult = []; + if (is_dir($sEntry)) { + $aFiles = array_diff(scandir($sEntry), ['.', '..']); + foreach ($aFiles as $sFile) { $sSubFile = $sEntry.'/'.$sFile; $aResult = array_merge($aResult, self::GetCacheEntries($sSubFile)); } - } - else - { + } else { $sKey = basename($sEntry); - if (strpos($sKey, '-') === 0) - { + if (strpos($sKey, '-') === 0) { $sKey = substr($sKey, 1); } - $aResult[] = array('info' => $sKey); + $aResult[] = ['info' => $sKey]; } return $aResult; } @@ -172,35 +165,25 @@ class apcFile * @param $sCache * @return bool true if the entry was deleted false if error occurs (like entry did not exist). */ - static public function DeleteEntry($sCache) + public static function DeleteEntry($sCache) { - if (is_dir($sCache)) - { - $aFiles = array_diff(scandir($sCache), array('.', '..')); - foreach($aFiles as $sFile) - { + if (is_dir($sCache)) { + $aFiles = array_diff(scandir($sCache), ['.', '..']); + foreach ($aFiles as $sFile) { $sSubFile = $sCache.'/'.$sFile; - if (!self::DeleteEntry($sSubFile)) - { + if (!self::DeleteEntry($sSubFile)) { return false; } } - if (!@rmdir($sCache)) - { + if (!@rmdir($sCache)) { return false; } - } - else - { - if (is_file($sCache)) - { - if (!@unlink($sCache)) - { + } else { + if (is_file($sCache)) { + if (!@unlink($sCache)) { return false; } - } - else - { + } else { return false; } } @@ -215,23 +198,22 @@ class apcFile * @return bool * @since 3.2.0 N°7068 */ - static public function ExistsOneFile($sKey) { - return is_file(self::GetCacheFileName('-' . $sKey)) || is_file(self::GetCacheFileName($sKey)); + public static function ExistsOneFile($sKey) + { + return is_file(self::GetCacheFileName('-'.$sKey)) || is_file(self::GetCacheFileName($sKey)); } /** Get one cache entry content. * @param $sKey * @return bool|mixed */ - static public function FetchOneFile($sKey) + public static function FetchOneFile($sKey) { // Try the 'TTLed' version $sValue = self::ReadCacheLocked(self::GetCacheFileName('-'.$sKey)); - if ($sValue === false) - { + if ($sValue === false) { $sValue = self::ReadCacheLocked(self::GetCacheFileName($sKey)); - if ($sValue === false) - { + if ($sValue === false) { return false; } } @@ -245,7 +227,7 @@ class apcFile * @param int $iTTL time to live * @return bool */ - static public function StoreOneFile($sKey, $value, $iTTL) + public static function StoreOneFile($sKey, $value, $iTTL) { if (empty($sKey)) { return false; @@ -279,40 +261,31 @@ class apcFile * remove older files if the mamximum is reached. * @param $sNewFilename */ - static protected function AddFile($sNewFilename) + protected static function AddFile($sNewFilename) { - if (strpos(basename($sNewFilename), '-') !== 0) - { + if (strpos(basename($sNewFilename), '-') !== 0) { return; } $iMaxFiles = MetaModel::GetConfig()->Get('apc_cache_emulation.max_entries'); - if ($iMaxFiles == 0) - { + if ($iMaxFiles == 0) { return; } - if (!self::$aFilesByTime) - { + if (!self::$aFilesByTime) { self::ListFilesByTime(); self::$iFileCount = count(self::$aFilesByTime); - if ($iMaxFiles !== 0) - { + if ($iMaxFiles !== 0) { asort(self::$aFilesByTime); } - } - else - { + } else { self::$aFilesByTime[$sNewFilename] = time(); self::$iFileCount++; } - if (self::$iFileCount > $iMaxFiles) - { + if (self::$iFileCount > $iMaxFiles) { $iFileNbToRemove = self::$iFileCount - $iMaxFiles; - foreach(self::$aFilesByTime as $sFileToRemove => $iTime) - { + foreach (self::$aFilesByTime as $sFileToRemove => $iTime) { @unlink($sFileToRemove); - if (--$iFileNbToRemove === 0) - { + if (--$iFileNbToRemove === 0) { break; } } @@ -324,25 +297,19 @@ class apcFile /** Get the list of files with their associated access time * @param string $sCheck Directory to scan */ - static protected function ListFilesByTime($sCheck = null) + protected static function ListFilesByTime($sCheck = null) { - if (empty($sCheck)) - { + if (empty($sCheck)) { $sCheck = self::GetCacheFileName(); } // Garbage collection - $aFiles = array_diff(@scandir($sCheck), array('.', '..')); - foreach($aFiles as $sFile) - { + $aFiles = array_diff(@scandir($sCheck), ['.', '..']); + foreach ($aFiles as $sFile) { $sSubFile = $sCheck.'/'.$sFile; - if (is_dir($sSubFile)) - { + if (is_dir($sSubFile)) { self::ListFilesByTime($sSubFile); - } - else - { - if (strpos(basename($sSubFile), '-') === 0) - { + } else { + if (strpos(basename($sSubFile), '-') === 0) { self::$aFilesByTime[$sSubFile] = @fileatime($sSubFile); } } @@ -353,7 +320,7 @@ class apcFile * @param $sFilename * @return bool|string the content of the cache entry or false if error */ - static protected function ReadCacheLocked($sFilename) + protected static function ReadCacheLocked($sFilename) { $sContent = false; $file = @fopen($sFilename, 'r'); @@ -367,7 +334,7 @@ class apcFile return $sContent; } - static protected function ResetFileCount() + protected static function ResetFileCount() { self::$aFilesByTime = null; self::$iFileCount = 0; diff --git a/core/apc-service.class.inc.php b/core/apc-service.class.inc.php index ca541eb84..c7922f0d9 100644 --- a/core/apc-service.class.inc.php +++ b/core/apc-service.class.inc.php @@ -4,8 +4,10 @@ * Class ApcService * @since 2.7.6 N°4125 */ -class ApcService { - public function __construct() { +class ApcService +{ + public function __construct() + { } /** @@ -13,7 +15,8 @@ class ApcService { * @return bool * @see function_exists() */ - public function function_exists($function_name) { + public function function_exists($function_name) + { return function_exists($function_name); } @@ -22,7 +25,7 @@ class ApcService { * @return mixed * @see apc_fetch() */ - function apc_fetch($key) + public function apc_fetch($key) { return apc_fetch($key); } @@ -34,9 +37,8 @@ class ApcService { * @return array|bool * @see apc_store() */ - function apc_store($key, $var = NULL, $ttl = 0) + public function apc_store($key, $var = null, $ttl = 0) { return apc_store($key, $var, $ttl); } } -?> \ No newline at end of file diff --git a/core/asynctask.class.inc.php b/core/asynctask.class.inc.php index c8a3a417d..aaf55b0cf 100644 --- a/core/asynctask.class.inc.php +++ b/core/asynctask.class.inc.php @@ -1,9 +1,10 @@ use Combodo\iTop\Service\Notification\Event\EventNotificationNewsroomService; - /** * Persistent classes (internal): user defined actions * @@ -25,11 +25,10 @@ use Combodo\iTop\Service\Notification\Event\EventNotificationNewsroomService; * @license http://opensource.org/licenses/AGPL-3.0 */ - class ExecAsyncTask implements iBackgroundProcess { public function GetPeriodicity() - { + { return 2; // seconds } @@ -39,19 +38,16 @@ class ExecAsyncTask implements iBackgroundProcess // Criteria: planned, and expected to occur... ASAP or in the past $sOQL = "SELECT AsyncTask WHERE (status = 'planned') AND (ISNULL(planned) OR (planned < '$sNow'))"; $iProcessed = 0; - while (time() < $iTimeLimit) - { + while (time() < $iTimeLimit) { // Next one ? - $oSet = new CMDBObjectSet(DBObjectSearch::FromOQL($sOQL), array('created' => true) /* order by*/, array(), null, 1 /* limit count */); + $oSet = new CMDBObjectSet(DBObjectSearch::FromOQL($sOQL), ['created' => true] /* order by*/, [], null, 1 /* limit count */); $oTask = $oSet->Fetch(); - if (is_null($oTask)) - { + if (is_null($oTask)) { // Nothing to be done break; } $iProcessed++; - if ($oTask->Process()) - { + if ($oTask->Process()) { $oTask->DBDelete(); } } @@ -60,7 +56,7 @@ class ExecAsyncTask implements iBackgroundProcess } /** - * A + * A * * @package iTopORM */ @@ -72,79 +68,72 @@ abstract class AsyncTask extends DBObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb", "key_type" => "autoincrement", - "name_attcode" => array('created'), + "name_attcode" => ['created'], "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_async_task", "db_key_field" => "id", "db_finalclass_field" => "realclass", - ); + ]; MetaModel::Init_Params($aParams); // Null is allowed to ease the migration from iTop 2.0.2 and earlier, when the status did not exist, and because the default value is not taken into account in the SQL definition // The value is set from null to planned in the setup program - MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('planned,running,idle,error'), "sql"=>"status", "default_value"=>"planned", "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeEnum("status", ["allowed_values" => new ValueSetEnum('planned,running,idle,error'), "sql" => "status", "default_value" => "planned", "is_null_allowed" => true, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeDateTime("created", array("allowed_values"=>null, "sql"=>"created", "default_value"=>"NOW()", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDateTime("started", array("allowed_values"=>null, "sql"=>"started", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDateTime("planned", array("allowed_values"=>null, "sql"=>"planned", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalKey("event_id", array("targetclass"=>"Event", "jointype"=> "", "allowed_values"=>null, "sql"=>"event_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_SILENT, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeDateTime("created", ["allowed_values" => null, "sql" => "created", "default_value" => "NOW()", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDateTime("started", ["allowed_values" => null, "sql" => "started", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDateTime("planned", ["allowed_values" => null, "sql" => "planned", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalKey("event_id", ["targetclass" => "Event", "jointype" => "", "allowed_values" => null, "sql" => "event_id", "is_null_allowed" => true, "on_target_delete" => DEL_SILENT, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeInteger("remaining_retries", array("allowed_values"=>null, "sql"=>"remaining_retries", "default_value"=>0, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeInteger("last_error_code", array("allowed_values"=>null, "sql"=>"last_error_code", "default_value"=>0, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("last_error", array("allowed_values"=>null, "sql"=>"last_error", "default_value"=>'', "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDateTime("last_attempt", array("allowed_values"=>null, "sql"=>"last_attempt", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeInteger("remaining_retries", ["allowed_values" => null, "sql" => "remaining_retries", "default_value" => 0, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeInteger("last_error_code", ["allowed_values" => null, "sql" => "last_error_code", "default_value" => 0, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("last_error", ["allowed_values" => null, "sql" => "last_error", "default_value" => '', "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDateTime("last_attempt", ["allowed_values" => null, "sql" => "last_attempt", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); } /** * Every is fine */ - const OK = 0; + public const OK = 0; /** * The task no longer exists */ - const DELETED = 1; + public const DELETED = 1; /** * The task is already being executed */ - const ALREADY_RUNNING = 2; + public const ALREADY_RUNNING = 2; /** * The current process requests the ownership on the task. * In case the task can be accessed concurrently, this function can be overloaded to add a critical section. - * The function must not block the caller if another process is already owning the task - * - * @return integer A code among OK/DELETED/ALREADY_RUNNING. - */ + * The function must not block the caller if another process is already owning the task + * + * @return integer A code among OK/DELETED/ALREADY_RUNNING. + */ public function MarkAsRunning() { - try - { - if ($this->Get('status') == 'running') - { + try { + if ($this->Get('status') == 'running') { return self::ALREADY_RUNNING; - } - else - { + } else { $this->Set('status', 'running'); $this->Set('started', time()); $this->DBUpdate(); return self::OK; } - } - catch(Exception $e) - { + } catch (Exception $e) { // Corrupted task !! (for example: "Failed to reload object") IssueLog::Error('Failed to process async task #'.$this->GetKey().' - reason: '.$e->getMessage().' - fatal error, deleting the task.'); - if ($this->Get('event_id') != 0) - { - $oEventLog = MetaModel::GetObject('Event', $this->Get('event_id')); - $oEventLog->Set('message', 'Failed, corrupted data: '.$e->getMessage()); - $oEventLog->DBUpdate(); + if ($this->Get('event_id') != 0) { + $oEventLog = MetaModel::GetObject('Event', $this->Get('event_id')); + $oEventLog->Set('message', 'Failed, corrupted data: '.$e->getMessage()); + $oEventLog->DBUpdate(); } $this->DBDelete(); return self::DELETED; @@ -155,8 +144,7 @@ abstract class AsyncTask extends DBObject { $iRetryDelay = 600; $aRetries = MetaModel::GetConfig()->Get('async_task_retries'); - if (is_array($aRetries) && array_key_exists(get_class($this), $aRetries)) - { + if (is_array($aRetries) && array_key_exists(get_class($this), $aRetries)) { $aConfig = $aRetries[get_class($this)]; $iRetryDelay = $aConfig['retry_delay'] ?? $iRetryDelay; } @@ -167,8 +155,7 @@ abstract class AsyncTask extends DBObject { $iMaxRetries = 0; $aRetries = MetaModel::GetConfig()->Get('async_task_retries'); - if (is_array($aRetries) && array_key_exists(get_class($this), $aRetries)) - { + if (is_array($aRetries) && array_key_exists(get_class($this), $aRetries)) { $aConfig = $aRetries[get_class($this)]; $iMaxRetries = $aConfig['max_retries'] ?? $iMaxRetries; } @@ -177,40 +164,33 @@ abstract class AsyncTask extends DBObject public function IsRetryDelayExponential() { - $bExponential = false; - $aRetries = MetaModel::GetConfig()->Get('async_task_retries'); - if (is_array($aRetries) && array_key_exists(get_class($this), $aRetries)) - { - $aConfig = $aRetries[get_class($this)]; - $bExponential = (bool) ($aConfig['exponential_delay'] ?? $bExponential); - } - return $bExponential; + $bExponential = false; + $aRetries = MetaModel::GetConfig()->Get('async_task_retries'); + if (is_array($aRetries) && array_key_exists(get_class($this), $aRetries)) { + $aConfig = $aRetries[get_class($this)]; + $bExponential = (bool) ($aConfig['exponential_delay'] ?? $bExponential); + } + return $bExponential; } public static function CheckRetryConfig(Config $oConfig, $sAsyncTaskClass) { - $aMessages = []; - $aRetries = $oConfig->Get('async_task_retries'); - if (is_array($aRetries) && array_key_exists($sAsyncTaskClass, $aRetries)) - { - $aValidKeys = array("retry_delay", "max_retries", "exponential_delay"); - $aConfig = $aRetries[$sAsyncTaskClass]; - if (!is_array($aConfig)) - { - $aMessages[] = Dict::Format('Class:AsyncTask:InvalidConfig_Class_Keys', $sAsyncTaskClass, implode(', ', $aValidKeys)); - } - else - { - foreach($aConfig as $key => $value) - { - if (!in_array($key, $aValidKeys)) - { - $aMessages[] = Dict::Format('Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys', $sAsyncTaskClass, $key, implode(', ', $aValidKeys)); - } - } - } - } - return $aMessages; + $aMessages = []; + $aRetries = $oConfig->Get('async_task_retries'); + if (is_array($aRetries) && array_key_exists($sAsyncTaskClass, $aRetries)) { + $aValidKeys = ["retry_delay", "max_retries", "exponential_delay"]; + $aConfig = $aRetries[$sAsyncTaskClass]; + if (!is_array($aConfig)) { + $aMessages[] = Dict::Format('Class:AsyncTask:InvalidConfig_Class_Keys', $sAsyncTaskClass, implode(', ', $aValidKeys)); + } else { + foreach ($aConfig as $key => $value) { + if (!in_array($key, $aValidKeys)) { + $aMessages[] = Dict::Format('Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys', $sAsyncTaskClass, $key, implode(', ', $aValidKeys)); + } + } + } + } + return $aMessages; } /** @@ -223,16 +203,15 @@ abstract class AsyncTask extends DBObject */ public static function GetNextRetryDelay($bIsExponential, $iRetryDelay, $iMaxRetries, $iRemainingRetries) { - if ($bIsExponential) - { - $iExponent = $iMaxRetries - $iRemainingRetries; - if ($iExponent < 0) $iExponent = 0; // Safety net in case on configuration change in the middle of retries - return $iRetryDelay * (2 ** $iExponent); - } - else - { - return $iRetryDelay; - } + if ($bIsExponential) { + $iExponent = $iMaxRetries - $iRemainingRetries; + if ($iExponent < 0) { + $iExponent = 0; + } // Safety net in case on configuration change in the middle of retries + return $iRetryDelay * (2 ** $iExponent); + } else { + return $iRetryDelay; + } } /** @@ -242,14 +221,14 @@ abstract class AsyncTask extends DBObject { } - protected function OnInsert() + protected function OnInsert() { $this->Set('created', time()); } - /** - * @return boolean True if the task record can be deleted - */ + /** + * @return boolean True if the task record can be deleted + */ public function Process() { // By default: consider that the task is not completed @@ -257,25 +236,19 @@ abstract class AsyncTask extends DBObject // Attempt to take the ownership $iStatus = $this->MarkAsRunning(); - if ($iStatus == self::OK) - { - try - { + if ($iStatus == self::OK) { + try { $sStatus = $this->DoProcess(); - if ($this->Get('event_id') != 0) - { + if ($this->Get('event_id') != 0) { $oEventLog = MetaModel::GetObject('Event', $this->Get('event_id')); $oEventLog->Set('message', $sStatus); $oEventLog->DBUpdate(); } $bRet = true; - } catch (Exception $e) - { + } catch (Exception $e) { $this->HandleError($e->getMessage(), $e->getCode()); } - } - else - { + } else { // Already done or being handled by another process... skip... $bRet = false; } @@ -288,8 +261,7 @@ abstract class AsyncTask extends DBObject */ protected function HandleError($sErrorMessage, $iErrorCode) { - if ($this->Get('last_attempt') == '') - { + if ($this->Get('last_attempt') == '') { // First attempt $this->Set('remaining_retries', $this->GetMaxRetries($iErrorCode)); } @@ -299,45 +271,34 @@ abstract class AsyncTask extends DBObject $this->Set('last_attempt', time()); $iRemaining = $this->Get('remaining_retries'); - if ($iRemaining > 0) - { + if ($iRemaining > 0) { $iRetryDelay = $this->GetRetryDelay($iErrorCode); $iNextRetryDelay = static::GetNextRetryDelay($this->IsRetryDelayExponential(), $iRetryDelay, $this->GetMaxRetries($iErrorCode), $iRemaining); IssueLog::Info('Failed to process async task #'.$this->GetKey().' - reason: '.$sErrorMessage.' - remaining retries: '.$iRemaining.' - next retry in '.$iNextRetryDelay.'s'); - if ($this->Get('event_id') != 0) - { + if ($this->Get('event_id') != 0) { $oEventLog = MetaModel::GetObject('Event', $this->Get('event_id')); $oEventLog->Set('message', "$sErrorMessage\nFailed to process async task. Remaining retries: $iRemaining. Next retry in {$iNextRetryDelay}s"); - try - { - $oEventLog->DBUpdate(); - } - catch (Exception $e) - { - $oEventLog->Set('message', "Failed to process async task. Remaining retries: $iRemaining. Next retry in {$iNextRetryDelay}s, more details in the log"); - $oEventLog->DBUpdate(); - } + try { + $oEventLog->DBUpdate(); + } catch (Exception $e) { + $oEventLog->Set('message', "Failed to process async task. Remaining retries: $iRemaining. Next retry in {$iNextRetryDelay}s, more details in the log"); + $oEventLog->DBUpdate(); + } } $this->Set('remaining_retries', $iRemaining - 1); $this->Set('status', 'planned'); $this->Set('started', null); $this->Set('planned', time() + $iNextRetryDelay); - } - else - { + } else { IssueLog::Error('Failed to process async task #'.$this->GetKey().' - reason: '.$sErrorMessage); - if ($this->Get('event_id') != 0) - { + if ($this->Get('event_id') != 0) { $oEventLog = MetaModel::GetObject('Event', $this->Get('event_id')); $oEventLog->Set('message', "$sErrorMessage\nFailed to process async task."); - try - { - $oEventLog->DBUpdate(); - } - catch (Exception $e) - { - $oEventLog->Set('message', 'Failed to process async task, more details in the log'); - $oEventLog->DBUpdate(); + try { + $oEventLog->DBUpdate(); + } catch (Exception $e) { + $oEventLog->Set('message', 'Failed to process async task, more details in the log'); + $oEventLog->DBUpdate(); } } $this->Set('status', 'error'); @@ -352,20 +313,20 @@ abstract class AsyncTask extends DBObject * Throws an exception (message and code) * * @return string - */ + */ abstract public function DoProcess(); /** * Describes the error codes that DoProcess can return by the mean of exceptions - */ - static public function EnumErrorCodes() + */ + public static function EnumErrorCodes() { - return array(); + return []; } } /** - * An email notification + * An email notification * * @package iTopORM */ @@ -373,38 +334,37 @@ class AsyncSendEmail extends AsyncTask { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb", "key_type" => "autoincrement", "name_attcode" => "created", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_async_send_email", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeInteger("version", array("allowed_values"=>null, "sql"=>"version", "default_value"=>Email::ORIGINAL_FORMAT, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("to", array("allowed_values"=>null, "sql"=>"to", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("subject", array("allowed_values"=>null, "sql"=>"subject", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeLongText("message", array("allowed_values"=>null, "sql"=>"message", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeInteger("version", ["allowed_values" => null, "sql" => "version", "default_value" => Email::ORIGINAL_FORMAT, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("to", ["allowed_values" => null, "sql" => "to", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("subject", ["allowed_values" => null, "sql" => "subject", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeLongText("message", ["allowed_values" => null, "sql" => "message", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); // Display lists -// MetaModel::Init_SetZListItems('details', array('name', 'description', 'status', 'test_recipient', 'from', 'reply_to', 'to', 'cc', 'bcc', 'subject', 'body', 'importance', 'trigger_list')); // Attributes to be displayed for the complete details -// MetaModel::Init_SetZListItems('list', array('name', 'status', 'to', 'subject')); // Attributes to be displayed for a list + // MetaModel::Init_SetZListItems('details', array('name', 'description', 'status', 'test_recipient', 'from', 'reply_to', 'to', 'cc', 'bcc', 'subject', 'body', 'importance', 'trigger_list')); // Attributes to be displayed for the complete details + // MetaModel::Init_SetZListItems('list', array('name', 'status', 'to', 'subject')); // Attributes to be displayed for a list // Search criteria -// MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form -// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + // MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form + // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } - static public function AddToQueue(EMail $oEMail, $oLog) + public static function AddToQueue(EMail $oEMail, $oLog) { $oNew = MetaModel::NewObject(__class__); - if ($oLog) - { + if ($oLog) { $oNew->Set('event_id', $oLog->GetKey()); } $oNew->Set('to', $oEMail->GetRecipientTO(true /* string */)); @@ -425,35 +385,33 @@ class AsyncSendEmail extends AsyncTask { $sMessage = $this->Get('message'); $iVersion = (int) $this->Get('version'); - switch($iVersion) - { + switch ($iVersion) { case Email::FORMAT_V2: - $oEMail = Email::UnSerializeV2($sMessage); - break; - + $oEMail = Email::UnSerializeV2($sMessage); + break; + case Email::ORIGINAL_FORMAT: - $oEMail = unserialize($sMessage); - break; - + $oEMail = unserialize($sMessage); + break; + default: - return 'Unknown version of the serialization format: '.$iVersion; + return 'Unknown version of the serialization format: '.$iVersion; } $iRes = $oEMail->Send($aIssues, true /* force synchro !!!!! */); - switch ($iRes) - { - case EMAIL_SEND_OK: - return "Sent"; + switch ($iRes) { + case EMAIL_SEND_OK: + return "Sent"; - case EMAIL_SEND_PENDING: - return "Bug - the email should be sent in synchronous mode"; + case EMAIL_SEND_PENDING: + return "Bug - the email should be sent in synchronous mode"; - case EMAIL_SEND_ERROR: - if (is_array($aIssues)) { - $sMessage = "Sending eMail failed: ".implode(', ', $aIssues); - } else { - $sMessage = "Sending eMail failed."; - } - throw new Exception($sMessage); + case EMAIL_SEND_ERROR: + if (is_array($aIssues)) { + $sMessage = "Sending eMail failed: ".implode(', ', $aIssues); + } else { + $sMessage = "Sending eMail failed."; + } + throw new Exception($sMessage); } return ''; } @@ -463,33 +421,33 @@ class AsyncSendEmail extends AsyncTask * An async notification to be sent to iTop users through the newsroom * @since 3.2.0 */ -class AsyncSendNewsroom extends AsyncTask { - +class AsyncSendNewsroom extends AsyncTask +{ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb", "key_type" => "autoincrement", "name_attcode" => "created", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_async_send_newsroom", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeText("recipients", array("allowed_values"=>null, "sql"=>"recipients", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalKey("action_id", array("targetclass"=>"Action", "allowed_values"=>null, "sql"=>"action_id", "default_value"=>null, "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalKey("trigger_id", array("targetclass"=>"Trigger", "allowed_values"=>null, "sql"=>"trigger_id", "default_value"=>null, "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("title", array("allowed_values"=>null, "sql"=>"title", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("message", array("allowed_values"=>null, "sql"=>"message", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeInteger("object_id", array("allowed_values"=>null, "sql"=>"object_id", "default_value"=>null, "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("object_class", array("allowed_values"=>null, "sql"=>"object_class", "default_value"=>null, "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("url", array("allowed_values"=>null, "sql"=>"url", "default_value"=>null, "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDateTime("date", array("allowed_values"=>null, "sql"=>"date", "default_value"=>'NOW()', "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeText("recipients", ["allowed_values" => null, "sql" => "recipients", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalKey("action_id", ["targetclass" => "Action", "allowed_values" => null, "sql" => "action_id", "default_value" => null, "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalKey("trigger_id", ["targetclass" => "Trigger", "allowed_values" => null, "sql" => "trigger_id", "default_value" => null, "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("title", ["allowed_values" => null, "sql" => "title", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("message", ["allowed_values" => null, "sql" => "message", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeInteger("object_id", ["allowed_values" => null, "sql" => "object_id", "default_value" => null, "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("object_class", ["allowed_values" => null, "sql" => "object_class", "default_value" => null, "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("url", ["allowed_values" => null, "sql" => "url", "default_value" => null, "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDateTime("date", ["allowed_values" => null, "sql" => "date", "default_value" => 'NOW()', "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); } @@ -514,7 +472,7 @@ class AsyncSendNewsroom extends AsyncTask { $oNew->Set('object_id', $iObjectId); $oNew->Set('object_class', $sObjectClass); $oNew->SetCurrentDate('date'); - + $oNew->DBInsert(); } @@ -532,13 +490,12 @@ class AsyncSendNewsroom extends AsyncTask { $iObjectId = $this->Get('object_id'); $sObjectClass = $this->Get('object_class'); $sDate = $this->Get('date'); - - foreach ($aRecipients as $iRecipientId) - { + + foreach ($aRecipients as $iRecipientId) { $oEvent = EventNotificationNewsroomService::MakeEventFromAction($oAction, $iRecipientId, $iTriggerId, $sMessage, $sTitle, $sUrl, $iObjectId, $sObjectClass, $sDate); $oEvent->DBInsertNoReload(); } - + return "Sent"; } -} \ No newline at end of file +} diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 231d48ca3..150a28cdc 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -1,4 +1,5 @@ GetMaxSize(); - if (is_null($iMaxLength)) - { + if (is_null($iMaxLength)) { return null; } - if ($iMaxLength > static::INDEX_LENGTH) - { + if ($iMaxLength > static::INDEX_LENGTH) { return static::INDEX_LENGTH; } @@ -215,12 +211,9 @@ abstract class AttributeDefinition protected function GetOptional($sParamName, $default) { - if (array_key_exists($sParamName, $this->m_aParams)) - { + if (array_key_exists($sParamName, $this->m_aParams)) { return $this->m_aParams[$sParamName]; - } - else - { + } else { return $default; } } @@ -238,7 +231,7 @@ abstract class AttributeDefinition $this->m_sCode = $sCode; $this->m_aParams = $aParams; $this->ConsistencyCheck(); - $this->aCSSClasses = array('attribute'); + $this->aCSSClasses = ['attribute']; } public function GetParams() @@ -268,13 +261,10 @@ abstract class AttributeDefinition */ public function ListSubItems() { - $aSubItems = array(); - foreach(MetaModel::ListAttributeDefs($this->m_sHostClass) as $sAttCode => $oAttDef) - { - if ($oAttDef instanceof AttributeSubItem) - { - if ($oAttDef->Get('target_attcode') == $this->m_sCode) - { + $aSubItems = []; + foreach (MetaModel::ListAttributeDefs($this->m_sHostClass) as $sAttCode => $oAttDef) { + if ($oAttDef instanceof AttributeSubItem) { + if ($oAttDef->Get('target_attcode') == $this->m_sCode) { $aSubItems[$sAttCode] = $oAttDef; } } @@ -287,7 +277,7 @@ abstract class AttributeDefinition // to be overloaded public static function ListExpectedParams() { - return array(); + return []; } /** @@ -298,10 +288,8 @@ abstract class AttributeDefinition // Check that any mandatory param has been specified // $aExpectedParams = static::ListExpectedParams(); - foreach($aExpectedParams as $sParamName) - { - if (!array_key_exists($sParamName, $this->m_aParams)) - { + foreach ($aExpectedParams as $sParamName) { + if (!array_key_exists($sParamName, $this->m_aParams)) { $aBacktrace = debug_backtrace(); $sTargetClass = $aBacktrace[2]["class"]; $sCodeInfo = $aBacktrace[1]["file"]." - ".$aBacktrace[1]["line"]; @@ -567,16 +555,13 @@ abstract class AttributeDefinition protected function SearchLabel($sDictEntrySuffix, $sDefault, $bUserLanguageOnly) { $sLabel = Dict::S('Class:'.$this->m_sHostClass.$sDictEntrySuffix, '', $bUserLanguageOnly); - if (strlen($sLabel) == 0) - { + if (strlen($sLabel) == 0) { // Nothing found: go higher in the hierarchy (if possible) // $sLabel = $sDefault; $sParentClass = MetaModel::GetParentClass($this->m_sHostClass); - if ($sParentClass) - { - if (MetaModel::IsValidAttCode($sParentClass, $this->m_sCode)) - { + if ($sParentClass) { + if (MetaModel::IsValidAttCode($sParentClass, $this->m_sCode)) { $oAttDef = MetaModel::GetAttributeDef($sParentClass, $this->m_sCode); $sLabel = $oAttDef->SearchLabel($sDictEntrySuffix, $sDefault, $bUserLanguageOnly); } @@ -596,11 +581,9 @@ abstract class AttributeDefinition public function GetLabel($sDefault = null) { $sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode, null, true /*user lang*/); - if (is_null($sLabel)) - { + if (is_null($sLabel)) { // If no default value is specified, let's define the most relevant one for developping purposes - if (is_null($sDefault)) - { + if (is_null($sDefault)) { $sDefault = str_replace('_', ' ', $this->m_sCode); } // Browse the hierarchy again, accepting default (english) translations @@ -665,12 +648,9 @@ abstract class AttributeDefinition public function GetLabel_Obsolete() { // Written for compatibility with a data model written prior to version 0.9.1 - if (array_key_exists('label', $this->m_aParams)) - { + if (array_key_exists('label', $this->m_aParams)) { return $this->m_aParams['label']; - } - else - { + } else { return $this->GetLabel(); } } @@ -685,11 +665,9 @@ abstract class AttributeDefinition public function GetDescription($sDefault = null) { $sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode.'+', null, true /*user lang*/); - if (is_null($sLabel)) - { + if (is_null($sLabel)) { // If no default value is specified, let's define the most relevant one for developping purposes - if (is_null($sDefault)) - { + if (is_null($sDefault)) { $sDefault = ''; } // Browse the hierarchy again, accepting default (english) translations @@ -719,11 +697,9 @@ abstract class AttributeDefinition public function GetHelpOnEdition($sDefault = null) { $sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode.'?', null, true /*user lang*/); - if (is_null($sLabel)) - { + if (is_null($sLabel)) { // If no default value is specified, let's define the most relevant one for developping purposes - if (is_null($sDefault)) - { + if (is_null($sDefault)) { $sDefault = ''; } // Browse the hierarchy again, accepting default (english) translations @@ -735,12 +711,10 @@ abstract class AttributeDefinition public function GetHelpOnSmartSearch() { - $aParents = array_merge(array(get_class($this) => get_class($this)), class_parents($this)); - foreach($aParents as $sClass) - { + $aParents = array_merge([get_class($this) => get_class($this)], class_parents($this)); + foreach ($aParents as $sClass) { $sHelp = Dict::S("Core:$sClass?SmartSearch", '-missing-'); - if ($sHelp != '-missing-') - { + if ($sHelp != '-missing-') { return $sHelp; } } @@ -756,12 +730,9 @@ abstract class AttributeDefinition public function GetDescription_Obsolete() { // Written for compatibility with a data model written prior to version 0.9.1 - if (array_key_exists('description', $this->m_aParams)) - { + if (array_key_exists('description', $this->m_aParams)) { return $this->m_aParams['description']; - } - else - { + } else { return $this->GetDescription(); } } @@ -781,7 +752,7 @@ abstract class AttributeDefinition public function GetPrerequisiteAttributes($sClass = null) { - return array(); + return []; } public function GetNullValue() @@ -831,7 +802,7 @@ abstract class AttributeDefinition */ public function GetSQLExpressions($sPrefix = '') { - return array(); + return []; } /** @@ -853,7 +824,7 @@ abstract class AttributeDefinition */ public function GetSQLColumns($bFullSpec = false) { - return array(); + return []; } /** @@ -863,7 +834,7 @@ abstract class AttributeDefinition */ public function GetSQLValues($value) { - return array(); + return []; } public function RequiresIndex() @@ -884,7 +855,7 @@ abstract class AttributeDefinition public function GetOrderBySQLExpressions($sClassAlias) { // Note: This is the responsibility of this function to place backticks around column aliases - return array('`'.$sClassAlias.$this->GetCode().'`'); + return ['`'.$sClassAlias.$this->GetCode().'`']; } public function GetOrderByHint() @@ -901,9 +872,8 @@ abstract class AttributeDefinition public function FromImportToValue($aCols, $sPrefix = '') { - $aValues = array(); - foreach($this->GetSQLExpressions($sPrefix) as $sAlias => $sExpr) - { + $aValues = []; + foreach ($this->GetSQLExpressions($sPrefix) as $sAlias => $sExpr) { // This is working, based on the assumption that importable fields // are not computed fields => the expression is the name of a column $aValues[$sPrefix.$sAlias] = $aCols[$sExpr]; @@ -962,7 +932,7 @@ abstract class AttributeDefinition */ public function GetFilterDefinitions() { - return array(); + return []; } public function GetEditValue($sValue, $oHostObj = null) @@ -1059,7 +1029,11 @@ abstract class AttributeDefinition * @return string */ public function GetAsCSV( - $sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $sValue, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { return (string)$sValue; @@ -1177,12 +1151,12 @@ abstract class AttributeDefinition */ public function EnumTemplateVerbs() { - return array( + return [ '' => 'Plain text (unlocalized) representation', 'html' => 'HTML representation', 'label' => 'Localized representation', 'text' => 'Plain text representation (without any markup)', - ); + ]; } /** @@ -1199,10 +1173,8 @@ abstract class AttributeDefinition */ public function GetForTemplate($value, $sVerb, $oHostObject = null, $bLocalize = true) { - if ($this->IsScalar()) - { - switch ($sVerb) - { + if ($this->IsScalar()) { + switch ($sVerb) { case '': return $value; @@ -1232,11 +1204,10 @@ abstract class AttributeDefinition * @throws \CoreException * @throws \OQLException */ - public function GetAllowedValues($aArgs = array(), $sContains = '') + public function GetAllowedValues($aArgs = [], $sContains = '') { $oValSetDef = $this->GetValuesDef(); - if (!$oValSetDef) - { + if (!$oValSetDef) { return null; } @@ -1252,7 +1223,7 @@ abstract class AttributeDefinition * @throws \CoreException * @throws \OQLException */ - public function GetAllowedValuesForSelect($aArgs = array(), $sContains = '') + public function GetAllowedValuesForSelect($aArgs = [], $sContains = '') { return $this->GetAllowedValues($aArgs, $sContains); } @@ -1273,69 +1244,58 @@ abstract class AttributeDefinition */ public function DescribeChangeAsHTML($sOldValue, $sNewValue, $sLabel = null) { - if (is_null($sLabel)) - { + if (is_null($sLabel)) { $sLabel = $this->GetLabel(); } $sNewValueHtml = $this->GetAsHTMLForHistory($sNewValue); $sOldValueHtml = $this->GetAsHTMLForHistory($sOldValue); - if ($this->IsExternalKey()) - { + if ($this->IsExternalKey()) { /** @var \AttributeExternalKey $this */ $sTargetClass = $this->GetTargetClass(); $sOldValueHtml = (int)$sOldValue ? MetaModel::GetHyperLink($sTargetClass, (int)$sOldValue) : null; $sNewValueHtml = (int)$sNewValue ? MetaModel::GetHyperLink($sTargetClass, (int)$sNewValue) : null; } if ((($this->GetType() == 'String') || ($this->GetType() == 'Text')) && - (strlen($sNewValue) > strlen($sOldValue))) - { + (strlen($sNewValue) > strlen($sOldValue))) { // Check if some text was not appended to the field - if (substr($sNewValue, 0, strlen($sOldValue)) == $sOldValue) // Text added at the end - { + if (substr($sNewValue, 0, strlen($sOldValue)) == $sOldValue) { // Text added at the end $sDelta = $this->GetAsHTML(substr($sNewValue, strlen($sOldValue))); $sResult = Dict::Format('Change:Text_AppendedTo_AttName', $sDelta, $sLabel); - } - else - { - if (substr($sNewValue, -strlen($sOldValue)) == $sOldValue) // Text added at the beginning - { + } else { + if (substr($sNewValue, -strlen($sOldValue)) == $sOldValue) { // Text added at the beginning $sDelta = $this->GetAsHTML(substr($sNewValue, 0, strlen($sNewValue) - strlen($sOldValue))); $sResult = Dict::Format('Change:Text_AppendedTo_AttName', $sDelta, $sLabel); - } - else - { - if (strlen($sOldValue) == 0) - { + } else { + if (strlen($sOldValue) == 0) { $sResult = Dict::Format('Change:AttName_SetTo', $sLabel, $sNewValueHtml); - } - else - { - if (is_null($sNewValue)) - { + } else { + if (is_null($sNewValue)) { $sNewValueHtml = Dict::S('UI:UndefinedObject'); } - $sResult = Dict::Format('Change:AttName_SetTo_NewValue_PreviousValue_OldValue', $sLabel, - $sNewValueHtml, $sOldValueHtml); + $sResult = Dict::Format( + 'Change:AttName_SetTo_NewValue_PreviousValue_OldValue', + $sLabel, + $sNewValueHtml, + $sOldValueHtml + ); } } } - } - else - { - if (strlen($sOldValue) == 0) - { + } else { + if (strlen($sOldValue) == 0) { $sResult = Dict::Format('Change:AttName_SetTo', $sLabel, $sNewValueHtml); - } - else - { - if (is_null($sNewValue)) - { + } else { + if (is_null($sNewValue)) { $sNewValueHtml = Dict::S('UI:UndefinedObject'); } - $sResult = Dict::Format('Change:AttName_SetTo_NewValue_PreviousValue_OldValue', $sLabel, $sNewValueHtml, - $sOldValueHtml); + $sResult = Dict::Format( + 'Change:AttName_SetTo_NewValue_PreviousValue_OldValue', + $sLabel, + $sNewValueHtml, + $sOldValueHtml + ); } } @@ -1417,8 +1377,7 @@ abstract class AttributeDefinition $sParamName = $oField->GetParent().'_'.$oField->GetName(); $oRightExpr = new VariableExpression($sParamName); $sOperator = $this->GetBasicFilterLooseOperator(); - switch ($sOperator) - { + switch ($sOperator) { case 'Contains': $aParams[$sParamName] = "%$sSearchText%"; $sSQLOperator = 'LIKE'; @@ -1460,7 +1419,7 @@ abstract class AttributeDefinition /* * return string */ - public function GetRenderForDataTable(string $sClassAlias) :string + public function GetRenderForDataTable(string $sClassAlias): string { $sRenderFunction = "return data;"; return $sRenderFunction; @@ -1488,8 +1447,10 @@ class AttributeDashboard extends AttributeDefinition public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), - array("definition_file", "is_user_editable")); + return array_merge( + parent::ListExpectedParams(), + ["definition_file", "is_user_editable"] + ); } public function GetDashboard() @@ -1522,7 +1483,7 @@ class AttributeDashboard extends AttributeDefinition public function GetBasicFilterOperators() { - return array(); + return []; } public function GetBasicFilterLooseOperator() @@ -1591,8 +1552,10 @@ class AttributeLinkedSet extends AttributeDefinition public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), - array("allowed_values", "depends_on", "linked_class", "ext_key_to_me", "count_min", "count_max")); + return array_merge( + parent::ListExpectedParams(), + ["allowed_values", "depends_on", "linked_class", "ext_key_to_me", "count_min", "count_max"] + ); } public function GetEditClass() @@ -1661,8 +1624,7 @@ class AttributeLinkedSet extends AttributeDefinition */ public function GetDefaultValue(DBObject $oHostObject = null) { - if ($oHostObject === null) - { + if ($oHostObject === null) { return null; } @@ -1676,23 +1638,20 @@ class AttributeLinkedSet extends AttributeDefinition $sMyClass = $oRemoteExtKeyAtt->GetTargetClass(); $oMyselfSearch = new DBObjectSearch($sMyClass); - if ($oHostObject !== null) - { + if ($oHostObject !== null) { $oMyselfSearch->AddCondition('id', $oHostObject->GetKey(), '='); } $oLinkSearch = new DBObjectSearch($sLinkClass); $oLinkSearch->AddCondition_PointingTo($oMyselfSearch, $sExtKeyToMe); - if ($this->IsIndirect()) - { + if ($this->IsIndirect()) { // Join the remote class so that the archive flag will be taken into account /** @var \AttributeLinkedSetIndirect $this */ $sExtKeyToRemote = $this->GetExtKeyToRemote(); /** @var \AttributeExternalKey $oExtKeyToRemote */ $oExtKeyToRemote = MetaModel::GetAttributeDef($sLinkClass, $sExtKeyToRemote); $sRemoteClass = $oExtKeyToRemote->GetTargetClass(); - if (MetaModel::IsArchivable($sRemoteClass)) - { + if (MetaModel::IsArchivable($sRemoteClass)) { $oRemoteSearch = new DBObjectSearch($sRemoteClass); /** @var \AttributeLinkedSetIndirect $this */ $oLinkSearch->AddCondition_PointingTo($oRemoteSearch, $this->GetExtKeyToRemote()); @@ -1771,7 +1730,7 @@ class AttributeLinkedSet extends AttributeDefinition public function GetBasicFilterOperators() { - return array(); + return []; } public function GetBasicFilterLooseOperator() @@ -1787,37 +1746,30 @@ class AttributeLinkedSet extends AttributeDefinition /** @inheritDoc * */ public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) { - if($this->GetDisplayStyle() === LINKSET_DISPLAY_STYLE_TAB){ + if ($this->GetDisplayStyle() === LINKSET_DISPLAY_STYLE_TAB) { return $this->GetAsHTMLForTab($sValue, $oHostObject, $bLocalize); - } - else{ + } else { return $this->GetAsHTMLForProperty($sValue, $oHostObject, $bLocalize); } } public function GetAsHTMLForTab($sValue, $oHostObject = null, $bLocalize = true) { - if (is_object($sValue) && ($sValue instanceof ormLinkSet)) - { + if (is_object($sValue) && ($sValue instanceof ormLinkSet)) { $sValue->Rewind(); - $aItems = array(); - while ($oObj = $sValue->Fetch()) - { + $aItems = []; + while ($oObj = $sValue->Fetch()) { // Show only relevant information (hide the external key to the current object) - $aAttributes = array(); - foreach(MetaModel::ListAttributeDefs($this->GetLinkedClass()) as $sAttCode => $oAttDef) - { - if ($sAttCode == $this->GetExtKeyToMe()) - { + $aAttributes = []; + foreach (MetaModel::ListAttributeDefs($this->GetLinkedClass()) as $sAttCode => $oAttDef) { + if ($sAttCode == $this->GetExtKeyToMe()) { continue; } - if ($oAttDef->IsExternalField()) - { + if ($oAttDef->IsExternalField()) { continue; } $sAttValue = $oObj->GetAsHTML($sAttCode); - if (strlen($sAttValue) > 0) - { + if (strlen($sAttValue) > 0) { $aAttributes[] = $sAttValue; } } @@ -1843,8 +1795,7 @@ class AttributeLinkedSet extends AttributeDefinition $oLinkSetBlock = new BlockLinkSetDisplayAsProperty($this->GetCode(), $this, $sValue); return ConsoleBlockRenderer::RenderBlockTemplates($oLinkSetBlock); - } - catch (Exception $e) { + } catch (Exception $e) { $sMessage = "Error while displaying attribute {$this->GetCode()}"; IssueLog::Error($sMessage, IssueLog::CHANNEL_DEFAULT, [ 'host_object_class' => $this->GetHostClass(), @@ -1867,48 +1818,37 @@ class AttributeLinkedSet extends AttributeDefinition */ public function GetAsXML($sValue, $oHostObject = null, $bLocalize = true) { - if (is_object($sValue) && ($sValue instanceof ormLinkSet)) - { + if (is_object($sValue) && ($sValue instanceof ormLinkSet)) { $sValue->Rewind(); $sRes = "\n"; - while ($oObj = $sValue->Fetch()) - { + while ($oObj = $sValue->Fetch()) { $sObjClass = get_class($oObj); $sRes .= "<$sObjClass id=\"".$oObj->GetKey()."\">\n"; // Show only relevant information (hide the external key to the current object) - foreach(MetaModel::ListAttributeDefs($sObjClass) as $sAttCode => $oAttDef) - { - if ($sAttCode == 'finalclass') - { - if ($sObjClass == $this->GetLinkedClass()) - { + foreach (MetaModel::ListAttributeDefs($sObjClass) as $sAttCode => $oAttDef) { + if ($sAttCode == 'finalclass') { + if ($sObjClass == $this->GetLinkedClass()) { // Simplify the output if the exact class could be determined implicitely continue; } } - if ($sAttCode == $this->GetExtKeyToMe()) - { + if ($sAttCode == $this->GetExtKeyToMe()) { continue; } - if ($oAttDef->IsExternalField()) - { + if ($oAttDef->IsExternalField()) { /** @var \AttributeExternalField $oAttDef */ - if ($oAttDef->GetKeyAttCode() == $this->GetExtKeyToMe()) - { + if ($oAttDef->GetKeyAttCode() == $this->GetExtKeyToMe()) { continue; } /** @var AttributeExternalField $oAttDef */ - if ($oAttDef->IsFriendlyName()) - { + if ($oAttDef->IsFriendlyName()) { continue; } } - if ($oAttDef instanceof AttributeFriendlyName) - { + if ($oAttDef instanceof AttributeFriendlyName) { continue; } - if (!$oAttDef->IsScalar()) - { + if (!$oAttDef->IsScalar()) { continue; } $sAttValue = $oObj->GetAsXML($sAttCode, $bLocalize); @@ -1917,9 +1857,7 @@ class AttributeLinkedSet extends AttributeDefinition $sRes .= "\n"; } $sRes .= "\n"; - } - else - { + } else { $sRes = ''; } @@ -1938,7 +1876,11 @@ class AttributeLinkedSet extends AttributeDefinition * @throws \CoreException */ public function GetAsCSV( - $sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $sValue, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { $sSepItem = MetaModel::GetConfig()->Get('link_set_item_separator'); @@ -1946,46 +1888,39 @@ class AttributeLinkedSet extends AttributeDefinition $sSepValue = MetaModel::GetConfig()->Get('link_set_value_separator'); $sAttributeQualifier = MetaModel::GetConfig()->Get('link_set_attribute_qualifier'); - if (is_object($sValue) && ($sValue instanceof ormLinkSet)) - { + if (is_object($sValue) && ($sValue instanceof ormLinkSet)) { $sValue->Rewind(); - $aItems = array(); - while ($oObj = $sValue->Fetch()) - { + $aItems = []; + while ($oObj = $sValue->Fetch()) { $sObjClass = get_class($oObj); // Show only relevant information (hide the external key to the current object) - $aAttributes = array(); - foreach(MetaModel::ListAttributeDefs($sObjClass) as $sAttCode => $oAttDef) - { - if ($sAttCode == 'finalclass') - { - if ($sObjClass == $this->GetLinkedClass()) - { + $aAttributes = []; + foreach (MetaModel::ListAttributeDefs($sObjClass) as $sAttCode => $oAttDef) { + if ($sAttCode == 'finalclass') { + if ($sObjClass == $this->GetLinkedClass()) { // Simplify the output if the exact class could be determined implicitely continue; } } - if ($sAttCode == $this->GetExtKeyToMe()) - { + if ($sAttCode == $this->GetExtKeyToMe()) { continue; } - if ($oAttDef->IsExternalField()) - { + if ($oAttDef->IsExternalField()) { continue; } - if (!$oAttDef->IsBasedOnDBColumns()) - { + if (!$oAttDef->IsBasedOnDBColumns()) { continue; } - if (!$oAttDef->IsScalar()) - { + if (!$oAttDef->IsScalar()) { continue; } $sAttValue = $oObj->GetAsCSV($sAttCode, $sSepValue, '', $bLocalize); - if (strlen($sAttValue) > 0) - { - $sAttributeData = str_replace($sAttributeQualifier, $sAttributeQualifier.$sAttributeQualifier, - $sAttCode.$sSepValue.$sAttValue); + if (strlen($sAttValue) > 0) { + $sAttributeData = str_replace( + $sAttributeQualifier, + $sAttributeQualifier.$sAttributeQualifier, + $sAttCode.$sSepValue.$sAttValue + ); $aAttributes[] = $sAttributeQualifier.$sAttributeData.$sAttributeQualifier; } } @@ -1993,9 +1928,7 @@ class AttributeLinkedSet extends AttributeDefinition $aItems[] = $sAttributes; } $sRes = implode($sSepItem, $aItems); - } - else - { + } else { $sRes = ''; } $sRes = str_replace($sTextQualifier, $sTextQualifier.$sTextQualifier, $sRes); @@ -2009,10 +1942,10 @@ class AttributeLinkedSet extends AttributeDefinition */ public function EnumTemplateVerbs() { - return array( + return [ '' => 'Plain text (unlocalized) representation', 'html' => 'HTML representation (unordered list)', - ); + ]; } /** @@ -2035,11 +1968,9 @@ class AttributeLinkedSet extends AttributeDefinition $oLinkSet = clone $value; // Workaround/Safety net for Trac #887 $iLimit = MetaModel::GetConfig()->Get('max_linkset_output'); $iCount = 0; - $aNames = array(); - foreach($oLinkSet as $oItem) - { - if (($iLimit > 0) && ($iCount == $iLimit)) - { + $aNames = []; + foreach ($oLinkSet as $oItem) { + if (($iLimit > 0) && ($iCount == $iLimit)) { $iTotal = $oLinkSet->Count(); $aNames[] = '... '.Dict::Format('UI:TruncatedResults', $iCount, $iTotal); break; @@ -2048,8 +1979,7 @@ class AttributeLinkedSet extends AttributeDefinition $iCount++; } - switch ($sVerb) - { + switch ($sVerb) { case '': return implode("\n", $aNames); @@ -2068,7 +1998,7 @@ class AttributeLinkedSet extends AttributeDefinition public function GetImportColumns() { - $aColumns = array(); + $aColumns = []; $aColumns[$this->GetCode()] = 'MEDIUMTEXT'.CMDBSource::GetSqlStringColumnDefinition(); return $aColumns; @@ -2092,23 +2022,23 @@ class AttributeLinkedSet extends AttributeDefinition * @throws \Exception */ public function MakeValueFromString( - $sProposedValue, $bLocalizedValue = false, $sSepItem = null, $sSepAttribute = null, $sSepValue = null, + $sProposedValue, + $bLocalizedValue = false, + $sSepItem = null, + $sSepAttribute = null, + $sSepValue = null, $sAttributeQualifier = null ) { - if (is_null($sSepItem) || empty($sSepItem)) - { + if (is_null($sSepItem) || empty($sSepItem)) { $sSepItem = MetaModel::GetConfig()->Get('link_set_item_separator'); } - if (is_null($sSepAttribute) || empty($sSepAttribute)) - { + if (is_null($sSepAttribute) || empty($sSepAttribute)) { $sSepAttribute = MetaModel::GetConfig()->Get('link_set_attribute_separator'); } - if (is_null($sSepValue) || empty($sSepValue)) - { + if (is_null($sSepValue) || empty($sSepValue)) { $sSepValue = MetaModel::GetConfig()->Get('link_set_value_separator'); } - if (is_null($sAttributeQualifier) || empty($sAttributeQualifier)) - { + if (is_null($sAttributeQualifier) || empty($sAttributeQualifier)) { $sAttributeQualifier = MetaModel::GetConfig()->Get('link_set_attribute_qualifier'); } @@ -2119,100 +2049,97 @@ class AttributeLinkedSet extends AttributeDefinition $aInput = $oCSVParser->ToArray(0 /* do not skip lines */); - $aLinks = array(); - foreach($aInput as $aRow) - { + $aLinks = []; + foreach ($aInput as $aRow) { // 1st - get the values, split the extkey->searchkey specs, and eventually get the finalclass value - $aExtKeys = array(); - $aValues = array(); - foreach($aRow as $sCell) - { + $aExtKeys = []; + $aValues = []; + foreach ($aRow as $sCell) { $iSepPos = strpos($sCell, $sSepValue); - if ($iSepPos === false) - { + if ($iSepPos === false) { // Houston... - throw new CoreException('Wrong format for link attribute specification', array('value' => $sCell)); + throw new CoreException('Wrong format for link attribute specification', ['value' => $sCell]); } $sAttCode = trim(substr($sCell, 0, $iSepPos)); $sValue = substr($sCell, $iSepPos + strlen($sSepValue)); - if (preg_match('/^(.+)->(.+)$/', $sAttCode, $aMatches)) - { + if (preg_match('/^(.+)->(.+)$/', $sAttCode, $aMatches)) { $sKeyAttCode = $aMatches[1]; $sRemoteAttCode = $aMatches[2]; $aExtKeys[$sKeyAttCode][$sRemoteAttCode] = $sValue; - if (!MetaModel::IsValidAttCode($sTargetClass, $sKeyAttCode)) - { - throw new CoreException('Wrong attribute code for link attribute specification', - array('class' => $sTargetClass, 'attcode' => $sKeyAttCode)); + if (!MetaModel::IsValidAttCode($sTargetClass, $sKeyAttCode)) { + throw new CoreException( + 'Wrong attribute code for link attribute specification', + ['class' => $sTargetClass, 'attcode' => $sKeyAttCode] + ); } /** @var \AttributeExternalKey $oKeyAttDef */ $oKeyAttDef = MetaModel::GetAttributeDef($sTargetClass, $sKeyAttCode); $sRemoteClass = $oKeyAttDef->GetTargetClass(); - if (!MetaModel::IsValidAttCode($sRemoteClass, $sRemoteAttCode)) - { - throw new CoreException('Wrong attribute code for link attribute specification', - array('class' => $sRemoteClass, 'attcode' => $sRemoteAttCode)); + if (!MetaModel::IsValidAttCode($sRemoteClass, $sRemoteAttCode)) { + throw new CoreException( + 'Wrong attribute code for link attribute specification', + ['class' => $sRemoteClass, 'attcode' => $sRemoteAttCode] + ); } - } - else - { - if (!MetaModel::IsValidAttCode($sTargetClass, $sAttCode)) - { - throw new CoreException('Wrong attribute code for link attribute specification', - array('class' => $sTargetClass, 'attcode' => $sAttCode)); + } else { + if (!MetaModel::IsValidAttCode($sTargetClass, $sAttCode)) { + throw new CoreException( + 'Wrong attribute code for link attribute specification', + ['class' => $sTargetClass, 'attcode' => $sAttCode] + ); } $oAttDef = MetaModel::GetAttributeDef($sTargetClass, $sAttCode); - $aValues[$sAttCode] = $oAttDef->MakeValueFromString($sValue, $bLocalizedValue, $sSepItem, - $sSepAttribute, $sSepValue, $sAttributeQualifier); + $aValues[$sAttCode] = $oAttDef->MakeValueFromString( + $sValue, + $bLocalizedValue, + $sSepItem, + $sSepAttribute, + $sSepValue, + $sAttributeQualifier + ); } } // 2nd - Instanciate the object and set the value - if (isset($aValues['finalclass'])) - { + if (isset($aValues['finalclass'])) { $sLinkClass = $aValues['finalclass']; - if (!is_subclass_of($sLinkClass, $sTargetClass)) - { - throw new CoreException('Wrong class for link attribute specification', - array('requested_class' => $sLinkClass, 'expected_class' => $sTargetClass)); + if (!is_subclass_of($sLinkClass, $sTargetClass)) { + throw new CoreException( + 'Wrong class for link attribute specification', + ['requested_class' => $sLinkClass, 'expected_class' => $sTargetClass] + ); } - } - elseif (MetaModel::IsAbstract($sTargetClass)) - { + } elseif (MetaModel::IsAbstract($sTargetClass)) { throw new CoreException('Missing finalclass for link attribute specification'); - } - else - { + } else { $sLinkClass = $sTargetClass; } $oLink = MetaModel::NewObject($sLinkClass); - foreach($aValues as $sAttCode => $sValue) - { + foreach ($aValues as $sAttCode => $sValue) { $oLink->Set($sAttCode, $sValue); } // 3rd - Set external keys from search conditions - foreach($aExtKeys as $sKeyAttCode => $aReconciliation) - { + foreach ($aExtKeys as $sKeyAttCode => $aReconciliation) { $oKeyAttDef = MetaModel::GetAttributeDef($sTargetClass, $sKeyAttCode); $sKeyClass = $oKeyAttDef->GetTargetClass(); $oExtKeyFilter = new DBObjectSearch($sKeyClass); - $aReconciliationDesc = array(); - foreach($aReconciliation as $sRemoteAttCode => $sValue) - { + $aReconciliationDesc = []; + foreach ($aReconciliation as $sRemoteAttCode => $sValue) { $oExtKeyFilter->AddCondition($sRemoteAttCode, $sValue, '='); $aReconciliationDesc[] = "$sRemoteAttCode=$sValue"; } $oExtKeySet = new DBObjectSet($oExtKeyFilter); - switch ($oExtKeySet->Count()) - { + switch ($oExtKeySet->Count()) { case 0: $sReconciliationDesc = implode(', ', $aReconciliationDesc); - throw new CoreException("Found no match", - array('ext_key' => $sKeyAttCode, 'reconciliation' => $sReconciliationDesc)); + throw new CoreException( + "Found no match", + ['ext_key' => $sKeyAttCode, 'reconciliation' => $sReconciliationDesc] + ); break; case 1: $oRemoteObj = $oExtKeySet->Fetch(); @@ -2220,33 +2147,32 @@ class AttributeLinkedSet extends AttributeDefinition break; default: $sReconciliationDesc = implode(', ', $aReconciliationDesc); - throw new CoreException("Found several matches", - array('ext_key' => $sKeyAttCode, 'reconciliation' => $sReconciliationDesc)); - // Found several matches, ambiguous + throw new CoreException( + "Found several matches", + ['ext_key' => $sKeyAttCode, 'reconciliation' => $sReconciliationDesc] + ); + // Found several matches, ambiguous } } // Check (roughly) if such a link is valid - $aErrors = array(); - foreach(MetaModel::ListAttributeDefs($sTargetClass) as $sAttCode => $oAttDef) - { - if ($oAttDef->IsExternalKey()) - { + $aErrors = []; + foreach (MetaModel::ListAttributeDefs($sTargetClass) as $sAttCode => $oAttDef) { + if ($oAttDef->IsExternalKey()) { /** @var \AttributeExternalKey $oAttDef */ - if (($oAttDef->GetTargetClass() == $this->GetHostClass()) || (is_subclass_of($this->GetHostClass(), - $oAttDef->GetTargetClass()))) - { + if (($oAttDef->GetTargetClass() == $this->GetHostClass()) || (is_subclass_of( + $this->GetHostClass(), + $oAttDef->GetTargetClass() + ))) { continue; // Don't check the key to self } } - if ($oAttDef->IsWritable() && $oAttDef->IsNull($oLink->Get($sAttCode)) && !$oAttDef->IsNullAllowed()) - { + if ($oAttDef->IsWritable() && $oAttDef->IsNull($oLink->Get($sAttCode)) && !$oAttDef->IsNullAllowed()) { $aErrors[] = $sAttCode; } } - if (count($aErrors) > 0) - { + if (count($aErrors) > 0) { throw new CoreException("Missing value for mandatory attribute(s): ".implode(', ', $aErrors)); } @@ -2264,39 +2190,30 @@ class AttributeLinkedSet extends AttributeDefinition */ public function GetForJSON($value) { - $aRet = array(); - if (is_object($value) && ($value instanceof ormLinkSet)) - { + $aRet = []; + if (is_object($value) && ($value instanceof ormLinkSet)) { $value->Rewind(); - while ($oObj = $value->Fetch()) - { + while ($oObj = $value->Fetch()) { $sObjClass = get_class($oObj); // Show only relevant information (hide the external key to the current object) - $aAttributes = array(); - foreach(MetaModel::ListAttributeDefs($sObjClass) as $sAttCode => $oAttDef) - { - if ($sAttCode == 'finalclass') - { - if ($sObjClass == $this->GetLinkedClass()) - { + $aAttributes = []; + foreach (MetaModel::ListAttributeDefs($sObjClass) as $sAttCode => $oAttDef) { + if ($sAttCode == 'finalclass') { + if ($sObjClass == $this->GetLinkedClass()) { // Simplify the output if the exact class could be determined implicitely continue; } } - if ($sAttCode == $this->GetExtKeyToMe()) - { + if ($sAttCode == $this->GetExtKeyToMe()) { continue; } - if ($oAttDef->IsExternalField()) - { + if ($oAttDef->IsExternalField()) { continue; } - if (!$oAttDef->IsBasedOnDBColumns()) - { + if (!$oAttDef->IsBasedOnDBColumns()) { continue; } - if (!$oAttDef->IsScalar()) - { + if (!$oAttDef->IsScalar()) { continue; } $attValue = $oObj->Get($sAttCode); @@ -2321,54 +2238,45 @@ class AttributeLinkedSet extends AttributeDefinition { $sTargetClass = $this->Get('linked_class'); - $aLinks = array(); - foreach($json as $aValues) - { - if (isset($aValues['finalclass'])) - { + $aLinks = []; + foreach ($json as $aValues) { + if (isset($aValues['finalclass'])) { $sLinkClass = $aValues['finalclass']; - if (!is_subclass_of($sLinkClass, $sTargetClass)) - { - throw new CoreException('Wrong class for link attribute specification', - array('requested_class' => $sLinkClass, 'expected_class' => $sTargetClass)); + if (!is_subclass_of($sLinkClass, $sTargetClass)) { + throw new CoreException( + 'Wrong class for link attribute specification', + ['requested_class' => $sLinkClass, 'expected_class' => $sTargetClass] + ); } - } - elseif (MetaModel::IsAbstract($sTargetClass)) - { + } elseif (MetaModel::IsAbstract($sTargetClass)) { throw new CoreException('Missing finalclass for link attribute specification'); - } - else - { + } else { $sLinkClass = $sTargetClass; } $oLink = MetaModel::NewObject($sLinkClass); - foreach($aValues as $sAttCode => $sValue) - { + foreach ($aValues as $sAttCode => $sValue) { $oLink->Set($sAttCode, $sValue); } // Check (roughly) if such a link is valid - $aErrors = array(); - foreach(MetaModel::ListAttributeDefs($sTargetClass) as $sAttCode => $oAttDef) - { - if ($oAttDef->IsExternalKey()) - { + $aErrors = []; + foreach (MetaModel::ListAttributeDefs($sTargetClass) as $sAttCode => $oAttDef) { + if ($oAttDef->IsExternalKey()) { /** @var AttributeExternalKey $oAttDef */ - if (($oAttDef->GetTargetClass() == $this->GetHostClass()) || (is_subclass_of($this->GetHostClass(), - $oAttDef->GetTargetClass()))) - { + if (($oAttDef->GetTargetClass() == $this->GetHostClass()) || (is_subclass_of( + $this->GetHostClass(), + $oAttDef->GetTargetClass() + ))) { continue; // Don't check the key to self } } - if ($oAttDef->IsWritable() && $oAttDef->IsNull($oLink->Get($sAttCode)) && !$oAttDef->IsNullAllowed()) - { + if ($oAttDef->IsWritable() && $oAttDef->IsNull($oLink->Get($sAttCode)) && !$oAttDef->IsNullAllowed()) { $aErrors[] = $sAttCode; } } - if (count($aErrors) > 0) - { + if (count($aErrors) > 0) { throw new CoreException("Missing value for mandatory attribute(s): ".implode(', ', $aErrors)); } @@ -2388,10 +2296,9 @@ class AttributeLinkedSet extends AttributeDefinition */ public function MakeRealValue($proposedValue, $oHostObj) { - if ($proposedValue === null) - { + if ($proposedValue === null) { $sLinkedClass = $this->GetLinkedClass(); - $aLinkedObjectsArray = array(); + $aLinkedObjectsArray = []; $oSet = DBObjectSet::FromArray($sLinkedClass, $aLinkedObjectsArray); return new ormLinkSet( @@ -2412,12 +2319,9 @@ class AttributeLinkedSet extends AttributeDefinition */ public function Equals($val1, $val2) { - if ($val1 === $val2) - { + if ($val1 === $val2) { $bAreEquivalent = true; - } - else - { + } else { $bAreEquivalent = ($val2->HasDelta() === false); } @@ -2453,8 +2357,7 @@ class AttributeLinkedSet extends AttributeDefinition */ public function MakeFormField(DBObject $oObject, $oFormField = null) { - if ($oFormField === null) - { + if ($oFormField === null) { $sFormFieldClass = static::GetFormFieldClass(); $oFormField = new $sFormFieldClass($this->GetCode()); } @@ -2479,10 +2382,10 @@ class AttributeLinkedSet extends AttributeDefinition // - Adding friendlyname attribute to the list is not already in it $sTitleAttCode = MetaModel::GetFriendlyNameAttributeCode($sTargetClass); if (($sTitleAttCode !== null) && !in_array($sTitleAttCode, $aAttCodesToDisplay)) { - $aAttCodesToDisplay = array_merge(array($sTitleAttCode), $aAttCodesToDisplay); + $aAttCodesToDisplay = array_merge([$sTitleAttCode], $aAttCodesToDisplay); } // - Adding attribute properties - $aAttributesToDisplay = array(); + $aAttributesToDisplay = []; foreach ($aAttCodesToDisplay as $sAttCodeToDisplay) { $oAttDefToDisplay = MetaModel::GetAttributeDef($sTargetClass, $sAttCodeToDisplay); $aAttributesToDisplay[$sAttCodeToDisplay] = [ @@ -2495,7 +2398,7 @@ class AttributeLinkedSet extends AttributeDefinition // Append lnk attributes (filtered from zlist) if ($this->IsIndirect()) { $aLnkAttDefToDisplay = MetaModel::GetZListAttDefsFilteredForIndirectLinkClass($this->m_sHostClass, $this->m_sCode); - $aLnkAttributesToDisplay = array(); + $aLnkAttributesToDisplay = []; foreach ($aLnkAttDefToDisplay as $oLnkAttDefToDisplay) { $aLnkAttributesToDisplay[$oLnkAttDefToDisplay->GetCode()] = [ 'att_code' => $oLnkAttDefToDisplay->GetCode(), @@ -2511,59 +2414,59 @@ class AttributeLinkedSet extends AttributeDefinition return $oFormField; } - public function IsPartOfFingerprint() - { - return false; - } + public function IsPartOfFingerprint() + { + return false; + } - /** - * @inheritDoc - * @param \ormLinkSet $proposedValue - */ - public function HasAValue($proposedValue): bool - { - // Protection against wrong value type - if (false === ($proposedValue instanceof ormLinkSet)) { - return parent::HasAValue($proposedValue); - } + /** + * @inheritDoc + * @param \ormLinkSet $proposedValue + */ + public function HasAValue($proposedValue): bool + { + // Protection against wrong value type + if (false === ($proposedValue instanceof ormLinkSet)) { + return parent::HasAValue($proposedValue); + } - // We test if there is at least 1 item in the linkset (new or existing), not if an item is being added to it. - return $proposedValue->Count() > 0; - } + // We test if there is at least 1 item in the linkset (new or existing), not if an item is being added to it. + return $proposedValue->Count() > 0; + } - /** - * SearchSpecificLabel. - * - * @param string $sDictEntrySuffix - * @param string $sDefault - * @param bool $bUserLanguageOnly - * @param ...$aArgs - * @return string - * @since 3.1.0 - */ - public function SearchSpecificLabel(string $sDictEntrySuffix, string $sDefault, bool $bUserLanguageOnly, ...$aArgs): string - { - try { - $sNextClass = $this->m_sHostClass; + /** + * SearchSpecificLabel. + * + * @param string $sDictEntrySuffix + * @param string $sDefault + * @param bool $bUserLanguageOnly + * @param ...$aArgs + * @return string + * @since 3.1.0 + */ + public function SearchSpecificLabel(string $sDictEntrySuffix, string $sDefault, bool $bUserLanguageOnly, ...$aArgs): string + { + try { + $sNextClass = $this->m_sHostClass; - do { - $sKey = "Class:{$sNextClass}/Attribute:{$this->m_sCode}/{$sDictEntrySuffix}"; - if (Dict::S($sKey, null, $bUserLanguageOnly) !== $sKey) { - return Dict::Format($sKey, ...$aArgs); - } - $sNextClass = MetaModel::GetParentClass($sNextClass); - } while ($sNextClass !== null); + do { + $sKey = "Class:{$sNextClass}/Attribute:{$this->m_sCode}/{$sDictEntrySuffix}"; + if (Dict::S($sKey, null, $bUserLanguageOnly) !== $sKey) { + return Dict::Format($sKey, ...$aArgs); + } + $sNextClass = MetaModel::GetParentClass($sNextClass); + } while ($sNextClass !== null); - if (Dict::S($sDictEntrySuffix, null, $bUserLanguageOnly) !== $sKey) { - return Dict::Format($sDictEntrySuffix, ...$aArgs); - } else { - return $sDefault; - } - } catch (Exception $e) { - ExceptionLog::LogException($e); - return $sDefault; - } - } + if (Dict::S($sDictEntrySuffix, null, $bUserLanguageOnly) !== $sKey) { + return Dict::Format($sDictEntrySuffix, ...$aArgs); + } else { + return $sDefault; + } + } catch (Exception $e) { + ExceptionLog::LogException($e); + return $sDefault; + } + } } /** @@ -2592,7 +2495,7 @@ class AttributeLinkedSetIndirect extends AttributeLinkedSet public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array("ext_key_to_remote")); + return array_merge(parent::ListExpectedParams(), ["ext_key_to_remote"]); } public function IsIndirect() @@ -2617,8 +2520,10 @@ class AttributeLinkedSetIndirect extends AttributeLinkedSet public function GetTrackingLevel() { - return $this->GetOptional('tracking_level', - MetaModel::GetConfig()->Get('tracking_level_linked_set_indirect_default')); + return $this->GetOptional( + 'tracking_level', + MetaModel::GetConfig()->Get('tracking_level_linked_set_indirect_default') + ); } /** @@ -2633,7 +2538,7 @@ class AttributeLinkedSetIndirect extends AttributeLinkedSet /** @var \AttributeExternalKey $oExtKeyToRemote */ $oExtKeyToRemote = MetaModel::GetAttributeDef($this->GetLinkedClass(), $this->GetExtKeyToRemote()); $sRemoteClass = $oExtKeyToRemote->GetTargetClass(); - foreach(MetaModel::ListAttributeDefs($sRemoteClass) as $sRemoteAttCode => $oRemoteAttDef) { + foreach (MetaModel::ListAttributeDefs($sRemoteClass) as $sRemoteAttCode => $oRemoteAttDef) { if (!$oRemoteAttDef instanceof AttributeLinkedSetIndirect) { continue; } @@ -2670,7 +2575,7 @@ class AttributeDBFieldVoid extends AttributeDefinition { public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array("allowed_values", "depends_on", "sql")); + return array_merge(parent::ListExpectedParams(), ["allowed_values", "depends_on", "sql"]); } // To be overriden, used in GetSQLColumns @@ -2684,20 +2589,14 @@ class AttributeDBFieldVoid extends AttributeDefinition protected function GetSQLColSpec() { $default = $this->ScalarToSQL($this->GetDefaultValue()); - if (is_null($default)) - { + if (is_null($default)) { $sRet = ''; - } - else - { - if (is_numeric($default)) - { + } else { + if (is_numeric($default)) { // Though it is a string in PHP, it will be considered as a numeric value in MySQL // Then it must not be quoted here, to preserve the compatibility with the value returned by CMDBSource::GetFieldSpec $sRet = " DEFAULT $default"; - } - else - { + } else { $sRet = " DEFAULT ".CMDBSource::Quote($default); } } @@ -2758,7 +2657,7 @@ class AttributeDBFieldVoid extends AttributeDefinition public function GetSQLExpressions($sPrefix = '') { - $aColumns = array(); + $aColumns = []; // Note: to optimize things, the existence of the attribute is determined by the existence of one column with an empty suffix $aColumns[''] = $this->Get("sql"); @@ -2774,7 +2673,7 @@ class AttributeDBFieldVoid extends AttributeDefinition public function GetSQLValues($value) { - $aValues = array(); + $aValues = []; $aValues[$this->Get("sql")] = $this->ScalarToSQL($value); return $aValues; @@ -2782,7 +2681,7 @@ class AttributeDBFieldVoid extends AttributeDefinition public function GetSQLColumns($bFullSpec = false) { - $aColumns = array(); + $aColumns = []; $aColumns[$this->Get("sql")] = $this->GetSQLCol($bFullSpec); return $aColumns; @@ -2790,12 +2689,12 @@ class AttributeDBFieldVoid extends AttributeDefinition public function GetFilterDefinitions() { - return array($this->GetCode() => $this->GetCode()); + return [$this->GetCode() => $this->GetCode()]; } public function GetBasicFilterOperators() { - return array("=" => "equals", "!=" => "differs from"); + return ["=" => "equals", "!=" => "differs from"]; } public function GetBasicFilterLooseOperator() @@ -2806,8 +2705,7 @@ class AttributeDBFieldVoid extends AttributeDefinition public function GetBasicFilterSQLExpr($sOpCode, $value) { $sQValue = CMDBSource::Quote($value); - switch ($sOpCode) - { + switch ($sOpCode) { case '!=': return $this->GetSQLExpr()." != $sQValue"; break; @@ -2827,7 +2725,7 @@ class AttributeDBField extends AttributeDBFieldVoid { public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array("default_value", "is_null_allowed")); + return array_merge(parent::ListExpectedParams(), ["default_value", "is_null_allowed"]); } public function GetDefaultValue(DBObject $oHostObject = null) @@ -2848,7 +2746,7 @@ class AttributeDBField extends AttributeDBFieldVoid */ class AttributeInteger extends AttributeDBField { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_NUMERIC; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_NUMERIC; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -2890,15 +2788,15 @@ class AttributeInteger extends AttributeDBField public function GetBasicFilterOperators() { - return array( + return [ "!=" => "differs from", "=" => "equals", ">" => "greater (strict) than", ">=" => "greater than", "<" => "less (strict) than", "<=" => "less than", - "in" => "in" - ); + "in" => "in", + ]; } public function GetBasicFilterLooseOperator() @@ -2910,8 +2808,7 @@ class AttributeInteger extends AttributeDBField public function GetBasicFilterSQLExpr($sOpCode, $value) { $sQValue = CMDBSource::Quote($value); - switch ($sOpCode) - { + switch ($sOpCode) { case '!=': return $this->GetSQLExpr()." != $sQValue"; break; @@ -2928,8 +2825,7 @@ class AttributeInteger extends AttributeDBField return $this->GetSQLExpr()." <= $sQValue"; break; case 'in': - if (!is_array($value)) - { + if (!is_array($value)) { throw new CoreException("Expected an array for argument value (sOpCode='$sOpCode')"); } @@ -2962,12 +2858,10 @@ class AttributeInteger extends AttributeDBField public function MakeRealValue($proposedValue, $oHostObj) { - if (is_null($proposedValue)) - { + if (is_null($proposedValue)) { return null; } - if ($proposedValue === '') - { + if ($proposedValue === '') { return null; } // 0 is transformed into '' ! @@ -2989,7 +2883,7 @@ class AttributeInteger extends AttributeDBField */ class AttributeObjectKey extends AttributeDBFieldVoid { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_EXTERNAL_KEY; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_EXTERNAL_KEY; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -3010,7 +2904,7 @@ class AttributeObjectKey extends AttributeDBFieldVoid public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array('class_attcode', 'is_null_allowed')); + return array_merge(parent::ListExpectedParams(), ['class_attcode', 'is_null_allowed']); } public function GetEditClass() @@ -3033,7 +2927,6 @@ class AttributeObjectKey extends AttributeDBFieldVoid return $this->Get("is_null_allowed"); } - public function GetBasicFilterOperators() { return parent::GetBasicFilterOperators(); @@ -3067,23 +2960,20 @@ class AttributeObjectKey extends AttributeDBFieldVoid return ((int) $proposedValue) !== 0; } - /** - * @inheritDoc - * - * @param int|DBObject $proposedValue Object key or valid ({@see MetaModel::IsValidObject()}) datamodel object - */ + /** + * @inheritDoc + * + * @param int|DBObject $proposedValue Object key or valid ({@see MetaModel::IsValidObject()}) datamodel object + */ public function MakeRealValue($proposedValue, $oHostObj) { - if (is_null($proposedValue)) - { + if (is_null($proposedValue)) { return 0; } - if ($proposedValue === '') - { + if ($proposedValue === '') { return 0; } - if (MetaModel::IsValidObject($proposedValue)) - { + if (MetaModel::IsValidObject($proposedValue)) { return $proposedValue->GetKey(); } @@ -3098,7 +2988,7 @@ class AttributeObjectKey extends AttributeDBFieldVoid */ class AttributePercentage extends AttributeInteger { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_NUMERIC; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_NUMERIC; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -3121,29 +3011,19 @@ class AttributePercentage extends AttributeInteger { $iWidth = 5; // Total width of the percentage bar graph, in em... $iValue = (int)$sValue; - if ($iValue > 100) - { + if ($iValue > 100) { $iValue = 100; - } - else - { - if ($iValue < 0) - { + } else { + if ($iValue < 0) { $iValue = 0; } } - if ($iValue > 90) - { + if ($iValue > 90) { $sColor = "#cc3300"; - } - else - { - if ($iValue > 50) - { + } else { + if ($iValue > 50) { $sColor = "#cccc00"; - } - else - { + } else { $sColor = "#33cc00"; } } @@ -3163,7 +3043,7 @@ class AttributePercentage extends AttributeInteger */ class AttributeDecimal extends AttributeDBField { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_NUMERIC; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_NUMERIC; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -3184,7 +3064,7 @@ class AttributeDecimal extends AttributeDBField public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array('digits', 'decimals' /* including precision */)); + return array_merge(parent::ListExpectedParams(), ['digits', 'decimals' /* including precision */]); } public function GetEditClass() @@ -3218,15 +3098,15 @@ class AttributeDecimal extends AttributeDBField public function GetBasicFilterOperators() { - return array( + return [ "!=" => "differs from", "=" => "equals", ">" => "greater (strict) than", ">=" => "greater than", "<" => "less (strict) than", "<=" => "less than", - "in" => "in" - ); + "in" => "in", + ]; } public function GetBasicFilterLooseOperator() @@ -3238,8 +3118,7 @@ class AttributeDecimal extends AttributeDBField public function GetBasicFilterSQLExpr($sOpCode, $value) { $sQValue = CMDBSource::Quote($value); - switch ($sOpCode) - { + switch ($sOpCode) { case '!=': return $this->GetSQLExpr()." != $sQValue"; break; @@ -3256,8 +3135,7 @@ class AttributeDecimal extends AttributeDBField return $this->GetSQLExpr()." <= $sQValue"; break; case 'in': - if (!is_array($value)) - { + if (!is_array($value)) { throw new CoreException("Expected an array for argument value (sOpCode='$sOpCode')"); } @@ -3290,12 +3168,10 @@ class AttributeDecimal extends AttributeDBField public function MakeRealValue($proposedValue, $oHostObj) { - if (is_null($proposedValue)) - { + if (is_null($proposedValue)) { return null; } - if ($proposedValue === '') - { + if ($proposedValue === '') { return null; } @@ -3306,8 +3182,7 @@ class AttributeDecimal extends AttributeDBField { assert(is_null($value) || preg_match('/'.$this->GetValidationPattern().'/', $value)); - if (!is_null($value) && ($value !== '')) - { + if (!is_null($value) && ($value !== '')) { $value = sprintf("%1.".$this->Get('decimals')."F", $value); } return $value; // null or string @@ -3321,7 +3196,7 @@ class AttributeDecimal extends AttributeDBField */ class AttributeBoolean extends AttributeInteger { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -3358,16 +3233,13 @@ class AttributeBoolean extends AttributeInteger public function MakeRealValue($proposedValue, $oHostObj) { - if (is_null($proposedValue)) - { + if (is_null($proposedValue)) { return null; } - if ($proposedValue === '') - { + if ($proposedValue === '') { return null; } - if ((int)$proposedValue) - { + if ((int)$proposedValue) { return true; } @@ -3376,8 +3248,7 @@ class AttributeBoolean extends AttributeInteger public function ScalarToSQL($value) { - if ($value) - { + if ($value) { return 1; } @@ -3386,12 +3257,9 @@ class AttributeBoolean extends AttributeInteger public function GetValueLabel($bValue) { - if (is_null($bValue)) - { + if (is_null($bValue)) { $sLabel = Dict::S('Core:'.get_class($this).'/Value:null'); - } - else - { + } else { $sValue = $bValue ? 'yes' : 'no'; $sDefault = Dict::S('Core:'.get_class($this).'/Value:'.$sValue); $sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode.'/Value:'.$sValue, $sDefault, true /*user lang*/); @@ -3402,16 +3270,16 @@ class AttributeBoolean extends AttributeInteger public function GetValueDescription($bValue) { - if (is_null($bValue)) - { + if (is_null($bValue)) { $sDescription = Dict::S('Core:'.get_class($this).'/Value:null+'); - } - else - { + } else { $sValue = $bValue ? 'yes' : 'no'; $sDefault = Dict::S('Core:'.get_class($this).'/Value:'.$sValue.'+'); - $sDescription = $this->SearchLabel('/Attribute:'.$this->m_sCode.'/Value:'.$sValue.'+', $sDefault, - true /*user lang*/); + $sDescription = $this->SearchLabel( + '/Attribute:'.$this->m_sCode.'/Value:'.$sValue.'+', + $sDefault, + true /*user lang*/ + ); } return $sDescription; @@ -3419,19 +3287,14 @@ class AttributeBoolean extends AttributeInteger public function GetAsHTML($bValue, $oHostObject = null, $bLocalize = true) { - if (is_null($bValue)) - { + if (is_null($bValue)) { $sRes = ''; - } - elseif ($bLocalize) - { + } elseif ($bLocalize) { $sLabel = $this->GetValueLabel($bValue); $sDescription = $this->GetValueDescription($bValue); // later, we could imagine a detailed description in the title $sRes = "".parent::GetAsHtml($sLabel).""; - } - else - { + } else { $sRes = $bValue ? 'yes' : 'no'; } @@ -3440,16 +3303,11 @@ class AttributeBoolean extends AttributeInteger public function GetAsXML($bValue, $oHostObject = null, $bLocalize = true) { - if (is_null($bValue)) - { + if (is_null($bValue)) { $sFinalValue = ''; - } - elseif ($bLocalize) - { + } elseif ($bLocalize) { $sFinalValue = $this->GetValueLabel($bValue); - } - else - { + } else { $sFinalValue = $bValue ? 'yes' : 'no'; } $sRes = parent::GetAsXML($sFinalValue, $oHostObject, $bLocalize); @@ -3458,19 +3316,18 @@ class AttributeBoolean extends AttributeInteger } public function GetAsCSV( - $bValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $bValue, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { - if (is_null($bValue)) - { + if (is_null($bValue)) { $sFinalValue = ''; - } - elseif ($bLocalize) - { + } elseif ($bLocalize) { $sFinalValue = $this->GetValueLabel($bValue); - } - else - { + } else { $sFinalValue = $bValue ? 'yes' : 'no'; } $sRes = parent::GetAsCSV($sFinalValue, $sSeparator, $sTextQualifier, $oHostObject, $bLocalize); @@ -3492,13 +3349,12 @@ class AttributeBoolean extends AttributeInteger */ public function MakeFormField(DBObject $oObject, $oFormField = null) { - if ($oFormField === null) - { + if ($oFormField === null) { $sFormFieldClass = static::GetFormFieldClass(); $oFormField = new $sFormFieldClass($this->GetCode()); } - $oFormField->SetChoices(array('yes' => $this->GetValueLabel(true), 'no' => $this->GetValueLabel(false))); + $oFormField->SetChoices(['yes' => $this->GetValueLabel(true), 'no' => $this->GetValueLabel(false)]); parent::MakeFormField($oObject, $oFormField); return $oFormField; @@ -3506,12 +3362,9 @@ class AttributeBoolean extends AttributeInteger public function GetEditValue($value, $oHostObj = null) { - if (is_null($value)) - { + if (is_null($value)) { return ''; - } - else - { + } else { return $this->GetValueLabel($value); } } @@ -3522,14 +3375,16 @@ class AttributeBoolean extends AttributeInteger } public function MakeValueFromString( - $sProposedValue, $bLocalizedValue = false, $sSepItem = null, $sSepAttribute = null, $sSepValue = null, + $sProposedValue, + $bLocalizedValue = false, + $sSepItem = null, + $sSepAttribute = null, + $sSepValue = null, $sAttributeQualifier = null ) { $sInput = mb_strtolower(trim($sProposedValue)); - if ($bLocalizedValue) - { - switch ($sInput) - { + if ($bLocalizedValue) { + switch ($sInput) { case '1': // backward compatibility case $this->GetValueLabel(true): $value = true; @@ -3542,11 +3397,8 @@ class AttributeBoolean extends AttributeInteger default: $value = null; } - } - else - { - switch ($sInput) - { + } else { + switch ($sInput) { case '1': // backward compatibility case 'yes': $value = true; @@ -3573,11 +3425,11 @@ class AttributeBoolean extends AttributeInteger return CMDBChangeOpSetAttributeScalar::class; } - public function GetAllowedValues($aArgs = array(), $sContains = '') : array + public function GetAllowedValues($aArgs = [], $sContains = ''): array { return [ 0 => $this->GetValueLabel(false), - 1 => $this->GetValueLabel(true) + 1 => $this->GetValueLabel(true), ]; } @@ -3594,7 +3446,7 @@ class AttributeBoolean extends AttributeInteger */ class AttributeString extends AttributeDBField { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -3634,12 +3486,9 @@ class AttributeString extends AttributeDBField public function GetValidationPattern() { $sPattern = $this->GetOptional('validation_pattern', ''); - if (empty($sPattern)) - { + if (empty($sPattern)) { return parent::GetValidationPattern(); - } - else - { + } else { return $sPattern; } } @@ -3647,12 +3496,9 @@ class AttributeString extends AttributeDBField public function CheckFormat($value) { $sRegExp = $this->GetValidationPattern(); - if (empty($sRegExp)) - { + if (empty($sRegExp)) { return true; - } - else - { + } else { $sRegExp = str_replace('/', '\\/', $sRegExp); return preg_match("/$sRegExp/", $value); @@ -3666,15 +3512,15 @@ class AttributeString extends AttributeDBField public function GetBasicFilterOperators() { - return array( + return [ "=" => "equals", "!=" => "differs from", "Like" => "equals (no case)", "NotLike" => "differs from (no case)", "Contains" => "contains", "Begins with" => "begins with", - "Finishes with" => "finishes with" - ); + "Finishes with" => "finishes with", + ]; } public function GetBasicFilterLooseOperator() @@ -3685,8 +3531,7 @@ class AttributeString extends AttributeDBField public function GetBasicFilterSQLExpr($sOpCode, $value) { $sQValue = CMDBSource::Quote($value); - switch ($sOpCode) - { + switch ($sOpCode) { case '=': case '!=': return $this->GetSQLExpr()." $sOpCode $sQValue"; @@ -3724,8 +3569,7 @@ class AttributeString extends AttributeDBField public function MakeRealValue($proposedValue, $oHostObj) { - if (is_null($proposedValue)) - { + if (is_null($proposedValue)) { return ''; } @@ -3734,25 +3578,28 @@ class AttributeString extends AttributeDBField public function ScalarToSQL($value) { - if (!is_string($value) && !is_null($value)) - { - throw new CoreWarning('Expected the attribute value to be a string', array( + if (!is_string($value) && !is_null($value)) { + throw new CoreWarning('Expected the attribute value to be a string', [ 'found_type' => gettype($value), 'value' => $value, 'class' => $this->GetHostClass(), - 'attribute' => $this->GetCode() - )); + 'attribute' => $this->GetCode(), + ]); } return $value; } public function GetAsCSV( - $sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $sValue, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { - $sFrom = array("\r\n", $sTextQualifier); - $sTo = array("\n", $sTextQualifier.$sTextQualifier); + $sFrom = ["\r\n", $sTextQualifier]; + $sTo = ["\n", $sTextQualifier.$sTextQualifier]; $sEscaped = str_replace($sFrom, $sTo, (string)$sValue); return $sTextQualifier.$sEscaped.$sTextQualifier; @@ -3770,8 +3617,7 @@ class AttributeString extends AttributeDBField public function MakeFormField(DBObject $oObject, $oFormField = null) { - if ($oFormField === null) - { + if ($oFormField === null) { $sFormFieldClass = static::GetFormFieldClass(); $oFormField = new $sFormFieldClass($this->GetCode()); } @@ -3789,11 +3635,11 @@ class AttributeString extends AttributeDBField */ class AttributeClass extends AttributeString { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_ENUM; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_ENUM; public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array("class_category", "more_values")); + return array_merge(parent::ListExpectedParams(), ["class_category", "more_values"]); } public function __construct($sCode, $aParams) @@ -3806,8 +3652,7 @@ class AttributeClass extends AttributeString public function GetDefaultValue(DBObject $oHostObject = null) { $sDefault = parent::GetDefaultValue($oHostObject); - if (!$this->IsNullAllowed() && $this->IsNull($sDefault)) - { + if (!$this->IsNullAllowed() && $this->IsNull($sDefault)) { // For this kind of attribute specifying null as default value // is authorized even if null is not allowed @@ -3821,8 +3666,7 @@ class AttributeClass extends AttributeString public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) { - if (empty($sValue)) - { + if (empty($sValue)) { return ''; } @@ -3841,7 +3685,6 @@ class AttributeClass extends AttributeString } - /** * An attribute that matches a class state * @@ -3849,7 +3692,7 @@ class AttributeClass extends AttributeString */ class AttributeClassState extends AttributeString { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -3870,23 +3713,20 @@ class AttributeClassState extends AttributeString public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array('class_field')); + return array_merge(parent::ListExpectedParams(), ['class_field']); } - public function GetAllowedValues($aArgs = array(), $sContains = '') + public function GetAllowedValues($aArgs = [], $sContains = '') { - if (isset($aArgs['this'])) - { + if (isset($aArgs['this'])) { $oHostObj = $aArgs['this']; $sTargetClass = $this->Get('class_field'); $sClass = $oHostObj->Get($sTargetClass); - $aAllowedStates = array(); - foreach (MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL) as $sChildClass) - { + $aAllowedStates = []; + foreach (MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL) as $sChildClass) { $aValues = MetaModel::EnumStates($sChildClass); - foreach (array_keys($aValues) as $sState) - { + foreach (array_keys($aValues) as $sState) { $aAllowedStates[$sState] = $sState.' ('.MetaModel::GetStateLabel($sChildClass, $sState).')'; } } @@ -3898,20 +3738,16 @@ class AttributeClassState extends AttributeString public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) { - if (empty($sValue)) - { + if (empty($sValue)) { return ''; } - if (!empty($oHostObject)) - { + if (!empty($oHostObject)) { $sTargetClass = $this->Get('class_field'); $sClass = $oHostObject->Get($sTargetClass); - foreach (MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL) as $sChildClass) - { + foreach (MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL) as $sChildClass) { $aValues = MetaModel::EnumStates($sChildClass); - if (in_array($sValue, $aValues)) - { + if (in_array($sValue, $aValues)) { $sLabelForHtmlAttribute = utils::EscapeHtml($sValue.' ('.MetaModel::GetStateLabel($sChildClass, $sValue).')'); $sHTML = ''.$sValue.''; @@ -3932,7 +3768,7 @@ class AttributeClassState extends AttributeString */ class AttributeApplicationLanguage extends AttributeString { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; public static function ListExpectedParams() { @@ -3943,9 +3779,8 @@ class AttributeApplicationLanguage extends AttributeString { $this->m_sCode = $sCode; $aAvailableLanguages = Dict::GetLanguages(); - $aLanguageCodes = array(); - foreach($aAvailableLanguages as $sLangCode => $aInfo) - { + $aLanguageCodes = []; + foreach ($aAvailableLanguages as $sLangCode => $aInfo) { $aLanguageCodes[$sLangCode] = $aInfo['description'].' ('.$aInfo['localized_description'].')'; } @@ -3976,7 +3811,7 @@ class AttributeApplicationLanguage extends AttributeString */ class AttributeFinalClass extends AttributeString { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; public $m_sValue; public function __construct($sCode, $aParams) @@ -4015,16 +3850,12 @@ class AttributeFinalClass extends AttributeString public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) { - if (empty($sValue)) - { + if (empty($sValue)) { return ''; } - if ($bLocalize) - { + if ($bLocalize) { return MetaModel::GetName($sValue); - } - else - { + } else { return $sValue; } } @@ -4044,46 +3875,47 @@ class AttributeFinalClass extends AttributeString * @throws \OQLException */ public function MakeValueFromString( - $sProposedValue, $bLocalizedValue = false, $sSepItem = null, $sSepAttribute = null, $sSepValue = null, + $sProposedValue, + $bLocalizedValue = false, + $sSepItem = null, + $sSepAttribute = null, + $sSepValue = null, $sAttributeQualifier = null ) { - if ($bLocalizedValue) - { + if ($bLocalizedValue) { // Lookup for the value matching the input // $sFoundValue = null; $aRawValues = self::GetAllowedValues(); - if (!is_null($aRawValues)) - { - foreach($aRawValues as $sKey => $sValue) - { - if ($sProposedValue == $sValue) - { + if (!is_null($aRawValues)) { + foreach ($aRawValues as $sKey => $sValue) { + if ($sProposedValue == $sValue) { $sFoundValue = $sKey; break; } } } - if (is_null($sFoundValue)) - { + if (is_null($sFoundValue)) { return null; } return $this->MakeRealValue($sFoundValue, null); - } - else - { - return parent::MakeValueFromString($sProposedValue, $bLocalizedValue, $sSepItem, $sSepAttribute, $sSepValue, - $sAttributeQualifier); + } else { + return parent::MakeValueFromString( + $sProposedValue, + $bLocalizedValue, + $sSepItem, + $sSepAttribute, + $sSepValue, + $sAttributeQualifier + ); } } - // Because this is sometimes used to get a localized/string version of an attribute... public function GetEditValue($sValue, $oHostObj = null) { - if (empty($sValue)) - { + if (empty($sValue)) { return ''; } @@ -4109,15 +3941,16 @@ class AttributeFinalClass extends AttributeString * @throws \DictExceptionMissingString */ public function GetAsCSV( - $value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $value, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { - if ($bLocalize && $value != '') - { + if ($bLocalize && $value != '') { $sRawValue = MetaModel::GetName($value); - } - else - { + } else { $sRawValue = $value; } @@ -4126,16 +3959,12 @@ class AttributeFinalClass extends AttributeString public function GetAsXML($value, $oHostObject = null, $bLocalize = true) { - if (empty($value)) - { + if (empty($value)) { return ''; } - if ($bLocalize) - { + if ($bLocalize) { $sRawValue = MetaModel::GetName($value); - } - else - { + } else { $sRawValue = $value; } @@ -4149,20 +3978,18 @@ class AttributeFinalClass extends AttributeString public function GetValueLabel($sValue) { - if (empty($sValue)) - { + if (empty($sValue)) { return ''; } return MetaModel::GetName($sValue); } - public function GetAllowedValues($aArgs = array(), $sContains = '') + public function GetAllowedValues($aArgs = [], $sContains = '') { $aRawValues = MetaModel::EnumChildClasses($this->GetHostClass(), ENUM_CHILD_CLASSES_ALL); - $aLocalizedValues = array(); - foreach($aRawValues as $sClass) - { + $aLocalizedValues = []; + foreach ($aRawValues as $sClass) { $aLocalizedValues[$sClass] = MetaModel::GetName($sClass); } @@ -4176,8 +4003,7 @@ class AttributeFinalClass extends AttributeString public function CopyOnAllTables() { $sClass = self::GetHostClass(); - if (MetaModel::IsLeafClass($sClass)) - { + if (MetaModel::IsLeafClass($sClass)) { // Leaf class, no finalclass return false; } @@ -4185,7 +4011,6 @@ class AttributeFinalClass extends AttributeString } } - /** * Map a varchar column (size < ?) to an attribute that must never be shown to the user * @@ -4193,7 +4018,7 @@ class AttributeFinalClass extends AttributeString */ class AttributePassword extends AttributeString implements iAttributeNoGroupBy { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -4239,17 +4064,14 @@ class AttributePassword extends AttributeString implements iAttributeNoGroupBy { // Note: due to this, you will get an error if a password is being declared as a search criteria (see ZLists) // not allowed to search on passwords! - return array(); + return []; } public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) { - if (utils::IsNullOrEmptyString($sValue)) - { + if (utils::IsNullOrEmptyString($sValue)) { return ''; - } - else - { + } else { return '******'; } } @@ -4270,7 +4092,7 @@ class AttributePassword extends AttributeString implements iAttributeNoGroupBy */ class AttributeEncryptedString extends AttributeString implements iAttributeNoGroupBy { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; protected function GetSQLCol($bFullSpec = false) { @@ -4286,13 +4108,12 @@ class AttributeEncryptedString extends AttributeString implements iAttributeNoGr { // Note: due to this, you will get an error if a an encrypted field is declared as a search criteria (see ZLists) // not allowed to search on encrypted fields ! - return array(); + return []; } public function MakeRealValue($proposedValue, $oHostObj) { - if (is_null($proposedValue)) - { + if (is_null($proposedValue)) { return null; } @@ -4329,7 +4150,7 @@ class AttributeEncryptedString extends AttributeString implements iAttributeNoGr $oSimpleCrypt = new SimpleCrypt(MetaModel::GetConfig()->GetEncryptionLibrary()); $encryptedValue = $oSimpleCrypt->Encrypt(MetaModel::GetConfig()->GetEncryptionKey(), $value); - $aValues = array(); + $aValues = []; $aValues[$this->Get("sql")] = $encryptedValue; return $aValues; @@ -4348,10 +4169,8 @@ class AttributeEncryptedString extends AttributeString implements iAttributeNoGr return CMDBChangeOpSetAttributeEncrypted::class; } - } - /** * Wiki formatting - experimental * @@ -4366,7 +4185,6 @@ class AttributeEncryptedString extends AttributeString implements iAttributeNoGr */ define('WIKI_OBJECT_REGEXP', '/\[\[(.+):(.+)(\|(.+))?\]\]/U'); - /** * Map a text column (size > ?) to an attribute * @@ -4403,14 +4221,12 @@ class AttributeText extends AttributeString public function GetSQLColumns($bFullSpec = false) { - $aColumns = array(); + $aColumns = []; $aColumns[$this->Get('sql')] = $this->GetSQLCol($bFullSpec); - if ($this->GetOptional('format', null) != null) - { + if ($this->GetOptional('format', null) != null) { // Add the extra column only if the property 'format' is specified for the attribute $aColumns[$this->Get('sql').'_format'] = "ENUM('text','html')".CMDBSource::GetSqlStringColumnDefinition(); - if ($bFullSpec) - { + if ($bFullSpec) { $aColumns[$this->Get('sql').'_format'] .= " DEFAULT 'text'"; // default 'text' is for migrating old records } } @@ -4420,15 +4236,13 @@ class AttributeText extends AttributeString public function GetSQLExpressions($sPrefix = '') { - if ($sPrefix == '') - { + if ($sPrefix == '') { $sPrefix = $this->Get('sql'); } - $aColumns = array(); + $aColumns = []; // Note: to optimize things, the existence of the attribute is determined by the existence of one column with an empty suffix $aColumns[''] = $sPrefix; - if ($this->GetOptional('format', null) != null) - { + if ($this->GetOptional('format', null) != null) { // Add the extra column only if the property 'format' is specified for the attribute $aColumns['_format'] = $sPrefix.'_format'; } @@ -4445,19 +4259,20 @@ class AttributeText extends AttributeString public static function RenderWikiHtml($sText, $bWikiOnly = false) { - if (!$bWikiOnly) - { + if (!$bWikiOnly) { $sPattern = '/'.str_replace('/', '\/', utils::GetConfig()->Get('url_validation_pattern')).'/i'; - if (preg_match_all($sPattern, $sText, $aAllMatches, - PREG_SET_ORDER /* important !*/ | PREG_OFFSET_CAPTURE /* important ! */)) - { + if (preg_match_all( + $sPattern, + $sText, + $aAllMatches, + PREG_SET_ORDER /* important !*/ | PREG_OFFSET_CAPTURE /* important ! */ + )) { $i = count($aAllMatches); // Replace the URLs by an actual hyperlink
      ... // Let's do it backwards so that the initial positions are not modified by the replacement // This works if the matches are captured: in the order they occur in the string AND // with their offset (i.e. position) inside the string - while ($i > 0) - { + while ($i > 0) { $i--; $sUrl = $aAllMatches[$i][0][0]; // String corresponding to the main pattern $iPos = $aAllMatches[$i][0][1]; // Position of the main pattern @@ -4466,40 +4281,31 @@ class AttributeText extends AttributeString } } } - if (preg_match_all(WIKI_OBJECT_REGEXP, $sText, $aAllMatches, PREG_SET_ORDER)) - { - foreach($aAllMatches as $iPos => $aMatches) - { + if (preg_match_all(WIKI_OBJECT_REGEXP, $sText, $aAllMatches, PREG_SET_ORDER)) { + foreach ($aAllMatches as $iPos => $aMatches) { $sClass = trim($aMatches[1]); $sName = trim($aMatches[2]); $sLabel = (!empty($aMatches[4])) ? trim($aMatches[4]) : null; - if (MetaModel::IsValidClass($sClass)) - { - $bFound = false; + if (MetaModel::IsValidClass($sClass)) { + $bFound = false; - // Try to find by name, then by id - if (is_object($oObj = MetaModel::GetObjectByName($sClass, $sName, false /* MustBeFound */))) - { - $bFound = true; - } - elseif(is_object($oObj = MetaModel::GetObject($sClass, (int) $sName, false /* MustBeFound */, true))) - { - $bFound = true; - } - - if($bFound === true) - { - // Propose a std link to the object - $sHyperlinkLabel = (empty($sLabel)) ? $oObj->GetName() : $sLabel; - $sText = str_replace($aMatches[0], $oObj->GetHyperlink(null, true, $sHyperlinkLabel), $sText); + // Try to find by name, then by id + if (is_object($oObj = MetaModel::GetObjectByName($sClass, $sName, false /* MustBeFound */))) { + $bFound = true; + } elseif (is_object($oObj = MetaModel::GetObject($sClass, (int) $sName, false /* MustBeFound */, true))) { + $bFound = true; } - else - { + + if ($bFound === true) { + // Propose a std link to the object + $sHyperlinkLabel = (empty($sLabel)) ? $oObj->GetName() : $sLabel; + $sText = str_replace($aMatches[0], $oObj->GetHyperlink(null, true, $sHyperlinkLabel), $sText); + } else { // Propose a std link to the object $sClassLabel = MetaModel::GetName($sClass); $sToolTipForHtml = utils::EscapeHtml(Dict::Format('Core:UnknownObjectLabel', $sClass, $sName)); - $sReplacement = "$sClassLabel:$sName" . (!empty($sLabel) ? " ($sLabel)" : "") . ""; + $sReplacement = "$sClassLabel:$sName".(!empty($sLabel) ? " ($sLabel)" : "").""; $sText = str_replace($aMatches[0], $sReplacement, $sText); // Later: propose a link to create a new object // Anyhow... there is no easy way to suggest default values based on the given FRIENDLY name @@ -4514,31 +4320,25 @@ class AttributeText extends AttributeString public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) { - $aStyles = array(); - if ($this->GetWidth() != '') - { + $aStyles = []; + if ($this->GetWidth() != '') { $aStyles[] = 'width:'.$this->GetWidth(); } - if ($this->GetHeight() != '') - { + if ($this->GetHeight() != '') { $aStyles[] = 'height:'.$this->GetHeight(); } $sStyle = ''; - if (count($aStyles) > 0) - { + if (count($aStyles) > 0) { $sStyle = 'style="'.implode(';', $aStyles).'"'; } - if ($this->GetFormat() == 'text') - { + if ($this->GetFormat() == 'text') { $sValue = parent::GetAsHTML($sValue, $oHostObject, $bLocalize); $sValue = self::RenderWikiHtml($sValue); $sValue = nl2br($sValue); return "
      $sValue
      "; - } - else - { + } else { $sValue = self::RenderWikiHtml($sValue, true /* wiki only */); return "
      ".InlineImage::FixUrls($sValue).'
      '; @@ -4582,12 +4382,9 @@ class AttributeText extends AttributeString */ public function GetAsPlainText($sValue, $oHostObj = null) { - if ($this->GetFormat() == 'html') - { + if ($this->GetFormat() == 'html') { return (string)utils::HtmlToText($this->GetEditValue($sValue, $oHostObj)); - } - else - { + } else { return parent::GetAsPlainText($sValue, $oHostObj); } } @@ -4659,8 +4456,7 @@ class AttributeText extends AttributeString */ public function MakeFormField(DBObject $oObject, $oFormField = null) { - if ($oFormField === null) - { + if ($oFormField === null) { $sFormFieldClass = static::GetFormFieldClass(); /** @var \Combodo\iTop\Form\Field\TextAreaField $oFormField */ $oFormField = new $sFormFieldClass($this->GetCode(), null, $oObject); @@ -4695,32 +4491,24 @@ class AttributeText extends AttributeString public function FromSQLToValue($aCols, $sPrefix = '') { $value = $aCols[$sPrefix.'']; - if ($this->GetOptional('format', null) != null) - { + if ($this->GetOptional('format', null) != null) { // Read from the extra column only if the property 'format' is specified for the attribute $sFormat = $aCols[$sPrefix.'_format']; - } - else - { + } else { $sFormat = $this->GetFormat(); } - switch ($sFormat) - { + switch ($sFormat) { case 'text': - if ($this->GetFormat() == 'html') - { + if ($this->GetFormat() == 'html') { $value = utils::TextToHtml($value); } break; case 'html': - if ($this->GetFormat() == 'text') - { + if ($this->GetFormat() == 'text') { $value = utils::HtmlToText($value); - } - else - { + } else { $value = InlineImage::FixUrls((string)$value); } break; @@ -4734,10 +4522,9 @@ class AttributeText extends AttributeString public function GetSQLValues($value) { - $aValues = array(); + $aValues = []; $aValues[$this->Get("sql")] = $this->ScalarToSQL($value); - if ($this->GetOptional('format', null) != null) - { + if ($this->GetOptional('format', null) != null) { // Add the extra column only if the property 'format' is specified for the attribute $aValues[$this->Get("sql").'_format'] = $this->GetFormat(); } @@ -4746,18 +4533,20 @@ class AttributeText extends AttributeString } public function GetAsCSV( - $sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $sValue, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { - switch ($this->GetFormat()) - { + switch ($this->GetFormat()) { case 'html': - if ($bConvertToPlainText) - { + if ($bConvertToPlainText) { $sValue = utils::HtmlToText((string)$sValue); } - $sFrom = array("\r\n", $sTextQualifier); - $sTo = array("\n", $sTextQualifier.$sTextQualifier); + $sFrom = ["\r\n", $sTextQualifier]; + $sTo = ["\n", $sTextQualifier.$sTextQualifier]; $sEscaped = str_replace($sFrom, $sTo, (string)$sValue); return $sTextQualifier.$sEscaped.$sTextQualifier; @@ -4765,8 +4554,14 @@ class AttributeText extends AttributeString case 'text': default: - return parent::GetAsCSV($sValue, $sSeparator, $sTextQualifier, $oHostObject, $bLocalize, - $bConvertToPlainText); + return parent::GetAsCSV( + $sValue, + $sSeparator, + $sTextQualifier, + $oHostObject, + $bLocalize, + $bConvertToPlainText + ); } } @@ -4838,7 +4633,7 @@ class AttributeLongText extends AttributeText */ class AttributeCaseLog extends AttributeLongText { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -4864,8 +4659,7 @@ class AttributeCaseLog extends AttributeLongText public function IsNull($proposedValue) { - if (!($proposedValue instanceof ormCaseLog)) - { + if (!($proposedValue instanceof ormCaseLog)) { return ($proposedValue == ''); } @@ -4887,17 +4681,15 @@ class AttributeCaseLog extends AttributeLongText return $proposedValue->GetEntryCount() > 0; } - public function ScalarToSQL($value) { - if (!is_string($value) && !is_null($value)) - { - throw new CoreWarning('Expected the attribute value to be a string', array( + if (!is_string($value) && !is_null($value)) { + throw new CoreWarning('Expected the attribute value to be a string', [ 'found_type' => gettype($value), 'value' => $value, 'class' => $this->GetCode(), - 'attribute' => $this->GetHostClass() - )); + 'attribute' => $this->GetHostClass(), + ]); } return $value; @@ -4910,8 +4702,7 @@ class AttributeCaseLog extends AttributeLongText public function GetEditValue($sValue, $oHostObj = null) { - if (!($sValue instanceOf ormCaseLog)) - { + if (!($sValue instanceof ormCaseLog)) { return ''; } @@ -4928,13 +4719,10 @@ class AttributeCaseLog extends AttributeLongText */ public function GetAsPlainText($value, $oHostObj = null) { - if ($value instanceOf ormCaseLog) - { + if ($value instanceof ormCaseLog) { /** ormCaseLog $value */ return $value->GetAsPlainText(); - } - else - { + } else { return (string)$value; } } @@ -4949,7 +4737,6 @@ class AttributeCaseLog extends AttributeLongText return ($val1->GetText() == $val2->GetText()); } - /** * Facilitate things: allow the user to Set the value from a string * @@ -4961,44 +4748,33 @@ class AttributeCaseLog extends AttributeLongText */ public function MakeRealValue($proposedValue, $oHostObj) { - if ($proposedValue instanceof ormCaseLog) - { + if ($proposedValue instanceof ormCaseLog) { // Passthrough $ret = clone $proposedValue; - } - else - { + } else { // Append the new value if an instance of the object is supplied // $oPreviousLog = null; - if ($oHostObj != null) - { + if ($oHostObj != null) { $oPreviousLog = $oHostObj->Get($this->GetCode()); - if (!is_object($oPreviousLog)) - { - $oPreviousLog = $oHostObj->GetOriginal($this->GetCode());; + if (!is_object($oPreviousLog)) { + $oPreviousLog = $oHostObj->GetOriginal($this->GetCode()); + ; } } - if (is_object($oPreviousLog)) - { + if (is_object($oPreviousLog)) { $oCaseLog = clone($oPreviousLog); - } - else - { + } else { $oCaseLog = new ormCaseLog(); } - if ($proposedValue instanceof stdClass) - { + if ($proposedValue instanceof stdClass) { $oCaseLog->AddLogEntryFromJSON($proposedValue); - } - else - { - if (utils::StrLen($proposedValue) > 0) - { + } else { + if (utils::StrLen($proposedValue) > 0) { //N°5135 - add impersonation information in caselog - if (UserRights::IsImpersonated()){ + if (UserRights::IsImpersonated()) { $sOnBehalfOf = Dict::Format('UI:Archive_User_OnBehalfOf_User', UserRights::GetRealUserFriendlyName(), UserRights::GetUserFriendlyName()); $oCaseLog->AddLogEntry($proposedValue, $sOnBehalfOf, UserRights::GetConnectedUserId()); } else { @@ -5014,11 +4790,10 @@ class AttributeCaseLog extends AttributeLongText public function GetSQLExpressions($sPrefix = '') { - if ($sPrefix == '') - { + if ($sPrefix == '') { $sPrefix = $this->Get('sql'); } - $aColumns = array(); + $aColumns = []; // Note: to optimize things, the existence of the attribute is determined by the existence of one column with an empty suffix $aColumns[''] = $sPrefix; $aColumns['_index'] = $sPrefix.'_index'; @@ -5035,30 +4810,23 @@ class AttributeCaseLog extends AttributeLongText */ public function FromSQLToValue($aCols, $sPrefix = '') { - if (!array_key_exists($sPrefix, $aCols)) - { + if (!array_key_exists($sPrefix, $aCols)) { $sAvailable = implode(', ', array_keys($aCols)); throw new MissingColumnException("Missing column '$sPrefix' from {$sAvailable}"); } $sLog = $aCols[$sPrefix]; - if (isset($aCols[$sPrefix.'_index'])) - { + if (isset($aCols[$sPrefix.'_index'])) { $sIndex = $aCols[$sPrefix.'_index']; - } - else - { + } else { // For backward compatibility, allow the current state to be: 1 log, no index $sIndex = ''; } - if (strlen($sIndex) > 0) - { + if (strlen($sIndex) > 0) { $aIndex = unserialize($sIndex); $value = new ormCaseLog($sLog, $aIndex); - } - else - { + } else { $value = new ormCaseLog($sLog); } @@ -5067,11 +4835,10 @@ class AttributeCaseLog extends AttributeLongText public function GetSQLValues($value) { - if (!($value instanceOf ormCaseLog)) - { + if (!($value instanceof ormCaseLog)) { $value = new ormCaseLog(''); } - $aValues = array(); + $aValues = []; $aValues[$this->GetCode()] = $value->GetText(); $aValues[$this->GetCode().'_index'] = serialize($value->GetIndex()); @@ -5080,7 +4847,7 @@ class AttributeCaseLog extends AttributeLongText public function GetSQLColumns($bFullSpec = false) { - $aColumns = array(); + $aColumns = []; $aColumns[$this->GetCode()] = 'LONGTEXT' // 2^32 (4 Gb) .CMDBSource::GetSqlStringColumnDefinition(); $aColumns[$this->GetCode().'_index'] = 'BLOB'; @@ -5090,56 +4857,53 @@ class AttributeCaseLog extends AttributeLongText public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { - if ($value instanceOf ormCaseLog) - { - $sContent = $value->GetAsHTML(null, false, array(__class__, 'RenderWikiHtml')); - } - else - { + if ($value instanceof ormCaseLog) { + $sContent = $value->GetAsHTML(null, false, [__class__, 'RenderWikiHtml']); + } else { $sContent = ''; } - $aStyles = array(); - if ($this->GetWidth() != '') - { + $aStyles = []; + if ($this->GetWidth() != '') { $aStyles[] = 'width:'.$this->GetWidth(); } - if ($this->GetHeight() != '') - { + if ($this->GetHeight() != '') { $aStyles[] = 'height:'.$this->GetHeight(); } $sStyle = ''; - if (count($aStyles) > 0) - { + if (count($aStyles) > 0) { $sStyle = 'style="'.implode(';', $aStyles).'"'; } return "
      ".$sContent.'
      '; } - public function GetAsCSV( - $value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $value, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { - if ($value instanceOf ormCaseLog) - { - return parent::GetAsCSV($value->GetText($bConvertToPlainText), $sSeparator, $sTextQualifier, $oHostObject, - $bLocalize, $bConvertToPlainText); - } - else - { + if ($value instanceof ormCaseLog) { + return parent::GetAsCSV( + $value->GetText($bConvertToPlainText), + $sSeparator, + $sTextQualifier, + $oHostObject, + $bLocalize, + $bConvertToPlainText + ); + } else { return ''; } } public function GetAsXML($value, $oHostObject = null, $bLocalize = true) { - if ($value instanceOf ormCaseLog) - { + if ($value instanceof ormCaseLog) { return parent::GetAsXML($value->GetText(), $oHostObject, $bLocalize); - } - else - { + } else { return ''; } } @@ -5149,12 +4913,12 @@ class AttributeCaseLog extends AttributeLongText */ public function EnumTemplateVerbs() { - return array( + return [ '' => 'Plain text representation of all the log entries', 'head' => 'Plain text representation of the latest entry', 'head_html' => 'HTML representation of the latest entry', 'html' => 'HTML representation of all the log entries', - ); + ]; } /** @@ -5170,8 +4934,7 @@ class AttributeCaseLog extends AttributeLongText */ public function GetForTemplate($value, $sVerb, $oHostObject = null, $bLocalize = true) { - switch ($sVerb) - { + switch ($sVerb) { case '': return $value->GetText(true); @@ -5196,24 +4959,17 @@ class AttributeCaseLog extends AttributeLongText public function FromJSONToValue($json) { - if (is_string($json)) - { + if (is_string($json)) { // Will be correctly handled in MakeRealValue $ret = $json; - } - else - { - if (isset($json->add_item)) - { + } else { + if (isset($json->add_item)) { // Will be correctly handled in MakeRealValue $ret = $json->add_item; - if (!isset($ret->message)) - { + if (!isset($ret->message)) { throw new Exception("Missing mandatory entry: 'message'"); } - } - else - { + } else { $ret = ormCaseLog::FromJSON($json); } } @@ -5224,8 +4980,7 @@ class AttributeCaseLog extends AttributeLongText public function Fingerprint($value) { $sFingerprint = ''; - if ($value instanceOf ormCaseLog) - { + if ($value instanceof ormCaseLog) { $sFingerprint = $value->GetText(); } @@ -5297,14 +5052,12 @@ class AttributeHTML extends AttributeLongText public function GetSQLColumns($bFullSpec = false) { - $aColumns = array(); + $aColumns = []; $aColumns[$this->Get('sql')] = $this->GetSQLCol(); - if ($this->GetOptional('format', null) != null) - { + if ($this->GetOptional('format', null) != null) { // Add the extra column only if the property 'format' is specified for the attribute $aColumns[$this->Get('sql').'_format'] = "ENUM('text','html')"; - if ($bFullSpec) - { + if ($bFullSpec) { $aColumns[$this->Get('sql').'_format'] .= " DEFAULT 'html'"; // default 'html' is for migrating old records } } @@ -5359,8 +5112,7 @@ class AttributeEmailAddress extends AttributeString public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) { - if (empty($sValue)) - { + if (empty($sValue)) { return ''; } @@ -5404,7 +5156,7 @@ class AttributeIPAddress extends AttributeString public function GetOrderBySQLExpressions($sClassAlias) { // Note: This is the responsibility of this function to place backticks around column aliases - return array('INET_ATON(`'.$sClassAlias.$this->GetCode().'`)'); + return ['INET_ATON(`'.$sClassAlias.$this->GetCode().'`)']; } } @@ -5434,8 +5186,10 @@ class AttributePhoneNumber extends AttributeString public function GetValidationPattern() { - return $this->GetOptional('validation_pattern', - '^'.utils::GetConfig()->Get('phone_number_validation_pattern').'$'); + return $this->GetOptional( + 'validation_pattern', + '^'.utils::GetConfig()->Get('phone_number_validation_pattern').'$' + ); } public static function GetFormFieldClass() @@ -5445,8 +5199,7 @@ class AttributePhoneNumber extends AttributeString public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) { - if (empty($sValue)) - { + if (empty($sValue)) { return ''; } @@ -5466,7 +5219,7 @@ class AttributePhoneNumber extends AttributeString */ class AttributeOQL extends AttributeText { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -5498,7 +5251,7 @@ class AttributeOQL extends AttributeText */ class AttributeTemplateString extends AttributeString { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -5525,7 +5278,7 @@ class AttributeTemplateString extends AttributeString */ class AttributeTemplateText extends AttributeText { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -5552,7 +5305,7 @@ class AttributeTemplateText extends AttributeText */ class AttributeTemplateHTML extends AttributeText { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -5573,14 +5326,12 @@ class AttributeTemplateHTML extends AttributeText public function GetSQLColumns($bFullSpec = false) { - $aColumns = array(); + $aColumns = []; $aColumns[$this->Get('sql')] = $this->GetSQLCol(); - if ($this->GetOptional('format', null) != null) - { + if ($this->GetOptional('format', null) != null) { // Add the extra column only if the property 'format' is specified for the attribute $aColumns[$this->Get('sql').'_format'] = "ENUM('text','html')"; - if ($bFullSpec) - { + if ($bFullSpec) { $aColumns[$this->Get('sql').'_format'] .= " DEFAULT 'html'"; // default 'html' is for migrating old records } } @@ -5599,7 +5350,6 @@ class AttributeTemplateHTML extends AttributeText } } - /** * Map a enum column to an attribute * @@ -5607,7 +5357,7 @@ class AttributeTemplateHTML extends AttributeText */ class AttributeEnum extends AttributeString { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_ENUM; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_ENUM; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -5675,20 +5425,15 @@ class AttributeEnum extends AttributeString protected function GetSQLColHelper($bFullSpec = false, $bIncludeActualValues = false, $sSQLTableName = null) { $oValDef = $this->GetValuesDef(); - if ($oValDef) - { - $aValues = CMDBSource::Quote(array_keys($oValDef->GetValues(array(), "")), true); - } - else - { - $aValues = array(); + if ($oValDef) { + $aValues = CMDBSource::Quote(array_keys($oValDef->GetValues([], "")), true); + } else { + $aValues = []; } // Preserve the values already present in the database to ease migrations - if ($bIncludeActualValues) - { - if ($sSQLTableName == null) - { + if ($bIncludeActualValues) { + if ($sSQLTableName == null) { // No SQL table given, use the one of the attribute $sHostClass = $this->GetHostClass(); $sSQLTableName = MetaModel::DBGetTable($sHostClass, $this->GetCode()); @@ -5696,8 +5441,7 @@ class AttributeEnum extends AttributeString $aValues = array_unique(array_merge($aValues, $this->GetActualValuesInDB($sSQLTableName))); } - if (count($aValues) > 0) - { + if (count($aValues) > 0) { // The syntax used here do matters // In particular, I had to remove unnecessary spaces to // make sure that this string will match the field type returned by the DB @@ -5705,9 +5449,7 @@ class AttributeEnum extends AttributeString return "ENUM(".implode(",", $aValues).")" .CMDBSource::GetSqlStringColumnDefinition() .($bFullSpec ? $this->GetSQLColSpec() : ''); - } - else - { + } else { return "VARCHAR(255)" .CMDBSource::GetSqlStringColumnDefinition() .($bFullSpec ? " DEFAULT ''" : ""); // ENUM() is not an allowed syntax! @@ -5725,7 +5467,7 @@ class AttributeEnum extends AttributeString // Right now the function is not passed the "target" SQL table, but if we improve this in the future // we may call $this->GetSQLColHelper(true, true, $sDBTable); to take into account the actual 'enum' values // in this table - return array($this->GetCode() => $this->GetSQLColHelper(false, false)); + return [$this->GetCode() => $this->GetSQLColHelper(false, false)]; } /** @@ -5735,21 +5477,16 @@ class AttributeEnum extends AttributeString */ protected function GetActualValuesInDB(string $sDBTable) { - $aValues = array(); - try - { + $aValues = []; + try { $sSQL = "SELECT DISTINCT `".$this->GetSQLExpr()."` AS value FROM `$sDBTable`;"; $aValuesInDB = CMDBSource::QueryToArray($sSQL); - foreach($aValuesInDB as $aRow) - { - if ($aRow['value'] !== null) - { + foreach ($aValuesInDB as $aRow) { + if ($aRow['value'] !== null) { $aValues[] = $aRow['value']; } } - } - catch(MySQLException $e) - { + } catch (MySQLException $e) { // Never mind, maybe the table does not exist yet (new installation from scratch) // It seems more efficient to try and ignore errors than to test if the table & column really exists } @@ -5759,12 +5496,9 @@ class AttributeEnum extends AttributeString protected function GetSQLColSpec() { $default = $this->ScalarToSQL($this->GetDefaultValue()); - if (is_null($default)) - { + if (is_null($default)) { $sRet = ''; - } - else - { + } else { // ENUMs values are strings so the default value must be a string as well, // otherwise MySQL interprets the number as the zero-based index of the value in the list (i.e. the nth value in the list) $sRet = " DEFAULT ".CMDBSource::Quote($default); @@ -5779,12 +5513,9 @@ class AttributeEnum extends AttributeString // but that wasn't working for enums, because '' is NOT one of the allowed values // that's why a null value must be forced to a real null $value = parent::ScalarToSQL($value); - if ($this->IsNull($value)) - { + if ($this->IsNull($value)) { return null; - } - else - { + } else { return $value; } } @@ -5811,17 +5542,15 @@ class AttributeEnum extends AttributeString public function GetValueLabel($sValue) { - if (is_null($sValue)) - { + if (is_null($sValue)) { // Unless a specific label is defined for the null value of this enum, use a generic "undefined" label - $sLabel = Dict::S('Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue, - Dict::S('Enum:Undefined')); - } - else - { + $sLabel = Dict::S( + 'Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue, + Dict::S('Enum:Undefined') + ); + } else { $sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode.'/Value:'.$sValue, null, true /*user lang*/); - if (is_null($sLabel)) - { + if (is_null($sLabel)) { $sDefault = str_replace('_', ' ', $sValue); // Browse the hierarchy again, accepting default (english) translations $sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode.'/Value:'.$sValue, $sDefault, false); @@ -5833,23 +5562,22 @@ class AttributeEnum extends AttributeString public function GetValueDescription($sValue) { - if (is_null($sValue)) - { + if (is_null($sValue)) { // Unless a specific label is defined for the null value of this enum, use a generic "undefined" label - $sDescription = Dict::S('Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue.'+', - Dict::S('Enum:Undefined')); - } - else - { - $sDescription = Dict::S('Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue.'+', - '', true /* user language only */); - if (strlen($sDescription) == 0) - { + $sDescription = Dict::S( + 'Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue.'+', + Dict::S('Enum:Undefined') + ); + } else { + $sDescription = Dict::S( + 'Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue.'+', + '', + true /* user language only */ + ); + if (strlen($sDescription) == 0) { $sParentClass = MetaModel::GetParentClass($this->m_sHostClass); - if ($sParentClass) - { - if (MetaModel::IsValidAttCode($sParentClass, $this->m_sCode)) - { + if ($sParentClass) { + if (MetaModel::IsValidAttCode($sParentClass, $this->m_sCode)) { $oAttDef = MetaModel::GetAttributeDef($sParentClass, $this->m_sCode); $sDescription = $oAttDef->GetValueDescription($sValue); } @@ -5871,9 +5599,7 @@ class AttributeEnum extends AttributeString $oBadge = FieldBadgeUIBlockFactory::MakeForField($sLabel, $oStyle); $oRenderer = new BlockRenderer($oBadge); $sRes = $oRenderer->RenderHtml(); - } - else - { + } else { $sRes = parent::GetAsHtml($sValue, $oHostObject, $bLocalize); } @@ -5882,16 +5608,11 @@ class AttributeEnum extends AttributeString public function GetAsXML($value, $oHostObject = null, $bLocalize = true) { - if (is_null($value)) - { + if (is_null($value)) { $sFinalValue = ''; - } - elseif ($bLocalize) - { + } elseif ($bLocalize) { $sFinalValue = $this->GetValueLabel($value); - } - else - { + } else { $sFinalValue = $value; } $sRes = parent::GetAsXML($sFinalValue, $oHostObject, $bLocalize); @@ -5900,19 +5621,18 @@ class AttributeEnum extends AttributeString } public function GetAsCSV( - $sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $sValue, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { - if (is_null($sValue)) - { + if (is_null($sValue)) { $sFinalValue = ''; - } - elseif ($bLocalize) - { + } elseif ($bLocalize) { $sFinalValue = $this->GetValueLabel($sValue); - } - else - { + } else { $sFinalValue = $sValue; } $sRes = parent::GetAsCSV($sFinalValue, $sSeparator, $sTextQualifier, $oHostObject, $bLocalize); @@ -5927,8 +5647,7 @@ class AttributeEnum extends AttributeString public function MakeFormField(DBObject $oObject, $oFormField = null) { - if ($oFormField === null) - { + if ($oFormField === null) { // Later : We should check $this->Get('display_style') and create a Radio / Select / ... regarding its value $sFormFieldClass = static::GetFormFieldClass(); $oFormField = new $sFormFieldClass($this->GetCode()); @@ -5942,12 +5661,9 @@ class AttributeEnum extends AttributeString public function GetEditValue($sValue, $oHostObj = null) { - if (is_null($sValue)) - { + if (is_null($sValue)) { return ''; - } - else - { + } else { return $this->GetValueLabel($sValue); } } @@ -5957,16 +5673,14 @@ class AttributeEnum extends AttributeString return $value; } - public function GetAllowedValues($aArgs = array(), $sContains = '') + public function GetAllowedValues($aArgs = [], $sContains = '') { $aRawValues = parent::GetAllowedValues($aArgs, $sContains); - if (is_null($aRawValues)) - { + if (is_null($aRawValues)) { return null; } - $aLocalizedValues = array(); - foreach($aRawValues as $sKey => $sValue) - { + $aLocalizedValues = []; + foreach ($aRawValues as $sKey => $sValue) { $aLocalizedValues[$sKey] = $this->GetValueLabel($sKey); } @@ -5990,38 +5704,41 @@ class AttributeEnum extends AttributeString * An enum can be localized */ public function MakeValueFromString( - $sProposedValue, $bLocalizedValue = false, $sSepItem = null, $sSepAttribute = null, $sSepValue = null, + $sProposedValue, + $bLocalizedValue = false, + $sSepItem = null, + $sSepAttribute = null, + $sSepValue = null, $sAttributeQualifier = null ) { - if ($bLocalizedValue) - { + if ($bLocalizedValue) { // Lookup for the value matching the input // $sFoundValue = null; $aRawValues = parent::GetAllowedValues(); - if (!is_null($aRawValues)) - { - foreach($aRawValues as $sKey => $sValue) - { + if (!is_null($aRawValues)) { + foreach ($aRawValues as $sKey => $sValue) { $sRefValue = $this->GetValueLabel($sKey); - if ($sProposedValue == $sRefValue) - { + if ($sProposedValue == $sRefValue) { $sFoundValue = $sKey; break; } } } - if (is_null($sFoundValue)) - { + if (is_null($sFoundValue)) { return null; } return $this->MakeRealValue($sFoundValue, null); - } - else - { - return parent::MakeValueFromString($sProposedValue, $bLocalizedValue, $sSepItem, $sSepAttribute, $sSepValue, - $sAttributeQualifier); + } else { + return parent::MakeValueFromString( + $sProposedValue, + $bLocalizedValue, + $sSepItem, + $sSepAttribute, + $sSepValue, + $sAttributeQualifier + ); } } @@ -6035,8 +5752,7 @@ class AttributeEnum extends AttributeString */ public function MakeRealValue($proposedValue, $oHostObj) { - if ($proposedValue == '') - { + if ($proposedValue == '') { return null; } @@ -6079,7 +5795,7 @@ class AttributeMetaEnum extends AttributeEnum public static function ListExpectedParams() { - return array('allowed_values', 'sql', 'default_value', 'mapping'); + return ['allowed_values', 'sql', 'default_value', 'mapping']; } public function IsNullAllowed() @@ -6099,18 +5815,14 @@ class AttributeMetaEnum extends AttributeEnum public function GetPrerequisiteAttributes($sClass = null) { - if (is_null($sClass)) - { + if (is_null($sClass)) { $sClass = $this->GetHostClass(); } $aMappingData = $this->GetMapRule($sClass); - if ($aMappingData == null) - { - $aRet = array(); - } - else - { - $aRet = array($aMappingData['attcode']); + if ($aMappingData == null) { + $aRet = []; + } else { + $aRet = [$aMappingData['attcode']]; } return $aRet; @@ -6124,22 +5836,19 @@ class AttributeMetaEnum extends AttributeEnum * * @return array|null */ - public function GetAllowedValues($aArgs = array(), $sContains = '') + public function GetAllowedValues($aArgs = [], $sContains = '') { $oValSetDef = $this->GetValuesDef(); - if (!$oValSetDef) - { + if (!$oValSetDef) { return null; } $aRawValues = $oValSetDef->GetValueList(); - if (is_null($aRawValues)) - { + if (is_null($aRawValues)) { return null; } - $aLocalizedValues = array(); - foreach($aRawValues as $sKey => $sValue) - { + $aLocalizedValues = []; + foreach ($aRawValues as $sKey => $sValue) { $aLocalizedValues[$sKey] = $this->GetValueLabel($sKey); } @@ -6158,26 +5867,20 @@ class AttributeMetaEnum extends AttributeEnum public function MapValue($oObject) { $aMappingData = $this->GetMapRule(get_class($oObject)); - if ($aMappingData == null) - { + if ($aMappingData == null) { $sRet = $this->GetDefaultValue(); - } - else - { + } else { $sAttCode = $aMappingData['attcode']; $value = $oObject->Get($sAttCode); - if (array_key_exists($value, $aMappingData['values'])) - { + if (array_key_exists($value, $aMappingData['values'])) { $sRet = $aMappingData['values'][$value]; - } - elseif ($this->GetDefaultValue() != '') - { + } elseif ($this->GetDefaultValue() != '') { $sRet = $this->GetDefaultValue(); - } - else - { - throw new Exception('AttributeMetaEnum::MapValue(): mapping not found for value "'.$value.'" in '.get_class($oObject).', on attribute '.MetaModel::GetAttributeOrigin($this->GetHostClass(), - $this->GetCode()).'::'.$this->GetCode()); + } else { + throw new Exception('AttributeMetaEnum::MapValue(): mapping not found for value "'.$value.'" in '.get_class($oObject).', on attribute '.MetaModel::GetAttributeOrigin( + $this->GetHostClass(), + $this->GetCode() + ).'::'.$this->GetCode()); } } @@ -6187,19 +5890,13 @@ class AttributeMetaEnum extends AttributeEnum public function GetMapRule($sClass) { $aMappings = $this->Get('mapping'); - if (array_key_exists($sClass, $aMappings)) - { + if (array_key_exists($sClass, $aMappings)) { $aMappingData = $aMappings[$sClass]; - } - else - { + } else { $sParent = MetaModel::GetParentClass($sClass); - if (is_null($sParent)) - { + if (is_null($sParent)) { $aMappingData = null; - } - else - { + } else { $aMappingData = $this->GetMapRule($sParent); } } @@ -6215,7 +5912,7 @@ class AttributeMetaEnum extends AttributeEnum */ class AttributeDateTime extends AttributeDBField { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_DATE_TIME; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_DATE_TIME; public static $oFormat = null; @@ -6242,8 +5939,7 @@ class AttributeDateTime extends AttributeDBField */ public static function GetFormat() { - if (self::$oFormat == null) - { + if (self::$oFormat == null) { static::LoadFormatFromConfig(); } @@ -6261,7 +5957,7 @@ class AttributeDateTime extends AttributeDBField $sTimeFormat = isset($aFormats[$sLang]['time']) ? $aFormats[$sLang]['time'] : (isset($aFormats['default']['time']) ? $aFormats['default']['time'] : 'H:i:s'); $sDateAndTimeFormat = isset($aFormats[$sLang]['date_time']) ? $aFormats[$sLang]['date_time'] : (isset($aFormats['default']['date_time']) ? $aFormats['default']['date_time'] : '$date $time'); - $sFullFormat = str_replace(array('$date', '$time'), array($sDateFormat, $sTimeFormat), $sDateAndTimeFormat); + $sFullFormat = str_replace(['$date', '$time'], [$sDateFormat, $sTimeFormat], $sDateAndTimeFormat); self::SetFormat(new DateTimeFormat($sFullFormat)); AttributeDate::SetFormat(new DateTimeFormat($sDateFormat)); @@ -6306,16 +6002,13 @@ class AttributeDateTime extends AttributeDBField */ public function ParseSearchString($sSearchString) { - try - { + try { $oDateTime = $this->GetFormat()->Parse($sSearchString); $sSearchString = $oDateTime->format($this->GetInternalFormat()); - } catch (Exception $e) - { + } catch (Exception $e) { $sFormatString = '!'.(string)AttributeDate::GetFormat(); // BEWARE: ! is needed to set non-parsed fields to zero !!! $oDateTime = DateTime::createFromFormat($sFormatString, $sSearchString); - if ($oDateTime !== false) - { + if ($oDateTime !== false) { $sSearchString = $oDateTime->format($this->GetInternalFormat()); } } @@ -6336,8 +6029,7 @@ class AttributeDateTime extends AttributeDBField */ public function MakeFormField(DBObject $oObject, $oFormField = null) { - if ($oFormField === null) - { + if ($oFormField === null) { $sFormFieldClass = static::GetFormFieldClass(); $oFormField = new $sFormFieldClass($this->GetCode()); } @@ -6346,15 +6038,14 @@ class AttributeDateTime extends AttributeDBField $oFormField = parent::MakeFormField($oObject, $oFormField); - // After call to the parent as it sets the current value - $oValue = $oObject->Get($this->GetCode()); - if ($oValue === $this->GetNullValue()) { - $oValue = $this->GetDefaultValue($oObject); - } - $oFormField->SetCurrentValue($this->GetFormat()->Format($oValue)); + // After call to the parent as it sets the current value + $oValue = $oObject->Get($this->GetCode()); + if ($oValue === $this->GetNullValue()) { + $oValue = $this->GetDefaultValue($oObject); + } + $oFormField->SetCurrentValue($this->GetFormat()->Format($oValue)); - - return $oFormField; + return $oFormField; } /** @@ -6362,10 +6053,10 @@ class AttributeDateTime extends AttributeDBField */ public function EnumTemplateVerbs() { - return array( + return [ '' => 'Formatted representation', 'raw' => 'Not formatted representation', - ); + ]; } /** @@ -6373,8 +6064,7 @@ class AttributeDateTime extends AttributeDBField */ public function GetForTemplate($value, $sVerb, $oHostObject = null, $bLocalize = true) { - switch ($sVerb) - { + switch ($sVerb) { case '': case 'text': return static::GetFormat()->format($value); @@ -6403,7 +6093,6 @@ class AttributeDateTime extends AttributeDBField return "DateTime"; } - public function GetEditValue($sValue, $oHostObj = null) { return (string)static::GetFormat()->format($sValue); @@ -6422,7 +6111,7 @@ class AttributeDateTime extends AttributeDBField public function GetImportColumns() { // Allow an empty string to be a valid value (synonym for "reset") - $aColumns = array(); + $aColumns = []; $aColumns[$this->GetCode()] = 'VARCHAR(19)'.CMDBSource::GetSqlStringColumnDefinition(); return $aColumns; @@ -6469,7 +6158,7 @@ class AttributeDateTime extends AttributeDBField public function GetBasicFilterOperators() { - return array( + return [ "=" => "equals", "!=" => "differs from", "<" => "before", @@ -6483,7 +6172,7 @@ class AttributeDateTime extends AttributeDBField ">|" => "after today + N days", "<|" => "before today + N days", "=|" => "equals today + N days", - ); + ]; } public function GetBasicFilterLooseOperator() @@ -6496,8 +6185,7 @@ class AttributeDateTime extends AttributeDBField { $sQValue = CMDBSource::Quote($value); - switch ($sOpCode) - { + switch ($sOpCode) { case '=': case '!=': case '<': @@ -6536,8 +6224,7 @@ class AttributeDateTime extends AttributeDBField */ public function MakeRealValue($proposedValue, $oHostObj) { - if (is_null($proposedValue)) - { + if (is_null($proposedValue)) { return null; } @@ -6568,8 +6255,7 @@ class AttributeDateTime extends AttributeDBField public function ScalarToSQL($value) { - if (empty($value)) - { + if (empty($value)) { return null; } @@ -6587,27 +6273,26 @@ class AttributeDateTime extends AttributeDBField } public function GetAsCSV( - $sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $sValue, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { - if (empty($sValue) || ($sValue === '0000-00-00 00:00:00') || ($sValue === '0000-00-00')) - { + if (empty($sValue) || ($sValue === '0000-00-00 00:00:00') || ($sValue === '0000-00-00')) { return ''; - } - else - { - if ((string)static::GetFormat() !== static::GetInternalFormat()) - { + } else { + if ((string)static::GetFormat() !== static::GetInternalFormat()) { // Format conversion $oDate = new DateTime($sValue); - if ($oDate !== false) - { + if ($oDate !== false) { $sValue = static::GetFormat()->format($oDate); } } } - $sFrom = array("\r\n", $sTextQualifier); - $sTo = array("\n", $sTextQualifier.$sTextQualifier); + $sFrom = ["\r\n", $sTextQualifier]; + $sTo = ["\n", $sTextQualifier.$sTextQualifier]; $sEscaped = str_replace($sFrom, $sTo, (string)$sValue); return $sTextQualifier.$sEscaped.$sTextQualifier; @@ -6627,52 +6312,46 @@ class AttributeDateTime extends AttributeDBField * @throws \CoreException */ public function GetSmartConditionExpression( - $sSearchText, FieldExpression $oField, &$aParams, $bParseSearchString = false + $sSearchText, + FieldExpression $oField, + &$aParams, + $bParseSearchString = false ) { // Possible smart patterns - $aPatterns = array( - 'between' => array('pattern' => '/^\[(.*),(.*)\]$/', 'operator' => 'n/a'), - 'greater than or equal' => array('pattern' => '/^>=(.*)$/', 'operator' => '>='), - 'greater than' => array('pattern' => '/^>(.*)$/', 'operator' => '>'), - 'less than or equal' => array('pattern' => '/^<=(.*)$/', 'operator' => '<='), - 'less than' => array('pattern' => '/^<(.*)$/', 'operator' => '<'), - ); + $aPatterns = [ + 'between' => ['pattern' => '/^\[(.*),(.*)\]$/', 'operator' => 'n/a'], + 'greater than or equal' => ['pattern' => '/^>=(.*)$/', 'operator' => '>='], + 'greater than' => ['pattern' => '/^>(.*)$/', 'operator' => '>'], + 'less than or equal' => ['pattern' => '/^<=(.*)$/', 'operator' => '<='], + 'less than' => ['pattern' => '/^<(.*)$/', 'operator' => '<'], + ]; $sPatternFound = ''; - $aMatches = array(); - foreach($aPatterns as $sPatName => $sPattern) - { - if (preg_match($sPattern['pattern'], $sSearchText, $aMatches)) - { + $aMatches = []; + foreach ($aPatterns as $sPatName => $sPattern) { + if (preg_match($sPattern['pattern'], $sSearchText, $aMatches)) { $sPatternFound = $sPatName; break; } } - switch ($sPatternFound) - { + switch ($sPatternFound) { case 'between': $sParamName1 = $oField->GetParent().'_'.$oField->GetName().'_1'; $oRightExpr = new VariableExpression($sParamName1); - if ($bParseSearchString) - { + if ($bParseSearchString) { $aParams[$sParamName1] = $this->ParseSearchString($aMatches[1]); - } - else - { + } else { $aParams[$sParamName1] = $aMatches[1]; } $oCondition1 = new BinaryExpression($oField, '>=', $oRightExpr); $sParamName2 = $oField->GetParent().'_'.$oField->GetName().'_2'; $oRightExpr = new VariableExpression($sParamName2); - if ($bParseSearchString) - { + if ($bParseSearchString) { $aParams[$sParamName2] = $this->ParseSearchString($aMatches[2]); - } - else - { + } else { $aParams[$sParamName2] = $aMatches[2]; } $oCondition2 = new BinaryExpression($oField, '<=', $oRightExpr); @@ -6687,12 +6366,9 @@ class AttributeDateTime extends AttributeDBField $sSQLOperator = $aPatterns[$sPatternFound]['operator']; $sParamName = $oField->GetParent().'_'.$oField->GetName(); $oRightExpr = new VariableExpression($sParamName); - if ($bParseSearchString) - { + if ($bParseSearchString) { $aParams[$sParamName] = $this->ParseSearchString($aMatches[1]); - } - else - { + } else { $aParams[$sParamName] = $aMatches[1]; } $oNewCondition = new BinaryExpression($oField, $sSQLOperator, $oRightExpr); @@ -6707,7 +6383,6 @@ class AttributeDateTime extends AttributeDBField return $oNewCondition; } - public function GetHelpOnSmartSearch() { $sDict = parent::GetHelpOnSmartSearch(); @@ -6715,7 +6390,7 @@ class AttributeDateTime extends AttributeDBField $oFormat = static::GetFormat(); $sExample = $oFormat->Format(new DateTime('2015-07-19 18:40:00')); - return vsprintf($sDict, array($oFormat->ToPlaceholder(), $sExample)); + return vsprintf($sDict, [$oFormat->ToPlaceholder(), $sExample]); } } @@ -6760,16 +6435,13 @@ class AttributeDuration extends AttributeInteger public function MakeRealValue($proposedValue, $oHostObj) { - if (is_null($proposedValue)) - { + if (is_null($proposedValue)) { return null; } - if (!is_numeric($proposedValue)) - { + if (!is_numeric($proposedValue)) { return null; } - if (((int)$proposedValue) < 0) - { + if (((int)$proposedValue) < 0) { return null; } @@ -6778,8 +6450,7 @@ class AttributeDuration extends AttributeInteger public function ScalarToSQL($value) { - if (is_null($value)) - { + if (is_null($value)) { return null; } @@ -6795,31 +6466,31 @@ class AttributeDuration extends AttributeInteger { $aDuration = self::SplitDuration($duration); - if ($duration < 60) - { + if ($duration < 60) { // Less than 1 min $sResult = Dict::Format('Core:Duration_Seconds', $aDuration['seconds']); - } - else - { - if ($duration < 3600) - { + } else { + if ($duration < 3600) { // less than 1 hour, display it in minutes/seconds $sResult = Dict::Format('Core:Duration_Minutes_Seconds', $aDuration['minutes'], $aDuration['seconds']); - } - else - { - if ($duration < 86400) - { + } else { + if ($duration < 86400) { // Less than 1 day, display it in hours/minutes/seconds - $sResult = Dict::Format('Core:Duration_Hours_Minutes_Seconds', $aDuration['hours'], - $aDuration['minutes'], $aDuration['seconds']); - } - else - { + $sResult = Dict::Format( + 'Core:Duration_Hours_Minutes_Seconds', + $aDuration['hours'], + $aDuration['minutes'], + $aDuration['seconds'] + ); + } else { // more than 1 day, display it in days/hours/minutes/seconds - $sResult = Dict::Format('Core:Duration_Days_Hours_Minutes_Seconds', $aDuration['days'], - $aDuration['hours'], $aDuration['minutes'], $aDuration['seconds']); + $sResult = Dict::Format( + 'Core:Duration_Days_Hours_Minutes_Seconds', + $aDuration['days'], + $aDuration['hours'], + $aDuration['minutes'], + $aDuration['seconds'] + ); } } } @@ -6827,7 +6498,7 @@ class AttributeDuration extends AttributeInteger return $sResult; } - static function SplitDuration($duration) + public static function SplitDuration($duration) { $duration = (int)$duration; $days = floor($duration / 86400); @@ -6835,7 +6506,7 @@ class AttributeDuration extends AttributeInteger $minutes = floor(($duration - (86400 * $days + 3600 * $hours)) / 60); $seconds = ($duration % 60); // modulo - return array('days' => $days, 'hours' => $hours, 'minutes' => $minutes, 'seconds' => $seconds); + return ['days' => $days, 'hours' => $hours, 'minutes' => $minutes, 'seconds' => $seconds]; } public static function GetFormFieldClass() @@ -6845,8 +6516,7 @@ class AttributeDuration extends AttributeInteger public function MakeFormField(DBObject $oObject, $oFormField = null) { - if ($oFormField === null) - { + if ($oFormField === null) { $sFormFieldClass = static::GetFormFieldClass(); $oFormField = new $sFormFieldClass($this->GetCode()); } @@ -6869,7 +6539,7 @@ class AttributeDuration extends AttributeInteger */ class AttributeDate extends AttributeDateTime { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_DATE; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_DATE; public static $oDateFormat = null; @@ -6892,8 +6562,7 @@ class AttributeDate extends AttributeDateTime public static function GetFormat() { - if (self::$oDateFormat == null) - { + if (self::$oDateFormat == null) { AttributeDateTime::LoadFormatFromConfig(); } @@ -6944,13 +6613,12 @@ class AttributeDate extends AttributeDateTime public function GetImportColumns() { // Allow an empty string to be a valid value (synonym for "reset") - $aColumns = array(); + $aColumns = []; $aColumns[$this->GetCode()] = 'VARCHAR(10)'.CMDBSource::GetSqlStringColumnDefinition(); return $aColumns; } - /** * Override to specify Field class * @@ -7001,54 +6669,41 @@ class AttributeDeadline extends AttributeDateTime public static function FormatDeadline($value) { $sResult = ''; - if ($value !== null) - { + if ($value !== null) { $iValue = AttributeDateTime::GetAsUnixSeconds($value); $sDate = AttributeDateTime::GetFormat()->Format($value); $difference = $iValue - time(); - if ($difference >= 0) - { + if ($difference >= 0) { $sDifference = self::FormatDuration($difference); - } - else - { + } else { $sDifference = Dict::Format('UI:DeadlineMissedBy_duration', self::FormatDuration(-$difference)); } $sFormat = MetaModel::GetConfig()->Get('deadline_format'); - $sResult = str_replace(array('$date$', '$difference$'), array($sDate, $sDifference), $sFormat); + $sResult = str_replace(['$date$', '$difference$'], [$sDate, $sDifference], $sFormat); } return $sResult; } - static function FormatDuration($duration) + public static function FormatDuration($duration) { $days = floor($duration / 86400); $hours = floor(($duration - (86400 * $days)) / 3600); $minutes = floor(($duration - (86400 * $days + 3600 * $hours)) / 60); - if ($duration < 60) - { + if ($duration < 60) { // Less than 1 min $sResult = Dict::S('UI:Deadline_LessThan1Min'); - } - else - { - if ($duration < 3600) - { + } else { + if ($duration < 3600) { // less than 1 hour, display it in minutes $sResult = Dict::Format('UI:Deadline_Minutes', $minutes); - } - else - { - if ($duration < 86400) - { + } else { + if ($duration < 86400) { // Less that 1 day, display it in hours/minutes $sResult = Dict::Format('UI:Deadline_Hours_Minutes', $hours, $minutes); - } - else - { + } else { // Less that 1 day, display it in hours/minutes $sResult = Dict::Format('UI:Deadline_Days_Hours_Minutes', $days, $hours, $minutes); } @@ -7069,7 +6724,7 @@ class AttributeDeadline extends AttributeDateTime */ class AttributeExternalKey extends AttributeDBFieldVoid { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_EXTERNAL_KEY; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_EXTERNAL_KEY; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -7095,18 +6750,15 @@ class AttributeExternalKey extends AttributeDBFieldVoid */ public function GetSearchType() { - try - { + try { $oRemoteAtt = $this->GetFinalAttDef(); $sTargetClass = $oRemoteAtt->GetTargetClass(); - if (MetaModel::IsHierarchicalClass($sTargetClass)) - { + if (MetaModel::IsHierarchicalClass($sTargetClass)) { return self::SEARCH_WIDGET_TYPE_HIERARCHICAL_KEY; } return self::SEARCH_WIDGET_TYPE_EXTERNAL_KEY; - } catch (CoreException $e) - { + } catch (CoreException $e) { } return self::SEARCH_WIDGET_TYPE_RAW; @@ -7114,7 +6766,7 @@ class AttributeExternalKey extends AttributeDBFieldVoid public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array("targetclass", "is_null_allowed", "on_target_delete")); + return array_merge(parent::ListExpectedParams(), ["targetclass", "is_null_allowed", "on_target_delete"]); } public function GetEditClass() @@ -7157,7 +6809,6 @@ class AttributeExternalKey extends AttributeDBFieldVoid return $this->GetOptional('display_style', 'select'); } - public function GetDefaultValue(DBObject $oHostObject = null) { return 0; @@ -7165,15 +6816,13 @@ class AttributeExternalKey extends AttributeDBFieldVoid public function IsNullAllowed() { - if (MetaModel::GetConfig()->Get('disable_mandatory_ext_keys')) - { + if (MetaModel::GetConfig()->Get('disable_mandatory_ext_keys')) { return true; } return $this->Get("is_null_allowed"); } - public function GetBasicFilterOperators() { return parent::GetBasicFilterOperators(); @@ -7194,8 +6843,7 @@ class AttributeExternalKey extends AttributeDBFieldVoid public function GetValuesDef() { $oValSetDef = $this->Get("allowed_values"); - if (!$oValSetDef) - { + if (!$oValSetDef) { // Let's propose every existing value $oValSetDef = new ValueSetObjects('SELECT '.$this->GetTargetClass()); } @@ -7203,14 +6851,12 @@ class AttributeExternalKey extends AttributeDBFieldVoid return $oValSetDef; } - public function GetAllowedValues($aArgs = array(), $sContains = '') + public function GetAllowedValues($aArgs = [], $sContains = '') { //throw new Exception("GetAllowedValues on ext key has been deprecated"); - try - { + try { return parent::GetAllowedValues($aArgs, $sContains); - } catch (Exception $e) - { + } catch (Exception $e) { // Some required arguments could not be found, enlarge to any existing value $oValSetDef = new ValueSetObjects('SELECT '.$this->GetTargetClass()); @@ -7218,15 +6864,14 @@ class AttributeExternalKey extends AttributeDBFieldVoid } } - public function GetAllowedValuesForSelect($aArgs = array(), $sContains = '') + public function GetAllowedValuesForSelect($aArgs = [], $sContains = '') { //$this->GetValuesDef(); $oValSetDef = new ValueSetObjects('SELECT '.$this->GetTargetClass()); return $oValSetDef->GetValuesForAutocomplete($aArgs, $sContains); } - - public function GetAllowedValuesAsObjectSet($aArgs = array(), $sContains = '', $iAdditionalValue = null) + public function GetAllowedValuesAsObjectSet($aArgs = [], $sContains = '', $iAdditionalValue = null) { $oValSetDef = $this->GetValuesDef(); $oSet = $oValSetDef->ToObjectSet($aArgs, $sContains, $iAdditionalValue); @@ -7234,7 +6879,7 @@ class AttributeExternalKey extends AttributeDBFieldVoid return $oSet; } - public function GetAllowedValuesAsFilter($aArgs = array(), $sContains = '', $iAdditionalValue = null) + public function GetAllowedValuesAsFilter($aArgs = [], $sContains = '', $iAdditionalValue = null) { return DBObjectSearch::FromOQL($this->GetValuesDef()->GetFilterExpression()); } @@ -7264,12 +6909,10 @@ class AttributeExternalKey extends AttributeDBFieldVoid public function MakeRealValue($proposedValue, $oHostObj) { - if (is_null($proposedValue)) - { + if (is_null($proposedValue)) { return 0; } - if ($proposedValue === '') - { + if ($proposedValue === '') { return 0; } if (MetaModel::IsValidObject($proposedValue)) { @@ -7327,19 +6970,17 @@ class AttributeExternalKey extends AttributeDBFieldVoid { $oRet = null; $sRemoteClass = $this->GetTargetClass(); - foreach(MetaModel::ListAttributeDefs($sRemoteClass) as $sRemoteAttCode => $oRemoteAttDef) - { - if (!$oRemoteAttDef->IsLinkSet()) - { + foreach (MetaModel::ListAttributeDefs($sRemoteClass) as $sRemoteAttCode => $oRemoteAttDef) { + if (!$oRemoteAttDef->IsLinkSet()) { continue; } - if (!is_subclass_of($this->GetHostClass(), - $oRemoteAttDef->GetLinkedClass()) && $oRemoteAttDef->GetLinkedClass() != $this->GetHostClass()) - { + if (!is_subclass_of( + $this->GetHostClass(), + $oRemoteAttDef->GetLinkedClass() + ) && $oRemoteAttDef->GetLinkedClass() != $this->GetHostClass()) { continue; } - if ($oRemoteAttDef->GetExtKeyToMe() != $this->GetCode()) - { + if ($oRemoteAttDef->GetExtKeyToMe() != $this->GetCode()) { continue; } $oRet = $oRemoteAttDef; @@ -7379,17 +7020,15 @@ class AttributeExternalKey extends AttributeDBFieldVoid /** @var $oObject \DBObject */ // We set search object only if it has not already been set (overrided) - if ($oTmpField->GetSearch() === null) - { + if ($oTmpField->GetSearch() === null) { $oSearch = DBSearch::FromOQL($oTmpAttDef->GetValuesDef()->GetFilterExpression()); - $oSearch->SetInternalParams(array('this' => $oObject)); + $oSearch->SetInternalParams(['this' => $oObject]); $oTmpField->SetSearch($oSearch); } }); - } - else { + } else { $oSearch = DBSearch::FromOQL($this->GetValuesDef()->GetFilterExpression()); - $oSearch->SetInternalParams(array('this' => $oObject)); + $oSearch->SetInternalParams(['this' => $oObject]); $oFormField->SetSearch($oSearch); } @@ -7413,7 +7052,7 @@ class AttributeExternalKey extends AttributeDBFieldVoid */ class AttributeHierarchicalKey extends AttributeExternalKey { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_HIERARCHICAL_KEY; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_HIERARCHICAL_KEY; protected $m_sTargetClass; @@ -7460,8 +7099,7 @@ class AttributeHierarchicalKey extends AttributeExternalKey */ public function SetHostClass($sHostClass) { - if (!isset($this->m_sTargetClass)) - { + if (!isset($this->m_sTargetClass)) { $this->m_sTargetClass = $sHostClass; } parent::SetHostClass($sHostClass); @@ -7499,7 +7137,7 @@ class AttributeHierarchicalKey extends AttributeExternalKey public function GetSQLColumns($bFullSpec = false) { - $aColumns = array(); + $aColumns = []; $aColumns[$this->GetCode()] = 'INT(11)'.($bFullSpec ? ' DEFAULT 0' : ''); $aColumns[$this->GetSQLLeft()] = 'INT(11)'.($bFullSpec ? ' DEFAULT 0' : ''); $aColumns[$this->GetSQLRight()] = 'INT(11)'.($bFullSpec ? ' DEFAULT 0' : ''); @@ -7519,13 +7157,10 @@ class AttributeHierarchicalKey extends AttributeExternalKey public function GetSQLValues($value) { - if (!is_array($value)) - { + if (!is_array($value)) { $aValues[$this->GetCode()] = $value; - } - else - { - $aValues = array(); + } else { + $aValues = []; $aValues[$this->GetCode()] = $value[$this->GetCode()]; $aValues[$this->GetSQLRight()] = $value[$this->GetSQLRight()]; $aValues[$this->GetSQLLeft()] = $value[$this->GetSQLLeft()]; @@ -7534,28 +7169,24 @@ class AttributeHierarchicalKey extends AttributeExternalKey return $aValues; } - public function GetAllowedValues($aArgs = array(), $sContains = '') + public function GetAllowedValues($aArgs = [], $sContains = '') { $oFilter = $this->GetHierachicalFilter($aArgs, $sContains); - if ($oFilter) - { + if ($oFilter) { $oValSetDef = $this->GetValuesDef(); $oValSetDef->SetCondition($oFilter); return $oValSetDef->GetValues($aArgs, $sContains); - } - else - { + } else { return parent::GetAllowedValues($aArgs, $sContains); } } - public function GetAllowedValuesAsObjectSet($aArgs = array(), $sContains = '', $iAdditionalValue = null) + public function GetAllowedValuesAsObjectSet($aArgs = [], $sContains = '', $iAdditionalValue = null) { $oValSetDef = $this->GetValuesDef(); $oFilter = $this->GetHierachicalFilter($aArgs, $sContains, $iAdditionalValue); - if ($oFilter) - { + if ($oFilter) { $oValSetDef->SetCondition($oFilter); } $oSet = $oValSetDef->ToObjectSet($aArgs, $sContains, $iAdditionalValue); @@ -7563,26 +7194,23 @@ class AttributeHierarchicalKey extends AttributeExternalKey return $oSet; } - public function GetAllowedValuesAsFilter($aArgs = array(), $sContains = '', $iAdditionalValue = null) + public function GetAllowedValuesAsFilter($aArgs = [], $sContains = '', $iAdditionalValue = null) { $oFilter = $this->GetHierachicalFilter($aArgs, $sContains, $iAdditionalValue); - if ($oFilter) - { + if ($oFilter) { return $oFilter; } return parent::GetAllowedValuesAsFilter($aArgs, $sContains, $iAdditionalValue); } - private function GetHierachicalFilter($aArgs = array(), $sContains = '', $iAdditionalValue = null) + private function GetHierachicalFilter($aArgs = [], $sContains = '', $iAdditionalValue = null) { - if (array_key_exists('this', $aArgs)) - { + if (array_key_exists('this', $aArgs)) { // Hierarchical keys have one more constraint: the "parent value" cannot be // "under" themselves $iRootId = $aArgs['this']->GetKey(); - if ($iRootId > 0) // ignore objects that do no exist in the database... - { + if ($iRootId > 0) { // ignore objects that do no exist in the database... $sClass = $this->m_sTargetClass; return DBObjectSearch::FromOQL("SELECT $sClass AS node JOIN $sClass AS root ON node.".$this->GetCode()." NOT BELOW root.id WHERE root.id = $iRootId"); @@ -7636,32 +7264,27 @@ class AttributeExternalField extends AttributeDefinition public function GetSearchType() { // Not necessary the external key is already present - if ($this->IsFriendlyName()) - { + if ($this->IsFriendlyName()) { return self::SEARCH_WIDGET_TYPE_RAW; } - try - { + try { $oRemoteAtt = $this->GetFinalAttDef(); - switch (true) - { + switch (true) { case ($oRemoteAtt instanceof AttributeString): return self::SEARCH_WIDGET_TYPE_EXTERNAL_FIELD; case ($oRemoteAtt instanceof AttributeExternalKey): return self::SEARCH_WIDGET_TYPE_EXTERNAL_KEY; } - } catch (CoreException $e) - { + } catch (CoreException $e) { } return self::SEARCH_WIDGET_TYPE_RAW; } - function IsSearchable() + public function IsSearchable() { - if ($this->IsFriendlyName()) - { + if ($this->IsFriendlyName()) { return true; } return parent::IsSearchable(); @@ -7669,7 +7292,7 @@ class AttributeExternalField extends AttributeDefinition public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array("extkey_attcode", "target_attcode")); + return array_merge(parent::ListExpectedParams(), ["extkey_attcode", "target_attcode"]); } public function GetEditClass() @@ -7698,12 +7321,9 @@ class AttributeExternalField extends AttributeDefinition public function GetSQLExpressions($sPrefix = '') { - if ($sPrefix == '') - { - return array('' => $this->GetCode()); // Warning: Use GetCode() since AttributeExternalField does not have any 'sql' property - } - else - { + if ($sPrefix == '') { + return ['' => $this->GetCode()]; // Warning: Use GetCode() since AttributeExternalField does not have any 'sql' property + } else { return $sPrefix; } } @@ -7739,13 +7359,11 @@ class AttributeExternalField extends AttributeDefinition { $sLabelDefaultValue = ''; $sLabel = parent::GetLabel($sLabelDefaultValue); - if ($sLabelDefaultValue !== $sLabel) - { + if ($sLabelDefaultValue !== $sLabel) { return $sLabel; } - if ($this->IsFriendlyName() && ($this->Get("target_attcode") === "friendlyname")) - { + if ($this->IsFriendlyName() && ($this->Get("target_attcode") === "friendlyname")) { // This will be used even if we are pointing to a friendlyname in a distance > 1 // For example we can link to a magic friendlyname (like org_id_friendlyname) // If a specific label is needed, use a Dict key ! @@ -7769,8 +7387,7 @@ class AttributeExternalField extends AttributeDefinition public function GetLabelForSearchField() { $sLabel = parent::GetLabel(''); - if (strlen($sLabel) == 0) - { + if (strlen($sLabel) == 0) { $sKeyAttCode = $this->Get("extkey_attcode"); $oExtKeyAttDef = MetaModel::GetAttributeDef($this->GetHostClass(), $sKeyAttCode); $sLabel = $oExtKeyAttDef->GetLabel($this->m_sCode); @@ -7785,8 +7402,7 @@ class AttributeExternalField extends AttributeDefinition public function GetDescription($sDefault = null) { $sLabel = parent::GetDescription(''); - if (strlen($sLabel) == 0) - { + if (strlen($sLabel) == 0) { $oRemoteAtt = $this->GetExtAttDef(); $sLabel = $oRemoteAtt->GetDescription(''); } @@ -7797,8 +7413,7 @@ class AttributeExternalField extends AttributeDefinition public function GetHelpOnEdition($sDefault = null) { $sLabel = parent::GetHelpOnEdition(''); - if (strlen($sLabel) == 0) - { + if (strlen($sLabel) == 0) { $oRemoteAtt = $this->GetExtAttDef(); $sLabel = $oRemoteAtt->GetHelpOnEdition(''); } @@ -7808,8 +7423,7 @@ class AttributeExternalField extends AttributeDefinition public function IsExternalKey($iType = EXTKEY_RELATIVE) { - switch ($iType) - { + switch ($iType) { case EXTKEY_ABSOLUTE: // see further $oRemoteAtt = $this->GetExtAttDef(); @@ -7831,16 +7445,11 @@ class AttributeExternalField extends AttributeDefinition public function IsFriendlyName() { $oRemoteAtt = $this->GetExtAttDef(); - if ($oRemoteAtt instanceof AttributeExternalField) - { + if ($oRemoteAtt instanceof AttributeExternalField) { $bRet = $oRemoteAtt->IsFriendlyName(); - } - elseif ($oRemoteAtt instanceof AttributeFriendlyName) - { + } elseif ($oRemoteAtt instanceof AttributeFriendlyName) { $bRet = true; - } - else - { + } else { $bRet = false; } @@ -7876,20 +7485,15 @@ class AttributeExternalField extends AttributeDefinition */ public function GetKeyAttDef($iType = EXTKEY_RELATIVE) { - switch ($iType) - { + switch ($iType) { case EXTKEY_ABSOLUTE: // see further /** @var \AttributeExternalKey $oRemoteAtt */ $oRemoteAtt = $this->GetExtAttDef(); - if ($oRemoteAtt->IsExternalField()) - { + if ($oRemoteAtt->IsExternalField()) { return $oRemoteAtt->GetKeyAttDef(EXTKEY_ABSOLUTE); - } - else - { - if ($oRemoteAtt->IsExternalKey()) - { + } else { + if ($oRemoteAtt->IsExternalKey()) { return $oRemoteAtt; } } @@ -7909,10 +7513,9 @@ class AttributeExternalField extends AttributeDefinition public function GetPrerequisiteAttributes($sClass = null) { - return array($this->Get("extkey_attcode")); + return [$this->Get("extkey_attcode")]; } - /** * @return \AttributeExternalField * @throws \CoreException @@ -7923,8 +7526,7 @@ class AttributeExternalField extends AttributeDefinition $oKeyAttDef = $this->GetKeyAttDef(); /** @var \AttributeExternalField $oExtAttDef */ $oExtAttDef = MetaModel::GetAttributeDef($oKeyAttDef->GetTargetClass(), $this->Get("target_attcode")); - if (!is_object($oExtAttDef)) - { + if (!is_object($oExtAttDef)) { throw new CoreException("Invalid external field ".$this->GetCode()." in class ".$this->GetHostClass().". The class ".$oKeyAttDef->GetTargetClass()." has no attribute ".$this->Get("target_attcode")); } @@ -7963,7 +7565,7 @@ class AttributeExternalField extends AttributeDefinition public function GetFilterDefinitions() { - return array($this->GetCode() => $this->GetCode()); + return [$this->GetCode() => $this->GetCode()]; } public function GetBasicFilterOperators() @@ -8037,7 +7639,6 @@ class AttributeExternalField extends AttributeDefinition return $oExtAttDef->ScalarToSQL($value); } - // Do not overload GetSQLExpression here because this is handled in the joins //public function GetSQLExpressions($sPrefix = '') {return array();} @@ -8064,7 +7665,11 @@ class AttributeExternalField extends AttributeDefinition } public function GetAsCSV( - $value, $sSeparator = ',', $sTestQualifier = '"', $oHostObject = null, $bLocalize = true, + $value, + $sSeparator = ',', + $sTestQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { $oExtAttDef = $this->GetExtAttDef(); @@ -8089,22 +7694,17 @@ class AttributeExternalField extends AttributeDefinition // Retrieving AttDef from the remote attribute $oRemoteAttDef = $this->GetExtAttDef(); - if ($oFormField === null) - { + if ($oFormField === null) { // ExternalField's FormField are actually based on the FormField from the target attribute. // Except for the AttributeExternalKey because we have no OQL and stuff - if ($oRemoteAttDef instanceof AttributeExternalKey) - { + if ($oRemoteAttDef instanceof AttributeExternalKey) { $sFormFieldClass = static::GetFormFieldClass(); - } - else - { + } else { $sFormFieldClass = $oRemoteAttDef::GetFormFieldClass(); } /** @var \Combodo\iTop\Form\Field\Field $oFormField */ $oFormField = new $sFormFieldClass($this->GetCode()); - switch ($sFormFieldClass) - { + switch ($sFormFieldClass) { case '\Combodo\iTop\Form\Field\SelectField': $oFormField->SetChoices($oRemoteAttDef->GetAllowedValues($oObject->ToArgsForQuery())); break; @@ -8121,8 +7721,7 @@ class AttributeExternalField extends AttributeDefinition } // Manually setting for remote ExternalKey, otherwise, the id would be displayed. - if ($oRemoteAttDef instanceof AttributeExternalKey) - { + if ($oRemoteAttDef instanceof AttributeExternalKey) { $oFormField->SetCurrentValue($oObject->Get($this->GetCode().'_friendlyname')); } @@ -8148,7 +7747,6 @@ class AttributeExternalField extends AttributeDefinition } } - /** * Map a varchar column to an URL (formats the ouput in HMTL) * @@ -8187,7 +7785,7 @@ class AttributeURL extends AttributeString public static function ListExpectedParams() { //return parent::ListExpectedParams(); - return array_merge(parent::ListExpectedParams(), array("target")); + return array_merge(parent::ListExpectedParams(), ["target"]); } protected function GetSQLCol($bFullSpec = false) @@ -8210,13 +7808,11 @@ class AttributeURL extends AttributeString public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) { $sTarget = $this->Get("target"); - if (empty($sTarget)) - { + if (empty($sTarget)) { $sTarget = "_blank"; } $sLabel = Str::pure2html($sValue); - if (strlen($sLabel) > 128) - { + if (strlen($sLabel) > 128) { // Truncate the length to 128 characters, by removing the middle $sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20); } @@ -8267,7 +7863,7 @@ class AttributeURL extends AttributeString */ class AttributeBlob extends AttributeDefinition { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -8288,7 +7884,7 @@ class AttributeBlob extends AttributeDefinition public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array("depends_on")); + return array_merge(parent::ListExpectedParams(), ["depends_on"]); } public function GetEditClass() @@ -8327,31 +7923,25 @@ class AttributeBlob extends AttributeDefinition } /** - * {@inheritDoc} - * - * @param string $proposedValue Can be an URL (including an URL to iTop itself), or a local path (CSV import) + * {@inheritDoc} + * + * @param string $proposedValue Can be an URL (including an URL to iTop itself), or a local path (CSV import) * * @see AttributeDefinition::MakeRealValue() */ public function MakeRealValue($proposedValue, $oHostObj) { - if ($proposedValue === null) - { + if ($proposedValue === null) { return null; } - if (is_object($proposedValue)) - { + if (is_object($proposedValue)) { $proposedValue = clone $proposedValue; - } - else - { - try - { + } else { + try { // Read the file from iTop, an URL (or the local file system - for admins only) $proposedValue = Utils::FileGetContentsAndMIMEType($proposedValue); - } catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Warning(get_class($this)."::MakeRealValue - ".$e->getMessage()); // Not a real document !! store is as text !!! (This was the default behavior before) $proposedValue = new ormDocument($e->getMessage()." \n".$proposedValue, 'text/plain'); @@ -8363,11 +7953,10 @@ class AttributeBlob extends AttributeDefinition public function GetSQLExpressions($sPrefix = '') { - if ($sPrefix == '') - { + if ($sPrefix == '') { $sPrefix = $this->GetCode(); } - $aColumns = array(); + $aColumns = []; // Note: to optimize things, the existence of the attribute is determined by the existence of one column with an empty suffix $aColumns[''] = $sPrefix.'_mimetype'; $aColumns['_data'] = $sPrefix.'_data'; @@ -8416,24 +8005,18 @@ class AttributeBlob extends AttributeDefinition // (temporary tables created on disk) // We will have to remove the blobs from the list of attributes when doing the select // then the use of Get() should finalize the load - if ($value instanceOf ormDocument) - { - $aValues = array(); - if (!$value->IsEmpty()) - { + if ($value instanceof ormDocument) { + $aValues = []; + if (!$value->IsEmpty()) { $aValues[$this->GetCode().'_data'] = $value->GetData(); - } - else - { + } else { $aValues[$this->GetCode().'_data'] = ''; } $aValues[$this->GetCode().'_mimetype'] = $value->GetMimeType(); $aValues[$this->GetCode().'_filename'] = $value->GetFileName(); $aValues[$this->GetCode().'_downloads_count'] = $value->GetDownloadsCount(); - } - else - { - $aValues = array(); + } else { + $aValues = []; $aValues[$this->GetCode().'_data'] = ''; $aValues[$this->GetCode().'_mimetype'] = ''; $aValues[$this->GetCode().'_filename'] = ''; @@ -8445,7 +8028,7 @@ class AttributeBlob extends AttributeDefinition public function GetSQLColumns($bFullSpec = false) { - $aColumns = array(); + $aColumns = []; $aColumns[$this->GetCode().'_data'] = 'LONGBLOB'; // 2^32 (4 Gb) $aColumns[$this->GetCode().'_mimetype'] = 'VARCHAR(255)'.CMDBSource::GetSqlStringColumnDefinition(); $aColumns[$this->GetCode().'_filename'] = 'VARCHAR(255)'.CMDBSource::GetSqlStringColumnDefinition(); @@ -8456,12 +8039,12 @@ class AttributeBlob extends AttributeDefinition public function GetFilterDefinitions() { - return array(); + return []; } public function GetBasicFilterOperators() { - return array(); + return []; } public function GetBasicFilterLooseOperator() @@ -8476,8 +8059,7 @@ class AttributeBlob extends AttributeDefinition public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { - if (is_object($value)) - { + if (is_object($value)) { return $value->GetAsHTML(); } @@ -8495,12 +8077,15 @@ class AttributeBlob extends AttributeDefinition * @return string */ public function GetAsCSV( - $sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $sValue, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { $sAttCode = $this->GetCode(); - if ($sValue instanceof ormDocument && !$sValue->IsEmpty()) - { + if ($sValue instanceof ormDocument && !$sValue->IsEmpty()) { return $sValue->GetDownloadURL(get_class($oHostObject), $oHostObject->GetKey(), $sAttCode); } @@ -8517,11 +8102,9 @@ class AttributeBlob extends AttributeDefinition public function GetAsXML($value, $oHostObject = null, $bLocalize = true) { $sRet = ''; - if (is_object($value)) - { + if (is_object($value)) { /** @var \ormDocument $value */ - if (!$value->IsEmpty()) - { + if (!$value->IsEmpty()) { $sRet = ''.$value->GetMimeType().''; $sRet .= ''.$value->GetFileName().''; $sRet .= ''.base64_encode($value->GetData()).''; @@ -8534,16 +8117,13 @@ class AttributeBlob extends AttributeDefinition public function GetForJSON($value) { - if ($value instanceOf ormDocument) - { - $aValues = array(); + if ($value instanceof ormDocument) { + $aValues = []; $aValues['data'] = base64_encode($value->GetData()); $aValues['mimetype'] = $value->GetMimeType(); $aValues['filename'] = $value->GetFileName(); $aValues['downloads_count'] = $value->GetDownloadsCount(); - } - else - { + } else { $aValues = null; } @@ -8552,13 +8132,10 @@ class AttributeBlob extends AttributeDefinition public function FromJSONToValue($json) { - if (isset($json->data)) - { + if (isset($json->data)) { $data = base64_decode($json->data); $value = new ormDocument($data, $json->mimetype, $json->filename, $json->downloads_count); - } - else - { + } else { $value = null; } @@ -8568,8 +8145,7 @@ class AttributeBlob extends AttributeDefinition public function Fingerprint($value) { $sFingerprint = ''; - if ($value instanceOf ormDocument) - { + if ($value instanceof ormDocument) { $sFingerprint = $value->GetSignature(); } @@ -8584,8 +8160,7 @@ class AttributeBlob extends AttributeDefinition public function MakeFormField(DBObject $oObject, $oFormField = null) { /** @var $oFormField \Combodo\iTop\Form\Field\BlobField */ - if ($oFormField === null) - { + if ($oFormField === null) { $sFormFieldClass = static::GetFormFieldClass(); $oFormField = new $sFormFieldClass($this->GetCode()); } @@ -8599,14 +8174,12 @@ class AttributeBlob extends AttributeDefinition // Setting current value correctly as the default method returns an empty string when there is no file yet. /** @var \ormDocument $value */ $value = $oObject->Get($this->GetCode()); - if(!is_object($value)) - { + if (!is_object($value)) { $oFormField->SetCurrentValue(new ormDocument()); } // Generating urls - if(is_object($value) && !$value->IsEmpty()) - { + if (is_object($value) && !$value->IsEmpty()) { $oFormField->SetDownloadUrl($value->GetDownloadURL(get_class($oObject), $oObject->GetKey(), $this->GetCode())); $oFormField->SetDisplayUrl($value->GetDisplayURL(get_class($oObject), $oObject->GetKey(), $this->GetCode())); } @@ -8688,7 +8261,7 @@ class AttributeImage extends AttributeBlob if ($sParamName === 'default_image') { /** @noinspection NestedPositiveIfStatementsInspection */ if (!empty($oParamValue)) { - return utils::GetAbsoluteUrlModulesRoot() . $oParamValue; + return utils::GetAbsoluteUrlModulesRoot().$oParamValue; } } @@ -8732,8 +8305,7 @@ class AttributeImage extends AttributeBlob */ public function CheckFormat($value) { - if ($value instanceof ormDocument && !$value->IsEmpty()) - { + if ($value instanceof ormDocument && !$value->IsEmpty()) { return ($value->GetMainMimeType() == 'image'); } @@ -8787,7 +8359,8 @@ class AttributeImage extends AttributeBlob * @since 2.6.0 new private method * @since 2.7.0 change visibility to protected */ - protected function GetHtmlForImageUrl($sUrl, $iMaxWidthPx, $iMaxHeightPx) { + protected function GetHtmlForImageUrl($sUrl, $iMaxWidthPx, $iMaxHeightPx) + { return ''; } @@ -8800,7 +8373,8 @@ class AttributeImage extends AttributeBlob * @since 2.6.0 new private method * @since 2.7.0 change visibility to protected */ - protected function GetAttributeImageFileUrl($value, $oHostObject) { + protected function GetAttributeImageFileUrl($value, $oHostObject) + { if (!is_object($value)) { return null; } @@ -8809,8 +8383,7 @@ class AttributeImage extends AttributeBlob } $bExistingImageModified = ($oHostObject->IsModified() && (array_key_exists($this->GetCode(), $oHostObject->ListChanges()))); - if ($oHostObject->IsNew() || ($bExistingImageModified)) - { + if ($oHostObject->IsNew() || ($bExistingImageModified)) { // If the object is modified (or not yet stored in the database) we must serve the content of the image directly inline // otherwise (if we just give an URL) the browser will be given the wrong content... and may cache it return 'data:'.$value->GetMimeType().';base64,'.base64_encode($value->GetData()); @@ -8826,8 +8399,7 @@ class AttributeImage extends AttributeBlob public function MakeFormField(DBObject $oObject, $oFormField = null) { - if ($oFormField === null) - { + if ($oFormField === null) { $sFormFieldClass = static::GetFormFieldClass(); $oFormField = new $sFormFieldClass($this->GetCode()); } @@ -8836,13 +8408,10 @@ class AttributeImage extends AttributeBlob // Generating urls $value = $oObject->Get($this->GetCode()); - if (is_object($value) && !$value->IsEmpty()) - { + if (is_object($value) && !$value->IsEmpty()) { $oFormField->SetDownloadUrl($value->GetDownloadURL(get_class($oObject), $oObject->GetKey(), $this->GetCode())); - $oFormField->SetDisplayUrl($value->GetDisplayURL(get_class($oObject), $oObject->GetKey(), $this->GetCode())); - } - else - { + $oFormField->SetDisplayUrl($value->GetDisplayURL(get_class($oObject), $oObject->GetKey(), $this->GetCode())); + } else { $oDefaultImage = $this->Get('default_image'); if (is_object($oDefaultImage) && !$oDefaultImage->IsEmpty()) { $oFormField->SetDownloadUrl($oDefaultImage); @@ -8861,7 +8430,7 @@ class AttributeImage extends AttributeBlob */ class AttributeStopWatch extends AttributeDefinition { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -8883,8 +8452,10 @@ class AttributeStopWatch extends AttributeDefinition public static function ListExpectedParams() { // The list of thresholds must be an array of iPercent => array of 'option' => value - return array_merge(parent::ListExpectedParams(), - array("states", "goal_computing", "working_time_computing", "thresholds")); + return array_merge( + parent::ListExpectedParams(), + ["states", "goal_computing", "working_time_computing", "thresholds"] + ); } public function GetEditClass() @@ -8940,8 +8511,7 @@ class AttributeStopWatch extends AttributeDefinition public function NewStopWatch() { $oSW = new ormStopWatch(); - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $oSW->DefineThreshold($iThreshold); } @@ -8951,8 +8521,7 @@ class AttributeStopWatch extends AttributeDefinition // Facilitate things: allow the user to Set the value from a string public function MakeRealValue($proposedValue, $oHostObj) { - if (!$proposedValue instanceof ormStopWatch) - { + if (!$proposedValue instanceof ormStopWatch) { return $this->NewStopWatch(); } @@ -8961,18 +8530,16 @@ class AttributeStopWatch extends AttributeDefinition public function GetSQLExpressions($sPrefix = '') { - if ($sPrefix == '') - { + if ($sPrefix == '') { $sPrefix = $this->GetCode(); // Warning: a stopwatch does not have any 'sql' property, so its SQL column is equal to its attribute code !! } - $aColumns = array(); + $aColumns = []; // Note: to optimize things, the existence of the attribute is determined by the existence of one column with an empty suffix $aColumns[''] = $sPrefix.'_timespent'; $aColumns['_started'] = $sPrefix.'_started'; $aColumns['_laststart'] = $sPrefix.'_laststart'; $aColumns['_stopped'] = $sPrefix.'_stopped'; - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sThPrefix = '_'.$iThreshold; $aColumns[$sThPrefix.'_deadline'] = $sPrefix.$sThPrefix.'_deadline'; $aColumns[$sThPrefix.'_passed'] = $sPrefix.$sThPrefix.'_passed'; @@ -8985,8 +8552,7 @@ class AttributeStopWatch extends AttributeDefinition public static function DateToSeconds($sDate) { - if (is_null($sDate)) - { + if (is_null($sDate)) { return null; } $oDateTime = new DateTime($sDate); @@ -8997,8 +8563,7 @@ class AttributeStopWatch extends AttributeDefinition public static function SecondsToDate($iSeconds) { - if (is_null($iSeconds)) - { + if (is_null($iSeconds)) { return null; } @@ -9007,19 +8572,16 @@ class AttributeStopWatch extends AttributeDefinition public function FromSQLToValue($aCols, $sPrefix = '') { - $aExpectedCols = array($sPrefix, $sPrefix.'_started', $sPrefix.'_laststart', $sPrefix.'_stopped'); - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + $aExpectedCols = [$sPrefix, $sPrefix.'_started', $sPrefix.'_laststart', $sPrefix.'_stopped']; + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sThPrefix = '_'.$iThreshold; $aExpectedCols[] = $sPrefix.$sThPrefix.'_deadline'; $aExpectedCols[] = $sPrefix.$sThPrefix.'_passed'; $aExpectedCols[] = $sPrefix.$sThPrefix.'_triggered'; $aExpectedCols[] = $sPrefix.$sThPrefix.'_overrun'; } - foreach($aExpectedCols as $sExpectedCol) - { - if (!array_key_exists($sExpectedCol, $aCols)) - { + foreach ($aExpectedCols as $sExpectedCol) { + if (!array_key_exists($sExpectedCol, $aCols)) { $sAvailable = implode(', ', array_keys($aCols)); throw new MissingColumnException("Missing column '$sExpectedCol' from {$sAvailable}"); } @@ -9032,8 +8594,7 @@ class AttributeStopWatch extends AttributeDefinition self::DateToSeconds($aCols[$sPrefix.'_stopped']) ); - foreach($this->ListThresholds() as $iThreshold => $aDefinition) - { + foreach ($this->ListThresholds() as $iThreshold => $aDefinition) { $sThPrefix = '_'.$iThreshold; $value->DefineThreshold( $iThreshold, @@ -9050,26 +8611,22 @@ class AttributeStopWatch extends AttributeDefinition public function GetSQLValues($value) { - if ($value instanceOf ormStopWatch) - { - $aValues = array(); + if ($value instanceof ormStopWatch) { + $aValues = []; $aValues[$this->GetCode().'_timespent'] = $value->GetTimeSpent(); $aValues[$this->GetCode().'_started'] = self::SecondsToDate($value->GetStartDate()); $aValues[$this->GetCode().'_laststart'] = self::SecondsToDate($value->GetLastStartDate()); $aValues[$this->GetCode().'_stopped'] = self::SecondsToDate($value->GetStopDate()); - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sPrefix = $this->GetCode().'_'.$iThreshold; $aValues[$sPrefix.'_deadline'] = self::SecondsToDate($value->GetThresholdDate($iThreshold)); $aValues[$sPrefix.'_passed'] = $value->IsThresholdPassed($iThreshold) ? '1' : '0'; $aValues[$sPrefix.'_triggered'] = $value->IsThresholdTriggered($iThreshold) ? '1' : '0'; $aValues[$sPrefix.'_overrun'] = $value->GetOverrun($iThreshold); } - } - else - { - $aValues = array(); + } else { + $aValues = []; $aValues[$this->GetCode().'_timespent'] = ''; $aValues[$this->GetCode().'_started'] = ''; $aValues[$this->GetCode().'_laststart'] = ''; @@ -9081,13 +8638,12 @@ class AttributeStopWatch extends AttributeDefinition public function GetSQLColumns($bFullSpec = false) { - $aColumns = array(); + $aColumns = []; $aColumns[$this->GetCode().'_timespent'] = 'INT(11) UNSIGNED'; $aColumns[$this->GetCode().'_started'] = 'DATETIME'; $aColumns[$this->GetCode().'_laststart'] = 'DATETIME'; $aColumns[$this->GetCode().'_stopped'] = 'DATETIME'; - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sPrefix = $this->GetCode().'_'.$iThreshold; $aColumns[$sPrefix.'_deadline'] = 'DATETIME'; $aColumns[$sPrefix.'_passed'] = 'TINYINT(1) UNSIGNED'; @@ -9100,12 +8656,12 @@ class AttributeStopWatch extends AttributeDefinition public function GetFilterDefinitions() { - $aRes = array( + $aRes = [ $this->GetCode() => $this->GetCode(), $this->GetCode().'_started' => $this->GetCode(), $this->GetCode().'_laststart' => $this->GetCode(), $this->GetCode().'_stopped' => $this->GetCode(), - ); + ]; foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sPrefix = $this->GetCode().'_'.$iThreshold; $aRes[$sPrefix.'_deadline'] = $this->GetCode(); @@ -9119,7 +8675,7 @@ class AttributeStopWatch extends AttributeDefinition public function GetBasicFilterOperators() { - return array(); + return []; } public function GetBasicFilterLooseOperator() @@ -9141,8 +8697,7 @@ class AttributeStopWatch extends AttributeDefinition */ public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { - if (is_object($value)) - { + if (is_object($value)) { return $value->GetAsHTML($this, $oHostObject); } @@ -9160,7 +8715,11 @@ class AttributeStopWatch extends AttributeDefinition * @return string */ public function GetAsCSV( - $value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $value, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { return $value->GetTimeSpent(); @@ -9186,8 +8745,7 @@ class AttributeStopWatch extends AttributeDefinition public function Fingerprint($value) { $sFingerprint = ''; - if (is_object($value)) - { + if (is_object($value)) { $sFingerprint = $value->GetAsHTML($this); } @@ -9206,35 +8764,31 @@ class AttributeStopWatch extends AttributeDefinition public function GetSubItemSQLExpression($sItemCode) { $sPrefix = $this->GetCode(); - switch ($sItemCode) - { + switch ($sItemCode) { case 'timespent': - return array('' => $sPrefix.'_timespent'); + return ['' => $sPrefix.'_timespent']; case 'started': - return array('' => $sPrefix.'_started'); + return ['' => $sPrefix.'_started']; case 'laststart': - return array('' => $sPrefix.'_laststart'); + return ['' => $sPrefix.'_laststart']; case 'stopped': - return array('' => $sPrefix.'_stopped'); + return ['' => $sPrefix.'_stopped']; } - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sThPrefix = $iThreshold.'_'; - if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) - { + if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) { // The current threshold is concerned $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); - switch ($sThresholdCode) - { + switch ($sThresholdCode) { case 'deadline': - return array('' => $sPrefix.'_'.$iThreshold.'_deadline'); + return ['' => $sPrefix.'_'.$iThreshold.'_deadline']; case 'passed': - return array('' => $sPrefix.'_'.$iThreshold.'_passed'); + return ['' => $sPrefix.'_'.$iThreshold.'_passed']; case 'triggered': - return array('' => $sPrefix.'_'.$iThreshold.'_triggered'); + return ['' => $sPrefix.'_'.$iThreshold.'_triggered']; case 'overrun': - return array('' => $sPrefix.'_'.$iThreshold.'_overrun'); + return ['' => $sPrefix.'_'.$iThreshold.'_overrun']; } } } @@ -9252,8 +8806,7 @@ class AttributeStopWatch extends AttributeDefinition public function GetSubItemValue($sItemCode, $value, $oHostObject = null) { $oStopWatch = $value; - switch ($sItemCode) - { + switch ($sItemCode) { case 'timespent': return $oStopWatch->GetTimeSpent(); case 'started': @@ -9264,15 +8817,12 @@ class AttributeStopWatch extends AttributeDefinition return $oStopWatch->GetStopDate(); } - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sThPrefix = $iThreshold.'_'; - if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) - { + if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) { // The current threshold is concerned $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); - switch ($sThresholdCode) - { + switch ($sThresholdCode) { case 'deadline': return $oStopWatch->GetThresholdDate($iThreshold); case 'passed': @@ -9288,86 +8838,75 @@ class AttributeStopWatch extends AttributeDefinition throw new CoreException("Unknown item code '$sItemCode' for attribute ".$this->GetHostClass().'::'.$this->GetCode()); } + public function GetSubItemSearchType($sItemCode) + { + switch ($sItemCode) { + case 'timespent': + return static::SEARCH_WIDGET_TYPE_NUMERIC; //seconds + case 'started': + case 'laststart': + case 'stopped': + return static::SEARCH_WIDGET_TYPE_DATE_TIME; //timestamp + } - public function GetSubItemSearchType($sItemCode) - { - switch ($sItemCode) - { - case 'timespent': - return static::SEARCH_WIDGET_TYPE_NUMERIC; //seconds - case 'started': - case 'laststart': - case 'stopped': - return static::SEARCH_WIDGET_TYPE_DATE_TIME; //timestamp - } + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { + $sThPrefix = $iThreshold.'_'; + if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) { + // The current threshold is concerned + $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); + switch ($sThresholdCode) { + case 'deadline': + return static::SEARCH_WIDGET_TYPE_DATE_TIME; //timestamp + case 'passed': + case 'triggered': + return static::SEARCH_WIDGET_TYPE_ENUM; //booleans, used in conjuction with GetSubItemAllowedValues and IsSubItemNullAllowed + case 'overrun': + return static::SEARCH_WIDGET_TYPE_NUMERIC; //seconds + } + } + } - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { - $sThPrefix = $iThreshold.'_'; - if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) - { - // The current threshold is concerned - $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); - switch ($sThresholdCode) - { - case 'deadline': - return static::SEARCH_WIDGET_TYPE_DATE_TIME; //timestamp - case 'passed': - case 'triggered': - return static::SEARCH_WIDGET_TYPE_ENUM; //booleans, used in conjuction with GetSubItemAllowedValues and IsSubItemNullAllowed - case 'overrun': - return static::SEARCH_WIDGET_TYPE_NUMERIC; //seconds - } - } - } + return static::SEARCH_WIDGET_TYPE_RAW; + } - return static::SEARCH_WIDGET_TYPE_RAW; - } + public function GetSubItemAllowedValues($sItemCode, $aArgs = [], $sContains = '') + { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { + $sThPrefix = $iThreshold.'_'; + if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) { + // The current threshold is concerned + $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); + switch ($sThresholdCode) { + case 'passed': + case 'triggered': + return [ + 0 => $this->GetBooleanLabel(0), + 1 => $this->GetBooleanLabel(1), + ]; + } + } + } - public function GetSubItemAllowedValues($sItemCode, $aArgs = array(), $sContains = '') - { - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { - $sThPrefix = $iThreshold.'_'; - if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) - { - // The current threshold is concerned - $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); - switch ($sThresholdCode) - { - case 'passed': - case 'triggered': - return array( - 0 => $this->GetBooleanLabel(0), - 1 => $this->GetBooleanLabel(1), - ); - } - } - } + return null; + } - return null; - } + public function IsSubItemNullAllowed($sItemCode, $bDefaultValue) + { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { + $sThPrefix = $iThreshold.'_'; + if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) { + // The current threshold is concerned + $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); + switch ($sThresholdCode) { + case 'passed': + case 'triggered': + return false; + } + } + } - public function IsSubItemNullAllowed($sItemCode, $bDefaultValue) - { - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { - $sThPrefix = $iThreshold.'_'; - if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) - { - // The current threshold is concerned - $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); - switch ($sThresholdCode) - { - case 'passed': - case 'triggered': - return false; - } - } - } - - return $bDefaultValue; - } + return $bDefaultValue; + } protected function GetBooleanLabel($bValue) { @@ -9379,8 +8918,7 @@ class AttributeStopWatch extends AttributeDefinition public function GetSubItemAsHTMLForHistory($sItemCode, $sValue) { $sHtml = null; - switch ($sItemCode) - { + switch ($sItemCode) { case 'timespent': $sHtml = (int)$sValue ? Str::pure2html(AttributeDuration::FormatDuration($sValue)) : null; break; @@ -9391,18 +8929,17 @@ class AttributeStopWatch extends AttributeDefinition break; default: - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sThPrefix = $iThreshold.'_'; - if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) - { + if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) { // The current threshold is concerned $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); - switch ($sThresholdCode) - { + switch ($sThresholdCode) { case 'deadline': - $sHtml = (int)$sValue ? date((string)AttributeDateTime::GetFormat(), - (int)$sValue) : null; + $sHtml = (int)$sValue ? date( + (string)AttributeDateTime::GetFormat(), + (int)$sValue + ) : null; break; case 'passed': case 'triggered': @@ -9422,20 +8959,16 @@ class AttributeStopWatch extends AttributeDefinition { $sRet = $value; - switch ($sItemCode) - { + switch ($sItemCode) { case 'timespent': $sRet = AttributeDuration::FormatDuration($value); break; case 'started': case 'laststart': case 'stopped': - if (is_null($value)) - { + if (is_null($value)) { $sRet = ''; // Undefined - } - else - { + } else { $oDateTime = new DateTime(); $oDateTime->setTimestamp($value); $oDateTimeFormat = AttributeDateTime::GetFormat(); @@ -9444,28 +8977,21 @@ class AttributeStopWatch extends AttributeDefinition break; default: - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sThPrefix = $iThreshold.'_'; - if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) - { + if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) { // The current threshold is concerned $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); - switch ($sThresholdCode) - { + switch ($sThresholdCode) { case 'deadline': - if ($value) - { - if (is_int($value)) - { + if ($value) { + if (is_int($value)) { $sDate = date(AttributeDateTime::GetInternalFormat(), $value); $sRet = AttributeDeadline::FormatDeadline($sDate); } else { $sRet = $value; } - } - else - { + } else { $sRet = ''; } break; @@ -9488,20 +9014,16 @@ class AttributeStopWatch extends AttributeDefinition { $sHtml = $value; - switch ($sItemCode) - { + switch ($sItemCode) { case 'timespent': $sHtml = Str::pure2html(AttributeDuration::FormatDuration($value)); break; case 'started': case 'laststart': case 'stopped': - if (is_null($value)) - { + if (is_null($value)) { $sHtml = ''; // Undefined - } - else - { + } else { $oDateTime = new DateTime(); $oDateTime->setTimestamp($value); $oDateTimeFormat = AttributeDateTime::GetFormat(); @@ -9510,23 +9032,17 @@ class AttributeStopWatch extends AttributeDefinition break; default: - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sThPrefix = $iThreshold.'_'; - if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) - { + if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) { // The current threshold is concerned $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); - switch ($sThresholdCode) - { + switch ($sThresholdCode) { case 'deadline': - if ($value) - { + if ($value) { $sDate = date(AttributeDateTime::GetInternalFormat(), $value); $sHtml = Str::pure2html(AttributeDeadline::FormatDeadline($sDate)); - } - else - { + } else { $sHtml = ''; } break; @@ -9546,23 +9062,25 @@ class AttributeStopWatch extends AttributeDefinition } public function GetSubItemAsCSV( - $sItemCode, $value, $sSeparator = ',', $sTextQualifier = '"', $bConvertToPlainText = false + $sItemCode, + $value, + $sSeparator = ',', + $sTextQualifier = '"', + $bConvertToPlainText = false ) { - $sFrom = array("\r\n", $sTextQualifier); - $sTo = array("\n", $sTextQualifier.$sTextQualifier); + $sFrom = ["\r\n", $sTextQualifier]; + $sTo = ["\n", $sTextQualifier.$sTextQualifier]; $sEscaped = str_replace($sFrom, $sTo, (string)$value); $sRet = $sTextQualifier.$sEscaped.$sTextQualifier; - switch ($sItemCode) - { + switch ($sItemCode) { case 'timespent': $sRet = $sTextQualifier.AttributeDuration::FormatDuration($value).$sTextQualifier; break; case 'started': case 'laststart': case 'stopped': - if ($value !== null) - { + if ($value !== null) { $oDateTime = new DateTime(); $oDateTime->setTimestamp($value); $oDateTimeFormat = AttributeDateTime::GetFormat(); @@ -9571,18 +9089,14 @@ class AttributeStopWatch extends AttributeDefinition break; default: - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sThPrefix = $iThreshold.'_'; - if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) - { + if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) { // The current threshold is concerned $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); - switch ($sThresholdCode) - { + switch ($sThresholdCode) { case 'deadline': - if ($value != '') - { + if ($value != '') { $oDateTime = new DateTime(); $oDateTime->setTimestamp($value); $oDateTimeFormat = AttributeDateTime::GetFormat(); @@ -9610,8 +9124,7 @@ class AttributeStopWatch extends AttributeDefinition { $sRet = Str::pure2xml((string)$value); - switch ($sItemCode) - { + switch ($sItemCode) { case 'timespent': case 'started': case 'laststart': @@ -9619,15 +9132,12 @@ class AttributeStopWatch extends AttributeDefinition break; default: - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sThPrefix = $iThreshold.'_'; - if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) - { + if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) { // The current threshold is concerned $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); - switch ($sThresholdCode) - { + switch ($sThresholdCode) { case 'deadline': case 'overrun': break; @@ -9656,41 +9166,31 @@ class AttributeStopWatch extends AttributeDefinition { $sRet = $value; - switch ($sItemCode) - { + switch ($sItemCode) { case 'timespent': break; case 'started': case 'laststart': case 'stopped': - if (is_null($value)) - { + if (is_null($value)) { $sRet = ''; // Undefined - } - else - { + } else { $sRet = date((string)AttributeDateTime::GetFormat(), $value); } break; default: - foreach($this->ListThresholds() as $iThreshold => $aFoo) - { + foreach ($this->ListThresholds() as $iThreshold => $aFoo) { $sThPrefix = $iThreshold.'_'; - if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) - { + if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix) { // The current threshold is concerned $sThresholdCode = substr($sItemCode, strlen($sThPrefix)); - switch ($sThresholdCode) - { + switch ($sThresholdCode) { case 'deadline': - if ($value) - { + if ($value) { $sRet = date((string)AttributeDateTime::GetFormat(), $value); - } - else - { + } else { $sRet = ''; } break; @@ -9768,40 +9268,40 @@ class AttributeSubItem extends AttributeDefinition } /** - * Return the search widget type corresponding to this attribute - * the computation is made by AttributeStopWatch::GetSubItemSearchType - * - * @return string - */ - public function GetSearchType() - { - /** @var AttributeStopWatch $oParent */ - $oParent = $this->GetTargetAttDef(); - - return $oParent->GetSubItemSearchType($this->Get('item_code')); - } - - public function GetAllowedValues($aArgs = array(), $sContains = '') - { - /** @var AttributeStopWatch $oParent */ - $oParent = $this->GetTargetAttDef(); - - return $oParent->GetSubItemAllowedValues($this->Get('item_code'), $aArgs, $sContains); - } - - public function IsNullAllowed() - { - /** @var AttributeStopWatch $oParent */ - $oParent = $this->GetTargetAttDef(); - - $bDefaultValue = parent::IsNullAllowed(); - - return $oParent->IsSubItemNullAllowed($this->Get('item_code'), $bDefaultValue); - } - - public static function ListExpectedParams() + * Return the search widget type corresponding to this attribute + * the computation is made by AttributeStopWatch::GetSubItemSearchType + * + * @return string + */ + public function GetSearchType() { - return array_merge(parent::ListExpectedParams(), array('target_attcode', 'item_code')); + /** @var AttributeStopWatch $oParent */ + $oParent = $this->GetTargetAttDef(); + + return $oParent->GetSubItemSearchType($this->Get('item_code')); + } + + public function GetAllowedValues($aArgs = [], $sContains = '') + { + /** @var AttributeStopWatch $oParent */ + $oParent = $this->GetTargetAttDef(); + + return $oParent->GetSubItemAllowedValues($this->Get('item_code'), $aArgs, $sContains); + } + + public function IsNullAllowed() + { + /** @var AttributeStopWatch $oParent */ + $oParent = $this->GetTargetAttDef(); + + $bDefaultValue = parent::IsNullAllowed(); + + return $oParent->IsSubItemNullAllowed($this->Get('item_code'), $bDefaultValue); + } + + public static function ListExpectedParams() + { + return array_merge(parent::ListExpectedParams(), ['target_attcode', 'item_code']); } public function GetParentAttCode() @@ -9850,7 +9350,7 @@ class AttributeSubItem extends AttributeDefinition return null; } -// public function IsNullAllowed() {return false;} + // public function IsNullAllowed() {return false;} public static function LoadInObject() { @@ -9876,7 +9376,7 @@ class AttributeSubItem extends AttributeDefinition } // -// protected function ScalarToSQL($value) {return $value;} // format value as a valuable SQL literal (quoted outside) + // protected function ScalarToSQL($value) {return $value;} // format value as a valuable SQL literal (quoted outside) public function FromSQLToValue($aCols, $sPrefix = '') { @@ -9884,17 +9384,17 @@ class AttributeSubItem extends AttributeDefinition public function GetSQLColumns($bFullSpec = false) { - return array(); + return []; } public function GetFilterDefinitions() { - return array($this->GetCode() => $this->GetCode()); + return [$this->GetCode() => $this->GetCode()]; } public function GetBasicFilterOperators() { - return array(); + return []; } public function GetBasicFilterLooseOperator() @@ -9905,8 +9405,7 @@ class AttributeSubItem extends AttributeDefinition public function GetBasicFilterSQLExpr($sOpCode, $value) { $sQValue = CMDBSource::Quote($value); - switch ($sOpCode) - { + switch ($sOpCode) { case '!=': return $this->GetSQLExpr()." != $sQValue"; break; @@ -9949,12 +9448,21 @@ class AttributeSubItem extends AttributeDefinition } public function GetAsCSV( - $value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $value, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { $oParent = $this->GetTargetAttDef(); - $res = $oParent->GetSubItemAsCSV($this->Get('item_code'), $value, $sSeparator, $sTextQualifier, - $bConvertToPlainText); + $res = $oParent->GetSubItemAsCSV( + $this->Get('item_code'), + $value, + $sSeparator, + $sTextQualifier, + $bConvertToPlainText + ); return $res; } @@ -9990,8 +9498,7 @@ class AttributeSubItem extends AttributeDefinition public function MakeFormField(DBObject $oObject, $oFormField = null) { - if ($oFormField === null) - { + if ($oFormField === null) { $sFormFieldClass = static::GetFormFieldClass(); $oFormField = new $sFormFieldClass($this->GetCode()); } @@ -10012,7 +9519,7 @@ class AttributeSubItem extends AttributeDefinition */ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeNoGroupBy { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -10033,7 +9540,7 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array("depends_on")); + return array_merge(parent::ListExpectedParams(), ["depends_on"]); } public function GetEditClass() @@ -10070,12 +9577,9 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN public function MakeRealValue($proposedValue, $oHostObj) { $oPassword = $proposedValue; - if (is_object($oPassword)) - { + if (is_object($oPassword)) { $oPassword = clone $proposedValue; - } - else - { + } else { $oPassword = new ormPassword('', ''); $oPassword->SetPassword($proposedValue); } @@ -10085,11 +9589,10 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN public function GetSQLExpressions($sPrefix = '') { - if ($sPrefix == '') - { + if ($sPrefix == '') { $sPrefix = $this->GetCode(); // Warning: AttributeOneWayPassword does not have any sql property so code = sql ! } - $aColumns = array(); + $aColumns = []; // Note: to optimize things, the existence of the attribute is determined by the existence of one column with an empty suffix $aColumns[''] = $sPrefix.'_hash'; $aColumns['_salt'] = $sPrefix.'_salt'; @@ -10099,15 +9602,13 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN public function FromSQLToValue($aCols, $sPrefix = '') { - if (!array_key_exists($sPrefix, $aCols)) - { + if (!array_key_exists($sPrefix, $aCols)) { $sAvailable = implode(', ', array_keys($aCols)); throw new MissingColumnException("Missing column '$sPrefix' from {$sAvailable}"); } $hashed = isset($aCols[$sPrefix]) ? $aCols[$sPrefix] : ''; - if (!array_key_exists($sPrefix.'_salt', $aCols)) - { + if (!array_key_exists($sPrefix.'_salt', $aCols)) { $sAvailable = implode(', ', array_keys($aCols)); throw new MissingColumnException("Missing column '".$sPrefix."_salt' from {$sAvailable}"); } @@ -10126,15 +9627,12 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN // (temporary tables created on disk) // We will have to remove the blobs from the list of attributes when doing the select // then the use of Get() should finalize the load - if ($value instanceOf ormPassword) - { - $aValues = array(); + if ($value instanceof ormPassword) { + $aValues = []; $aValues[$this->GetCode().'_hash'] = $value->GetHash(); $aValues[$this->GetCode().'_salt'] = $value->GetSalt(); - } - else - { - $aValues = array(); + } else { + $aValues = []; $aValues[$this->GetCode().'_hash'] = ''; $aValues[$this->GetCode().'_salt'] = ''; } @@ -10144,7 +9642,7 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN public function GetSQLColumns($bFullSpec = false) { - $aColumns = array(); + $aColumns = []; $aColumns[$this->GetCode().'_hash'] = 'TINYBLOB'; $aColumns[$this->GetCode().'_salt'] = 'TINYBLOB'; @@ -10153,7 +9651,7 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN public function GetImportColumns() { - $aColumns = array(); + $aColumns = []; $aColumns[$this->GetCode()] = 'TINYTEXT'.CMDBSource::GetSqlStringColumnDefinition(); return $aColumns; @@ -10161,8 +9659,7 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN public function FromImportToValue($aCols, $sPrefix = '') { - if (!isset($aCols[$sPrefix])) - { + if (!isset($aCols[$sPrefix])) { $sAvailable = implode(', ', array_keys($aCols)); throw new MissingColumnException("Missing column '$sPrefix' from {$sAvailable}"); } @@ -10176,13 +9673,13 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN public function GetFilterDefinitions() { - return array(); + return []; // still not working... see later... } public function GetBasicFilterOperators() { - return array(); + return []; } public function GetBasicFilterLooseOperator() @@ -10197,8 +9694,7 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { - if (is_object($value)) - { + if (is_object($value)) { return $value->GetAsHTML(); } @@ -10206,7 +9702,11 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN } public function GetAsCSV( - $sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $sValue, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { return ''; // Not exportable in CSV @@ -10258,7 +9758,7 @@ class AttributeOneWayPassword extends AttributeDefinition implements iAttributeN // Indexed array having two dimensions class AttributeTable extends AttributeDBField { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -10294,7 +9794,7 @@ class AttributeTable extends AttributeDBField public function GetNullValue() { - return array(); + return []; } public function IsNull($proposedValue) @@ -10310,7 +9810,6 @@ class AttributeTable extends AttributeDBField return count($proposedValue) > 0; } - public function GetEditValue($sValue, $oHostObj = null) { return ''; @@ -10319,15 +9818,11 @@ class AttributeTable extends AttributeDBField // Facilitate things: allow the user to Set the value from a string public function MakeRealValue($proposedValue, $oHostObj) { - if (is_null($proposedValue)) - { - return array(); - } - else - { - if (!is_array($proposedValue)) - { - return array(0 => array(0 => $proposedValue)); + if (is_null($proposedValue)) { + return []; + } else { + if (!is_array($proposedValue)) { + return [0 => [0 => $proposedValue]]; } } @@ -10336,23 +9831,18 @@ class AttributeTable extends AttributeDBField public function FromSQLToValue($aCols, $sPrefix = '') { - try - { + try { $value = @unserialize($aCols[$sPrefix.'']); - if ($value === false) - { + if ($value === false) { $value = @json_decode($aCols[$sPrefix.''], true); - if (is_null($value)) - { + if (is_null($value)) { $value = false; } } - if ($value === false) - { + if ($value === false) { $value = $this->MakeRealValue($aCols[$sPrefix.''], null); } - } catch (Exception $e) - { + } catch (Exception $e) { $value = $this->MakeRealValue($aCols[$sPrefix.''], null); } @@ -10361,13 +9851,10 @@ class AttributeTable extends AttributeDBField public function GetSQLValues($value) { - $aValues = array(); - try - { + $aValues = []; + try { $sSerializedValue = serialize($value); - } - catch (Exception $e) - { + } catch (Exception $e) { $sSerializedValue = json_encode($value); } $aValues[$this->Get("sql")] = $sSerializedValue; @@ -10377,22 +9864,18 @@ class AttributeTable extends AttributeDBField public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { - if (!is_array($value)) - { - throw new CoreException('Expecting an array', array('found' => get_class($value))); + if (!is_array($value)) { + throw new CoreException('Expecting an array', ['found' => get_class($value)]); } - if (count($value) == 0) - { + if (count($value) == 0) { return ""; } $sRes = ""; $sRes .= ""; - foreach($value as $iRow => $aRawData) - { + foreach ($value as $iRow => $aRawData) { $sRes .= ""; - foreach($aRawData as $iCol => $cell) - { + foreach ($aRawData as $iCol => $cell) { // Note: avoid the warning in case the cell is made of an array $sCell = @Str::pure2html((string)$cell); $sCell = str_replace("\n", "
      \n", $sCell); @@ -10407,7 +9890,11 @@ class AttributeTable extends AttributeDBField } public function GetAsCSV( - $sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $sValue, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { // Not implemented @@ -10416,17 +9903,14 @@ class AttributeTable extends AttributeDBField public function GetAsXML($value, $oHostObject = null, $bLocalize = true) { - if (!is_array($value) || count($value) == 0) - { + if (!is_array($value) || count($value) == 0) { return ""; } $sRes = ""; - foreach($value as $iRow => $aRawData) - { + foreach ($value as $iRow => $aRawData) { $sRes .= ""; - foreach($aRawData as $iCol => $cell) - { + foreach ($aRawData as $iCol => $cell) { $sCell = Str::pure2xml((string)$cell); $sRes .= "$sCell"; } @@ -10465,9 +9949,8 @@ class AttributePropertySet extends AttributeTable // Facilitate things: allow the user to Set the value from a string public function MakeRealValue($proposedValue, $oHostObj) { - if (!is_array($proposedValue)) - { - return array('?' => (string)$proposedValue); + if (!is_array($proposedValue)) { + return ['?' => (string)$proposedValue]; } return $proposedValue; @@ -10475,21 +9958,17 @@ class AttributePropertySet extends AttributeTable public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { - if (!is_array($value)) - { - throw new CoreException('Expecting an array', array('found' => get_class($value))); + if (!is_array($value)) { + throw new CoreException('Expecting an array', ['found' => get_class($value)]); } - if (count($value) == 0) - { + if (count($value) == 0) { return ""; } $sRes = "
      "; $sRes .= ""; - foreach($value as $sProperty => $sValue) - { - if ($sProperty == 'auth_pwd') - { + foreach ($value as $sProperty => $sValue) { + if ($sProperty == 'auth_pwd') { $sValue = '*****'; } $sRes .= ""; @@ -10504,29 +9983,30 @@ class AttributePropertySet extends AttributeTable } public function GetAsCSV( - $value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $value, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { - if (!is_array($value) || count($value) == 0) - { + if (!is_array($value) || count($value) == 0) { return ""; } - $aRes = array(); - foreach($value as $sProperty => $sValue) - { - if ($sProperty == 'auth_pwd') - { + $aRes = []; + foreach ($value as $sProperty => $sValue) { + if ($sProperty == 'auth_pwd') { $sValue = '*****'; } - $sFrom = array(',', '='); - $sTo = array('\,', '\='); + $sFrom = [',', '=']; + $sTo = ['\,', '\=']; $aRes[] = $sProperty.'='.str_replace($sFrom, $sTo, (string)$sValue); } $sRaw = implode(',', $aRes); - $sFrom = array("\r\n", $sTextQualifier); - $sTo = array("\n", $sTextQualifier.$sTextQualifier); + $sFrom = ["\r\n", $sTextQualifier]; + $sTo = ["\n", $sTextQualifier.$sTextQualifier]; $sEscaped = str_replace($sFrom, $sTo, $sRaw); return $sTextQualifier.$sEscaped.$sTextQualifier; @@ -10534,16 +10014,13 @@ class AttributePropertySet extends AttributeTable public function GetAsXML($value, $oHostObject = null, $bLocalize = true) { - if (!is_array($value) || count($value) == 0) - { + if (!is_array($value) || count($value) == 0) { return ""; } $sRes = ""; - foreach($value as $sProperty => $sValue) - { - if ($sProperty == 'auth_pwd') - { + foreach ($value as $sProperty => $sValue) { + if ($sProperty == 'auth_pwd') { $sValue = '*****'; } $sRes .= ""; @@ -10563,8 +10040,8 @@ class AttributePropertySet extends AttributeTable */ abstract class AttributeSet extends AttributeDBFieldVoid { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; - const EDITABLE_INPUT_ID_SUFFIX = '-setwidget-values'; // used client side, see js/jquery.itop-set-widget.js + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; + public const EDITABLE_INPUT_ID_SUFFIX = '-setwidget-values'; // used client side, see js/jquery.itop-set-widget.js protected $bDisplayLink; // Display search link in readonly mode public function __construct($sCode, array $aParams) @@ -10584,7 +10061,7 @@ abstract class AttributeSet extends AttributeDBFieldVoid public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array('is_null_allowed', 'max_items')); + return array_merge(parent::ListExpectedParams(), ['is_null_allowed', 'max_items']); } /** @@ -10597,7 +10074,7 @@ abstract class AttributeSet extends AttributeDBFieldVoid * @throws \CoreException * @throws \OQLException */ - public function GetPossibleValues($aArgs = array(), $sContains = '') + public function GetPossibleValues($aArgs = [], $sContains = '') { return $this->GetAllowedValues($aArgs, $sContains); } @@ -10611,43 +10088,35 @@ abstract class AttributeSet extends AttributeDBFieldVoid * @throws \CoreException * @throws \OQLException */ - public function GetJsonForWidget($oValue, $aArgs = array()) + public function GetJsonForWidget($oValue, $aArgs = []) { - $aJson = array(); + $aJson = []; // possible_values $aAllowedValues = $this->GetPossibleValues($aArgs); - $aSetKeyValData = array(); - foreach($aAllowedValues as $sCode => $sLabel) - { + $aSetKeyValData = []; + foreach ($aAllowedValues as $sCode => $sLabel) { $aSetKeyValData[] = [ 'code' => $sCode, 'label' => $sLabel, ]; } $aJson['possible_values'] = $aSetKeyValData; - $aRemoved = array(); - if (is_null($oValue)) - { - $aJson['partial_values'] = array(); - $aJson['orig_value'] = array(); - } - else - { + $aRemoved = []; + if (is_null($oValue)) { + $aJson['partial_values'] = []; + $aJson['orig_value'] = []; + } else { $aPartialValues = $oValue->GetModified(); - foreach ($aPartialValues as $key => $value) - { - if (!isset($aAllowedValues[$value])) - { + foreach ($aPartialValues as $key => $value) { + if (!isset($aAllowedValues[$value])) { unset($aPartialValues[$key]); } } $aJson['partial_values'] = array_values($aPartialValues); $aOrigValues = array_merge($oValue->GetValues(), $oValue->GetModified()); - foreach ($aOrigValues as $key => $value) - { - if (!isset($aAllowedValues[$value])) - { + foreach ($aOrigValues as $key => $value) { + if (!isset($aAllowedValues[$value])) { // Remove unwanted values $aRemoved[] = $value; unset($aOrigValues[$key]); @@ -10655,7 +10124,7 @@ abstract class AttributeSet extends AttributeDBFieldVoid } $aJson['orig_value'] = array_values($aOrigValues); } - $aJson['added'] = array(); + $aJson['added'] = []; $aJson['removed'] = $aRemoved; $iMaxTags = $this->GetMaxItems(); @@ -10691,16 +10160,13 @@ abstract class AttributeSet extends AttributeDBFieldVoid public function GetEditValue($value, $oHostObj = null) { - if (is_string($value)) - { + if (is_string($value)) { return $value; } - if ($value instanceof ormSet) - { + if ($value instanceof ormSet) { $value = $value->GetValues(); } - if (is_array($value)) - { + if (is_array($value)) { return implode(', ', $value); } return ''; @@ -10721,20 +10187,16 @@ abstract class AttributeSet extends AttributeDBFieldVoid public function FromStringToArray($proposedValue, $sDefaultSepItem = ',') { - $aValues = array(); - if (!empty($proposedValue)) - { + $aValues = []; + if (!empty($proposedValue)) { $sSepItem = MetaModel::GetConfig()->Get('tag_set_item_separator'); // convert also , separated strings - if ($sSepItem !== $sDefaultSepItem) - { + if ($sSepItem !== $sDefaultSepItem) { $proposedValue = str_replace($sDefaultSepItem, $sSepItem, $proposedValue); } - foreach(explode($sSepItem, $proposedValue) as $sCode) - { + foreach (explode($sSepItem, $proposedValue) as $sCode) { $sValue = trim($sCode); - if ($sValue !== '') - { + if ($sValue !== '') { $aValues[] = $sValue; } } @@ -10772,21 +10234,16 @@ abstract class AttributeSet extends AttributeDBFieldVoid { $oSet = new ormSet(MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), $this->GetCode(), $this->GetMaxItems()); $aAllowedValues = $this->GetPossibleValues(); - if (is_string($proposedValue) && !empty($proposedValue)) - { + if (is_string($proposedValue) && !empty($proposedValue)) { $proposedValue = trim("$proposedValue"); $aValues = $this->FromStringToArray($proposedValue); - foreach ($aValues as $i => $sValue) - { - if (!isset($aAllowedValues[$sValue])) - { + foreach ($aValues as $i => $sValue) { + if (!isset($aAllowedValues[$sValue])) { unset($aValues[$i]); } } $oSet->SetValues($aValues); - } - elseif ($proposedValue instanceof ormSet) - { + } elseif ($proposedValue instanceof ormSet) { $oSet = $proposedValue; } @@ -10823,8 +10280,7 @@ abstract class AttributeSet extends AttributeDBFieldVoid public function IsNull($proposedValue) { - if (empty($proposedValue)) - { + if (empty($proposedValue)) { return true; } @@ -10854,12 +10310,10 @@ abstract class AttributeSet extends AttributeDBFieldVoid */ public function GetValueLabel($sValue) { - if ($sValue instanceof ormSet) - { + if ($sValue instanceof ormSet) { $sValue = $sValue->GetValues(); } - if (is_array($sValue)) - { + if (is_array($sValue)) { return implode(', ', $sValue); } return $sValue; @@ -10884,24 +10338,18 @@ abstract class AttributeSet extends AttributeDBFieldVoid */ public function ScalarToSQL($value) { - if (empty($value)) - { + if (empty($value)) { return ''; } - if ($value instanceof ormSet) - { + if ($value instanceof ormSet) { $value = $value->GetValues(); } - if (is_array($value)) - { + if (is_array($value)) { $sSepItem = MetaModel::GetConfig()->Get('tag_set_item_separator'); $sRes = implode($sSepItem, $value); - if (!empty($sRes)) - { + if (!empty($sRes)) { $value = "{$sSepItem}{$sRes}{$sSepItem}"; - } - else - { + } else { $value = ''; } } @@ -10919,13 +10367,11 @@ abstract class AttributeSet extends AttributeDBFieldVoid */ public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { - if ($value instanceof ormSet) - { + if ($value instanceof ormSet) { $aValues = $value->GetValues(); return $this->GenerateViewHtmlForValues($aValues); } - if (is_array($value)) - { + if (is_array($value)) { return implode(', ', $value); } return $value; @@ -10945,9 +10391,11 @@ abstract class AttributeSet extends AttributeDBFieldVoid */ public function GenerateViewHtmlForValues($aValues, $sCssClass = '', $bWithLink = true) { - if (empty($aValues)) {return '';} + if (empty($aValues)) { + return ''; + } $sHtml = ''; - foreach($aValues as $sValue) { + foreach ($aValues as $sValue) { $sClass = MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()); $sAttCode = $this->GetCode(); $sLabel = utils::EscapeHtml($this->GetValueLabel($sValue)); @@ -10996,20 +10444,14 @@ HTML; public function GetAsCSV($value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, $bConvertToPlainText = false) { $sSepItem = MetaModel::GetConfig()->Get('tag_set_item_separator'); - if (is_object($value) && ($value instanceof ormSet)) - { - if ($bLocalize) - { + if (is_object($value) && ($value instanceof ormSet)) { + if ($bLocalize) { $aValues = $value->GetLabels(); - } - else - { + } else { $aValues = $value->GetValues(); } $sRes = implode($sSepItem, $aValues); - } - else - { + } else { $sRes = ''; } @@ -11030,7 +10472,8 @@ HTML; { /** @var \ormSet $original */ /** @var \ormSet $value */ - parent::RecordAttChange($oObject, + parent::RecordAttChange( + $oObject, implode(' ', $original->GetValues()), implode(' ', $value->GetValues()) ); @@ -11047,48 +10490,44 @@ HTML; */ class AttributeEnumSet extends AttributeSet { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_TAG_SET; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_TAG_SET; public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array('possible_values', 'is_null_allowed', 'max_items')); + return array_merge(parent::ListExpectedParams(), ['possible_values', 'is_null_allowed', 'max_items']); } public function GetMaxSize() { $aRawValues = $this->GetRawPossibleValues(); $iMaxItems = $this->GetMaxItems(); - $aLengths = array(); - foreach (array_keys($aRawValues) as $sKey) - { + $aLengths = []; + foreach (array_keys($aRawValues) as $sKey) { $aLengths[] = strlen($sKey); } rsort($aLengths, SORT_NUMERIC); $iMaxSize = 2; - for ($i = 0; $i < min($iMaxItems, count($aLengths)); $i++) - { + for ($i = 0; $i < min($iMaxItems, count($aLengths)); $i++) { $iMaxSize += $aLengths[$i] + 1; } return max(255, $iMaxSize); } - private function GetRawPossibleValues($aArgs = array(), $sContains = '') + private function GetRawPossibleValues($aArgs = [], $sContains = '') { /** @var ValueSetEnumPadded $oValSetDef */ $oValSetDef = $this->Get('possible_values'); - if (!$oValSetDef) - { - return array(); + if (!$oValSetDef) { + return []; } return $oValSetDef->GetValues($aArgs, $sContains); } - public function GetPossibleValues($aArgs = array(), $sContains = '') + public function GetPossibleValues($aArgs = [], $sContains = '') { $aRawValues = $this->GetRawPossibleValues($aArgs, $sContains); - $aLocalizedValues = array(); - foreach($aRawValues as $sKey => $sValue) - { + $aLocalizedValues = []; + foreach ($aRawValues as $sKey => $sValue) { $aLocalizedValues[$sKey] = $this->GetValueLabel($sKey); } @@ -11097,32 +10536,27 @@ class AttributeEnumSet extends AttributeSet public function GetValueLabel($sValue) { - if ($sValue instanceof ormSet) - { + if ($sValue instanceof ormSet) { $sValue = implode(', ', $sValue->GetValues()); } $aValues = $this->GetRawPossibleValues(); - if (is_array($aValues) && is_string($sValue) && isset($aValues[$sValue])) - { + if (is_array($aValues) && is_string($sValue) && isset($aValues[$sValue])) { $sValue = $aValues[$sValue]; } - if (is_null($sValue)) - { + if (is_null($sValue)) { // Unless a specific label is defined for the null value of this enum, use a generic "undefined" label - $sLabel = Dict::S('Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue, - Dict::S('Enum:Undefined')); - } - else - { + $sLabel = Dict::S( + 'Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue, + Dict::S('Enum:Undefined') + ); + } else { $sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode.'/Value:'.$sValue, null, true /*user lang*/); - if (is_null($sLabel)) - { + if (is_null($sLabel)) { // Browse the hierarchy again, accepting default (english) translations $sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode.'/Value:'.$sValue, null, false); - if (is_null($sLabel)) - { + if (is_null($sLabel)) { $sDefault = trim(str_replace('_', ' ', $sValue)); // Browse the hierarchy again, accepting default (english) translations $sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode.'/Value:'.$sDefault, $sDefault, false); @@ -11135,23 +10569,22 @@ class AttributeEnumSet extends AttributeSet public function GetValueDescription($sValue) { - if (is_null($sValue)) - { + if (is_null($sValue)) { // Unless a specific label is defined for the null value of this enum, use a generic "undefined" label - $sDescription = Dict::S('Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue.'+', - Dict::S('Enum:Undefined')); - } - else - { - $sDescription = Dict::S('Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue.'+', - '', true /* user language only */); - if (strlen($sDescription) == 0) - { + $sDescription = Dict::S( + 'Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue.'+', + Dict::S('Enum:Undefined') + ); + } else { + $sDescription = Dict::S( + 'Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue.'+', + '', + true /* user language only */ + ); + if (strlen($sDescription) == 0) { $sParentClass = MetaModel::GetParentClass($this->m_sHostClass); - if ($sParentClass) - { - if (MetaModel::IsValidAttCode($sParentClass, $this->m_sCode)) - { + if ($sParentClass) { + if (MetaModel::IsValidAttCode($sParentClass, $this->m_sCode)) { $oAttDef = MetaModel::GetAttributeDef($sParentClass, $this->m_sCode); $sDescription = $oAttDef->GetValueDescription($sValue); } @@ -11164,28 +10597,21 @@ class AttributeEnumSet extends AttributeSet public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { - if ($bLocalize) - { - if ($value instanceof ormSet) - { + if ($bLocalize) { + if ($value instanceof ormSet) { $sRes = $this->GenerateViewHtmlForValues($value->GetValues()); - } - else - { + } else { $sLabel = $this->GetValueLabel($value); $sDescription = $this->GetValueDescription($value); $sRes = "".parent::GetAsHtml($sLabel).""; } - } - else - { + } else { $sRes = parent::GetAsHtml($value, $oHostObject, $bLocalize); } return $sRes; } - /** * @param ormSet $value * @param string $sSeparator @@ -11200,22 +10626,17 @@ class AttributeEnumSet extends AttributeSet public function GetAsCSV($value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, $bConvertToPlainText = false) { $sSepItem = MetaModel::GetConfig()->Get('tag_set_item_separator'); - if (is_object($value) && ($value instanceof ormSet)) - { + if (is_object($value) && ($value instanceof ormSet)) { $aValues = $value->GetValues(); - if ($bLocalize) - { - $aLocalizedValues = array(); - foreach($aValues as $sValue) - { + if ($bLocalize) { + $aLocalizedValues = []; + foreach ($aValues as $sValue) { $aLocalizedValues[] = $this->GetValueLabel($sValue); } $aValues = $aLocalizedValues; } $sRes = implode($sSepItem, $aValues); - } - else - { + } else { $sRes = ''; } @@ -11237,36 +10658,29 @@ class AttributeEnumSet extends AttributeSet */ public function MakeValueFromString($sProposedValue, $bLocalizedValue = false, $sSepItem = null, $sSepAttribute = null, $sSepValue = null, $sAttributeQualifier = null) { - if ($bLocalizedValue) - { + if ($bLocalizedValue) { // Lookup for the values matching the input // $aValues = $this->FromStringToArray($sProposedValue); - $aFoundValues = array(); + $aFoundValues = []; $aRawValues = $this->GetPossibleValues(); - foreach ($aValues as $sValue) - { + foreach ($aValues as $sValue) { $bFound = false; - foreach ($aRawValues as $sCode => $sRawValue) - { - if ($sValue == $sRawValue) - { + foreach ($aRawValues as $sCode => $sRawValue) { + if ($sValue == $sRawValue) { $aFoundValues[] = $sCode; $bFound = true; break; } } - if (!$bFound) - { + if (!$bFound) { // Not found, break the import return null; } } return $this->MakeRealValue(implode(',', $aFoundValues), null); - } - else - { + } else { return $this->MakeRealValue($sProposedValue, null, false); } } @@ -11281,20 +10695,16 @@ class AttributeEnumSet extends AttributeSet */ public function FromStringToArray($proposedValue, $sDefaultSepItem = ',') { - $aValues = array(); - if (!empty($proposedValue)) - { + $aValues = []; + if (!empty($proposedValue)) { $sSepItem = MetaModel::GetConfig()->Get('tag_set_item_separator'); // convert also other separators - if ($sSepItem !== $sDefaultSepItem) - { + if ($sSepItem !== $sDefaultSepItem) { $proposedValue = str_replace($sDefaultSepItem, $sSepItem, $proposedValue); } - foreach(explode($sSepItem, $proposedValue) as $sCode) - { + foreach (explode($sSepItem, $proposedValue) as $sCode) { $sValue = trim($sCode); - if (strlen($sValue) > 2) - { + if (strlen($sValue) > 2) { $sLabel = $this->GetValueLabel($sValue); $aValues[$sLabel] = $sValue; } @@ -11308,12 +10718,11 @@ class AttributeEnumSet extends AttributeSet } } - class AttributeClassAttCodeSet extends AttributeSet { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; - const DEFAULT_PARAM_INCLUDE_CHILD_CLASSES_ATTRIBUTES = false; + public const DEFAULT_PARAM_INCLUDE_CHILD_CLASSES_ATTRIBUTES = false; public function __construct($sCode, array $aParams) { @@ -11323,7 +10732,7 @@ class AttributeClassAttCodeSet extends AttributeSet public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array('class_field', 'attribute_definition_list', 'attribute_definition_exclusion_list')); + return array_merge(parent::ListExpectedParams(), ['class_field', 'attribute_definition_list', 'attribute_definition_exclusion_list']); } public function GetMaxSize() @@ -11338,10 +10747,9 @@ class AttributeClassAttCodeSet extends AttributeSet * @return array|null * @throws \CoreException */ - public function GetAllowedValues($aArgs = array(), $sContains = '') + public function GetAllowedValues($aArgs = [], $sContains = '') { - if (!isset($aArgs['this'])) - { + if (!isset($aArgs['this'])) { return null; } @@ -11350,87 +10758,68 @@ class AttributeClassAttCodeSet extends AttributeSet $sRootClass = $oHostObj->Get($sTargetClass); $bIncludeChildClasses = $this->GetOptional('include_child_classes_attributes', static::DEFAULT_PARAM_INCLUDE_CHILD_CLASSES_ATTRIBUTES); - $aExcludeDefs = array(); + $aExcludeDefs = []; $sAttDefExclusionList = $this->Get('attribute_definition_exclusion_list'); - if (!empty($sAttDefExclusionList)) - { - foreach(explode(',', $sAttDefExclusionList) as $sAttDefName) - { + if (!empty($sAttDefExclusionList)) { + foreach (explode(',', $sAttDefExclusionList) as $sAttDefName) { $sAttDefName = trim($sAttDefName); $aExcludeDefs[$sAttDefName] = $sAttDefName; } } - $aAllowedDefs = array(); + $aAllowedDefs = []; $sAttDefList = $this->Get('attribute_definition_list'); - if (!empty($sAttDefList)) - { - foreach(explode(',', $sAttDefList) as $sAttDefName) - { + if (!empty($sAttDefList)) { + foreach (explode(',', $sAttDefList) as $sAttDefName) { $sAttDefName = trim($sAttDefName); $aAllowedDefs[$sAttDefName] = $sAttDefName; } } - $aAllAttributes = array(); - if (!empty($sRootClass)) - { - $aClasses = array($sRootClass); - if($bIncludeChildClasses === true) - { + $aAllAttributes = []; + if (!empty($sRootClass)) { + $aClasses = [$sRootClass]; + if ($bIncludeChildClasses === true) { $aClasses = $aClasses + MetaModel::EnumChildClasses($sRootClass, ENUM_CHILD_CLASSES_EXCLUDETOP); } - foreach($aClasses as $sClass) - { - foreach(MetaModel::GetAttributesList($sClass) as $sAttCode) - { + foreach ($aClasses as $sClass) { + foreach (MetaModel::GetAttributesList($sClass) as $sAttCode) { // Add attribute only if not already there (can be in leaf classes but not the root) - if(!array_key_exists($sAttCode, $aAllAttributes)) - { + if (!array_key_exists($sAttCode, $aAllAttributes)) { $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); $sAttDefClass = get_class($oAttDef); // Skip excluded attdefs - if(isset($aExcludeDefs[$sAttDefClass])) - { + if (isset($aExcludeDefs[$sAttDefClass])) { continue; } // Skip not allowed attdefs only if list specified - if(!empty($aAllowedDefs) && !isset($aAllowedDefs[$sAttDefClass])) - { + if (!empty($aAllowedDefs) && !isset($aAllowedDefs[$sAttDefClass])) { continue; } - $aAllAttributes[$sAttCode] = array( - 'classes' => array($sClass), - ); - } - else - { + $aAllAttributes[$sAttCode] = [ + 'classes' => [$sClass], + ]; + } else { $aAllAttributes[$sAttCode]['classes'][] = $sClass; } } } } - $aAllowedAttributes = array(); - foreach($aAllAttributes as $sAttCode => $aAttData) - { + $aAllowedAttributes = []; + foreach ($aAllAttributes as $sAttCode => $aAttData) { $iAttClassesCount = count($aAttData['classes']); $sAttFirstClass = $aAttData['classes'][0]; $sAttLabel = MetaModel::GetLabel($sAttFirstClass, $sAttCode); - if($sAttFirstClass === $sRootClass) - { + if ($sAttFirstClass === $sRootClass) { $sLabel = Dict::Format('Core:AttributeClassAttCodeSet:ItemLabel:AttributeFromClass', $sAttCode, $sAttLabel); - } - elseif($iAttClassesCount === 1) - { + } elseif ($iAttClassesCount === 1) { $sLabel = Dict::Format('Core:AttributeClassAttCodeSet:ItemLabel:AttributeFromOneChildClass', $sAttCode, $sAttLabel, MetaModel::GetName($sAttFirstClass)); - } - else - { + } else { $sLabel = Dict::Format('Core:AttributeClassAttCodeSet:ItemLabel:AttributeFromSeveralChildClasses', $sAttCode, $sAttLabel); } $aAllowedAttributes[$sAttCode] = $sLabel; @@ -11457,42 +10846,32 @@ class AttributeClassAttCodeSet extends AttributeSet public function MakeRealValue($proposedValue, $oHostObj, $bIgnoreErrors = false) { $oSet = new ormSet(MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), $this->GetCode(), $this->GetMaxItems()); - $aArgs = array(); - if (!empty($oHostObj)) - { + $aArgs = []; + if (!empty($oHostObj)) { $aArgs['this'] = $oHostObj; } $aAllowedAttributes = $this->GetAllowedValues($aArgs); - $aInvalidAttCodes = array(); - if (is_string($proposedValue) && !empty($proposedValue)) - { + $aInvalidAttCodes = []; + if (is_string($proposedValue) && !empty($proposedValue)) { $aJsonFromWidget = json_decode($proposedValue, true); - if (is_null($aJsonFromWidget)) - { + if (is_null($aJsonFromWidget)) { $proposedValue = trim($proposedValue); $aProposedValues = $this->FromStringToArray($proposedValue); - $aValues = array(); - foreach($aProposedValues as $sValue) - { + $aValues = []; + foreach ($aProposedValues as $sValue) { $sAttCode = trim($sValue); - if (empty($aAllowedAttributes) || isset($aAllowedAttributes[$sAttCode])) - { + if (empty($aAllowedAttributes) || isset($aAllowedAttributes[$sAttCode])) { $aValues[$sAttCode] = $sAttCode; - } - else - { + } else { $aInvalidAttCodes[] = $sAttCode; } } $oSet->SetValues($aValues); } - } - elseif ($proposedValue instanceof ormSet) - { + } elseif ($proposedValue instanceof ormSet) { $oSet = $proposedValue; } - if (!empty($aInvalidAttCodes) && !$bIgnoreErrors) - { + if (!empty($aInvalidAttCodes) && !$bIgnoreErrors) { $sTargetClass = $this->Get('class_field'); $sClass = $oHostObj->Get($sTargetClass); throw new CoreUnexpectedValue("The attribute(s) ".implode(', ', $aInvalidAttCodes)." are invalid for class {$sClass}"); @@ -11512,22 +10891,17 @@ class AttributeClassAttCodeSet extends AttributeSet */ public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { - if ($value instanceof ormSet) - { + if ($value instanceof ormSet) { $value = $value->GetValues(); } - if (is_array($value)) - { - if (!empty($oHostObject) && $bLocalize) - { + if (is_array($value)) { + if (!empty($oHostObject) && $bLocalize) { $sTargetClass = $this->Get('class_field'); $sClass = $oHostObject->Get($sTargetClass); - $aLocalizedValues = array(); - foreach($value as $sAttCode) - { - try - { + $aLocalizedValues = []; + foreach ($value as $sAttCode) { + try { $sAttClass = $sClass; // Look for the first class (current or children) that have this attcode @@ -11540,8 +10914,7 @@ class AttributeClassAttCodeSet extends AttributeSet $sLabelForHtmlAttribute = utils::HtmlEntities(MetaModel::GetLabel($sAttClass, $sAttCode)." ($sAttCode)"); $aLocalizedValues[] = ''.$sAttCode.''; - } catch (Exception $e) - { + } catch (Exception $e) { // Ignore bad values } } @@ -11560,7 +10933,7 @@ class AttributeClassAttCodeSet extends AttributeSet class AttributeQueryAttCodeSet extends AttributeSet { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; public function __construct($sCode, array $aParams) { @@ -11570,7 +10943,7 @@ class AttributeQueryAttCodeSet extends AttributeSet public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array('query_field')); + return array_merge(parent::ListExpectedParams(), ['query_field']); } protected function GetSQLCol($bFullSpec = false) @@ -11591,59 +10964,47 @@ class AttributeQueryAttCodeSet extends AttributeSet */ private function GetClassList($oHostObj) { - try - { + try { $sQueryField = $this->Get('query_field'); $sQuery = $oHostObj->Get($sQueryField); - if (empty($sQuery)) - { - return array(); + if (empty($sQuery)) { + return []; } $oFilter = DBSearch::FromOQL($sQuery); return $oFilter->GetSelectedClasses(); - } catch (OQLException $e) - { + } catch (OQLException $e) { IssueLog::Warning($e->getMessage()); } - return array(); + return []; } - public function GetAllowedValues($aArgs = array(), $sContains = '') + public function GetAllowedValues($aArgs = [], $sContains = '') { - if (isset($aArgs['this'])) - { + if (isset($aArgs['this'])) { $oHostObj = $aArgs['this']; $aClasses = $this->GetClassList($oHostObj); - $aAllowedAttributes = array(); - $aAllAttributes = array(); + $aAllowedAttributes = []; + $aAllAttributes = []; - if ((count($aClasses) == 1) && (array_keys($aClasses)[0] == array_values($aClasses)[0])) - { + if ((count($aClasses) == 1) && (array_keys($aClasses)[0] == array_values($aClasses)[0])) { $sClass = reset($aClasses); $aAttributes = MetaModel::GetAttributesList($sClass); - foreach($aAttributes as $sAttCode) - { + foreach ($aAttributes as $sAttCode) { $aAllowedAttributes[$sAttCode] = "$sAttCode (".MetaModel::GetLabel($sClass, $sAttCode).')'; } - } - else - { - if (!empty($aClasses)) - { + } else { + if (!empty($aClasses)) { ksort($aClasses); - foreach($aClasses as $sAlias => $sClass) - { + foreach ($aClasses as $sAlias => $sClass) { $aAttributes = MetaModel::GetAttributesList($sClass); - foreach($aAttributes as $sAttCode) - { - $aAllAttributes[] = array('alias' => $sAlias, 'class' => $sClass, 'att_code' => $sAttCode); + foreach ($aAttributes as $sAttCode) { + $aAllAttributes[] = ['alias' => $sAlias, 'class' => $sClass, 'att_code' => $sAttCode]; } } } - foreach($aAllAttributes as $aFullAttCode) - { + foreach ($aAllAttributes as $aFullAttCode) { $sAttCode = $aFullAttCode['alias'].'.'.$aFullAttCode['att_code']; $sClass = $aFullAttCode['class']; $sLabel = "$sAttCode (".MetaModel::GetLabel($sClass, $aFullAttCode['att_code']).')'; @@ -11673,38 +11034,29 @@ class AttributeQueryAttCodeSet extends AttributeSet public function MakeRealValue($proposedValue, $oHostObj, $bIgnoreErrors = false) { $oSet = new ormSet(MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), $this->GetCode(), $this->GetMaxItems()); - $aArgs = array(); - if (!empty($oHostObj)) - { + $aArgs = []; + if (!empty($oHostObj)) { $aArgs['this'] = $oHostObj; } $aAllowedAttributes = $this->GetAllowedValues($aArgs); - $aInvalidAttCodes = array(); - if (is_string($proposedValue) && !empty($proposedValue)) - { + $aInvalidAttCodes = []; + if (is_string($proposedValue) && !empty($proposedValue)) { $proposedValue = trim($proposedValue); $aProposedValues = $this->FromStringToArray($proposedValue); - $aValues = array(); - foreach($aProposedValues as $sValue) - { + $aValues = []; + foreach ($aProposedValues as $sValue) { $sAttCode = trim($sValue); - if (empty($aAllowedAttributes) || isset($aAllowedAttributes[$sAttCode])) - { + if (empty($aAllowedAttributes) || isset($aAllowedAttributes[$sAttCode])) { $aValues[$sAttCode] = $sAttCode; - } - else - { + } else { $aInvalidAttCodes[] = $sAttCode; } } $oSet->SetValues($aValues); - } - elseif ($proposedValue instanceof ormSet) - { + } elseif ($proposedValue instanceof ormSet) { $oSet = $proposedValue; } - if (!empty($aInvalidAttCodes) && !$bIgnoreErrors) - { + if (!empty($aInvalidAttCodes) && !$bIgnoreErrors) { throw new CoreUnexpectedValue("The attribute(s) ".implode(', ', $aInvalidAttCodes)." are invalid"); } @@ -11723,17 +11075,15 @@ class AttributeQueryAttCodeSet extends AttributeSet public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { - if ($value instanceof ormSet) - { + if ($value instanceof ormSet) { $value = $value->GetValues(); } - if (is_array($value)) - { + if (is_array($value)) { if (!empty($oHostObject) && $bLocalize) { $aArgs['this'] = $oHostObject; $aAllowedAttributes = $this->GetAllowedValues($aArgs); - $aLocalizedValues = array(); + $aLocalizedValues = []; foreach ($value as $sAttCode) { if (isset($aAllowedAttributes[$sAttCode])) { $sLabelForHtmlAttribute = utils::HtmlEntities($aAllowedAttributes[$sAttCode]); @@ -11757,7 +11107,7 @@ class AttributeQueryAttCodeSet extends AttributeSet */ class AttributeTagSet extends AttributeSet { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_TAG_SET; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_TAG_SET; public function __construct($sCode, array $aParams) { @@ -11772,7 +11122,7 @@ class AttributeTagSet extends AttributeSet public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array('tag_code_max_len')); + return array_merge(parent::ListExpectedParams(), ['tag_code_max_len']); } /** @@ -11784,15 +11134,14 @@ class AttributeTagSet extends AttributeSet * @throws \CoreException * @throws \OQLException */ - public function GetJsonForWidget($oValue, $aArgs = array()) + public function GetJsonForWidget($oValue, $aArgs = []) { - $aJson = array(); + $aJson = []; // possible_values $aTagSetObjectData = $this->GetAllowedValues($aArgs); - $aTagSetKeyValData = array(); - foreach($aTagSetObjectData as $sTagCode => $sTagLabel) - { + $aTagSetKeyValData = []; + foreach ($aTagSetObjectData as $sTagCode => $sTagLabel) { $aTagSetKeyValData[] = [ 'code' => $sTagCode, 'label' => $sTagLabel, @@ -11800,32 +11149,25 @@ class AttributeTagSet extends AttributeSet } $aJson['possible_values'] = $aTagSetKeyValData; - if (is_null($oValue)) - { - $aJson['partial_values'] = array(); - $aJson['orig_value'] = array(); - $aJson['added'] = array(); - $aJson['removed'] = array(); - } - else - { + if (is_null($oValue)) { + $aJson['partial_values'] = []; + $aJson['orig_value'] = []; + $aJson['added'] = []; + $aJson['removed'] = []; + } else { $aJson['orig_value'] = array_merge($oValue->GetValues(), $oValue->GetModified()); $aJson['added'] = $oValue->GetAdded(); $aJson['removed'] = $oValue->GetRemoved(); - if ($oValue->DisplayPartial()) - { + if ($oValue->DisplayPartial()) { // For bulk updates $aJson['partial_values'] = $oValue->GetModified(); - } - else - { + } else { // For simple updates - $aJson['partial_values'] = array(); + $aJson['partial_values'] = []; } } - $iMaxTags = $this->GetMaxItems(); $aJson['max_items_allowed'] = $iMaxTags; @@ -11834,11 +11176,9 @@ class AttributeTagSet extends AttributeSet public function FromStringToArray($proposedValue, $sDefaultSepItem = ',') { - $aValues = array(); - if (!empty($proposedValue)) - { - foreach(explode(' ', $proposedValue) as $sCode) - { + $aValues = []; + if (!empty($proposedValue)) { + foreach (explode(' ', $proposedValue) as $sCode) { $sValue = trim($sCode); $aValues[] = $sValue; } @@ -11861,26 +11201,19 @@ class AttributeTagSet extends AttributeSet $aTagCodes = $this->FromStringToArray("$sValue"); $sAttCode = $this->GetCode(); $sClass = MetaModel::GetAttributeOrigin($this->GetHostClass(), $sAttCode); - if ($bNoLimit) - { + if ($bNoLimit) { $oTagSet = new ormTagSet($sClass, $sAttCode, 0); - } - else - { + } else { $oTagSet = new ormTagSet($sClass, $sAttCode, $this->GetMaxItems()); } - $aGoodTags = array(); - foreach($aTagCodes as $sTagCode) - { - if ($sTagCode === '') - { + $aGoodTags = []; + foreach ($aTagCodes as $sTagCode) { + if ($sTagCode === '') { continue; } - if ($oTagSet->IsValidTag($sTagCode)) - { + if ($oTagSet->IsValidTag($sTagCode)) { $aGoodTags[] = $sTagCode; - if (!$bNoLimit && (count($aGoodTags) === $this->GetMaxItems())) - { + if (!$bNoLimit && (count($aGoodTags) === $this->GetMaxItems())) { // extra and bad tags are ignored break; } @@ -11898,12 +11231,10 @@ class AttributeTagSet extends AttributeSet public function GetEditValue($value, $oHostObj = null) { - if (empty($value)) - { + if (empty($value)) { return ''; } - if ($value instanceof ormTagSet) - { + if ($value instanceof ormTagSet) { $aValues = $value->GetValues(); return implode(' ', $aValues); @@ -11919,22 +11250,20 @@ class AttributeTagSet extends AttributeSet public function Equals($val1, $val2) { - if (($val1 instanceof ormTagSet) && ($val2 instanceof ormTagSet)) - { + if (($val1 instanceof ormTagSet) && ($val2 instanceof ormTagSet)) { return $val1->Equals($val2); } return ($val1 == $val2); } - public function GetAllowedValues($aArgs = array(), $sContains = '') + public function GetAllowedValues($aArgs = [], $sContains = '') { $sAttCode = $this->GetCode(); $sClass = MetaModel::GetAttributeOrigin($this->GetHostClass(), $sAttCode); $aAllowedTags = TagSetFieldData::GetAllowedValues($sClass, $sAttCode); - $aAllowedValues = array(); - foreach($aAllowedTags as $oAllowedTag) - { + $aAllowedValues = []; + foreach ($aAllowedTags as $oAllowedTag) { $aAllowedValues[$oAllowedTag->Get('code')] = $oAllowedTag->Get('label'); } @@ -11971,18 +11300,14 @@ class AttributeTagSet extends AttributeSet public function MakeRealValue($proposedValue, $oHostObj, $bIgnoreErrors = false) { $oTagSet = new ormTagSet(MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), $this->GetCode(), $this->GetMaxItems()); - if (is_string($proposedValue) && !empty($proposedValue)) - { + if (is_string($proposedValue) && !empty($proposedValue)) { $sJsonFromWidget = json_decode($proposedValue, true); - if (is_null($sJsonFromWidget)) - { + if (is_null($sJsonFromWidget)) { $proposedValue = trim("$proposedValue"); $aTagCodes = $this->FromStringToArray($proposedValue); $oTagSet->SetValues($aTagCodes); } - } - elseif ($proposedValue instanceof ormTagSet) - { + } elseif ($proposedValue instanceof ormTagSet) { $oTagSet = $proposedValue; } @@ -12004,20 +11329,19 @@ class AttributeTagSet extends AttributeSet */ public function MakeValueFromString($sProposedValue, $bLocalizedValue = false, $sSepItem = null, $sSepAttribute = null, $sSepValue = null, $sAttributeQualifier = null) { - if (is_null($sSepItem) || empty($sSepItem)) - { + if (is_null($sSepItem) || empty($sSepItem)) { $sSepItem = MetaModel::GetConfig()->Get('tag_set_item_separator'); } - if (!empty($sProposedValue)) - { - $oTagSet = new ormTagSet(MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), - $this->GetCode(), $this->GetMaxItems()); + if (!empty($sProposedValue)) { + $oTagSet = new ormTagSet( + MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), + $this->GetCode(), + $this->GetMaxItems() + ); $aLabels = explode($sSepItem, $sProposedValue); - $aCodes = array(); - foreach($aLabels as $sTagLabel) - { - if (!empty($sTagLabel)) - { + $aCodes = []; + foreach ($aLabels as $sTagLabel) { + if (!empty($sTagLabel)) { $aCodes[] = ($bLocalizedValue) ? $oTagSet->GetTagFromLabel($sTagLabel) : $sTagLabel; } } @@ -12041,8 +11365,7 @@ class AttributeTagSet extends AttributeSet public function IsNull($proposedValue) { - if (is_null($proposedValue)) - { + if (is_null($proposedValue)) { return true; } @@ -12061,26 +11384,23 @@ class AttributeTagSet extends AttributeSet */ public function GetValueLabel($sValue) { - if (empty($sValue)) - { + if (empty($sValue)) { return ''; } - if (is_string($sValue)) - { + if (is_string($sValue)) { $sValue = $this->GetExistingTagsFromString($sValue); } - if ($sValue instanceof ormTagSet) - { + if ($sValue instanceof ormTagSet) { $aValues = $sValue->GetLabels(); return implode(', ', $aValues); } - throw new CoreWarning('Expected the attribute value to be a TagSet', array( + throw new CoreWarning('Expected the attribute value to be a TagSet', [ 'found_type' => gettype($sValue), 'value' => $sValue, 'class' => $this->GetHostClass(), - 'attribute' => $this->GetCode() - )); + 'attribute' => $this->GetCode(), + ]); } /** @@ -12091,22 +11411,20 @@ class AttributeTagSet extends AttributeSet */ public function ScalarToSQL($value) { - if (empty($value)) - { + if (empty($value)) { return ''; } - if ($value instanceof ormTagSet) - { + if ($value instanceof ormTagSet) { $aValues = $value->GetValues(); return implode(' ', $aValues); } - throw new CoreWarning('Expected the attribute value to be a TagSet', array( + throw new CoreWarning('Expected the attribute value to be a TagSet', [ 'found_type' => gettype($value), 'value' => $value, 'class' => $this->GetHostClass(), - 'attribute' => $this->GetCode() - )); + 'attribute' => $this->GetCode(), + ]); } /** @@ -12121,56 +11439,46 @@ class AttributeTagSet extends AttributeSet */ public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { - if ($value instanceof ormTagSet) - { - if ($bLocalize) - { + if ($value instanceof ormTagSet) { + if ($bLocalize) { $aValues = $value->GetTags(); - } - else - { + } else { $aValues = $value->GetValues(); } - if (empty($aValues)) - { + if (empty($aValues)) { return ''; } return $this->GenerateViewHtmlForValues($aValues); } - if (is_string($value)) - { - try - { + if (is_string($value)) { + try { $oValue = $this->MakeRealValue($value, $oHostObject); return $this->GetAsHTML($oValue, $oHostObject, $bLocalize); - } catch (Exception $e) - { + } catch (Exception $e) { // unknown tags are present display the code instead } $aTagCodes = $this->FromStringToArray($value); - $aValues = array(); - $oTagSet = new ormTagSet(MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), - $this->GetCode(), $this->GetMaxItems()); - foreach($aTagCodes as $sTagCode) - { - try - { + $aValues = []; + $oTagSet = new ormTagSet( + MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), + $this->GetCode(), + $this->GetMaxItems() + ); + foreach ($aTagCodes as $sTagCode) { + try { $oTagSet->Add($sTagCode); - } catch (Exception $e) - { + } catch (Exception $e) { $aValues[] = $sTagCode; } } $sHTML = ''; - if (!empty($aValues)) - { + if (!empty($aValues)) { $sHTML .= $this->GenerateViewHtmlForValues($aValues, 'attribute-set-item-undefined'); } $aValues = $oTagSet->GetTags(); - if (!empty($aValues)) - { + if (!empty($aValues)) { $sHTML .= $this->GenerateViewHtmlForValues($aValues); } @@ -12193,17 +11501,15 @@ class AttributeTagSet extends AttributeSet $aAllowedTags = TagSetFieldData::GetAllowedValues(MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), $this->GetCode()); - if (!empty($aDelta['removed'])) - { - $aRemoved = array(); - foreach($aDelta['removed'] as $idx => $sTagCode) - { - if (empty($sTagCode)) {continue;} + if (!empty($aDelta['removed'])) { + $aRemoved = []; + foreach ($aDelta['removed'] as $idx => $sTagCode) { + if (empty($sTagCode)) { + continue; + } $sTagLabel = $sTagCode; - foreach($aAllowedTags as $oTag) - { - if ($sTagCode === $oTag->Get('code')) - { + foreach ($aAllowedTags as $oTag) { + if ($sTagCode === $oTag->Get('code')) { $sTagLabel = $oTag->Get('label'); } } @@ -12211,28 +11517,24 @@ class AttributeTagSet extends AttributeSet } $sRemoved = $this->GenerateViewHtmlForValues($aRemoved, 'history-removed'); - if (!empty($sRemoved)) - { + if (!empty($sRemoved)) { $sResult .= Dict::Format('Change:LinkSet:Removed', $sRemoved); } } - if (!empty($aDelta['added'])) - { - if (!empty($sRemoved)) - { + if (!empty($aDelta['added'])) { + if (!empty($sRemoved)) { $sResult .= ', '; } - $aAdded = array(); - foreach($aDelta['added'] as $idx => $sTagCode) - { - if (empty($sTagCode)) {continue;} + $aAdded = []; + foreach ($aDelta['added'] as $idx => $sTagCode) { + if (empty($sTagCode)) { + continue; + } $sTagLabel = $sTagCode; - foreach($aAllowedTags as $oTag) - { - if ($sTagCode === $oTag->Get('code')) - { + foreach ($aAllowedTags as $oTag) { + if ($sTagCode === $oTag->Get('code')) { $sTagLabel = $oTag->Get('label'); } } @@ -12240,8 +11542,7 @@ class AttributeTagSet extends AttributeSet } $sAdded = $this->GenerateViewHtmlForValues($aAdded, 'history-added'); - if (!empty($sAdded)) - { + if (!empty($sAdded)) { $sResult .= Dict::Format('Change:LinkSet:Added', $sAdded); } } @@ -12263,12 +11564,12 @@ class AttributeTagSet extends AttributeSet */ public function GenerateViewHtmlForValues($aValues, $sCssClass = '', $bWithLink = true) { - if (empty($aValues)) {return '';} + if (empty($aValues)) { + return ''; + } $sHtml = ''; - foreach($aValues as $oTag) - { - if ($oTag instanceof TagSetFieldData) - { + foreach ($aValues as $oTag) { + if ($oTag instanceof TagSetFieldData) { $sClass = MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()); $sAttCode = $this->GetCode(); $sTagCode = $oTag->Get('code'); @@ -12302,9 +11603,7 @@ HTML; $sTooltipContent = utils::HtmlEntities($sTooltipContent); $sHtml .= ''.$sLabelForHtml.''; - } - else - { + } else { $sHtml .= ''.utils::EscapeHtml($oTag).''; } } @@ -12323,25 +11622,18 @@ HTML; */ public function GetAsXML($value, $oHostObject = null, $bLocalize = true) { - if (is_object($value) && ($value instanceof ormTagSet)) - { + if (is_object($value) && ($value instanceof ormTagSet)) { $sRes = "\n"; - if ($bLocalize) - { + if ($bLocalize) { $aValues = $value->GetLabels(); - } - else - { + } else { $aValues = $value->GetValues(); } - if (!empty($aValues)) - { + if (!empty($aValues)) { $sRes .= ''.implode('', $aValues).''; } $sRes .= "\n"; - } - else - { + } else { $sRes = ''; } @@ -12353,10 +11645,10 @@ HTML; */ public function EnumTemplateVerbs() { - return array( + return [ '' => 'Plain text representation', 'html' => 'HTML representation (unordered list)', - ); + ]; } /** @@ -12372,21 +11664,16 @@ HTML; */ public function GetForTemplate($value, $sVerb, $oHostObject = null, $bLocalize = true) { - if (is_object($value) && ($value instanceof ormTagSet)) - { - if ($bLocalize) - { + if (is_object($value) && ($value instanceof ormTagSet)) { + if ($bLocalize) { $aValues = $value->GetLabels(); $sSep = ', '; - } - else - { + } else { $aValues = $value->GetValues(); $sSep = ' '; } - switch ($sVerb) - { + switch ($sVerb) { case '': return implode($sSep, $aValues); @@ -12409,9 +11696,8 @@ HTML; */ public function GetForJSON($value) { - $aRet = array(); - if (is_object($value) && ($value instanceof ormTagSet)) - { + $aRet = []; + if (is_object($value) && ($value instanceof ormTagSet)) { $aRet = $value->GetValues(); } @@ -12443,8 +11729,7 @@ HTML; */ public function Fingerprint($value) { - if ($value instanceof ormTagSet) - { + if ($value instanceof ormTagSet) { $aValues = $value->GetValues(); return implode(' ', $aValues); @@ -12466,13 +11751,13 @@ HTML; */ class AttributeFriendlyName extends AttributeDefinition { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; public $m_sValue; public function __construct($sCode) { $this->m_sCode = $sCode; - $aParams = array(); + $aParams = []; $aParams["default_value"] = ''; parent::__construct($sCode, $aParams); @@ -12492,7 +11777,7 @@ class AttributeFriendlyName extends AttributeDefinition public function GetPrerequisiteAttributes($sClass = null) { // Code duplicated with AttributeObsolescenceFlag - $aAttributes = $this->GetOptional("depends_on", array()); + $aAttributes = $this->GetOptional("depends_on", []); $oExpression = $this->GetOQLExpression(); foreach ($oExpression->ListRequiredFields() as $sAttCode) { if (!in_array($sAttCode, $aAttributes)) { @@ -12515,12 +11800,11 @@ class AttributeFriendlyName extends AttributeDefinition public function GetSQLExpressions($sPrefix = '') { - if ($sPrefix == '') - { + if ($sPrefix == '') { $sPrefix = $this->GetCode(); // Warning AttributeComputedFieldVoid does not have any sql property } - return array('' => $sPrefix); + return ['' => $sPrefix]; } public static function IsBasedOnOQLExpression() @@ -12536,8 +11820,7 @@ class AttributeFriendlyName extends AttributeDefinition public function GetLabel($sDefault = null) { $sLabel = parent::GetLabel(''); - if (strlen($sLabel) == 0) - { + if (strlen($sLabel) == 0) { $sLabel = Dict::S('Core:FriendlyName-Label'); } @@ -12547,8 +11830,7 @@ class AttributeFriendlyName extends AttributeDefinition public function GetDescription($sDefault = null) { $sLabel = parent::GetDescription(''); - if (strlen($sLabel) == 0) - { + if (strlen($sLabel) == 0) { $sLabel = Dict::S('Core:FriendlyName-Description'); } @@ -12593,25 +11875,28 @@ class AttributeFriendlyName extends AttributeDefinition } public function GetAsCSV( - $sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $sValue, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { - $sFrom = array("\r\n", $sTextQualifier); - $sTo = array("\n", $sTextQualifier.$sTextQualifier); + $sFrom = ["\r\n", $sTextQualifier]; + $sTo = ["\n", $sTextQualifier.$sTextQualifier]; $sEscaped = str_replace($sFrom, $sTo, (string)$sValue); return $sTextQualifier.$sEscaped.$sTextQualifier; } - static function GetFormFieldClass() + public static function GetFormFieldClass() { return '\\Combodo\\iTop\\Form\\Field\\StringField'; } public function MakeFormField(DBObject $oObject, $oFormField = null) { - if ($oFormField === null) - { + if ($oFormField === null) { $sFormFieldClass = static::GetFormFieldClass(); $oFormField = new $sFormFieldClass($this->GetCode()); } @@ -12629,12 +11914,12 @@ class AttributeFriendlyName extends AttributeDefinition public function GetFilterDefinitions() { - return array($this->GetCode() => $this->GetCode()); + return [$this->GetCode() => $this->GetCode()]; } public function GetBasicFilterOperators() { - return array("=" => "equals", "!=" => "differs from"); + return ["=" => "equals", "!=" => "differs from"]; } public function GetBasicFilterLooseOperator() @@ -12645,8 +11930,7 @@ class AttributeFriendlyName extends AttributeDefinition public function GetBasicFilterSQLExpr($sOpCode, $value) { $sQValue = CMDBSource::Quote($value); - switch ($sOpCode) - { + switch ($sOpCode) { case '=': case '!=': return $this->GetSQLExpr()." $sOpCode $sQValue"; @@ -12677,7 +11961,7 @@ class AttributeFriendlyName extends AttributeDefinition */ class AttributeRedundancySettings extends AttributeDBField { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -12698,7 +11982,7 @@ class AttributeRedundancySettings extends AttributeDBField public static function ListExpectedParams() { - return array( + return [ 'sql', 'relation_code', 'from_class', @@ -12707,8 +11991,8 @@ class AttributeRedundancySettings extends AttributeDBField 'enabled_mode', 'min_up', 'min_up_type', - 'min_up_mode' - ); + 'min_up_mode', + ]; } public function GetValuesDef() @@ -12718,7 +12002,7 @@ class AttributeRedundancySettings extends AttributeDBField public function GetPrerequisiteAttributes($sClass = null) { - return array(); + return []; } public function GetEditClass() @@ -12733,7 +12017,6 @@ class AttributeRedundancySettings extends AttributeDBField .($bFullSpec ? $this->GetSQLColSpec() : ''); } - public function GetValidationPattern() { return "^[0-9]{1,3}|[0-9]{1,2}%|disabled$"; @@ -12747,14 +12030,10 @@ class AttributeRedundancySettings extends AttributeDBField public function GetDefaultValue(DBObject $oHostObject = null) { $sRet = 'disabled'; - if ($this->Get('enabled')) - { - if ($this->Get('min_up_type') == 'count') - { + if ($this->Get('enabled')) { + if ($this->Get('min_up_type') == 'count') { $sRet = (string)$this->Get('min_up'); - } - else // percent - { + } else { // percent $sRet = $this->Get('min_up').'%'; } } @@ -12779,8 +12058,7 @@ class AttributeRedundancySettings extends AttributeDBField public function MakeRealValue($proposedValue, $oHostObj) { - if (is_null($proposedValue)) - { + if (is_null($proposedValue)) { return ''; } @@ -12789,14 +12067,13 @@ class AttributeRedundancySettings extends AttributeDBField public function ScalarToSQL($value) { - if (!is_string($value)) - { - throw new CoreException('Expected the attribute value to be a string', array( + if (!is_string($value)) { + throw new CoreException('Expected the attribute value to be a string', [ 'found_type' => gettype($value), 'value' => $value, 'class' => $this->GetHostClass(), - 'attribute' => $this->GetCode() - )); + 'attribute' => $this->GetCode(), + ]); } return $value; @@ -12804,19 +12081,19 @@ class AttributeRedundancySettings extends AttributeDBField public function GetRelationQueryData() { - foreach(MetaModel::EnumRelationQueries($this->GetHostClass(), $this->Get('relation_code'), - false) as $sDummy => $aQueryInfo) - { - if ($aQueryInfo['sFromClass'] == $this->Get('from_class')) - { - if ($aQueryInfo['sNeighbour'] == $this->Get('neighbour_id')) - { + foreach (MetaModel::EnumRelationQueries( + $this->GetHostClass(), + $this->Get('relation_code'), + false + ) as $sDummy => $aQueryInfo) { + if ($aQueryInfo['sFromClass'] == $this->Get('from_class')) { + if ($aQueryInfo['sNeighbour'] == $this->Get('neighbour_id')) { return $aQueryInfo; } } } - return array(); + return []; } /** @@ -12831,11 +12108,9 @@ class AttributeRedundancySettings extends AttributeDBField public function GetUserOptionFormat($sUserOption, $sDefault = null) { $sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode.'/'.$sUserOption, null, true /*user lang*/); - if (is_null($sLabel)) - { + if (is_null($sLabel)) { // If no default value is specified, let's define the most relevant one for developping purposes - if (is_null($sDefault)) - { + if (is_null($sDefault)) { $sDefault = str_replace('_', ' ', $this->m_sCode.':'.$sUserOption.'(%1$s)'); } // Browse the hierarchy again, accepting default (english) translations @@ -12861,16 +12136,23 @@ class AttributeRedundancySettings extends AttributeDBField $sCurrentOption = $this->GetCurrentOption($sValue); $sClass = $oHostObject ? get_class($oHostObject) : $this->m_sHostClass; - return sprintf($this->GetUserOptionFormat($sCurrentOption), $this->GetMinUpValue($sValue), - MetaModel::GetName($sClass)); + return sprintf( + $this->GetUserOptionFormat($sCurrentOption), + $this->GetMinUpValue($sValue), + MetaModel::GetName($sClass) + ); } public function GetAsCSV( - $sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $sValue, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false ) { - $sFrom = array("\r\n", $sTextQualifier); - $sTo = array("\n", $sTextQualifier.$sTextQualifier); + $sFrom = ["\r\n", $sTextQualifier]; + $sTo = ["\n", $sTextQualifier.$sTextQualifier]; $sEscaped = str_replace($sFrom, $sTo, (string)$sValue); return $sTextQualifier.$sEscaped.$sTextQualifier; @@ -12881,12 +12163,9 @@ class AttributeRedundancySettings extends AttributeDBField */ public function IsEnabled($sValue) { - if ($this->get('enabled_mode') == 'fixed') - { + if ($this->get('enabled_mode') == 'fixed') { $bRet = $this->get('enabled'); - } - else - { + } else { $bRet = ($sValue != 'disabled'); } @@ -12898,15 +12177,11 @@ class AttributeRedundancySettings extends AttributeDBField */ public function GetMinUpType($sValue) { - if ($this->get('min_up_mode') == 'fixed') - { + if ($this->get('min_up_mode') == 'fixed') { $sRet = $this->get('min_up_type'); - } - else - { + } else { $sRet = 'count'; - if (substr(trim($sValue), -1, 1) == '%') - { + if (substr(trim($sValue), -1, 1) == '%') { $sRet = 'percent'; } } @@ -12919,15 +12194,11 @@ class AttributeRedundancySettings extends AttributeDBField */ public function GetMinUpValue($sValue) { - if ($this->get('min_up_mode') == 'fixed') - { + if ($this->get('min_up_mode') == 'fixed') { $iRet = (int)$this->Get('min_up'); - } - else - { + } else { $sRefValue = $sValue; - if (substr(trim($sValue), -1, 1) == '%') - { + if (substr(trim($sValue), -1, 1) == '%') { $sRefValue = substr(trim($sValue), 0, -1); } $iRet = (int)trim($sRefValue); @@ -12942,12 +12213,9 @@ class AttributeRedundancySettings extends AttributeDBField public function IsVisible() { $bRet = false; - if ($this->Get('enabled_mode') == 'fixed') - { + if ($this->Get('enabled_mode') == 'fixed') { $bRet = $this->Get('enabled'); - } - elseif ($this->Get('enabled_mode') == 'user') - { + } elseif ($this->Get('enabled_mode') == 'user') { $bRet = true; } @@ -12956,8 +12224,7 @@ class AttributeRedundancySettings extends AttributeDBField public function IsWritable() { - if (($this->Get('enabled_mode') == 'fixed') && ($this->Get('min_up_mode') == 'fixed')) - { + if (($this->Get('enabled_mode') == 'fixed') && ($this->Get('min_up_mode') == 'fixed')) { return false; } @@ -12971,55 +12238,50 @@ class AttributeRedundancySettings extends AttributeDBField { $sRet = ''; $aUserOptions = $this->GetUserOptions($sCurrentValue); - if (count($aUserOptions) < 2) - { + if (count($aUserOptions) < 2) { $bEditOption = false; - } - else - { + } else { $bEditOption = $bEditMode; } $sCurrentOption = $this->GetCurrentOption($sCurrentValue); - foreach($aUserOptions as $sUserOption) - { + foreach ($aUserOptions as $sUserOption) { $bSelected = ($sUserOption == $sCurrentOption); $sRet .= '
      '; - $sRet .= $this->GetDisplayOption($sCurrentValue, $oPage, $sFormPrefix, $bEditOption, $sUserOption, - $bSelected); + $sRet .= $this->GetDisplayOption( + $sCurrentValue, + $oPage, + $sFormPrefix, + $bEditOption, + $sUserOption, + $bSelected + ); $sRet .= '
      '; } return $sRet; } - const USER_OPTION_DISABLED = 'disabled'; - const USER_OPTION_ENABLED_COUNT = 'count'; - const USER_OPTION_ENABLED_PERCENT = 'percent'; + public const USER_OPTION_DISABLED = 'disabled'; + public const USER_OPTION_ENABLED_COUNT = 'count'; + public const USER_OPTION_ENABLED_PERCENT = 'percent'; /** * Depending on the xxx_mode parameters, build the list of options that are allowed to the end-user */ protected function GetUserOptions($sValue) { - $aRet = array(); - if ($this->Get('enabled_mode') == 'user') - { + $aRet = []; + if ($this->Get('enabled_mode') == 'user') { $aRet[] = self::USER_OPTION_DISABLED; } - if ($this->Get('min_up_mode') == 'user') - { + if ($this->Get('min_up_mode') == 'user') { $aRet[] = self::USER_OPTION_ENABLED_COUNT; $aRet[] = self::USER_OPTION_ENABLED_PERCENT; - } - else - { - if ($this->GetMinUpType($sValue) == 'count') - { + } else { + if ($this->GetMinUpType($sValue) == 'count') { $aRet[] = self::USER_OPTION_ENABLED_COUNT; - } - else - { + } else { $aRet[] = self::USER_OPTION_ENABLED_PERCENT; } } @@ -13033,14 +12295,10 @@ class AttributeRedundancySettings extends AttributeDBField protected function GetCurrentOption($sValue) { $sRet = self::USER_OPTION_DISABLED; - if ($this->IsEnabled($sValue)) - { - if ($this->GetMinUpType($sValue) == 'count') - { + if ($this->IsEnabled($sValue)) { + if ($this->GetMinUpType($sValue) == 'count') { $sRet = self::USER_OPTION_ENABLED_COUNT; - } - else - { + } else { $sRet = self::USER_OPTION_ENABLED_PERCENT; } } @@ -13064,66 +12322,66 @@ class AttributeRedundancySettings extends AttributeDBField * @throws \Exception */ protected function GetDisplayOption( - $sCurrentValue, $oPage, $sFormPrefix, $bEditMode, $sUserOption, $bSelected = true + $sCurrentValue, + $oPage, + $sFormPrefix, + $bEditMode, + $sUserOption, + $bSelected = true ) { $sRet = ''; $iCurrentValue = $this->GetMinUpValue($sCurrentValue); - if ($bEditMode) - { + if ($bEditMode) { $sValue = null; $sHtmlNamesPrefix = 'rddcy_'.$this->Get('relation_code').'_'.$this->Get('from_class').'_'.$this->Get('neighbour_id'); - switch ($sUserOption) - { + switch ($sUserOption) { case self::USER_OPTION_DISABLED: $sValue = ''; // Empty placeholder break; case self::USER_OPTION_ENABLED_COUNT: - if ($bEditMode) - { + if ($bEditMode) { $sName = $sHtmlNamesPrefix.'_min_up_count'; $sEditValue = $bSelected ? $iCurrentValue : ''; $sValue = ''; // To fix an issue on Firefox: focus set to the option (because the input is within the label for the option) $oPage->add_ready_script("\$('[name=\"$sName\"]').on('click', function(){var me=this; setTimeout(function(){\$(me).focus();}, 100);});"); - } - else - { + } else { $sValue = $iCurrentValue; } break; case self::USER_OPTION_ENABLED_PERCENT: - if ($bEditMode) - { + if ($bEditMode) { $sName = $sHtmlNamesPrefix.'_min_up_percent'; $sEditValue = $bSelected ? $iCurrentValue : ''; $sValue = ''; // To fix an issue on Firefox: focus set to the option (because the input is within the label for the option) $oPage->add_ready_script("\$('[name=\"$sName\"]').on('click', function(){var me=this; setTimeout(function(){\$(me).focus();}, 100);});"); - } - else - { + } else { $sValue = $iCurrentValue; } break; } - $sLabel = sprintf($this->GetUserOptionFormat($sUserOption), $sValue, - MetaModel::GetName($this->GetHostClass())); + $sLabel = sprintf( + $this->GetUserOptionFormat($sUserOption), + $sValue, + MetaModel::GetName($this->GetHostClass()) + ); $sOptionName = $sHtmlNamesPrefix.'_user_option'; $sOptionId = $sOptionName.'_'.$sUserOption; $sChecked = $bSelected ? 'checked' : ''; $sRet = ' '; - } - else - { + } else { // Read-only: display only the currently selected option - if ($bSelected) - { - $sRet = sprintf($this->GetUserOptionFormat($sUserOption), $iCurrentValue, - MetaModel::GetName($this->GetHostClass())); + if ($bSelected) { + $sRet = sprintf( + $this->GetUserOptionFormat($sUserOption), + $iCurrentValue, + MetaModel::GetName($this->GetHostClass()) + ); } } @@ -13140,8 +12398,7 @@ class AttributeRedundancySettings extends AttributeDBField $iMinUpCount = (int)utils::ReadPostedParam($sHtmlNamesPrefix.'_min_up_count', null, 'raw_data'); $iMinUpPercent = (int)utils::ReadPostedParam($sHtmlNamesPrefix.'_min_up_percent', null, 'raw_data'); $sSelectedOption = utils::ReadPostedParam($sHtmlNamesPrefix.'_user_option', null, 'raw_data'); - switch ($sSelectedOption) - { + switch ($sSelectedOption) { case self::USER_OPTION_ENABLED_COUNT: $sRet = $iMinUpCount; break; @@ -13167,7 +12424,7 @@ class AttributeRedundancySettings extends AttributeDBField */ class AttributeCustomFields extends AttributeDefinition { - const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; + public const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW; /** * Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329) @@ -13188,7 +12445,7 @@ class AttributeCustomFields extends AttributeDefinition public static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array("handler_class")); + return array_merge(parent::ListExpectedParams(), ["handler_class"]); } public function GetEditClass() @@ -13213,7 +12470,7 @@ class AttributeCustomFields extends AttributeDefinition public function GetBasicFilterOperators() { - return array(); + return []; } public function GetBasicFilterLooseOperator() @@ -13237,8 +12494,7 @@ class AttributeCustomFields extends AttributeDefinition $sHandlerClass = $this->Get('handler_class'); /** @var \TemplateFieldsHandler $oHandler */ $oHandler = new $sHandlerClass($this->GetCode()); - if (!is_null($aValues)) - { + if (!is_null($aValues)) { $oHandler->SetCurrentValues($aValues); } @@ -13260,17 +12516,18 @@ class AttributeCustomFields extends AttributeDefinition /** * Makes the string representation out of the values given by the form defined in GetDisplayForm */ - public function ReadValueFromPostedForm($oHostObject, $sFormPrefix) { + public function ReadValueFromPostedForm($oHostObject, $sFormPrefix) + { $aRawData = json_decode(utils::ReadPostedParam("attr_{$sFormPrefix}{$this->GetCode()}", '{}', 'raw_data'), true); if ($aRawData != null) { return new ormCustomFieldsValue($oHostObject, $this->GetCode(), $aRawData); - } - else { + } else { return null; } } - public function MakeRealValue($proposedValue, $oHostObject) { + public function MakeRealValue($proposedValue, $oHostObject) + { if (is_object($proposedValue) && ($proposedValue instanceof ormCustomFieldsValue)) { if (false === $oHostObject->IsNew()) { // In that case we need additional keys : see \TemplateFieldsHandler::DoBuildForm @@ -13320,8 +12577,7 @@ class AttributeCustomFields extends AttributeDefinition */ public function MakeFormField(DBObject $oObject, $oFormField = null) { - if ($oFormField === null) - { + if ($oFormField === null) { $sFormFieldClass = static::GetFormFieldClass(); $oFormField = new $sFormFieldClass($this->GetCode()); $oFormField->SetForm($this->GetForm($oObject)); @@ -13346,8 +12602,7 @@ class AttributeCustomFields extends AttributeDefinition $sFormId = utils::IsNullOrEmptyString($sFormPrefix) ? 'cf_'.$this->GetCode() : $sFormPrefix.'_cf_'.$this->GetCode(); $oHandler->BuildForm($oHostObject, $sFormId); $oForm = $oHandler->GetForm(); - } - catch (Exception $e) { + } catch (Exception $e) { $oForm = new Form(''); $oField = new LabelField(''); $oField->SetLabel('Custom field error: '.$e->getMessage()); @@ -13369,13 +12624,11 @@ class AttributeCustomFields extends AttributeDefinition */ public function ReadExternalValues(DBObject $oHostObject) { - try - { + try { $oHandler = $this->GetHandler(); $aValues = $oHandler->ReadValues($oHostObject); $oRet = new ormCustomFieldsValue($oHostObject, $this->GetCode(), $aValues); - } catch (Exception $e) - { + } catch (Exception $e) { $oRet = new ormCustomFieldsValue($oHostObject, $this->GetCode()); } @@ -13392,7 +12645,7 @@ class AttributeCustomFields extends AttributeDefinition $oValue = $oHostObject->Get($this->GetCode()); if (!($oValue instanceof ormCustomFieldsValue)) { $oHandler = $this->GetHandler(); - $aValues = array(); + $aValues = []; } else { // Pass the values through the form to make sure that they are correct $oHandler = $this->GetHandler($oValue->GetValues()); @@ -13457,12 +12710,10 @@ class AttributeCustomFields extends AttributeDefinition public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { - try - { + try { /** @var \ormCustomFieldsValue $value */ $sRet = $value->GetAsHTML($bLocalize); - } catch (Exception $e) - { + } catch (Exception $e) { $sRet = 'Custom field error: '.utils::EscapeHtml($e->getMessage()); } @@ -13473,8 +12724,7 @@ class AttributeCustomFields extends AttributeDefinition { try { $sRet = $value->GetAsXML($bLocalize); - } - catch (Exception $e) { + } catch (Exception $e) { $sRet = Str::pure2xml('Custom field error: '.$e->getMessage()); } @@ -13493,16 +12743,18 @@ class AttributeCustomFields extends AttributeDefinition * @noinspection PhpParameterNameChangedDuringInheritanceInspection */ public function GetAsCSV( - $value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, + $value, + $sSeparator = ',', + $sTextQualifier = '"', + $oHostObject = null, + $bLocalize = true, $bConvertToPlainText = false - ) - { + ) { try { $sRet = $value->GetAsCSV($sSeparator, $sTextQualifier, $bLocalize, $bConvertToPlainText); - } - catch (Exception $e) { - $sFrom = array("\r\n", $sTextQualifier); - $sTo = array("\n", $sTextQualifier.$sTextQualifier); + } catch (Exception $e) { + $sFrom = ["\r\n", $sTextQualifier]; + $sTo = ["\n", $sTextQualifier.$sTextQualifier]; $sEscaped = str_replace($sFrom, $sTo, 'Custom field error: '.$e->getMessage()); $sRet = $sTextQualifier.$sEscaped.$sTextQualifier; } @@ -13532,11 +12784,9 @@ class AttributeCustomFields extends AttributeDefinition */ public function GetForTemplate($value, $sVerb, $oHostObject = null, $bLocalize = true) { - try - { + try { $sRet = $value->GetForTemplate($sVerb, $bLocalize); - } catch (Exception $e) - { + } catch (Exception $e) { $sRet = 'Custom field error: '.$e->getMessage(); } @@ -13544,7 +12794,11 @@ class AttributeCustomFields extends AttributeDefinition } public function MakeValueFromString( - $sProposedValue, $bLocalizedValue = false, $sSepItem = null, $sSepAttribute = null, $sSepValue = null, + $sProposedValue, + $bLocalizedValue = false, + $sSepItem = null, + $sSepAttribute = null, + $sSepValue = null, $sAttributeQualifier = null ) { return null; @@ -13563,8 +12817,7 @@ class AttributeCustomFields extends AttributeDefinition { try { $sRet = $value->GetForJSON(); - } - catch (Exception $e) { + } catch (Exception $e) { $sRet = 'Custom field error: '.$e->getMessage(); } @@ -13585,11 +12838,9 @@ class AttributeCustomFields extends AttributeDefinition public function Equals($val1, $val2) { - try - { + try { $bEquals = $val1->Equals($val2); - } catch (Exception $e) - { + } catch (Exception $e) { $bEquals = false; } @@ -13624,13 +12875,13 @@ class AttributeArchiveFlag extends AttributeBoolean { public function __construct($sCode) { - parent::__construct($sCode, array( + parent::__construct($sCode, [ "allowed_values" => null, "sql" => $sCode, "default_value" => false, "is_null_allowed" => false, - "depends_on" => array() - )); + "depends_on" => [], + ]); } public function RequiresIndex() @@ -13706,13 +12957,13 @@ class AttributeObsolescenceFlag extends AttributeBoolean { public function __construct($sCode) { - parent::__construct($sCode, array( + parent::__construct($sCode, [ "allowed_values" => null, "sql" => $sCode, "default_value" => "", "is_null_allowed" => false, - "depends_on" => array() - )); + "depends_on" => [], + ]); } public function IsWritable() @@ -13748,17 +12999,17 @@ class AttributeObsolescenceFlag extends AttributeBoolean public function GetSQLExpressions($sPrefix = '') { - return array(); + return []; } public function GetSQLColumns($bFullSpec = false) { - return array(); + return []; } // returns column/spec pairs (1 in most of the cases), for STRUCTURING (DB creation) public function GetSQLValues($value) { - return array(); + return []; } // returns column/value pairs (1 in most of the cases), for WRITING (Insert, Update) public function GetEditClass() @@ -13774,12 +13025,10 @@ class AttributeObsolescenceFlag extends AttributeBoolean public function GetPrerequisiteAttributes($sClass = null) { // Code duplicated with AttributeFriendlyName - $aAttributes = $this->GetOptional("depends_on", array()); + $aAttributes = $this->GetOptional("depends_on", []); $oExpression = $this->GetOQLExpression(); - foreach ($oExpression->ListRequiredFields() as $sClass => $sAttCode) - { - if (!in_array($sAttCode, $aAttributes)) - { + foreach ($oExpression->ListRequiredFields() as $sClass => $sAttCode) { + if (!in_array($sAttCode, $aAttributes)) { $aAttributes[] = $sAttCode; } } diff --git a/core/autoload.php b/core/autoload.php index f89eda208..83f4e972c 100644 --- a/core/autoload.php +++ b/core/autoload.php @@ -1,9 +1,10 @@ - /** * Tasks performed in the background * @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - class ObsolescenceDateUpdater implements iBackgroundProcess { public function GetPeriodicity() @@ -37,18 +36,17 @@ class ObsolescenceDateUpdater implements iBackgroundProcess $iCountSet = 0; $iCountReset = 0; $iClasses = 0; - foreach (MetaModel::EnumObsoletableClasses() as $sClass) - { + foreach (MetaModel::EnumObsoletableClasses() as $sClass) { $oObsoletedToday = new DBObjectSearch($sClass); $oObsoletedToday->AddCondition('obsolescence_flag', 1, '='); $oObsoletedToday->AddCondition('obsolescence_date', null, '='); $sToday = date(AttributeDate::GetSQLFormat()); - $iCountSet += MetaModel::BulkUpdate($oObsoletedToday, array('obsolescence_date' => $sToday)); + $iCountSet += MetaModel::BulkUpdate($oObsoletedToday, ['obsolescence_date' => $sToday]); $oObsoletedToday = new DBObjectSearch($sClass); $oObsoletedToday->AddCondition('obsolescence_flag', 1, '!='); $oObsoletedToday->AddCondition('obsolescence_date', null, '!='); - $iCountReset += MetaModel::BulkUpdate($oObsoletedToday, array('obsolescence_date' => null)); + $iCountReset += MetaModel::BulkUpdate($oObsoletedToday, ['obsolescence_date' => null]); } return "Obsolescence date updated (classes: $iClasses ; set: $iCountSet ; reset: $iCountReset)\n"; } diff --git a/core/backgroundprocess.inc.php b/core/backgroundprocess.inc.php index 46b4490f3..3e05348ed 100644 --- a/core/backgroundprocess.inc.php +++ b/core/backgroundprocess.inc.php @@ -1,4 +1,5 @@ oConfig)) - { + if (!isset($this->oConfig)) { $this->oConfig = MetaModel::GetConfig(); } return $this->oConfig; } - /** * Interpret current setting for the week days * @@ -128,7 +125,7 @@ abstract class AbstractWeeklyScheduledProcess implements iScheduledProcess */ public function InterpretWeekDays() { - static $aWEEKDAYTON = array( + static $aWEEKDAYTON = [ 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, @@ -136,32 +133,26 @@ abstract class AbstractWeeklyScheduledProcess implements iScheduledProcess 'friday' => 5, 'saturday' => 6, 'sunday' => 7, - ); - $aDays = array(); + ]; + $aDays = []; $sWeekDays = $this->getOConfig()->GetModuleSetting( $this->GetModuleName(), static::MODULE_SETTING_WEEKDAYS, static::DEFAULT_MODULE_SETTING_WEEKDAYS ); - if ($sWeekDays !== '') - { + if ($sWeekDays !== '') { $aWeekDaysRaw = explode(',', $sWeekDays); - foreach ($aWeekDaysRaw as $sWeekDay) - { + foreach ($aWeekDaysRaw as $sWeekDay) { $sWeekDay = strtolower(trim($sWeekDay)); - if (array_key_exists($sWeekDay, $aWEEKDAYTON)) - { + if (array_key_exists($sWeekDay, $aWEEKDAYTON)) { $aDays[] = $aWEEKDAYTON[$sWeekDay]; - } - else - { + } else { throw new ProcessInvalidConfigException($this->GetModuleName().": wrong format for setting '".static::MODULE_SETTING_WEEKDAYS."' (found '$sWeekDay')"); } } } - if (count($aDays) === 0) - { + if (count($aDays) === 0) { throw new ProcessInvalidConfigException($this->GetModuleName().': missing setting \''.static::MODULE_SETTING_WEEKDAYS.'\''); } $aDays = array_unique($aDays); @@ -185,8 +176,7 @@ abstract class AbstractWeeklyScheduledProcess implements iScheduledProcess static::DEFAULT_MODULE_SETTING_ENABLED ); - if (!$bEnabled) - { + if (!$bEnabled) { return new DateTime('3000-01-01'); } @@ -202,21 +192,17 @@ abstract class AbstractWeeklyScheduledProcess implements iScheduledProcess static::GetDefaultModuleSettingTime() ); $sProcessTime = trim($sProcessTime); - if (!preg_match('/[0-2]\d:[0-5]\d/', $sProcessTime)) - { + if (!preg_match('/[0-2]\d:[0-5]\d/', $sProcessTime)) { throw new ProcessInvalidConfigException($this->GetModuleName().": wrong format for setting '".static::MODULE_SETTING_TIME."' (found '$sProcessTime')"); } $oNow = new DateTime($sCurrentTime); $iNextPos = false; $sDay = $oNow->format('N'); - for ($iDay = (int) $sDay; $iDay <= 7; $iDay++) - { + for ($iDay = (int) $sDay; $iDay <= 7; $iDay++) { $iNextPos = array_search($iDay, $aDays, true); - if ($iNextPos !== false) - { - if (($iDay > $oNow->format('N')) || ($oNow->format('H:i') < $sProcessTime)) - { + if ($iNextPos !== false) { + if (($iDay > $oNow->format('N')) || ($oNow->format('H:i') < $sProcessTime)) { break; } $iNextPos = false; // necessary on sundays @@ -225,17 +211,14 @@ abstract class AbstractWeeklyScheduledProcess implements iScheduledProcess // 3rd - Compute the result // - if ($iNextPos === false) - { + if ($iNextPos === false) { // Jump to the first day within the next week $iFirstDayOfWeek = $aDays[0]; $iDayMove = $oNow->format('N') - $iFirstDayOfWeek; $oRet = clone $oNow; $oRet->modify(-$iDayMove.' days'); $oRet->modify('+1 weeks'); - } - else - { + } else { $iNextDayOfWeek = $aDays[$iNextPos]; $iMove = $iNextDayOfWeek - $oNow->format('N'); $oRet = clone $oNow; diff --git a/core/backgroundtask.class.inc.php b/core/backgroundtask.class.inc.php index 6c6736819..bfc843f98 100644 --- a/core/backgroundtask.class.inc.php +++ b/core/backgroundtask.class.inc.php @@ -1,9 +1,10 @@ - /** * Class BackgroundTask * A class to record information about the execution of background processes ({@link iProcess} impl) @@ -46,49 +46,47 @@ class BackgroundTask extends DBObject public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb", "key_type" => "autoincrement", "name_attcode" => "class_name", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_backgroundtask", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); - MetaModel::Init_AddAttribute(new AttributeString("class_name", array("allowed_values"=>null, "sql"=>"class_name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDateTime("first_run_date", array("allowed_values"=>null, "sql"=>"first_run_date", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDateTime("latest_run_date", array("allowed_values"=>null, "sql"=>"latest_run_date", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDateTime("next_run_date", array("allowed_values"=>null, "sql"=>"next_run_date", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); - - MetaModel::Init_AddAttribute(new AttributeInteger("total_exec_count", array("allowed_values"=>null, "sql"=>"total_exec_count", "default_value"=>"0", "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDecimal("latest_run_duration", array("allowed_values"=>null, "sql"=>"latest_run_duration", "digits"=> 8, "decimals"=> 3, "default_value"=>"0", "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDecimal("min_run_duration", array("allowed_values"=>null, "sql"=>"min_run_duration", "digits"=> 8, "decimals"=> 3, "default_value"=>"0", "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDecimal("max_run_duration", array("allowed_values"=>null, "sql"=>"max_run_duration", "digits"=> 8, "decimals"=> 3, "default_value"=>"0", "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDecimal("average_run_duration", array("allowed_values"=>null, "sql"=>"average_run_duration", "digits"=> 8, "decimals"=> 3, "default_value"=>"0", "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("class_name", ["allowed_values" => null, "sql" => "class_name", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDateTime("first_run_date", ["allowed_values" => null, "sql" => "first_run_date", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDateTime("latest_run_date", ["allowed_values" => null, "sql" => "latest_run_date", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDateTime("next_run_date", ["allowed_values" => null, "sql" => "next_run_date", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeBoolean("running", array("allowed_values"=>null, "sql"=>"running", "default_value"=>false, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('active,paused,removed'), "sql"=>"status", "default_value"=>'active', "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("system_user", array("allowed_values"=>null, "sql"=>"system_user", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeInteger("total_exec_count", ["allowed_values" => null, "sql" => "total_exec_count", "default_value" => "0", "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDecimal("latest_run_duration", ["allowed_values" => null, "sql" => "latest_run_duration", "digits" => 8, "decimals" => 3, "default_value" => "0", "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDecimal("min_run_duration", ["allowed_values" => null, "sql" => "min_run_duration", "digits" => 8, "decimals" => 3, "default_value" => "0", "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDecimal("max_run_duration", ["allowed_values" => null, "sql" => "max_run_duration", "digits" => 8, "decimals" => 3, "default_value" => "0", "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDecimal("average_run_duration", ["allowed_values" => null, "sql" => "average_run_duration", "digits" => 8, "decimals" => 3, "default_value" => "0", "is_null_allowed" => true, "depends_on" => []])); + + MetaModel::Init_AddAttribute(new AttributeBoolean("running", ["allowed_values" => null, "sql" => "running", "default_value" => false, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("status", ["allowed_values" => new ValueSetEnum('active,paused,removed'), "sql" => "status", "default_value" => 'active', "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("system_user", ["allowed_values" => null, "sql" => "system_user", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); } - + public function ComputeDurations($fLatestDuration) { $iTotalRun = $this->Get('total_exec_count'); - $fAverageDuration = ($this->Get('average_run_duration') * $iTotalRun + $fLatestDuration) / (1+$iTotalRun); - $this->Set('average_run_duration', sprintf('%.3f',$fAverageDuration)); - $this->Set('total_exec_count', 1+$iTotalRun); - if ($fLatestDuration < $this->Get('min_run_duration')) - { - $this->Set('min_run_duration', sprintf('%.3f',$fLatestDuration)); + $fAverageDuration = ($this->Get('average_run_duration') * $iTotalRun + $fLatestDuration) / (1 + $iTotalRun); + $this->Set('average_run_duration', sprintf('%.3f', $fAverageDuration)); + $this->Set('total_exec_count', 1 + $iTotalRun); + if ($fLatestDuration < $this->Get('min_run_duration')) { + $this->Set('min_run_duration', sprintf('%.3f', $fLatestDuration)); } - if ($fLatestDuration > $this->Get('max_run_duration')) - { - $this->Set('max_run_duration', sprintf('%.3f',$fLatestDuration)); + if ($fLatestDuration > $this->Get('max_run_duration')) { + $this->Set('max_run_duration', sprintf('%.3f', $fLatestDuration)); } - $this->Set('latest_run_duration', sprintf('%.3f',$fLatestDuration)); + $this->Set('latest_run_duration', sprintf('%.3f', $fLatestDuration)); } } diff --git a/core/bulkchange.class.inc.php b/core/bulkchange.class.inc.php index df6a238e5..1fe3ff8b1 100644 --- a/core/bulkchange.class.inc.php +++ b/core/bulkchange.class.inc.php @@ -1,4 +1,5 @@ m_proposedValue)) { + if (is_object($this->m_proposedValue)) { if ($this->m_proposedValue instanceof ReportValue) { return $this->m_proposedValue->GetAsCSV($bLocalizedValues, ',', '"'); } - throw new Exception('Unexpected class : '. get_class($this->m_proposedValue)); + throw new Exception('Unexpected class : '.get_class($this->m_proposedValue)); } return $this->m_proposedValue; } @@ -60,12 +60,11 @@ abstract class CellChangeSpec if ($this->m_proposedValue instanceof ReportValue) { return $this->m_proposedValue->GetAsHTML($bLocalizedValues); } - throw new Exception('Unexpected class : '. get_class($this->m_proposedValue)); + throw new Exception('Unexpected class : '.get_class($this->m_proposedValue)); } return utils::EscapeHtml($this->m_proposedValue); } - /** * @since 3.1.0 N°5305 */ @@ -84,7 +83,8 @@ abstract class CellChangeSpec */ public function GetCLIValueAndDescription(): string { - return sprintf("%s%s", + return sprintf( + "%s%s", $this->GetCLIValue(), $this->GetDescription() ); @@ -93,7 +93,6 @@ abstract class CellChangeSpec abstract public function GetDescription(); } - class CellStatus_Void extends CellChangeSpec { public function GetDescription() @@ -139,20 +138,18 @@ class CellStatus_Issue extends CellStatus_Modify if (is_null($this->m_proposedValue)) { return Dict::Format('UI:CSVReport-Value-SetIssue'); } - return Dict::Format('UI:CSVReport-Value-ChangeIssue',$this->m_proposedValue); + return Dict::Format('UI:CSVReport-Value-ChangeIssue', $this->m_proposedValue); } public function GetHTMLValue(bool $bLocalizedValues = false): string { - if (is_null($this->m_proposedValue)) - { + if (is_null($this->m_proposedValue)) { return Dict::Format('UI:CSVReport-Value-SetIssue'); } - if ($this->m_proposedValue instanceof ReportValue) - { + if ($this->m_proposedValue instanceof ReportValue) { return Dict::Format('UI:CSVReport-Value-ChangeIssue', $this->m_proposedValue->GetAsHTML($bLocalizedValues)); } - return Dict::Format('UI:CSVReport-Value-ChangeIssue',utils::EscapeHtml($this->m_proposedValue)); + return Dict::Format('UI:CSVReport-Value-ChangeIssue', utils::EscapeHtml($this->m_proposedValue)); } public function GetDescription() @@ -164,7 +161,8 @@ class CellStatus_Issue extends CellStatus_Modify */ public function GetCLIValueAndDescription(): string { - return sprintf("%s. %s", + return sprintf( + "%s. %s", $this->GetCLIValue(), $this->GetDescription() ); @@ -244,7 +242,8 @@ class CellStatus_SearchIssue extends CellStatus_Issue */ public function GetSearchLinkUrl() { - return sprintf("UI.php?operation=search&filter=%s", + return sprintf( + "UI.php?operation=search&filter=%s", rawurlencode($this->sSerializedSearch ?? "") ); } @@ -255,7 +254,8 @@ class CellStatus_SearchIssue extends CellStatus_Issue */ public function GetAllowedValuesLinkUrl(): ?string { - return sprintf("UI.php?operation=search&filter=%s", + return sprintf( + "UI.php?operation=search&filter=%s", rawurlencode($this->sAllowedValuesSearch ?? "") ); } @@ -284,7 +284,9 @@ class ReportValue * @param string $sAttCode * @param bool $bOriginal */ - public function __construct(protected DBObject $oObject, protected string $sAttCode, protected bool $bOriginal){} + public function __construct(protected DBObject $oObject, protected string $sAttCode, protected bool $bOriginal) + { + } public function GetAsHTML(bool $bLocalizedValues) { @@ -293,7 +295,8 @@ class ReportValue } return $this->oObject->GetAsHTML($this->sAttCode, $bLocalizedValues); } - public function GetAsCSV (bool $bLocalizedValues, string $sCsvSep, string $sCsvDelimiter) { + public function GetAsCSV(bool $bLocalizedValues, string $sCsvSep, string $sCsvDelimiter) + { if ($this->bOriginal) { return $this->oObject->GetOriginalAsCSV($this->sAttCode, $sCsvSep, $sCsvDelimiter, $bLocalizedValues); } @@ -301,7 +304,6 @@ class ReportValue } } - class CellStatus_Ambiguous extends CellStatus_Issue { protected $m_iCount; @@ -338,13 +340,13 @@ class CellStatus_Ambiguous extends CellStatus_Issue */ public function GetSearchLinkUrl() { - return sprintf("UI.php?operation=search&filter=%s", + return sprintf( + "UI.php?operation=search&filter=%s", rawurlencode($this->sSerializedSearch ?? "") ); } } - /** * RowStatus * A series of classes, keeping the information about a given row: could it be changed or not (and why)? @@ -484,21 +486,17 @@ class BulkChange $this->m_aOnDisappear = $aOnDisappear; $this->m_sDateFormat = $sDateFormat; $this->m_bLocalizedValues = $bLocalize; - $this->m_aExtKeysMappingCache = array(); + $this->m_aExtKeysMappingCache = []; } protected function ResolveExternalKey($aRowData, $sAttCode, &$aResults) { $oExtKey = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode); $oReconFilter = new DBObjectSearch($oExtKey->GetTargetClass()); - foreach ($this->m_aExtKeys[$sAttCode] as $sReconKeyAttCode => $iCol) - { - if ($sReconKeyAttCode == 'id') - { + foreach ($this->m_aExtKeys[$sAttCode] as $sReconKeyAttCode => $iCol) { + if ($sReconKeyAttCode == 'id') { $value = (int) $aRowData[$iCol]; - } - else - { + } else { // The foreign attribute is one of our reconciliation key $oForeignAtt = MetaModel::GetAttributeDef($oExtKey->GetTargetClass(), $sReconKeyAttCode); $value = $oForeignAtt->MakeValueFromString($aRowData[$iCol], $this->m_bLocalizedValues); @@ -509,18 +507,16 @@ class BulkChange $oExtObjects = new CMDBObjectSet($oReconFilter); $aKeys = $oExtObjects->ToArray(); - return array($oReconFilter, $aKeys); + return [$oReconFilter, $aKeys]; } // Returns true if the CSV data specifies that the external key must be left undefined protected function IsNullExternalKeySpec($aRowData, $sAttCode) { //$oExtKey = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode); - foreach ($this->m_aExtKeys[$sAttCode] as $sForeignAttCode => $iCol) - { + foreach ($this->m_aExtKeys[$sAttCode] as $sForeignAttCode => $iCol) { // The foreign attribute is one of our reconciliation key - if (strlen($aRowData[$iCol]) > 0) - { + if (strlen($aRowData[$iCol]) > 0) { return false; } } @@ -541,51 +537,39 @@ class BulkChange */ protected function PrepareObject(&$oTargetObj, $aRowData, &$aErrors) { - $aResults = array(); - $aErrors = array(); + $aResults = []; + $aErrors = []; // External keys reconciliation // - foreach($this->m_aExtKeys as $sAttCode => $aReconKeys) - { + foreach ($this->m_aExtKeys as $sAttCode => $aReconKeys) { // Skip external keys used for the reconciliation process // if (!array_key_exists($sAttCode, $this->m_aAttList)) continue; $oExtKey = MetaModel::GetAttributeDef(get_class($oTargetObj), $sAttCode); - if ($this->IsNullExternalKeySpec($aRowData, $sAttCode)) - { - foreach ($aReconKeys as $sReconKeyAttCode => $iCol) - { + if ($this->IsNullExternalKeySpec($aRowData, $sAttCode)) { + foreach ($aReconKeys as $sReconKeyAttCode => $iCol) { // Default reporting // $aRowData[$iCol] is always null $aResults[$iCol] = new CellStatus_Void($aRowData[$iCol]); } - if ($oExtKey->IsNullAllowed()) - { + if ($oExtKey->IsNullAllowed()) { $oTargetObj->Set($sAttCode, $oExtKey->GetNullValue()); - $aResults[$sAttCode]= new CellStatus_Void($oExtKey->GetNullValue()); - } - else - { + $aResults[$sAttCode] = new CellStatus_Void($oExtKey->GetNullValue()); + } else { $aErrors[$sAttCode] = Dict::S('UI:CSVReport-Value-Issue-Null'); - $aResults[$sAttCode]= new CellStatus_Issue(null, $oTargetObj->Get($sAttCode), Dict::S('UI:CSVReport-Value-Issue-Null')); + $aResults[$sAttCode] = new CellStatus_Issue(null, $oTargetObj->Get($sAttCode), Dict::S('UI:CSVReport-Value-Issue-Null')); } - } - else - { + } else { $oReconFilter = new DBObjectSearch($oExtKey->GetTargetClass()); - $aCacheKeys = array(); - foreach ($aReconKeys as $sReconKeyAttCode => $iCol) - { + $aCacheKeys = []; + foreach ($aReconKeys as $sReconKeyAttCode => $iCol) { // The foreign attribute is one of our reconciliation key - if ($sReconKeyAttCode == 'id') - { + if ($sReconKeyAttCode == 'id') { $value = $aRowData[$iCol]; - } - else - { + } else { $oForeignAtt = MetaModel::GetAttributeDef($oExtKey->GetTargetClass(), $sReconKeyAttCode); $value = $oForeignAtt->MakeValueFromString($aRowData[$iCol], $this->m_bLocalizedValues); } @@ -596,37 +580,31 @@ class BulkChange $sCacheKey = implode('_|_', $aCacheKeys); // Unique key for this query... $iForeignKey = null; // TODO: check if *too long* keys can lead to collisions... and skip the cache in such a case... - if (!array_key_exists($sAttCode, $this->m_aExtKeysMappingCache)) - { - $this->m_aExtKeysMappingCache[$sAttCode] = array(); + if (!array_key_exists($sAttCode, $this->m_aExtKeysMappingCache)) { + $this->m_aExtKeysMappingCache[$sAttCode] = []; } - if (array_key_exists($sCacheKey, $this->m_aExtKeysMappingCache[$sAttCode])) - { + if (array_key_exists($sCacheKey, $this->m_aExtKeysMappingCache[$sAttCode])) { // Cache hit $iObjectFoundCount = $this->m_aExtKeysMappingCache[$sAttCode][$sCacheKey]['c']; $iForeignKey = $this->m_aExtKeysMappingCache[$sAttCode][$sCacheKey]['k']; // Record the hit $this->m_aExtKeysMappingCache[$sAttCode][$sCacheKey]['h']++; - } - else - { + } else { // Cache miss, let's initialize it $oExtObjects = new CMDBObjectSet($oReconFilter); $iObjectFoundCount = $oExtObjects->Count(); - if ($iObjectFoundCount == 1) - { + if ($iObjectFoundCount == 1) { $oForeignObj = $oExtObjects->Fetch(); $iForeignKey = $oForeignObj->GetKey(); } - $this->m_aExtKeysMappingCache[$sAttCode][$sCacheKey] = array( + $this->m_aExtKeysMappingCache[$sAttCode][$sCacheKey] = [ 'c' => $iObjectFoundCount, 'k' => $iForeignKey, 'oql' => $oReconFilter->ToOql(), 'h' => 0, // number of hits on this cache entry - ); + ]; } - switch($iObjectFoundCount) - { + switch ($iObjectFoundCount) { case 0: $oCellStatus_SearchIssue = $this->GetCellSearchIssue($oReconFilter); $aResults[$sAttCode] = $oCellStatus_SearchIssue; @@ -640,41 +618,32 @@ class BulkChange default: $aErrors[$sAttCode] = Dict::Format('UI:CSVReport-Value-Issue-FoundMany', $iObjectFoundCount); - $aResults[$sAttCode]= new CellStatus_Ambiguous($oTargetObj->Get($sAttCode), $iObjectFoundCount, $oReconFilter->serialize()); + $aResults[$sAttCode] = new CellStatus_Ambiguous($oTargetObj->Get($sAttCode), $iObjectFoundCount, $oReconFilter->serialize()); } } // Report - if (!array_key_exists($sAttCode, $aResults)) - { + if (!array_key_exists($sAttCode, $aResults)) { $iForeignObj = $oTargetObj->Get($sAttCode); - if (array_key_exists($sAttCode, $oTargetObj->ListChanges())) - { - if ($oTargetObj->IsNew()) - { - $aResults[$sAttCode]= new CellStatus_Void($iForeignObj); - } - else - { - $aResults[$sAttCode]= new CellStatus_Modify($iForeignObj, $oTargetObj->GetOriginal($sAttCode)); - foreach ($aReconKeys as $sReconKeyAttCode => $iCol) - { + if (array_key_exists($sAttCode, $oTargetObj->ListChanges())) { + if ($oTargetObj->IsNew()) { + $aResults[$sAttCode] = new CellStatus_Void($iForeignObj); + } else { + $aResults[$sAttCode] = new CellStatus_Modify($iForeignObj, $oTargetObj->GetOriginal($sAttCode)); + foreach ($aReconKeys as $sReconKeyAttCode => $iCol) { // Report the change on reconciliation values as well $aResults[$iCol] = new CellStatus_Modify($aRowData[$iCol]); } } - } - else - { - $aResults[$sAttCode]= new CellStatus_Void($iForeignObj); + } else { + $aResults[$sAttCode] = new CellStatus_Void($iForeignObj); } } } // Set the object attributes // - foreach ($this->m_aAttList as $sAttCode => $iCol) - { + foreach ($this->m_aAttList as $sAttCode => $iCol) { // skip the private key, if any if (($sAttCode == 'id') || ($sAttCode == 'friendlyname')) { continue; @@ -687,47 +656,34 @@ class BulkChange continue; } - $aReasons = array(); + $aReasons = []; $iFlags = ($oTargetObj->IsNew()) ? $oTargetObj->GetInitialStateAttributeFlags($sAttCode, $aReasons) : $oTargetObj->GetAttributeFlags($sAttCode, $aReasons); if ((($iFlags & OPT_ATT_READONLY) == OPT_ATT_READONLY) && ($oTargetObj->Get($sAttCode) != $oAttDef->MakeValueFromString($aRowData[$iCol], $this->m_bLocalizedValues))) { $aErrors[$sAttCode] = Dict::Format('UI:CSVReport-Value-Issue-Readonly', $sAttCode, $oTargetObj->Get($sAttCode), $aRowData[$iCol]); - } - else if ($oAttDef->IsLinkSet() && $oAttDef->IsIndirect()) - { - try - { + } elseif ($oAttDef->IsLinkSet() && $oAttDef->IsIndirect()) { + try { $oSet = $oAttDef->MakeValueFromString($aRowData[$iCol], $this->m_bLocalizedValues); $oTargetObj->Set($sAttCode, $oSet); - } - catch(CoreException $e) - { + } catch (CoreException $e) { $aErrors[$sAttCode] = Dict::Format('UI:CSVReport-Value-Issue-Format', $e->getMessage()); } - } - else - { + } else { $value = $oAttDef->MakeValueFromString($aRowData[$iCol], $this->m_bLocalizedValues); - if (is_null($value) && (strlen($aRowData[$iCol]) > 0)) - { - if ($oAttDef instanceof AttributeEnum || $oAttDef instanceof AttributeTagSet){ + if (is_null($value) && (strlen($aRowData[$iCol]) > 0)) { + if ($oAttDef instanceof AttributeEnum || $oAttDef instanceof AttributeTagSet) { /** @var AttributeDefinition $oAttributeDefinition */ $oAttributeDefinition = $oAttDef; $aErrors[$sAttCode] = Dict::Format('UI:CSVReport-Value-Issue-AllowedValues', $sAttCode, implode(',', $oAttributeDefinition->GetAllowedValues())); } else { $aErrors[$sAttCode] = Dict::Format('UI:CSVReport-Value-Issue-NoMatch', $sAttCode); } - } - else - { + } else { $res = $oTargetObj->CheckValue($sAttCode, $value); - if ($res === true) - { + if ($res === true) { $oTargetObj->Set($sAttCode, $value); - } - else - { + } else { // $res is a string with the error description $aErrors[$sAttCode] = Dict::Format('UI:CSVReport-Value-Issue-Unknown', $sAttCode, $res); } @@ -740,30 +696,25 @@ class BulkChange $aChangedFields = $oTargetObj->ListChanges(); foreach ($this->m_aAttList as $sAttCode => $iCol) { if ($sAttCode == 'id') { - $aResults[$iCol]= new CellStatus_Void($aRowData[$iCol]); - } - else { + $aResults[$iCol] = new CellStatus_Void($aRowData[$iCol]); + } else { $sCurValue = new ReportValue($oTargetObj, $sAttCode, false); $sOrigValue = new ReportValue($oTargetObj, $sAttCode, true); if (isset($aErrors[$sAttCode])) { - $aResults[$iCol]= new CellStatus_Issue($aRowData[$iCol], $sOrigValue, $aErrors[$sAttCode]); - } - elseif (array_key_exists($sAttCode, $aChangedFields)){ - if ($oTargetObj->IsNew()) { - $aResults[$iCol]= new CellStatus_Void($sCurValue); + $aResults[$iCol] = new CellStatus_Issue($aRowData[$iCol], $sOrigValue, $aErrors[$sAttCode]); + } elseif (array_key_exists($sAttCode, $aChangedFields)) { + if ($oTargetObj->IsNew()) { + $aResults[$iCol] = new CellStatus_Void($sCurValue); + } else { + $aResults[$iCol] = new CellStatus_Modify($sCurValue, $sOrigValue); } - else { - $aResults[$iCol]= new CellStatus_Modify($sCurValue, $sOrigValue); - } - } - else { + } else { // By default... nothing happens $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode); if ($oAttDef instanceof AttributeDateTime) { - $aResults[$iCol]= new CellStatus_Void($oAttDef->GetFormat()->Format($aRowData[$iCol])); - } - else { - $aResults[$iCol]= new CellStatus_Void($aRowData[$iCol]); + $aResults[$iCol] = new CellStatus_Void($oAttDef->GetFormat()->Format($aRowData[$iCol])); + } else { + $aResults[$iCol] = new CellStatus_Void($aRowData[$iCol]); } } } @@ -772,8 +723,7 @@ class BulkChange // Checks // $res = $oTargetObj->CheckConsistency(); - if ($res !== true) - { + if ($res !== true) { // $res contains the error description $aErrors["GLOBAL"] = Dict::Format('UI:CSVReport-Row-Issue-Inconsistent', $res); } @@ -794,7 +744,8 @@ class BulkChange * * @since 3.1.0 N°5305 */ - protected function GetCellSearchIssue($oDbSearchWithConditions) : CellStatus_SearchIssue { + protected function GetCellSearchIssue($oDbSearchWithConditions): CellStatus_SearchIssue + { //current search with current permissions did not match //let's search why and give some more feedback to the user @@ -817,36 +768,38 @@ class BulkChange $iCurrentUserRightsObjectCount = $oExtObjectSetWithCurrentUserPermissions->Count(); $sAllowedValuesOql = $oDbSearchWithoutAnyCondition->serialize(); - if ($iCurrentUserRightsObjectCount === 0){ + if ($iCurrentUserRightsObjectCount === 0) { // No objects visible by current user $sReason = Dict::Format('UI:CSVReport-Value-NoMatch-NoObject-ForCurrentUser', $oDbSearchWithConditions->GetClass()); return new CellStatus_SearchIssue($sSerializedSearch, $sReason); } - try{ + try { $aDisplayedAllowedValues = []; // Possibles values are displayed to UI user. we have to limit the amount of displayed values $oExtObjectSetWithCurrentUserPermissions->SetLimit(4); - for($i = 0; $i < 3; $i++){ + for ($i = 0; $i < 3; $i++) { /** @var DBObject $oVisibleObject */ $oVisibleObject = $oExtObjectSetWithCurrentUserPermissions->Fetch(); - if (is_null($oVisibleObject)){ + if (is_null($oVisibleObject)) { break; } $aCurrentAllowedValueFields = []; - foreach ($oDbSearchWithConditions->GetInternalParams() as $sForeignAttCode => $sValue){ + foreach ($oDbSearchWithConditions->GetInternalParams() as $sForeignAttCode => $sValue) { $aCurrentAllowedValueFields[] = $oVisibleObject->Get($sForeignAttCode); } $aDisplayedAllowedValues[] = implode(" ", $aCurrentAllowedValueFields); } $allowedValues = implode(", ", $aDisplayedAllowedValues); - if ($oExtObjectSetWithCurrentUserPermissions->Count() > 3){ + if ($oExtObjectSetWithCurrentUserPermissions->Count() > 3) { $allowedValues .= "..."; } - } catch(Exception $e) { - IssueLog::Error("failure during CSV import when fetching few visible objects: ", null, + } catch (Exception $e) { + IssueLog::Error( + "failure during CSV import when fetching few visible objects: ", + null, [ 'target_class' => $oDbSearchWithConditions->GetClass(), 'criteria' => $oDbSearchWithConditions->GetCriteria(), 'message' => $e->getMessage()] ); $sReason = Dict::Format('UI:CSVReport-Value-NoMatch-NoObject-ForCurrentUser', $oDbSearchWithConditions->GetClass()); @@ -862,39 +815,35 @@ class BulkChange // No match. This is not linked to any right issue // Possible values: DD,DD $aCurrentValueFields = []; - foreach ($oDbSearchWithConditions->GetInternalParams() as $sValue){ + foreach ($oDbSearchWithConditions->GetInternalParams() as $sValue) { $aCurrentValueFields[] = $sValue; } - $value =implode(" ", $aCurrentValueFields); + $value = implode(" ", $aCurrentValueFields); $sReason = Dict::Format('UI:CSVReport-Value-NoMatch', $value); return new CellStatus_SearchIssue($sSerializedSearch, $sReason, $oDbSearchWithConditions->GetClass(), $allowedValues, $sAllowedValuesOql); } protected function PrepareMissingObject(&$oTargetObj, &$aErrors) { - $aResults = array(); - $aErrors = array(); + $aResults = []; + $aErrors = []; // External keys // - foreach($this->m_aExtKeys as $sAttCode => $aKeyConfig) - { + foreach ($this->m_aExtKeys as $sAttCode => $aKeyConfig) { //$oExtKey = MetaModel::GetAttributeDef(get_class($oTargetObj), $sAttCode); - $aResults[$sAttCode]= new CellStatus_Void($oTargetObj->Get($sAttCode)); + $aResults[$sAttCode] = new CellStatus_Void($oTargetObj->Get($sAttCode)); - foreach ($aKeyConfig as $sForeignAttCode => $iCol) - { + foreach ($aKeyConfig as $sForeignAttCode => $iCol) { $aResults[$iCol] = new CellStatus_Void('?'); } } // Update attributes // - foreach($this->m_aOnDisappear as $sAttCode => $value) - { - if (!MetaModel::IsValidAttCode(get_class($oTargetObj), $sAttCode)) - { - throw new BulkChangeException('Invalid attribute code', array('class' => get_class($oTargetObj), 'attcode' => $sAttCode)); + foreach ($this->m_aOnDisappear as $sAttCode => $value) { + if (!MetaModel::IsValidAttCode(get_class($oTargetObj), $sAttCode)) { + throw new BulkChangeException('Invalid attribute code', ['class' => get_class($oTargetObj), 'attcode' => $sAttCode]); } $oTargetObj->Set($sAttCode, $value); } @@ -902,61 +851,46 @@ class BulkChange // Reporting on fields // $aChangedFields = $oTargetObj->ListChanges(); - foreach ($this->m_aAttList as $sAttCode => $iCol) - { - if ($sAttCode == 'id') - { - $aResults[$iCol]= new CellStatus_Void($oTargetObj->GetKey()); + foreach ($this->m_aAttList as $sAttCode => $iCol) { + if ($sAttCode == 'id') { + $aResults[$iCol] = new CellStatus_Void($oTargetObj->GetKey()); } - if (array_key_exists($sAttCode, $aChangedFields)) - { - $aResults[$iCol]= new CellStatus_Modify($oTargetObj->Get($sAttCode), $oTargetObj->GetOriginal($sAttCode)); - } - else - { + if (array_key_exists($sAttCode, $aChangedFields)) { + $aResults[$iCol] = new CellStatus_Modify($oTargetObj->Get($sAttCode), $oTargetObj->GetOriginal($sAttCode)); + } else { // By default... nothing happens - $aResults[$iCol]= new CellStatus_Void($oTargetObj->Get($sAttCode)); + $aResults[$iCol] = new CellStatus_Void($oTargetObj->Get($sAttCode)); } } // Checks // $res = $oTargetObj->CheckConsistency(); - if ($res !== true) - { + if ($res !== true) { // $res contains the error description $aErrors["GLOBAL"] = Dict::Format('UI:CSVReport-Row-Issue-Inconsistent', $res); } return $aResults; } - protected function CreateObject(&$aResult, $iRow, $aRowData, CMDBChange $oChange = null) { $oTargetObj = MetaModel::NewObject($this->m_sClass); // Populate the cache for hierarchical keys (only if in verify mode) - if (is_null($oChange)) - { + if (is_null($oChange)) { // 1. determine if a hierarchical key exists - foreach($this->m_aExtKeys as $sAttCode => $aKeyConfig) - { + foreach ($this->m_aExtKeys as $sAttCode => $aKeyConfig) { $oExtKey = MetaModel::GetAttributeDef(get_class($oTargetObj), $sAttCode); - if (!$this->IsNullExternalKeySpec($aRowData, $sAttCode) && MetaModel::IsParentClass(get_class($oTargetObj), $this->m_sClass)) - { + if (!$this->IsNullExternalKeySpec($aRowData, $sAttCode) && MetaModel::IsParentClass(get_class($oTargetObj), $this->m_sClass)) { // 2. Populate the cache for further checks - $aCacheKeys = array(); - foreach ($aKeyConfig as $sForeignAttCode => $iCol) - { + $aCacheKeys = []; + foreach ($aKeyConfig as $sForeignAttCode => $iCol) { // The foreign attribute is one of our reconciliation key - if ($sForeignAttCode == 'id') - { + if ($sForeignAttCode == 'id') { $value = $aRowData[$iCol]; - } - else - { - if (!isset($this->m_aAttList[$sForeignAttCode]) || !isset($aRowData[$this->m_aAttList[$sForeignAttCode]])) - { + } else { + if (!isset($this->m_aAttList[$sForeignAttCode]) || !isset($aRowData[$this->m_aAttList[$sForeignAttCode]])) { // the key is not in the import break 2; } @@ -965,20 +899,19 @@ class BulkChange $aCacheKeys[] = $value; } $sCacheKey = implode('_|_', $aCacheKeys); // Unique key for this query... - $this->m_aExtKeysMappingCache[$sAttCode][$sCacheKey] = array( + $this->m_aExtKeysMappingCache[$sAttCode][$sCacheKey] = [ 'c' => 1, 'k' => -1, 'oql' => '', 'h' => 0, // number of hits on this cache entry - ); + ]; } } } $aResult[$iRow] = $this->PrepareObject($oTargetObj, $aRowData, $aErrors); - if (count($aErrors) > 0) - { + if (count($aErrors) > 0) { $sErrors = implode(', ', $aErrors); $aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Attribute')); //__ERRORS__ used by tests only @@ -987,19 +920,15 @@ class BulkChange } // Check that any external key will have a value proposed - $aMissingKeys = array(); - foreach (MetaModel::GetExternalKeys($this->m_sClass) as $sExtKeyAttCode => $oExtKey) - { - if (!$oExtKey->IsNullAllowed()) - { - if (!array_key_exists($sExtKeyAttCode, $this->m_aExtKeys) && !array_key_exists($sExtKeyAttCode, $this->m_aAttList)) - { + $aMissingKeys = []; + foreach (MetaModel::GetExternalKeys($this->m_sClass) as $sExtKeyAttCode => $oExtKey) { + if (!$oExtKey->IsNullAllowed()) { + if (!array_key_exists($sExtKeyAttCode, $this->m_aExtKeys) && !array_key_exists($sExtKeyAttCode, $this->m_aAttList)) { $aMissingKeys[] = $oExtKey->GetLabel(); } } } - if (count($aMissingKeys) > 0) - { + if (count($aMissingKeys) > 0) { $sMissingKeys = implode(', ', $aMissingKeys); $aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::Format('UI:CSVReport-Row-Issue-MissingExtKey', $sMissingKeys)); return $oTargetObj; @@ -1007,12 +936,9 @@ class BulkChange // Optionally record the results // - if ($oChange) - { + if ($oChange) { $newID = $oTargetObj->DBInsert(); - } - else - { + } else { $newID = 0; } @@ -1045,8 +971,7 @@ class BulkChange $aResult[$iRow]["finalclass"] = get_class($oTargetObj); $aResult[$iRow]["id"] = new CellStatus_Void($oTargetObj->GetKey()); - if (count($aErrors) > 0) - { + if (count($aErrors) > 0) { $sErrors = implode(', ', $aErrors); $aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Attribute')); //__ERRORS__ used by tests only @@ -1055,26 +980,19 @@ class BulkChange } $aChangedFields = $oTargetObj->ListChanges(); - if (count($aChangedFields) > 0) - { + if (count($aChangedFields) > 0) { $aResult[$iRow]["__STATUS__"] = new RowStatus_Modify(count($aChangedFields)); // Optionaly record the results // - if ($oChange) - { - try - { + if ($oChange) { + try { $oTargetObj->DBUpdate(); - } - catch(CoreException $e) - { + } catch (CoreException $e) { $aResult[$iRow]["__STATUS__"] = new RowStatus_Issue($e->getMessage()); } } - } - else - { + } else { $aResult[$iRow]["__STATUS__"] = new RowStatus_NoChange(); } } @@ -1096,8 +1014,7 @@ class BulkChange $aResult[$iRow]["finalclass"] = get_class($oTargetObj); $aResult[$iRow]["id"] = new CellStatus_Void($oTargetObj->GetKey()); - if (count($aErrors) > 0) - { + if (count($aErrors) > 0) { $sErrors = implode(', ', $aErrors); $aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Attribute')); //__ERRORS__ used by tests only @@ -1106,34 +1023,26 @@ class BulkChange } $aChangedFields = $oTargetObj->ListChanges(); - if (count($aChangedFields) > 0) - { + if (count($aChangedFields) > 0) { $aResult[$iRow]["__STATUS__"] = new RowStatus_Disappeared(count($aChangedFields)); // Optionaly record the results // - if ($oChange) - { - try - { + if ($oChange) { + try { $oTargetObj->DBUpdate(); - } - catch(CoreException $e) - { + } catch (CoreException $e) { $aResult[$iRow]["__STATUS__"] = new RowStatus_Issue($e->getMessage()); } } - } - else - { + } else { $aResult[$iRow]["__STATUS__"] = new RowStatus_Disappeared(0); } } public function Process(CMDBChange $oChange = null) { - if ($oChange) - { + if ($oChange) { CMDBObject::SetCurrentChange($oChange); } @@ -1141,8 +1050,7 @@ class BulkChange // Debug... // - if (false) - { + if (false) { echo "
      \n";
       			echo "Attributes:\n";
       			print_r($this->m_aAttList);
      @@ -1160,10 +1068,9 @@ class BulkChange
       			exit;
       		}
       
      -		$aResult = array();
      +		$aResult = [];
       
      -		if (!is_null($this->m_sDateFormat) && (strlen($this->m_sDateFormat) > 0))
      -		{
      +		if (!is_null($this->m_sDateFormat) && (strlen($this->m_sDateFormat) > 0)) {
       			$sDateTimeFormat = $this->m_sDateFormat; // the specified format is actually the date AND time format
       			$oDateTimeFormat = new DateTimeFormat($sDateTimeFormat);
       			$sDateFormat = $oDateTimeFormat->ToDateFormat();
      @@ -1171,52 +1078,41 @@ class BulkChange
       			AttributeDate::SetFormat(new DateTimeFormat($sDateFormat));
       			// Translate dates from the source data
       			//
      -			foreach ($this->m_aAttList as $sAttCode => $iCol)
      -			{
      -				if ($sAttCode == 'id') continue;
      +			foreach ($this->m_aAttList as $sAttCode => $iCol) {
      +				if ($sAttCode == 'id') {
      +					continue;
      +				}
       
       				$oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
      -				if ($oAttDef instanceof AttributeDateTime) // AttributeDate is derived from AttributeDateTime
      -				{
      -					foreach($this->m_aData as $iRow => $aRowData)
      -					{
      +				if ($oAttDef instanceof AttributeDateTime) { // AttributeDate is derived from AttributeDateTime
      +					foreach ($this->m_aData as $iRow => $aRowData) {
       						$sFormat = $sDateTimeFormat;
       						$sValue = $this->m_aData[$iRow][$iCol];
      -						if (!empty($sValue))
      -						{
      -							if ($oAttDef instanceof AttributeDate)
      -							{
      +						if (!empty($sValue)) {
      +							if ($oAttDef instanceof AttributeDate) {
       								$sFormat = $sDateFormat;
       							}
       							$oFormat = new DateTimeFormat($sFormat);
       							$sDateExample = $oFormat->Format(new DateTime('2022-10-23 16:25:33'));
       							$sRegExp = $oFormat->ToRegExpr('/');
       							$sErrorMsg = Dict::Format('UI:CSVReport-Row-Issue-ExpectedDateFormat', $sDateExample);
      -							if (!preg_match($sRegExp, $sValue))
      -							{
      -								$aResult[$iRow]["__STATUS__"]= new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-DateFormat'));
      +							if (!preg_match($sRegExp, $sValue)) {
      +								$aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-DateFormat'));
       								$aResult[$iRow][$iCol] = new CellStatus_Issue($sValue, null, $sErrorMsg);
       
      -							}
      -							else
      -							{
      +							} else {
       								$oDate = DateTime::createFromFormat($sFormat, $sValue);
      -								if ($oDate !== false)
      -								{
      +								if ($oDate !== false) {
       									$sNewDate = $oDate->format($oAttDef->GetInternalFormat());
       									$this->m_aData[$iRow][$iCol] = $sNewDate;
      -								}
      -								else
      -								{
      +								} else {
       									// almost impossible ti reproduce since even incorrect dates with correct formats are formated and $oDate will not be false
       									// Leave the cell unchanged
      -									$aResult[$iRow]["__STATUS__"]= new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-DateFormat'));
      +									$aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-DateFormat'));
       									$aResult[$iRow][$iCol] = new CellStatus_Issue($sValue, null, $sErrorMsg);
       								}
       							}
      -						}
      -						else
      -						{
      +						} else {
       							$this->m_aData[$iRow][$iCol] = '';
       						}
       					}
      @@ -1226,9 +1122,8 @@ class BulkChange
       
       		// Compute the results
       		//
      -		if (!is_null($this->m_sSynchroScope))
      -		{
      -			$aVisited = array();
      +		if (!is_null($this->m_sSynchroScope)) {
      +			$aVisited = [];
       		}
       		$iPreviousTimeLimit = ini_get('max_execution_time');
       		$iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop');
      @@ -1342,25 +1237,18 @@ class BulkChange
       
       		// Fill in the blanks - the result matrix is expected to be 100% complete
       		//
      -		foreach($this->m_aData as $iRow => $aRowData)
      -		{
      -			foreach($this->m_aAttList as $iCol)
      -			{
      -				if (!array_key_exists($iCol, $aResult[$iRow]))
      -				{
      +		foreach ($this->m_aData as $iRow => $aRowData) {
      +			foreach ($this->m_aAttList as $iCol) {
      +				if (!array_key_exists($iCol, $aResult[$iRow])) {
       					$aResult[$iRow][$iCol] = new CellStatus_Void($aRowData[$iCol]);
       				}
       			}
      -			foreach($this->m_aExtKeys as $sAttCode => $aForeignAtts)
      -			{
      -				if (!array_key_exists($sAttCode, $aResult[$iRow]))
      -				{
      +			foreach ($this->m_aExtKeys as $sAttCode => $aForeignAtts) {
      +				if (!array_key_exists($sAttCode, $aResult[$iRow])) {
       					$aResult[$iRow][$sAttCode] = new CellStatus_Void('n/a');
       				}
      -				foreach ($aForeignAtts as $sForeignAttCode => $iCol)
      -				{
      -					if (!array_key_exists($iCol, $aResult[$iRow]))
      -					{
      +				foreach ($aForeignAtts as $sForeignAttCode => $iCol) {
      +					if (!array_key_exists($iCol, $aResult[$iRow])) {
       						// The foreign attribute is one of our reconciliation key
       						$aResult[$iRow][$iCol] = new CellStatus_Void($aRowData[$iCol]);
       					}
      @@ -1374,11 +1262,10 @@ class BulkChange
       	/**
       	 * Display the history of bulk imports
       	 */
      -	static function DisplayImportHistory(WebPage $oPage, $bFromAjax = false, $bShowAll = false)
      +	public static function DisplayImportHistory(WebPage $oPage, $bFromAjax = false, $bShowAll = false)
       	{
       		$sAjaxDivId = "CSVImportHistory";
      -		if (!$bFromAjax)
      -		{
      +		if (!$bFromAjax) {
       			$oPage->add('
      '); } @@ -1387,53 +1274,45 @@ class BulkChange $oBulkChangeSearch = DBObjectSearch::FromOQL("SELECT CMDBChange WHERE origin IN ('csv-interactive', 'csv-import.php')"); $iQueryLimit = $bShowAll ? 0 : appUserPreferences::GetPref('default_page_size', MetaModel::GetConfig()->GetMinDisplayLimit()); - $oBulkChanges = new DBObjectSet($oBulkChangeSearch, array('date' => false), array(), null, $iQueryLimit); + $oBulkChanges = new DBObjectSet($oBulkChangeSearch, ['date' => false], [], null, $iQueryLimit); $oAppContext = new ApplicationContext(); $bLimitExceeded = false; - if ($oBulkChanges->Count() > (appUserPreferences::GetPref('default_page_size', MetaModel::GetConfig()->GetMinDisplayLimit()))) - { + if ($oBulkChanges->Count() > (appUserPreferences::GetPref('default_page_size', MetaModel::GetConfig()->GetMinDisplayLimit()))) { $bLimitExceeded = true; - if (!$bShowAll) - { + if (!$bShowAll) { $iMaxObjects = appUserPreferences::GetPref('default_page_size', MetaModel::GetConfig()->GetMinDisplayLimit()); $oBulkChanges->SetLimit($iMaxObjects); } } $oBulkChanges->Seek(0); - $aDetails = array(); - while ($oChange = $oBulkChanges->Fetch()) - { + $aDetails = []; + while ($oChange = $oBulkChanges->Fetch()) { $sDate = ''.$oChange->Get('date').''; $sUser = $oChange->GetUserName(); - if (preg_match('/^(.*)\\(CSV\\)$/i', $oChange->Get('userinfo'), $aMatches)) - { + if (preg_match('/^(.*)\\(CSV\\)$/i', $oChange->Get('userinfo'), $aMatches)) { $sUser = $aMatches[1]; - } - else - { + } else { $sUser = $oChange->Get('userinfo'); } $oOpSearch = DBObjectSearch::FromOQL("SELECT CMDBChangeOpCreate WHERE change = :change_id"); - $oOpSet = new DBObjectSet($oOpSearch, array(), array('change_id' => $oChange->GetKey())); + $oOpSet = new DBObjectSet($oOpSearch, [], ['change_id' => $oChange->GetKey()]); $iCreated = $oOpSet->Count(); // Get the class from the first item found (assumption: a CSV load is done for a single class) - if ($oCreateOp = $oOpSet->Fetch()) - { + if ($oCreateOp = $oOpSet->Fetch()) { $sClass = $oCreateOp->Get('objclass'); } $oOpSearch = DBObjectSearch::FromOQL("SELECT CMDBChangeOpSetAttribute WHERE change = :change_id"); - $oOpSet = new DBObjectSet($oOpSearch, array(), array('change_id' => $oChange->GetKey())); + $oOpSet = new DBObjectSet($oOpSearch, [], ['change_id' => $oChange->GetKey()]); - $aModified = array(); - $aAttList = array(); - while ($oModified = $oOpSet->Fetch()) - { + $aModified = []; + $aAttList = []; + while ($oModified = $oOpSet->Fetch()) { // Get the class (if not done earlier on object creation) $sClass = $oModified->Get('objclass'); $iKey = $oModified->Get('objkey'); @@ -1446,28 +1325,23 @@ class BulkChange // Assumption: there is only one class of objects being loaded // Then the last class found gives us the class for every object - if ( ($iModified > 0) || ($iCreated > 0)) - { - $aDetails[] = array('date' => $sDate, 'user' => $sUser, 'class' => $sClass, 'created' => $iCreated, 'modified' => $iModified); + if (($iModified > 0) || ($iCreated > 0)) { + $aDetails[] = ['date' => $sDate, 'user' => $sUser, 'class' => $sClass, 'created' => $iCreated, 'modified' => $iModified]; } } - $aConfig = array( 'date' => array('label' => Dict::S('UI:History:Date'), 'description' => Dict::S('UI:History:Date+')), - 'user' => array('label' => Dict::S('UI:History:User'), 'description' => Dict::S('UI:History:User+')), - 'class' => array('label' => Dict::S('Core:AttributeClass'), 'description' => Dict::S('Core:AttributeClass+')), - 'created' => array('label' => Dict::S('UI:History:StatsCreations'), 'description' => Dict::S('UI:History:StatsCreations+')), - 'modified' => array('label' => Dict::S('UI:History:StatsModifs'), 'description' => Dict::S('UI:History:StatsModifs+')), - ); + $aConfig = [ 'date' => ['label' => Dict::S('UI:History:Date'), 'description' => Dict::S('UI:History:Date+')], + 'user' => ['label' => Dict::S('UI:History:User'), 'description' => Dict::S('UI:History:User+')], + 'class' => ['label' => Dict::S('Core:AttributeClass'), 'description' => Dict::S('Core:AttributeClass+')], + 'created' => ['label' => Dict::S('UI:History:StatsCreations'), 'description' => Dict::S('UI:History:StatsCreations+')], + 'modified' => ['label' => Dict::S('UI:History:StatsModifs'), 'description' => Dict::S('UI:History:StatsModifs+')], + ]; - if ($bLimitExceeded) - { - if ($bShowAll) - { + if ($bLimitExceeded) { + if ($bShowAll) { // Collapsible list $oPage->add('

      '.Dict::Format('UI:CountOfResults', $oBulkChanges->Count()).'  '.Dict::S('UI:CollapseList').'

      '); - } - else - { + } else { // Truncated list $iMinDisplayLimit = appUserPreferences::GetPref('default_page_size', MetaModel::GetConfig()->GetMinDisplayLimit()); $sCollapsedLabel = Dict::Format('UI:TruncatedResults', $iMinDisplayLimit, $oBulkChanges->Count()); @@ -1481,7 +1355,6 @@ class BulkChange EOF ); - $sAppContext = $oAppContext->GetForLink(); $oPage->add_script( <<table($aConfig, $aDetails); - if (!$bFromAjax) - { + if (!$bFromAjax) { $oPage->add('
      '); } } @@ -1517,137 +1387,104 @@ EOF * @param $iChange * @throws Exception */ - static function DisplayImportHistoryDetails(iTopWebPage $oPage, $iChange) + public static function DisplayImportHistoryDetails(iTopWebPage $oPage, $iChange) { - if ($iChange == 0) - { + if ($iChange == 0) { throw new Exception("Missing parameter changeid"); } $oChange = MetaModel::GetObject('CMDBChange', $iChange, false); - if (is_null($oChange)) - { + if (is_null($oChange)) { throw new Exception("Unknown change: $iChange"); } $oPage->add("

      ".Dict::Format('UI:History:BulkImportDetails', $oChange->Get('date'), $oChange->GetUserName())."

      \n"); // Assumption : change made one single class of objects - $aObjects = array(); - $aAttributes = array(); // array of attcode => occurences + $aObjects = []; + $aAttributes = []; // array of attcode => occurences $oOpSearch = DBObjectSearch::FromOQL("SELECT CMDBChangeOp WHERE change = :change_id"); - $oOpSet = new DBObjectSet($oOpSearch, array(), array('change_id' => $iChange)); - while ($oOperation = $oOpSet->Fetch()) - { + $oOpSet = new DBObjectSet($oOpSearch, [], ['change_id' => $iChange]); + while ($oOperation = $oOpSet->Fetch()) { $sClass = $oOperation->Get('objclass'); $iKey = $oOperation->Get('objkey'); $iObjId = "$sClass::$iKey"; - if (!isset($aObjects[$iObjId])) - { - $aObjects[$iObjId] = array(); + if (!isset($aObjects[$iObjId])) { + $aObjects[$iObjId] = []; $aObjects[$iObjId]['__class__'] = $sClass; $aObjects[$iObjId]['__id__'] = $iKey; } - if (get_class($oOperation) == 'CMDBChangeOpCreate') - { + if (get_class($oOperation) == 'CMDBChangeOpCreate') { $aObjects[$iObjId]['__created__'] = true; - } - elseif ($oOperation instanceof CMDBChangeOpSetAttribute) - { + } elseif ($oOperation instanceof CMDBChangeOpSetAttribute) { $sAttCode = $oOperation->Get('attcode'); - if ((get_class($oOperation) == 'CMDBChangeOpSetAttributeScalar') || (get_class($oOperation) == 'CMDBChangeOpSetAttributeURL')) - { + if ((get_class($oOperation) == 'CMDBChangeOpSetAttributeScalar') || (get_class($oOperation) == 'CMDBChangeOpSetAttributeURL')) { $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - if ($oAttDef->IsExternalKey()) - { + if ($oAttDef->IsExternalKey()) { $sOldValue = Dict::S('UI:UndefinedObject'); - if ($oOperation->Get('oldvalue') != 0) - { + if ($oOperation->Get('oldvalue') != 0) { $oOldTarget = MetaModel::GetObject($oAttDef->GetTargetClass(), $oOperation->Get('oldvalue')); $sOldValue = $oOldTarget->GetHyperlink(); } $sNewValue = Dict::S('UI:UndefinedObject'); - if ($oOperation->Get('newvalue') != 0) - { + if ($oOperation->Get('newvalue') != 0) { $oNewTarget = MetaModel::GetObject($oAttDef->GetTargetClass(), $oOperation->Get('newvalue')); $sNewValue = $oNewTarget->GetHyperlink(); } - } - else - { + } else { $sOldValue = $oOperation->GetAsHTML('oldvalue'); $sNewValue = $oOperation->GetAsHTML('newvalue'); } $aObjects[$iObjId][$sAttCode] = $sOldValue.' -> '.$sNewValue; - } - else - { + } else { $aObjects[$iObjId][$sAttCode] = 'n/a'; } - if (isset($aAttributes[$sAttCode])) - { + if (isset($aAttributes[$sAttCode])) { $aAttributes[$sAttCode]++; - } - else - { + } else { $aAttributes[$sAttCode] = 1; } } } - $aDetails = array(); - foreach($aObjects as $iUId => $aObjData) - { - $aRow = array(); + $aDetails = []; + foreach ($aObjects as $iUId => $aObjData) { + $aRow = []; $oObject = MetaModel::GetObject($aObjData['__class__'], $aObjData['__id__'], false); - if (is_null($oObject)) - { + if (is_null($oObject)) { $aRow['object'] = $aObjData['__class__'].'::'.$aObjData['__id__'].' (deleted)'; - } - else - { + } else { $aRow['object'] = $oObject->GetHyperlink(); } - if (isset($aObjData['__created__'])) - { + if (isset($aObjData['__created__'])) { $aRow['operation'] = Dict::S('Change:ObjectCreated'); - } - else - { + } else { $aRow['operation'] = Dict::S('Change:ObjectModified'); } - foreach ($aAttributes as $sAttCode => $iOccurences) - { - if (isset($aObjData[$sAttCode])) - { + foreach ($aAttributes as $sAttCode => $iOccurences) { + if (isset($aObjData[$sAttCode])) { $aRow[$sAttCode] = $aObjData[$sAttCode]; - } - elseif (!is_null($oObject)) - { + } elseif (!is_null($oObject)) { // This is the current vaslue: $oObject->GetAsHtml($sAttCode) // whereas we are displaying the value that was set at the time // the object was created // This requires addtional coding...let's do that later $aRow[$sAttCode] = ''; - } - else - { + } else { $aRow[$sAttCode] = ''; } } $aDetails[] = $aRow; } - $aConfig = array(); - $aConfig['object'] = array('label' => MetaModel::GetName($sClass), 'description' => MetaModel::GetClassDescription($sClass)); - $aConfig['operation'] = array('label' => Dict::S('UI:History:Changes'), 'description' => Dict::S('UI:History:Changes+')); - foreach ($aAttributes as $sAttCode => $iOccurences) - { - $aConfig[$sAttCode] = array('label' => MetaModel::GetLabel($sClass, $sAttCode), 'description' => MetaModel::GetDescription($sClass, $sAttCode)); + $aConfig = []; + $aConfig['object'] = ['label' => MetaModel::GetName($sClass), 'description' => MetaModel::GetClassDescription($sClass)]; + $aConfig['operation'] = ['label' => Dict::S('UI:History:Changes'), 'description' => Dict::S('UI:History:Changes+')]; + foreach ($aAttributes as $sAttCode => $iOccurences) { + $aConfig[$sAttCode] = ['label' => MetaModel::GetLabel($sClass, $sAttCode), 'description' => MetaModel::GetDescription($sClass, $sAttCode)]; } $oPage->table($aConfig, $aDetails); } } - diff --git a/core/bulkexport.class.inc.php b/core/bulkexport.class.inc.php index 601c1b956..064592647 100644 --- a/core/bulkexport.class.inc.php +++ b/core/bulkexport.class.inc.php @@ -1,4 +1,5 @@ sLocalizedMessage = $sLocalizedMessage; } - + public function GetLocalizedMessage() { return $this->sLocalizedMessage; @@ -42,7 +43,7 @@ class BulkExportMissingParameterException extends BulkExportException { parent::__construct('Missing parameter: '.$sFieldCode, Dict::Format('Core:BulkExport:MissingParameter_Param', $sFieldCode)); } - + } /** @@ -56,28 +57,28 @@ class BulkExportResult extends DBObject { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => 'core/cmdb', "key_type" => 'autoincrement', - "name_attcode" => array('created'), + "name_attcode" => ['created'], "state_attcode" => '', - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => 'priv_bulk_export_result', "db_key_field" => 'id', "db_finalclass_field" => '', "display_template" => '', - ); + ]; MetaModel::Init_Params($aParams); - MetaModel::Init_AddAttribute(new AttributeDateTime("created", array("allowed_values"=>null, "sql"=>"created", "default_value"=>"NOW()", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeInteger("user_id", array("allowed_values"=>null, "sql"=>"user_id", "default_value"=>0, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeInteger("chunk_size", array("allowed_values"=>null, "sql"=>"chunk_size", "default_value"=>0, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("format", array("allowed_values"=>null, "sql"=>"format", "default_value"=>'', "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("temp_file_path", array("allowed_values"=>null, "sql"=>"temp_file_path", "default_value"=>'', "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeLongText("search", array("allowed_values"=>null, "sql"=>"search", "default_value"=>'', "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeLongText("status_info", array("allowed_values"=>null, "sql"=>"status_info", "default_value"=>'', "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeBoolean("localize_output", array("allowed_values"=>null, "sql"=>"localize_output", "default_value"=>true, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeDateTime("created", ["allowed_values" => null, "sql" => "created", "default_value" => "NOW()", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeInteger("user_id", ["allowed_values" => null, "sql" => "user_id", "default_value" => 0, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeInteger("chunk_size", ["allowed_values" => null, "sql" => "chunk_size", "default_value" => 0, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("format", ["allowed_values" => null, "sql" => "format", "default_value" => '', "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("temp_file_path", ["allowed_values" => null, "sql" => "temp_file_path", "default_value" => '', "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeLongText("search", ["allowed_values" => null, "sql" => "search", "default_value" => '', "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeLongText("status_info", ["allowed_values" => null, "sql" => "status_info", "default_value" => '', "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeBoolean("localize_output", ["allowed_values" => null, "sql" => "localize_output", "default_value" => true, "is_null_allowed" => true, "depends_on" => []])); } @@ -100,23 +101,21 @@ class BulkExportResultGC implements iBackgroundProcess { public function GetPeriodicity() { - return 24*3600; // seconds + return 24 * 3600; // seconds } public function Process($iTimeLimit) { - $sDateLimit = date(AttributeDateTime::GetSQLFormat(), time() - 24*3600); // Every BulkExportResult older than one day will be deleted + $sDateLimit = date(AttributeDateTime::GetSQLFormat(), time() - 24 * 3600); // Every BulkExportResult older than one day will be deleted $sOQL = "SELECT BulkExportResult WHERE created < '$sDateLimit'"; $iProcessed = 0; - while (time() < $iTimeLimit) - { + while (time() < $iTimeLimit) { // Next one ? - $oSet = new CMDBObjectSet(DBObjectSearch::FromOQL($sOQL), array('created' => true) /* order by*/, array(), null, 1 /* limit count */); - $oSet->OptimizeColumnLoad(array('BulkExportResult' => array('temp_file_path'))); + $oSet = new CMDBObjectSet(DBObjectSearch::FromOQL($sOQL), ['created' => true] /* order by*/, [], null, 1 /* limit count */); + $oSet->OptimizeColumnLoad(['BulkExportResult' => ['temp_file_path']]); $oResult = $oSet->Fetch(); - if (is_null($oResult)) - { + if (is_null($oResult)) { // Nothing to be done break; } @@ -146,7 +145,7 @@ abstract class BulkExport protected $oBulkExportResult; protected $sTmpFile; protected $bLocalizeOutput; - + public function __construct() { $this->oSearch = null; @@ -160,28 +159,24 @@ abstract class BulkExport $this->bLocalizeOutput = false; } - /** - * Find the first class capable of exporting the data in the given format - * - * @param string $sFormatCode The lowercase format (e.g. html, csv, spreadsheet, xlsx, xml, json, pdf...) - * @param DBSearch $oSearch The search/filter defining the set of objects to export or null when listing the supported formats - * - * @return BulkExport|null - * @throws ReflectionException - */ - static public function FindExporter($sFormatCode, $oSearch = null) + /** + * Find the first class capable of exporting the data in the given format + * + * @param string $sFormatCode The lowercase format (e.g. html, csv, spreadsheet, xlsx, xml, json, pdf...) + * @param DBSearch $oSearch The search/filter defining the set of objects to export or null when listing the supported formats + * + * @return BulkExport|null + * @throws ReflectionException + */ + public static function FindExporter($sFormatCode, $oSearch = null) { - foreach(get_declared_classes() as $sPHPClass) - { + foreach (get_declared_classes() as $sPHPClass) { $oRefClass = new ReflectionClass($sPHPClass); - if ($oRefClass->isSubclassOf('BulkExport') && !$oRefClass->isAbstract()) - { + if ($oRefClass->isSubclassOf('BulkExport') && !$oRefClass->isAbstract()) { /** @var BulkExport $oBulkExporter */ $oBulkExporter = new $sPHPClass(); - if ($oBulkExporter->IsFormatSupported($sFormatCode, $oSearch)) - { - if ($oSearch) - { + if ($oBulkExporter->IsFormatSupported($sFormatCode, $oSearch)) { + if ($oSearch) { $oBulkExporter->SetObjectList($oSearch); } return $oBulkExporter; @@ -191,37 +186,34 @@ abstract class BulkExport return null; } - /** - * Find the exporter corresponding to the given persistent token - * - * @param int $iPersistentToken The identifier of the BulkExportResult object storing the information - * - * @return BulkExport|null - * @throws ArchivedObjectException - * @throws CoreException - * @throws ReflectionException - */ - static public function FindExporterFromToken($iPersistentToken = null) + /** + * Find the exporter corresponding to the given persistent token + * + * @param int $iPersistentToken The identifier of the BulkExportResult object storing the information + * + * @return BulkExport|null + * @throws ArchivedObjectException + * @throws CoreException + * @throws ReflectionException + */ + public static function FindExporterFromToken($iPersistentToken = null) { $oBulkExporter = null; $oInfo = MetaModel::GetObject('BulkExportResult', $iPersistentToken, false); - if ($oInfo && ($oInfo->Get('user_id') == UserRights::GetUserId())) - { + if ($oInfo && ($oInfo->Get('user_id') == UserRights::GetUserId())) { $sFormatCode = $oInfo->Get('format'); - $aStatusInfo = json_decode($oInfo->Get('status_info'),true); + $aStatusInfo = json_decode($oInfo->Get('status_info'), true); $oSearch = DBObjectSearch::unserialize($oInfo->Get('search')); $oSearch->SetShowObsoleteData($aStatusInfo['show_obsolete_data']); $oBulkExporter = self::FindExporter($sFormatCode, $oSearch); - if ($oBulkExporter) - { + if ($oBulkExporter) { $oBulkExporter->SetFormat($sFormatCode); $oBulkExporter->SetObjectList($oSearch); $oBulkExporter->SetChunkSize($oInfo->Get('chunk_size')); $oBulkExporter->SetStatusInfo($aStatusInfo); - $oBulkExporter->SetLocalizeOutput($oInfo->Get('localize_output')); - + $oBulkExporter->SetLocalizeOutput($oInfo->Get('localize_output')); $oBulkExporter->sTmpFile = $oInfo->Get('temp_file_path'); $oBulkExporter->oBulkExportResult = $oInfo; @@ -236,18 +228,16 @@ abstract class BulkExport */ public function AppendToTmpFile($data) { - if ($this->sTmpFile == '') - { + if ($this->sTmpFile == '') { $this->sTmpFile = $this->MakeTmpFile($this->GetFileExtension()); } $hFile = fopen($this->sTmpFile, 'ab'); - if ($hFile !== false) - { + if ($hFile !== false) { fwrite($hFile, $data); fclose($hFile); } } - + public function GetTmpFilePath() { return $this->sTmpFile; @@ -257,15 +247,13 @@ abstract class BulkExport * Lists all possible export formats. The output is a hash array in the form: 'format_code' => 'localized format label' * @return array :string */ - static public function FindSupportedFormats() + public static function FindSupportedFormats() { - $aSupportedFormats = array(); - foreach(get_declared_classes() as $sPHPClass) - { + $aSupportedFormats = []; + foreach (get_declared_classes() as $sPHPClass) { $oRefClass = new ReflectionClass($sPHPClass); - if ($oRefClass->isSubClassOf('BulkExport') && !$oRefClass->isAbstract()) - { - $oBulkExporter = new $sPHPClass; + if ($oRefClass->isSubClassOf('BulkExport') && !$oRefClass->isAbstract()) { + $oBulkExporter = new $sPHPClass(); $aFormats = $oBulkExporter->GetSupportedFormats(); $aSupportedFormats = array_merge($aSupportedFormats, $aFormats); } @@ -282,14 +270,14 @@ abstract class BulkExport $this->iChunkSize = $iChunkSize; } - /** - * @param $bLocalizeOutput - */ - public function SetLocalizeOutput($bLocalizeOutput) - { - $this->bLocalizeOutput = $bLocalizeOutput; - } - + /** + * @param $bLocalizeOutput + */ + public function SetLocalizeOutput($bLocalizeOutput) + { + $this->bLocalizeOutput = $bLocalizeOutput; + } + /** * (non-PHPdoc) * @see iBulkExport::SetObjectList() @@ -299,12 +287,12 @@ abstract class BulkExport $oSearch->SetShowObsoleteData($this->aStatusInfo['show_obsolete_data']); $this->oSearch = $oSearch; } - + public function SetFormat($sFormatCode) { - $this->sFormatCode = $sFormatCode; + $this->sFormatCode = $sFormatCode; } - + /** * (non-PHPdoc) * @see iBulkExport::IsFormatSupported() @@ -320,9 +308,8 @@ abstract class BulkExport */ public function GetSupportedFormats() { - return array(); // return array('csv' => Dict::S('UI:ExportFormatCSV')); + return []; // return array('csv' => Dict::S('UI:ExportFormatCSV')); } - public function SetHttpHeaders(WebPage $oPage) { @@ -344,17 +331,16 @@ abstract class BulkExport { return ''; } - + public function SaveState() { - if ($this->oBulkExportResult === null) - { + if ($this->oBulkExportResult === null) { $this->oBulkExportResult = new BulkExportResult(); $this->oBulkExportResult->Set('format', $this->sFormatCode); $this->oBulkExportResult->Set('search', $this->oSearch->serialize()); $this->oBulkExportResult->Set('chunk_size', $this->iChunkSize); - $this->oBulkExportResult->Set('localize_output', $this->bLocalizeOutput); - } + $this->oBulkExportResult->Set('localize_output', $this->bLocalizeOutput); + } $this->oBulkExportResult->Set('status_info', json_encode($this->GetStatusInfo())); $this->oBulkExportResult->Set('temp_file_path', $this->sTmpFile); utils::PushArchiveMode(false); @@ -362,14 +348,12 @@ abstract class BulkExport utils::PopArchiveMode(); return $ret; } - + public function Cleanup() { - if (($this->oBulkExportResult && (!$this->oBulkExportResult->IsNew()))) - { + if (($this->oBulkExportResult && (!$this->oBulkExportResult->IsNew()))) { $sFilename = $this->oBulkExportResult->Get('temp_file_path'); - if ($sFilename != '') - { + if ($sFilename != '') { @unlink($sFilename); } utils::PushArchiveMode(false); @@ -380,7 +364,7 @@ abstract class BulkExport public function EnumFormParts() { - return array(); + return []; } /** @@ -392,7 +376,6 @@ abstract class BulkExport $oP->AddSubBlock($this->GetFormPart($oP, $sPartId)); } - /** * @param WebPage $oP * @param $sPartId @@ -412,14 +395,14 @@ abstract class BulkExport { $this->bLocalizeOutput = !((bool)utils::ReadParam('no_localize', 0, true, 'integer')); } - + public function GetResultAsHtml() { - + } public function GetRawResult() { - + } /** @@ -441,17 +424,17 @@ abstract class BulkExport { return 'UTF-8'; } - + public function GetStatistics() { - + } public function SetFields($sFields) { } - + public function GetDownloadFileName() { return Dict::Format('Core:BulkExportOf_Class', MetaModel::GetName($this->oSearch->GetClass())).'.'.$this->GetFileExtension(); @@ -461,7 +444,7 @@ abstract class BulkExport { $this->aStatusInfo = $aStatusInfo; } - + public function GetStatusInfo() { return $this->aStatusInfo; @@ -474,26 +457,22 @@ abstract class BulkExport */ protected function MakeTmpFile($sExtension) { - if(!is_dir(APPROOT."data/bulk_export")) - { + if (!is_dir(APPROOT."data/bulk_export")) { @mkdir(APPROOT."data/bulk_export", 0777, true /* recursive */); clearstatcache(); } - if (!is_writable(APPROOT."data/bulk_export")) - { + if (!is_writable(APPROOT."data/bulk_export")) { throw new Exception('Data directory "'.APPROOT.'data/bulk_export" could not be written.'); } $iNum = rand(); - do - { + do { $iNum++; $sToken = sprintf("%08x", $iNum); $sFileName = APPROOT."data/bulk_export/$sToken.".$sExtension; $hFile = @fopen($sFileName, 'x'); - } - while($hFile === false); - + } while ($hFile === false); + fclose($hFile); return $sFileName; } @@ -502,8 +481,7 @@ abstract class BulkExport // The built-in exports require_once(APPROOT.'core/tabularbulkexport.class.inc.php'); require_once(APPROOT.'core/htmlbulkexport.class.inc.php'); -if (extension_loaded('gd')) -{ +if (extension_loaded('gd')) { // PDF export - via TCPDF - requires GD require_once(APPROOT.'core/pdfbulkexport.class.inc.php'); } @@ -511,4 +489,3 @@ require_once(APPROOT.'core/csvbulkexport.class.inc.php'); require_once(APPROOT.'core/excelbulkexport.class.inc.php'); require_once(APPROOT.'core/spreadsheetbulkexport.class.inc.php'); require_once(APPROOT.'core/xmlbulkexport.class.inc.php'); - diff --git a/core/cmdbchange.class.inc.php b/core/cmdbchange.class.inc.php index e69673e22..0ea64f595 100644 --- a/core/cmdbchange.class.inc.php +++ b/core/cmdbchange.class.inc.php @@ -1,4 +1,5 @@ "core/cmdb, grant_by_profile", "key_type" => "autoincrement", "name_attcode" => "date", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_change", "db_key_field" => "id", "db_finalclass_field" => "", - 'indexes' => array( - array('origin'), - ), - ); + 'indexes' => [ + ['origin'], + ], + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeDateTime("date", array("allowed_values"=>null, "sql"=>"date", "default_value"=>"NOW()", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("userinfo", array("allowed_values"=>null, "sql"=>"userinfo", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalKey("user_id", array("allowed_values"=>null, "sql"=>"user_id", "targetclass"=>"User", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("origin", array("allowed_values"=>new ValueSetEnum(implode(',', [CMDBChangeOrigin::INTERACTIVE, CMDBChangeOrigin::CSV_INTERACTIVE, CMDBChangeOrigin::CSV_IMPORT, CMDBChangeOrigin::WEBSERVICE_SOAP, CMDBChangeOrigin::WEBSERVICE_REST, CMDBChangeOrigin::SYNCHRO_DATA_SOURCE, CMDBChangeOrigin::EMAIL_PROCESSING, CMDBChangeOrigin::CUSTOM_EXTENSION])), "sql"=>"origin", "default_value"=>CMDBChangeOrigin::INTERACTIVE, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeDateTime("date", ["allowed_values" => null, "sql" => "date", "default_value" => "NOW()", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("userinfo", ["allowed_values" => null, "sql" => "userinfo", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalKey("user_id", ["allowed_values" => null, "sql" => "user_id", "targetclass" => "User", "is_null_allowed" => true, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("origin", ["allowed_values" => new ValueSetEnum(implode(',', [CMDBChangeOrigin::INTERACTIVE, CMDBChangeOrigin::CSV_INTERACTIVE, CMDBChangeOrigin::CSV_IMPORT, CMDBChangeOrigin::WEBSERVICE_SOAP, CMDBChangeOrigin::WEBSERVICE_REST, CMDBChangeOrigin::SYNCHRO_DATA_SOURCE, CMDBChangeOrigin::EMAIL_PROCESSING, CMDBChangeOrigin::CUSTOM_EXTENSION])), "sql" => "origin", "default_value" => CMDBChangeOrigin::INTERACTIVE, "is_null_allowed" => true, "depends_on" => []])); } /** @@ -48,12 +49,9 @@ class CMDBChange extends DBObject */ public static function GetCurrentUserName() { - if (UserRights::IsImpersonated()) - { + if (UserRights::IsImpersonated()) { $sUserString = Dict::Format('UI:Archive_User_OnBehalfOf_User', UserRights::GetRealUserFriendlyName(), UserRights::GetUserFriendlyName()); - } - else - { + } else { $sUserString = UserRights::GetUserFriendlyName(); } return $sUserString; @@ -74,12 +72,9 @@ class CMDBChange extends DBObject public function GetUserName() { - if (preg_match('/^(.*)\\(CSV\\)$/i', $this->Get('userinfo'), $aMatches)) - { + if (preg_match('/^(.*)\\(CSV\\)$/i', $this->Get('userinfo'), $aMatches)) { $sUser = $aMatches[1]; - } - else - { + } else { $sUser = $this->Get('userinfo'); } return $sUser; diff --git a/core/cmdbchangeop.class.inc.php b/core/cmdbchangeop.class.inc.php index 26703dc62..c3add281e 100644 --- a/core/cmdbchangeop.class.inc.php +++ b/core/cmdbchangeop.class.inc.php @@ -1,9 +1,10 @@ - /** * Persistent classes (internal) : cmdbChangeOp and derived * @@ -24,9 +24,8 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - /** - * Various atomic change operations, to be tracked + * Various atomic change operations, to be tracked * * @package iTopORM */ @@ -50,31 +49,31 @@ class CMDBChangeOp extends DBObject implements iCMDBChangeOp { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "autoincrement", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop", "db_key_field" => "id", "db_finalclass_field" => "optype", - 'indexes' => array( - array('objclass', 'objkey'), - ), - ); + 'indexes' => [ + ['objclass', 'objkey'], + ], + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("change", array("allowed_values"=>null, "sql"=>"changeid", "targetclass"=>"CMDBChange", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("date", array("allowed_values"=>null, "extkey_attcode"=>"change", "target_attcode"=>"date"))); - MetaModel::Init_AddAttribute(new AttributeExternalField("userinfo", array("allowed_values"=>null, "extkey_attcode"=>"change", "target_attcode"=>"userinfo"))); - MetaModel::Init_AddAttribute(new AttributeExternalField("user_id", array("allowed_values"=>null, "extkey_attcode"=>"change", "target_attcode"=>"user_id"))); - MetaModel::Init_AddAttribute(new AttributeString("objclass", array("allowed_values"=>null, "sql"=>"objclass", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeObjectKey("objkey", array("allowed_values"=>null, "class_attcode"=>"objclass", "sql"=>"objkey", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("change", ["allowed_values" => null, "sql" => "changeid", "targetclass" => "CMDBChange", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("date", ["allowed_values" => null, "extkey_attcode" => "change", "target_attcode" => "date"])); + MetaModel::Init_AddAttribute(new AttributeExternalField("userinfo", ["allowed_values" => null, "extkey_attcode" => "change", "target_attcode" => "userinfo"])); + MetaModel::Init_AddAttribute(new AttributeExternalField("user_id", ["allowed_values" => null, "extkey_attcode" => "change", "target_attcode" => "user_id"])); + MetaModel::Init_AddAttribute(new AttributeString("objclass", ["allowed_values" => null, "sql" => "objclass", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeObjectKey("objkey", ["allowed_values" => null, "class_attcode" => "objclass", "sql" => "objkey", "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_SetZListItems('details', array('change', 'date', 'userinfo')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('change', 'date', 'userinfo')); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('details', ['change', 'date', 'userinfo']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['change', 'date', 'userinfo']); // Attributes to be displayed for the complete details } /** @@ -108,7 +107,7 @@ class CMDBChangeOp extends DBObject implements iCMDBChangeOp } /** - * Record the creation of an object + * Record the creation of an object * * @package iTopORM */ @@ -119,24 +118,24 @@ class CMDBChangeOpCreate extends CMDBChangeOp */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_create", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); } - + /** * @inheritDoc - */ + */ public function GetDescription() { return Dict::S('Change:ObjectCreated'); @@ -144,7 +143,7 @@ class CMDBChangeOpCreate extends CMDBChangeOp } /** - * Record the deletion of an object + * Record the deletion of an object * * @package iTopORM */ @@ -155,24 +154,24 @@ class CMDBChangeOpDelete extends CMDBChangeOp */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_delete", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); // Final class of the object (objclass must be set to the root class for efficiency purposes) - MetaModel::Init_AddAttribute(new AttributeString("fclass", array("allowed_values"=>null, "sql"=>"fclass", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("fclass", ["allowed_values" => null, "sql" => "fclass", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); // Last friendly name of the object - MetaModel::Init_AddAttribute(new AttributeString("fname", array("allowed_values"=>null, "sql"=>"fname", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("fname", ["allowed_values" => null, "sql" => "fname", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); } /** @@ -196,29 +195,29 @@ class CMDBChangeOpSetAttribute extends CMDBChangeOp */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_setatt", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("attcode", array("allowed_values"=>null, "sql"=>"attcode", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); - + MetaModel::Init_AddAttribute(new AttributeString("attcode", ["allowed_values" => null, "sql" => "attcode", "default_value" => "", "is_null_allowed" => false, "depends_on" => []])); + // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for a list } } /** - * Record the modification of a scalar attribute + * Record the modification of a scalar attribute * * @package iTopORM */ @@ -229,25 +228,25 @@ class CMDBChangeOpSetAttributeScalar extends CMDBChangeOpSetAttribute */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_setatt_scalar", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("oldvalue", array("allowed_values"=>null, "sql"=>"oldvalue", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("newvalue", array("allowed_values"=>null, "sql"=>"newvalue", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - + MetaModel::Init_AddAttribute(new AttributeString("oldvalue", ["allowed_values" => null, "sql" => "oldvalue", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("newvalue", ["allowed_values" => null, "sql" => "newvalue", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode', 'oldvalue', 'newvalue')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode', 'oldvalue', 'newvalue')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'attcode', 'oldvalue', 'newvalue']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'attcode', 'oldvalue', 'newvalue']); // Attributes to be displayed for a list } /** @@ -262,9 +261,10 @@ class CMDBChangeOpSetAttributeScalar extends CMDBChangeOpSetAttribute $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { - if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) return ''; // Protects against renamed attributes... + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { + if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { + return ''; + } // Protects against renamed attributes... $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); @@ -287,57 +287,58 @@ class CMDBChangeOpSetAttributeTagSet extends CMDBChangeOpSetAttribute * @inheritDoc */ public static function Init() - { - $aParams = array - ( - "category" => "core/cmdb, grant_by_profile", - "key_type" => "", - "name_attcode" => "change", - "state_attcode" => "", - "reconc_keys" => array(), - "db_table" => "priv_changeop_setatt_tagset", - "db_key_field" => "id", - "db_finalclass_field" => "", - ); - MetaModel::Init_Params($aParams); - MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeText("oldvalue", array("allowed_values"=>null, "sql"=>"oldvalue", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("newvalue", array("allowed_values"=>null, "sql"=>"newvalue", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + { + $aParams = + [ + "category" => "core/cmdb, grant_by_profile", + "key_type" => "", + "name_attcode" => "change", + "state_attcode" => "", + "reconc_keys" => [], + "db_table" => "priv_changeop_setatt_tagset", + "db_key_field" => "id", + "db_finalclass_field" => "", + ]; + MetaModel::Init_Params($aParams); + MetaModel::Init_InheritAttributes(); + MetaModel::Init_AddAttribute(new AttributeText("oldvalue", ["allowed_values" => null, "sql" => "oldvalue", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("newvalue", ["allowed_values" => null, "sql" => "newvalue", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); - // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode', 'oldvalue', 'newvalue')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode', 'oldvalue', 'newvalue')); // Attributes to be displayed for a list - } + // Display lists + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'attcode', 'oldvalue', 'newvalue']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'attcode', 'oldvalue', 'newvalue']); // Attributes to be displayed for a list + } /** * @inheritDoc */ public function GetDescription() - { - $sResult = ''; - $sTargetObjectClass = $this->Get('objclass'); - $oTargetObjectKey = $this->Get('objkey'); - $sAttCode = $this->Get('attcode'); - $oTargetSearch = new DBObjectSearch($sTargetObjectClass); - $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); + { + $sResult = ''; + $sTargetObjectClass = $this->Get('objclass'); + $oTargetObjectKey = $this->Get('objkey'); + $sAttCode = $this->Get('attcode'); + $oTargetSearch = new DBObjectSearch($sTargetObjectClass); + $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); - $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($sTargetObjectClass, $sAttCode, UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { - if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) return ''; // Protects against renamed attributes... + $oMonoObjectSet = new DBObjectSet($oTargetSearch); + if (UserRights::IsActionAllowedOnAttribute($sTargetObjectClass, $sAttCode, UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { + if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { + return ''; + } // Protects against renamed attributes... - $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); - $sAttName = $oAttDef->GetLabel(); - $sNewValue = $this->Get('newvalue'); - $sOldValue = $this->Get('oldvalue'); - $sResult = $oAttDef->DescribeChangeAsHTML($sOldValue, $sNewValue); - } - return $sResult; - } + $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); + $sAttName = $oAttDef->GetLabel(); + $sNewValue = $this->Get('newvalue'); + $sOldValue = $this->Get('oldvalue'); + $sResult = $oAttDef->DescribeChangeAsHTML($sOldValue, $sNewValue); + } + return $sResult; + } } /** - * Record the modification of an URL + * Record the modification of an URL * * @package iTopORM */ @@ -348,17 +349,17 @@ class CMDBChangeOpSetAttributeURL extends CMDBChangeOpSetAttribute */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_setatt_url", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); @@ -371,12 +372,12 @@ class CMDBChangeOpSetAttributeURL extends CMDBChangeOpSetAttribute // 2. from the iTop config // 3. config parameter default value // see \AttributeURL::GetValidationPattern - MetaModel::Init_AddAttribute(new AttributeURL("oldvalue", array("allowed_values" => null, "sql" => "oldvalue", "target" => '_blank', "default_value" => null, "is_null_allowed" => true, "depends_on" => array(), "validation_pattern" => '.*'))); - MetaModel::Init_AddAttribute(new AttributeURL("newvalue", array("allowed_values" => null, "sql" => "newvalue", "target" => '_blank', "default_value" => null, "is_null_allowed" => true, "depends_on" => array(), "validation_pattern" => '.*'))); + MetaModel::Init_AddAttribute(new AttributeURL("oldvalue", ["allowed_values" => null, "sql" => "oldvalue", "target" => '_blank', "default_value" => null, "is_null_allowed" => true, "depends_on" => [], "validation_pattern" => '.*'])); + MetaModel::Init_AddAttribute(new AttributeURL("newvalue", ["allowed_values" => null, "sql" => "newvalue", "target" => '_blank', "default_value" => null, "is_null_allowed" => true, "depends_on" => [], "validation_pattern" => '.*'])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode', 'oldvalue', 'newvalue')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode', 'oldvalue', 'newvalue')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'attcode', 'oldvalue', 'newvalue']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'attcode', 'oldvalue', 'newvalue']); // Attributes to be displayed for a list } /** @@ -391,9 +392,10 @@ class CMDBChangeOpSetAttributeURL extends CMDBChangeOpSetAttribute $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { - if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) return ''; // Protects against renamed attributes... + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { + if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { + return ''; + } // Protects against renamed attributes... $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); @@ -417,24 +419,24 @@ class CMDBChangeOpSetAttributeBlob extends CMDBChangeOpSetAttribute */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_setatt_data", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeBlob("prevdata", array("depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeBlob("prevdata", ["depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for a list } /** @@ -444,7 +446,7 @@ class CMDBChangeOpSetAttributeBlob extends CMDBChangeOpSetAttribute { // Temporary, until we change the options of GetDescription() -needs a more global revision $bIsHtml = true; - + $sResult = ''; $oTargetObjectClass = $this->Get('objclass'); $oTargetObjectKey = $this->Get('objkey'); @@ -452,8 +454,7 @@ class CMDBChangeOpSetAttributeBlob extends CMDBChangeOpSetAttribute $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); @@ -496,24 +497,24 @@ class CMDBChangeOpSetAttributeOneWayPassword extends CMDBChangeOpSetAttribute */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_setatt_pwd", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeOneWayPassword("prev_pwd", array("sql" => 'data', "default_value" => '', "is_null_allowed"=> true, "allowed_values" => null, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeOneWayPassword("prev_pwd", ["sql" => 'data', "default_value" => '', "is_null_allowed" => true, "allowed_values" => null, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for a list } /** @@ -523,7 +524,7 @@ class CMDBChangeOpSetAttributeOneWayPassword extends CMDBChangeOpSetAttribute { // Temporary, until we change the options of GetDescription() -needs a more global revision $bIsHtml = true; - + $sResult = ''; $oTargetObjectClass = $this->Get('objclass'); $oTargetObjectKey = $this->Get('objkey'); @@ -531,15 +532,11 @@ class CMDBChangeOpSetAttributeOneWayPassword extends CMDBChangeOpSetAttribute $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { - if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) - { + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { + if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); - } - else - { + } else { // The attribute was renamed or removed from the object ? $sAttName = $this->Get('attcode'); } @@ -559,24 +556,24 @@ class CMDBChangeOpSetAttributeEncrypted extends CMDBChangeOpSetAttribute */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_setatt_encrypted", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeEncryptedString("prevstring", array("sql" => 'data', "default_value" => '', "is_null_allowed"=> true, "allowed_values" => null, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeEncryptedString("prevstring", ["sql" => 'data', "default_value" => '', "is_null_allowed" => true, "allowed_values" => null, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for a list } /** @@ -586,7 +583,7 @@ class CMDBChangeOpSetAttributeEncrypted extends CMDBChangeOpSetAttribute { // Temporary, until we change the options of GetDescription() -needs a more global revision $bIsHtml = true; - + $sResult = ''; $oTargetObjectClass = $this->Get('objclass'); $oTargetObjectKey = $this->Get('objkey'); @@ -594,15 +591,11 @@ class CMDBChangeOpSetAttributeEncrypted extends CMDBChangeOpSetAttribute $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { - if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) - { + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { + if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); - } - else - { + } else { // The attribute was renamed or removed from the object ? $sAttName = $this->Get('attcode'); } @@ -625,24 +618,24 @@ class CMDBChangeOpSetAttributeText extends CMDBChangeOpSetAttribute */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_setatt_text", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeText("prevdata", array("allowed_values"=>null, "sql"=>"prevdata", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeText("prevdata", ["allowed_values" => null, "sql" => "prevdata", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for a list } /** @@ -652,7 +645,7 @@ class CMDBChangeOpSetAttributeText extends CMDBChangeOpSetAttribute { // Temporary, until we change the options of GetDescription() -needs a more global revision $bIsHtml = true; - + $sResult = ''; $oTargetObjectClass = $this->Get('objclass'); $oTargetObjectKey = $this->Get('objkey'); @@ -660,15 +653,11 @@ class CMDBChangeOpSetAttributeText extends CMDBChangeOpSetAttribute $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { - if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) - { + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { + if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); - } - else - { + } else { // The attribute was renamed or removed from the object ? $sAttName = $this->Get('attcode'); } @@ -693,24 +682,24 @@ class CMDBChangeOpSetAttributeLongText extends CMDBChangeOpSetAttribute */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_setatt_longtext", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeLongText("prevdata", array("allowed_values"=>null, "sql"=>"prevdata", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeLongText("prevdata", ["allowed_values" => null, "sql" => "prevdata", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for a list } /** @@ -725,15 +714,11 @@ class CMDBChangeOpSetAttributeLongText extends CMDBChangeOpSetAttribute $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { - if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) - { + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { + if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); - } - else - { + } else { // The attribute was renamed or removed from the object ? $sAttName = $this->Get('attcode'); } @@ -758,23 +743,23 @@ class CMDBChangeOpSetAttributeHTML extends CMDBChangeOpSetAttributeLongText */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_setatt_html", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - + // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for a list } /** @@ -787,10 +772,9 @@ class CMDBChangeOpSetAttributeHTML extends CMDBChangeOpSetAttributeLongText $oTargetObjectKey = $this->Get('objkey'); $oTargetSearch = new DBObjectSearch($oTargetObjectClass); $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); - + $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); @@ -804,7 +788,7 @@ class CMDBChangeOpSetAttributeHTML extends CMDBChangeOpSetAttributeLongText $sResult = Dict::Format('Change:AttName_Changed_PreviousValue_OldValue', $sAttName, $sTextView); } return $sResult; - } + } } /** @@ -822,24 +806,24 @@ class CMDBChangeOpSetAttributeCaseLog extends CMDBChangeOpSetAttribute */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_setatt_log", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeInteger("lastentry", array("allowed_values"=>null, "sql"=>"lastentry", "default_value"=>0, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeInteger("lastentry", ["allowed_values" => null, "sql" => "lastentry", "default_value" => 0, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for a list } /** @@ -849,7 +833,7 @@ class CMDBChangeOpSetAttributeCaseLog extends CMDBChangeOpSetAttribute { // Temporary, until we change the options of GetDescription() -needs a more global revision $bIsHtml = true; - + $sResult = ''; $oTargetObjectClass = $this->Get('objclass'); $oTargetObjectKey = $this->Get('objkey'); @@ -857,15 +841,11 @@ class CMDBChangeOpSetAttributeCaseLog extends CMDBChangeOpSetAttribute $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { - if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) - { + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { + if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); - } - else - { + } else { // The attribute was renamed or removed from the object ? $sAttName = $this->Get('attcode'); } @@ -885,12 +865,12 @@ class CMDBChangeOpSetAttributeCaseLog extends CMDBChangeOpSetAttribute */ protected function ToHtml($sRawText) { - return str_replace(array("\r\n", "\n", "\r"), "
      ", utils::EscapeHtml($sRawText)); + return str_replace(["\r\n", "\n", "\r"], "
      ", utils::EscapeHtml($sRawText)); } } /** - * Record an action made by a plug-in + * Record an action made by a plug-in * * @package iTopORM */ @@ -901,19 +881,19 @@ class CMDBChangeOpPlugin extends CMDBChangeOp */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_plugin", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); - MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>'', "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => '', "is_null_allowed" => false, "depends_on" => []])); /* May be used later when implementing an extension mechanism that will allow the plug-ins to store some extra information and still degrades gracefully when the plug-in is desinstalled MetaModel::Init_AddAttribute(new AttributeString("extension_class", array("allowed_values"=>null, "sql"=>"extension_class", "default_value"=>'', "is_null_allowed"=>false, "depends_on"=>array()))); MetaModel::Init_AddAttribute(new AttributeInteger("extension_id", array("allowed_values"=>null, "sql"=>"extension_id", "default_value"=>0, "is_null_allowed"=>false, "depends_on"=>array()))); @@ -931,7 +911,7 @@ class CMDBChangeOpPlugin extends CMDBChangeOp } /** - * Record added/removed objects from within a link set + * Record added/removed objects from within a link set * * @package iTopORM */ @@ -942,29 +922,29 @@ abstract class CMDBChangeOpSetAttributeLinks extends CMDBChangeOpSetAttribute */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_links", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); // Note: item class/id points to the link class itself in case of a direct link set (e.g. Server::interface_list => Interface) // item class/id points to the remote class in case of a indirect link set (e.g. Server::contract_list => Contract) - MetaModel::Init_AddAttribute(new AttributeString("item_class", array("allowed_values"=>null, "sql"=>"item_class", "default_value"=>'', "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeInteger("item_id", array("allowed_values"=>null, "sql"=>"item_id", "default_value"=>0, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("item_class", ["allowed_values" => null, "sql" => "item_class", "default_value" => '', "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeInteger("item_id", ["allowed_values" => null, "sql" => "item_id", "default_value" => 0, "is_null_allowed" => false, "depends_on" => []])); } } /** - * Record added/removed objects from within a link set + * Record added/removed objects from within a link set * * @package iTopORM */ @@ -975,21 +955,21 @@ class CMDBChangeOpSetAttributeLinksAddRemove extends CMDBChangeOpSetAttributeLin */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_links_addremove", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeEnum("type", array("allowed_values"=>new ValueSetEnum('added,removed'), "sql"=>"type", "default_value"=>"added", "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeEnum("type", ["allowed_values" => new ValueSetEnum('added,removed'), "sql" => "type", "default_value" => "added", "is_null_allowed" => false, "depends_on" => []])); } /** @@ -1004,9 +984,10 @@ class CMDBChangeOpSetAttributeLinksAddRemove extends CMDBChangeOpSetAttributeLin $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { - if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) return ''; // Protects against renamed attributes... + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { + if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { + return ''; + } // Protects against renamed attributes... $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); @@ -1014,15 +995,14 @@ class CMDBChangeOpSetAttributeLinksAddRemove extends CMDBChangeOpSetAttributeLin $sItemDesc = MetaModel::GetHyperLink($this->Get('item_class'), $this->Get('item_id')); $sResult = $sAttName.' - '; - switch ($this->Get('type')) - { - case 'added': - $sResult .= Dict::Format('Change:LinkSet:Added', $sItemDesc); - break; + switch ($this->Get('type')) { + case 'added': + $sResult .= Dict::Format('Change:LinkSet:Added', $sItemDesc); + break; - case 'removed': - $sResult .= Dict::Format('Change:LinkSet:Removed', $sItemDesc); - break; + case 'removed': + $sResult .= Dict::Format('Change:LinkSet:Removed', $sItemDesc); + break; } } return $sResult; @@ -1031,7 +1011,7 @@ class CMDBChangeOpSetAttributeLinksAddRemove extends CMDBChangeOpSetAttributeLin /** * Record attribute changes from within a link set - * A single record redirects to the modifications made within the same change + * A single record redirects to the modifications made within the same change * * @package iTopORM */ @@ -1042,21 +1022,21 @@ class CMDBChangeOpSetAttributeLinksTune extends CMDBChangeOpSetAttributeLinks */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_links_tune", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeInteger("link_id", array("allowed_values"=>null, "sql"=>"link_id", "default_value"=>0, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeInteger("link_id", ["allowed_values" => null, "sql" => "link_id", "default_value" => 0, "is_null_allowed" => false, "depends_on" => []])); } /** @@ -1071,9 +1051,10 @@ class CMDBChangeOpSetAttributeLinksTune extends CMDBChangeOpSetAttributeLinks $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { - if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) return ''; // Protects against renamed attributes... + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { + if (!MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { + return ''; + } // Protects against renamed attributes... $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); @@ -1086,27 +1067,22 @@ class CMDBChangeOpSetAttributeLinksTune extends CMDBChangeOpSetAttributeLinks $oSearch = new DBObjectSearch('CMDBChangeOpSetAttribute'); $oSearch->AddCondition('change', $this->Get('change'), '='); $oSearch->AddCondition('objkey', $this->Get('link_id'), '='); - if (count($aLinkClasses) == 1) - { + if (count($aLinkClasses) == 1) { // Faster than the whole building of the expression below for just one value ?? $oSearch->AddCondition('objclass', $sLinkClass, '='); - } - else - { - $oField = new FieldExpression('objclass', $oSearch->GetClassAlias()); + } else { + $oField = new FieldExpression('objclass', $oSearch->GetClassAlias()); $sListExpr = '('.implode(', ', CMDBSource::Quote($aLinkClasses)).')'; $sOQLCondition = $oField->RenderExpression()." IN $sListExpr"; $oNewCondition = Expression::FromOQL($sOQLCondition); $oSearch->AddConditionExpression($oNewCondition); } $oSet = new DBObjectSet($oSearch); - $aChanges = array(); - while ($oChangeOp = $oSet->Fetch()) - { + $aChanges = []; + while ($oChangeOp = $oSet->Fetch()) { $aChanges[] = $oChangeOp->GetDescription(); } - if (count($aChanges) == 0) - { + if (count($aChanges) == 0) { return ''; } @@ -1132,24 +1108,24 @@ class CMDBChangeOpSetAttributeCustomFields extends CMDBChangeOpSetAttribute */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_setatt_custfields", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeLongText("prevdata", array("allowed_values"=>null, "sql"=>"prevdata", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeLongText("prevdata", ["allowed_values" => null, "sql" => "prevdata", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'attcode']); // Attributes to be displayed for a list } /** @@ -1158,26 +1134,22 @@ class CMDBChangeOpSetAttributeCustomFields extends CMDBChangeOpSetAttribute public function GetDescription() { $sResult = ''; - if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) - { + if (MetaModel::IsValidAttCode($this->Get('objclass'), $this->Get('attcode'))) { $oTargetObjectClass = $this->Get('objclass'); $oTargetObjectKey = $this->Get('objkey'); $oTargetSearch = new DBObjectSearch($oTargetObjectClass); $oTargetSearch->AddCondition('id', $oTargetObjectKey, '='); $oMonoObjectSet = new DBObjectSet($oTargetSearch); - if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) - { + if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oMonoObjectSet) == UR_ALLOWED_YES) { $aValues = json_decode($this->Get('prevdata'), true); $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode')); $sAttName = $oAttDef->GetLabel(); - try - { + try { $oHandler = $oAttDef->GetHandler($aValues); $sValueDesc = $oHandler->GetAsHTML($aValues); - } - catch (Exception $e) { + } catch (Exception $e) { $sValueDesc = 'Custom field error: '.utils::EscapeHtml($e->getMessage()); } $sTextView = '
      '.$sValueDesc.'
      '; diff --git a/core/cmdbobject.class.inc.php b/core/cmdbobject.class.inc.php index 29d767420..d669f8264 100644 --- a/core/cmdbobject.class.inc.php +++ b/core/cmdbobject.class.inc.php @@ -1,4 +1,5 @@ - /** * Class cmdbObject * @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - /** * cmdbObjectClass * the file to include, then the core is yours @@ -149,8 +148,7 @@ abstract class CMDBObject extends DBObject */ public static function GetCurrentChange($bAutoCreate = true) { - if ($bAutoCreate && is_null(self::$m_oCurrChange)) - { + if ($bAutoCreate && is_null(self::$m_oCurrChange)) { self::CreateChange(); } return self::$m_oCurrChange; @@ -215,7 +213,7 @@ abstract class CMDBObject extends DBObject return CMDBChange::GetCurrentUserName(); } else { //N°5135 - add impersonation information in activity log/current cmdb change - if (UserRights::IsImpersonated()){ + if (UserRights::IsImpersonated()) { return sprintf("%s (%s)", CMDBChange::GetCurrentUserName(), self::$m_sInfo); } else { return self::$m_sInfo; @@ -235,12 +233,9 @@ abstract class CMDBObject extends DBObject if (is_null(self::$m_sUserId) //N°5135 - indicate impersonation inside changelogs && (false === UserRights::IsImpersonated()) - ) - { + ) { return CMDBChange::GetCurrentUserId(); - } - else - { + } else { return self::$m_sUserId; } } @@ -250,12 +245,9 @@ abstract class CMDBObject extends DBObject */ protected static function GetTrackOrigin() { - if (is_null(self::$m_sOrigin)) - { + if (is_null(self::$m_sOrigin)) { return 'interactive'; - } - else - { + } else { return self::$m_sOrigin; } } @@ -383,14 +375,10 @@ abstract class CMDBObject extends DBObject // $aValues is an array of $sAttCode => $value // - foreach ($aValues as $sAttCode=> $value) - { - if (array_key_exists($sAttCode, $aOrigValues)) - { + foreach ($aValues as $sAttCode => $value) { + if (array_key_exists($sAttCode, $aOrigValues)) { $original = $aOrigValues[$sAttCode]; - } - else - { + } else { $original = null; } $this->RecordAttChange($sAttCode, $original, $value); @@ -420,12 +408,10 @@ abstract class CMDBObject extends DBObject // skip_strong_security = 0, in the config file $bSkipStrongSecurity = MetaModel::GetConfig()->Get('skip_strong_security'); } - if (!$bSkipStrongSecurity) - { + if (!$bSkipStrongSecurity) { $sClass = get_class($this); $oSet = DBObjectSet::FromObject($this); - if (!UserRights::IsActionAllowed($sClass, $iActionCode, $oSet)) - { + if (!UserRights::IsActionAllowed($sClass, $iActionCode, $oSet)) { // Intrusion detected throw new SecurityException('You are not allowed to modify objects of class: '.$sClass); } @@ -495,8 +481,7 @@ abstract class CMDBObject extends DBObject $bOriginal = $this->Get('archive_flag'); parent::DBArchive(); - if (!$bOriginal) - { + if (!$bOriginal) { utils::PushArchiveMode(false); $this->RecordAttChange('archive_flag', false, true); utils::PopArchiveMode(); @@ -509,8 +494,7 @@ abstract class CMDBObject extends DBObject $bOriginal = $this->Get('archive_flag'); parent::DBUnarchive(); - if ($bOriginal) - { + if ($bOriginal) { utils::PushArchiveMode(false); $this->RecordAttChange('archive_flag', true, false); utils::PopArchiveMode(); @@ -518,8 +502,6 @@ abstract class CMDBObject extends DBObject } } - - /** * TODO: investigate how to get rid of this class that was made to workaround some language limitation... or a poor design! * @@ -535,7 +517,7 @@ class CMDBObjectSet extends DBObjectSet // just to get the right object class in return. // I have to think again to those things: maybe it will work fine if a have a constructor define here (?) - static public function FromScratch($sClass) + public static function FromScratch($sClass) { $oFilter = new DBObjectSearch($sClass); $oFilter->AddConditionExpression(new FalseExpression()); @@ -547,14 +529,14 @@ class CMDBObjectSet extends DBObjectSet // create an object set ex nihilo // input = array of objects - static public function FromArray($sClass, $aObjects) + public static function FromArray($sClass, $aObjects) { $oRetSet = self::FromScratch($sClass); $oRetSet->AddObjectArray($aObjects, $sClass); return $oRetSet; } - static public function FromArrayAssoc($aClasses, $aObjects) + public static function FromArrayAssoc($aClasses, $aObjects) { // In a perfect world, we should create a complete tree of DBObjectSearch, // but as we lack most of the information related to the objects, @@ -566,8 +548,7 @@ class CMDBObjectSet extends DBObjectSet $oRetSet = new CMDBObjectSet($oFilter); $oRetSet->m_bLoaded = true; // no DB load - foreach($aObjects as $rowIndex => $aObjectsByClassAlias) - { + foreach ($aObjects as $rowIndex => $aObjectsByClassAlias) { $oRetSet->AddObjectExtended($aObjectsByClassAlias); } return $oRetSet; diff --git a/core/cmdbsource.class.inc.php b/core/cmdbsource.class.inc.php index 39817aa85..c911d766e 100644 --- a/core/cmdbsource.class.inc.php +++ b/core/cmdbsource.class.inc.php @@ -1,4 +1,5 @@ - /** * DB Server abstraction * @@ -29,7 +29,6 @@ use Combodo\iTop\Core\DbConnectionWrapper; require_once('MyHelpers.class.inc.php'); require_once(APPROOT.'core/kpi.class.inc.php'); - /** * CMDBSource * database access wrapper @@ -38,26 +37,26 @@ require_once(APPROOT.'core/kpi.class.inc.php'); */ class CMDBSource { - const ENUM_DB_VENDOR_MYSQL = 'MySQL'; - const ENUM_DB_VENDOR_MARIADB = 'MariaDB'; - const ENUM_DB_VENDOR_PERCONA = 'Percona'; + public const ENUM_DB_VENDOR_MYSQL = 'MySQL'; + public const ENUM_DB_VENDOR_MARIADB = 'MariaDB'; + public const ENUM_DB_VENDOR_PERCONA = 'Percona'; /** * @since 2.7.10 3.0.4 3.1.2 3.0.2 N°6889 constant creation * @internal will be removed in a future version */ - const MYSQL_DEFAULT_PORT = 3306; + public const MYSQL_DEFAULT_PORT = 3306; /** * Error: 1205 SQLSTATE: HY000 (ER_LOCK_WAIT_TIMEOUT) * Message: Lock wait timeout exceeded; try restarting transaction */ - const MYSQL_ERRNO_WAIT_TIMEOUT = 1205; + public const MYSQL_ERRNO_WAIT_TIMEOUT = 1205; /** * Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK) * Message: Deadlock found when trying to get lock; try restarting transaction */ - const MYSQL_ERRNO_DEADLOCK = 1213; + public const MYSQL_ERRNO_DEADLOCK = 1213; protected static $m_sDBHost; protected static $m_sDBUser; @@ -128,9 +127,13 @@ class CMDBSource * @throws \MySQLException */ public static function Init( - $sServer, $sUser, $sPwd, $sSource = '', $bTlsEnabled = false, $sTlsCA = null - ) - { + $sServer, + $sUser, + $sPwd, + $sSource = '', + $bTlsEnabled = false, + $sTlsCA = null + ) { self::$m_sDBHost = $sServer; self::$m_sDBUser = $sUser; self::$m_sDBPwd = $sPwd; @@ -157,7 +160,13 @@ class CMDBSource * @uses IsOpenedDbConnectionUsingTls when asking for a TLS connection, to check if it was really opened using TLS */ public static function GetMysqliInstance( - $sDbHost, $sUser, $sPwd, $sSource = '', $bTlsEnabled = false, $sTlsCa = null, $bCheckTlsAfterConnection = false + $sDbHost, + $sUser, + $sPwd, + $sSource = '', + $bTlsEnabled = false, + $sTlsCa = null, + $bCheckTlsAfterConnection = false ) { $sServer = null; $iPort = null; @@ -169,12 +178,10 @@ class CMDBSource // but some other errors will still cause the query() method to return false !!! mysqli_report(MYSQLI_REPORT_STRICT); - try - { + try { $oMysqli = new mysqli(); - if ($bTlsEnabled) - { + if ($bTlsEnabled) { $iFlags = (empty($sTlsCa)) ? MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT : MYSQLI_CLIENT_SSL; @@ -184,31 +191,31 @@ class CMDBSource $oMysqli->ssl_set($bTlsEnabled, $sTlsCert, $sTlsCa, $sTlsCaPath, $sTlsCipher); } $oMysqli->real_connect($sServer, $sUser, $sPwd, '', $iPort, ini_get("mysqli.default_socket"), $iFlags); - } - catch(mysqli_sql_exception $e) - { - throw new MySQLException('Could not connect to the DB server', array('host' => $sServer, 'user' => $sUser),$e); + } catch (mysqli_sql_exception $e) { + throw new MySQLException('Could not connect to the DB server', ['host' => $sServer, 'user' => $sUser], $e); } if ($bTlsEnabled && $bCheckTlsAfterConnection - && !self::IsOpenedDbConnectionUsingTls($oMysqli)) - { - throw new MySQLException("Connection to the database is not encrypted whereas it was opened using TLS parameters", - null, null, $oMysqli); + && !self::IsOpenedDbConnectionUsingTls($oMysqli)) { + throw new MySQLException( + "Connection to the database is not encrypted whereas it was opened using TLS parameters", + null, + null, + $oMysqli + ); } - if (!empty($sSource)) - { - try - { + if (!empty($sSource)) { + try { mysqli_report(MYSQLI_REPORT_STRICT); // Errors, in the next query, will throw mysqli_sql_exception $oMysqli->query("USE `$sSource`"); - } - catch(mysqli_sql_exception $e) - { - throw new MySQLException('Could not select DB', - array('host' => $sServer, 'user' => $sUser, 'db_name' => $sSource), $e); + } catch (mysqli_sql_exception $e) { + throw new MySQLException( + 'Could not select DB', + ['host' => $sServer, 'user' => $sUser, 'db_name' => $sSource], + $e + ); } } @@ -229,23 +236,17 @@ class CMDBSource $aConnectInfo = explode(':', $sDbHost); $bUsePersistentConnection = false; - if (strcasecmp($aConnectInfo[0], 'p') === 0) - { + if (strcasecmp($aConnectInfo[0], 'p') === 0) { $bUsePersistentConnection = true; $sServer = $aConnectInfo[0].':'.$aConnectInfo[1]; - } - else - { + } else { $sServer = $aConnectInfo[0]; } $iConnectInfoCount = count($aConnectInfo); - if ($bUsePersistentConnection && ($iConnectInfoCount == 3)) - { + if ($bUsePersistentConnection && ($iConnectInfoCount == 3)) { $iPort = (int)($aConnectInfo[2]); - } - else if (!$bUsePersistentConnection && ($iConnectInfoCount == 2)) - { + } elseif (!$bUsePersistentConnection && ($iConnectInfoCount == 2)) { $iPort = (int)($aConnectInfo[1]); } } @@ -287,12 +288,9 @@ class CMDBSource */ private static function IsMySqlVarNonEmpty($sVarName, $oMysqli) { - try - { + try { $sResult = self::QueryToScalar("SHOW SESSION STATUS LIKE '$sVarName'", 1, $oMysqli); - } - catch (MySQLQueryHasNoResultException $e) - { + } catch (MySQLQueryHasNoResultException $e) { $sResult = null; } @@ -301,14 +299,10 @@ class CMDBSource public static function SetCharacterSet($sCharset = DEFAULT_CHARACTER_SET, $sCollation = DEFAULT_COLLATION) { - if (strlen($sCharset) > 0) - { - if (strlen($sCollation) > 0) - { + if (strlen($sCharset) > 0) { + if (strlen($sCollation) > 0) { self::Query("SET NAMES '$sCharset' COLLATE '$sCollation'"); - } - else - { + } else { self::Query("SET NAMES '$sCharset'"); } } @@ -318,8 +312,7 @@ class CMDBSource { // Note: requires the installation of MySQL special tables, // otherwise, only 'SYSTEM' or "+10:00' may be specified which is NOT sufficient because of day light saving times - if (!is_null($sTimezone)) - { + if (!is_null($sTimezone)) { $sQuotedTimezone = self::Quote($sTimezone); self::Query("SET time_zone = $sQuotedTimezone"); } @@ -334,18 +327,16 @@ class CMDBSource public static function IsDB($sSource) { - try - { + try { $aDBs = self::ListDB(); - foreach($aDBs as $sDBName) - { - // perform a case insensitive test because on Windows the table names become lowercase :-( - if (strtolower($sDBName) == strtolower($sSource)) return true; + foreach ($aDBs as $sDBName) { + // perform a case insensitive test because on Windows the table names become lowercase :-( + if (strtolower($sDBName) == strtolower($sSource)) { + return true; + } } return false; - } - catch(Exception $e) - { + } catch (Exception $e) { // In case we don't have rights to enumerate the databases // Let's try to connect directly /** @noinspection NullPointerExceptionInspection this shouldn't be called with un-init DB */ @@ -386,13 +377,10 @@ class CMDBSource { $sDBVendor = static::ENUM_DB_VENDOR_MYSQL; - $sVersionComment = static::GetServerVariable('version') . ' - ' . static::GetServerVariable('version_comment'); - if(preg_match('/mariadb/i', $sVersionComment) === 1) - { + $sVersionComment = static::GetServerVariable('version').' - '.static::GetServerVariable('version_comment'); + if (preg_match('/mariadb/i', $sVersionComment) === 1) { $sDBVendor = static::ENUM_DB_VENDOR_MARIADB; - } - else if(preg_match('/percona/i', $sVersionComment) === 1) - { + } elseif (preg_match('/percona/i', $sVersionComment) === 1) { $sDBVendor = static::ENUM_DB_VENDOR_PERCONA; } @@ -408,7 +396,7 @@ class CMDBSource { /** @noinspection NullPointerExceptionInspection this shouldn't be called with un-init DB */ if (!((bool)DbConnectionWrapper::GetDbConnection(true)->query("USE `$sSource`"))) { - throw new MySQLException('Could not select DB', array('db_name' => $sSource)); + throw new MySQLException('Could not select DB', ['db_name' => $sSource]); } self::$m_sDBName = $sSource; } @@ -427,13 +415,11 @@ class CMDBSource public static function DropDB($sDBToDrop = '') { - if (empty($sDBToDrop)) - { + if (empty($sDBToDrop)) { $sDBToDrop = self::$m_sDBName; } self::Query("DROP DATABASE `$sDBToDrop`"); - if ($sDBToDrop == self::$m_sDBName) - { + if ($sDBToDrop == self::$m_sDBName) { self::$m_sDBName = ''; } self::_TablesInfoCacheReset(); // reset the table info cache! @@ -486,10 +472,22 @@ class CMDBSource } } - public static function DBHost() {return self::$m_sDBHost;} - public static function DBUser() {return self::$m_sDBUser;} - public static function DBPwd() {return self::$m_sDBPwd;} - public static function DBName() {return self::$m_sDBName;} + public static function DBHost() + { + return self::$m_sDBHost; + } + public static function DBUser() + { + return self::$m_sDBUser; + } + public static function DBPwd() + { + return self::$m_sDBPwd; + } + public static function DBName() + { + return self::$m_sDBName; + } /** * Quote variable and protect against SQL injection attacks @@ -504,24 +502,20 @@ class CMDBSource */ public static function Quote($value, $bAlways = false, $cQuoteStyle = "'") { - if (is_null($value)) - { + if (is_null($value)) { return 'NULL'; } - if (is_array($value)) - { - $aRes = array(); - foreach ($value as $key => $itemvalue) - { + if (is_array($value)) { + $aRes = []; + foreach ($value as $key => $itemvalue) { $aRes[$key] = self::Quote($itemvalue, $bAlways, $cQuoteStyle); } return $aRes; } // Quote if not a number or a numeric string - if ($bAlways || is_string($value)) - { + if ($bAlways || is_string($value)) { /** @noinspection NullPointerExceptionInspection this shouldn't be called with un-init DB */ $value = $cQuoteStyle.DbConnectionWrapper::GetDbConnection()->real_escape_string($value).$cQuoteStyle; } @@ -538,8 +532,7 @@ class CMDBSource */ private static function RemoveSurroundingQuotes($sValue) { - if (utils::StartsWith($sValue, '\'') && utils::EndsWith($sValue, '\'')) - { + if (utils::StartsWith($sValue, '\'') && utils::EndsWith($sValue, '\'')) { $sValue = substr($sValue, 1, -1); } @@ -549,34 +542,30 @@ class CMDBSource /** * @param string $sSQLQuery * - * @return mysqli_result|null - * @throws MySQLException - * @throws MySQLHasGoneAwayException + * @return mysqli_result|null + * @throws MySQLException + * @throws MySQLHasGoneAwayException * * @since 2.7.0 N°679 handles nested transactions */ public static function Query($sSQLQuery) { - if (preg_match('/^START TRANSACTION;?$/i', $sSQLQuery)) - { + if (preg_match('/^START TRANSACTION;?$/i', $sSQLQuery)) { self::StartTransaction(); return null; } - if (preg_match('/^COMMIT;?$/i', $sSQLQuery)) - { + if (preg_match('/^COMMIT;?$/i', $sSQLQuery)) { self::Commit(); return null; } - if (preg_match('/^ROLLBACK;?$/i', $sSQLQuery)) - { + if (preg_match('/^ROLLBACK;?$/i', $sSQLQuery)) { self::Rollback(); return null; } - return self::DBQuery($sSQLQuery); } @@ -603,20 +592,17 @@ class CMDBSource } $oKPI = new ExecutionKPI(); - try - { + try { /** @noinspection NullPointerExceptionInspection this shouldn't be called with un-init DB */ $oResult = DbConnectionWrapper::GetDbConnection(true)->query($sSql); - } - catch (mysqli_sql_exception $e) - { + } catch (mysqli_sql_exception $e) { self::LogDeadLock($e, true); - throw new MySQLException('Failed to issue SQL query', array('query' => $sSql, $e)); + throw new MySQLException('Failed to issue SQL query', ['query' => $sSql, $e]); } finally { - $oKPI->ComputeStats('Query exec (mySQL)', $sSql); - } + $oKPI->ComputeStats('Query exec (mySQL)', $sSql); + } if ($oResult === false) { - $aContext = array('query' => $sSql); + $aContext = ['query' => $sSql]; $iMySqlErrorNo = DbConnectionWrapper::GetDbConnection(true)->errno; $aMySqlHasGoneAwayErrorCodes = MySQLHasGoneAwayException::getErrorCodes(); @@ -645,7 +631,7 @@ class CMDBSource // checks MySQL error code if ($bCheckMysqliErrno) { $iMySqlErrorNo = DbConnectionWrapper::GetDbConnection($bForQuery)->errno; - if (!in_array($iMySqlErrorNo, array(self::MYSQL_ERRNO_WAIT_TIMEOUT, self::MYSQL_ERRNO_DEADLOCK))) { + if (!in_array($iMySqlErrorNo, [self::MYSQL_ERRNO_WAIT_TIMEOUT, self::MYSQL_ERRNO_DEADLOCK])) { return; } } else { @@ -659,21 +645,19 @@ class CMDBSource if ($oError !== false) { $aData = $oError->fetch_all(MYSQLI_ASSOC); $sInnodbStatus = $aData[0]; - } - else - { + } else { $sInnodbStatus = 'Get status query cannot execute'; } // log ! $sMessage = "deadlock detected: user= $sUser; errno=$iMySqlErrorNo"; - $aLogContext = array( + $aLogContext = [ 'userinfo' => $sUser, 'errno' => $iMySqlErrorNo, 'ex_msg' => $e->getMessage(), 'callstack' => $e->getTraceAsString(), 'data' => $sInnodbStatus, - ); + ]; DeadLockLog::Info($sMessage, $iMySqlErrorNo, $aLogContext); IssueLog::Error($sMessage, LogChannels::DEADLOCK, [ @@ -695,7 +679,7 @@ class CMDBSource */ private static function StartTransaction() { - $aStackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT , 3); + $aStackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 3); $bHasExistingTransactions = self::IsInsideTransaction(); if (!$bHasExistingTransactions) { @@ -720,8 +704,8 @@ class CMDBSource */ private static function Commit() { - $aStackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT , 3); - if(isset($aStackTrace[2]['class']) && isset($aStackTrace[2]['function'])) { + $aStackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 3); + if (isset($aStackTrace[2]['class']) && isset($aStackTrace[2]['function'])) { $sCaller = 'From '.$aStackTrace[1]['file'].'('.$aStackTrace[1]['line'].'): '.$aStackTrace[2]['class'].'->'.$aStackTrace[2]['function'].'()'; } else { $sCaller = 'From '.$aStackTrace[1]['file'].'('.$aStackTrace[1]['line'].') '; @@ -758,8 +742,8 @@ class CMDBSource */ private static function Rollback() { - $aStackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT , 3); - if(isset($aStackTrace[2]['class']) && isset($aStackTrace[2]['function'])) { + $aStackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 3); + if (isset($aStackTrace[2]['class']) && isset($aStackTrace[2]['function'])) { $sCaller = 'From '.$aStackTrace[1]['file'].'('.$aStackTrace[1]['line'].'): '.$aStackTrace[2]['class'].'->'.$aStackTrace[2]['function'].'()'; } else { $sCaller = 'From '.$aStackTrace[1]['file'].'('.$aStackTrace[1]['line'].') '; @@ -808,8 +792,7 @@ class CMDBSource */ private static function RemoveLastTransactionLevel() { - if (self::$m_iTransactionLevel === 0) - { + if (self::$m_iTransactionLevel === 0) { return; } @@ -837,12 +820,10 @@ class CMDBSource return false; } - public static function GetInsertId() { $iRes = DbConnectionWrapper::GetDbConnection()->insert_id; - if (is_null($iRes)) - { + if (is_null($iRes)) { return 0; } return $iRes; @@ -850,8 +831,7 @@ class CMDBSource public static function InsertInto($sSQLQuery) { - if (self::Query($sSQLQuery)) - { + if (self::Query($sSQLQuery)) { return self::GetInsertId(); } return false; @@ -887,31 +867,26 @@ class CMDBSource try { /** @noinspection NullPointerExceptionInspection this shouldn't happen : either cnx is passed or the DB was init */ $oResult = $oMysqliForQuery->query($sSql); - } - catch (mysqli_sql_exception $e) { + } catch (mysqli_sql_exception $e) { $oKPI->ComputeStats('Query exec (mySQL)', $sSql); - throw new MySQLException('Failed to issue SQL query', array('query' => $sSql, $e)); + throw new MySQLException('Failed to issue SQL query', ['query' => $sSql, $e]); } $oKPI->ComputeStats('Query exec (mySQL)', $sSql); if ($oResult === false) { - throw new MySQLException('Failed to issue SQL query', array('query' => $sSql)); + throw new MySQLException('Failed to issue SQL query', ['query' => $sSql]); } - if ($aRow = $oResult->fetch_array(MYSQLI_BOTH)) - { + if ($aRow = $oResult->fetch_array(MYSQLI_BOTH)) { $res = $aRow[$iCol]; - } - else - { + } else { $oResult->free(); - throw new MySQLQueryHasNoResultException('Found no result for query', array('query' => $sSql)); + throw new MySQLQueryHasNoResultException('Found no result for query', ['query' => $sSql]); } $oResult->free(); return $res; } - /** * @param string $sSql * @param int $iMode @@ -921,26 +896,21 @@ class CMDBSource */ public static function QueryToArray($sSql, $iMode = MYSQLI_BOTH) { - $aData = array(); + $aData = []; $oKPI = new ExecutionKPI(); - try - { + try { /** @noinspection NullPointerExceptionInspection this shouldn't be called with un-init DB */ $oResult = DbConnectionWrapper::GetDbConnection(true)->query($sSql); - } - catch(mysqli_sql_exception $e) - { + } catch (mysqli_sql_exception $e) { $oKPI->ComputeStats('Query exec (mySQL)', $sSql); - throw new MySQLException('Failed to issue SQL query', array('query' => $sSql, $e)); + throw new MySQLException('Failed to issue SQL query', ['query' => $sSql, $e]); } $oKPI->ComputeStats('Query exec (mySQL)', $sSql); - if ($oResult === false) - { - throw new MySQLException('Failed to issue SQL query', array('query' => $sSql)); + if ($oResult === false) { + throw new MySQLException('Failed to issue SQL query', ['query' => $sSql]); } - while ($aRow = $oResult->fetch_array($iMode)) - { + while ($aRow = $oResult->fetch_array($iMode)) { $aData[] = $aRow; } $oResult->free(); @@ -956,10 +926,9 @@ class CMDBSource */ public static function QueryToCol($sSql, $col) { - $aColumn = array(); + $aColumn = []; $aData = self::QueryToArray($sSql); - foreach($aData as $aRow) - { + foreach ($aData as $aRow) { @$aColumn[] = $aRow[$col]; } return $aColumn; @@ -973,26 +942,21 @@ class CMDBSource */ public static function ExplainQuery($sSql) { - $aData = array(); - try - { + $aData = []; + try { /** @noinspection NullPointerExceptionInspection this shouldn't be called with un-init DB */ $oResult = DbConnectionWrapper::GetDbConnection(true)->query($sSql); + } catch (mysqli_sql_exception $e) { + throw new MySQLException('Failed to issue SQL query', ['query' => $sSql, $e]); } - catch(mysqli_sql_exception $e) - { - throw new MySQLException('Failed to issue SQL query', array('query' => $sSql, $e)); - } - if ($oResult === false) - { - throw new MySQLException('Failed to issue SQL query', array('query' => $sSql)); + if ($oResult === false) { + throw new MySQLException('Failed to issue SQL query', ['query' => $sSql]); } $aNames = self::GetColumns($oResult, $sSql); $aData[] = $aNames; - while ($aRow = $oResult->fetch_array(MYSQLI_ASSOC)) - { + while ($aRow = $oResult->fetch_array(MYSQLI_ASSOC)) { $aData[] = $aRow; } $oResult->free(); @@ -1007,22 +971,17 @@ class CMDBSource */ public static function TestQuery($sSql) { - try - { + try { /** @noinspection NullPointerExceptionInspection this shouldn't be called with un-init DB */ $oResult = DbConnectionWrapper::GetDbConnection(true)->query($sSql); + } catch (mysqli_sql_exception $e) { + throw new MySQLException('Failed to issue SQL query', ['query' => $sSql, $e]); } - catch(mysqli_sql_exception $e) - { - throw new MySQLException('Failed to issue SQL query', array('query' => $sSql, $e)); - } - if ($oResult === false) - { - throw new MySQLException('Failed to issue SQL query', array('query' => $sSql)); + if ($oResult === false) { + throw new MySQLException('Failed to issue SQL query', ['query' => $sSql]); } - if (is_object($oResult)) - { + if (is_object($oResult)) { $oResult->free(); } return ''; @@ -1052,16 +1011,12 @@ class CMDBSource */ public static function GetColumns($oResult, $sSql) { - $aNames = array(); - for ($i = 0; $i < (($___mysqli_tmp = $oResult->field_count) ? $___mysqli_tmp : 0) ; $i++) - { + $aNames = []; + for ($i = 0; $i < (($___mysqli_tmp = $oResult->field_count) ? $___mysqli_tmp : 0) ; $i++) { $meta = $oResult->fetch_field_direct($i); - if (!$meta) - { - throw new MySQLException('mysql_fetch_field: No information available', array('query'=>$sSql, 'i'=>$i)); - } - else - { + if (!$meta) { + throw new MySQLException('mysql_fetch_field: No information available', ['query' => $sSql, 'i' => $i]); + } else { $aNames[] = $meta->name; } } @@ -1088,20 +1043,32 @@ class CMDBSource public static function IsKey($sTable, $iKey) { $aTableInfo = self::GetTableInfo($sTable); - if (empty($aTableInfo)) return false; - if (!array_key_exists($iKey, $aTableInfo["Fields"])) return false; + if (empty($aTableInfo)) { + return false; + } + if (!array_key_exists($iKey, $aTableInfo["Fields"])) { + return false; + } $aFieldData = $aTableInfo["Fields"][$iKey]; - if (!array_key_exists("Key", $aFieldData)) return false; + if (!array_key_exists("Key", $aFieldData)) { + return false; + } return ($aFieldData["Key"] == "PRI"); } public static function IsAutoIncrement($sTable, $sField) { $aTableInfo = self::GetTableInfo($sTable); - if (empty($aTableInfo)) return false; - if (!array_key_exists($sField, $aTableInfo["Fields"])) return false; + if (empty($aTableInfo)) { + return false; + } + if (!array_key_exists($sField, $aTableInfo["Fields"])) { + return false; + } $aFieldData = $aTableInfo["Fields"][$sField]; - if (!array_key_exists("Extra", $aFieldData)) return false; + if (!array_key_exists("Extra", $aFieldData)) { + return false; + } //MyHelpers::debug_breakpoint($aFieldData); return (strstr($aFieldData["Extra"], "auto_increment")); } @@ -1109,16 +1076,24 @@ class CMDBSource public static function IsField($sTable, $sField) { $aTableInfo = self::GetTableInfo($sTable); - if (empty($aTableInfo)) return false; - if (!array_key_exists($sField, $aTableInfo["Fields"])) return false; + if (empty($aTableInfo)) { + return false; + } + if (!array_key_exists($sField, $aTableInfo["Fields"])) { + return false; + } return true; } public static function IsNullAllowed($sTable, $sField) { $aTableInfo = self::GetTableInfo($sTable); - if (empty($aTableInfo)) return false; - if (!array_key_exists($sField, $aTableInfo["Fields"])) return false; + if (empty($aTableInfo)) { + return false; + } + if (!array_key_exists($sField, $aTableInfo["Fields"])) { + return false; + } $aFieldData = $aTableInfo["Fields"][$sField]; return (strtolower($aFieldData["Null"]) == "yes"); } @@ -1126,20 +1101,22 @@ class CMDBSource public static function GetFieldType($sTable, $sField) { $aTableInfo = self::GetTableInfo($sTable); - if (empty($aTableInfo)) return false; - if (!array_key_exists($sField, $aTableInfo["Fields"])) return false; + if (empty($aTableInfo)) { + return false; + } + if (!array_key_exists($sField, $aTableInfo["Fields"])) { + return false; + } $aFieldData = $aTableInfo["Fields"][$sField]; return ($aFieldData["Type"]); } private static function IsNumericType($aFieldData) { - $aNumericTypes = array('tinyint(', 'decimal(', 'int(' ); + $aNumericTypes = ['tinyint(', 'decimal(', 'int(' ]; $sType = strtolower($aFieldData["Type"]); - foreach ($aNumericTypes as $sNumericType) - { - if (strpos($sType, $sNumericType) === 0) - { + foreach ($aNumericTypes as $sNumericType) { + if (strpos($sType, $sNumericType) === 0) { return true; } } @@ -1172,21 +1149,18 @@ class CMDBSource [$sItopFieldDataType, $sItopFieldTypeOptions, $sItopFieldOtherOptions] = static::GetFieldDataTypeAndOptions($sItopGeneratedFieldType); [$sDbFieldDataType, $sDbFieldTypeOptions, $sDbFieldOtherOptions] = static::GetFieldDataTypeAndOptions($sDbFieldType); - if (strcasecmp($sItopFieldDataType, $sDbFieldDataType) !== 0) - { + if (strcasecmp($sItopFieldDataType, $sDbFieldDataType) !== 0) { return false; } - if (strcmp($sItopFieldTypeOptions, $sDbFieldTypeOptions) !== 0) - { + if (strcmp($sItopFieldTypeOptions, $sDbFieldTypeOptions) !== 0) { // case sensitive comp as we need to check case for enum possible values for example return false; } // remove the default value NULL added by MariadDB $sMariaDbDefaultNull = ' DEFAULT \'NULL\''; - if (utils::EndsWith($sDbFieldOtherOptions, $sMariaDbDefaultNull)) - { + if (utils::EndsWith($sDbFieldOtherOptions, $sMariaDbDefaultNull)) { $sDbFieldOtherOptions = substr($sDbFieldOtherOptions, 0, -strlen($sMariaDbDefaultNull)); } // remove quotes around default values (always present in MariaDB) @@ -1194,17 +1168,16 @@ class CMDBSource '/( DEFAULT )\'([^\']+)\'/', function ($aMatches) use ($sItopFieldDataType) { // ENUM default values should keep quotes, but all other numeric values don't have quotes - if (is_numeric($aMatches[2]) && ($sItopFieldDataType !== 'ENUM')) - { + if (is_numeric($aMatches[2]) && ($sItopFieldDataType !== 'ENUM')) { return $aMatches[1].$aMatches[2]; } return $aMatches[0]; }, - $sDbFieldOtherOptions); + $sDbFieldOtherOptions + ); - if (strcasecmp($sItopFieldOtherOptions, $sDbFieldOtherOptions) !== 0) - { + if (strcasecmp($sItopFieldOtherOptions, $sDbFieldOtherOptions) !== 0) { return false; } @@ -1229,10 +1202,10 @@ class CMDBSource $sDataType = isset($aMatches[1]) ? $aMatches[1] : ''; - if (strcasecmp($sDataType, 'ENUM') === 0){ - try{ + if (strcasecmp($sDataType, 'ENUM') === 0) { + try { return self::GetEnumOptions($sDataType, $sCompleteFieldType); - }catch(CoreException $e){ + } catch (CoreException $e) { //do nothing ; especially do not block setup. IssueLog::Warning("enum was not parsed properly: $sCompleteFieldType. it should not happen during setup."); } @@ -1241,7 +1214,7 @@ class CMDBSource $sTypeOptions = isset($aMatches[2]) ? $aMatches[3] : ''; $sOtherOptions = isset($aMatches[4]) ? $aMatches[4] : ''; - return array($sDataType, $sTypeOptions, $sOtherOptions); + return [$sDataType, $sTypeOptions, $sOtherOptions]; } /** @@ -1262,16 +1235,16 @@ class CMDBSource $iFirstOpeningParenthesis = strpos($sCompleteFieldType, '('); $iLastEndingParenthesis = strrpos($sCompleteFieldType, ')'); - if ($iFirstOpeningParenthesis === false || $iLastEndingParenthesis === false ){ + if ($iFirstOpeningParenthesis === false || $iLastEndingParenthesis === false) { //should never happen as GetFieldDataTypeAndOptions regexp matched. //except if regexp is modiied/broken somehow one day... - throw new CoreException("GetEnumOptions issue with $sDataType parsing : " . $sCompleteFieldType); + throw new CoreException("GetEnumOptions issue with $sDataType parsing : ".$sCompleteFieldType); } $sTypeOptions = substr($sCompleteFieldType, $iFirstOpeningParenthesis + 1, $iLastEndingParenthesis - 1); $sOtherOptions = substr($sCompleteFieldType, $iLastEndingParenthesis + 1); - return array($sDataType, $sTypeOptions, $sOtherOptions); + return [$sDataType, $sTypeOptions, $sOtherOptions]; } /** @@ -1284,47 +1257,40 @@ class CMDBSource public static function GetFieldSpec($sTable, $sField) { $aTableInfo = self::GetTableInfo($sTable); - if (empty($aTableInfo)) return false; - if (!array_key_exists($sField, $aTableInfo["Fields"])) return false; + if (empty($aTableInfo)) { + return false; + } + if (!array_key_exists($sField, $aTableInfo["Fields"])) { + return false; + } $aFieldData = $aTableInfo["Fields"][$sField]; $sRet = $aFieldData["Type"]; $sColumnCharset = $aFieldData["Charset"]; $sColumnCollation = $aFieldData["Collation"]; - if (!empty($sColumnCharset)) - { + if (!empty($sColumnCharset)) { $sRet .= ' CHARACTER SET '.$sColumnCharset; $sRet .= ' COLLATE '.$sColumnCollation; } - if ($aFieldData["Null"] == 'NO') - { + if ($aFieldData["Null"] == 'NO') { $sRet .= ' NOT NULL'; } - if (is_numeric($aFieldData["Default"])) - { - if (strtolower(substr($aFieldData["Type"], 0, 5)) == 'enum(') - { + if (is_numeric($aFieldData["Default"])) { + if (strtolower(substr($aFieldData["Type"], 0, 5)) == 'enum(') { // Force quotes to match the column declaration statement $sRet .= ' DEFAULT '.self::Quote($aFieldData["Default"], true); - } - else - { - if (self::IsNumericType($aFieldData)) - { + } else { + if (self::IsNumericType($aFieldData)) { $sRet .= ' DEFAULT '.$aFieldData["Default"]; - } - else - { + } else { $default = $aFieldData["Default"] + 0; // Coerce to a numeric variable $sRet .= ' DEFAULT '.self::Quote($default); } } - } - elseif (is_string($aFieldData["Default"]) == 'string') - { + } elseif (is_string($aFieldData["Default"]) == 'string') { $sDefaultValue = static::RemoveSurroundingQuotes($aFieldData["Default"]); $sRet .= ' DEFAULT '.self::Quote($sDefaultValue); } @@ -1335,28 +1301,29 @@ class CMDBSource public static function HasIndex($sTable, $sIndexId, $aFields = null, $aLength = null) { $aTableInfo = self::GetTableInfo($sTable); - if (empty($aTableInfo)) return false; - if (!array_key_exists($sIndexId, $aTableInfo['Indexes'])) return false; + if (empty($aTableInfo)) { + return false; + } + if (!array_key_exists($sIndexId, $aTableInfo['Indexes'])) { + return false; + } - if ($aFields == null) - { + if ($aFields == null) { // Just searching for the name return true; } // Compare the columns $sSearchedIndex = implode(',', $aFields); - $aColumnNames = array(); - $aSubParts = array(); - foreach($aTableInfo['Indexes'][$sIndexId] as $aIndexDef) - { + $aColumnNames = []; + $aSubParts = []; + foreach ($aTableInfo['Indexes'][$sIndexId] as $aIndexDef) { $aColumnNames[] = $aIndexDef['Column_name']; $aSubParts[] = $aIndexDef['Sub_part']; } $sExistingIndex = implode(',', $aColumnNames); - if (is_null($aLength)) - { + if (is_null($aLength)) { return ($sSearchedIndex == $sExistingIndex); } @@ -1372,21 +1339,20 @@ class CMDBSource assert(!empty($sTable)); $aTableInfo = self::GetTableInfo($sTable); - if (empty($aTableInfo)) return array(); // #@# or an error ? + if (empty($aTableInfo)) { + return []; + } // #@# or an error ? return array_keys($aTableInfo["Fields"]); } // Cache the information about existing tables, and their fields - private static $m_aTablesInfo = array(); + private static $m_aTablesInfo = []; private static function _TablesInfoCacheReset($sTableName = null) { - if (is_null($sTableName)) - { - self::$m_aTablesInfo = array(); - } - else - { + if (is_null($sTableName)) { + self::$m_aTablesInfo = []; + } else { self::$m_aTablesInfo[strtolower($sTableName)] = null; } } @@ -1399,8 +1365,7 @@ class CMDBSource private static function _TableInfoCacheInit($sTableName) { if (isset(self::$m_aTablesInfo[strtolower($sTableName)]) - && (self::$m_aTablesInfo[strtolower($sTableName)] != null)) - { + && (self::$m_aTablesInfo[strtolower($sTableName)] != null)) { return; } @@ -1410,7 +1375,7 @@ class CMDBSource // Get table informations // We were using SHOW COLUMNS FROM... but this don't return charset and collation info ! // so since 2.5 and #1001 (switch to utf8mb4) we're using INFORMATION_SCHEMA ! - $aMapping = array( + $aMapping = [ "Name" => "COLUMN_NAME", "Type" => "COLUMN_TYPE", "Null" => "IS_NULLABLE", @@ -1420,28 +1385,24 @@ class CMDBSource "Charset" => "CHARACTER_SET_NAME", "Collation" => "COLLATION_NAME", "CharMaxLength" => "CHARACTER_MAXIMUM_LENGTH", - ); + ]; $sColumns = implode(', ', $aMapping); $sDBName = self::$m_sDBName; $aFields = self::QueryToArray("SELECT $sColumns FROM information_schema.`COLUMNS` WHERE table_schema = '$sDBName' AND table_name = '$sTableName';"); - foreach ($aFields as $aFieldData) - { - $aFields = array(); - foreach($aMapping as $sKey => $sColumn) - { + foreach ($aFields as $aFieldData) { + $aFields = []; + foreach ($aMapping as $sKey => $sColumn) { $aFields[$sKey] = $aFieldData[$sColumn]; } $sFieldName = $aFieldData["COLUMN_NAME"]; self::$m_aTablesInfo[strtolower($sTableName)]["Fields"][$sFieldName] = $aFields; } - if (!is_null(self::$m_aTablesInfo[strtolower($sTableName)])) - { + if (!is_null(self::$m_aTablesInfo[strtolower($sTableName)])) { $aIndexes = self::QueryToArray("SHOW INDEXES FROM `$sTableName`"); - $aMyIndexes = array(); - foreach ($aIndexes as $aIndexColumn) - { - $aMyIndexes[$aIndexColumn['Key_name']][$aIndexColumn['Seq_in_index']-1] = $aIndexColumn; + $aMyIndexes = []; + foreach ($aIndexes as $aIndexColumn) { + $aMyIndexes[$aIndexColumn['Key_name']][$aIndexColumn['Seq_in_index'] - 1] = $aIndexColumn; } self::$m_aTablesInfo[strtolower($sTableName)]["Indexes"] = $aMyIndexes; } @@ -1477,12 +1438,10 @@ class CMDBSource $sTableCharset = $aTableInfo[0]['CHARACTER_SET_NAME']; $sTableCollation = $aTableInfo[0]['TABLE_COLLATION']; - if ((DEFAULT_CHARACTER_SET == $sTableCharset) && (DEFAULT_COLLATION == $sTableCollation)) - { + if ((DEFAULT_CHARACTER_SET == $sTableCharset) && (DEFAULT_COLLATION == $sTableCollation)) { return null; } - return 'ALTER TABLE `'.$sTableName.'` '.self::GetSqlStringColumnDefinition().';'; } @@ -1496,23 +1455,18 @@ class CMDBSource public static function DumpTable($sTable) { $sSql = "SELECT * FROM `$sTable`"; - try - { + try { /** @noinspection NullPointerExceptionInspection this shouldn't be called with un-init DB */ $oResult = DbConnectionWrapper::GetDbConnection(true)->query($sSql); + } catch (mysqli_sql_exception $e) { + throw new MySQLException('Failed to issue SQL query', ['query' => $sSql], $e); } - catch(mysqli_sql_exception $e) - { - throw new MySQLException('Failed to issue SQL query', array('query' => $sSql), $e); - } - if ($oResult === false) - { - throw new MySQLException('Failed to issue SQL query', array('query' => $sSql)); + if ($oResult === false) { + throw new MySQLException('Failed to issue SQL query', ['query' => $sSql]); } - $aRows = array(); - while ($aRow = $oResult->fetch_array(MYSQLI_ASSOC)) - { + $aRows = []; + while ($aRow = $oResult->fetch_array(MYSQLI_ASSOC)) { $aRows[] = $aRow; } $oResult->free(); @@ -1537,19 +1491,15 @@ class CMDBSource */ public static function GetRawPrivileges() { - try - { + try { $oResult = self::Query('SHOW GRANTS'); // [ FOR CURRENT_USER()] - } - catch(MySQLException $e) - { + } catch (MySQLException $e) { $iCode = self::GetErrNo(); return "Current user not allowed to see his own privileges (could not access to the database 'mysql' - $iCode)"; } - $aRes = array(); - while ($aRow = $oResult->fetch_array(MYSQLI_NUM)) - { + $aRes = []; + while ($aRow = $oResult->fetch_array(MYSQLI_NUM)) { // so far, only one column... $aRes[] = implode('/', $aRow); } @@ -1564,17 +1514,13 @@ class CMDBSource */ public static function IsSlaveServer() { - try - { + try { $oResult = self::Query('SHOW SLAVE STATUS'); - } - catch(MySQLException $e) - { - throw new CoreException("Current user not allowed to check the status", array('mysql_error' => $e->getMessage())); + } catch (MySQLException $e) { + throw new CoreException("Current user not allowed to check the status", ['mysql_error' => $e->getMessage()]); } - if ($oResult->num_rows == 0) - { + if ($oResult->num_rows == 0) { return false; } @@ -1582,40 +1528,35 @@ class CMDBSource $aRow = $oResult->fetch_array(MYSQLI_ASSOC); $oResult->free(); - if (!isset($aRow['Slave_IO_Running'])) - { + if (!isset($aRow['Slave_IO_Running'])) { return false; } - if (!isset($aRow['Slave_SQL_Running'])) - { + if (!isset($aRow['Slave_SQL_Running'])) { return false; } // If at least one slave thread is running, then we consider that the slave is enabled - if ($aRow['Slave_IO_Running'] == 'Yes') - { + if ($aRow['Slave_IO_Running'] == 'Yes') { return true; } - if ($aRow['Slave_SQL_Running'] == 'Yes') - { + if ($aRow['Slave_SQL_Running'] == 'Yes') { return true; } return false; } - public static function GetClusterNb() - { - $result = 0; - $sSql = "SHOW STATUS LIKE 'wsrep_cluster_size';"; - $aRows = self::QueryToArray($sSql); - if (count($aRows) > 0) - { - $result = $aRows[0]['Value']; - } - return intval($result); - } + public static function GetClusterNb() + { + $result = 0; + $sSql = "SHOW STATUS LIKE 'wsrep_cluster_size';"; + $aRows = self::QueryToArray($sSql); + if (count($aRows) > 0) { + $result = $aRows[0]['Value']; + } + return intval($result); + } - /** + /** * @see https://dev.mysql.com/doc/refman/5.7/en/charset-database.html * @return string query to upgrade database charset and collation if needed, null if not * @throws \MySQLException @@ -1631,8 +1572,7 @@ class CMDBSource $sDBCharset = $aDBInfo[0]['DEFAULT_CHARACTER_SET_NAME']; $sDBCollation = $aDBInfo[0]['DEFAULT_COLLATION_NAME']; - if ((DEFAULT_CHARACTER_SET == $sDBCharset) && (DEFAULT_COLLATION == $sDBCollation)) - { + if ((DEFAULT_CHARACTER_SET == $sDBCharset) && (DEFAULT_COLLATION == $sDBCollation)) { return null; } @@ -1649,8 +1589,7 @@ class CMDBSource */ public static function IsSslModeDBVersion() { - if (static::GetDBVendor() === static::ENUM_DB_VENDOR_MYSQL) - { + if (static::GetDBVendor() === static::ENUM_DB_VENDOR_MYSQL) { //Mysql 5.7.0 and upper deprecated --ssl and uses --ssl-mode instead return version_compare(static::GetDBVersion(), '5.7.11', '>='); } diff --git a/core/computing.inc.php b/core/computing.inc.php index f183e737c..88283492c 100644 --- a/core/computing.inc.php +++ b/core/computing.inc.php @@ -1,4 +1,5 @@ */ - /** * Any extension to compute things like a stop watch deadline or working hours * @@ -29,7 +29,7 @@ /** * Metric computing for stop watches. * Can be used for AttributeStopWatch goal (iTop XML node xpath: /itop_design/classes/class/fields/field/goal) - */ + */ interface iMetricComputer { public static function GetDescription(); @@ -44,7 +44,7 @@ interface iMetricComputer /** * Working time computing for stop watches - */ + */ interface iWorkingTimeComputer { public static function GetDescription(); @@ -58,7 +58,7 @@ interface iWorkingTimeComputer * considering only the valid (open) hours for a specified object */ public function GetDeadline($oObject, $iDuration, DateTime $oStartDate); - + /** * @param DBObject $oObject The object for which to compute the duration * @param DateTime $oStartDate The starting point for the computation (default = now) @@ -87,7 +87,7 @@ class DefaultMetricComputer implements iMetricComputer /** * Default implementation of working time computing - */ + */ class DefaultWorkingTimeComputer implements iWorkingTimeComputer { public static function GetDescription() @@ -100,8 +100,7 @@ class DefaultWorkingTimeComputer implements iWorkingTimeComputer */ public function GetDeadline($oObject, $iDuration, DateTime $oStartDate) { - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::Trace(WorkingTimeRecorder::TRACE_DEBUG, __class__.'::'.__function__); } //echo "GetDeadline - default: ".$oStartDate->format('Y-m-d H:i:s')." + $iDuration
      \n"; @@ -109,26 +108,23 @@ class DefaultWorkingTimeComputer implements iWorkingTimeComputer // the specified duration to the given date/time $oResult = clone $oStartDate; $oResult->modify($iDuration.' seconds'); - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::SetValues($oStartDate->format('U'), $oResult->format('U'), $iDuration, WorkingTimeRecorder::COMPUTED_END); } return $oResult; } - + /** * @inheritDoc */ public function GetOpenDuration($oObject, DateTime $oStartDate, DateTime $oEndDate) { - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::Trace(WorkingTimeRecorder::TRACE_DEBUG, __class__.'::'.__function__); } //echo "GetOpenDuration - default: ".$oStartDate->format('Y-m-d H:i:s')." to ".$oEndDate->format('Y-m-d H:i:s')."
      \n"; $iDuration = abs($oEndDate->format('U') - $oStartDate->format('U')); - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::SetValues($oStartDate->format('U'), $oEndDate->format('U'), $iDuration, WorkingTimeRecorder::COMPUTED_DURATION); } return $iDuration; diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 66545f161..cdc08ddf9 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -1,4 +1,5 @@ true, ], 'export_pdf_font' => [ // @since 2.7.0 PR #49 / N°1947 - 'type' => 'string', - 'description' => 'Font used when generating a PDF file', - 'default' => 'DejaVuSans', // DejaVuSans is a UTF-8 Unicode font, embedded in the TCPPDF lib we're using - // Standard PDF fonts like helvetica or times newroman are NOT Unicode - // A new DroidSansFallback can be used to improve CJK support (se PR #49) - 'value' => '', - 'source_of_value' => '', - 'show_in_conf_sample' => false, + 'type' => 'string', + 'description' => 'Font used when generating a PDF file', + 'default' => 'DejaVuSans', // DejaVuSans is a UTF-8 Unicode font, embedded in the TCPPDF lib we're using + // Standard PDF fonts like helvetica or times newroman are NOT Unicode + // A new DroidSansFallback can be used to improve CJK support (se PR #49) + 'value' => '', + 'source_of_value' => '', + 'show_in_conf_sample' => false, ], 'access_mode' => [ 'type' => 'integer', @@ -897,7 +896,7 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => false, ], - 'forgot_password.url' => [ + 'forgot_password.url' => [ 'type' => 'string', 'description' => 'Set this value to your "forgot password" service URL if it should be handled out of '.ITOP_APPLICATION_SHORT.'. Note that it will apply to all users (iTop users, LDAP users, ...)', 'default' => '', @@ -1843,8 +1842,7 @@ class Config $value = $this->oConfigPlaceholdersResolver->Resolve($value); - switch ($sType) - { + switch ($sType) { case 'bool': $value = (bool)$value; break; @@ -1852,7 +1850,7 @@ class Config $value = (string)$value; break; case 'integer': - $value = (integer)$value; + $value = (int)$value; break; case 'float': $value = (float)$value; @@ -1860,11 +1858,10 @@ class Config case 'array': break; default: - throw new CoreException('Unknown type for setting', array('property' => $sPropCode, 'type' => $sType)); + throw new CoreException('Unknown type for setting', ['property' => $sPropCode, 'type' => $sType]); } - if ($this->m_aSettings[$sPropCode]['value'] == $value) - { + if ($this->m_aSettings[$sPropCode]['value'] == $value) { //when you set the exact same value than the previous one, then, you still can preserve the non evaluated version and so on preserve vars/jokers. $bCanOverride = true; } @@ -2006,18 +2003,16 @@ class Config $this->oConfigPlaceholdersResolver = new ConfigPlaceholdersResolver(); $this->m_sFile = $sConfigFile; - if (is_null($sConfigFile)) - { + if (is_null($sConfigFile)) { $bLoadConfig = false; } - $this->m_aAddons = array( + $this->m_aAddons = [ // Default AddOn, always present can be moved to an official iTop Module later if needed 'user rights' => 'addons/userrights/userrightsprofile.class.inc.php', - ); + ]; - foreach ($this->m_aSettings as $sPropCode => $aSettingInfo) - { + foreach ($this->m_aSettings as $sPropCode => $aSettingInfo) { $this->m_aSettings[$sPropCode]['value'] = $aSettingInfo['default']; } @@ -2033,7 +2028,7 @@ class Config $this->m_sDefaultLanguage = 'EN US'; $this->m_sAllowedLoginTypes = DEFAULT_ALLOWED_LOGIN_TYPES; $this->m_sExtAuthVariable = DEFAULT_EXT_AUTH_VARIABLE; - $this->m_aCharsets = array(); + $this->m_aCharsets = []; $this->m_bQueryCacheEnabled = DEFAULT_QUERY_CACHE_ENABLED; $this->m_iPasswordHashAlgo = DEFAULT_HASH_ALGO; $this->m_sAppSecret = bin2hex(random_bytes(16)); @@ -2043,10 +2038,9 @@ class Config $this->m_sEncryptionLibrary = isset($aEncryptParams['lib']) ? $aEncryptParams['lib'] : DEFAULT_ENCRYPTION_LIB; $this->m_sEncryptionKey = isset($aEncryptParams['key']) ? $aEncryptParams['key'] : DEFAULT_ENCRYPTION_KEY; - $this->m_aModuleSettings = array(); + $this->m_aModuleSettings = []; - if ($bLoadConfig) - { + if ($bLoadConfig) { $this->Load($sConfigFile); $this->Verify(); } @@ -2075,14 +2069,14 @@ class Config */ protected function CheckFile($sPurpose, $sFileName) { - if (!file_exists($sFileName)) - { - throw new ConfigException("Could not find $sPurpose file", array('file' => $sFileName)); + if (!file_exists($sFileName)) { + throw new ConfigException("Could not find $sPurpose file", ['file' => $sFileName]); } - if (!is_readable($sFileName)) - { - throw new ConfigException("Could not read $sPurpose file (the file exists but cannot be read). Do you have the rights to access this file?", - array('file' => $sFileName)); + if (!is_readable($sFileName)) { + throw new ConfigException( + "Could not read $sPurpose file (the file exists but cannot be read). Do you have the rights to access this file?", + ['file' => $sFileName] + ); } } @@ -2109,70 +2103,65 @@ class Config // This does not work on several lines // preg_match('/^<\\?php(.*)\\?'.'>$/', $sConfigCode, $aMatches)... // So, I've implemented a solution suggested in the PHP doc (search for phpWrapper) - try - { + try { ob_start(); eval('?'.'>'.trim($sConfigCode)); $sNoise = trim(ob_get_contents()); ob_end_clean(); - } - catch (Error $e) - { + } catch (Error $e) { // PHP 7 - throw new ConfigException('Error in configuration file', - array('file' => $sConfigFile, 'error' => $e->getMessage().' at line '.$e->getLine())); - } - catch (Exception $e) - { + throw new ConfigException( + 'Error in configuration file', + ['file' => $sConfigFile, 'error' => $e->getMessage().' at line '.$e->getLine()] + ); + } catch (Exception $e) { // well, never reach in case of parsing error :-( // will be improved in PHP 6 ? - throw new ConfigException('Error in configuration file', - array('file' => $sConfigFile, 'error' => $e->getMessage())); + throw new ConfigException( + 'Error in configuration file', + ['file' => $sConfigFile, 'error' => $e->getMessage()] + ); } - if (strlen($sNoise) > 0) - { + if (strlen($sNoise) > 0) { // Note: sNoise is an html output, but so far it was ok for me (e.g. showing the entire call stack) - throw new ConfigException('Syntax error in configuration file', - array('file' => $sConfigFile, 'error' => ''.utils::EscapeHtml($sNoise, ENT_QUOTES).'')); + throw new ConfigException( + 'Syntax error in configuration file', + ['file' => $sConfigFile, 'error' => ''.utils::EscapeHtml($sNoise, ENT_QUOTES).''] + ); } - if (!isset($MySettings) || !is_array($MySettings)) - { - throw new ConfigException('Missing array in configuration file', - array('file' => $sConfigFile, 'expected' => '$MySettings')); + if (!isset($MySettings) || !is_array($MySettings)) { + throw new ConfigException( + 'Missing array in configuration file', + ['file' => $sConfigFile, 'expected' => '$MySettings'] + ); } - if (!array_key_exists('addons', $MyModules)) - { - throw new ConfigException('Missing item in configuration file', - array('file' => $sConfigFile, 'expected' => '$MyModules[\'addons\']')); + if (!array_key_exists('addons', $MyModules)) { + throw new ConfigException( + 'Missing item in configuration file', + ['file' => $sConfigFile, 'expected' => '$MyModules[\'addons\']'] + ); } - if (!array_key_exists('user rights', $MyModules['addons'])) - { + if (!array_key_exists('user rights', $MyModules['addons'])) { // Add one, by default $MyModules['addons']['user rights'] = '/addons/userrights/userrightsnull.class.inc.php'; } $this->m_aAddons = $MyModules['addons']; - foreach ($MySettings as $sPropCode => $rawvalue) - { - if ($this->IsProperty($sPropCode)) - { - if (is_string($rawvalue)) - { + foreach ($MySettings as $sPropCode => $rawvalue) { + if ($this->IsProperty($sPropCode)) { + if (is_string($rawvalue)) { $value = trim($rawvalue); - } - else - { + } else { $value = $rawvalue; } $this->Set($sPropCode, $value, $sConfigFile, true); } } - if (file_exists(READONLY_MODE_FILE)) - { + if (file_exists(READONLY_MODE_FILE)) { $this->Set('access_mode', ACCESS_READONLY, READONLY_MODE_FILE); } @@ -2188,14 +2177,14 @@ class Config $this->m_iFastReloadInterval = isset($MySettings['fast_reload_interval']) ? trim($MySettings['fast_reload_interval']) : DEFAULT_FAST_RELOAD_INTERVAL; $this->m_bSecureConnectionRequired = isset($MySettings['secure_connection_required']) ? (bool)trim($MySettings['secure_connection_required']) : DEFAULT_SECURE_CONNECTION_REQUIRED; - $this->m_aModuleSettings = isset($MyModuleSettings) ? $MyModuleSettings : array(); + $this->m_aModuleSettings = isset($MyModuleSettings) ? $MyModuleSettings : []; $this->m_sDefaultLanguage = isset($MySettings['default_language']) ? trim($MySettings['default_language']) : 'EN US'; $this->m_sAllowedLoginTypes = isset($MySettings['allowed_login_types']) ? trim($MySettings['allowed_login_types']) : DEFAULT_ALLOWED_LOGIN_TYPES; $this->m_sExtAuthVariable = isset($MySettings['ext_auth_variable']) ? trim($MySettings['ext_auth_variable']) : DEFAULT_EXT_AUTH_VARIABLE; $this->m_sEncryptionKey = isset($MySettings['encryption_key']) ? trim($MySettings['encryption_key']) : $this->m_sEncryptionKey; $this->m_sEncryptionLibrary = isset($MySettings['encryption_library']) ? trim($MySettings['encryption_library']) : $this->m_sEncryptionLibrary; - $this->m_aCharsets = isset($MySettings['csv_import_charsets']) ? $MySettings['csv_import_charsets'] : array(); + $this->m_aCharsets = isset($MySettings['csv_import_charsets']) ? $MySettings['csv_import_charsets'] : []; $this->m_iPasswordHashAlgo = isset($MySettings['password_hash_algo']) ? $MySettings['password_hash_algo'] : $this->m_iPasswordHashAlgo; $this->m_sAppSecret = isset($MySettings['application.secret']) ? trim($MySettings['application.secret']) : $this->m_sAppSecret; } @@ -2218,8 +2207,7 @@ class Config */ public function GetModuleSetting($sModule, $sProperty, $defaultvalue = null) { - if (isset($this->m_aModuleSettings[$sModule][$sProperty])) - { + if (isset($this->m_aModuleSettings[$sModule][$sProperty])) { return $this->m_aModuleSettings[$sModule][$sProperty]; } @@ -2241,11 +2229,9 @@ class Config public function GetModuleParameter($sModule, $sProperty, $defaultvalue = null) { $ret = $defaultvalue; - if (class_exists('ModulesXMLParameters')) - { + if (class_exists('ModulesXMLParameters')) { $aAllParams = ModulesXMLParameters::GetData($sModule); - if (array_key_exists($sProperty, $aAllParams)) - { + if (array_key_exists($sProperty, $aAllParams)) { $ret = $aAllParams[$sProperty]; } } @@ -2436,7 +2422,7 @@ class Config public function AddAllowedLoginTypes($sLoginMode) { $aAllowedLoginTypes = $this->GetAllowedLoginTypes(); - if (in_array($sLoginMode, $aAllowedLoginTypes)){ + if (in_array($sLoginMode, $aAllowedLoginTypes)) { return; } @@ -2459,7 +2445,6 @@ class Config $this->m_sAppSecret = $sKey; } - public function SetCSVImportCharsets($aCharsets) { $this->m_aCharsets = $aCharsets; @@ -2472,12 +2457,9 @@ class Config public function GetLoadedFile() { - if (is_null($this->m_sFile)) - { + if (is_null($this->m_sFile)) { return ''; - } - else - { + } else { return $this->m_sFile; } } @@ -2489,9 +2471,8 @@ class Config */ public function ToArray() { - $aSettings = array(); - foreach ($this->m_aSettings as $sPropCode => $aSettingInfo) - { + $aSettings = []; + foreach ($this->m_aSettings as $sPropCode => $aSettingInfo) { $aSettings[$sPropCode] = $aSettingInfo['value']; } $aSettings['log_global'] = $this->m_bLogGlobal; @@ -2513,15 +2494,12 @@ class Config $aSettings['password_hash_algo'] = $this->m_iPasswordHashAlgo; $aSettings['application.secret'] = $this->m_sAppSecret; - foreach ($this->m_aModuleSettings as $sModule => $aProperties) - { - foreach ($aProperties as $sProperty => $value) - { + foreach ($this->m_aModuleSettings as $sModule => $aProperties) { + foreach ($aProperties as $sProperty => $value) { $aSettings['module_settings'][$sModule][$sProperty] = $value; } } - foreach ($this->m_aAddons as $sKey => $sFile) - { + foreach ($this->m_aAddons as $sKey => $sFile) { $aSettings['addon_list'][] = $sFile; } @@ -2540,22 +2518,18 @@ class Config */ public function WriteToFile($sFileName = '') { - if (empty($sFileName)) - { + if (empty($sFileName)) { $sFileName = $this->m_sFile; } $oHandle = null; $sConfig = null; - if ($this->m_sFile !== null && is_file($this->m_sFile)) - { + if ($this->m_sFile !== null && is_file($this->m_sFile)) { $oHandle = fopen($this->m_sFile, 'r'); $index = 0; - while (!flock($oHandle, LOCK_SH)) - { - if ($index > 50) - { - throw new ConfigException("Could not read to configuration file", array('file' => $this->m_sFile)); + while (!flock($oHandle, LOCK_SH)) { + if ($index > 50) { + throw new ConfigException("Could not read to configuration file", ['file' => $this->m_sFile]); } usleep(100000); $index++; @@ -2563,61 +2537,59 @@ class Config $sConfig = file_get_contents($this->m_sFile); } $this->oItopConfigParser = new iTopConfigParser($sConfig); - if ($oHandle !==null) - { + if ($oHandle !== null) { flock($oHandle, LOCK_UN); } $hFile = @fopen($sFileName, 'w'); - if ($hFile !== false) - { + if ($hFile !== false) { fwrite($hFile, "m_aSettings; // Old fashioned boolean settings - $aBoolValues = array( + $aBoolValues = [ 'log_global' => $this->m_bLogGlobal, 'log_notification' => $this->m_bLogNotification, 'log_issue' => $this->m_bLogIssue, 'log_web_service' => $this->m_bLogWebService, 'secure_connection_required' => $this->m_bSecureConnectionRequired, - ); - foreach ($aBoolValues as $sKey => $bValue) - { - $aConfigSettings[$sKey] = array( + ]; + foreach ($aBoolValues as $sKey => $bValue) { + $aConfigSettings[$sKey] = [ 'show_in_conf_sample' => true, 'type' => 'bool', 'value' => $bValue, - ); + ]; } // Old fashioned integer settings - $aIntValues = array( + $aIntValues = [ 'fast_reload_interval' => $this->m_iFastReloadInterval, 'max_display_limit' => $this->m_iMaxDisplayLimit, 'min_display_limit' => $this->m_iMinDisplayLimit, 'standard_reload_interval' => $this->m_iStandardReloadInterval, - ); - foreach ($aIntValues as $sKey => $iValue) - { - $aConfigSettings[$sKey] = array( + ]; + foreach ($aIntValues as $sKey => $iValue) { + $aConfigSettings[$sKey] = [ 'show_in_conf_sample' => true, 'type' => 'integer', 'value' => $iValue, - ); + ]; } // Old fashioned remaining values - $aOtherValues = array( + $aOtherValues = [ 'default_language' => $this->m_sDefaultLanguage, 'allowed_login_types' => $this->m_sAllowedLoginTypes, 'ext_auth_variable' => $this->m_sExtAuthVariable, @@ -2626,45 +2598,37 @@ class Config 'csv_import_charsets' => $this->m_aCharsets, 'password_hash_algo' => $this->m_iPasswordHashAlgo, 'application.secret' => $this->m_sAppSecret, - ); - foreach ($aOtherValues as $sKey => $value) - { - $aConfigSettings[$sKey] = array( + ]; + foreach ($aOtherValues as $sKey => $value) { + $aConfigSettings[$sKey] = [ 'show_in_conf_sample' => true, 'type' => is_string($value) ? 'string' : 'mixed', 'value' => $value, - ); + ]; } ksort($aConfigSettings); fwrite($hFile, "\$MySettings = array(\n"); - foreach ($aConfigSettings as $sPropCode => $aSettingInfo) - { + foreach ($aConfigSettings as $sPropCode => $aSettingInfo) { // Write all values that are either always visible or present in the cloned config file - if ($aSettingInfo['show_in_conf_sample'] || (!empty($aSettingInfo['source_of_value']) && ($aSettingInfo['source_of_value'] != 'unknown'))) - { + if ($aSettingInfo['show_in_conf_sample'] || (!empty($aSettingInfo['source_of_value']) && ($aSettingInfo['source_of_value'] != 'unknown'))) { fwrite($hFile, "\n"); - if (isset($aSettingInfo['description'])) - { + if (isset($aSettingInfo['description'])) { fwrite($hFile, "\t// $sPropCode: {$aSettingInfo['description']}\n"); } - if (isset($aSettingInfo['default'])) - { - $sComment = self::PrettyVarExport(null,$aSettingInfo['default'], "\t//\t\t", true); - fwrite($hFile,"\t//\tdefault: {$sComment}\n"); + if (isset($aSettingInfo['default'])) { + $sComment = self::PrettyVarExport(null, $aSettingInfo['default'], "\t//\t\t", true); + fwrite($hFile, "\t//\tdefault: {$sComment}\n"); } - if (isset($this->m_aCanOverrideSettings[$sPropCode]) && $this->m_aCanOverrideSettings[$sPropCode]) - { + if (isset($this->m_aCanOverrideSettings[$sPropCode]) && $this->m_aCanOverrideSettings[$sPropCode]) { $aParserValue = $this->oItopConfigParser->GetVarValue('MySettings', $sPropCode); - } - else - { + } else { $aParserValue = null; } - $sSeenAs = self::PrettyVarExport($aParserValue,$aSettingInfo['value'], "\t"); + $sSeenAs = self::PrettyVarExport($aParserValue, $aSettingInfo['value'], "\t"); fwrite($hFile, "\t'$sPropCode' => $sSeenAs,\n"); } } @@ -2673,11 +2637,9 @@ class Config fwrite($hFile, "\n"); fwrite($hFile, "/**\n *\n * Modules specific settings\n *\n */\n"); fwrite($hFile, "\$MyModuleSettings = array(\n"); - foreach ($this->m_aModuleSettings as $sModule => $aProperties) - { + foreach ($this->m_aModuleSettings as $sModule => $aProperties) { fwrite($hFile, "\t'$sModule' => array (\n"); - foreach ($aProperties as $sProperty => $value) - { + foreach ($aProperties as $sProperty => $value) { $sNiceExport = self::PrettyVarExport($this->oItopConfigParser->GetVarValue('MyModuleSettings', $sProperty), $value, "\t\t"); fwrite($hFile, "\t\t'$sProperty' => $sNiceExport,\n"); } @@ -2692,15 +2654,11 @@ class Config fwrite($hFile, " */\n"); fwrite($hFile, "\$MyModules = array(\n"); $aParserValue = $this->oItopConfigParser->GetVarValue('MyModules', 'addons'); - if ($aParserValue['found']) - { + if ($aParserValue['found']) { fwrite($hFile, "\t'addons' => {$aParserValue['value']},\n"); - } - else - { + } else { fwrite($hFile, "\t'addons' => array (\n"); - foreach ($this->m_aAddons as $sKey => $sFile) - { + foreach ($this->m_aAddons as $sKey => $sFile) { fwrite($hFile, "\t\t'$sKey' => '$sFile',\n"); } fwrite($hFile, "\t),\n"); @@ -2713,10 +2671,8 @@ class Config utils::SetConfig($this); return $bReturn; - } - else - { - throw new ConfigException("Could not write to configuration file", array('file' => $sFileName)); + } else { + throw new ConfigException("Could not write to configuration file", ['file' => $sFileName]); } } @@ -2737,32 +2693,25 @@ class Config */ public function UpdateFromParams($aParamValues, $sModulesDir = null, $bPreserveModuleSettings = false) { - if (isset($aParamValues['application_path'])) - { + if (isset($aParamValues['application_path'])) { $this->Set('app_root_url', $aParamValues['application_path']); } - if (isset($aParamValues['graphviz_path'])) - { + if (isset($aParamValues['graphviz_path'])) { $this->Set('graphviz_path', $aParamValues['graphviz_path']); } - if (isset($aParamValues['mode']) && isset($aParamValues['language'])) - { - if (($aParamValues['mode'] == 'install') || $this->GetDefaultLanguage() == '') - { + if (isset($aParamValues['mode']) && isset($aParamValues['language'])) { + if (($aParamValues['mode'] == 'install') || $this->GetDefaultLanguage() == '') { $this->SetDefaultLanguage($aParamValues['language']); } } - if (isset($aParamValues['db_server'])) - { + if (isset($aParamValues['db_server'])) { $this->Set('db_host', $aParamValues['db_server']); $this->Set('db_user', $aParamValues['db_user']); $this->Set('db_pwd', $aParamValues['db_pwd']); $sDBName = $aParamValues['db_name']; - if ($sDBName == '') - { + if ($sDBName == '') { // Todo - obsolete after the transition to the new setup (2.0) is complete (WARNING: used by the designer) - if (isset($aParamValues['new_db_name'])) - { + if (isset($aParamValues['new_db_name'])) { $sDBName = $aParamValues['new_db_name']; } } @@ -2770,39 +2719,29 @@ class Config $this->Set('db_subname', $aParamValues['db_prefix']); $bDbTlsEnabled = (bool)$aParamValues['db_tls_enabled']; - if ($bDbTlsEnabled) - { + if ($bDbTlsEnabled) { $this->Set('db_tls.enabled', $bDbTlsEnabled, 'UpdateFromParams'); - } - else - { + } else { // disabled : we don't want parameter in the file $this->Set('db_tls.enabled', $bDbTlsEnabled, null); } $sDbTlsCa = $bDbTlsEnabled ? $aParamValues['db_tls_ca'] : null; - if (isset($sDbTlsCa) && !empty($sDbTlsCa)) - { + if (isset($sDbTlsCa) && !empty($sDbTlsCa)) { $this->Set('db_tls.ca', $sDbTlsCa, 'UpdateFromParams'); - } - else - { + } else { // empty parameter : we don't want it in the file $this->Set('db_tls.ca', null, null); } } - if (isset($aParamValues['selected_modules'])) - { + if (isset($aParamValues['selected_modules'])) { $aSelectedModules = explode(',', $aParamValues['selected_modules']); - } - else - { + } else { $aSelectedModules = null; } $this->UpdateIncludes($sModulesDir, $aSelectedModules); - if (isset($aParamValues['source_dir'])) - { + if (isset($aParamValues['source_dir'])) { $this->Set('source_dir', $aParamValues['source_dir']); } } @@ -2820,8 +2759,7 @@ class Config */ public function UpdateIncludes($sModulesDir, $aSelectedModules = null) { - if ($sModulesDir === null) - { + if ($sModulesDir === null) { return; } @@ -2829,40 +2767,30 @@ class Config $oEmptyConfig = new Config('dummy_file', false); // Do NOT load any config file, just set the default values $aAddOns = $oEmptyConfig->GetAddOns(); - $aModules = ModuleDiscovery::GetAvailableModules(array(APPROOT.$sModulesDir)); - foreach ($aModules as $sModuleId => $aModuleInfo) - { - list ($sModuleName, $sModuleVersion) = ModuleDiscovery::GetModuleName($sModuleId); - if (is_null($aSelectedModules) || in_array($sModuleName, $aSelectedModules)) - { - if (isset($aModuleInfo['settings'])) - { - list ($sName, $sVersion) = ModuleDiscovery::GetModuleName($sModuleId); - foreach ($aModuleInfo['settings'] as $sProperty => $value) - { - if (isset($this->m_aModuleSettings[$sName][$sProperty])) - { + $aModules = ModuleDiscovery::GetAvailableModules([APPROOT.$sModulesDir]); + foreach ($aModules as $sModuleId => $aModuleInfo) { + list($sModuleName, $sModuleVersion) = ModuleDiscovery::GetModuleName($sModuleId); + if (is_null($aSelectedModules) || in_array($sModuleName, $aSelectedModules)) { + if (isset($aModuleInfo['settings'])) { + list($sName, $sVersion) = ModuleDiscovery::GetModuleName($sModuleId); + foreach ($aModuleInfo['settings'] as $sProperty => $value) { + if (isset($this->m_aModuleSettings[$sName][$sProperty])) { // Do nothing keep the original value - } - else - { + } else { $this->SetModuleSetting($sName, $sProperty, $value); } } } - if (isset($aModuleInfo['installer'])) - { + if (isset($aModuleInfo['installer'])) { $sModuleInstallerClass = $aModuleInfo['installer']; - if (!class_exists($sModuleInstallerClass)) - { + if (!class_exists($sModuleInstallerClass)) { throw new Exception("Wrong installer class: '$sModuleInstallerClass' is not a PHP class - Module: ".$aModuleInfo['label']); } - if (!is_subclass_of($sModuleInstallerClass, 'ModuleInstallerAPI')) - { + if (!is_subclass_of($sModuleInstallerClass, 'ModuleInstallerAPI')) { throw new Exception("Wrong installer class: '$sModuleInstallerClass' is not derived from 'ModuleInstallerAPI' - Module: ".$aModuleInfo['label']); } - $aCallSpec = array($sModuleInstallerClass, 'BeforeWritingConfig'); - call_user_func_array($aCallSpec, array($this)); + $aCallSpec = [$sModuleInstallerClass, 'BeforeWritingConfig']; + call_user_func_array($aCallSpec, [$this]); } } } @@ -2878,10 +2806,8 @@ class Config */ protected static function ChangePrefix(&$aStrings, $sSearchPrefix, $sNewPrefix) { - foreach ($aStrings as &$sFile) - { - if (substr($sFile, 0, strlen($sSearchPrefix)) == $sSearchPrefix) - { + foreach ($aStrings as &$sFile) { + if (substr($sFile, 0, strlen($sSearchPrefix)) == $sSearchPrefix) { $sFile = $sNewPrefix.substr($sFile, strlen($sSearchPrefix)); } } @@ -2912,22 +2838,19 @@ class Config */ protected static function PrettyVarExport($aParserValue, $value, $sIndentation, $bForceIndentation = false) { - if (is_array($aParserValue) && $aParserValue['found']) - { + if (is_array($aParserValue) && $aParserValue['found']) { return $aParserValue['value']; } $sExport = var_export($value, true); - $sNiceExport = str_replace(array("\r\n", "\n", "\r"), "\n".$sIndentation, trim($sExport)); - if (!$bForceIndentation) - { + $sNiceExport = str_replace(["\r\n", "\n", "\r"], "\n".$sIndentation, trim($sExport)); + if (!$bForceIndentation) { /** @var array $aImported */ $aImported = null; eval('$aImported='.$sNiceExport.';'); // Check if adding the identations at the beginning of each line // did not modify the values (in case of a string containing a line break) - if ($aImported != $value) - { + if ($aImported != $value) { $sNiceExport = $sExport; } } @@ -2956,37 +2879,31 @@ class ConfigPlaceholdersResolver public function Resolve($rawValue) { - if (empty($this->aEnv['ITOP_CONFIG_PLACEHOLDERS']) && empty($this->aServer['ITOP_CONFIG_PLACEHOLDERS'])) - { + if (empty($this->aEnv['ITOP_CONFIG_PLACEHOLDERS']) && empty($this->aServer['ITOP_CONFIG_PLACEHOLDERS'])) { return $rawValue; } - if (is_array($rawValue)) - { - $aResolvedRawValue = array(); - foreach ($rawValue as $key => $value) - { + if (is_array($rawValue)) { + $aResolvedRawValue = []; + foreach ($rawValue as $key => $value) { $aResolvedRawValue[$key] = $this->Resolve($value); } return $aResolvedRawValue; } - if (!is_string($rawValue)) - { + if (!is_string($rawValue)) { return $rawValue; } $sPattern = '/\%(env|server)\((\w+)\)(?:\?:(\w*))?\%/'; //3 capturing groups, ie `%env(HTTP_PORT)?:8080%` produce: `env` `HTTP_PORT` and `8080`. - if (! preg_match_all($sPattern, $rawValue, $aMatchesCollection, PREG_SET_ORDER)) - { + if (! preg_match_all($sPattern, $rawValue, $aMatchesCollection, PREG_SET_ORDER)) { return $rawValue; } $sValue = $rawValue; - foreach ($aMatchesCollection as $aMatches) - { + foreach ($aMatchesCollection as $aMatches) { $sWholeMask = $aMatches[0]; $sSource = $aMatches[1]; $sKey = $aMatches[2]; @@ -3002,33 +2919,26 @@ class ConfigPlaceholdersResolver private function Get($sSourceName, $sKey, $sDefault, $sWholeMask) { - if ('env' == $sSourceName) - { + if ('env' == $sSourceName) { $aSource = $this->aEnv; - } - else if ('server' == $sSourceName) - { + } elseif ('server' == $sSourceName) { $aSource = $this->aServer; - } - else - { + } else { $sErrorMessage = sprintf('unsupported source name "%s" into "%s"', $sSourceName, $sWholeMask); - IssueLog::Error($sErrorMessage, self::class, array($sSourceName, $sKey, $sDefault, $sWholeMask)); + IssueLog::Error($sErrorMessage, self::class, [$sSourceName, $sKey, $sDefault, $sWholeMask]); throw new ConfigException($sErrorMessage); } - if (array_key_exists($sKey, $aSource)) - { + if (array_key_exists($sKey, $aSource)) { return $aSource[$sKey]; } - if (null !== $sDefault) - { + if (null !== $sDefault) { return $sDefault; } $sErrorMessage = sprintf('key "%s" not found into "%s" while expanding', $sSourceName, $sWholeMask); - IssueLog::Error($sErrorMessage, self::class, array($sSourceName, $sKey, $sDefault, $sWholeMask)); + IssueLog::Error($sErrorMessage, self::class, [$sSourceName, $sKey, $sDefault, $sWholeMask]); throw new ConfigException($sErrorMessage); } } diff --git a/core/contexttag.class.inc.php b/core/contexttag.class.inc.php index 760df778c..698a21d00 100644 --- a/core/contexttag.class.inc.php +++ b/core/contexttag.class.inc.php @@ -1,4 +1,5 @@ - /** * Simple helper class for keeping track of the context inside the call stack * @@ -63,7 +63,7 @@ class ContextTag * @since 3.1.0 N°6047 */ public const TAG_IMPORT = 'Import'; - /** + /** * @since 3.1.0 N°6047 */ public const TAG_EXPORT = 'Export'; @@ -74,7 +74,7 @@ class ContextTag */ public const TAG_OBJECT_SEARCH = 'ObjectSearch'; - protected static $aStack = array(); + protected static $aStack = []; /** * Store a context tag on the stack @@ -124,33 +124,29 @@ class ContextTag */ public static function GetTags() { - $aRawTags = array( + $aRawTags = [ ContextTag::TAG_REST, ContextTag::TAG_SYNCHRO, ContextTag::TAG_SETUP, ContextTag::TAG_CONSOLE, ContextTag::TAG_CRON, - ContextTag::TAG_PORTAL); + ContextTag::TAG_PORTAL]; - $aTags = array(); + $aTags = []; - foreach ($aRawTags as $sRawTag) - { + foreach ($aRawTags as $sRawTag) { $aTags[$sRawTag] = Dict::S("Core:Context={$sRawTag}"); } $aPortalsConf = PortalDispatcherData::GetData(); - $aDispatchers = array(); - foreach ($aPortalsConf as $sPortalId => $aConf) - { + $aDispatchers = []; + foreach ($aPortalsConf as $sPortalId => $aConf) { $sHandlerClass = $aConf['handler']; $aDispatchers[$sPortalId] = new $sHandlerClass($sPortalId); } - foreach ($aDispatchers as $sPortalId => $oDispatcher) - { - if ($sPortalId != 'backoffice') - { + foreach ($aDispatchers as $sPortalId => $oDispatcher) { + if ($sPortalId != 'backoffice') { $aTags['Portal:'.$sPortalId] = $oDispatcher->GetLabel(); } } diff --git a/core/coreexception.class.inc.php b/core/coreexception.class.inc.php index d27569168..1196af146 100644 --- a/core/coreexception.class.inc.php +++ b/core/coreexception.class.inc.php @@ -1,4 +1,5 @@ Lock(); $bIsInsideTransaction = CMDBSource::IsInsideTransaction(); - if ($bIsInsideTransaction) - { + if ($bIsInsideTransaction) { // # Transaction isolation hack: // When inside a transaction, we need to open a new connection for the counter. // So it is visible immediately to the connections outside of the transaction. @@ -59,75 +57,61 @@ final class ItopCounter // we did not wanted this! As opening a short connection is less prone to starving than a long running one. // Plus it would trigger way more deadlocks! $hDBLink = self::InitMySQLSession(); - } - else - { + } else { $hDBLink = CMDBSource::GetMysqli(); } - try - { - $oFilter = DBObjectSearch::FromOQL('SELECT KeyValueStore WHERE key_name=:key_name AND namespace=:namespace', array( + try { + $oFilter = DBObjectSearch::FromOQL('SELECT KeyValueStore WHERE key_name=:key_name AND namespace=:namespace', [ 'key_name' => $sCounterName, 'namespace' => $sSelfClassName, - )); + ]); $oAttDef = MetaModel::GetAttributeDef(KeyValueStore::class, 'value'); - $aAttToLoad = array(KeyValueStore::class => array('value' => $oAttDef)); - $sSql = $oFilter->MakeSelectQuery(array(), array(), $aAttToLoad); + $aAttToLoad = [KeyValueStore::class => ['value' => $oAttDef]]; + $sSql = $oFilter->MakeSelectQuery([], [], $aAttToLoad); $hResult = mysqli_query($hDBLink, $sSql); $aCounter = mysqli_fetch_array($hResult, MYSQLI_NUM); mysqli_free_result($hResult); //Rebuild the filter, as the MakeSelectQuery polluted the orignal and it cannot be reused - $oFilter = DBObjectSearch::FromOQL('SELECT KeyValueStore WHERE key_name=:key_name AND namespace=:namespace', array( + $oFilter = DBObjectSearch::FromOQL('SELECT KeyValueStore WHERE key_name=:key_name AND namespace=:namespace', [ 'key_name' => $sCounterName, 'namespace' => $sSelfClassName, - )); + ]); - if (is_null($aCounter)) - { - if (null != $oNewObjectValueProvider) - { + if (is_null($aCounter)) { + if (null != $oNewObjectValueProvider) { $iComputedValue = $oNewObjectValueProvider(); - } - else - { + } else { $iComputedValue = 0; } $iCurrentValue = $iComputedValue + 1; - $aQueryParams = array( + $aQueryParams = [ 'key_name' => $sCounterName, 'value' => "$iCurrentValue", 'namespace' => $sSelfClassName, - ); + ]; $sSql = $oFilter->MakeInsertQuery($aQueryParams); - } - else - { + } else { $iCurrentValue = (int) $aCounter[1]; $iCurrentValue++; - $aQueryParams = array( + $aQueryParams = [ 'value' => "$iCurrentValue", - ); + ]; $sSql = $oFilter->MakeUpdateQuery($aQueryParams); } $hResult = mysqli_query($hDBLink, $sSql); - } - catch(Exception $e) - { + } catch (Exception $e) { IssueLog::Error($e->getMessage()); throw $e; - } - finally - { - if ($bIsInsideTransaction) - { + } finally { + if ($bIsInsideTransaction) { mysqli_close($hDBLink); } $oiTopMutex->Unlock(); @@ -157,8 +141,7 @@ final class ItopCounter { $sRootClass = MetaModel::GetRootClass($sLeafClass); - $oNewObjectCallback = function() use ($sRootClass) - { + $oNewObjectCallback = function () use ($sRootClass) { $sRootTable = MetaModel::DBGetTable($sRootClass); $sIdField = MetaModel::DBGetKey($sRootClass); @@ -186,17 +169,14 @@ final class ItopCounter $hDBLink = CMDBSource::GetMysqliInstance($sDBHost, $sDBUser, $sDBPwd, $sDBName, $bDBTlsEnabled, $sDBTlsCA, false); - if (!$hDBLink) - { - throw new MySQLException('Could not connect to the DB server '.mysqli_connect_error().' (mysql errno: '.mysqli_connect_errno(), array('host' => $sDBHost, 'user' => $sDBUser)); - } + if (!$hDBLink) { + throw new MySQLException('Could not connect to the DB server '.mysqli_connect_error().' (mysql errno: '.mysqli_connect_errno(), ['host' => $sDBHost, 'user' => $sDBUser]); + } return $hDBLink; } } - - /** * Persistent classes for a CMDB * @@ -208,44 +188,43 @@ class KeyValueStore extends DBObject { public static function Init() { - $aParams = array( + $aParams = [ 'category' => '', 'key_type' => 'autoincrement', - 'name_attcode' => array('key_name'), + 'name_attcode' => ['key_name'], 'state_attcode' => '', - 'reconc_keys' => array(''), + 'reconc_keys' => [''], 'db_table' => 'key_value_store', 'db_key_field' => 'id', 'db_finalclass_field' => '', - 'indexes' => array ( - array ( + 'indexes' => [ + [ 0 => 'key_name', 1 => 'namespace', - ), - ),); + ], + ],]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("namespace", array("allowed_values"=>null, "sql"=>'namespace', "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array(), "always_load_in_tables"=>false))); - MetaModel::Init_AddAttribute(new AttributeString("key_name", array("allowed_values"=>null, "sql"=>'key_name', "default_value"=>'', "is_null_allowed"=>false, "depends_on"=>array(), "always_load_in_tables"=>false))); - MetaModel::Init_AddAttribute(new AttributeString("value", array("allowed_values"=>null, "sql"=>'value', "default_value"=>'0', "is_null_allowed"=>false, "depends_on"=>array(), "always_load_in_tables"=>false))); + MetaModel::Init_AddAttribute(new AttributeString("namespace", ["allowed_values" => null, "sql" => 'namespace', "default_value" => null, "is_null_allowed" => true, "depends_on" => [], "always_load_in_tables" => false])); + MetaModel::Init_AddAttribute(new AttributeString("key_name", ["allowed_values" => null, "sql" => 'key_name', "default_value" => '', "is_null_allowed" => false, "depends_on" => [], "always_load_in_tables" => false])); + MetaModel::Init_AddAttribute(new AttributeString("value", ["allowed_values" => null, "sql" => 'value', "default_value" => '0', "is_null_allowed" => false, "depends_on" => [], "always_load_in_tables" => false])); - MetaModel::Init_SetZListItems('details', array ( + MetaModel::Init_SetZListItems('details', [ 0 => 'key_name', 1 => 'value', 2 => 'namespace', - )); - MetaModel::Init_SetZListItems('standard_search', array ( + ]); + MetaModel::Init_SetZListItems('standard_search', [ 0 => 'key_name', 1 => 'value', 2 => 'namespace', - )); - MetaModel::Init_SetZListItems('list', array ( + ]); + MetaModel::Init_SetZListItems('list', [ 0 => 'key_name', 1 => 'value', 2 => 'namespace', - )); + ]); ; } - -} \ No newline at end of file +} diff --git a/core/csvbulkexport.class.inc.php b/core/csvbulkexport.class.inc.php index 62d4e990b..bc0d957ac 100644 --- a/core/csvbulkexport.class.inc.php +++ b/core/csvbulkexport.class.inc.php @@ -1,4 +1,5 @@ aStatusInfo['separator'] = utils::ReadParam('separator', ',', true, 'raw_data'); - if (strtolower($this->aStatusInfo['separator']) == 'tab') - { + if (strtolower($this->aStatusInfo['separator']) == 'tab') { $this->aStatusInfo['separator'] = "\t"; - } - else if (strtolower($this->aStatusInfo['separator']) == 'other') - { + } elseif (strtolower($this->aStatusInfo['separator']) == 'other') { $this->aStatusInfo['separator'] = utils::ReadParam('other-separator', ',', true, 'raw_data'); } - + $this->aStatusInfo['text_qualifier'] = utils::ReadParam('text-qualifier', '"', true, 'raw_data'); - if (strtolower($this->aStatusInfo['text_qualifier']) == 'other') - { + if (strtolower($this->aStatusInfo['text_qualifier']) == 'other') { $this->aStatusInfo['text_qualifier'] = utils::ReadParam('other-text-qualifier', '"', true, 'raw_data'); } $this->aStatusInfo['charset'] = strtoupper(utils::ReadParam('charset', 'UTF-8', true, 'raw_data')); $this->aStatusInfo['formatted_text'] = (bool)utils::ReadParam('formatted_text', 0, true); - + $sDateFormatRadio = utils::ReadParam('csv_date_format_radio', ''); - switch($sDateFormatRadio) - { + switch ($sDateFormatRadio) { case 'default': - // Export from the UI => format = same as is the UI - $this->aStatusInfo['date_format'] = (string)AttributeDateTime::GetFormat(); - break; - + // Export from the UI => format = same as is the UI + $this->aStatusInfo['date_format'] = (string)AttributeDateTime::GetFormat(); + break; + case 'custom': - // Custom format specified from the UI - $this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetFormat(), true, 'raw_data'); - break; - + // Custom format specified from the UI + $this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetFormat(), true, 'raw_data'); + break; + default: - // Export from the command line (or scripted) => default format is SQL, as in previous versions of iTop, unless specified otherwise - $this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetSQLFormat(), true, 'raw_data'); + // Export from the command line (or scripted) => default format is SQL, as in previous versions of iTop, unless specified otherwise + $this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetSQLFormat(), true, 'raw_data'); } } - protected function SuggestField($sClass, $sAttCode) { - switch($sAttCode) - { + switch ($sAttCode) { case 'id': // replace 'id' by 'friendlyname' $sAttCode = 'friendlyname'; break; - + default: $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - if ($oAttDef instanceof AttributeExternalKey) - { + if ($oAttDef instanceof AttributeExternalKey) { $sAttCode .= '_friendlyname'; } } @@ -99,7 +92,7 @@ class CSVBulkExport extends TabularBulkExport public function EnumFormParts() { - return array_merge(parent::EnumFormParts(), array('csv_options' => array('separator', 'charset', 'text-qualifier', 'no_localize', 'formatted_text'), 'interactive_fields_csv' => array('interactive_fields_csv'))); + return array_merge(parent::EnumFormParts(), ['csv_options' => ['separator', 'charset', 'text-qualifier', 'no_localize', 'formatted_text'], 'interactive_fields_csv' => ['interactive_fields_csv']]); } /** @@ -128,11 +121,11 @@ class CSVBulkExport extends TabularBulkExport $sRawSeparator = utils::ReadParam('separator', ',', true, 'raw_data'); $sCustomDateTimeFormat = utils::ReadParam('', ',', true, 'raw_data'); - $aSep = array( + $aSep = [ ';' => Dict::S('UI:CSVImport:SeparatorSemicolon+'), ',' => Dict::S('UI:CSVImport:SeparatorComma+'), 'tab' => Dict::S('UI:CSVImport:SeparatorTab+'), - ); + ]; $sOtherSeparator = ''; if (!array_key_exists($sRawSeparator, $aSep)) { $sOtherSeparator = $sRawSeparator; @@ -155,10 +148,10 @@ class CSVBulkExport extends TabularBulkExport $oMulticolumn->AddColumn(ColumnUIBlockFactory::MakeForBlock($oFieldSetTextQualifier)); $sRawQualifier = utils::ReadParam('text-qualifier', '"', true, 'raw_data'); - $aQualifiers = array( + $aQualifiers = [ '"' => Dict::S('UI:CSVImport:QualifierDoubleQuote+'), '\'' => Dict::S('UI:CSVImport:QualifierSimpleQuote+'), - ); + ]; $sOtherQualifier = ''; if (!array_key_exists($sRawQualifier, $aQualifiers)) { $sOtherQualifier = $sRawQualifier; @@ -230,7 +223,6 @@ class CSVBulkExport extends TabularBulkExport $oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox'); $oFieldSetDate->AddSubBlock($oRadioCustom); - $oP->add_ready_script( <<'.utils::EscapeHtml($oAttDef->GetEditValue($oObj->Get($sAttCode), $oObj)).''; @@ -266,14 +256,13 @@ EOF protected function GetValue($oObj, $sAttCode) { - switch($sAttCode) - { + switch ($sAttCode) { case 'id': $sRet = $oObj->GetKey(); break; - + default: - $sRet = trim($oObj->GetAsCSV($sAttCode), '"'); + $sRet = trim($oObj->GetAsCSV($sAttCode), '"'); } return $sRet; } @@ -285,20 +274,17 @@ EOF $this->aStatusInfo['position'] = 0; $this->aStatusInfo['total'] = $oSet->Count(); - $aData = array(); - foreach($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) - { + $aData = []; + foreach ($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) { $aData[] = $aFieldSpec['sColLabel']; } - $sFrom = array("\r\n", $this->aStatusInfo['text_qualifier']); - $sTo = array("\n", $this->aStatusInfo['text_qualifier'].$this->aStatusInfo['text_qualifier']); - foreach($aData as $idx => $sData) - { + $sFrom = ["\r\n", $this->aStatusInfo['text_qualifier']]; + $sTo = ["\n", $this->aStatusInfo['text_qualifier'].$this->aStatusInfo['text_qualifier']]; + foreach ($aData as $idx => $sData) { // Escape and encode (if needed) the headers $sEscaped = str_replace($sFrom, $sTo, (string)$sData); $aData[$idx] = $this->aStatusInfo['text_qualifier'].$sEscaped.$this->aStatusInfo['text_qualifier']; - if ($this->aStatusInfo['charset'] != 'UTF-8') - { + if ($this->aStatusInfo['charset'] != 'UTF-8') { // Note: due to bugs in the glibc library it's safer to call iconv on the smallest possible string // and thus to convert field by field and not the whole row or file at once (see ticket N°991) $aData[$idx] = @iconv('UTF-8', $this->aStatusInfo['charset'].'//IGNORE//TRANSLIT', $aData[$idx]); @@ -325,45 +311,37 @@ EOF $sExportDateTimeFormat = $this->aStatusInfo['date_format']; $oPrevDateTimeFormat = AttributeDateTime::GetFormat(); $oPrevDateFormat = AttributeDate::GetFormat(); - if ($sExportDateTimeFormat !== (string)$oPrevDateTimeFormat) - { + if ($sExportDateTimeFormat !== (string)$oPrevDateTimeFormat) { // Change date & time formats $oDateTimeFormat = new DateTimeFormat($sExportDateTimeFormat); $oDateFormat = new DateTimeFormat($oDateTimeFormat->ToDateFormat()); AttributeDateTime::SetFormat($oDateTimeFormat); AttributeDate::SetFormat($oDateFormat); } - while($aRow = $oSet->FetchAssoc()) - { + while ($aRow = $oSet->FetchAssoc()) { set_time_limit(intval($iLoopTimeLimit)); - $aData = array(); - foreach($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) - { + $aData = []; + foreach ($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) { $sAlias = $aFieldSpec['sAlias']; $sAttCode = $aFieldSpec['sAttCode']; $sField = ''; $oObj = $aRow[$sAlias]; - if ($oObj != null) - { - switch($sAttCode) - { + if ($oObj != null) { + switch ($sAttCode) { case 'id': $sField = $oObj->GetKey(); break; - + default: $sField = $oObj->GetAsCSV($sAttCode, $this->aStatusInfo['separator'], $this->aStatusInfo['text_qualifier'], $this->bLocalizeOutput, !$this->aStatusInfo['formatted_text']); } } - if ($this->aStatusInfo['charset'] != 'UTF-8') - { + if ($this->aStatusInfo['charset'] != 'UTF-8') { // Note: due to bugs in the glibc library it's safer to call iconv on the smallest possible string // and thus to convert field by field and not the whole row or file at once (see ticket N°991) $aData[] = @iconv('UTF-8', $this->aStatusInfo['charset'].'//IGNORE//TRANSLIT', $sField); - } - else - { + } else { $aData[] = $sField; } } @@ -375,27 +353,23 @@ EOF AttributeDate::SetFormat($oPrevDateFormat); set_time_limit(intval($iPreviousTimeLimit)); $this->aStatusInfo['position'] += $this->iChunkSize; - if ($this->aStatusInfo['total'] == 0) - { + if ($this->aStatusInfo['total'] == 0) { $iPercentage = 100; - } - else - { - $iPercentage = floor(min(100.0, 100.0*$this->aStatusInfo['position']/$this->aStatusInfo['total'])); + } else { + $iPercentage = floor(min(100.0, 100.0 * $this->aStatusInfo['position'] / $this->aStatusInfo['total'])); } - if ($iCount < $this->iChunkSize) - { + if ($iCount < $this->iChunkSize) { $sRetCode = 'done'; } - $aStatus = array('code' => $sRetCode, 'message' => Dict::S('Core:BulkExport:RetrievingData'), 'percentage' => $iPercentage); + $aStatus = ['code' => $sRetCode, 'message' => Dict::S('Core:BulkExport:RetrievingData'), 'percentage' => $iPercentage]; return $sData; } public function GetSupportedFormats() { - return array('csv' => Dict::S('Core:BulkExport:CSVFormat')); + return ['csv' => Dict::S('Core:BulkExport:CSVFormat')]; } public function GetMimeType() diff --git a/core/csvparser.class.inc.php b/core/csvparser.class.inc.php index 2ba7ac21a..0af23a685 100644 --- a/core/csvparser.class.inc.php +++ b/core/csvparser.class.inc.php @@ -1,10 +1,10 @@ '); - /** * CSVParser * @@ -41,9 +40,9 @@ class CSVParser } protected $m_sCurrCell = ''; - protected $m_aCurrRow = array(); + protected $m_aCurrRow = []; protected $m_iToSkip = 0; - protected $m_aDataSet = array(); + protected $m_aDataSet = []; protected function __AddChar($c) { @@ -55,27 +54,20 @@ class CSVParser } protected function __AddCell($c = null, $aFieldMap = null, $bTrimSpaces = false) { - if ($bTrimSpaces) - { + if ($bTrimSpaces) { $sCell = trim($this->m_sCurrCell); - } - else - { + } else { $sCell = $this->m_sCurrCell; } - if ($sCell == NULL_VALUE) - { + if ($sCell == NULL_VALUE) { $sCell = null; } - if (!is_null($aFieldMap)) - { + if (!is_null($aFieldMap)) { $iNextCol = count($this->m_aCurrRow); $iNextName = $aFieldMap[$iNextCol]; $this->m_aCurrRow[$iNextName] = $sCell; - } - else - { + } else { $this->m_aCurrRow[] = $sCell; } $this->m_sCurrCell = ''; @@ -84,33 +76,24 @@ class CSVParser { $this->__AddCell($c, $aFieldMap, $bTrimSpaces); - if ($this->m_iToSkip > 0) - { + if ($this->m_iToSkip > 0) { $this->m_iToSkip--; - } - elseif (count($this->m_aCurrRow) > 1) - { + } elseif (count($this->m_aCurrRow) > 1) { $this->m_aDataSet[] = $this->m_aCurrRow; - } - elseif (count($this->m_aCurrRow) == 1) - { + } elseif (count($this->m_aCurrRow) == 1) { // Get the unique value $aValues = array_values($this->m_aCurrRow); - $sValue = $aValues[0]; - if (strlen($sValue) > 0) - { + $sValue = $aValues[0]; + if (strlen($sValue) > 0) { $this->m_aDataSet[] = $this->m_aCurrRow; } - } - else - { + } else { // blank line, skip silently } - $this->m_aCurrRow = array(); - + $this->m_aCurrRow = []; + // More time for the next row - if ($this->m_iTimeLimitPerRow !== null) - { + if ($this->m_iTimeLimitPerRow !== null) { set_time_limit(intval($this->m_iTimeLimitPerRow)); } } @@ -124,87 +107,71 @@ class CSVParser $this->__AddRow($c, $aFieldMap, true); } - function ToArray($iToSkip = 1, $aFieldMap = null, $iMax = 0) + public function ToArray($iToSkip = 1, $aFieldMap = null, $iMax = 0) { - $aTransitions = array(); + $aTransitions = []; - $aTransitions[stSTARTING][evBLANK] = array('', stSTARTING); - $aTransitions[stSTARTING][evSEPARATOR] = array('__AddCell', stSTARTING); - $aTransitions[stSTARTING][evNEWLINE] = array('__AddRow', stSTARTING); - $aTransitions[stSTARTING][evTEXTQUAL] = array('', stQUALIFIED); - $aTransitions[stSTARTING][evOTHERCHAR] = array('__AddChar', stRAW); - $aTransitions[stSTARTING][evEND] = array('__AddRow', stSTARTING); + $aTransitions[stSTARTING][evBLANK] = ['', stSTARTING]; + $aTransitions[stSTARTING][evSEPARATOR] = ['__AddCell', stSTARTING]; + $aTransitions[stSTARTING][evNEWLINE] = ['__AddRow', stSTARTING]; + $aTransitions[stSTARTING][evTEXTQUAL] = ['', stQUALIFIED]; + $aTransitions[stSTARTING][evOTHERCHAR] = ['__AddChar', stRAW]; + $aTransitions[stSTARTING][evEND] = ['__AddRow', stSTARTING]; - $aTransitions[stRAW][evBLANK] = array('__AddChar', stRAW); - $aTransitions[stRAW][evSEPARATOR] = array('__AddCellTrimmed', stSTARTING); - $aTransitions[stRAW][evNEWLINE] = array('__AddRowTrimmed', stSTARTING); - $aTransitions[stRAW][evTEXTQUAL] = array('__AddChar', stRAW); - $aTransitions[stRAW][evOTHERCHAR] = array('__AddChar', stRAW); - $aTransitions[stRAW][evEND] = array('__AddRowTrimmed', stSTARTING); + $aTransitions[stRAW][evBLANK] = ['__AddChar', stRAW]; + $aTransitions[stRAW][evSEPARATOR] = ['__AddCellTrimmed', stSTARTING]; + $aTransitions[stRAW][evNEWLINE] = ['__AddRowTrimmed', stSTARTING]; + $aTransitions[stRAW][evTEXTQUAL] = ['__AddChar', stRAW]; + $aTransitions[stRAW][evOTHERCHAR] = ['__AddChar', stRAW]; + $aTransitions[stRAW][evEND] = ['__AddRowTrimmed', stSTARTING]; - $aTransitions[stQUALIFIED][evBLANK] = array('__AddChar', stQUALIFIED); - $aTransitions[stQUALIFIED][evSEPARATOR] = array('__AddChar', stQUALIFIED); - $aTransitions[stQUALIFIED][evNEWLINE] = array('__AddChar', stQUALIFIED); - $aTransitions[stQUALIFIED][evTEXTQUAL] = array('', stESCAPED); - $aTransitions[stQUALIFIED][evOTHERCHAR] = array('__AddChar', stQUALIFIED); - $aTransitions[stQUALIFIED][evEND] = array('__AddRow', stSTARTING); + $aTransitions[stQUALIFIED][evBLANK] = ['__AddChar', stQUALIFIED]; + $aTransitions[stQUALIFIED][evSEPARATOR] = ['__AddChar', stQUALIFIED]; + $aTransitions[stQUALIFIED][evNEWLINE] = ['__AddChar', stQUALIFIED]; + $aTransitions[stQUALIFIED][evTEXTQUAL] = ['', stESCAPED]; + $aTransitions[stQUALIFIED][evOTHERCHAR] = ['__AddChar', stQUALIFIED]; + $aTransitions[stQUALIFIED][evEND] = ['__AddRow', stSTARTING]; - $aTransitions[stESCAPED][evBLANK] = array('', stESCAPED); - $aTransitions[stESCAPED][evSEPARATOR] = array('__AddCell', stSTARTING); - $aTransitions[stESCAPED][evNEWLINE] = array('__AddRow', stSTARTING); - $aTransitions[stESCAPED][evTEXTQUAL] = array('__AddChar', stQUALIFIED); - $aTransitions[stESCAPED][evOTHERCHAR] = array('__AddChar', stSTARTING); - $aTransitions[stESCAPED][evEND] = array('__AddRow', stSTARTING); + $aTransitions[stESCAPED][evBLANK] = ['', stESCAPED]; + $aTransitions[stESCAPED][evSEPARATOR] = ['__AddCell', stSTARTING]; + $aTransitions[stESCAPED][evNEWLINE] = ['__AddRow', stSTARTING]; + $aTransitions[stESCAPED][evTEXTQUAL] = ['__AddChar', stQUALIFIED]; + $aTransitions[stESCAPED][evOTHERCHAR] = ['__AddChar', stSTARTING]; + $aTransitions[stESCAPED][evEND] = ['__AddRow', stSTARTING]; // Reset parser variables $this->m_sCurrCell = ''; - $this->m_aCurrRow = array(); + $this->m_aCurrRow = []; $this->m_iToSkip = $iToSkip; - $this->m_aDataSet = array(); + $this->m_aDataSet = []; $iDataLength = strlen($this->m_sCSVData); $iState = stSTARTING; $iTimeLimit = null; - if ($this->m_iTimeLimitPerRow !== null) - { + if ($this->m_iTimeLimitPerRow !== null) { // Give some time for the first row $iTimeLimit = ini_get('max_execution_time'); set_time_limit(intval($this->m_iTimeLimitPerRow)); } - for($i = 0; $i <= $iDataLength ; $i++) - { - if ($i == $iDataLength) - { + for ($i = 0; $i <= $iDataLength ; $i++) { + if ($i == $iDataLength) { $c = null; $iEvent = evEND; - } - else - { + } else { $c = $this->m_sCSVData[$i]; - if ($c == $this->m_sSep) - { + if ($c == $this->m_sSep) { $iEvent = evSEPARATOR; - } - elseif ($c == ' ') - { + } elseif ($c == ' ') { $iEvent = evBLANK; - } - elseif ($c == "\t") - { + } elseif ($c == "\t") { $iEvent = evBLANK; - } - elseif ($c == "\n") - { + } elseif ($c == "\n") { $iEvent = evNEWLINE; - } - elseif ($c == $this->m_sTextQualifier) - { + } elseif ($c == $this->m_sTextQualifier) { $iEvent = evTEXTQUAL; - } - else - { + } else { $iEvent = evOTHERCHAR; } } @@ -212,24 +179,21 @@ class CSVParser $sAction = $aTransitions[$iState][$iEvent][0]; $iState = $aTransitions[$iState][$iEvent][1]; - if (!empty($sAction)) - { - $aCallSpec = array($this, $sAction); - if (is_callable($aCallSpec)) - { + if (!empty($sAction)) { + $aCallSpec = [$this, $sAction]; + if (is_callable($aCallSpec)) { call_user_func($aCallSpec, $c, $aFieldMap); - } - else - { + } else { throw new CSVParserException("CSVParser: unknown verb '$sAction'"); } } $iLineCount = count($this->m_aDataSet); - if (($iMax > 0) && ($iLineCount >= $iMax)) break; + if (($iMax > 0) && ($iLineCount >= $iMax)) { + break; + } } - if ($iTimeLimit !== null) - { + if ($iTimeLimit !== null) { // Restore the previous time limit set_time_limit(intval($iTimeLimit)); } @@ -242,6 +206,3 @@ class CSVParser return $aHeader[0]; } } - - -?> diff --git a/core/customfieldshandler.class.inc.php b/core/customfieldshandler.class.inc.php index 6aa3a0033..10a14ad2a 100644 --- a/core/customfieldshandler.class.inc.php +++ b/core/customfieldshandler.class.inc.php @@ -1,4 +1,5 @@ sAttCode = $sAttCode; $this->aValues = null; } @@ -59,7 +62,8 @@ abstract class CustomFieldsHandler { * @throws \ApplicationException if {@link static::$oForm} attribute not initialized yet * @since 3.1.0 N°6322 N°1150 Add template_id checks */ - public function Validate(DBObject $oHostObject) { + public function Validate(DBObject $oHostObject) + { if (false === isset($this->oForm)) { throw new ApplicationException('oForm attribute not init yet. You must call BuildForm before this method !'); } @@ -68,9 +72,8 @@ abstract class CustomFieldsHandler { $this->oForm->Validate(); if ($this->oForm->GetValid()) { $ret = true; - } - else { - $aMessages = array(); + } else { + $aMessages = []; foreach ($this->oForm->GetErrorMessages() as $sFieldId => $aFieldMessages) { $aMessages[] = $sFieldId.': '.implode(', ', $aFieldMessages); } @@ -87,7 +90,8 @@ abstract class CustomFieldsHandler { * * @return \Combodo\iTop\Form\Form */ - public function GetForm() { + public function GetForm() + { return $this->oForm; } @@ -96,15 +100,17 @@ abstract class CustomFieldsHandler { $this->aValues = $aValues; } - public static function GetPrerequisiteAttributes($sClass = null) { - return array(); + public static function GetPrerequisiteAttributes($sClass = null) + { + return []; } /** * List the available verbs for 'GetForTemplate' */ - public static function EnumTemplateVerbs() { - return array(); + public static function EnumTemplateVerbs() + { + return []; } /** @@ -169,7 +175,6 @@ abstract class CustomFieldsHandler { return null; } - /** * @param DBObject $oHostObject * diff --git a/core/data.generator.class.inc.php b/core/data.generator.class.inc.php index 7883ac17e..7e1d56eaf 100644 --- a/core/data.generator.class.inc.php +++ b/core/data.generator.class.inc.php @@ -1,9 +1,10 @@ - /** * data generator - * helps the consultants in creating dummy data sets, for various test purposes (validation, usability, scalability) + * helps the consultants in creating dummy data sets, for various test purposes (validation, usability, scalability) * * @copyright Copyright (C) 2010-2024 Combodo SAS * @license http://opensource.org/licenses/AGPL-3.0 @@ -37,60 +37,50 @@ class cmdbDataGenerator protected $m_sOrganizationCode; protected $m_sOrganizationName; protected $m_OrganizationDomains; - + /** * Constructor */ public function __construct($sOrganizationId = "") { global $aCompanies, $aCompaniesCode; - if ($sOrganizationId == '') - { + if ($sOrganizationId == '') { // No organization provided, pick a random and unused one from our predefined list - $retries = 5*count($aCompanies); - while ( ($retries > 0) && !isset($this->m_sOrganizationCode)) // Stupid algorithm, but I'm too lazy to do something bulletproof tonight - { + $retries = 5 * count($aCompanies); + while (($retries > 0) && !isset($this->m_sOrganizationCode)) { // Stupid algorithm, but I'm too lazy to do something bulletproof tonight $index = rand(0, count($aCompanies) - 1); - if (!$this->OrganizationExists($aCompanies[$index]['code'])) - { + if (!$this->OrganizationExists($aCompanies[$index]['code'])) { $this->m_sOrganizationCode = $aCompanies[$index]['code']; $this->m_sOrganizationName = $aCompanies[$index]['name']; $this->m_OrganizationDomains = $aCompanies[$index]['domain']; } $retries--; } - } - else - { + } else { // A code has been provided, let's take the information we need from the organization itself $this->m_sOrganizationId = $sOrganizationId; $oOrg = $this->GetOrganization($sOrganizationId); - if ($oOrg == null) - { + if ($oOrg == null) { echo "Unable to find the organization '$sOrganisationCode' in the database... can not add objects into this organization.
      \n"; exit(); } $this->m_sOrganizationCode = $oOrg->Get('code'); $this->m_sOrganizationName = $oOrg->Get('name'); - if (!isset($aCompaniesCode[$this->m_sOrganizationCode]['domain'])) - { + if (!isset($aCompaniesCode[$this->m_sOrganizationCode]['domain'])) { // Generate some probable domain names for this organization - $this->m_OrganizationDomains = array(strtolower($this->m_sOrganizationCode).".com", strtolower($this->m_sOrganizationCode).".org", strtolower($this->m_sOrganizationCode)."corp.net",); - } - else - { + $this->m_OrganizationDomains = [strtolower($this->m_sOrganizationCode).".com", strtolower($this->m_sOrganizationCode).".org", strtolower($this->m_sOrganizationCode)."corp.net",]; + } else { // Pick the domain names for this organization from the predefined list $this->m_OrganizationDomains = $aCompaniesCode[$this->m_sOrganizationCode]['domain']; } } - - if (!isset($this->m_sOrganizationCode)) - { + + if (!isset($this->m_sOrganizationCode)) { echo "Unable to find an organization code which is not already used... can not create a new organization. Enhance the list of fake organizations (\$aCompanies in data_sample.inc.php).
      \n"; exit(); } } - + /** * Get the current organization id used by the generator * @@ -100,7 +90,7 @@ class cmdbDataGenerator { return $this->m_sOrganizationId; } - + /** * Get the current organization id used by the generator * @@ -111,7 +101,7 @@ class cmdbDataGenerator { $this->m_sOrganizationId = $sId; } - + /** * Get the current organization code used by the generator * @@ -127,69 +117,66 @@ class cmdbDataGenerator * * @return string The organization name */ - function GetOrganizationName() + public function GetOrganizationName() { return $this->m_sOrganizationName; } - + /** * Get a pseudo random first name taken from a (big) prefedined list * * @return string A random first name */ - function GenerateFirstName() + public function GenerateFirstName() { global $aFirstNames; return $aFirstNames[rand(0, count($aFirstNames) - 1)]; } - + /** * Get a pseudo random last name taken from a (big) prefedined list * * @return string A random last name */ - function GenerateLastName() + public function GenerateLastName() { global $aNames; return $aNames[rand(0, count($aNames) - 1)]; } - + /** * Get a pseudo random country name taken from a prefedined list * * @return string A random city name */ - function GenerateCountryName() + public function GenerateCountryName() { global $aCountries; return $aCountries[rand(0, count($aCountries) - 1)]; } - + /** * Get a pseudo random city name taken from a (big) prefedined list * * @return string A random city name */ - function GenerateCityName() + public function GenerateCityName() { global $aCities; return $aCities[rand(0, count($aCities) - 1)]; } - + /** * Get a pseudo random email address made of the first name, last name and organization's domain * * @return string A random email address */ - function GenerateEmail($sFirstName, $sLastName) + public function GenerateEmail($sFirstName, $sLastName) { - if (rand(1, 20) > 18) - { + if (rand(1, 20) > 18) { // some people (let's say 5~10%) have an irregular email address $sEmail = strtolower($this->CleanForEmail($sLastName))."@".strtolower($this->GenerateDomain()); - } - else - { + } else { $sEmail = strtolower($this->CleanForEmail($sFirstName)).".".strtolower($this->CleanForEmail($sLastName))."@".strtolower($this->GenerateDomain()); } return $sEmail; @@ -203,7 +190,7 @@ class cmdbDataGenerator * - domain() => returns a domain name for the current organization * - enum(aaa,bb,c,dddd) => returns randomly one of aaa,bb,c or dddd with the same * probability of occurence. If you want to change the probability you can repeat some values - * i.e enum(most probable,most probable,most probable,most probable,most probable,rare) + * i.e enum(most probable,most probable,most probable,most probable,most probable,rare) * - number(xxx-yyy) => a random number between xxx and yyy (bounds included) * note that if the first number (xxx) begins with a zero, then the result will zero padded * to the same number of digits as xxx. @@ -215,39 +202,28 @@ class cmdbDataGenerator * @param string $sTemplate The template used for generating the string * @return string The generated pseudo random the string */ - function GenerateString($sTemplate) + public function GenerateString($sTemplate) { $sResult = ""; $aParts = explode("\|", $sTemplate); - foreach($aParts as $sPart) - { - if (preg_match("/domain\(\)/", $sPart, $aMatches)) - { + foreach ($aParts as $sPart) { + if (preg_match("/domain\(\)/", $sPart, $aMatches)) { $sResult .= strtolower($this->GenerateDomain()); - } - elseif (preg_match("/enum\((.+)\)/", $sPart, $aMatches)) - { + } elseif (preg_match("/enum\((.+)\)/", $sPart, $aMatches)) { $sEnumValues = $aMatches[1]; $aEnumValues = explode(",", $sEnumValues); $sResult .= $aEnumValues[rand(0, count($aEnumValues) - 1)]; - } - elseif (preg_match("/number\((\d+)-(\d+)\)/", $sPart, $aMatches)) - { + } elseif (preg_match("/number\((\d+)-(\d+)\)/", $sPart, $aMatches)) { $sStartNumber = $aMatches[1]; - if ($sStartNumber[0] == '0') - { + if ($sStartNumber[0] == '0') { // number must be zero padded $sFormat = "%0".strlen($sStartNumber)."d"; - } - else - { + } else { $sFormat = "%d"; } $sEndNumber = $aMatches[2]; $sResult .= sprintf($sFormat, rand($sStartNumber, $sEndNumber)); - } - else - { + } else { $sResult .= $sPart; } } @@ -264,27 +240,22 @@ class cmdbDataGenerator * @param string $aFilterCriteria A hash array of filterCOde => FilterValue (the strict operator '=' is used ) * @return mixed The key to an object of the given class, or null if none are found */ - function GenerateKey($sClass, $aFilterCriteria) + public function GenerateKey($sClass, $aFilterCriteria) { $retKey = null; $oFilter = new DBObjectSearch($sClass); - foreach($aFilterCriteria as $sFilterCode => $filterValue) - { + foreach ($aFilterCriteria as $sFilterCode => $filterValue) { $oFilter->AddCondition($sFilterCode, $filterValue, '='); } $oSet = new CMDBObjectSet($oFilter); - if ($oSet->Count() > 0) - { + if ($oSet->Count() > 0) { $max_count = $index = rand(1, $oSet->Count()); - do - { + do { $oObj = $oSet->Fetch(); $index--; - } - while($index > 0); - - if (!is_object($oObj)) - { + } while ($index > 0); + + if (!is_object($oObj)) { echo "
      ";
       				echo "ERROR: non empty set, but invalid object picked! class='$sClass'\n";
       				echo "Index chosen: $max_count\n";
      @@ -292,9 +263,7 @@ class cmdbDataGenerator
       				echo "Filter criteria:\n";
       				print_r($aFilterCriteria);
       				echo "
      "; - } - else - { + } else { $retKey = $oObj->GetKey(); } } @@ -305,7 +274,7 @@ class cmdbDataGenerator // Protected methods // /////////////////////////////////////////////////////////////////////////////// - + /** * Generate a (random) domain name consistent with the organization name & code * @@ -316,17 +285,14 @@ class cmdbDataGenerator */ protected function GenerateDomain() { - if (is_array($this->m_OrganizationDomains)) - { - $sDomain = $this->m_OrganizationDomains[rand(0, count($this->m_OrganizationDomains)-1)]; - } - else - { + if (is_array($this->m_OrganizationDomains)) { + $sDomain = $this->m_OrganizationDomains[rand(0, count($this->m_OrganizationDomains) - 1)]; + } else { $sDomain = $this->m_OrganizationDomains; } return $sDomain; } - + /** * Strips accented characters from a string in order to produce a suitable email address * @@ -335,7 +301,7 @@ class cmdbDataGenerator */ protected function CleanForEmail($sText) { - return str_replace(array("'", "�", "�", "�", "�", "�", "�", "�", "�", "�"), array("", "e", "e", "e", "c", "a", "a", "n", "oe", "ae"), $sText); + return str_replace(["'", "�", "�", "�", "�", "�", "�", "�", "�", "�"], ["", "e", "e", "e", "c", "a", "a", "n", "oe", "ae"], $sText); } /** @@ -364,11 +330,9 @@ class cmdbDataGenerator $oFilter = new DBObjectSearch('Organization'); $oFilter->AddCondition('id', $sId, '='); $oSet = new CMDBObjectSet($oFilter); - if ($oSet->Count() > 0) - { + if ($oSet->Count() > 0) { $oOrg = $oSet->Fetch(); // Let's take the first one found } return $oOrg; } } -?> diff --git a/core/datetimeformat.class.inc.php b/core/datetimeformat.class.inc.php index bf8921723..f4e7f9215 100644 --- a/core/datetimeformat.class.inc.php +++ b/core/datetimeformat.class.inc.php @@ -1,9 +1,10 @@ - /** * Helper class to generate Date & Time formatting strings in the various conventions * from the PHP DateTime::createFromFormat convention. - * + * * Example: - * + * * $oFormat = new DateTimeFormat('m/d/Y H:i'); * $oFormat->ToExcel(); * >> 'MM/dd/YYYY HH:mm' - * + * * @author Denis Flaven * */ class DateTimeFormat { protected $sPHPFormat; - + /** * Constructs the DateTimeFormat object * @param string $sPHPFormat A format string using the PHP 'DateTime::createFromFormat' convention @@ -42,7 +42,7 @@ class DateTimeFormat { $this->sPHPFormat = (string)$sPHPFormat; } - + /** * @return string */ @@ -50,34 +50,34 @@ class DateTimeFormat { return $this->sPHPFormat; } - + /** * Return the mapping table for converting between various conventions for date/time formats */ protected static function GetFormatMapping() { - return array( + return [ // Days - 'd' => array('regexpr' => '(0[1-9]|[1-2][0-9]|3[0-1])', 'datepicker' => 'dd', 'excel' => 'dd', 'moment' => 'DD'), // Day of the month: 2 digits (with leading zero) - 'j' => array('regexpr' => '([1-9]|[1-2][0-9]|3[0-1])', 'datepicker' => 'd', 'excel' => 'd', 'moment' => 'D'), // Day of the month: 1 or 2 digits (without leading zero) + 'd' => ['regexpr' => '(0[1-9]|[1-2][0-9]|3[0-1])', 'datepicker' => 'dd', 'excel' => 'dd', 'moment' => 'DD'], // Day of the month: 2 digits (with leading zero) + 'j' => ['regexpr' => '([1-9]|[1-2][0-9]|3[0-1])', 'datepicker' => 'd', 'excel' => 'd', 'moment' => 'D'], // Day of the month: 1 or 2 digits (without leading zero) // Months - 'm' => array('regexpr' => '(0[1-9]|1[0-2])', 'datepicker' => 'mm', 'excel' => 'MM', 'moment' => 'MM' ), // Month on 2 digits i.e. 01-12 - 'n' => array('regexpr' => '([1-9]|1[0-2])', 'datepicker' => 'm', 'excel' => 'm', 'moment' => 'M'), // Month on 1 or 2 digits 1-12 + 'm' => ['regexpr' => '(0[1-9]|1[0-2])', 'datepicker' => 'mm', 'excel' => 'MM', 'moment' => 'MM' ], // Month on 2 digits i.e. 01-12 + 'n' => ['regexpr' => '([1-9]|1[0-2])', 'datepicker' => 'm', 'excel' => 'm', 'moment' => 'M'], // Month on 1 or 2 digits 1-12 // Years - 'Y' => array('regexpr' => '([0-9]{4})', 'datepicker' => 'yy', 'excel' => 'YYYY', 'moment' => 'YYYY'), // Year on 4 digits - 'y' => array('regexpr' => '([0-9]{2})', 'datepicker' => 'y', 'excel' => 'YY', 'moment' => 'YY'), // Year on 2 digits + 'Y' => ['regexpr' => '([0-9]{4})', 'datepicker' => 'yy', 'excel' => 'YYYY', 'moment' => 'YYYY'], // Year on 4 digits + 'y' => ['regexpr' => '([0-9]{2})', 'datepicker' => 'y', 'excel' => 'YY', 'moment' => 'YY'], // Year on 2 digits // Hours - 'H' => array('regexpr' => '([0-1][0-9]|2[0-3])', 'datepicker' => 'HH', 'excel' => 'HH', 'moment' => 'HH'), // Hour 00..23 - 'h' => array('regexpr' => '(0[1-9]|1[0-2])', 'datepicker' => 'hh', 'excel' => 'hh', 'moment' => 'hh'), // Hour 01..12 - 'G' => array('regexpr' => '([0-9]|1[0-9]|2[0-3])', 'datepicker' => 'H', 'excel' => 'H', 'moment' => 'H'), // Hour 0..23 - 'g' => array('regexpr' => '([1-9]|1[0-2])', 'datepicker' => 'h', 'excel' => 'h', 'moment' => 'h'), // Hour 1..12 - 'a' => array('regexpr' => '(am|pm)', 'datepicker' => 'tt', 'excel' => 'am/pm', 'moment' => 'a'), - 'A' => array('regexpr' => '(AM|PM)', 'datepicker' => 'TT', 'excel' => 'AM/PM', 'moment' => 'A'), + 'H' => ['regexpr' => '([0-1][0-9]|2[0-3])', 'datepicker' => 'HH', 'excel' => 'HH', 'moment' => 'HH'], // Hour 00..23 + 'h' => ['regexpr' => '(0[1-9]|1[0-2])', 'datepicker' => 'hh', 'excel' => 'hh', 'moment' => 'hh'], // Hour 01..12 + 'G' => ['regexpr' => '([0-9]|1[0-9]|2[0-3])', 'datepicker' => 'H', 'excel' => 'H', 'moment' => 'H'], // Hour 0..23 + 'g' => ['regexpr' => '([1-9]|1[0-2])', 'datepicker' => 'h', 'excel' => 'h', 'moment' => 'h'], // Hour 1..12 + 'a' => ['regexpr' => '(am|pm)', 'datepicker' => 'tt', 'excel' => 'am/pm', 'moment' => 'a'], + 'A' => ['regexpr' => '(AM|PM)', 'datepicker' => 'TT', 'excel' => 'AM/PM', 'moment' => 'A'], // Minutes - 'i' => array('regexpr' => '([0-5][0-9])', 'datepicker' => 'mm', 'excel' => 'mm', 'moment' => 'mm'), + 'i' => ['regexpr' => '([0-5][0-9])', 'datepicker' => 'mm', 'excel' => 'mm', 'moment' => 'mm'], // Seconds - 's' => array('regexpr' => '([0-5][0-9])', 'datepicker' => 'ss', 'excel' => 'ss', 'moment' => 'ss'), - ); + 's' => ['regexpr' => '([0-5][0-9])', 'datepicker' => 'ss', 'excel' => 'ss', 'moment' => 'ss'], + ]; } /** @@ -87,57 +87,44 @@ class DateTimeFormat * @param string $sEscapePattern The replacement string for escaping characters in the output string. %s is the source char. * @param string $bEscapeAll True to systematically escape all litteral characters * @param array $sSpecialChars A string containing the only characters to escape in the output - * @return string The string in the requested format + * @return string The string in the requested format */ protected function Transform($sOutputFormatCode, $sEscapePattern, $bEscapeAll = false, $sSpecialChars = '') { $aMappings = static::GetFormatMapping(); $sResult = ''; - + $bEscaping = false; - for($i=0; $i < strlen($this->sPHPFormat); $i++) - { - if (($this->sPHPFormat[$i] == '\\')) - { + for ($i = 0; $i < strlen($this->sPHPFormat); $i++) { + if (($this->sPHPFormat[$i] == '\\')) { $bEscaping = true; continue; } - - if ($bEscaping) - { - if (($sSpecialChars === '') || (strpos($sSpecialChars, $this->sPHPFormat[$i]) !== false)) - { + + if ($bEscaping) { + if (($sSpecialChars === '') || (strpos($sSpecialChars, $this->sPHPFormat[$i]) !== false)) { $sResult .= sprintf($sEscapePattern, $this->sPHPFormat[$i]); - } - else - { + } else { $sResult .= $this->sPHPFormat[$i]; } - + $bEscaping = false; - } - else if(array_key_exists($this->sPHPFormat[$i], $aMappings)) - { + } elseif (array_key_exists($this->sPHPFormat[$i], $aMappings)) { // Not a litteral value, must be replaced by its regular expression pattern $sResult .= $aMappings[$this->sPHPFormat[$i]][$sOutputFormatCode]; - } - else - { - if ($bEscapeAll || (strpos($sSpecialChars, $this->sPHPFormat[$i]) !== false)) - { + } else { + if ($bEscapeAll || (strpos($sSpecialChars, $this->sPHPFormat[$i]) !== false)) { $sResult .= sprintf($sEscapePattern, $this->sPHPFormat[$i]); - } - else - { + } else { // Normal char with no special meaning, no need to escape it $sResult .= $this->sPHPFormat[$i]; } } } - - return $sResult; - } - + + return $sResult; + } + /** * Format a date into the supplied format string * @param mixed $date An int, string, DateTime object or null !! @@ -146,38 +133,27 @@ class DateTimeFormat */ public function Format($date) { - if ($date == null) - { + if ($date == null) { $sDate = ''; - } - else if (($date === '0000-00-00') || ($date === '0000-00-00 00:00:00')) - { + } elseif (($date === '0000-00-00') || ($date === '0000-00-00 00:00:00')) { $sDate = ''; - } - else if ($date instanceof DateTime) - { + } elseif ($date instanceof DateTime) { // Parameter is a DateTime $sDate = $date->format($this->sPHPFormat); - } - else if (is_int($date)) - { + } elseif (is_int($date)) { // Parameter is a Unix timestamp $oDate = new DateTime(); $oDate->setTimestamp($date); $sDate = $oDate->format($this->sPHPFormat); - } - else if (is_string($date)) - { + } elseif (is_string($date)) { $oDate = new DateTime($date); $sDate = $oDate->format($this->sPHPFormat); - } - else - { + } else { throw new Exception(__CLASS__."::Format: Unexpected date value: ".print_r($date, true)); } return $sDate; } - + /** * Parse a date in the supplied format and return the date as a string in the internal format * @param string $sDate The string to parse @@ -187,22 +163,18 @@ class DateTimeFormat */ public function Parse($sDate) { - if (($sDate == null) || ($sDate == '0000-00-00 00:00:00') || ($sDate == '0000-00-00')) - { - return null; - } - else - { + if (($sDate == null) || ($sDate == '0000-00-00 00:00:00') || ($sDate == '0000-00-00')) { + return null; + } else { $sFormat = preg_replace('/\\?/', '', $this->sPHPFormat); // replace escaped characters by a wildcard for parsing $oDate = DateTime::createFromFormat($this->sPHPFormat, $sDate); - if ($oDate === false) - { + if ($oDate === false) { throw new Exception(__CLASS__."::Parse: Unable to parse the date: '$sDate' using the format: '{$this->sPHPFormat}'"); } return $oDate; } } - + /** * Get the date or datetime format string in the jQuery UI date picker format * @return string The format string using the date picker convention @@ -211,7 +183,7 @@ class DateTimeFormat { return $this->Transform('datepicker', "'%s'"); } - + /** * Get a date or datetime format string in the Excel format * @return string The format string using the Excel convention @@ -220,7 +192,7 @@ class DateTimeFormat { return $this->Transform('excel', "%s"); } - + /** * Get a date or datetime format string in the moment.js format * @return string The format string using the moment.js convention @@ -229,16 +201,15 @@ class DateTimeFormat { return $this->Transform('moment', "[%s]", true /* escape all */); } - + public static function GetJSSQLToCustomFormat() { - $aPHPToMoment = array(); - foreach(self::GetFormatMapping() as $sPHPCode => $aMapping) - { + $aPHPToMoment = []; + foreach (self::GetFormatMapping() as $sPHPCode => $aMapping) { $aPHPToMoment[$sPHPCode] = $aMapping['moment']; } $sJSMapping = json_encode($aPHPToMoment); - + $sFunction = <<sPHPFormat); $i++) - { - if (($this->sPHPFormat[$i] == '\\')) - { + for ($i = 0; $i < strlen($this->sPHPFormat); $i++) { + if (($this->sPHPFormat[$i] == '\\')) { $bEscaping = true; continue; } - - if ($bEscaping) - { + + if ($bEscaping) { $sResult .= $this->sPHPFormat[$i]; // No need to escape characters in the placeholder $bEscaping = false; - } - else if(array_key_exists($this->sPHPFormat[$i], $aMappings)) - { + } elseif (array_key_exists($this->sPHPFormat[$i], $aMappings)) { // Not a litteral value, must be replaced by Dict equivalent $sResult .= Dict::S('Core:DateTime:Placeholder_'.$this->sPHPFormat[$i]); - } - else - { + } else { // Normal char with no special meaning $sResult .= $this->sPHPFormat[$i]; } } - + return $sResult; } @@ -373,14 +337,11 @@ EOF { $iStart = 999; $iEnd = 0; - - foreach($aPlaceholders as $sChar) - { + + foreach ($aPlaceholders as $sChar) { $iPos = strpos($this->sPHPFormat, $sChar); - if ($iPos !== false) - { - if (($iPos > 0) && ($this->sPHPFormat[$iPos-1] == '\\')) - { + if ($iPos !== false) { + if (($iPos > 0) && ($this->sPHPFormat[$iPos - 1] == '\\')) { // The placeholder is actually escaped, it's a litteral character, ignore it continue; } @@ -391,25 +352,25 @@ EOF $sFormat = substr($this->sPHPFormat, $iStart, $iEnd - $iStart + 1); return $sFormat; } - + /** * Produces the Date format string by extracting only the date part of the date and time format string * @return string */ public function ToDateFormat() { - return $this->ToSubFormat(array('Y', 'y', 'd', 'j', 'm', 'n')); + return $this->ToSubFormat(['Y', 'y', 'd', 'j', 'm', 'n']); } - + /** * Produces the Time format string by extracting only the time part of the date and time format string * @return string */ public function ToTimeFormat() { - return $this->ToSubFormat(array('H', 'h', 'G', 'g', 'i', 's', 'a', 'A')); + return $this->ToSubFormat(['H', 'h', 'G', 'g', 'i', 's', 'a', 'A']); } - + /** * Get the regular expression to (approximately) validate a date/time for the current format * The validation does not take into account the number of days in a month (i.e. June 31st will pass, as well as Feb 30th!) @@ -419,8 +380,7 @@ EOF public function ToRegExpr($sDelimiter = null) { $sRet = '^'.$this->Transform('regexpr', "\\%s", false /* escape all */, '.?*$^()[]:').'$'; - if ($sDelimiter !== null) - { + if ($sDelimiter !== null) { $sRet = $sDelimiter.str_replace($sDelimiter, '\\'.$sDelimiter, $sRet).$sDelimiter; } return $sRet; diff --git a/core/dbobject.class.php b/core/dbobject.class.php index fec3d472a..cad54effc 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -1,4 +1,5 @@ array of ('table' => array of (array of )) */ - private static $m_aBulkInsertItems = array(); + private static $m_aBulkInsertItems = []; /** @var array class => array of ('table' => array of ) */ - private static $m_aBulkInsertCols = array(); - private static $m_bBulkInsert = false; + private static $m_aBulkInsertCols = []; + private static $m_bBulkInsert = false; /** @var bool true IF the object is mapped to a DB record */ protected $m_bIsInDB = false; protected $m_iKey = null; /** @var array attcode => value : corresponding current value (the new value passed to {@see DBObject::Set()}). Reset during {@see DBObject::DBUpdate()} */ - private $m_aCurrValues = array(); + private $m_aCurrValues = []; /** @var array attcode => value : previous values before the {@see DBObject::Set()} call. Array is reset at the end of {@see DBObject::DBUpdate()} */ - protected $m_aOrigValues = array(); + protected $m_aOrigValues = []; protected $m_aExtendedData = null; - /** - * @var bool Is dirty (true) if a modification is ongoing. - * - * @internal The object may have incorrect external keys, then any attempt of reload must be avoided - */ + /** + * @var bool Is dirty (true) if a modification is ongoing. + * + * @internal The object may have incorrect external keys, then any attempt of reload must be avoided + */ private $m_bDirty = false; /** @@ -148,9 +147,9 @@ abstract class DBObject implements iDisplay /** @var bool Compound objects can be partially loaded */ private $m_bFullyLoaded = false; /** @var array Compound objects can be partially loaded, array of sAttCode */ - private $m_aLoadedAtt = array(); + private $m_aLoadedAtt = []; /** @var array list of (potentially) modified sAttCodes */ - protected $m_aTouchedAtt = array(); + protected $m_aTouchedAtt = []; /** * @var array real modification status * for each attCode can be: @@ -158,7 +157,7 @@ abstract class DBObject implements iDisplay * * true => modified, * * false => not modified (the same value as the original value was set) */ - protected $m_aModifiedAtt = array(); + protected $m_aModifiedAtt = []; /** * @var array attname => value : value before the last {@see DBObject::Set()} call. Set at the beginning of {@see DBObject::DBUpdate()}. * @see DBObject::ListPreviousValuesForUpdatedAttributes() getter for this attribute @@ -176,7 +175,7 @@ abstract class DBObject implements iDisplay */ protected $m_aSynchroData = null; protected $m_sHighlightCode = null; - protected $m_aCallbacks = array(); + protected $m_aCallbacks = []; /** * @var string local events suffix */ @@ -207,7 +206,7 @@ abstract class DBObject implements iDisplay // Protect DBUpdate against infinite loop protected $iUpdateLoopCount; - const MAX_UPDATE_LOOP_COUNT = 10; + public const MAX_UPDATE_LOOP_COUNT = 10; private $aEventListeners = []; private array $aAllowedTransitions = []; @@ -233,12 +232,11 @@ abstract class DBObject implements iDisplay public function __construct($aRow = null, $sClassAlias = '', $aAttToLoad = null, $aExtendedDataSpec = null) { $this->iUpdateLoopCount = 0; - if (!empty($aRow)) - { + if (!empty($aRow)) { $this->FromRow($aRow, $sClassAlias, $aAttToLoad, $aExtendedDataSpec); $this->m_bFullyLoaded = $this->IsFullyLoaded(); - $this->m_aTouchedAtt = array(); - $this->m_aModifiedAtt = array(); + $this->m_aTouchedAtt = []; + $this->m_aModifiedAtt = []; $this->m_sObjectUniqId = get_class($this).'::'.$this->GetKey().'_'.uniqId('', true); $this->RegisterEventListeners(); return; @@ -249,8 +247,7 @@ abstract class DBObject implements iDisplay $this->m_iKey = self::GetNextTempId(get_class($this)); // set default values - foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode=>$oAttDef) - { + foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { $this->m_aCurrValues[$sAttCode] = $this->GetDefaultValue($sAttCode); $this->m_aOrigValues[$sAttCode] = null; if (!$oAttDef->IsExternalField() && !$oAttDef instanceof AttributeFriendlyName) { @@ -277,128 +274,124 @@ abstract class DBObject implements iDisplay /** * Update meta-attributes depending on the given attribute list * - * @internal - * - * @param array|null $aAttCodes List of att codes - * + * @internal + * + * @param array|null $aAttCodes List of att codes + * * @throws \CoreException */ protected function UpdateMetaAttributes($aAttCodes = null) { - if (is_null($aAttCodes)) - { + if (is_null($aAttCodes)) { $aAttCodes = MetaModel::GetAttributesList(get_class($this)); } - foreach ($aAttCodes as $sAttCode) - { - foreach (MetaModel::ListMetaAttributes(get_class($this), $sAttCode) as $sMetaAttCode => $oMetaAttDef) - { + foreach ($aAttCodes as $sAttCode) { + foreach (MetaModel::ListMetaAttributes(get_class($this), $sAttCode) as $sMetaAttCode => $oMetaAttDef) { /** @var \AttributeMetaEnum $oMetaAttDef */ $this->_Set($sMetaAttCode, $oMetaAttDef->MapValue($this)); } } } - /** - * Mark the object as dirty - * - * Once dirty the object may be written to the DB, it is NOT possible to reload it - * or at least not possible to reload it the same way - * - * @internal - */ + /** + * Mark the object as dirty + * + * Once dirty the object may be written to the DB, it is NOT possible to reload it + * or at least not possible to reload it the same way + * + * @internal + */ public function RegisterAsDirty() { $this->m_bDirty = true; } - /** - * Whether the object is already persisted in DB or not. - * - * @api - * - * @return bool - */ + /** + * Whether the object is already persisted in DB or not. + * + * @api + * + * @return bool + */ public function IsNew() { return (!$this->m_bIsInDB); } - /** - * Returns an Id for memory objects - * - * @internal - * - * @param string $sClass - * - * @return int - * @throws CoreException - */ - static protected function GetNextTempId($sClass) + /** + * Returns an Id for memory objects + * + * @internal + * + * @param string $sClass + * + * @return int + * @throws CoreException + */ + protected static function GetNextTempId($sClass) { $sRootClass = MetaModel::GetRootClass($sClass); - if (!array_key_exists($sRootClass, self::$m_aMemoryObjectsByClass)) - { + if (!array_key_exists($sRootClass, self::$m_aMemoryObjectsByClass)) { self::$m_aMemoryObjectsByClass[$sRootClass] = 0; } self::$m_aMemoryObjectsByClass[$sRootClass]++; return (- self::$m_aMemoryObjectsByClass[$sRootClass]); } - /** - * HTML String representation of the object - * - * Only a few meaningful information will be returned. - * This representation is for debugging purposes, and is subject to change. - * The returned string is raw HTML - * - * @return string - * @throws CoreException - */ + /** + * HTML String representation of the object + * + * Only a few meaningful information will be returned. + * This representation is for debugging purposes, and is subject to change. + * The returned string is raw HTML + * + * @return string + * @throws CoreException + */ public function __toString() { - $sRet = ''; - $sClass = get_class($this); - $sRootClass = MetaModel::GetRootClass($sClass); - $iPKey = $this->GetKey(); - $sFriendlyname = $this->GetAsHTML('friendlyname'); - $sRet .= "$sClass::$iPKey ($sFriendlyname)
      \n"; - return $sRet; + $sRet = ''; + $sClass = get_class($this); + $sRootClass = MetaModel::GetRootClass($sClass); + $iPKey = $this->GetKey(); + $sFriendlyname = $this->GetAsHTML('friendlyname'); + $sRet .= "$sClass::$iPKey ($sFriendlyname)
      \n"; + return $sRet; } - - /** - * Alias of DBObject::Reload() - * - * Restore initial values - * - * @see Reload() - * - * @throws CoreException - */ + + /** + * Alias of DBObject::Reload() + * + * Restore initial values + * + * @see Reload() + * + * @throws CoreException + */ public function DBRevert() { $this->Reload(); } - /** - * Is the current instance fully or partially loaded. - * - * This method compute the state in realtime. - * In almost every case it is preferable to use DBObject::m_bFullyLoaded. - * - * @internal - * @see m_bFullyLoaded - * - * @return bool - * @throws CoreException - */ + /** + * Is the current instance fully or partially loaded. + * + * This method compute the state in realtime. + * In almost every case it is preferable to use DBObject::m_bFullyLoaded. + * + * @internal + * @see m_bFullyLoaded + * + * @return bool + * @throws CoreException + */ protected function IsFullyLoaded() { - foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode=>$oAttDef) - { - if (!$oAttDef->LoadInObject()) continue; - if (!isset($this->m_aLoadedAtt[$sAttCode]) || !$this->m_aLoadedAtt[$sAttCode]) - { + foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { + if (!$oAttDef->LoadInObject()) { + continue; + } + if (!isset($this->m_aLoadedAtt[$sAttCode]) || !$this->m_aLoadedAtt[$sAttCode]) { return false; } } @@ -406,11 +399,11 @@ abstract class DBObject implements iDisplay } /** - * Reload the object from the DB. - * - * This is mostly used after a lazy load (automatically performed by the framework) - * This will erase any pending changes. - * + * Reload the object from the DB. + * + * This is mostly used after a lazy load (automatically performed by the framework) + * This will erase any pending changes. + * * @param bool $bAllowAllData @deprecated This parameter is ignored!! * * @throws CoreException @@ -420,21 +413,21 @@ abstract class DBObject implements iDisplay assert($this->m_bIsInDB); $this->FireEvent(EVENT_DB_OBJECT_RELOAD); $aRow = MetaModel::MakeSingleRow(get_class($this), $this->m_iKey, false /* must be found */, true /* AllowAllData */); - if (empty($aRow)) - { - $sErrorMessage = "Failed to reload object of class '".get_class($this)."', id = ".$this->m_iKey.', DBIsReadOnly = '.(int) MetaModel::DBIsReadOnly(); + if (empty($aRow)) { + $sErrorMessage = "Failed to reload object of class '".get_class($this)."', id = ".$this->m_iKey.', DBIsReadOnly = '.(int) MetaModel::DBIsReadOnly(); - IssueLog::Error("$sErrorMessage:\n".MyHelpers::get_callstack_text(1)); - throw new CoreException("$sErrorMessage (see the log for more information)"); + IssueLog::Error("$sErrorMessage:\n".MyHelpers::get_callstack_text(1)); + throw new CoreException("$sErrorMessage (see the log for more information)"); } $this->FromRow($aRow); // Process linked set attributes // - foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode=>$oAttDef) - { - if (!$oAttDef->IsLinkSet()) continue; + foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { + if (!$oAttDef->IsLinkSet()) { + continue; + } $this->m_aCurrValues[$sAttCode] = $oAttDef->GetDefaultValue($this); $this->m_aOrigValues[$sAttCode] = clone $this->m_aCurrValues[$sAttCode]; @@ -442,37 +435,36 @@ abstract class DBObject implements iDisplay } $this->m_bFullyLoaded = true; - $this->m_aTouchedAtt = array(); - $this->m_aModifiedAtt = array(); + $this->m_aTouchedAtt = []; + $this->m_aModifiedAtt = []; } - /** - * Initialize the instance against a given structured array - * - * @internal - * @see GetExtendedData() extended data - * - * @param array $aRow an array under the form: ` => ` - * @param string $sClassAlias if not null, it is preprended to the `` part of $aRow - * @param null|array $aAttToLoad List of attribute that will be fetched against the database anyway - * @param null|array $aExtendedDataSpec List of attribute that will be marked as DBObject::GetExtendedData() - * - * @return bool - * @throws CoreException - */ + /** + * Initialize the instance against a given structured array + * + * @internal + * @see GetExtendedData() extended data + * + * @param array $aRow an array under the form: ` => ` + * @param string $sClassAlias if not null, it is preprended to the `` part of $aRow + * @param null|array $aAttToLoad List of attribute that will be fetched against the database anyway + * @param null|array $aExtendedDataSpec List of attribute that will be marked as DBObject::GetExtendedData() + * + * @return bool + * @throws CoreException + */ protected function FromRow($aRow, $sClassAlias = '', $aAttToLoad = null, $aExtendedDataSpec = null) { - if (strlen($sClassAlias) == 0) - { + if (strlen($sClassAlias) == 0) { // Default to the current class $sClassAlias = get_class($this); } $this->m_iKey = null; $this->m_bIsInDB = true; - $this->m_aCurrValues = array(); - $this->m_aOrigValues = array(); - $this->m_aLoadedAtt = array(); + $this->m_aCurrValues = []; + $this->m_aOrigValues = []; + $this->m_aLoadedAtt = []; $this->m_bCheckStatus = true; $this->m_aCheckIssues = []; $this->m_bSecurityIssue = []; @@ -480,21 +472,16 @@ abstract class DBObject implements iDisplay // Get the key // $sKeyField = $sClassAlias."id"; - if (!array_key_exists($sKeyField, $aRow)) - { + if (!array_key_exists($sKeyField, $aRow)) { // #@# Bug ? throw new CoreException("Missing key for class '".get_class($this)."'"); } $iPKey = $aRow[$sKeyField]; - if (!self::IsValidPKey($iPKey)) - { - if (is_null($iPKey)) - { + if (!self::IsValidPKey($iPKey)) { + if (is_null($iPKey)) { throw new CoreException("Missing object id in query result (found null)"); - } - else - { + } else { throw new CoreException("An object id must be an integer value ($iPKey)"); } } @@ -503,27 +490,26 @@ abstract class DBObject implements iDisplay // Build the object from an array of "attCode"=>"value") // $bFullyLoaded = true; // ... set to false if any attribute is not found - if (is_null($aAttToLoad) || !array_key_exists($sClassAlias, $aAttToLoad)) - { + if (is_null($aAttToLoad) || !array_key_exists($sClassAlias, $aAttToLoad)) { $aAttList = MetaModel::ListAttributeDefs(get_class($this)); - } - else - { + } else { $aAttList = $aAttToLoad[$sClassAlias]; } - - foreach($aAttList as $sAttCode=>$oAttDef) - { + + foreach ($aAttList as $sAttCode => $oAttDef) { // Skip links (could not be loaded by the mean of this query) /** @var \AttributeDefinition $oAttDef */ - if ($oAttDef->IsLinkSet()) continue; + if ($oAttDef->IsLinkSet()) { + continue; + } - if (!$oAttDef->LoadInObject()) continue; + if (!$oAttDef->LoadInObject()) { + continue; + } unset($value); $bIsDefined = false; - if ($oAttDef->LoadFromClassTables()) - { + if ($oAttDef->LoadFromClassTables()) { // Note: we assume that, for a given attribute, if it can be loaded, // then one column will be found with an empty suffix, the others have a suffix // Take care: the function isset will return false in case the value is null, @@ -540,46 +526,34 @@ abstract class DBObject implements iDisplay } } - if (!$bIsDefined && array_key_exists($sAttRef, $aRow)) - { + if (!$bIsDefined && array_key_exists($sAttRef, $aRow)) { $value = $oAttDef->FromSQLToValue($aRow, $sAttRef); $bIsDefined = true; } - } - else - { + } else { $value = $oAttDef->ReadExternalValues($this); $bIsDefined = true; } - if ($bIsDefined) - { + if ($bIsDefined) { $this->m_aCurrValues[$sAttCode] = $value; - if (is_object($value)) - { + if (is_object($value)) { $this->m_aOrigValues[$sAttCode] = clone $value; - } - else - { + } else { $this->m_aOrigValues[$sAttCode] = $value; } $this->m_aLoadedAtt[$sAttCode] = true; - } - else - { + } else { // This attribute was expected and not found in the query columns $bFullyLoaded = false; } } - + // Load extended data - if ($aExtendedDataSpec != null) - { - foreach($aExtendedDataSpec['fields'] as $sColumn) - { + if ($aExtendedDataSpec != null) { + foreach ($aExtendedDataSpec['fields'] as $sColumn) { $sColRef = $sClassAlias.'_extdata_'.$sColumn; - if (array_key_exists($sColRef, $aRow)) - { + if (array_key_exists($sColRef, $aRow)) { $this->m_aExtendedData[$sColumn] = $aRow[$sColRef]; } } @@ -587,18 +561,18 @@ abstract class DBObject implements iDisplay return $bFullyLoaded; } - /** - * Protected raw Setter - * - * This method is an internal plumbing : it sets the value without doing any of the required processes. - * The exposed API Setter is DBObject::Set() - * - * @internal - * @see Set() - * - * @param string $sAttCode - * @param mixed $value - */ + /** + * Protected raw Setter + * + * This method is an internal plumbing : it sets the value without doing any of the required processes. + * The exposed API Setter is DBObject::Set() + * + * @internal + * @see Set() + * + * @param string $sAttCode + * @param mixed $value + */ protected function _Set($sAttCode, $value) { $this->m_aCurrValues[$sAttCode] = $value; @@ -606,25 +580,24 @@ abstract class DBObject implements iDisplay unset($this->m_aModifiedAtt[$sAttCode]); } - - /** - * Attributes setter - * - * Set $sAttCode to $value. - * The value must be valid according to the type of attribute : see the different {@see AttributeDefinition::MakeRealValue()} implementations - * The value will not be recorded into the DB until DBObject::DBWrite() is called. - * - * @api - * - * @param string $sAttCode - * @param mixed $value - * - * @return bool - * @throws CoreException - * @throws CoreUnexpectedValue - * - * @see DBWrite() - */ + /** + * Attributes setter + * + * Set $sAttCode to $value. + * The value must be valid according to the type of attribute : see the different {@see AttributeDefinition::MakeRealValue()} implementations + * The value will not be recorded into the DB until DBObject::DBWrite() is called. + * + * @api + * + * @param string $sAttCode + * @param mixed $value + * + * @return bool + * @throws CoreException + * @throws CoreUnexpectedValue + * + * @see DBWrite() + */ public function Set($sAttCode, $value) { if (!utils::StartsWith(get_class($this), 'CMDBChange') && $this->GetKey() > 0) { @@ -678,8 +651,7 @@ abstract class DBObject implements iDisplay /** @var \DBObject $value */ $this->m_aCurrValues[$sCode] = $value->Get($oDef->GetExtAttCode()); $this->m_aLoadedAtt[$sCode] = true; - } - elseif ($oDef->IsBasedOnOQLExpression()) { + } elseif ($oDef->IsBasedOnOQLExpression()) { $this->m_aCurrValues[$sCode] = $this->GetDefaultValue($sCode); unset($this->m_aLoadedAtt[$sCode]); } @@ -706,7 +678,7 @@ abstract class DBObject implements iDisplay } $this->_Set($sAttCode, $realvalue); - $this->UpdateMetaAttributes(array($sAttCode)); + $this->UpdateMetaAttributes([$sAttCode]); // The object has changed, reset caches $this->m_bCheckStatus = null; @@ -719,13 +691,13 @@ abstract class DBObject implements iDisplay } /** - * Helper to set a value only if it is currently undefined - * - * Call Set() only of the internal representation of the attribute is null. - * - * @api - * @see Set() - * + * Helper to set a value only if it is currently undefined + * + * Call Set() only of the internal representation of the attribute is null. + * + * @api + * @see Set() + * * @param string $sAttCode * @param mixed $value * @@ -738,26 +710,25 @@ abstract class DBObject implements iDisplay { $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); $oCurrentValue = $this->Get($sAttCode); - if ($oAttDef->IsNull($oCurrentValue)) - { + if ($oAttDef->IsNull($oCurrentValue)) { $this->Set($sAttCode, $value); } } - /** - * Helper to set a value that fits the attribute max size - * - * compare $sValue against the field's max size in the database, and truncate it's ending in order to make it fit. - * If $sValue is short enough, nothing is done. - * - * @api - * - * @param string $sAttCode - * @param string $sValue - * - * @throws CoreException - * @throws CoreUnexpectedValue - */ + /** + * Helper to set a value that fits the attribute max size + * + * compare $sValue against the field's max size in the database, and truncate it's ending in order to make it fit. + * If $sValue is short enough, nothing is done. + * + * @api + * + * @param string $sAttCode + * @param string $sValue + * + * @throws CoreException + * @throws CoreUnexpectedValue + */ public function SetTrim($sAttCode, $sValue) { $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); @@ -787,20 +758,21 @@ abstract class DBObject implements iDisplay // Activate any existing trigger $sClass = get_class($this); - $aParams = array('class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL)); - $oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnObjectDelete AS t WHERE t.target_class IN (:class_list)'), array(), - $aParams); + $aParams = ['class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL)]; + $oSet = new DBObjectSet( + DBObjectSearch::FromOQL('SELECT TriggerOnObjectDelete AS t WHERE t.target_class IN (:class_list)'), + [], + $aParams + ); while ($oTrigger = $oSet->Fetch()) { /** @var \TriggerOnObjectDelete $oTrigger */ try { $oKPI = new ExecutionKPI(); $oTrigger->DoActivate($this->ToArgs('this')); - } - catch (Exception $e) { + } catch (Exception $e) { $oTrigger->LogException($e, $this); utils::EnrichRaisedException($oTrigger, $e); - } - finally { + } finally { $oKPI->ComputeStatsForExtension($this, 'TriggerOnObjectDelete'); } } @@ -849,18 +821,18 @@ abstract class DBObject implements iDisplay } /** - * Get the label of an attribute. - * - * Shortcut to the field's AttributeDefinition->GetLabel() - * - * @api - * - * @param string $sAttCode - * - * @return string - * - * @throws Exception - */ + * Get the label of an attribute. + * + * Shortcut to the field's AttributeDefinition->GetLabel() + * + * @api + * + * @param string $sAttCode + * + * @return string + * + * @throws Exception + */ public function GetLabel($sAttCode) { $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); @@ -885,55 +857,45 @@ abstract class DBObject implements iDisplay */ public function Get($sAttCode) { - if (($iPos = strpos($sAttCode, '->')) === false) - { + if (($iPos = strpos($sAttCode, '->')) === false) { return $this->GetStrict($sAttCode); - } - else - { + } else { $sExtKeyAttCode = substr($sAttCode, 0, $iPos); $sRemoteAttCode = substr($sAttCode, $iPos + 2); - if (!MetaModel::IsValidAttCode(get_class($this), $sExtKeyAttCode)) - { + if (!MetaModel::IsValidAttCode(get_class($this), $sExtKeyAttCode)) { throw new CoreException("Unknown external key '$sExtKeyAttCode' for the class ".get_class($this)); } $oExtFieldAtt = MetaModel::FindExternalField(get_class($this), $sExtKeyAttCode, $sRemoteAttCode); - if (!is_null($oExtFieldAtt)) - { + if (!is_null($oExtFieldAtt)) { /** @var \AttributeExternalField $oExtFieldAtt */ return $this->GetStrict($oExtFieldAtt->GetCode()); - } - else - { + } else { $oKeyAttDef = MetaModel::GetAttributeDef(get_class($this), $sExtKeyAttCode); /** @var \AttributeExternalKey $oKeyAttDef */ $sRemoteClass = $oKeyAttDef->GetTargetClass(); $oRemoteObj = MetaModel::GetObject($sRemoteClass, $this->GetStrict($sExtKeyAttCode), false); - if (is_null($oRemoteObj)) - { + if (is_null($oRemoteObj)) { return ''; - } - else - { + } else { return $oRemoteObj->Get($sRemoteAttCode); } } } } - /** - * Getter : get values from the current object - * - * @internal - * @see Get - * - * @param string $sAttCode - * - * @return int|mixed|null - * @throws ArchivedObjectException - * @throws CoreException - */ + /** + * Getter : get values from the current object + * + * @internal + * @see Get + * + * @param string $sAttCode + * + * @return int|mixed|null + * @throws ArchivedObjectException + * @throws CoreException + */ public function GetStrict($sAttCode) { if ($sAttCode == 'id') { @@ -963,8 +925,7 @@ abstract class DBObject implements iDisplay /** @var \AttributeExternalField $oAttDef */ $sExtKeyAttCode = $oAttDef->GetKeyAttCode(); - if (($iRemote = $this->Get($sExtKeyAttCode)) && ($iRemote > 0)) // Objects in memory have negative IDs - { + if (($iRemote = $this->Get($sExtKeyAttCode)) && ($iRemote > 0)) { // Objects in memory have negative IDs $oExtKeyAttDef = MetaModel::GetAttributeDef(get_class($this), $sExtKeyAttCode); // Note: "allow all data" must be enabled because the external fields are always visible // to the current user even if this is not the case for the remote object @@ -992,7 +953,6 @@ abstract class DBObject implements iDisplay $value = $this->m_aCurrValues[$sAttCode]; } - if ($value instanceof ormLinkSet) { $value->Rewind(); } @@ -1000,23 +960,22 @@ abstract class DBObject implements iDisplay return $value; } - /** - * @see \DBObject::ListPreviousValuesForUpdatedAttributes() to get previous values anywhere in the CRUD stack - * @see https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Asequence_crud iTop CRUD stack documentation - * - * @param string $sAttCode - * - * @return mixed|null the value as it was before changed with {@see DBObject::Set()}. - * Returns null if the attribute wasn't changed. - * Values are reset during {@see DBObject::DBUpdate()} - * - * @throws CoreException if the attribute is unknown for the current object - * @uses DBObject::$m_aOrigValues - */ + /** + * @see \DBObject::ListPreviousValuesForUpdatedAttributes() to get previous values anywhere in the CRUD stack + * @see https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Asequence_crud iTop CRUD stack documentation + * + * @param string $sAttCode + * + * @return mixed|null the value as it was before changed with {@see DBObject::Set()}. + * Returns null if the attribute wasn't changed. + * Values are reset during {@see DBObject::DBUpdate()} + * + * @throws CoreException if the attribute is unknown for the current object + * @uses DBObject::$m_aOrigValues + */ public function GetOriginal($sAttCode) { - if (!array_key_exists($sAttCode, MetaModel::ListAttributeDefs(get_class($this)))) - { + if (!array_key_exists($sAttCode, MetaModel::ListAttributeDefs(get_class($this)))) { throw new CoreException("Unknown attribute code '$sAttCode' for the class ".get_class($this)); } $aOrigValues = $this->m_aOrigValues; @@ -1028,46 +987,46 @@ abstract class DBObject implements iDisplay return $this->m_aCurrValues; } - /** - * Returns the default value of the $sAttCode. - * - * Returns the default value of the given attribute. - * - * @internal - * - * @param string $sAttCode - * - * @return mixed - * - * @throws Exception - */ + /** + * Returns the default value of the $sAttCode. + * + * Returns the default value of the given attribute. + * + * @internal + * + * @param string $sAttCode + * + * @return mixed + * + * @throws Exception + */ public function GetDefaultValue($sAttCode) - { - $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); - return $oAttDef->GetDefaultValue($this); - } + { + $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); + return $oAttDef->GetDefaultValue($this); + } /** * Returns data loaded by the mean of a dynamic and explicit JOIN - * - * @internal - * - * @return array|null - */ + * + * @internal + * + * @return array|null + */ public function GetExtendedData() { return $this->m_aExtendedData; } - + /** - * Set the HighlightCode - * - * Switch to $sCode if it has a greater rank than the current code - * - * @internal - * @used-by DBObject::ComputeHighlightCode() - * @see m_sHighlightCode - * + * Set the HighlightCode + * + * Switch to $sCode if it has a greater rank than the current code + * + * @internal + * @used-by DBObject::ComputeHighlightCode() + * @see m_sHighlightCode + * * @param string $sCode * * @return void @@ -1076,27 +1035,24 @@ abstract class DBObject implements iDisplay { $aHighlightScale = MetaModel::GetHighlightScale(get_class($this)); $fCurrentRank = 0.0; - if (($this->m_sHighlightCode !== null) && array_key_exists($this->m_sHighlightCode, $aHighlightScale)) - { + if (($this->m_sHighlightCode !== null) && array_key_exists($this->m_sHighlightCode, $aHighlightScale)) { $fCurrentRank = $aHighlightScale[$this->m_sHighlightCode]['rank']; } - - if (array_key_exists($sCode, $aHighlightScale)) - { + + if (array_key_exists($sCode, $aHighlightScale)) { $fRank = $aHighlightScale[$sCode]['rank']; - if ($fRank > $fCurrentRank) - { + if ($fRank > $fCurrentRank) { $this->m_sHighlightCode = $sCode; } } } - + /** * Get the current HighlightCode - * - * @internal - * @used-by DBObject::ComputeHighlightCode() - * + * + * @internal + * @used-by DBObject::ComputeHighlightCode() + * * @return string|null The Hightlight code (null if none set, meaning rank = 0) */ protected function GetHighlightCode() @@ -1104,35 +1060,31 @@ abstract class DBObject implements iDisplay return $this->m_sHighlightCode; } - /** - * Compute the highlightCode - * - * @internal - * - * @example When TTR, then TTR of a UserRequest is greater thant a defined scale, the item is highlighted in the listings - * - * @return string|null The Hightlight code (null if none set, meaning rank = 0) - * - * @throws ArchivedObjectException - * @throws CoreException - */ + /** + * Compute the highlightCode + * + * @internal + * + * @example When TTR, then TTR of a UserRequest is greater thant a defined scale, the item is highlighted in the listings + * + * @return string|null The Hightlight code (null if none set, meaning rank = 0) + * + * @throws ArchivedObjectException + * @throws CoreException + */ protected function ComputeHighlightCode() { - if (MetaModel::HasLifecycle(get_class($this))) - { + if (MetaModel::HasLifecycle(get_class($this))) { $sState = $this->GetState(); $sCode = MetaModel::GetHighlightCode(get_class($this), $sState); $this->SetHighlightCode($sCode); } // The check for each StopWatch if a HighlightCode is effective - foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) - { - if ($oAttDef instanceof AttributeStopWatch) - { + foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { + if ($oAttDef instanceof AttributeStopWatch) { $oStopWatch = $this->Get($sAttCode); $sCode = $oStopWatch->GetHighlightCode(); - if ($sCode !== '') - { + if ($sCode !== '') { $this->SetHighlightCode($sCode); } } @@ -1140,28 +1092,27 @@ abstract class DBObject implements iDisplay return $this->GetHighlightCode(); } - /** - * Updates the value of an external field by (re)loading the object - * corresponding to the external key and getting the value from it - * - * UNUSED ? - * - * @internal - * @todo: check if this is dead code. - * - * @param string $sAttCode Attribute code of the external field to update - * - * @return void - * - * @throws ArchivedObjectException - * @throws CoreException - * @throws CoreUnexpectedValue - */ + /** + * Updates the value of an external field by (re)loading the object + * corresponding to the external key and getting the value from it + * + * UNUSED ? + * + * @internal + * @todo: check if this is dead code. + * + * @param string $sAttCode Attribute code of the external field to update + * + * @return void + * + * @throws ArchivedObjectException + * @throws CoreException + * @throws CoreUnexpectedValue + */ protected function UpdateExternalField($sAttCode) { $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); - if ($oAttDef->IsExternalField()) - { + if ($oAttDef->IsExternalField()) { /** @var \AttributeExternalField $oAttDef */ $sTargetClass = $oAttDef->GetTargetClass(); $objkey = $this->Get($oAttDef->GetKeyAttCode()); @@ -1169,8 +1120,7 @@ abstract class DBObject implements iDisplay // to the current user even if this is not the case for the remote object // This is consistent with the behavior of the lists $oObj = MetaModel::GetObject($sTargetClass, $objkey, true, true); - if (is_object($oObj)) - { + if (is_object($oObj)) { $value = $oObj->Get($oAttDef->GetExtAttCode()); $this->Set($sAttCode, $value); } @@ -1179,9 +1129,9 @@ abstract class DBObject implements iDisplay /** * Overridable callback - * + * * @internal this method is elligible to the "overwritable-hook" tag. But it is willingly excluded. - * @used-by DoComputeValues() + * @used-by DoComputeValues() */ public function ComputeValues() { @@ -1201,11 +1151,16 @@ abstract class DBObject implements iDisplay // First check that we are not currently computing the fields // (yes, we need to do some things like Set/Get to compute the fields which will in turn trigger the update...) - foreach (debug_backtrace() as $aCallInfo) - { - if (!array_key_exists("class", $aCallInfo)) continue; - if ($aCallInfo["class"] != get_class($this)) continue; - if ($aCallInfo["function"] != "ComputeValues") continue; + foreach (debug_backtrace() as $aCallInfo) { + if (!array_key_exists("class", $aCallInfo)) { + continue; + } + if ($aCallInfo["class"] != get_class($this)) { + continue; + } + if ($aCallInfo["function"] != "ComputeValues") { + continue; + } return; //skip! } $this->FireEventComputeValues($this->sStimulusBeingApplied); @@ -1214,40 +1169,36 @@ abstract class DBObject implements iDisplay $oKPI->ComputeStatsForExtension($this, 'ComputeValues'); } - /** - * @api - * - * @param string $sAttCode - * @param bool $bLocalize - * - * @return string $sAttCode formatted as HTML for the console details forms (when viewing, not when editing !) - * The returned string is already escaped, and as such is protected against XSS - * The markup relies on a few assumptions (CSS) that could change without notice - * - * @throws ArchivedObjectException - * @throws CoreException - * @throws DictExceptionMissingString - * - * @see \Combodo\iTop\Form\Field\Field for rendering in portal forms - */ + /** + * @api + * + * @param string $sAttCode + * @param bool $bLocalize + * + * @return string $sAttCode formatted as HTML for the console details forms (when viewing, not when editing !) + * The returned string is already escaped, and as such is protected against XSS + * The markup relies on a few assumptions (CSS) that could change without notice + * + * @throws ArchivedObjectException + * @throws CoreException + * @throws DictExceptionMissingString + * + * @see \Combodo\iTop\Form\Field\Field for rendering in portal forms + */ public function GetAsHTML($sAttCode, $bLocalize = true) { $sClass = get_class($this); $oAtt = MetaModel::GetAttributeDef($sClass, $sAttCode); - if ($oAtt->IsExternalKey(EXTKEY_ABSOLUTE)) - { + if ($oAtt->IsExternalKey(EXTKEY_ABSOLUTE)) { //return $this->Get($sAttCode.'_friendlyname'); /** @var \AttributeExternalKey $oAtt */ $sTargetClass = $oAtt->GetTargetClass(EXTKEY_ABSOLUTE); $iTargetKey = $this->Get($sAttCode); - if ($iTargetKey < 0) - { + if ($iTargetKey < 0) { // the key points to an object that exists only in memory... no hyperlink points to it yet return ''; - } - else - { + } else { $sHtmlLabel = utils::EscapeHtml($this->Get($sAttCode.'_friendlyname')); $bArchived = $this->IsArchived($sAttCode); $bObsolete = $this->IsObsolete($sAttCode); @@ -1260,183 +1211,175 @@ abstract class DBObject implements iDisplay return $oAtt->GetAsHTML($this->Get($sAttCode), $this, $bLocalize); } - /** - * Get the value as it must be in the edit areas (forms) - * - * Makes a raw text representation of the value. - * - * @internal - * - * @param string $sAttCode - * - * @return int|mixed|string - * - * @throws ArchivedObjectException - * @throws CoreException - */ + /** + * Get the value as it must be in the edit areas (forms) + * + * Makes a raw text representation of the value. + * + * @internal + * + * @param string $sAttCode + * + * @return int|mixed|string + * + * @throws ArchivedObjectException + * @throws CoreException + */ public function GetEditValue($sAttCode) { $sClass = get_class($this); $oAtt = MetaModel::GetAttributeDef($sClass, $sAttCode); - if ($oAtt->IsExternalKey()) - { + if ($oAtt->IsExternalKey()) { /** @var \AttributeExternalKey $oAtt */ $sTargetClass = $oAtt->GetTargetClass(); - if ($this->IsNew()) - { + if ($this->IsNew()) { // The current object exists only in memory, don't try to query it in the DB ! // instead let's query for the object pointed by the external key, and get its name $targetObjId = $this->Get($sAttCode); $oTargetObj = MetaModel::GetObject($sTargetClass, $targetObjId, false); // false => not sure it exists - if (is_object($oTargetObj)) - { + if (is_object($oTargetObj)) { $sEditValue = $oTargetObj->GetName(); - } - else - { + } else { $sEditValue = 0; - } - } - else - { + } + } else { $sEditValue = $this->Get($sAttCode.'_friendlyname'); } - } - else - { + } else { $sEditValue = $oAtt->GetEditValue($this->Get($sAttCode), $this); } return $sEditValue; } - /** - * Get $sAttCode formatted as XML - * - * The returned value is a text that is suitable for insertion into an XML node. - * Depending on the type of attribute, the returned text is either: - * * A literal, with XML entities already escaped, - * * XML - * - * @api - * - * @param string $sAttCode - * @param bool $bLocalize - * - * @return mixed - * - * @throws ArchivedObjectException - * @throws CoreException - */ + /** + * Get $sAttCode formatted as XML + * + * The returned value is a text that is suitable for insertion into an XML node. + * Depending on the type of attribute, the returned text is either: + * * A literal, with XML entities already escaped, + * * XML + * + * @api + * + * @param string $sAttCode + * @param bool $bLocalize + * + * @return mixed + * + * @throws ArchivedObjectException + * @throws CoreException + */ public function GetAsXML($sAttCode, $bLocalize = true) { $oAtt = MetaModel::GetAttributeDef(get_class($this), $sAttCode); return $oAtt->GetAsXML($this->Get($sAttCode), $this, $bLocalize); } - /** - * Get $sAttCode formatted as CSV - * - * @api - * - * @param string $sAttCode - * @param string $sSeparator - * @param string $sTextQualifier - * @param bool $bLocalize - * @param bool $bConvertToPlainText - * - * @return string - * - * @throws ArchivedObjectException - * @throws CoreException - */ + /** + * Get $sAttCode formatted as CSV + * + * @api + * + * @param string $sAttCode + * @param string $sSeparator + * @param string $sTextQualifier + * @param bool $bLocalize + * @param bool $bConvertToPlainText + * + * @return string + * + * @throws ArchivedObjectException + * @throws CoreException + */ public function GetAsCSV($sAttCode, $sSeparator = ',', $sTextQualifier = '"', $bLocalize = true, $bConvertToPlainText = false) { $oAtt = MetaModel::GetAttributeDef(get_class($this), $sAttCode); return $oAtt->GetAsCSV($this->Get($sAttCode), $sSeparator, $sTextQualifier, $this, $bLocalize, $bConvertToPlainText); } - /** - * - * @see GetAsHTML() - * @see GetOriginal() - * - * @param string $sAttCode - * @param bool $bLocalize - * - * @return string - * @throws CoreException - */ + /** + * + * @see GetAsHTML() + * @see GetOriginal() + * + * @param string $sAttCode + * @param bool $bLocalize + * + * @return string + * @throws CoreException + */ public function GetOriginalAsHTML($sAttCode, $bLocalize = true) { $oAtt = MetaModel::GetAttributeDef(get_class($this), $sAttCode); return $oAtt->GetAsHTML($this->GetOriginal($sAttCode), $this, $bLocalize); } - /** - * - * @see GetAsXML() - * @see GetOriginal() - * - * @param string $sAttCode - * @param bool $bLocalize - * - * @return mixed - * @throws CoreException - */ + /** + * + * @see GetAsXML() + * @see GetOriginal() + * + * @param string $sAttCode + * @param bool $bLocalize + * + * @return mixed + * @throws CoreException + */ public function GetOriginalAsXML($sAttCode, $bLocalize = true) { $oAtt = MetaModel::GetAttributeDef(get_class($this), $sAttCode); return $oAtt->GetAsXML($this->GetOriginal($sAttCode), $this, $bLocalize); } - /** - * - * @see GetAsCSV() - * @see GetOriginal() - * - * @param string $sAttCode - * @param string $sSeparator - * @param string $sTextQualifier - * @param bool $bLocalize - * @param bool $bConvertToPlainText - * - * @return string - * @throws CoreException - */ + /** + * + * @see GetAsCSV() + * @see GetOriginal() + * + * @param string $sAttCode + * @param string $sSeparator + * @param string $sTextQualifier + * @param bool $bLocalize + * @param bool $bConvertToPlainText + * + * @return string + * @throws CoreException + */ public function GetOriginalAsCSV($sAttCode, $sSeparator = ',', $sTextQualifier = '"', $bLocalize = true, $bConvertToPlainText = false) { $oAtt = MetaModel::GetAttributeDef(get_class($this), $sAttCode); return $oAtt->GetAsCSV($this->GetOriginal($sAttCode), $sSeparator, $sTextQualifier, $this, $bLocalize, $bConvertToPlainText); } - /** - * Return an hyperlink pointing to <$sObjClass, $sObjKey> - * - * @internal - * - * @param string $sObjClass - * @param string $sObjKey - * @param string $sHtmlLabel Label with HTML entities escaped (< escaped as <) - * @param null|string $sUrlMakerClass if not null, the class must expose a public method ''MakeObjectUrl(string $sObjClass, string $sObjKey)'' - * @param bool $bWithNavigationContext - * @param bool $bArchived - * @param bool $bObsolete - * - * @return string the HTML markup pointing to <$sObjClass, $sObjKey> - * - * @throws \ArchivedObjectException - * @throws \CoreException - * @throws \DictExceptionMissingString - */ + /** + * Return an hyperlink pointing to <$sObjClass, $sObjKey> + * + * @internal + * + * @param string $sObjClass + * @param string $sObjKey + * @param string $sHtmlLabel Label with HTML entities escaped (< escaped as <) + * @param null|string $sUrlMakerClass if not null, the class must expose a public method ''MakeObjectUrl(string $sObjClass, string $sObjKey)'' + * @param bool $bWithNavigationContext + * @param bool $bArchived + * @param bool $bObsolete + * + * @return string the HTML markup pointing to <$sObjClass, $sObjKey> + * + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \DictExceptionMissingString + */ public static function MakeHyperLink($sObjClass, $sObjKey, $sHtmlLabel = '', $sUrlMakerClass = null, $bWithNavigationContext = true, $bArchived = false, $bObsolete = false, $bIgnorePreview = false) { - if ($sObjKey <= 0) return ''.Dict::S('UI:UndefinedObject').''; // Objects built in memory have negative IDs + if ($sObjKey <= 0) { + return ''.Dict::S('UI:UndefinedObject').''; + } // Objects built in memory have negative IDs // Safety net // - if (empty($sHtmlLabel)) - { + if (empty($sHtmlLabel)) { // If the object if not issued from a query but constructed programmatically // the label may be empty. In this case run a query to get the object's friendly name $sObjOql = 'SELECT '.$sObjClass.' WHERE id='.$sObjKey; @@ -1461,29 +1404,21 @@ abstract class DBObject implements iDisplay $sUrl = ApplicationContext::MakeObjectUrl($sObjClass, $sObjKey, $sUrlMakerClass, $bWithNavigationContext); $bClickable = !$bArchived || utils::IsArchiveMode(); - if ($bArchived) - { + if ($bArchived) { $sSpanClass = 'archived'; $sFA = 'fa-archive object-archived'; $sHint = Dict::S('ObjectRef:Archived'); - } - elseif ($bObsolete) - { + } elseif ($bObsolete) { $sSpanClass = 'obsolete'; $sFA = 'fa-eye-slash object-obsolete'; $sHint = Dict::S('ObjectRef:Obsolete'); - } - else - { + } else { $sSpanClass = ''; $sFA = ''; } - if ($sFA == '') - { + if ($sFA == '') { $sIcon = ''; - } - else - { + } else { if ($bClickable) { $sIcon = ""; } else { @@ -1491,63 +1426,57 @@ abstract class DBObject implements iDisplay } } - if ($bClickable && (strlen($sUrl) > 0)) - { + if ($bClickable && (strlen($sUrl) > 0)) { $sHLink = "$sIcon$sHtmlLabel"; - } - else - { + } else { $sHLink = $sIcon.$sHtmlLabel; } $sPreview = ''; - if(SummaryCardService::IsAllowedForClass($sObjClass) && $bIgnorePreview === false){ + if (SummaryCardService::IsAllowedForClass($sObjClass) && $bIgnorePreview === false) { $sPreview = SummaryCardService::GetHyperlinkMarkup($sObjClass, $sObjKey); } $sRet = "$sHLink"; return $sRet; } - /** - * Return an hyperlink pointing to the current DBObject - * - * @api - * - * @param string $sUrlMakerClass - * @param bool $bWithNavigationContext - * @param string $sLabel - * - * @return string - * - * @throws ArchivedObjectException - * @throws CoreException - * @throws DictExceptionMissingString - */ + /** + * Return an hyperlink pointing to the current DBObject + * + * @api + * + * @param string $sUrlMakerClass + * @param bool $bWithNavigationContext + * @param string $sLabel + * + * @return string + * + * @throws ArchivedObjectException + * @throws CoreException + * @throws DictExceptionMissingString + */ public function GetHyperlink($sUrlMakerClass = null, $bWithNavigationContext = true, $sLabel = null, $bIgnorePreview = false) { - if($sLabel === null) - { - $sLabel = $this->GetName(); - } + if ($sLabel === null) { + $sLabel = $this->GetName(); + } $bArchived = $this->IsArchived(); $bObsolete = $this->IsObsolete(); return self::MakeHyperLink(get_class($this), $this->GetKey(), $sLabel, $sUrlMakerClass, $bWithNavigationContext, $bArchived, $bObsolete, $bIgnorePreview); } - /** - * @internal - * - * @param string $sClass - * - * @return mixed - */ + /** + * @internal + * + * @param string $sClass + * + * @return mixed + */ public static function ComputeStandardUIPage($sClass) { - static $aUIPagesCache = array(); // Cache to store the php page used to display each class of object - if (!isset($aUIPagesCache[$sClass])) - { + static $aUIPagesCache = []; // Cache to store the php page used to display each class of object + if (!isset($aUIPagesCache[$sClass])) { $UIPage = false; - if (is_callable("$sClass::GetUIPage")) - { + if (is_callable("$sClass::GetUIPage")) { $UIPage = eval("return $sClass::GetUIPage();"); // May return false in case of error } $aUIPagesCache[$sClass] = $UIPage === false ? './UI.php' : $UIPage; @@ -1556,93 +1485,87 @@ abstract class DBObject implements iDisplay return $sPage; } - /** - * @internal - * - * @return string - */ + /** + * @internal + * + * @return string + */ public static function GetUIPage() { return 'UI.php'; } - - - - /** - * Whether $value is valid as a primary key - * - * @internal - * - * @param string $value - * - * @return bool - */ + /** + * Whether $value is valid as a primary key + * + * @internal + * + * @param string $value + * + * @return bool + */ public static function IsValidPKey($value) { - // this function could be in the metamodel ? + // this function could be in the metamodel ? return ((string)$value === (string)(int)$value); } - /** - * Primary key Getter - * - * Get the id - * - * @api - * - * @return string|null - */ + /** + * Primary key Getter + * + * Get the id + * + * @api + * + * @return string|null + */ public function GetKey() { return $this->m_iKey; } - /** - * Primary key Setter - * Usable only for not yet persisted DBObjects - * - * @internal - * - * @param int $iNewKey the desired identifier - * - * @throws CoreException - */ + /** + * Primary key Setter + * Usable only for not yet persisted DBObjects + * + * @internal + * + * @param int $iNewKey the desired identifier + * + * @throws CoreException + */ public function SetKey($iNewKey) { - if (!self::IsValidPKey($iNewKey)) - { + if (!self::IsValidPKey($iNewKey)) { throw new CoreException("An object id must be an integer value ($iNewKey)"); } - - if ($this->m_bIsInDB && !empty($this->m_iKey) && ($this->m_iKey != $iNewKey)) - { + + if ($this->m_bIsInDB && !empty($this->m_iKey) && ($this->m_iKey != $iNewKey)) { throw new CoreException("Changing the key ({$this->m_iKey} to $iNewKey) on an object (class {".get_class($this).") wich already exists in the Database"); } $this->m_iKey = $iNewKey; } - /** - * Get the icon representing this object - * - * @api - * - * @param boolean $bImgTag If true the result is a full IMG tag (or an empty string if no icon is defined) - * - * @return string Either the full IMG tag ($bImgTag == true) or just the URL to the icon file - * @throws ArchivedObjectException - * @throws CoreException - */ + /** + * Get the icon representing this object + * + * @api + * + * @param boolean $bImgTag If true the result is a full IMG tag (or an empty string if no icon is defined) + * + * @return string Either the full IMG tag ($bImgTag == true) or just the URL to the icon file + * @throws ArchivedObjectException + * @throws CoreException + */ public function GetIcon($bImgTag = true) { $sClass = get_class($this); - if($this->HasHighlightIcon()) { + if ($this->HasHighlightIcon()) { $sIconUrl = MetaModel::GetHighlightScale($sClass)[$this->ComputeHighlightCode()]['icon']; - if($bImgTag) { + if ($bImgTag) { return ""; - } - else { + } else { return $sIconUrl; } } @@ -1651,10 +1574,9 @@ abstract class DBObject implements iDisplay $sImageAttCode = MetaModel::GetImageAttributeCode($sClass); $sIconUrl = $this->HasInstanceIcon() ? $this->Get($sImageAttCode)->GetDisplayURL($sClass, $this->GetKey(), $sImageAttCode) : ''; if (strlen($sIconUrl) > 0) { - if($bImgTag) { + if ($bImgTag) { return ""; - } - else { + } else { return $sIconUrl; } } @@ -1697,11 +1619,9 @@ abstract class DBObject implements iDisplay $sCode = $this->ComputeHighlightCode(); $sClass = get_class($this); - if($sCode != '') - { + if ($sCode != '') { $aHighlightScale = MetaModel::GetHighlightScale($sClass); - if (array_key_exists($sCode, $aHighlightScale)) - { + if (array_key_exists($sCode, $aHighlightScale)) { $bHasHighlightIcon = true; } } @@ -1713,9 +1633,9 @@ abstract class DBObject implements iDisplay * Get the label of a class * * Returns the label as defined in the dictionary for the language of the current user - * - * @api - * + * + * @api + * * @return string (empty for default name scheme) */ public static function GetClassName($sClass) @@ -1728,14 +1648,14 @@ abstract class DBObject implements iDisplay * Get the description of a class * * Returns the label as defined in the dictionary for the language of the current user - * - * @internal - * + * + * @internal + * * @param string $sClass * * @return string */ - final static public function GetClassDescription($sClass) + final public static function GetClassDescription($sClass) { $sStringCode = 'Class:'.$sClass.'+'; return Dict::S($sStringCode, ''); @@ -1780,69 +1700,60 @@ abstract class DBObject implements iDisplay } /** - * Helper to get the state - * - * @api - * + * Helper to get the state + * + * @api + * * @return mixed|string '' if no state attribute, object representing its value otherwise * @throws \CoreException */ public function GetState() { $sStateAttCode = MetaModel::GetStateAttributeCode(get_class($this)); - if (empty($sStateAttCode)) - { + if (empty($sStateAttCode)) { return ''; - } - else - { + } else { return $this->Get($sStateAttCode); } } - /** - * Get the label (raw text) of the current state - * helper for MetaModel::GetStateLabel() - * - * @api - * - * @return mixed|string - * - * @throws ArchivedObjectException - * @throws CoreException - */ + /** + * Get the label (raw text) of the current state + * helper for MetaModel::GetStateLabel() + * + * @api + * + * @return mixed|string + * + * @throws ArchivedObjectException + * @throws CoreException + */ public function GetStateLabel() { $sStateAttCode = MetaModel::GetStateAttributeCode(get_class($this)); - if (empty($sStateAttCode)) - { + if (empty($sStateAttCode)) { return ''; - } - else - { + } else { $sStateValue = $this->Get($sStateAttCode); return MetaModel::GetStateLabel(get_class($this), $sStateValue); } } - /** - * Get the description of the state - * - * @api - * - * @return mixed|string - * @throws ArchivedObjectException - * @throws CoreException - */ + /** + * Get the description of the state + * + * @api + * + * @return mixed|string + * @throws ArchivedObjectException + * @throws CoreException + */ public function GetStateDescription() { $sStateAttCode = MetaModel::GetStateAttributeCode(get_class($this)); - if (empty($sStateAttCode)) - { + if (empty($sStateAttCode)) { return ''; - } - else - { + } else { $sStateValue = $this->Get($sStateAttCode); return MetaModel::GetStateDescription(get_class($this), $sStateValue); } @@ -1852,33 +1763,32 @@ abstract class DBObject implements iDisplay * Define attributes read-only from the end-user perspective * * @return array|null List of attcodes - */ + */ public static function GetReadOnlyAttributes() { return null; } - /** * Get predefined objects - * + * * The predefined objects will be synchronized with the DB at each install/upgrade - * As soon as a class has predefined objects, then nobody can create nor delete objects - * - * @internal - * + * As soon as a class has predefined objects, then nobody can create nor delete objects + * + * @internal + * * @return array An array of id => array of attcode => php value(so-called "real value": integer, string, ormDocument, DBObjectSet, etc.) - */ + */ public static function GetPredefinedObjects() { return null; } /** - * Get the flags for the given state - * - * @overwritable-hook You can extend this method in order to provide your own logic. If you do so, rely on the parent as a fallback if you have uncovered $sAttCode - * + * Get the flags for the given state + * + * @overwritable-hook You can extend this method in order to provide your own logic. If you do so, rely on the parent as a fallback if you have uncovered $sAttCode + * * @param string $sAttCode $sAttCode The code of the attribute * @param array $aReasons To store the reasons why the attribute is read-only (info about the synchro replicas) * @param string $sTargetState The target state in which to evaluate the flags, if empty the current state will be used @@ -1886,41 +1796,34 @@ abstract class DBObject implements iDisplay * @return integer the binary combination of flags for the given attribute in the given state of the object. * Values can be one of the OPT_ATT_HIDDEN, OPT_ATT_READONLY, OPT_ATT_MANDATORY, ... (see define in metamodel.class.php) * Combine multiple values using the "|" operator, for example `OPT_ATT_READONLY | OPT_ATT_HIDDEN`. - * + * * @throws \CoreException * * @see GetInitialStateAttributeFlags for creation */ - public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '') + public function GetAttributeFlags($sAttCode, &$aReasons = [], $sTargetState = '') { $iFlags = 0; // By default (if no life cycle) no flag at all $sClass = get_class($this); $aReadOnlyAtts = $this->GetReadOnlyAttributes(); - if (($aReadOnlyAtts != null) && (in_array($sAttCode, $aReadOnlyAtts))) - { + if (($aReadOnlyAtts != null) && (in_array($sAttCode, $aReadOnlyAtts))) { return OPT_ATT_READONLY; } - if (MetaModel::HasLifecycle($sClass)) - { - if ($sTargetState != '') - { + if (MetaModel::HasLifecycle($sClass)) { + if ($sTargetState != '') { $iFlags = MetaModel::GetAttributeFlags($sClass, $sTargetState, $sAttCode); - } - else - { + } else { $sStateAttCode = MetaModel::GetStateAttributeCode($sClass); $iFlags = MetaModel::GetAttributeFlags($sClass, $this->Get($sStateAttCode), $sAttCode); } } - $aReasons = array(); + $aReasons = []; $iSynchroFlags = 0; - if ($this->InSyncScope()) - { + if ($this->InSyncScope()) { $iSynchroFlags = $this->GetSynchroReplicaFlags($sAttCode, $aReasons); - if ($iSynchroFlags & OPT_ATT_SLAVE) - { + if ($iSynchroFlags & OPT_ATT_SLAVE) { $iSynchroFlags |= OPT_ATT_READONLY; } } @@ -1928,117 +1831,113 @@ abstract class DBObject implements iDisplay return $iFlags | $iSynchroFlags | $iExtensionsFlags; // Combine both sets of flags } - /** - * Whether the attribute is read-only - * - * @internal - * - * @param string $sAttCode - * @param array $aReasons To store the reasons why the attribute is read-only (info about the synchro replicas) - * - * @return int Values can be one of the OPT_ATT_HIDDEN, OPT_ATT_READONLY, OPT_ATT_MANDATORY, ... (see define in metamodel.class.php) - * - * @throws \CoreException - */ - public function IsAttributeReadOnlyForCurrentState($sAttCode, &$aReasons = array()) + /** + * Whether the attribute is read-only + * + * @internal + * + * @param string $sAttCode + * @param array $aReasons To store the reasons why the attribute is read-only (info about the synchro replicas) + * + * @return int Values can be one of the OPT_ATT_HIDDEN, OPT_ATT_READONLY, OPT_ATT_MANDATORY, ... (see define in metamodel.class.php) + * + * @throws \CoreException + */ + public function IsAttributeReadOnlyForCurrentState($sAttCode, &$aReasons = []) { $iAttFlags = $this->GetAttributeFlags($sAttCode, $aReasons); return ($iAttFlags & OPT_ATT_READONLY); } - /** - * Returns the set of flags (OPT_ATT_HIDDEN, OPT_ATT_READONLY, OPT_ATT_MANDATORY...) - * for the given attribute in a transition - * - * @internal - * - * @param string $sAttCode $sAttCode The code of the attribute - * @param string $sStimulus The stimulus code to apply - * @param array|null $aReasons To store the reasons why the attribute is read-only (info about the synchro replicas) - * @param string $sOriginState The state from which to apply $sStimulus, if empty current state will be used - * - * @return integer Flags: the binary combination of the flags applicable to this attribute - * @throws ArchivedObjectException - * @throws CoreException - */ - public function GetTransitionFlags($sAttCode, $sStimulus, &$aReasons = array(), $sOriginState = '') - { - $iFlags = 0; // By default (if no lifecycle) no flag at all - $sClass = get_class($this); + /** + * Returns the set of flags (OPT_ATT_HIDDEN, OPT_ATT_READONLY, OPT_ATT_MANDATORY...) + * for the given attribute in a transition + * + * @internal + * + * @param string $sAttCode $sAttCode The code of the attribute + * @param string $sStimulus The stimulus code to apply + * @param array|null $aReasons To store the reasons why the attribute is read-only (info about the synchro replicas) + * @param string $sOriginState The state from which to apply $sStimulus, if empty current state will be used + * + * @return integer Flags: the binary combination of the flags applicable to this attribute + * @throws ArchivedObjectException + * @throws CoreException + */ + public function GetTransitionFlags($sAttCode, $sStimulus, &$aReasons = [], $sOriginState = '') + { + $iFlags = 0; // By default (if no lifecycle) no flag at all + $sClass = get_class($this); - // If no state attribute, there is no lifecycle - if (!MetaModel::HasLifecycle($sClass)) - { - return $iFlags; - } + // If no state attribute, there is no lifecycle + if (!MetaModel::HasLifecycle($sClass)) { + return $iFlags; + } - // Retrieving current state if necessary - if ($sOriginState === '') - { - $sStateAttCode = MetaModel::GetStateAttributeCode($sClass); - $sOriginState = $this->Get($sStateAttCode); - } + // Retrieving current state if necessary + if ($sOriginState === '') { + $sStateAttCode = MetaModel::GetStateAttributeCode($sClass); + $sOriginState = $this->Get($sStateAttCode); + } - // Retrieving attribute flags - $iAttributeFlags = $this->GetAttributeFlags($sAttCode, $aReasons, $sOriginState); + // Retrieving attribute flags + $iAttributeFlags = $this->GetAttributeFlags($sAttCode, $aReasons, $sOriginState); - // Retrieving transition flags - $iTransitionFlags = MetaModel::GetTransitionFlags($sClass, $sOriginState, $sStimulus, $sAttCode); + // Retrieving transition flags + $iTransitionFlags = MetaModel::GetTransitionFlags($sClass, $sOriginState, $sStimulus, $sAttCode); - // Merging transition flags with attribute flags - $iFlags = $iTransitionFlags | $iAttributeFlags; + // Merging transition flags with attribute flags + $iFlags = $iTransitionFlags | $iAttributeFlags; - return $iFlags; - } + return $iFlags; + } - /** - * Returns an array of attribute codes (with their flags) when $sStimulus is applied on the object in the $sOriginState state. - * Note: Attributes (and flags) from the target state and the transition are combined. - * - * @internal - * - * @param string $sStimulus - * @param string $sOriginState Default is current state - * - * @return array - * @throws CoreException - */ - public function GetTransitionAttributes($sStimulus, $sOriginState = null) - { - $sObjClass = get_class($this); + /** + * Returns an array of attribute codes (with their flags) when $sStimulus is applied on the object in the $sOriginState state. + * Note: Attributes (and flags) from the target state and the transition are combined. + * + * @internal + * + * @param string $sStimulus + * @param string $sOriginState Default is current state + * + * @return array + * @throws CoreException + */ + public function GetTransitionAttributes($sStimulus, $sOriginState = null) + { + $sObjClass = get_class($this); - // Defining current state as origin state if not specified - if($sOriginState === null) - { - $sOriginState = $this->GetState(); - } + // Defining current state as origin state if not specified + if ($sOriginState === null) { + $sOriginState = $this->GetState(); + } - $aAttributes = MetaModel::GetTransitionAttributes($sObjClass, $sStimulus, $sOriginState); + $aAttributes = MetaModel::GetTransitionAttributes($sObjClass, $sStimulus, $sOriginState); - return $aAttributes; - } + return $aAttributes; + } /** * @param string $sAttCode The code of the attribute * @param array $aReasons * - * @overwritable-hook You can extend this method in order to provide your own logic - * + * @overwritable-hook You can extend this method in order to provide your own logic + * * @return integer The binary combination of the flags for the given attribute for the current state of the object considered as an INITIAL state. * Values can be one of the OPT_ATT_HIDDEN, OPT_ATT_READONLY, OPT_ATT_MANDATORY, ... (see define in metamodel.class.php) - * + * * @throws \CoreException * * @see GetAttributeFlags when modifying the object */ - public function GetInitialStateAttributeFlags($sAttCode, &$aReasons = array()) + public function GetInitialStateAttributeFlags($sAttCode, &$aReasons = []) { $iFlags = 0; $sClass = get_class($this); - if (MetaModel::HasLifecycle($sClass)) - { + if (MetaModel::HasLifecycle($sClass)) { $sStateAttCode = MetaModel::GetStateAttributeCode($sClass); $iFlags = MetaModel::GetInitialStateAttributeFlags($sClass, $this->Get($sStateAttCode), $sAttCode); } @@ -2064,89 +1963,63 @@ abstract class DBObject implements iDisplay */ public function CheckValue($sAttCode, $value = null) { - if (!is_null($value)) - { + if (!is_null($value)) { $toCheck = $value; - } - else - { + } else { $toCheck = $this->Get($sAttCode); } $oAtt = MetaModel::GetAttributeDef(get_class($this), $sAttCode); - if (!$oAtt->IsWritable()) - { + if (!$oAtt->IsWritable()) { return true; - } - elseif ($oAtt->IsNull($toCheck)) - { - if ($oAtt->IsNullAllowed()) - { + } elseif ($oAtt->IsNull($toCheck)) { + if ($oAtt->IsNullAllowed()) { return true; - } - else - { + } else { return "Null not allowed"; } - } - elseif ($oAtt->IsExternalKey()) - { - if (!MetaModel::SkipCheckExtKeys()) - { + } elseif ($oAtt->IsExternalKey()) { + if (!MetaModel::SkipCheckExtKeys()) { /** @var \AttributeExternalKey $oAtt */ $sTargetClass = $oAtt->GetTargetClass(); if (false === MetaModel::IsObjectInDB($sTargetClass, $toCheck)) { return "Target object not found ({$sTargetClass}::{$toCheck})"; } } - if ($oAtt->IsHierarchicalKey()) - { + if ($oAtt->IsHierarchicalKey()) { // This check cannot be deactivated since otherwise the user may break things by a CSV import of a bulk modify - $aValues = $oAtt->GetAllowedValues(array('this' => $this)); - if (!array_key_exists($toCheck, $aValues)) - { + $aValues = $oAtt->GetAllowedValues(['this' => $this]); + if (!array_key_exists($toCheck, $aValues)) { return "Value not allowed [$toCheck]"; } } - } - elseif ($oAtt instanceof AttributeTagSet) - { - if (is_string($toCheck)) - { + } elseif ($oAtt instanceof AttributeTagSet) { + if (is_string($toCheck)) { $oTag = new ormTagSet(get_class($this), $sAttCode, $oAtt->GetMaxItems()); - try - { + try { $oTag->SetValues(explode(' ', $toCheck)); - } catch (Exception $e) - { + } catch (Exception $e) { return "Tag value '$toCheck' is not a valid tag list"; } return true; } - if ($toCheck instanceof ormTagSet) - { + if ($toCheck instanceof ormTagSet) { return true; } return "Bad type"; - } - elseif ($oAtt instanceof AttributeSet) - { - if (is_string($toCheck)) - { + } elseif ($oAtt instanceof AttributeSet) { + if (is_string($toCheck)) { $oTag = new ormSet(get_class($this), $sAttCode, $oAtt->GetMaxItems()); - try - { - $aValues = array(); - foreach(explode(',', $toCheck) as $sValue) - { + try { + $aValues = []; + foreach (explode(',', $toCheck) as $sValue) { $aValues[] = trim($sValue); } $oTag->SetValues($aValues); - } catch (Exception $e) - { + } catch (Exception $e) { return "Set value '$toCheck' is not a valid set"; } @@ -2175,9 +2048,7 @@ abstract class DBObject implements iDisplay if (!$oAtt->CheckFormat($toCheck)) { return "Wrong format [$toCheck]"; } - } - else - { + } else { return $oAtt->CheckValue($this, $toCheck); } return true; @@ -2196,11 +2067,11 @@ abstract class DBObject implements iDisplay } /** - * @internal - * + * @internal + * * @throws \CoreException * @throws \OQLException - * + * * @since 2.6.0 N°659 uniqueness constraint * @api */ @@ -2209,28 +2080,23 @@ abstract class DBObject implements iDisplay $sCurrentClass = get_class($this); $aUniquenessRules = MetaModel::GetUniquenessRules($sCurrentClass); - foreach ($aUniquenessRules as $sUniquenessRuleId => $aUniquenessRuleProperties) - { - if ($aUniquenessRuleProperties['disabled'] === true) - { + foreach ($aUniquenessRules as $sUniquenessRuleId => $aUniquenessRuleProperties) { + if ($aUniquenessRuleProperties['disabled'] === true) { continue; } // No iTopMutex so there might be concurrent access ! // But the necessary lock would have a high performance cost :( $bHasDuplicates = $this->HasObjectsInDbForUniquenessRule($sUniquenessRuleId, $aUniquenessRuleProperties); - if ($bHasDuplicates) - { + if ($bHasDuplicates) { $bIsBlockingRule = $aUniquenessRuleProperties['is_blocking']; - if (is_null($bIsBlockingRule)) - { + if (is_null($bIsBlockingRule)) { $bIsBlockingRule = true; } $sErrorMessage = $this->GetUniquenessRuleMessage($sUniquenessRuleId); - if ($bIsBlockingRule) - { + if ($bIsBlockingRule) { $this->m_aCheckIssues[] = $sErrorMessage; continue; } @@ -2241,9 +2107,9 @@ abstract class DBObject implements iDisplay } /** - * - * @internal - * + * + * @internal + * * @param string $sUniquenessRuleId * * @return string dict key : Class:$sClassName/UniquenessRule:$sUniquenessRuleId if none then will use Core:UniquenessDefaultError @@ -2272,7 +2138,7 @@ abstract class DBObject implements iDisplay $oString = new TemplateString($sTemplate); - return $oString->Render(array('this' => $this)); + return $oString->Render(['this' => $this]); } /** @@ -2325,8 +2191,7 @@ abstract class DBObject implements iDisplay } return Dict::Format($sMessageKey, ...$aPlaceholdersData); - } - catch (Exception $e) { + } catch (Exception $e) { ExceptionLog::LogException($e); return null; @@ -2357,36 +2222,33 @@ abstract class DBObject implements iDisplay } /** - * @param array $aUniquenessRuleProperties uniqueness rule properties + * @param array $aUniquenessRuleProperties uniqueness rule properties * - * @param string $sUniquenessRuleId uniqueness rule ID + * @param string $sUniquenessRuleId uniqueness rule ID * @return \DBSearch * @throws \OQLException - * @throws \CoreException - * - * @internal - * - * @since 2.6.0 N°659 uniqueness constraint - * @since 2.7.11 3.1.2 3.2.0 N°4314 Fix Uniqueness rules not working with Silo + * @throws \CoreException + * + * @internal + * + * @since 2.6.0 N°659 uniqueness constraint + * @since 2.7.11 3.1.2 3.2.0 N°4314 Fix Uniqueness rules not working with Silo */ protected function GetSearchForUniquenessRule($sUniquenessRuleId, $aUniquenessRuleProperties) { $sRuleRootClass = $aUniquenessRuleProperties['root_class']; $sOqlUniquenessQuery = "SELECT $sRuleRootClass"; - if (!(empty($sUniquenessFilter = $aUniquenessRuleProperties['filter']))) - { + if (!(empty($sUniquenessFilter = $aUniquenessRuleProperties['filter']))) { $sOqlUniquenessQuery .= ' WHERE '.$sUniquenessFilter; } /** @var \DBObjectSearch $oUniquenessQuery */ $oUniquenessQuery = DBObjectSearch::FromOQL($sOqlUniquenessQuery); - if (!$this->IsNew()) - { + if (!$this->IsNew()) { $oUniquenessQuery->AddCondition('id', $this->GetKey(), '<>'); } - foreach ($aUniquenessRuleProperties['attributes'] as $sAttributeCode) - { + foreach ($aUniquenessRuleProperties['attributes'] as $sAttributeCode) { $attributeValue = $this->Get($sAttributeCode); $oUniquenessQuery->AddCondition($sAttributeCode, $attributeValue, '='); } @@ -2443,9 +2305,11 @@ abstract class DBObject implements iDisplay } if (!empty($aDuplicatesFields)) { - $this->m_aCheckWarnings[] = Dict::Format('Core:AttributeLinkedSetDuplicatesFound', + $this->m_aCheckWarnings[] = Dict::Format( + 'Core:AttributeLinkedSetDuplicatesFound', $oAttDef->GetLabel(), - implode(', ', $aDuplicatesFields)); + implode(', ', $aDuplicatesFields) + ); } } @@ -2458,8 +2322,8 @@ abstract class DBObject implements iDisplay * @overwritable-hook You can extend this method in order to provide your own logic. * @see CheckToWrite() * @see $m_aCheckIssues - * @see $m_aCheckWarnings - * + * @see $m_aCheckWarnings + * * @throws \ArchivedObjectException * @throws \CoreException * @throws \OQLException @@ -2470,7 +2334,7 @@ abstract class DBObject implements iDisplay $aChanges = $this->ListChanges(); - foreach($aChanges as $sAttCode => $value) { + foreach ($aChanges as $sAttCode => $value) { $res = $this->CheckValue($sAttCode); if ($res !== true) { $sAttLabel = $this->GetLabel($sAttCode); @@ -2480,31 +2344,25 @@ abstract class DBObject implements iDisplay $this->DoCheckLinkedSetDuplicates($sAttCode, $value); } - if (count($this->m_aCheckIssues) > 0) - { + if (count($this->m_aCheckIssues) > 0) { // No need to check consistency between attributes if any of them has // an unexpected value return; } $res = $this->CheckConsistency(); - if ($res !== true) - { + if ($res !== true) { // $res contains the error description $this->m_aCheckIssues[] = Dict::Format('Core:CheckConsistencyError', $res); } // Synchronization: are we attempting to modify an attribute for which an external source is master? // - if ($this->m_bIsInDB && $this->InSyncScope() && (count($aChanges) > 0)) - { - foreach($aChanges as $sAttCode => $value) - { + if ($this->m_bIsInDB && $this->InSyncScope() && (count($aChanges) > 0)) { + foreach ($aChanges as $sAttCode => $value) { $iFlags = $this->GetSynchroReplicaFlags($sAttCode, $aReasons); - if ($iFlags & OPT_ATT_SLAVE) - { + if ($iFlags & OPT_ATT_SLAVE) { // Note: $aReasonInfo['name'] could be reported (the task owning the attribute) - if (!empty($aReasons)) - { + if (!empty($aReasons)) { $sAttLabel = $this->GetLabel($sAttCode); $this->m_aCheckIssues[] = Dict::Format('UI:AttemptingToSetASlaveAttribute_Name', $sAttLabel, $sAttCode); } @@ -2549,7 +2407,7 @@ abstract class DBObject implements iDisplay } } - final static protected function GetObjectIfNotInCRUDStack($sClass, $sKey) + final protected static function GetObjectIfNotInCRUDStack($sClass, $sKey) { if (DBObject::IsObjectCurrentlyInCrud($sClass, $sKey)) { return null; @@ -2583,7 +2441,7 @@ abstract class DBObject implements iDisplay if ($this->IsNew()) { $this->CheckToWriteForSingleTargetObject_Internal('add', $oTargetObject, $sAttCodeMirrorLink, false); - } else if ($bIsCheckToDelete) { + } elseif ($bIsCheckToDelete) { $this->CheckToWriteForSingleTargetObject_Internal('remove', $oTargetObject, $sAttCodeMirrorLink, true); } else { if (array_key_exists($sExtKeyWithMirrorLinkAttCode, $aChanges)) { @@ -2638,32 +2496,30 @@ abstract class DBObject implements iDisplay } /** - * @api - * @api-advanced - * + * @api + * @api-advanced + * * @return array containing : * * $m_bCheckStatus * * $m_aCheckIssues * * $m_bSecurityIssue * - * @see $m_bCheckStatus - * @see $m_aCheckIssues - * @see $m_bSecurityIssue - * + * @see $m_bCheckStatus + * @see $m_aCheckIssues + * @see $m_bSecurityIssue + * * @throws \ArchivedObjectException * @throws \CoreException * @throws \OQLException */ final public function CheckToWrite($bDoComputeValues = true) { - if (MetaModel::SkipCheckToWrite()) - { - return array(true, array()); + if (MetaModel::SkipCheckToWrite()) { + return [true, []]; } - if (is_null($this->m_bCheckStatus)) - { - $this->m_aCheckIssues = array(); + if (is_null($this->m_bCheckStatus)) { + $this->m_aCheckIssues = []; if ($bDoComputeValues) { $this->DoComputeValues(); @@ -2676,21 +2532,18 @@ abstract class DBObject implements iDisplay $oKPI = new ExecutionKPI(); $this->DoCheckToWrite(); - $oKPI->ComputeStatsForExtension($this, 'DoCheckToWrite'); + $oKPI->ComputeStatsForExtension($this, 'DoCheckToWrite'); $this->CheckToWriteForTargetObjects(); - if (count($this->m_aCheckIssues) == 0) - { + if (count($this->m_aCheckIssues) == 0) { $this->m_bCheckStatus = true; - } - else - { + } else { $this->m_bCheckStatus = false; } } - return array($this->m_bCheckStatus, $this->m_aCheckIssues, $this->m_bSecurityIssue); + return [$this->m_bCheckStatus, $this->m_aCheckIssues, $this->m_bSecurityIssue]; } /** @@ -2747,7 +2600,7 @@ abstract class DBObject implements iDisplay if (($oAttDef instanceof AttributeHierarchicalKey) || ($oAttDef instanceof AttributeExternalKey)) { $sRemoteObjectClass = $oAttDef->GetTargetClass(); $sRemoteObjectKey = $this->Get($sAttDefCode); - } else if ($oAttDef instanceof AttributeObjectKey) { + } elseif ($oAttDef instanceof AttributeObjectKey) { $sRemoteObjectClassAttCode = $oAttDef->Get('class_attcode'); $sRemoteObjectClass = $this->Get($sRemoteObjectClassAttCode); $sRemoteObjectKey = $this->Get($sAttDefCode); @@ -2763,7 +2616,7 @@ abstract class DBObject implements iDisplay // 0 : Undefined ext. key (EG. non-mandatory and no value provided) // < 0 : Non yet persisted object - /** @noinspection TypeUnsafeComparisonInspection Non-strict comparison as object ID can be string */ + /** @noinspection TypeUnsafeComparisonInspection Non-strict comparison as object ID can be string */ if ($sRemoteObjectKey <= 0) { continue; } @@ -2779,94 +2632,86 @@ abstract class DBObject implements iDisplay * * an array of displayable error is added in {@see DBObject::$m_aDeleteIssues} * - * @internal - * + * @internal + * * @param \DeletionPlan $oDeletionPlan * * @throws \CoreException */ protected function DoCheckToDelete(&$oDeletionPlan) { - if ($this->InSyncScope()) - { + if ($this->InSyncScope()) { - foreach ($this->GetSynchroData() as $iSourceId => $aSourceData) - { - foreach ($aSourceData['replica'] as $oReplica) - { + foreach ($this->GetSynchroData() as $iSourceId => $aSourceData) { + foreach ($aSourceData['replica'] as $oReplica) { $oDeletionPlan->AddToDelete($oReplica, DEL_SILENT); } /** @var \SynchroDataSource $oDataSource */ $oDataSource = $aSourceData['source']; - if ($oDataSource->GetKey() == SynchroExecution::GetCurrentTaskId()) - { + if ($oDataSource->GetKey() == SynchroExecution::GetCurrentTaskId()) { // The current task has the right to delete the object continue; } $oReplica = reset($aSourceData['replica']); // Take the first one - if ($oReplica->Get('status_dest_creator') != 1) - { + if ($oReplica->Get('status_dest_creator') != 1) { // The object is not owned by the task continue; } $sLink = $oDataSource->GetName(); $sUserDeletePolicy = $oDataSource->Get('user_delete_policy'); - switch($sUserDeletePolicy) - { - case 'nobody': - $this->m_aDeleteIssues[] = Dict::Format('Core:Synchro:TheObjectCannotBeDeletedByUser_Source', $sLink); - break; - - case 'administrators': - if (!UserRights::IsAdministrator()) - { + switch ($sUserDeletePolicy) { + case 'nobody': $this->m_aDeleteIssues[] = Dict::Format('Core:Synchro:TheObjectCannotBeDeletedByUser_Source', $sLink); - } - break; + break; - case 'everybody': - default: - // Ok - break; + case 'administrators': + if (!UserRights::IsAdministrator()) { + $this->m_aDeleteIssues[] = Dict::Format('Core:Synchro:TheObjectCannotBeDeletedByUser_Source', $sLink); + } + break; + + case 'everybody': + default: + // Ok + break; } } } } - /** - * @internal - * - * @param \DeletionPlan $oDeletionPlan - * - * @return bool - * @throws CoreException - */ + /** + * @internal + * + * @param \DeletionPlan $oDeletionPlan + * + * @return bool + * @throws CoreException + */ public function CheckToDelete(&$oDeletionPlan) - { + { $this->AddCurrentObjectInCrudStack('DELETE'); try { $this->MakeDeletionPlan($oDeletionPlan); $oDeletionPlan->ComputeResults(); - } - finally { + } finally { $this->RemoveCurrentObjectInCrudStack(); } return (!$oDeletionPlan->FoundStopper()); } - /** - * @internal - * - * @param array $aProposal - * - * @return array - * @throws Exception - */ + /** + * @internal + * + * @param array $aProposal + * + * @return array + * @throws Exception + */ protected function ListChangedValues(array $aProposal) { - $aDelta = array(); + $aDelta = []; $sClass = get_class($this); if (MetaModel::HasLifecycle($sClass) && utils::IsNotNullOrEmptyString($this->sStimulusBeingApplied)) { $sStateAttCode = MetaModel::GetStateAttributeCode($sClass); @@ -2875,52 +2720,36 @@ abstract class DBObject implements iDisplay $aDelta[$sStateAttCode] = $this->m_aCurrValues[$sStateAttCode]; } } - foreach ($aProposal as $sAtt => $proposedValue) - { - if (!array_key_exists($sAtt, $this->m_aOrigValues)) - { + foreach ($aProposal as $sAtt => $proposedValue) { + if (!array_key_exists($sAtt, $this->m_aOrigValues)) { // The value was not set $aDelta[$sAtt] = $proposedValue; - } - elseif(!array_key_exists($sAtt, $this->m_aTouchedAtt) || (array_key_exists($sAtt, $this->m_aModifiedAtt) && $this->m_aModifiedAtt[$sAtt] == false)) - { + } elseif (!array_key_exists($sAtt, $this->m_aTouchedAtt) || (array_key_exists($sAtt, $this->m_aModifiedAtt) && $this->m_aModifiedAtt[$sAtt] == false)) { // This attCode was never set, cannot be modified // or the same value - as the original value - was set, and has been verified as equivalent to the original value continue; - } - else if (array_key_exists($sAtt, $this->m_aModifiedAtt) && $this->m_aModifiedAtt[$sAtt] == true) - { + } elseif (array_key_exists($sAtt, $this->m_aModifiedAtt) && $this->m_aModifiedAtt[$sAtt] == true) { // We already know that the value is really modified $aDelta[$sAtt] = $proposedValue; - } - elseif(is_object($proposedValue)) - { + } elseif (is_object($proposedValue)) { $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAtt); // The value is an object, the comparison is not strict - if (!$oAttDef->Equals($this->m_aOrigValues[$sAtt], $proposedValue)) - { + if (!$oAttDef->Equals($this->m_aOrigValues[$sAtt], $proposedValue)) { $aDelta[$sAtt] = $proposedValue; $this->m_aModifiedAtt[$sAtt] = true; // Really modified - } - else - { + } else { $this->m_aModifiedAtt[$sAtt] = false; // Not really modified } - } - else - { + } else { // The value is a scalar, the comparison must be 100% strict - if($this->m_aOrigValues[$sAtt] !== $proposedValue) - { + if ($this->m_aOrigValues[$sAtt] !== $proposedValue) { //echo "$sAtt:
      \n";
       					//var_dump($this->m_aOrigValues[$sAtt]);
       					//var_dump($proposedValue);
       					//echo "
      \n"; $aDelta[$sAtt] = $proposedValue; $this->m_aModifiedAtt[$sAtt] = true; // Really modified - } - else - { + } else { $this->m_aModifiedAtt[$sAtt] = false; // Not really modified } } @@ -2964,15 +2793,13 @@ abstract class DBObject implements iDisplay */ public function ListPreviousValuesForUpdatedAttributes() { - if (empty($this->m_aPreviousValuesForUpdatedAttributes)) - { - return array(); + if (empty($this->m_aPreviousValuesForUpdatedAttributes)) { + return []; } return $this->m_aPreviousValuesForUpdatedAttributes; } - /** * Whether an object was modified since last read from the DB or not * (ie: does it differ from the DB ?) @@ -2998,33 +2825,27 @@ abstract class DBObject implements iDisplay */ public function Equals($oSibling) { - if (get_class($oSibling) != get_class($this)) - { + if (get_class($oSibling) != get_class($this)) { return false; } - if ($this->GetKey() != $oSibling->GetKey()) - { + if ($this->GetKey() != $oSibling->GetKey()) { return false; } - if ($this->m_bIsInDB) - { + if ($this->m_bIsInDB) { // If one has changed, then consider them as being different - if ($this->IsModified() || $oSibling->IsModified()) - { + if ($this->IsModified() || $oSibling->IsModified()) { return false; } - } - else - { + } else { // Todo - implement this case (loop on every attribute) //foreach(MetaModel::ListAttributeDefs(get_class($this) as $sAttCode => $oAttDef) //{ - //if (!isset($this->m_CurrentValues[$sAttCode])) continue; - //if (!isset($this->m_CurrentValues[$sAttCode])) continue; - //if (!$oAttDef->Equals($this->m_CurrentValues[$sAttCode], $oSibling->m_CurrentValues[$sAttCode])) - //{ - //return false; - //} + //if (!isset($this->m_CurrentValues[$sAttCode])) continue; + //if (!isset($this->m_CurrentValues[$sAttCode])) continue; + //if (!$oAttDef->Equals($this->m_CurrentValues[$sAttCode], $oSibling->m_CurrentValues[$sAttCode])) + //{ + //return false; + //} //} return false; } @@ -3033,27 +2854,32 @@ abstract class DBObject implements iDisplay /** * Used only by insert, Meant to be overloaded - * - * @overwritable-hook You can extend this method in order to provide your own logic. + * + * @overwritable-hook You can extend this method in order to provide your own logic. */ protected function OnObjectKeyReady() - { - } + { + } /** * used both by insert/update * - * @internal - * + * @internal + * * @throws \CoreException */ private function DBWriteLinks() { - foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) - { - if (!$oAttDef->IsLinkSet()) continue; - if (!array_key_exists($sAttCode, $this->m_aTouchedAtt)) continue; - if (array_key_exists($sAttCode, $this->m_aModifiedAtt) && ($this->m_aModifiedAtt[$sAttCode] == false)) continue; + foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { + if (!$oAttDef->IsLinkSet()) { + continue; + } + if (!array_key_exists($sAttCode, $this->m_aTouchedAtt)) { + continue; + } + if (array_key_exists($sAttCode, $this->m_aModifiedAtt) && ($this->m_aModifiedAtt[$sAttCode] == false)) { + continue; + } /** @var \ormLinkSet $oLinkSet */ $oLinkSet = $this->m_aCurrValues[$sAttCode]; @@ -3064,49 +2890,53 @@ abstract class DBObject implements iDisplay /** * Used both by insert/update * - * @internal - * + * @internal + * * @throws \CoreException */ private function WriteExternalAttributes() { - foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) - { - if (!$oAttDef->LoadInObject()) continue; - if (!array_key_exists($sAttCode, $this->m_aTouchedAtt)) continue; - if (array_key_exists($sAttCode, $this->m_aModifiedAtt) && ($this->m_aModifiedAtt[$sAttCode] === false)) continue; + foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { + if (!$oAttDef->LoadInObject()) { + continue; + } + if (!array_key_exists($sAttCode, $this->m_aTouchedAtt)) { + continue; + } + if (array_key_exists($sAttCode, $this->m_aModifiedAtt) && ($this->m_aModifiedAtt[$sAttCode] === false)) { + continue; + } $oAttDef->WriteExternalValues($this); } } - - /** - * Note: this is experimental - it was designed to speed up the setup of iTop - * Known limitations: - * - does not work with multi-table classes (issue with the unique id to maintain in several tables) - * - the id of the object is not updated - * - * @internal - * @experimental - */ - static public final function BulkInsertStart() + /** + * Note: this is experimental - it was designed to speed up the setup of iTop + * Known limitations: + * - does not work with multi-table classes (issue with the unique id to maintain in several tables) + * - the id of the object is not updated + * + * @internal + * @experimental + */ + final public static function BulkInsertStart() { self::$m_bBulkInsert = true; } - /** - * - * @internal - * @experimental - */ - static public final function BulkInsertFlush() + /** + * + * @internal + * @experimental + */ + final public static function BulkInsertFlush() { - if (!self::$m_bBulkInsert) return; + if (!self::$m_bBulkInsert) { + return; + } - foreach(self::$m_aBulkInsertCols as $sClass => $aTables) - { - foreach ($aTables as $sTable => $sColumns) - { + foreach (self::$m_aBulkInsertCols as $sClass => $aTables) { + foreach ($aTables as $sTable => $sColumns) { $sValues = implode(', ', self::$m_aBulkInsertItems[$sClass][$sTable]); $sInsertSQL = "INSERT INTO `$sTable` ($sColumns) VALUES $sValues"; CMDBSource::InsertInto($sInsertSQL); @@ -3114,15 +2944,15 @@ abstract class DBObject implements iDisplay } // Reset - self::$m_aBulkInsertItems = array(); - self::$m_aBulkInsertCols = array(); + self::$m_aBulkInsertItems = []; + self::$m_aBulkInsertCols = []; self::$m_bBulkInsert = false; } /** * Persists new object in the DB - * - * @internal + * + * @internal * * @param string $sTableClass * @@ -3134,65 +2964,57 @@ abstract class DBObject implements iDisplay { $sTable = MetaModel::DBGetTable($sTableClass); // Abstract classes or classes having no specific attribute do not have an associated table - if ($sTable == '') { return false; } + if ($sTable == '') { + return false; + } $sClass = get_class($this); // fields in first array, values in the second - $aFieldsToWrite = array(); - $aValuesToWrite = array(); + $aFieldsToWrite = []; + $aValuesToWrite = []; - if (!empty($this->m_iKey) && ($this->m_iKey >= 0)) - { + if (!empty($this->m_iKey) && ($this->m_iKey >= 0)) { // Add it to the list of fields to write $aFieldsToWrite[] = '`'.MetaModel::DBGetKey($sTableClass).'`'; $aValuesToWrite[] = CMDBSource::Quote($this->m_iKey); } - $aHierarchicalKeys = array(); + $aHierarchicalKeys = []; - foreach(MetaModel::ListAttributeDefs($sTableClass) as $sAttCode=>$oAttDef) { + foreach (MetaModel::ListAttributeDefs($sTableClass) as $sAttCode => $oAttDef) { // Skip this attribute if not defined in this table if ((!MetaModel::IsAttributeOrigin($sTableClass, $sAttCode) && !$oAttDef->CopyOnAllTables()) || $oAttDef->IsExternalField()) { continue; } $aAttColumns = $oAttDef->GetSQLValues($this->m_aCurrValues[$sAttCode]); - foreach($aAttColumns as $sColumn => $sValue) - { + foreach ($aAttColumns as $sColumn => $sValue) { $aFieldsToWrite[] = "`$sColumn`"; $aValuesToWrite[] = CMDBSource::Quote($sValue); } - if ($oAttDef->IsHierarchicalKey()) - { + if ($oAttDef->IsHierarchicalKey()) { $aHierarchicalKeys[$sAttCode] = $oAttDef; } } - if (count($aValuesToWrite) == 0) { return false; } - - if (MetaModel::DBIsReadOnly()) - { - $iNewKey = -1; + if (count($aValuesToWrite) == 0) { + return false; } - else - { - if (self::$m_bBulkInsert) - { - if (!isset(self::$m_aBulkInsertCols[$sClass][$sTable])) - { + + if (MetaModel::DBIsReadOnly()) { + $iNewKey = -1; + } else { + if (self::$m_bBulkInsert) { + if (!isset(self::$m_aBulkInsertCols[$sClass][$sTable])) { self::$m_aBulkInsertCols[$sClass][$sTable] = implode(', ', $aFieldsToWrite); } - self::$m_aBulkInsertItems[$sClass][$sTable][] = '('.implode (', ', $aValuesToWrite).')'; + self::$m_aBulkInsertItems[$sClass][$sTable][] = '('.implode(', ', $aValuesToWrite).')'; $iNewKey = 999999; // TODO - compute next id.... - } - else - { - if (count($aHierarchicalKeys) > 0) - { - foreach($aHierarchicalKeys as $sAttCode => $oAttDef) - { + } else { + if (count($aHierarchicalKeys) > 0) { + foreach ($aHierarchicalKeys as $sAttCode => $oAttDef) { $aValues = MetaModel::HKInsertChildUnder($this->m_aCurrValues[$sAttCode], $oAttDef, $sTable); $aFieldsToWrite[] = '`'.$oAttDef->GetSQLRight().'`'; $aValuesToWrite[] = $aValues[$oAttDef->GetSQLRight()]; @@ -3205,8 +3027,7 @@ abstract class DBObject implements iDisplay } } // Note that it is possible to have a key defined here, and the autoincrement expected, this is acceptable in a non root class - if (empty($this->m_iKey)) - { + if (empty($this->m_iKey)) { // Take the autonumber $this->m_iKey = "$iNewKey"; } @@ -3250,75 +3071,72 @@ abstract class DBObject implements iDisplay return $this->m_iKey; } - /** - * @internal - * - * @param array $aAuthorizedExtKeys - * @param array $aStatements - * @param string $sTableClass - * - * @throws CoreException - * @throws MySQLException - */ + /** + * @internal + * + * @param array $aAuthorizedExtKeys + * @param array $aStatements + * @param string $sTableClass + * + * @throws CoreException + * @throws MySQLException + */ protected function MakeInsertStatementSingleTable($aAuthorizedExtKeys, &$aStatements, $sTableClass) { $sTable = MetaModel::DBGetTable($sTableClass); // Abstract classes or classes having no specific attribute do not have an associated table - if ($sTable == '') return; + if ($sTable == '') { + return; + } // fields in first array, values in the second - $aFieldsToWrite = array(); - $aValuesToWrite = array(); + $aFieldsToWrite = []; + $aValuesToWrite = []; - if (!empty($this->m_iKey) && ($this->m_iKey >= 0)) - { + if (!empty($this->m_iKey) && ($this->m_iKey >= 0)) { // Add it to the list of fields to write $aFieldsToWrite[] = '`'.MetaModel::DBGetKey($sTableClass).'`'; $aValuesToWrite[] = CMDBSource::Quote($this->m_iKey); } - $aHierarchicalKeys = array(); - foreach(MetaModel::ListAttributeDefs($sTableClass) as $sAttCode => $oAttDef) - { + $aHierarchicalKeys = []; + foreach (MetaModel::ListAttributeDefs($sTableClass) as $sAttCode => $oAttDef) { // Skip this attribute if not defined in this table if ((!MetaModel::IsAttributeOrigin($sTableClass, $sAttCode)) || $oAttDef->IsExternalField()) { continue; }; // Skip link set that can still be undefined though the object is 100% loaded - if ($oAttDef->IsLinkSet()) continue; + if ($oAttDef->IsLinkSet()) { + continue; + } $value = $this->m_aCurrValues[$sAttCode]; - if ($oAttDef->IsExternalKey()) - { + if ($oAttDef->IsExternalKey()) { /** @var \AttributeExternalKey $oAttDef */ $sTargetClass = $oAttDef->GetTargetClass(); - if (is_array($aAuthorizedExtKeys)) - { - if (!array_key_exists($sTargetClass, $aAuthorizedExtKeys) || !array_key_exists($value, $aAuthorizedExtKeys[$sTargetClass])) - { + if (is_array($aAuthorizedExtKeys)) { + if (!array_key_exists($sTargetClass, $aAuthorizedExtKeys) || !array_key_exists($value, $aAuthorizedExtKeys[$sTargetClass])) { $value = 0; } } } $aAttColumns = $oAttDef->GetSQLValues($value); - foreach($aAttColumns as $sColumn => $sValue) - { + foreach ($aAttColumns as $sColumn => $sValue) { $aFieldsToWrite[] = "`$sColumn`"; $aValuesToWrite[] = CMDBSource::Quote($sValue); } - if ($oAttDef->IsHierarchicalKey()) - { + if ($oAttDef->IsHierarchicalKey()) { $aHierarchicalKeys[$sAttCode] = $oAttDef; } } - if (count($aValuesToWrite) == 0) return; + if (count($aValuesToWrite) == 0) { + return; + } - if (count($aHierarchicalKeys) > 0) - { - foreach($aHierarchicalKeys as $sAttCode => $oAttDef) - { + if (count($aHierarchicalKeys) > 0) { + foreach ($aHierarchicalKeys as $sAttCode => $oAttDef) { $aValues = MetaModel::HKInsertChildUnder($this->m_aCurrValues[$sAttCode], $oAttDef, $sTable); $aFieldsToWrite[] = '`'.$oAttDef->GetSQLRight().'`'; $aValuesToWrite[] = $aValues[$oAttDef->GetSQLRight()]; @@ -3329,15 +3147,15 @@ abstract class DBObject implements iDisplay $aStatements[] = "INSERT INTO `$sTable` (".join(",", $aFieldsToWrite).") VALUES (".join(", ", $aValuesToWrite).");"; } - /** - * @internal - * - * @param array $aAuthorizedExtKeys - * @param array $aStatements - * - * @throws CoreException - * @throws MySQLException - */ + /** + * @internal + * + * @param array $aAuthorizedExtKeys + * @param array $aStatements + * + * @throws CoreException + * @throws MySQLException + */ public function MakeInsertStatements($aAuthorizedExtKeys, &$aStatements) { $sClass = get_class($this); @@ -3347,15 +3165,15 @@ abstract class DBObject implements iDisplay $this->MakeInsertStatementSingleTable($aAuthorizedExtKeys, $aStatements, $sRootClass); // Then do the leaf class, if different from the root class - if ($sClass != $sRootClass) - { + if ($sClass != $sRootClass) { $this->MakeInsertStatementSingleTable($aAuthorizedExtKeys, $aStatements, $sClass); } // Then do the other classes - foreach(MetaModel::EnumParentClasses($sClass) as $sParentClass) - { - if ($sParentClass == $sRootClass) continue; + foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass) { + if ($sParentClass == $sRootClass) { + continue; + } $this->MakeInsertStatementSingleTable($aAuthorizedExtKeys, $aStatements, $sParentClass); } } @@ -3363,11 +3181,11 @@ abstract class DBObject implements iDisplay /** * Persist an object to the DB, for the first time * - * @api - * @see DBWrite - * + * @api + * @see DBWrite + * * @return string|null inserted object key - * + * * @throws \ArchivedObjectException * @throws \CoreCannotSaveObjectException * @throws \CoreException @@ -3413,13 +3231,13 @@ abstract class DBObject implements iDisplay // If not automatically computed, then check that the key is given by the caller if (!MetaModel::IsAutoIncrementKey($sRootClass)) { if (empty($this->m_iKey)) { - throw new CoreWarning('Missing key for the object to write - This class is supposed to have a user defined key, not an autonumber', array('class' => $sRootClass)); + throw new CoreWarning('Missing key for the object to write - This class is supposed to have a user defined key, not an autonumber', ['class' => $sRootClass]); } } [$bRes, $aIssues] = $this->CheckToWrite(false); if (!$bRes) { - throw new CoreCannotSaveObjectException(array('issues' => $aIssues, 'class' => get_class($this), 'id' => $this->GetKey())); + throw new CoreCannotSaveObjectException(['issues' => $aIssues, 'class' => get_class($this), 'id' => $this->GetKey()]); } if ($this->m_iKey < 0) { @@ -3481,8 +3299,7 @@ abstract class DBObject implements iDisplay CMDBSource::Query('COMMIT'); } break; - } - catch (Exception $e) { + } catch (Exception $e) { IssueLog::Error($e->getMessage()); if ($bIsTransactionEnabled) { CMDBSource::Query('ROLLBACK'); @@ -3517,16 +3334,14 @@ abstract class DBObject implements iDisplay try { $this->PostInsertActions(); - } - finally { + } finally { MetaModel::StopReentranceProtection($this); } if ((count($this->ListChanges()) !== 0)) { $this->DBUpdate(); } - } - finally { + } finally { $this->RemoveCurrentObjectInCrudStack(); } @@ -3550,14 +3365,13 @@ abstract class DBObject implements iDisplay // Activate any existing trigger $sClass = get_class($this); - $aParams = array('class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL)); - $oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnObjectCreate AS t WHERE t.target_class IN (:class_list)'), array(), $aParams); + $aParams = ['class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL)]; + $oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnObjectCreate AS t WHERE t.target_class IN (:class_list)'), [], $aParams); while ($oTrigger = $oSet->Fetch()) { /** @var \TriggerOnObjectCreate $oTrigger */ try { $oTrigger->DoActivate($this->ToArgs('this')); - } - catch (Exception $e) { + } catch (Exception $e) { $oTrigger->LogException($e, $this); utils::EnrichRaisedException($oTrigger, $e); } @@ -3570,23 +3384,23 @@ abstract class DBObject implements iDisplay $this->ActivateOnObjectUpdateTriggersForTargetObjects(); } - /** - * Creates a copy of the current object into the database - * - * @internal - * - * @param null $iNewKey - * - * @return int|null the id of the newly created object - * - * @throws ArchivedObjectException - * @throws CoreCannotSaveObjectException - * @throws CoreException - * @throws CoreUnexpectedValue - * @throws CoreWarning - * @throws MySQLException - * @throws OQLException - */ + /** + * Creates a copy of the current object into the database + * + * @internal + * + * @param null $iNewKey + * + * @return int|null the id of the newly created object + * + * @throws ArchivedObjectException + * @throws CoreCannotSaveObjectException + * @throws CoreException + * @throws CoreUnexpectedValue + * @throws CoreWarning + * @throws MySQLException + * @throws OQLException + */ public function DBClone($iNewKey = null) { $this->m_bIsInDB = false; @@ -3631,8 +3445,7 @@ abstract class DBObject implements iDisplay return false; } - if (!$this->m_bIsInDB) - { + if (!$this->m_bIsInDB) { throw new CoreException("DBUpdate: could not update a newly created object, please call DBInsert instead"); } $sClass = get_class($this); @@ -3643,7 +3456,6 @@ abstract class DBObject implements iDisplay // Protect against infinite loop $this->iUpdateLoopCount++; - try { $this->DoComputeValues(); $this->ComputeStopWatchesDeadline(false); @@ -3674,8 +3486,8 @@ abstract class DBObject implements iDisplay // Activate any existing trigger $sClass = get_class($this); - $aHierarchicalKeys = array(); - $aDBChanges = array(); + $aHierarchicalKeys = []; + $aDBChanges = []; foreach ($aChanges as $sAttCode => $currentValue) { $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); if ($oAttDef->IsBasedOnDBColumns()) { @@ -3750,7 +3562,7 @@ abstract class DBObject implements iDisplay $this->DBWriteLinks(); $this->WriteExternalAttributes(); - $this->HandleTemporaryDescriptor(); + $this->HandleTemporaryDescriptor(); if (count($aChanges) != 0) { $this->RecordAttChanges($aChanges, $aOriginalValues); @@ -3760,8 +3572,7 @@ abstract class DBObject implements iDisplay CMDBSource::Query('COMMIT'); } break; - } - catch (MySQLException $e) { + } catch (MySQLException $e) { IssueLog::Error($e->getMessage()); if ($bIsTransactionEnabled) { CMDBSource::Query('ROLLBACK'); @@ -3777,17 +3588,15 @@ abstract class DBObject implements iDisplay } } } - $aErrors = array($e->getMessage()); + $aErrors = [$e->getMessage()]; throw new CoreCannotSaveObjectException(['id' => $this->GetKey(), 'class' => $sClass, 'issues' => $aErrors], $e); - } - catch (CoreCannotSaveObjectException $e) { + } catch (CoreCannotSaveObjectException $e) { IssueLog::Error($e->getMessage()); if ($bIsTransactionEnabled) { CMDBSource::Query('ROLLBACK'); } throw $e; - } - catch (Exception $e) { + } catch (Exception $e) { IssueLog::Error($e->getMessage()); if ($bIsTransactionEnabled) { CMDBSource::Query('ROLLBACK'); @@ -3801,8 +3610,8 @@ abstract class DBObject implements iDisplay // new values are already in the object (call {@see DBObject::Get()} to get them) // call {@see DBObject::ListPreviousValuesForUpdatedAttributes()} to get changed fields and previous values $this->m_bDirty = false; - $this->m_aTouchedAtt = array(); - $this->m_aModifiedAtt = array(); + $this->m_aTouchedAtt = []; + $this->m_aModifiedAtt = []; // Reset original values although the object has not been reloaded foreach ($this->m_aLoadedAtt as $sAttCode => $bLoaded) { if ($bLoaded) { @@ -3820,14 +3629,12 @@ abstract class DBObject implements iDisplay try { $this->PostUpdateActions($this->m_aPreviousValuesForUpdatedAttributes, $sClass); - } - catch (Exception $e) { + } catch (Exception $e) { $this->LogCRUDExit(__METHOD__, 'Error: '.$e->getMessage()); $aErrors = [$e->getMessage()]; throw new CoreException($e->getMessage(), ['id' => $this->GetKey(), 'class' => $sClass, 'issues' => $aErrors]); } - } - finally { + } finally { MetaModel::StopReentranceProtection($this); } @@ -3839,8 +3646,7 @@ abstract class DBObject implements iDisplay } $this->DBUpdate(); } - } - finally { + } finally { $this->RemoveCurrentObjectInCrudStack(); $this->iUpdateLoopCount--; } @@ -3876,35 +3682,32 @@ abstract class DBObject implements iDisplay $this->ActivateOnObjectUpdateTriggersForTargetObjects(); $sClass = get_class($this); - if (utils::IsNotNullOrEmptyString($sStimulusBeingApplied)) - { + if (utils::IsNotNullOrEmptyString($sStimulusBeingApplied)) { $sStateAttCode = MetaModel::GetStateAttributeCode($sClass); $sPreviousState = $this->m_aPreviousValuesForUpdatedAttributes[$sStateAttCode]; // Change state triggers... - $aParams = array( + $aParams = [ 'class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL), 'previous_state' => $sPreviousState, 'new_state' => $this->Get($sStateAttCode), - ); - $oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnStateLeave AS t WHERE t.target_class IN (:class_list) AND t.state=:previous_state'), array(), $aParams); + ]; + $oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnStateLeave AS t WHERE t.target_class IN (:class_list) AND t.state=:previous_state'), [], $aParams); while ($oTrigger = $oSet->Fetch()) { /** @var \TriggerOnStateLeave $oTrigger */ try { $oTrigger->DoActivate($this->ToArgs('this')); - } - catch (Exception $e) { + } catch (Exception $e) { $oTrigger->LogException($e, $this); utils::EnrichRaisedException($oTrigger, $e); } } - $oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnStateEnter AS t WHERE t.target_class IN (:class_list) AND t.state=:new_state'), array(), $aParams); + $oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnStateEnter AS t WHERE t.target_class IN (:class_list) AND t.state=:new_state'), [], $aParams); while ($oTrigger = $oSet->Fetch()) { /** @var \TriggerOnStateEnter $oTrigger */ try { $oTrigger->DoActivate($this->ToArgs('this')); - } - catch (Exception $e) { + } catch (Exception $e) { $oTrigger->LogException($e, $this); utils::EnrichRaisedException($oTrigger, $e); } @@ -3934,15 +3737,17 @@ abstract class DBObject implements iDisplay // - TriggerOnObjectUpdate $aClassList = MetaModel::EnumParentClasses(get_class($oObject), ENUM_PARENT_CLASSES_ALL); - $aParams = array('class_list' => $aClassList); - $oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnObjectUpdate AS t WHERE t.target_class IN (:class_list)'), - array(), $aParams); + $aParams = ['class_list' => $aClassList]; + $oSet = new DBObjectSet( + DBObjectSearch::FromOQL('SELECT TriggerOnObjectUpdate AS t WHERE t.target_class IN (:class_list)'), + [], + $aParams + ); while ($oTrigger = $oSet->Fetch()) { /** @var \TriggerOnObjectUpdate $oTrigger */ try { $oTrigger->DoActivateForSpecificAttributes($oObject->ToArgs(), $aAttributes); - } - catch (Exception $e) { + } catch (Exception $e) { $oTrigger->LogException($e, $oObject); utils::EnrichRaisedException($oTrigger, $e); } @@ -3971,13 +3776,13 @@ abstract class DBObject implements iDisplay $sClass = get_class($this); // dirty object not allowed - if($this->m_bDirty){ + if ($this->m_bDirty) { throw new CoreException("Invalid DBIncrement usage, dirty objects are not allowed. Call DBUpdate before calling DBIncrement."); } // ensure attribute type is AttributeInteger $oAttr = MetaModel::GetAttributeDef($sClass, $sAttCode); - if(!$oAttr instanceof AttributeInteger){ + if (!$oAttr instanceof AttributeInteger) { throw new CoreException(sprintf("Invalid DBIncrement usage, attribute type of {$sAttCode} is %s. Only AttributeInteger are compatibles with DBIncrement.", get_class($oAttr))); } @@ -4047,8 +3852,7 @@ abstract class DBObject implements iDisplay $aParams = ['class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL)]; $oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObjectMention AS t WHERE t.target_class IN (:class_list)"), [], $aParams); - while ($oTrigger = $oSet->Fetch()) - { + while ($oTrigger = $oSet->Fetch()) { /** @var \TriggerOnObjectMention $oTrigger */ try { // Ensure to handle only mentioned object in the trigger's scope @@ -4057,8 +3861,7 @@ abstract class DBObject implements iDisplay } $oTrigger->DoActivate($aTriggerArgs); - } - catch (Exception $e) { + } catch (Exception $e) { utils::EnrichRaisedException($oTrigger, $e); } } @@ -4077,12 +3880,11 @@ abstract class DBObject implements iDisplay * @since 3.1.0 N°6299 - change visibility * @throws \Exception */ - protected final function InitPreviousValuesForUpdatedAttributes() + final protected function InitPreviousValuesForUpdatedAttributes() { - $aChanges= $this->ListChanges(); - if (empty($aChanges)) - { - $this->m_aPreviousValuesForUpdatedAttributes = array(); + $aChanges = $this->ListChanges(); + if (empty($aChanges)) { + $this->m_aPreviousValuesForUpdatedAttributes = []; return; } @@ -4108,29 +3910,28 @@ abstract class DBObject implements iDisplay */ public function DBWrite() { - if ($this->m_bIsInDB) - { + if ($this->m_bIsInDB) { return $this->DBUpdate(); - } - else - { + } else { return $this->DBInsert(); } } - /** - * @internal - * - * @param string $sTableClass - * - * @throws CoreException - * @throws MySQLException - */ + /** + * @internal + * + * @param string $sTableClass + * + * @throws CoreException + * @throws MySQLException + */ private function DBDeleteSingleTable($sTableClass) { $sTable = MetaModel::DBGetTable($sTableClass); // Abstract classes or classes having no specific attribute do not have an associated table - if ($sTable == '') return; + if ($sTable == '') { + return; + } $sPKField = '`'.MetaModel::DBGetKey($sTableClass).'`'; $sKey = CMDBSource::Quote($this->m_iKey); @@ -4154,8 +3955,7 @@ abstract class DBObject implements iDisplay { $this->LogCRUDEnter(__METHOD__); - if (MetaModel::DBIsReadOnly()) - { + if (MetaModel::DBIsReadOnly()) { $this->LogCRUDExit(__METHOD__, 'DB is read-only'); return; } @@ -4164,10 +3964,8 @@ abstract class DBObject implements iDisplay $this->RecordObjDeletion($this->m_iKey); // May cause a reload for storing history information - foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) - { - if ($oAttDef->IsHierarchicalKey()) - { + foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { + if ($oAttDef->IsHierarchicalKey()) { // Update the left & right indexes for each hierarchical key $sTable = $sTable = MetaModel::DBGetTable(get_class($this), $sAttCode); /** @var \AttributeHierarchicalKey $oAttDef */ @@ -4181,12 +3979,9 @@ abstract class DBObject implements iDisplay // No new parent for now, insert completely at the right of the tree $sSQL = "SELECT max(`".$oAttDef->GetSQLRight()."`) AS max FROM `$sTable`"; $aRes = CMDBSource::QueryToArray($sSQL); - if (count($aRes) == 0) - { + if (count($aRes) == 0) { $iNewLeft = 1; - } - else - { + } else { $iNewLeft = $aRes[0]['max'] + 1; } MetaModel::HKReplugBranch($iNewLeft, $iNewLeft + $iDelta - 1, $oAttDef, $sTable); @@ -4195,51 +3990,38 @@ abstract class DBObject implements iDisplay } $iTransactionRetry = 1; $bIsTransactionEnabled = MetaModel::GetConfig()->Get('db_core_transactions_enabled'); - if ($bIsTransactionEnabled) - { + if ($bIsTransactionEnabled) { // TODO Deep clone this object before the transaction (to use it in case of rollback) // $iTransactionRetryCount = MetaModel::GetConfig()->Get('db_core_transactions_retry_count'); $iTransactionRetryCount = 1; $iTransactionRetryDelay = MetaModel::GetConfig()->Get('db_core_transactions_retry_delay_ms'); $iTransactionRetry = $iTransactionRetryCount; } - while ($iTransactionRetry > 0) - { - try - { + while ($iTransactionRetry > 0) { + try { $iTransactionRetry--; - if ($bIsTransactionEnabled) - { + if ($bIsTransactionEnabled) { CMDBSource::Query('START TRANSACTION'); } - foreach (MetaModel::EnumParentClasses(get_class($this), ENUM_PARENT_CLASSES_ALL) as $sParentClass) - { + foreach (MetaModel::EnumParentClasses(get_class($this), ENUM_PARENT_CLASSES_ALL) as $sParentClass) { $this->DBDeleteSingleTable($sParentClass); } - if ($bIsTransactionEnabled) - { + if ($bIsTransactionEnabled) { CMDBSource::Query('COMMIT'); } break; - } - catch (MySQLException $e) - { + } catch (MySQLException $e) { IssueLog::Error($e->getMessage()); - if ($bIsTransactionEnabled) - { + if ($bIsTransactionEnabled) { CMDBSource::Query('ROLLBACK'); - if (!CMDBSource::IsInsideTransaction() && CMDBSource::IsDeadlockException($e)) - { + if (!CMDBSource::IsInsideTransaction() && CMDBSource::IsDeadlockException($e)) { // Deadlock found when trying to get lock; try restarting transaction - if ($iTransactionRetry > 0) - { + if ($iTransactionRetry > 0) { // wait and retry IssueLog::Error("Delete TRANSACTION Retrying..."); usleep(random_int(1, 5) * 1000 * $iTransactionRetryDelay * ($iTransactionRetryCount - $iTransactionRetry)); continue; - } - else - { + } else { IssueLog::Error("Delete Deadlock TRANSACTION prevention failed."); } } @@ -4262,28 +4044,28 @@ abstract class DBObject implements iDisplay // Thought the key is not reset, using DBInsert or DBWrite will create an object having the same characteristics and a new ID. DBUpdate is protected } - /** - * Delete an object - * - * First, checks if the object can be deleted regarding database integrity. - * If the answer is yes, it performs any required cleanup (delete other objects or reset external keys) in addition to the object - * deletion. - * - * @api - * - * @param \DeletionPlan $oDeletionPlan Do not use: aims at dealing with recursion - * - * @return DeletionPlan The detailed description of cleanup operation that have been performed - * - * @throws ArchivedObjectException - * @throws CoreCannotSaveObjectException - * @throws CoreException - * @throws CoreUnexpectedValue - * @throws DeleteException - * @throws MySQLException - * @throws MySQLHasGoneAwayException - * @throws OQLException - */ + /** + * Delete an object + * + * First, checks if the object can be deleted regarding database integrity. + * If the answer is yes, it performs any required cleanup (delete other objects or reset external keys) in addition to the object + * deletion. + * + * @api + * + * @param \DeletionPlan $oDeletionPlan Do not use: aims at dealing with recursion + * + * @return DeletionPlan The detailed description of cleanup operation that have been performed + * + * @throws ArchivedObjectException + * @throws CoreCannotSaveObjectException + * @throws CoreException + * @throws CoreUnexpectedValue + * @throws DeleteException + * @throws MySQLException + * @throws MySQLHasGoneAwayException + * @throws OQLException + */ public function DBDelete(&$oDeletionPlan = null) { $this->LogCRUDEnter(__METHOD__); @@ -4299,10 +4081,9 @@ abstract class DBObject implements iDisplay if (false === $this->CheckToDelete($oDeletionPlan)) { $aIssues = $oDeletionPlan->GetIssues(); $this->LogCRUDError(__METHOD__, ' Errors: '.implode(', ', $aIssues)); - throw new DeleteException('Found issue(s)', array('target_class' => get_class($this), 'target_id' => $this->GetKey(), 'issues' => implode(', ', $aIssues))); + throw new DeleteException('Found issue(s)', ['target_class' => get_class($this), 'target_id' => $this->GetKey(), 'issues' => implode(', ', $aIssues)]); } - // Getting and setting time limit are not symmetric: // www.php.net/manual/fr/function.set-time-limit.php#72305 $iPreviousTimeLimit = ini_get('max_execution_time'); @@ -4322,8 +4103,7 @@ abstract class DBObject implements iDisplay $oToDelete->AddCurrentObjectInCrudStack('DELETE'); try { $oToDelete->DBDeleteSingleObject(); - } - finally { + } finally { $oToDelete->RemoveCurrentObjectInCrudStack(); } } @@ -4350,14 +4130,14 @@ abstract class DBObject implements iDisplay return $oDeletionPlan; } - /** - * @overwritable-hook You can extend this method in order to provide your own logic. - * - * @return array - * - * @throws ArchivedObjectException - * @throws CoreException - */ + /** + * @overwritable-hook You can extend this method in order to provide your own logic. + * + * @return array + * + * @throws ArchivedObjectException + * @throws CoreException + */ public function EnumTransitions() { $sClass = get_class($this); @@ -4385,7 +4165,7 @@ abstract class DBObject implements iDisplay $aStimuli = MetaModel::EnumStimuli($sClass); // Sort $aSortedTransitions based on labels from $aStimuli - uksort($aSortedTransitions, function($sKey1, $sKey2) use ($aStimuli) { + uksort($aSortedTransitions, function ($sKey1, $sKey2) use ($aStimuli) { // If any transition is not in $aStimuli, put it at the end even though it's a weird situation if ((false === isset($aStimuli[$sKey1])) || (false === isset($aStimuli[$sKey2]))) { return 1; @@ -4405,7 +4185,7 @@ abstract class DBObject implements iDisplay $aStatesSortFromDatamodel = array_keys($aAllowedValues); // Sort $aSortedTransitions based on the states sort from the datamodel - uksort($aSortedTransitions, function($sKey1, $sKey2) use ($aSortedTransitions, $aStatesSortFromDatamodel) { + uksort($aSortedTransitions, function ($sKey1, $sKey2) use ($aSortedTransitions, $aStatesSortFromDatamodel) { $sTargetState1 = $aSortedTransitions[$sKey1]['target_state']; $sTargetState2 = $aSortedTransitions[$sKey2]['target_state']; @@ -4463,25 +4243,24 @@ abstract class DBObject implements iDisplay } } - /** - * Helper to reset a stop-watch - * Suitable for use as a lifecycle action - * - * @api - * - * @param string $sAttCode - * - * @return bool - * - * @throws ArchivedObjectException - * @throws CoreException - * @throws CoreUnexpectedValue - */ + /** + * Helper to reset a stop-watch + * Suitable for use as a lifecycle action + * + * @api + * + * @param string $sAttCode + * + * @return bool + * + * @throws ArchivedObjectException + * @throws CoreException + * @throws CoreUnexpectedValue + */ public function ResetStopWatch($sAttCode) { $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); - if (!$oAttDef instanceof AttributeStopWatch) - { + if (!$oAttDef instanceof AttributeStopWatch) { throw new CoreException("Invalid stop watch id: '$sAttCode'"); } $oSW = $this->Get($sAttCode); @@ -4514,8 +4293,7 @@ abstract class DBObject implements iDisplay $this->LogCRUDEnter(__METHOD__, "Code: $sStimulusCode"); $sClass = get_class($this); - if (!MetaModel::HasLifecycle($sClass)) - { + if (!MetaModel::HasLifecycle($sClass)) { throw new CoreException('No lifecycle for the class '.$sClass); } @@ -4523,15 +4301,14 @@ abstract class DBObject implements iDisplay $sStateAttCode = MetaModel::GetStateAttributeCode($sClass); $aStateTransitions = $this->EnumTransitions(); - if (!array_key_exists($sStimulusCode, $aStateTransitions)) - { + if (!array_key_exists($sStimulusCode, $aStateTransitions)) { // This stimulus has no effect in the current state... do nothing IssueLog::Error("$sClass: Transition $sStimulusCode is not allowed in ".$this->Get($sStateAttCode)); return false; } // save current object values in case of an action failure (in memory rollback) - $aBackupValues = array(); - foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + $aBackupValues = []; + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { if (isset($this->m_aCurrValues[$sAttCode])) { $value = $this->m_aCurrValues[$sAttCode]; if (is_object($value)) { @@ -4562,19 +4339,18 @@ abstract class DBObject implements iDisplay foreach ($aTransitionDef['actions'] as $actionHandler) { if (is_string($actionHandler)) { // Old (pre-2.1.0 modules) action definition without any parameter - $aActionCallSpec = array($this, $actionHandler); + $aActionCallSpec = [$this, $actionHandler]; $sActionDesc = $sClass.'::'.$actionHandler; if (!is_callable($aActionCallSpec)) { throw new CoreException("Unable to call action: $sClass::$actionHandler"); } $bRet = call_user_func($aActionCallSpec, $sStimulusCode); - } else // if (is_array($actionHandler)) - { + } else { // if (is_array($actionHandler)) // New syntax: 'verb' and typed parameters $sAction = $actionHandler['verb']; $sActionDesc = "$sClass::$sAction"; - $aParams = array(); + $aParams = []; foreach ($actionHandler['params'] as $aDefinition) { $sParamType = array_key_exists('type', $aDefinition) ? $aDefinition['type'] : 'string'; switch ($sParamType) { @@ -4600,7 +4376,7 @@ abstract class DBObject implements iDisplay } $aParams[] = $value; } - $aCallSpec = array($this, $sAction); + $aCallSpec = [$this, $sAction]; $bRet = call_user_func_array($aCallSpec, $aParams); } // if one call fails, the whole is considered as failed @@ -4617,17 +4393,13 @@ abstract class DBObject implements iDisplay } $this->RemoveCurrentObjectInCrudStack(); } - if ($bSuccess) - { + if ($bSuccess) { $this->sStimulusBeingApplied = $sStimulusCode; // Stop watches - foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - if ($oAttDef instanceof AttributeStopWatch) - { + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if ($oAttDef instanceof AttributeStopWatch) { $oSW = $this->Get($sAttCode); - if (in_array($sNewState, $oAttDef->GetStates())) - { + if (in_array($sNewState, $oAttDef->GetStates())) { $oSW->Start($this, $oAttDef); } else { $oSW->Stop($this, $oAttDef); @@ -4639,12 +4411,9 @@ abstract class DBObject implements iDisplay if (!$bDoNotWrite) { $this->DBWrite(); } - } - else - { + } else { // At least one action failed, rollback the object value to its previous value - foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { $this->m_aCurrValues[$sAttCode] = $aBackupValues[$sAttCode]; } } @@ -4668,10 +4437,10 @@ abstract class DBObject implements iDisplay /** * Helper to recover the default value (aka when an object is being created) - * Suitable for use as a lifecycle action - * - * @api - * + * Suitable for use as a lifecycle action + * + * @api + * */ public function Reset($sAttCode) { @@ -4680,35 +4449,26 @@ abstract class DBObject implements iDisplay } /** - * Helper to copy the value of an attribute to another one - * Suitable for use as a lifecycle action - * - * @api + * Helper to copy the value of an attribute to another one + * Suitable for use as a lifecycle action + * + * @api */ public function Copy($sDestAttCode, $sSourceAttCode) { $oTypeValueToCopy = MetaModel::GetAttributeDef(get_class($this), $sSourceAttCode); $oTypeValueDest = MetaModel::GetAttributeDef(get_class($this), $sDestAttCode); - if ($oTypeValueToCopy instanceof AttributeText && $oTypeValueDest instanceof AttributeText) - { - if ($oTypeValueToCopy->GetFormat() == $oTypeValueDest->GetFormat()) - { + if ($oTypeValueToCopy instanceof AttributeText && $oTypeValueDest instanceof AttributeText) { + if ($oTypeValueToCopy->GetFormat() == $oTypeValueDest->GetFormat()) { $sValueToCopy = $this->Get($sSourceAttCode); - } - else - { - if ($oTypeValueToCopy->GetFormat() == 'text')// and $oTypeValueDest->GetFormat()=='HTML' - { + } else { + if ($oTypeValueToCopy->GetFormat() == 'text') {// and $oTypeValueDest->GetFormat()=='HTML' $sValueToCopy = $this->GetAsHTML($sSourceAttCode); - } - else - {// $oTypeValueToCopy->GetFormat() == 'HTML' and $oTypeValueDest->GetFormat()=='Text' + } else {// $oTypeValueToCopy->GetFormat() == 'HTML' and $oTypeValueDest->GetFormat()=='Text' $sValueToCopy = utils::HtmlToText($this->Get($sSourceAttCode)); } } - } - else - { + } else { $sValueToCopy = $this->Get($sSourceAttCode); } $this->Set($sDestAttCode, $sValueToCopy); @@ -4716,19 +4476,19 @@ abstract class DBObject implements iDisplay return true; } - /** - * Helper to set the current date/time for the given attribute - * Suitable for use as a lifecycle action - * - * @api - * - * @param string $sAttCode - * - * @return bool - * - * @throws CoreException - * @throws CoreUnexpectedValue - */ + /** + * Helper to set the current date/time for the given attribute + * Suitable for use as a lifecycle action + * + * @api + * + * @param string $sAttCode + * + * @return bool + * + * @throws CoreException + * @throws CoreUnexpectedValue + */ public function SetCurrentDate($sAttCode) { $this->Set($sAttCode, time()); @@ -4834,7 +4594,6 @@ abstract class DBObject implements iDisplay } } - /** * Helper to set the current logged in user for the given attribute * Suitable for use as a lifecycle action @@ -4866,42 +4625,34 @@ abstract class DBObject implements iDisplay return true; } - /** - * Helper to set the current logged in CONTACT for the given attribute - * Suitable for use as a lifecycle action - * - * @api - * - * @param string $sAttCode - * - * @return bool - * @throws ArchivedObjectException - * @throws CoreException - * @throws CoreUnexpectedValue - */ + /** + * Helper to set the current logged in CONTACT for the given attribute + * Suitable for use as a lifecycle action + * + * @api + * + * @param string $sAttCode + * + * @return bool + * @throws ArchivedObjectException + * @throws CoreException + * @throws CoreUnexpectedValue + */ public function SetCurrentPerson($sAttCode) { $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); - if ($oAttDef instanceof AttributeString) - { + if ($oAttDef instanceof AttributeString) { $iPerson = UserRights::GetContactId(); - if ($iPerson == 0) - { + if ($iPerson == 0) { $this->Set($sAttCode, ''); - } - else - { + } else { $oPerson = MetaModel::GetObject('Person', $iPerson); $this->Set($sAttCode, $oPerson->Get('friendlyname')); } - } - else - { - if ($oAttDef->IsExternalKey()) - { + } else { + if ($oAttDef->IsExternalKey()) { /** @var \AttributeExternalKey $oAttDef */ - if (!MetaModel::IsParentClass($oAttDef->GetTargetClass(), 'Person')) - { + if (!MetaModel::IsParentClass($oAttDef->GetTargetClass(), 'Person')) { throw new Exception("SetCurrentContact: the attribute $sAttCode must be an external key to 'Person' or any other class above 'Person', found '".$oAttDef->GetTargetClass()."'"); } } @@ -4910,31 +4661,29 @@ abstract class DBObject implements iDisplay return true; } - /** - * Helper to set the time elapsed since a reference point - * Suitable for use as a lifecycle action - * - * @api - * - * @param string $sAttCode - * @param string $sRefAttCode - * @param string|null $sWorkingTimeComputer - * - * @return bool - * @throws ArchivedObjectException - * @throws CoreException - * @throws CoreUnexpectedValue - */ + /** + * Helper to set the time elapsed since a reference point + * Suitable for use as a lifecycle action + * + * @api + * + * @param string $sAttCode + * @param string $sRefAttCode + * @param string|null $sWorkingTimeComputer + * + * @return bool + * @throws ArchivedObjectException + * @throws CoreException + * @throws CoreUnexpectedValue + */ public function SetElapsedTime($sAttCode, $sRefAttCode, $sWorkingTimeComputer = null) { - if (is_null($sWorkingTimeComputer)) - { + if (is_null($sWorkingTimeComputer)) { $sWorkingTimeComputer = class_exists('SLAComputation') ? 'SLAComputation' : 'DefaultWorkingTimeComputer'; } $oComputer = new $sWorkingTimeComputer(); - $aCallSpec = array($oComputer, 'GetOpenDuration'); - if (!is_callable($aCallSpec)) - { + $aCallSpec = [$oComputer, 'GetOpenDuration']; + if (!is_callable($aCallSpec)) { throw new CoreException("Unknown class/verb '$sWorkingTimeComputer/GetOpenDuration'"); } @@ -4942,14 +4691,12 @@ abstract class DBObject implements iDisplay $oStartDate = new DateTime('@'.$iStartTime); // setTimestamp not available in PHP 5.2 $oEndDate = new DateTime(); // now - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { $sClass = get_class($this); - WorkingTimeRecorder::Start($this, time(), "DBObject-SetElapsedTime-$sAttCode-$sRefAttCode", 'Core:ExplainWTC:ElapsedTime', array("Class:$sClass/Attribute:$sAttCode")); + WorkingTimeRecorder::Start($this, time(), "DBObject-SetElapsedTime-$sAttCode-$sRefAttCode", 'Core:ExplainWTC:ElapsedTime', ["Class:$sClass/Attribute:$sAttCode"]); } $iElapsed = call_user_func($aCallSpec, $this, $oStartDate, $oEndDate); - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::End(); } @@ -4957,219 +4704,197 @@ abstract class DBObject implements iDisplay return true; } - - /** - * Create query parameters (SELECT ... WHERE service = :this->service_id) - * to be used with the APIs DBObjectSearch/DBObjectSet - * - * Starting 2.0.2 the parameters are computed on demand, at the lowest level, - * in VariableExpression::Render() - * - * @internal - * - * @param string $sArgName - * - * @return array - */ + /** + * Create query parameters (SELECT ... WHERE service = :this->service_id) + * to be used with the APIs DBObjectSearch/DBObjectSet + * + * Starting 2.0.2 the parameters are computed on demand, at the lowest level, + * in VariableExpression::Render() + * + * @internal + * + * @param string $sArgName + * + * @return array + */ public function ToArgsForQuery($sArgName = 'this') { - return array($sArgName.'->object()' => $this); + return [$sArgName.'->object()' => $this]; } - /** - * Create template placeholders: now equivalent to ToArgsForQuery since the actual - * template placeholders are computed on demand. - * - * @internal - * - * @param string $sArgName - * - * @return array - */ + /** + * Create template placeholders: now equivalent to ToArgsForQuery since the actual + * template placeholders are computed on demand. + * + * @internal + * + * @param string $sArgName + * + * @return array + */ public function ToArgs($sArgName = 'this') { return $this->ToArgsForQuery($sArgName); } - /** - * Get various representations of the value, for insertion into a template (e.g. in Notifications) - * - * @internal - * - * @param string $sPlaceholderAttCode - * - * @return int|mixed|string|null - * @throws ArchivedObjectException - * @throws CoreException - * @throws DictExceptionMissingString - */ + /** + * Get various representations of the value, for insertion into a template (e.g. in Notifications) + * + * @internal + * + * @param string $sPlaceholderAttCode + * + * @return int|mixed|string|null + * @throws ArchivedObjectException + * @throws CoreException + * @throws DictExceptionMissingString + */ public function GetForTemplate($sPlaceholderAttCode) { $ret = null; - if (preg_match('/^([^-]+)-(>|>)(.+)$/', $sPlaceholderAttCode, $aMatches)) // Support both syntaxes: this->xxx or this->xxx for HTML compatibility - { + if (preg_match('/^([^-]+)-(>|>)(.+)$/', $sPlaceholderAttCode, $aMatches)) { // Support both syntaxes: this->xxx or this->xxx for HTML compatibility $sExtKeyAttCode = $aMatches[1]; $sRemoteAttCode = $aMatches[3]; - if (!MetaModel::IsValidAttCode(get_class($this), $sExtKeyAttCode)) - { + if (!MetaModel::IsValidAttCode(get_class($this), $sExtKeyAttCode)) { throw new CoreException("Unknown attribute '$sExtKeyAttCode' for the class ".get_class($this)); } $oKeyAttDef = MetaModel::GetAttributeDef(get_class($this), $sExtKeyAttCode); - if (!$oKeyAttDef instanceof AttributeExternalKey) - { + if (!$oKeyAttDef instanceof AttributeExternalKey) { throw new CoreException("'$sExtKeyAttCode' is not an external key of the class ".get_class($this)); } $sRemoteClass = $oKeyAttDef->GetTargetClass(); $oRemoteObj = MetaModel::GetObject($sRemoteClass, $this->GetStrict($sExtKeyAttCode), false); - if (is_null($oRemoteObj)) - { + if (is_null($oRemoteObj)) { $ret = Dict::S('UI:UndefinedObject'); - } - else - { + } else { // Recurse $ret = $oRemoteObj->GetForTemplate($sRemoteAttCode); } - } - else - { - switch($sPlaceholderAttCode) - { + } else { + switch ($sPlaceholderAttCode) { case 'id': - $ret = $this->GetKey(); - break; + $ret = $this->GetKey(); + break; case 'name()': - $ret = $this->GetName(); - break; + $ret = $this->GetName(); + break; default: - if (preg_match('/^([^(]+)\\((.*)\\)$/', $sPlaceholderAttCode, $aMatches)) - { - $sVerb = $aMatches[1]; - $sAttCode = $aMatches[2]; - } - else - { - $sVerb = ''; - $sAttCode = $sPlaceholderAttCode; - } - - if (in_array($sVerb, ['hyperlink', 'url'])) - { - $sPortalId = ($sAttCode === '') ? 'console' : $sAttCode; - if (!array_key_exists($sPortalId, self::$aPortalToURLMaker)) - { - throw new Exception("Unknown portal id '$sPortalId' in placeholder '$sPlaceholderAttCode''"); + if (preg_match('/^([^(]+)\\((.*)\\)$/', $sPlaceholderAttCode, $aMatches)) { + $sVerb = $aMatches[1]; + $sAttCode = $aMatches[2]; + } else { + $sVerb = ''; + $sAttCode = $sPlaceholderAttCode; } - if($sVerb == 'hyperlink') - { - $ret = $this->GetHyperlink(self::$aPortalToURLMaker[$sPortalId], false); + if (in_array($sVerb, ['hyperlink', 'url'])) { + $sPortalId = ($sAttCode === '') ? 'console' : $sAttCode; + if (!array_key_exists($sPortalId, self::$aPortalToURLMaker)) { + throw new Exception("Unknown portal id '$sPortalId' in placeholder '$sPlaceholderAttCode''"); + } + + if ($sVerb == 'hyperlink') { + $ret = $this->GetHyperlink(self::$aPortalToURLMaker[$sPortalId], false); + } else { + $ret = ApplicationContext::MakeObjectUrl(get_class($this), $this->GetKey(), self::$aPortalToURLMaker[$sPortalId], false); + } + } else { + $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); + $ret = $oAttDef->GetForTemplate($this->Get($sAttCode), $sVerb, $this); } - else - { - $ret = ApplicationContext::MakeObjectUrl(get_class($this), $this->GetKey(), self::$aPortalToURLMaker[$sPortalId], false); - } - } - else - { - $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); - $ret = $oAttDef->GetForTemplate($this->Get($sAttCode), $sVerb, $this); - } } - if ($ret === null) - { + if ($ret === null) { $ret = ''; } } return $ret; } - static protected $aPortalToURLMaker = array('console' => 'iTopStandardURLMaker', 'portal' => 'PortalURLMaker'); + protected static $aPortalToURLMaker = ['console' => 'iTopStandardURLMaker', 'portal' => 'PortalURLMaker']; /** * Associate a portal to a class that implements iDBObjectURLMaker, * and which will be invoked with placeholders like $this->org_id->hyperlink(portal)$ * - * @internal - * + * @internal + * * @param string $sPortalId Identifies the portal. Conventions: the main portal is 'console', The user requests portal is 'portal'. * @param string $sUrlMakerClass */ - static public function RegisterURLMakerClass($sPortalId, $sUrlMakerClass) + public static function RegisterURLMakerClass($sPortalId, $sUrlMakerClass) { self::$aPortalToURLMaker[$sPortalId] = $sUrlMakerClass; } /** * this method is called before the object is inserted into DB. - * - * + * + * * @overwritable-hook You can extend this method in order to provide your own logic. */ protected function OnInsert() { } - /** - * this method is called after the object is inserted into DB. - * - * @overwritable-hook You can extend this method in order to provide your own logic. - */ + /** + * this method is called after the object is inserted into DB. + * + * @overwritable-hook You can extend this method in order to provide your own logic. + */ protected function AfterInsert() { } - /** - * this method is called before the object is updated into DB. - * - * @overwritable-hook You can extend this method in order to provide your own logic. - */ + /** + * this method is called before the object is updated into DB. + * + * @overwritable-hook You can extend this method in order to provide your own logic. + */ protected function OnUpdate() { } - /** - * @overwritable-hook You can extend this method in order to provide your own logic. - * - * This method is called after the object is updated into DB, and just before the {@see DBObject::Reload()} call. - * - * Warning : do not use {@see DBObject::ListChanges()} as it will return an empty array ! - * Use instead {@see DBObject::ListPreviousValuesForUpdatedAttributes()} to get modified fields and their previous values, - * and {@see DBObject::Get()} to get the persisted value for a given attribute. - * - * @since 2.7.0 N°2293 can access object changes by calling {@see DBObject::ListPreviousValuesForUpdatedAttributes()} - */ + /** + * @overwritable-hook You can extend this method in order to provide your own logic. + * + * This method is called after the object is updated into DB, and just before the {@see DBObject::Reload()} call. + * + * Warning : do not use {@see DBObject::ListChanges()} as it will return an empty array ! + * Use instead {@see DBObject::ListPreviousValuesForUpdatedAttributes()} to get modified fields and their previous values, + * and {@see DBObject::Get()} to get the persisted value for a given attribute. + * + * @since 2.7.0 N°2293 can access object changes by calling {@see DBObject::ListPreviousValuesForUpdatedAttributes()} + */ protected function AfterUpdate() { } - /** - * this method is called before the object is deleted into DB. - * - * @overwritable-hook You can extend this method in order to provide your own logic. - */ + /** + * this method is called before the object is deleted into DB. + * + * @overwritable-hook You can extend this method in order to provide your own logic. + */ protected function OnDelete() { } - /** - * this method is called after the object is deleted into DB. - * - * @overwritable-hook You can extend this method in order to provide your own logic. - */ + /** + * this method is called after the object is deleted into DB. + * + * @overwritable-hook You can extend this method in order to provide your own logic. + */ protected function AfterDelete() { } - /** * Common to the recording of link set changes (add/remove/modify) * - * @internal - * + * @internal + * * @param $iLinkSetOwnerId * @param \AttributeLinkedSet $oLinkSet * @param $sChangeOpClass @@ -5182,39 +4907,31 @@ abstract class DBObject implements iDisplay */ private function PrepareChangeOpLinkSet($iLinkSetOwnerId, $oLinkSet, $sChangeOpClass, $aOriginalValues = null) { - if ($iLinkSetOwnerId <= 0) - { + if ($iLinkSetOwnerId <= 0) { return null; } - if (!is_subclass_of($oLinkSet->GetHostClass(), 'CMDBObject')) - { + if (!is_subclass_of($oLinkSet->GetHostClass(), 'CMDBObject')) { // The link set owner class does not keep track of its history return null; } // Determine the linked item class and id // - if ($oLinkSet->IsIndirect()) - { + if ($oLinkSet->IsIndirect()) { // The "item" is on the other end (N-N links) /** @var \AttributeLinkedSetIndirect $oLinkSet */ $sExtKeyToRemote = $oLinkSet->GetExtKeyToRemote(); $oExtKeyToRemote = MetaModel::GetAttributeDef(get_class($this), $sExtKeyToRemote); /** @var \AttributeExternalKey $oExtKeyToRemote */ $sItemClass = $oExtKeyToRemote->GetTargetClass(); - if ($aOriginalValues) - { + if ($aOriginalValues) { // Get the value from the original values $iItemId = $aOriginalValues[$sExtKeyToRemote]; - } - else - { + } else { $iItemId = $this->Get($sExtKeyToRemote); } - } - else - { + } else { // I am the "item" (1-N links) $sItemClass = get_class($this); $iItemId = $this->GetKey(); @@ -5223,8 +4940,7 @@ abstract class DBObject implements iDisplay // Get the remote object, to determine its exact class // Possible optimization: implement a tool in MetaModel, to get the final class of an object (not always querying + query reduced to a select on the root table! $oOwner = MetaModel::GetObject($oLinkSet->GetHostClass(), $iLinkSetOwnerId, false); - if ($oOwner) - { + if ($oOwner) { $sLinkSetOwnerClass = get_class($oOwner); $oMyChangeOp = MetaModel::NewObject($sChangeOpClass); @@ -5234,9 +4950,7 @@ abstract class DBObject implements iDisplay $oMyChangeOp->Set("item_class", $sItemClass); $oMyChangeOp->Set("item_id", $iItemId); return $oMyChangeOp; - } - else - { + } else { // Depending on the deletion order, it may happen that the id is already invalid... ignore return null; } @@ -5249,21 +4963,18 @@ abstract class DBObject implements iDisplay */ private function RecordLinkSetListChange($bAdd = true) { - foreach(MetaModel::GetTrackForwardExternalKeys(get_class($this)) as $sExtKeyAttCode => $oLinkSet) - { + foreach (MetaModel::GetTrackForwardExternalKeys(get_class($this)) as $sExtKeyAttCode => $oLinkSet) { /** @var \AttributeLinkedSet $oLinkSet */ - if (($oLinkSet->GetTrackingLevel() & LINKSET_TRACKING_LIST) == 0) continue; + if (($oLinkSet->GetTrackingLevel() & LINKSET_TRACKING_LIST) == 0) { + continue; + } $iLinkSetOwnerId = $this->Get($sExtKeyAttCode); $oMyChangeOp = $this->PrepareChangeOpLinkSet($iLinkSetOwnerId, $oLinkSet, 'CMDBChangeOpSetAttributeLinksAddRemove'); - if ($oMyChangeOp) - { - if ($bAdd) - { + if ($oMyChangeOp) { + if ($bAdd) { $oMyChangeOp->Set("type", "added"); - } - else - { + } else { $oMyChangeOp->Set("type", "removed"); } $oMyChangeOp->DBInsertNoReload(); @@ -5279,55 +4990,52 @@ abstract class DBObject implements iDisplay $this->RecordLinkSetListChange(true); } - /** - * @internal - */ + /** + * @internal + */ protected function RecordObjDeletion($objkey) { $this->RecordLinkSetListChange(false); } - /** - * @internal - */ + /** + * @internal + */ protected function RecordAttChanges(array $aValues, array $aOrigValues) { - foreach(MetaModel::GetTrackForwardExternalKeys(get_class($this)) as $sExtKeyAttCode => $oLinkSet) - { + foreach (MetaModel::GetTrackForwardExternalKeys(get_class($this)) as $sExtKeyAttCode => $oLinkSet) { - if (array_key_exists($sExtKeyAttCode, $aValues)) - { + if (array_key_exists($sExtKeyAttCode, $aValues)) { /** @var \AttributeLinkedSet $oLinkSet */ - if (($oLinkSet->GetTrackingLevel() & LINKSET_TRACKING_LIST) == 0) continue; + if (($oLinkSet->GetTrackingLevel() & LINKSET_TRACKING_LIST) == 0) { + continue; + } // Keep track of link added/removed // $iLinkSetOwnerNext = $aValues[$sExtKeyAttCode]; $oMyChangeOp = $this->PrepareChangeOpLinkSet($iLinkSetOwnerNext, $oLinkSet, 'CMDBChangeOpSetAttributeLinksAddRemove'); - if ($oMyChangeOp) - { + if ($oMyChangeOp) { $oMyChangeOp->Set("type", "added"); $oMyChangeOp->DBInsertNoReload(); } $iLinkSetOwnerPrevious = $aOrigValues[$sExtKeyAttCode]; $oMyChangeOp = $this->PrepareChangeOpLinkSet($iLinkSetOwnerPrevious, $oLinkSet, 'CMDBChangeOpSetAttributeLinksAddRemove', $aOrigValues); - if ($oMyChangeOp) - { + if ($oMyChangeOp) { $oMyChangeOp->Set("type", "removed"); $oMyChangeOp->DBInsertNoReload(); } - } - else - { + } else { // Keep track of link changes // - if (($oLinkSet->GetTrackingLevel() & LINKSET_TRACKING_DETAILS) == 0) continue; - + if (($oLinkSet->GetTrackingLevel() & LINKSET_TRACKING_DETAILS) == 0) { + continue; + } + $iLinkSetOwnerId = $this->Get($sExtKeyAttCode); $oMyChangeOp = $this->PrepareChangeOpLinkSet($iLinkSetOwnerId, $oLinkSet, 'CMDBChangeOpSetAttributeLinksTune'); - if ($oMyChangeOp) - { + if ($oMyChangeOp) { $oMyChangeOp->Set("link_id", $this->GetKey()); $oMyChangeOp->DBInsertNoReload(); } @@ -5335,31 +5043,29 @@ abstract class DBObject implements iDisplay } } - - - /** - * Reserved: do not overload - * - * @internal - */ + /** + * Reserved: do not overload + * + * @internal + */ public static function GetRelationQueriesEx($sRelCode) { - return array(); + return []; } - /** - * Compute the "RelatedObjects" (forward or "down" direction) for the object - * for the specified relation - * - * @internal - * - * @param string $sRelCode The code of the relation to use for the computation - * @param int $iMaxDepth Maximum recursion depth - * @param bool $bEnableRedundancy - * - * @return RelationGraph The graph of all the related objects - * @throws CoreException - */ + /** + * Compute the "RelatedObjects" (forward or "down" direction) for the object + * for the specified relation + * + * @internal + * + * @param string $sRelCode The code of the relation to use for the computation + * @param int $iMaxDepth Maximum recursion depth + * @param bool $bEnableRedundancy + * + * @return RelationGraph The graph of all the related objects + * @throws CoreException + */ public function GetRelatedObjectsDown($sRelCode, $iMaxDepth = 99, $bEnableRedundancy = true) { $oGraph = new RelationGraph(); @@ -5368,19 +5074,19 @@ abstract class DBObject implements iDisplay return $oGraph; } - /** - * Compute the "RelatedObjects" (reverse or "up" direction) for the object - * for the specified relation - * - * @internal - * - * @param string $sRelCode The code of the relation to use for the computation - * @param int $iMaxDepth Maximum recursion depth - * @param bool $bEnableRedundancy - * - * @return RelationGraph The graph of all the related objects - * @throws CoreException - */ + /** + * Compute the "RelatedObjects" (reverse or "up" direction) for the object + * for the specified relation + * + * @internal + * + * @param string $sRelCode The code of the relation to use for the computation + * @param int $iMaxDepth Maximum recursion depth + * @param bool $bEnableRedundancy + * + * @return RelationGraph The graph of all the related objects + * @throws CoreException + */ public function GetRelatedObjectsUp($sRelCode, $iMaxDepth = 99, $bEnableRedundancy = true) { $oGraph = new RelationGraph(); @@ -5403,32 +5109,32 @@ abstract class DBObject implements iDisplay */ protected function GetReferencingObjectsForDeletion($bAllowAllData = false) { - $aDependentObjects = array(); + $aDependentObjects = []; $aRererencingMe = MetaModel::EnumReferencingClasses(get_class($this)); - foreach($aRererencingMe as $sRemoteClass => $aExtKeys) - { + foreach ($aRererencingMe as $sRemoteClass => $aExtKeys) { /** @var \AttributeExternalKey $oExtKeyAttDef */ - foreach($aExtKeys as $sExtKeyAttCode => $oExtKeyAttDef) - { + foreach ($aExtKeys as $sExtKeyAttCode => $oExtKeyAttDef) { // skip if external key doesn't require the deletion cascading - if($oExtKeyAttDef->GetDeletionPropagationOption() === DEL_NONE) continue; + if ($oExtKeyAttDef->GetDeletionPropagationOption() === DEL_NONE) { + continue; + } // skip if this external key is behind an external field - if (!$oExtKeyAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) continue; + if (!$oExtKeyAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) { + continue; + } $oSearch = new DBObjectSearch($sRemoteClass); $oSearch->AddCondition($sExtKeyAttCode, $this->GetKey(), '='); - if ($bAllowAllData) - { + if ($bAllowAllData) { $oSearch->AllowAllData(); } $oSet = new CMDBObjectSet($oSearch); - if ($oSet->CountExceeds(0)) - { - $aDependentObjects[$sRemoteClass][$sExtKeyAttCode] = array( + if ($oSet->CountExceeds(0)) { + $aDependentObjects[$sRemoteClass][$sExtKeyAttCode] = [ 'attribute' => $oExtKeyAttDef, 'objects' => $oSet, - ); + ]; } } } @@ -5436,19 +5142,18 @@ abstract class DBObject implements iDisplay } /** - * @internal - * + * @internal + * * @param \DeletionPlan $oDeletionPlan * @param array $aVisited * @param int $iDeleteOption * * @throws \CoreException */ - private function MakeDeletionPlan(&$oDeletionPlan, $aVisited = array(), $iDeleteOption = null) + private function MakeDeletionPlan(&$oDeletionPlan, $aVisited = [], $iDeleteOption = null) { static $iLoopTimeLimit = null; - if ($iLoopTimeLimit == null) - { + if ($iLoopTimeLimit == null) { $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop'); } $sClass = get_class($this); @@ -5456,22 +5161,19 @@ abstract class DBObject implements iDisplay $oDeletionPlan->AddToDelete($this, $iDeleteOption); - if (array_key_exists($sClass, $aVisited)) - { - if (in_array($iThisId, $aVisited[$sClass])) - { + if (array_key_exists($sClass, $aVisited)) { + if (in_array($iThisId, $aVisited[$sClass])) { return; } } $aVisited[$sClass] = $iThisId; - if ($iDeleteOption == DEL_MANUAL) - { + if ($iDeleteOption == DEL_MANUAL) { // Stop the recursion here return; } // Check the node itself - $this->m_aDeleteIssues = array(); // Ok + $this->m_aDeleteIssues = []; // Ok $this->FireEventCheckToDelete($oDeletionPlan); $this->DoCheckToDelete($oDeletionPlan); $this->CheckToWriteForTargetObjects(true); @@ -5481,10 +5183,8 @@ abstract class DBObject implements iDisplay // www.php.net/manual/fr/function.set-time-limit.php#72305 $iPreviousTimeLimit = ini_get('max_execution_time'); - foreach ($this->GetReferencingObjectsForDeletion(true /* allow all data */) as $aPotentialDeletes) - { - foreach ($aPotentialDeletes as $aData) - { + foreach ($this->GetReferencingObjectsForDeletion(true /* allow all data */) as $aPotentialDeletes) { + foreach ($aPotentialDeletes as $aData) { set_time_limit(intval($iLoopTimeLimit)); /** @var \AttributeExternalKey $oAttDef */ @@ -5493,24 +5193,17 @@ abstract class DBObject implements iDisplay /** @var \DBObjectSet $oDepSet */ $oDepSet = $aData['objects']; $oDepSet->Rewind(); - while ($oDependentObj = $oDepSet->fetch()) - { - if ($oAttDef->IsNullAllowed()) - { + while ($oDependentObj = $oDepSet->fetch()) { + if ($oAttDef->IsNullAllowed()) { // Optional external key, list to reset - if (($iDeletePropagationOption == DEL_MOVEUP) && ($oAttDef->IsHierarchicalKey())) - { + if (($iDeletePropagationOption == DEL_MOVEUP) && ($oAttDef->IsHierarchicalKey())) { // Move the child up one level i.e. set the same parent as the current object $iParentId = $this->Get($oAttDef->GetCode()); $oDeletionPlan->AddToUpdate($oDependentObj, $oAttDef, $iParentId); - } - else - { + } else { $oDeletionPlan->AddToUpdate($oDependentObj, $oAttDef); } - } - else - { + } else { // Mandatory external key, list to delete $oDependentObj->MakeDeletionPlan($oDeletionPlan, $aVisited, $iDeletePropagationOption); } @@ -5525,9 +5218,9 @@ abstract class DBObject implements iDisplay * Use GetSynchroData instead * * Get all the synchro replica related to this object - * - * @internal - * @deprecated + * + * @internal + * @deprecated * * @return DBObjectSet Set with two columns: R=SynchroReplica S=SynchroDataSource * @throws \OQLException @@ -5536,15 +5229,15 @@ abstract class DBObject implements iDisplay { DeprecatedCallsLog::NotifyDeprecatedPhpMethod(); $sOQL = "SELECT replica,datasource FROM SynchroReplica AS replica JOIN SynchroDataSource AS datasource ON replica.sync_source_id=datasource.id WHERE replica.dest_class = :dest_class AND replica.dest_id = :dest_id"; - $oReplicaSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array() /* order by*/, array('dest_class' => get_class($this), 'dest_id' => $this->GetKey())); + $oReplicaSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), [] /* order by*/, ['dest_class' => get_class($this), 'dest_id' => $this->GetKey()]); return $oReplicaSet; } /** * Get all the synchro data related to this object - * - * @internal + * + * @internal * * @return array of data_source_id => array * * 'source' => $oSource, @@ -5562,23 +5255,23 @@ abstract class DBObject implements iDisplay if (!$bIncludeObsolete) { $sOQL .= " AND replica.status != 'obsolete'"; } - $oReplicaSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array() /* order by*/, array('dest_class' => get_class($this), 'dest_id' => $this->GetKey())); - $this->m_aSynchroData = array(); + $oReplicaSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), [] /* order by*/, ['dest_class' => get_class($this), 'dest_id' => $this->GetKey()]); + $this->m_aSynchroData = []; while ($aData = $oReplicaSet->FetchAssoc()) { /** @var \DBObject[] $aData */ $iSourceId = $aData['datasource']->GetKey(); if (!array_key_exists($iSourceId, $this->m_aSynchroData)) { - $aAttributes = array(); + $aAttributes = []; $oAttrSet = $aData['datasource']->Get('attribute_list'); while ($oSyncAttr = $oAttrSet->Fetch()) { /** @var \DBObject $oSyncAttr */ $aAttributes[$oSyncAttr->Get('attcode')] = $oSyncAttr; } - $this->m_aSynchroData[$iSourceId] = array( + $this->m_aSynchroData[$iSourceId] = [ 'source' => $aData['datasource'], 'attributes' => $aAttributes, - 'replica' => array() - ); + 'replica' => [], + ]; } // Assumption: $aData['datasource'] will not be null because the data source id is always set... $this->m_aSynchroData[$iSourceId]['replica'][] = $aData['replica']; @@ -5587,20 +5280,20 @@ abstract class DBObject implements iDisplay return $this->m_aSynchroData; } - /** - * - * @internal - * - * @param string $sAttCode - * @param array $aReason - * - * @return int - * @throws ArchivedObjectException - * @throws CoreException - * @throws CoreUnexpectedValue - * @throws MySQLException - * @throws OQLException - */ + /** + * + * @internal + * + * @param string $sAttCode + * @param array $aReason + * + * @return int + * @throws ArchivedObjectException + * @throws CoreException + * @throws CoreUnexpectedValue + * @throws MySQLException + * @throws OQLException + */ public function GetSynchroReplicaFlags($sAttCode, &$aReason) { $iFlags = OPT_ATT_NORMAL; @@ -5615,12 +5308,11 @@ abstract class DBObject implements iDisplay if (array_key_exists($sAttCode, $aSourceData['attributes'])) { /** @var \DBObject $oSyncAttr */ $oSyncAttr = $aSourceData['attributes'][$sAttCode]; - if (($oSyncAttr->Get('update') == 1) && ($oSyncAttr->Get('update_policy') == 'master_locked')) - { + if (($oSyncAttr->Get('update') == 1) && ($oSyncAttr->Get('update_policy') == 'master_locked')) { $iFlags |= OPT_ATT_SLAVE; /** @var \SynchroDataSource $oSource */ $sUrl = $oSource->GetApplicationUrl($this, $oReplica); - $aReason[] = array('name' => $oSource->GetName(), 'description' => $oSource->Get('description'), 'url_application' => $sUrl); + $aReason[] = ['name' => $oSource->GetName(), 'description' => $oSource->Get('description'), 'url_application' => $sUrl]; } } } @@ -5628,9 +5320,9 @@ abstract class DBObject implements iDisplay } /** - * - * @internal - * + * + * @internal + * * @return bool true if this object is used in a data synchro * @throws \CoreException * @throws \CoreUnexpectedValue @@ -5645,22 +5337,18 @@ abstract class DBObject implements iDisplay // Optimization: cache the list of Data Sources and classes candidates for synchro // static $aSynchroClasses = null; - if (is_null($aSynchroClasses)) - { - $aSynchroClasses = array(); + if (is_null($aSynchroClasses)) { + $aSynchroClasses = []; $sOQL = "SELECT SynchroDataSource AS datasource"; - $oSourceSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array() /* order by*/, array()); - while($oSource = $oSourceSet->Fetch()) - { + $oSourceSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), [] /* order by*/, []); + while ($oSource = $oSourceSet->Fetch()) { $sTarget = $oSource->Get('scope_class'); $aSynchroClasses[] = $sTarget; } } - foreach($aSynchroClasses as $sClass) - { - if ($this instanceof $sClass) - { + foreach ($aSynchroClasses as $sClass) { + if ($this instanceof $sClass) { return true; } } @@ -5672,86 +5360,79 @@ abstract class DBObject implements iDisplay // ///////////////////////////////////////////////////////////////////////// - /** - * @internal - * - * @param string $sContextParam - * - * @return string|null - */ + /** + * @internal + * + * @param string $sContextParam + * + * @return string|null + */ public static function MapContextParam($sContextParam) { return null; } - /** - * @internal - * - * @return String - * @throws ArchivedObjectException - * @throws CoreException - */ + /** + * @internal + * + * @return String + * @throws ArchivedObjectException + * @throws CoreException + */ public function GetHilightClass() { $sCode = $this->ComputeHighlightCode(); - if($sCode != '') - { + if ($sCode != '') { $aHighlightScale = MetaModel::GetHighlightScale(get_class($this)); - if (array_key_exists($sCode, $aHighlightScale)) - { + if (array_key_exists($sCode, $aHighlightScale)) { return $aHighlightScale[$sCode]['color']; } } return HILIGHT_CLASS_NONE; } - /** - * @internal - * - * @param WebPage $oPage - * @param bool $bEditMode - * - * @throws ArchivedObjectException - * @throws CoreException - * @throws DictExceptionMissingString - */ + /** + * @internal + * + * @param WebPage $oPage + * @param bool $bEditMode + * + * @throws ArchivedObjectException + * @throws CoreException + * @throws DictExceptionMissingString + */ public function DisplayDetails(WebPage $oPage, $bEditMode = false) { $oPage->add('

      '.MetaModel::GetName(get_class($this)).': '.$this->GetName().'

      '); - $aValues = array(); + $aValues = []; $aList = MetaModel::FlattenZList(MetaModel::GetZListItems(get_class($this), 'details')); - if (empty($aList)) - { + if (empty($aList)) { $aList = array_keys(MetaModel::ListAttributeDefs(get_class($this))); } - foreach($aList as $sAttCode) - { - $aValues[$sAttCode] = array('label' => MetaModel::GetLabel(get_class($this), $sAttCode), 'value' => $this->GetAsHTML($sAttCode)); + foreach ($aList as $sAttCode) { + $aValues[$sAttCode] = ['label' => MetaModel::GetLabel(get_class($this), $sAttCode), 'value' => $this->GetAsHTML($sAttCode)]; } $oPage->details($aValues); } - /** - * Computes a text-like fingerprint identifying the content of the object - * but excluding the specified columns - * - * @internal - * - * @param $aExcludedColumns array The list of columns to exclude - * - * @return string - * @throws ArchivedObjectException - * @throws CoreException - */ - public function Fingerprint($aExcludedColumns = array()) + /** + * Computes a text-like fingerprint identifying the content of the object + * but excluding the specified columns + * + * @internal + * + * @param $aExcludedColumns array The list of columns to exclude + * + * @return string + * @throws ArchivedObjectException + * @throws CoreException + */ + public function Fingerprint($aExcludedColumns = []) { $sFingerprint = ''; - foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) - { - if (!in_array($sAttCode, $aExcludedColumns)) - { - if ($oAttDef->IsPartOfFingerprint()) - { + foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { + if (!in_array($sAttCode, $aExcludedColumns)) { + if ($oAttDef->IsPartOfFingerprint()) { $sFingerprint .= chr(0).$oAttDef->Fingerprint($this->Get($sAttCode)); } } @@ -5762,8 +5443,8 @@ abstract class DBObject implements iDisplay /** * Execute a set of scripted actions onto the current object * See ExecAction for the syntax and features of the scripted actions - * - * @internal + * + * @internal * * @param $aActions array of statements (e.g. "set(name, Made after $source->name$)") * @param $aSourceObjects array of Alias => Context objects (Convention: some statements require the 'source' element @@ -5771,42 +5452,31 @@ abstract class DBObject implements iDisplay */ public function ExecActions($aActions, $aSourceObjects) { - foreach($aActions as $sAction) - { - try - { - if (preg_match('/^(\S*)\s*\((.*)\)$/ms', $sAction, $aMatches)) // multiline and newline matched by a dot - { + foreach ($aActions as $sAction) { + try { + if (preg_match('/^(\S*)\s*\((.*)\)$/ms', $sAction, $aMatches)) { // multiline and newline matched by a dot $sVerb = trim($aMatches[1]); $sParams = $aMatches[2]; // the coma is the separator for the parameters // comas can be escaped: \, - $sParams = str_replace(array("\\\\", "\\,"), array("__backslash__", "__coma__"), $sParams); + $sParams = str_replace(["\\\\", "\\,"], ["__backslash__", "__coma__"], $sParams); $sParams = trim($sParams); - if (strlen($sParams) == 0) - { - $aParams = array(); - } - else - { + if (strlen($sParams) == 0) { + $aParams = []; + } else { $aParams = explode(',', $sParams); - foreach ($aParams as &$sParam) - { - $sParam = str_replace(array("__backslash__", "__coma__"), array("\\", ","), $sParam); + foreach ($aParams as &$sParam) { + $sParam = str_replace(["__backslash__", "__coma__"], ["\\", ","], $sParam); $sParam = trim($sParam); } } $this->ExecAction($sVerb, $aParams, $aSourceObjects); - } - else - { + } else { throw new Exception("Invalid syntax"); } - } - catch(Exception $e) - { + } catch (Exception $e) { throw new Exception('Action: '.$sAction.' - '.$e->getMessage()); } } @@ -5815,8 +5485,8 @@ abstract class DBObject implements iDisplay /** * Helper to copy an attribute between two objects (in memory) * Originally designed for ExecAction() - * - * @internal + * + * @internal * * @param \DBObject $oSourceObject * @param $sSourceAttCode @@ -5828,8 +5498,7 @@ abstract class DBObject implements iDisplay */ public function CopyAttribute($oSourceObject, $sSourceAttCode, $sDestAttCode) { - if ($sSourceAttCode == 'id') - { + if ($sSourceAttCode == 'id') { $oSourceAttDef = null; } else { if (!MetaModel::IsValidAttCode(get_class($this), $sDestAttCode)) { @@ -5861,9 +5530,7 @@ abstract class DBObject implements iDisplay $oDestSet->AddItem($oLinkClone); } $this->Set($sDestAttCode, $oDestSet); - } - else - { + } else { $this->Set($sDestAttCode, $oSourceObject->Get($sSourceAttCode)); } } @@ -5881,9 +5548,9 @@ abstract class DBObject implements iDisplay * - add_to_list (source_key_att, dest_att, lnk_att, lnk_att_value) * - apply_stimulus (stimulus) * - call_method (method_name) - * - * - * @internal + * + * + * @internal * * @param $sVerb string Any of the verb listed above (e.g. "set") * @param $aParams array of strings (e.g. array('name', 'copied from $source->name$') @@ -5894,48 +5561,39 @@ abstract class DBObject implements iDisplay */ public function ExecAction($sVerb, $aParams, $aSourceObjects) { - switch($sVerb) - { + switch ($sVerb) { case 'clone': - if (!array_key_exists('source', $aSourceObjects)) - { + if (!array_key_exists('source', $aSourceObjects)) { throw new Exception('Missing conventional "source" object'); } $oObjectToRead = $aSourceObjects['source']; - foreach($aParams as $sAttCode) - { + foreach ($aParams as $sAttCode) { $this->CopyAttribute($oObjectToRead, $sAttCode, $sAttCode); } break; case 'clone_scalars': - if (!array_key_exists('source', $aSourceObjects)) - { + if (!array_key_exists('source', $aSourceObjects)) { throw new Exception('Missing conventional "source" object'); } $oObjectToRead = $aSourceObjects['source']; - foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) - { - if ($oAttDef->IsScalar() && $oAttDef->IsWritable()) - { + foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { + if ($oAttDef->IsScalar() && $oAttDef->IsWritable()) { $this->CopyAttribute($oObjectToRead, $sAttCode, $sAttCode); } } break; case 'copy': - if (!array_key_exists('source', $aSourceObjects)) - { + if (!array_key_exists('source', $aSourceObjects)) { throw new Exception('Missing conventional "source" object'); } $oObjectToRead = $aSourceObjects['source']; - if (!array_key_exists(0, $aParams)) - { + if (!array_key_exists(0, $aParams)) { throw new Exception('Missing argument #1: source attribute'); } $sSourceAttCode = $aParams[0]; - if (!array_key_exists(1, $aParams)) - { + if (!array_key_exists(1, $aParams)) { throw new Exception('Missing argument #2: target attribute'); } $sDestAttCode = $aParams[1]; @@ -5943,26 +5601,22 @@ abstract class DBObject implements iDisplay break; case 'reset': - if (!array_key_exists(0, $aParams)) - { + if (!array_key_exists(0, $aParams)) { throw new Exception('Missing argument #1: target attribute'); } $sAttCode = $aParams[0]; - if (!MetaModel::IsValidAttCode(get_class($this), $sAttCode)) - { + if (!MetaModel::IsValidAttCode(get_class($this), $sAttCode)) { throw new Exception("Unknown attribute ".get_class($this)."::".$sAttCode); } $this->Set($sAttCode, $this->GetDefaultValue($sAttCode)); break; case 'nullify': - if (!array_key_exists(0, $aParams)) - { + if (!array_key_exists(0, $aParams)) { throw new Exception('Missing argument #1: target attribute'); } $sAttCode = $aParams[0]; - if (!MetaModel::IsValidAttCode(get_class($this), $sAttCode)) - { + if (!MetaModel::IsValidAttCode(get_class($this), $sAttCode)) { throw new Exception("Unknown attribute ".get_class($this)."::".$sAttCode); } $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); @@ -5970,23 +5624,19 @@ abstract class DBObject implements iDisplay break; case 'set': - if (!array_key_exists(0, $aParams)) - { + if (!array_key_exists(0, $aParams)) { throw new Exception('Missing argument #1: target attribute'); } $sAttCode = $aParams[0]; - if (!MetaModel::IsValidAttCode(get_class($this), $sAttCode)) - { + if (!MetaModel::IsValidAttCode(get_class($this), $sAttCode)) { throw new Exception("Unknown attribute ".get_class($this)."::".$sAttCode); } - if (!array_key_exists(1, $aParams)) - { + if (!array_key_exists(1, $aParams)) { throw new Exception('Missing argument #2: value to set'); } $sRawValue = $aParams[1]; - $aContext = array(); - foreach ($aSourceObjects as $sAlias => $oObject) - { + $aContext = []; + foreach ($aSourceObjects as $sAlias => $oObject) { $aContext = array_merge($aContext, $oObject->ToArgs($sAlias)); } $aContext['current_contact_id'] = UserRights::GetContactId(); @@ -5998,23 +5648,19 @@ abstract class DBObject implements iDisplay break; case 'append': - if (!array_key_exists(0, $aParams)) - { + if (!array_key_exists(0, $aParams)) { throw new Exception('Missing argument #1: target attribute'); } $sAttCode = $aParams[0]; - if (!MetaModel::IsValidAttCode(get_class($this), $sAttCode)) - { + if (!MetaModel::IsValidAttCode(get_class($this), $sAttCode)) { throw new Exception("Unknown attribute ".get_class($this)."::".$sAttCode); } - if (!array_key_exists(1, $aParams)) - { + if (!array_key_exists(1, $aParams)) { throw new Exception('Missing argument #2: value to append'); } $sRawAddendum = $aParams[1]; - $aContext = array(); - foreach ($aSourceObjects as $sAlias => $oObject) - { + $aContext = []; + foreach ($aSourceObjects as $sAlias => $oObject) { $aContext = array_merge($aContext, $oObject->ToArgs($sAlias)); } $aContext['current_contact_id'] = UserRights::GetContactId(); @@ -6026,38 +5672,31 @@ abstract class DBObject implements iDisplay break; case 'add_to_list': - if (!array_key_exists('source', $aSourceObjects)) - { + if (!array_key_exists('source', $aSourceObjects)) { throw new Exception('Missing conventional "source" object'); } $oObjectToRead = $aSourceObjects['source']; - if (!array_key_exists(0, $aParams)) - { + if (!array_key_exists(0, $aParams)) { throw new Exception('Missing argument #1: source attribute'); } $sSourceKeyAttCode = $aParams[0]; - if (($sSourceKeyAttCode != 'id') && !MetaModel::IsValidAttCode(get_class($oObjectToRead), $sSourceKeyAttCode)) - { + if (($sSourceKeyAttCode != 'id') && !MetaModel::IsValidAttCode(get_class($oObjectToRead), $sSourceKeyAttCode)) { throw new Exception("Unknown attribute ".get_class($oObjectToRead)."::".$sSourceKeyAttCode); } - if (!array_key_exists(1, $aParams)) - { + if (!array_key_exists(1, $aParams)) { throw new Exception('Missing argument #2: target attribute (link set)'); } $sTargetListAttCode = $aParams[1]; // indirect !!! - if (!MetaModel::IsValidAttCode(get_class($this), $sTargetListAttCode)) - { + if (!MetaModel::IsValidAttCode(get_class($this), $sTargetListAttCode)) { throw new Exception("Unknown attribute ".get_class($this)."::".$sTargetListAttCode); } - if (isset($aParams[2]) && isset($aParams[3])) - { + if (isset($aParams[2]) && isset($aParams[3])) { $sRoleAttCode = $aParams[2]; $sRoleValue = $aParams[3]; } $iObjKey = $oObjectToRead->Get($sSourceKeyAttCode); - if ($iObjKey > 0) - { + if ($iObjKey > 0) { $oLinkSet = $this->Get($sTargetListAttCode); /** @var \AttributeLinkedSetIndirect $oListAttDef */ @@ -6065,10 +5704,8 @@ abstract class DBObject implements iDisplay /** @var \AttributeLinkedSet $oListAttDef */ $oLnk = MetaModel::NewObject($oListAttDef->GetLinkedClass()); $oLnk->Set($oListAttDef->GetExtKeyToRemote(), $iObjKey); - if (isset($sRoleAttCode)) - { - if (!MetaModel::IsValidAttCode(get_class($oLnk), $sRoleAttCode)) - { + if (isset($sRoleAttCode)) { + if (!MetaModel::IsValidAttCode(get_class($oLnk), $sRoleAttCode)) { throw new Exception("Unknown attribute ".get_class($oLnk)."::".$sRoleAttCode); } $oLnk->Set($sRoleAttCode, $sRoleValue); @@ -6079,8 +5716,7 @@ abstract class DBObject implements iDisplay break; case 'apply_stimulus': - if (!array_key_exists(0, $aParams)) - { + if (!array_key_exists(0, $aParams)) { throw new Exception('Missing argument #1: stimulus'); } $sStimulus = $aParams[0]; @@ -6088,19 +5724,16 @@ abstract class DBObject implements iDisplay break; case 'call_method': - if (!array_key_exists('source', $aSourceObjects)) - { + if (!array_key_exists('source', $aSourceObjects)) { throw new Exception('Missing conventional "source" object'); } $oObjectToRead = $aSourceObjects['source']; - if (!array_key_exists(0, $aParams)) - { + if (!array_key_exists(0, $aParams)) { throw new Exception('Missing argument #1: method name'); } $sMethod = $aParams[0]; - $aCallSpec = array($this, $sMethod); - if (!is_callable($aCallSpec)) - { + $aCallSpec = [$this, $sMethod]; + if (!is_callable($aCallSpec)) { throw new Exception("Unknown method ".get_class($this)."::".$sMethod.'()'); } // Note: $oObjectToRead has been preserved when adding $aSourceObjects, so as to remain backward compatible with methods having only 1 parameter ($oObjectToRead� @@ -6112,51 +5745,49 @@ abstract class DBObject implements iDisplay } } - /** - * Is the object archived - * - * @api - * - * @param string|null $sKeyAttCode - * - * @return bool - * @throws ArchivedObjectException - * @throws CoreException - */ + /** + * Is the object archived + * + * @api + * + * @param string|null $sKeyAttCode + * + * @return bool + * @throws ArchivedObjectException + * @throws CoreException + */ public function IsArchived($sKeyAttCode = null) { $bRet = false; $sFlagAttCode = is_null($sKeyAttCode) ? 'archive_flag' : $sKeyAttCode.'_archive_flag'; - if (MetaModel::IsValidAttCode(get_class($this), $sFlagAttCode) && $this->Get($sFlagAttCode)) - { - $bRet = true; - } - return $bRet; - } - - /** - * Is the object obsolete - * - * @param string|null $sKeyAttCode - * - * @return bool - * @throws ArchivedObjectException - * @throws CoreException - */ - public function IsObsolete($sKeyAttCode = null) - { - $bRet = false; - $sFlagAttCode = is_null($sKeyAttCode) ? 'obsolescence_flag' : $sKeyAttCode.'_obsolescence_flag'; - if (MetaModel::IsValidAttCode(get_class($this), $sFlagAttCode) && $this->Get($sFlagAttCode)) - { + if (MetaModel::IsValidAttCode(get_class($this), $sFlagAttCode) && $this->Get($sFlagAttCode)) { $bRet = true; } return $bRet; } /** - * @internal - * + * Is the object obsolete + * + * @param string|null $sKeyAttCode + * + * @return bool + * @throws ArchivedObjectException + * @throws CoreException + */ + public function IsObsolete($sKeyAttCode = null) + { + $bRet = false; + $sFlagAttCode = is_null($sKeyAttCode) ? 'obsolescence_flag' : $sKeyAttCode.'_obsolescence_flag'; + if (MetaModel::IsValidAttCode(get_class($this), $sFlagAttCode) && $this->Get($sFlagAttCode)) { + $bRet = true; + } + return $bRet; + } + + /** + * @internal + * *

      Sets the archive_flag For all of the class hierarchy
      * Also update the archive_date : *

        @@ -6174,8 +5805,7 @@ abstract class DBObject implements iDisplay */ protected function DBWriteArchiveFlag($bArchive) { - if (!MetaModel::IsArchivable(get_class($this))) - { + if (!MetaModel::IsArchivable(get_class($this))) { throw new Exception(get_class($this).' is not an archivable class'); } @@ -6186,24 +5816,21 @@ abstract class DBObject implements iDisplay $sArchiveRoot = MetaModel::GetAttributeOrigin($sClass, 'archive_flag'); $sRootTable = MetaModel::DBGetTable($sArchiveRoot); $sRootKey = MetaModel::DBGetKey($sArchiveRoot); - $aJoins = array("`$sRootTable`"); - $aUpdates = array(); - foreach (MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL) as $sParentClass) - { - if (!MetaModel::IsValidAttCode($sParentClass, 'archive_flag')) continue; + $aJoins = ["`$sRootTable`"]; + $aUpdates = []; + foreach (MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL) as $sParentClass) { + if (!MetaModel::IsValidAttCode($sParentClass, 'archive_flag')) { + continue; + } $sTable = MetaModel::DBGetTable($sParentClass); $aUpdates[] = "`$sTable`.`archive_flag` = $iFlag"; - if ($sParentClass == $sArchiveRoot) - { - if (!$bArchive || $this->Get('archive_date') == '') - { + if ($sParentClass == $sArchiveRoot) { + if (!$bArchive || $this->Get('archive_date') == '') { // Erase or set the date (do not change it) $aUpdates[] = "`$sTable`.`archive_date` = $sDate"; } - } - else - { + } else { $sKey = MetaModel::DBGetKey($sParentClass); $aJoins[] = "`$sTable` ON `$sTable`.`$sKey` = `$sRootTable`.`$sRootKey`"; } @@ -6226,10 +5853,10 @@ abstract class DBObject implements iDisplay $this->FireEventArchive(); } - /** - * @throws Exception - * @uses DBWriteArchiveFlag - */ + /** + * @throws Exception + * @uses DBWriteArchiveFlag + */ public function DBUnarchive() { $this->DBWriteArchiveFlag(false); @@ -6240,21 +5867,19 @@ abstract class DBObject implements iDisplay $this->FireEventUnArchive(); } - - /** - * @internal - * - * @param string $sClass Needs to be an instanciable class - * - * @return DBObject - * @throws CoreException - * @throws CoreUnexpectedValue - */ + /** + * @internal + * + * @param string $sClass Needs to be an instanciable class + * + * @return DBObject + * @throws CoreException + * @throws CoreUnexpectedValue + */ public static function MakeDefaultInstance($sClass) { $oObj = MetaModel::NewObject($sClass); - if (MetaModel::HasLifecycle($sClass)) - { + if (MetaModel::HasLifecycle($sClass)) { $sStateAttCode = MetaModel::GetStateAttributeCode($sClass); $sTargetState = MetaModel::GetDefaultState($sClass); $oObj->Set($sStateAttCode, $sTargetState); @@ -6264,7 +5889,7 @@ abstract class DBObject implements iDisplay /** * Complete a new object with data from context - * + * * @overwritable-hook You can extend this method in order to provide your own logic. * * @see https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Aform_prefill wiki tutorial @@ -6286,7 +5911,7 @@ abstract class DBObject implements iDisplay * Complete an object after a state transition with data from context * * @overwritable-hook You can extend this method in order to provide your own logic. - * + * * @see https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Aform_prefill wiki tutorial * * @param array $aContextParam Context used for creation form prefilling. Contains those keys : @@ -6336,7 +5961,7 @@ abstract class DBObject implements iDisplay */ public function PrefillForm($sOperation, &$aContextParam) { - switch($sOperation){ + switch ($sOperation) { case 'creation_from_0': case 'creation_from_extkey': case 'creation_from_editinplace': @@ -6356,7 +5981,7 @@ abstract class DBObject implements iDisplay public function EvaluateExpression(Expression $oExpression) { $aFields = $oExpression->ListRequiredFields(); - $aArgs = array(); + $aArgs = []; foreach ($aFields as $sFieldDesc) { $aFieldParts = explode('.', $sFieldDesc); if (count($aFieldParts) == 2) { @@ -6519,7 +6144,7 @@ abstract class DBObject implements iDisplay return OPT_ATT_NORMAL; } - public final function GetListeners(): array + final public function GetListeners(): array { $aListeners = []; foreach ($this->aEventListeners as $aEventListener) { @@ -6545,12 +6170,12 @@ abstract class DBObject implements iDisplay { $aEventCallbacks = $this->aEventListeners[$sEvent] ?? []; - $aEventCallbacks[] = array( + $aEventCallbacks[] = [ 'event' => $sEvent, 'callback' => $callback, 'priority' => $fPriority, 'module' => $sModuleId, - ); + ]; usort($aEventCallbacks, function ($a, $b) { $fPriorityA = $a['priority']; $fPriorityB = $b['priority']; @@ -6573,7 +6198,7 @@ abstract class DBObject implements iDisplay * @throws \Exception * @since 3.1.0 */ - public function FireEvent(string $sEvent, array $aEventData = array()): void + public function FireEvent(string $sEvent, array $aEventData = []): void { $aEventData['debug_info'] = 'from: '.get_class($this).':'.$this->GetKey(); $aEventData['object'] = $this; @@ -6592,20 +6217,17 @@ abstract class DBObject implements iDisplay EventServiceLog::Debug("Fire event '$sEvent' calling '".get_class($this).":$sCallback'"); try { call_user_func([$this, $sCallback], new EventData($sEvent, null, $aEventData)); - } - catch (EventException $e) { + } catch (EventException $e) { EventServiceLog::Error("Event '$sEvent' for '$sCallback'} failed with blocking error: ".$e->getMessage()); throw $e; - } - catch (Exception $e) { + } catch (Exception $e) { $sMessage = "Event '$sEvent' for '$sCallback'} failed with non-blocking error: ".$e->getMessage(); EventServiceLog::Error($sMessage); if (is_null($oFirstException)) { $sFirstExceptionMessage = $sMessage; $oFirstException = $e; } - } - finally { + } finally { if (!$oKPI->ComputeStatsForExtension($this, $sCallback, "Event: $sEvent")) { $sSignature = ModuleService::GetInstance()->GetModuleMethodSignature($this, $sCallback); $oKPI->ComputeStats('FireEvent', "$sEvent callback: $sSignature"); @@ -6975,4 +6597,3 @@ abstract class DBObject implements iDisplay return array_key_exists($sSection, $this->aContext); } } - diff --git a/core/dbobjectiterator.php b/core/dbobjectiterator.php index 98519f9ed..eb5845c8d 100644 --- a/core/dbobjectiterator.php +++ b/core/dbobjectiterator.php @@ -1,9 +1,10 @@ - /** - * A set of persistent objects, could be heterogeneous as long as the objects in the set have a common ancestor class + * A set of persistent objects, could be heterogeneous as long as the objects in the set have a common ancestor class * * @package iTopORM * @copyright Copyright (C) 2010-2024 Combodo SAS diff --git a/core/dbobjectsearch.class.php b/core/dbobjectsearch.class.php index a6472e862..bbe79b01c 100644 --- a/core/dbobjectsearch.class.php +++ b/core/dbobjectsearch.class.php @@ -1,4 +1,5 @@ m_aSelectedClasses = array($sClassAlias => $sClass); - $this->m_aClasses = array($sClassAlias => $sClass); - $this->m_oSearchCondition = new TrueExpression; - $this->m_aParams = array(); - $this->m_aPointingTo = array(); - $this->m_aReferencedBy = array(); + $this->m_aSelectedClasses = [$sClassAlias => $sClass]; + $this->m_aClasses = [$sClassAlias => $sClass]; + $this->m_oSearchCondition = new TrueExpression(); + $this->m_aParams = []; + $this->m_aPointingTo = []; + $this->m_aReferencedBy = []; } - public function AllowAllData($bAllowAllData = true) { + public function AllowAllData($bAllowAllData = true) + { $this->m_bAllowAllData = $bAllowAllData; $this->m_oSearchCondition->Browse(function ($oThisExpression) use ($bAllowAllData) { @@ -76,32 +78,37 @@ class DBObjectSearch extends DBSearch }); } - public function IsAllDataAllowed() { + public function IsAllDataAllowed() + { return $this->m_bAllowAllData; } - protected function IsDataFiltered() { + protected function IsDataFiltered() + { return $this->m_bDataFiltered; } - protected function SetDataFiltered() { + protected function SetDataFiltered() + { $this->m_bDataFiltered = true; } // Create a search definition that leads to 0 result, still a valid search object - public static function FromEmptySet($sClass) { + public static function FromEmptySet($sClass) + { $oResultFilter = new DBObjectSearch($sClass); - $oResultFilter->m_oSearchCondition = new FalseExpression; + $oResultFilter->m_oSearchCondition = new FalseExpression(); return $oResultFilter; } - - public function GetJoinedClasses() { + public function GetJoinedClasses() + { return $this->m_aClasses; } - public function GetClassName($sAlias) { + public function GetClassName($sAlias) + { if (array_key_exists($sAlias, $this->m_aSelectedClasses)) { return $this->m_aSelectedClasses[$sAlias]; } else { @@ -140,26 +147,20 @@ class DBObjectSearch extends DBSearch */ public function ChangeClass($sNewClass, $sAlias = null) { - if (is_null($sAlias)) - { + if (is_null($sAlias)) { $sAlias = $this->GetClassAlias(); - } - else - { - if (!array_key_exists($sAlias, $this->m_aSelectedClasses)) - { + } else { + if (!array_key_exists($sAlias, $this->m_aSelectedClasses)) { // discard silently - necessary when recursing on the related nodes (see code below) return; } } $sCurrClass = $this->GetClassName($sAlias); - if ($sNewClass == $sCurrClass) - { + if ($sNewClass == $sCurrClass) { // Skip silently return; } - if (!MetaModel::IsParentClass($sCurrClass, $sNewClass)) - { + if (!MetaModel::IsParentClass($sCurrClass, $sNewClass)) { throw new Exception("Could not change the search class from '$sCurrClass' to '$sNewClass'. Only child classes are permitted."); } @@ -170,24 +171,17 @@ class DBObjectSearch extends DBSearch // Change for all the related node (yes, this was necessary with some queries - strange effects otherwise) // - foreach($this->m_aPointingTo as $sExtKeyAttCode=>$aPointingTo) - { - foreach($aPointingTo as $iOperatorCode => $aFilter) - { - foreach($aFilter as $oExtFilter) - { + foreach ($this->m_aPointingTo as $sExtKeyAttCode => $aPointingTo) { + foreach ($aPointingTo as $iOperatorCode => $aFilter) { + foreach ($aFilter as $oExtFilter) { $oExtFilter->ChangeClass($sNewClass, $sAlias); } } } - foreach($this->m_aReferencedBy as $sForeignClass => $aReferences) - { - foreach($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) - { - foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) - { - foreach ($aFilters as $oForeignFilter) - { + foreach ($this->m_aReferencedBy as $sForeignClass => $aReferences) { + foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { + foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) { + foreach ($aFilters as $oForeignFilter) { $oForeignFilter->ChangeClass($sNewClass, $sAlias); } } @@ -206,11 +200,9 @@ class DBObjectSearch extends DBSearch */ public function SetSelectedClasses($aSelectedClasses) { - $this->m_aSelectedClasses = array(); - foreach ($aSelectedClasses as $sAlias) - { - if (!array_key_exists($sAlias, $this->m_aClasses)) - { + $this->m_aSelectedClasses = []; + foreach ($aSelectedClasses as $sAlias) { + if (!array_key_exists($sAlias, $this->m_aClasses)) { throw new CoreException("SetSelectedClasses: Invalid class alias $sAlias"); } $this->m_aSelectedClasses[$sAlias] = $this->m_aClasses[$sAlias]; @@ -229,38 +221,28 @@ class DBObjectSearch extends DBSearch public function RenameAlias($sOldName, $sNewName) { $bFound = false; - if (!array_key_exists($sOldName, $this->m_aClasses)) - { + if (!array_key_exists($sOldName, $this->m_aClasses)) { return false; } - if (array_key_exists($sNewName, $this->m_aClasses)) - { + if (array_key_exists($sNewName, $this->m_aClasses)) { throw new Exception("RenameAlias: alias '$sNewName' already used"); } - $aClasses = array(); - foreach ($this->m_aClasses as $sAlias => $sClass) - { - if ($sAlias === $sOldName) - { + $aClasses = []; + foreach ($this->m_aClasses as $sAlias => $sClass) { + if ($sAlias === $sOldName) { $aClasses[$sNewName] = $sClass; - } - else - { + } else { $aClasses[$sAlias] = $sClass; } } $this->m_aClasses = $aClasses; - $aSelectedClasses = array(); - foreach ($this->m_aSelectedClasses as $sAlias => $sClass) - { - if ($sAlias === $sOldName) - { + $aSelectedClasses = []; + foreach ($this->m_aSelectedClasses as $sAlias => $sClass) { + if ($sAlias === $sOldName) { $aSelectedClasses[$sNewName] = $sClass; - } - else - { + } else { $aSelectedClasses[$sAlias] = $sClass; } } @@ -268,24 +250,17 @@ class DBObjectSearch extends DBSearch $this->m_oSearchCondition->RenameAlias($sOldName, $sNewName); - foreach($this->m_aPointingTo as $sExtKeyAttCode=>$aPointingTo) - { - foreach($aPointingTo as $iOperatorCode => $aFilter) - { - foreach($aFilter as $oExtFilter) - { + foreach ($this->m_aPointingTo as $sExtKeyAttCode => $aPointingTo) { + foreach ($aPointingTo as $iOperatorCode => $aFilter) { + foreach ($aFilter as $oExtFilter) { $bFound = $oExtFilter->RenameAlias($sOldName, $sNewName) || $bFound; } } } - foreach($this->m_aReferencedBy as $sForeignClass => $aReferences) - { - foreach($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) - { - foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) - { - foreach ($aFilters as $oForeignFilter) - { + foreach ($this->m_aReferencedBy as $sForeignClass => $aReferences) { + foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { + foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) { + foreach ($aFilters as $oForeignFilter) { $bFound = $oForeignFilter->RenameAlias($sOldName, $sNewName) || $bFound; } } @@ -301,21 +276,24 @@ class DBObjectSearch extends DBSearch public function GetModifierProperties($sPluginClass) { - if (array_key_exists($sPluginClass, $this->m_aModifierProperties)) - { + if (array_key_exists($sPluginClass, $this->m_aModifierProperties)) { return $this->m_aModifierProperties[$sPluginClass]; - } - else - { - return array(); + } else { + return []; } } public function IsAny() { - if (!$this->m_oSearchCondition->IsTrue()) return false; - if (count($this->m_aPointingTo) > 0) return false; - if (count($this->m_aReferencedBy) > 0) return false; + if (!$this->m_oSearchCondition->IsTrue()) { + return false; + } + if (count($this->m_aPointingTo) > 0) { + return false; + } + if (count($this->m_aReferencedBy) > 0) { + return false; + } return true; } @@ -327,14 +305,11 @@ class DBObjectSearch extends DBSearch protected function TransferConditionExpression($oFilter, $aTranslation) { // Prevent collisions in the parameter names by renaming them if needed - foreach($this->m_aParams as $sParam => $value) - { - if (array_key_exists($sParam, $oFilter->m_aParams) && ($value != $oFilter->m_aParams[$sParam])) - { + foreach ($this->m_aParams as $sParam => $value) { + if (array_key_exists($sParam, $oFilter->m_aParams) && ($value != $oFilter->m_aParams[$sParam])) { // Generate a new and unique name for the collinding parameter $index = 1; - while(array_key_exists($sParam.$index, $oFilter->m_aParams)) - { + while (array_key_exists($sParam.$index, $oFilter->m_aParams)) { $index++; } $secondValue = $oFilter->m_aParams[$sParam]; @@ -352,19 +327,15 @@ class DBObjectSearch extends DBSearch public function RenameParam($sOldName, $sNewName) { $this->m_oSearchCondition->RenameParam($sOldName, $sNewName); - foreach($this->m_aPointingTo as $sExtKeyAttCode=>$aPointingTo) - { - foreach($aPointingTo as $iOperatorCode => $aFilter) - { - foreach($aFilter as $oExtFilter) - { + foreach ($this->m_aPointingTo as $sExtKeyAttCode => $aPointingTo) { + foreach ($aPointingTo as $iOperatorCode => $aFilter) { + foreach ($aFilter as $oExtFilter) { $oExtFilter->RenameParam($sOldName, $sNewName); } } } - foreach($this->m_aReferencedBy as $sForeignClass => $aReferences) - { - foreach($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { + foreach ($this->m_aReferencedBy as $sForeignClass => $aReferences) { + foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) { foreach ($aFilters as $oForeignFilter) { $oForeignFilter->RenameParam($sOldName, $sNewName); @@ -374,16 +345,19 @@ class DBObjectSearch extends DBSearch } } - public function ResetCondition() { + public function ResetCondition() + { $this->m_oSearchCondition = new TrueExpression(); // ? is that usefull/enough, do I need to rebuild the list after the subqueries ? } - public function MergeConditionExpression($oExpression) { + public function MergeConditionExpression($oExpression) + { $this->m_oSearchCondition = $this->m_oSearchCondition->LogOr($oExpression); } - public function AddConditionExpression($oExpression) { + public function AddConditionExpression($oExpression) + { $this->m_oSearchCondition = $this->m_oSearchCondition->LogAnd($oExpression); $bRootSearchAllowAllData = $this->IsAllDataAllowed(); @@ -392,7 +366,8 @@ class DBObjectSearch extends DBSearch }); } - public function AddNameCondition($sName) { + public function AddNameCondition($sName) + { $oValueExpr = new ScalarExpression($sName); $oNameExpr = new FieldExpression('friendlyname', $this->GetClassAlias()); $oNewCondition = new BinaryExpression($oNameExpr, '=', $oValueExpr); @@ -431,81 +406,82 @@ class DBObjectSearch extends DBSearch } } // Parse search strings if needed and if the filter code corresponds to a valid attcode - if($bParseSearchString && MetaModel::IsValidAttCode($this->GetClass(), $sFilterCode)) - { + if ($bParseSearchString && MetaModel::IsValidAttCode($this->GetClass(), $sFilterCode)) { $oAttDef = MetaModel::GetAttributeDef($this->GetClass(), $sFilterCode); $value = $oAttDef->ParseSearchString($value); } // Preserve backward compatibility - quick n'dirty way to change that API semantic // - switch($sOpCode) - { - case 'SameDay': - case 'SameMonth': - case 'SameYear': - case 'Today': - case '>|': - case '<|': - case '=|': - throw new CoreException('Deprecated operator, please consider using OQL (SQL) expressions like "(TO_DAYS(NOW()) - TO_DAYS(x)) AS AgeDays"', array('operator' => $sOpCode)); + switch ($sOpCode) { + case 'SameDay': + case 'SameMonth': + case 'SameYear': + case 'Today': + case '>|': + case '<|': + case '=|': + throw new CoreException('Deprecated operator, please consider using OQL (SQL) expressions like "(TO_DAYS(NOW()) - TO_DAYS(x)) AS AgeDays"', ['operator' => $sOpCode]); - case 'IN': - if (!is_array($value)) $value = array($value); - if (count($value) === 0) throw new Exception('AddCondition '.$sOpCode.': Value cannot be an empty array.'); - $sListExpr = '('.implode(', ', CMDBSource::Quote($value)).')'; - $sOQLCondition = $oField->RenderExpression()." IN $sListExpr"; - break; - - case 'NOTIN': - if (!is_array($value)) $value = array($value); - if (count($value) === 0) throw new Exception('AddCondition '.$sOpCode.': Value cannot be an empty array.'); - $sListExpr = '('.implode(', ', CMDBSource::Quote($value)).')'; - $sOQLCondition = $oField->RenderExpression()." NOT IN $sListExpr"; - break; - - case 'Contains': - $this->m_aParams[$sFilterCode] = "%$value%"; - $sOperator = 'LIKE'; - break; - - case 'Begins with': - $this->m_aParams[$sFilterCode] = "$value%"; - $sOperator = 'LIKE'; - break; - - case 'Finishes with': - $this->m_aParams[$sFilterCode] = "%$value"; - $sOperator = 'LIKE'; - break; - - default: - if ($value === null) - { - switch ($sOpCode) - { - case '=': - $sOpCode = '*Expression*'; - $oExpression = new FunctionExpression('ISNULL', array($oField)); - break; - case '!=': - $sOpCode = '*Expression*'; - $oExpression = new FunctionExpression('ISNULL', array($oField)); - $oExpression = new BinaryExpression($oExpression, '=', new ScalarExpression(0)); - break; - default: - throw new Exception("AddCondition on null value: unsupported operator '$sOpCode''"); + case 'IN': + if (!is_array($value)) { + $value = [$value]; + } + if (count($value) === 0) { + throw new Exception('AddCondition '.$sOpCode.': Value cannot be an empty array.'); + } + $sListExpr = '('.implode(', ', CMDBSource::Quote($value)).')'; + $sOQLCondition = $oField->RenderExpression()." IN $sListExpr"; + break; + + case 'NOTIN': + if (!is_array($value)) { + $value = [$value]; + } + if (count($value) === 0) { + throw new Exception('AddCondition '.$sOpCode.': Value cannot be an empty array.'); + } + $sListExpr = '('.implode(', ', CMDBSource::Quote($value)).')'; + $sOQLCondition = $oField->RenderExpression()." NOT IN $sListExpr"; + break; + + case 'Contains': + $this->m_aParams[$sFilterCode] = "%$value%"; + $sOperator = 'LIKE'; + break; + + case 'Begins with': + $this->m_aParams[$sFilterCode] = "$value%"; + $sOperator = 'LIKE'; + break; + + case 'Finishes with': + $this->m_aParams[$sFilterCode] = "%$value"; + $sOperator = 'LIKE'; + break; + + default: + if ($value === null) { + switch ($sOpCode) { + case '=': + $sOpCode = '*Expression*'; + $oExpression = new FunctionExpression('ISNULL', [$oField]); + break; + case '!=': + $sOpCode = '*Expression*'; + $oExpression = new FunctionExpression('ISNULL', [$oField]); + $oExpression = new BinaryExpression($oExpression, '=', new ScalarExpression(0)); + break; + default: + throw new Exception("AddCondition on null value: unsupported operator '$sOpCode''"); + } + } else { + $this->m_aParams[$sFilterCode] = $value; + $sOperator = $sOpCode; } - } - else - { - $this->m_aParams[$sFilterCode] = $value; - $sOperator = $sOpCode; - } } - switch($sOpCode) - { + switch ($sOpCode) { case '*Expression*': $oNewCondition = $oExpression; break; @@ -553,7 +529,7 @@ class DBObjectSearch extends DBSearch $oParamExpression = new VariableExpression($sInParamName); $this->GetInternalParamsByRef()[$sInParamName] = $aValues; - $oListExpression = new ListExpression(array($oParamExpression)); + $oListExpression = new ListExpression([$oParamExpression]); $oInCondition = new BinaryExpression($oFieldExpression, $sOperator, $oListExpression); $this->AddConditionExpression($oInCondition); @@ -573,19 +549,16 @@ class DBObjectSearch extends DBSearch $sClass = $this->GetClass(); $iPos = strpos($sAttSpec, '->'); - if ($iPos !== false) - { + if ($iPos !== false) { $sAttCode = substr($sAttSpec, 0, $iPos); $sSubSpec = substr($sAttSpec, $iPos + 2); - if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) { throw new Exception("Invalid attribute code '$sClass/$sAttCode' in condition specification '$sAttSpec'"); } $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - if ($oAttDef->IsLinkSet()) - { + if ($oAttDef->IsLinkSet()) { $sTargetClass = $oAttDef->GetLinkedClass(); $sExtKeyToMe = $oAttDef->GetExtKeyToMe(); @@ -593,35 +566,26 @@ class DBObjectSearch extends DBSearch $oNewFilter->AddConditionAdvanced($sSubSpec, $value); $this->AddCondition_ReferencedBy($oNewFilter, $sExtKeyToMe); - } - elseif ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) - { + } elseif ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) { $sTargetClass = $oAttDef->GetTargetClass(EXTKEY_ABSOLUTE); $oNewFilter = new DBObjectSearch($sTargetClass); $oNewFilter->AddConditionAdvanced($sSubSpec, $value); $this->AddCondition_PointingTo($oNewFilter, $sAttCode); - } - else - { + } else { throw new Exception("Attribute specification '$sAttSpec', '$sAttCode' should be either a link set or an external key"); } - } - else - { + } else { // $sAttSpec is an attribute code // - if (is_array($value)) - { + if (is_array($value)) { $oField = new FieldExpression($sAttSpec, $this->GetClass()); $oListExpr = ListExpression::FromScalars($value); $oInValues = new BinaryExpression($oField, 'IN', $oListExpr); $this->AddConditionExpression($oInValues); - } - else - { + } else { $this->AddCondition($sAttSpec, $value); } } @@ -632,9 +596,15 @@ class DBObjectSearch extends DBSearch // Transform the full text condition into additional condition expression $aAttCodes = []; foreach (MetaModel::ListAttributeDefs($this->GetClass()) as $sAttCode => $oAttDef) { - if (!$oAttDef->IsScalar()) continue; - if ($oAttDef->IsExternalKey()) continue; - if (!$oAttDef->IsSearchable()) continue; + if (!$oAttDef->IsScalar()) { + continue; + } + if ($oAttDef->IsExternalKey()) { + continue; + } + if (!$oAttDef->IsSearchable()) { + continue; + } $aAttCodes[] = $sAttCode; } $this->AddCondition_FullTextOnAttributes($aAttCodes, $sNeedle); @@ -656,7 +626,7 @@ class DBObjectSearch extends DBSearch $oTextFields = new CharConcatWSExpression(' ', $aFullTextFields); $sQueryParam = str_replace('.', '', uniqid('needle_', true)); - $oFlexNeedle = new CharConcatExpression(array(new ScalarExpression('%'), new VariableExpression($sQueryParam), new ScalarExpression('%'))); + $oFlexNeedle = new CharConcatExpression([new ScalarExpression('%'), new VariableExpression($sQueryParam), new ScalarExpression('%')]); $oNewCond = new BinaryExpression($oTextFields, 'LIKE', $oFlexNeedle); $this->AddConditionExpression($oNewCond); @@ -668,14 +638,11 @@ class DBObjectSearch extends DBSearch protected function AddToNameSpace(&$aClassAliases, &$aAliasTranslation, $bTranslateMainAlias = true) { - if ($bTranslateMainAlias) - { + if ($bTranslateMainAlias) { $sOrigAlias = $this->GetFirstJoinedClassAlias(); - if (array_key_exists($sOrigAlias, $aClassAliases)) - { + if (array_key_exists($sOrigAlias, $aClassAliases)) { $sNewAlias = MetaModel::GenerateUniqueAlias($aClassAliases, $sOrigAlias, $this->GetFirstJoinedClass()); - if (isset($this->m_aSelectedClasses[$sOrigAlias])) - { + if (isset($this->m_aSelectedClasses[$sOrigAlias])) { $this->m_aSelectedClasses[$sNewAlias] = $this->GetFirstJoinedClass(); unset($this->m_aSelectedClasses[$sOrigAlias]); } @@ -683,46 +650,35 @@ class DBObjectSearch extends DBSearch // TEMPORARY ALGORITHM (m_aClasses is not correctly updated, it is not possible to add a subtree onto a subnode) // Replace the element at the same position (unset + set is not enough because the hash array is ordered) $aPrevList = $this->m_aClasses; - $this->m_aClasses = array(); - foreach ($aPrevList as $sSomeAlias => $sSomeClass) - { - if ($sSomeAlias == $sOrigAlias) - { + $this->m_aClasses = []; + foreach ($aPrevList as $sSomeAlias => $sSomeClass) { + if ($sSomeAlias == $sOrigAlias) { $this->m_aClasses[$sNewAlias] = $sSomeClass; // note: GetFirstJoinedClass now returns '' !!! - } - else - { + } else { $this->m_aClasses[$sSomeAlias] = $sSomeClass; } } - + // Translate the condition expression with the new alias $aAliasTranslation[$sOrigAlias]['*'] = $sNewAlias; } - + // add the alias into the filter aliases list $aClassAliases[$this->GetFirstJoinedClassAlias()] = $this->GetFirstJoinedClass(); } - - foreach($this->m_aPointingTo as $sExtKeyAttCode=>$aPointingTo) - { - foreach($aPointingTo as $iOperatorCode => $aFilter) - { - foreach($aFilter as $oFilter) - { + + foreach ($this->m_aPointingTo as $sExtKeyAttCode => $aPointingTo) { + foreach ($aPointingTo as $iOperatorCode => $aFilter) { + foreach ($aFilter as $oFilter) { $oFilter->AddToNameSpace($aClassAliases, $aAliasTranslation); } } } - foreach($this->m_aReferencedBy as $sForeignClass=>$aReferences) - { - foreach($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) - { - foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) - { - foreach ($aFilters as $oForeignFilter) - { + foreach ($this->m_aReferencedBy as $sForeignClass => $aReferences) { + foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { + foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) { + foreach ($aFilters as $oForeignFilter) { $oForeignFilter->AddToNameSpace($aClassAliases, $aAliasTranslation); } } @@ -736,18 +692,17 @@ class DBObjectSearch extends DBSearch * @param array $aClassAliases array of alias => class for the main query * @param array $aAliasTranslation translation table of main query to apply to nested queries */ - public function RenameNestedQueriesAliasesInNameSpace($aClassAliases, $aAliasTranslation = array()) + public function RenameNestedQueriesAliasesInNameSpace($aClassAliases, $aAliasTranslation = []) { $this->GetCriteria()->Browse(function ($oNode) use ($aClassAliases, $aAliasTranslation) { - if ($oNode instanceof NestedQueryExpression) - { + if ($oNode instanceof NestedQueryExpression) { $oNestedQuery = $oNode->GetNestedQuery(); $oNestedQuery->RenameAliasesInNameSpace($aClassAliases, $aAliasTranslation); } }); } - public function RenameAliasesInNameSpace($aClassAliases, $aAliasTranslation = array()) + public function RenameAliasesInNameSpace($aClassAliases, $aAliasTranslation = []) { // Recurse in nested queries $this->RenameNestedQueriesAliasesInNameSpace($aClassAliases, $aAliasTranslation); @@ -766,37 +721,25 @@ class DBObjectSearch extends DBSearch // protected function GetNode($sAlias) { - if ($this->GetFirstJoinedClassAlias() == $sAlias) - { + if ($this->GetFirstJoinedClassAlias() == $sAlias) { return $this; - } - else - { - foreach($this->m_aPointingTo as $sExtKeyAttCode=>$aPointingTo) - { - foreach($aPointingTo as $iOperatorCode => $aFilter) - { - foreach($aFilter as $oFilter) - { + } else { + foreach ($this->m_aPointingTo as $sExtKeyAttCode => $aPointingTo) { + foreach ($aPointingTo as $iOperatorCode => $aFilter) { + foreach ($aFilter as $oFilter) { $ret = $oFilter->GetNode($sAlias); - if (is_object($ret)) - { + if (is_object($ret)) { return $ret; } } } } - foreach($this->m_aReferencedBy as $sForeignClass=>$aReferences) - { - foreach($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) - { - foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) - { - foreach ($aFilters as $oForeignFilter) - { + foreach ($this->m_aReferencedBy as $sForeignClass => $aReferences) { + foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { + foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) { + foreach ($aFilters as $oForeignFilter) { $ret = $oForeignFilter->GetNode($sAlias); - if (is_object($ret)) - { + if (is_object($ret)) { return $ret; } } @@ -820,36 +763,27 @@ class DBObjectSearch extends DBSearch */ protected function UpdateRealiasingMap(&$aRealiasingMap, $aAliasTranslation) { - if ($aRealiasingMap !== null) - { - foreach ($aAliasTranslation as $sPrevAlias => $aRules) - { - if (!isset($aRules['*'])) - { + if ($aRealiasingMap !== null) { + foreach ($aAliasTranslation as $sPrevAlias => $aRules) { + if (!isset($aRules['*'])) { continue; } $sNewAlias = $aRules['*']; $bOriginalFound = false; $iIndex = 0; - foreach ($aRealiasingMap as $sOriginalAlias => $aAliases) - { + foreach ($aRealiasingMap as $sOriginalAlias => $aAliases) { $iIndex = array_search($sPrevAlias, $aAliases); - if ($iIndex !== false) - { + if ($iIndex !== false) { $bOriginalFound = true; break; } } - if ($bOriginalFound) - { + if ($bOriginalFound) { $aRealiasingMap[$sOriginalAlias][$iIndex] = $sNewAlias; - } - else - { - if (!isset($aRealiasingMap[$sPrevAlias]) || !in_array($sNewAlias, $aRealiasingMap[$sPrevAlias])) - { + } else { + if (!isset($aRealiasingMap[$sPrevAlias]) || !in_array($sNewAlias, $aRealiasingMap[$sPrevAlias])) { $aRealiasingMap[$sPrevAlias][] = $sNewAlias; } } @@ -869,25 +803,18 @@ class DBObjectSearch extends DBSearch $aClasses[$this->GetFirstJoinedClassAlias()] = $this->GetFirstJoinedClass(); // Recurse in the query tree - foreach($this->m_aPointingTo as $sExtKeyAttCode=>$aPointingTo) - { - foreach($aPointingTo as $iOperatorCode => $aFilter) - { - foreach($aFilter as $oFilter) - { + foreach ($this->m_aPointingTo as $sExtKeyAttCode => $aPointingTo) { + foreach ($aPointingTo as $iOperatorCode => $aFilter) { + foreach ($aFilter as $oFilter) { $oFilter->RecomputeClassList($aClasses); } } } - foreach($this->m_aReferencedBy as $sForeignClass=>$aReferences) - { - foreach($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) - { - foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) - { - foreach ($aFilters as $oForeignFilter) - { + foreach ($this->m_aReferencedBy as $sForeignClass => $aReferences) { + foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { + foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) { + foreach ($aFilters as $oForeignFilter) { $oForeignFilter->RecomputeClassList($aClasses); } } @@ -909,40 +836,33 @@ class DBObjectSearch extends DBSearch */ public function AddCondition_PointingTo(DBObjectSearch $oFilter, $sExtKeyAttCode, $iOperatorCode = TREE_OPERATOR_EQUALS, &$aRealiasingMap = null) { - if (!MetaModel::IsValidKeyAttCode($this->GetClass(), $sExtKeyAttCode)) - { + if (!MetaModel::IsValidKeyAttCode($this->GetClass(), $sExtKeyAttCode)) { throw new CoreWarning("The attribute code '$sExtKeyAttCode' is not an external key of the class '{$this->GetClass()}'"); } $oAttExtKey = MetaModel::GetAttributeDef($this->GetClass(), $sExtKeyAttCode); - if(!MetaModel::IsSameFamilyBranch($oFilter->GetClass(), $oAttExtKey->GetTargetClass())) - { + if (!MetaModel::IsSameFamilyBranch($oFilter->GetClass(), $oAttExtKey->GetTargetClass())) { throw new CoreException("The specified filter (pointing to {$oFilter->GetClass()}) is not compatible with the key '{$this->GetClass()}::$sExtKeyAttCode', which is pointing to {$oAttExtKey->GetTargetClass()}"); } - if(($iOperatorCode != TREE_OPERATOR_EQUALS) && !($oAttExtKey instanceof AttributeHierarchicalKey)) - { + if (($iOperatorCode != TREE_OPERATOR_EQUALS) && !($oAttExtKey instanceof AttributeHierarchicalKey)) { throw new CoreException("The specified tree operator $iOperatorCode is not applicable to the key '{$this->GetClass()}::$sExtKeyAttCode', which is not a HierarchicalKey"); } // Note: though it seems to be a good practice to clone the given source filter // (as it was done and fixed an issue in Intersect()) // this was not implemented here because it was causing a regression (login as admin, select an org, click on any badge) - // root cause: FromOQL relies on the fact that the passed filter can be modified later + // root cause: FromOQL relies on the fact that the passed filter can be modified later // NO: $oFilter = $oFilter->DeepClone(); // See also: Trac #639, and self::AddCondition_ReferencedBy() - $aAliasTranslation = array(); + $aAliasTranslation = []; $res = $this->AddCondition_PointingTo_InNameSpace($oFilter, $sExtKeyAttCode, $this->m_aClasses, $aAliasTranslation, $iOperatorCode); $this->TransferConditionExpression($oFilter, $aAliasTranslation); $this->UpdateRealiasingMap($aRealiasingMap, $aAliasTranslation); - if (ENABLE_OPT && ($oFilter->GetClass() == $oFilter->GetFirstJoinedClass())) - { - if (isset($oFilter->m_aReferencedBy[$this->GetClass()][$sExtKeyAttCode][$iOperatorCode])) - { - foreach ($oFilter->m_aReferencedBy[$this->GetClass()][$sExtKeyAttCode][$iOperatorCode] as $oRemoteFilter) - { - if ($this->GetClass() == $oRemoteFilter->GetClass()) - { + if (ENABLE_OPT && ($oFilter->GetClass() == $oFilter->GetFirstJoinedClass())) { + if (isset($oFilter->m_aReferencedBy[$this->GetClass()][$sExtKeyAttCode][$iOperatorCode])) { + foreach ($oFilter->m_aReferencedBy[$this->GetClass()][$sExtKeyAttCode][$iOperatorCode] as $oRemoteFilter) { + if ($this->GetClass() == $oRemoteFilter->GetClass()) { // Optimization - fold sibling query - $aAliasTranslation = array(); + $aAliasTranslation = []; $this->MergeWith_InNamespace($oRemoteFilter, $this->m_aClasses, $aAliasTranslation); unset($oFilter->m_aReferencedBy[$this->GetClass()][$sExtKeyAttCode][$iOperatorCode]); $this->m_oSearchCondition = $this->m_oSearchCondition->Translate($aAliasTranslation, false, false); @@ -971,21 +891,17 @@ class DBObjectSearch extends DBSearch $oReceivingFilter = $this->GetNode($this->GetClassAlias()); $bMerged = false; - if (ENABLE_OPT && isset($oReceivingFilter->m_aPointingTo[$sExtKeyAttCode][$iOperatorCode])) - { - foreach ($oReceivingFilter->m_aPointingTo[$sExtKeyAttCode][$iOperatorCode] as $oExisting) - { + if (ENABLE_OPT && isset($oReceivingFilter->m_aPointingTo[$sExtKeyAttCode][$iOperatorCode])) { + foreach ($oReceivingFilter->m_aPointingTo[$sExtKeyAttCode][$iOperatorCode] as $oExisting) { /** @var DBObjectSearch $oExisting */ - if ($oExisting->GetClass() == $oFilter->GetClass()) - { + if ($oExisting->GetClass() == $oFilter->GetClass()) { $oExisting->MergeWith_InNamespace($oFilter, $aClassAliases, $aAliasTranslation); $bMerged = true; break; } } } - if (!$bMerged) - { + if (!$bMerged) { $oFilter->AddToNamespace($aClassAliases, $aAliasTranslation); $oReceivingFilter->m_aPointingTo[$sExtKeyAttCode][$iOperatorCode][] = $oFilter; } @@ -1002,13 +918,11 @@ class DBObjectSearch extends DBSearch public function AddCondition_ReferencedBy(DBObjectSearch $oFilter, $sForeignExtKeyAttCode, $iOperatorCode = TREE_OPERATOR_EQUALS, &$aRealiasingMap = null) { $sForeignClass = $oFilter->GetClass(); - if (!MetaModel::IsValidKeyAttCode($sForeignClass, $sForeignExtKeyAttCode)) - { + if (!MetaModel::IsValidKeyAttCode($sForeignClass, $sForeignExtKeyAttCode)) { throw new CoreException("The attribute code '$sForeignExtKeyAttCode' is not an external key of the class '{$sForeignClass}'"); } $oAttExtKey = MetaModel::GetAttributeDef($sForeignClass, $sForeignExtKeyAttCode); - if(!MetaModel::IsSameFamilyBranch($this->GetClass(), $oAttExtKey->GetTargetClass())) - { + if (!MetaModel::IsSameFamilyBranch($this->GetClass(), $oAttExtKey->GetTargetClass())) { // à refaire en spécifique dans FromOQL throw new CoreException("The specified filter (objects referencing an object of class {$this->GetClass()}) is not compatible with the key '{$sForeignClass}::$sForeignExtKeyAttCode', which is pointing to {$oAttExtKey->GetTargetClass()}"); } @@ -1016,24 +930,20 @@ class DBObjectSearch extends DBSearch // Note: though it seems to be a good practice to clone the given source filter // (as it was done and fixed an issue in Intersect()) // this was not implemented here because it was causing a regression (login as admin, select an org, click on any badge) - // root cause: FromOQL relies on the fact that the passed filter can be modified later + // root cause: FromOQL relies on the fact that the passed filter can be modified later // NO: $oFilter = $oFilter->DeepClone(); // See also: Trac #639, and self::AddCondition_PointingTo() - $aAliasTranslation = array(); + $aAliasTranslation = []; $this->AddCondition_ReferencedBy_InNameSpace($oFilter, $sForeignExtKeyAttCode, $this->m_aClasses, $aAliasTranslation, $iOperatorCode); $this->TransferConditionExpression($oFilter, $aAliasTranslation); $this->UpdateRealiasingMap($aRealiasingMap, $aAliasTranslation); - if (ENABLE_OPT && ($oFilter->GetClass() == $oFilter->GetFirstJoinedClass())) - { - if (isset($oFilter->m_aPointingTo[$sForeignExtKeyAttCode][$iOperatorCode])) - { - foreach ($oFilter->m_aPointingTo[$sForeignExtKeyAttCode][$iOperatorCode] as $oRemoteFilter) - { - if ($this->GetClass() == $oRemoteFilter->GetClass()) - { + if (ENABLE_OPT && ($oFilter->GetClass() == $oFilter->GetFirstJoinedClass())) { + if (isset($oFilter->m_aPointingTo[$sForeignExtKeyAttCode][$iOperatorCode])) { + foreach ($oFilter->m_aPointingTo[$sForeignExtKeyAttCode][$iOperatorCode] as $oRemoteFilter) { + if ($this->GetClass() == $oRemoteFilter->GetClass()) { // Optimization - fold sibling query - $aAliasTranslation = array(); + $aAliasTranslation = []; $this->MergeWith_InNamespace($oRemoteFilter, $this->m_aClasses, $aAliasTranslation); unset($oFilter->m_aPointingTo[$sForeignExtKeyAttCode][$iOperatorCode]); $this->m_oSearchCondition = $this->m_oSearchCondition->Translate($aAliasTranslation, false, false); @@ -1054,20 +964,16 @@ class DBObjectSearch extends DBSearch $oReceivingFilter = $this->GetNode($this->GetClassAlias()); $bMerged = false; - if (ENABLE_OPT && isset($oReceivingFilter->m_aReferencedBy[$sForeignClass][$sForeignExtKeyAttCode][$iOperatorCode])) - { - foreach ($oReceivingFilter->m_aReferencedBy[$sForeignClass][$sForeignExtKeyAttCode][$iOperatorCode] as $oExisting) - { - if ($oExisting->GetClass() == $oFilter->GetClass()) - { + if (ENABLE_OPT && isset($oReceivingFilter->m_aReferencedBy[$sForeignClass][$sForeignExtKeyAttCode][$iOperatorCode])) { + foreach ($oReceivingFilter->m_aReferencedBy[$sForeignClass][$sForeignExtKeyAttCode][$iOperatorCode] as $oExisting) { + if ($oExisting->GetClass() == $oFilter->GetClass()) { $oExisting->MergeWith_InNamespace($oFilter, $aClassAliases, $aAliasTranslation); $bMerged = true; break; } } } - if (!$bMerged) - { + if (!$bMerged) { $oFilter->AddToNamespace($aClassAliases, $aAliasTranslation); $oReceivingFilter->m_aReferencedBy[$sForeignClass][$sForeignExtKeyAttCode][$iOperatorCode][] = $oFilter; } @@ -1135,23 +1041,18 @@ class DBObjectSearch extends DBSearch */ private static function FilterSubClass(DBObjectSearch &$oSearch, $sClassAlias, DBSearch $oFilter, $aRootClasses) { - if (($oSearch->GetFirstJoinedClassAlias() == $sClassAlias)) - { + if (($oSearch->GetFirstJoinedClassAlias() == $sClassAlias)) { $oSearch = $oSearch->IntersectSubClass($oFilter, $aRootClasses); return $oSearch->GetCriteria(); } /** @var Expression $oFilterExpression */ // Search in the filter tree where is the correct DBSearch - foreach ($oSearch->m_aPointingTo as $sExtKey => $aPointingTo) - { - foreach ($aPointingTo as $iOperatorCode => $aFilters) - { - foreach ($aFilters as $index => $oExtFilter) - { + foreach ($oSearch->m_aPointingTo as $sExtKey => $aPointingTo) { + foreach ($aPointingTo as $iOperatorCode => $aFilters) { + foreach ($aFilters as $index => $oExtFilter) { $oFilterExpression = self::FilterSubClass($oExtFilter, $sClassAlias, $oFilter, $aRootClasses); - if ($oFilterExpression !== false) - { + if ($oFilterExpression !== false) { $oSearch->m_aPointingTo[$sExtKey][$iOperatorCode][$index] = $oExtFilter; return $oFilterExpression; } @@ -1159,17 +1060,12 @@ class DBObjectSearch extends DBSearch } } - foreach($oSearch->m_aReferencedBy as $sForeignClass => $aReferences) - { - foreach($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) - { - foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) - { - foreach ($aFilters as $index => $oForeignFilter) - { + foreach ($oSearch->m_aReferencedBy as $sForeignClass => $aReferences) { + foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { + foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) { + foreach ($aFilters as $index => $oForeignFilter) { $oFilterExpression = self::FilterSubClass($oForeignFilter, $sClassAlias, $oFilter, $aRootClasses); - if ($oFilterExpression !== false) - { + if ($oFilterExpression !== false) { $oSearch->m_aReferencedBy[$sForeignClass][$sForeignExtKeyAttCode][$iOperatorCode][$index] = $oForeignFilter; return $oFilterExpression; } @@ -1187,24 +1083,19 @@ class DBObjectSearch extends DBSearch */ public function Intersect(DBSearch $oFilter) { - if ($oFilter instanceof DBUnionSearch) - { + if ($oFilter instanceof DBUnionSearch) { // Develop! $aFilters = $oFilter->GetSearches(); - } - else - { - $aFilters = array($oFilter); + } else { + $aFilters = [$oFilter]; } - $aSearches = array(); - foreach ($aFilters as $oRightFilter) - { + $aSearches = []; + foreach ($aFilters as $oRightFilter) { $aSearches[] = $this->IntersectSubClass($oRightFilter, $this->m_aClasses); } - if (count($aSearches) == 1) - { + if (count($aSearches) == 1) { // return a DBObjectSearch return $aSearches[0]; } @@ -1248,7 +1139,7 @@ class DBObjectSearch extends DBSearch } } - $aAliasTranslation = array(); + $aAliasTranslation = []; $oLeftFilter->RenameNestedQueriesAliasesInNameSpace($aRootClasses, $aAliasTranslation); $oLeftFilter->MergeWith_InNamespace($oRightFilter, $aRootClasses, $aAliasTranslation); $oRightFilter->RenameNestedQueriesAliasesInNameSpace($aRootClasses, $aAliasTranslation); @@ -1266,32 +1157,24 @@ class DBObjectSearch extends DBSearch */ protected function MergeWith_InNamespace($oFilter, &$aClassAliases, &$aAliasTranslation) { - if ($this->GetFirstJoinedClass() != $oFilter->GetClass()) - { + if ($this->GetFirstJoinedClass() != $oFilter->GetClass()) { throw new CoreException("Attempting to merge a filter of class '{$this->GetFirstJoinedClass()}' with a filter of class '{$oFilter->GetClass()}'"); } // Translate search condition into our aliasing scheme $aAliasTranslation[$oFilter->GetClassAlias()]['*'] = $this->GetFirstJoinedClassAlias(); - foreach($oFilter->m_aPointingTo as $sExtKeyAttCode=>$aPointingTo) - { - foreach($aPointingTo as $iOperatorCode => $aFilter) - { - foreach($aFilter as $oExtFilter) - { + foreach ($oFilter->m_aPointingTo as $sExtKeyAttCode => $aPointingTo) { + foreach ($aPointingTo as $iOperatorCode => $aFilter) { + foreach ($aFilter as $oExtFilter) { $this->AddCondition_PointingTo_InNamespace($oExtFilter, $sExtKeyAttCode, $aClassAliases, $aAliasTranslation, $iOperatorCode); } } } - foreach($oFilter->m_aReferencedBy as $sForeignClass => $aReferences) - { - foreach($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) - { - foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) - { - foreach ($aFilters as $oForeignFilter) - { + foreach ($oFilter->m_aReferencedBy as $sForeignClass => $aReferences) { + foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { + foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) { + foreach ($aFilters as $oForeignFilter) { $this->AddCondition_ReferencedBy_InNamespace($oForeignFilter, $sForeignExtKeyAttCode, $aClassAliases, $aAliasTranslation, $iOperatorCode); } } @@ -1299,15 +1182,22 @@ class DBObjectSearch extends DBSearch } } - public function GetCriteria() {return $this->m_oSearchCondition;} - public function GetCriteria_FullText() {throw new Exception("Removed GetCriteria_FullText");} + public function GetCriteria() + { + return $this->m_oSearchCondition; + } + public function GetCriteria_FullText() + { + throw new Exception("Removed GetCriteria_FullText"); + } public function GetCriteria_PointingTo($sKeyAttCode = "") { - if (empty($sKeyAttCode)) - { + if (empty($sKeyAttCode)) { return $this->m_aPointingTo; } - if (!array_key_exists($sKeyAttCode, $this->m_aPointingTo)) return array(); + if (!array_key_exists($sKeyAttCode, $this->m_aPointingTo)) { + return []; + } return $this->m_aPointingTo[$sKeyAttCode]; } @@ -1353,10 +1243,8 @@ class DBObjectSearch extends DBSearch */ public function AddInternalParam($sKey, $value, $bDoNotOverride = false) { - if ($bDoNotOverride) - { - if (array_key_exists($sKey, $this->m_aParams)) - { + if ($bDoNotOverride) { + if (array_key_exists($sKey, $this->m_aParams)) { throw new CoreUnexpectedValue("The key $sKey already exists with value : ".$this->m_aParams[$sKey]); } } @@ -1366,40 +1254,30 @@ class DBObjectSearch extends DBSearch public function GetQueryParams($bExcludeMagicParams = true) { - $aParams = array(); + $aParams = []; $this->m_oSearchCondition->RenderExpression(false, $aParams, true); - if ($bExcludeMagicParams) - { - $aRet = array(); + if ($bExcludeMagicParams) { + $aRet = []; // Make the list of acceptable arguments... could be factorized with run_query, into oSearch->GetQueryParams($bExclude magic params) - $aNakedMagicArguments = array(); - foreach (MetaModel::PrepareQueryArguments(array(),array(), $this->GetExpectedArguments()) as $sArgName => $value) - { + $aNakedMagicArguments = []; + foreach (MetaModel::PrepareQueryArguments([], [], $this->GetExpectedArguments()) as $sArgName => $value) { $iPos = strpos($sArgName, '->object()'); - if ($iPos === false) - { + if ($iPos === false) { $aNakedMagicArguments[$sArgName] = $value; - } - else - { + } else { $aNakedMagicArguments[substr($sArgName, 0, $iPos)] = true; } } - foreach ($aParams as $sParam => $foo) - { + foreach ($aParams as $sParam => $foo) { $iPos = strpos($sParam, '->'); - if ($iPos === false) - { + if ($iPos === false) { $sRefName = $sParam; - } - else - { + } else { $sRefName = substr($sParam, 0, $iPos); } - if (!array_key_exists($sRefName, $aNakedMagicArguments)) - { + if (!array_key_exists($sRefName, $aNakedMagicArguments)) { $aRet[$sParam] = $foo; } } @@ -1422,44 +1300,36 @@ class DBObjectSearch extends DBSearch { $this->m_oSearchCondition->ApplyParameters(array_merge($this->m_aParams, $aArgs)); } - + public function ToOQL($bDevelopParams = false, $aContextParams = null, $bWithAllowAllFlag = false) { // Currently unused, but could be useful later $bRetrofitParams = false; - if ($bDevelopParams) - { - if (is_null($aContextParams)) - { + if ($bDevelopParams) { + if (is_null($aContextParams)) { $aParams = array_merge($this->m_aParams); - } - else - { + } else { $aParams = array_merge($aContextParams, $this->m_aParams); } - $aParams = MetaModel::PrepareQueryArguments($aParams,array(), $this->GetExpectedArguments()); - } - else - { + $aParams = MetaModel::PrepareQueryArguments($aParams, [], $this->GetExpectedArguments()); + } else { // Leave it as is, the rendering will be made with parameters in clear $aParams = null; } - $aSelectedAliases = array(); - foreach ($this->m_aSelectedClasses as $sAlias => $sClass) - { - $aSelectedAliases[] = '`' . $sAlias . '`'; + $aSelectedAliases = []; + foreach ($this->m_aSelectedClasses as $sAlias => $sClass) { + $aSelectedAliases[] = '`'.$sAlias.'`'; } $sSelectedClasses = implode(', ', $aSelectedAliases); $sRes = 'SELECT '.$sSelectedClasses.' FROM'; - $sRes .= ' ' . $this->GetFirstJoinedClass() . ' AS `' . $this->GetFirstJoinedClassAlias() . '`'; + $sRes .= ' '.$this->GetFirstJoinedClass().' AS `'.$this->GetFirstJoinedClassAlias().'`'; $sRes .= $this->ToOQL_Joins(); $sRes .= " WHERE ".$this->m_oSearchCondition->RenderExpression(false, $aParams, $bRetrofitParams); - if ($bWithAllowAllFlag && $this->m_bAllowAllData) - { + if ($bWithAllowAllFlag && $this->m_bAllowAllData) { $sRes .= " ALLOW ALL DATA"; } return $sRes; @@ -1467,8 +1337,7 @@ class DBObjectSearch extends DBSearch protected function OperatorCodeToOQL($iOperatorCode) { - switch($iOperatorCode) - { + switch ($iOperatorCode) { case TREE_OPERATOR_EQUALS: $sOperator = ' = '; break; @@ -1512,28 +1381,21 @@ class DBObjectSearch extends DBSearch protected function ToOQL_Joins() { $sRes = ''; - foreach($this->m_aPointingTo as $sExtKey => $aPointingTo) - { - foreach($aPointingTo as $iOperatorCode => $aFilter) - { + foreach ($this->m_aPointingTo as $sExtKey => $aPointingTo) { + foreach ($aPointingTo as $iOperatorCode => $aFilter) { $sOperator = $this->OperatorCodeToOQL($iOperatorCode); - foreach($aFilter as $oFilter) - { - $sRes .= ' JOIN ' . $oFilter->GetFirstJoinedClass() . ' AS `' . $oFilter->GetFirstJoinedClassAlias() . '` ON `' . $this->GetFirstJoinedClassAlias() . '`.' . $sExtKey . $sOperator . '`' . $oFilter->GetFirstJoinedClassAlias() . '`.id'; - $sRes .= $oFilter->ToOQL_Joins(); + foreach ($aFilter as $oFilter) { + $sRes .= ' JOIN '.$oFilter->GetFirstJoinedClass().' AS `'.$oFilter->GetFirstJoinedClassAlias().'` ON `'.$this->GetFirstJoinedClassAlias().'`.'.$sExtKey.$sOperator.'`'.$oFilter->GetFirstJoinedClassAlias().'`.id'; + $sRes .= $oFilter->ToOQL_Joins(); } } } - foreach($this->m_aReferencedBy as $sForeignClass=>$aReferences) - { - foreach($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) - { - foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) - { + foreach ($this->m_aReferencedBy as $sForeignClass => $aReferences) { + foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { + foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) { $sOperator = $this->OperatorCodeToOQL($iOperatorCode); - foreach ($aFilters as $oForeignFilter) - { - $sRes .= ' JOIN ' . $oForeignFilter->GetFirstJoinedClass() . ' AS `' . $oForeignFilter->GetFirstJoinedClassAlias() . '` ON `' . $oForeignFilter->GetFirstJoinedClassAlias() . '`.' . $sForeignExtKeyAttCode . $sOperator . '`' . $this->GetFirstJoinedClassAlias() . '`.id'; + foreach ($aFilters as $oForeignFilter) { + $sRes .= ' JOIN '.$oForeignFilter->GetFirstJoinedClass().' AS `'.$oForeignFilter->GetFirstJoinedClassAlias().'` ON `'.$oForeignFilter->GetFirstJoinedClassAlias().'`.'.$sForeignExtKeyAttCode.$sOperator.'`'.$this->GetFirstJoinedClassAlias().'`.id'; $sRes .= $oForeignFilter->ToOQL_Joins(); } } @@ -1544,81 +1406,55 @@ class DBObjectSearch extends DBSearch protected function OQLExpressionToCondition($sQuery, $oExpression, $aClassAliases) { - if ($oExpression instanceof BinaryOqlExpression) - { + if ($oExpression instanceof BinaryOqlExpression) { $sOperator = $oExpression->GetOperator(); $oLeft = $this->OQLExpressionToCondition($sQuery, $oExpression->GetLeftExpr(), $aClassAliases); $oRight = $this->OQLExpressionToCondition($sQuery, $oExpression->GetRightExpr(), $aClassAliases); return new BinaryExpression($oLeft, $sOperator, $oRight); - } - elseif ($oExpression instanceof MatchOqlExpression) - { + } elseif ($oExpression instanceof MatchOqlExpression) { $oLeft = $this->OQLExpressionToCondition($sQuery, $oExpression->GetLeftExpr(), $aClassAliases); $oRight = $this->OQLExpressionToCondition($sQuery, $oExpression->GetRightExpr(), $aClassAliases); return new MatchExpression($oLeft, $oRight); - } - elseif ($oExpression instanceof FieldOqlExpression) - { + } elseif ($oExpression instanceof FieldOqlExpression) { $sClassAlias = $oExpression->GetParent(); $sFltCode = $oExpression->GetName(); - if (empty($sClassAlias)) - { + if (empty($sClassAlias)) { // Need to find the right alias // Build an array of field => array of aliases - $aFieldClasses = array(); - foreach($aClassAliases as $sAlias => $sReal) - { - foreach(MetaModel::GetFiltersList($sReal) as $sAnFltCode) - { + $aFieldClasses = []; + foreach ($aClassAliases as $sAlias => $sReal) { + foreach (MetaModel::GetFiltersList($sReal) as $sAnFltCode) { $aFieldClasses[$sAnFltCode][] = $sAlias; } } $sClassAlias = $aFieldClasses[$sFltCode][0]; } return new FieldExpression($sFltCode, $sClassAlias); - } - elseif ($oExpression instanceof VariableOqlExpression) - { + } elseif ($oExpression instanceof VariableOqlExpression) { return new VariableExpression($oExpression->GetName()); - } - elseif ($oExpression instanceof TrueOqlExpression) - { - return new TrueExpression; - } - elseif ($oExpression instanceof ScalarOqlExpression) - { + } elseif ($oExpression instanceof TrueOqlExpression) { + return new TrueExpression(); + } elseif ($oExpression instanceof ScalarOqlExpression) { return new ScalarExpression($oExpression->GetValue()); - } - elseif ($oExpression instanceof ListOqlExpression) - { - $aItems = array(); - foreach ($oExpression->GetItems() as $oItemExpression) - { + } elseif ($oExpression instanceof ListOqlExpression) { + $aItems = []; + foreach ($oExpression->GetItems() as $oItemExpression) { $aItems[] = $this->OQLExpressionToCondition($sQuery, $oItemExpression, $aClassAliases); } return new ListExpression($aItems); - } - elseif ($oExpression instanceof FunctionOqlExpression) - { - $aArgs = array(); - foreach ($oExpression->GetArgs() as $oArgExpression) - { + } elseif ($oExpression instanceof FunctionOqlExpression) { + $aArgs = []; + foreach ($oExpression->GetArgs() as $oArgExpression) { $aArgs[] = $this->OQLExpressionToCondition($sQuery, $oArgExpression, $aClassAliases); } return new FunctionExpression($oExpression->GetVerb(), $aArgs); - } - elseif ($oExpression instanceof IntervalOqlExpression) - { + } elseif ($oExpression instanceof IntervalOqlExpression) { return new IntervalExpression($oExpression->GetValue(), $oExpression->GetUnit()); - } - elseif ($oExpression instanceof NestedQueryOqlExpression) - { + } elseif ($oExpression instanceof NestedQueryOqlExpression) { return NestedQueryExpression::FromOQLObjectQuery($oExpression->GetOQLObjectQuery()); - } - else - { - throw new CoreException('Unknown expression type', array('class'=>get_class($oExpression), 'query'=>$sQuery)); + } else { + throw new CoreException('Unknown expression type', ['class' => get_class($oExpression), 'query' => $sQuery]); } } @@ -1628,14 +1464,13 @@ class DBObjectSearch extends DBSearch */ public function ToJSON() { - $aRet = array('selects' => array(), 'joins' => array(), 'where' => array()); + $aRet = ['selects' => [], 'joins' => [], 'where' => []]; $aParams = array_merge($this->m_aParams); - $aParams = MetaModel::PrepareQueryArguments($aParams, array(), $this->GetExpectedArguments()); + $aParams = MetaModel::PrepareQueryArguments($aParams, [], $this->GetExpectedArguments()); - foreach ($this->m_aSelectedClasses as $sAlias => $sClass) - { - $aRet['selects'][] = array('class' => $sClass, 'alias' => $sAlias); + foreach ($this->m_aSelectedClasses as $sAlias => $sClass) { + $aRet['selects'][] = ['class' => $sClass, 'alias' => $sAlias]; } $this->JoinsToJSON($aRet); @@ -1653,42 +1488,35 @@ class DBObjectSearch extends DBSearch */ protected function JoinsToJSON(&$aRet) { - foreach($this->m_aPointingTo as $sExtKey => $aPointingTo) - { - foreach($aPointingTo as $iOperatorCode => $aFilter) - { + foreach ($this->m_aPointingTo as $sExtKey => $aPointingTo) { + foreach ($aPointingTo as $iOperatorCode => $aFilter) { $sOperator = $this->OperatorCodeToOQL($iOperatorCode); - foreach($aFilter as $oFilter) - { - $aRet['joins'][] = array( + foreach ($aFilter as $oFilter) { + $aRet['joins'][] = [ 'src' => $this->GetFirstJoinedClass(), 'src_alias' => $this->GetFirstJoinedClassAlias(), 'target' => $oFilter->GetFirstJoinedClass(), 'target_alias' => $oFilter->GetFirstJoinedClassAlias(), 'foreign_key' => $sExtKey, 'operator' => $sOperator, - ); + ]; $oFilter->JoinsToJSON($aRet); } } } - foreach($this->m_aReferencedBy as $aReferences) - { - foreach($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) - { - foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) - { + foreach ($this->m_aReferencedBy as $aReferences) { + foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { + foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) { $sOperator = $this->OperatorCodeToOQL($iOperatorCode); - foreach ($aFilters as $oForeignFilter) - { - $aRet['joins'][] = array( + foreach ($aFilters as $oForeignFilter) { + $aRet['joins'][] = [ 'src' => $oForeignFilter->GetFirstJoinedClass(), 'src_alias' => $oForeignFilter->GetFirstJoinedClassAlias(), 'target' => $this->GetFirstJoinedClass(), 'target_alias' => $this->GetFirstJoinedClassAlias(), 'foreign_key' => $sForeignExtKeyAttCode, 'operator' => $sOperator, - ); + ]; $oForeignFilter->JoinsToJSON($aRet); } } @@ -1709,18 +1537,15 @@ class DBObjectSearch extends DBSearch $sClass = $oOqlQuery->GetClass($oModelReflection); $sClassAlias = $oOqlQuery->GetClassAlias(); - $aAliases = array($sClassAlias => $sClass); + $aAliases = [$sClassAlias => $sClass]; // Note: the condition must be built here, it may be altered later on when optimizing some joins $oConditionTree = $oOqlQuery->GetCondition(); - if ($oConditionTree instanceof Expression) - { - $aRawAliases = array($sClassAlias => $sClass); + if ($oConditionTree instanceof Expression) { + $aRawAliases = [$sClassAlias => $sClass]; $aJoinSpecs = $oOqlQuery->GetJoins(); - if (is_array($aJoinSpecs)) - { - foreach ($aJoinSpecs as $oJoinSpec) - { + if (is_array($aJoinSpecs)) { + foreach ($aJoinSpecs as $oJoinSpec) { $aRawAliases[$oJoinSpec->GetClassAlias()] = $oJoinSpec->GetClass(); } } @@ -1730,18 +1555,15 @@ class DBObjectSearch extends DBSearch // Maintain an array of filters, because the flat list is in fact referring to a tree // And this will be an easy way to dispatch the conditions // $this will be referenced by the other filters, or the other way around... - $aJoinItems = array($sClassAlias => $this); + $aJoinItems = [$sClassAlias => $this]; $aJoinSpecs = $oOqlQuery->GetJoins(); - if (is_array($aJoinSpecs)) - { - $aAliasTranslation = array(); - foreach ($aJoinSpecs as $oJoinSpec) - { + if (is_array($aJoinSpecs)) { + $aAliasTranslation = []; + foreach ($aJoinSpecs as $oJoinSpec) { $sJoinClass = $oJoinSpec->GetClass(); $sJoinClassAlias = $oJoinSpec->GetClassAlias(); - if (isset($aAliasTranslation[$sJoinClassAlias]['*'])) - { + if (isset($aAliasTranslation[$sJoinClassAlias]['*'])) { $sJoinClassAlias = $aAliasTranslation[$sJoinClassAlias]['*']; } @@ -1749,16 +1571,14 @@ class DBObjectSearch extends DBSearch // normalization should take care of this $oLeftField = $oJoinSpec->GetLeftField(); $sFromClass = $oLeftField->GetParent(); - if (isset($aAliasTranslation[$sFromClass]['*'])) - { + if (isset($aAliasTranslation[$sFromClass]['*'])) { $sFromClass = $aAliasTranslation[$sFromClass]['*']; } $sExtKeyAttCode = $oLeftField->GetName(); $oRightField = $oJoinSpec->GetRightField(); $sToClass = $oRightField->GetParent(); - if (isset($aAliasTranslation[$sToClass]['*'])) - { + if (isset($aAliasTranslation[$sToClass]['*'])) { $sToClass = $aAliasTranslation[$sToClass]['*']; } @@ -1766,8 +1586,7 @@ class DBObjectSearch extends DBSearch $aJoinItems[$sJoinClassAlias] = new DBObjectSearch($sJoinClass, $sJoinClassAlias); $sOperator = $oJoinSpec->GetOperator(); - switch($sOperator) - { + switch ($sOperator) { case '=': default: $iOperatorCode = TREE_OPERATOR_EQUALS; @@ -1798,14 +1617,11 @@ class DBObjectSearch extends DBSearch break; } - if ($sFromClass == $sJoinClassAlias) - { + if ($sFromClass == $sJoinClassAlias) { $oReceiver = $aJoinItems[$sToClass]; $oNewComer = $aJoinItems[$sFromClass]; $oReceiver->AddCondition_ReferencedBy_InNameSpace($oNewComer, $sExtKeyAttCode, $oReceiver->m_aClasses, $aAliasTranslation, $iOperatorCode); - } - else - { + } else { $oReceiver = $aJoinItems[$sFromClass]; $oNewComer = $aJoinItems[$sToClass]; $oReceiver->AddCondition_PointingTo_InNameSpace($oNewComer, $sExtKeyAttCode, $oReceiver->m_aClasses, $aAliasTranslation, $iOperatorCode); @@ -1815,12 +1631,10 @@ class DBObjectSearch extends DBSearch } // Check and prepare the select information - $this->m_aSelectedClasses = array(); - foreach ($oOqlQuery->GetSelectedClasses() as $oClassDetails) - { + $this->m_aSelectedClasses = []; + foreach ($oOqlQuery->GetSelectedClasses() as $oClassDetails) { $sClassToSelect = $oClassDetails->GetValue(); - if (!array_key_exists($sClassToSelect, $aAliases)) - { + if (!array_key_exists($sClassToSelect, $aAliases)) { throw new CoreException("$sClassToSelect is not a valid alias"); } $this->m_aSelectedClasses[$sClassToSelect] = $aAliases[$sClassToSelect]; @@ -1834,7 +1648,7 @@ class DBObjectSearch extends DBSearch // //////////////////////////////////////////////////////////////////////////// - public function MakeDeleteQuery($aArgs = array()) + public function MakeDeleteQuery($aArgs = []) { $oSQLObjectQueryBuilder = new SQLObjectQueryBuilder($this); $oSQLQuery = $oSQLObjectQueryBuilder->MakeSQLObjectDeleteQuery(); @@ -1850,7 +1664,7 @@ class DBObjectSearch extends DBSearch * @return string * @throws \CoreException */ - public function MakeUpdateQuery($aValues, $aArgs = array()) + public function MakeUpdateQuery($aValues, $aArgs = []) { $oSQLObjectQueryBuilder = new SQLObjectQueryBuilder($this); $oSQLQuery = $oSQLObjectQueryBuilder->MakeSQLObjectUpdateQuery($aValues); @@ -1869,7 +1683,7 @@ class DBObjectSearch extends DBSearch * @return string * @throws \CoreException */ - public function MakeInsertQuery($aValues, $aArgs = array()) + public function MakeInsertQuery($aValues, $aArgs = []) { $oSQLObjectQueryBuilder = new SQLObjectQueryBuilder($this); $oSQLQuery = $oSQLObjectQueryBuilder->MakeSQLObjectUpdateQuery($aValues); @@ -1914,14 +1728,12 @@ class DBObjectSearch extends DBSearch // Create a unique cache id // - $aContextData = array(); + $aContextData = []; $bCanCache = true; - if (self::$m_bQueryCacheEnabled || self::$m_bTraceQueries) - { - if (isset($_SERVER['REQUEST_URI'])) - { + if (self::$m_bQueryCacheEnabled || self::$m_bTraceQueries) { + if (isset($_SERVER['REQUEST_URI'])) { $aContextData['sRequestUri'] = $_SERVER['REQUEST_URI']; - } else if (isset($_SERVER['SCRIPT_NAME'])) { + } elseif (isset($_SERVER['SCRIPT_NAME'])) { $aContextData['sRequestUri'] = $_SERVER['SCRIPT_NAME']; } else { $aContextData['sRequestUri'] = ''; @@ -1974,19 +1786,15 @@ class DBObjectSearch extends DBSearch $aContextData['bIsArchiveMode'] = $bIsArchiveMode; $aContextData['bShowObsoleteData'] = $bShowObsoleteData; $sOqlId = md5($sRawId); - } - else - { + } else { $sOqlQuery = "SELECTING... ".$oSearch->GetClass(); $sOqlId = "query id ? n/a"; } - // Query caching // $sOqlAPCCacheId = null; - if (self::$m_bQueryCacheEnabled && $bCanCache) - { + if (self::$m_bQueryCacheEnabled && $bCanCache) { // Warning: using directly the query string as the key to the hash array can FAIL if the string // is long and the differences are only near the end... so it's safer (but not bullet proof?) // to use a hash (like md5) of the string as the key ! @@ -1997,15 +1805,12 @@ class DBObjectSearch extends DBSearch // SELECT SLT JOIN lnkSLTToSLA AS L1 ON L1.slt_id=SLT.id JOIN SLA ON L1.sla_id = SLA.id JOIN lnkContractToSLA AS L2 ON L2.sla_id = SLA.id JOIN CustomerContract ON L2.contract_id = CustomerContract.id WHERE SLT.ticket_priority = 1 AND SLA.service_id = 3 AND SLT.metric = 'TTR' AND CustomerContract.customer_id = 2 // the only difference is R instead or O at position 285 (TTR instead of TTO)... // - if (array_key_exists($sOqlId, self::$m_aQueryStructCache)) - { + if (array_key_exists($sOqlId, self::$m_aQueryStructCache)) { // hit! $oSQLQuery = unserialize(serialize(self::$m_aQueryStructCache[$sOqlId])); // Note: cloning is not enough because the subtree is made of objects - } - elseif (self::$m_bUseAPCCache) - { + } elseif (self::$m_bUseAPCCache) { // Note: For versions of APC older than 3.0.17, fetch() accepts only one parameter // $sOqlAPCCacheId = 'itop-'.MetaModel::GetEnvironmentId().'-query-cache-'.$sOqlId; @@ -2013,25 +1818,21 @@ class DBObjectSearch extends DBSearch $result = apc_fetch($sOqlAPCCacheId); $oKPI->ComputeStats('Query APC (fetch)', $sOqlQuery); - if (is_object($result)) - { + if (is_object($result)) { $oSQLQuery = $result; self::$m_aQueryStructCache[$sOqlId] = $oSQLQuery; } } } - if (!isset($oSQLQuery)) - { + if (!isset($oSQLQuery)) { $oKPI = new ExecutionKPI(); $oSQLObjectQueryBuilder = new SQLObjectQueryBuilder($oSearch); $oSQLQuery = $oSQLObjectQueryBuilder->BuildSQLQueryStruct($aAttToLoad, $bGetCount, $aModifierProperties, $aGroupByExpr, $aSelectedClasses, $aSelectExpr); $oKPI->ComputeStats('BuildSQLQueryStruct', $sOqlQuery); - if (self::$m_bQueryCacheEnabled) - { - if ($bCanCache && self::$m_bUseAPCCache) - { + if (self::$m_bQueryCacheEnabled) { + if ($bCanCache && self::$m_bUseAPCCache) { $oSQLQuery->m_aContextData = $aContextData; $oKPI = new ExecutionKPI(); apc_store($sOqlAPCCacheId, $oSQLQuery, self::$m_iQueryCacheTTL); @@ -2052,28 +1853,28 @@ class DBObjectSearch extends DBSearch * @return \FunctionExpression|mixed|null * @throws \CoreException */ - static public function GetPolymorphicExpression($sClass, $sAttCode) + public static function GetPolymorphicExpression($sClass, $sAttCode) { $oExpression = ExpressionCache::GetCachedExpression($sClass, $sAttCode); - if (!empty($oExpression)) - { + if (!empty($oExpression)) { return $oExpression; } // 1st step - get all of the required expressions (instantiable classes) // and group them using their OQL representation // - $aExpressions = array(); // signature => array('expression' => oExp, 'classes' => array of classes) - foreach (MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL) as $sSubClass) - { - if (($sSubClass != $sClass) && MetaModel::IsAbstract($sSubClass)) continue; + $aExpressions = []; // signature => array('expression' => oExp, 'classes' => array of classes) + foreach (MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL) as $sSubClass) { + if (($sSubClass != $sClass) && MetaModel::IsAbstract($sSubClass)) { + continue; + } $oAttDef = MetaModel::GetAttributeDef($sSubClass, $sAttCode); $oSubClassExp = $oAttDef->GetOQLExpression($sSubClass); // 3rd step - position the attributes in the hierarchy of classes // - $oSubClassExp->Browse(function($oNode) use ($sSubClass) { + $oSubClassExp->Browse(function ($oNode) use ($sSubClass) { if ($oNode instanceof FieldExpression) { $sAttCode = $oNode->GetName(); $oAttDef = MetaModel::GetAttributeDef($sSubClass, $sAttCode); @@ -2090,44 +1891,37 @@ class DBObjectSearch extends DBSearch $sSignature = $oSubClassExp->RenderExpression(); if (!array_key_exists($sSignature, $aExpressions)) { - $aExpressions[$sSignature] = array( + $aExpressions[$sSignature] = [ 'expression' => $oSubClassExp, - 'classes' => array(), - ); + 'classes' => [], + ]; } $aExpressions[$sSignature]['classes'][] = $sSubClass; } // 2nd step - build the final name expression depending on the finalclass // - if (count($aExpressions) == 1) - { + if (count($aExpressions) == 1) { $aExpData = reset($aExpressions); $oExpression = $aExpData['expression']; - } - else - { + } else { $oExpression = null; - foreach ($aExpressions as $sSignature => $aExpData) - { + foreach ($aExpressions as $sSignature => $aExpData) { $oClassListExpr = ListExpression::FromScalars($aExpData['classes']); $oClassExpr = new FieldExpression('finalclass', $sClass); $oClassInList = new BinaryExpression($oClassExpr, 'IN', $oClassListExpr); - if (is_null($oExpression)) - { + if (is_null($oExpression)) { $oExpression = $aExpData['expression']; - } - else - { - $oExpression = new FunctionExpression('IF', array($oClassInList, $aExpData['expression'], $oExpression)); + } else { + $oExpression = new FunctionExpression('IF', [$oClassInList, $aExpData['expression'], $oExpression]); } } } return $oExpression; } - function GetExpectedArguments(): array + public function GetExpectedArguments(): array { return $this->GetCriteria()->ListParameters(); } diff --git a/core/dbobjectset.class.php b/core/dbobjectset.class.php index 12783ce6f..6d25134cf 100644 --- a/core/dbobjectset.class.php +++ b/core/dbobjectset.class.php @@ -1,4 +1,5 @@ .]attcode' => bAscending (true for ASC, false, for DESC) * Example : array('name' => true, 'id' => false) @@ -97,10 +97,10 @@ class DBObjectSet implements iDBObjectSetIterator * @param int $iLimitStart Index of the first row to load (i.e. equivalent to MySQL's LIMIT start, count) * @param bool $bSort if false no order by is done */ - public function __construct(DBSearch $oFilter, $aOrderBy = array(), $aArgs = array(), $aExtendedDataSpec = null, $iLimitCount = 0, $iLimitStart = 0, $bSort = true) + public function __construct(DBSearch $oFilter, $aOrderBy = [], $aArgs = [], $aExtendedDataSpec = null, $iLimitCount = 0, $iLimitStart = 0, $bSort = true) { $this->m_oFilter = $oFilter->DeepClone(); - $this->m_aAddedIds = array(); + $this->m_aAddedIds = []; $this->m_aOrderBy = $aOrderBy; $this->m_aArgs = $aArgs; $this->m_aAttToLoad = null; @@ -112,44 +112,41 @@ class DBObjectSet implements iDBObjectSetIterator $this->m_iNumTotalDBRows = null; $this->m_iNumLoadedDBRows = 0; $this->m_bLoaded = false; - $this->m_aAddedObjects = array(); + $this->m_aAddedObjects = []; $this->m_iCurrRow = 0; $this->m_oSQLResult = null; } - /** - * @internal - */ + /** + * @internal + */ public function __destruct() { - if (is_object($this->m_oSQLResult)) - { + if (is_object($this->m_oSQLResult)) { $this->m_oSQLResult->free(); } } - /** - * @internal - * - * @return string - * - * @throws \Exception - * @throws \CoreException - * @throws \MissingQueryArgument - */ + /** + * @internal + * + * @return string + * + * @throws \Exception + * @throws \CoreException + * @throws \MissingQueryArgument + */ public function __toString() { $sRet = ''; $this->Rewind(); $sRet .= "Set (".$this->m_oFilter->ToOQL(true).")
        \n"; - $sRet .= "Query:
        ".$this->m_oFilter->MakeSelectQuery().")
        \n"; - + $sRet .= "Query:
        ".$this->m_oFilter->MakeSelectQuery().")
        \n"; + $sRet .= $this->Count()." records
        \n"; - if ($this->Count() > 0) - { + if ($this->Count() > 0) { $sRet .= "
          \n"; - while ($oObj = $this->Fetch()) - { + while ($oObj = $this->Fetch()) { $sRet .= "
        • ".$oObj->__toString()."
        • \n"; } $sRet .= "
        \n"; @@ -158,9 +155,9 @@ class DBObjectSet implements iDBObjectSetIterator return $sRet; } - /** - * @internal - */ + /** + * @internal + */ public function __clone() { $this->m_oFilter = $this->m_oFilter->DeepClone(); @@ -174,7 +171,7 @@ class DBObjectSet implements iDBObjectSetIterator /** * Called when unserializing a DBObjectSet - * @internal + * @internal */ public function __wakeup() { @@ -185,84 +182,75 @@ class DBObjectSet implements iDBObjectSetIterator $this->m_oSQLResult = null; } - /** - * @internal - * @param $bShow - */ + /** + * @internal + * @param $bShow + */ public function SetShowObsoleteData($bShow) { $this->m_oFilter->SetShowObsoleteData($bShow); } - /** - * @internal - * @return bool - */ + /** + * @internal + * @return bool + */ public function GetShowObsoleteData() { return $this->m_oFilter->GetShowObsoleteData(); } - /** - * Specify the subset of attributes to load - * this subset is specified for each class of objects, - * this has to be done before the actual fetch. - * - * @api - * - * @param array $aAttToLoad Format: alias => array of attribute_codes - * - * @return void - * - * @throws \Exception - * @throws \CoreException - */ + /** + * Specify the subset of attributes to load + * this subset is specified for each class of objects, + * this has to be done before the actual fetch. + * + * @api + * + * @param array $aAttToLoad Format: alias => array of attribute_codes + * + * @return void + * + * @throws \Exception + * @throws \CoreException + */ public function OptimizeColumnLoad($aAttToLoad) { // Check that the structure is an array of array - if (!is_array($aAttToLoad)) - { + if (!is_array($aAttToLoad)) { $this->m_aAttToLoad = null; - trigger_error ( "OptimizeColumnLoad : wrong format actual :(".print_r($aAttToLoad, true)."). should be [alias=>[attributes]]", E_USER_WARNING ); + trigger_error("OptimizeColumnLoad : wrong format actual :(".print_r($aAttToLoad, true)."). should be [alias=>[attributes]]", E_USER_WARNING); return; } - foreach ($aAttToLoad as $sAlias => $aAttCodes) - { - if (!is_array($aAttCodes)) - { + foreach ($aAttToLoad as $sAlias => $aAttCodes) { + if (!is_array($aAttCodes)) { $this->m_aAttToLoad = null; - trigger_error ( "OptimizeColumnLoad : wrong format actual :(".print_r($aAttToLoad, true)."). should be [alias=>[attributes]]", E_USER_WARNING ); + trigger_error("OptimizeColumnLoad : wrong format actual :(".print_r($aAttToLoad, true)."). should be [alias=>[attributes]]", E_USER_WARNING); return; } } // Complete the attribute list with the attribute codes - $aAttToLoadWithAttDef = array(); - foreach($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) - { - $aAttToLoadWithAttDef[$sClassAlias] = array(); - if (array_key_exists($sClassAlias, $aAttToLoad)) - { + $aAttToLoadWithAttDef = []; + foreach ($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) { + $aAttToLoadWithAttDef[$sClassAlias] = []; + if (array_key_exists($sClassAlias, $aAttToLoad)) { $aAttList = $aAttToLoad[$sClassAlias]; - foreach($aAttList as $sAttToLoad) - { + foreach ($aAttList as $sAttToLoad) { $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttToLoad); $aAttToLoadWithAttDef[$sClassAlias][$sAttToLoad] = $oAttDef; - if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) - { + if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) { // Add the external key friendly name anytime $oFriendlyNameAttDef = MetaModel::GetAttributeDef($sClass, $sAttToLoad.'_friendlyname'); $aAttToLoadWithAttDef[$sClassAlias][$sAttToLoad.'_friendlyname'] = $oFriendlyNameAttDef; - if (MetaModel::IsArchivable($oAttDef->GetTargetClass(EXTKEY_ABSOLUTE))) - { + if (MetaModel::IsArchivable($oAttDef->GetTargetClass(EXTKEY_ABSOLUTE))) { // Add the archive flag if necessary $oArchiveFlagAttDef = MetaModel::GetAttributeDef($sClass, $sAttToLoad.'_archive_flag'); $aAttToLoadWithAttDef[$sClassAlias][$sAttToLoad.'_archive_flag'] = $oArchiveFlagAttDef; } - if (MetaModel::IsObsoletable($oAttDef->GetTargetClass(EXTKEY_ABSOLUTE))) - { + if (MetaModel::IsObsoletable($oAttDef->GetTargetClass(EXTKEY_ABSOLUTE))) { // Add the obsolescence flag if necessary $oObsoleteFlagAttDef = MetaModel::GetAttributeDef($sClass, $sAttToLoad.'_obsolescence_flag'); $aAttToLoadWithAttDef[$sClassAlias][$sAttToLoad.'_obsolescence_flag'] = $oObsoleteFlagAttDef; @@ -275,23 +263,20 @@ class DBObjectSet implements iDBObjectSetIterator $oFriendlyNameAttDef = MetaModel::GetAttributeDef($sClass, 'friendlyname'); $aAttToLoadWithAttDef[$sClassAlias]['friendlyname'] = $oFriendlyNameAttDef; - if (MetaModel::IsArchivable($sClass)) - { + if (MetaModel::IsArchivable($sClass)) { // Add the archive flag if necessary $oArchiveFlagAttDef = MetaModel::GetAttributeDef($sClass, 'archive_flag'); $aAttToLoadWithAttDef[$sClassAlias]['archive_flag'] = $oArchiveFlagAttDef; } - if (MetaModel::IsObsoletable($sClass)) - { + if (MetaModel::IsObsoletable($sClass)) { // Add the obsolescence flag if necessary $oObsoleteFlagAttDef = MetaModel::GetAttributeDef($sClass, 'obsolescence_flag'); $aAttToLoadWithAttDef[$sClassAlias]['obsolescence_flag'] = $oObsoleteFlagAttDef; } // Make sure that the final class is requested anytime, whatever the specification (needed for object construction!) - if (!MetaModel::IsStandaloneClass($sClass) && !array_key_exists('finalclass', $aAttToLoadWithAttDef[$sClassAlias])) - { + if (!MetaModel::IsStandaloneClass($sClass) && !array_key_exists('finalclass', $aAttToLoadWithAttDef[$sClassAlias])) { $aAttToLoadWithAttDef[$sClassAlias]['finalclass'] = MetaModel::GetAttributeDef($sClass, 'finalclass'); } } @@ -299,36 +284,36 @@ class DBObjectSet implements iDBObjectSetIterator $this->m_aAttToLoad = $aAttToLoadWithAttDef; } - /** - * Create a set (in-memory) containing just the given object - * - * @internal - * - * @param \DBobject $oObject - * - * @return \DBObjectSet The singleton set - * - * @throws \Exception - */ - static public function FromObject($oObject) + /** + * Create a set (in-memory) containing just the given object + * + * @internal + * + * @param \DBobject $oObject + * + * @return \DBObjectSet The singleton set + * + * @throws \Exception + */ + public static function FromObject($oObject) { $oRetSet = self::FromScratch(get_class($oObject)); $oRetSet->AddObject($oObject); return $oRetSet; } - /** - * Create an empty set (in-memory), for the given class (and its subclasses) of objects - * - * @internal - * - * @param string $sClass The class (or an ancestor) for the objects to be added in this set - * - * @return \DBObjectSet The empty set - * - * @throws \Exception - */ - static public function FromScratch($sClass) + /** + * Create an empty set (in-memory), for the given class (and its subclasses) of objects + * + * @internal + * + * @param string $sClass The class (or an ancestor) for the objects to be added in this set + * + * @return \DBObjectSet The empty set + * + * @throws \Exception + */ + public static function FromScratch($sClass) { $oFilter = new DBObjectSearch($sClass); $oFilter->AddConditionExpression(new FalseExpression()); @@ -338,41 +323,41 @@ class DBObjectSet implements iDBObjectSetIterator return $oRetSet; } - /** - * Create a set (in-memory) with just one column (i.e. one object per row) and filled with the given array of objects - * - * @internal - * - * @param string $sClass The class of the objects (must be a common ancestor to all objects in the set) - * @param array $aObjects The list of objects to add into the set - * - * @return \DBObjectSet - * - * @throws \Exception - */ - static public function FromArray($sClass, $aObjects) + /** + * Create a set (in-memory) with just one column (i.e. one object per row) and filled with the given array of objects + * + * @internal + * + * @param string $sClass The class of the objects (must be a common ancestor to all objects in the set) + * @param array $aObjects The list of objects to add into the set + * + * @return \DBObjectSet + * + * @throws \Exception + */ + public static function FromArray($sClass, $aObjects) { $oRetSet = self::FromScratch($sClass); $oRetSet->AddObjectArray($aObjects, $sClass); return $oRetSet; } - /** - * Create a set in-memory with several classes of objects per row (with one alias per "column") - * - * **Limitation:** - * The filter/OQL query representing such a set can not be rebuilt (only the first column will be taken into account) - * - * @internal - * - * @param array $aClasses Format: array of (alias => class) - * @param array $aObjects Format: array of (array of (classalias => object)) - * - * @return \DBObjectSet - * - * @throws \Exception - */ - static public function FromArrayAssoc($aClasses, $aObjects) + /** + * Create a set in-memory with several classes of objects per row (with one alias per "column") + * + * **Limitation:** + * The filter/OQL query representing such a set can not be rebuilt (only the first column will be taken into account) + * + * @internal + * + * @param array $aClasses Format: array of (alias => class) + * @param array $aObjects Format: array of (array of (classalias => object)) + * + * @return \DBObjectSet + * + * @throws \Exception + */ + public static function FromArrayAssoc($aClasses, $aObjects) { // In a perfect world, we should create a complete tree of DBObjectSearch, // but as we lack most of the information related to the objects, @@ -384,132 +369,115 @@ class DBObjectSet implements iDBObjectSetIterator $oRetSet = new self($oFilter); $oRetSet->m_bLoaded = true; // no DB load $oRetSet->m_iNumTotalDBRows = 0; // Nothing from the DB - - foreach($aObjects as $rowIndex => $aObjectsByClassAlias) - { + + foreach ($aObjects as $rowIndex => $aObjectsByClassAlias) { $oRetSet->AddObjectExtended($aObjectsByClassAlias); } return $oRetSet; } - /** - * - * @internal - * - * @param $oObject - * @param string $sLinkSetAttCode - * @param string $sExtKeyToRemote - * - * @return \DBObjectSet - * - * @throws \Exception - * @throws \ArchivedObjectException - * @throws \CoreException - */static public function FromLinkSet($oObject, $sLinkSetAttCode, $sExtKeyToRemote) + /** + * + * @internal + * + * @param $oObject + * @param string $sLinkSetAttCode + * @param string $sExtKeyToRemote + * + * @return \DBObjectSet + * + * @throws \Exception + * @throws \ArchivedObjectException + * @throws \CoreException + */public static function FromLinkSet($oObject, $sLinkSetAttCode, $sExtKeyToRemote) { $oLinkAttCode = MetaModel::GetAttributeDef(get_class($oObject), $sLinkSetAttCode); $oExtKeyAttDef = MetaModel::GetAttributeDef($oLinkAttCode->GetLinkedClass(), $sExtKeyToRemote); $sTargetClass = $oExtKeyAttDef->GetTargetClass(); $oLinkSet = $oObject->Get($sLinkSetAttCode); - $aTargets = array(); - while ($oLink = $oLinkSet->Fetch()) - { + $aTargets = []; + while ($oLink = $oLinkSet->Fetch()) { $aTargets[] = MetaModel::GetObject($sTargetClass, $oLink->Get($sExtKeyToRemote)); } return self::FromArray($sTargetClass, $aTargets); } - /** - * Fetch all as array of DBObject - * - * Note: After calling this method, the set cursor will be at the end of the set. You might want to rewind it. - * - * @api - * - * @param bool $bWithId if true array key will be set to object id - * - * @return DBObject[] - * - * @throws \Exception - * @throws \CoreException - * @throws \CoreUnexpectedValue - * @throws \MySQLException - */ + /** + * Fetch all as array of DBObject + * + * Note: After calling this method, the set cursor will be at the end of the set. You might want to rewind it. + * + * @api + * + * @param bool $bWithId if true array key will be set to object id + * + * @return DBObject[] + * + * @throws \Exception + * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \MySQLException + */ public function ToArray($bWithId = true) { - $aRet = array(); + $aRet = []; $this->Rewind(); - while ($oObject = $this->Fetch()) - { - if ($bWithId) - { + while ($oObject = $this->Fetch()) { + if ($bWithId) { $aRet[$oObject->GetKey()] = $oObject; - } - else - { + } else { $aRet[] = $oObject; } } return $aRet; } - /** - * Fetch all as a structured array - * - * Unlike ToArray, ToArrayOfValues return the objects as an array. - * Only the scalar values will be presents (see AttributeDefinition::IsScalar()) - * - * @api - * - * @return array[] - * - * @throws \Exception - * @throws \CoreException - * @throws \CoreUnexpectedValue - * @throws \MySQLException - */ + /** + * Fetch all as a structured array + * + * Unlike ToArray, ToArrayOfValues return the objects as an array. + * Only the scalar values will be presents (see AttributeDefinition::IsScalar()) + * + * @api + * + * @return array[] + * + * @throws \Exception + * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \MySQLException + */ public function ToArrayOfValues() { - if (!$this->m_bLoaded) $this->Load(); + if (!$this->m_bLoaded) { + $this->Load(); + } $this->Rewind(); $aSelectedClasses = $this->m_oFilter->GetSelectedClasses(); - $aRet = array(); + $aRet = []; $iRow = 0; - while($aObjects = $this->FetchAssoc()) - { - foreach($aObjects as $sClassAlias => $oObject) - { - if (is_null($oObject)) - { + while ($aObjects = $this->FetchAssoc()) { + foreach ($aObjects as $sClassAlias => $oObject) { + if (is_null($oObject)) { $aRet[$iRow][$sClassAlias.'.'.'id'] = null; - } - else - { + } else { $aRet[$iRow][$sClassAlias.'.'.'id'] = $oObject->GetKey(); - } - if (is_null($oObject)) - { - $sClass = $aSelectedClasses[$sClassAlias]; } - else - { + if (is_null($oObject)) { + $sClass = $aSelectedClasses[$sClassAlias]; + } else { $sClass = get_class($oObject); } - foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - if ($oAttDef->IsScalar()) - { + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if ($oAttDef->IsScalar()) { $sAttName = $sClassAlias.'.'.$sAttCode; - if (is_null($oObject)) - { + if (is_null($oObject)) { $aRet[$iRow][$sAttName] = null; - } - else - { + } else { $aRet[$iRow][$sAttName] = $oObject->Get($sAttCode); } } @@ -520,45 +488,41 @@ class DBObjectSet implements iDBObjectSetIterator return $aRet; } - /** - * Note: After calling this method, the set cursor will be at the end of the set. You might want to rewind it. - * - * @param string $sAttCode - * @param bool $bWithId - * - * @return array - * - * @throws \Exception - * @throws \CoreException - */ + /** + * Note: After calling this method, the set cursor will be at the end of the set. You might want to rewind it. + * + * @param string $sAttCode + * @param bool $bWithId + * + * @return array + * + * @throws \Exception + * @throws \CoreException + */ public function GetColumnAsArray($sAttCode, $bWithId = true) { - $aRet = array(); + $aRet = []; $this->Rewind(); - while ($oObject = $this->Fetch()) - { - if ($bWithId) - { + while ($oObject = $this->Fetch()) { + if ($bWithId) { $aRet[$oObject->GetKey()] = $oObject->Get($sAttCode); - } - else - { + } else { $aRet[] = $oObject->Get($sAttCode); } } return $aRet; } - /** - * Retrieve the DBSearch corresponding to the objects present in this set - * - * Limitation: - * This method will NOT work for sets with several columns (i.e. several objects per row) - * - * @return \DBObjectSearch - * - * @throws \CoreException - */ + /** + * Retrieve the DBSearch corresponding to the objects present in this set + * + * Limitation: + * This method will NOT work for sets with several columns (i.e. several objects per row) + * + * @return \DBObjectSearch + * + * @throws \CoreException + */ public function GetFilter() { // Make sure that we carry on the parameters of the set with the filter @@ -567,13 +531,10 @@ class DBObjectSet implements iDBObjectSetIterator // Note: the arguments found within a set can be object (but not in a filter) // That's why PrepareQueryArguments must be invoked there $oFilter->SetInternalParams(array_merge($oFilter->GetInternalParams(), $this->m_aArgs)); - - if (count($this->m_aAddedIds) == 0) - { + + if (count($this->m_aAddedIds) == 0) { return $oFilter; - } - else - { + } else { $oIdListExpr = ListExpression::FromScalars(array_keys($this->m_aAddedIds)); $oIdExpr = new FieldExpression('id', $oFilter->GetClassAlias()); $oIdInList = new BinaryExpression($oIdExpr, 'IN', $oIdListExpr); @@ -584,7 +545,7 @@ class DBObjectSet implements iDBObjectSetIterator /** * The (common ancestor) class of the objects in the first column of this set - * + * * @return string The class of the objects in the first column */ public function GetClass() @@ -594,7 +555,7 @@ class DBObjectSet implements iDBObjectSetIterator /** * The alias for the class of the objects in the first column of this set - * + * * @return string The alias of the class in the first column */ public function GetClassAlias() @@ -604,7 +565,7 @@ class DBObjectSet implements iDBObjectSetIterator /** * The list of all classes (one per column) which are part of this set - * + * * @return array Format: alias => class */ public function GetSelectedClasses() @@ -612,13 +573,13 @@ class DBObjectSet implements iDBObjectSetIterator return $this->m_oFilter->GetSelectedClasses(); } - /** - * The root class (i.e. highest ancestor in the MeaModel class hierarchy) for the first column on this set - * - * @return string The root class for the objects in the first column of the set - * - * @throws \CoreException - */ + /** + * The root class (i.e. highest ancestor in the MeaModel class hierarchy) for the first column on this set + * + * @return string The root class for the objects in the first column of the set + * + * @throws \CoreException + */ public function GetRootClass() { return MetaModel::GetRootClass($this->GetClass()); @@ -626,7 +587,7 @@ class DBObjectSet implements iDBObjectSetIterator /** * The arguments used for building this set - * + * * @return array Format: parameter_name => value */ public function GetArgs() @@ -645,50 +606,44 @@ class DBObjectSet implements iDBObjectSetIterator $this->m_iLimitStart = $iLimitStart; } - /** - * Sets the sort order for loading the rows from the DB. Changing the order by causes a Reload. - * - * @param array $aOrderBy Format: [alias.]attcode => boolean (true = ascending, false = descending) - * - * @throws \MySQLException - */ + /** + * Sets the sort order for loading the rows from the DB. Changing the order by causes a Reload. + * + * @param array $aOrderBy Format: [alias.]attcode => boolean (true = ascending, false = descending) + * + * @throws \MySQLException + */ public function SetOrderBy($aOrderBy) { - if ($this->m_aOrderBy != $aOrderBy) - { + if ($this->m_aOrderBy != $aOrderBy) { $this->m_aOrderBy = $aOrderBy; - if ($this->m_bLoaded) - { + if ($this->m_bLoaded) { $this->m_bLoaded = false; $this->Load(); } } } - /** - * Sets the sort order for loading the rows from the DB. Changing the order by causes a Reload. - * - * @param array $aAliases Format: alias => boolean (true = ascending, false = descending). If omitted, then it defaults to all the selected classes - * - * @throws \CoreException - * @throws \MySQLException - */ + /** + * Sets the sort order for loading the rows from the DB. Changing the order by causes a Reload. + * + * @param array $aAliases Format: alias => boolean (true = ascending, false = descending). If omitted, then it defaults to all the selected classes + * + * @throws \CoreException + * @throws \MySQLException + */ public function SetOrderByClasses($aAliases = null) { - if ($aAliases === null) - { - $aAliases = array(); - foreach ($this->GetSelectedClasses() as $sAlias => $sClass) - { + if ($aAliases === null) { + $aAliases = []; + foreach ($this->GetSelectedClasses() as $sAlias => $sClass) { $aAliases[$sAlias] = true; } } - $aAttributes = array(); - foreach ($aAliases as $sAlias => $bClassDirection) - { - foreach (MetaModel::GetOrderByDefault($this->m_oFilter->GetClassName($sAlias)) as $sAttCode => $bAttributeDirection) - { + $aAttributes = []; + foreach ($aAliases as $sAlias => $bClassDirection) { + foreach (MetaModel::GetOrderByDefault($this->m_oFilter->GetClassName($sAlias)) as $sAttCode => $bAttributeDirection) { $bDirection = $bClassDirection ? $bAttributeDirection : !$bAttributeDirection; $aAttributes[$sAlias.'.'.$sAttCode] = $bDirection; } @@ -698,7 +653,7 @@ class DBObjectSet implements iDBObjectSetIterator /** * Returns the 'count' limit for loading the rows from the DB - * + * * @return int */ public function GetLimitCount() @@ -708,7 +663,7 @@ class DBObjectSet implements iDBObjectSetIterator /** * Returns the 'start' limit for loading the rows from the DB - * + * * @return int */ public function GetLimitStart() @@ -716,79 +671,71 @@ class DBObjectSet implements iDBObjectSetIterator return $this->m_iLimitStart; } - /** - * Get the sort order used for loading this set from the database - * - * Limitation: the sort order has no effect on objects added in-memory - * - * @return array Format: field_code => boolean (true = ascending, false = descending) - * - * @throws \CoreException - */ + /** + * Get the sort order used for loading this set from the database + * + * Limitation: the sort order has no effect on objects added in-memory + * + * @return array Format: field_code => boolean (true = ascending, false = descending) + * + * @throws \CoreException + */ public function GetRealSortOrder() { - if (!$this->m_bSort) - { + if (!$this->m_bSort) { // No order by - return array(); + return []; } // Get the class default sort order if not specified with the API // - if (empty($this->m_aOrderBy)) - { + if (empty($this->m_aOrderBy)) { return MetaModel::GetOrderByDefault($this->m_oFilter->GetClass()); - } - else - { + } else { return $this->m_aOrderBy; } } - /** - * Loads the set from the database. Actually performs the SQL query to retrieve the records from the DB. - * - * @throws \Exception - * @throws \MySQLException - */ + /** + * Loads the set from the database. Actually performs the SQL query to retrieve the records from the DB. + * + * @throws \Exception + * @throws \MySQLException + */ public function Load() { - if ($this->m_bLoaded) return; + if ($this->m_bLoaded) { + return; + } // Note: it is mandatory to set this value now, to protect against reentrance $this->m_bLoaded = true; $sSQL = $this->_makeSelectQuery($this->m_aAttToLoad); - - if (is_object($this->m_oSQLResult)) - { + + if (is_object($this->m_oSQLResult)) { // Free previous resultset if any $this->m_oSQLResult->free(); $this->m_oSQLResult = null; } - try - { - $oKPI = new ExecutionKPI(); + try { + $oKPI = new ExecutionKPI(); $this->m_oSQLResult = CMDBSource::Query($sSQL); - $sOQL = $this->GetPseudoOQL($this->m_oFilter, $this->GetRealSortOrder(), $this->m_iLimitCount, $this->m_iLimitStart, false); - $oKPI->ComputeStats('OQL Query Exec', $sOQL); - } catch (MySQLException $e) - { + $sOQL = $this->GetPseudoOQL($this->m_oFilter, $this->GetRealSortOrder(), $this->m_iLimitCount, $this->m_iLimitStart, false); + $oKPI->ComputeStats('OQL Query Exec', $sOQL); + } catch (MySQLException $e) { // 1116 = ER_TOO_MANY_TABLES // https://dev.mysql.com/doc/refman/5.7/en/error-messages-server.html#error_er_too_many_tables - if ($e->getCode() != 1116) - { + if ($e->getCode() != 1116) { throw $e; } // N.689 Workaround for the 61 max joins in MySQL : full lazy load ! - $aAttToLoad = array(); - foreach($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) - { - $aAttToLoad[$sClassAlias] = array(); + $aAttToLoad = []; + foreach ($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) { + $aAttToLoad[$sClassAlias] = []; $bIsAbstractClass = MetaModel::IsAbstract($sClass); $bIsClassWithChildren = MetaModel::HasChildrenClasses($sClass); - if ($bIsAbstractClass || $bIsClassWithChildren) - { + if ($bIsAbstractClass || $bIsClassWithChildren) { // we need finalClass field at least to be able to instantiate the real corresponding object ! $aAttToLoad[$sClassAlias]['finalclass'] = MetaModel::GetAttributeDef($sClass, 'finalclass'); } @@ -797,65 +744,74 @@ class DBObjectSet implements iDBObjectSetIterator $this->m_oSQLResult = CMDBSource::Query($sSQL); // may fail again } - if ($this->m_oSQLResult === false) return; + if ($this->m_oSQLResult === false) { + return; + } - if ((($this->m_iLimitCount == 0) || ($this->m_iLimitCount > $this->m_oSQLResult->num_rows)) && ($this->m_iLimitStart == 0)) - { + if ((($this->m_iLimitCount == 0) || ($this->m_iLimitCount > $this->m_oSQLResult->num_rows)) && ($this->m_iLimitStart == 0)) { $this->m_iNumTotalDBRows = $this->m_oSQLResult->num_rows; } $this->m_iNumLoadedDBRows = $this->m_oSQLResult->num_rows; } - /** - * @param string[] $aAttToLoad - * - * @return string SQL query - * - * @throws \CoreException - * @throws \MissingQueryArgument - */ + /** + * @param string[] $aAttToLoad + * + * @return string SQL query + * + * @throws \CoreException + * @throws \MissingQueryArgument + */ private function _makeSelectQuery($aAttToLoad) { - if ($this->m_iLimitCount > 0) - { - $sSQL = $this->m_oFilter->MakeSelectQuery($this->GetRealSortOrder(), $this->m_aArgs, $aAttToLoad, - $this->m_aExtendedDataSpec, $this->m_iLimitCount, $this->m_iLimitStart); - } - else - { - $sSQL = $this->m_oFilter->MakeSelectQuery($this->GetRealSortOrder(), $this->m_aArgs, $aAttToLoad, - $this->m_aExtendedDataSpec); + if ($this->m_iLimitCount > 0) { + $sSQL = $this->m_oFilter->MakeSelectQuery( + $this->GetRealSortOrder(), + $this->m_aArgs, + $aAttToLoad, + $this->m_aExtendedDataSpec, + $this->m_iLimitCount, + $this->m_iLimitStart + ); + } else { + $sSQL = $this->m_oFilter->MakeSelectQuery( + $this->GetRealSortOrder(), + $this->m_aArgs, + $aAttToLoad, + $this->m_aExtendedDataSpec + ); } return $sSQL; } - /** - * The total number of rows in this set. Independently of the SetLimit used for loading the set and taking into - * account the rows added in-memory. - * - * May actually perform the SQL query SELECT COUNT... if the set was not previously loaded, or loaded with a - * SetLimit - * - * @api - * @return int The total number of rows for this set. - * - * @throws \CoreException - * @throws \MissingQueryArgument - * @throws \MySQLException - * @throws \MySQLHasGoneAwayException - */ + /** + * The total number of rows in this set. Independently of the SetLimit used for loading the set and taking into + * account the rows added in-memory. + * + * May actually perform the SQL query SELECT COUNT... if the set was not previously loaded, or loaded with a + * SetLimit + * + * @api + * @return int The total number of rows for this set. + * + * @throws \CoreException + * @throws \MissingQueryArgument + * @throws \MySQLException + * @throws \MySQLHasGoneAwayException + */ public function Count(): int { - if (is_null($this->m_iNumTotalDBRows)) - { - $oKPI = new ExecutionKPI(); - $sSQL = $this->m_oFilter->MakeSelectQuery(array(), $this->m_aArgs, null, null, 0, 0, true); + if (is_null($this->m_iNumTotalDBRows)) { + $oKPI = new ExecutionKPI(); + $sSQL = $this->m_oFilter->MakeSelectQuery([], $this->m_aArgs, null, null, 0, 0, true); $resQuery = CMDBSource::Query($sSQL); - $sOQL = $this->GetPseudoOQL($this->m_oFilter, array(), 0, 0, true); - $oKPI->ComputeStats('OQL Query Exec', $sOQL); - if (!$resQuery) return 0; + $sOQL = $this->GetPseudoOQL($this->m_oFilter, [], 0, 0, true); + $oKPI->ComputeStats('OQL Query Exec', $sOQL); + if (!$resQuery) { + return 0; + } $aRow = CMDBSource::FetchArray($resQuery); CMDBSource::FreeResult($resQuery); @@ -865,41 +821,41 @@ class DBObjectSet implements iDBObjectSetIterator return $this->m_iNumTotalDBRows + count($this->m_aAddedObjects); // Does it fix Trac #887 ?? } - /** - * @param \DBSearch $oFilter - * @param array $aOrder - * @param int $iLimitCount - * @param int $iLimitStart - * @param bool $bCount - * - * @return string - */ - private function GetPseudoOQL($oFilter, $aOrder, $iLimitCount, $iLimitStart, $bCount) - { - $sOQL = ''; - if ($bCount) { - $sOQL .= 'COUNT '; - } - $sOQL .= $oFilter->ToOQL(); + /** + * @param \DBSearch $oFilter + * @param array $aOrder + * @param int $iLimitCount + * @param int $iLimitStart + * @param bool $bCount + * + * @return string + */ + private function GetPseudoOQL($oFilter, $aOrder, $iLimitCount, $iLimitStart, $bCount) + { + $sOQL = ''; + if ($bCount) { + $sOQL .= 'COUNT '; + } + $sOQL .= $oFilter->ToOQL(); - if ($iLimitCount > 0) { - $sOQL .= ' LIMIT '; - if ($iLimitStart > 0) { - $sOQL .= "$iLimitStart, "; - } - $sOQL .= "$iLimitCount"; - } + if ($iLimitCount > 0) { + $sOQL .= ' LIMIT '; + if ($iLimitStart > 0) { + $sOQL .= "$iLimitStart, "; + } + $sOQL .= "$iLimitCount"; + } - if (count($aOrder) > 0) { - $sOQL .= ' ORDER BY '; - $aOrderBy = []; - foreach ($aOrder as $sAttCode => $bAsc) { - $aOrderBy[] = $sAttCode.' '.($bAsc ? 'ASC' : 'DESC'); - } - $sOQL .= implode(', ', $aOrderBy); - } - return $sOQL; - } + if (count($aOrder) > 0) { + $sOQL .= ' ORDER BY '; + $aOrderBy = []; + foreach ($aOrder as $sAttCode => $bAsc) { + $aOrderBy[] = $sAttCode.' '.($bAsc ? 'ASC' : 'DESC'); + } + $sOQL .= implode(', ', $aOrderBy); + } + return $sOQL; + } /** * Check if the count exceeds a given limit @@ -915,26 +871,20 @@ class DBObjectSet implements iDBObjectSetIterator */ public function CountExceeds($iLimit) { - if (is_null($this->m_iNumTotalDBRows)) - { - $oKPI = new ExecutionKPI(); - $sSQL = $this->m_oFilter->MakeSelectQuery(array(), $this->m_aArgs, null, null, $iLimit + 2, 0, true); + if (is_null($this->m_iNumTotalDBRows)) { + $oKPI = new ExecutionKPI(); + $sSQL = $this->m_oFilter->MakeSelectQuery([], $this->m_aArgs, null, null, $iLimit + 2, 0, true); $resQuery = CMDBSource::Query($sSQL); - $sOQL = $this->GetPseudoOQL($this->m_oFilter, array(), $iLimit + 2, 0, true); - $oKPI->ComputeStats('OQL Query Exec', $sOQL); - if ($resQuery) - { + $sOQL = $this->GetPseudoOQL($this->m_oFilter, [], $iLimit + 2, 0, true); + $oKPI->ComputeStats('OQL Query Exec', $sOQL); + if ($resQuery) { $aRow = CMDBSource::FetchArray($resQuery); $iCount = intval($aRow['COUNT']); CMDBSource::FreeResult($resQuery); - } - else - { + } else { $iCount = 0; } - } - else - { + } else { $iCount = $this->m_iNumTotalDBRows; } @@ -955,26 +905,20 @@ class DBObjectSet implements iDBObjectSetIterator */ public function CountWithLimit($iLimit) { - if (is_null($this->m_iNumTotalDBRows)) - { - $oKPI = new ExecutionKPI(); - $sSQL = $this->m_oFilter->MakeSelectQuery(array(), $this->m_aArgs, null, null, $iLimit + 2, 0, true); + if (is_null($this->m_iNumTotalDBRows)) { + $oKPI = new ExecutionKPI(); + $sSQL = $this->m_oFilter->MakeSelectQuery([], $this->m_aArgs, null, null, $iLimit + 2, 0, true); $resQuery = CMDBSource::Query($sSQL); - $sOQL = $this->GetPseudoOQL($this->m_oFilter, array(), $iLimit + 2, 0, true); - $oKPI->ComputeStats('OQL Query Exec', $sOQL); - if ($resQuery) - { + $sOQL = $this->GetPseudoOQL($this->m_oFilter, [], $iLimit + 2, 0, true); + $oKPI->ComputeStats('OQL Query Exec', $sOQL); + if ($resQuery) { $aRow = CMDBSource::FetchArray($resQuery); CMDBSource::FreeResult($resQuery); $iCount = intval($aRow['COUNT']); - } - else - { + } else { $iCount = 0; } - } - else - { + } else { $iCount = $this->m_iNumTotalDBRows; } @@ -983,7 +927,7 @@ class DBObjectSet implements iDBObjectSetIterator /** * Number of rows available in memory (loaded from DB + added in memory) - * + * * @return number The number of rows available for Fetch'ing */ protected function CountLoaded() @@ -991,53 +935,44 @@ class DBObjectSet implements iDBObjectSetIterator return $this->m_iNumLoadedDBRows + count($this->m_aAddedObjects); } - /** - * Fetch an object (with the given class alias) at the current position in the set and move the cursor to the next position. - * - * @api - * - * @param string $sRequestedClassAlias The class alias to fetch (defaults to the first selected class) - * - * @return \DBObject The fetched object or null when at the end - * - * @throws \CoreException - * @throws \CoreUnexpectedValue - * @throws \MySQLException - */ + /** + * Fetch an object (with the given class alias) at the current position in the set and move the cursor to the next position. + * + * @api + * + * @param string $sRequestedClassAlias The class alias to fetch (defaults to the first selected class) + * + * @return \DBObject The fetched object or null when at the end + * + * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \MySQLException + */ public function Fetch($sRequestedClassAlias = '') { - if (!$this->m_bLoaded) $this->Load(); + if (!$this->m_bLoaded) { + $this->Load(); + } - if ($this->m_iCurrRow >= $this->CountLoaded()) - { + if ($this->m_iCurrRow >= $this->CountLoaded()) { return null; } - - if (strlen($sRequestedClassAlias) == 0) - { + + if (strlen($sRequestedClassAlias) == 0) { $sRequestedClassAlias = $this->m_oFilter->GetClassAlias(); } - if ($this->m_iCurrRow < $this->m_iNumLoadedDBRows) - { + if ($this->m_iCurrRow < $this->m_iNumLoadedDBRows) { // Pick the row from the database $aRow = CMDBSource::FetchArray($this->m_oSQLResult); - foreach ($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) - { - if ($sRequestedClassAlias == $sClassAlias) - { - if (is_null($aRow[$sClassAlias.'id'])) - { + foreach ($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) { + if ($sRequestedClassAlias == $sClassAlias) { + if (is_null($aRow[$sClassAlias.'id'])) { $oRetObj = null; - } - else - { - try - { + } else { + try { $oRetObj = MetaModel::GetObjectByRow($sClass, $aRow, $sClassAlias, $this->m_aAttToLoad, $this->m_aExtendedDataSpec); - } - catch (CoreException $e) - { + } catch (CoreException $e) { $this->m_iCurrRow++; $oRetObj = $this->Fetch($sRequestedClassAlias); } @@ -1045,9 +980,7 @@ class DBObjectSet implements iDBObjectSetIterator break; } } - } - else - { + } else { // Pick the row from the objects added *in memory* $oRetObj = $this->m_aAddedObjects[$this->m_iCurrRow - $this->m_iNumLoadedDBRows][$sRequestedClassAlias]; } @@ -1055,50 +988,43 @@ class DBObjectSet implements iDBObjectSetIterator return $oRetObj; } - /** - * Fetch the whole row of objects (if several classes have been specified in the query) and move the cursor to the next position - * - * @api - * - * @return array An associative with the format 'classAlias' => $oObj representing the current row of the set. Returns null when at the end. - * - * @throws \CoreException - * @throws \CoreUnexpectedValue - * @throws \MySQLException - */ + /** + * Fetch the whole row of objects (if several classes have been specified in the query) and move the cursor to the next position + * + * @api + * + * @return array An associative with the format 'classAlias' => $oObj representing the current row of the set. Returns null when at the end. + * + * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \MySQLException + */ public function FetchAssoc() { - if (!$this->m_bLoaded) $this->Load(); + if (!$this->m_bLoaded) { + $this->Load(); + } - if ($this->m_iCurrRow >= $this->CountLoaded()) - { + if ($this->m_iCurrRow >= $this->CountLoaded()) { return null; } - - if ($this->m_iCurrRow < $this->m_iNumLoadedDBRows) - { + + if ($this->m_iCurrRow < $this->m_iNumLoadedDBRows) { // Pick the row from the database $aRow = CMDBSource::FetchArray($this->m_oSQLResult); - $aRetObjects = array(); - foreach ($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) - { - if (is_null($aRow[$sClassAlias.'id'])) - { + $aRetObjects = []; + foreach ($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) { + if (is_null($aRow[$sClassAlias.'id'])) { $oObj = null; - } - else - { + } else { $oObj = MetaModel::GetObjectByRow($sClass, $aRow, $sClassAlias, $this->m_aAttToLoad, $this->m_aExtendedDataSpec); } $aRetObjects[$sClassAlias] = $oObj; } - } - else - { + } else { // Pick the row from the objects added *in memory* - $aRetObjects = array(); - foreach ($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) - { + $aRetObjects = []; + foreach ($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) { $aRetObjects[$sClassAlias] = $this->m_aAddedObjects[$this->m_iCurrRow - $this->m_iNumLoadedDBRows][$sClassAlias]; } } @@ -1115,182 +1041,181 @@ class DBObjectSet implements iDBObjectSetIterator */ public function Rewind() { - if ($this->m_bLoaded) - { + if ($this->m_bLoaded) { $this->Seek(0); } } - /** - * Position the cursor (for iterating in the set) to the given position - * - * @param int $iRow - * - * @throws \CoreException - * @throws \MissingQueryArgument - * @throws \MySQLException - * @throws \MySQLHasGoneAwayException - * @since 3.1.0 N°4517 Now returns void for return type to match parent class and be compatible with PHP 8.1 - */ + /** + * Position the cursor (for iterating in the set) to the given position + * + * @param int $iRow + * + * @throws \CoreException + * @throws \MissingQueryArgument + * @throws \MySQLException + * @throws \MySQLHasGoneAwayException + * @since 3.1.0 N°4517 Now returns void for return type to match parent class and be compatible with PHP 8.1 + */ public function Seek($iRow): void { - if (!$this->m_bLoaded) $this->Load(); + if (!$this->m_bLoaded) { + $this->Load(); + } $this->m_iCurrRow = min($iRow, $this->Count()); - if ($this->m_iCurrRow < $this->m_iNumLoadedDBRows) - { + if ($this->m_iCurrRow < $this->m_iNumLoadedDBRows) { $this->m_oSQLResult->data_seek($this->m_iCurrRow); } } - /** - * Add an object to the current set (in-memory only, nothing is written to the database) - * - * Limitation: - * Sets with several objects per row are NOT supported - * - * @param \DBObject $oObject The object to add - * @param string $sClassAlias The alias for the class of the object - * - * @throws \MySQLException - */ + /** + * Add an object to the current set (in-memory only, nothing is written to the database) + * + * Limitation: + * Sets with several objects per row are NOT supported + * + * @param \DBObject $oObject The object to add + * @param string $sClassAlias The alias for the class of the object + * + * @throws \MySQLException + */ public function AddObject($oObject, $sClassAlias = '') { - if (!$this->m_bLoaded) $this->Load(); + if (!$this->m_bLoaded) { + $this->Load(); + } - if (strlen($sClassAlias) == 0) - { + if (strlen($sClassAlias) == 0) { $sClassAlias = $this->m_oFilter->GetClassAlias(); } $iNextPos = count($this->m_aAddedObjects); $this->m_aAddedObjects[$iNextPos][$sClassAlias] = $oObject; - if (!is_null($oObject)) - { + if (!is_null($oObject)) { $this->m_aAddedIds[$oObject->GetKey()] = true; } } - /** - * Add a hash containig objects into the current set. - * - * The expected format for the hash is: $aObjectArray[$idx][$sClassAlias] => $oObject - * Limitation: - * The aliases MUST match the ones used in the current set - * Only the ID of the objects associated to the first alias (column) is remembered.. in case we have to rebuild a filter - * - * @param array $aObjectArray - * - * @throws \MySQLException - */ + /** + * Add a hash containig objects into the current set. + * + * The expected format for the hash is: $aObjectArray[$idx][$sClassAlias] => $oObject + * Limitation: + * The aliases MUST match the ones used in the current set + * Only the ID of the objects associated to the first alias (column) is remembered.. in case we have to rebuild a filter + * + * @param array $aObjectArray + * + * @throws \MySQLException + */ protected function AddObjectExtended($aObjectArray) { - if (!$this->m_bLoaded) $this->Load(); + if (!$this->m_bLoaded) { + $this->Load(); + } $iNextPos = count($this->m_aAddedObjects); - + $sFirstAlias = $this->m_oFilter->GetClassAlias(); - foreach ($aObjectArray as $sClassAlias => $oObject) - { + foreach ($aObjectArray as $sClassAlias => $oObject) { $this->m_aAddedObjects[$iNextPos][$sClassAlias] = $oObject; - - if (!is_null($oObject) && ($sFirstAlias == $sClassAlias)) - { + + if (!is_null($oObject) && ($sFirstAlias == $sClassAlias)) { $this->m_aAddedIds[$oObject->GetKey()] = true; } } } - /** - * Add an array of objects into the current set - * - * Limitation: - * Sets with several classes per row are not supported (use AddObjectExtended instead) - * - * @param array $aObjects The array of objects to add - * @param string $sClassAlias The Alias of the class for the added objects - * - * @throws \MySQLException - */ + /** + * Add an array of objects into the current set + * + * Limitation: + * Sets with several classes per row are not supported (use AddObjectExtended instead) + * + * @param array $aObjects The array of objects to add + * @param string $sClassAlias The Alias of the class for the added objects + * + * @throws \MySQLException + */ public function AddObjectArray($aObjects, $sClassAlias = '') { - if (!$this->m_bLoaded) $this->Load(); + if (!$this->m_bLoaded) { + $this->Load(); + } // #@# todo - add a check on the object class ? - foreach ($aObjects as $oObj) - { + foreach ($aObjects as $oObj) { $this->AddObject($oObj, $sClassAlias); } } /** * Append a given set to the current object. (This method used to be named Merge) - * + * * Limitation: * The added objects are not checked for duplicates (i.e. one cann add several times the same object, or add an object already present in the set). - * + * * @param \DBObjectSet $oObjectSet The set to append - * + * * @throws \CoreException */ public function Append(DBObjectSet $oObjectSet) { - if ($this->GetRootClass() != $oObjectSet->GetRootClass()) - { + if ($this->GetRootClass() != $oObjectSet->GetRootClass()) { throw new CoreException("Could not merge two objects sets if they don't have the same root class"); } - if (!$this->m_bLoaded) $this->Load(); + if (!$this->m_bLoaded) { + $this->Load(); + } $oObjectSet->Seek(0); - while ($oObject = $oObjectSet->Fetch()) - { + while ($oObject = $oObjectSet->Fetch()) { $this->AddObject($oObject); } } - /** - * Create a set containing the objects present in both the current set and another specified set - * - * Limitations: - * Will NOT work if only a subset of the sets was loaded with SetLimit. - * Works only with sets made of objects loaded from the database since the comparison is based on the objects identifiers - * - * @param \DBObjectSet $oObjectSet The set to intersect with. The current position inside the set will be lost (= at the end) - * - * @return \DBObjectSet A new set of objects, containing the objects present in both sets (based on their identifier) - * - * @throws \Exception - * @throws \CoreException - * @throws \CoreUnexpectedValue - * @throws \MissingQueryArgument - * @throws \MySQLException - * @throws \MySQLHasGoneAwayException - */ + /** + * Create a set containing the objects present in both the current set and another specified set + * + * Limitations: + * Will NOT work if only a subset of the sets was loaded with SetLimit. + * Works only with sets made of objects loaded from the database since the comparison is based on the objects identifiers + * + * @param \DBObjectSet $oObjectSet The set to intersect with. The current position inside the set will be lost (= at the end) + * + * @return \DBObjectSet A new set of objects, containing the objects present in both sets (based on their identifier) + * + * @throws \Exception + * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \MissingQueryArgument + * @throws \MySQLException + * @throws \MySQLHasGoneAwayException + */ public function CreateIntersect(DBObjectSet $oObjectSet) { - if ($this->GetRootClass() != $oObjectSet->GetRootClass()) - { + if ($this->GetRootClass() != $oObjectSet->GetRootClass()) { throw new CoreException("Could not 'intersect' two objects sets if they don't have the same root class"); } - if (!$this->m_bLoaded) $this->Load(); + if (!$this->m_bLoaded) { + $this->Load(); + } - $aId2Row = array(); + $aId2Row = []; $iCurrPos = $this->m_iCurrRow; // Save the cursor $idx = 0; - while($oObj = $this->Fetch()) - { + while ($oObj = $this->Fetch()) { $aId2Row[$oObj->GetKey()] = $idx; $idx++; } - + $oNewSet = DBObjectSet::FromScratch($this->GetClass()); $oObjectSet->Seek(0); - while ($oObject = $oObjectSet->Fetch()) - { - if (array_key_exists($oObject->GetKey(), $aId2Row)) - { + while ($oObject = $oObjectSet->Fetch()) { + if (array_key_exists($oObject->GetKey(), $aId2Row)) { $oNewSet->AddObject($oObject); } } @@ -1298,34 +1223,34 @@ class DBObjectSet implements iDBObjectSetIterator return $oNewSet; } - /** - * Compare two sets of objects to determine if their content is identical or not. - * - * Limitation: - * Works only for sets of 1 column (i.e. one class of object selected) - * - * @param \DBObjectSet $oObjectSet - * @param array $aExcludeColumns The list of columns to exclude frop the comparison - * - * @return boolean True if the sets are identical, false otherwise - * - * @throws \CoreException - */ - public function HasSameContents(DBObjectSet $oObjectSet, $aExcludeColumns = array()) - { + /** + * Compare two sets of objects to determine if their content is identical or not. + * + * Limitation: + * Works only for sets of 1 column (i.e. one class of object selected) + * + * @param \DBObjectSet $oObjectSet + * @param array $aExcludeColumns The list of columns to exclude frop the comparison + * + * @return boolean True if the sets are identical, false otherwise + * + * @throws \CoreException + */ + public function HasSameContents(DBObjectSet $oObjectSet, $aExcludeColumns = []) + { $oComparator = new DBObjectSetComparator($this, $oObjectSet, $aExcludeColumns); return $oComparator->SetsAreEquivalent(); } /** * Build a new set (in memory) made of objects of the given set which are NOT present in the current set - * + * * Limitations: * The objects inside the set must be written in the database since the comparison is based on their identifiers * Sets with several objects per row are NOT supported - * + * * @param \DBObjectSet $oObjectSet - * + * * @return \DBObjectSet The "delta" set. * * @throws \Exception @@ -1333,17 +1258,17 @@ class DBObjectSet implements iDBObjectSetIterator */ public function CreateDelta(DBObjectSet $oObjectSet) { - if ($this->GetRootClass() != $oObjectSet->GetRootClass()) - { + if ($this->GetRootClass() != $oObjectSet->GetRootClass()) { throw new CoreException("Could not 'delta' two objects sets if they don't have the same root class"); } - if (!$this->m_bLoaded) $this->Load(); + if (!$this->m_bLoaded) { + $this->Load(); + } - $aId2Row = array(); + $aId2Row = []; $iCurrPos = $this->m_iCurrRow; // Save the cursor $idx = 0; - while($oObj = $this->Fetch()) - { + while ($oObj = $this->Fetch()) { $aId2Row[$oObj->GetKey()] = $idx; $idx++; } @@ -1351,10 +1276,8 @@ class DBObjectSet implements iDBObjectSetIterator $oNewSet = DBObjectSet::FromScratch($this->GetClass()); $oObjectSet->Seek(0); - while ($oObject = $oObjectSet->Fetch()) - { - if (!array_key_exists($oObject->GetKey(), $aId2Row)) - { + while ($oObject = $oObjectSet->Fetch()) { + if (!array_key_exists($oObject->GetKey(), $aId2Row)) { $oNewSet->AddObject($oObject); } } @@ -1362,145 +1285,126 @@ class DBObjectSet implements iDBObjectSetIterator return $oNewSet; } - /** - * Compute the "RelatedObjects" (forward or "down" direction) for the set - * for the specified relation - * - * @param string $sRelCode The code of the relation to use for the computation - * @param int $iMaxDepth Maximum recursion depth - * @param bool $bEnableRedundancy - * - * @return \RelationGraph The graph of all the related objects - * - * @throws \Exception - * @throws \CoreException - * @throws \CoreUnexpectedValue - * @throws \MySQLException - */ + /** + * Compute the "RelatedObjects" (forward or "down" direction) for the set + * for the specified relation + * + * @param string $sRelCode The code of the relation to use for the computation + * @param int $iMaxDepth Maximum recursion depth + * @param bool $bEnableRedundancy + * + * @return \RelationGraph The graph of all the related objects + * + * @throws \Exception + * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \MySQLException + */ public function GetRelatedObjectsDown($sRelCode, $iMaxDepth = 99, $bEnableRedundancy = true) { $oGraph = new RelationGraph(); $this->Rewind(); - while($oObj = $this->Fetch()) - { + while ($oObj = $this->Fetch()) { $oGraph->AddSourceObject($oObj); } $oGraph->ComputeRelatedObjectsDown($sRelCode, $iMaxDepth, $bEnableRedundancy); return $oGraph; } - /** - * Compute the "RelatedObjects" (reverse or "up" direction) for the set - * for the specified relation - * - * @param string $sRelCode The code of the relation to use for the computation - * @param int $iMaxDepth Maximum recursion depth - * @param bool $bEnableRedundancy - * - * @return \RelationGraph The graph of all the related objects - * - * @throws \Exception - * @throws \CoreException - * @throws \CoreUnexpectedValue - * @throws \MySQLException - */ + /** + * Compute the "RelatedObjects" (reverse or "up" direction) for the set + * for the specified relation + * + * @param string $sRelCode The code of the relation to use for the computation + * @param int $iMaxDepth Maximum recursion depth + * @param bool $bEnableRedundancy + * + * @return \RelationGraph The graph of all the related objects + * + * @throws \Exception + * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \MySQLException + */ public function GetRelatedObjectsUp($sRelCode, $iMaxDepth = 99, $bEnableRedundancy = true) { $oGraph = new RelationGraph(); $this->Rewind(); - while($oObj = $this->Fetch()) - { + while ($oObj = $this->Fetch()) { $oGraph->AddSinkObject($oObj); } $oGraph->ComputeRelatedObjectsUp($sRelCode, $iMaxDepth, $bEnableRedundancy); return $oGraph; } - /** - * Builds an object that contains the values that are common to all the objects - * in the set. If for a given attribute, objects in the set have various values - * then the resulting object will contain null for this value. - * - * @param array $aValues Hash Output: the distribution of the values, in the set, for each attribute - * - * @return \DBObject The object with the common values - * - * @throws \Exception - * @throws \CoreException - * @throws \CoreUnexpectedValue - * @throws \MySQLException - */ + /** + * Builds an object that contains the values that are common to all the objects + * in the set. If for a given attribute, objects in the set have various values + * then the resulting object will contain null for this value. + * + * @param array $aValues Hash Output: the distribution of the values, in the set, for each attribute + * + * @return \DBObject The object with the common values + * + * @throws \Exception + * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \MySQLException + */ public function ComputeCommonObject(&$aValues) { $sClass = $this->GetClass(); $aList = MetaModel::ListAttributeDefs($sClass); - $aValues = array(); - foreach($aList as $sAttCode => $oAttDef) - { - if ($oAttDef->IsScalar()) - { - $aValues[$sAttCode] = array(); + $aValues = []; + foreach ($aList as $sAttCode => $oAttDef) { + if ($oAttDef->IsScalar()) { + $aValues[$sAttCode] = []; } } $this->Rewind(); - while($oObj = $this->Fetch()) - { - foreach($aList as $sAttCode => $oAttDef) - { - if ($oAttDef->IsScalar() && $oAttDef->IsWritable()) - { + while ($oObj = $this->Fetch()) { + foreach ($aList as $sAttCode => $oAttDef) { + if ($oAttDef->IsScalar() && $oAttDef->IsWritable()) { $currValue = $oObj->Get($sAttCode); - if (is_object($currValue)) continue; // Skip non scalar values... - if(!array_key_exists($currValue, $aValues[$sAttCode])) - { - $aValues[$sAttCode][$currValue] = array('count' => 1, 'display' => $oObj->GetAsHTML($sAttCode)); - } - else - { - $aValues[$sAttCode][$currValue]['count']++; + if (is_object($currValue)) { + continue; + } // Skip non scalar values... + if (!array_key_exists($currValue, $aValues[$sAttCode])) { + $aValues[$sAttCode][$currValue] = ['count' => 1, 'display' => $oObj->GetAsHTML($sAttCode)]; + } else { + $aValues[$sAttCode][$currValue]['count']++; } } } } - - foreach($aValues as $sAttCode => $aMultiValues) - { - if (count($aMultiValues) > 1) - { + + foreach ($aValues as $sAttCode => $aMultiValues) { + if (count($aMultiValues) > 1) { uasort($aValues[$sAttCode], 'HashCountComparison'); } } - - - // Now create an object that has values for the homogenous values only + + // Now create an object that has values for the homogenous values only $oCommonObj = new $sClass(); // @@ What if the class is abstract ? - $aComments = array(); + $aComments = []; $iFormId = cmdbAbstractObject::GetNextFormId(); // Identifier that prefixes all the form fields $sReadyScript = ''; - $aDependsOn = array(); + $aDependsOn = []; $sFormPrefix = '2_'; - foreach($aList as $sAttCode => $oAttDef) - { - if ($oAttDef->IsScalar() && $oAttDef->IsWritable()) - { - if ($oAttDef->GetEditClass() == 'One Way Password') - { + foreach ($aList as $sAttCode => $oAttDef) { + if ($oAttDef->IsScalar() && $oAttDef->IsWritable()) { + if ($oAttDef->GetEditClass() == 'One Way Password') { $oCommonObj->Set($sAttCode, null); - } - else - { + } else { $iCount = count($aValues[$sAttCode]); - if ($iCount == 1) - { + if ($iCount == 1) { // Homogenous value reset($aValues[$sAttCode]); $aKeys = array_keys($aValues[$sAttCode]); $currValue = $aKeys[0]; // The only value is the first key $oCommonObj->Set($sAttCode, $currValue); - } - else - { + } else { // Non-homogenous value $oCommonObj->Set($sAttCode, null); } @@ -1520,21 +1424,18 @@ class DBObjectSet implements iDBObjectSetIterator // The complete list of arguments will include magic arguments (e.g. current_user->attcode) $aScalarArgs = MetaModel::PrepareQueryArguments($this->m_oFilter->GetInternalParams(), $this->m_aArgs, $this->m_oFilter->GetExpectedArguments()); $aConst = $this->m_oFilter->ListConstantFields(); - - foreach($aConst as $sClassAlias => $aVals) - { - foreach($aVals as $sCode => $oExpr) - { - if (is_object($oExpr)) // Array_merge_recursive creates an array when the same key is present multiple times... ignore them - { + + foreach ($aConst as $sClassAlias => $aVals) { + foreach ($aVals as $sCode => $oExpr) { + if (is_object($oExpr)) { // Array_merge_recursive creates an array when the same key is present multiple times... ignore them $oScalarExpr = $oExpr->GetAsScalar($aScalarArgs); $aConst[$sClassAlias][$sCode] = $oScalarExpr->GetValue(); } } } - return $aConst; + return $aConst; } - + public function ApplyParameters() { $aAllArgs = MetaModel::PrepareQueryArguments($this->m_oFilter->GetInternalParams(), $this->m_aArgs, $this->m_oFilter->GetExpectedArguments()); @@ -1549,11 +1450,10 @@ class DBObjectSet implements iDBObjectSetIterator */ function HashCountComparison($a, $b) // Sort descending on 'count' { - if ($a['count'] == $b['count']) - { - return 0; - } - return ($a['count'] > $b['count']) ? -1 : 1; + if ($a['count'] == $b['count']) { + return 0; + } + return ($a['count'] > $b['count']) ? -1 : 1; } /** @@ -1561,7 +1461,7 @@ function HashCountComparison($a, $b) // Sort descending on 'count' * The FIRST SET MUST BE LOADED FROM THE DATABASE, the second one can be a set of objects in memory * When computing the actual differences, the algorithm tries to preserve as much as possible the EXISTING * objects (i.e. prefers 'modified' to 'removed' + 'added') - * + * * LIMITATIONS: * - only DBObjectSets with one column (i.e. one class of object selected) are supported * - the first set must be the one loaded from the database @@ -1590,7 +1490,7 @@ class DBObjectSetComparator protected $sAdditionalKeyColumn; protected $aAdditionalKeys; - + /** * Initializes the comparator * @param iDBObjectSetIterator $oSet1 The first set of objects to compare, or null @@ -1598,63 +1498,55 @@ class DBObjectSetComparator * @param array $aExcludedColumns The list of columns (= attribute codes) to exclude from the comparison * @param string $sAdditionalKeyColumn The attribute code of an additional column to be considered as a key indentifying the object (useful for n:n links) */ - public function __construct(iDBObjectSetIterator $oSet1, iDBObjectSetIterator $oSet2, $aExcludedColumns = array(), $sAdditionalKeyColumn = null) + public function __construct(iDBObjectSetIterator $oSet1, iDBObjectSetIterator $oSet2, $aExcludedColumns = [], $sAdditionalKeyColumn = null) { $this->aFingerprints1 = null; $this->aFingerprints2 = null; - $this->aIDs1 = array(); - $this->aIDs2 = array(); + $this->aIDs1 = []; + $this->aIDs2 = []; $this->aExcludedColumns = $aExcludedColumns; $this->sAdditionalKeyColumn = $sAdditionalKeyColumn; $this->aAdditionalKeys = null; $this->oSet1 = $oSet1; - $this->oSet2 = $oSet2; + $this->oSet2 = $oSet2; } - /** - * Builds the lists of fingerprints and initializes internal structures, if it was not already done - * - * @internal - * - * @throws \CoreException - */ + /** + * Builds the lists of fingerprints and initializes internal structures, if it was not already done + * + * @internal + * + * @throws \CoreException + */ protected function ComputeFingerprints() { - if ($this->aFingerprints1 === null) - { - $this->aFingerprints1 = array(); - $this->aFingerprints2 = array(); - $this->aAdditionalKeys = array(); - - if ($this->oSet1 !== null) - { + if ($this->aFingerprints1 === null) { + $this->aFingerprints1 = []; + $this->aFingerprints2 = []; + $this->aAdditionalKeys = []; + + if ($this->oSet1 !== null) { $this->oSet1->Rewind(); - while($oObj = $this->oSet1->Fetch()) - { + while ($oObj = $this->oSet1->Fetch()) { $sFingerprint = $oObj->Fingerprint($this->aExcludedColumns); $this->aFingerprints1[$sFingerprint] = $oObj; - if (!$oObj->IsNew()) - { + if (!$oObj->IsNew()) { $this->aIDs1[$oObj->GetKey()] = $oObj; } } $this->oSet1->Rewind(); } - - if ($this->oSet2 !== null) - { + + if ($this->oSet2 !== null) { $this->oSet2->Rewind(); - while($oObj = $this->oSet2->Fetch()) - { + while ($oObj = $this->oSet2->Fetch()) { $sFingerprint = $oObj->Fingerprint($this->aExcludedColumns); $this->aFingerprints2[$sFingerprint] = $oObj; - if (!$oObj->IsNew()) - { + if (!$oObj->IsNew()) { $this->aIDs2[$oObj->GetKey()] = $oObj; } - - if ($this->sAdditionalKeyColumn !== null) - { + + if ($this->sAdditionalKeyColumn !== null) { $this->aAdditionalKeys[$oObj->Get($this->sAdditionalKeyColumn)] = $oObj; } } @@ -1663,82 +1555,75 @@ class DBObjectSetComparator } } - /** - * Tells if the sets are equivalent or not. Returns as soon as the first difference is found. - * - * @internal - * - * @return boolean true if the set have an equivalent content, false otherwise - * - * @throws \CoreException - */ + /** + * Tells if the sets are equivalent or not. Returns as soon as the first difference is found. + * + * @internal + * + * @return boolean true if the set have an equivalent content, false otherwise + * + * @throws \CoreException + */ public function SetsAreEquivalent() { - if (($this->oSet1 === null) && ($this->oSet2 === null)) - { + if (($this->oSet1 === null) && ($this->oSet2 === null)) { // Both sets are empty, they are equal return true; - } - else if (($this->oSet1 === null) || ($this->oSet2 === null)) - { + } elseif (($this->oSet1 === null) || ($this->oSet2 === null)) { // one of them is empty, they are different return false; } - - if (($this->oSet1->GetRootClass() != $this->oSet2->GetRootClass()) || ($this->oSet1->Count() != $this->oSet2->Count())) return false; - + + if (($this->oSet1->GetRootClass() != $this->oSet2->GetRootClass()) || ($this->oSet1->Count() != $this->oSet2->Count())) { + return false; + } + $this->ComputeFingerprints(); - + // Check that all objects in Set1 are also in Set2 - foreach($this->aFingerprints1 as $sFingerprint => $oObj) - { - if (!array_key_exists($sFingerprint, $this->aFingerprints2)) - { + foreach ($this->aFingerprints1 as $sFingerprint => $oObj) { + if (!array_key_exists($sFingerprint, $this->aFingerprints2)) { return false; } } - + // Vice versa // Check that all objects in Set2 are also in Set1 - foreach($this->aFingerprints2 as $sFingerprint => $oObj) - { - if (!array_key_exists($sFingerprint, $this->aFingerprints1)) - { + foreach ($this->aFingerprints2 as $sFingerprint => $oObj) { + if (!array_key_exists($sFingerprint, $this->aFingerprints1)) { return false; } } - + return true; } - /** - * Get the list of differences between the two sets. In ordeer to write back into the database only the minimum changes - * THE FIRST SET MUST BE THE ONE LOADED FROM THE DATABASE - * - * @internal - * - * @return array 'added' => DBObject(s), 'removed' => DBObject(s), 'modified' => DBObjects(s) - * - * @throws \Exception - * @throws \CoreException - */ + /** + * Get the list of differences between the two sets. In ordeer to write back into the database only the minimum changes + * THE FIRST SET MUST BE THE ONE LOADED FROM THE DATABASE + * + * @internal + * + * @return array 'added' => DBObject(s), 'removed' => DBObject(s), 'modified' => DBObjects(s) + * + * @throws \Exception + * @throws \CoreException + */ public function GetDifferences() { - $aResult = array('added' => array(), 'removed' => array(), 'modified' => array()); + $aResult = ['added' => [], 'removed' => [], 'modified' => []]; $this->ComputeFingerprints(); - + // Check that all objects in Set1 are also in Set2 - foreach($this->aFingerprints1 as $sFingerprint => $oObj) - { + foreach ($this->aFingerprints1 as $sFingerprint => $oObj) { // Beware: the elements from the first set MUST come from the database, otherwise the result will be irrelevant - if ($oObj->IsNew()) throw new Exception('Cannot compute differences when elements from the first set are NOT in the database'); - if (array_key_exists($oObj->GetKey(), $this->aIDs2) && ($this->aIDs2[$oObj->GetKey()]->IsModified())) - { + if ($oObj->IsNew()) { + throw new Exception('Cannot compute differences when elements from the first set are NOT in the database'); + } + if (array_key_exists($oObj->GetKey(), $this->aIDs2) && ($this->aIDs2[$oObj->GetKey()]->IsModified())) { // The very same object exists in both set, but was modified since its load $aResult['modified'][$oObj->GetKey()] = $this->aIDs2[$oObj->GetKey()]; - } - else if (($this->sAdditionalKeyColumn !== null) && array_key_exists($oObj->Get($this->sAdditionalKeyColumn), $this->aAdditionalKeys)) - { + } elseif (($this->sAdditionalKeyColumn !== null) && array_key_exists($oObj->Get($this->sAdditionalKeyColumn), $this->aAdditionalKeys)) { // Special case for n:n links where the link is recreated between the very same 2 objects, but some of its attributes are modified // Let's consider this as a "modification" instead of "deletion" + "creation" in order to have a "clean" history for the objects $oDestObj = $this->aAdditionalKeys[$oObj->Get($this->sAdditionalKeyColumn)]; @@ -1747,51 +1632,43 @@ class DBObjectSetComparator // Mark this as processed, so that the pass on aFingerprints2 below ignores this object $sNewFingerprint = $oDestObj->Fingerprint($this->aExcludedColumns); $this->aFingerprints2[$sNewFingerprint] = $oCloneObj; - } - else if (!array_key_exists($sFingerprint, $this->aFingerprints2)) - { + } elseif (!array_key_exists($sFingerprint, $this->aFingerprints2)) { $aResult['removed'][] = $oObj; } } - + // Vice versa // Check that all objects in Set2 are also in Set1 - foreach($this->aFingerprints2 as $sFingerprint => $oObj) - { - if (array_key_exists($oObj->GetKey(), $this->aIDs1) && ($oObj->IsModified())) - { + foreach ($this->aFingerprints2 as $sFingerprint => $oObj) { + if (array_key_exists($oObj->GetKey(), $this->aIDs1) && ($oObj->IsModified())) { // Already marked as modified above //$aResult['modified'][$oObj->GetKey()] = $oObj; - } - else if (!array_key_exists($sFingerprint, $this->aFingerprints1)) - { + } elseif (!array_key_exists($sFingerprint, $this->aFingerprints1)) { $aResult['added'][] = $oObj; } } return $aResult; } - /** - * Helper to clone (in memory) an object and to apply to it the values taken from a second object - * - * @internal - * - * @param \DBObject $oObjToClone - * @param \DBObject $oObjWithValues - * - * @return \DBObject The modified clone - * - * @throws \ArchivedObjectException - * @throws \CoreException - * @throws \CoreUnexpectedValue - */ + /** + * Helper to clone (in memory) an object and to apply to it the values taken from a second object + * + * @internal + * + * @param \DBObject $oObjToClone + * @param \DBObject $oObjWithValues + * + * @return \DBObject The modified clone + * + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \CoreUnexpectedValue + */ protected function CopyFrom($oObjToClone, $oObjWithValues) { $oObj = MetaModel::GetObject(get_class($oObjToClone), $oObjToClone->GetKey()); - foreach(MetaModel::ListAttributeDefs(get_class($oObj)) as $sAttCode => $oAttDef) - { - if (!in_array($sAttCode, $this->aExcludedColumns) && $oAttDef->IsWritable()) - { + foreach (MetaModel::ListAttributeDefs(get_class($oObj)) as $sAttCode => $oAttDef) { + if (!in_array($sAttCode, $this->aExcludedColumns) && $oAttDef->IsWritable()) { $oObj->Set($sAttCode, $oObjWithValues->Get($sAttCode)); } } diff --git a/core/dbproperty.class.inc.php b/core/dbproperty.class.inc.php index b03aae2fe..c7ddcc542 100644 --- a/core/dbproperty.class.inc.php +++ b/core/dbproperty.class.inc.php @@ -1,9 +1,10 @@ - /** * Database properties - manage database instances in a complex installation * @@ -24,9 +24,8 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - /** - * A database property + * A database property * * @package iTopORM */ @@ -34,40 +33,37 @@ class DBProperty extends DBObject { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "cloud", "key_type" => "autoincrement", "name_attcode" => "name", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_db_properties", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("value", array("allowed_values"=>null, "sql"=>"value", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("name", ["allowed_values" => null, "sql" => "name", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("value", ["allowed_values" => null, "sql" => "value", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeDateTime("change_date", array("allowed_values"=>null, "sql"=>"change_date", "default_value"=>"NOW()", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("change_comment", array("allowed_values"=>null, "sql"=>"change_comment", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeDateTime("change_date", ["allowed_values" => null, "sql" => "change_date", "default_value" => "NOW()", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("change_comment", ["allowed_values" => null, "sql" => "change_comment", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); } /** - * Helper to check wether the table has been created into the DB + * Helper to check wether the table has been created into the DB * (this table did not exist in 1.0.1 and older versions) */ public static function IsInstalled() { $sTable = MetaModel::DBGetTable(__CLASS__); - if (CMDBSource::IsTable($sTable)) - { + if (CMDBSource::IsTable($sTable)) { return true; - } - else - { + } else { return false; } return false; @@ -75,12 +71,10 @@ class DBProperty extends DBObject public static function SetProperty($sName, $sValue, $sComment = '', $sDescription = null) { - try - { + try { $oSearch = DBObjectSearch::FromOQL('SELECT DBProperty WHERE name = :name'); - $oSet = new DBObjectSet($oSearch, array(), array('name' => $sName)); - if ($oSet->Count() == 0) - { + $oSet = new DBObjectSet($oSearch, [], ['name' => $sName]); + if ($oSet->Count() == 0) { $oProp = new DBProperty(); $oProp->Set('name', $sName); $oProp->Set('description', $sDescription); @@ -88,31 +82,23 @@ class DBProperty extends DBObject $oProp->Set('change_date', time()); $oProp->Set('change_comment', $sComment); $oProp->DBInsert(); - } - elseif ($oSet->Count() == 1) - { + } elseif ($oSet->Count() == 1) { $oProp = $oSet->fetch(); - if (!is_null($sDescription)) - { + if (!is_null($sDescription)) { $oProp->Set('description', $sDescription); } $oProp->Set('value', $sValue); $oProp->Set('change_date', time()); $oProp->Set('change_comment', $sComment); $oProp->DBUpdate(); - } - else - { + } else { // Houston... throw new CoreException('duplicate db property'); } - } - catch (MySQLException $e) - { + } catch (MySQLException $e) { // This might be because the table could not be found, // let's check it and discard silently if this is really the case - if (self::IsInstalled()) - { + if (self::IsInstalled()) { throw $e; } IssueLog::Error('Attempting to write a DBProperty while the module has not been installed'); @@ -121,34 +107,25 @@ class DBProperty extends DBObject public static function GetProperty($sName, $default = null) { - try - { + try { $oSearch = DBObjectSearch::FromOQL('SELECT DBProperty WHERE name = :name'); - $oSet = new DBObjectSet($oSearch, array(), array('name' => $sName)); + $oSet = new DBObjectSet($oSearch, [], ['name' => $sName]); $iCount = $oSet->Count(); - if ($iCount == 0) - { + if ($iCount == 0) { //throw new CoreException('unknown db property', array('name' => $sName)); $sValue = $default; - } - elseif ($iCount == 1) - { + } elseif ($iCount == 1) { $oProp = $oSet->fetch(); $sValue = $oProp->Get('value'); - } - else - { + } else { // $iCount > 1 // Houston... - throw new CoreException('duplicate db property', array('name' => $sName, 'count' => $iCount)); + throw new CoreException('duplicate db property', ['name' => $sName, 'count' => $iCount]); } - } - catch (MySQLException $e) - { + } catch (MySQLException $e) { // This might be because the table could not be found, // let's check it and discard silently if this is really the case - if (self::IsInstalled()) - { + if (self::IsInstalled()) { throw $e; } $sValue = $default; @@ -156,5 +133,3 @@ class DBProperty extends DBObject return $sValue; } } - -?> diff --git a/core/dbsearch.class.php b/core/dbsearch.class.php index 2e160e077..3babe8447 100644 --- a/core/dbsearch.class.php +++ b/core/dbsearch.class.php @@ -1,4 +1,5 @@ Init(); } - /** - * called by the constructor - * @internal Set the obsolete and archive modes to the default ones - */ + /** + * called by the constructor + * @internal Set the obsolete and archive modes to the default ones + */ protected function Init() { $this->m_bArchiveMode = utils::IsArchiveMode(); @@ -86,104 +87,104 @@ abstract class DBSearch $this->m_bArchiveMode = $bEnable; } - /** - * @internal - * @return bool - */ + /** + * @internal + * @return bool + */ public function GetArchiveMode() { return $this->m_bArchiveMode; } - /** - * Should the obsolete data be fetched - * - * @internal - * @param $bShow - */ + /** + * Should the obsolete data be fetched + * + * @internal + * @param $bShow + */ public function SetShowObsoleteData($bShow) { $this->m_bShowObsoleteData = $bShow; } - /** - * @internal - * @return bool - */ + /** + * @internal + * @return bool + */ public function GetShowObsoleteData() { - if ($this->m_bArchiveMode || $this->IsAllDataAllowed()) - { + if ($this->m_bArchiveMode || $this->IsAllDataAllowed()) { // Enable obsolete data too! $bRet = true; - } - else - { + } else { $bRet = $this->m_bShowObsoleteData; } return $bRet; } - /** - * @internal - */ - public function NoContextParameters() {$this->m_bNoContextParameters = true;} + /** + * @internal + */ + public function NoContextParameters() + { + $this->m_bNoContextParameters = true; + } - /** - * @internal - * @return bool - */ - public function HasContextParameters() {return $this->m_bNoContextParameters;} + /** + * @internal + * @return bool + */ + public function HasContextParameters() + { + return $this->m_bNoContextParameters; + } - /** - * @internal - * - * @param $sPluginClass - * @param $sProperty - * @param $value - */ + /** + * @internal + * + * @param $sPluginClass + * @param $sProperty + * @param $value + */ public function SetModifierProperty($sPluginClass, $sProperty, $value) { $this->m_aModifierProperties[$sPluginClass][$sProperty] = $value; } - /** - * @internal - * - * @param $sPluginClass - * - * @return array|mixed - */ + /** + * @internal + * + * @param $sPluginClass + * + * @return array|mixed + */ public function GetModifierProperties($sPluginClass) { - if (array_key_exists($sPluginClass, $this->m_aModifierProperties)) - { + if (array_key_exists($sPluginClass, $this->m_aModifierProperties)) { return $this->m_aModifierProperties[$sPluginClass]; - } - else - { - return array(); + } else { + return []; } } - /** - * @internal - * @param $sAlias - * - * @return mixed - */ + /** + * @internal + * @param $sAlias + * + * @return mixed + */ abstract public function GetClassName($sAlias); - /** - * @internal - * @return mixed - */ + /** + * @internal + * @return mixed + */ abstract public function GetClass(); - /** - * @internal - * @return mixed - */ + /** + * @internal + * @return mixed + */ abstract public function GetClassAlias(); /** @@ -193,23 +194,23 @@ abstract class DBSearch abstract public function GetFirstJoinedClass(); /** - * Change the class - * - * Defaults to the first selected class (most of the time it is also the first joined class - * only subclasses are supported as of now, because the conditions must fit the new class - * - * @internal - */ + * Change the class + * + * Defaults to the first selected class (most of the time it is also the first joined class + * only subclasses are supported as of now, because the conditions must fit the new class + * + * @internal + */ abstract public function ChangeClass($sNewClass, $sAlias = null); - /** - * @internal - * @return mixed - */ + /** + * @internal + * @return mixed + */ abstract public function GetSelectedClasses(); /** - * @internal + * @internal * @param array $aSelectedClasses array of aliases * @throws CoreException */ @@ -218,15 +219,15 @@ abstract class DBSearch /** * Change any alias of the query tree * - * @internal - * + * @internal + * * @param $sOldName * @param $sNewName * @return bool True if the alias has been found and changed */ abstract public function RenameAlias($sOldName, $sNewName); - abstract public function RenameAliasesInNameSpace($aClassAliases, $aAliasTranslation = array()); + abstract public function RenameAliasesInNameSpace($aClassAliases, $aAliasTranslation = []); abstract public function TranslateConditions($aTranslationData, $bMatchAll = true, $bMarkFieldsAsResolved = true); @@ -321,107 +322,107 @@ abstract class DBSearch * @see DBSearch::AddConditionExpression() * * @param Expression $oExpression - * - * @return mixed - */ + * + * @return mixed + */ abstract public function MergeConditionExpression($oExpression); - /** - * add $oExpression as a AND - * - * @api - * @see DBSearch::MergeConditionExpression() - * - * @param Expression $oExpression - * - * @return mixed - */ + /** + * add $oExpression as a AND + * + * @api + * @see DBSearch::MergeConditionExpression() + * + * @param Expression $oExpression + * + * @return mixed + */ abstract public function AddConditionExpression($oExpression); - /** - * Condition on the friendlyname - * - * Restrict the query to only the corresponding selected class' friendlyname - * - * @internal - * - * @param string $sName the desired friendlyname - * - * @return mixed - */ - abstract public function AddNameCondition($sName); + /** + * Condition on the friendlyname + * + * Restrict the query to only the corresponding selected class' friendlyname + * + * @internal + * + * @param string $sName the desired friendlyname + * + * @return mixed + */ + abstract public function AddNameCondition($sName); - /** - * Add a condition - * - * This is the simplest way to express a AND condition. For complex use cases, use MergeConditionExpression or AddConditionExpression instead - * - * @api - * - * @param string $sFilterCode - * @param mixed $value - * @param string $sOpCode operator to use : '=' (default), '!=', 'IN', 'NOT IN' - * - * @throws \CoreException - * - */ + /** + * Add a condition + * + * This is the simplest way to express a AND condition. For complex use cases, use MergeConditionExpression or AddConditionExpression instead + * + * @api + * + * @param string $sFilterCode + * @param mixed $value + * @param string $sOpCode operator to use : '=' (default), '!=', 'IN', 'NOT IN' + * + * @throws \CoreException + * + */ abstract public function AddCondition($sFilterCode, $value, $sOpCode = null); /** * Specify a condition on external keys or link sets - * - * @internal - * + * + * @internal + * * @param string $sAttSpec Can be either an attribute code or extkey->[sAttSpec] or linkset->[sAttSpec] and so on, recursively - * Example: infra_list->ci_id->location_id->country + * Example: infra_list->ci_id->location_id->country * @param mixed $value The value to match (can be an array => IN(val1, val2...) * @return void */ abstract public function AddConditionAdvanced($sAttSpec, $value); - /** - * @internal - * - * @param string $sFullText - * - * @return mixed - */ + /** + * @internal + * + * @param string $sFullText + * + * @return mixed + */ abstract public function AddCondition_FullText($sFullText); abstract public function AddCondition_FullTextOnAttributes(array $aAttCodes, $sNeedle); - /** - * Perform a join, the remote class being matched by the mean of its primary key - * - * The join is performed - * * from the searched class, based on the $sExtKeyAttCode attribute - * * against the oFilter searched class, based on its primary key - * Note : if several classes have already being joined (SELECT a join b ON...), the first joined class (a in the example) is considered as being the searched class. - * - * @api - * @see AddCondition_ReferencedBy() - * + /** + * Perform a join, the remote class being matched by the mean of its primary key + * + * The join is performed + * * from the searched class, based on the $sExtKeyAttCode attribute + * * against the oFilter searched class, based on its primary key + * Note : if several classes have already being joined (SELECT a join b ON...), the first joined class (a in the example) is considered as being the searched class. + * + * @api + * @see AddCondition_ReferencedBy() + * * @param DBObjectSearch $oFilter * @param string $sExtKeyAttCode * @param int $iOperatorCode the comparison operator to use. For the list of all possible values, see the constant defined in core/oql/oqlquery.class.inc.php * @param array|null $aRealiasingMap array of => , for each alias that has changed in the newly attached oFilter (in case of collisions between the two filters) - * + * * @throws CoreException * @throws CoreWarning */ abstract public function AddCondition_PointingTo(DBObjectSearch $oFilter, $sExtKeyAttCode, $iOperatorCode = TREE_OPERATOR_EQUALS, &$aRealiasingMap = null); /** - * Inverse operation of AddCondition_PointingTo - * - * The join is performed - * * from the olFilter searched class, based on the $sExtKeyAttCode attribute - * * against the searched class, based on its primary key - * Note : if several classes have already being joined (SELECT a join b ON...), the first joined class (a in the example) is considered as being the searched class. - * - * - * @api - * @see AddCondition_PointingTo() - * + * Inverse operation of AddCondition_PointingTo + * + * The join is performed + * * from the olFilter searched class, based on the $sExtKeyAttCode attribute + * * against the searched class, based on its primary key + * Note : if several classes have already being joined (SELECT a join b ON...), the first joined class (a in the example) is considered as being the searched class. + * + * + * @api + * @see AddCondition_PointingTo() + * * @param DBObjectSearch $oFilter * @param $sForeignExtKeyAttCode * @param int $iOperatorCode @@ -445,62 +446,54 @@ abstract class DBSearch abstract public function Filter($sClassAlias, DBSearch $oFilter); /** - * Filter the result - * - * The filter is performed by returning only the values in common with the given $oFilter - * The impact on the resulting query performance/viability can be significant. - * Only the first joined class can be filtered. - * - * @internal - * - * @param DBSearch $oFilter - * - * @return mixed - */ + * Filter the result + * + * The filter is performed by returning only the values in common with the given $oFilter + * The impact on the resulting query performance/viability can be significant. + * Only the first joined class can be filtered. + * + * @internal + * + * @param DBSearch $oFilter + * + * @return mixed + */ abstract public function Intersect(DBSearch $oFilter); - /** - * Perform a join - * - * The join is performed against $oFilter selected class using $sExtKeyAttCode of the current selected class - * - * @internal - * - * @param DBSearch $oFilter The join is performed against $oFilter selected class - * @param integer $iDirection can be either DBSearch::JOIN_POINTING_TO or DBSearch::JOIN_REFERENCED_BY - * @param string $sExtKeyAttCode The join is performed against $sExtKeyAttCode whether it is compared against the current DBSearch or $oFilter depend of $iDirection - * @param integer $iOperatorCode See DBSearch::AddCondition_PointingTo() - * @param array|null $aRealiasingMap Map of aliases from the attached query, that could have been renamed by the optimization process - * - * @return DBSearch - * @throws CoreException - * @throws CoreWarning - */ + /** + * Perform a join + * + * The join is performed against $oFilter selected class using $sExtKeyAttCode of the current selected class + * + * @internal + * + * @param DBSearch $oFilter The join is performed against $oFilter selected class + * @param integer $iDirection can be either DBSearch::JOIN_POINTING_TO or DBSearch::JOIN_REFERENCED_BY + * @param string $sExtKeyAttCode The join is performed against $sExtKeyAttCode whether it is compared against the current DBSearch or $oFilter depend of $iDirection + * @param integer $iOperatorCode See DBSearch::AddCondition_PointingTo() + * @param array|null $aRealiasingMap Map of aliases from the attached query, that could have been renamed by the optimization process + * + * @return DBSearch + * @throws CoreException + * @throws CoreWarning + */ public function Join(DBSearch $oFilter, $iDirection, $sExtKeyAttCode, $iOperatorCode = TREE_OPERATOR_EQUALS, &$aRealiasingMap = null) { $oSourceFilter = $this->DeepClone(); $oRet = null; - if ($oFilter instanceof DBUnionSearch) - { - $aSearches = array(); - foreach ($oFilter->GetSearches() as $oSearch) - { + if ($oFilter instanceof DBUnionSearch) { + $aSearches = []; + foreach ($oFilter->GetSearches() as $oSearch) { $aSearches[] = $oSourceFilter->Join($oSearch, $iDirection, $sExtKeyAttCode, $iOperatorCode, $aRealiasingMap); } $oRet = new DBUnionSearch($aSearches); - } - else - { + } else { /** @var \DBObjectSearch $oFilter */ - if ($iDirection === static::JOIN_POINTING_TO) - { + if ($iDirection === static::JOIN_POINTING_TO) { $oSourceFilter->AddCondition_PointingTo($oFilter, $sExtKeyAttCode, $iOperatorCode, $aRealiasingMap); - } - else - { - if ($iOperatorCode !== TREE_OPERATOR_EQUALS) - { + } else { + if ($iOperatorCode !== TREE_OPERATOR_EQUALS) { throw new Exception('Only TREE_OPERATOR_EQUALS operator code is supported yet for AddCondition_ReferencedBy.'); } $oSourceFilter->AddCondition_ReferencedBy($oFilter, $sExtKeyAttCode, TREE_OPERATOR_EQUALS, $aRealiasingMap); @@ -511,101 +504,90 @@ abstract class DBSearch return $oRet; } - /** - * Set the internal params. - * - * If any params pre-existed, they are lost. - * - * @internal - * - * @param mixed[string] $aParams array of mixed params index by string name - * - * @return mixed - */ + /** + * Set the internal params. + * + * If any params pre-existed, they are lost. + * + * @internal + * + * @param mixed[string] $aParams array of mixed params index by string name + * + * @return mixed + */ abstract public function SetInternalParams($aParams); - /** - * @internal - * @return mixed - */ + /** + * @internal + * @return mixed + */ abstract public function GetInternalParams(); - /** - * @internal - * - * @param bool $bExcludeMagicParams - * - * @return mixed - */ + /** + * @internal + * + * @param bool $bExcludeMagicParams + * + * @return mixed + */ abstract public function GetQueryParams($bExcludeMagicParams = true); - /** - * @internal - * @return mixed - */ + /** + * @internal + * @return mixed + */ abstract public function ListConstantFields(); /** - * Turn the parameters (:xxx) into scalar values - * - * The goal is to easily serialize a search + * Turn the parameters (:xxx) into scalar values + * + * The goal is to easily serialize a search + * + * @internal * - * @internal - * * @param array $aArgs * * @return string */ abstract public function ApplyParameters($aArgs); - /** - * Convert a query to a string representation - * - * This operation can be revert back to a DBSearch using DBSearch::unserialize() - * - * @api - * @see DBSearch::unserialize() - * - * @param bool $bDevelopParams - * @param array $aContextParams - * - * @return false|string - * @throws ArchivedObjectException - * @throws CoreException - */ - public function serialize($bDevelopParams = false, $aContextParams = array()) + /** + * Convert a query to a string representation + * + * This operation can be revert back to a DBSearch using DBSearch::unserialize() + * + * @api + * @see DBSearch::unserialize() + * + * @param bool $bDevelopParams + * @param array $aContextParams + * + * @return false|string + * @throws ArchivedObjectException + * @throws CoreException + */ + public function serialize($bDevelopParams = false, $aContextParams = []) { $aQueryParams = $this->GetQueryParams(); $aContextParams = array_merge($this->GetInternalParams(), $aContextParams); - foreach($aQueryParams as $sParam => $sValue) - { - if (isset($aContextParams[$sParam])) - { + foreach ($aQueryParams as $sParam => $sValue) { + if (isset($aContextParams[$sParam])) { $aQueryParams[$sParam] = $aContextParams[$sParam]; - } - elseif (($iPos = strpos($sParam, '->')) !== false) - { + } elseif (($iPos = strpos($sParam, '->')) !== false) { $sParamName = substr($sParam, 0, $iPos); - if (isset($aContextParams[$sParamName.'->object()']) || isset($aContextParams[$sParamName])) - { + if (isset($aContextParams[$sParamName.'->object()']) || isset($aContextParams[$sParamName])) { $sAttCode = substr($sParam, $iPos + 2); /** @var \DBObject $oObj */ $oObj = isset($aContextParams[$sParamName.'->object()']) ? $aContextParams[$sParamName.'->object()'] : $aContextParams[$sParamName]; - if ($oObj->IsModified()) - { - if ($sAttCode == 'id') - { + if ($oObj->IsModified()) { + if ($sAttCode == 'id') { $aQueryParams[$sParam] = $oObj->GetKey(); - } - else - { + } else { $aQueryParams[$sParam] = $oObj->Get($sAttCode); } - } - else - { + } else { unset($aQueryParams[$sParam]); // For database objects, serialize only class, key $aQueryParams[$sParamName.'->id'] = $oObj->GetKey(); @@ -616,14 +598,14 @@ abstract class DBSearch } $sOql = $this->ToOql($bDevelopParams, $aContextParams); - return urlencode(json_encode(array($sOql, $aQueryParams, $this->m_aModifierProperties))); + return urlencode(json_encode([$sOql, $aQueryParams, $this->m_aModifierProperties])); } /** - * Convert a serialized query back to an instance of DBSearch - * - * @api - * + * Convert a serialized query back to an instance of DBSearch + * + * @api + * * @param string $sValue Serialized OQL query * * @return \DBSearch @@ -631,23 +613,19 @@ abstract class DBSearch * @throws \CoreException * @throws \OQLException */ - static public function unserialize($sValue) + public static function unserialize($sValue) { $aData = json_decode(urldecode($sValue), true); - if (is_null($aData)) - { + if (is_null($aData)) { throw new CoreException("Invalid filter parameter"); } $sOql = $aData[0]; $aParams = $aData[1]; - $aExtraParams = array(); - foreach($aParams as $sParam => $sValue) - { - if (($iPos = strpos($sParam, '->class')) !== false) - { + $aExtraParams = []; + foreach ($aParams as $sParam => $sValue) { + if (($iPos = strpos($sParam, '->class')) !== false) { $sParamName = substr($sParam, 0, $iPos); - if (isset($aParams[$sParamName.'->id'])) - { + if (isset($aParams[$sParamName.'->id'])) { $sClass = $aParams[$sParamName.'->class']; $iKey = $aParams[$sParamName.'->id']; $oObj = MetaModel::GetObject($sClass, $iKey); @@ -664,65 +642,65 @@ abstract class DBSearch return $oRetFilter; } - /** - * Create a new DBObjectSearch from $oSearch with a new alias $sAlias - * - * @internal Note : This has not be tested with UNION queries. - * - * @param DBSearch $oSearch - * @param string $sAlias - * - * @return DBObjectSearch - * @throws CoreException - */ - static public function CloneWithAlias(DBSearch $oSearch, $sAlias) - { - $oSearchWithAlias = new DBObjectSearch($oSearch->GetClass(), $sAlias); - $oSearchWithAlias = $oSearchWithAlias->Intersect($oSearch); - return $oSearchWithAlias; - } + /** + * Create a new DBObjectSearch from $oSearch with a new alias $sAlias + * + * @internal Note : This has not be tested with UNION queries. + * + * @param DBSearch $oSearch + * @param string $sAlias + * + * @return DBObjectSearch + * @throws CoreException + */ + public static function CloneWithAlias(DBSearch $oSearch, $sAlias) + { + $oSearchWithAlias = new DBObjectSearch($oSearch->GetClass(), $sAlias); + $oSearchWithAlias = $oSearchWithAlias->Intersect($oSearch); + return $oSearchWithAlias; + } - /** - * Convert the DBSearch to an OQL representation - * - * @api - * @see DBSearch::FromOQL() - * - * @param bool $bDevelopParams - * @param null $aContextParams - * @param bool $bWithAllowAllFlag - * - * @return mixed - */ - abstract public function ToOQL($bDevelopParams = false, $aContextParams = null, $bWithAllowAllFlag = false); + /** + * Convert the DBSearch to an OQL representation + * + * @api + * @see DBSearch::FromOQL() + * + * @param bool $bDevelopParams + * @param null $aContextParams + * @param bool $bWithAllowAllFlag + * + * @return mixed + */ + abstract public function ToOQL($bDevelopParams = false, $aContextParams = null, $bWithAllowAllFlag = false); - /** - * Export the DBSearch as a structure (array of arrays...) suitable for a conversion to JSON - * - * @internal - * - * @return mixed[string] - */ - abstract public function ToJSON(); + /** + * Export the DBSearch as a structure (array of arrays...) suitable for a conversion to JSON + * + * @internal + * + * @return mixed[string] + */ + abstract public function ToJSON(); - static protected $m_aOQLQueries = array(); + protected static $m_aOQLQueries = []; - /** - * FromOQL with AllowAllData enabled - * - * The goal is to not filter out depending on user rights. - * In particular when we are currently in the process of evaluating the user rights... - * - * @internal - * @see DBSearch::FromOQL() - * - * @param string $sQuery - * @param null $aParams - * - * @return DBSearch - * @throws OQLException - */ - static public function FromOQL_AllData($sQuery, $aParams = null) + /** + * FromOQL with AllowAllData enabled + * + * The goal is to not filter out depending on user rights. + * In particular when we are currently in the process of evaluating the user rights... + * + * @internal + * @see DBSearch::FromOQL() + * + * @param string $sQuery + * @param null $aParams + * + * @return DBSearch + * @throws OQLException + */ + public static function FromOQL_AllData($sQuery, $aParams = null) { $oRes = self::FromOQL($sQuery, $aParams); $oRes->AllowAllData(); @@ -730,50 +708,44 @@ abstract class DBSearch } /** - * Create a new DBSearch from the given OQL. - * - * This is the simplest way to create a DBSearch. - * For almost every cases, this is the easiest way. - * - * @api - * @see DBSearch::ToOQL() - * + * Create a new DBSearch from the given OQL. + * + * This is the simplest way to create a DBSearch. + * For almost every cases, this is the easiest way. + * + * @api + * @see DBSearch::ToOQL() + * * @param string $sQuery The OQL to convert to a DBSearch * @param array $aParams array of params index by name * @param ModelReflection|null $oMetaModel The MetaModel to use when checking the consistency of the OQL - * + * * @return DBObjectSearch|DBUnionSearch - * + * * @throws OQLException */ - public static function FromOQL($sQuery, $aParams = null, ModelReflection $oMetaModel=null) + public static function FromOQL($sQuery, $aParams = null, ModelReflection $oMetaModel = null) { - if (empty($sQuery)) - { + if (empty($sQuery)) { return null; } // Query caching $sQueryId = md5($sQuery); $bOQLCacheEnabled = true; - if ($bOQLCacheEnabled) - { - if (array_key_exists($sQueryId, self::$m_aOQLQueries)) - { + if ($bOQLCacheEnabled) { + if (array_key_exists($sQueryId, self::$m_aOQLQueries)) { // hit! $oResultFilter = self::$m_aOQLQueries[$sQueryId]->DeepClone(); - } - elseif (self::$m_bUseAPCCache) - { + } elseif (self::$m_bUseAPCCache) { // Note: For versions of APC older than 3.0.17, fetch() accepts only one parameter // $sAPCCacheId = 'itop-'.MetaModel::GetEnvironmentId().'-dbsearch-cache-'.$sQueryId; $oKPI = new ExecutionKPI(); $result = apc_fetch($sAPCCacheId); $oKPI->ComputeStats('Search APC (fetch)', $sQuery); - - if (is_object($result)) - { + + if (is_object($result)) { $oResultFilter = $result; self::$m_aOQLQueries[$sQueryId] = $oResultFilter->DeepClone(); } @@ -781,29 +753,25 @@ abstract class DBSearch } /** @var DBObjectSearch | null $oResultFilter */ - if (!isset($oResultFilter)) - { + if (!isset($oResultFilter)) { $oKPI = new ExecutionKPI(); $oOql = new OqlInterpreter($sQuery); $oOqlQuery = $oOql->ParseQuery(); - - if ($oMetaModel === null) - { + + if ($oMetaModel === null) { $oMetaModel = new ModelReflectionRuntime(); } $oOqlQuery->Check($oMetaModel, $sQuery); // Exceptions thrown in case of issue - + $oResultFilter = $oOqlQuery->ToDBSearch($sQuery); $oKPI->ComputeStats('Parse OQL', $sQuery); - - if ($bOQLCacheEnabled) - { + + if ($bOQLCacheEnabled) { self::$m_aOQLQueries[$sQueryId] = $oResultFilter->DeepClone(); - if (self::$m_bUseAPCCache) - { + if (self::$m_bUseAPCCache) { $oKPI = new ExecutionKPI(); apc_store($sAPCCacheId, $oResultFilter, self::$m_iQueryCacheTTL); $oKPI->ComputeStats('Search APC (store)', $sQueryId); @@ -811,8 +779,7 @@ abstract class DBSearch } } - if (!is_null($aParams)) - { + if (!is_null($aParams)) { $oResultFilter->SetInternalParams($aParams); } @@ -823,60 +790,54 @@ abstract class DBSearch } /** - * Fetch the result has an array structure. - * + * Fetch the result has an array structure. + * * Alternative to object mapping: the data are transfered directly into an array * This is 10 times faster than creating a set of objects, and makes sense when optimization is required - * But this speed comes at the cost of not obtaining the easy to manipulates DBObject instances but simple array structure. - * - * @internal + * But this speed comes at the cost of not obtaining the easy to manipulates DBObject instances but simple array structure. + * + * @internal * * @param array $aColumns The columns you'd like to fetch. * @param array $aOrderBy Array of '[.]attcode' => bAscending * @param array $aArgs * * @return array|void - * + * * @throws \CoreException * @throws \MissingQueryArgument * @throws \MySQLException * @throws \MySQLHasGoneAwayException */ - public function ToDataArray($aColumns = array(), $aOrderBy = array(), $aArgs = array()) + public function ToDataArray($aColumns = [], $aOrderBy = [], $aArgs = []) { $sSQL = $this->MakeSelectQuery($aOrderBy, $aArgs); $resQuery = CMDBSource::Query($sSQL); - if (!$resQuery) - { + if (!$resQuery) { return; } - if (count($aColumns) == 0) - { - $aColumns = array_keys(MetaModel::ListAttributeDefs($this->GetClass())); - // Add the standard id (as first column) - array_unshift($aColumns, 'id'); + if (count($aColumns) == 0) { + $aColumns = array_keys(MetaModel::ListAttributeDefs($this->GetClass())); + // Add the standard id (as first column) + array_unshift($aColumns, 'id'); } $aQueryCols = CMDBSource::GetColumns($resQuery, $sSQL); $sClassAlias = $this->GetClassAlias(); - $aColMap = array(); - foreach ($aColumns as $sAttCode) - { + $aColMap = []; + foreach ($aColumns as $sAttCode) { $sColName = $sClassAlias.$sAttCode; - if (in_array($sColName, $aQueryCols)) - { + if (in_array($sColName, $aQueryCols)) { $aColMap[$sAttCode] = $sColName; } } - $aRes = array(); - while ($aRow = CMDBSource::FetchArray($resQuery)) - { - $aMappedRow = array(); - foreach ($aColMap as $sAttCode => $sColName) - { + $aRes = []; + while ($aRow = CMDBSource::FetchArray($resQuery)) { + $aMappedRow = []; + foreach ($aColMap as $sAttCode => $sColName) { $aMappedRow[$sAttCode] = $aRow[$sColName]; } $aRes[] = $aMappedRow; @@ -885,68 +846,65 @@ abstract class DBSearch return $aRes; } - /** - * Selects a column ($sAttCode) from the specified class ($sClassAlias - default main class) of the DBsearch object and gives the result as an array - * @param string $sAttCode - * @param string|null $sClassAlias - * - * @return array - * @throws ConfigException - * @throws CoreException - * @throws MissingQueryArgument - * @throws MySQLException - * @throws MySQLHasGoneAwayException - */ - public function SelectAttributeToArray(string $sAttCode, ?string $sClassAlias = null):array - { - if(is_null($sClassAlias)) { - $sClassAlias = $this->GetClassAlias(); - } + /** + * Selects a column ($sAttCode) from the specified class ($sClassAlias - default main class) of the DBsearch object and gives the result as an array + * @param string $sAttCode + * @param string|null $sClassAlias + * + * @return array + * @throws ConfigException + * @throws CoreException + * @throws MissingQueryArgument + * @throws MySQLException + * @throws MySQLHasGoneAwayException + */ + public function SelectAttributeToArray(string $sAttCode, ?string $sClassAlias = null): array + { + if (is_null($sClassAlias)) { + $sClassAlias = $this->GetClassAlias(); + } - $sClass = $this->GetClass(); - if($sAttCode === 'id'){ - $aAttToLoad[$sClassAlias]=[]; - } else { - $aAttToLoad[$sClassAlias][$sAttCode] = MetaModel::GetAttributeDef($sClass, $sAttCode); - } + $sClass = $this->GetClass(); + if ($sAttCode === 'id') { + $aAttToLoad[$sClassAlias] = []; + } else { + $aAttToLoad[$sClassAlias][$sAttCode] = MetaModel::GetAttributeDef($sClass, $sAttCode); + } - $sSQL = $this->MakeSelectQuery([], [], $aAttToLoad); - $resQuery = CMDBSource::Query($sSQL); - if (!$resQuery) - { - return []; - } + $sSQL = $this->MakeSelectQuery([], [], $aAttToLoad); + $resQuery = CMDBSource::Query($sSQL); + if (!$resQuery) { + return []; + } - $sColName = $sClassAlias.$sAttCode; + $sColName = $sClassAlias.$sAttCode; - $aRes = []; - while ($aRow = CMDBSource::FetchArray($resQuery)) - { - $aMappedRow = array(); - if($sAttCode === 'id') { - $aMappedRow[$sAttCode] = $aRow[$sColName]; - } else { - $aMappedRow[$sAttCode] = $aAttToLoad[$sClassAlias][$sAttCode]->FromSQLToValue($aRow, $sColName); - } - $aRes[] = $aMappedRow; - } - CMDBSource::FreeResult($resQuery); - return $aRes; - } + $aRes = []; + while ($aRow = CMDBSource::FetchArray($resQuery)) { + $aMappedRow = []; + if ($sAttCode === 'id') { + $aMappedRow[$sAttCode] = $aRow[$sColName]; + } else { + $aMappedRow[$sAttCode] = $aAttToLoad[$sClassAlias][$sAttCode]->FromSQLToValue($aRow, $sColName); + } + $aRes[] = $aMappedRow; + } + CMDBSource::FreeResult($resQuery); + return $aRes; + } //////////////////////////////////////////////////////////////////////////// // // Construction of the SQL queries // //////////////////////////////////////////////////////////////////////////// - protected static $m_aQueryStructCache = array(); + protected static $m_aQueryStructCache = []; - - /** - * Generate a Group By SQL query from the current search - * - * @internal - * + /** + * Generate a Group By SQL query from the current search + * + * @internal + * * @param array $aArgs * @param array $aGroupByExpr array('alias' => Expression) * @param bool $bExcludeNullValues @@ -954,76 +912,62 @@ abstract class DBSearch * @param array $aOrderBy array('alias' => bool) true = ASC false = DESC * @param int $iLimitCount * @param int $iLimitStart - * + * * @return string SQL query generated - * + * * @throws Exception */ - public function MakeGroupByQuery($aArgs, $aGroupByExpr, $bExcludeNullValues = false, $aSelectExpr = array(), $aOrderBy = array(), $iLimitCount = 0, $iLimitStart = 0) + public function MakeGroupByQuery($aArgs, $aGroupByExpr, $bExcludeNullValues = false, $aSelectExpr = [], $aOrderBy = [], $iLimitCount = 0, $iLimitStart = 0) { // Sanity check - foreach($aGroupByExpr as $sAlias => $oExpr) - { - if (!($oExpr instanceof Expression)) - { + foreach ($aGroupByExpr as $sAlias => $oExpr) { + if (!($oExpr instanceof Expression)) { throw new CoreException("Wrong parameter for 'Group By' for [$sAlias] (an array('alias' => Expression) is awaited)"); } } - foreach($aSelectExpr as $sAlias => $oExpr) - { - if (array_key_exists($sAlias, $aGroupByExpr)) - { + foreach ($aSelectExpr as $sAlias => $oExpr) { + if (array_key_exists($sAlias, $aGroupByExpr)) { throw new CoreException("Alias collision between 'Group By' and 'Select Expressions' [$sAlias]"); } - if (!($oExpr instanceof Expression)) - { + if (!($oExpr instanceof Expression)) { throw new CoreException("Wrong parameter for 'Select Expressions' for [$sAlias] (an array('alias' => Expression) is awaited)"); } } - foreach($aOrderBy as $sAlias => $bAscending) - { - if (!array_key_exists($sAlias, $aGroupByExpr) && !array_key_exists($sAlias, $aSelectExpr) && ($sAlias != '_itop_count_')) - { + foreach ($aOrderBy as $sAlias => $bAscending) { + if (!array_key_exists($sAlias, $aGroupByExpr) && !array_key_exists($sAlias, $aSelectExpr) && ($sAlias != '_itop_count_')) { $aAllowedAliases = array_keys($aSelectExpr); - $aAllowedAliases = array_merge($aAllowedAliases, array_keys($aGroupByExpr)); + $aAllowedAliases = array_merge($aAllowedAliases, array_keys($aGroupByExpr)); $aAllowedAliases[] = '_itop_count_'; throw new CoreException("Wrong alias [$sAlias] for 'Order By'. Allowed values are: ", null, implode(", ", $aAllowedAliases)); } - if (!is_bool($bAscending)) - { + if (!is_bool($bAscending)) { throw new CoreException("Wrong direction in ORDER BY spec, found '$bAscending' and expecting a boolean value for '$sAlias''"); } } - if ($bExcludeNullValues) - { + if ($bExcludeNullValues) { // Null values are not handled (though external keys set to 0 are allowed) $oQueryFilter = $this->DeepClone(); - foreach ($aGroupByExpr as $oGroupByExp) - { - $oNull = new FunctionExpression('ISNULL', array($oGroupByExp)); + foreach ($aGroupByExpr as $oGroupByExp) { + $oNull = new FunctionExpression('ISNULL', [$oGroupByExp]); $oNotNull = new BinaryExpression($oNull, '!=', new TrueExpression()); $oQueryFilter->AddConditionExpression($oNotNull); } - } - else - { + } else { $oQueryFilter = $this; } - $aAttToLoad = array(); - $oSQLQuery = $oQueryFilter->GetSQLQuery(array(), $aArgs, $aAttToLoad, null, 0, 0, false, $aGroupByExpr, $aSelectExpr); + $aAttToLoad = []; + $oSQLQuery = $oQueryFilter->GetSQLQuery([], $aArgs, $aAttToLoad, null, 0, 0, false, $aGroupByExpr, $aSelectExpr); $aScalarArgs = MetaModel::PrepareQueryArguments($aArgs, $this->GetInternalParams(), $this->GetExpectedArguments()); - try - { + try { $bBeautifulSQL = self::$m_bTraceQueries || self::$m_bDebugQuery || self::$m_bIndentQueries; $sRes = $oSQLQuery->RenderGroupBy($aScalarArgs, $bBeautifulSQL, $aOrderBy, $iLimitCount, $iLimitStart); } // Catch CoreException to add info before throwing again // Other exceptions will be thrown directly - catch (CoreException $e) - { + catch (CoreException $e) { // Add some information... $e->addInfo('OQL', $this->ToOQL()); throw $e; @@ -1051,79 +995,62 @@ abstract class DBSearch * @internal * */ - public function MakeSelectQuery($aOrderBy = array(), $aArgs = array(), $aAttToLoad = null, $aExtendedDataSpec = null, $iLimitCount = 0, $iLimitStart = 0, $bGetCount = false, $bBeautifulSQL = true) + public function MakeSelectQuery($aOrderBy = [], $aArgs = [], $aAttToLoad = null, $aExtendedDataSpec = null, $iLimitCount = 0, $iLimitStart = 0, $bGetCount = false, $bBeautifulSQL = true) { // Check the order by specification, and prefix with the class alias // and make sure that the ordering columns are going to be selected // $sClass = $this->GetClass(); $sClassAlias = $this->GetClassAlias(); - $aOrderSpec = array(); - foreach ($aOrderBy as $sFieldAlias => $bAscending) - { - if (!is_bool($bAscending)) - { + $aOrderSpec = []; + foreach ($aOrderBy as $sFieldAlias => $bAscending) { + if (!is_bool($bAscending)) { throw new CoreException("Wrong direction in ORDER BY spec, found '$bAscending' and expecting a boolean value"); } $iDotPos = strpos($sFieldAlias, '.'); - if ($iDotPos === false) - { + if ($iDotPos === false) { $sAttClass = $sClass; $sAttClassAlias = $sClassAlias; $sAttCode = $sFieldAlias; - } - else - { + } else { $sAttClassAlias = substr($sFieldAlias, 0, $iDotPos); $sAttClass = $this->GetClassName($sAttClassAlias); $sAttCode = substr($sFieldAlias, $iDotPos + 1); } - if ($sAttCode != 'id') - { + if ($sAttCode != 'id') { MyHelpers::CheckValueInArray('field name in ORDER BY spec', $sAttCode, MetaModel::GetAttributesList($sAttClass)); $oAttDef = MetaModel::GetAttributeDef($sAttClass, $sAttCode); - foreach($oAttDef->GetOrderBySQLExpressions($sAttClassAlias) as $sSQLExpression) - { + foreach ($oAttDef->GetOrderBySQLExpressions($sAttClassAlias) as $sSQLExpression) { $aOrderSpec[$sSQLExpression] = $bAscending; } - } - else - { + } else { $aOrderSpec['`'.$sAttClassAlias.$sAttCode.'`'] = $bAscending; } // Make sure that the columns used for sorting are present in the loaded columns - if (!is_null($aAttToLoad) && !isset($aAttToLoad[$sAttClassAlias][$sAttCode])) - { + if (!is_null($aAttToLoad) && !isset($aAttToLoad[$sAttClassAlias][$sAttCode])) { $aAttToLoad[$sAttClassAlias][$sAttCode] = MetaModel::GetAttributeDef($sAttClass, $sAttCode); - } + } } $oSQLQuery = $this->GetSQLQuery($aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart, $bGetCount); - if ($this->m_bNoContextParameters) - { + if ($this->m_bNoContextParameters) { // Only internal parameters $aScalarArgs = $this->GetInternalParams(); - } - else - { + } else { // The complete list of arguments will include magic arguments (e.g. current_user->attcode) $aScalarArgs = MetaModel::PrepareQueryArguments($aArgs, $this->GetInternalParams(), $this->GetExpectedArguments()); } - try - { + try { $sRes = $oSQLQuery->RenderSelect($aOrderSpec, $aScalarArgs, $iLimitCount, $iLimitStart, $bGetCount, $bBeautifulSQL); - if ($sClassAlias == '_itop_') - { + if ($sClassAlias == '_itop_') { IssueLog::Info('SQL Query (_itop_): '.$sRes); } - } - catch (MissingQueryArgument $e) - { + } catch (MissingQueryArgument $e) { // Add some information... $e->addInfo('OQL', $this->ToOQL()); throw $e; @@ -1145,39 +1072,37 @@ abstract class DBSearch * * @since 2.7.0 N°2555 */ - public function GetFirstResult($bMustHaveOneResultMax = true, $aOrderBy = array(), $aSearchParams = array()) + public function GetFirstResult($bMustHaveOneResultMax = true, $aOrderBy = [], $aSearchParams = []) { - $oSet = new DBObjectSet($this, array(), $aSearchParams, null, 2); + $oSet = new DBObjectSet($this, [], $aSearchParams, null, 2); $oFirstResult = $oSet->Fetch(); - if ($oFirstResult === null) // useless but here for readability ;) - { + if ($oFirstResult === null) { // useless but here for readability ;) return null; } - if ($bMustHaveOneResultMax) - { + if ($bMustHaveOneResultMax) { $oSecondResult = $oSet->Fetch(); - if ($oSecondResult !== null) - { + if ($oSecondResult !== null) { throw new CoreOqlMultipleResultsForbiddenException( - 'Search returned multiple results, this is forbidden. Query was: '.$this->ToOQL()); + 'Search returned multiple results, this is forbidden. Query was: '.$this->ToOQL() + ); } } return $oFirstResult; } - /** - * @internal - * @return mixed - */ - protected abstract function IsDataFiltered(); + /** + * @internal + * @return mixed + */ + abstract protected function IsDataFiltered(); - /** - * @internal - * @return mixed - */ - protected abstract function SetDataFiltered(); + /** + * @internal + * @return mixed + */ + abstract protected function SetDataFiltered(); /** * @param $aOrderBy @@ -1198,18 +1123,14 @@ abstract class DBSearch protected function GetSQLQuery($aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart, $bGetCount, $aGroupByExpr = null, $aSelectExpr = null) { $oSearch = $this; - if (!$this->IsAllDataAllowed() && !$this->IsDataFiltered()) - { - foreach ($this->GetSelectedClasses() as $sClassAlias => $sClass) - { + if (!$this->IsAllDataAllowed() && !$this->IsDataFiltered()) { + foreach ($this->GetSelectedClasses() as $sClassAlias => $sClass) { $oVisibleObjects = UserRights::GetSelectFilter($sClass, $this->GetModifierProperties('UserRightsGetSelectFilter')); - if ($oVisibleObjects === false) - { + if ($oVisibleObjects === false) { // Make sure this is a valid search object, saying NO for all $oVisibleObjects = DBObjectSearch::FromEmptySet($sClass); } - if (is_object($oVisibleObjects)) - { + if (is_object($oVisibleObjects)) { $oVisibleObjects->AllowAllData(); $oSearch = $oSearch->Filter($sClassAlias, $oVisibleObjects); $oSearch->SetDataFiltered(); @@ -1217,22 +1138,17 @@ abstract class DBSearch } } - if (is_array($aGroupByExpr)) - { - foreach($aGroupByExpr as $sAlias => $oGroupByExp) - { + if (is_array($aGroupByExpr)) { + foreach ($aGroupByExpr as $sAlias => $oGroupByExp) { /** @var \Expression $oGroupByExp */ $aFields = $oGroupByExp->ListRequiredFields(); - foreach($aFields as $sFieldAlias) - { - $aMatches = array(); - if (preg_match('/^([^.]+)\\.([^.]+)$/', $sFieldAlias, $aMatches)) - { + foreach ($aFields as $sFieldAlias) { + $aMatches = []; + if (preg_match('/^([^.]+)\\.([^.]+)$/', $sFieldAlias, $aMatches)) { $sFieldClass = $this->GetClassName($aMatches[1]); $oAttDef = MetaModel::GetAttributeDef($sFieldClass, $aMatches[2]); - if ( $oAttDef instanceof iAttributeNoGroupBy) - { + if ($oAttDef instanceof iAttributeNoGroupBy) { throw new Exception("Grouping on '$sFieldClass' fields is not supported."); } } @@ -1245,56 +1161,59 @@ abstract class DBSearch // Join to an additional table, if required... // - if ($aExtendedDataSpec != null) - { + if ($aExtendedDataSpec != null) { $sTableAlias = '_extended_data_'; - $aExtendedFields = array(); - foreach($aExtendedDataSpec['fields'] as $sColumn) - { + $aExtendedFields = []; + foreach ($aExtendedDataSpec['fields'] as $sColumn) { $sColRef = $this->GetClassAlias().'_extdata_'.$sColumn; $aExtendedFields[$sColRef] = new FieldExpressionResolved($sColumn, $sTableAlias); } $oSQLQueryExt = new SQLObjectQuery($aExtendedDataSpec['table'], $sTableAlias, $aExtendedFields); $oSQLQuery->AddInnerJoin($oSQLQueryExt, 'id', $aExtendedDataSpec['join_key'] /*, $sTableAlias*/); } - + return $oSQLQuery; } - /** - * @internal - * - * @param $aAttToLoad - * @param $bGetCount - * @param null $aGroupByExpr - * @param null $aSelectedClasses - * @param null $aSelectExpr - * - * @return mixed - */ - public abstract function GetSQLQueryStructure( - $aAttToLoad, $bGetCount, $aGroupByExpr = null, $aSelectedClasses = null, $aSelectExpr = null + /** + * @internal + * + * @param $aAttToLoad + * @param $bGetCount + * @param null $aGroupByExpr + * @param null $aSelectedClasses + * @param null $aSelectExpr + * + * @return mixed + */ + abstract public function GetSQLQueryStructure( + $aAttToLoad, + $bGetCount, + $aGroupByExpr = null, + $aSelectedClasses = null, + $aSelectExpr = null ); - /** - * Shortcut to add efficient IN condition - * - * @internal - * - * @param $sFilterCode - * @param $aValues - * @param bool $bPositiveMatch if true a `IN` is performed, if false, a `NOT IN` is performed - * - * @return mixed - */ - public abstract function AddConditionForInOperatorUsingParam($sFilterCode, $aValues, $bPositiveMatch = true); + /** + * Shortcut to add efficient IN condition + * + * @internal + * + * @param $sFilterCode + * @param $aValues + * @param bool $bPositiveMatch if true a `IN` is performed, if false, a `NOT IN` is performed + * + * @return mixed + */ + abstract public function AddConditionForInOperatorUsingParam($sFilterCode, $aValues, $bPositiveMatch = true); /** - * @internal + * @internal * @return string a unique param name */ - protected function GenerateUniqueParamName() { - return str_replace('.', '', 'param_'.microtime(true).rand(0,100)); + protected function GenerateUniqueParamName() + { + return str_replace('.', '', 'param_'.microtime(true).rand(0, 100)); } //////////////////////////////////////////////////////////////////////////// @@ -1303,7 +1222,7 @@ abstract class DBSearch // //////////////////////////////////////////////////////////////////////////// protected static $m_bDebugQuery = false; - protected static $m_aQueriesLog = array(); + protected static $m_aQueriesLog = []; protected static $m_bQueryCacheEnabled = false; protected static $m_bUseAPCCache = false; protected static $m_iQueryCacheTTL = 3600; @@ -1311,30 +1230,30 @@ abstract class DBSearch protected static $m_bIndentQueries = false; protected static $m_bOptimizeQueries = false; - /** - * @internal - */ + /** + * @internal + */ public static function StartDebugQuery() { $aBacktrace = debug_backtrace(); self::$m_bDebugQuery = true; } - /** - * @internal - */ + /** + * @internal + */ public static function StopDebugQuery() { self::$m_bDebugQuery = false; } - /** - * @internal - * - * @param bool $bEnabled - * @param bool $bUseAPC - * @param int $iTimeToLive - */ + /** + * @internal + * + * @param bool $bEnabled + * @param bool $bUseAPC + * @param int $iTimeToLive + */ public static function EnableQueryCache($bEnabled, $bUseAPC, $iTimeToLive = 3600) { self::$m_bQueryCacheEnabled = $bEnabled; @@ -1342,28 +1261,28 @@ abstract class DBSearch self::$m_iQueryCacheTTL = $iTimeToLive; } - /** - * @internal - * @param $bEnabled - */ + /** + * @internal + * @param $bEnabled + */ public static function EnableQueryTrace($bEnabled) { self::$m_bTraceQueries = $bEnabled; } - /** - * @internal - * @param $bEnabled - */ + /** + * @internal + * @param $bEnabled + */ public static function EnableQueryIndentation($bEnabled) { self::$m_bIndentQueries = $bEnabled; } - /** - * @internal - * @param $bEnabled - */ + /** + * @internal + * @param $bEnabled + */ public static function EnableOptimizeQuery($bEnabled) { self::$m_bOptimizeQueries = $bEnabled; @@ -1387,46 +1306,39 @@ abstract class DBSearch */ protected function AddQueryTraceSelect($sOql, $aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart, $bGetCount, $sSql) { - if (self::$m_bTraceQueries) - { - $aQueryData = array( + if (self::$m_bTraceQueries) { + $aQueryData = [ 'type' => 'select', 'order_by' => $aOrderBy, 'att_to_load' => $aAttToLoad, 'limit_count' => $iLimitCount, 'limit_start' => $iLimitStart, - 'is_count' => $bGetCount - ); + 'is_count' => $bGetCount, + ]; DBSearch::EnableQueryTrace(false); $aQueryData['oql'] = $this->ToOQL(true, $aArgs); DBSearch::EnableQueryTrace(true); - if (!empty($aAttToLoad)) - { - $aAttToLoadNames = array(); - foreach ($aAttToLoad as $sClass => $aAttributes) - { - $aAttToLoadNames[$sClass] = array(); - foreach ($aAttributes as $sAttCode => $oAttDef) - { + if (!empty($aAttToLoad)) { + $aAttToLoadNames = []; + foreach ($aAttToLoad as $sClass => $aAttributes) { + $aAttToLoadNames[$sClass] = []; + foreach ($aAttributes as $sAttCode => $oAttDef) { $aAttToLoadNames[$sClass][] = $sAttCode; } } - } - else - { + } else { $aAttToLoadNames = null; } $aQueryData['att_to_load'] = $aAttToLoadNames; $hLogFile = @fopen(APPROOT.'log/oql_records.txt', 'a'); - if ($hLogFile !== false) - { - flock($hLogFile,LOCK_EX); - fwrite($hLogFile,serialize($aQueryData)."\n"); + if ($hLogFile !== false) { + flock($hLogFile, LOCK_EX); + fwrite($hLogFile, serialize($aQueryData)."\n"); fflush($hLogFile); - flock($hLogFile,LOCK_UN); + flock($hLogFile, LOCK_UN); fclose($hLogFile); } } @@ -1450,9 +1362,8 @@ abstract class DBSearch */ protected function AddQueryTraceGroupBy($aArgs, $aGroupByExpr, $bExcludeNullValues, $aSelectExpr, $aOrderBy, $iLimitCount, $iLimitStart, $sSql) { - if (self::$m_bTraceQueries) - { - $aQueryData = array( + if (self::$m_bTraceQueries) { + $aQueryData = [ 'type' => 'group_by', 'order_by' => $aOrderBy, 'group_by_expr' => $aGroupByExpr, @@ -1460,89 +1371,77 @@ abstract class DBSearch 'select_expr' => $aSelectExpr, 'limit_count' => $iLimitCount, 'limit_start' => $iLimitStart, - ); + ]; $aQueryData['oql'] = $this->ToOQL(true, $aArgs); $aQueryData['group_by_expr'] = Expression::ConvertArrayToOQL($aQueryData['group_by_expr'], $aArgs); $aQueryData['select_expr'] = Expression::ConvertArrayToOQL($aQueryData['select_expr'], $aArgs); $hLogFile = @fopen(APPROOT.'log/oql_group_by_records.txt', 'a'); - if ($hLogFile !== false) - { - flock($hLogFile,LOCK_EX); - fwrite($hLogFile,serialize($aQueryData)."\n"); + if ($hLogFile !== false) { + flock($hLogFile, LOCK_EX); + fwrite($hLogFile, serialize($aQueryData)."\n"); fflush($hLogFile); - flock($hLogFile,LOCK_UN); + flock($hLogFile, LOCK_UN); fclose($hLogFile); } } } - /** - * @internal - * - * @param $aQueryData - * @param $sOql - * @param $sSql - * - * @throws MySQLException - */ + /** + * @internal + * + * @param $aQueryData + * @param $sOql + * @param $sSql + * + * @throws MySQLException + */ protected static function AddQueryTrace($aQueryData, $sOql, $sSql) { - if (self::$m_bTraceQueries) - { + if (self::$m_bTraceQueries) { $sQueryId = md5(serialize($aQueryData)); $sMySQLQueryId = md5($sSql); - if(!isset(self::$m_aQueriesLog[$sQueryId])) - { + if (!isset(self::$m_aQueriesLog[$sQueryId])) { self::$m_aQueriesLog[$sQueryId]['data'] = serialize($aQueryData); self::$m_aQueriesLog[$sQueryId]['oql'] = $sOql; self::$m_aQueriesLog[$sQueryId]['hits'] = 1; - } - else - { + } else { self::$m_aQueriesLog[$sQueryId]['hits']++; } - if(!isset(self::$m_aQueriesLog[$sQueryId]['queries'][$sMySQLQueryId])) - { + if (!isset(self::$m_aQueriesLog[$sQueryId]['queries'][$sMySQLQueryId])) { self::$m_aQueriesLog[$sQueryId]['queries'][$sMySQLQueryId]['sql'] = $sSql; self::$m_aQueriesLog[$sQueryId]['queries'][$sMySQLQueryId]['count'] = 1; $iTableCount = count(CMDBSource::ExplainQuery($sSql)); self::$m_aQueriesLog[$sQueryId]['queries'][$sMySQLQueryId]['table_count'] = $iTableCount; - } - else - { + } else { self::$m_aQueriesLog[$sQueryId]['queries'][$sMySQLQueryId]['count']++; } } } - /** - * @internal - */ + /** + * @internal + */ public static function RecordQueryTrace() { - if (!self::$m_bTraceQueries) - { + if (!self::$m_bTraceQueries) { return; } $iOqlCount = count(self::$m_aQueriesLog); $iSqlCount = 0; - foreach (self::$m_aQueriesLog as $sQueryId => $aOqlData) - { + foreach (self::$m_aQueriesLog as $sQueryId => $aOqlData) { $iSqlCount += $aOqlData['hits']; } $sHtml = "

        Stats on SELECT queries: OQL=$iOqlCount, SQL=$iSqlCount

        \n"; - foreach (self::$m_aQueriesLog as $sQueryId => $aOqlData) - { + foreach (self::$m_aQueriesLog as $sQueryId => $aOqlData) { $sOql = $aOqlData['oql']; $sHits = $aOqlData['hits']; $sHtml .= "

        $sHits hits for OQL query: $sOql

        \n"; $sHtml .= "
          \n"; - foreach($aOqlData['queries'] as $aSqlData) - { + foreach ($aOqlData['queries'] as $aSqlData) { $sQuery = $aSqlData['sql']; $sSqlHits = $aSqlData['count']; $iTableCount = $aSqlData['table_count']; @@ -1559,60 +1458,49 @@ abstract class DBSearch // Cumulate the queries $sAllQueries = APPROOT.'data/queries.log'; - if (file_exists($sAllQueries)) - { + if (file_exists($sAllQueries)) { // Merge the new queries into the existing log include($sAllQueries); - $aQueriesLog = array(); - foreach (self::$m_aQueriesLog as $sQueryId => $aOqlData) - { - if (!array_key_exists($sQueryId, $aQueriesLog)) - { + $aQueriesLog = []; + foreach (self::$m_aQueriesLog as $sQueryId => $aOqlData) { + if (!array_key_exists($sQueryId, $aQueriesLog)) { $aQueriesLog[$sQueryId] = $aOqlData; } } - } - else - { + } else { $aQueriesLog = self::$m_aQueriesLog; } $sLog = "".$aBacktrace[1]["function"].""; - if (is_object($value)) - { + if (is_object($value)) { echo "$sIndent$sFunction:\n
          \n";
           			print_r($value);
           			echo "
          \n"; - } - else - { + } else { echo "$sIndent$sFunction: $value
          \n"; } } @@ -1630,63 +1518,49 @@ abstract class DBSearch public function DBBulkWriteArchiveFlag($bArchive) { $sClass = $this->GetClass(); - if (!MetaModel::IsArchivable($sClass)) - { + if (!MetaModel::IsArchivable($sClass)) { throw new Exception($sClass.' is not an archivable class'); } $iFlag = $bArchive ? 1 : 0; $oSet = new DBObjectSet($this); - if (MetaModel::IsStandaloneClass($sClass)) - { - $oSet->OptimizeColumnLoad(array($this->GetClassAlias() => array())); - $aIds = array($sClass => $oSet->GetColumnAsArray('id')); - } - else - { - $oSet->OptimizeColumnLoad(array($this->GetClassAlias() => array('finalclass'))); + if (MetaModel::IsStandaloneClass($sClass)) { + $oSet->OptimizeColumnLoad([$this->GetClassAlias() => []]); + $aIds = [$sClass => $oSet->GetColumnAsArray('id')]; + } else { + $oSet->OptimizeColumnLoad([$this->GetClassAlias() => ['finalclass']]); $aTemp = $oSet->GetColumnAsArray('finalclass'); - $aIds = array(); - foreach ($aTemp as $iObjectId => $sObjectClass) - { + $aIds = []; + foreach ($aTemp as $iObjectId => $sObjectClass) { $aIds[$sObjectClass][$iObjectId] = $iObjectId; } } - foreach ($aIds as $sFinalClass => $aObjectIds) - { + foreach ($aIds as $sFinalClass => $aObjectIds) { $sIds = implode(', ', $aObjectIds); $sArchiveRoot = MetaModel::GetAttributeOrigin($sFinalClass, 'archive_flag'); $sRootTable = MetaModel::DBGetTable($sArchiveRoot); $sRootKey = MetaModel::DBGetKey($sArchiveRoot); - $aJoins = array("`$sRootTable`"); - $aUpdates = array(); - foreach (MetaModel::EnumParentClasses($sFinalClass, ENUM_PARENT_CLASSES_ALL) as $sParentClass) - { - if (!MetaModel::IsValidAttCode($sParentClass, 'archive_flag')) - { + $aJoins = ["`$sRootTable`"]; + $aUpdates = []; + foreach (MetaModel::EnumParentClasses($sFinalClass, ENUM_PARENT_CLASSES_ALL) as $sParentClass) { + if (!MetaModel::IsValidAttCode($sParentClass, 'archive_flag')) { continue; } $sTable = MetaModel::DBGetTable($sParentClass); $aUpdates[] = "`$sTable`.`archive_flag` = $iFlag"; - if ($sParentClass == $sArchiveRoot) - { - if ($bArchive) - { + if ($sParentClass == $sArchiveRoot) { + if ($bArchive) { // Set the date (do not change it) $sDate = '"'.date(AttributeDate::GetSQLFormat()).'"'; $aUpdates[] = "`$sTable`.`archive_date` = coalesce(`$sTable`.`archive_date`, $sDate)"; - } - else - { + } else { // Reset the date $aUpdates[] = "`$sTable`.`archive_date` = null"; } - } - else - { + } else { $sKey = MetaModel::DBGetKey($sParentClass); $aJoins[] = "`$sTable` ON `$sTable`.`$sKey` = `$sRootTable`.`$sRootKey`"; } @@ -1698,9 +1572,9 @@ abstract class DBSearch } } - /** - * @internal - */ + /** + * @internal + */ public function UpdateContextFromUser() { $this->SetShowObsoleteData(utils::ShowObsoleteData()); @@ -1733,5 +1607,5 @@ abstract class DBSearch * * @return array{\VariableExpression} */ - abstract function GetExpectedArguments(): array; + abstract public function GetExpectedArguments(): array; } diff --git a/core/dbunionsearch.class.php b/core/dbunionsearch.class.php index 7f4b16d6b..8d8d73684 100644 --- a/core/dbunionsearch.class.php +++ b/core/dbunionsearch.class.php @@ -1,4 +1,5 @@ classes (lowest common ancestors) computed at construction protected $aColumnToAliases; - /** - * DBUnionSearch constructor. - * - * @api - * - * @param $aSearches - * - * @throws CoreException - */ + /** + * DBUnionSearch constructor. + * + * @api + * + * @param $aSearches + * + * @throws CoreException + */ public function __construct($aSearches) { - if (count ($aSearches) == 0) - { + if (count($aSearches) == 0) { throw new CoreException('A DBUnionSearch must be made of at least one search'); } - $this->aSearches = array(); - foreach ($aSearches as $oSearch) - { - if ($oSearch instanceof DBUnionSearch) - { - foreach ($oSearch->aSearches as $oSubSearch) - { + $this->aSearches = []; + foreach ($aSearches as $oSearch) { + if ($oSearch instanceof DBUnionSearch) { + foreach ($oSearch->aSearches as $oSubSearch) { $this->aSearches[] = $oSubSearch->DeepClone(); } } else { @@ -69,15 +66,16 @@ class DBUnionSearch extends DBSearch public function IsAllDataAllowed() { foreach ($this->aSearches as $oSearch) { - if ($oSearch->IsAllDataAllowed() === false) return false; + if ($oSearch->IsAllDataAllowed() === false) { + return false; + } } return true; } public function SetArchiveMode($bEnable) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->SetArchiveMode($bEnable); } parent::SetArchiveMode($bEnable); @@ -85,8 +83,7 @@ class DBUnionSearch extends DBSearch public function SetShowObsoleteData($bShow) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->SetShowObsoleteData($bShow); } parent::SetShowObsoleteData($bShow); @@ -102,31 +99,25 @@ class DBUnionSearch extends DBSearch // 1 - Collect all the column/classes $aColumnToClasses = []; $this->aColumnToAliases = []; - foreach ($this->aSearches as $iPos => $oSearch) - { + foreach ($this->aSearches as $iPos => $oSearch) { $aSelected = array_values($oSearch->GetSelectedClasses()); - if ($iPos != 0) - { - if (count($aSelected) < count($aColumnToClasses)) - { - throw new Exception('Too few selected classes in the subquery #'.($iPos+1)); + if ($iPos != 0) { + if (count($aSelected) < count($aColumnToClasses)) { + throw new Exception('Too few selected classes in the subquery #'.($iPos + 1)); } - if (count($aSelected) > count($aColumnToClasses)) - { - throw new Exception('Too many selected classes in the subquery #'.($iPos+1)); + if (count($aSelected) > count($aColumnToClasses)) { + throw new Exception('Too many selected classes in the subquery #'.($iPos + 1)); } } - foreach ($aSelected as $iColumn => $sClass) - { + foreach ($aSelected as $iColumn => $sClass) { $aColumnToClasses[$iColumn][$iPos] = $sClass; } // Store the aliases by column to map them later (the first query impose the aliases) $aAliases = array_keys($oSearch->GetSelectedClasses()); - foreach ($aAliases as $iColumn => $sAlias) - { + foreach ($aAliases as $iColumn => $sAlias) { $this->aColumnToAliases[$iColumn][$iPos] = $sAlias; } } @@ -137,13 +128,11 @@ class DBUnionSearch extends DBSearch // 3 - Compute alias => lowest common ancestor $this->aSelectedClasses = []; - foreach ($aColumnToClasses as $iColumn => $aClasses) - { + foreach ($aColumnToClasses as $iColumn => $aClasses) { $sAlias = $aColumnToAlias[$iColumn]; $sAncestor = MetaModel::GetLowestCommonAncestor($aClasses); - if (is_null($sAncestor)) - { - throw new Exception('Could not find a common ancestor for the column '.($iColumn+1).' (Classes: '.implode(', ', $aClasses).')'); + if (is_null($sAncestor)) { + throw new Exception('Could not find a common ancestor for the column '.($iColumn + 1).' (Classes: '.implode(', ', $aClasses).')'); } $this->aSelectedClasses[$sAlias] = $sAncestor; } @@ -164,12 +153,9 @@ class DBUnionSearch extends DBSearch */ public function GetClassName($sAlias) { - if (array_key_exists($sAlias, $this->aSelectedClasses)) - { + if (array_key_exists($sAlias, $this->aSelectedClasses)) { return $this->aSelectedClasses[$sAlias]; - } - else - { + } else { throw new CoreException("Invalid class alias '$sAlias'"); } } @@ -185,20 +171,16 @@ class DBUnionSearch extends DBSearch return key($this->aSelectedClasses); } - /** * Change the class (only subclasses are supported as of now, because the conditions must fit the new class) * Defaults to the first selected class * Only the selected classes can be changed - */ + */ public function ChangeClass($sNewClass, $sAlias = null) { - if (is_null($sAlias)) - { + if (is_null($sAlias)) { $sAlias = $this->GetClassAlias(); - } - elseif (!array_key_exists($sAlias, $this->aSelectedClasses)) - { + } elseif (!array_key_exists($sAlias, $this->aSelectedClasses)) { // discard silently - necessary when recursing (??? copied from DBObjectSearch) return; } @@ -207,8 +189,7 @@ class DBUnionSearch extends DBSearch $iColumn = array_search($sAlias, array_keys($this->aSelectedClasses)); // 2 - change for each search - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $aSearchAliases = array_keys($oSearch->GetSelectedClasses()); $sSearchAlias = $aSearchAliases[$iColumn]; $oSearch->ChangeClass($sNewClass, $sSearchAlias); @@ -279,38 +260,31 @@ class DBUnionSearch extends DBSearch public function RenameAlias($sOldName, $sNewName) { $bRet = false; - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $bRet = $oSearch->RenameAlias($sOldName, $sNewName) || $bRet; } return $bRet; } - public function RenameAliasesInNameSpace($aClassAliases, $aAliasTranslation = array()) + public function RenameAliasesInNameSpace($aClassAliases, $aAliasTranslation = []) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->RenameAliasesInNameSpace($aClassAliases, $aAliasTranslation); } } public function TranslateConditions($aTranslationData, $bMatchAll = true, $bMarkFieldsAsResolved = true) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->TranslateConditions($aTranslationData, $bMatchAll, $bMarkFieldsAsResolved); } } - - public function IsAny() { $bIsAny = true; - foreach ($this->aSearches as $oSearch) - { - if (!$oSearch->IsAny()) - { + foreach ($this->aSearches as $oSearch) { + if (!$oSearch->IsAny()) { $bIsAny = false; break; } @@ -320,8 +294,7 @@ class DBUnionSearch extends DBSearch public function ResetCondition() { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->ResetCondition(); } } @@ -329,13 +302,10 @@ class DBUnionSearch extends DBSearch public function MergeConditionExpression($oExpression) { $aAliases = array_keys($this->aSelectedClasses); - foreach ($this->aSearches as $iSearchIndex => $oSearch) - { + foreach ($this->aSearches as $iSearchIndex => $oSearch) { $oClonedExpression = $oExpression->DeepClone(); - if ($iSearchIndex != 0) - { - foreach (array_keys($oSearch->GetSelectedClasses()) as $iColumn => $sSearchAlias) - { + if ($iSearchIndex != 0) { + foreach (array_keys($oSearch->GetSelectedClasses()) as $iColumn => $sSearchAlias) { $oClonedExpression->RenameAlias($aAliases[$iColumn], $sSearchAlias); } } @@ -346,13 +316,10 @@ class DBUnionSearch extends DBSearch public function AddConditionExpression($oExpression) { $aAliases = array_keys($this->aSelectedClasses); - foreach ($this->aSearches as $iSearchIndex => $oSearch) - { + foreach ($this->aSearches as $iSearchIndex => $oSearch) { $oClonedExpression = $oExpression->DeepClone(); - if ($iSearchIndex != 0) - { - foreach (array_keys($oSearch->GetSelectedClasses()) as $iColumn => $sSearchAlias) - { + if ($iSearchIndex != 0) { + foreach (array_keys($oSearch->GetSelectedClasses()) as $iColumn => $sSearchAlias) { $oClonedExpression->RenameAlias($aAliases[$iColumn], $sSearchAlias); } } @@ -360,18 +327,16 @@ class DBUnionSearch extends DBSearch } } - public function AddNameCondition($sName) + public function AddNameCondition($sName) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->AddNameCondition($sName); } } public function AddCondition($sFilterCode, $value, $sOpCode = null) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->AddCondition($sFilterCode, $value, $sOpCode); } } @@ -379,35 +344,32 @@ class DBUnionSearch extends DBSearch /** * Specify a condition on external keys or link sets * @param String sAttSpec Can be either an attribute code or extkey->[sAttSpec] or linkset->[sAttSpec] and so on, recursively - * Example: infra_list->ci_id->location_id->country + * Example: infra_list->ci_id->location_id->country * @param Object value The value to match (can be an array => IN(val1, val2...) * @return void */ public function AddConditionAdvanced($sAttSpec, $value) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->AddConditionAdvanced($sAttSpec, $value); } } public function AddCondition_FullText($sFullText) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->AddCondition_FullText($sFullText); } } public function AddCondition_FullTextOnAttributes(array $aAttCodes, $sNeedle) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->AddCondition_FullTextOnAttributes($aAttCodes, $sNeedle); } } - /** + /** * @param DBObjectSearch $oFilter * @param $sExtKeyAttCode * @param int $iOperatorCode @@ -415,8 +377,7 @@ class DBUnionSearch extends DBSearch */ public function AddCondition_PointingTo(DBObjectSearch $oFilter, $sExtKeyAttCode, $iOperatorCode = TREE_OPERATOR_EQUALS, &$aRealiasingMap = null) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oConditionFilter = $oFilter->DeepClone(); $oSearch->AddCondition_PointingTo($oConditionFilter, $sExtKeyAttCode, $iOperatorCode, $aRealiasingMap); } @@ -430,8 +391,7 @@ class DBUnionSearch extends DBSearch */ public function AddCondition_ReferencedBy(DBObjectSearch $oFilter, $sForeignExtKeyAttCode, $iOperatorCode = TREE_OPERATOR_EQUALS, &$aRealiasingMap = null) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oConditionFilter = $oFilter->DeepClone(); $oSearch->AddCondition_ReferencedBy($oConditionFilter, $sForeignExtKeyAttCode, $iOperatorCode, $aRealiasingMap); } @@ -439,9 +399,8 @@ class DBUnionSearch extends DBSearch public function Filter($sClassAlias, DBSearch $oFilter) { - $aSearches = array(); - foreach ($this->aSearches as $oSearch) - { + $aSearches = []; + foreach ($this->aSearches as $oSearch) { if (!$oSearch->IsAllDataAllowed()) { $aSearches[] = $oSearch->Filter($sClassAlias, $oFilter); } else { @@ -453,9 +412,8 @@ class DBUnionSearch extends DBSearch public function Intersect(DBSearch $oFilter) { - $aSearches = array(); - foreach ($this->aSearches as $oSearch) - { + $aSearches = []; + foreach ($this->aSearches as $oSearch) { $aSearches[] = $oSearch->Intersect($oFilter); } return new DBUnionSearch($aSearches); @@ -463,17 +421,15 @@ class DBUnionSearch extends DBSearch public function SetInternalParams($aParams) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->SetInternalParams($aParams); } } public function GetInternalParams() { - $aParams = array(); - foreach ($this->aSearches as $oSearch) - { + $aParams = []; + foreach ($this->aSearches as $oSearch) { $aParams = array_merge($oSearch->GetInternalParams(), $aParams); } return $aParams; @@ -481,9 +437,8 @@ class DBUnionSearch extends DBSearch public function GetQueryParams($bExcludeMagicParams = true) { - $aParams = array(); - foreach ($this->aSearches as $oSearch) - { + $aParams = []; + foreach ($this->aSearches as $oSearch) { $aParams = array_merge($oSearch->GetQueryParams($bExcludeMagicParams), $aParams); } return $aParams; @@ -492,7 +447,7 @@ class DBUnionSearch extends DBSearch public function ListConstantFields() { // Somewhat complex to implement for unions, for a poor benefit - return array(); + return []; } /** @@ -501,20 +456,18 @@ class DBUnionSearch extends DBSearch */ public function ApplyParameters($aArgs) { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->ApplyParameters($aArgs); } } /** * Overloads for query building - */ + */ public function ToOQL($bDevelopParams = false, $aContextParams = null, $bWithAllowAllFlag = false) { - $aSubQueries = array(); - foreach ($this->aSearches as $oSearch) - { + $aSubQueries = []; + foreach ($this->aSearches as $oSearch) { $aSubQueries[] = $oSearch->ToOQL($bDevelopParams, $aContextParams, $bWithAllowAllFlag); } $sRet = implode(' UNION ', $aSubQueries); @@ -527,9 +480,8 @@ class DBUnionSearch extends DBSearch */ public function ToJSON() { - $sRet = array('unions' => array()); - foreach ($this->aSearches as $oSearch) - { + $sRet = ['unions' => []]; + foreach ($this->aSearches as $oSearch) { $sRet['unions'][] = $oSearch->ToJSON(); } return $sRet; @@ -543,21 +495,19 @@ class DBUnionSearch extends DBSearch */ public function RemoveDuplicateQueries() { - $aQueries = array(); - $aSearches = array(); + $aQueries = []; + $aSearches = []; - foreach ($this->GetSearches() as $oTmpSearch) - { + foreach ($this->GetSearches() as $oTmpSearch) { $sQuery = $oTmpSearch->ToOQL(true); - if (!in_array($sQuery, $aQueries)) - { + if (!in_array($sQuery, $aQueries)) { $aQueries[] = $sQuery; $aSearches[] = $oTmpSearch; } } $oNewSearch = new DBUnionSearch($aSearches); - + return $oNewSearch; } @@ -567,60 +517,49 @@ class DBUnionSearch extends DBSearch // //////////////////////////////////////////////////////////////////////////// - public function MakeDeleteQuery($aArgs = array()) + public function MakeDeleteQuery($aArgs = []) { throw new Exception('MakeDeleteQuery is not implemented for the unions!'); } - public function MakeUpdateQuery($aValues, $aArgs = array()) + public function MakeUpdateQuery($aValues, $aArgs = []) { throw new Exception('MakeUpdateQuery is not implemented for the unions!'); } public function GetSQLQueryStructure($aAttToLoad, $bGetCount, $aGroupByExpr = null, $aSelectedClasses = null, $aSelectExpr = null) { - if (count($this->aSearches) == 1) - { + if (count($this->aSearches) == 1) { return $this->aSearches[0]->GetSQLQueryStructure($aAttToLoad, $bGetCount, $aGroupByExpr, $aSelectedClasses, $aSelectExpr); } - $aSQLQueries = array(); + $aSQLQueries = []; $aAliases = array_keys($this->aSelectedClasses); $aQueryAttToLoad = null; - $aUnionQuerySelectExpr = array(); - foreach ($this->aSearches as $iSearch => $oSearch) - { + $aUnionQuerySelectExpr = []; + foreach ($this->aSearches as $iSearch => $oSearch) { $aSearchAliases = array_keys($oSearch->GetSelectedClasses()); // The selected classes from the query build perspective are the lowest common ancestors amongst the various queries // (used when it comes to determine which attributes must be selected) - $aSearchSelectedClasses = array(); - foreach ($aSearchAliases as $iColumn => $sSearchAlias) - { + $aSearchSelectedClasses = []; + foreach ($aSearchAliases as $iColumn => $sSearchAlias) { $sAlias = $aAliases[$iColumn]; $aSearchSelectedClasses[$sSearchAlias] = $this->aSelectedClasses[$sAlias]; } - if ($bGetCount) - { + if ($bGetCount) { // Select only ids for the count to allow optimization of joins - foreach($aSearchAliases as $sSearchAlias) - { - $aQueryAttToLoad[$sSearchAlias] = array(); + foreach ($aSearchAliases as $sSearchAlias) { + $aQueryAttToLoad[$sSearchAlias] = []; } - } - else - { - if (is_null($aAttToLoad)) - { + } else { + if (is_null($aAttToLoad)) { $aQueryAttToLoad = null; - } - else - { + } else { // (Eventually) Transform the aliases - $aQueryAttToLoad = array(); - foreach($aAttToLoad as $sAlias => $aAttributes) - { + $aQueryAttToLoad = []; + foreach ($aAttToLoad as $sAlias => $aAttributes) { $iColumn = array_search($sAlias, $aAliases); $sQueryAlias = ($iColumn === false) ? $sAlias : $aSearchAliases[$iColumn]; $aQueryAttToLoad[$sQueryAlias] = $aAttributes; @@ -628,66 +567,51 @@ class DBUnionSearch extends DBSearch } } - if (is_null($aGroupByExpr)) - { + if (is_null($aGroupByExpr)) { $aQueryGroupByExpr = null; - } - else - { + } else { // Clone (and eventually transform) the group by expressions - $aQueryGroupByExpr = array(); - $aTranslationData = array(); + $aQueryGroupByExpr = []; + $aTranslationData = []; $aQueryColumns = array_keys($oSearch->GetSelectedClasses()); - foreach ($aAliases as $iColumn => $sAlias) - { + foreach ($aAliases as $iColumn => $sAlias) { $sQueryAlias = $aQueryColumns[$iColumn]; $aTranslationData[$sAlias]['*'] = $sQueryAlias; $aQueryGroupByExpr[$sAlias.'id'] = new FieldExpression('id', $sQueryAlias); } - foreach ($aGroupByExpr as $sExpressionAlias => $oExpression) - { + foreach ($aGroupByExpr as $sExpressionAlias => $oExpression) { $aQueryGroupByExpr[$sExpressionAlias] = $oExpression->Translate($aTranslationData, false, false); } } - if (is_null($aSelectExpr)) - { + if (is_null($aSelectExpr)) { $aQuerySelectExpr = null; - } - else - { - $aQuerySelectExpr = array(); - $aTranslationData = array(); + } else { + $aQuerySelectExpr = []; + $aTranslationData = []; $aQueryColumns = array_keys($oSearch->GetSelectedClasses()); - foreach($aAliases as $iColumn => $sAlias) - { + foreach ($aAliases as $iColumn => $sAlias) { $sQueryAlias = $aQueryColumns[$iColumn]; $aTranslationData[$sAlias]['*'] = $sQueryAlias; } - foreach($aSelectExpr as $sExpressionAlias => $oExpression) - { - $oExpression->Browse(function ($oNode) use (&$aQuerySelectExpr, &$aTranslationData) - { - if ($oNode instanceof FieldExpression) - { + foreach ($aSelectExpr as $sExpressionAlias => $oExpression) { + $oExpression->Browse(function ($oNode) use (&$aQuerySelectExpr, &$aTranslationData) { + if ($oNode instanceof FieldExpression) { $sAlias = $oNode->GetParent()."__".$oNode->GetName(); - if (!key_exists($sAlias, $aQuerySelectExpr)) - { + if (!key_exists($sAlias, $aQuerySelectExpr)) { $aQuerySelectExpr[$sAlias] = $oNode->Translate($aTranslationData, false, false); } $aTranslationData[$oNode->GetParent()][$oNode->GetName()] = new FieldExpression($sAlias); } }); // Only done for the first select as aliases are named after the first query - if (!array_key_exists($sExpressionAlias, $aUnionQuerySelectExpr)) - { + if (!array_key_exists($sExpressionAlias, $aUnionQuerySelectExpr)) { $aUnionQuerySelectExpr[$sExpressionAlias] = $oExpression->Translate($aTranslationData, false, false); } } } $oSubQuery = $oSearch->GetSQLQueryStructure($aQueryAttToLoad, false, $aQueryGroupByExpr, $aSearchSelectedClasses, $aQuerySelectExpr); - if (count($aSearchAliases) > 1) - { + if (count($aSearchAliases) > 1) { // Necessary to make sure that selected columns will match throughout all the queries // (default order of selected fields depending on the order of JOINS) $oSubQuery->SortSelectedFields(); @@ -698,17 +622,17 @@ class DBUnionSearch extends DBSearch $oSQLQuery = new SQLUnionQuery($aSQLQueries, $aGroupByExpr, $aUnionQuerySelectExpr); //MyHelpers::var_dump_html($oSQLQuery, true); //MyHelpers::var_dump_html($oSQLQuery->RenderSelect(), true); - if (self::$m_bDebugQuery) $oSQLQuery->DisplayHtml(); + if (self::$m_bDebugQuery) { + $oSQLQuery->DisplayHtml(); + } return $oSQLQuery; } protected function IsDataFiltered() { $bIsAllDataFiltered = true; - foreach ($this->aSearches as $oSearch) - { - if (!$oSearch->IsDataFiltered()) - { + foreach ($this->aSearches as $oSearch) { + if (!$oSearch->IsDataFiltered()) { $bIsAllDataFiltered = false; break; } @@ -718,19 +642,15 @@ class DBUnionSearch extends DBSearch protected function SetDataFiltered() { - foreach ($this->aSearches as $oSearch) - { + foreach ($this->aSearches as $oSearch) { $oSearch->SetDataFiltered(); } } - - public function AddConditionForInOperatorUsingParam($sFilterCode, $aValues, $bPositiveMatch = true) { $sInParamName = $this->GenerateUniqueParamName(); - foreach ($this->aSearches as $iSearchIndex => $oSearch) - { + foreach ($this->aSearches as $iSearchIndex => $oSearch) { $oFieldExpression = new FieldExpression($sFilterCode, $oSearch->GetClassAlias()); $sOperator = $bPositiveMatch ? 'IN' : 'NOT IN'; @@ -738,17 +658,16 @@ class DBUnionSearch extends DBSearch $oParamExpression = new VariableExpression($sInParamName); $oSearch->GetInternalParamsByRef()[$sInParamName] = $aValues; - $oListExpression = new ListExpression(array($oParamExpression)); + $oListExpression = new ListExpression([$oParamExpression]); $oInCondition = new BinaryExpression($oFieldExpression, $sOperator, $oListExpression); $oSearch->AddConditionExpression($oInCondition); } } - function GetExpectedArguments(): array + public function GetExpectedArguments(): array { - $aVariableCriteria = array(); - foreach ($this->aSearches as $oSearch) - { + $aVariableCriteria = []; + foreach ($this->aSearches as $oSearch) { $aVariableCriteria = array_merge($aVariableCriteria, $oSearch->GetExpectedArguments()); } diff --git a/core/deletionplan.class.inc.php b/core/deletionplan.class.inc.php index 493e0a1c8..fa12655e3 100644 --- a/core/deletionplan.class.inc.php +++ b/core/deletionplan.class.inc.php @@ -1,4 +1,5 @@ array( + protected static $m_aModeUpdate = [ + DEL_SILENT => [ DEL_SILENT => DEL_SILENT, DEL_AUTO => DEL_AUTO, - DEL_MANUAL => DEL_MANUAL - ), - DEL_MANUAL => array( + DEL_MANUAL => DEL_MANUAL, + ], + DEL_MANUAL => [ DEL_SILENT => DEL_MANUAL, DEL_AUTO => DEL_AUTO, - DEL_MANUAL => DEL_MANUAL - ), - DEL_AUTO => array( + DEL_MANUAL => DEL_MANUAL, + ], + DEL_AUTO => [ DEL_SILENT => DEL_AUTO, DEL_AUTO => DEL_AUTO, - DEL_MANUAL => DEL_AUTO - ) - ); + DEL_MANUAL => DEL_AUTO, + ], + ]; public function __construct() { $this->m_iToDelete = 0; $this->m_iToUpdate = 0; - $this->m_aToDelete = array(); - $this->m_aToUpdate = array(); + $this->m_aToDelete = []; + $this->m_aToUpdate = []; $this->m_bFoundStopper = false; $this->m_bFoundSecurityIssue = false; @@ -65,22 +66,17 @@ class DeletionPlan $this->m_iToDelete = 0; $this->m_iToUpdate = 0; - foreach($this->m_aToDelete as $sClass => $aToDelete) - { - foreach($aToDelete as $iId => $aData) - { + foreach ($this->m_aToDelete as $sClass => $aToDelete) { + foreach ($aToDelete as $iId => $aData) { $this->m_iToDelete++; - if (isset($aData['issue'])) - { + if (isset($aData['issue'])) { $this->m_bFoundStopper = true; $this->m_bFoundManualOperation = true; - if (isset($aData['issue_security'])) - { + if (isset($aData['issue_security'])) { $this->m_bFoundSecurityIssue = true; } } - if ($aData['mode'] == DEL_MANUAL) - { + if ($aData['mode'] == DEL_MANUAL) { $this->m_aToDelete[$sClass][$iId]['issue'] = $sClass.'::'.$iId.' '.Dict::S('UI:Delete:MustBeDeletedManually'); $this->m_bFoundStopper = true; $this->m_bFoundManualDelete = true; @@ -92,30 +88,25 @@ class DeletionPlan // www.php.net/manual/fr/function.set-time-limit.php#72305 $iPreviousTimeLimit = ini_get('max_execution_time'); $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop'); - foreach($this->m_aToUpdate as $sClass => $aToUpdate) - { - foreach($aToUpdate as $iId => $aData) - { + foreach ($this->m_aToUpdate as $sClass => $aToUpdate) { + foreach ($aToUpdate as $iId => $aData) { set_time_limit(intval($iLoopTimeLimit)); $this->m_iToUpdate++; $oObject = $aData['to_reset']; - $aExtKeyLabels = array(); - foreach ($aData['attributes'] as $sRemoteExtKey => $aRemoteAttDef) - { + $aExtKeyLabels = []; + foreach ($aData['attributes'] as $sRemoteExtKey => $aRemoteAttDef) { $oObject->Set($sRemoteExtKey, $aData['values'][$sRemoteExtKey]); $aExtKeyLabels[] = $aRemoteAttDef->GetLabel(); } - $this->m_aToUpdate[$sClass][$iId]['attributes_list'] = implode(', ', $aExtKeyLabels); + $this->m_aToUpdate[$sClass][$iId]['attributes_list'] = implode(', ', $aExtKeyLabels); list($bRes, $aIssues, $bSecurityIssues) = $oObject->CheckToWrite(); - if (!$bRes) - { + if (!$bRes) { $this->m_aToUpdate[$sClass][$iId]['issue'] = implode(', ', $aIssues); $this->m_bFoundStopper = true; - if ($bSecurityIssues) - { + if ($bSecurityIssues) { $this->m_aToUpdate[$sClass][$iId]['issue_security'] = true; $this->m_bFoundSecurityIssue = true; } @@ -127,23 +118,17 @@ class DeletionPlan public function GetIssues() { - $aIssues = array(); - foreach ($this->m_aToDelete as $sClass => $aToDelete) - { - foreach ($aToDelete as $iId => $aData) - { - if (isset($aData['issue'])) - { + $aIssues = []; + foreach ($this->m_aToDelete as $sClass => $aToDelete) { + foreach ($aToDelete as $iId => $aData) { + if (isset($aData['issue'])) { $aIssues[] = $aData['issue']; } } } - foreach ($this->m_aToUpdate as $sClass => $aToUpdate) - { - foreach ($aToUpdate as $iId => $aData) - { - if (isset($aData['issue'])) - { + foreach ($this->m_aToUpdate as $sClass => $aToUpdate) { + foreach ($aToUpdate as $iId => $aData) { + if (isset($aData['issue'])) { $aIssues[] = $aData['issue']; } } @@ -192,63 +177,50 @@ class DeletionPlan public function AddToDelete($oObject, $iDeletionMode = null) { - if (is_null($iDeletionMode)) - { + if (is_null($iDeletionMode)) { $bRequestedExplicitely = true; $iDeletionMode = DEL_AUTO; - } - else - { + } else { $bRequestedExplicitely = false; } $sClass = get_class($oObject); $iId = $oObject->GetKey(); - if (isset($this->m_aToUpdate[$sClass][$iId])) - { + if (isset($this->m_aToUpdate[$sClass][$iId])) { unset($this->m_aToUpdate[$sClass][$iId]); } - if (isset($this->m_aToDelete[$sClass][$iId])) - { - if ($this->m_aToDelete[$sClass][$iId]['requested_explicitely']) - { + if (isset($this->m_aToDelete[$sClass][$iId])) { + if ($this->m_aToDelete[$sClass][$iId]['requested_explicitely']) { // No change: let it in mode DEL_AUTO - } - else - { + } else { $iPrevDeletionMode = $this->m_aToDelete[$sClass][$iId]['mode']; $iNewDeletionMode = self::$m_aModeUpdate[$iPrevDeletionMode][$iDeletionMode]; $this->m_aToDelete[$sClass][$iId]['mode'] = $iNewDeletionMode; - - if ($bRequestedExplicitely) - { + + if ($bRequestedExplicitely) { // This object was in the root list $this->m_aToDelete[$sClass][$iId]['requested_explicitely'] = true; $this->m_aToDelete[$sClass][$iId]['mode'] = DEL_AUTO; } } - } - else - { - $this->m_aToDelete[$sClass][$iId] = array( + } else { + $this->m_aToDelete[$sClass][$iId] = [ 'to_delete' => $oObject, 'mode' => $iDeletionMode, 'requested_explicitely' => $bRequestedExplicitely, - ); + ]; } } public function SetDeletionIssues($oObject, $aIssues, $bSecurityIssue) { - if (count($aIssues ?? []) > 0) - { + if (count($aIssues ?? []) > 0) { $sClass = get_class($oObject); $iId = $oObject->GetKey(); $this->m_aToDelete[$sClass][$iId]['issue'] = implode(', ', $aIssues); - if ($bSecurityIssue) - { + if ($bSecurityIssue) { $this->m_aToDelete[$sClass][$iId]['issue_security'] = true; } } @@ -258,21 +230,16 @@ class DeletionPlan { $sClass = get_class($oObject); $iId = $oObject->GetKey(); - if (isset($this->m_aToDelete[$sClass][$iId])) - { + if (isset($this->m_aToDelete[$sClass][$iId])) { // skip... it should be deleted anyhow ! - } - else - { - if (!isset($this->m_aToUpdate[$sClass][$iId])) - { - $this->m_aToUpdate[$sClass][$iId] = array( + } else { + if (!isset($this->m_aToUpdate[$sClass][$iId])) { + $this->m_aToUpdate[$sClass][$iId] = [ 'to_reset' => $oObject, - ); + ]; } $this->m_aToUpdate[$sClass][$iId]['attributes'][$oAttDef->GetCode()] = $oAttDef; $this->m_aToUpdate[$sClass][$iId]['values'][$oAttDef->GetCode()] = $value; } } } -?> diff --git a/core/designdocument.class.inc.php b/core/designdocument.class.inc.php index 3965c68ec..91318090a 100644 --- a/core/designdocument.class.inc.php +++ b/core/designdocument.class.inc.php @@ -1,4 +1,5 @@ query($sXPath); - } - else - { + } else { $oResult = $oXPath->query($sXPath, $oContextNode); } return $oResult; @@ -174,8 +167,12 @@ class DesignDocument extends DOMDocument */ public static function GetItopNodePath($oNode) { - if ($oNode instanceof \DOMDocument) return ''; - if (is_null($oNode)) return ''; + if ($oNode instanceof \DOMDocument) { + return ''; + } + if (is_null($oNode)) { + return ''; + } $sId = $oNode->getAttribute('id'); $sNodeDesc = ($sId != '') ? $oNode->nodeName.'['.$sId.']' : $oNode->nodeName; @@ -303,16 +300,13 @@ class DesignElement extends \DOMElement public function GetUniqueElement($sTagName, $bMustExist = true) { $oNode = null; - foreach($this->childNodes as $oChildNode) - { - if ($oChildNode->nodeName == $sTagName) - { + foreach ($this->childNodes as $oChildNode) { + if ($oChildNode->nodeName == $sTagName) { $oNode = $oChildNode; break; } } - if ($bMustExist && is_null($oNode)) - { + if ($bMustExist && is_null($oNode)) { throw new DOMFormatException('Missing unique tag: '.$sTagName); } return $oNode; @@ -337,20 +331,17 @@ class DesignElement extends \DOMElement public function GetText($sDefault = null) { $sText = null; - foreach($this->childNodes as $oChildNode) - { - if ($oChildNode instanceof \DOMText) - { - if (is_null($sText)) $sText = ''; + foreach ($this->childNodes as $oChildNode) { + if ($oChildNode instanceof \DOMText) { + if (is_null($sText)) { + $sText = ''; + } $sText .= $oChildNode->wholeText; } } - if (is_null($sText)) - { + if (is_null($sText)) { return $sDefault; - } - else - { + } else { return $sText; } } @@ -367,8 +358,7 @@ class DesignElement extends \DOMElement public function GetChildText($sTagName, $sDefault = null) { $sRet = $sDefault; - if ($oChild = $this->GetOptionalElement($sTagName)) - { + if ($oChild = $this->GetOptionalElement($sTagName)) { $sRet = $oChild->GetText($sDefault); } return $sRet; @@ -427,7 +417,6 @@ class DesignElement extends \DOMElement return self::_FindNode($this, $oRefNode, $sSearchId); } - /** * Find the child node matching the given node. * UNSAFE: may return nodes marked as _alteration="removed" @@ -482,31 +471,24 @@ class DesignElement extends \DOMElement */ public static function _FindNodes(DOMNode $oParent, DesignElement $oRefNode, string $sSearchId = null) { - if ($oParent instanceof DOMDocument) - { + if ($oParent instanceof DOMDocument) { $oDoc = $oParent->firstChild->ownerDocument; $oRoot = $oParent; - } - else - { + } else { $oDoc = $oParent->ownerDocument; $oRoot = $oParent; } $oXPath = new DOMXPath($oDoc); - if ($oRefNode->hasAttribute('id')) - { + if ($oRefNode->hasAttribute('id')) { // Find the elements having the same tag name and id - if (!$sSearchId) - { + if (!$sSearchId) { $sSearchId = $oRefNode->getAttribute('id'); } $sXPath = './'.$oRefNode->tagName."[@id='$sSearchId']"; $oRes = $oXPath->query($sXPath, $oRoot); - } - else - { + } else { // Get the elements having the same tag name $sXPath = './'.$oRefNode->tagName; diff --git a/core/dict.class.inc.php b/core/dict.class.inc.php index 002ca3c4b..ae87c76c5 100644 --- a/core/dict.class.inc.php +++ b/core/dict.class.inc.php @@ -1,4 +1,5 @@ - define('DICT_ERR_STRING', 1); // when a string is missing, return the identifier define('DICT_ERR_EXCEPTION', 2); // when a string is missing, throw an exception //define('DICT_ERR_LOG', 3); // when a string is missing, log an error - /** * Class Dict * Management of localizable strings @@ -32,8 +31,8 @@ class Dict protected static $m_sDefaultLanguage = 'EN US'; protected static $m_sCurrentLanguage = null; // No language selected by default - protected static $m_aLanguages = array(); // array( code => array( 'description' => '...', 'localized_description' => '...') ...) - protected static $m_aData = array(); + protected static $m_aLanguages = []; // array( code => array( 'description' => '...', 'localized_description' => '...') ...) + protected static $m_aData = []; protected static $m_sApplicationPrefix = null; /** @var \ApcService $m_oApcService */ protected static $m_oApcService = null; @@ -45,8 +44,7 @@ class Dict */ public static function SetDefaultLanguage($sLanguageCode) { - if (!array_key_exists($sLanguageCode, self::$m_aLanguages)) - { + if (!array_key_exists($sLanguageCode, self::$m_aLanguages)) { throw new DictExceptionUnknownLanguage($sLanguageCode); } self::$m_sDefaultLanguage = $sLanguageCode; @@ -60,18 +58,15 @@ class Dict */ public static function SetUserLanguage($sLanguageCode = null) { - if (!is_null($sLanguageCode) && !array_key_exists($sLanguageCode, self::$m_aLanguages)) - { + if (!is_null($sLanguageCode) && !array_key_exists($sLanguageCode, self::$m_aLanguages)) { throw new DictExceptionUnknownLanguage($sLanguageCode); } self::$m_sCurrentLanguage = $sLanguageCode; } - public static function GetUserLanguage() { - if (self::$m_sCurrentLanguage == null) // May happen when no user is logged in (i.e. login screen, non-authenticated page) - { + if (self::$m_sCurrentLanguage == null) { // May happen when no user is logged in (i.e. login screen, non-authenticated page) // In which case let's use the default language return self::$m_sDefaultLanguage; } @@ -99,8 +94,7 @@ class Dict public static function Exists($sStringCode) { $sImpossibleString = 'aVlHYKEI3TZuDV5o0pghv7fvhYNYuzYkTk7WL0Zoqw8rggE7aq'; - if (static::S($sStringCode, $sImpossibleString) === $sImpossibleString) - { + if (static::S($sStringCode, $sImpossibleString) === $sImpossibleString) { return false; } return true; @@ -139,26 +133,22 @@ class Dict $sLangCode = self::GetUserLanguage(); self::InitLangIfNeeded($sLangCode); - if (! array_key_exists($sLangCode, self::$m_aData)) - { + if (! array_key_exists($sLangCode, self::$m_aData)) { IssueLog::Warning("Cannot find $sLangCode in all registered dictionaries."); // It may happen, when something happens before the dictionaries get loaded return [ 'label' => $sStringCode, 'lang' => $sLangCode ]; } $aCurrentDictionary = self::$m_aData[$sLangCode]; - if (is_array($aCurrentDictionary) && array_key_exists($sStringCode, $aCurrentDictionary)) - { + if (is_array($aCurrentDictionary) && array_key_exists($sStringCode, $aCurrentDictionary)) { return [ 'label' => $aCurrentDictionary[$sStringCode], 'lang' => $sLangCode ]; } - if (!$bUserLanguageOnly) - { + if (!$bUserLanguageOnly) { // Attempt to find the string in the default language // self::InitLangIfNeeded(self::$m_sDefaultLanguage); $aDefaultDictionary = self::$m_aData[self::$m_sDefaultLanguage]; - if (is_array($aDefaultDictionary) && array_key_exists($sStringCode, $aDefaultDictionary)) - { + if (is_array($aDefaultDictionary) && array_key_exists($sStringCode, $aDefaultDictionary)) { return [ 'label' => $aDefaultDictionary[$sStringCode], 'lang' => self::$m_sDefaultLanguage ]; } // Attempt to find the string in english @@ -166,22 +156,19 @@ class Dict self::InitLangIfNeeded('EN US'); $aDefaultDictionary = self::$m_aData['EN US']; - if (is_array($aDefaultDictionary) && array_key_exists($sStringCode, $aDefaultDictionary)) - { + if (is_array($aDefaultDictionary) && array_key_exists($sStringCode, $aDefaultDictionary)) { return [ 'label' => $aDefaultDictionary[$sStringCode], 'lang' => 'EN US' ]; } } // Could not find the string... // - if (is_null($sDefault)) - { + if (is_null($sDefault)) { return [ 'label' => $sStringCode, 'lang' => null ]; } return [ 'label' => $sDefault, 'lang' => null ]; } - /** * Formats a localized string with numbered placeholders (%1$s...) for the additional arguments * See vsprintf for more information about the syntax of the placeholders @@ -199,15 +186,14 @@ class Dict $aArguments = func_get_args(); array_shift($aArguments); - if ($sLocalizedFormat == $sFormatCode) - { + if ($sLocalizedFormat == $sFormatCode) { // Make sure the information will be displayed (ex: an error occurring before the dictionary gets loaded) return $sFormatCode.' - '.implode(', ', $aArguments); } - try{ + try { return utils::VSprintf($sLocalizedFormat, $aArguments); - } catch(\Throwable $e){ + } catch (\Throwable $e) { \IssueLog::Error("Cannot format dict key", null, ["sFormatCode" => $sFormatCode, "sLangCode" => $sLangCode, 'exception_msg' => $e->getMessage() ]); return $sFormatCode.' - '.implode(', ', $aArguments); } @@ -236,8 +222,9 @@ class Dict * @since 2.7.6 N°4125 * @return \ApcService */ - public static function GetApcService() { - if (self::$m_oApcService === null){ + public static function GetApcService() + { + if (self::$m_oApcService === null) { self::$m_oApcService = new ApcService(); } return self::$m_oApcService; @@ -247,7 +234,8 @@ class Dict * @since 2.7.6 N°4125 * @param \ApcService $m_oApcService */ - public static function SetApcService($oApcService) { + public static function SetApcService($oApcService) + { self::$m_oApcService = $oApcService; } @@ -258,19 +246,20 @@ class Dict */ public static function InitLangIfNeeded($sLangCode) { - if (array_key_exists($sLangCode, self::$m_aData)) return true; + if (array_key_exists($sLangCode, self::$m_aData)) { + return true; + } $bResult = false; if (self::GetApcService()->function_exists('apc_fetch') - && (self::$m_sApplicationPrefix !== null)) - { + && (self::$m_sApplicationPrefix !== null)) { // Note: For versions of APC older than 3.0.17, fetch() accepts only one parameter // self::$m_aData[$sLangCode] = self::GetApcService()->apc_fetch(self::$m_sApplicationPrefix.'-dict-'.$sLangCode); if (self::$m_aData[$sLangCode] === false) { unset(self::$m_aData[$sLangCode]); - } else if (! is_array(self::$m_aData[$sLangCode])) { + } elseif (! is_array(self::$m_aData[$sLangCode])) { // N°4125: we don't fix dictionary corrupted cache (on iTop side). // but we log an error in a dedicated channel to let itop administrator be aware of a potential APCu issue to fix. IssueLog::Error("APCu corrupted data (with $sLangCode dictionary). APCu configuration and running version should be troubleshooted...", LogChannels::APC); @@ -279,14 +268,12 @@ class Dict $bResult = true; } } - if (!$bResult) - { + if (!$bResult) { $sDictFile = APPROOT.'env-'.utils::GetCurrentEnvironment().'/dictionaries/'.str_replace(' ', '-', strtolower($sLangCode)).'.dict.php'; require_once($sDictFile); if (self::GetApcService()->function_exists('apc_store') - && (self::$m_sApplicationPrefix !== null)) - { + && (self::$m_sApplicationPrefix !== null)) { self::GetApcService()->apc_store(self::$m_sApplicationPrefix.'-dict-'.$sLangCode, self::$m_aData[$sLangCode]); } $bResult = true; @@ -309,10 +296,8 @@ class Dict */ public static function ResetCache($sApplicationPrefix) { - if (function_exists('apc_delete')) - { - foreach(self::$m_aLanguages as $sLang => $void) - { + if (function_exists('apc_delete')) { + foreach (self::$m_aLanguages as $sLang => $void) { apc_delete($sApplicationPrefix.'-dict-'.$sLang); } } @@ -320,7 +305,6 @@ class Dict ///////////////////////////////////////////////////////////////////////// - /** * Clone a string in every language (if it exists in that language) * @@ -330,8 +314,8 @@ class Dict */ public static function CloneString($sSourceCode, $sDestCode) { - foreach(self::$m_aLanguages as $sLanguageCode => $foo) { - if (isset(self::$m_aData[$sLanguageCode][$sSourceCode]) && !isset(self::$m_aData[$sLanguageCode][$sDestCode] )) { + foreach (self::$m_aLanguages as $sLanguageCode => $foo) { + if (isset(self::$m_aData[$sLanguageCode][$sSourceCode]) && !isset(self::$m_aData[$sLanguageCode][$sDestCode])) { self::$m_aData[$sLanguageCode][$sDestCode] = self::$m_aData[$sLanguageCode][$sSourceCode]; } } @@ -339,40 +323,31 @@ class Dict public static function MakeStats($sLanguageCode, $sLanguageRef = 'EN US') { - $aMissing = array(); // Strings missing for the target language - $aUnexpected = array(); // Strings defined for the target language, but not found in the reference dictionary - $aNotTranslated = array(); // Strings having the same value in both dictionaries - $aOK = array(); // Strings having different values in both dictionaries + $aMissing = []; // Strings missing for the target language + $aUnexpected = []; // Strings defined for the target language, but not found in the reference dictionary + $aNotTranslated = []; // Strings having the same value in both dictionaries + $aOK = []; // Strings having different values in both dictionaries - foreach (self::$m_aData[$sLanguageRef] as $sStringCode => $sValue) - { - if (!array_key_exists($sStringCode, self::$m_aData[$sLanguageCode])) - { + foreach (self::$m_aData[$sLanguageRef] as $sStringCode => $sValue) { + if (!array_key_exists($sStringCode, self::$m_aData[$sLanguageCode])) { $aMissing[$sStringCode] = $sValue; } } - foreach (self::$m_aData[$sLanguageCode] as $sStringCode => $sValue) - { - if (!array_key_exists($sStringCode, self::$m_aData[$sLanguageRef])) - { + foreach (self::$m_aData[$sLanguageCode] as $sStringCode => $sValue) { + if (!array_key_exists($sStringCode, self::$m_aData[$sLanguageRef])) { $aUnexpected[$sStringCode] = $sValue; - } - else - { + } else { // The value exists in the reference $sRefValue = self::$m_aData[$sLanguageRef][$sStringCode]; - if ($sValue == $sRefValue) - { + if ($sValue == $sRefValue) { $aNotTranslated[$sStringCode] = $sValue; - } - else - { + } else { $aOK[$sStringCode] = $sValue; } } } - return array($aMissing, $aUnexpected, $aNotTranslated, $aOK); + return [$aMissing, $aUnexpected, $aNotTranslated, $aOK]; } public static function Dump() @@ -389,10 +364,9 @@ class Dict // ~~ or ~* can be used to indicate entries still to be translated. public static function Add($sLanguageCode, $sEnglishLanguageDesc, $sLocalizedLanguageDesc, $aEntries) { - if (!array_key_exists($sLanguageCode, self::$m_aLanguages)) - { - self::$m_aLanguages[$sLanguageCode] = array('description' => $sEnglishLanguageDesc, 'localized_description' => $sLocalizedLanguageDesc); - self::$m_aData[$sLanguageCode] = array(); + if (!array_key_exists($sLanguageCode, self::$m_aLanguages)) { + self::$m_aLanguages[$sLanguageCode] = ['description' => $sEnglishLanguageDesc, 'localized_description' => $sLocalizedLanguageDesc]; + self::$m_aData[$sLanguageCode] = []; } // No need to actually load the strings since it's only used to know the list of languages // at setup time !! @@ -408,27 +382,22 @@ class Dict { self::InitLangIfNeeded(self::GetUserLanguage()); self::InitLangIfNeeded(self::$m_sDefaultLanguage); - $aEntries = array(); + $aEntries = []; $iLength = strlen($sStartingWith); // First prefill the array with entries from the default language - foreach(self::$m_aData[self::$m_sDefaultLanguage] as $sCode => $sEntry) - { - if (substr($sCode, 0, $iLength) == $sStartingWith) - { + foreach (self::$m_aData[self::$m_sDefaultLanguage] as $sCode => $sEntry) { + if (substr($sCode, 0, $iLength) == $sStartingWith) { $aEntries[$sCode] = $sEntry; } } // Now put (overwrite) the entries for the user language - foreach(self::$m_aData[self::GetUserLanguage()] as $sCode => $sEntry) - { - if (substr($sCode, 0, $iLength) == $sStartingWith) - { + foreach (self::$m_aData[self::GetUserLanguage()] as $sCode => $sEntry) { + if (substr($sCode, 0, $iLength) == $sStartingWith) { $aEntries[$sCode] = $sEntry; } } return $aEntries; } } -?> diff --git a/core/displayablegraph.class.inc.php b/core/displayablegraph.class.inc.php index cf354f135..82294824c 100644 --- a/core/displayablegraph.class.inc.php +++ b/core/displayablegraph.class.inc.php @@ -1,4 +1,5 @@ x - $oNode->x; $dy = $this->y - $oNode->y; - $d2 = $dx*$dx + $dy*$dy - $this->GetHeight()*$this->GetHeight(); - if ($d2 < 40) - { + $d2 = $dx * $dx + $dy * $dy - $this->GetHeight() * $this->GetHeight(); + if ($d2 < 40) { $d2 = 40; } return $d2; @@ -94,7 +94,7 @@ class DisplayableNode extends GraphNode public function GetForRaphael($aContextDefs) { - $aNode = array(); + $aNode = []; $aNode['shape'] = 'icon'; $aNode['icon_url'] = $this->GetIconURL(); $aNode['width'] = 32; @@ -103,19 +103,17 @@ class DisplayableNode extends GraphNode $aNode['obj_key'] = $this->GetProperty('object')->GetKey(); $aNode['sink'] = ($this->GetProperty('sink') == true); $aNode['x'] = $this->x; - $aNode['y']= $this->y; + $aNode['y'] = $this->y; $aNode['label'] = $this->GetLabel(); $aNode['id'] = $this->GetId(); $fOpacity = ($this->GetProperty('is_reached') ? 1 : 0.4); - $aNode['icon_attr'] = array('opacity' => $fOpacity); - $aNode['text_attr'] = array('opacity' => $fOpacity); + $aNode['icon_attr'] = ['opacity' => $fOpacity]; + $aNode['text_attr'] = ['opacity' => $fOpacity]; $aNode['tooltip'] = $this->GetTooltip($aContextDefs); - $aNode['context_icons'] = array(); + $aNode['context_icons'] = []; $aContextRootCauses = $this->GetProperty('context_root_causes'); - if (!is_null($aContextRootCauses)) - { - foreach($aContextRootCauses as $key => $aObjects) - { + if (!is_null($aContextRootCauses)) { + foreach ($aContextRootCauses as $key => $aObjects) { $aNode['context_icons'][] = utils::GetAbsoluteUrlModulesRoot().$aContextDefs[$key]['icon']; } } @@ -132,10 +130,10 @@ class DisplayableNode extends GraphNode $sIconPath = str_replace(utils::GetAbsoluteUrlModulesRoot(), APPROOT.'env-'.utils::GetCurrentEnvironment().'/', $sIconUrl); if ($this->GetProperty('source')) { - $oPdf->SetLineStyle(array('width' => 2 * $fScale, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => array(204, 51, 51))); + $oPdf->SetLineStyle(['width' => 2 * $fScale, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => [204, 51, 51]]); $oPdf->Circle($this->x * $fScale, $this->y * $fScale, 16 * 1.25 * $fScale, 0, 360, 'D'); - } else if ($this->GetProperty('sink')) { - $oPdf->SetLineStyle(array('width' => 2 * $fScale, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => array(51, 51, 204))); + } elseif ($this->GetProperty('sink')) { + $oPdf->SetLineStyle(['width' => 2 * $fScale, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => [51, 51, 204]]); $oPdf->Circle($this->x * $fScale, $this->y * $fScale, 16 * 1.25 * $fScale, 0, 360, 'D'); } @@ -172,10 +170,10 @@ class DisplayableNode extends GraphNode $oPdf->setAlpha(0.6 * $Alpha); $oPdf->SetFillColor(255, 255, 255); $oPdf->SetDrawColor(255, 255, 255); - $oPdf->Rect($this->x*$fScale - $width/2, ($this->y + 18)*$fScale, $width, $height, 'DF'); + $oPdf->Rect($this->x * $fScale - $width / 2, ($this->y + 18) * $fScale, $width, $height, 'DF'); $oPdf->setAlpha($Alpha); $oPdf->SetTextColor(0, 0, 0); - $oPdf->Text($this->x*$fScale - $width/2, ($this->y + 18)*$fScale, $this->GetProperty('label')); + $oPdf->Text($this->x * $fScale - $width / 2, ($this->y + 18) * $fScale, $this->GetProperty('label')); } /** @@ -188,26 +186,22 @@ class DisplayableNode extends GraphNode $aInfo = getimagesize($sIconFile); $im = null; - switch($aInfo['mime']) - { + switch ($aInfo['mime']) { case 'image/png': - if (function_exists('imagecreatefrompng')) - { + if (function_exists('imagecreatefrompng')) { $im = imagecreatefrompng($sIconFile); } break; case 'image/gif': - if (function_exists('imagecreatefromgif')) - { + if (function_exists('imagecreatefromgif')) { $im = imagecreatefromgif($sIconFile); } break; case 'image/jpeg': case 'image/jpg': - if (function_exists('imagecreatefromjpeg')) - { + if (function_exists('imagecreatefromjpeg')) { $im = imagecreatefromjpeg($sIconFile); } break; @@ -216,16 +210,13 @@ class DisplayableNode extends GraphNode return null; } - if($im && imagefilter($im, IMG_FILTER_COLORIZE, 255, 255, 255)) - { + if ($im && imagefilter($im, IMG_FILTER_COLORIZE, 255, 255, 255)) { $sTempImageName = $oGraph->GetTempImageName(); imagesavealpha($im, true); imagepng($im, $sTempImageName); imagedestroy($im); return $sTempImageName; - } - else - { + } else { return null; } } @@ -243,24 +234,22 @@ class DisplayableNode extends GraphNode protected function AddToStats($oNode, &$aNodesPerClass) { $sClass = $oNode->GetObjectClass(); - if (!array_key_exists($sClass, $aNodesPerClass)) - { - $aNodesPerClass[$sClass] = array( - 'reached' => array( + if (!array_key_exists($sClass, $aNodesPerClass)) { + $aNodesPerClass[$sClass] = [ + 'reached' => [ 'count' => 0, - 'nodes' => array(), + 'nodes' => [], 'icon_url' => $oNode->GetProperty('icon_url'), - ), - 'not_reached' => array( + ], + 'not_reached' => [ 'count' => 0, - 'nodes' => array(), + 'nodes' => [], 'icon_url' => $oNode->GetProperty('icon_url'), - ) - ); + ], + ]; } $sKey = $oNode->GetProperty('is_reached') ? 'reached' : 'not_reached'; - if (!array_key_exists($oNode->GetId(), $aNodesPerClass[$sClass][$sKey]['nodes'])) - { + if (!array_key_exists($oNode->GetId(), $aNodesPerClass[$sClass][$sKey]['nodes'])) { $aNodesPerClass[$sClass][$sKey]['nodes'][$oNode->GetId()] = $oNode; $aNodesPerClass[$sClass][$sKey]['count'] += $oNode->GetObjectCount(); } @@ -273,18 +262,13 @@ class DisplayableNode extends GraphNode */ protected function GetNextNodes($bDirectionDown = true) { - $aNextNodes = array(); - if ($bDirectionDown) - { - foreach($this->GetOutgoingEdges() as $oEdge) - { + $aNextNodes = []; + if ($bDirectionDown) { + foreach ($this->GetOutgoingEdges() as $oEdge) { $aNextNodes[] = $oEdge->GetSinkNode(); } - } - else - { - foreach($this->GetIncomingEdges() as $oEdge) - { + } else { + foreach ($this->GetIncomingEdges() as $oEdge) { $aNextNodes[] = $oEdge->GetSourceNode(); } } @@ -302,76 +286,50 @@ class DisplayableNode extends GraphNode protected function ReplaceNextNodeBy(DisplayableGraph $oGraph, DisplayableNode $oNextNode, DisplayableGroupNode $oNewNode, $bDirectionDown = true) { $sClass = $oNewNode->GetProperty('class'); - if ($bDirectionDown) - { - foreach($oNextNode->GetIncomingEdges() as $oEdge) - { - if ($oEdge->GetSourceNode()->GetId() !== $this->GetId()) - { - try - { + if ($bDirectionDown) { + foreach ($oNextNode->GetIncomingEdges() as $oEdge) { + if ($oEdge->GetSourceNode()->GetId() !== $this->GetId()) { + try { $oNewEdge = new DisplayableEdge($oGraph, $oEdge->GetId().'::'.$sClass, $oEdge->GetSourceNode(), $oNewNode); - } - catch(Exception $e) - { + } catch (Exception $e) { // ignore this edge } } } - foreach($oNextNode->GetOutgoingEdges() as $oEdge) - { - try - { + foreach ($oNextNode->GetOutgoingEdges() as $oEdge) { + try { $oNewEdge = new DisplayableEdge($oGraph, $oEdge->GetId().'::'.$sClass, $oNewNode, $oEdge->GetSinkNode()); - } - catch(Exception $e) - { + } catch (Exception $e) { // ignore this edge } } - } - else - { - foreach($oNextNode->GetOutgoingEdges() as $oEdge) - { - if ($oEdge->GetSinkNode()->GetId() !== $this->GetId()) - { - try - { + } else { + foreach ($oNextNode->GetOutgoingEdges() as $oEdge) { + if ($oEdge->GetSinkNode()->GetId() !== $this->GetId()) { + try { $oNewEdge = new DisplayableEdge($oGraph, $oEdge->GetId().'::'.$sClass, $oNewNode, $oEdge->GetSinkNode()); - } - catch(Exception $e) - { + } catch (Exception $e) { // ignore this edge } } } - foreach($oNextNode->GetIncomingEdges() as $oEdge) - { - try - { + foreach ($oNextNode->GetIncomingEdges() as $oEdge) { + try { $oNewEdge = new DisplayableEdge($oGraph, $oEdge->GetId().'::'.$sClass, $oEdge->GetSourceNode(), $oNewNode); - } - catch(Exception $e) - { + } catch (Exception $e) { // ignore this edge } } } - if ($oGraph->GetNode($oNextNode->GetId())) - { + if ($oGraph->GetNode($oNextNode->GetId())) { $oGraph->_RemoveNode($oNextNode); - if ($oNextNode instanceof DisplayableGroupNode) - { + if ($oNextNode instanceof DisplayableGroupNode) { // Copy all the objects of the previous group into the new group - foreach($oNextNode->GetObjects() as $oObj) - { + foreach ($oNextNode->GetObjects() as $oObj) { $oNewNode->AddObject($oObj); } - } - else - { + } else { $oNewNode->AddObject($oNextNode->GetProperty('object')); } } @@ -386,32 +344,26 @@ class DisplayableNode extends GraphNode */ public function GroupSimilarNeighbours(DisplayableGraph $oGraph, $iThresholdCount, $bDirectionUp = false, $bDirectionDown = true) { - if ($this->GetProperty('grouped') === true) return; + if ($this->GetProperty('grouped') === true) { + return; + } $this->SetProperty('grouped', true); - $aNodesPerClass = array(); - foreach($this->GetNextNodes($bDirectionDown) as $oNode) - { + $aNodesPerClass = []; + foreach ($this->GetNextNodes($bDirectionDown) as $oNode) { $sClass = $oNode->GetObjectClass(); - if ($sClass !== null) - { + if ($sClass !== null) { $this->AddToStats($oNode, $aNodesPerClass); - } - else - { + } else { $oNode->GroupSimilarNeighbours($oGraph, $iThresholdCount, $bDirectionUp, $bDirectionDown); } } - foreach($aNodesPerClass as $sClass => $aDefs) - { - foreach($aDefs as $sStatus => $aGroupProps) - { - if (count($aGroupProps['nodes']) >= $iThresholdCount) - { - $sNewId = $this->GetId().'::'.$sClass.'/'.(($sStatus == 'reached') ? '_reached': ''); + foreach ($aNodesPerClass as $sClass => $aDefs) { + foreach ($aDefs as $sStatus => $aGroupProps) { + if (count($aGroupProps['nodes']) >= $iThresholdCount) { + $sNewId = $this->GetId().'::'.$sClass.'/'.(($sStatus == 'reached') ? '_reached' : ''); $oNewNode = $oGraph->GetNode($sNewId); - if ($oNewNode == null) - { + if ($oNewNode == null) { $oNewNode = new DisplayableGroupNode($oGraph, $sNewId); $oNewNode->SetProperty('label', 'x'.$aGroupProps['count']); $oNewNode->SetProperty('icon_url', MetaModel::GetClassIcon($sClass, false)); @@ -420,32 +372,22 @@ class DisplayableNode extends GraphNode $oNewNode->SetProperty('count', $aGroupProps['count']); } - try - { - if ($bDirectionDown) - { + try { + if ($bDirectionDown) { $oIncomingEdge = new DisplayableEdge($oGraph, $this->GetId().'-'.$oNewNode->GetId(), $this, $oNewNode); - } - else - { + } else { $oOutgoingEdge = new DisplayableEdge($oGraph, $this->GetId().'-'.$oNewNode->GetId(), $oNewNode, $this); } - } - catch(Exception $e) - { + } catch (Exception $e) { // Ignore this redundant egde } - foreach($aGroupProps['nodes'] as $oNextNode) - { + foreach ($aGroupProps['nodes'] as $oNextNode) { $this->ReplaceNextNodeBy($oGraph, $oNextNode, $oNewNode, $bDirectionDown); } $oNewNode->GroupSimilarNeighbours($oGraph, $iThresholdCount, $bDirectionUp, $bDirectionDown); - } - else - { - foreach($aGroupProps['nodes'] as $oNode) - { + } else { + foreach ($aGroupProps['nodes'] as $oNode) { $oNode->GroupSimilarNeighbours($oGraph, $iThresholdCount, $bDirectionUp, $bDirectionDown); } } @@ -460,12 +402,10 @@ class DisplayableNode extends GraphNode $sSubClass = get_class($oCurrObj); $sHtml .= $oCurrObj->GetHyperlink()."
          "; $aContextRootCauses = $this->GetProperty('context_root_causes'); - if (!is_null($aContextRootCauses)) - { - foreach($aContextRootCauses as $key => $aObjects) - { + if (!is_null($aContextRootCauses)) { + foreach ($aContextRootCauses as $key => $aObjects) { $aContext = $aContextDefs[$key]; - $aRootCauses = array(); + $aRootCauses = []; foreach ($aObjects as $oRootCause) { $aRootCauses[] = $oRootCause->GetHyperlink(); } @@ -474,8 +414,7 @@ class DisplayableNode extends GraphNode $sHtml .= '
          '; } $sHtml .= '
      '; - foreach(MetaModel::GetZListItems($sSubClass, 'list') as $sAttCode) - { + foreach (MetaModel::GetZListItems($sSubClass, 'list') as $sAttCode) { $oAttDef = MetaModel::GetAttributeDef($sSubClass, $sAttCode); $sHtml .= ''; } @@ -492,14 +431,11 @@ class DisplayableNode extends GraphNode public function GetDotAttributes($bNoLabel = false) { $sDot = ''; - if ($bNoLabel) - { + if ($bNoLabel) { // simulate a fake label with the approximate same size as the true label $sLabel = str_repeat('x', mb_strlen($this->GetProperty('label', $this->GetId()))); $sDot = 'label="'.$sLabel.'"'; - } - else - { + } else { // actual label $sLabel = addslashes($this->GetProperty('label', $this->GetId())); $sDot = 'label="'.$sLabel.'"'; @@ -517,20 +453,20 @@ class DisplayableRedundancyNode extends DisplayableNode public function GetForRaphael($aContextDefs) { - $aNode = array(); + $aNode = []; $aNode['shape'] = 'disc'; $aNode['icon_url'] = $this->GetIconURL(); $aNode['source'] = ($this->GetProperty('source') == true); $aNode['width'] = $this->GetWidth(); $aNode['x'] = $this->x; - $aNode['y']= $this->y; + $aNode['y'] = $this->y; $aNode['label'] = $this->GetLabel(); $aNode['id'] = $this->GetId(); $fDiscOpacity = ($this->GetProperty('is_reached') ? 1 : 0.2); $sColor = ($this->GetProperty('is_reached_count') > $this->GetProperty('threshold')) ? '#c33' : '#999'; - $aNode['disc_attr'] = array('stroke-width' => 2, 'stroke' => '#000', 'fill' => $sColor, 'opacity' => $fDiscOpacity); + $aNode['disc_attr'] = ['stroke-width' => 2, 'stroke' => '#000', 'fill' => $sColor, 'opacity' => $fDiscOpacity]; $fTextOpacity = ($this->GetProperty('is_reached') ? 1 : 0.4); - $aNode['text_attr'] = array('fill' => '#fff', 'opacity' => $fTextOpacity); + $aNode['text_attr'] = ['fill' => '#fff', 'opacity' => $fTextOpacity]; $aNode['tooltip'] = $this->GetTooltip($aContextDefs); return $aNode; } @@ -538,28 +474,25 @@ class DisplayableRedundancyNode extends DisplayableNode public function RenderAsPDF(iTopPDF $oPdf, DisplayableGraph $oGraph, $fScale, $aContextDefs) { $oPdf->SetAlpha(1); - if($this->GetProperty('is_reached_count') > $this->GetProperty('threshold')) - { + if ($this->GetProperty('is_reached_count') > $this->GetProperty('threshold')) { $oPdf->SetFillColor(200, 0, 0); - } - else - { + } else { $oPdf->SetFillColor(144, 144, 144); } $oPdf->SetDrawColor(0, 0, 0); - $oPdf->Circle($this->x*$fScale, $this->y*$fScale, 16*$fScale, 0, 360, 'DF'); + $oPdf->Circle($this->x * $fScale, $this->y * $fScale, 16 * $fScale, 0, 360, 'DF'); $oPdf->SetTextColor(255, 255, 255); $oPdf->SetFontParams('', 28 * $fScale, '', true); $sLabel = (string)$this->GetProperty('label'); $width = $oPdf->GetStringWidth($sLabel, iTopPDF::GetPdfFont(), 'B', 24 * $fScale); $height = $oPdf->GetStringHeight(1000, $sLabel); - $xPos = (float)$this->x*$fScale - $width/2; - $yPos = (float)$this->y*$fScale - $height/2; + $xPos = (float)$this->x * $fScale - $width / 2; + $yPos = (float)$this->y * $fScale - $height / 2; - $oPdf->SetXY(($this->x - 16)*$fScale, ($this->y - 16)*$fScale); + $oPdf->SetXY(($this->x - 16) * $fScale, ($this->y - 16) * $fScale); - $oPdf->Cell(32*$fScale, 32*$fScale, $sLabel, 0, 0, 'C', 0, '', 0, false, 'T', 'C'); + $oPdf->Cell(32 * $fScale, 32 * $fScale, $sLabel, 0, 0, 'C', 0, '', 0, false, 'T', 'C'); } /** @@ -569,28 +502,20 @@ class DisplayableRedundancyNode extends DisplayableNode { parent::GroupSimilarNeighbours($oGraph, $iThresholdCount, $bDirectionUp, $bDirectionDown); - if ($bDirectionUp) - { - $aNodesPerClass = array(); - foreach($this->GetIncomingEdges() as $oEdge) - { + if ($bDirectionUp) { + $aNodesPerClass = []; + foreach ($this->GetIncomingEdges() as $oEdge) { $oNode = $oEdge->GetSourceNode(); - if (($oNode->GetObjectClass() !== null) && (!$oNode->GetProperty('is_reached'))) - { + if (($oNode->GetObjectClass() !== null) && (!$oNode->GetProperty('is_reached'))) { $this->AddToStats($oNode, $aNodesPerClass); - } - else - { + } else { //$oNode->GroupSimilarNeighbours($oGraph, $iThresholdCount, $bDirectionUp, $bDirectionDown); } } - foreach($aNodesPerClass as $sClass => $aDefs) - { - foreach($aDefs as $sStatus => $aGroupProps) - { - if (count($aGroupProps['nodes']) >= $iThresholdCount) - { + foreach ($aNodesPerClass as $sClass => $aDefs) { + foreach ($aDefs as $sStatus => $aGroupProps) { + if (count($aGroupProps['nodes']) >= $iThresholdCount) { $oNewNode = new DisplayableGroupNode($oGraph, '-'.$this->GetId().'::'.$sClass.'/'.$sStatus); $oNewNode->SetProperty('label', 'x'.count($aGroupProps['nodes'])); $oNewNode->SetProperty('icon_url', MetaModel::GetClassIcon($sClass, false)); @@ -598,11 +523,9 @@ class DisplayableRedundancyNode extends DisplayableNode $oNewNode->SetProperty('class', $sClass); $oNewNode->SetProperty('count', count($aGroupProps['nodes'])); - - $sNewId = $this->GetId().'::'.$sClass.'/'.(($sStatus == 'reached') ? '_reached': ''); + $sNewId = $this->GetId().'::'.$sClass.'/'.(($sStatus == 'reached') ? '_reached' : ''); $oNewNode = $oGraph->GetNode($sNewId); - if ($oNewNode == null) - { + if ($oNewNode == null) { $oNewNode = new DisplayableGroupNode($oGraph, $sNewId); $oNewNode->SetProperty('label', 'x'.$aGroupProps['count']); $oNewNode->SetProperty('icon_url', $aGroupProps['icon_url']); @@ -611,25 +534,18 @@ class DisplayableRedundancyNode extends DisplayableNode $oNewNode->SetProperty('count', $aGroupProps['count']); } - try - { + try { $oOutgoingEdge = new DisplayableEdge($oGraph, '-'.$this->GetId().'-'.$oNewNode->GetId().'/'.$sStatus, $oNewNode, $this); - } - catch(Exception $e) - { + } catch (Exception $e) { // Ignore this redundant egde } - foreach($aGroupProps['nodes'] as $oNextNode) - { + foreach ($aGroupProps['nodes'] as $oNextNode) { $this->ReplaceNextNodeBy($oGraph, $oNextNode, $oNewNode, !$bDirectionUp); } //$oNewNode->GroupSimilarNeighbours($oGraph, $iThresholdCount, $bDirectionUp, $bDirectionDown); - } - else - { - foreach($aGroupProps['nodes'] as $oNode) - { + } else { + foreach ($aGroupProps['nodes'] as $oNode) { //$oNode->GroupSimilarNeighbours($oGraph, $iThresholdCount, $bDirectionUp, $bDirectionDown); } } @@ -643,13 +559,12 @@ class DisplayableRedundancyNode extends DisplayableNode $sHtml = ''; $sHtml .= Dict::S('UI:RelationTooltip:Redundancy')."
      "; $sHtml .= '
      '.$oAttDef->GetLabel().': '.$oCurrObj->GetAsHtml($sAttCode).'
      '; - $sHtml .= ""; - $sHtml .= ""; + $sHtml .= ""; + $sHtml .= ""; $sHtml .= '
      ".Dict::Format('UI:RelationTooltip:ImpactedItems_N_of_M' , $this->GetProperty('is_reached_count'), $this->GetProperty('min_up') + $this->GetProperty('threshold'))."
      ".Dict::Format('UI:RelationTooltip:CriticalThreshold_N_of_M' , $this->GetProperty('threshold'), $this->GetProperty('min_up') + $this->GetProperty('threshold'))."
      ".Dict::Format('UI:RelationTooltip:ImpactedItems_N_of_M', $this->GetProperty('is_reached_count'), $this->GetProperty('min_up') + $this->GetProperty('threshold'))."
      ".Dict::Format('UI:RelationTooltip:CriticalThreshold_N_of_M', $this->GetProperty('threshold'), $this->GetProperty('min_up') + $this->GetProperty('threshold'))."
      '; return $sHtml; } - public function GetObjectCount() { return 0; @@ -666,16 +581,14 @@ class DisplayableEdge extends GraphEdge public function RenderAsPDF(TCPDF $oPdf, DisplayableGraph $oGraph, $fScale, $aContextDefs) { $oSourceNode = $this->GetSourceNode(); - if (($oSourceNode->x == null) || ($oSourceNode->y == null)) - { + if (($oSourceNode->x == null) || ($oSourceNode->y == null)) { return; } $xStart = $oSourceNode->x * $fScale; $yStart = $oSourceNode->y * $fScale; $oSinkNode = $this->GetSinkNode(); - if (($oSinkNode->x == null) || ($oSinkNode->y == null)) - { + if (($oSinkNode->x == null) || ($oSinkNode->y == null)) { return; } $xEnd = $oSinkNode->x * $fScale; @@ -684,32 +597,28 @@ class DisplayableEdge extends GraphEdge $bReached = ($this->GetSourceNode()->GetProperty('is_reached') && $this->GetSinkNode()->GetProperty('is_reached')); $oPdf->setAlpha(1); - if ($bReached) - { - $aColor = array(100, 100, 100); + if ($bReached) { + $aColor = [100, 100, 100]; + } else { + $aColor = [200, 200, 200]; } - else - { - $aColor = array(200, 200, 200); - } - $oPdf->SetLineStyle(array('width' => 2*$fScale, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => $aColor)); + $oPdf->SetLineStyle(['width' => 2 * $fScale, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => $aColor]); $oPdf->Line($xStart, $yStart, $xEnd, $yEnd); - $vx = $xEnd - $xStart; $vy = $yEnd - $yStart; - $l = sqrt($vx*$vx + $vy*$vy); + $l = sqrt($vx * $vx + $vy * $vy); $vx = $vx / $l; $vy = $vy / $l; $ux = -$vy; $uy = $vx; - $lPos = max($l/2, $l - 40*$fScale); - $iArrowSize = 5*$fScale; + $lPos = max($l / 2, $l - 40 * $fScale); + $iArrowSize = 5 * $fScale; $x = $xStart + $lPos * $vx; $y = $yStart + $lPos * $vy; - $oPdf->Line($x, $y, $x + $iArrowSize * ($ux-$vx), $y + $iArrowSize * ($uy-$vy)); - $oPdf->Line($x, $y, $x - $iArrowSize * ($ux+$vx), $y - $iArrowSize * ($uy+$vy)); + $oPdf->Line($x, $y, $x + $iArrowSize * ($ux - $vx), $y + $iArrowSize * ($uy - $vy)); + $oPdf->Line($x, $y, $x - $iArrowSize * ($ux + $vx), $y - $iArrowSize * ($uy + $vy)); } } @@ -720,16 +629,14 @@ class DisplayableGroupNode extends DisplayableNode public function __construct(SimpleGraph $oGraph, $sId, $x = 0, $y = 0) { parent::__construct($oGraph, $sId, $x, $y); - $this->aObjects = array(); + $this->aObjects = []; } public function AddObject(DBObject $oObj = null) { - if (is_object($oObj)) - { + if (is_object($oObj)) { $sPrevClass = $this->GetObjectClass(); - if (($sPrevClass !== null) && (get_class($oObj) !== $sPrevClass)) - { + if (($sPrevClass !== null) && (get_class($oObj) !== $sPrevClass)) { throw new Exception("Error: adding an object of class '".get_class($oObj)."' to a group of '$sPrevClass' objects."); } $this->aObjects[$oObj->GetKey()] = $oObj; @@ -748,21 +655,21 @@ class DisplayableGroupNode extends DisplayableNode public function GetForRaphael($aContextDefs) { - $aNode = array(); + $aNode = []; $aNode['shape'] = 'group'; $aNode['icon_url'] = $this->GetIconURL(); $aNode['source'] = ($this->GetProperty('source') == true); $aNode['width'] = $this->GetWidth(); $aNode['x'] = $this->x; - $aNode['y']= $this->y; + $aNode['y'] = $this->y; $aNode['label'] = $this->GetLabel(); $aNode['id'] = $this->GetId(); $aNode['group_index'] = $this->GetProperty('group_index'); // if supplied $fDiscOpacity = ($this->GetProperty('is_reached') ? 1 : 0.2); $fTextOpacity = ($this->GetProperty('is_reached') ? 1 : 0.4); - $aNode['icon_attr'] = array('opacity' => $fTextOpacity); - $aNode['disc_attr'] = array('stroke-width' => 2, 'stroke' => '#000', 'fill' => '#fff', 'opacity' => $fDiscOpacity); - $aNode['text_attr'] = array('fill' => '#000', 'opacity' => $fTextOpacity); + $aNode['icon_attr'] = ['opacity' => $fTextOpacity]; + $aNode['disc_attr'] = ['stroke-width' => 2, 'stroke' => '#000', 'fill' => '#fff', 'opacity' => $fDiscOpacity]; + $aNode['text_attr'] = ['fill' => '#000', 'opacity' => $fTextOpacity]; $aNode['tooltip'] = $this->GetTooltip($aContextDefs); return $aNode; } @@ -772,11 +679,11 @@ class DisplayableGroupNode extends DisplayableNode $bReached = $this->GetProperty('is_reached'); $oPdf->SetFillColor(255, 255, 255); if ($bReached) { - $aBorderColor = array(100, 100, 100); + $aBorderColor = [100, 100, 100]; } else { - $aBorderColor = array(200, 200, 200); + $aBorderColor = [200, 200, 200]; } - $oPdf->SetLineStyle(array('width' => 2 * $fScale, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => $aBorderColor)); + $oPdf->SetLineStyle(['width' => 2 * $fScale, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => $aBorderColor]); $sIconUrl = $this->GetProperty('icon_url'); $sIconPath = str_replace(utils::GetAbsoluteUrlModulesRoot(), APPROOT.'env-'.utils::GetCurrentEnvironment().'/', $sIconUrl); @@ -800,7 +707,7 @@ class DisplayableGroupNode extends DisplayableNode public function GetTooltip($aContextDefs) { $iGroupIdx = $this->GetProperty('group_index'); - $sHtml = ''.Dict::Format('UI:RelationGroupNumber_N', (1+$iGroupIdx)).""; + $sHtml = ''.Dict::Format('UI:RelationGroupNumber_N', (1 + $iGroupIdx)).""; $sHtml .= '
      '; $sHtml .= ''; $sHtml .= '"; $sHtml .= " "; $sHtml .= ""; - foreach ($aConsolidatedStats as $sOperation => $aOpStats) - { + foreach ($aConsolidatedStats as $sOperation => $aOpStats) { $sOperation = ''.$sOperation.''; $sCount = $aOpStats['count']; $sDuration = round($aOpStats['duration'], 3); @@ -250,25 +245,20 @@ class ExecutionKPI self::Report($sHtml); // Report operation details - foreach (self::$m_aStats as $sOperation => $aOpStats) - { + foreach (self::$m_aStats as $sOperation => $aOpStats) { $sHtml = ''; $bDisplayHeader = true; - foreach ($aOpStats as $sArguments => $aEvents) - { + foreach ($aOpStats as $sArguments => $aEvents) { $sHtmlArguments = '
      '.$sArguments.'
      '; - if ($aConsolidatedStats[$sOperation]['max_args'] == $sArguments) - { + if ($aConsolidatedStats[$sOperation]['max_args'] == $sArguments) { $sHtmlArguments = ''.$sHtmlArguments.''; } - if (isset($aEvents[0]['callers'])) - { + if (isset($aEvents[0]['callers'])) { $sHtmlArguments .= '
      '; $sHtmlArguments .= '
      '.MetaModel::GetName($this->GetObjectClass()).'
      '; @@ -833,9 +740,9 @@ class DisplayableGraph extends SimpleGraph public function __construct() { parent::__construct(); - $this->aTempImages = array(); - $this->aSourceObjects = array(); - $this->aSinkObjects = array(); + $this->aTempImages = []; + $this->aSourceObjects = []; + $this->aSinkObjects = []; } public function GetTempImageName() @@ -847,8 +754,7 @@ class DisplayableGraph extends SimpleGraph public function __destruct() { - foreach($this->aTempImages as $sTempFile) - { + foreach ($this->aTempImages as $sTempFile) { @unlink($sTempFile); } } @@ -880,14 +786,14 @@ class DisplayableGraph extends SimpleGraph $sClass = get_class($oObj); if ($oNode->GetProperty('source')) { if (!array_key_exists($sClass, $oNewGraph->aSourceObjects)) { - $oNewGraph->aSourceObjects[$sClass] = array(); + $oNewGraph->aSourceObjects[$sClass] = []; } $oNewGraph->aSourceObjects[$sClass][] = $oObj->GetKey(); $oNewNode->SetProperty('source', true); } if ($oNode->GetProperty('sink')) { if (!array_key_exists($sClass, $oNewGraph->aSinkObjects)) { - $oNewGraph->aSinkObjects[$sClass] = array(); + $oNewGraph->aSinkObjects[$sClass] = []; } $oNewGraph->aSinkObjects[$sClass][] = $oObj->GetKey(); $oNewNode->SetProperty('sink', true); @@ -917,8 +823,7 @@ class DisplayableGraph extends SimpleGraph } } $oEdgesIter = new RelationTypeIterator($oGraph, 'Edge'); - foreach($oEdgesIter as $oEdge) - { + foreach ($oEdgesIter as $oEdge) { set_time_limit(intval($iLoopTimeLimit)); $oSourceNode = $oNewGraph->GetNode($oEdge->GetSourceNode()->GetId()); $oSinkNode = $oNewGraph->GetNode($oEdge->GetSinkNode()->GetId()); @@ -927,60 +832,44 @@ class DisplayableGraph extends SimpleGraph // Remove duplicate edges between two nodes $oEdgesIter = new RelationTypeIterator($oNewGraph, 'Edge'); - $aEdgeKeys = array(); - foreach($oEdgesIter as $oEdge) - { + $aEdgeKeys = []; + foreach ($oEdgesIter as $oEdge) { set_time_limit(intval($iLoopTimeLimit)); $sSourceId = $oEdge->GetSourceNode()->GetId(); $sSinkId = $oEdge->GetSinkNode()->GetId(); - if ($sSourceId == $sSinkId) - { + if ($sSourceId == $sSinkId) { // Remove self referring edges $oNewGraph->_RemoveEdge($oEdge); - } - else - { + } else { $sKey = $sSourceId.'//'.$sSinkId; - if (array_key_exists($sKey, $aEdgeKeys)) - { + if (array_key_exists($sKey, $aEdgeKeys)) { // Remove duplicate edges $oNewGraph->_RemoveEdge($oEdge); - } - else - { + } else { $aEdgeKeys[$sKey] = true; } } } $oNodesIter = new RelationTypeIterator($oNewGraph, 'Node'); - foreach($oNodesIter as $oNode) - { + foreach ($oNodesIter as $oNode) { set_time_limit(intval($iLoopTimeLimit)); - if ($bDirectionDown && $oNode->GetProperty('source')) - { + if ($bDirectionDown && $oNode->GetProperty('source')) { $oNode->GroupSimilarNeighbours($oNewGraph, $iGroupingThreshold, true, $bDirectionDown); - } - else if (!$bDirectionDown && $oNode->GetProperty('sink')) - { + } elseif (!$bDirectionDown && $oNode->GetProperty('sink')) { $oNode->GroupSimilarNeighbours($oNewGraph, $iGroupingThreshold, true, $bDirectionDown); } } // Groups numbering $oIterator = new RelationTypeIterator($oNewGraph, 'Node'); $iGroupIdx = 0; - foreach($oIterator as $oNode) - { + foreach ($oIterator as $oNode) { set_time_limit(intval($iLoopTimeLimit)); - if ($oNode instanceof DisplayableGroupNode) - { - if ($oNode->GetObjectCount() == 0) - { + if ($oNode instanceof DisplayableGroupNode) { + if ($oNode->GetObjectCount() == 0) { // Remove empty groups $oNewGraph->_RemoveNode($oNode); - } - else - { + } else { $aGroups[] = $oNode->GetObjects(); $oNode->SetProperty('group_index', $iGroupIdx); $iGroupIdx++; @@ -990,27 +879,20 @@ class DisplayableGraph extends SimpleGraph // Remove duplicate edges between two nodes $oEdgesIter = new RelationTypeIterator($oNewGraph, 'Edge'); - $aEdgeKeys = array(); - foreach($oEdgesIter as $oEdge) - { + $aEdgeKeys = []; + foreach ($oEdgesIter as $oEdge) { set_time_limit(intval($iLoopTimeLimit)); $sSourceId = $oEdge->GetSourceNode()->GetId(); $sSinkId = $oEdge->GetSinkNode()->GetId(); - if ($sSourceId == $sSinkId) - { + if ($sSourceId == $sSinkId) { // Remove self referring edges $oNewGraph->_RemoveEdge($oEdge); - } - else - { + } else { $sKey = $sSourceId.'//'.$sSinkId; - if (array_key_exists($sKey, $aEdgeKeys)) - { + if (array_key_exists($sKey, $aEdgeKeys)) { // Remove duplicate edges $oNewGraph->_RemoveEdge($oEdge); - } - else - { + } else { $aEdgeKeys[$sKey] = true; } } @@ -1028,28 +910,22 @@ class DisplayableGraph extends SimpleGraph public function InitFromGraphviz() { $sDot = $this->DumpAsXDot(); - if (strpos($sDot, 'digraph') === false) - { + if (strpos($sDot, 'digraph') === false) { throw new Exception($sDot); } $aChunks = explode(";", $sDot); - foreach($aChunks as $sChunk) - { - if(preg_match('/"([^"]+)".+pos="([0-9\\.]+),([0-9\\.]+)"/ms', $sChunk, $aMatches)) - { + foreach ($aChunks as $sChunk) { + if (preg_match('/"([^"]+)".+pos="([0-9\\.]+),([0-9\\.]+)"/ms', $sChunk, $aMatches)) { $sId = $aMatches[1]; $xPos = $aMatches[2]; $yPos = $aMatches[3]; $oNode = $this->GetNode($sId); - if ($oNode !== null) - { + if ($oNode !== null) { $oNode->x = (float)$xPos; $oNode->y = (float)$yPos; - } - else - { + } else { IssueLog::Warning("??? Position of the non-existing node '$sId', x=$xPos, y=$yPos"); } } @@ -1063,17 +939,13 @@ class DisplayableGraph extends SimpleGraph $yMin = null; $yMax = null; $oIterator = new RelationTypeIterator($this, 'Node'); - foreach($oIterator as $sId => $oNode) - { - if ($xMin === null) // First element in the loop - { + foreach ($oIterator as $sId => $oNode) { + if ($xMin === null) { // First element in the loop $xMin = $oNode->x - $oNode->GetWidth(); $xMax = $oNode->x + $oNode->GetWidth(); $yMin = $oNode->y - $oNode->GetHeight(); $yMax = $oNode->y + $oNode->GetHeight(); - } - else - { + } else { $xMin = min($xMin, $oNode->x - $oNode->GetWidth() / 2); $xMax = max($xMax, $oNode->x + $oNode->GetWidth() / 2); $yMin = min($yMin, $oNode->y - $oNode->GetHeight() / 2); @@ -1081,14 +953,13 @@ class DisplayableGraph extends SimpleGraph } } - return array('xmin' => $xMin, 'xmax' => $xMax, 'ymin' => $yMin, 'ymax' => $yMax); + return ['xmin' => $xMin, 'xmax' => $xMax, 'ymin' => $yMin, 'ymax' => $yMax]; } - function Translate($dx, $dy) + public function Translate($dx, $dy) { $oIterator = new RelationTypeIterator($this, 'Node'); - foreach($oIterator as $sId => $oNode) - { + foreach ($oIterator as $sId => $oNode) { $oNode->x += $dx; $oNode->y += $dy; } @@ -1096,11 +967,9 @@ class DisplayableGraph extends SimpleGraph public function UpdatePositions($aPositions) { - foreach($aPositions as $sNodeId => $aPos) - { + foreach ($aPositions as $sNodeId => $aPos) { $oNode = $this->GetNode($sNodeId); - if ($oNode != null) - { + if ($oNode != null) { $oNode->x = $aPos['x']; $oNode->y = $aPos['y']; } @@ -1110,17 +979,15 @@ class DisplayableGraph extends SimpleGraph /** * Renders as JSON string suitable for loading into the simple_graph widget */ - function GetAsJSON($sContextKey) + public function GetAsJSON($sContextKey) { $aContextDefs = static::GetContextDefinitions($sContextKey, false); - $aData = array('nodes' => array(), 'edges' => array(), 'groups' => array(), 'lists' => array()); + $aData = ['nodes' => [], 'edges' => [], 'groups' => [], 'lists' => []]; $iGroupIdx = 0; $oIterator = new RelationTypeIterator($this, 'Node'); - foreach($oIterator as $sId => $oNode) - { - if ($oNode instanceof DisplayableGroupNode) - { + foreach ($oIterator as $sId => $oNode) { + if ($oNode instanceof DisplayableGroupNode) { // The contents of the "Groups" tab will be rendered // using a separate ajax call, since the content of // the page is made of a mix of HTML / CSS / JS which @@ -1128,53 +995,45 @@ class DisplayableGraph extends SimpleGraph // So we just pass a list of groups, each being defined by a class and a list of keys // in order to avoid redoing the impact computation which is expensive $aObjects = $oNode->GetObjects(); - $aKeys = array(); - foreach($aObjects as $oObj) - { + $aKeys = []; + foreach ($aObjects as $oObj) { $sClass = get_class($oObj); $aKeys[] = $oObj->GetKey(); } - $aData['groups'][$iGroupIdx] = array('class' => $sClass, 'keys' => $aKeys); + $aData['groups'][$iGroupIdx] = ['class' => $sClass, 'keys' => $aKeys]; $oNode->SetProperty('group_index', $iGroupIdx); $iGroupIdx++; - if ($oNode->GetProperty('is_reached')) - { + if ($oNode->GetProperty('is_reached')) { // Also add the objects from this group into the 'list' tab - if (!array_key_exists($sClass, $aData['lists'])) - { + if (!array_key_exists($sClass, $aData['lists'])) { $aData['lists'][$sClass] = $aKeys; - } - else - { + } else { $aData['lists'][$sClass] = array_merge($aData['lists'][$sClass], $aKeys); } } } - if (($oNode instanceof DisplayableNode) && $oNode->GetProperty('is_reached') && is_object($oNode->GetProperty('object'))) - { + if (($oNode instanceof DisplayableNode) && $oNode->GetProperty('is_reached') && is_object($oNode->GetProperty('object'))) { $sObjClass = get_class($oNode->GetProperty('object')); - if (!array_key_exists($sObjClass, $aData['lists'])) - { - $aData['lists'][$sObjClass] = array(); + if (!array_key_exists($sObjClass, $aData['lists'])) { + $aData['lists'][$sObjClass] = []; } $aData['lists'][$sObjClass][] = $oNode->GetProperty('object')->GetKey(); } $aData['nodes'][] = $oNode->GetForRaphael($aContextDefs); } - uksort($aData['lists'], array(get_class($this), 'SortOnClassLabel')); // sort on the localized names of the classes to provide a consistent and stable order + uksort($aData['lists'], [get_class($this), 'SortOnClassLabel']); // sort on the localized names of the classes to provide a consistent and stable order $oIterator = new RelationTypeIterator($this, 'Edge'); - foreach($oIterator as $sId => $oEdge) - { - $aEdge = array(); + foreach ($oIterator as $sId => $oEdge) { + $aEdge = []; $aEdge['id'] = $oEdge->GetId(); $aEdge['source_node_id'] = $oEdge->GetSourceNode()->GetId(); $aEdge['sink_node_id'] = $oEdge->GetSinkNode()->GetId(); $fOpacity = ($oEdge->GetSinkNode()->GetProperty('is_reached') && $oEdge->GetSourceNode()->GetProperty('is_reached') ? 1 : 0.2); - $aEdge['attr'] = array('opacity' => $fOpacity, 'stroke' => '#000'); + $aEdge['attr'] = ['opacity' => $fOpacity, 'stroke' => '#000']; $aData['edges'][] = $aEdge; } @@ -1204,7 +1063,7 @@ class DisplayableGraph extends SimpleGraph * * @since 2.7.7 3.0.2 3.1.0 N°4985 $sComments param is no longer optional */ - function RenderAsPDF(PDFPage $oPage, $sComments, $sContextKey, $xMin = -1, $xMax = -1, $yMin = -1, $yMax = -1) + public function RenderAsPDF(PDFPage $oPage, $sComments, $sContextKey, $xMin = -1, $xMax = -1, $yMin = -1, $yMax = -1) { $aContextDefs = static::GetContextDefinitions($sContextKey, false); // No need to develop the parameters $oPdf = $oPage->get_tcpdf(); @@ -1214,20 +1073,16 @@ class DisplayableGraph extends SimpleGraph $aMargins = $oPdf->getMargins(); - if ($xMin == -1) - { + if ($xMin == -1) { $xMin = $aMargins['left']; } - if ($xMax == -1) - { + if ($xMax == -1) { $xMax = $oPdf->getPageWidth() - $aMargins['right']; } - if ($yMin == -1) - { + if ($yMin == -1) { $yMin = $aMargins['top']; } - if ($yMax == -1) - { + if ($yMax == -1) { $yMax = $oPdf->getPageHeight() - $aMargins['bottom']; } @@ -1251,19 +1106,17 @@ class DisplayableGraph extends SimpleGraph $dx = ($fPageW - $fScale * $w) / 2; $dy = ($fPageH - $fScale * $h) / 2; - $this->Translate(($xMin + $dx)/$fScale, ($yMin + $dy)/$fScale); + $this->Translate(($xMin + $dx) / $fScale, ($yMin + $dy) / $fScale); $oIterator = new RelationTypeIterator($this, 'Edge'); $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop'); - foreach($oIterator as $sId => $oEdge) - { + foreach ($oIterator as $sId => $oEdge) { set_time_limit(intval($iLoopTimeLimit)); $oEdge->RenderAsPDF($oPdf, $this, $fScale, $aContextDefs); } $oIterator = new RelationTypeIterator($this, 'Node'); - foreach($oIterator as $sId => $oNode) - { + foreach ($oIterator as $sId => $oNode) { set_time_limit(intval($iLoopTimeLimit)); $oNode->RenderAsPDF($oPdf, $this, $fScale, $aContextDefs); } @@ -1292,17 +1145,14 @@ class DisplayableGraph extends SimpleGraph $fPadding = 1; // in mm $oIterator = new RelationTypeIterator($this, 'Node'); $fMaxWidth = max($oPdf->GetStringWidth(Dict::S('UI:Relation:Key')) - $fIconSize, $oPdf->GetStringWidth(Dict::S('UI:Relation:Comments')) - $fIconSize); - $aClasses = array(); - $aIcons = array(); - $aContexts = array(); - $aContextIcons = array(); + $aClasses = []; + $aIcons = []; + $aContexts = []; + $aContextIcons = []; $oPdf->SetFontParams('', $fFontSize, '', true); - foreach($oIterator as $sId => $oNode) - { - if ($sClass = $oNode->GetObjectClass()) - { - if (!array_key_exists($sClass, $aClasses)) - { + foreach ($oIterator as $sId => $oNode) { + if ($sClass = $oNode->GetObjectClass()) { + if (!array_key_exists($sClass, $aClasses)) { $sClassLabel = MetaModel::GetName($sClass); $width = $oPdf->GetStringWidth($sClassLabel); $fMaxWidth = max($width, $fMaxWidth); @@ -1313,10 +1163,8 @@ class DisplayableGraph extends SimpleGraph } } $aContextRootCauses = $oNode->GetProperty('context_root_causes'); - if (!is_null($aContextRootCauses)) - { - foreach($aContextRootCauses as $key => $aObjects) - { + if (!is_null($aContextRootCauses)) { + foreach ($aContextRootCauses as $key => $aObjects) { $aContexts[$key] = Dict::S($aContextDefs[$key]['dict']); $aContextIcons[$key] = APPROOT.'env-'.utils::GetCurrentEnvironment().'/'.$aContextDefs[$key]['icon']; } @@ -1339,7 +1187,7 @@ class DisplayableGraph extends SimpleGraph $oPdf->AddImage($aContextIcons[$key], $xMin + 1 + $fIconSize * 0.125, $yPos + $fIconSize * 0.125, $fIconSize * 0.75, $fIconSize * 0.75); $yPos += $fIconSize + 2 * $fPadding; } - $oPdf->Rect($xMin, $yMin, $fMaxWidth + $fIconSize + 3*$fPadding, $yMax - $yMin, 'D'); + $oPdf->Rect($xMin, $yMin, $fMaxWidth + $fIconSize + 3 * $fPadding, $yMax - $yMin, 'D'); if ($sComments != '') { // Draw the comment text (surrounded by a rectangle) @@ -1355,7 +1203,7 @@ class DisplayableGraph extends SimpleGraph $yMax = $yPos - $fPadding; } - return array('xmin' => $xMin + $fMaxWidth + $fIconSize + 4*$fPadding, 'xmax' => $xMax, 'ymin' => $yMin, 'ymax' => $yMax); + return ['xmin' => $xMin + $fMaxWidth + $fIconSize + 4 * $fPadding, 'xmax' => $xMax, 'ymin' => $yMin, 'ymax' => $yMax]; } /** @@ -1368,45 +1216,33 @@ class DisplayableGraph extends SimpleGraph * @param array $aContextParams Arguments for the queries (via ToArgs()) if $bDevelopParams == true * @return multitype:multitype:string */ - public static function GetContextDefinitions($sContextKey, $bDevelopParams = true, $aContextParams = array()) + public static function GetContextDefinitions($sContextKey, $bDevelopParams = true, $aContextParams = []) { - $aContextDefs = array(); + $aContextDefs = []; $aLevels = explode('/', $sContextKey); - if (count($aLevels) < 5) - { + if (count($aLevels) < 5) { IssueLog::Warning("GetContextDefinitions: invalid 'sContextKey' = '$sContextKey'. 5 levels of / are expected !"); - } - else - { + } else { $sLeafClass = $aLevels[2]; - if (!MetaModel::IsValidClass($sLeafClass)) - { + if (!MetaModel::IsValidClass($sLeafClass)) { IssueLog::Warning("GetContextDefinitions: invalid 'sLeafClass' = '$sLeafClass'. A valid class name is expected in 3rd position inside '$sContextKey' !"); - } - else - { - $aRelationContext = MetaModel::GetConfig()->GetModuleSetting($aLevels[0], $aLevels[1], array()); - foreach(MetaModel::EnumParentClasses($sLeafClass, ENUM_PARENT_CLASSES_ALL) as $sClass) - { - if (isset($aRelationContext[$sClass][$aLevels[3]][$aLevels[4]]['items'])) - { + } else { + $aRelationContext = MetaModel::GetConfig()->GetModuleSetting($aLevels[0], $aLevels[1], []); + foreach (MetaModel::EnumParentClasses($sLeafClass, ENUM_PARENT_CLASSES_ALL) as $sClass) { + if (isset($aRelationContext[$sClass][$aLevels[3]][$aLevels[4]]['items'])) { $aContextDefs = array_merge($aContextDefs, $aRelationContext[$sClass][$aLevels[3]][$aLevels[4]]['items']); } } // Check if the queries are valid - foreach($aContextDefs as $sKey => $sDefs) - { + foreach ($aContextDefs as $sKey => $sDefs) { $sOQL = $aContextDefs[$sKey]['oql']; - try - { + try { // Expand the parameters. If anything goes wrong, then the query is considered as invalid and removed from the list $oSearch = DBObjectSearch::FromOQL($sOQL); $aContextDefs[$sKey]['oql'] = $oSearch->ToOQL($bDevelopParams, $aContextParams); - } - catch(Exception $e) - { + } catch (Exception $e) { IssueLog::Warning('Invalid OQL query: '.$sOQL.' in the parameter '.$sContextKey); unset($aContextDefs[$sKey]); } @@ -1436,7 +1272,7 @@ class DisplayableGraph extends SimpleGraph * @throws \DictExceptionMissingString * */ - function Display(WebPage $oP, $aResults, $sRelation, ApplicationContext $oAppContext, $aExcludedObjects, $sObjClass, $iObjKey, $sContextKey, $aContextParams = array(), bool $bLazyLoading = false) + public function Display(WebPage $oP, $aResults, $sRelation, ApplicationContext $oAppContext, $aExcludedObjects, $sObjClass, $iObjKey, $sContextKey, $aContextParams = [], bool $bLazyLoading = false) { $oP->AddSubBlock($this->DisplayFilterBox($oP, $aResults, $bLazyLoading)); $this->DisplayGraph($oP, $sRelation, $oAppContext, $aExcludedObjects, $sObjClass, $iObjKey, $sContextKey, $aContextParams, $bLazyLoading); @@ -1460,7 +1296,7 @@ class DisplayableGraph extends SimpleGraph * * @since 3.1.1 3.2.0 N°3767 */ - function DisplayGraph(WebPage $oP, $sRelation, ApplicationContext $oAppContext, $aExcludedObjects, $sObjClass, $iObjKey, $sContextKey, $aContextParams = array(), bool $bLazyLoading = false): void + public function DisplayGraph(WebPage $oP, $sRelation, ApplicationContext $oAppContext, $aExcludedObjects, $sObjClass, $iObjKey, $sContextKey, $aContextParams = [], bool $bLazyLoading = false): void { list($aExcludedByClass, $aAdditionalContexts) = $this->GetFilteringData($sContextKey, $aContextParams, $aExcludedObjects); @@ -1490,16 +1326,16 @@ class DisplayableGraph extends SimpleGraph $oP->add_ready_script("$('.simple-graph').width(18/2.54*96).resizable({ stop: function() { $(window).trigger('resized'); }});"); // Default width about 18 cm, since most browsers assume 96 dpi } $oP->add('
      '); - $aParams = array( + $aParams = [ 'source_url' => $sLoadFromURL, 'sources' => ($this->bDirectionDown ? $this->aSourceObjects : $this->aSinkObjects), 'excluded' => $aExcludedByClass, 'grouping_threshold' => $iGroupingThreshold, - 'export_as_pdf' => array('url' => $sExportAsPdfURL, 'label' => Dict::S('UI:Relation:ExportAsPDF')), + 'export_as_pdf' => ['url' => $sExportAsPdfURL, 'label' => Dict::S('UI:Relation:ExportAsPDF')], 'transaction_id' => utils::GetNewTransactionId(), - 'export_as_attachment' => array('url' => $sExportAsDocumentURL, 'label' => Dict::S('UI:Relation:ExportAsAttachment'), 'obj_class' => $sObjClass, 'obj_key' => $iObjKey), - 'drill_down' => array('url' => $sDrillDownURL, 'label' => Dict::S('UI:Relation:DrillDown')), - 'labels' => array( + 'export_as_attachment' => ['url' => $sExportAsDocumentURL, 'label' => Dict::S('UI:Relation:ExportAsAttachment'), 'obj_class' => $sObjClass, 'obj_key' => $iObjKey], + 'drill_down' => ['url' => $sDrillDownURL, 'label' => Dict::S('UI:Relation:DrillDown')], + 'labels' => [ 'export_pdf_title' => Dict::S('UI:Relation:PDFExportOptions'), 'export_as_attachment_title' => $sAttachmentExportTitle, 'export' => Dict::S('UI:Button:Export'), @@ -1517,25 +1353,25 @@ class DisplayableGraph extends SimpleGraph 'additional_context_info' => Dict::S('UI:Relation:AdditionalContextInfo'), 'zoom' => Dict::S('UI:Relation:Zoom'), 'loading' => Dict::S('UI:Loading'), - ), - 'page_format' => array( + ], + 'page_format' => [ 'label' => Dict::S('UI:Relation:PDFExportPageFormat'), - 'values' => array( + 'values' => [ 'A3' => Dict::S('UI:PageFormat_A3'), 'A4' => Dict::S('UI:PageFormat_A4'), 'Letter' => Dict::S('UI:PageFormat_Letter'), - ), - ), - 'page_orientation' => array( + ], + ], + 'page_orientation' => [ 'label' => Dict::S('UI:Relation:PDFExportPageOrientation'), - 'values' => array( + 'values' => [ 'P' => Dict::S('UI:PageOrientation_Portrait'), 'L' => Dict::S('UI:PageOrientation_Landscape'), - ), - ), + ], + ], 'additional_contexts' => $aAdditionalContexts, 'context_key' => $sContextKey, - ); + ]; if (!extension_loaded('gd')) { // PDF export requires GD unset($aParams['export_as_pdf']); @@ -1550,8 +1386,7 @@ class DisplayableGraph extends SimpleGraph $oP->add_script("function Load(){var aExcluded = []; $('input[name^=excluded]').each( function() {if (!$(this).prop('checked')) { aExcluded.push($(this).val()); }} ); var params= $.extend(".json_encode($aParams).", {excluded_classes: aExcluded}); $('#$sId').simple_graph(params);}"); $oP->add_ready_script("$('#graph').html('".utils::TextToHtml(Dict::S('Relation:impacts/NoFilteredData'))."');$('#impacted_objects_lists').html('".utils::TextToHtml(Dict::S('Relation:impacts/NoFilteredData'))."');$('#impacted_groups').html('".utils::TextToHtml(Dict::S('Relation:impacts/NoFilteredData'))."');"); } - } - catch (Exception $e) { + } catch (Exception $e) { $oP->add('
      '.$e->getMessage().'
      '); } $oP->add_script( @@ -1650,7 +1485,7 @@ EOF } else { $oP->add_ready_script("$('#dh_flash').addClass('closed');"); } - $aSortedElements = array(); + $aSortedElements = []; foreach ($aResults as $sClassIdx => $aObjects) { foreach ($aObjects as $oCurrObj) { $sSubClass = get_class($oCurrObj); @@ -1687,19 +1522,19 @@ EOF public function GetFilteringData(string $sContextKey, array $aContextParams, array $aExcludedObjects): array { $aContextDefs = static::GetContextDefinitions($sContextKey, true, $aContextParams); - $aExcludedByClass = array(); + $aExcludedByClass = []; foreach ($aExcludedObjects as $oObj) { if (!array_key_exists(get_class($oObj), $aExcludedByClass)) { - $aExcludedByClass[get_class($oObj)] = array(); + $aExcludedByClass[get_class($oObj)] = []; } $aExcludedByClass[get_class($oObj)][] = $oObj->GetKey(); } - $aAdditionalContexts = array(); + $aAdditionalContexts = []; foreach ($aContextDefs as $sKey => $aDefinition) { - $aAdditionalContexts[] = array('key' => $sKey, 'label' => Dict::S($aDefinition['dict']), 'oql' => $aDefinition['oql'], 'default' => (array_key_exists('default', $aDefinition) && ($aDefinition['default'] == 'yes'))); + $aAdditionalContexts[] = ['key' => $sKey, 'label' => Dict::S($aDefinition['dict']), 'oql' => $aDefinition['oql'], 'default' => (array_key_exists('default', $aDefinition) && ($aDefinition['default'] == 'yes'))]; } - return array($aExcludedByClass, $aAdditionalContexts); + return [$aExcludedByClass, $aAdditionalContexts]; } } diff --git a/core/email.class.inc.php b/core/email.class.inc.php index ca26d9223..5e559861c 100644 --- a/core/email.class.inc.php +++ b/core/email.class.inc.php @@ -1,9 +1,10 @@ - /** * Send an email (abstraction for synchronous/asynchronous modes) * @@ -27,9 +27,9 @@ use Combodo\iTop\Core\Email\EmailFactory; use Combodo\iTop\Core\Email\iEMail; -define ('EMAIL_SEND_OK', 0); -define ('EMAIL_SEND_PENDING', 1); -define ('EMAIL_SEND_ERROR', 2); +define('EMAIL_SEND_OK', 0); +define('EMAIL_SEND_PENDING', 1); +define('EMAIL_SEND_ERROR', 2); class EMail implements iEMail { @@ -43,18 +43,18 @@ class EMail implements iEMail protected $oMailer; // Serialization formats - const ORIGINAL_FORMAT = 1; // Original format, consisting in serializing the whole object, inculding the Swift Mailer's object. + public const ORIGINAL_FORMAT = 1; // Original format, consisting in serializing the whole object, inculding the Swift Mailer's object. // Did not work with attachements since their binary representation cannot be stored as a valid UTF-8 string - const FORMAT_V2 = 2; // New format, only the raw data are serialized (base64 encoded if needed) - + public const FORMAT_V2 = 2; // New format, only the raw data are serialized (base64 encoded if needed) + /** @var int ENUM_SEND_DEFAULT This option can be used when sending an e-mail to respect the default configuration parameter. */ - const ENUM_SEND_DEFAULT = 0; - + public const ENUM_SEND_DEFAULT = 0; + /** @var int ENUM_SEND_FORCE_SYNCHRONOUS This option can be used when sending an e-mail to ignore the default and force synchronous sending instead. Example of a use case: instant e-mail test. */ - const ENUM_SEND_FORCE_SYNCHRONOUS = 1; - + public const ENUM_SEND_FORCE_SYNCHRONOUS = 1; + /** @var int ENUM_SEND_FORCE_ASYNCHRONOUS This option can be used when sending an e-mail to ignore the default and force synchronous sending instead. Example of a use case: Bulk mails. */ - const ENUM_SEND_FORCE_ASYNCHRONOUS = 2; + public const ENUM_SEND_FORCE_ASYNCHRONOUS = 2; public function __construct() { @@ -157,7 +157,7 @@ class EMail implements iEMail public function SetBody($sBody, $sMimeType = 'text/html', $sCustomStyles = null) { $this->oMailer->SetBody($sBody, $sMimeType, $sCustomStyles); - } + } public function AddPart($sText, $sMimeType = 'text/html') { @@ -208,4 +208,4 @@ class EMail implements iEMail { $this->oMailer->SetRecipientReplyTo($sAddress); } -} \ No newline at end of file +} diff --git a/core/event.class.inc.php b/core/event.class.inc.php index 4deadbdd6..d02ef4c0e 100644 --- a/core/event.class.inc.php +++ b/core/event.class.inc.php @@ -24,31 +24,31 @@ class Event extends DBObject implements iDisplay { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb,view_in_gui", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_event", "db_key_field" => "id", "db_finalclass_field" => "realclass", - "order_by_default" => array('date' => false) - ); + "order_by_default" => ['date' => false], + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeText("message", array("allowed_values"=>null, "sql"=>"message", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDateTime("date", array("allowed_values"=>null, "sql"=>"date", "default_value"=>"NOW()", "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("userinfo", array("allowed_values"=>null, "sql"=>"userinfo", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); -// MetaModel::Init_AddAttribute(new AttributeString("userinfo", array("allowed_values"=>null, "sql"=>"userinfo", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeText("message", ["allowed_values" => null, "sql" => "message", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDateTime("date", ["allowed_values" => null, "sql" => "date", "default_value" => "NOW()", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("userinfo", ["allowed_values" => null, "sql" => "userinfo", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + // MetaModel::Init_AddAttribute(new AttributeString("userinfo", array("allowed_values"=>null, "sql"=>"userinfo", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'message', 'userinfo')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'finalclass', 'message')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'message', 'userinfo']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'finalclass', 'message']); // Attributes to be displayed for a list // Search criteria -// MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form -// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + // MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form + // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } /** @@ -58,12 +58,9 @@ class Event extends DBObject implements iDisplay */ public static function MapContextParam($sContextParam) { - if ($sContextParam == 'menu') - { + if ($sContextParam == 'menu') { return null; - } - else - { + } else { return $sContextParam; } } @@ -79,7 +76,7 @@ class Event extends DBObject implements iDisplay public function GetHilightClass() { // Possible return values are: - // HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING, HILIGHT_CLASS_OK, HILIGHT_CLASS_NONE + // HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING, HILIGHT_CLASS_OK, HILIGHT_CLASS_NONE return HILIGHT_CLASS_NONE; // Not hilighted by default } @@ -88,7 +85,7 @@ class Event extends DBObject implements iDisplay return 'UI.php'; } - function DisplayDetails(WebPage $oPage, $bEditMode = false) + public function DisplayDetails(WebPage $oPage, $bEditMode = false) { // Object's details //$this->DisplayBareHeader($oPage, $bEditMode); @@ -97,21 +94,23 @@ class Event extends DBObject implements iDisplay $oPage->SetCurrentTab('UI:PropertiesTab'); $this->DisplayBareProperties($oPage, $bEditMode); } - - function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '', $aExtraParams = array()) - { - if ($bEditMode) return array(); // Not editable - $aDetails = array(); + public function DisplayBareProperties(WebPage $oPage, $bEditMode = false, $sPrefix = '', $aExtraParams = []) + { + if ($bEditMode) { + return []; + } // Not editable + + $aDetails = []; $sClass = get_class($this); $aZList = MetaModel::FlattenZlist(MetaModel::GetZListItems($sClass, 'details')); foreach ($aZList as $sAttCode) { $sDisplayValue = $this->GetAsHTML($sAttCode); - $aDetails[] = array('label' => ''.MetaModel::GetLabel($sClass, $sAttCode).'', 'value' => $sDisplayValue); + $aDetails[] = ['label' => ''.MetaModel::GetLabel($sClass, $sAttCode).'', 'value' => $sDisplayValue]; } $oPage->Details($aDetails); - return array(); + return []; } } @@ -119,33 +118,33 @@ class EventNotification extends Event { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb,view_in_gui", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_event_notification", "db_key_field" => "id", "db_finalclass_field" => "", - "order_by_default" => array('date' => false), - 'indexes' => array( - array('object_id'), - ) - ); + "order_by_default" => ['date' => false], + 'indexes' => [ + ['object_id'], + ], + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("trigger_id", array("targetclass"=>"Trigger", "jointype"=> "", "allowed_values"=>null, "sql"=>"trigger_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalKey("action_id", array("targetclass" => "Action", "jointype" => "", "allowed_values" => null, "sql" => "action_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeInteger("object_id", array("allowed_values" => null, "sql" => "object_id", "default_value" => 0, "is_null_allowed" => false, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("trigger_id", ["targetclass" => "Trigger", "jointype" => "", "allowed_values" => null, "sql" => "trigger_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalKey("action_id", ["targetclass" => "Action", "jointype" => "", "allowed_values" => null, "sql" => "action_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeInteger("object_id", ["allowed_values" => null, "sql" => "object_id", "default_value" => 0, "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'message', 'userinfo', 'trigger_id', 'action_id', 'object_id')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'message')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'message', 'userinfo', 'trigger_id', 'action_id', 'object_id']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'message']); // Attributes to be displayed for a list // Search criteria -// MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form -// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + // MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form + // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } } @@ -153,35 +152,35 @@ class EventNotificationEmail extends EventNotification { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb,view_in_gui", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_event_email", "db_key_field" => "id", "db_finalclass_field" => "", - "order_by_default" => array('date' => false) - ); + "order_by_default" => ['date' => false], + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeText("to", array("allowed_values"=>null, "sql"=>"to", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("cc", array("allowed_values"=>null, "sql"=>"cc", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("bcc", array("allowed_values"=>null, "sql"=>"bcc", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("from", array("allowed_values"=>null, "sql"=>"from", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("subject", array("allowed_values"=>null, "sql"=>"subject", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeHTML("body", array("allowed_values"=>null, "sql"=>"body", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeTable("attachments", array("allowed_values"=>null, "sql"=>"attachments", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeText("to", ["allowed_values" => null, "sql" => "to", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("cc", ["allowed_values" => null, "sql" => "cc", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("bcc", ["allowed_values" => null, "sql" => "bcc", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("from", ["allowed_values" => null, "sql" => "from", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("subject", ["allowed_values" => null, "sql" => "subject", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeHTML("body", ["allowed_values" => null, "sql" => "body", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeTable("attachments", ["allowed_values" => null, "sql" => "attachments", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'message', 'trigger_id', 'action_id', 'object_id', 'to', 'cc', 'bcc', 'from', 'subject', 'body', 'attachments')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'message', 'to', 'subject', 'attachments')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'message', 'trigger_id', 'action_id', 'object_id', 'to', 'cc', 'bcc', 'from', 'subject', 'body', 'attachments']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'message', 'to', 'subject', 'attachments']); // Attributes to be displayed for a list // Search criteria -// MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form -// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + // MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form + // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } } @@ -189,34 +188,34 @@ class EventIssue extends Event { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb,view_in_gui", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_event_issue", "db_key_field" => "id", "db_finalclass_field" => "", - "order_by_default" => array('date' => false) - ); + "order_by_default" => ['date' => false], + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("issue", array("allowed_values"=>null, "sql"=>"issue", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("impact", array("allowed_values"=>null, "sql"=>"impact", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("page", array("allowed_values"=>null, "sql"=>"page", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributePropertySet("arguments_post", array("allowed_values"=>null, "sql"=>"arguments_post", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributePropertySet("arguments_get", array("allowed_values"=>null, "sql"=>"arguments_get", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeTable("callstack", array("allowed_values"=>null, "sql"=>"callstack", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributePropertySet("data", array("allowed_values"=>null, "sql"=>"data", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("issue", ["allowed_values" => null, "sql" => "issue", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("impact", ["allowed_values" => null, "sql" => "impact", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("page", ["allowed_values" => null, "sql" => "page", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributePropertySet("arguments_post", ["allowed_values" => null, "sql" => "arguments_post", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributePropertySet("arguments_get", ["allowed_values" => null, "sql" => "arguments_get", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeTable("callstack", ["allowed_values" => null, "sql" => "callstack", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributePropertySet("data", ["allowed_values" => null, "sql" => "data", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'message', 'userinfo', 'issue', 'impact', 'page', 'arguments_post', 'arguments_get', 'callstack', 'data')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'issue', 'impact')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'message', 'userinfo', 'issue', 'impact', 'page', 'arguments_post', 'arguments_get', 'callstack', 'data']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'issue', 'impact']); // Attributes to be displayed for a list // Search criteria -// MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form -// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + // MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form + // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } protected function OnInsert() @@ -229,20 +228,16 @@ class EventIssue extends Event $this->Set('userinfo', UserRights::GetUserId()); } - if (array_key_exists('_GET', $GLOBALS) && is_array($GLOBALS['_GET'])) - { + if (array_key_exists('_GET', $GLOBALS) && is_array($GLOBALS['_GET'])) { $this->Set('arguments_get', $this->SanitizeRequestParams($GLOBALS['_GET'])); - } - else - { - $this->Set('arguments_get', array()); + } else { + $this->Set('arguments_get', []); } - if (array_key_exists('_POST', $GLOBALS) && is_array($GLOBALS['_POST'])) - { + if (array_key_exists('_POST', $GLOBALS) && is_array($GLOBALS['_POST'])) { $this->Set('arguments_post', $this->SanitizeRequestParams($GLOBALS['_POST'])); } else { - $this->Set('arguments_post', array()); + $this->Set('arguments_post', []); } $sLength = mb_strlen($this->Get('issue')); if ($sLength > 255) { @@ -279,44 +274,42 @@ class EventIssue extends Event } } - return $aSanitizedParams; } } - class EventWebService extends Event { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb,view_in_gui", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_event_webservice", "db_key_field" => "id", "db_finalclass_field" => "", - "order_by_default" => array('date' => false) - ); + "order_by_default" => ['date' => false], + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("verb", array("allowed_values"=>null, "sql"=>"verb", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("verb", ["allowed_values" => null, "sql" => "verb", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); //MetaModel::Init_AddAttribute(new AttributeStructure("arguments", array("allowed_values"=>null, "sql"=>"data", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeBoolean("result", array("allowed_values"=>null, "sql"=>"result", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("log_info", array("allowed_values"=>null, "sql"=>"log_info", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("log_warning", array("allowed_values"=>null, "sql"=>"log_warning", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("log_error", array("allowed_values"=>null, "sql"=>"log_error", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("data", array("allowed_values"=>null, "sql"=>"data", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeBoolean("result", ["allowed_values" => null, "sql" => "result", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("log_info", ["allowed_values" => null, "sql" => "log_info", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("log_warning", ["allowed_values" => null, "sql" => "log_warning", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("log_error", ["allowed_values" => null, "sql" => "log_error", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("data", ["allowed_values" => null, "sql" => "data", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'verb', 'result', 'log_info', 'log_warning', 'log_error', 'data')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'verb', 'result')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'verb', 'result', 'log_info', 'log_warning', 'log_error', 'data']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'verb', 'result']); // Attributes to be displayed for a list // Search criteria -// MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form -// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + // MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form + // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } } @@ -324,34 +317,34 @@ class EventRestService extends Event { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb,view_in_gui", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_event_restservice", "db_key_field" => "id", "db_finalclass_field" => "", - "order_by_default" => array('date' => false) - ); + "order_by_default" => ['date' => false], + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("operation", array("allowed_values"=>null, "sql"=>"operation", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("version", array("allowed_values"=>null, "sql"=>"version", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("json_input", array("allowed_values"=>null, "sql"=>"json_input", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("operation", ["allowed_values" => null, "sql" => "operation", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("version", ["allowed_values" => null, "sql" => "version", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("json_input", ["allowed_values" => null, "sql" => "json_input", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeInteger("code", array("allowed_values"=>null, "sql"=>"code", "default_value"=>0, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeText("json_output", array("allowed_values"=>null, "sql"=>"json_output", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("provider", array("allowed_values"=>null, "sql"=>"provider", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeInteger("code", ["allowed_values" => null, "sql" => "code", "default_value" => 0, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("json_output", ["allowed_values" => null, "sql" => "json_output", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("provider", ["allowed_values" => null, "sql" => "provider", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'operation', 'version', 'json_input', 'message', 'code', 'json_output', 'provider')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'operation', 'message')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'operation', 'version', 'json_input', 'message', 'code', 'json_output', 'provider']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'operation', 'message']); // Attributes to be displayed for a list // Search criteria -// MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form -// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + // MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form + // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } } @@ -359,66 +352,64 @@ class EventLoginUsage extends Event { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb,view_in_gui", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_event_loginusage", "db_key_field" => "id", "db_finalclass_field" => "", - "order_by_default" => array('date' => false) - ); + "order_by_default" => ['date' => false], + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("user_id", array("targetclass"=>"User", "jointype"=> "", "allowed_values"=>null, "sql"=>"user_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_SILENT, "depends_on"=>array()))); - $aZList = array('date', 'user_id'); - if (MetaModel::IsValidAttCode('Contact', 'name')) - { - MetaModel::Init_AddAttribute(new AttributeExternalField("contact_name", array("allowed_values"=>null, "extkey_attcode"=>"user_id", "target_attcode"=>"contactid", "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("user_id", ["targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "user_id", "is_null_allowed" => false, "on_target_delete" => DEL_SILENT, "depends_on" => []])); + $aZList = ['date', 'user_id']; + if (MetaModel::IsValidAttCode('Contact', 'name')) { + MetaModel::Init_AddAttribute(new AttributeExternalField("contact_name", ["allowed_values" => null, "extkey_attcode" => "user_id", "target_attcode" => "contactid", "is_null_allowed" => true, "depends_on" => []])); $aZList[] = 'contact_name'; } - if (MetaModel::IsValidAttCode('Contact', 'email')) - { - MetaModel::Init_AddAttribute(new AttributeExternalField("contact_email", array("allowed_values"=>null, "extkey_attcode"=>"user_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array()))); + if (MetaModel::IsValidAttCode('Contact', 'email')) { + MetaModel::Init_AddAttribute(new AttributeExternalField("contact_email", ["allowed_values" => null, "extkey_attcode" => "user_id", "target_attcode" => "email", "is_null_allowed" => true, "depends_on" => []])); $aZList[] = 'contact_email'; } // Display lists - MetaModel::Init_SetZListItems('details', array_merge($aZList, array('userinfo', 'message'))); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array_merge($aZList, array('userinfo'))); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', array_merge($aZList, ['userinfo', 'message'])); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', array_merge($aZList, ['userinfo'])); // Attributes to be displayed for a list // Search criteria MetaModel::Init_SetZListItems('standard_search', $aZList); // Criteria of the std search form -// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } } class EventOnObject extends Event { - public static function Init() - { - $aParams = array - ( - "category" => "core/cmdb,view_in_gui", - "key_type" => "autoincrement", - "name_attcode" => "", - "state_attcode" => "", - "reconc_keys" => array(), - "db_table" => "priv_event_onobject", - "db_key_field" => "id", - "db_finalclass_field" => "", - "display_template" => "", - "order_by_default" => array('date' => false) - ); - MetaModel::Init_Params($aParams); - MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("obj_class", array("allowed_values"=>null, "sql"=>"obj_class", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeInteger("obj_key", array("allowed_values"=>null, "sql"=>"obj_key", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + public static function Init() + { + $aParams = + [ + "category" => "core/cmdb,view_in_gui", + "key_type" => "autoincrement", + "name_attcode" => "", + "state_attcode" => "", + "reconc_keys" => [], + "db_table" => "priv_event_onobject", + "db_key_field" => "id", + "db_finalclass_field" => "", + "display_template" => "", + "order_by_default" => ['date' => false], + ]; + MetaModel::Init_Params($aParams); + MetaModel::Init_InheritAttributes(); + MetaModel::Init_AddAttribute(new AttributeString("obj_class", ["allowed_values" => null, "sql" => "obj_class", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeInteger("obj_key", ["allowed_values" => null, "sql" => "obj_key", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); - // Display lists - MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'obj_class', 'obj_key', 'message')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'obj_class', 'obj_key', 'message')); // Attributes to be displayed for a list - } + // Display lists + MetaModel::Init_SetZListItems('details', ['date', 'userinfo', 'obj_class', 'obj_key', 'message']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['date', 'userinfo', 'obj_class', 'obj_key', 'message']); // Attributes to be displayed for a list + } } diff --git a/core/excelbulkexport.class.inc.php b/core/excelbulkexport.class.inc.php index 57eb40f96..6f4632962 100644 --- a/core/excelbulkexport.class.inc.php +++ b/core/excelbulkexport.class.inc.php @@ -1,4 +1,5 @@ aStatusInfo['formatted_text'] = (bool)utils::ReadParam('formatted_text', 0, true); - + $sDateFormatRadio = utils::ReadParam('excel_date_format_radio', ''); - switch($sDateFormatRadio) - { + switch ($sDateFormatRadio) { case 'default': - // Export from the UI => format = same as is the UI - $this->aStatusInfo['date_format'] = (string)AttributeDateTime::GetFormat(); - break; - + // Export from the UI => format = same as is the UI + $this->aStatusInfo['date_format'] = (string)AttributeDateTime::GetFormat(); + break; + case 'custom': - // Custom format specified from the UI - $this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetFormat(), true, 'raw_data'); - break; + // Custom format specified from the UI + $this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetFormat(), true, 'raw_data'); + break; default: // Export from the command line (or scripted) => default format is SQL, as in previous versions of iTop, unless specified otherwise @@ -67,7 +67,7 @@ class ExcelBulkExport extends TabularBulkExport public function EnumFormParts() { - return array_merge(parent::EnumFormParts(), array('xlsx_options' => array('formatted_text'), 'interactive_fields_xlsx' => array('interactive_fields_xlsx'))); + return array_merge(parent::EnumFormParts(), ['xlsx_options' => ['formatted_text'], 'interactive_fields_xlsx' => ['interactive_fields_xlsx']]); } /** @@ -121,7 +121,6 @@ class ExcelBulkExport extends TabularBulkExport $oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox'); $oFieldSetDate->AddSubBlock($oRadioCustom); - $oP->add_ready_script( <<'.utils::EscapeHtml($oAttDef->GetEditValue($oObj->Get($sAttCode), $oObj)).''; @@ -175,74 +171,50 @@ EOF protected function GetValue($oObj, $sAttCode) { - switch($sAttCode) - { + switch ($sAttCode) { case 'id': $sRet = $oObj->GetKey(); break; - + default: - $value = $oObj->Get($sAttCode); - if ($value instanceOf ormCaseLog) - { - if (array_key_exists('formatted_text', $this->aStatusInfo) && $this->aStatusInfo['formatted_text']) - { - $sText = $value->GetText(); - } - else - { - $sText = $value->GetAsPlainText(); - } - // Extract the case log as text and remove the "===" which make Excel think that the cell contains a formula the next time you edit it! - $sRet = trim(preg_replace('/========== ([^=]+) ============/', '********** $1 ************', $sText)); - } - else if ($value instanceOf DBObjectSet) - { - $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); - $sRet = $oAttDef->GetAsCSV($value, '', '', $oObj); - } - else if ($value instanceOf ormDocument) - { - $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); - $sRet = $oAttDef->GetAsCSV($value, '', '', $oObj); - } - else if ($value instanceOf ormSet) - { - $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); - $sRet = $oAttDef->GetAsCSV($value, '', '', $oObj); - } - else - { - $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); - if ($oAttDef instanceof AttributeDateTime) - { - // Date and times are formatted using the ISO encoding, not the localized format - if ($oAttDef->IsNull($value)) - { - // NOt a valid date - $sRet = ''; + $value = $oObj->Get($sAttCode); + if ($value instanceof ormCaseLog) { + if (array_key_exists('formatted_text', $this->aStatusInfo) && $this->aStatusInfo['formatted_text']) { + $sText = $value->GetText(); + } else { + $sText = $value->GetAsPlainText(); } - else - { - $sRet = $value; + // Extract the case log as text and remove the "===" which make Excel think that the cell contains a formula the next time you edit it! + $sRet = trim(preg_replace('/========== ([^=]+) ============/', '********** $1 ************', $sText)); + } elseif ($value instanceof DBObjectSet) { + $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); + $sRet = $oAttDef->GetAsCSV($value, '', '', $oObj); + } elseif ($value instanceof ormDocument) { + $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); + $sRet = $oAttDef->GetAsCSV($value, '', '', $oObj); + } elseif ($value instanceof ormSet) { + $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); + $sRet = $oAttDef->GetAsCSV($value, '', '', $oObj); + } else { + $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); + if ($oAttDef instanceof AttributeDateTime) { + // Date and times are formatted using the ISO encoding, not the localized format + if ($oAttDef->IsNull($value)) { + // NOt a valid date + $sRet = ''; + } else { + $sRet = $value; + } + } elseif (array_key_exists('formatted_text', $this->aStatusInfo) && $this->aStatusInfo['formatted_text']) { + if ($oAttDef instanceof AttributeText && $oAttDef->GetFormat() == 'html') { + $sRet = str_replace(">", ">", $value); + } else { + $sRet = $oAttDef->GetEditValue($value, $oObj); + } + } else { + $sRet = $oAttDef->GetAsPlainText($value, $oObj); } } - else if (array_key_exists('formatted_text', $this->aStatusInfo) && $this->aStatusInfo['formatted_text']) - { - if ($oAttDef instanceof AttributeText && $oAttDef->GetFormat()=='html') - { - $sRet = str_replace(">", ">", $value); - } - else - { - $sRet = $oAttDef->GetEditValue($value, $oObj); - } - } - else - { - $sRet = $oAttDef->GetAsPlainText($value, $oObj); - } - } } return $sRet; } @@ -255,14 +227,12 @@ EOF $this->aStatusInfo['position'] = 0; $this->aStatusInfo['total'] = $oSet->Count(); - foreach($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) - { + foreach ($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) { $sExtendedAttCode = $aFieldSpec['sFieldSpec']; $sAttCode = $aFieldSpec['sAttCode']; $sColLabel = $aFieldSpec['sColLabel']; - - switch($sAttCode) - { + + switch ($sAttCode) { case 'id': $sType = '0'; break; @@ -270,22 +240,18 @@ EOF default: $oAttDef = MetaModel::GetAttributeDef($aFieldSpec['sClass'], $aFieldSpec['sAttCode']); $sType = 'string'; - if($oAttDef instanceof AttributeDate) - { + if ($oAttDef instanceof AttributeDate) { $sType = 'date'; - } - else if($oAttDef instanceof AttributeDateTime) - { + } elseif ($oAttDef instanceof AttributeDateTime) { $sType = 'datetime'; } } - $aTableHeaders[] = array('label' => $sColLabel, 'type' => $sType); + $aTableHeaders[] = ['label' => $sColLabel, 'type' => $sType]; } $sRow = json_encode($aTableHeaders); $hFile = @fopen($this->aStatusInfo['tmp_file'], 'ab'); - if ($hFile === false) - { + if ($hFile === false) { throw new Exception('ExcelBulkExport: Failed to open temporary data file: "'.$this->aStatusInfo['tmp_file'].'" for writing.'); } fwrite($hFile, $sRow."\n"); @@ -307,19 +273,16 @@ EOF $iCount = 0; $iPreviousTimeLimit = ini_get('max_execution_time'); $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop'); - while($aRow = $oSet->FetchAssoc()) - { + while ($aRow = $oSet->FetchAssoc()) { set_time_limit(intval($iLoopTimeLimit)); - $aData = array(); - foreach($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) - { + $aData = []; + foreach ($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) { $sAlias = $aFieldSpec['sAlias']; $sAttCode = $aFieldSpec['sAttCode']; $oObj = $aRow[$sAlias]; $sField = ''; - if ($oObj) - { + if ($oObj) { $sField = $this->GetValue($oObj, $sAttCode); } $aData[] = $sField; @@ -329,41 +292,35 @@ EOF } set_time_limit(intval($iPreviousTimeLimit)); $this->aStatusInfo['position'] += $this->iChunkSize; - if ($this->aStatusInfo['total'] == 0) - { + if ($this->aStatusInfo['total'] == 0) { $iPercentage = 100; $sRetCode = 'done'; // Next phase (GetFooter) will be to build the xlsx file + } else { + $iPercentage = floor(min(100.0, 100.0 * $this->aStatusInfo['position'] / $this->aStatusInfo['total'])); } - else - { - $iPercentage = floor(min(100.0, 100.0*$this->aStatusInfo['position']/$this->aStatusInfo['total'])); - } - if ($iCount < $this->iChunkSize) - { + if ($iCount < $this->iChunkSize) { $sRetCode = 'done'; } - $aStatus = array('code' => $sRetCode, 'message' => Dict::S('Core:BulkExport:RetrievingData'), 'percentage' => $iPercentage); + $aStatus = ['code' => $sRetCode, 'message' => Dict::S('Core:BulkExport:RetrievingData'), 'percentage' => $iPercentage]; return ''; // The actual XLSX file is built in GetFooter(); } public function GetFooter() { $hFile = @fopen($this->aStatusInfo['tmp_file'], 'rb'); - if ($hFile === false) - { + if ($hFile === false) { throw new Exception('ExcelBulkExport: Failed to open temporary data file: "'.$this->aStatusInfo['tmp_file'].'" for reading.'); } $sHeaders = fgets($hFile); $aHeaders = json_decode($sHeaders, true); - $aData = array(); - while($sLine = fgets($hFile)) - { + $aData = []; + while ($sLine = fgets($hFile)) { $aRow = json_decode($sLine); $aData[] = $aRow; } fclose($hFile); - + $fStartExcel = microtime(true); $writer = new XLSXWriter(); $sDateFormat = isset($this->aStatusInfo['date_format']) ? $this->aStatusInfo['date_format'] : (string)AttributeDateTime::GetFormat(); @@ -372,14 +329,13 @@ EOF $oDateFormat = new DateTimeFormat($oDateTimeFormat->ToDateFormat()); $writer->setDateFormat($oDateFormat->ToExcel()); $writer->setAuthor(UserRights::GetUserFriendlyName()); - $aHeaderTypes = array(); - $aHeaderNames = array(); - foreach($aHeaders as $Header) - { + $aHeaderTypes = []; + $aHeaderNames = []; + foreach ($aHeaders as $Header) { $aHeaderNames[] = $Header['label']; $aHeaderTypes[] = $Header['type']; } - $writer->writeSheet($aData,'Sheet1', $aHeaderTypes, $aHeaderNames); + $writer->writeSheet($aData, 'Sheet1', $aHeaderTypes, $aHeaderNames); $fExcelTime = microtime(true) - $fStartExcel; //$this->aStatistics['excel_build_duration'] = $fExcelTime; @@ -405,6 +361,6 @@ EOF public function GetSupportedFormats() { - return array('xlsx' => Dict::S('Core:BulkExport:XLSXFormat')); + return ['xlsx' => Dict::S('Core:BulkExport:XLSXFormat')]; } } diff --git a/core/expression.class.inc.php b/core/expression.class.inc.php index 5e05bf710..9df6d6e1b 100644 --- a/core/expression.class.inc.php +++ b/core/expression.class.inc.php @@ -1,4 +1,5 @@ - /** * Definition of a filter * Most of the time, a filter corresponds to an attribute, but we could imagine other search criteria @@ -25,11 +25,8 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - - require_once('MyHelpers.class.inc.php'); - /** * Definition of a filter (could be made out of an existing attribute, or from an expression) * @@ -42,10 +39,13 @@ abstract class FilterDefinition abstract public function GetTypeDesc(); protected $m_sCode; - private $m_aParams = array(); - protected function Get($sParamName) {return $this->m_aParams[$sParamName];} - - public function __construct($sCode, $aParams = array()) + private $m_aParams = []; + protected function Get($sParamName) + { + return $this->m_aParams[$sParamName]; + } + + public function __construct($sCode, $aParams = []) { DeprecatedCallsLog::NotifyDeprecatedPhpMethod("Deprecated class ".$this->GetClass().". Do not use. Will be removed in next version."); $this->m_sCode = $sCode; @@ -54,9 +54,9 @@ abstract class FilterDefinition } // to be overloaded - static protected function ListExpectedParams() + protected static function ListExpectedParams() { - return array(); + return []; } private function ConsistencyCheck() @@ -64,21 +64,22 @@ abstract class FilterDefinition // Check that any mandatory param has been specified // $aExpectedParams = $this->ListExpectedParams(); - foreach($aExpectedParams as $sParamName) - { - if (!array_key_exists($sParamName, $this->m_aParams)) - { + foreach ($aExpectedParams as $sParamName) { + if (!array_key_exists($sParamName, $this->m_aParams)) { $aBacktrace = debug_backtrace(); $sTargetClass = $aBacktrace[2]["class"]; $sCodeInfo = $aBacktrace[1]["file"]." - ".$aBacktrace[1]["line"]; throw new CoreException("ERROR missing parameter '$sParamName' in ".get_class($this)." declaration for class $sTargetClass ($sCodeInfo)"); } } - } + } - public function GetCode() {return $this->m_sCode;} - abstract public function GetLabel(); - abstract public function GetValuesDef(); + public function GetCode() + { + return $this->m_sCode; + } + abstract public function GetLabel(); + abstract public function GetValuesDef(); // returns an array of opcode=>oplabel (e.g. "differs from") abstract public function GetOperators(); @@ -90,11 +91,10 @@ abstract class FilterDefinition public function GetOpDescription($sOpCode) { $aOperators = $this->GetOperators(); - if (!array_key_exists($sOpCode, $aOperators)) - { + if (!array_key_exists($sOpCode, $aOperators)) { throw new CoreException("Unknown operator '$sOpCode'"); } - + return $aOperators[$sOpCode]; } } @@ -107,18 +107,24 @@ abstract class FilterDefinition */ class FilterPrivateKey extends FilterDefinition { - static protected function ListExpectedParams() + protected static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array("id_field")); + return array_merge(parent::ListExpectedParams(), ["id_field"]); } - public function GetType() {return "PrivateKey";} - public function GetTypeDesc() {return "Match against object identifier";} + public function GetType() + { + return "PrivateKey"; + } + public function GetTypeDesc() + { + return "Match against object identifier"; + } public function GetLabel() { return "Object Private Key"; - } + } public function GetValuesDef() { @@ -127,12 +133,12 @@ class FilterPrivateKey extends FilterDefinition public function GetOperators() { - return array( - "="=>"equals", - "!="=>"differs from", - "IN"=>"in", - "NOTIN"=>"not in" - ); + return [ + "=" => "equals", + "!=" => "differs from", + "IN" => "in", + "NOTIN" => "not in", + ]; } public function GetLooseOperator() { @@ -141,9 +147,9 @@ class FilterPrivateKey extends FilterDefinition public function GetSQLExpressions() { - return array( + return [ '' => $this->Get("id_field"), - ); + ]; } } @@ -155,22 +161,28 @@ class FilterPrivateKey extends FilterDefinition */ class FilterFromAttribute extends FilterDefinition { - static protected function ListExpectedParams() + protected static function ListExpectedParams() { - return array_merge(parent::ListExpectedParams(), array("refattribute")); + return array_merge(parent::ListExpectedParams(), ["refattribute"]); } public function __construct($oRefAttribute, $sSuffix = '') { // In this very specific case, the code is the one of the attribute - // (this to get a very very simple syntax upon declaration) - $aParam = array(); + // (this to get a very very simple syntax upon declaration) + $aParam = []; $aParam["refattribute"] = $oRefAttribute; parent::__construct($oRefAttribute->GetCode().$sSuffix, $aParam); } - public function GetType() {return "Basic";} - public function GetTypeDesc() {return "Match against field contents";} + public function GetType() + { + return "Basic"; + } + public function GetTypeDesc() + { + return "Match against field contents"; + } public function __GetRefAttribute() // for checking purposes only !!! { @@ -181,7 +193,7 @@ class FilterFromAttribute extends FilterDefinition { $oAttDef = $this->Get("refattribute"); return $oAttDef->GetLabel(); - } + } public function GetValuesDef() { @@ -189,7 +201,7 @@ class FilterFromAttribute extends FilterDefinition return $oAttDef->GetValuesDef(); } - public function GetAllowedValues($aArgs = array(), $sContains = '') + public function GetAllowedValues($aArgs = [], $sContains = '') { $oAttDef = $this->Get("refattribute"); return $oAttDef->GetAllowedValues($aArgs, $sContains); @@ -212,5 +224,3 @@ class FilterFromAttribute extends FilterDefinition return $oAttDef->GetSQLExpressions(); } } - -?> diff --git a/core/htmlbulkexport.class.inc.php b/core/htmlbulkexport.class.inc.php index 7a78ab0b8..b0d4a9348 100644 --- a/core/htmlbulkexport.class.inc.php +++ b/core/htmlbulkexport.class.inc.php @@ -1,4 +1,5 @@ array('interactive_fields_html'))); + return array_merge(parent::EnumFormParts(), ['interactive_fields_html' => ['interactive_fields_html']]); } /** @@ -52,17 +53,15 @@ class HTMLBulkExport extends TabularBulkExport break; default: - return parent:: GetFormPart($oP, $sPartId); + return parent::GetFormPart($oP, $sPartId); } } protected function GetSampleData($oObj, $sAttCode) { - if ($sAttCode != 'id') - { + if ($sAttCode != 'id') { $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); - if ($oAttDef instanceof AttributeDateTime) // AttributeDate is derived from AttributeDateTime - { + if ($oAttDef instanceof AttributeDateTime) { // AttributeDate is derived from AttributeDateTime $sClass = (get_class($oAttDef) == 'AttributeDateTime') ? 'user-formatted-date-time' : 'user-formatted-date'; return '
      '.utils::EscapeHtml($oAttDef->GetEditValue($oObj->Get($sAttCode), $oObj)).'
      '; @@ -73,24 +72,18 @@ class HTMLBulkExport extends TabularBulkExport protected function GetValue($oObj, $sAttCode) { - switch($sAttCode) - { + switch ($sAttCode) { case 'id': $sRet = $oObj->GetHyperlink(); break; - + default: $value = $oObj->Get($sAttCode); - if ($value instanceof ormCaseLog) - { + if ($value instanceof ormCaseLog) { $sRet = $value->GetAsSimpleHtml(); - } - elseif ($value instanceof ormStopWatch) - { + } elseif ($value instanceof ormStopWatch) { $sRet = $value->GetTimeSpent(); - } - else - { + } else { $sRet = $oObj->GetAsHtml($sAttCode); } } @@ -100,7 +93,7 @@ class HTMLBulkExport extends TabularBulkExport public function GetHeader() { $sData = ''; - + $oSet = new DBObjectSet($this->oSearch); $this->aStatusInfo['status'] = 'running'; $this->aStatusInfo['position'] = 0; @@ -109,8 +102,7 @@ class HTMLBulkExport extends TabularBulkExport $sData .= "\n"; $sData .= "\n"; $sData .= "\n"; - foreach($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) - { + foreach ($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) { $sData .= "\n"; } $sData .= "\n"; @@ -135,32 +127,25 @@ class HTMLBulkExport extends TabularBulkExport $sData = ''; $iPreviousTimeLimit = ini_get('max_execution_time'); $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop'); - while($aRow = $oSet->FetchAssoc()) - { + while ($aRow = $oSet->FetchAssoc()) { set_time_limit(intval($iLoopTimeLimit)); $oMainObj = $aRow[$sFirstAlias]; $sHilightClass = ''; - if ($oMainObj) - { + if ($oMainObj) { $sHilightClass = MetaModel::GetHilightClass($sClass, $aRow[$sFirstAlias]); } - if ($sHilightClass != '') - { + if ($sHilightClass != '') { $sData .= ""; - } - else - { + } else { $sData .= ""; } - foreach($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) - { + foreach ($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) { $sAlias = $aFieldSpec['sAlias']; $sAttCode = $aFieldSpec['sAttCode']; $oObj = $aRow[$sAlias]; $sField = ''; - if ($oObj) - { + if ($oObj) { $sField = $this->GetValue($oObj, $sAttCode); } $sValue = ($sField === '') ? ' ' : $sField; @@ -171,21 +156,17 @@ class HTMLBulkExport extends TabularBulkExport } set_time_limit(intval($iPreviousTimeLimit)); $this->aStatusInfo['position'] += $this->iChunkSize; - if ($this->aStatusInfo['total'] == 0) - { + if ($this->aStatusInfo['total'] == 0) { $iPercentage = 100; - } - else - { - $iPercentage = floor(min(100.0, 100.0*$this->aStatusInfo['position']/$this->aStatusInfo['total'])); + } else { + $iPercentage = floor(min(100.0, 100.0 * $this->aStatusInfo['position'] / $this->aStatusInfo['total'])); } - if ($iCount < $this->iChunkSize) - { + if ($iCount < $this->iChunkSize) { $sRetCode = 'done'; } - $aStatus = array('code' => $sRetCode, 'message' => Dict::S('Core:BulkExport:RetrievingData'), 'percentage' => $iPercentage); + $aStatus = ['code' => $sRetCode, 'message' => Dict::S('Core:BulkExport:RetrievingData'), 'percentage' => $iPercentage]; return $sData; } @@ -198,7 +179,7 @@ class HTMLBulkExport extends TabularBulkExport public function GetSupportedFormats() { - return array('html' => Dict::S('Core:BulkExport:HTMLFormat')); + return ['html' => Dict::S('Core:BulkExport:HTMLFormat')]; } public function GetMimeType() diff --git a/core/htmlsanitizer.class.inc.php b/core/htmlsanitizer.class.inc.php index 7fa1e9690..d6f43eb65 100644 --- a/core/htmlsanitizer.class.inc.php +++ b/core/htmlsanitizer.class.inc.php @@ -1,4 +1,5 @@ DoSanitize($sHTML); - } - catch (Exception $e) { + } catch (Exception $e) { if ($sSanitizerClass != 'HTMLDOMSanitizer') { IssueLog::Warning('Failed to sanitize an HTML string with "'.$sSanitizerClass.'". The following exception occured: '.$e->getMessage()); IssueLog::Warning('Will try to sanitize with HTMLDOMSanitizer.'); // try again with the HTMLDOMSanitizer $oSanitizer = new HTMLDOMSanitizer(); $sCleanHTML = $oSanitizer->DoSanitize($sHTML); - } - else - { + } else { IssueLog::Error('Failed to sanitize an HTML string with "HTMLDOMSanitizer". The following exception occured: '.$e->getMessage()); IssueLog::Error('The HTML will NOT be sanitized.'); $sCleanHTML = $sHTML; @@ -104,8 +102,6 @@ class HTMLNullSanitizer extends HTMLSanitizer } } - - /** * Common implementation for sanitizer using DOM parsing */ @@ -166,7 +162,7 @@ abstract class DOMSanitizer extends HTMLSanitizer protected function CleanNode(DOMNode $oElement) { - $aAttrToRemove = array(); + $aAttrToRemove = []; // Gather the attributes to remove if ($oElement->hasAttributes()) { foreach ($oElement->attributes as $oAttr) { @@ -174,13 +170,13 @@ abstract class DOMSanitizer extends HTMLSanitizer if ((false === empty($this->GetAttrsBlackList())) && (in_array($sAttr, $this->GetAttrsBlackList(), true))) { $aAttrToRemove[] = $oAttr->name; - } else if ((false === empty($this->GetTagsWhiteList())) + } elseif ((false === empty($this->GetTagsWhiteList())) && (false === in_array($sAttr, $this->GetTagsWhiteList()[strtolower($oElement->tagName)]))) { $aAttrToRemove[] = $oAttr->name; - } else if (!$this->IsValidAttributeContent($sAttr, $oAttr->value)) { + } elseif (!$this->IsValidAttributeContent($sAttr, $oAttr->value)) { // Invalid content $aAttrToRemove[] = $oAttr->name; - } else if ($sAttr == 'style') { + } elseif ($sAttr == 'style') { // Special processing for style tags $sCleanStyle = $this->CleanStyle($oAttr->value); if ($sCleanStyle == '') { @@ -192,17 +188,15 @@ abstract class DOMSanitizer extends HTMLSanitizer } } // Now remove them - foreach($aAttrToRemove as $sName) - { + foreach ($aAttrToRemove as $sName) { $oElement->removeAttribute($sName); } } - if ($oElement->hasChildNodes()) - { - $aChildElementsToRemove = array(); + if ($oElement->hasChildNodes()) { + $aChildElementsToRemove = []; // Gather the child noes to remove - foreach($oElement->childNodes as $oNode) { + foreach ($oElement->childNodes as $oNode) { if ($oNode instanceof DOMElement) { $sNodeTagName = strtolower($oNode->tagName); } @@ -210,11 +204,11 @@ abstract class DOMSanitizer extends HTMLSanitizer && (false === empty($this->GetTagsBlackList())) && (in_array($sNodeTagName, $this->GetTagsBlackList(), true))) { $aChildElementsToRemove[] = $oNode; - } else if (($oNode instanceof DOMElement) + } elseif (($oNode instanceof DOMElement) && (false === empty($this->GetTagsWhiteList())) && (false === array_key_exists($sNodeTagName, $this->GetTagsWhiteList()))) { $aChildElementsToRemove[] = $oNode; - } else if ($oNode instanceof DOMComment) { + } elseif ($oNode instanceof DOMComment) { $aChildElementsToRemove[] = $oNode; } else { // Recurse @@ -225,8 +219,7 @@ abstract class DOMSanitizer extends HTMLSanitizer } } // Now remove them - foreach($aChildElementsToRemove as $oDomElement) - { + foreach ($aChildElementsToRemove as $oDomElement) { $oElement->removeChild($oDomElement); } } @@ -252,7 +245,7 @@ abstract class DOMSanitizer extends HTMLSanitizer return $sStyle; } - $aAllowedStyles = array(); + $aAllowedStyles = []; $aItems = explode(';', $sStyle); { foreach ($aItems as $sItem) { @@ -267,78 +260,76 @@ abstract class DOMSanitizer extends HTMLSanitizer } } - - class HTMLDOMSanitizer extends DOMSanitizer { /** * @var array * @see https://www.itophub.io/wiki/page?id=2_6_0%3Aadmin%3Arich_text_limitations */ - protected static $aTagsWhiteList = array( - 'html' => array(), - 'body' => array(), - 'a' => array('href', 'name', 'style', 'class', 'target', 'title', 'data-role', 'data-object-class', 'data-object-id', 'data-object-key'), - 'p' => array('style', 'class'), - 'blockquote' => array('style', 'class'), - 'br' => array(), - 'span' => array('style', 'class'), - 'div' => array('style', 'class'), - 'b' => array('class'), - 'i' => array('class'), - 'u' => array('class'), - 'em' => array('class'), - 'strong' => array('class'), - 'img' => array('src', 'style', 'class', 'alt', 'title', 'width', 'height'), - 'ul' => array('style', 'class'), - 'ol' => array('reversed', 'start', 'style', 'class', 'type'), - 'li' => array('style', 'class', 'value'), - 'h1' => array('style', 'class'), - 'h2' => array('style', 'class'), - 'h3' => array('style', 'class'), - 'h4' => array('style', 'class'), - 'nav' => array('style', 'class'), - 'section' => array('style', 'class'), - 'code' => array('style', 'class'), - 'table' => array('style', 'class', 'width', 'summary', 'align', 'border', 'cellpadding', 'cellspacing'), - 'colgroup' => array(), - 'col' => array('style'), - 'thead' => array('style', 'class'), - 'tbody' => array('style', 'class'), - 'tr' => array('style', 'class', 'colspan', 'rowspan'), - 'td' => array('style', 'class', 'colspan', 'rowspan'), - 'th' => array('style', 'class', 'colspan', 'rowspan'), - 'fieldset' => array('style', 'class'), - 'legend' => array('style', 'class'), - 'font' => array('face', 'color', 'style', 'class', 'size'), - 'big' => array(), - 'small' => array(), - 'tt' => array(), - 'kbd' => array(), - 'samp' => array(), - 'var' => array(), - 'del' => array(), - 's' => array(), // strikethrough - 'ins' => array(), - 'cite' => array(), - 'q' => array(), - 'hr' => array('style', 'class'), - 'pre' => array('class'), - 'center' => array(), - 'figure' => array('style', 'class'), // Ckeditor 5 puts images in figures - 'figcaption' => array('class'), - 'mark' => array('class') - ); + protected static $aTagsWhiteList = [ + 'html' => [], + 'body' => [], + 'a' => ['href', 'name', 'style', 'class', 'target', 'title', 'data-role', 'data-object-class', 'data-object-id', 'data-object-key'], + 'p' => ['style', 'class'], + 'blockquote' => ['style', 'class'], + 'br' => [], + 'span' => ['style', 'class'], + 'div' => ['style', 'class'], + 'b' => ['class'], + 'i' => ['class'], + 'u' => ['class'], + 'em' => ['class'], + 'strong' => ['class'], + 'img' => ['src', 'style', 'class', 'alt', 'title', 'width', 'height'], + 'ul' => ['style', 'class'], + 'ol' => ['reversed', 'start', 'style', 'class', 'type'], + 'li' => ['style', 'class', 'value'], + 'h1' => ['style', 'class'], + 'h2' => ['style', 'class'], + 'h3' => ['style', 'class'], + 'h4' => ['style', 'class'], + 'nav' => ['style', 'class'], + 'section' => ['style', 'class'], + 'code' => ['style', 'class'], + 'table' => ['style', 'class', 'width', 'summary', 'align', 'border', 'cellpadding', 'cellspacing'], + 'colgroup' => [], + 'col' => ['style'], + 'thead' => ['style', 'class'], + 'tbody' => ['style', 'class'], + 'tr' => ['style', 'class', 'colspan', 'rowspan'], + 'td' => ['style', 'class', 'colspan', 'rowspan'], + 'th' => ['style', 'class', 'colspan', 'rowspan'], + 'fieldset' => ['style', 'class'], + 'legend' => ['style', 'class'], + 'font' => ['face', 'color', 'style', 'class', 'size'], + 'big' => [], + 'small' => [], + 'tt' => [], + 'kbd' => [], + 'samp' => [], + 'var' => [], + 'del' => [], + 's' => [], // strikethrough + 'ins' => [], + 'cite' => [], + 'q' => [], + 'hr' => ['style', 'class'], + 'pre' => ['class'], + 'center' => [], + 'figure' => ['style', 'class'], // Ckeditor 5 puts images in figures + 'figcaption' => ['class'], + 'mark' => ['class'], + ]; - protected static $aAttrsWhiteList = array( + protected static $aAttrsWhiteList = [ 'src' => '/^(http:|https:|data:)/i', - ); + ]; /** * @var array * @see https://www.itophub.io/wiki/page?id=2_6_0%3Aadmin%3Arich_text_limitations */ - protected static $aStylesWhiteList = array( + protected static $aStylesWhiteList = [ 'aspect-ratio', 'background-color', 'border', @@ -361,7 +352,7 @@ class HTMLDOMSanitizer extends DOMSanitizer 'vertical-align', 'width', 'white-space', - ); + ]; public function __construct($sInlineImageClassName = InlineImage::class) { @@ -431,15 +422,13 @@ class HTMLDOMSanitizer extends DOMSanitizer // Export only the content of the body tag $sCleanHtml = $this->oDoc->saveHTML($oNodesList->item(0)); // remove the body tag itself - $sCleanHtml = str_replace(array('', ''), '', $sCleanHtml); + $sCleanHtml = str_replace(['', ''], '', $sCleanHtml); } return $sCleanHtml; } } - - /** * @since 2.6.5 2.7.6 3.0.0 N°4360 */ diff --git a/core/iTopConfigParser.php b/core/iTopConfigParser.php index 97327bca1..9311b2706 100644 --- a/core/iTopConfigParser.php +++ b/core/iTopConfigParser.php @@ -1,4 +1,5 @@ create(ParserFactory::PREFER_PHP7); - $this->aVarsMap = array( - 'MySettings' => array(), - 'MyModuleSettings' => array(), - 'MyModules' => array(), - ); + $this->aVarsMap = [ + 'MySettings' => [], + 'MyModuleSettings' => [], + 'MyModules' => [], + ]; - if ($sConfig !== null) - { + if ($sConfig !== null) { $this->BrowseFile($oParser, $sConfig); } } @@ -67,15 +66,15 @@ class iTopConfigParser */ public function GetVarValue($arrayName, $key) { - if (!array_key_exists($arrayName, $this->aVarsMap)){ - return array('found' => false); + if (!array_key_exists($arrayName, $this->aVarsMap)) { + return ['found' => false]; } $arrayValue = $this->aVarsMap[$arrayName]; - if (!array_key_exists($key, $arrayValue)){ - return array('found' => false); + if (!array_key_exists($key, $arrayValue)) { + return ['found' => false]; } - return array('found' => true, - 'value' => $arrayValue[$key]); + return ['found' => true, + 'value' => $arrayValue[$key]]; } /** @@ -90,8 +89,7 @@ class iTopConfigParser try { $aNodes = $oParser->parse($sConfig); - } - catch (\Error $e) { + } catch (\Error $e) { $sMessage = Dict::Format('config-parse-error', $e->getMessage(), $e->getLine()); $this->oException = new \Exception($sMessage, 0, $e); } @@ -122,7 +120,7 @@ class iTopConfigParser if (!array_key_exists($sCurrentRootVar, $this->aVarsMap)) { continue; } - $aCurrentRootVarMap =& $this->aVarsMap[$sCurrentRootVar]; + $aCurrentRootVarMap = & $this->aVarsMap[$sCurrentRootVar]; foreach ($oAssignation->expr->items as $oItem) { $sValue = $prettyPrinter->prettyPrintExpr($oItem->value); @@ -130,4 +128,4 @@ class iTopConfigParser } } } -} \ No newline at end of file +} diff --git a/core/inlineimage.class.inc.php b/core/inlineimage.class.inc.php index bc59cb7dd..50242ff36 100644 --- a/core/inlineimage.class.inc.php +++ b/core/inlineimage.class.inc.php @@ -1,4 +1,5 @@ 'addon', 'key_type' => 'autoincrement', - 'name_attcode' => array('item_class', 'temp_id'), + 'name_attcode' => ['item_class', 'temp_id'], 'state_attcode' => '', - 'reconc_keys' => array(''), + 'reconc_keys' => [''], 'db_table' => 'inline_image', 'db_key_field' => 'id', 'db_finalclass_field' => '', - 'indexes' => array( - array('temp_id'), - array('item_class', 'item_id'), - array('item_org_id'), - ), - ); + 'indexes' => [ + ['temp_id'], + ['item_class', 'item_id'], + ['item_org_id'], + ], + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeDateTime("expire", array("allowed_values" => null, "sql" => 'expire', "default_value" => 'DATE_ADD(NOW(), INTERVAL 1 DAY)', "is_null_allowed" => false, "depends_on" => array(), "always_load_in_tables" => false))); - MetaModel::Init_AddAttribute(new AttributeString("temp_id", array("allowed_values"=>null, "sql"=>'temp_id', "default_value"=>'', "is_null_allowed"=>true, "depends_on"=>array(), "always_load_in_tables"=>false))); - MetaModel::Init_AddAttribute(new AttributeString("item_class", array("allowed_values"=>null, "sql"=>'item_class', "default_value"=>'', "is_null_allowed"=>false, "depends_on"=>array(), "always_load_in_tables"=>false))); - MetaModel::Init_AddAttribute(new AttributeObjectKey("item_id", array("class_attcode"=>'item_class', "allowed_values"=>null, "sql"=>'item_id', "is_null_allowed"=>true, "depends_on"=>array(), "always_load_in_tables"=>false))); - MetaModel::Init_AddAttribute(new AttributeInteger("item_org_id", array("allowed_values"=>null, "sql"=>'item_org_id', "default_value"=>'0', "is_null_allowed"=>true, "depends_on"=>array(), "always_load_in_tables"=>false))); - MetaModel::Init_AddAttribute(new AttributeBlob("contents", array("is_null_allowed"=>false, "depends_on"=>array(), "always_load_in_tables"=>false))); - MetaModel::Init_AddAttribute(new AttributeString("secret", array("allowed_values"=>null, "sql" => "secret", "default_value"=>'', "is_null_allowed"=>false, "depends_on"=>array(), "always_load_in_tables"=>false))); + MetaModel::Init_AddAttribute(new AttributeDateTime("expire", ["allowed_values" => null, "sql" => 'expire', "default_value" => 'DATE_ADD(NOW(), INTERVAL 1 DAY)', "is_null_allowed" => false, "depends_on" => [], "always_load_in_tables" => false])); + MetaModel::Init_AddAttribute(new AttributeString("temp_id", ["allowed_values" => null, "sql" => 'temp_id', "default_value" => '', "is_null_allowed" => true, "depends_on" => [], "always_load_in_tables" => false])); + MetaModel::Init_AddAttribute(new AttributeString("item_class", ["allowed_values" => null, "sql" => 'item_class', "default_value" => '', "is_null_allowed" => false, "depends_on" => [], "always_load_in_tables" => false])); + MetaModel::Init_AddAttribute(new AttributeObjectKey("item_id", ["class_attcode" => 'item_class', "allowed_values" => null, "sql" => 'item_id', "is_null_allowed" => true, "depends_on" => [], "always_load_in_tables" => false])); + MetaModel::Init_AddAttribute(new AttributeInteger("item_org_id", ["allowed_values" => null, "sql" => 'item_org_id', "default_value" => '0', "is_null_allowed" => true, "depends_on" => [], "always_load_in_tables" => false])); + MetaModel::Init_AddAttribute(new AttributeBlob("contents", ["is_null_allowed" => false, "depends_on" => [], "always_load_in_tables" => false])); + MetaModel::Init_AddAttribute(new AttributeString("secret", ["allowed_values" => null, "sql" => "secret", "default_value" => '', "is_null_allowed" => false, "depends_on" => [], "always_load_in_tables" => false])); - - MetaModel::Init_SetZListItems('details', array('temp_id', 'item_class', 'item_id', 'item_org_id')); - MetaModel::Init_SetZListItems('standard_search', array('temp_id', 'item_class', 'item_id')); - MetaModel::Init_SetZListItems('list', array('temp_id', 'item_class', 'item_id' )); + MetaModel::Init_SetZListItems('details', ['temp_id', 'item_class', 'item_id', 'item_org_id']); + MetaModel::Init_SetZListItems('standard_search', ['temp_id', 'item_class', 'item_id']); + MetaModel::Init_SetZListItems('list', ['temp_id', 'item_class', 'item_id' ]); } - /** * Maps the given context parameter name to the appropriate filter/search code for this class * @@ -77,12 +76,9 @@ class InlineImage extends DBObject */ public static function MapContextParam($sContextParam) { - if ($sContextParam == 'org_id') - { + if ($sContextParam == 'org_id') { return 'item_org_id'; - } - else - { + } else { return null; } } @@ -104,23 +100,18 @@ class InlineImage extends DBObject $sClass = get_class($oItem); $iItemId = $oItem->GetKey(); - $this->Set('item_class', $sClass); - $this->Set('item_id', $iItemId); + $this->Set('item_class', $sClass); + $this->Set('item_id', $iItemId); - $aCallSpec = array($sClass, 'MapContextParam'); - if (is_callable($aCallSpec)) - { - $sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter - if (MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + $aCallSpec = [$sClass, 'MapContextParam']; + if (is_callable($aCallSpec)) { + $sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter + if (MetaModel::IsValidAttCode($sClass, $sAttCode)) { $iOrgId = $oItem->Get($sAttCode); - if ($iOrgId > 0) - { - if ($iOrgId != $this->Get('item_org_id')) - { + if ($iOrgId > 0) { + if ($iOrgId != $this->Get('item_org_id')) { $this->Set('item_org_id', $iOrgId); - if ($bUpdateOnChange) - { + if ($bUpdateOnChange) { $this->DBUpdate(); } } @@ -143,29 +134,23 @@ class InlineImage extends DBObject // First check that the organization CAN be fetched from the target class // $sClass = $this->Get('item_class'); - $aCallSpec = array($sClass, 'MapContextParam'); - if (is_callable($aCallSpec)) - { - $sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter - if (MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + $aCallSpec = [$sClass, 'MapContextParam']; + if (is_callable($aCallSpec)) { + $sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter + if (MetaModel::IsValidAttCode($sClass, $sAttCode)) { // Second: check that the organization CAN be fetched from the current user // - if (MetaModel::IsValidClass('Person')) - { - $aCallSpec = array($sClass, 'MapContextParam'); - if (is_callable($aCallSpec)) - { - $sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter - if (MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + if (MetaModel::IsValidClass('Person')) { + $aCallSpec = [$sClass, 'MapContextParam']; + if (is_callable($aCallSpec)) { + $sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter + if (MetaModel::IsValidAttCode($sClass, $sAttCode)) { // OK - try it // $oCurrentPerson = MetaModel::GetObject('Person', UserRights::GetContactId(), false); - if ($oCurrentPerson) - { - $this->Set('item_org_id', $oCurrentPerson->Get($sAttCode)); - } + if ($oCurrentPerson) { + $this->Set('item_org_id', $oCurrentPerson->Get($sAttCode)); + } } } } @@ -189,39 +174,37 @@ class InlineImage extends DBObject public static function FinalizeInlineImages(DBObject $oObject) { $iTransactionId = utils::ReadParam('transaction_id', null, false, 'transaction_id'); - if (!is_null($iTransactionId)) - { + if (!is_null($iTransactionId)) { // Attach new (temporary) inline images - + $sTempId = utils::GetUploadTempId($iTransactionId); // The object is being created from a form, check if there are pending inline images for this object $sOQL = 'SELECT InlineImage WHERE temp_id = :temp_id'; $oSearch = DBObjectSearch::FromOQL($sOQL); - $oSet = new DBObjectSet($oSearch, array(), array('temp_id' => $sTempId)); - $aInlineImagesId = array(); + $oSet = new DBObjectSet($oSearch, [], ['temp_id' => $sTempId]); + $aInlineImagesId = []; while ($oInlineImage = $oSet->Fetch()) { $aInlineImagesId[] = $oInlineImage->GetKey(); $oInlineImage->SetItem($oObject); $oInlineImage->Set('temp_id', ''); $oInlineImage->DBUpdate(); } - IssueLog::Trace('FinalizeInlineImages (see $aInlineImagesId for the id list)', LogChannels::INLINE_IMAGE, array( + IssueLog::Trace('FinalizeInlineImages (see $aInlineImagesId for the id list)', LogChannels::INLINE_IMAGE, [ '$sObjectClass' => get_class($oObject), '$sTransactionId' => $iTransactionId, '$sTempId' => $sTempId, '$aInlineImagesId' => $aInlineImagesId, '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], - )); + ]); + } else { + IssueLog::Trace('FinalizeInlineImages "error" $iTransactionId is null', LogChannels::INLINE_IMAGE, [ + '$sObjectClass' => get_class($oObject), + '$sTransactionId' => $iTransactionId, + '$sUser' => UserRights::GetUser(), + 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], + ]); } - else { - IssueLog::Trace('FinalizeInlineImages "error" $iTransactionId is null', LogChannels::INLINE_IMAGE, array( - '$sObjectClass' => get_class($oObject), - '$sTransactionId' => $iTransactionId, - '$sUser' => UserRights::GetUser(), - 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], - )); - } } /** @@ -243,11 +226,11 @@ class InlineImage extends DBObject { // Protection against unfortunate massive delete of inline images when a null temp ID is passed if (utils::IsNullOrEmptyString($sTempId)) { - IssueLog::Trace('OnFormCancel "error" $sTempId is null or empty', LogChannels::INLINE_IMAGE, array( + IssueLog::Trace('OnFormCancel "error" $sTempId is null or empty', LogChannels::INLINE_IMAGE, [ '$sTempId' => $sTempId, '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], - )); + ]); return false; } @@ -255,19 +238,18 @@ class InlineImage extends DBObject // Delete all "pending" InlineImages for this form $sOQL = 'SELECT InlineImage WHERE temp_id = :temp_id'; $oSearch = DBObjectSearch::FromOQL($sOQL); - $oSet = new DBObjectSet($oSearch, array(), array('temp_id' => $sTempId)); - $aInlineImagesId = array(); - while($oInlineImage = $oSet->Fetch()) - { - $aInlineImagesId[] = $oInlineImage->GetKey(); + $oSet = new DBObjectSet($oSearch, [], ['temp_id' => $sTempId]); + $aInlineImagesId = []; + while ($oInlineImage = $oSet->Fetch()) { + $aInlineImagesId[] = $oInlineImage->GetKey(); $oInlineImage->DBDelete(); } - IssueLog::Trace('OnFormCancel', LogChannels::INLINE_IMAGE, array( + IssueLog::Trace('OnFormCancel', LogChannels::INLINE_IMAGE, [ '$sTempId' => $sTempId, '$aInlineImagesId' => $aInlineImagesId, '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], - )); + ]); return true; } @@ -284,15 +266,17 @@ class InlineImage extends DBObject */ public static function FixUrls($sHtml) { - $aNeedles = array(); - $aReplacements = array(); + $aNeedles = []; + $aReplacements = []; // Find img tags with an attribute data-img-id - if (preg_match_all('/]*)'.self::DOM_ATTR_ID.'="([0-9]+)"([^>]*)>/i', - $sHtml, $aMatches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) - { + if (preg_match_all( + '/]*)'.self::DOM_ATTR_ID.'="([0-9]+)"([^>]*)>/i', + $sHtml, + $aMatches, + PREG_SET_ORDER | PREG_OFFSET_CAPTURE + )) { $sUrl = utils::GetAbsoluteUrlAppRoot().INLINEIMAGE_DOWNLOAD_URL; - foreach($aMatches as $aImgInfo) - { + foreach ($aMatches as $aImgInfo) { $sImgTag = $aImgInfo[0][0]; $sSecret = ''; if (preg_match('/data-img-secret="([0-9a-f]+)"/', $sImgTag, $aSecretMatches)) { @@ -321,11 +305,10 @@ class InlineImage extends DBObject public static function ProcessImageTag(DOMElement $oElement) { $sSrc = $oElement->getAttribute('src'); - $sDownloadUrl = str_replace(array('.', '?'), array('\.', '\?'), INLINEIMAGE_DOWNLOAD_URL); // Escape . and ? + $sDownloadUrl = str_replace(['.', '?'], ['\.', '\?'], INLINEIMAGE_DOWNLOAD_URL); // Escape . and ? $sUrlPattern = '|'.$sDownloadUrl.'([0-9]+)&s=([0-9a-f]+)|'; $bIsInlineImage = preg_match($sUrlPattern, $sSrc, $aMatches); - if (!$bIsInlineImage) - { + if (!$bIsInlineImage) { return; } $iInlineImageId = $aMatches[1]; @@ -334,8 +317,7 @@ class InlineImage extends DBObject $sAppRoot = utils::GetAbsoluteUrlAppRoot(); $sAppRootPattern = '/^'.preg_quote($sAppRoot, '/').'/'; $bIsSameItop = preg_match($sAppRootPattern, $sSrc); - if (!$bIsSameItop) - { + if (!$bIsSameItop) { // @see N°1921 // image from another iTop should be treated as external images $oElement->removeAttribute(self::DOM_ATTR_ID); @@ -357,8 +339,7 @@ class InlineImage extends DBObject { $iMaxWidth = (int)MetaModel::GetConfig()->Get('inline_image_max_display_width', 0); $sJS = ''; - if ($iMaxWidth != 0) - { + if ($iMaxWidth != 0) { $sJS = <<GetMimeType()) - { + switch ($oImage->GetMimeType()) { case 'image/gif': case 'image/jpeg': case 'image/png': $img = @imagecreatefromstring($oImage->GetData()); break; - + default: // Unsupported image type, return the image as-is $aDimensions = null; return $oImage; } - if ($img === false) - { + if ($img === false) { $aDimensions = null; return $oImage; - } - else - { + } else { // Let's scale the image, preserving the transparency for GIFs and PNGs $iWidth = imagesx($img); $iHeight = imagesy($img); - $aDimensions = array('width' => $iWidth, 'height' => $iHeight); + $aDimensions = ['width' => $iWidth, 'height' => $iHeight]; $iMaxImageSize = (int)MetaModel::GetConfig()->Get('inline_image_max_storage_width', 0); - - if (($iMaxImageSize > 0) && ($iWidth <= $iMaxImageSize) && ($iHeight <= $iMaxImageSize)) - { + + if (($iMaxImageSize > 0) && ($iWidth <= $iMaxImageSize) && ($iHeight <= $iMaxImageSize)) { // No need to resize return $oImage; } - + $fScale = min($iMaxImageSize / $iWidth, $iMaxImageSize / $iHeight); - + $iNewWidth = (int) ($iWidth * $fScale); $iNewHeight = (int) ($iHeight * $fScale); - + $aDimensions['width'] = $iNewWidth; $aDimensions['height'] = $iNewHeight; - + $new = imagecreatetruecolor($iNewWidth, $iNewHeight); - + // Preserve transparency - if(($oImage->GetMimeType() == "image/gif") || ($oImage->GetMimeType() == "image/png")) - { + if (($oImage->GetMimeType() == "image/gif") || ($oImage->GetMimeType() == "image/png")) { imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127)); imagealphablending($new, false); imagesavealpha($new, true); } - + imagecopyresampled($new, $img, 0, 0, 0, 0, $iNewWidth, $iNewHeight, $iWidth, $iHeight); - + ob_start(); - switch ($oImage->GetMimeType()) - { + switch ($oImage->GetMimeType()) { case 'image/gif': imagegif($new); // send image to output buffer break; - + case 'image/jpeg': imagejpeg($new, null, 80); // null = send image to output buffer, 80 = good quality break; - + case 'image/png': imagepng($new, null, 5); // null = send image to output buffer, 5 = medium compression break; } $oNewImage = new ormDocument(ob_get_contents(), $oImage->GetMimeType(), $oImage->GetFileName()); @ob_end_clean(); - + imagedestroy($img); imagedestroy($new); - + return $oNewImage; } - + } /** @@ -496,29 +471,21 @@ JS public static function GetMaxUpload() { $iMaxUpload = ini_get('upload_max_filesize'); - if (!$iMaxUpload) - { + if (!$iMaxUpload) { $sRet = Dict::S('Attachments:UploadNotAllowedOnThisSystem'); - } - else - { + } else { $iMaxUpload = utils::ConvertToBytes($iMaxUpload); - if ($iMaxUpload > 1024*1024*1024) - { - $sRet = Dict::Format('Attachment:Max_Go', sprintf('%0.2f', $iMaxUpload/(1024*1024*1024))); - } - else if ($iMaxUpload > 1024*1024) - { - $sRet = Dict::Format('Attachment:Max_Mo', sprintf('%0.2f', $iMaxUpload/(1024*1024))); - } - else - { - $sRet = Dict::Format('Attachment:Max_Ko', sprintf('%0.2f', $iMaxUpload/(1024))); + if ($iMaxUpload > 1024 * 1024 * 1024) { + $sRet = Dict::Format('Attachment:Max_Go', sprintf('%0.2f', $iMaxUpload / (1024 * 1024 * 1024))); + } elseif ($iMaxUpload > 1024 * 1024) { + $sRet = Dict::Format('Attachment:Max_Mo', sprintf('%0.2f', $iMaxUpload / (1024 * 1024))); + } else { + $sRet = Dict::Format('Attachment:Max_Ko', sprintf('%0.2f', $iMaxUpload / (1024))); } } return $sRet; } - + /** * Get the fragment of javascript needed to complete the initialization of * CKEditor when creating/modifying an object @@ -543,73 +510,71 @@ JS JS; } + /** + * @inheritDoc + */ + protected function AfterInsert() + { + IssueLog::Trace(__METHOD__, LogChannels::INLINE_IMAGE, [ + 'id' => $this->GetKey(), + 'expire' => $this->Get('expire'), + 'temp_id' => $this->Get('temp_id'), + 'item_class' => $this->Get('item_class'), + 'item_id' => $this->Get('item_id'), + 'item_org_id' => $this->Get('item_org_id'), + 'secret' => $this->Get('secret'), + 'user' => $sUser = UserRights::GetUser(), + 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], + 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], + ]); + + parent::AfterInsert(); + } /** * @inheritDoc */ - protected function AfterInsert() - { - IssueLog::Trace(__METHOD__, LogChannels::INLINE_IMAGE, array( - 'id' => $this->GetKey(), - 'expire' => $this->Get('expire'), - 'temp_id' => $this->Get('temp_id'), - 'item_class' => $this->Get('item_class'), - 'item_id' => $this->Get('item_id'), - 'item_org_id' => $this->Get('item_org_id'), - 'secret' => $this->Get('secret'), - 'user' => $sUser = UserRights::GetUser(), - 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], - 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); + protected function AfterUpdate() + { + IssueLog::Trace(__METHOD__, LogChannels::INLINE_IMAGE, [ + 'id' => $this->GetKey(), + 'expire' => $this->Get('expire'), + 'temp_id' => $this->Get('temp_id'), + 'item_class' => $this->Get('item_class'), + 'item_id' => $this->Get('item_id'), + 'item_org_id' => $this->Get('item_org_id'), + 'secret' => $this->Get('secret'), + 'user' => $sUser = UserRights::GetUser(), + 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], + 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], + ]); - parent::AfterInsert(); - } - - /** - * @inheritDoc - */ - protected function AfterUpdate() - { - IssueLog::Trace(__METHOD__, LogChannels::INLINE_IMAGE, array( - 'id' => $this->GetKey(), - 'expire' => $this->Get('expire'), - 'temp_id' => $this->Get('temp_id'), - 'item_class' => $this->Get('item_class'), - 'item_id' => $this->Get('item_id'), - 'item_org_id' => $this->Get('item_org_id'), - 'secret' => $this->Get('secret'), - 'user' => $sUser = UserRights::GetUser(), - 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], - 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); - - parent::AfterUpdate(); - } + parent::AfterUpdate(); + } /** * @inheritDoc */ protected function AfterDelete() - { - IssueLog::Trace(__METHOD__, LogChannels::INLINE_IMAGE, array( - 'id' => $this->GetKey(), - 'expire' => $this->Get('expire'), - 'temp_id' => $this->Get('temp_id'), - 'item_class' => $this->Get('item_class'), - 'item_id' => $this->Get('item_id'), - 'item_org_id' => $this->Get('item_org_id'), - 'secret' => $this->Get('secret'), - 'user' => $sUser = UserRights::GetUser(), - 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], - 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); + { + IssueLog::Trace(__METHOD__, LogChannels::INLINE_IMAGE, [ + 'id' => $this->GetKey(), + 'expire' => $this->Get('expire'), + 'temp_id' => $this->Get('temp_id'), + 'item_class' => $this->Get('item_class'), + 'item_id' => $this->Get('item_id'), + 'item_org_id' => $this->Get('item_org_id'), + 'secret' => $this->Get('secret'), + 'user' => $sUser = UserRights::GetUser(), + 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], + 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], + ]); - parent::AfterDelete(); - } + parent::AfterDelete(); + } } - /** * Garbage collector for cleaning "old" temporary InlineImages (and Attachments). */ @@ -619,9 +584,9 @@ class InlineImageGC implements iBackgroundProcess * @inheritDoc */ public function GetPeriodicity() - { - return 1; - } + { + return 1; + } /** * @inheritDoc @@ -630,13 +595,11 @@ class InlineImageGC implements iBackgroundProcess { $sDateLimit = date(AttributeDateTime::GetSQLFormat(), time()); // Every temporary InlineImage/Attachment expired will be deleted - $aResults = array(); - $aClasses = array('InlineImage', 'Attachment'); - foreach($aClasses as $sClass) - { + $aResults = []; + $aClasses = ['InlineImage', 'Attachment']; + foreach ($aClasses as $sClass) { $iProcessed = 0; - if(class_exists($sClass)) - { + if (class_exists($sClass)) { $iProcessed = $this->DeleteExpiredDocuments($sClass, $iTimeLimit, $sDateLimit); } $aResults[] = "$iProcessed old temporary $sClass(s)"; @@ -665,11 +628,15 @@ class InlineImageGC implements iBackgroundProcess $iProcessed = 0; $sOQL = "SELECT $sClass WHERE (item_id = 0) AND (expire < '$sDateLimit')"; // Next one ? - $oSet = new CMDBObjectSet(DBObjectSearch::FromOQL($sOQL), array('expire' => true) /* order by*/, array(), null, - 1 /* limit count */); - $oSet->OptimizeColumnLoad(array()); - while ((time() < $iTimeLimit) && ($oResult = $oSet->Fetch())) - { + $oSet = new CMDBObjectSet( + DBObjectSearch::FromOQL($sOQL), + ['expire' => true] /* order by*/, + [], + null, + 1 /* limit count */ + ); + $oSet->OptimizeColumnLoad([]); + while ((time() < $iTimeLimit) && ($oResult = $oSet->Fetch())) { /** @var \ormDocument $oDocument */ $oDocument = $oResult->Get('contents'); IssueLog::Info($sClass.' GC: Removed temp. file '.$oDocument->GetFileName().' on "'.$oResult->Get('item_class').'" #'.$oResult->Get('item_id').' as it has expired.'); @@ -679,4 +646,4 @@ class InlineImageGC implements iBackgroundProcess return $iProcessed; } -} \ No newline at end of file +} diff --git a/core/introspection.class.inc.php b/core/introspection.class.inc.php index cee5f9087..9e59be2a7 100644 --- a/core/introspection.class.inc.php +++ b/core/introspection.class.inc.php @@ -1,9 +1,10 @@ child classes - protected $aAttributes = array(); + protected $aAttributeHierarchy = []; // class => child classes + protected $aAttributes = []; public function __construct() { @@ -35,25 +36,19 @@ class Introspection protected function InitAttributes() { - foreach(get_declared_classes() as $sPHPClass) - { + foreach (get_declared_classes() as $sPHPClass) { $oRefClass = new ReflectionClass($sPHPClass); - if ($sPHPClass == 'AttributeDefinition' || $oRefClass->isSubclassOf('AttributeDefinition')) - { - if ($oParentClass = $oRefClass->getParentClass()) - { + if ($sPHPClass == 'AttributeDefinition' || $oRefClass->isSubclassOf('AttributeDefinition')) { + if ($oParentClass = $oRefClass->getParentClass()) { $sParentClass = $oParentClass->getName(); - if (!array_key_exists($sParentClass, $this->aAttributeHierarchy)) - { - $this->aAttributeHierarchy[$sParentClass] = array(); + if (!array_key_exists($sParentClass, $this->aAttributeHierarchy)) { + $this->aAttributeHierarchy[$sParentClass] = []; } $this->aAttributeHierarchy[$sParentClass][] = $sPHPClass; - } - else - { + } else { $sParentClass = null; } - $this->aAttributes[$sPHPClass] = array( + $this->aAttributes[$sPHPClass] = [ 'parent' => $sParentClass, 'LoadInObject' => $sPHPClass::LoadInObject(), 'LoadFromDB' => $sPHPClass::LoadFromDB(), @@ -63,7 +58,7 @@ class Introspection 'IsScalar' => $sPHPClass::IsScalar(), 'IsLinkset' => $sPHPClass::IsLinkset(), 'IsHierarchicalKey' => $sPHPClass::IsHierarchicalKey(), - ); + ]; } } } @@ -77,7 +72,7 @@ class Introspection } public function EnumAttributeCharacteristics() { - return array( + return [ 'LoadInObject' => 'Is the value stored in the object itself?', 'LoadFromDB' => 'Is the value read from the DB?', 'IsBasedOnDBColumns' => 'Is this a value stored within one or several columns?', @@ -86,8 +81,6 @@ class Introspection 'IsScalar' => 'Is this a value that makes sense in a SQL/OQL expression?', 'IsLinkset' => 'Is this a collection (1-N or N-N)?', 'IsHierarchicalKey' => 'Is this attribute an external key pointing to the host class?', - ); + ]; } } - - diff --git a/core/kpi.class.inc.php b/core/kpi.class.inc.php index d61621e36..fd6f83feb 100644 --- a/core/kpi.class.inc.php +++ b/core/kpi.class.inc.php @@ -1,4 +1,5 @@ 0) { self::$m_bEnabled_Duration = true; @@ -47,7 +47,7 @@ class ExecutionKPI } } - static public function EnableMemory($iLevel) + public static function EnableMemory($iLevel) { if ($iLevel > 0) { self::$m_bEnabled_Memory = true; @@ -57,91 +57,94 @@ class ExecutionKPI } /** - * @param string sUser A user login or * for all users - */ - static public function SetAllowedUser($sUser) + * @param string sUser A user login or * for all users + */ + public static function SetAllowedUser($sUser) { self::$m_sAllowedUser = $sUser; } - static public function IsEnabled() + public static function IsEnabled() { - if (self::$m_bEnabled_Duration || self::$m_bEnabled_Memory) - { - if ((self::$m_sAllowedUser == '*') || (UserRights::GetUser() == trim(self::$m_sAllowedUser))) - { + if (self::$m_bEnabled_Duration || self::$m_bEnabled_Memory) { + if ((self::$m_sAllowedUser == '*') || (UserRights::GetUser() == trim(self::$m_sAllowedUser))) { return true; } } return false; } - static public function SetGenerateLegacyReport($bReportExtensionsOnly) - { - self::$m_bGenerateLegacyReport = $bReportExtensionsOnly; - } - - static public function SetSlowQueries($fSlowQueries) - { - self::$m_fSlowQueries = $fSlowQueries; - } - - static public function GetDescription() + public static function SetGenerateLegacyReport($bReportExtensionsOnly) { - $aFeatures = array(); - if (self::$m_bEnabled_Duration) $aFeatures[] = 'Duration'; - if (self::$m_bEnabled_Memory) $aFeatures[] = 'Memory usage'; - $sFeatures = 'Measures: '.implode(', ', $aFeatures); - $sFor = self::$m_sAllowedUser == '*' ? 'EVERYBODY' : "'".trim(self::$m_sAllowedUser)."'"; - $sSlowQueries = ''; - if (self::$m_fSlowQueries > 0) { - $sSlowQueries = ". Slow Queries: ".self::$m_fSlowQueries."s"; - } - - $aExtensions = []; - /** @var \iKPILoggerExtension $oExtensionInstance */ - foreach (MetaModel::EnumPlugins('iKPILoggerExtension') as $oExtensionInstance) { - $aExtensions[] = ModuleService::GetInstance()->GetModuleNameFromObject($oExtensionInstance); - } - $sExtensions = ''; - if (count($aExtensions) > 0) { - $sExtensions = '. KPI Extensions: ['.implode(', ', $aExtensions).']'; - } - - return "KPI logging is active for $sFor. $sFeatures$sSlowQueries$sExtensions"; + self::$m_bGenerateLegacyReport = $bReportExtensionsOnly; } - static public function ReportStats() + public static function SetSlowQueries($fSlowQueries) { - if (!self::IsEnabled()) return; + self::$m_fSlowQueries = $fSlowQueries; + } + + public static function GetDescription() + { + $aFeatures = []; + if (self::$m_bEnabled_Duration) { + $aFeatures[] = 'Duration'; + } + if (self::$m_bEnabled_Memory) { + $aFeatures[] = 'Memory usage'; + } + $sFeatures = 'Measures: '.implode(', ', $aFeatures); + $sFor = self::$m_sAllowedUser == '*' ? 'EVERYBODY' : "'".trim(self::$m_sAllowedUser)."'"; + $sSlowQueries = ''; + if (self::$m_fSlowQueries > 0) { + $sSlowQueries = ". Slow Queries: ".self::$m_fSlowQueries."s"; + } + + $aExtensions = []; + /** @var \iKPILoggerExtension $oExtensionInstance */ + foreach (MetaModel::EnumPlugins('iKPILoggerExtension') as $oExtensionInstance) { + $aExtensions[] = ModuleService::GetInstance()->GetModuleNameFromObject($oExtensionInstance); + } + $sExtensions = ''; + if (count($aExtensions) > 0) { + $sExtensions = '. KPI Extensions: ['.implode(', ', $aExtensions).']'; + } + + return "KPI logging is active for $sFor. $sFeatures$sSlowQueries$sExtensions"; + } + + public static function ReportStats() + { + if (!self::IsEnabled()) { + return; + } global $fItopStarted; - global $iItopInitialMemory; + global $iItopInitialMemory; $sExecId = microtime(); // id to differentiate the hrefs! - $sRequest = $_SERVER['REQUEST_URI'].' ('.$_SERVER['REQUEST_METHOD'].')'; - if (isset($_POST['operation'])) { - $sRequest .= ' operation: '.$_POST['operation']; - } + $sRequest = $_SERVER['REQUEST_URI'].' ('.$_SERVER['REQUEST_METHOD'].')'; + if (isset($_POST['operation'])) { + $sRequest .= ' operation: '.$_POST['operation']; + } - $fStop = MyHelpers::getmicrotime(); - if (($fStop - $fItopStarted) > self::$m_fSlowQueries) { - // Invoke extensions to log the KPI operation - /** @var \iKPILoggerExtension $oExtensionInstance */ - $iCurrentMemory = self::memory_get_usage(); - $iPeakMemory = self::memory_get_peak_usage(); - foreach (MetaModel::EnumPlugins('iKPILoggerExtension') as $oExtensionInstance) { - $oKPILogData = new KpiLogData(KpiLogData::TYPE_REQUEST, 'Page', $sRequest, $fItopStarted, $fStop, '', $iItopInitialMemory, $iCurrentMemory, $iPeakMemory); - $oExtensionInstance->LogOperation($oKPILogData); - } - } + $fStop = MyHelpers::getmicrotime(); + if (($fStop - $fItopStarted) > self::$m_fSlowQueries) { + // Invoke extensions to log the KPI operation + /** @var \iKPILoggerExtension $oExtensionInstance */ + $iCurrentMemory = self::memory_get_usage(); + $iPeakMemory = self::memory_get_peak_usage(); + foreach (MetaModel::EnumPlugins('iKPILoggerExtension') as $oExtensionInstance) { + $oKPILogData = new KpiLogData(KpiLogData::TYPE_REQUEST, 'Page', $sRequest, $fItopStarted, $fStop, '', $iItopInitialMemory, $iCurrentMemory, $iPeakMemory); + $oExtensionInstance->LogOperation($oKPILogData); + } + } - if (!self::$m_bGenerateLegacyReport) { - return; - } + if (!self::$m_bGenerateLegacyReport) { + return; + } - $aBeginTimes = array(); - foreach (self::$m_aExecData as $aOpStats) - { + $aBeginTimes = []; + foreach (self::$m_aExecData as $aOpStats) { $aBeginTimes[] = $aOpStats['time_begin']; } array_multisort($aBeginTimes, self::$m_aExecData); @@ -150,7 +153,7 @@ class ExecutionKPI $sHtml = "
      "; $sHtml .= "
      "; - $sHtml .= "

      KPIs - $sRequest

      "; + $sHtml .= "

      KPIs - $sRequest

      "; $oStarted = DateTime::createFromFormat('U.u', $fItopStarted); $sHtml .= '

      '.$oStarted->format('Y-m-d H:i:s.u').'

      '; $sHtml .= "

      log_kpi_user_id: ".UserRights::GetUserId()."

      "; @@ -159,8 +162,7 @@ class ExecutionKPI $sHtml .= "
      "; $sHtml .= " "; $sHtml .= ""; - foreach (self::$m_aExecData as $aOpStats) - { + foreach (self::$m_aExecData as $aOpStats) { $sOperation = $aOpStats['op']; $sBegin = round($aOpStats['time_begin'], 3); $sEnd = round($aOpStats['time_end'], 3); @@ -170,12 +172,10 @@ class ExecutionKPI $sMemBegin = 'n/a'; $sMemEnd = 'n/a'; $sMemPeak = 'n/a'; - if (isset($aOpStats['mem_begin'])) - { + if (isset($aOpStats['mem_begin'])) { $sMemBegin = self::MemStr($aOpStats['mem_begin']); $sMemEnd = self::MemStr($aOpStats['mem_end']); - if (isset($aOpStats['mem_peak'])) - { + if (isset($aOpStats['mem_peak'])) { $sMemPeak = self::MemStr($aOpStats['mem_peak']); } } @@ -187,38 +187,34 @@ class ExecutionKPI $sHtml .= "
      ".$aFieldSpec['sColLabel']."
      OperationBeginEndDurationMemory startMemory endMemory peak
      "; $sHtml .= ""; - $aConsolidatedStats = array(); - foreach (self::$m_aStats as $sOperation => $aOpStats) - { + $aConsolidatedStats = []; + foreach (self::$m_aStats as $sOperation => $aOpStats) { $fTotalOp = 0; $iTotalOp = 0; $fMinOp = null; $fMaxOp = 0; $sMaxOpArguments = null; - foreach ($aOpStats as $sArguments => $aEvents) - { - foreach ($aEvents as $aEventData) - { + foreach ($aOpStats as $sArguments => $aEvents) { + foreach ($aEvents as $aEventData) { $fDuration = $aEventData['time']; $fTotalOp += $fDuration; $iTotalOp++; $fMinOp = is_null($fMinOp) ? $fDuration : min($fMinOp, $fDuration); - if ($fDuration > $fMaxOp) - { + if ($fDuration > $fMaxOp) { $sMaxOpArguments = $sArguments; $fMaxOp = $fDuration; } } } - $aConsolidatedStats[$sOperation] = array( + $aConsolidatedStats[$sOperation] = [ 'count' => $iTotalOp, 'duration' => $fTotalOp, 'min' => $fMinOp, 'max' => $fMaxOp, 'avg' => $fTotalOp / $iTotalOp, - 'max_args' => $sMaxOpArguments - ); + 'max_args' => $sMaxOpArguments, + ]; } $sHtml .= "
      "; @@ -226,8 +222,7 @@ class ExecutionKPI $sHtml .= "
      OperationCountDurationMinMaxAvg
      '; $sHtmlArguments .= ''; - foreach ($aEvents[0]['callers'] as $aCall) - { + foreach ($aEvents[0]['callers'] as $aCall) { $sHtmlArguments .= ''; $sHtmlArguments .= ''; $sHtmlArguments .= ''; @@ -281,8 +271,7 @@ class ExecutionKPI $fTotalInter = 0; $fMinInter = null; $fMaxInter = 0; - foreach ($aEvents as $aEventData) - { + foreach ($aEvents as $aEventData) { $fDuration = $aEventData['time']; $fTotalInter += $fDuration; $fMinInter = is_null($fMinInter) ? $fDuration : min($fMinInter, $fDuration); @@ -293,10 +282,8 @@ class ExecutionKPI $sTotalInter = round($fTotalInter, 3); $sMinInter = round($fMinInter, 3); $sMaxInter = round($fMaxInter, 3); - if (($fTotalInter >= self::$m_fSlowQueries)) - { - if ($bDisplayHeader) - { + if (($fTotalInter >= self::$m_fSlowQueries)) { + if ($bDisplayHeader) { $sOperationHtml = ''.$sOperation.''; $sHtml .= "

      $sOperationHtml

      "; $sHtml .= "
      Call stack for the FIRST caller
      '.$aCall['Function'].''.$aCall['File'].':'.$aCall['Line'].'
      "; @@ -310,8 +297,7 @@ class ExecutionKPI $sHtml .= ""; } } - if (!$bDisplayHeader) - { + if (!$bDisplayHeader) { $sHtml .= "
      "; $sHtml .= "

      Back to page stats

      "; } @@ -321,19 +307,19 @@ class ExecutionKPI self::Report($sHtml); } - public static function InitStats() - { - // Invoke extensions to initialize the KPI statistics - /** @var \iKPILoggerExtension $oExtensionInstance */ - foreach (MetaModel::EnumPlugins('iKPILoggerExtension') as $oExtensionInstance) { - $oExtensionInstance->InitStats(); - } - } + public static function InitStats() + { + // Invoke extensions to initialize the KPI statistics + /** @var \iKPILoggerExtension $oExtensionInstance */ + foreach (MetaModel::EnumPlugins('iKPILoggerExtension') as $oExtensionInstance) { + $oExtensionInstance->InitStats(); + } + } public function __construct() { $this->ResetCounters(); - } + } // Get the duration since startup, and reset the counter for the next measure // @@ -341,65 +327,62 @@ class ExecutionKPI { global $fItopStarted; - if (!self::IsEnabled()) { - return; - } + if (!self::IsEnabled()) { + return; + } $aNewEntry = null; - $fStarted = $this->m_fStarted; - $fStopped = $this->m_fStarted; - if (self::$m_bEnabled_Duration) { + $fStarted = $this->m_fStarted; + $fStopped = $this->m_fStarted; + if (self::$m_bEnabled_Duration) { $fStopped = MyHelpers::getmicrotime(); - $aNewEntry = array( + $aNewEntry = [ 'op' => $sOperationDesc, 'time_begin' => $this->m_fStarted - $fItopStarted, 'time_end' => $fStopped - $fItopStarted, - ); + ]; // Reset for the next operation (if the object is recycled) $this->m_fStarted = $fStopped; } - $iInitialMemory = is_null($this->m_iInitialMemory) ? 0 : $this->m_iInitialMemory; - $iCurrentMemory = 0; - $iPeakMemory = 0; - if (self::$m_bEnabled_Memory) - { + $iInitialMemory = is_null($this->m_iInitialMemory) ? 0 : $this->m_iInitialMemory; + $iCurrentMemory = 0; + $iPeakMemory = 0; + if (self::$m_bEnabled_Memory) { $iCurrentMemory = self::memory_get_usage(); - if (is_null($aNewEntry)) - { - $aNewEntry = array('op' => $sOperationDesc); + if (is_null($aNewEntry)) { + $aNewEntry = ['op' => $sOperationDesc]; } $aNewEntry['mem_begin'] = $this->m_iInitialMemory; $aNewEntry['mem_end'] = $iCurrentMemory; - $iPeakMemory = self::memory_get_peak_usage(); - $aNewEntry['mem_peak'] = $iPeakMemory; + $iPeakMemory = self::memory_get_peak_usage(); + $aNewEntry['mem_peak'] = $iPeakMemory; // Reset for the next operation (if the object is recycled) $this->m_iInitialMemory = $iCurrentMemory; } - if (self::$m_bEnabled_Duration || self::$m_bEnabled_Memory) { - // Invoke extensions to log the KPI operation - /** @var \iKPILoggerExtension $oExtensionInstance */ - foreach(MetaModel::EnumPlugins('iKPILoggerExtension') as $oExtensionInstance) - { - $sExtension = ModuleService::GetInstance()->GetModuleNameFromCallStack(1); - $oKPILogData = new KpiLogData( - KpiLogData::TYPE_REPORT, - 'Step', - $sOperationDesc, - $fStarted, - $fStopped, - $sExtension, - $iInitialMemory, - $iCurrentMemory, - $iPeakMemory); - $oExtensionInstance->LogOperation($oKPILogData); - } - } + if (self::$m_bEnabled_Duration || self::$m_bEnabled_Memory) { + // Invoke extensions to log the KPI operation + /** @var \iKPILoggerExtension $oExtensionInstance */ + foreach (MetaModel::EnumPlugins('iKPILoggerExtension') as $oExtensionInstance) { + $sExtension = ModuleService::GetInstance()->GetModuleNameFromCallStack(1); + $oKPILogData = new KpiLogData( + KpiLogData::TYPE_REPORT, + 'Step', + $sOperationDesc, + $fStarted, + $fStopped, + $sExtension, + $iInitialMemory, + $iCurrentMemory, + $iPeakMemory + ); + $oExtensionInstance->LogOperation($oKPILogData); + } + } - if (!is_null($aNewEntry) && self::$m_bGenerateLegacyReport) - { + if (!is_null($aNewEntry) && self::$m_bGenerateLegacyReport) { self::$m_aExecData[] = $aNewEntry; } $this->ResetCounters(); @@ -417,20 +400,20 @@ class ExecutionKPI * @throws \ReflectionException */ public function ComputeStatsForExtension($object, string $sMethod, string $sMessage = ''): bool - { - if (!self::IsEnabled()) { - return true; - } + { + if (!self::IsEnabled()) { + return true; + } - $sSignature = ModuleService::GetInstance()->GetModuleMethodSignature($object, $sMethod); - if (utils::StartsWith($sSignature, '[')) { - $this->ComputeStats('Extension', "$sSignature $sMessage"); + $sSignature = ModuleService::GetInstance()->GetModuleMethodSignature($object, $sMethod); + if (utils::StartsWith($sSignature, '[')) { + $this->ComputeStats('Extension', "$sSignature $sMessage"); return true; - } + } return false; - } + } public function ComputeStats($sOperation, $sArguments) { @@ -442,85 +425,82 @@ class ExecutionKPI if (self::$m_bEnabled_Duration) { $fStopped = MyHelpers::getmicrotime(); $fDuration = $fStopped - $this->m_fStarted; - $aCallstack = []; - if (self::$m_bGenerateLegacyReport) { - if (self::$m_bBlameCaller) { - $aCallstack = MyHelpers::get_callstack(1); - self::$m_aStats[$sOperation][$sArguments][] = [ - 'time' => $fDuration, - 'callers' => $aCallstack, - ]; - } else { - self::$m_aStats[$sOperation][$sArguments][] = [ - 'time' => $fDuration - ]; - } - } + $aCallstack = []; + if (self::$m_bGenerateLegacyReport) { + if (self::$m_bBlameCaller) { + $aCallstack = MyHelpers::get_callstack(1); + self::$m_aStats[$sOperation][$sArguments][] = [ + 'time' => $fDuration, + 'callers' => $aCallstack, + ]; + } else { + self::$m_aStats[$sOperation][$sArguments][] = [ + 'time' => $fDuration, + ]; + } + } - $iInitialMemory = is_null($this->m_iInitialMemory) ? 0 : $this->m_iInitialMemory; - $iCurrentMemory = 0; - $iPeakMemory = 0; - if (self::$m_bEnabled_Memory) - { - $iCurrentMemory = self::memory_get_usage(); - $iPeakMemory = self::memory_get_peak_usage(); - } + $iInitialMemory = is_null($this->m_iInitialMemory) ? 0 : $this->m_iInitialMemory; + $iCurrentMemory = 0; + $iPeakMemory = 0; + if (self::$m_bEnabled_Memory) { + $iCurrentMemory = self::memory_get_usage(); + $iPeakMemory = self::memory_get_peak_usage(); + } - // Invoke extensions to log the KPI operation - /** @var \iKPILoggerExtension $oExtensionInstance */ - foreach (MetaModel::EnumPlugins('iKPILoggerExtension') as $oExtensionInstance) { - //$sExtension = ModuleService::GetInstance()->GetModuleNameFromCallStack(1); - $sExtension = ''; - $oKPILogData = new KpiLogData( - KpiLogData::TYPE_STATS, - $sOperation, - $sArguments, - $this->m_fStarted, - $fStopped, - $sExtension, - $iInitialMemory, - $iCurrentMemory, - $iPeakMemory, - $aCallstack); - $oExtensionInstance->LogOperation($oKPILogData); - } - } + // Invoke extensions to log the KPI operation + /** @var \iKPILoggerExtension $oExtensionInstance */ + foreach (MetaModel::EnumPlugins('iKPILoggerExtension') as $oExtensionInstance) { + //$sExtension = ModuleService::GetInstance()->GetModuleNameFromCallStack(1); + $sExtension = ''; + $oKPILogData = new KpiLogData( + KpiLogData::TYPE_STATS, + $sOperation, + $sArguments, + $this->m_fStarted, + $fStopped, + $sExtension, + $iInitialMemory, + $iCurrentMemory, + $iPeakMemory, + $aCallstack + ); + $oExtensionInstance->LogOperation($oKPILogData); + } + } } protected function ResetCounters() { - if (self::$m_bEnabled_Duration) - { + if (self::$m_bEnabled_Duration) { $this->m_fStarted = microtime(true); } - if (self::$m_bEnabled_Memory) - { + if (self::$m_bEnabled_Memory) { $this->m_iInitialMemory = self::memory_get_usage(); } } - const HTML_REPORT_FILE = 'log/kpi.html'; + public const HTML_REPORT_FILE = 'log/kpi.html'; - static protected function Report($sText) + protected static function Report($sText) { file_put_contents(APPROOT.self::HTML_REPORT_FILE, "$sText\n", FILE_APPEND | LOCK_EX); } - static protected function MemStr($iMemory) + protected static function MemStr($iMemory) { return round($iMemory / 1024).' Kb'; } - static protected function memory_get_usage() + protected static function memory_get_usage() { - return memory_get_usage(true); + return memory_get_usage(true); } - static public function memory_get_peak_usage($bRealUsage = false) + public static function memory_get_peak_usage($bRealUsage = false) { - if (function_exists('memory_get_peak_usage')) - { + if (function_exists('memory_get_peak_usage')) { return memory_get_peak_usage($bRealUsage); } // PHP > 5.2.1 - this verb depends on a compilation option diff --git a/core/log.class.inc.php b/core/log.class.inc.php index a1688afdc..b79703ebf 100644 --- a/core/log.class.inc.php +++ b/core/log.class.inc.php @@ -1,4 +1,5 @@ - /** * @since 2.7.0 N°2518 N°2793 */ @@ -66,7 +66,7 @@ abstract class RotatingLogFileNameBuilder implements iLogFileNameBuilder * We are caching the file mtime though * @var array with full file path as key and DateTime (file last modification time) as value */ - protected static $aLogFileLastModified = array(); + protected static $aLogFileLastModified = []; /** @var string */ protected $sLogFileFullPath; /** @var string */ @@ -86,8 +86,7 @@ abstract class RotatingLogFileNameBuilder implements iLogFileNameBuilder protected function GetLastModifiedDateForFile() { - if (isset(static::$aLogFileLastModified[$this->sLogFileFullPath])) - { + if (isset(static::$aLogFileLastModified[$this->sLogFileFullPath])) { return static::$aLogFileLastModified[$this->sLogFileFullPath]; } @@ -131,16 +130,13 @@ abstract class RotatingLogFileNameBuilder implements iLogFileNameBuilder $oConfig = utils::GetConfig(); utils::InitTimeZone($oConfig); - if ($this->GetLastModifiedDateForFile() === null) - { - if (!$this->IsLogFileExists()) - { + if ($this->GetLastModifiedDateForFile() === null) { + if (!$this->IsLogFileExists()) { return; } $iLogDateLastModifiedTimeStamp = filemtime($this->sLogFileFullPath); - if ($iLogDateLastModifiedTimeStamp === false) - { + if ($iLogDateLastModifiedTimeStamp === false) { return; } $oDateTime = DateTime::createFromFormat('U', $iLogDateLastModifiedTimeStamp); @@ -152,8 +148,7 @@ abstract class RotatingLogFileNameBuilder implements iLogFileNameBuilder $oNow = new DateTime(); $bShouldRotate = $this->ShouldRotate($this->GetLastModifiedDateForFile(), $oNow); - if (!$bShouldRotate) - { + if (!$bShouldRotate) { return; } @@ -170,33 +165,28 @@ abstract class RotatingLogFileNameBuilder implements iLogFileNameBuilder */ protected function RotateLogFile($oLogFileLastModified) { - if (!$this->IsLogFileExists()) // extra check, but useful for cron also ! - { + if (!$this->IsLogFileExists()) { // extra check, but useful for cron also ! return; } $oLock = null; - try - { + try { $oLock = new iTopMutex('log_rotation_'.$this->sLogFileFullPath); $oLock->Lock(); - if (!$this->IsLogFileExists()) // extra extra check if we were blocked and another process moved the file in the meantime - { + if (!$this->IsLogFileExists()) { // extra extra check if we were blocked and another process moved the file in the meantime $oLock->Unlock(); return; } $this->ResetLastModifiedDateForFile(); $sNewLogFileName = $this->GetRotatedFileName($oLogFileLastModified); rename($this->sLogFileFullPath, $sNewLogFileName); - } - catch (Exception $e) - { + } catch (Exception $e) { // nothing to do, cannot log... file will be renamed on the next call O:) return; - } - finally - { - if (!is_null($oLock)) { $oLock->Unlock();} + } finally { + if (!is_null($oLock)) { + $oLock->Unlock(); + } } } @@ -227,13 +217,11 @@ abstract class RotatingLogFileNameBuilder implements iLogFileNameBuilder */ public function IsLogFileExists() { - if (!file_exists($this->sLogFileFullPath)) - { + if (!file_exists($this->sLogFileFullPath)) { return false; } - if (!is_readable($this->sLogFileFullPath)) - { + if (!is_readable($this->sLogFileFullPath)) { return false; } @@ -290,13 +278,11 @@ class DailyRotatingLogFileNameBuilder extends RotatingLogFileNameBuilder $iNowYear = $oNow->format('Y'); $iNowDay = $oNow->format('z'); - if ($iLogYear !== $iNowYear) - { + if ($iLogYear !== $iNowYear) { return true; } - if ($iLogDay !== $iNowDay) - { + if ($iLogDay !== $iNowDay) { return true; } @@ -341,13 +327,11 @@ class WeeklyRotatingLogFileNameBuilder extends RotatingLogFileNameBuilder $iNowYear = $oNow->format('Y'); $iNowWeek = $oNow->format('W'); - if ($iLogYear !== $iNowYear) - { + if ($iLogYear !== $iNowYear) { return true; } - if ($iLogWeek !== $iNowWeek) - { + if ($iLogWeek !== $iNowWeek) { return true; } @@ -381,13 +365,11 @@ class MonthlyRotatingLogFileNameBuilder extends RotatingLogFileNameBuilder $iNowYear = $oNow->format('Y'); $iNowMonth = $oNow->format('n'); - if ($iLogYear !== $iNowYear) - { + if ($iLogYear !== $iNowYear) { return true; } - if ($iLogMonth !== $iNowMonth) - { + if ($iLogMonth !== $iNowMonth) { return true; } @@ -435,8 +417,7 @@ class LogFileNameBuilderFactory { $oConfig = utils::GetConfig(); $sFileNameBuilderImpl = $oConfig->Get('log_filename_builder_impl'); - if (!is_a($sFileNameBuilderImpl, iLogFileNameBuilder::class, true)) - { + if (!is_a($sFileNameBuilderImpl, iLogFileNameBuilder::class, true)) { $sFileNameBuilderImpl = 'DefaultLogFileNameBuilder'; } @@ -444,7 +425,6 @@ class LogFileNameBuilderFactory } } - /** * File logging * @@ -469,38 +449,37 @@ class FileLog $this->oFileNameBuilder = LogFileNameBuilderFactory::GetInstance($sFileName); } - public function Error($sText, $sChannel = '', $aContext = array()) + public function Error($sText, $sChannel = '', $aContext = []) { $this->Write($sText, __FUNCTION__, $sChannel, $aContext); } - public function Warning($sText, $sChannel = '', $aContext = array()) + public function Warning($sText, $sChannel = '', $aContext = []) { $this->Write($sText, __FUNCTION__, $sChannel, $aContext); } - public function Info($sText, $sChannel = '', $aContext = array()) + public function Info($sText, $sChannel = '', $aContext = []) { $this->Write($sText, __FUNCTION__, $sChannel, $aContext); } - public function Ok($sText, $sChannel = '', $aContext = array()) + public function Ok($sText, $sChannel = '', $aContext = []) { $this->Write($sText, __FUNCTION__, $sChannel, $aContext); } - public function Debug($sText, $sChannel = '', $aContext = array()) + public function Debug($sText, $sChannel = '', $aContext = []) { $this->Write($sText, __FUNCTION__, $sChannel, $aContext); } - public function Trace($sText, $sChannel = '', $aContext = array()) + public function Trace($sText, $sChannel = '', $aContext = []) { $this->Write($sText, __FUNCTION__, $sChannel, $aContext); } - - protected function Write($sText, $sLevel = '', $sChannel = '', $aContext = array()) + protected function Write($sText, $sLevel = '', $sChannel = '', $aContext = []) { $sTextPrefix = empty($sLevel) ? '' : (str_pad($sLevel, 7)); $sTextPrefix .= ' | '; @@ -533,7 +512,6 @@ class FileLog } } - /** * Simple enum like class to factorize channels values as constants * Channels are used especially as parameters in {@see \LogAPI} methods @@ -638,7 +616,6 @@ class LogChannels public const SECURITY = 'Security'; } - abstract class LogAPI { public const CHANNEL_DEFAULT = ''; @@ -666,19 +643,18 @@ abstract class LogAPI */ public const LEVEL_DEFAULT_DB = false; - protected static $aLevelsPriority = array( + protected static $aLevelsPriority = [ self::LEVEL_ERROR => 400, self::LEVEL_WARNING => 300, self::LEVEL_INFO => 200, self::LEVEL_OK => 200, self::LEVEL_DEBUG => 100, self::LEVEL_TRACE => 50, - ); + ]; public const ENUM_CONFIG_PARAM_FILE = 'log_level_min'; public const ENUM_CONFIG_PARAM_DB = 'log_level_min.write_in_db'; - /** * Parameter to enable log purge. * @@ -715,32 +691,32 @@ abstract class LogAPI static::$m_oMockMetaModelConfig = $oMetaModelConfig; } - public static function Error($sMessage, $sChannel = null, $aContext = array()) + public static function Error($sMessage, $sChannel = null, $aContext = []) { static::Log(self::LEVEL_ERROR, $sMessage, $sChannel, $aContext); } - public static function Warning($sMessage, $sChannel = null, $aContext = array()) + public static function Warning($sMessage, $sChannel = null, $aContext = []) { static::Log(self::LEVEL_WARNING, $sMessage, $sChannel, $aContext); } - public static function Info($sMessage, $sChannel = null, $aContext = array()) + public static function Info($sMessage, $sChannel = null, $aContext = []) { static::Log(self::LEVEL_INFO, $sMessage, $sChannel, $aContext); } - public static function Ok($sMessage, $sChannel = null, $aContext = array()) + public static function Ok($sMessage, $sChannel = null, $aContext = []) { static::Log(self::LEVEL_OK, $sMessage, $sChannel, $aContext); } - public static function Debug($sMessage, $sChannel = null, $aContext = array()) + public static function Debug($sMessage, $sChannel = null, $aContext = []) { static::Log(self::LEVEL_DEBUG, $sMessage, $sChannel, $aContext); } - public static function Trace($sMessage, $sChannel = null, $aContext = array()) + public static function Trace($sMessage, $sChannel = null, $aContext = []) { static::Log(self::LEVEL_TRACE, $sMessage, $sChannel, $aContext); } @@ -748,7 +724,7 @@ abstract class LogAPI /** * @throws \ConfigException if log wrongly configured */ - public static function Log($sLevel, $sMessage, $sChannel = null, $aContext = array()) + public static function Log($sLevel, $sMessage, $sChannel = null, $aContext = []) { if (!isset(self::$aLevelsPriority[$sLevel])) { IssueLog::Error("invalid log level '{$sLevel}'"); @@ -766,7 +742,7 @@ abstract class LogAPI /** * @throws \ConfigException */ - protected static function WriteLog(string $sLevel, string $sMessage, ?string $sChannel = null, ?array $aContext = array()): void + protected static function WriteLog(string $sLevel, string $sMessage, ?string $sChannel = null, ?array $aContext = []): void { if ( (null !== static::$m_oFileLog) @@ -918,15 +894,13 @@ abstract class LogAPI try { self::$oLastEventIssue = static::GetEventIssue($sMessage, $sChannel, $aContext); self::$oLastEventIssue->DBInsertNoReload(); - } - catch (Exception $e) { + } catch (Exception $e) { // calling low level methods : if we would call Error() for example we would try to write to DB again... static::$m_oFileLog->Error('Failed to log issue into the DB', LogChannels::CORE, [ 'exception message' => $e->getMessage(), 'exception stack' => $e->getTraceAsString(), ]); - } - finally { + } finally { $bWriteToDbReentrance = false; } } @@ -994,13 +968,13 @@ abstract class LogAPI class SetupLog extends LogAPI { - const CHANNEL_DEFAULT = 'SetupLog'; + public const CHANNEL_DEFAULT = 'SetupLog'; /** * @inheritDoc * * As this object is used during setup, without any conf file available, customizing the level can be done by changing this constant ! */ - const LEVEL_DEFAULT = self::LEVEL_INFO; + public const LEVEL_DEFAULT = self::LEVEL_INFO; protected static $m_oFileLog = null; @@ -1017,14 +991,14 @@ class SetupLog extends LogAPI class IssueLog extends LogAPI { - const CHANNEL_DEFAULT = 'IssueLog'; + public const CHANNEL_DEFAULT = 'IssueLog'; protected static $m_oFileLog = null; } class ToolsLog extends LogAPI { - const CHANNEL_DEFAULT = 'ToolsLog'; + public const CHANNEL_DEFAULT = 'ToolsLog'; protected static $m_oFileLog = null; } @@ -1037,17 +1011,16 @@ class ToolsLog extends LogAPI */ class DeadLockLog extends LogAPI { - const CHANNEL_WAIT_TIMEOUT = 'Deadlock-WaitTimeout'; - const CHANNEL_DEADLOCK_FOUND = 'Deadlock-Found'; - const CHANNEL_DEFAULT = self::CHANNEL_WAIT_TIMEOUT; + public const CHANNEL_WAIT_TIMEOUT = 'Deadlock-WaitTimeout'; + public const CHANNEL_DEADLOCK_FOUND = 'Deadlock-Found'; + public const CHANNEL_DEFAULT = self::CHANNEL_WAIT_TIMEOUT; /** @var \FileLog we want our own instance ! */ protected static $m_oFileLog = null; public static function Enable($sTargetFile = null) { - if (empty($sTargetFile)) - { + if (empty($sTargetFile)) { $sTargetFile = APPROOT.'log/deadlocks.log'; } parent::Enable($sTargetFile); @@ -1056,8 +1029,7 @@ class DeadLockLog extends LogAPI /** @noinspection PhpUnreachableStatementInspection we want to keep the break statements to keep clarity and avoid errors */ private static function GetChannelFromMysqlErrorNo($iMysqlErrorNo) { - switch ($iMysqlErrorNo) - { + switch ($iMysqlErrorNo) { case CMDBSource::MYSQL_ERRNO_WAIT_TIMEOUT: return self::CHANNEL_WAIT_TIMEOUT; break; @@ -1082,14 +1054,13 @@ class DeadLockLog extends LogAPI * @since 2.7.1 method creation * @since 2.7.5 3.0.0 rename param names and fix phpdoc (thanks Hipska !) */ - public static function Log($sLevel, $sMessage, $iMysqlErrorNumber = null, $aContext = array()) + public static function Log($sLevel, $sMessage, $iMysqlErrorNumber = null, $aContext = []) { $sChannel = self::GetChannelFromMysqlErrorNo($iMysqlErrorNumber); parent::Log($sLevel, $sMessage, $sChannel, $aContext); } } - /** * Starting with the WARNING level we will log in a dedicated file (/log/deprecated-calls.log) : * - iTop deprecated files or code @@ -1137,8 +1108,7 @@ class DeprecatedCallsLog extends LogAPI { try { $bIsLogLevelEnabled = static::IsLogLevelEnabled(self::LEVEL_WARNING, self::ENUM_CHANNEL_PHP_LIBMETHOD); - } - catch (ConfigException $e) { + } catch (ConfigException $e) { $bIsLogLevelEnabled = false; } @@ -1153,7 +1123,8 @@ class DeprecatedCallsLog extends LogAPI * @since 3.0.0 N°3002 logs deprecated notices in called code * @since 3.0.4 N°6274 do not set handler when in PHPUnit context (otherwise PHP notices won't be caught) */ - public static function Enable($sTargetFile = null): void { + public static function Enable($sTargetFile = null): void + { if (empty($sTargetFile)) { $sTargetFile = APPROOT.'log/deprecated-calls.log'; } @@ -1248,8 +1219,7 @@ class DeprecatedCallsLog extends LogAPI if (!static::IsLogLevelEnabled(self::LEVEL_WARNING, self::ENUM_CHANNEL_FILE)) { return; } - } - catch (ConfigException $e) { + } catch (ConfigException $e) { return; } @@ -1290,8 +1260,7 @@ class DeprecatedCallsLog extends LogAPI if (!static::IsLogLevelEnabled(self::LEVEL_WARNING, self::ENUM_CHANNEL_PHP_API)) { return; } - } - catch (ConfigException $oException) { + } catch (ConfigException $oException) { return; } @@ -1319,8 +1288,7 @@ class DeprecatedCallsLog extends LogAPI if (!static::IsLogLevelEnabled(self::LEVEL_WARNING, self::ENUM_CHANNEL_PHP_METHOD)) { return; } - } - catch (ConfigException $e) { + } catch (ConfigException $e) { return; } @@ -1328,8 +1296,7 @@ class DeprecatedCallsLog extends LogAPI if (isset($aStack[1]['class'])) { $sFunctionDesc = $aStack[1]['class'].$aStack[1]['type'].$aStack[1]['function']; - } - else { + } else { $sFunctionDesc = $aStack[1]['function']; } @@ -1340,7 +1307,6 @@ class DeprecatedCallsLog extends LogAPI $sMessage .= '. Caller: '.self::SummarizeCallStack(array_slice($aStack, 1)); - static::Warning($sMessage, self::ENUM_CHANNEL_PHP_METHOD); static::ForwardToTriggerError($sMessage); } @@ -1355,8 +1321,7 @@ class DeprecatedCallsLog extends LogAPI if (!static::IsLogLevelEnabled(self::LEVEL_WARNING, self::ENUM_CHANNEL_PHP_ENDPOINT)) { return; } - } - catch (ConfigException $e) { + } catch (ConfigException $e) { return; } @@ -1375,12 +1340,11 @@ class DeprecatedCallsLog extends LogAPI static::ForwardToTriggerError($sMessage); } - public static function Log($sLevel, $sMessage, $sChannel = null, $aContext = array()): void + public static function Log($sLevel, $sMessage, $sChannel = null, $aContext = []): void { try { parent::Log($sLevel, $sMessage, $sChannel, $aContext); - } - catch (ConfigException $e) { + } catch (ConfigException $e) { // nothing much we can do... and we don't want to crash the caller ! } } @@ -1412,13 +1376,11 @@ class DeprecatedCallsLog extends LogAPI // If possible and meaningful, add the class and method if (isset($aCallStack[1]['class'])) { $sSummary = $aCallStack[1]['class'].$aCallStack[1]['type'].$aCallStack[1]['function']." ($sFileLine)"; - } - elseif (isset($aCallStack[1]['function'])) { + } elseif (isset($aCallStack[1]['function'])) { if (in_array($aCallStack[1]['function'], ['include', 'require', 'include_once', 'require_once'])) { // No need to show the generic mechanism of inclusion $bRecurse = false; - } - else { + } else { $sSummary = $aCallStack[1]['function']." ($sFileLine)"; } } @@ -1441,7 +1403,6 @@ class DeprecatedCallsLog extends LogAPI } } - class LogFileRotationProcess implements iScheduledProcess { /** @@ -1449,12 +1410,12 @@ class LogFileRotationProcess implements iScheduledProcess * * @var string[] */ - const LOGFILES_TO_ROTATE = array( + public const LOGFILES_TO_ROTATE = [ 'setup.log', 'error.log', 'tools.log', 'itop-fence.log', - ); + ]; /** * @inheritDoc @@ -1492,7 +1453,7 @@ class LogFileRotationProcess implements iScheduledProcess public function PurgeLogs(): array { // result - $aFilesResult = array(); + $aFilesResult = []; // Max keep days $iMaxDays = MetaModel::GetConfig()->Get(LogAPI::ENUM_CONFIG_PARAM_PURGE_MAX_KEEP_DAYS); @@ -1511,9 +1472,9 @@ class LogFileRotationProcess implements iScheduledProcess $sFileRealPath = $oLogFile->getRealPath(); // Check file extension - if(!in_array($oLogFile->getExtension(), ['log','sql','xml'])){ + if (!in_array($oLogFile->getExtension(), ['log','sql','xml'])) { continue; - } + } // Compute number of days since last modification $oDateFileLastModification = new DateTime(); @@ -1535,7 +1496,7 @@ class LogFileRotationProcess implements iScheduledProcess if (!is_writable($sFileRealPath)) { $aFileResult['error'] = Dict::S('itop-log-mgmt:UI:Error:file_read_only'); } // unlink OK - else if (unlink($sFileRealPath)) { + elseif (unlink($sFileRealPath)) { $aFileResult['deleted'] = true; } // unlink KO else { @@ -1558,8 +1519,7 @@ class LogFileRotationProcess implements iScheduledProcess { try { $sLogFileNameBuilder = $this->GetLogFileNameBuilderClassName(); - } - catch (ProcessException $e) { + } catch (ProcessException $e) { return new DateTime('3000-01-01'); } @@ -1575,8 +1535,7 @@ class LogFileRotationProcess implements iScheduledProcess private function GetLogFileNameBuilderClassName() { $sLogFileNameBuilder = MetaModel::GetConfig()->Get('log_filename_builder_impl'); - if (is_a($sLogFileNameBuilder, RotatingLogFileNameBuilder::class, true)) - { + if (is_a($sLogFileNameBuilder, RotatingLogFileNameBuilder::class, true)) { return $sLogFileNameBuilder; } @@ -1604,7 +1563,7 @@ class ExceptionLog extends LogAPI * As it encapsulate the operations performed using the Exception, you should prefer it to the standard API inherited from LogApi `ExceptionLog::Error($oException->getMessage(), get_class($oException), ['__exception' => $oException]);` * The parameter order is not standard, but in our use case, the resulting API is way more convenient this way ! */ - public static function LogException(Throwable $oException, $aContext = array(), $sLevel = self::LEVEL_ERROR): void + public static function LogException(Throwable $oException, $aContext = [], $sLevel = self::LEVEL_ERROR): void { if (!isset(self::$aLevelsPriority[$sLevel])) { IssueLog::Error("invalid log level '{$sLevel}'"); @@ -1626,13 +1585,13 @@ class ExceptionLog extends LogAPI } /** @noinspection PhpUnhandledExceptionInspection */ - public static function Log($sLevel, $sMessage, $sChannel = null, $aContext = array()) + public static function Log($sLevel, $sMessage, $sChannel = null, $aContext = []) { throw new ApplicationException('Do not call this directly, prefer using ExceptionLog::LogException() instead'); } /** @noinspection PhpParameterNameChangedDuringInheritanceInspection */ - protected static function WriteLog(string $sLevel, string $sMessage, ?string $sExceptionClass = null, ?array $aContext = array()): void + protected static function WriteLog(string $sLevel, string $sMessage, ?string $sExceptionClass = null, ?array $aContext = []): void { if ( (null !== static::$m_oFileLog) diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 59cabbfc9..8725bbe2f 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -1,4 +1,5 @@ "rootclass" * * @var array */ - private static $m_aRootClasses = array(); + private static $m_aRootClasses = []; /** * array of ("classname" => array of "parentclass") * * @var array */ - private static $m_aParentClasses = array(); + private static $m_aParentClasses = []; /** * array of ("classname" => array of "childclass") * * @var array */ - private static $m_aChildClasses = array(); + private static $m_aChildClasses = []; /** * array of ("classname" => array of class information) * * @var array */ - private static $m_aClassParams = array(); + private static $m_aClassParams = []; /** * array of ("classname" => array of highlightscale information) * * @var array */ - private static $m_aHighlightScales = array(); + private static $m_aHighlightScales = []; /** * @param string $sRefClass @@ -615,47 +611,37 @@ abstract class MetaModel */ final public static function GetUniquenessRules($sClass, $bClassDefinitionOnly = false) { - if (!isset(self::$m_aClassParams[$sClass])) - { - return array(); + if (!isset(self::$m_aClassParams[$sClass])) { + return []; } - $aCurrentUniquenessRules = array(); + $aCurrentUniquenessRules = []; - if (array_key_exists('uniqueness_rules', self::$m_aClassParams[$sClass])) - { + if (array_key_exists('uniqueness_rules', self::$m_aClassParams[$sClass])) { $aCurrentUniquenessRules = self::$m_aClassParams[$sClass]['uniqueness_rules']; } - if ($bClassDefinitionOnly) - { + if ($bClassDefinitionOnly) { return $aCurrentUniquenessRules; } $sParentClass = self::GetParentClass($sClass); - if ($sParentClass) - { + if ($sParentClass) { $aParentUniquenessRules = self::GetUniquenessRules($sParentClass); - foreach ($aParentUniquenessRules as $sUniquenessRuleId => $aParentUniquenessRuleProperties) - { + foreach ($aParentUniquenessRules as $sUniquenessRuleId => $aParentUniquenessRuleProperties) { $bCopyDisabledKey = true; $bCurrentDisabledValue = null; - if (array_key_exists($sUniquenessRuleId, $aCurrentUniquenessRules)) - { - if (self::IsUniquenessRuleContainingOnlyDisabledKey($aCurrentUniquenessRules[$sUniquenessRuleId])) - { + if (array_key_exists($sUniquenessRuleId, $aCurrentUniquenessRules)) { + if (self::IsUniquenessRuleContainingOnlyDisabledKey($aCurrentUniquenessRules[$sUniquenessRuleId])) { $bCopyDisabledKey = false; - } - else - { + } else { continue; } } $aMergedUniquenessProperties = $aParentUniquenessRuleProperties; - if (!$bCopyDisabledKey) - { + if (!$bCopyDisabledKey) { $aMergedUniquenessProperties['disabled'] = $aCurrentUniquenessRules[$sUniquenessRuleId]['disabled']; } $aCurrentUniquenessRules[$sUniquenessRuleId] = $aMergedUniquenessProperties; @@ -675,8 +661,7 @@ abstract class MetaModel */ private static function SetUniquenessRuleRootClass($sRootClass, $sRuleId) { - foreach (self::EnumChildClasses($sRootClass, ENUM_CHILD_CLASSES_ALL) as $sClass) - { + foreach (self::EnumChildClasses($sRootClass, ENUM_CHILD_CLASSES_ALL) as $sClass) { self::$m_aClassParams[$sClass]['uniqueness_rules'][$sRuleId]['root_class'] = $sClass; } } @@ -690,17 +675,14 @@ abstract class MetaModel final public static function GetRootClassForUniquenessRule($sRuleId, $sLeafClassName) { $sFirstClassWithRuleId = null; - if (isset(self::$m_aClassParams[$sLeafClassName]['uniqueness_rules'][$sRuleId])) - { + if (isset(self::$m_aClassParams[$sLeafClassName]['uniqueness_rules'][$sRuleId])) { $sFirstClassWithRuleId = $sLeafClassName; } $sParentClass = self::GetParentClass($sLeafClassName); - if ($sParentClass) - { + if ($sParentClass) { $sParentClassWithRuleId = self::GetRootClassForUniquenessRule($sRuleId, $sParentClass); - if (!is_null($sParentClassWithRuleId)) - { + if (!is_null($sParentClassWithRuleId)) { $sFirstClassWithRuleId = $sParentClassWithRuleId; } } @@ -719,29 +701,22 @@ abstract class MetaModel */ final public static function GetChildClassesWithDisabledUniquenessRule($sRootClass, $sRuleId) { - $aClassesWithDisabledRule = array(); - foreach (self::EnumChildClasses($sRootClass, ENUM_CHILD_CLASSES_EXCLUDETOP) as $sChildClass) - { - if (array_key_exists($sChildClass, $aClassesWithDisabledRule)) - { + $aClassesWithDisabledRule = []; + foreach (self::EnumChildClasses($sRootClass, ENUM_CHILD_CLASSES_EXCLUDETOP) as $sChildClass) { + if (array_key_exists($sChildClass, $aClassesWithDisabledRule)) { continue; } - if (!array_key_exists('uniqueness_rules', self::$m_aClassParams[$sChildClass])) - { + if (!array_key_exists('uniqueness_rules', self::$m_aClassParams[$sChildClass])) { continue; } - if (!array_key_exists($sRuleId, self::$m_aClassParams[$sChildClass]['uniqueness_rules'])) - { + if (!array_key_exists($sRuleId, self::$m_aClassParams[$sChildClass]['uniqueness_rules'])) { continue; } - if (self::$m_aClassParams[$sChildClass]['uniqueness_rules'][$sRuleId]['disabled'] === true) - { + if (self::$m_aClassParams[$sChildClass]['uniqueness_rules'][$sRuleId]['disabled'] === true) { $aDisabledClassChildren = self::EnumChildClasses($sChildClass, ENUM_CHILD_CLASSES_ALL); - foreach ($aDisabledClassChildren as $sDisabledClassChild) - { - if (!self::IsAbstract($sDisabledClassChild)) - { + foreach ($aDisabledClassChildren as $sDisabledClassChild) { + if (!self::IsAbstract($sDisabledClassChild)) { $aClassesWithDisabledRule[] = $sDisabledClassChild; } } @@ -766,7 +741,6 @@ abstract class MetaModel return ((count($aNonNullRuleProperties) == 1) && (array_key_exists('disabled', $aNonNullRuleProperties))); } - /** * @param string $sClass * @param string $sType {@see \Combodo\iTop\Core\MetaModel\FriendlyNameType} @@ -931,7 +905,7 @@ abstract class MetaModel $aAttributes = $aNameSpec[1]; $aPieces = preg_split('/%([0-9])\\$s/', $sFormat, -1, PREG_SPLIT_DELIM_CAPTURE); - $aExpressions = array(); + $aExpressions = []; foreach ($aPieces as $i => $sPiece) { if ($i & 1) { // $i is ODD - sPiece is a delimiter @@ -942,12 +916,10 @@ abstract class MetaModel $sAttCode = $aAttributes[$iReplacement]; $aExpressions[] = new FieldExpression($sAttCode); } - } else - { + } else { // $i is EVEN - sPiece is a literal // - if (strlen($sPiece) > 0) - { + if (strlen($sPiece) > 0) { $aExpressions[] = new ScalarExpression($sPiece); } } @@ -1106,8 +1078,10 @@ abstract class MetaModel final public static function GetOrderByDefault($sClass, $bOnlyDeclared = false) { self::_check_subclass($sClass); - $aOrderBy = array_key_exists("order_by_default", - self::$m_aClassParams[$sClass]) ? self::$m_aClassParams[$sClass]["order_by_default"] : array(); + $aOrderBy = array_key_exists( + "order_by_default", + self::$m_aClassParams[$sClass] + ) ? self::$m_aClassParams[$sClass]["order_by_default"] : []; if ($bOnlyDeclared) { // Used to reverse engineer the declaration of the data model return $aOrderBy; @@ -1178,7 +1152,7 @@ abstract class MetaModel */ final public static function GetDependentAttributes($sClass, $sAttCode) { - $aResults = array(); + $aResults = []; self::_check_subclass($sClass); foreach (self::ListAttributeDefs($sClass) as $sDependentAttCode => $void) { $aPrerequisites = self::GetPrerequisiteAttributes($sClass, $sDependentAttCode); @@ -1234,7 +1208,7 @@ abstract class MetaModel // This API does not rely on our capability to query the DB and retrieve // the list of existing tables // Rather, it uses the list of expected tables, corresponding to the data model - $aTables = array(); + $aTables = []; foreach (self::GetClasses() as $sClass) { if (!self::HasTable($sClass)) { continue; @@ -1243,7 +1217,7 @@ abstract class MetaModel // Could be completed later with all the classes that are using a given table if (!array_key_exists($sTable, $aTables)) { - $aTables[$sTable] = array(); + $aTables[$sTable] = []; } $aTables[$sTable][] = $sClass; } @@ -1263,13 +1237,12 @@ abstract class MetaModel if (isset(self::$m_aClassParams[$sClass]['indexes'])) { $aRet = self::$m_aClassParams[$sClass]['indexes']; } else { - $aRet = array(); + $aRet = []; } return $aRet; } - /** * @param $sClass * @param $aColumns @@ -1280,15 +1253,12 @@ abstract class MetaModel */ private static function DBGetIndexesLength($sClass, $aColumns, $aTableInfo) { - $aLength = array(); + $aLength = []; $aAttDefs = self::ListAttributeDefs($sClass); - foreach($aColumns as $sAttSqlCode) - { + foreach ($aColumns as $sAttSqlCode) { $iLength = null; - foreach($aAttDefs as $sAttCode => $oAttDef) - { - if (($sAttCode == $sAttSqlCode) || ($oAttDef->IsParam('sql') && ($oAttDef->Get('sql') == $sAttSqlCode))) - { + foreach ($aAttDefs as $sAttCode => $oAttDef) { + if (($sAttCode == $sAttSqlCode) || ($oAttDef->IsParam('sql') && ($oAttDef->Get('sql') == $sAttSqlCode))) { $iLength = $oAttDef->GetIndexLength(); break; } @@ -1420,25 +1390,25 @@ abstract class MetaModel * * @var \AttributeDefinition[][] */ - private static $m_aAttribDefs = array(); + private static $m_aAttribDefs = []; /** * array of ("classname" => array of ("attcode"=>"sourceclass")) * * @var array */ - private static $m_aAttribOrigins = array(); + private static $m_aAttribOrigins = []; /** * array of ("classname" => array of ("attcode")) * * @var array */ - private static $m_aIgnoredAttributes = array(); + private static $m_aIgnoredAttributes = []; /** * array of ("classname" => array of ("attcode" => array of ("metaattcode" => oMetaAttDef)) * * @var array */ - private static $m_aEnumToMeta = array(); + private static $m_aEnumToMeta = []; /** * @param string $sClass @@ -1522,11 +1492,9 @@ abstract class MetaModel final public static function GetKeysList($sClass) { self::_check_subclass($sClass); - $aExtKeys = array(); - foreach(self::$m_aAttribDefs[$sClass] as $sAttCode => $oAttDef) - { - if ($oAttDef->IsExternalKey()) - { + $aExtKeys = []; + foreach (self::$m_aAttribDefs[$sClass] as $sAttCode => $oAttDef) { + if ($oAttDef->IsExternalKey()) { $aExtKeys[] = $sAttCode; } } @@ -1584,9 +1552,7 @@ abstract class MetaModel $bRes = false; } } - } - else - { + } else { $bRes = array_key_exists($sAttCode, self::$m_aAttribDefs[$sClass]); } @@ -1640,8 +1606,7 @@ abstract class MetaModel */ public static function IsValidObject($oObject) { - if (!is_object($oObject)) - { + if (!is_object($oObject)) { return false; } return (self::IsValidClass(get_class($oObject))); @@ -1677,9 +1642,7 @@ abstract class MetaModel $oKeyAttDef = self::GetAttributeDef($sClass, $sExtKeyAttCode); $sRemoteClass = $oKeyAttDef->GetTargetClass(); return self::GetAttributeDef($sRemoteClass, $sRemoteAttCode); - } - else - { + } else { throw new Exception("Unknown attribute $sAttCode from class $sClass"); } } @@ -1692,7 +1655,7 @@ abstract class MetaModel */ final public static function GetExternalKeys($sClass) { - $aExtKeys = array(); + $aExtKeys = []; foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAtt) { if ($oAtt->IsExternalKey()) { $aExtKeys[$sAttCode] = $oAtt; @@ -1710,7 +1673,7 @@ abstract class MetaModel */ final public static function GetLinkedSets($sClass) { - $aLinkedSets = array(); + $aLinkedSets = []; foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAtt) { // Note: Careful, this will only return SUB-classes, which does NOT include AttributeLinkedset itself! We might want to use "is_a()" instead. if (is_subclass_of($oAtt, 'AttributeLinkedSet')) { @@ -1730,9 +1693,9 @@ abstract class MetaModel */ final public static function GetExternalFields($sClass, $sKeyAttCode) { - static $aExtFields = array(); + static $aExtFields = []; if (!isset($aExtFields[$sClass][$sKeyAttCode])) { - $aExtFields[$sClass][$sKeyAttCode] = array(); + $aExtFields[$sClass][$sKeyAttCode] = []; foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAtt) { if ($oAtt->IsExternalField() && ($oAtt->GetKeyAttCode() == $sKeyAttCode)) { $aExtFields[$sClass][$sKeyAttCode][$oAtt->GetExtAttCode()] = $oAtt; @@ -1784,7 +1747,7 @@ abstract class MetaModel } /** @var array */ - protected static $m_aTrackForwardCache = array(); + protected static $m_aTrackForwardCache = []; /** * List external keys for which there is a LinkSet (direct or indirect) on the other end @@ -1800,20 +1763,17 @@ abstract class MetaModel final public static function GetTrackForwardExternalKeys($sClass) { if (!isset(self::$m_aTrackForwardCache[$sClass])) { - $aRes = array(); + $aRes = []; foreach (MetaModel::GetExternalKeys($sClass) as $sAttCode => $oAttDef) { $sRemoteClass = $oAttDef->GetTargetClass(); foreach (MetaModel::ListAttributeDefs($sRemoteClass) as $sRemoteAttCode => $oRemoteAttDef) { - if (!$oRemoteAttDef->IsLinkSet()) - { + if (!$oRemoteAttDef->IsLinkSet()) { continue; } - if (!is_subclass_of($sClass, $oRemoteAttDef->GetLinkedClass()) && $oRemoteAttDef->GetLinkedClass() != $sClass) - { + if (!is_subclass_of($sClass, $oRemoteAttDef->GetLinkedClass()) && $oRemoteAttDef->GetLinkedClass() != $sClass) { continue; } - if ($oRemoteAttDef->GetExtKeyToMe() != $sAttCode) - { + if ($oRemoteAttDef->GetExtKeyToMe() != $sAttCode) { continue; } $aRes[$sAttCode] = $oRemoteAttDef; @@ -1836,7 +1796,7 @@ abstract class MetaModel if (isset(self::$m_aEnumToMeta[$sClass][$sAttCode])) { $aRet = self::$m_aEnumToMeta[$sClass][$sAttCode]; } else { - $aRet = array(); + $aRet = []; } return $aRet; @@ -1855,21 +1815,15 @@ abstract class MetaModel */ public static function GetLabel($sClass, $sAttCodeEx, $bShowMandatory = false) { - if (($iPos = strpos($sAttCodeEx, '->')) === false) - { - if ($sAttCodeEx == 'id') - { + if (($iPos = strpos($sAttCodeEx, '->')) === false) { + if ($sAttCodeEx == 'id') { $sLabel = Dict::S('UI:CSVImport:idField'); - } - else - { + } else { $oAttDef = self::GetAttributeDef($sClass, $sAttCodeEx); $sMandatory = ($bShowMandatory && !$oAttDef->IsNullAllowed()) ? '*' : ''; $sLabel = $oAttDef->GetLabel().$sMandatory; } - } - else - { + } else { $sExtKeyAttCode = substr($sAttCodeEx, 0, $iPos); $sRemoteAttCode = substr($sAttCodeEx, $iPos + 2); $oKeyAttDef = MetaModel::GetAttributeDef($sClass, $sExtKeyAttCode); @@ -1901,7 +1855,7 @@ abstract class MetaModel /** * @var array array of (FilterCode => AttributeCode) */ - private static $m_aFilterAttribList = array(); + private static $m_aFilterAttribList = []; /** * @deprecated 3.0.0 do not use : dead code, will be removed in the future N°4690 - Deprecate "FilterCodes" @@ -1951,7 +1905,7 @@ abstract class MetaModel /** * @var array array of ("listcode" => various info on the list, common to every classes) */ - private static $m_aListInfos = array(); + private static $m_aListInfos = []; /** * array of ("classname" => array of "listcode" => list) * list may be an array of attcode / fltcode @@ -1959,7 +1913,7 @@ abstract class MetaModel * * @var array */ - private static $m_aListData = array(); + private static $m_aListData = []; /** * @return array @@ -1974,7 +1928,7 @@ abstract class MetaModel * * @return mixed */ - final static public function GetZListInfo($sListCode) + final public static function GetZListInfo($sListCode) { return self::$m_aListInfos[$sListCode]; } @@ -1987,17 +1941,14 @@ abstract class MetaModel */ public static function GetZListItems($sClass, $sListCode) { - if (array_key_exists($sClass, self::$m_aListData)) - { - if (array_key_exists($sListCode, self::$m_aListData[$sClass])) - { + if (array_key_exists($sClass, self::$m_aListData)) { + if (array_key_exists($sListCode, self::$m_aListData[$sClass])) { return self::$m_aListData[$sClass][$sListCode]; } } $sParentClass = self::GetParentPersistentClass($sClass); - if (empty($sParentClass)) - { - return array(); + if (empty($sParentClass)) { + return []; } // nothing for the mother of all classes // Dig recursively return self::GetZListItems($sParentClass, $sListCode); @@ -2050,28 +2001,23 @@ abstract class MetaModel $sStateAttCode = MetaModel::GetStateAttributeCode($sClass); $sDefaultState = MetaModel::GetDefaultState($sClass); - foreach (MetaModel::FlattenZList(MetaModel::GetZListItems($sLinkedClass, 'list')) as $sLnkAttCode) - { + foreach (MetaModel::FlattenZList(MetaModel::GetZListItems($sLinkedClass, 'list')) as $sLnkAttCode) { $oLnkAttDef = MetaModel::GetAttributeDef($sLinkedClass, $sLnkAttCode); - if ($sStateAttCode == $sLnkAttCode) - { + if ($sStateAttCode == $sLnkAttCode) { // State attribute is always hidden from the UI continue; } if (($sLnkAttCode == $sExtKeyToMe) || ($sLnkAttCode == $sExtKeyToRemote) - || ($sLnkAttCode == 'finalclass')) - { + || ($sLnkAttCode == 'finalclass')) { continue; } - if (!($oLnkAttDef->IsWritable())) - { + if (!($oLnkAttDef->IsWritable())) { continue; } $iFlags = MetaModel::GetAttributeFlags($sLinkedClass, $sDefaultState, $sLnkAttCode); - if (!($iFlags & OPT_ATT_HIDDEN) && !($iFlags & OPT_ATT_READONLY)) - { + if (!($iFlags & OPT_ATT_HIDDEN) && !($iFlags & OPT_ATT_READONLY)) { $aAttCodesToPrint[] = $oLnkAttDef; } } @@ -2091,7 +2037,7 @@ abstract class MetaModel * @since 3.0.0 N°2334 added code for n-n relations in {@see BlockIndirectLinkSetViewTable::GetAttCodesToDisplay} * @since 3.1.0 N°3200 method creation so that it can be used elsewhere */ - public static function GetAttributeLinkedSetIndirectDatatableAttCodesToDisplay(string $sObjectClass, string $sObjectLinkedSetIndirectAttCode, string $sRemoteClass, string $sLnkExternalKeyToRemoteClassAttCode):array + public static function GetAttributeLinkedSetIndirectDatatableAttCodesToDisplay(string $sObjectClass, string $sObjectLinkedSetIndirectAttCode, string $sRemoteClass, string $sLnkExternalKeyToRemoteClassAttCode): array { $aLnkAttDefsToDisplay = MetaModel::GetZListAttDefsFilteredForIndirectLinkClass($sObjectClass, $sObjectLinkedSetIndirectAttCode); $aRemoteAttDefsToDisplay = MetaModel::GetZListAttDefsFilteredForIndirectRemoteClass($sRemoteClass); @@ -2127,8 +2073,7 @@ abstract class MetaModel public static function IsAttributeInZList($sClass, $sListCode, $sAttCodeOrFltCode, $sGroup = null) { $aZList = self::FlattenZlist(self::GetZListItems($sClass, $sListCode)); - if (!$sGroup) - { + if (!$sGroup) { return (in_array($sAttCodeOrFltCode, $aZList)); } return (in_array($sAttCodeOrFltCode, $aZList[$sGroup])); @@ -2142,7 +2087,7 @@ abstract class MetaModel * * @var array */ - private static $m_aRelationInfos = array(); + private static $m_aRelationInfos = []; /** * @deprecated Use EnumRelationsEx instead @@ -2161,7 +2106,7 @@ abstract class MetaModel if (!empty($sClass)) { // Return only the relations that have a meaning (i.e. for which at least one query is defined) // for the specified class - $aClassRelations = array(); + $aClassRelations = []; foreach ($aResult as $sRelCode) { $aQueriesDown = self::EnumRelationQueries($sClass, $sRelCode); if (count($aQueriesDown) > 0) { @@ -2172,8 +2117,7 @@ abstract class MetaModel // The current patch has been implemented in DBObject and MetaModel if ($sRelCode == 'impacts') { $aQueriesUp = self::EnumRelationQueries($sClass, 'impacts', false); - if (count($aQueriesUp) > 0) - { + if (count($aQueriesUp) > 0) { $aClassRelations[] = 'depends on'; } } @@ -2185,8 +2129,7 @@ abstract class MetaModel // Temporary patch: until the impact analysis GUI gets rewritten, // let's consider that "depends on" is equivalent to "impacts/up" // The current patch has been implemented in DBObject and MetaModel - if (in_array('impacts', $aResult)) - { + if (in_array('impacts', $aResult)) { $aResult[] = 'depends on'; } @@ -2206,18 +2149,15 @@ abstract class MetaModel $aRelationInfo = array_keys(self::$m_aRelationInfos); // Return only the relations that have a meaning (i.e. for which at least one query is defined) // for the specified class - $aClassRelations = array(); - foreach($aRelationInfo as $sRelCode) - { + $aClassRelations = []; + foreach ($aRelationInfo as $sRelCode) { $aQueriesDown = self::EnumRelationQueries($sClass, $sRelCode, true /* Down */); - if (count($aQueriesDown) > 0) - { + if (count($aQueriesDown) > 0) { $aClassRelations[$sRelCode]['down'] = self::GetRelationLabel($sRelCode, true); } $aQueriesUp = self::EnumRelationQueries($sClass, $sRelCode, false /* Up */); - if (count($aQueriesUp) > 0) - { + if (count($aQueriesUp) > 0) { $aClassRelations[$sRelCode]['up'] = self::GetRelationLabel($sRelCode, false); } } @@ -2232,18 +2172,15 @@ abstract class MetaModel * @return string * @throws \DictExceptionMissingString */ - final static public function GetRelationDescription($sRelCode, $bDown = true) + final public static function GetRelationDescription($sRelCode, $bDown = true) { // Legacy convention had only one description describing the relation. // Now, as the relation is bidirectional, we have a description for each directions. $sLegacy = Dict::S("Relation:$sRelCode/Description"); - if($bDown) - { + if ($bDown) { $sKey = "Relation:$sRelCode/DownStream+"; - } - else - { + } else { $sKey = "Relation:$sRelCode/UpStream+"; } $sRet = Dict::S($sKey, $sLegacy); @@ -2266,8 +2203,7 @@ abstract class MetaModel // Now, the relation from A to B says that something is transmitted from A to B, thus going DOWNstream as described in a petri net. $sKey = "Relation:$sRelCode/DownStream"; $sLegacy = Dict::S("Relation:$sRelCode/VerbUp", $sKey); - } else - { + } else { $sKey = "Relation:$sRelCode/UpStream"; $sLegacy = Dict::S("Relation:$sRelCode/VerbDown", $sKey); } @@ -2285,23 +2221,19 @@ abstract class MetaModel */ protected static function ComputeRelationQueries($sRelCode) { - $aQueries = array(); - foreach(self::GetClasses() as $sClass) - { - $aQueries[$sClass]['down'] = array(); - if (!array_key_exists('up', $aQueries[$sClass])) - { - $aQueries[$sClass]['up'] = array(); + $aQueries = []; + foreach (self::GetClasses() as $sClass) { + $aQueries[$sClass]['down'] = []; + if (!array_key_exists('up', $aQueries[$sClass])) { + $aQueries[$sClass]['up'] = []; } - $aNeighboursDown = call_user_func_array(array($sClass, 'GetRelationQueriesEx'), array($sRelCode)); + $aNeighboursDown = call_user_func_array([$sClass, 'GetRelationQueriesEx'], [$sRelCode]); // Translate attributes into queries (new style of spec only) - foreach($aNeighboursDown as $sNeighbourId => $aNeighbourData) - { + foreach ($aNeighboursDown as $sNeighbourId => $aNeighbourData) { $aNeighbourData['sFromClass'] = $aNeighbourData['sDefinedInClass']; - try - { + try { if (Utils::StrLen($aNeighbourData['sQueryDown']) == 0) { $oAttDef = self::GetAttributeDef($sClass, $aNeighbourData['sAttribute']); if ($oAttDef instanceof AttributeExternalKey) { @@ -2309,12 +2241,10 @@ abstract class MetaModel $aNeighbourData['sToClass'] = $sTargetClass; $aNeighbourData['sQueryDown'] = 'SELECT '.$sTargetClass.' AS o WHERE o.id = :this->'.$aNeighbourData['sAttribute']; $aNeighbourData['sQueryUp'] = 'SELECT '.$aNeighbourData['sFromClass'].' AS o WHERE o.'.$aNeighbourData['sAttribute'].' = :this->id'; - } elseif ($oAttDef instanceof AttributeLinkedSet) - { + } elseif ($oAttDef instanceof AttributeLinkedSet) { $sLinkedClass = $oAttDef->GetLinkedClass(); $sExtKeyToMe = $oAttDef->GetExtKeyToMe(); - if ($oAttDef->IsIndirect()) - { + if ($oAttDef->IsIndirect()) { $sExtKeyToRemote = $oAttDef->GetExtKeyToRemote(); $oRemoteAttDef = self::GetAttributeDef($sLinkedClass, $sExtKeyToRemote); $sRemoteClass = $oRemoteAttDef->GetTargetClass(); @@ -2322,32 +2252,23 @@ abstract class MetaModel $aNeighbourData['sToClass'] = $sRemoteClass; $aNeighbourData['sQueryDown'] = "SELECT $sRemoteClass AS o JOIN $sLinkedClass AS lnk ON lnk.$sExtKeyToRemote = o.id WHERE lnk.$sExtKeyToMe = :this->id"; $aNeighbourData['sQueryUp'] = "SELECT ".$aNeighbourData['sFromClass']." AS o JOIN $sLinkedClass AS lnk ON lnk.$sExtKeyToMe = o.id WHERE lnk.$sExtKeyToRemote = :this->id"; - } - else - { + } else { $aNeighbourData['sToClass'] = $sLinkedClass; $aNeighbourData['sQueryDown'] = "SELECT $sLinkedClass AS o WHERE o.$sExtKeyToMe = :this->id"; $aNeighbourData['sQueryUp'] = "SELECT ".$aNeighbourData['sFromClass']." AS o WHERE o.id = :this->$sExtKeyToMe"; } - } - else - { + } else { throw new Exception("Unexpected attribute type for '{$aNeighbourData['sAttribute']}'. Expecting a link set or external key."); } - } - else - { + } else { $oSearch = DBObjectSearch::FromOQL($aNeighbourData['sQueryDown']); $aNeighbourData['sToClass'] = $oSearch->GetClass(); } - } - catch (Exception $e) - { + } catch (Exception $e) { throw new Exception("Wrong definition for the relation $sRelCode/{$aNeighbourData['sDefinedInClass']}/{$aNeighbourData['sNeighbour']}: ".$e->getMessage()); } - if ($aNeighbourData['sDirection'] == 'down') - { + if ($aNeighbourData['sDirection'] == 'down') { $aNeighbourData['sQueryUp'] = null; } @@ -2355,13 +2276,10 @@ abstract class MetaModel $aQueries[$sClass]['down'][$sArrowId] = $aNeighbourData; // Compute the reverse index - if ($aNeighbourData['sDefinedInClass'] == $sClass) - { - if ($aNeighbourData['sDirection'] == 'both') - { + if ($aNeighbourData['sDefinedInClass'] == $sClass) { + if ($aNeighbourData['sDirection'] == 'both') { $sToClass = $aNeighbourData['sToClass']; - foreach(self::EnumChildClasses($sToClass, ENUM_CHILD_CLASSES_ALL) as $sSubClass) - { + foreach (self::EnumChildClasses($sToClass, ENUM_CHILD_CLASSES_ALL) as $sSubClass) { $aQueries[$sSubClass]['up'][$sArrowId] = $aNeighbourData; } } @@ -2384,19 +2302,15 @@ abstract class MetaModel */ public static function EnumRelationQueries($sClass, $sRelCode, $bDown = true) { - static $aQueries = array(); - if (!isset($aQueries[$sRelCode])) - { + static $aQueries = []; + if (!isset($aQueries[$sRelCode])) { $aQueries[$sRelCode] = self::ComputeRelationQueries($sRelCode); } $sDirection = $bDown ? 'down' : 'up'; - if (isset($aQueries[$sRelCode][$sClass][$sDirection])) - { + if (isset($aQueries[$sRelCode][$sClass][$sDirection])) { return $aQueries[$sRelCode][$sClass][$sDirection]; - } - else - { - return array(); + } else { + return []; } } @@ -2414,9 +2328,13 @@ abstract class MetaModel * @throws \Exception */ public static function GetRelatedObjectsDown( - $sRelCode, $aSourceObjects, $iMaxDepth = 99, $bEnableRedundancy = true, $aUnreachable = array(), $aContexts = array() - ) - { + $sRelCode, + $aSourceObjects, + $iMaxDepth = 99, + $bEnableRedundancy = true, + $aUnreachable = [], + $aContexts = [] + ) { $oGraph = new RelationGraph(); foreach ($aSourceObjects as $oObject) { $oGraph->AddSourceObject($oObject); @@ -2440,7 +2358,7 @@ abstract class MetaModel * @return RelationGraph The graph of all the related objects * @throws \Exception */ - public static function GetRelatedObjectsUp($sRelCode, $aSourceObjects, $iMaxDepth = 99, $bEnableRedundancy = true, $aContexts = array()) + public static function GetRelatedObjectsUp($sRelCode, $aSourceObjects, $iMaxDepth = 99, $bEnableRedundancy = true, $aContexts = []) { $oGraph = new RelationGraph(); foreach ($aSourceObjects as $oObject) { @@ -2461,19 +2379,19 @@ abstract class MetaModel * * @var array */ - private static $m_aStates = array(); + private static $m_aStates = []; /** * array of ("classname" => array of ("stimuluscode"=>array('label'=>...))) * * @var array */ - private static $m_aStimuli = array(); + private static $m_aStimuli = []; /** * array of ("classname" => array of ("statcode_from"=>array of ("stimuluscode" => array('target_state'=>..., 'actions'=>array of handlers procs, 'user_restriction'=>TBD))) * * @var array */ - private static $m_aTransitions = array(); + private static $m_aTransitions = []; /** * @param string $sClass @@ -2482,18 +2400,14 @@ abstract class MetaModel */ public static function EnumStates($sClass) { - if (array_key_exists($sClass, self::$m_aStates)) - { + if (array_key_exists($sClass, self::$m_aStates)) { return self::$m_aStates[$sClass]; - } - elseif (self::HasStateAttributeCode($sClass)) - { + } elseif (self::HasStateAttributeCode($sClass)) { $sStateAttCode = self::GetStateAttributeCode($sClass); $oAttDef = self::GetAttributeDef($sClass, $sStateAttCode); $aStates = []; - foreach($oAttDef->GetAllowedValues() as $sStateCode => $sStateLabel) - { + foreach ($oAttDef->GetAllowedValues() as $sStateCode => $sStateLabel) { $aStates[$sStateCode] = [ 'attribute_inherit' => '', 'attribute_list' => [], @@ -2501,10 +2415,8 @@ abstract class MetaModel } return $aStates; - } - else - { - return array(); + } else { + return []; } } @@ -2517,28 +2429,22 @@ abstract class MetaModel */ public static function EnumInitialStates($sClass) { - if (array_key_exists($sClass, self::$m_aStates)) - { - $aRet = array(); + if (array_key_exists($sClass, self::$m_aStates)) { + $aRet = []; // Add the states for which the flag 'is_initial_state' is set to - foreach(self::$m_aStates[$sClass] as $aStateCode => $aProps) - { - if (isset($aProps['initial_state_path'])) - { + foreach (self::$m_aStates[$sClass] as $aStateCode => $aProps) { + if (isset($aProps['initial_state_path'])) { $aRet[$aStateCode] = $aProps['initial_state_path']; } } // Add the default initial state $sMainInitialState = self::GetDefaultState($sClass); - if (!isset($aRet[$sMainInitialState])) - { - $aRet[$sMainInitialState] = array(); + if (!isset($aRet[$sMainInitialState])) { + $aRet[$sMainInitialState] = []; } return $aRet; - } - else - { - return array(); + } else { + return []; } } @@ -2549,13 +2455,10 @@ abstract class MetaModel */ public static function EnumStimuli($sClass) { - if (array_key_exists($sClass, self::$m_aStimuli)) - { + if (array_key_exists($sClass, self::$m_aStimuli)) { return self::$m_aStimuli[$sClass]; - } - else - { - return array(); + } else { + return []; } } @@ -2612,14 +2515,12 @@ abstract class MetaModel */ public static function EnumTransitions($sClass, $sStateCode) { - if (array_key_exists($sClass, self::$m_aTransitions)) - { - if (array_key_exists($sStateCode, self::$m_aTransitions[$sClass])) - { + if (array_key_exists($sClass, self::$m_aTransitions)) { + if (array_key_exists($sStateCode, self::$m_aTransitions[$sClass])) { return self::$m_aTransitions[$sClass][$sStateCode]; } } - return array(); + return []; } /** @@ -2637,15 +2538,15 @@ abstract class MetaModel */ public static function EnumPossibleAttributeFlags() { - return $aPossibleAttFlags = array( + return $aPossibleAttFlags = [ 'normal' => OPT_ATT_NORMAL, 'hidden' => OPT_ATT_HIDDEN, 'read_only' => OPT_ATT_READONLY, 'mandatory' => OPT_ATT_MANDATORY, 'must_change' => OPT_ATT_MUSTCHANGE, 'must_prompt' => OPT_ATT_MUSTPROMPT, - 'slave' => OPT_ATT_SLAVE - ); + 'slave' => OPT_ATT_SLAVE, + ]; } /** @@ -2713,7 +2614,7 @@ abstract class MetaModel */ public static function GetTransitionAttributes($sClass, $sStimulus, $sOriginState) { - $aAttributes = array(); + $aAttributes = []; // Retrieving target state $aTransitions = MetaModel::EnumTransitions($sClass, $sOriginState); @@ -2725,19 +2626,15 @@ abstract class MetaModel $aTargetState = $aStates[$sTargetState]; $aTargetStateAttributes = $aTargetState['attribute_list']; // - Merging with results (only MUST_XXX and MANDATORY) - foreach($aTargetStateAttributes as $sTargetStateAttCode => $iTargetStateAttFlags) - { + foreach ($aTargetStateAttributes as $sTargetStateAttCode => $iTargetStateAttFlags) { $iTmpAttFlags = OPT_ATT_NORMAL; - if ($iTargetStateAttFlags & OPT_ATT_MUSTPROMPT) - { + if ($iTargetStateAttFlags & OPT_ATT_MUSTPROMPT) { $iTmpAttFlags = $iTmpAttFlags | OPT_ATT_MUSTPROMPT; } - if ($iTargetStateAttFlags & OPT_ATT_MUSTCHANGE) - { + if ($iTargetStateAttFlags & OPT_ATT_MUSTCHANGE) { $iTmpAttFlags = $iTmpAttFlags | OPT_ATT_MUSTCHANGE; } - if ($iTargetStateAttFlags & OPT_ATT_MANDATORY) - { + if ($iTargetStateAttFlags & OPT_ATT_MANDATORY) { $iTmpAttFlags = $iTmpAttFlags | OPT_ATT_MANDATORY; } @@ -2747,14 +2644,10 @@ abstract class MetaModel // Retrieving attributes from transition $aTransitionAttributes = $aTransition['attribute_list']; // - Merging with results - foreach($aTransitionAttributes as $sAttCode => $iAttributeFlags) - { - if (array_key_exists($sAttCode, $aAttributes)) - { + foreach ($aTransitionAttributes as $sAttCode => $iAttributeFlags) { + if (array_key_exists($sAttCode, $aAttributes)) { $aAttributes[$sAttCode] = $aAttributes[$sAttCode] | $iAttributeFlags; - } - else - { + } else { $aAttributes[$sAttCode] = $iAttributeFlags; } } @@ -2779,7 +2672,7 @@ abstract class MetaModel if (array_key_exists($sState, $aStates)) { $bReadOnly = (($iFlags & OPT_ATT_READONLY) == OPT_ATT_READONLY); $bHidden = (($iFlags & OPT_ATT_HIDDEN) == OPT_ATT_HIDDEN); - foreach($aStates[$sState] as $sPrevState) { + foreach ($aStates[$sState] as $sPrevState) { $iPrevFlags = self::GetAttributeFlags($sClass, $sPrevState, $sAttCode); if (($iPrevFlags & OPT_ATT_HIDDEN) != OPT_ATT_HIDDEN) { $bReadOnly = $bReadOnly && (($iPrevFlags & OPT_ATT_READONLY) == OPT_ATT_READONLY); // if it is/was not readonly => then it's not @@ -2789,15 +2682,13 @@ abstract class MetaModel if ($bReadOnly) { $iFlags = $iFlags | OPT_ATT_READONLY; - } - else { + } else { $iFlags = $iFlags & ~OPT_ATT_READONLY; } if ($bHidden) { $iFlags = $iFlags | OPT_ATT_HIDDEN; - } - else { + } else { $iFlags = $iFlags & ~OPT_ATT_HIDDEN; } } @@ -2814,7 +2705,7 @@ abstract class MetaModel * @return mixed * @throws \Exception */ - public static function GetAllowedValues_att($sClass, $sAttCode, $aArgs = array(), $sContains = '') + public static function GetAllowedValues_att($sClass, $sAttCode, $aArgs = [], $sContains = '') { $oAttDef = self::GetAttributeDef($sClass, $sAttCode); return $oAttDef->GetAllowedValues($aArgs, $sContains); @@ -2831,14 +2722,13 @@ abstract class MetaModel * @return mixed * @throws \CoreException */ - public static function GetAllowedValues_flt($sClass, $sFltCode, $aArgs = array(), $sContains = '') + public static function GetAllowedValues_flt($sClass, $sFltCode, $aArgs = [], $sContains = '') { DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use MetaModel::GetAllowedValues_flt: dead code, will be removed in the future. Use MetaModel::GetAllowedValues'); return self::GetAllowedValues_att($sClass, $sFltCode); } - /** * @param string $sClass * @param string $sAttCode @@ -2849,7 +2739,7 @@ abstract class MetaModel * @return mixed * @throws \Exception */ - public static function GetAllowedValuesAsObjectSet($sClass, $sAttCode, $aArgs = array(), $sContains = '', $iAdditionalValue = null) + public static function GetAllowedValuesAsObjectSet($sClass, $sAttCode, $aArgs = [], $sContains = '', $iAdditionalValue = null) { /** @var \AttributeExternalKey $oAttDef */ $oAttDef = self::GetAttributeDef($sClass, $sAttCode); @@ -2857,8 +2747,6 @@ abstract class MetaModel return $oAttDef->GetAllowedValuesAsObjectSet($aArgs, $sContains, $iAdditionalValue); } - - // // Business model declaration verbs (should be static) // @@ -2871,14 +2759,12 @@ abstract class MetaModel public static function RegisterZList($sListCode, $aListInfo) { // Check mandatory params - $aMandatParams = array( + $aMandatParams = [ "description" => "detailed (though one line) description of the list", "type" => "attributes | filters", - ); - foreach($aMandatParams as $sParamName => $sParamDesc) - { - if (!array_key_exists($sParamName, $aListInfo)) - { + ]; + foreach ($aMandatParams as $sParamName => $sParamDesc) { + if (!array_key_exists($sParamName, $aListInfo)) { throw new CoreException("Declaration of list $sListCode - missing parameter $sParamName"); } } @@ -2925,8 +2811,7 @@ abstract class MetaModel */ public static function InitClasses($sTablePrefix) { - if (count(self::GetClasses()) > 0) - { + if (count(self::GetClasses()) > 0) { throw new CoreException("InitClasses should not be called more than once -skipped"); } @@ -2935,54 +2820,43 @@ abstract class MetaModel // Initialize the classes (declared attributes, etc.) // - $aObsoletableRootClasses = array(); - foreach(get_declared_classes() as $sPHPClass) - { - if (is_subclass_of($sPHPClass, 'DBObject')) - { + $aObsoletableRootClasses = []; + foreach (get_declared_classes() as $sPHPClass) { + if (is_subclass_of($sPHPClass, 'DBObject')) { $sParent = self::GetParentPersistentClass($sPHPClass); - if (array_key_exists($sParent, self::$m_aIgnoredAttributes)) - { + if (array_key_exists($sParent, self::$m_aIgnoredAttributes)) { // Inherit info about attributes to ignore self::$m_aIgnoredAttributes[$sPHPClass] = self::$m_aIgnoredAttributes[$sParent]; } - try - { + try { $oMethod = new ReflectionMethod($sPHPClass, 'Init'); - if ($oMethod->getDeclaringClass()->name == $sPHPClass) - { - call_user_func(array($sPHPClass, 'Init')); + if ($oMethod->getDeclaringClass()->name == $sPHPClass) { + call_user_func([$sPHPClass, 'Init']); // Inherit archive flag $bParentArchivable = isset(self::$m_aClassParams[$sParent]['archive']) ? self::$m_aClassParams[$sParent]['archive'] : false; $bArchivable = isset(self::$m_aClassParams[$sPHPClass]['archive']) ? self::$m_aClassParams[$sPHPClass]['archive'] : null; - if (!$bParentArchivable && $bArchivable && !self::IsRootClass($sPHPClass)) - { + if (!$bParentArchivable && $bArchivable && !self::IsRootClass($sPHPClass)) { throw new Exception("Archivability must be declared on top of the class hierarchy above $sPHPClass (consistency throughout the whole class tree is a must)"); } - if ($bParentArchivable && ($bArchivable === false)) - { + if ($bParentArchivable && ($bArchivable === false)) { throw new Exception("$sPHPClass must be archivable (consistency throughout the whole class tree is a must)"); } $bReallyArchivable = $bParentArchivable || $bArchivable; self::$m_aClassParams[$sPHPClass]['archive'] = $bReallyArchivable; $bArchiveRoot = $bReallyArchivable && !$bParentArchivable; self::$m_aClassParams[$sPHPClass]['archive_root'] = $bArchiveRoot; - if ($bReallyArchivable) - { + if ($bReallyArchivable) { self::$m_aClassParams[$sPHPClass]['archive_root_class'] = $bArchiveRoot ? $sPHPClass : self::$m_aClassParams[$sParent]['archive_root_class']; } // Inherit obsolescence expression $sObsolescence = null; - if (isset(self::$m_aClassParams[$sPHPClass]['obsolescence_expression'])) - { + if (isset(self::$m_aClassParams[$sPHPClass]['obsolescence_expression'])) { // Defined or overloaded $sObsolescence = self::$m_aClassParams[$sPHPClass]['obsolescence_expression']; $aObsoletableRootClasses[self::$m_aRootClasses[$sPHPClass]] = true; - } - elseif (isset(self::$m_aClassParams[$sParent]['obsolescence_expression'])) - { + } elseif (isset(self::$m_aClassParams[$sParent]['obsolescence_expression'])) { // Inherited $sObsolescence = self::$m_aClassParams[$sParent]['obsolescence_expression']; } @@ -2992,7 +2866,7 @@ abstract class MetaModel // - State attribute $bParentHasStateAttribute = (isset(self::$m_aClassParams[$sParent]['state_attcode']) && !empty(self::$m_aClassParams[$sParent]['state_attcode'])); $bHasStateAttribute = (isset(self::$m_aClassParams[$sPHPClass]['state_attcode']) && !empty(self::$m_aClassParams[$sPHPClass]['state_attcode'])); - if($bParentHasStateAttribute && !$bHasStateAttribute) { + if ($bParentHasStateAttribute && !$bHasStateAttribute) { // Set attribute code self::$m_aClassParams[$sPHPClass]['state_attcode'] = self::$m_aClassParams[$sParent]['state_attcode']; @@ -3001,43 +2875,34 @@ abstract class MetaModel // - Image attribute $bParentHasImageAttribute = (isset(self::$m_aClassParams[$sParent]['image_attcode']) && !empty(self::$m_aClassParams[$sParent]['image_attcode'])); $bHasImageAttribute = (isset(self::$m_aClassParams[$sPHPClass]['image_attcode']) && !empty(self::$m_aClassParams[$sPHPClass]['image_attcode'])); - if($bParentHasImageAttribute && !$bHasImageAttribute) { + if ($bParentHasImageAttribute && !$bHasImageAttribute) { // Set attribute code self::$m_aClassParams[$sPHPClass]['image_attcode'] = self::$m_aClassParams[$sParent]['image_attcode']; } - foreach(MetaModel::EnumPlugins('iOnClassInitialization') as $sPluginClass => $oClassInit) - { + foreach (MetaModel::EnumPlugins('iOnClassInitialization') as $sPluginClass => $oClassInit) { $oClassInit->OnAfterClassInitialization($sPHPClass); } } $aCurrentClassUniquenessRules = MetaModel::GetUniquenessRules($sPHPClass, true); - if (!empty($aCurrentClassUniquenessRules)) - { + if (!empty($aCurrentClassUniquenessRules)) { $aClassFields = self::GetAttributesList($sPHPClass); - foreach ($aCurrentClassUniquenessRules as $sUniquenessRuleId => $aUniquenessRuleProperties) - { + foreach ($aCurrentClassUniquenessRules as $sUniquenessRuleId => $aUniquenessRuleProperties) { $bIsRuleOverride = self::HasSameUniquenessRuleInParent($sPHPClass, $sUniquenessRuleId); - try - { + try { self::CheckUniquenessRuleValidity($aUniquenessRuleProperties, $bIsRuleOverride, $aClassFields); - } - catch (CoreUnexpectedValue $e) - { + } catch (CoreUnexpectedValue $e) { throw new Exception("Invalid uniqueness rule declaration : class={$sPHPClass}, rule=$sUniquenessRuleId, reason={$e->getMessage()}"); } - if (!$bIsRuleOverride) - { + if (!$bIsRuleOverride) { self::SetUniquenessRuleRootClass($sPHPClass, $sUniquenessRuleId); } } } - } - catch (ReflectionException $e) - { + } catch (ReflectionException $e) { // This class is only implementing methods, ignore it from the MetaModel perspective } } @@ -3045,25 +2910,22 @@ abstract class MetaModel // Add a 'class' attribute/filter to the root classes and their children // - foreach(self::EnumRootClasses() as $sRootClass) - { - if (self::IsStandaloneClass($sRootClass)) - { + foreach (self::EnumRootClasses() as $sRootClass) { + if (self::IsStandaloneClass($sRootClass)) { continue; } $sDbFinalClassField = self::DBGetClassField($sRootClass); - if (strlen($sDbFinalClassField) == 0) - { + if (strlen($sDbFinalClassField) == 0) { $sDbFinalClassField = 'finalclass'; self::$m_aClassParams[$sRootClass]["db_finalclass_field"] = 'finalclass'; } - $oClassAtt = new AttributeFinalClass('finalclass', array( + $oClassAtt = new AttributeFinalClass('finalclass', [ "sql" => $sDbFinalClassField, "default_value" => $sRootClass, "is_null_allowed" => false, - "depends_on" => array(), - )); + "depends_on" => [], + ]); self::AddMagicAttribute($oClassAtt, $sRootClass); $bObsoletable = array_key_exists($sRootClass, $aObsoletableRootClasses); @@ -3071,7 +2933,6 @@ abstract class MetaModel self::$m_aClassParams[$sRootClass]['obsolescence_expression'] = '0'; } - foreach (self::EnumChildClasses($sRootClass, ENUM_CHILD_CLASSES_EXCLUDETOP) as $sChildClass) { if (array_key_exists('finalclass', self::$m_aAttribDefs[$sChildClass])) { throw new CoreException("Class $sChildClass, 'finalclass' is a reserved keyword, it cannot be used as an attribute code"); @@ -3103,7 +2964,7 @@ abstract class MetaModel $oArchiveFlag = new AttributeArchiveFlag('archive_flag'); self::AddMagicAttribute($oArchiveFlag, $sClass); - $oArchiveDate = new AttributeArchiveDate('archive_date', array('magic' => true, "allowed_values" => null, "sql" => 'archive_date', "default_value" => '', "is_null_allowed" => true, "depends_on" => array())); + $oArchiveDate = new AttributeArchiveDate('archive_date', ['magic' => true, "allowed_values" => null, "sql" => 'archive_date', "default_value" => '', "is_null_allowed" => true, "depends_on" => []]); self::AddMagicAttribute($oArchiveDate, $sClass); } elseif (self::$m_aClassParams[$sClass]["archive"]) { $sArchiveRoot = self::$m_aClassParams[$sClass]['archive_root_class']; @@ -3124,7 +2985,7 @@ abstract class MetaModel self::AddMagicAttribute($oObsolescenceFlag, $sClass); if (self::$m_aRootClasses[$sClass] == $sClass) { - $oObsolescenceDate = new AttributeObsolescenceDate('obsolescence_date', array('magic' => true, "allowed_values" => null, "sql" => 'obsolescence_date', "default_value" => '', "is_null_allowed" => true, "depends_on" => array())); + $oObsolescenceDate = new AttributeObsolescenceDate('obsolescence_date', ['magic' => true, "allowed_values" => null, "sql" => 'obsolescence_date', "default_value" => '', "is_null_allowed" => true, "depends_on" => []]); self::AddMagicAttribute($oObsolescenceDate, $sClass); } else { $oObsolescenceDate = clone self::$m_aAttribDefs[$sRootClass]['obsolescence_date']; @@ -3161,41 +3022,37 @@ abstract class MetaModel $sKeyAttCode = $oAttDef->GetKeyAttCode(); $sRemoteAttCode = $oAttDef->GetExtAttCode()."_friendlyname"; $sFriendlyNameAttCode = $sAttCode.'_friendlyname'; - $oFriendlyName = new AttributeExternalField($sFriendlyNameAttCode, array("allowed_values" => null, "extkey_attcode" => $sKeyAttCode, "target_attcode" => $sRemoteAttCode, "depends_on" => array())); + $oFriendlyName = new AttributeExternalField($sFriendlyNameAttCode, ["allowed_values" => null, "extkey_attcode" => $sKeyAttCode, "target_attcode" => $sRemoteAttCode, "depends_on" => []]); self::AddMagicAttribute($oFriendlyName, $sClass, self::$m_aAttribOrigins[$sClass][$sKeyAttCode]); } else { // Create the friendly name attribute $sFriendlyNameAttCode = $sAttCode.'_friendlyname'; - $oFriendlyName = new AttributeExternalField($sFriendlyNameAttCode, array('allowed_values' => null, 'extkey_attcode' => $sAttCode, "target_attcode" => 'friendlyname', 'depends_on' => array())); + $oFriendlyName = new AttributeExternalField($sFriendlyNameAttCode, ['allowed_values' => null, 'extkey_attcode' => $sAttCode, "target_attcode" => 'friendlyname', 'depends_on' => []]); self::AddMagicAttribute($oFriendlyName, $sClass, self::$m_aAttribOrigins[$sClass][$sAttCode]); if (self::HasChildrenClasses($sRemoteClass)) { // First, create an external field attribute, that gets the final class $sClassRecallAttCode = $sAttCode.'_finalclass_recall'; - $oClassRecall = new AttributeExternalField($sClassRecallAttCode, array( + $oClassRecall = new AttributeExternalField($sClassRecallAttCode, [ "allowed_values" => null, "extkey_attcode" => $sAttCode, "target_attcode" => "finalclass", "is_null_allowed" => true, - "depends_on" => array(), - )); + "depends_on" => [], + ]); self::AddMagicAttribute($oClassRecall, $sClass, self::$m_aAttribOrigins[$sClass][$sAttCode]); // Add it to the ZLists where the external key is present //foreach(self::$m_aListData[$sClass] as $sListCode => $aAttributes) $sListCode = 'list'; - if (isset(self::$m_aListData[$sClass][$sListCode])) - { + if (isset(self::$m_aListData[$sClass][$sListCode])) { $aAttributes = self::$m_aListData[$sClass][$sListCode]; // temporary.... no loop { - if (in_array($sAttCode, $aAttributes)) - { - $aNewList = array(); - foreach($aAttributes as $iPos => $sAttToDisplay) - { - if (is_string($sAttToDisplay) && ($sAttToDisplay == $sAttCode)) - { + if (in_array($sAttCode, $aAttributes)) { + $aNewList = []; + foreach ($aAttributes as $iPos => $sAttToDisplay) { + if (is_string($sAttToDisplay) && ($sAttToDisplay == $sAttCode)) { // Insert the final class right before $aNewList[] = $sClassRecallAttCode; } @@ -3219,7 +3076,7 @@ abstract class MetaModel $sKeyAttCode = $sAttCode; $sRemoteAttCode = 'archive_flag'; } - $oMagic = new AttributeExternalField($sCode, array("allowed_values" => null, "extkey_attcode" => $sKeyAttCode, "target_attcode" => $sRemoteAttCode, "depends_on" => array())); + $oMagic = new AttributeExternalField($sCode, ["allowed_values" => null, "extkey_attcode" => $sKeyAttCode, "target_attcode" => $sRemoteAttCode, "depends_on" => []]); self::AddMagicAttribute($oMagic, $sClass, self::$m_aAttribOrigins[$sClass][$sKeyAttCode]); } @@ -3234,7 +3091,7 @@ abstract class MetaModel $sKeyAttCode = $sAttCode; $sRemoteAttCode = 'obsolescence_flag'; } - $oMagic = new AttributeExternalField($sCode, array("allowed_values" => null, "extkey_attcode" => $sKeyAttCode, "target_attcode" => $sRemoteAttCode, "depends_on" => array())); + $oMagic = new AttributeExternalField($sCode, ["allowed_values" => null, "extkey_attcode" => $sKeyAttCode, "target_attcode" => $sRemoteAttCode, "depends_on" => []]); self::AddMagicAttribute($oMagic, $sClass, self::$m_aAttribOrigins[$sClass][$sKeyAttCode]); } } @@ -3266,14 +3123,12 @@ abstract class MetaModel private static function HasSameUniquenessRuleInParent($sClassName, $sUniquenessRuleId) { $sParentClass = self::GetParentClass($sClassName); - if (empty($sParentClass)) - { + if (empty($sParentClass)) { return false; } $aParentClassUniquenessRules = self::GetUniquenessRules($sParentClass); - if (array_key_exists($sUniquenessRuleId, $aParentClassUniquenessRules)) - { + if (array_key_exists($sUniquenessRuleId, $aParentClassUniquenessRules)) { return true; } @@ -3291,9 +3146,9 @@ abstract class MetaModel * @since 2.6.0 N°659 uniqueness constraint * @since 2.6.1 N°1968 (joli mois de mai...) disallow overrides of 'attributes' properties */ - public static function CheckUniquenessRuleValidity($aUniquenessRuleProperties, $bRuleOverride = true, $aExistingClassFields = array()) + public static function CheckUniquenessRuleValidity($aUniquenessRuleProperties, $bRuleOverride = true, $aExistingClassFields = []) { - $MANDATORY_ATTRIBUTES = array('attributes'); + $MANDATORY_ATTRIBUTES = ['attributes']; $UNIQUENESS_MANDATORY_KEYS_NB = count($MANDATORY_ATTRIBUTES); $bHasMissingMandatoryKey = true; @@ -3302,18 +3157,14 @@ abstract class MetaModel $bHasNonDisabledKeys = false; $bDisabledKeyValue = null; - foreach ($aUniquenessRuleProperties as $sUniquenessRuleKey => $aUniquenessRuleProperty) - { - if ($sUniquenessRuleKey === 'disabled') - { + foreach ($aUniquenessRuleProperties as $sUniquenessRuleKey => $aUniquenessRuleProperty) { + if ($sUniquenessRuleKey === 'disabled') { $bDisabledKeyValue = $aUniquenessRuleProperty; - if (!is_null($aUniquenessRuleProperty)) - { + if (!is_null($aUniquenessRuleProperty)) { continue; } } - if (is_null($aUniquenessRuleProperty)) - { + if (is_null($aUniquenessRuleProperty)) { continue; } @@ -3323,14 +3174,10 @@ abstract class MetaModel $iMissingMandatoryKeysNb--; } - if ($sUniquenessRuleKey === 'attributes') - { - if (!empty($aExistingClassFields)) - { - foreach ($aUniquenessRuleProperties[$sUniquenessRuleKey] as $sRuleAttribute) - { - if (!in_array($sRuleAttribute, $aExistingClassFields, true)) - { + if ($sUniquenessRuleKey === 'attributes') { + if (!empty($aExistingClassFields)) { + foreach ($aUniquenessRuleProperties[$sUniquenessRuleKey] as $sRuleAttribute) { + if (!in_array($sRuleAttribute, $aExistingClassFields, true)) { throw new CoreUnexpectedValue("Uniqueness rule : non existing field '$sRuleAttribute'"); } } @@ -3338,21 +3185,17 @@ abstract class MetaModel } } - if ($iMissingMandatoryKeysNb === 0) - { + if ($iMissingMandatoryKeysNb === 0) { $bHasMissingMandatoryKey = false; } - if ($bRuleOverride && $bHasNonDisabledKeys) - { + if ($bRuleOverride && $bHasNonDisabledKeys) { throw new CoreUnexpectedValue('Uniqueness rule : only the \'disabled\' key can be overridden'); } - if ($bRuleOverride && is_null($bDisabledKeyValue)) - { + if ($bRuleOverride && is_null($bDisabledKeyValue)) { throw new CoreUnexpectedValue('Uniqueness rule : when overriding a rule, value must be set for the \'disabled\' key'); } - if (!$bRuleOverride && $bHasMissingMandatoryKey) - { + if (!$bRuleOverride && $bHasMissingMandatoryKey) { throw new CoreUnexpectedValue('Uniqueness rule : missing mandatory property'); } } @@ -3365,7 +3208,6 @@ abstract class MetaModel // In fact it is an ABSTRACT function, but this is not compatible with the fact that it is STATIC (error in E_STRICT interpretation) } - /** * @param array $aParams * @@ -3375,7 +3217,7 @@ abstract class MetaModel { // Check mandatory params // Warning: Do not put image_attcode as a mandatory attribute or it will break all PHP datamodel classes - $aMandatParams = array( + $aMandatParams = [ "category" => "group classes by modules defining their visibility in the UI", "key_type" => "autoincrement | string", "name_attcode" => "define which attribute is the class name, may be an array of attributes (format specified in the dictionary as 'Class:myclass/Name' => '%1\$s %2\$s...'", @@ -3384,35 +3226,31 @@ abstract class MetaModel "db_table" => "database table", "db_key_field" => "database field which is the key", "db_finalclass_field" => "database field wich is the reference to the actual class of the object, considering that this will be a compound class", - ); + ]; $sClass = self::GetCallersPHPClass("Init", self::$m_bTraceSourceFiles); - foreach($aMandatParams as $sParamName => $sParamDesc) - { - if (!array_key_exists($sParamName, $aParams)) - { + foreach ($aMandatParams as $sParamName => $sParamDesc) { + if (!array_key_exists($sParamName, $aParams)) { throw new CoreException("Declaration of class $sClass - missing parameter $sParamName"); } } $aCategories = explode(',', $aParams['category']); - foreach($aCategories as $sCategory) - { + foreach ($aCategories as $sCategory) { self::$m_Category2Class[$sCategory][] = $sClass; } self::$m_Category2Class[''][] = $sClass; // all categories, include this one - self::$m_aRootClasses[$sClass] = $sClass; // first, let consider that I am the root... updated on inheritance - self::$m_aParentClasses[$sClass] = array(); - self::$m_aChildClasses[$sClass] = array(); + self::$m_aParentClasses[$sClass] = []; + self::$m_aChildClasses[$sClass] = []; self::$m_aClassParams[$sClass] = $aParams; - self::$m_aAttribDefs[$sClass] = array(); - self::$m_aAttribOrigins[$sClass] = array(); - self::$m_aFilterAttribList[$sClass] = array(); + self::$m_aAttribDefs[$sClass] = []; + self::$m_aAttribOrigins[$sClass] = []; + self::$m_aFilterAttribList[$sClass] = []; } /** @@ -3423,13 +3261,11 @@ abstract class MetaModel */ protected static function object_array_mergeclone($aSource1, $aSource2) { - $aRes = array(); - foreach($aSource1 as $key => $object) - { + $aRes = []; + foreach ($aSource1 as $key => $object) { $aRes[$key] = clone $object; } - foreach($aSource2 as $key => $object) - { + foreach ($aSource2 as $key => $object) { $aRes[$key] = clone $object; } @@ -3451,8 +3287,8 @@ abstract class MetaModel } if (isset(self::$m_aAttribDefs[$sSourceClass])) { if (!isset(self::$m_aAttribDefs[$sTargetClass])) { - self::$m_aAttribDefs[$sTargetClass] = array(); - self::$m_aAttribOrigins[$sTargetClass] = array(); + self::$m_aAttribDefs[$sTargetClass] = []; + self::$m_aAttribOrigins[$sTargetClass] = []; } self::$m_aAttribDefs[$sTargetClass] = self::object_array_mergeclone(self::$m_aAttribDefs[$sTargetClass], self::$m_aAttribDefs[$sSourceClass]); foreach (self::$m_aAttribDefs[$sTargetClass] as $sAttCode => $oAttDef) { @@ -3461,13 +3297,10 @@ abstract class MetaModel self::$m_aAttribOrigins[$sTargetClass] = array_merge(self::$m_aAttribOrigins[$sTargetClass], self::$m_aAttribOrigins[$sSourceClass]); } // Build root class information - if (array_key_exists($sSourceClass, self::$m_aRootClasses)) - { + if (array_key_exists($sSourceClass, self::$m_aRootClasses)) { // Inherit... self::$m_aRootClasses[$sTargetClass] = self::$m_aRootClasses[$sSourceClass]; - } - else - { + } else { // This class will be the root class self::$m_aRootClasses[$sSourceClass] = $sSourceClass; self::$m_aRootClasses[$sTargetClass] = $sSourceClass; @@ -3475,8 +3308,7 @@ abstract class MetaModel self::$m_aParentClasses[$sTargetClass] += self::$m_aParentClasses[$sSourceClass]; self::$m_aParentClasses[$sTargetClass][] = $sSourceClass; // I am the child of each and every parent... - foreach(self::$m_aParentClasses[$sTargetClass] as $sAncestorClass) - { + foreach (self::$m_aParentClasses[$sTargetClass] as $sAncestorClass) { self::$m_aChildClasses[$sAncestorClass][] = $sTargetClass; } } @@ -3490,12 +3322,10 @@ abstract class MetaModel { // Differs from self::IsValidClass() // because it is being called before all the classes have been initialized - if (!class_exists($sClass)) - { + if (!class_exists($sClass)) { return false; } - if (!is_subclass_of($sClass, 'DBObject')) - { + if (!is_subclass_of($sClass, 'DBObject')) { return false; } @@ -3533,29 +3363,21 @@ abstract class MetaModel // declared in a module which is currently not installed/active // We simply discard those attributes // - if ($oAtt->IsLinkSet()) - { + if ($oAtt->IsLinkSet()) { $sRemoteClass = $oAtt->GetLinkedClass(); - if (!self::Init_IsKnownClass($sRemoteClass)) - { + if (!self::Init_IsKnownClass($sRemoteClass)) { self::$m_aIgnoredAttributes[$sTargetClass][$oAtt->GetCode()] = $sRemoteClass; return; } - } - elseif ($oAtt->IsExternalKey()) - { + } elseif ($oAtt->IsExternalKey()) { $sRemoteClass = $oAtt->GetTargetClass(); - if (!self::Init_IsKnownClass($sRemoteClass)) - { + if (!self::Init_IsKnownClass($sRemoteClass)) { self::$m_aIgnoredAttributes[$sTargetClass][$oAtt->GetCode()] = $sRemoteClass; return; } - } - elseif ($oAtt->IsExternalField()) - { + } elseif ($oAtt->IsExternalField()) { $sExtKeyAttCode = $oAtt->GetKeyAttCode(); - if (isset(self::$m_aIgnoredAttributes[$sTargetClass][$sExtKeyAttCode])) - { + if (isset(self::$m_aIgnoredAttributes[$sTargetClass][$sExtKeyAttCode])) { // The corresponding external key has already been ignored self::$m_aIgnoredAttributes[$sTargetClass][$oAtt->GetCode()] = self::$m_aIgnoredAttributes[$sTargetClass][$sExtKeyAttCode]; @@ -3597,22 +3419,16 @@ abstract class MetaModel */ protected static function Init_CheckZListItems(&$aItems, $sTargetClass) { - foreach($aItems as $iFoo => $attCode) - { - if (is_array($attCode)) - { + foreach ($aItems as $iFoo => $attCode) { + if (is_array($attCode)) { // Note: to make sure that the values will be updated recursively, // do not pass $attCode, but $aItems[$iFoo] instead self::Init_CheckZListItems($aItems[$iFoo], $sTargetClass); - if (count($aItems[$iFoo]) == 0) - { + if (count($aItems[$iFoo]) == 0) { unset($aItems[$iFoo]); } - } - else - { - if (isset(self::$m_aIgnoredAttributes[$sTargetClass][$attCode])) - { + } else { + if (isset(self::$m_aIgnoredAttributes[$sTargetClass][$attCode])) { unset($aItems[$iFoo]); } } @@ -3626,15 +3442,11 @@ abstract class MetaModel */ public static function FlattenZList($aList) { - $aResult = array(); - foreach($aList as $value) - { - if (!is_array($value)) - { + $aResult = []; + foreach ($aList as $value) { + if (!is_array($value)) { $aResult[] = $value; - } - else - { + } else { $aResult = array_merge($aResult, self::FlattenZList($value)); } } @@ -3649,22 +3461,19 @@ abstract class MetaModel public static function Init_DefineState($sStateCode, $aStateDef) { $sTargetClass = self::GetCallersPHPClass("Init"); - if (is_null($aStateDef['attribute_list'])) - { - $aStateDef['attribute_list'] = array(); + if (is_null($aStateDef['attribute_list'])) { + $aStateDef['attribute_list'] = []; } $sParentState = $aStateDef['attribute_inherit']; - if (!empty($sParentState)) - { + if (!empty($sParentState)) { // Inherit from the given state (must be defined !) // $aToInherit = self::$m_aStates[$sTargetClass][$sParentState]; // Reset the constraint when it was mandatory to set the value at the previous state // - foreach($aToInherit['attribute_list'] as $sState => $iFlags) - { + foreach ($aToInherit['attribute_list'] as $sState => $iFlags) { $iFlags = $iFlags & ~OPT_ATT_MUSTPROMPT; $iFlags = $iFlags & ~OPT_ATT_MUSTCHANGE; $aToInherit['attribute_list'][$sState] = $iFlags; @@ -3674,10 +3483,8 @@ abstract class MetaModel $aStateDef['attribute_list'] = array_merge($aToInherit['attribute_list'], $aStateDef['attribute_list']); } - foreach($aStateDef['attribute_list'] as $sAttCode => $iFlags) - { - if (isset(self::$m_aIgnoredAttributes[$sTargetClass][$sAttCode])) - { + foreach ($aStateDef['attribute_list'] as $sAttCode => $iFlags) { + if (isset(self::$m_aIgnoredAttributes[$sTargetClass][$sAttCode])) { unset($aStateDef['attribute_list'][$sAttCode]); } } @@ -3685,7 +3492,7 @@ abstract class MetaModel self::$m_aStates[$sTargetClass][$sStateCode] = $aStateDef; // by default, create an empty set of transitions associated to that state - self::$m_aTransitions[$sTargetClass][$sStateCode] = array(); + self::$m_aTransitions[$sTargetClass][$sStateCode] = []; } /** @@ -3725,16 +3532,14 @@ abstract class MetaModel */ public static function GetHighlightScale($sTargetClass) { - $aScale = array(); - $aParentScale = array(); + $aScale = []; + $aParentScale = []; $sParentClass = self::GetParentPersistentClass($sTargetClass); - if (!empty($sParentClass)) - { + if (!empty($sParentClass)) { // inherit the scale from the parent class $aParentScale = self::GetHighlightScale($sParentClass); } - if (array_key_exists($sTargetClass, self::$m_aHighlightScales)) - { + if (array_key_exists($sTargetClass, self::$m_aHighlightScales)) { $aScale = self::$m_aHighlightScales[$sTargetClass]; } return array_merge($aParentScale, $aScale); // Merge both arrays, the values from the last one have precedence @@ -3751,16 +3556,12 @@ abstract class MetaModel $sCode = ''; if (array_key_exists($sTargetClass, self::$m_aStates) && array_key_exists($sStateCode, self::$m_aStates[$sTargetClass]) - && array_key_exists('highlight', self::$m_aStates[$sTargetClass][$sStateCode])) - { + && array_key_exists('highlight', self::$m_aStates[$sTargetClass][$sStateCode])) { $sCode = self::$m_aStates[$sTargetClass][$sStateCode]['highlight']['code']; - } - else - { + } else { // Check the parent's definition $sParentClass = self::GetParentPersistentClass($sTargetClass); - if (!empty($sParentClass)) - { + if (!empty($sParentClass)) { $sCode = self::GetHighlightCode($sParentClass, $sStateCode); } } @@ -3801,9 +3602,8 @@ abstract class MetaModel public static function Init_DefineTransition($sStateCode, $sStimulusCode, $aTransitionDef) { $sTargetClass = self::GetCallersPHPClass("Init"); - if (is_null($aTransitionDef['actions'])) - { - $aTransitionDef['actions'] = array(); + if (is_null($aTransitionDef['actions'])) { + $aTransitionDef['actions'] = []; } self::$m_aTransitions[$sTargetClass][$sStateCode][$sStimulusCode] = $aTransitionDef; } @@ -3814,12 +3614,10 @@ abstract class MetaModel public static function Init_InheritLifecycle($sSourceClass = '') { $sTargetClass = self::GetCallersPHPClass("Init"); - if (empty($sSourceClass)) - { + if (empty($sSourceClass)) { // Default: inherit from parent class $sSourceClass = self::GetParentPersistentClass($sTargetClass); - if (empty($sSourceClass)) - { + if (empty($sSourceClass)) { return; } // no attributes for the mother of all classes } @@ -3866,12 +3664,9 @@ abstract class MetaModel */ public static function GetParentClass($sClass) { - if (count(self::$m_aParentClasses[$sClass]) == 0) - { + if (count(self::$m_aParentClasses[$sClass]) == 0) { return null; - } - else - { + } else { return end(self::$m_aParentClasses[$sClass]); } } @@ -3885,24 +3680,16 @@ abstract class MetaModel public static function GetLowestCommonAncestor($aClasses) { $sAncestor = null; - foreach($aClasses as $sClass) - { - if (is_null($sAncestor)) - { + foreach ($aClasses as $sClass) { + if (is_null($sAncestor)) { // first loop $sAncestor = $sClass; - } - elseif ($sClass == $sAncestor) - { + } elseif ($sClass == $sAncestor) { // remains the same - } - elseif (self::GetRootClass($sClass) != self::GetRootClass($sAncestor)) - { + } elseif (self::GetRootClass($sClass) != self::GetRootClass($sAncestor)) { $sAncestor = null; break; - } - else - { + } else { $sAncestor = self::LowestCommonAncestor($sAncestor, $sClass); } } @@ -3919,20 +3706,13 @@ abstract class MetaModel */ protected static function LowestCommonAncestor($sClassA, $sClassB) { - if ($sClassA == $sClassB) - { + if ($sClassA == $sClassB) { $sRet = $sClassA; - } - elseif (is_subclass_of($sClassA, $sClassB)) - { + } elseif (is_subclass_of($sClassA, $sClassB)) { $sRet = $sClassB; - } - elseif (is_subclass_of($sClassB, $sClassA)) - { + } elseif (is_subclass_of($sClassB, $sClassA)) { $sRet = $sClassA; - } - else - { + } else { // Recurse $sRet = self::LowestCommonAncestor($sClassA, self::GetParentClass($sClassB)); } @@ -3950,10 +3730,8 @@ abstract class MetaModel public static function IsHierarchicalClass($sClass) { $sHierarchicalKeyCode = false; - foreach(self::ListAttributeDefs($sClass) as $sAttCode => $oAtt) - { - if ($oAtt->IsHierarchicalKey()) - { + foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAtt) { + if ($oAtt->IsHierarchicalKey()) { $sHierarchicalKeyCode = $sAttCode; // Found the hierarchical key, no need to continue break; } @@ -3980,23 +3758,16 @@ abstract class MetaModel public static function EnumParentClasses($sClass, $iOption = ENUM_PARENT_CLASSES_EXCLUDELEAF, $bRootFirst = true) { self::_check_subclass($sClass); - if ($bRootFirst) - { + if ($bRootFirst) { $aRes = self::$m_aParentClasses[$sClass]; - } - else - { + } else { $aRes = array_reverse(self::$m_aParentClasses[$sClass], true); } - if ($iOption != ENUM_PARENT_CLASSES_EXCLUDELEAF) - { - if ($bRootFirst) - { + if ($iOption != ENUM_PARENT_CLASSES_EXCLUDELEAF) { + if ($bRootFirst) { // Leaf class at the end $aRes[] = $sClass; - } - else - { + } else { // Leaf class on top array_unshift($aRes, $sClass); } @@ -4019,8 +3790,7 @@ abstract class MetaModel self::_check_subclass($sClass); $aRes = self::$m_aChildClasses[$sClass]; - if ($iOption != ENUM_CHILD_CLASSES_EXCLUDETOP) - { + if ($iOption != ENUM_CHILD_CLASSES_EXCLUDETOP) { if ($bRootFirst) { // Root class on top array_unshift($aRes, $sClass); @@ -4039,11 +3809,9 @@ abstract class MetaModel */ public static function EnumArchivableClasses() { - $aRes = array(); - foreach(self::GetClasses() as $sClass) - { - if (self::IsArchivable($sClass)) - { + $aRes = []; + foreach (self::GetClasses() as $sClass) { + if (self::IsArchivable($sClass)) { $aRes[] = $sClass; } } @@ -4059,13 +3827,10 @@ abstract class MetaModel */ public static function EnumObsoletableClasses($bRootClassesOnly = true) { - $aRes = array(); - foreach(self::GetClasses() as $sClass) - { - if (self::IsObsoletable($sClass)) - { - if ($bRootClassesOnly && !static::IsRootClass($sClass)) - { + $aRes = []; + foreach (self::GetClasses() as $sClass) { + if (self::IsObsoletable($sClass)) { + if ($bRootClassesOnly && !static::IsRootClass($sClass)) { continue; } $aRes[] = $sClass; @@ -4103,11 +3868,9 @@ abstract class MetaModel public static function GetSubclasses($sClass) { self::_check_subclass($sClass); - $aSubClasses = array(); - foreach(self::$m_aClassParams as $sSubClass => $foo) - { - if (is_subclass_of($sSubClass, $sClass)) - { + $aSubClasses = []; + foreach (self::$m_aClassParams as $sSubClass => $foo) { + if (is_subclass_of($sSubClass, $sClass)) { $aSubClasses[] = $sSubClass; } } @@ -4125,21 +3888,16 @@ abstract class MetaModel public static function GetClasses($sCategories = '', $bStrict = false) { $aCategories = explode(',', $sCategories); - $aClasses = array(); - foreach($aCategories as $sCategory) - { + $aClasses = []; + foreach ($aCategories as $sCategory) { $sCategory = trim($sCategory); - if (strlen($sCategory) == 0) - { + if (strlen($sCategory) == 0) { return array_keys(self::$m_aClassParams); } - if (array_key_exists($sCategory, self::$m_Category2Class)) - { + if (array_key_exists($sCategory, self::$m_Category2Class)) { $aClasses = array_merge($aClasses, self::$m_Category2Class[$sCategory]); - } - elseif ($bStrict) - { + } elseif ($bStrict) { throw new CoreException("unkown class category '$sCategory', expecting a value in {".implode(', ', array_keys(self::$m_Category2Class))."}"); } } @@ -4155,8 +3913,7 @@ abstract class MetaModel */ public static function HasTable($sClass) { - if (strlen(self::DBGetTable($sClass)) == 0) - { + if (strlen(self::DBGetTable($sClass)) == 0) { return false; } return true; @@ -4185,13 +3942,11 @@ abstract class MetaModel * * @return array */ - public static function PrepareQueryArguments($aArgs, $aMoreArgs = array(), $aExpectedArgs = null) + public static function PrepareQueryArguments($aArgs, $aMoreArgs = [], $aExpectedArgs = null) { - $aScalarArgs = array(); - if (is_null($aExpectedArgs) || count($aExpectedArgs) > 0 || count($aMoreArgs)>0) - { - foreach (array_merge($aArgs, $aMoreArgs) as $sArgName => $value) - { + $aScalarArgs = []; + if (is_null($aExpectedArgs) || count($aExpectedArgs) > 0 || count($aMoreArgs) > 0) { + foreach (array_merge($aArgs, $aMoreArgs) as $sArgName => $value) { if (self::IsValidObject($value)) { if (strpos($sArgName, '->object()') === false) { // Normalize object arguments @@ -4211,10 +3966,8 @@ abstract class MetaModel } } return static::AddMagicPlaceholders($aScalarArgs, $aExpectedArgs); - } - else - { - return array(); + } else { + return []; } } @@ -4227,33 +3980,27 @@ abstract class MetaModel { // Add standard magic arguments // - if (is_null($aExpectedArgs)) - { + if (is_null($aExpectedArgs)) { $aPlaceholders['current_contact_id'] = UserRights::GetContactId(); // legacy $oUser = UserRights::GetUserObject(); - if (!is_null($oUser)) - { + if (!is_null($oUser)) { $aPlaceholders['current_user->object()'] = $oUser; $oContact = UserRights::GetContactObject(); - if (!is_null($oContact)) - { + if (!is_null($oContact)) { $aPlaceholders['current_contact->object()'] = $oContact; } } - } - else - { + } else { $aCurrentUser = []; $aCurrentContact = []; - foreach ($aExpectedArgs as $expression) - { + foreach ($aExpectedArgs as $expression) { $aName = explode('->', $expression->GetName()); if ($aName[0] == 'current_contact_id') { $aPlaceholders['current_contact_id'] = UserRights::GetContactId(); - } else if ($aName[0] == 'current_user') { + } elseif ($aName[0] == 'current_user') { array_push($aCurrentUser, $aName[1]); - } else if ($aName[0] == 'current_contact') { + } elseif ($aName[0] == 'current_contact') { array_push($aCurrentContact, $aName[1]); } } @@ -4278,35 +4025,42 @@ abstract class MetaModel * @return void * */ - private static function FillObjectPlaceholders(array &$aPlaceholders, string $sPlaceHolderPrefix, ?\DBObject $oObject, array $aCurrentUser) : void { + private static function FillObjectPlaceholders(array &$aPlaceholders, string $sPlaceHolderPrefix, ?\DBObject $oObject, array $aCurrentUser): void + { $sPlaceHolderKey = $sPlaceHolderPrefix."->object()"; - if (is_null($oObject)){ + if (is_null($oObject)) { $aContext = [ "current_user_id" => UserRights::GetUserId(), "null object type" => $sPlaceHolderPrefix, "fields" => $aCurrentUser, ]; - IssueLog::Warning("Unresolved placeholders due to null object in current context", null, - $aContext); + IssueLog::Warning( + "Unresolved placeholders due to null object in current context", + null, + $aContext + ); $aPlaceholders[$sPlaceHolderKey] = Dict::Format("Core:Placeholder:CannotBeResolved", $sPlaceHolderKey); foreach ($aCurrentUser as $sField) { - $sPlaceHolderKey = $sPlaceHolderPrefix . "->$sField"; + $sPlaceHolderKey = $sPlaceHolderPrefix."->$sField"; $aPlaceholders[$sPlaceHolderKey] = Dict::Format("Core:Placeholder:CannotBeResolved", $sPlaceHolderKey); } } else { $aPlaceholders[$sPlaceHolderKey] = $oObject; foreach ($aCurrentUser as $sField) { - $sPlaceHolderKey = $sPlaceHolderPrefix . "->$sField"; + $sPlaceHolderKey = $sPlaceHolderPrefix."->$sField"; // Mind that the "id" is not viewed as a valid att. code by \MetaModel::IsValidAttCode() so we have to test it manually - if ($sField !== "id" && false === MetaModel::IsValidAttCode(get_class($oObject), $sField)){ + if ($sField !== "id" && false === MetaModel::IsValidAttCode(get_class($oObject), $sField)) { $aContext = [ "current_user_id" => UserRights::GetUserId(), "obj_class" => get_class($oObject), "placeholder" => $sPlaceHolderKey, "invalid_field" => $sField, ]; - IssueLog::Warning("Unresolved placeholder due to invalid attribute", null, - $aContext); + IssueLog::Warning( + "Unresolved placeholder due to invalid attribute", + null, + $aContext + ); $aPlaceholders[$sPlaceHolderKey] = Dict::Format("Core:Placeholder:CannotBeResolved", $sPlaceHolderKey); continue; } @@ -4325,29 +4079,25 @@ abstract class MetaModel { // Compute query modifiers properties (can be set in the search itself, by the context, etc.) // - $aModifierProperties = array(); + $aModifierProperties = []; /** * @var string $sPluginClass * @var iQueryModifier $oQueryModifier */ - foreach(MetaModel::EnumPlugins('iQueryModifier') as $sPluginClass => $oQueryModifier) - { + foreach (MetaModel::EnumPlugins('iQueryModifier') as $sPluginClass => $oQueryModifier) { // Lowest precedence: the application context $aPluginProps = ApplicationContext::GetPluginProperties($sPluginClass); // Highest precedence: programmatically specified (or OQL) - foreach($oFilter->GetModifierProperties($sPluginClass) as $sProp => $value) - { + foreach ($oFilter->GetModifierProperties($sPluginClass) as $sProp => $value) { $aPluginProps[$sProp] = $value; } - if (count($aPluginProps) > 0) - { + if (count($aPluginProps) > 0) { $aModifierProperties[$sPluginClass] = $aPluginProps; } } return $aModifierProperties; } - /** * Special processing for the hierarchical keys stored as nested sets * @@ -4360,22 +4110,16 @@ abstract class MetaModel public static function HKInsertChildUnder($iId, $oAttDef, $sTable) { // Get the parent id.right value - if ($iId == 0) - { + if ($iId == 0) { // No parent, insert completely at the right of the tree $sSQL = "SELECT max(`".$oAttDef->GetSQLRight()."`) AS max FROM `$sTable`"; $aRes = CMDBSource::QueryToArray($sSQL); - if (count($aRes) == 0) - { + if (count($aRes) == 0) { $iMyRight = 1; - } - else - { + } else { $iMyRight = $aRes[0]['max'] + 1; } - } - else - { + } else { $sSQL = "SELECT `".$oAttDef->GetSQLRight()."` FROM `$sTable` WHERE id=".$iId; $iMyRight = CMDBSource::QueryToScalar($sSQL); $sSQLUpdateRight = "UPDATE `$sTable` SET `".$oAttDef->GetSQLRight()."` = `".$oAttDef->GetSQLRight()."` + 2 WHERE `".$oAttDef->GetSQLRight()."` >= $iMyRight"; @@ -4383,7 +4127,7 @@ abstract class MetaModel $sSQLUpdateLeft = "UPDATE `$sTable` SET `".$oAttDef->GetSQLLeft()."` = `".$oAttDef->GetSQLLeft()."` + 2 WHERE `".$oAttDef->GetSQLLeft()."` > $iMyRight"; CMDBSource::Query($sSQLUpdateLeft); } - return array($oAttDef->GetSQLRight() => $iMyRight + 1, $oAttDef->GetSQLLeft() => $iMyRight); + return [$oAttDef->GetSQLRight() => $iMyRight + 1, $oAttDef->GetSQLLeft() => $iMyRight]; } /** @@ -4445,26 +4189,20 @@ abstract class MetaModel public static function CheckHKeys(bool $bDiagnosticsOnly = false, bool $bVerbose = false, bool $bForceComputation = false) { $bChangeNeeded = false; - foreach(self::GetClasses() as $sClass) - { - if (!self::HasTable($sClass)) - { + foreach (self::GetClasses() as $sClass) { + if (!self::HasTable($sClass)) { continue; } - foreach(self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { + foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { // Check (once) all the attributes that are hierarchical keys - if ((self::GetAttributeOrigin($sClass, $sAttCode) == $sClass) && $oAttDef->IsHierarchicalKey()) - { - if ($bVerbose) - { + if ((self::GetAttributeOrigin($sClass, $sAttCode) == $sClass) && $oAttDef->IsHierarchicalKey()) { + if ($bVerbose) { echo "The attribute $sAttCode from $sClass is a hierarchical key.\n"; } $bResult = self::HKInit($sClass, $sAttCode, $bDiagnosticsOnly, $bVerbose, $bForceComputation); $bChangeNeeded |= $bResult; - if ($bVerbose && !$bResult) - { + if ($bVerbose && !$bResult) { echo "Ok, the attribute $sAttCode from class $sClass seems up to date.\n"; } } @@ -4495,40 +4233,31 @@ abstract class MetaModel $bUpdateNeeded = $bForceComputation; $oAttDef = self::GetAttributeDef($sClass, $sAttCode); $sTable = self::DBGetTable($sClass, $sAttCode); - if ($oAttDef->IsHierarchicalKey()) - { + if ($oAttDef->IsHierarchicalKey()) { // Check if some values already exist in the table for the _right value, if so, do nothing $sRight = $oAttDef->GetSQLRight(); $sSQL = "SELECT MAX(`$sRight`) AS MaxRight FROM `$sTable`"; $iMaxRight = CMDBSource::QueryToScalar($sSQL); $sSQL = "SELECT COUNT(*) AS Count FROM `$sTable`"; // Note: COUNT(field) returns zero if the given field contains only NULLs $iCount = CMDBSource::QueryToScalar($sSQL); - if (!$bForceComputation && ($iCount != 0) && ($iMaxRight == 0)) - { + if (!$bForceComputation && ($iCount != 0) && ($iMaxRight == 0)) { $bUpdateNeeded = true; - if ($bVerbose) - { + if ($bVerbose) { echo "The table '$sTable' must be updated to compute the fields $sRight and ".$oAttDef->GetSQLLeft()."\n"; } } - if ($bForceComputation && !$bDiagnosticsOnly) - { + if ($bForceComputation && !$bDiagnosticsOnly) { echo "Rebuilding the fields $sRight and ".$oAttDef->GetSQLLeft()." from table '$sTable'...\n"; } - if ($bUpdateNeeded && !$bDiagnosticsOnly) - { - try - { + if ($bUpdateNeeded && !$bDiagnosticsOnly) { + try { CMDBSource::Query('START TRANSACTION'); self::HKInitChildren($sTable, $sAttCode, $oAttDef, 0, $idx); CMDBSource::Query('COMMIT'); - if ($bVerbose) - { + if ($bVerbose) { echo "Ok, table '$sTable' successfully updated.\n"; } - } - catch (Exception $e) - { + } catch (Exception $e) { CMDBSource::Query('ROLLBACK'); throw new Exception("An error occured (".$e->getMessage().") while initializing the hierarchy for ($sClass, $sAttCode). The database was not modified."); } @@ -4555,8 +4284,7 @@ abstract class MetaModel $aRes = CMDBSource::QueryToArray($sSQL); $sLeft = $oAttDef->GetSQLLeft(); $sRight = $oAttDef->GetSQLRight(); - foreach($aRes as $aValues) - { + foreach ($aRes as $aValues) { $iChildId = $aValues['id']; $iLeft = $iCurrIndex++; self::HKInitChildren($sTable, $sAttCode, $oAttDef, $iChildId, $iCurrIndex); @@ -4578,49 +4306,33 @@ abstract class MetaModel */ public static function RebuildMetaEnums($bVerbose = false) { - foreach(self::GetClasses() as $sClass) - { - if (!self::HasTable($sClass)) - { + foreach (self::GetClasses() as $sClass) { + if (!self::HasTable($sClass)) { continue; } - foreach(self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { + foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { // Check (once) all the attributes that are hierarchical keys - if ((self::GetAttributeOrigin($sClass, $sAttCode) == $sClass) && $oAttDef instanceof AttributeEnum) - { - if (isset(self::$m_aEnumToMeta[$sClass][$sAttCode])) - { - foreach(self::$m_aEnumToMeta[$sClass][$sAttCode] as $sMetaAttCode => $oMetaAttDef) - { - $aMetaValues = array(); // array of (metavalue => array of values) - foreach($oAttDef->GetAllowedValues() as $sCode => $sLabel) - { + if ((self::GetAttributeOrigin($sClass, $sAttCode) == $sClass) && $oAttDef instanceof AttributeEnum) { + if (isset(self::$m_aEnumToMeta[$sClass][$sAttCode])) { + foreach (self::$m_aEnumToMeta[$sClass][$sAttCode] as $sMetaAttCode => $oMetaAttDef) { + $aMetaValues = []; // array of (metavalue => array of values) + foreach ($oAttDef->GetAllowedValues() as $sCode => $sLabel) { $aMappingData = $oMetaAttDef->GetMapRule($sClass); - if ($aMappingData == null) - { + if ($aMappingData == null) { $sMetaValue = $oMetaAttDef->GetDefaultValue(); - } - else - { - if (array_key_exists($sCode, $aMappingData['values'])) - { + } else { + if (array_key_exists($sCode, $aMappingData['values'])) { $sMetaValue = $aMappingData['values'][$sCode]; - } - elseif ($oMetaAttDef->GetDefaultValue() != '') - { + } elseif ($oMetaAttDef->GetDefaultValue() != '') { $sMetaValue = $oMetaAttDef->GetDefaultValue(); - } - else - { + } else { throw new Exception('MetaModel::RebuildMetaEnums(): mapping not found for value "'.$sCode.'"" in '.$sClass.', on attribute '.self::GetAttributeOrigin($sClass, $oMetaAttDef->GetCode()).'::'.$oMetaAttDef->GetCode()); } } $aMetaValues[$sMetaValue][] = $sCode; } - foreach($aMetaValues as $sMetaValue => $aEnumValues) - { + foreach ($aMetaValues as $sMetaValue => $aEnumValues) { $sMetaTable = self::DBGetTable($sClass, $sMetaAttCode); $sEnumTable = self::DBGetTable($sClass); $aColumns = array_keys($oMetaAttDef->GetSQLColumns()); @@ -4629,8 +4341,7 @@ abstract class MetaModel $sEnumColumn = reset($aColumns); $sValueList = implode(', ', CMDBSource::Quote($aEnumValues)); $sSql = "UPDATE `$sMetaTable` JOIN `$sEnumTable` ON `$sEnumTable`.id = `$sMetaTable`.id SET `$sMetaTable`.`$sMetaColumn` = '$sMetaValue' WHERE `$sEnumTable`.`$sEnumColumn` IN ($sValueList) AND `$sMetaTable`.`$sMetaColumn` != '$sMetaValue'"; - if ($bVerbose) - { + if ($bVerbose) { echo "Executing query: $sSql\n"; } CMDBSource::Query($sSql); @@ -4642,7 +4353,6 @@ abstract class MetaModel } } - /** * @param boolean $bDiagnostics * @param boolean $bVerbose @@ -4655,20 +4365,16 @@ abstract class MetaModel $sOQL = 'SELECT SynchroDataSource'; $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL)); $bFixNeeded = false; - if ($bVerbose && $oSet->Count() == 0) - { + if ($bVerbose && $oSet->Count() == 0) { echo "There are no Data Sources in the database.\n"; } - while ($oSource = $oSet->Fetch()) - { - if ($bVerbose) - { + while ($oSource = $oSet->Fetch()) { + if ($bVerbose) { echo "Checking Data Source '".$oSource->GetName()."'...\n"; $bFixNeeded = $bFixNeeded | $oSource->CheckDBConsistency($bDiagnostics, $bVerbose); } } - if (!$bFixNeeded && $bVerbose) - { + if (!$bFixNeeded && $bVerbose) { echo "Ok.\n"; } @@ -4685,23 +4391,20 @@ abstract class MetaModel */ public static function GenerateUniqueAlias(&$aAliases, $sNewName, $sRealName) { - if (!array_key_exists($sNewName, $aAliases)) - { + if (!array_key_exists($sNewName, $aAliases)) { $aAliases[$sNewName] = $sRealName; return $sNewName; } - for($i = 1; $i < 100; $i++) - { + for ($i = 1; $i < 100; $i++) { $sAnAlias = $sNewName.$i; - if (!array_key_exists($sAnAlias, $aAliases)) - { + if (!array_key_exists($sAnAlias, $aAliases)) { // Create that new alias $aAliases[$sAnAlias] = $sRealName; return $sAnAlias; } } - throw new CoreException('Failed to create an alias', array('aliases' => $aAliases, 'new' => $sNewName)); + throw new CoreException('Failed to create an alias', ['aliases' => $aAliases, 'new' => $sNewName]); } /** @@ -4713,106 +4416,76 @@ abstract class MetaModel */ public static function CheckDefinitions($bExitOnError = true) { - if (count(self::GetClasses()) == 0) - { + if (count(self::GetClasses()) == 0) { throw new CoreException("MetaModel::InitClasses() has not been called, or no class has been declared ?!?!"); } - $aErrors = array(); - $aSugFix = array(); - foreach(self::GetClasses() as $sClass) - { + $aErrors = []; + $aSugFix = []; + foreach (self::GetClasses() as $sClass) { $sTable = self::DBGetTable($sClass); $sTableLowercase = strtolower($sTable); - if ($sTableLowercase != $sTable) - { + if ($sTableLowercase != $sTable) { $aErrors[$sClass][] = "Table name '".$sTable."' has upper case characters. You might encounter issues when moving your installation between Linux and Windows."; $aSugFix[$sClass][] = "Use '$sTableLowercase' instead. Step 1: If already installed, then rename manually in the DB: RENAME TABLE `$sTable` TO `{$sTableLowercase}_tempname`, `{$sTableLowercase}_tempname` TO `$sTableLowercase`; Step 2: Rename the table in the datamodel and compile the application. Note: the MySQL statement provided in step 1 has been designed to be compatible with Windows or Linux."; } $aNameSpec = self::GetNameSpec($sClass); - foreach($aNameSpec[1] as $i => $sAttCode) - { - if (!self::IsValidAttCode($sClass, $sAttCode)) - { + foreach ($aNameSpec[1] as $i => $sAttCode) { + if (!self::IsValidAttCode($sClass, $sAttCode)) { $aErrors[$sClass][] = "Unknown attribute code '".$sAttCode."' for the name definition"; $aSugFix[$sClass][] = "Expecting a value in ".implode(", ", self::GetAttributesList($sClass)); } } - foreach(self::GetReconcKeys($sClass) as $sReconcKeyAttCode) - { - if (!empty($sReconcKeyAttCode) && !self::IsValidAttCode($sClass, $sReconcKeyAttCode)) - { + foreach (self::GetReconcKeys($sClass) as $sReconcKeyAttCode) { + if (!empty($sReconcKeyAttCode) && !self::IsValidAttCode($sClass, $sReconcKeyAttCode)) { $aErrors[$sClass][] = "Unknown attribute code '".$sReconcKeyAttCode."' in the list of reconciliation keys"; $aSugFix[$sClass][] = "Expecting a value in ".implode(", ", self::GetAttributesList($sClass)); } } $bHasWritableAttribute = false; - foreach(self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { + foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { // It makes no sense to check the attributes again and again in the subclasses - if (self::$m_aAttribOrigins[$sClass][$sAttCode] != $sClass) - { + if (self::$m_aAttribOrigins[$sClass][$sAttCode] != $sClass) { continue; } - if ($oAttDef->IsExternalKey()) - { - if (!self::IsValidClass($oAttDef->GetTargetClass())) - { + if ($oAttDef->IsExternalKey()) { + if (!self::IsValidClass($oAttDef->GetTargetClass())) { $aErrors[$sClass][] = "Unknown class '".$oAttDef->GetTargetClass()."' for the external key '$sAttCode'"; $aSugFix[$sClass][] = "Expecting a value in {".implode(", ", self::GetClasses())."}"; } - } - elseif ($oAttDef->IsExternalField()) - { + } elseif ($oAttDef->IsExternalField()) { $sKeyAttCode = $oAttDef->GetKeyAttCode(); - if (!self::IsValidAttCode($sClass, $sKeyAttCode) || !self::IsValidKeyAttCode($sClass, $sKeyAttCode)) - { + if (!self::IsValidAttCode($sClass, $sKeyAttCode) || !self::IsValidKeyAttCode($sClass, $sKeyAttCode)) { $aErrors[$sClass][] = "Unknown key attribute code '".$sKeyAttCode."' for the external field $sAttCode"; $aSugFix[$sClass][] = "Expecting a value in {".implode(", ", self::GetKeysList($sClass))."}"; - } - else - { + } else { $oKeyAttDef = self::GetAttributeDef($sClass, $sKeyAttCode); $sTargetClass = $oKeyAttDef->GetTargetClass(); $sExtAttCode = $oAttDef->GetExtAttCode(); - if (!self::IsValidAttCode($sTargetClass, $sExtAttCode)) - { + if (!self::IsValidAttCode($sTargetClass, $sExtAttCode)) { $aErrors[$sClass][] = "Unknown key attribute code '".$sExtAttCode."' for the external field $sAttCode"; $aSugFix[$sClass][] = "Expecting a value in {".implode(", ", self::GetKeysList($sTargetClass))."}"; } } - } - else - { - if ($oAttDef->IsLinkSet()) - { + } else { + if ($oAttDef->IsLinkSet()) { // Do nothing... - } - else - { - if ($oAttDef instanceof AttributeStopWatch) - { + } else { + if ($oAttDef instanceof AttributeStopWatch) { $aThresholds = $oAttDef->ListThresholds(); - if (is_array($aThresholds)) - { - foreach($aThresholds as $iPercent => $aDef) - { - if (array_key_exists('highlight', $aDef)) - { - if (!array_key_exists('code', $aDef['highlight'])) - { + if (is_array($aThresholds)) { + foreach ($aThresholds as $iPercent => $aDef) { + if (array_key_exists('highlight', $aDef)) { + if (!array_key_exists('code', $aDef['highlight'])) { $aErrors[$sClass][] = "The 'code' element is missing for the 'highlight' property of the $iPercent% threshold in the attribute: '$sAttCode'."; $aSugFix[$sClass][] = "Add a 'code' entry specifying the value of the highlight code for this threshold."; - } - else - { + } else { $aScale = self::GetHighlightScale($sClass); - if (!array_key_exists($aDef['highlight']['code'], $aScale)) - { + if (!array_key_exists($aDef['highlight']['code'], $aScale)) { $aErrors[$sClass][] = "'{$aDef['highlight']['code']}' is not a valid value for the 'code' element of the $iPercent% threshold in the attribute: '$sAttCode'."; $aSugFix[$sClass][] = "The possible highlight codes for this class are: ".implode(', ', array_keys($aScale))."."; } @@ -4820,25 +4493,18 @@ abstract class MetaModel } } } - } - else // standard attributes - { + } else { // standard attributes // Check that the default values definition is a valid object! $oValSetDef = $oAttDef->GetValuesDef(); - if (!is_null($oValSetDef) && !$oValSetDef instanceof ValueSetDefinition) - { + if (!is_null($oValSetDef) && !$oValSetDef instanceof ValueSetDefinition) { $aErrors[$sClass][] = "Allowed values for attribute $sAttCode is not of the relevant type"; $aSugFix[$sClass][] = "Please set it as an instance of a ValueSetDefinition object."; - } - else - { + } else { // Default value must be listed in the allowed values (if defined) $aAllowedValues = self::GetAllowedValues_att($sClass, $sAttCode); - if (!is_null($aAllowedValues)) - { + if (!is_null($aAllowedValues)) { $sDefaultValue = $oAttDef->GetDefaultValue(); - if (is_string($sDefaultValue) && !array_key_exists($sDefaultValue, $aAllowedValues)) - { + if (is_string($sDefaultValue) && !array_key_exists($sDefaultValue, $aAllowedValues)) { $aErrors[$sClass][] = "Default value '".$sDefaultValue."' for attribute $sAttCode is not an allowed value"; $aSugFix[$sClass][] = "Please pickup the default value out of {'".implode(", ", array_keys($aAllowedValues))."'}"; } @@ -4848,13 +4514,10 @@ abstract class MetaModel } } // Check dependencies - if ($oAttDef->IsWritable()) - { + if ($oAttDef->IsWritable()) { $bHasWritableAttribute = true; - foreach($oAttDef->GetPrerequisiteAttributes() as $sDependOnAttCode) - { - if (!self::IsValidAttCode($sClass, $sDependOnAttCode)) - { + foreach ($oAttDef->GetPrerequisiteAttributes() as $sDependOnAttCode) { + if (!self::IsValidAttCode($sClass, $sDependOnAttCode)) { $aErrors[$sClass][] = "Unknown attribute code '".$sDependOnAttCode."' in the list of prerequisite attributes"; $aSugFix[$sClass][] = "Expecting a value in ".implode(", ", self::GetAttributesList($sClass)); } @@ -4865,43 +4528,32 @@ abstract class MetaModel // Lifecycle // $sStateAttCode = self::GetStateAttributeCode($sClass); - if (strlen($sStateAttCode) > 0) - { + if (strlen($sStateAttCode) > 0) { // Lifecycle - check that the state attribute does exist as an attribute - if (!self::IsValidAttCode($sClass, $sStateAttCode)) - { + if (!self::IsValidAttCode($sClass, $sStateAttCode)) { $aErrors[$sClass][] = "Unknown attribute code '".$sStateAttCode."' for the state definition"; $aSugFix[$sClass][] = "Expecting a value in {".implode(", ", self::GetAttributesList($sClass))."}"; - } - else - { + } else { // Lifecycle - check that there is a value set constraint on the state attribute $aAllowedValuesRaw = self::GetAllowedValues_att($sClass, $sStateAttCode); $aStates = array_keys(self::EnumStates($sClass)); - if (is_null($aAllowedValuesRaw)) - { + if (is_null($aAllowedValuesRaw)) { $aErrors[$sClass][] = "Attribute '".$sStateAttCode."' will reflect the state of the object. It must be restricted to a set of values"; $aSugFix[$sClass][] = "Please define its allowed_values property as [new ValueSetEnum('".implode(", ", $aStates)."')]"; - } - else - { + } else { $aAllowedValues = array_keys($aAllowedValuesRaw); // Lifecycle - check the the state attribute allowed values are defined states - foreach($aAllowedValues as $sValue) - { - if (!in_array($sValue, $aStates)) - { + foreach ($aAllowedValues as $sValue) { + if (!in_array($sValue, $aStates)) { $aErrors[$sClass][] = "Attribute '".$sStateAttCode."' (object state) has an allowed value ($sValue) which is not a known state"; $aSugFix[$sClass][] = "You may define its allowed_values property as [new ValueSetEnum('".implode(", ", $aStates)."')], or reconsider the list of states"; } } // Lifecycle - check that defined states are allowed values - foreach($aStates as $sStateValue) - { - if (!in_array($sStateValue, $aAllowedValues)) - { + foreach ($aStates as $sStateValue) { + if (!in_array($sStateValue, $aAllowedValues)) { $aErrors[$sClass][] = "Attribute '".$sStateAttCode."' (object state) has a state ($sStateValue) which is not an allowed value"; $aSugFix[$sClass][] = "You may define its allowed_values property as [new ValueSetEnum('".implode(", ", $aStates)."')], or reconsider the list of states"; } @@ -4909,43 +4561,30 @@ abstract class MetaModel } // Lifecycle - check that the action handlers are defined - foreach(self::EnumStates($sClass) as $sStateCode => $aStateDef) - { - foreach(self::EnumTransitions($sClass, $sStateCode) as $sStimulusCode => $aTransitionDef) - { - foreach($aTransitionDef['actions'] as $actionHandler) - { - if (is_string($actionHandler)) - { - if (!method_exists($sClass, $actionHandler)) - { + foreach (self::EnumStates($sClass) as $sStateCode => $aStateDef) { + foreach (self::EnumTransitions($sClass, $sStateCode) as $sStimulusCode => $aTransitionDef) { + foreach ($aTransitionDef['actions'] as $actionHandler) { + if (is_string($actionHandler)) { + if (!method_exists($sClass, $actionHandler)) { $aErrors[$sClass][] = "Unknown function '$actionHandler' in transition [$sStateCode/$sStimulusCode] for state attribute '$sStateAttCode'"; $aSugFix[$sClass][] = "Specify a function which prototype is in the form [public function $actionHandler(\$sStimulusCode){return true;}]"; } - } - else // if(is_array($actionHandler)) - { + } else { // if(is_array($actionHandler)) $sActionHandler = $actionHandler['verb']; - if (!method_exists($sClass, $sActionHandler)) - { + if (!method_exists($sClass, $sActionHandler)) { $aErrors[$sClass][] = "Unknown function '$sActionHandler' in transition [$sStateCode/$sStimulusCode] for state attribute '$sStateAttCode'"; $aSugFix[$sClass][] = "Specify a function which prototype is in the form [public function $sActionHandler(...){return true;}]"; } } } } - if (array_key_exists('highlight', $aStateDef)) - { - if (!array_key_exists('code', $aStateDef['highlight'])) - { + if (array_key_exists('highlight', $aStateDef)) { + if (!array_key_exists('code', $aStateDef['highlight'])) { $aErrors[$sClass][] = "The 'code' element is missing for the 'highlight' property of state: '$sStateCode'."; $aSugFix[$sClass][] = "Add a 'code' entry specifying the value of the highlight code for this state."; - } - else - { + } else { $aScale = self::GetHighlightScale($sClass); - if (!array_key_exists($aStateDef['highlight']['code'], $aScale)) - { + if (!array_key_exists($aStateDef['highlight']['code'], $aScale)) { $aErrors[$sClass][] = "'{$aStateDef['highlight']['code']}' is not a valid value for the 'code' element in the 'highlight' property of state: '$sStateCode'."; $aSugFix[$sClass][] = "The possible highlight codes for this class are: ".implode(', ', array_keys($aScale))."."; } @@ -4955,24 +4594,18 @@ abstract class MetaModel } } - if ($bHasWritableAttribute) - { - if (!self::HasTable($sClass)) - { + if ($bHasWritableAttribute) { + if (!self::HasTable($sClass)) { $aErrors[$sClass][] = "No table has been defined for this class"; $aSugFix[$sClass][] = "Either define a table name or move the attributes elsewhere"; } } - // ZList // - foreach(self::EnumZLists() as $sListCode) - { - foreach(self::FlattenZList(self::GetZListItems($sClass, $sListCode)) as $sMyAttCode) - { - if (!self::IsValidAttCode($sClass, $sMyAttCode)) - { + foreach (self::EnumZLists() as $sListCode) { + foreach (self::FlattenZList(self::GetZListItems($sClass, $sListCode)) as $sMyAttCode) { + if (!self::IsValidAttCode($sClass, $sMyAttCode)) { $aErrors[$sClass][] = "Unknown attribute code '".$sMyAttCode."' from ZList '$sListCode'"; $aSugFix[$sClass][] = "Expecting a value in {".implode(", ", self::GetAttributesList($sClass))."}"; } @@ -4981,30 +4614,23 @@ abstract class MetaModel // Check SQL columns uniqueness // - if (self::HasTable($sClass)) - { - $aTableColumns = array(); // array of column => attcode (the column is used by this attribute) + if (self::HasTable($sClass)) { + $aTableColumns = []; // array of column => attcode (the column is used by this attribute) $aTableColumns[self::DBGetKey($sClass)] = 'id'; // Check that SQL columns are declared only once // - foreach(self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { + foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { // Skip this attribute if not originally defined in this class - if (self::$m_aAttribOrigins[$sClass][$sAttCode] != $sClass) - { + if (self::$m_aAttribOrigins[$sClass][$sAttCode] != $sClass) { continue; } - foreach($oAttDef->GetSQLColumns() as $sField => $sDBFieldType) - { - if (array_key_exists($sField, $aTableColumns)) - { + foreach ($oAttDef->GetSQLColumns() as $sField => $sDBFieldType) { + if (array_key_exists($sField, $aTableColumns)) { $aErrors[$sClass][] = "Column '$sField' declared for attribute $sAttCode, but already used for attribute ".$aTableColumns[$sField]; $aSugFix[$sClass][] = "Please find another name for the SQL column"; - } - else - { + } else { $aTableColumns[$sField] = $sAttCode; } } @@ -5012,30 +4638,25 @@ abstract class MetaModel } } // foreach class - if (count($aErrors) > 0) - { + if (count($aErrors) > 0) { echo "
      "; echo "

      Business model inconsistencies have been found

      \n"; // #@# later -> this is the responsibility of the caller to format the output - foreach($aErrors as $sClass => $aMessages) - { + foreach ($aErrors as $sClass => $aMessages) { echo "

      Wrong declaration for class $sClass

      \n"; echo "
        \n"; $i = 0; - foreach($aMessages as $sMsg) - { + foreach ($aMessages as $sMsg) { echo "
      • $sMsg ({$aSugFix[$sClass][$i]})
      • \n"; $i++; } echo "
      \n"; } - if ($bExitOnError) - { + if ($bExitOnError) { echo "

      Aborting...

      \n"; } echo "
      \n"; - if ($bExitOnError) - { + if ($bExitOnError) { exit; } } @@ -5053,7 +4674,7 @@ abstract class MetaModel } // By design, some queries might be blank, we have to ignore them - $aCleanFixes = array(); + $aCleanFixes = []; foreach ($aSQLFixes as $sSQLFix) { if (!empty($sSQLFix)) { $aCleanFixes[] = $sSQLFix; @@ -5078,40 +4699,29 @@ abstract class MetaModel */ public static function DBExists($bMustBeComplete = true) { - if (!CMDBSource::IsDB(self::$m_sDBName)) - { + if (!CMDBSource::IsDB(self::$m_sDBName)) { return false; } CMDBSource::SelectDB(self::$m_sDBName); - $aFound = array(); - $aMissing = array(); - foreach(self::DBEnumTables() as $sTable => $aClasses) - { - if (CMDBSource::IsTable($sTable)) - { + $aFound = []; + $aMissing = []; + foreach (self::DBEnumTables() as $sTable => $aClasses) { + if (CMDBSource::IsTable($sTable)) { $aFound[] = $sTable; - } - else - { + } else { $aMissing[] = $sTable; } } - if (count($aFound) == 0) - { + if (count($aFound) == 0) { // no expected table has been found return false; - } - else - { - if (count($aMissing) == 0) - { + } else { + if (count($aMissing) == 0) { // the database is complete (still, could be some fields missing!) return true; - } - else - { + } else { // not all the tables, could be an older version return !$bMustBeComplete; } @@ -5126,30 +4736,23 @@ abstract class MetaModel { $bDropEntireDB = true; - if (!empty(self::$m_sTablePrefix)) - { - foreach(self::DBEnumTables() as $sTable) - { + if (!empty(self::$m_sTablePrefix)) { + foreach (self::DBEnumTables() as $sTable) { // perform a case-insensitive test because on Windows the table names become lowercase :-( - if (strtolower(substr($sTable, 0, strlen(self::$m_sTablePrefix))) == strtolower(self::$m_sTablePrefix)) - { + if (strtolower(substr($sTable, 0, strlen(self::$m_sTablePrefix))) == strtolower(self::$m_sTablePrefix)) { CMDBSource::DropTable($sTable); - } - else - { + } else { // There is at least one table which is out of the scope of the current application $bDropEntireDB = false; } } } - if ($bDropEntireDB) - { + if ($bDropEntireDB) { CMDBSource::DropDB(self::$m_sDBName); } } - /** * @param callable $aCallback * @@ -5162,8 +4765,7 @@ abstract class MetaModel { // Note: we have to check if the DB does exist, because we may share the DB // with other applications (in which case the DB does exist, not the tables with the given prefix) - if (!CMDBSource::IsDB(self::$m_sDBName)) - { + if (!CMDBSource::IsDB(self::$m_sDBName)) { CMDBSource::CreateDB(self::$m_sDBName); } self::DBCreateTables($aCallback); @@ -5180,13 +4782,11 @@ abstract class MetaModel [$aErrors, $aSugFix, $aCondensedQueries] = self::DBCheckFormat(); //$sSQL = implode('; ', $aCondensedQueries); Does not work - multiple queries not allowed - foreach($aCondensedQueries as $sQuery) - { + foreach ($aCondensedQueries as $sQuery) { $fStart = microtime(true); CMDBSource::CreateTable($sQuery); $fDuration = microtime(true) - $fStart; - if ($aCallback != null) - { + if ($aCallback != null) { call_user_func($aCallback, $sQuery, $fDuration); } } @@ -5201,14 +4801,10 @@ abstract class MetaModel { [$aErrors, $aSugFix] = self::DBCheckViews(); - foreach($aSugFix as $sClass => $aTarget) - { - foreach($aTarget as $aQueries) - { - foreach($aQueries as $sQuery) - { - if (!empty($sQuery)) - { + foreach ($aSugFix as $sClass => $aTarget) { + foreach ($aTarget as $aQueries) { + foreach ($aQueries as $sQuery) { + if (!empty($sQuery)) { // forces a refresh of cached information CMDBSource::CreateTable($sQuery); } @@ -5224,9 +4820,8 @@ abstract class MetaModel */ public static function DBDump() { - $aDataDump = array(); - foreach(self::DBEnumTables() as $sTable => $aClasses) - { + $aDataDump = []; + foreach (self::DBEnumTables() as $sTable => $aClasses) { $aRows = CMDBSource::DumpTable($sTable); $aDataDump[$sTable] = $aRows; } @@ -5242,16 +4837,12 @@ abstract class MetaModel { // Improvement: check the mySQL variable -> Read-only - if (utils::IsArchiveMode()) - { + if (utils::IsArchiveMode()) { return true; } - if (UserRights::IsAdministrator()) - { + if (UserRights::IsAdministrator()) { return (!self::DBHasAccess(ACCESS_ADMIN_WRITE)); - } - else - { + } else { return (!self::DBHasAccess(ACCESS_USER_WRITE)); } } @@ -5264,8 +4855,7 @@ abstract class MetaModel public static function DBHasAccess($iRequested = ACCESS_FULL) { $iMode = self::$m_oConfig->Get('access_mode'); - if (($iMode & $iRequested) == 0) - { + if (($iMode & $iRequested) == 0) { return false; } @@ -5284,12 +4874,10 @@ abstract class MetaModel protected static function MakeDictEntry($sKey, $sValueFromOldSystem, $sDefaultValue, &$bNotInDico) { $sValue = Dict::S($sKey, 'x-no-nothing'); - if ($sValue == 'x-no-nothing') - { + if ($sValue == 'x-no-nothing') { $bNotInDico = true; $sValue = $sValueFromOldSystem; - if (strlen($sValue) == 0) - { + if (strlen($sValue) == 0) { $sValue = $sDefaultValue; } } @@ -5323,7 +4911,7 @@ abstract class MetaModel // Note: I did not use EnumCategories(), because a given class maybe found in several categories // Need to invent the "module", to characterize the origins of a class if (strlen($sModules) == 0) { - $aModules = array('bizmodel', 'core/cmdb', 'gui', 'application', 'addon/userrights'); + $aModules = ['bizmodel', 'core/cmdb', 'gui', 'application', 'addon/userrights']; } else { $aModules = explode(', ', $sModules); } @@ -5352,54 +4940,39 @@ abstract class MetaModel $sClassRes .= "Dict::Add('EN US', 'English', 'English', array(\n"; $sClassRes .= self::MakeDictEntry("Class:$sClass", self::GetName_Obsolete($sClass), $sClass, $bNotInDico); $sClassRes .= self::MakeDictEntry("Class:$sClass+", self::GetClassDescription_Obsolete($sClass), '', $bNotInDico); - foreach(self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { + foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { // Skip this attribute if not originally defined in this class - if (self::$m_aAttribOrigins[$sClass][$sAttCode] != $sClass) - { + if (self::$m_aAttribOrigins[$sClass][$sAttCode] != $sClass) { continue; } $sClassRes .= self::MakeDictEntry("Class:$sClass/Attribute:$sAttCode", $oAttDef->GetLabel_Obsolete(), $sAttCode, $bNotInDico); $sClassRes .= self::MakeDictEntry("Class:$sClass/Attribute:$sAttCode+", $oAttDef->GetDescription_Obsolete(), '', $bNotInDico); - if ($oAttDef instanceof AttributeEnum) - { - if (self::GetStateAttributeCode($sClass) == $sAttCode) - { - foreach(self::EnumStates($sClass) as $sStateCode => $aStateData) - { - if (array_key_exists('label', $aStateData)) - { + if ($oAttDef instanceof AttributeEnum) { + if (self::GetStateAttributeCode($sClass) == $sAttCode) { + foreach (self::EnumStates($sClass) as $sStateCode => $aStateData) { + if (array_key_exists('label', $aStateData)) { $sValue = $aStateData['label']; - } - else - { + } else { $sValue = MetaModel::GetStateLabel($sClass, $sStateCode); } - if (array_key_exists('description', $aStateData)) - { + if (array_key_exists('description', $aStateData)) { $sValuePlus = $aStateData['description']; - } - else - { + } else { $sValuePlus = MetaModel::GetStateDescription($sClass, $sStateCode); } $sClassRes .= self::MakeDictEntry("Class:$sClass/Attribute:$sAttCode/Value:$sStateCode", $sValue, '', $bNotInDico); $sClassRes .= self::MakeDictEntry("Class:$sClass/Attribute:$sAttCode/Value:$sStateCode+", $sValuePlus, '', $bNotInDico); } - } - else - { - foreach($oAttDef->GetAllowedValues() as $sKey => $value) - { + } else { + foreach ($oAttDef->GetAllowedValues() as $sKey => $value) { $sClassRes .= self::MakeDictEntry("Class:$sClass/Attribute:$sAttCode/Value:$sKey", $value, '', $bNotInDico); $sClassRes .= self::MakeDictEntry("Class:$sClass/Attribute:$sAttCode/Value:$sKey+", $value, '', $bNotInDico); } } } } - foreach(self::EnumStimuli($sClass) as $sStimulusCode => $oStimulus) - { + foreach (self::EnumStimuli($sClass) as $sStimulusCode => $oStimulus) { $sClassRes .= self::MakeDictEntry("Class:$sClass/Stimulus:$sStimulusCode", $oStimulus->GetLabel_Obsolete(), '', $bNotInDico); $sClassRes .= self::MakeDictEntry("Class:$sClass/Stimulus:$sStimulusCode+", $oStimulus->GetDescription_Obsolete(), '', $bNotInDico); } @@ -5407,8 +4980,7 @@ abstract class MetaModel $sClassRes .= "));\n"; $sClassRes .= "\n"; - if ($bNotInDico || ($sOutputFilter != 'NotInDictionary')) - { + if ($bNotInDico || ($sOutputFilter != 'NotInDictionary')) { $sRes .= $sClassRes; } } @@ -5417,7 +4989,6 @@ abstract class MetaModel return $sRes; } - /** * @return array * @throws \CoreException @@ -5425,29 +4996,27 @@ abstract class MetaModel */ public static function DBCheckFormat() { - $aErrors = array(); - $aSugFix = array(); + $aErrors = []; + $aSugFix = []; $sAlterDBMetaData = CMDBSource::DBCheckCharsetAndCollation(); // A new way of representing things to be done - quicker to execute ! - $aCreateTable = array(); // array of =>
      - $aCreateTableItems = array(); // array of
      => array of - $aAlterTableMetaData = array(); - $aAlterTableItems = array(); // array of
      => - $aPostTableAlteration = array(); // array of
      => post alteration queries + $aCreateTable = []; // array of
      =>
      + $aCreateTableItems = []; // array of
      => array of + $aAlterTableMetaData = []; + $aAlterTableItems = []; // array of
      => + $aPostTableAlteration = []; // array of
      => post alteration queries - foreach(self::GetClasses() as $sClass) - { - if (!self::HasTable($sClass)) - { + foreach (self::GetClasses() as $sClass) { + if (!self::HasTable($sClass)) { continue; } // Check that the table exists // $sTable = self::DBGetTable($sClass); - $aSugFix[$sClass]['*First'] = array(); + $aSugFix[$sClass]['*First'] = []; $aTableInfo = CMDBSource::GetTableInfo($sTable); @@ -5458,8 +5027,7 @@ abstract class MetaModel $sAutoIncrement = (self::IsAutoIncrementKey($sClass) ? "AUTO_INCREMENT" : ""); $sKeyFieldDefinition = "`$sKeyField` INT(11) NOT NULL $sAutoIncrement PRIMARY KEY"; $aTableInfo['Indexes']['PRIMARY']['used'] = true; - if (!CMDBSource::IsTable($sTable)) - { + if (!CMDBSource::IsTable($sTable)) { $bTableToCreate = true; $aErrors[$sClass]['*'][] = "table '$sTable' could not be found in the DB"; $aSugFix[$sClass]['*'][] = "CREATE TABLE `$sTable` ($sKeyFieldDefinition) ENGINE = ".MYSQL_ENGINE." CHARACTER SET $sDbCharset COLLATE $sDbCollation"; @@ -5468,44 +5036,34 @@ abstract class MetaModel } // Check that the key field exists // - elseif (!CMDBSource::IsField($sTable, $sKeyField)) - { + elseif (!CMDBSource::IsField($sTable, $sKeyField)) { $aErrors[$sClass]['id'][] = "key '$sKeyField' (table $sTable) could not be found"; $aSugFix[$sClass]['id'][] = "ALTER TABLE `$sTable` ADD $sKeyFieldDefinition"; - if (!$bTableToCreate) - { + if (!$bTableToCreate) { $aAlterTableItems[$sTable]['field'][$sKeyField] = "ADD $sKeyFieldDefinition"; } - } - else - { + } else { // Check the key field properties // - if (!CMDBSource::IsKey($sTable, $sKeyField)) - { + if (!CMDBSource::IsKey($sTable, $sKeyField)) { $aErrors[$sClass]['id'][] = "key '$sKeyField' is not a key for table '$sTable'"; $aSugFix[$sClass]['id'][] = "ALTER TABLE `$sTable`, DROP PRIMARY KEY, ADD PRIMARY key(`$sKeyField`)"; - if (!$bTableToCreate) - { + if (!$bTableToCreate) { $aAlterTableItems[$sTable]['field'][$sKeyField] = "CHANGE `$sKeyField` $sKeyFieldDefinition"; } } - if (self::IsAutoIncrementKey($sClass) && !CMDBSource::IsAutoIncrement($sTable, $sKeyField)) - { + if (self::IsAutoIncrementKey($sClass) && !CMDBSource::IsAutoIncrement($sTable, $sKeyField)) { $aErrors[$sClass]['id'][] = "key '$sKeyField' (table $sTable) is not automatically incremented"; $aSugFix[$sClass]['id'][] = "ALTER TABLE `$sTable` CHANGE `$sKeyField` $sKeyFieldDefinition"; - if (!$bTableToCreate) - { + if (!$bTableToCreate) { $aAlterTableItems[$sTable]['field'][$sKeyField] = "CHANGE `$sKeyField` $sKeyFieldDefinition"; } } } - if (!$bTableToCreate) - { + if (!$bTableToCreate) { $sAlterTableMetaDataQuery = CMDBSource::DBCheckTableCharsetAndCollation($sTable); - if (!empty($sAlterTableMetaDataQuery)) - { + if (!empty($sAlterTableMetaDataQuery)) { $aAlterTableMetaData[$sTable] = $sAlterTableMetaDataQuery; } } @@ -5514,135 +5072,101 @@ abstract class MetaModel // $aTableInfo['Fields'][$sKeyField]['used'] = true; $aFriendlynameAttcodes = self::GetFriendlyNameAttributeCodeList($sClass); - foreach(self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - if (!$oAttDef->CopyOnAllTables()) - { + foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if (!$oAttDef->CopyOnAllTables()) { // Skip this attribute if not originally defined in this class - if (self::$m_aAttribOrigins[$sClass][$sAttCode] != $sClass) - { + if (self::$m_aAttribOrigins[$sClass][$sAttCode] != $sClass) { continue; } } - foreach($oAttDef->GetSQLColumns(true) as $sField => $sDBFieldSpec) - { + foreach ($oAttDef->GetSQLColumns(true) as $sField => $sDBFieldSpec) { // Keep track of columns used by iTop $aTableInfo['Fields'][$sField]['used'] = true; $bIndexNeeded = $oAttDef->RequiresIndex(); $bFullTextIndexNeeded = false; - if (!$bIndexNeeded) - { + if (!$bIndexNeeded) { // Add an index on the columns of the friendlyname - if (in_array($sField, $aFriendlynameAttcodes)) - { + if (in_array($sField, $aFriendlynameAttcodes)) { $bIndexNeeded = true; } - } - else - { - if ($oAttDef->RequiresFullTextIndex()) - { + } else { + if ($oAttDef->RequiresFullTextIndex()) { $bFullTextIndexNeeded = true; } } $sFieldDefinition = "`$sField` $sDBFieldSpec"; - if (!CMDBSource::IsField($sTable, $sField)) - { + if (!CMDBSource::IsField($sTable, $sField)) { $aErrors[$sClass][$sAttCode][] = "field '$sField' could not be found in table '$sTable'"; $aSugFix[$sClass][$sAttCode][] = "ALTER TABLE `$sTable` ADD $sFieldDefinition"; - if ($bTableToCreate) - { + if ($bTableToCreate) { $aCreateTableItems[$sTable][$sField] = $sFieldDefinition; - } - else - { + } else { $aAlterTableItems[$sTable]['field'][$sField] = "ADD $sFieldDefinition"; $aAdditionalRequests = self::GetAdditionalRequestAfterAlter($sClass, $sTable, $sField); - if (!empty($aAdditionalRequests)) - { - foreach ($aAdditionalRequests as $sAdditionalRequest) - { + if (!empty($aAdditionalRequests)) { + foreach ($aAdditionalRequests as $sAdditionalRequest) { $aPostTableAlteration[$sTable][] = $sAdditionalRequest; } } } - if ($bIndexNeeded) - { + if ($bIndexNeeded) { $aTableInfo['Indexes'][$sField]['used'] = true; $sIndexName = $sField; $sColumns = '`'.$sField.'`'; - if ($bFullTextIndexNeeded) - { + if ($bFullTextIndexNeeded) { $sIndexType = 'FULLTEXT INDEX'; - } - else - { + } else { $sIndexType = 'INDEX'; - $aColumns = array($sField); + $aColumns = [$sField]; $aLength = self::DBGetIndexesLength($sClass, $aColumns, $aTableInfo); - if (!is_null($aLength[0])) - { + if (!is_null($aLength[0])) { $sColumns .= ' ('.$aLength[0].')'; } } $sSugFix = "ALTER TABLE `$sTable` ADD $sIndexType `$sIndexName` ($sColumns)"; $aSugFix[$sClass][$sAttCode][] = $sSugFix; - if ($bFullTextIndexNeeded) - { + if ($bFullTextIndexNeeded) { // MySQL does not support multi fulltext index creation in a single query (mysql_errno = 1795) $aPostTableAlteration[$sTable][] = $sSugFix; - } - elseif ($bTableToCreate) - { + } elseif ($bTableToCreate) { $aCreateTableItems[$sTable][] = "$sIndexType `$sIndexName` ($sColumns)"; - } - else - { + } else { $aAlterTableItems[$sTable]['index'][] = "ADD $sIndexType `$sIndexName` ($sColumns)"; } } - } - else - { + } else { // Create indexes (external keys only... so far) // (drop before change, add after change) $sSugFixAfterChange = ''; $sAlterTableItemsAfterChange = ''; - if ($bIndexNeeded) - { + if ($bIndexNeeded) { $aTableInfo['Indexes'][$sField]['used'] = true; - if ($bFullTextIndexNeeded) - { + if ($bFullTextIndexNeeded) { $sIndexType = 'FULLTEXT INDEX'; $aColumns = null; $aLength = null; - } - else - { + } else { $sIndexType = 'INDEX'; - $aColumns = array($sField); + $aColumns = [$sField]; $aLength = self::DBGetIndexesLength($sClass, $aColumns, $aTableInfo); } - if (!CMDBSource::HasIndex($sTable, $sField, $aColumns, $aLength)) - { + if (!CMDBSource::HasIndex($sTable, $sField, $aColumns, $aLength)) { $sIndexName = $sField; $sColumns = '`'.$sField.'`'; - if (isset($aLength[0])) - { + if (isset($aLength[0])) { $sColumns .= ' ('.$aLength[0].')'; } $aErrors[$sClass][$sAttCode][] = "Foreign key '$sField' in table '$sTable' should have an index"; - if (CMDBSource::HasIndex($sTable, $sField)) - { + if (CMDBSource::HasIndex($sTable, $sField)) { $aSugFix[$sClass][$sAttCode][] = "ALTER TABLE `$sTable` DROP INDEX `$sIndexName`"; $aAlterTableItems[$sTable]['index'][] = "DROP INDEX `$sIndexName`"; } @@ -5654,8 +5178,7 @@ abstract class MetaModel // The field already exists, does it have the relevant properties? // $sActualFieldSpec = CMDBSource::GetFieldSpec($sTable, $sField); - if (!CMDBSource::IsSameFieldTypes($sDBFieldSpec, $sActualFieldSpec)) - { + if (!CMDBSource::IsSameFieldTypes($sDBFieldSpec, $sActualFieldSpec)) { $aErrors[$sClass][$sAttCode][] = "field '$sField' in table '$sTable' has a wrong type: found $sActualFieldSpec while expecting $sDBFieldSpec"; $aSugFix[$sClass][$sAttCode][] = "ALTER TABLE `$sTable` CHANGE `$sField` $sFieldDefinition"; $aAlterTableItems[$sTable]['field'][$sField] = "CHANGE `$sField` $sFieldDefinition"; @@ -5663,16 +5186,12 @@ abstract class MetaModel // Create indexes (external keys only... so far) // - if (!empty($sSugFixAfterChange)) - { + if (!empty($sSugFixAfterChange)) { $aSugFix[$sClass][$sAttCode][] = $sSugFixAfterChange; - if ($bFullTextIndexNeeded) - { + if ($bFullTextIndexNeeded) { // MySQL does not support multi fulltext index creation in a single query (mysql_errno = 1795) $aPostTableAlteration[$sTable][] = $sSugFixAfterChange; - } - else - { + } else { $aAlterTableItems[$sTable]['index'][] = $sAlterTableItemsAfterChange; } } @@ -5681,60 +5200,45 @@ abstract class MetaModel } // Check indexes - foreach(self::DBGetIndexes($sClass) as $aColumns) - { + foreach (self::DBGetIndexes($sClass) as $aColumns) { $sIndexId = implode('_', $aColumns); - if (isset($aTableInfo['Indexes'][$sIndexId]['used']) && $aTableInfo['Indexes'][$sIndexId]['used']) - { + if (isset($aTableInfo['Indexes'][$sIndexId]['used']) && $aTableInfo['Indexes'][$sIndexId]['used']) { continue; } $aLength = self::DBGetIndexesLength($sClass, $aColumns, $aTableInfo); $aTableInfo['Indexes'][$sIndexId]['used'] = true; - if (!CMDBSource::HasIndex($sTable, $sIndexId, $aColumns, $aLength)) - { + if (!CMDBSource::HasIndex($sTable, $sIndexId, $aColumns, $aLength)) { $sColumns = ''; - for ($i = 0; $i < count($aColumns); $i++) - { - if (!empty($sColumns)) - { + for ($i = 0; $i < count($aColumns); $i++) { + if (!empty($sColumns)) { $sColumns .= ', '; } $sColumns .= '`'.$aColumns[$i].'`'; - if (!is_null($aLength[$i])) - { + if (!is_null($aLength[$i])) { $sColumns .= ' ('.$aLength[$i].')'; } } - if (CMDBSource::HasIndex($sTable, $sIndexId)) - { + if (CMDBSource::HasIndex($sTable, $sIndexId)) { $aErrors[$sClass]['*'][] = "Wrong index '$sIndexId' ($sColumns) in table '$sTable'"; $aSugFix[$sClass]['*First'][] = "ALTER TABLE `$sTable` DROP INDEX `$sIndexId`"; $aSugFix[$sClass]['*'][] = "ALTER TABLE `$sTable` ADD INDEX `$sIndexId` ($sColumns)"; - } - else - { + } else { $aErrors[$sClass]['*'][] = "Missing index '$sIndexId' ($sColumns) in table '$sTable'"; $aSugFix[$sClass]['*'][] = "ALTER TABLE `$sTable` ADD INDEX `$sIndexId` ($sColumns)"; } - if ($bTableToCreate) - { + if ($bTableToCreate) { $aCreateTableItems[$sTable][] = "INDEX `$sIndexId` ($sColumns)"; - } - else - { - if (CMDBSource::HasIndex($sTable, $sIndexId)) - { + } else { + if (CMDBSource::HasIndex($sTable, $sIndexId)) { // Add the drop before CHARSET alteration - if (!isset($aAlterTableItems[$sTable])) - { - $aAlterTableItems[$sTable] = array(); + if (!isset($aAlterTableItems[$sTable])) { + $aAlterTableItems[$sTable] = []; } - if (isset($aAlterTableItems[$sTable]['index'])) - { + if (isset($aAlterTableItems[$sTable]['index'])) { array_unshift($aAlterTableItems[$sTable]['index'], "DROP INDEX `$sIndexId`"); } } @@ -5745,13 +5249,10 @@ abstract class MetaModel // Find out unused columns // - foreach($aTableInfo['Fields'] as $sField => $aFieldData) - { - if (!isset($aFieldData['used']) || !$aFieldData['used']) - { + foreach ($aTableInfo['Fields'] as $sField => $aFieldData) { + if (!isset($aFieldData['used']) || !$aFieldData['used']) { $aErrors[$sClass]['*'][] = "Column '$sField' in table '$sTable' is not used"; - if (!CMDBSource::IsNullAllowed($sTable, $sField)) - { + if (!CMDBSource::IsNullAllowed($sTable, $sField)) { // Allow null values so that new record can be inserted // without specifying the value of this unknown column $sFieldDefinition = "`$sField` ".CMDBSource::GetFieldType($sTable, $sField).' NULL'; @@ -5764,86 +5265,71 @@ abstract class MetaModel // Find out unused indexes // - foreach($aTableInfo['Indexes'] as $sIndexId => $aIndexData) - { - if (!isset($aIndexData['used']) || !$aIndexData['used']) - { + foreach ($aTableInfo['Indexes'] as $sIndexId => $aIndexData) { + if (!isset($aIndexData['used']) || !$aIndexData['used']) { $aErrors[$sClass]['*'][] = "Index '$sIndexId' in table '$sTable' is not used and will be removed"; $aSugFix[$sClass]['*First'][] = "ALTER TABLE `$sTable` DROP INDEX `$sIndexId`"; // Add the drop before CHARSET alteration - if (!isset($aAlterTableItems[$sTable])) - { - $aAlterTableItems[$sTable] = array(); + if (!isset($aAlterTableItems[$sTable])) { + $aAlterTableItems[$sTable] = []; } - if (isset($aAlterTableItems[$sTable]['index'])) - { + if (isset($aAlterTableItems[$sTable]['index'])) { array_unshift($aAlterTableItems[$sTable]['index'], "DROP INDEX `$sIndexId`"); } } } - if (empty($aSugFix[$sClass]['*First'])) unset($aSugFix[$sClass]['*First']); + if (empty($aSugFix[$sClass]['*First'])) { + unset($aSugFix[$sClass]['*First']); + } } - $aCondensedQueries = array(); - if (!empty($sAlterDBMetaData)) - { + $aCondensedQueries = []; + if (!empty($sAlterDBMetaData)) { $aCondensedQueries[] = $sAlterDBMetaData; } - foreach($aCreateTable as $sTable => $sTableOptions) - { + foreach ($aCreateTable as $sTable => $sTableOptions) { $sTableItems = implode(', ', $aCreateTableItems[$sTable]); $aCondensedQueries[] = "CREATE TABLE `$sTable` ($sTableItems) $sTableOptions"; // Add request right after the CREATE TABLE - if (isset($aPostTableAlteration[$sTable])) - { - foreach ($aPostTableAlteration[$sTable] as $sQuery) - { + if (isset($aPostTableAlteration[$sTable])) { + foreach ($aPostTableAlteration[$sTable] as $sQuery) { $aCondensedQueries[] = $sQuery; } unset($aPostTableAlteration[$sTable]); } } - foreach ($aAlterTableMetaData as $sTableAlterQuery) - { + foreach ($aAlterTableMetaData as $sTableAlterQuery) { $aCondensedQueries[] = $sTableAlterQuery; } - foreach ($aAlterTableItems as $sTable => $aChangeList) - { - if (isset($aAlterTableItems[$sTable]['field'])) - { + foreach ($aAlterTableItems as $sTable => $aChangeList) { + if (isset($aAlterTableItems[$sTable]['field'])) { $sChangeList = implode(', ', $aChangeList['field']); $aCondensedQueries[] = "ALTER TABLE `$sTable` $sChangeList"; } - if (isset($aAlterTableItems[$sTable]['index'])) - { + if (isset($aAlterTableItems[$sTable]['index'])) { $sChangeList = implode(', ', $aChangeList['index']); $aCondensedQueries[] = "ALTER TABLE `$sTable` $sChangeList"; } // Add request right after the ALTER TABLE - if (isset($aPostTableAlteration[$sTable])) - { - foreach ($aPostTableAlteration[$sTable] as $sQuery) - { + if (isset($aPostTableAlteration[$sTable])) { + foreach ($aPostTableAlteration[$sTable] as $sQuery) { $aCondensedQueries[] = $sQuery; } unset($aPostTableAlteration[$sTable]); - } + } } // Add alterations not yet managed - foreach ($aPostTableAlteration as $aQueries) - { - foreach ($aQueries as $sQuery) - { + foreach ($aPostTableAlteration as $aQueries) { + foreach ($aQueries as $sQuery) { $aCondensedQueries[] = $sQuery; } } - return array($aErrors, $aSugFix, $aCondensedQueries); + return [$aErrors, $aSugFix, $aCondensedQueries]; } - /** * @deprecated 2.7.0 N°2369 Method will not be removed any time soon as we still need to drop view if the instance is migrating from an iTop 2.x to an iTop 3.0 or newer, even if they skip iTop 3.0. * @since 3.0.0 Does not recreate SQL views, only drops them. Method has not been renamed to avoid regressions @@ -5855,23 +5341,21 @@ abstract class MetaModel */ public static function DBCheckViews() { - $aErrors = array(); - $aSugFix = array(); + $aErrors = []; + $aSugFix = []; // Reporting views (must be created after any other table) // - foreach(self::GetClasses() as $sClass) - { + foreach (self::GetClasses() as $sClass) { $sView = self::DBGetView($sClass); - if (CMDBSource::IsTable($sView)) - { + if (CMDBSource::IsTable($sView)) { // Remove deprecated views $aErrors[$sClass]['*'][] = "Remove view '$sView' (deprecated, consider installing combodo-views if needed)"; $aSugFix[$sClass]['*'][] = "DROP VIEW `$sView`"; } } - return array($aErrors, $aSugFix); + return [$aErrors, $aSugFix]; } /** @@ -5891,31 +5375,24 @@ abstract class MetaModel $sTable = self::DBGetTable($sClass); $sKeyField = self::DBGetKey($sClass); - if (array_key_exists($sTable, $aPlannedDel) && count($aPlannedDel[$sTable]) > 0) - { + if (array_key_exists($sTable, $aPlannedDel) && count($aPlannedDel[$sTable]) > 0) { $sSelWrongRecs .= " AND maintable.`$sKeyField` NOT IN ('".implode("', '", $aPlannedDel[$sTable])."')"; } $aWrongRecords = CMDBSource::QueryToCol($sSelWrongRecs, "id"); - if (count($aWrongRecords) == 0) - { + if (count($aWrongRecords) == 0) { return; } - if (!array_key_exists($sRootClass, $aErrorsAndFixes)) - { - $aErrorsAndFixes[$sRootClass] = array(); + if (!array_key_exists($sRootClass, $aErrorsAndFixes)) { + $aErrorsAndFixes[$sRootClass] = []; } - if (!array_key_exists($sTable, $aErrorsAndFixes[$sRootClass])) - { - $aErrorsAndFixes[$sRootClass][$sTable] = array(); + if (!array_key_exists($sTable, $aErrorsAndFixes[$sRootClass])) { + $aErrorsAndFixes[$sRootClass][$sTable] = []; } - foreach($aWrongRecords as $iRecordId) - { - if (array_key_exists($iRecordId, $aErrorsAndFixes[$sRootClass][$sTable])) - { - switch ($aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action']) - { + foreach ($aWrongRecords as $iRecordId) { + if (array_key_exists($iRecordId, $aErrorsAndFixes[$sRootClass][$sTable])) { + switch ($aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action']) { case 'Delete': // Already planned for a deletion // Let's concatenate the errors description together @@ -5926,48 +5403,46 @@ abstract class MetaModel // Let's plan a deletion break; } - } - else - { + } else { $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Reason'] = $sErrorDesc; } - if (!$bProcessingFriends) - { - if (!array_key_exists($sTable, $aPlannedDel) || !in_array($iRecordId, $aPlannedDel[$sTable])) - { + if (!$bProcessingFriends) { + if (!array_key_exists($sTable, $aPlannedDel) || !in_array($iRecordId, $aPlannedDel[$sTable])) { // Something new to be deleted... $iNewDelCount++; } } $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action'] = 'Delete'; - $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action_Details'] = array(); + $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action_Details'] = []; $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Pass'] = 123; $aPlannedDel[$sTable][] = $iRecordId; } // Now make sure that we would delete the records of the other tables for that class // - if (!$bProcessingFriends) - { + if (!$bProcessingFriends) { $sDeleteKeys = "'".implode("', '", $aWrongRecords)."'"; - foreach(self::EnumChildClasses($sRootClass, ENUM_CHILD_CLASSES_ALL) as $sFriendClass) - { + foreach (self::EnumChildClasses($sRootClass, ENUM_CHILD_CLASSES_ALL) as $sFriendClass) { $sFriendTable = self::DBGetTable($sFriendClass); $sFriendKey = self::DBGetKey($sFriendClass); // skip the current table - if ($sFriendTable == $sTable) - { + if ($sFriendTable == $sTable) { continue; } $sFindRelatedRec = "SELECT DISTINCT maintable.`$sFriendKey` AS id FROM `$sFriendTable` AS maintable WHERE maintable.`$sFriendKey` IN ($sDeleteKeys)"; - self::DBCheckIntegrity_Check2Delete($sFindRelatedRec, - "Cascading deletion of record in friend table `$sTable`", $sFriendClass, $aErrorsAndFixes, - $iNewDelCount, $aPlannedDel, - true); + self::DBCheckIntegrity_Check2Delete( + $sFindRelatedRec, + "Cascading deletion of record in friend table `$sTable`", + $sFriendClass, + $aErrorsAndFixes, + $iNewDelCount, + $aPlannedDel, + true + ); } } } @@ -5990,63 +5465,51 @@ abstract class MetaModel $sTable = self::DBGetTable($sClass); $sKeyField = self::DBGetKey($sClass); - if (array_key_exists($sTable, $aPlannedDel) && count($aPlannedDel[$sTable]) > 0) - { + if (array_key_exists($sTable, $aPlannedDel) && count($aPlannedDel[$sTable]) > 0) { $sSelWrongRecs .= " AND maintable.`$sKeyField` NOT IN ('".implode("', '", $aPlannedDel[$sTable])."')"; } $aWrongRecords = CMDBSource::QueryToCol($sSelWrongRecs, "id"); - if (count($aWrongRecords) == 0) - { + if (count($aWrongRecords) == 0) { return; } - if (!array_key_exists($sRootClass, $aErrorsAndFixes)) - { - $aErrorsAndFixes[$sRootClass] = array(); + if (!array_key_exists($sRootClass, $aErrorsAndFixes)) { + $aErrorsAndFixes[$sRootClass] = []; } - if (!array_key_exists($sTable, $aErrorsAndFixes[$sRootClass])) - { - $aErrorsAndFixes[$sRootClass][$sTable] = array(); + if (!array_key_exists($sTable, $aErrorsAndFixes[$sRootClass])) { + $aErrorsAndFixes[$sRootClass][$sTable] = []; } - foreach($aWrongRecords as $iRecordId) - { - if (array_key_exists($iRecordId, $aErrorsAndFixes[$sRootClass][$sTable])) - { + foreach ($aWrongRecords as $iRecordId) { + if (array_key_exists($iRecordId, $aErrorsAndFixes[$sRootClass][$sTable])) { $sAction = $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action']; //if ($sAction == 'Delete') //{ - // No need to update, the record will be deleted! + // No need to update, the record will be deleted! //} - if ($sAction == 'Update') - { + if ($sAction == 'Update') { // Already planned for an update // Add this new update spec to the list $bFoundSameSpec = false; - foreach ($aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action_Details'] as $aUpdateSpec) - { - if (($sColumn == $aUpdateSpec['column']) && ($sNewValue == $aUpdateSpec['newvalue'])) - { + foreach ($aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action_Details'] as $aUpdateSpec) { + if (($sColumn == $aUpdateSpec['column']) && ($sNewValue == $aUpdateSpec['newvalue'])) { $bFoundSameSpec = true; } } - if (!$bFoundSameSpec) - { - $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action_Details'][] = (array( + if (!$bFoundSameSpec) { + $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action_Details'][] = ([ 'column' => $sColumn, - 'newvalue' => $sNewValue - )); + 'newvalue' => $sNewValue, + ]); $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Reason'] .= ', '.$sErrorDesc; } } - } - else - { + } else { $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Reason'] = $sErrorDesc; $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action'] = 'Update'; - $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action_Details'] = array(array('column' => $sColumn, 'newvalue' => $sNewValue)); + $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Action_Details'] = [['column' => $sColumn, 'newvalue' => $sNewValue]]; $aErrorsAndFixes[$sRootClass][$sTable][$iRecordId]['Pass'] = 123; } @@ -6063,20 +5526,16 @@ abstract class MetaModel */ public static function DBCheckIntegrity_SinglePass(&$aErrorsAndFixes, &$iNewDelCount, &$aPlannedDel) { - foreach(self::GetClasses() as $sClass) - { - if (!self::HasTable($sClass)) - { + foreach (self::GetClasses() as $sClass) { + if (!self::HasTable($sClass)) { continue; } $sRootClass = self::GetRootClass($sClass); $sTable = self::DBGetTable($sClass); $sKeyField = self::DBGetKey($sClass); - if (!self::IsStandaloneClass($sClass)) - { - if (self::IsRootClass($sClass)) - { + if (!self::IsStandaloneClass($sClass)) { + if (self::IsRootClass($sClass)) { // Check that the final class field contains the name of a class which inherited from the current class // $sFinalClassField = self::DBGetClassField($sClass); @@ -6086,9 +5545,7 @@ abstract class MetaModel $sSelWrongRecs = "SELECT DISTINCT maintable.`$sKeyField` AS id FROM `$sTable` AS maintable WHERE `$sFinalClassField` NOT IN ($sAllowedValues)"; self::DBCheckIntegrity_Check2Delete($sSelWrongRecs, "final class (field `$sFinalClassField`) is wrong (expected a value in {".$sAllowedValues."})", $sClass, $aErrorsAndFixes, $iNewDelCount, $aPlannedDel); - } - else - { + } else { $sRootTable = self::DBGetTable($sRootClass); $sRootKey = self::DBGetKey($sRootClass); $sFinalClassField = self::DBGetClassField($sRootClass); @@ -6110,16 +5567,13 @@ abstract class MetaModel } } - foreach(self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { + foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { // Skip this attribute if not defined in this table - if (self::$m_aAttribOrigins[$sClass][$sAttCode] != $sClass) - { + if (self::$m_aAttribOrigins[$sClass][$sAttCode] != $sClass) { continue; } - if ($oAttDef->IsExternalKey()) - { + if ($oAttDef->IsExternalKey()) { // Check that any external field is pointing to an existing object // $sRemoteClass = $oAttDef->GetTargetClass(); @@ -6133,46 +5587,35 @@ abstract class MetaModel $sSelBase = "SELECT DISTINCT maintable.`$sKeyField` AS id, maintable.`$sExtKeyField` AS extkey FROM `$sTable` AS maintable LEFT JOIN `$sRemoteTable` ON maintable.`$sExtKeyField` = `$sRemoteTable`.`$sRemoteKey`"; $sSelWrongRecs = $sSelBase." WHERE `$sRemoteTable`.`$sRemoteKey` IS NULL"; - if ($oAttDef->IsNullAllowed()) - { + if ($oAttDef->IsNullAllowed()) { // Exclude the records pointing to 0/null from the errors $sSelWrongRecs .= " AND maintable.`$sExtKeyField` IS NOT NULL"; $sSelWrongRecs .= " AND maintable.`$sExtKeyField` != 0"; self::DBCheckIntegrity_Check2Update($sSelWrongRecs, "Record pointing to (external key '$sAttCode') non existing objects", $sExtKeyField, 'null', $sClass, $aErrorsAndFixes, $iNewDelCount, $aPlannedDel); - } - else - { + } else { self::DBCheckIntegrity_Check2Delete($sSelWrongRecs, "Record pointing to (external key '$sAttCode') non existing objects", $sClass, $aErrorsAndFixes, $iNewDelCount, $aPlannedDel); } // Do almost the same, taking into account the records planned for deletion - if (array_key_exists($sRemoteTable, $aPlannedDel) && count($aPlannedDel[$sRemoteTable]) > 0) - { + if (array_key_exists($sRemoteTable, $aPlannedDel) && count($aPlannedDel[$sRemoteTable]) > 0) { // This could be done by the mean of a 'OR ... IN (aIgnoreRecords) // but in that case you won't be able to track the root cause (cascading) $sSelWrongRecs = $sSelBase." WHERE maintable.`$sExtKeyField` IN ('".implode("', '", $aPlannedDel[$sRemoteTable])."')"; - if ($oAttDef->IsNullAllowed()) - { + if ($oAttDef->IsNullAllowed()) { // Exclude the records pointing to 0/null from the errors $sSelWrongRecs .= " AND maintable.`$sExtKeyField` IS NOT NULL"; $sSelWrongRecs .= " AND maintable.`$sExtKeyField` != 0"; self::DBCheckIntegrity_Check2Update($sSelWrongRecs, "Record pointing to (external key '$sAttCode') a record planned for deletion", $sExtKeyField, 'null', $sClass, $aErrorsAndFixes, $iNewDelCount, $aPlannedDel); - } - else - { + } else { self::DBCheckIntegrity_Check2Delete($sSelWrongRecs, "Record pointing to (external key '$sAttCode') a record planned for deletion", $sClass, $aErrorsAndFixes, $iNewDelCount, $aPlannedDel); } } - } - else - { - if ($oAttDef->IsBasedOnDBColumns()) - { + } else { + if ($oAttDef->IsBasedOnDBColumns()) { // Check that the values fit the allowed values // $aAllowedValues = self::GetAllowedValues_att($sClass, $sAttCode); - if (!is_null($aAllowedValues) && count($aAllowedValues) > 0) - { + if (!is_null($aAllowedValues) && count($aAllowedValues) > 0) { $sExpectedValues = implode(",", CMDBSource::Quote(array_keys($aAllowedValues), true)); $aCols = $oAttDef->GetSQLExpressions(); // Workaround a PHP bug: sometimes issuing a Notice if invoking current(somefunc()) @@ -6199,11 +5642,11 @@ abstract class MetaModel { // Records in error, and action to be taken: delete or update // by RootClass/Table/Record - $aErrorsAndFixes = array(); + $aErrorsAndFixes = []; // Records to be ignored in the current/next pass // by Table = array of RecordId - $aPlannedDel = array(); + $aPlannedDel = []; // Count of errors in the next pass: no error means that we can leave... $iErrorCount = 0; @@ -6211,8 +5654,7 @@ abstract class MetaModel $iLoopCount = 0; $iNewDelCount = 1; // startup... - while ($iNewDelCount > 0) - { + while ($iNewDelCount > 0) { $iNewDelCount = 0; self::DBCheckIntegrity_SinglePass($aErrorsAndFixes, $iNewDelCount, $aPlannedDel); $iErrorCount += $iNewDelCount; @@ -6221,20 +5663,17 @@ abstract class MetaModel // $iMaxDel = 1000; $iPlannedDel = 0; - foreach($aPlannedDel as $sTable => $aPlannedDelOnTable) - { + foreach ($aPlannedDel as $sTable => $aPlannedDelOnTable) { $iPlannedDel += count($aPlannedDelOnTable); } - if ($iPlannedDel > $iMaxDel) - { + if ($iPlannedDel > $iMaxDel) { throw new CoreWarning("DB Integrity Check safety net - Exceeding the limit of $iMaxDel planned record deletion"); } // Safety net #2 - limit the iterations // $iLoopCount++; $iMaxLoops = 10; - if ($iLoopCount > $iMaxLoops) - { + if ($iLoopCount > $iMaxLoops) { throw new CoreWarning("DB Integrity Check safety net - Reached the limit of $iMaxLoops loops"); } } @@ -6242,29 +5681,24 @@ abstract class MetaModel // Display the results // $iIssueCount = 0; - $aFixesDelete = array(); - $aFixesUpdate = array(); + $aFixesDelete = []; + $aFixesUpdate = []; - foreach($aErrorsAndFixes as $sRootClass => $aTables) - { - foreach($aTables as $sTable => $aRecords) - { - foreach($aRecords as $iRecord => $aError) - { + foreach ($aErrorsAndFixes as $sRootClass => $aTables) { + foreach ($aTables as $sTable => $aRecords) { + foreach ($aRecords as $iRecord => $aError) { $sAction = $aError['Action']; $sReason = $aError['Reason']; - switch ($sAction) - { + switch ($sAction) { case 'Delete': $sActionDetails = ""; $aFixesDelete[$sTable][] = $iRecord; break; case 'Update': - $aUpdateDesc = array(); - foreach($aError['Action_Details'] as $aUpdateSpec) - { + $aUpdateDesc = []; + foreach ($aError['Action_Details'] as $aUpdateSpec) { $aUpdateDesc[] = $aUpdateSpec['column']." -> ".$aUpdateSpec['newvalue']; $aFixesUpdate[$sTable][$aUpdateSpec['column']][$aUpdateSpec['newvalue']][] = $iRecord; } @@ -6281,17 +5715,14 @@ abstract class MetaModel } } - if ($iIssueCount > 0) - { + if ($iIssueCount > 0) { // Build the queries to fix in the database // // First step, be able to get class data out of the table name // Could be optimized, because we've made the job earlier... but few benefits, so... - $aTable2ClassProp = array(); - foreach(self::GetClasses() as $sClass) - { - if (!self::HasTable($sClass)) - { + $aTable2ClassProp = []; + foreach (self::GetClasses() as $sClass) { + if (!self::HasTable($sClass)) { continue; } @@ -6299,18 +5730,15 @@ abstract class MetaModel $sTable = self::DBGetTable($sClass); $sKeyField = self::DBGetKey($sClass); - $aErrorsAndFixes[$sRootClass][$sTable] = array(); - $aTable2ClassProp[$sTable] = array('rootclass' => $sRootClass, 'class' => $sClass, 'keyfield' => $sKeyField); + $aErrorsAndFixes[$sRootClass][$sTable] = []; + $aTable2ClassProp[$sTable] = ['rootclass' => $sRootClass, 'class' => $sClass, 'keyfield' => $sKeyField]; } // Second step, build a flat list of SQL queries - $aSQLFixes = array(); + $aSQLFixes = []; $iPlannedUpdate = 0; - foreach($aFixesUpdate as $sTable => $aColumns) - { - foreach($aColumns as $sColumn => $aNewValues) - { - foreach($aNewValues as $sNewValue => $aRecords) - { + foreach ($aFixesUpdate as $sTable => $aColumns) { + foreach ($aColumns as $sColumn => $aNewValues) { + foreach ($aNewValues as $sNewValue => $aRecords) { $iPlannedUpdate += count($aRecords); $sWrongRecords = "'".implode("', '", $aRecords)."'"; $sKeyField = $aTable2ClassProp[$sTable]['keyfield']; @@ -6320,8 +5748,7 @@ abstract class MetaModel } } $iPlannedDel = 0; - foreach($aFixesDelete as $sTable => $aRecords) - { + foreach ($aFixesDelete as $sTable => $aRecords) { $iPlannedDel += count($aRecords); $sWrongRecords = "'".implode("', '", $aRecords)."'"; $sKeyField = $aTable2ClassProp[$sTable]['keyfield']; @@ -6335,8 +5762,7 @@ abstract class MetaModel echo "

      Database corruption error(s): $iErrorCount issues have been encountered. $iPlannedDel records will be deleted, $iPlannedUpdate records will be updated:

      \n"; // #@# later -> this is the responsibility of the caller to format the output echo "
        \n"; - foreach($aIssues as $sIssueDesc) - { + foreach ($aIssues as $sIssueDesc) { echo "
      • $sIssueDesc
      • \n"; } echo "
      \n"; @@ -6395,8 +5821,7 @@ abstract class MetaModel } ExpressionCache::Warmup(); - } - finally { + } finally { // Event service must be initialized after the MetaModel startup, otherwise it cannot discover classes implementing the iEventServiceSetup interface EventService::InitService(); EventService::FireEvent(new EventData(ApplicationEvents::APPLICATION_EVENT_METAMODEL_STARTED)); @@ -6423,8 +5848,7 @@ abstract class MetaModel utils::SetConfig($oConfiguration); // Set log ASAP - if (self::$m_oConfig->GetLogGlobal()) - { + if (self::$m_oConfig->GetLogGlobal()) { if (self::$m_oConfig->GetLogIssue()) { self::$m_bLogIssue = true; IssueLog::Enable(APPROOT.'log/error.log'); @@ -6436,9 +5860,7 @@ abstract class MetaModel DeadLockLog::Enable(); DeprecatedCallsLog::Enable(); ExceptionLog::Enable(); - } - else - { + } else { self::$m_bLogIssue = false; self::$m_bLogNotification = false; self::$m_bLogWebService = false; @@ -6446,9 +5868,9 @@ abstract class MetaModel ExecutionKPI::EnableDuration(self::$m_oConfig->Get('log_kpi_duration')); ExecutionKPI::EnableMemory(self::$m_oConfig->Get('log_kpi_memory')); - ExecutionKPI::SetAllowedUser(self::$m_oConfig->Get('log_kpi_user_id')); - ExecutionKPI::SetGenerateLegacyReport(self::$m_oConfig->Get('log_kpi_generate_legacy_report')); - ExecutionKPI::SetSlowQueries(self::$m_oConfig->Get('log_kpi_slow_queries')); + ExecutionKPI::SetAllowedUser(self::$m_oConfig->Get('log_kpi_user_id')); + ExecutionKPI::SetGenerateLegacyReport(self::$m_oConfig->Get('log_kpi_generate_legacy_report')); + ExecutionKPI::SetSlowQueries(self::$m_oConfig->Get('log_kpi_slow_queries')); self::$m_bSkipCheckToWrite = self::$m_oConfig->Get('skip_check_to_write'); self::$m_bSkipCheckExtKeys = self::$m_oConfig->Get('skip_check_ext_keys'); @@ -6466,8 +5888,7 @@ abstract class MetaModel // Note: load the dictionary as soon as possible, because it might be // needed when some error occur $sAppIdentity = 'itop-'.MetaModel::GetEnvironmentId(); - if (self::$m_bUseAPCCache) - { + if (self::$m_bUseAPCCache) { Dict::EnableCache($sAppIdentity); } require_once(APPROOT.'env-'.self::$m_sEnvironment.'/dictionaries/languages.php'); @@ -6525,8 +5946,7 @@ abstract class MetaModel $oKPI->ComputeAndReport('Metamodel APC (fetch + read)'); } - if (count(self::$m_aAttribDefs) == 0) - { + if (count(self::$m_aAttribDefs) == 0) { // The includes have been included, let's browse the existing classes and // develop some data based on the proposed model $oKPI = new ExecutionKPI(); @@ -6534,11 +5954,10 @@ abstract class MetaModel self::InitClasses($sTablePrefix); $oKPI->ComputeAndReport('Initialization of Data model structures'); - if (self::$m_bUseAPCCache) - { + if (self::$m_bUseAPCCache) { $oKPI = new ExecutionKPI(); - $aCache = array(); + $aCache = []; $aCache['m_aExtensionClassNames'] = self::$m_aExtensionClassNames; $aCache['m_Category2Class'] = self::$m_Category2Class; $aCache['m_aRootClasses'] = self::$m_aRootClasses; // array of "classname" => "rootclass" @@ -6567,7 +5986,7 @@ abstract class MetaModel CMDBSource::InitFromConfig(self::$m_oConfig); // Later when timezone implementation is correctly done: CMDBSource::SetTimezone($sDBTimezone); - ExecutionKPI::InitStats(); + ExecutionKPI::InitStats(); } /** @@ -6592,8 +6011,7 @@ abstract class MetaModel public static function GetModuleParameter($sModule, $sProperty, $defaultvalue = null) { $value = $defaultvalue; - if (!self::$m_aModulesParameters[$sModule] == null) - { + if (!self::$m_aModulesParameters[$sModule] == null) { $value = self::$m_aModulesParameters[$sModule]->Get($sProperty, $defaultvalue); } return $value; @@ -6636,8 +6054,8 @@ abstract class MetaModel return md5(APPROOT).'-'.self::$m_sEnvironment; } - /** @var array */ - protected static $m_aExtensionClassNames = []; + /** @var array */ + protected static $m_aExtensionClassNames = []; /** * @param string $sToInclude @@ -6649,42 +6067,29 @@ abstract class MetaModel { $sFirstChar = substr($sToInclude, 0, 1); $sSecondChar = substr($sToInclude, 1, 1); - if (($sFirstChar != '/') && ($sFirstChar != '\\') && ($sSecondChar != ':')) - { + if (($sFirstChar != '/') && ($sFirstChar != '\\') && ($sSecondChar != ':')) { // It is a relative path, prepend APPROOT - if (substr($sToInclude, 0, 3) == '../') - { + if (substr($sToInclude, 0, 3) == '../') { // Preserve compatibility with config files written before 1.0.1 // Replace '../' by '/' $sFile = APPROOT.'/'.substr($sToInclude, 3); - } - else - { + } else { $sFile = APPROOT.'/'.$sToInclude; } - } - else - { + } else { // Leave as is - should be an absolute path $sFile = $sToInclude; } - if (!file_exists($sFile)) - { + if (!file_exists($sFile)) { $sConfigFile = self::$m_oConfig->GetLoadedFile(); - if ($sModuleType == null) - { + if ($sModuleType == null) { throw new CoreException("Include: unable to load the file '$sFile'"); - } - else - { - if (strlen($sConfigFile) > 0) - { - throw new CoreException('Include: wrong file name in configuration file', array('config file' => $sConfigFile, 'section' => $sModuleType, 'filename' => $sFile)); - } - else - { + } else { + if (strlen($sConfigFile) > 0) { + throw new CoreException('Include: wrong file name in configuration file', ['config file' => $sConfigFile, 'section' => $sModuleType, 'filename' => $sFile]); + } else { // The configuration is in memory only - throw new CoreException('Include: wrong file name in configuration file (in memory)', array('section' => $sModuleType, 'filename' => $sFile)); + throw new CoreException('Include: wrong file name in configuration file (in memory)', ['section' => $sModuleType, 'filename' => $sFile]); } } } @@ -6697,10 +6102,8 @@ abstract class MetaModel ob_start(); require_once($sFile); $sPreviousContent = ob_get_clean(); - if (self::$m_oConfig->Get('debug_report_spurious_chars')) - { - if ($sPreviousContent != '') - { + if (self::$m_oConfig->Get('debug_report_spurious_chars')) { + if ($sPreviousContent != '') { IssueLog::Error("Spurious characters injected by '$sFile'"); } } @@ -6710,19 +6113,18 @@ abstract class MetaModel // // /** @var array */ - private static $aQueryCacheGetObject = array(); + private static $aQueryCacheGetObject = []; /** @var array */ - private static $aQueryCacheGetObjectHits = array(); + private static $aQueryCacheGetObjectHits = []; /** * @return string */ public static function GetQueryCacheStatus() { - $aRes = array(); + $aRes = []; $iTotalHits = 0; - foreach(self::$aQueryCacheGetObjectHits as $sClassSign => $iHits) - { + foreach (self::$aQueryCacheGetObjectHits as $sClassSign => $iHits) { $aRes[] = "$sClassSign: $iHits"; $iTotalHits += $iHits; } @@ -6747,20 +6149,17 @@ abstract class MetaModel // Build the query cache signature // $sQuerySign = $sClass; - if ($bAllowAllData) - { + if ($bAllowAllData) { $sQuerySign .= '_all_'; } - if (is_array($aModifierProperties) && (count($aModifierProperties) > 0)) - { + if (is_array($aModifierProperties) && (count($aModifierProperties) > 0)) { array_multisort($aModifierProperties); $sModifierProperties = json_encode($aModifierProperties); $sQuerySign .= '_all_'.md5($sModifierProperties); } $sQuerySign .= utils::IsArchiveMode() ? '_arch_' : ''; - if (!array_key_exists($sQuerySign, self::$aQueryCacheGetObject)) - { + if (!array_key_exists($sQuerySign, self::$aQueryCacheGetObject)) { // NOTE: Quick and VERY dirty caching mechanism which relies on // the fact that the string '987654321' will never appear in the // standard query @@ -6768,27 +6167,21 @@ abstract class MetaModel // but this would slow down -by how much time?- the application $oFilter = new DBObjectSearch($sClass); $oFilter->AddCondition('id', 987654321, '='); - if ($aModifierProperties) - { - foreach($aModifierProperties as $sPluginClass => $aProperties) - { - foreach($aProperties as $sProperty => $value) - { + if ($aModifierProperties) { + foreach ($aModifierProperties as $sPluginClass => $aProperties) { + foreach ($aProperties as $sProperty => $value) { $oFilter->SetModifierProperty($sPluginClass, $sProperty, $value); } } } - if ($bAllowAllData) - { + if ($bAllowAllData) { $oFilter->AllowAllData(); } $oFilter->NoContextParameters(); $sSQL = $oFilter->MakeSelectQuery(); self::$aQueryCacheGetObject[$sQuerySign] = $sSQL; self::$aQueryCacheGetObjectHits[$sQuerySign] = 0; - } - else - { + } else { $sSQL = self::$aQueryCacheGetObject[$sQuerySign]; self::$aQueryCacheGetObjectHits[$sQuerySign] += 1; } @@ -6798,8 +6191,7 @@ abstract class MetaModel $aRow = CMDBSource::FetchArray($res); CMDBSource::FreeResult($res); - if ($bMustBeFound && empty($aRow)) - { + if ($bMustBeFound && empty($aRow)) { $sNotFoundErrorMessage = "No result for the single row query"; IssueLog::Info($sNotFoundErrorMessage, LogChannels::CMDB_SOURCE, [ 'class' => $sClass, @@ -6829,40 +6221,31 @@ abstract class MetaModel { self::_check_subclass($sClass); - if (strlen($sClassAlias) == 0) - { + if (strlen($sClassAlias) == 0) { $sClassAlias = $sClass; } // Compound objects: if available, get the final object class // - if (!array_key_exists($sClassAlias."finalclass", $aRow)) - { + if (!array_key_exists($sClassAlias."finalclass", $aRow)) { // Either this is a bug (forgot to specify a root class with a finalclass field // Or this is the expected behavior, because the object is not made of several tables - if (self::IsAbstract($sClass)) - { + if (self::IsAbstract($sClass)) { throw new CoreUnexpectedValue("Querying the abstract '$sClass' class without finalClass attribute"); } - if (self::HasChildrenClasses($sClass)) - { + if (self::HasChildrenClasses($sClass)) { throw new CoreUnexpectedValue("Querying the '$sClass' class without the finalClass attribute, whereas this class has children"); } - } - elseif (empty($aRow[$sClassAlias."finalclass"])) - { + } elseif (empty($aRow[$sClassAlias."finalclass"])) { // The data is missing in the DB // @#@ possible improvement: check that the class is valid ! $sRootClass = self::GetRootClass($sClass); $sFinalClassField = self::DBGetClassField($sRootClass); throw new CoreException("Empty class name for object $sClass::{$aRow["id"]} (root class '$sRootClass', field '{$sFinalClassField}' is empty)"); - } - else - { + } else { // do the job for the real target class - if (!class_exists($aRow[$sClassAlias."finalclass"])) - { - throw new CoreException("Class {$aRow[$sClassAlias."finalclass"]} derived from $sClass does not exist anymore, please remove corresponding tables in the database", array('row' => $aRow)); + if (!class_exists($aRow[$sClassAlias."finalclass"])) { + throw new CoreException("Class {$aRow[$sClassAlias."finalclass"]} derived from $sClass does not exist anymore, please remove corresponding tables in the database", ['row' => $aRow]); } $sClass = $aRow[$sClassAlias."finalclass"]; } @@ -6979,23 +6362,17 @@ abstract class MetaModel self::_check_subclass($sClass); utils::PushArchiveMode(true); - try - { + try { $aRow = self::MakeSingleRow($sClass, $iKey, $bMustBeFound, $bAllowAllData, $aModifierProperties); - } - catch(Exception $e) - { + } catch (Exception $e) { // In the finally block we will pop the pushed archived mode // otherwise the application stays in ArchiveMode true which has caused hazardious behavior! throw $e; - } - finally - { + } finally { utils::PopArchiveMode(); } - if (empty($aRow)) - { + if (empty($aRow)) { return null; } @@ -7017,11 +6394,9 @@ abstract class MetaModel $oObjSearch = new DBObjectSearch($sClass); $oObjSearch->AddNameCondition($sName); $oSet = new DBObjectSet($oObjSearch); - if ($oSet->Count() != 1) - { - if ($bMustBeFound) - { - throw new CoreException('Failed to get an object by its name', array('class' => $sClass, 'name' => $sName)); + if ($oSet->Count() != 1) { + if ($bMustBeFound) { + throw new CoreException('Failed to get an object by its name', ['class' => $sClass, 'name' => $sName]); } return null; } @@ -7030,7 +6405,7 @@ abstract class MetaModel } /** @var array */ - static protected $m_aCacheObjectByColumn = array(); + protected static $m_aCacheObjectByColumn = []; /** * @param string $sClass @@ -7059,15 +6434,11 @@ abstract class MetaModel $oObjSearch->AllowAllData($bAllowAllData); $oObjSearch->AddCondition($sAttCode, $value, '='); $oSet = new DBObjectSet($oObjSearch); - if ($oSet->Count() == 1) - { + if ($oSet->Count() == 1) { self::$m_aCacheObjectByColumn[$sClass][$sAttCode][$value] = $oSet->fetch(); - } - else - { - if ($bMustBeFoundUnique) - { - throw new CoreException('Failed to get an object by column', array('class' => $sClass, 'attcode' => $sAttCode, 'value' => $value, 'matches' => $oSet->Count())); + } else { + if ($bMustBeFoundUnique) { + throw new CoreException('Failed to get an object by column', ['class' => $sClass, 'attcode' => $sAttCode, 'value' => $value, 'matches' => $oSet->Count()]); } self::$m_aCacheObjectByColumn[$sClass][$sAttCode][$value] = null; } @@ -7087,8 +6458,7 @@ abstract class MetaModel public static function GetObjectFromOQL($sQuery, $aParams = null, $bAllowAllData = false) { $oFilter = DBObjectSearch::FromOQL($sQuery, $aParams); - if ($bAllowAllData) - { + if ($bAllowAllData) { $oFilter->AllowAllData(); } $oSet = new DBObjectSet($oFilter); @@ -7116,7 +6486,7 @@ abstract class MetaModel if (is_null($oObj)) { // Whatever we are looking for, the root class is the key to search for $sRootClass = self::GetRootClass($sTargetClass); - $oSearch = DBObjectSearch::FromOQL('SELECT CMDBChangeOpDelete WHERE objclass = :objclass AND objkey = :objkey', array('objclass' => $sRootClass, 'objkey' => $iKey)); + $oSearch = DBObjectSearch::FromOQL('SELECT CMDBChangeOpDelete WHERE objclass = :objclass AND objkey = :objkey', ['objclass' => $sRootClass, 'objkey' => $iKey]); $oSet = new DBObjectSet($oSearch); $oRecord = $oSet->Fetch(); // An empty fname is obtained with iTop < 2.0 @@ -7148,10 +6518,8 @@ abstract class MetaModel { self::_check_subclass($sClass); $oRet = new $sClass(); - if (is_array($aValues)) - { - foreach($aValues as $sAttCode => $value) - { + if (is_array($aValues)) { + foreach ($aValues as $sAttCode => $value) { $oRet->Set($sAttCode, $value); } } @@ -7201,7 +6569,7 @@ abstract class MetaModel while ($bExecuteQuery) { $oSet = new DBObjectSet($oFilter); $oSet->SetLimit($iMaxChunkSize); - $oSet->OptimizeColumnLoad(array($sTargetClass => array('finalclass'))); + $oSet->OptimizeColumnLoad([$sTargetClass => ['finalclass']]); $aIdToClass = $oSet->GetColumnAsArray('finalclass', true); $aIds = array_keys($aIdToClass); @@ -7245,11 +6613,9 @@ abstract class MetaModel self::_check_subclass($sClass); // 1-N links (referenced by my class), returns an array of sAttCode=>sClass - $aResult = array(); - foreach(self::$m_aAttribDefs[$sClass] as $sAttCode => $oAttDef) - { - if ($oAttDef->IsExternalKey()) - { + $aResult = []; + foreach (self::$m_aAttribDefs[$sClass] as $sAttCode => $oAttDef) { + if ($oAttDef->IsExternalKey()) { $aResult[$sAttCode] = $oAttDef->GetTargetClass(); } } @@ -7269,39 +6635,31 @@ abstract class MetaModel { self::_check_subclass($sClass); - if ($bSkipLinkingClasses) - { + if ($bSkipLinkingClasses) { $aLinksClasses = array_keys(self::GetLinkClasses()); } // 1-N links (referencing my class), array of sClass => array of sAttcode - $aResult = array(); - foreach(self::$m_aAttribDefs as $sSomeClass => $aClassAttributes) - { - if ($bSkipLinkingClasses && in_array($sSomeClass, $aLinksClasses)) - { + $aResult = []; + foreach (self::$m_aAttribDefs as $sSomeClass => $aClassAttributes) { + if ($bSkipLinkingClasses && in_array($sSomeClass, $aLinksClasses)) { continue; } - $aExtKeys = array(); - foreach($aClassAttributes as $sAttCode => $oAttDef) - { - if (self::$m_aAttribOrigins[$sSomeClass][$sAttCode] != $sSomeClass) - { + $aExtKeys = []; + foreach ($aClassAttributes as $sAttCode => $oAttDef) { + if (self::$m_aAttribOrigins[$sSomeClass][$sAttCode] != $sSomeClass) { continue; } - if ($oAttDef->IsExternalKey() && (self::IsParentClass($oAttDef->GetTargetClass(), $sClass))) - { - if ($bInnerJoinsOnly && $oAttDef->IsNullAllowed()) - { + if ($oAttDef->IsExternalKey() && (self::IsParentClass($oAttDef->GetTargetClass(), $sClass))) { + if ($bInnerJoinsOnly && $oAttDef->IsNullAllowed()) { continue; } // Ok, I want this one $aExtKeys[$sAttCode] = $oAttDef; } } - if (count($aExtKeys) != 0) - { + if (count($aExtKeys) != 0) { $aResult[$sSomeClass] = $aExtKeys; } } @@ -7331,11 +6689,11 @@ abstract class MetaModel */ public static function GetLinkClasses(): array { - $aRet = array(); - foreach(self::GetClasses() as $sClass) { + $aRet = []; + foreach (self::GetClasses() as $sClass) { if (self::IsLinkClass($sClass)) { - $aExtKeys = array(); - foreach(self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + $aExtKeys = []; + foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { if ($oAttDef->IsExternalKey()) { $aExtKeys[$sAttCode] = $oAttDef->GetTargetClass(); } @@ -7386,8 +6744,8 @@ abstract class MetaModel $aParams['APP_URL'] = utils::GetAbsoluteUrlAppRoot(); $aParams['MODULES_URL'] = utils::GetAbsoluteUrlModulesRoot(); - $aSearches = array(); - $aReplacements = array(); + $aSearches = []; + $aReplacements = []; foreach ($aParams as $sSearch => $replace) { // Some environment parameters are objects, we just need scalars if (is_object($replace)) { @@ -7399,10 +6757,10 @@ abstract class MetaModel // 1 - The delimiter // 2 - The arrow // 3 - The attribute code - $aRegExps = array( + $aRegExps = [ '/(\\$)'.$sName.'-(>|>)([^\\$]+)\\$/', // Support both syntaxes: $this->xxx$ or $this->xxx$ for HTML compatibility '/(%24)'.$sName.'-(>|>)([^%24]+)%24/', // Support for urlencoded in HTML attributes (%20this->xxx%20) - ); + ]; foreach ($aRegExps as $sRegExp) { if (preg_match_all($sRegExp, $sInput, $aMatches)) { foreach ($aMatches[3] as $idx => $sPlaceholderAttCode) { @@ -7412,8 +6770,7 @@ abstract class MetaModel $aReplacements[] = $sReplacement; $aSearches[] = $aMatches[1][$idx].$sName.'-'.$aMatches[2][$idx].$sPlaceholderAttCode.$aMatches[1][$idx]; } - } - catch (Exception $e) { + } catch (Exception $e) { $aContext = [ 'placeholder' => $sPlaceholderAttCode, 'replace class' => get_class($replace), @@ -7434,13 +6791,13 @@ abstract class MetaModel continue; // Ignore this non-scalar value } } else { - $aRegExps = array( + $aRegExps = [ '/(\$)'.$sSearch.'\$/', // Regular placeholders (eg. $APP_URL$) or placeholders with an arrow in plain text (eg. $foo->bar$) '/(%24)'.$sSearch.'%24/', // Regular placeholders url-encoded in HTML attributes (eg. %24APP_URL%24) '/(\$)'.utils::EscapeHtml($sSearch).'\$/', // Placeholders with an arrow in HTML (eg. $foo->bar$) '/(%24)'.utils::EscapeHtml($sSearch).'%24/', // Placeholders with an arrow url-encoded in HTML attributes (eg. %24->bar%24) - ); + ]; foreach ($aRegExps as $sRegExp) { if (preg_match_all($sRegExp, $sInput, $aMatches)) { foreach ($aMatches[1] as $idx => $sDelimiter) { @@ -7452,8 +6809,7 @@ abstract class MetaModel // With an arrow in HTML $aReplacements[] = (string) $replace; $aSearches[] = $aMatches[1][$idx].utils::EscapeHtml($sSearch).$aMatches[1][$idx]; - } - catch (Exception $e) { + } catch (Exception $e) { IssueLog::Debug( 'Invalid placeholder in notification, no replacement will occur !', LogChannels::NOTIFICATIONS, @@ -7507,21 +6863,17 @@ abstract class MetaModel */ public static function GetCacheEntries($sEnvironment = null) { - if (is_null($sEnvironment)) - { + if (is_null($sEnvironment)) { $sEnvironment = MetaModel::GetEnvironmentId(); } - $aEntries = array(); + $aEntries = []; $aCacheUserData = apc_cache_info_compat(); - if (is_array($aCacheUserData) && isset($aCacheUserData['cache_list'])) - { + if (is_array($aCacheUserData) && isset($aCacheUserData['cache_list'])) { $sPrefix = 'itop-'.$sEnvironment.'-'; - foreach($aCacheUserData['cache_list'] as $i => $aEntry) - { + foreach ($aCacheUserData['cache_list'] as $i => $aEntry) { $sEntryKey = array_key_exists('info', $aEntry) ? $aEntry['info'] : $aEntry['key']; - if (strpos($sEntryKey, $sPrefix) === 0) - { + if (strpos($sEntryKey, $sPrefix) === 0) { $sCleanKey = substr($sEntryKey, strlen($sPrefix)); $aEntries[$sCleanKey] = $aEntry; $aEntries[$sCleanKey]['info'] = $sEntryKey; @@ -7570,8 +6922,7 @@ abstract class MetaModel */ public static function ResetCache($sEnvironmentId = null) { - if (is_null($sEnvironmentId)) - { + if (is_null($sEnvironmentId)) { $sEnvironmentId = MetaModel::GetEnvironmentId(); } @@ -7579,10 +6930,8 @@ abstract class MetaModel require_once(APPROOT.'/core/dict.class.inc.php'); Dict::ResetCache($sAppIdentity); - if (function_exists('apc_delete')) - { - foreach(self::GetCacheEntries($sEnvironmentId) as $sKey => $aAPCInfo) - { + if (function_exists('apc_delete')) { + foreach (self::GetCacheEntries($sEnvironmentId) as $sKey => $aAPCInfo) { $sAPCKey = $aAPCInfo['info']; apc_delete($sAPCKey); } @@ -7592,8 +6941,7 @@ abstract class MetaModel UserRights::FlushPrivileges(); // Reset the opcache since otherwise the PHP "model" files may still be cached !! - if (function_exists('opcache_reset')) - { + if (function_exists('opcache_reset')) { // Zend opcode cache opcache_reset(); } @@ -7620,42 +6968,29 @@ abstract class MetaModel { $sRet = $sField; - if ($sField == 'id') - { + if ($sField == 'id') { $sRet = 'id'; - } - elseif ($sField == 'friendlyname') - { + } elseif ($sField == 'friendlyname') { $sFriendlyNameAttCode = static::GetFriendlyNameAttributeCode($sClass); - if (!is_null($sFriendlyNameAttCode)) - { + if (!is_null($sFriendlyNameAttCode)) { // The friendly name is made of a single attribute $sRet = $sFriendlyNameAttCode; } - } - else - { + } else { $oAttDef = static::GetAttributeDef($sClass, $sField); - if ($oAttDef->IsExternalField()) - { - if ($oAttDef->IsFriendlyName()) - { + if ($oAttDef->IsExternalField()) { + if ($oAttDef->IsFriendlyName()) { $oKeyAttDef = MetaModel::GetAttributeDef($sClass, $oAttDef->GetKeyAttCode()); $sRemoteClass = $oKeyAttDef->GetTargetClass(); $sFriendlyNameAttCode = static::GetFriendlyNameAttributeCode($sRemoteClass); - if (is_null($sFriendlyNameAttCode)) - { + if (is_null($sFriendlyNameAttCode)) { // The friendly name is made of several attributes $sRet = $oAttDef->GetKeyAttCode().'->friendlyname'; - } - else - { + } else { // The friendly name is made of a single attribute $sRet = $oAttDef->GetKeyAttCode().'->'.$sFriendlyNameAttCode; } - } - else - { + } else { $sRet = $oAttDef->GetKeyAttCode().'->'.$oAttDef->GetExtAttCode(); } } @@ -7665,11 +7000,10 @@ abstract class MetaModel private static function GetAdditionalRequestAfterAlter($sClass, $sTable, $sField) { - $aRequests = array(); + $aRequests = []; // Copy finalclass fields from root class to intermediate classes - if ($sField == self::DBGetClassField($sClass)) - { + if ($sField == self::DBGetClassField($sClass)) { $sRootClass = MetaModel::GetRootClass($sClass); $sRootTable = self::DBGetTable($sRootClass); $sKey = self::DBGetKey($sClass); @@ -7785,7 +7119,7 @@ abstract class MetaModel 'iNewsroomProvider', ]; foreach ($aInterfaces as $sInterface) { - self::$m_aExtensionClassNames[$sInterface] = array(); + self::$m_aExtensionClassNames[$sInterface] = []; } foreach (get_declared_classes() as $sPHPClass) { @@ -7800,15 +7134,14 @@ abstract class MetaModel } } - // Standard attribute lists -MetaModel::RegisterZList("noneditable", array("description" => "non editable fields", "type" => "attributes")); +MetaModel::RegisterZList("noneditable", ["description" => "non editable fields", "type" => "attributes"]); -MetaModel::RegisterZList("details", array("description" => "All attributes to be displayed for the 'details' of an object", "type" => "attributes")); -MetaModel::RegisterZList("summary", array("description" => "All attributes to be displayed for shorter 'details' of an object", "type" => "attributes")); -MetaModel::RegisterZList("list", array("description" => "All attributes to be displayed for a list of objects", "type" => "attributes")); -MetaModel::RegisterZList("preview", array("description" => "All attributes visible in preview mode", "type" => "attributes")); +MetaModel::RegisterZList("details", ["description" => "All attributes to be displayed for the 'details' of an object", "type" => "attributes"]); +MetaModel::RegisterZList("summary", ["description" => "All attributes to be displayed for shorter 'details' of an object", "type" => "attributes"]); +MetaModel::RegisterZList("list", ["description" => "All attributes to be displayed for a list of objects", "type" => "attributes"]); +MetaModel::RegisterZList("preview", ["description" => "All attributes visible in preview mode", "type" => "attributes"]); -MetaModel::RegisterZList("standard_search", array("description" => "List of criteria for the standard search", "type" => "filters")); -MetaModel::RegisterZList("advanced_search", array("description" => "List of criteria for the advanced search", "type" => "filters")); -MetaModel::RegisterZList("default_search", array("description" => "List of criteria displayed by default during search", "type" => "filters")); +MetaModel::RegisterZList("standard_search", ["description" => "List of criteria for the standard search", "type" => "filters"]); +MetaModel::RegisterZList("advanced_search", ["description" => "List of criteria for the advanced search", "type" => "filters"]); +MetaModel::RegisterZList("default_search", ["description" => "List of criteria displayed by default during search", "type" => "filters"]); diff --git a/core/metamodelmodifier.inc.php b/core/metamodelmodifier.inc.php index 5da53d262..1dcff60d8 100644 --- a/core/metamodelmodifier.inc.php +++ b/core/metamodelmodifier.inc.php @@ -1,9 +1,10 @@ - /** - * Any extension to hook the initialization of the metamodel + * Any extension to hook the initialization of the metamodel * * @copyright Copyright (C) 2010-2024 Combodo SAS * @license http://opensource.org/licenses/AGPL-3.0 @@ -28,5 +28,3 @@ interface iOnClassInitialization { public function OnAfterClassInitialization($sClass); } - -?> diff --git a/core/modelreflection.class.inc.php b/core/modelreflection.class.inc.php index 3ab1ed7cf..3e10c0bdd 100644 --- a/core/modelreflection.class.inc.php +++ b/core/modelreflection.class.inc.php @@ -1,9 +1,10 @@ - /** - * Reflection API for the MetaModel (partial) + * Reflection API for the MetaModel (partial) * * @copyright Copyright (C) 2024 Combodo SAS * @license http://opensource.org/licenses/AGPL-3.0 @@ -37,10 +37,9 @@ define('ENUM_CHILD_CLASSES_EXCLUDETOP', 1); */ define('ENUM_CHILD_CLASSES_ALL', 2); - abstract class ModelReflection { - abstract public function GetClassIcon($sClass, $bImgTag = true); + abstract public function GetClassIcon($sClass, $bImgTag = true); abstract public function IsValidAttCode($sClass, $sAttCode); abstract public function GetName($sClass); abstract public function GetLabel($sClass, $sAttCodeEx); @@ -70,9 +69,8 @@ abstract class ModelReflection $sLocalizedFormat = $this->DictString($sFormatCode); $aArguments = func_get_args(); array_shift($aArguments); - - if ($sLocalizedFormat == $sFormatCode) - { + + if ($sLocalizedFormat == $sFormatCode) { // Make sure the information will be displayed (ex: an error occuring before the dictionary gets loaded) return $sFormatCode.' - '.implode(', ', $aArguments); } @@ -88,7 +86,7 @@ abstract class ModelReflection * @return \RunTimeIconSelectionField */ abstract public function GetIconSelectionField($sCode, $sLabel = '', $defaultValue = ''); - + abstract public function GetRootClass($sClass); abstract public function EnumChildClasses($sClass, $iOption = ENUM_CHILD_CLASSES_EXCLUDETOP); } @@ -104,7 +102,6 @@ abstract class QueryReflection abstract public function GetClassAlias(); } - class ModelReflectionRuntime extends ModelReflection { public function __construct() @@ -115,22 +112,22 @@ class ModelReflectionRuntime extends ModelReflection { return MetaModel::GetClassIcon($sClass, $bImgTag); } - + public function IsValidAttCode($sClass, $sAttCode) { return MetaModel::IsValidAttCode($sClass, $sAttCode); } - + public function GetName($sClass) { return MetaModel::GetName($sClass); } - + public function GetLabel($sClass, $sAttCodeEx) { return MetaModel::GetLabel($sClass, $sAttCodeEx); } - + public function GetValueLabel($sClass, $sAttCode, $sValue) { $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); @@ -140,52 +137,41 @@ class ModelReflectionRuntime extends ModelReflection public function ListAttributes($sClass, $sScope = null) { $aScope = null; - if ($sScope != null) - { - $aScope = array(); - foreach (explode(',', $sScope) as $sScopeClass) - { + if ($sScope != null) { + $aScope = []; + foreach (explode(',', $sScope) as $sScopeClass) { $aScope[] = trim($sScopeClass); } } - $aAttributes = array(); - foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { + $aAttributes = []; + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { $sAttributeClass = get_class($oAttDef); - if ($aScope != null) - { - foreach ($aScope as $sScopeClass) - { - if (($sAttributeClass == $sScopeClass) || is_subclass_of($sAttributeClass, $sScopeClass)) - { + if ($aScope != null) { + foreach ($aScope as $sScopeClass) { + if (($sAttributeClass == $sScopeClass) || is_subclass_of($sAttributeClass, $sScopeClass)) { $aAttributes[$sAttCode] = $sAttributeClass; break; } } - } - else - { + } else { $aAttributes[$sAttCode] = $sAttributeClass; } } return $aAttributes; } - + public function GetAttributeProperty($sClass, $sAttCode, $sPropName, $default = null) { $ret = $default; $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); $aParams = $oAttDef->GetParams(); - if (array_key_exists($sPropName, $aParams)) - { + if (array_key_exists($sPropName, $aParams)) { $ret = $aParams[$sPropName]; } - if ($oAttDef instanceof AttributeHierarchicalKey) - { - if ($sPropName == 'targetclass') - { + if ($oAttDef instanceof AttributeHierarchicalKey) { + if ($sPropName == 'targetclass') { $ret = $sClass; } } @@ -196,29 +182,24 @@ class ModelReflectionRuntime extends ModelReflection { return MetaModel::GetAllowedValues_att($sClass, $sAttCode); } - + public function HasChildrenClasses($sClass) { return MetaModel::HasChildrenClasses($sClass); } - + public function GetClasses($sCategories = '', $bExcludeLinks = false) { $aClasses = MetaModel::GetClasses($sCategories); - if ($bExcludeLinks) - { + if ($bExcludeLinks) { $aExcluded = MetaModel::GetLinkClasses(); - $aRes = array(); - foreach ($aClasses as $sClass) - { - if (!array_key_exists($sClass, $aExcluded)) - { + $aRes = []; + foreach ($aClasses as $sClass) { + if (!array_key_exists($sClass, $aExcluded)) { $aRes[] = $sClass; } } - } - else - { + } else { $aRes = $aClasses; } return $aRes; @@ -263,19 +244,18 @@ class ModelReflectionRuntime extends ModelReflection { return new RunTimeIconSelectionField($sCode, $sLabel, $defaultValue); } - + public function GetRootClass($sClass) { return MetaModel::GetRootClass($sClass); } - + public function EnumChildClasses($sClass, $iOption = ENUM_CHILD_CLASSES_EXCLUDETOP) { return MetaModel::EnumChildClasses($sClass, $iOption); } } - class QueryReflectionRuntime extends QueryReflection { protected $oFilter; diff --git a/core/moduledesign.class.inc.php b/core/moduledesign.class.inc.php index 8b76e8a56..16b5d57a2 100644 --- a/core/moduledesign.class.inc.php +++ b/core/moduledesign.class.inc.php @@ -1,4 +1,5 @@ LoadFromCompiledDesigns($sDesignSourceId); } } @@ -80,18 +79,13 @@ class ModuleDesign extends \Combodo\iTop\DesignDocument { $sDesignDir = APPROOT.'env-'.utils::GetCurrentEnvironment().'/core/module_designs/'; $sFile = $sDesignDir.$sDesignSourceId.'.xml'; - if (!file_exists($sFile)) - { + if (!file_exists($sFile)) { $aFiles = glob($sDesignDir.'/*.xml'); - if (count($aFiles) == 0) - { + if (count($aFiles) == 0) { $sAvailable = 'none!'; - } - else - { - $aAvailable = array(); - foreach ($aFiles as $sFile) - { + } else { + $aAvailable = []; + foreach ($aFiles as $sFile) { $aAvailable[] = "'".basename($sFile, '.xml')."'"; } $sAvailable = implode(', ', $aAvailable); @@ -105,11 +99,9 @@ class ModuleDesign extends \Combodo\iTop\DesignDocument $this->load($sFile); //$bValidated = $oDocument->schemaValidate(APPROOT.'setup/itop_design.xsd'); $aErrors = libxml_get_errors(); - if (count($aErrors) > 0) - { - $aDisplayErrors = array(); - foreach($aErrors as $oXmlError) - { + if (count($aErrors) > 0) { + $aDisplayErrors = []; + foreach ($aErrors as $oXmlError) { $aDisplayErrors[] = 'Line '.$oXmlError->line.': '.$oXmlError->message; } diff --git a/core/modulehandler.class.inc.php b/core/modulehandler.class.inc.php index 21d9b7204..60249aa4c 100644 --- a/core/modulehandler.class.inc.php +++ b/core/modulehandler.class.inc.php @@ -1,9 +1,10 @@ - /** * Class ModuleHandler - * Defines the API to implement module specific actions during page execution + * Defines the API to implement module specific actions during page execution * * @copyright Copyright (C) 2010-2024 Combodo SAS * @license http://opensource.org/licenses/AGPL-3.0 @@ -36,17 +36,16 @@ abstract class ModuleHandlerAPI implements ModuleHandlerApiInterface } public function __construct() - { - } + { + } } - interface ModuleHandlerApiInterface { - public static function OnMetaModelStarted(); + public static function OnMetaModelStarted(); - public static function OnMenuCreation(); + public static function OnMenuCreation(); - public function __construct(); //empty params is required in order to be instantiable by MetaModel::InitClasses() -} \ No newline at end of file + public function __construct(); //empty params is required in order to be instantiable by MetaModel::InitClasses() +} diff --git a/core/mutex.class.inc.php b/core/mutex.class.inc.php index 94db80198..4e7c096c1 100644 --- a/core/mutex.class.inc.php +++ b/core/mutex.class.inc.php @@ -1,9 +1,10 @@ - /** * Class iTopMutex * A class to serialize the execution of some code sections @@ -44,17 +44,20 @@ class iTopMutex protected $sDBSubname; protected $bDBTlsEnabled; protected $sDBTlsCA; - static protected $aAcquiredLocks = array(); // Number of instances of the Mutex, having the lock, in this page + protected static $aAcquiredLocks = []; // Number of instances of the Mutex, having the lock, in this page public function __construct( - $sName, $sDBHost = null, $sDBUser = null, $sDBPwd = null, $bDBTlsEnabled = null, $sDBTlsCA = null - ) - { + $sName, + $sDBHost = null, + $sDBUser = null, + $sDBPwd = null, + $bDBTlsEnabled = null, + $sDBTlsCA = null + ) { // Compute the name of a lock for mysql // Note: names are server-wide!!! So let's make the name specific to this iTop instance $oConfig = MetaModel::GetConfig(); - if ($oConfig === null) - { + if ($oConfig === null) { $oConfig = utils::GetConfig(); // Will return an empty config when called during the setup } $this->sDBHost = is_null($sDBHost) ? $oConfig->Get('db_host') : $sDBHost; @@ -67,8 +70,7 @@ class iTopMutex $this->sDBTlsCA = is_null($sDBTlsCA) ? $oConfig->Get('db_tls.ca') : $sDBTlsCA; $this->sName = $sName; - if (substr($sName, -strlen($this->sDBName.$sDBSubname)) != $this->sDBName.$sDBSubname) - { + if (substr($sName, -strlen($this->sDBName.$sDBSubname)) != $this->sDBName.$sDBSubname) { // If the name supplied already ends with the expected suffix // don't add it twice, since the setup may try to detect an already // running cron job by its mutex, without knowing if the config already exists or not @@ -80,8 +82,7 @@ class iTopMutex $this->bLocked = false; // Not yet locked - if (!array_key_exists($this->sName, self::$aAcquiredLocks)) - { + if (!array_key_exists($this->sName, self::$aAcquiredLocks)) { self::$aAcquiredLocks[$this->sName] = 0; } @@ -108,11 +109,9 @@ class iTopMutex return new iTopMutex(...$aArgs); } - public function __destruct() { - if ($this->bLocked) - { + if ($this->bLocked) { $this->Unlock(); } mysqli_close($this->hDBLink); @@ -122,27 +121,22 @@ class iTopMutex * Acquire the mutex. Uses a MySQL lock. Warn : can have an abnormal behavior on MySQL clusters (see R-016204) * * @see https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_get-lock - */ + */ public function Lock() { - if ($this->bLocked) - { + if ($this->bLocked) { // Lock already acquired return; } - if (self::$aAcquiredLocks[$this->sName] == 0) - { - do - { + if (self::$aAcquiredLocks[$this->sName] == 0) { + do { $res = $this->QueryToScalar("SELECT GET_LOCK('".$this->sName."', 3600)"); - if (is_null($res)) - { + if (is_null($res)) { throw new Exception("Failed to acquire the lock '".$this->sName."'"); } // $res === '1' means I hold the lock // $res === '0' means it timed out - } - while ($res !== '1'); + } while ($res !== '1'); } $this->bLocked = true; self::$aAcquiredLocks[$this->sName]++; @@ -150,66 +144,56 @@ class iTopMutex /** * Attempt to acquire the mutex - * @returns bool True if the mutex is acquired, false if already locked elsewhere - */ + * @returns bool True if the mutex is acquired, false if already locked elsewhere + */ public function TryLock() { - if ($this->bLocked) - { + if ($this->bLocked) { return true; // Already acquired } - if (self::$aAcquiredLocks[$this->sName] > 0) - { + if (self::$aAcquiredLocks[$this->sName] > 0) { self::$aAcquiredLocks[$this->sName]++; $this->bLocked = true; return true; } - + $res = $this->QueryToScalar("SELECT GET_LOCK('".$this->sName."', 0)"); - if (is_null($res)) - { + if (is_null($res)) { throw new Exception("Failed to acquire the lock '".$this->sName."'"); } // $res === '1' means I hold the lock // $res === '0' means it timed out - if ($res === '1') - { + if ($res === '1') { $this->bLocked = true; self::$aAcquiredLocks[$this->sName]++; } - if (($res !== '1') && ($res !== '0')) - { + if (($res !== '1') && ($res !== '0')) { $sMsg = 'GET_LOCK('.$this->sName.', 0) returned: '.var_export($res, true).'. Expected values are: 0, 1 or null'; IssueLog::Error($sMsg); throw new Exception($sMsg); } return ($res !== '0'); } - + /** * Check if the mutex is locked WITHOUT TRYING TO ACQUIRE IT * @returns bool True if the mutex is in use, false otherwise */ public function IsLocked() { - if ($this->bLocked) - { + if ($this->bLocked) { return true; // Already acquired } - if (self::$aAcquiredLocks[$this->sName] > 0) - { + if (self::$aAcquiredLocks[$this->sName] > 0) { return true; } - + $res = $this->QueryToScalar("SELECT IS_FREE_LOCK('".$this->sName."')"); // IS_FREE_LOCK detects some error cases that IS_USED_LOCK do not detect - if (is_null($res)) - { + if (is_null($res)) { $sMsg = "MySQL Error, IS_FREE_LOCK('".$this->sName."') returned null. Error (".mysqli_errno($this->hDBLink).") = '".mysqli_error($this->hDBLink)."'"; IssueLog::Error($sMsg); throw new Exception($sMsg); - } - else if ($res == '1') - { + } elseif ($res == '1') { // Lock is free return false; } @@ -218,21 +202,18 @@ class iTopMutex /** * Release the mutex - */ + */ public function Unlock() { - if (!$this->bLocked) - { + if (!$this->bLocked) { // ??? the lock is not acquired, exit - return; + return; } - if (self::$aAcquiredLocks[$this->sName] == 0) - { + if (self::$aAcquiredLocks[$this->sName] == 0) { return; // Safety net } - - if (self::$aAcquiredLocks[$this->sName] == 1) - { + + if (self::$aAcquiredLocks[$this->sName] == 1) { $res = $this->QueryToScalar("SELECT RELEASE_LOCK('".$this->sName."')"); } $this->bLocked = false; @@ -259,7 +240,7 @@ class iTopMutex $this->hDBLink = CMDBSource::GetMysqliInstance($sServer, $sUser, $sPwd, $sSource, $bTlsEnabled, $sTlsCA, false); if (!$this->hDBLink) { - throw new MySQLException('Could not connect to the DB server '.mysqli_connect_error().' (mysql errno: '.mysqli_connect_errno(), array('host' => $sDBHost, 'user' => $sDBUser)); + throw new MySQLException('Could not connect to the DB server '.mysqli_connect_error().' (mysql errno: '.mysqli_connect_errno(), ['host' => $sDBHost, 'user' => $sDBUser]); } // Make sure that the server variable `wait_timeout` is at least 86400 seconds for this connection, @@ -290,20 +271,15 @@ class iTopMutex } } - protected function QueryToScalar($sSql) { $result = mysqli_query($this->hDBLink, $sSql); - if (!$result) - { + if (!$result) { throw new Exception("Failed to issue MySQL query '".$sSql."': ".mysqli_error($this->hDBLink).' (mysql errno: '.mysqli_errno($this->hDBLink).')'); } - if ($aRow = mysqli_fetch_array($result, MYSQLI_BOTH)) - { + if ($aRow = mysqli_fetch_array($result, MYSQLI_BOTH)) { $res = $aRow[0]; - } - else - { + } else { mysqli_free_result($result); throw new Exception("No result for query '".$sSql."'"); } diff --git a/core/oqlactualclasstreeresolver.class.inc.php b/core/oqlactualclasstreeresolver.class.inc.php index 813a7e654..9f4c2b25a 100644 --- a/core/oqlactualclasstreeresolver.class.inc.php +++ b/core/oqlactualclasstreeresolver.class.inc.php @@ -1,10 +1,10 @@ oOQLClassNode->GetNodeClass(); $sClassAlias = $this->oOQLClassNode->GetNodeClassAlias(); $aExpectedAttributes = $this->oBuild->m_oQBExpressions->GetUnresolvedFields($sClassAlias); - if (!is_null($sIncomingKeyAttCode) && !isset($aExpectedAttributes[$sIncomingKeyAttCode])) - { + if (!is_null($sIncomingKeyAttCode) && !isset($aExpectedAttributes[$sIncomingKeyAttCode])) { // Add entry point as expected attribute $aExpectedAttributes[$sIncomingKeyAttCode] = new FieldExpression($sIncomingKeyAttCode, $sClassAlias); } $aClasses = MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL, false); /** @var OQLClassNode[] $aClassAndAncestorsNodes */ - $aClassAndAncestorsNodes = array(); - foreach ($aClasses as $sFamilyClass) - { + $aClassAndAncestorsNodes = []; + foreach ($aClasses as $sFamilyClass) { // Remove unnecessary classes - if (MetaModel::HasTable($sFamilyClass)) - { + if (MetaModel::HasTable($sFamilyClass)) { $aClassAndAncestorsNodes[$sFamilyClass] = null; } } - if (empty($aClassAndAncestorsNodes)) - { + if (empty($aClassAndAncestorsNodes)) { throw new CoreException("Impossible to query the class $sClass"); } $oBaseNode = null; - $aTranslateFields = array(); - foreach ($aExpectedAttributes as $sAttCode => $oExpression) - { + $aTranslateFields = []; + foreach ($aExpectedAttributes as $sAttCode => $oExpression) { // 'id' is managed later - if ($sAttCode == 'id') - { + if ($sAttCode == 'id') { continue; } // Attributes can be stored in attributes list or for magic ones into filter codes list. $sOriginClass = null; - if (MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + if (MetaModel::IsValidAttCode($sClass, $sAttCode)) { $sOriginClass = MetaModel::GetAttributeOrigin($sClass, $sAttCode); - } - else if (MetaModel::IsValidFilterCode($sClass, $sAttCode)) - { + } elseif (MetaModel::IsValidFilterCode($sClass, $sAttCode)) { $sOriginClass = MetaModel::GetFilterCodeOrigin($sClass, $sAttCode); - } - else - { + } else { continue; } - if (!isset($aClassAndAncestorsNodes[$sOriginClass]) || is_null($aClassAndAncestorsNodes[$sOriginClass])) - { - if ($sOriginClass == $sClass) - { + if (!isset($aClassAndAncestorsNodes[$sOriginClass]) || is_null($aClassAndAncestorsNodes[$sOriginClass])) { + if ($sOriginClass == $sClass) { $sOriginClassAlias = $sClassAlias; - } - else - { + } else { $sOriginClassAlias = $this->oBuild->GenerateTableAlias($sClassAlias.'_'.$sOriginClass, $sClass); } $oOriginClassNode = new OQLClassNode($this->oBuild, $sOriginClass, $sOriginClassAlias, $sClassAlias); $aClassAndAncestorsNodes[$sOriginClass] = $oOriginClassNode; - } - else - { + } else { $oOriginClassNode = $aClassAndAncestorsNodes[$sOriginClass]; } - if ($sOriginClass != $sClass) - { + if ($sOriginClass != $sClass) { // Alias changed, set a new translation $sOriginClassAlias = $oOriginClassNode->GetNodeClassAlias(); $aTranslateFields[$sClassAlias][$sAttCode] = new FieldExpression($sAttCode, $sOriginClassAlias); @@ -112,8 +94,7 @@ class OQLActualClassTreeResolver // Add Joins corresponding to external keys $this->ResolveJoins($sAttCode, $oOriginClassNode); - if ($sAttCode === $sIncomingKeyAttCode) - { + if ($sAttCode === $sIncomingKeyAttCode) { // This is the entry point of the class $oBaseNode = $oOriginClassNode; } @@ -122,47 +103,37 @@ class OQLActualClassTreeResolver // Create joins for ancestor classes /** @var \OQLClassNode $oBaseNode */ $sFirstValidAncestor = null; - foreach ($aClassAndAncestorsNodes as $sOriginClass => $oOriginClassNode) - { - if (is_null($sFirstValidAncestor)) - { + foreach ($aClassAndAncestorsNodes as $sOriginClass => $oOriginClassNode) { + if (is_null($sFirstValidAncestor)) { $sFirstValidAncestor = $sOriginClass; } - if (is_null($oOriginClassNode)) - { + if (is_null($oOriginClassNode)) { continue; } - if (is_null($oBaseNode)) - { + if (is_null($oBaseNode)) { $oBaseNode = $oOriginClassNode; continue; } - if ($oBaseNode === $oOriginClassNode) - { + if ($oBaseNode === $oOriginClassNode) { // Don't link to itself continue; } $oBaseNode->AddInnerJoin($oOriginClassNode, 'id', 'id'); } - if (is_null($oBaseNode)) - { + if (is_null($oBaseNode)) { // If no class was generated above, keep the first valid ancestor - if (is_null($sFirstValidAncestor) || ($sFirstValidAncestor == $sClass)) - { + if (is_null($sFirstValidAncestor) || ($sFirstValidAncestor == $sClass)) { // take current node $oBaseNode = $this->oOQLClassNode->CloneNode(); - } - else - { + } else { // Use the first valid class to build a default node $sDefaultClassAlias = $this->oBuild->GenerateTableAlias($sClassAlias.'_'.$sFirstValidAncestor, $sClass); $oBaseNode = new OQLClassNode($this->oBuild, $sFirstValidAncestor, $sDefaultClassAlias); } } - if (isset($aExpectedAttributes['id']) && !isset($aClassAndAncestorsNodes[$sClass])) - { + if (isset($aExpectedAttributes['id']) && !isset($aClassAndAncestorsNodes[$sClass])) { $sFirstClassAlias = $oBaseNode->GetNodeClassAlias(); $aTranslateFields[$sClassAlias]['id'] = new FieldExpression('id', $sFirstClassAlias); } @@ -172,12 +143,11 @@ class OQLActualClassTreeResolver $this->ResolveJoins('id', $oBaseNode); // Add finalclass condition if not the requested class - if ($oBaseNode->GetNodeClass() != $sClass) - { + if ($oBaseNode->GetNodeClass() != $sClass) { $sExpectedClasses = implode("', '", MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL)); $oInExpression = Expression::FromOQL("`".$oBaseNode->GetNodeClassAlias()."`.finalclass IN ('$sExpectedClasses')"); $oTrueExpression = new TrueExpression(); - $aCoalesceAttr = array($oInExpression, $oTrueExpression); + $aCoalesceAttr = [$oInExpression, $oTrueExpression]; $oFinalClassRestriction = new FunctionExpression("COALESCE", $aCoalesceAttr); $this->oBuild->m_oQBExpressions->AddCondition($oFinalClassRestriction); } @@ -199,10 +169,8 @@ class OQLActualClassTreeResolver // Joins on the selected class $aJoins = $this->oOQLClassNode->GetJoins(); - if (isset($aJoins[$sAttCode])) - { - foreach ($aJoins[$sAttCode] as $oBaseOQLJoin) - { + if (isset($aJoins[$sAttCode])) { + foreach ($aJoins[$sAttCode] as $oBaseOQLJoin) { // transfer the join from OQL class tree to actual class tree $oBaseJoinedClassNode = $oBaseOQLJoin->GetOOQLClassNode(); $oOQLActualClassTreeResolver = new OQLActualClassTreeResolver($oBaseJoinedClassNode, $this->oBuild); diff --git a/core/oqlclassnode.class.inc.php b/core/oqlclassnode.class.inc.php index 5abeb17e5..a77e42675 100644 --- a/core/oqlclassnode.class.inc.php +++ b/core/oqlclassnode.class.inc.php @@ -1,10 +1,10 @@ sNodeClass = $sNodeClass; - if (empty($sNodeClassAlias)) - { + if (empty($sNodeClassAlias)) { $this->sNodeClassAlias = $oBuild->GetEmptyClassAlias(); - } - else - { + } else { $this->sNodeClassAlias = $sNodeClassAlias; } - $this->aJoins = array(); - $this->aExtKeys = array(); - if (is_null($sOQLClassAlias)) - { + $this->aJoins = []; + $this->aExtKeys = []; + if (is_null($sOQLClassAlias)) { $this->sOQLClassAlias = $this->sNodeClassAlias; - } - else - { + } else { $this->sOQLClassAlias = $sOQLClassAlias; } $this->oBuild = $oBuild; @@ -60,9 +54,8 @@ class OQLClassNode public function AddExternalKey($sKeyAttCode) { - if (!isset($this->aExtKeys[$sKeyAttCode])) - { - $this->aExtKeys[$sKeyAttCode] = array(); + if (!isset($this->aExtKeys[$sKeyAttCode])) { + $this->aExtKeys[$sKeyAttCode] = []; } } @@ -72,7 +65,6 @@ class OQLClassNode $this->aExtKeys[$sKeyAttCode][$sFieldAttCode] = $oAttDef; } - public function AddInnerJoin($oOQLClassNode, $sLeftField, $sRightField, $bOutbound = true) { $this->AddJoin(OQLJoin::JOIN_INNER, $oOQLClassNode, $sLeftField, $sRightField, $bOutbound); @@ -82,7 +74,7 @@ class OQLClassNode { $this->AddJoin(OQLJoin::JOIN_LEFT, $oOQLClassNode, $sLeftField, $sRightField, $bOutbound); } - + public function AddInnerJoinTree($oOQLClassNode, $sLeftField, $sRightField, $bOutbound = true, $iOperatorCode = TREE_OPERATOR_BELOW, $bInvertOnClause = false) { $this->AddJoin(OQLJoin::JOIN_INNER_TREE, $oOQLClassNode, $sLeftField, $sRightField, $bOutbound, $iOperatorCode, $bInvertOnClause); @@ -90,8 +82,16 @@ class OQLClassNode private function AddJoin($sJoinType, $oOQLClassNode, $sLeftField, $sRightField, $bOutbound = true, $sTreeOperator = null, $bInvertOnClause = false) { - $oOQLJoin = new OQLJoin($this->oBuild, $sJoinType, $oOQLClassNode, $sLeftField, $sRightField, $bOutbound, $sTreeOperator, - $bInvertOnClause); + $oOQLJoin = new OQLJoin( + $this->oBuild, + $sJoinType, + $oOQLClassNode, + $sLeftField, + $sRightField, + $bOutbound, + $sTreeOperator, + $bInvertOnClause + ); $this->AddOQLJoin($sLeftField, $oOQLJoin); } @@ -116,26 +116,21 @@ class OQLClassNode public function RenderDebug() { $sOQL = "SELECT `{$this->sNodeClassAlias}` FROM `{$this->sNodeClass}` AS `{$this->sNodeClassAlias}`"; - foreach ($this->aJoins as $aJoins) - { - foreach ($aJoins as $oJoin) - { + foreach ($this->aJoins as $aJoins) { + foreach ($aJoins as $oJoin) { $sOQL .= "{$oJoin->RenderDebug($this->sNodeClassAlias)}"; } } - return $sOQL; } public function Browse(Closure $callback) { $callback($this); - foreach ($this->GetJoins() as $aJoins) - { + foreach ($this->GetJoins() as $aJoins) { /** @var \OQLJoin $oJoin */ - foreach ($aJoins as $oJoin) - { + foreach ($aJoins as $oJoin) { $oJoin->GetOOQLClassNode()->Browse($callback); } } @@ -182,8 +177,7 @@ class OQLClassNode public function RemoveJoin($sLeftKey, $index) { unset($this->aJoins[$sLeftKey][$index]); - if (empty($this->aJoins[$sLeftKey])) - { + if (empty($this->aJoins[$sLeftKey])) { unset($this->aJoins[$sLeftKey]); } } @@ -192,10 +186,10 @@ class OQLClassNode class OQLJoin { - const JOIN_INNER = 'inner'; - const JOIN_LEFT = 'left'; - const JOIN_INNER_TREE = 'inner_tree'; - + public const JOIN_INNER = 'inner'; + public const JOIN_LEFT = 'left'; + public const JOIN_INNER_TREE = 'inner_tree'; + private $sJoinType; /** @var \OQLClassNode */ private $oOQLClassNode; @@ -238,8 +232,16 @@ class OQLJoin public function NewOQLJoinWithClassNode($oOQLClassNode) { - return new self($this->oBuild, $this->sJoinType, $oOQLClassNode, $this->sLeftField, $this->sRightField, $this->bOutbound, - $this->sTreeOperator, $this->bInvertOnClause); + return new self( + $this->oBuild, + $this->sJoinType, + $oOQLClassNode, + $this->sLeftField, + $this->sRightField, + $this->bOutbound, + $this->sTreeOperator, + $this->bInvertOnClause + ); } /** @@ -252,27 +254,20 @@ class OQLJoin // Translate the fields before copy to SQL $sLeft = $oBaseSQLQuery->GetTableAlias().'.'.$this->sLeftField; $oLeftField = $oBuild->m_oQBExpressions->GetJoinField($sLeft); - if ($oLeftField) - { + if ($oLeftField) { $sSQLLeft = $oLeftField->GetName(); - } - else - { + } else { $sSQLLeft = "no_field_found_for_$sLeft"; } $sRight = $oJoinedSQLQuery->GetTableAlias().'.'.$this->sRightField; $oRightField = $oBuild->m_oQBExpressions->GetJoinField($sRight); - if ($oRightField) - { + if ($oRightField) { $sSQLRight = $oRightField->GetName(); - } - else - { + } else { $sSQLRight = "no_field_found_for_$sRight"; } - switch ($this->sJoinType) - { + switch ($this->sJoinType) { case self::JOIN_INNER: $oBaseSQLQuery->AddInnerJoin($oJoinedSQLQuery, $sSQLLeft, $sSQLRight); break; @@ -296,10 +291,8 @@ class OQLJoin $sOQL = "\n{$sPrefix}{$sType} JOIN `{$this->oOQLClassNode->GetNodeClass()}` AS `{$this->oOQLClassNode->GetNodeClassAlias()}`"; $sOQL .= "\n{$sPrefix} ON `{$sClassAlias}`.`{$this->sLeftField}` = `{$this->oOQLClassNode->GetNodeClassAlias()}`.`{$this->sRightField}`"; $sPrefix .= " "; - foreach ($this->oOQLClassNode->GetJoins() as $aJoins) - { - foreach ($aJoins as $oJoin) - { + foreach ($this->oOQLClassNode->GetJoins() as $aJoins) { + foreach ($aJoins as $oJoin) { $sOQL .= " {$oJoin->RenderDebug($this->oOQLClassNode->GetNodeClassAlias(), $sPrefix)}"; } } diff --git a/core/oqlclasstreebuilder.class.inc.php b/core/oqlclasstreebuilder.class.inc.php index f984dbae8..bbb80cb40 100644 --- a/core/oqlclasstreebuilder.class.inc.php +++ b/core/oqlclasstreebuilder.class.inc.php @@ -1,10 +1,10 @@ oDBObjectSearch = $oDBObjetSearch; $this->sClass = $oDBObjetSearch->GetFirstJoinedClass(); $this->sClassAlias = $oDBObjetSearch->GetFirstJoinedClassAlias(); - if (empty($this->sClassAlias)) - { + if (empty($this->sClassAlias)) { $this->sClassAlias = $oBuild->GetEmptyClassAlias(); } $this->oOQLClassNode = new OQLClassNode($oBuild, $this->sClass, $this->sClassAlias); @@ -89,10 +88,8 @@ class OQLClassTreeBuilder */ private function AddExternalKeysFromSearch() { - foreach ($this->oDBObjectSearch->GetCriteria_PointingTo() as $sKeyAttCode => $aPointingTo) - { - if (array_key_exists(TREE_OPERATOR_EQUALS, $aPointingTo)) - { + foreach ($this->oDBObjectSearch->GetCriteria_PointingTo() as $sKeyAttCode => $aPointingTo) { + if (array_key_exists(TREE_OPERATOR_EQUALS, $aPointingTo)) { $this->oOQLClassNode->AddExternalKey($sKeyAttCode); } } @@ -109,69 +106,53 @@ class OQLClassTreeBuilder // array of (attcode => fieldexpression) $aExpectedAttributes = $this->oBuild->m_oQBExpressions->GetUnresolvedFields($this->sClassAlias); - $aPolymorphicJoinAlias = array(); // array of (subclass => alias) - foreach ($aExpectedAttributes as $sExpectedAttCode => $oExpression) - { - if (!MetaModel::IsValidAttCode($this->sClass, $sExpectedAttCode)) - { + $aPolymorphicJoinAlias = []; // array of (subclass => alias) + foreach ($aExpectedAttributes as $sExpectedAttCode => $oExpression) { + if (!MetaModel::IsValidAttCode($this->sClass, $sExpectedAttCode)) { continue; } $oAttDef = MetaModel::GetAttributeDef($this->sClass, $sExpectedAttCode); - if ($oAttDef->IsBasedOnOQLExpression()) - { + if ($oAttDef->IsBasedOnOQLExpression()) { // To optimize: detect a restriction on child classes in the condition expression // e.g. SELECT FunctionalCI WHERE finalclass IN ('Server', 'VirtualMachine') $oExpression = DBObjectSearch::GetPolymorphicExpression($this->sClass, $sExpectedAttCode); - $aRequiredFields = array(); + $aRequiredFields = []; $oExpression->GetUnresolvedFields('', $aRequiredFields); - $aTranslateFields = array(); - foreach ($aRequiredFields as $sSubClass => $aFields) - { - foreach ($aFields as $sAttCode => $oField) - { + $aTranslateFields = []; + foreach ($aRequiredFields as $sSubClass => $aFields) { + foreach ($aFields as $sAttCode => $oField) { $oAttDef = MetaModel::GetAttributeDef($sSubClass, $sAttCode); - if ($oAttDef->IsExternalKey()) - { + if ($oAttDef->IsExternalKey()) { $sClassOfAttribute = MetaModel::GetAttributeOrigin($sSubClass, $sAttCode); - if (MetaModel::IsParentClass($sClassOfAttribute, $this->sClass)) - { + if (MetaModel::IsParentClass($sClassOfAttribute, $this->sClass)) { $this->oOQLClassNode->AddExternalKey($sAttCode); } - } - elseif ($oAttDef->IsExternalField()) - { + } elseif ($oAttDef->IsExternalField()) { $sKeyAttCode = $oAttDef->GetKeyAttCode(); $sClassOfAttribute = MetaModel::GetAttributeOrigin($sSubClass, $sKeyAttCode); - if (MetaModel::IsParentClass($sClassOfAttribute, $this->sClass)) - { + if (MetaModel::IsParentClass($sClassOfAttribute, $this->sClass)) { $this->oOQLClassNode->AddExternalField($sKeyAttCode, $sAttCode, $oAttDef); } - } - else - { + } else { $sClassOfAttribute = MetaModel::GetAttributeOrigin($sSubClass, $sAttCode); } - if (MetaModel::IsParentClass($sClassOfAttribute, $this->sClass)) - { + if (MetaModel::IsParentClass($sClassOfAttribute, $this->sClass)) { // The attribute is part of the standard query // $sAliasForAttribute = $this->sClassAlias; - } - else - { + } else { // The attribute will be available from an additional outer join // For each subclass (table) one single join is enough // - if (!array_key_exists($sClassOfAttribute, $aPolymorphicJoinAlias)) - { - $sAliasForAttribute = $this->oBuild->GenerateClassAlias($this->sClassAlias.'_poly_'.$sClassOfAttribute, - $sClassOfAttribute); + if (!array_key_exists($sClassOfAttribute, $aPolymorphicJoinAlias)) { + $sAliasForAttribute = $this->oBuild->GenerateClassAlias( + $this->sClassAlias.'_poly_'.$sClassOfAttribute, + $sClassOfAttribute + ); $aPolymorphicJoinAlias[$sClassOfAttribute] = $sAliasForAttribute; - } - else - { + } else { $sAliasForAttribute = $aPolymorphicJoinAlias[$sClassOfAttribute]; } } @@ -181,7 +162,7 @@ class OQLClassTreeBuilder } $oExpression = $oExpression->Translate($aTranslateFields, false); - $aTranslateNow = array(); + $aTranslateNow = []; $aTranslateNow[$this->sClassAlias][$sExpectedAttCode] = $oExpression; $this->oBuild->m_oQBExpressions->Translate($aTranslateNow, false); } @@ -200,12 +181,9 @@ class OQLClassTreeBuilder // array of (attcode => fieldexpression) $aExpectedAttributes = $this->oBuild->m_oQBExpressions->GetUnresolvedFields($this->sClassAlias); - foreach (MetaModel::ListAttributeDefs($this->sClass) as $sAttCode => $oAttDef) - { - if ($oAttDef->IsExternalField()) - { - if (array_key_exists($sAttCode, $aExpectedAttributes)) - { + foreach (MetaModel::ListAttributeDefs($this->sClass) as $sAttCode => $oAttDef) { + if ($oAttDef->IsExternalField()) { + if (array_key_exists($sAttCode, $aExpectedAttributes)) { // Add the external attribute $sKeyAttCode = $oAttDef->GetKeyAttCode(); $this->oOQLClassNode->AddExternalField($sKeyAttCode, $sAttCode, $oAttDef); @@ -225,16 +203,13 @@ class OQLClassTreeBuilder $aAllPointingTo = $this->oDBObjectSearch->GetCriteria_PointingTo(); // Add filters from external keys - foreach (array_keys($this->oOQLClassNode->GetExternalKeys()) as $sKeyAttCode) - { - if (!MetaModel::IsValidAttCode($this->sClass, $sKeyAttCode)) - { + foreach (array_keys($this->oOQLClassNode->GetExternalKeys()) as $sKeyAttCode) { + if (!MetaModel::IsValidAttCode($this->sClass, $sKeyAttCode)) { continue; } // Not defined in the class, skip it $oKeyAttDef = MetaModel::GetAttributeDef($this->sClass, $sKeyAttCode); - $aPointingTo = isset($aAllPointingTo[$sKeyAttCode]) ? $aAllPointingTo[$sKeyAttCode] : array(); - if (!array_key_exists(TREE_OPERATOR_EQUALS, $aPointingTo)) - { + $aPointingTo = isset($aAllPointingTo[$sKeyAttCode]) ? $aAllPointingTo[$sKeyAttCode] : []; + if (!array_key_exists(TREE_OPERATOR_EQUALS, $aPointingTo)) { // The join was not explicitly defined in the filter, // we need to do it now $sKeyClass = $oKeyAttDef->GetTargetClass(); @@ -246,14 +221,10 @@ class OQLClassTreeBuilder } $oQBContextExpressions = $this->oBuild->m_oQBExpressions; - foreach ($aAllPointingTo as $sKeyAttCode => $aPointingTo) - { - foreach ($aPointingTo as $iOperatorCode => $aFilter) - { - foreach ($aFilter as $oExtFilter) - { - if (!MetaModel::IsValidAttCode($this->sClass, $sKeyAttCode)) - { + foreach ($aAllPointingTo as $sKeyAttCode => $aPointingTo) { + foreach ($aPointingTo as $iOperatorCode => $aFilter) { + foreach ($aFilter as $oExtFilter) { + if (!MetaModel::IsValidAttCode($this->sClass, $sKeyAttCode)) { continue; } // Not defined in the class, skip it // The aliases should not conflict because normalization occurred while building the filter @@ -263,34 +234,29 @@ class OQLClassTreeBuilder // Note: there is no search condition in $oExtFilter, because normalization did merge the condition onto the top of the filter tree - if ($iOperatorCode == TREE_OPERATOR_EQUALS) - { - if ($this->oOQLClassNode->HasExternalKey($sKeyAttCode)) - { + if ($iOperatorCode == TREE_OPERATOR_EQUALS) { + if ($this->oOQLClassNode->HasExternalKey($sKeyAttCode)) { // Specify expected attributes for the target class query // ... and use the current alias ! - $aTranslateNow = array(); // Translation for external fields - must be performed before the join is done (recursion...) - foreach ($this->oOQLClassNode->GetExternalKey($sKeyAttCode) as $sAttCode => $oAtt) - { + $aTranslateNow = []; // Translation for external fields - must be performed before the join is done (recursion...) + foreach ($this->oOQLClassNode->GetExternalKey($sKeyAttCode) as $sAttCode => $oAtt) { $oExtAttDef = $oAtt->GetExtAttDef(); - if ($oExtAttDef->IsBasedOnOQLExpression()) - { + if ($oExtAttDef->IsBasedOnOQLExpression()) { $sExtAttCode = $oExtAttDef->GetCode(); - } - else - { + } else { $sExtAttCode = $oAtt->GetExtAttCode(); } // Translate mainclass.extfield => remoteclassalias.remotefieldcode $aTranslateNow[$this->sClassAlias][$sAttCode] = new FieldExpression($sExtAttCode, $sKeyClassAlias); } - if ($oKeyAttDef instanceof AttributeObjectKey) - { + if ($oKeyAttDef instanceof AttributeObjectKey) { // Add the condition: `$sTargetAlias`.$sClassAttCode IN (subclasses of $sKeyClass') $sClassAttCode = $oKeyAttDef->Get('class_attcode'); - $oClassListExpr = ListExpression::FromScalars(MetaModel::EnumChildClasses($sKeyClass, - ENUM_CHILD_CLASSES_ALL)); + $oClassListExpr = ListExpression::FromScalars(MetaModel::EnumChildClasses( + $sKeyClass, + ENUM_CHILD_CLASSES_ALL + )); $oClassExpr = new FieldExpression($sClassAttCode, $this->sClassAlias); $oClassRestriction = new BinaryExpression($oClassExpr, 'IN', $oClassListExpr); $oQBContextExpressions->AddCondition($oClassRestriction); @@ -304,24 +270,18 @@ class OQLClassTreeBuilder $oOQLClassTreeBuilder = new OQLClassTreeBuilder($oExtFilter, $this->oBuild); $oSelectExtKey = $oOQLClassTreeBuilder->DevelopOQLClassNode(); - if ($oKeyAttDef->IsNullAllowed()) - { + if ($oKeyAttDef->IsNullAllowed()) { $this->oOQLClassNode->AddLeftJoin($oSelectExtKey, $sKeyAttCode, $sExternalKeyField, true); - } - else - { + } else { $this->oOQLClassNode->AddInnerJoin($oSelectExtKey, $sKeyAttCode, $sExternalKeyField, true); } } - } - elseif (MetaModel::GetAttributeOrigin($sKeyClass, $sKeyAttCode) == $this->sClass) - { + } elseif (MetaModel::GetAttributeOrigin($sKeyClass, $sKeyAttCode) == $this->sClass) { $sExternalKeyField = $sKeyAttCode; $oOQLClassTreeBuilder = new OQLClassTreeBuilder($oExtFilter, $this->oBuild); $oSelectExtKey = $oOQLClassTreeBuilder->DevelopOQLClassNode(); - $this->oOQLClassNode->AddInnerJoinTree($oSelectExtKey, $sKeyAttCode, $sExternalKeyField, true, $iOperatorCode); } } @@ -336,25 +296,22 @@ class OQLClassTreeBuilder */ private function JoinClassesReferencedBy() { - foreach ($this->oDBObjectSearch->GetCriteria_ReferencedBy() as $sForeignClass => $aReferences) - { - foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) - { - foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) - { - foreach ($aFilters as $oForeignFilter) - { + foreach ($this->oDBObjectSearch->GetCriteria_ReferencedBy() as $sForeignClass => $aReferences) { + foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { + foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) { + foreach ($aFilters as $oForeignFilter) { $oForeignKeyAttDef = MetaModel::GetAttributeDef($sForeignClass, $sForeignExtKeyAttCode); $sForeignClassAlias = $oForeignFilter->GetFirstJoinedClassAlias(); - if ($oForeignKeyAttDef instanceof AttributeObjectKey) - { + if ($oForeignKeyAttDef instanceof AttributeObjectKey) { $sClassAttCode = $oForeignKeyAttDef->Get('class_attcode'); // Add the condition: `$sForeignClassAlias`.$sClassAttCode IN (subclasses of $sClass') - $oClassListExpr = ListExpression::FromScalars(MetaModel::EnumChildClasses($this->sClass, - ENUM_CHILD_CLASSES_ALL)); + $oClassListExpr = ListExpression::FromScalars(MetaModel::EnumChildClasses( + $this->sClass, + ENUM_CHILD_CLASSES_ALL + )); $oClassExpr = new FieldExpression($sClassAttCode, $sForeignClassAlias); $oClassRestriction = new BinaryExpression($oClassExpr, 'IN', $oClassListExpr); $this->oBuild->m_oQBExpressions->AddCondition($oClassRestriction); @@ -363,12 +320,9 @@ class OQLClassTreeBuilder $oOQLClassTreeBuilder = new OQLClassTreeBuilder($oForeignFilter, $this->oBuild); $oSelectForeign = $oOQLClassTreeBuilder->DevelopOQLClassNode(); - if ($iOperatorCode == TREE_OPERATOR_EQUALS) - { + if ($iOperatorCode == TREE_OPERATOR_EQUALS) { $this->oOQLClassNode->AddInnerJoin($oSelectForeign, 'id', $sForeignExtKeyAttCode, false); - } - else - { + } else { // Hierarchical key $this->oOQLClassNode->AddInnerJoinTree($oSelectForeign, $sForeignExtKeyAttCode, $sForeignExtKeyAttCode, false, $iOperatorCode, true); } @@ -387,8 +341,7 @@ class OQLClassTreeBuilder */ private function JoinClassesForPolymorphicExpressions($aPolymorphicJoinAlias) { - foreach ($aPolymorphicJoinAlias as $sSubClass => $sSubClassAlias) - { + foreach ($aPolymorphicJoinAlias as $sSubClass => $sSubClassAlias) { $oSubClassFilter = new DBObjectSearch($sSubClass, $sSubClassAlias); $oOQLClassTreeBuilder = new OQLClassTreeBuilder($oSubClassFilter, $this->oBuild); $oSelectPoly = $oOQLClassTreeBuilder->DevelopOQLClassNode(); diff --git a/core/oqlclasstreeoptimizer.class.inc.php b/core/oqlclasstreeoptimizer.class.inc.php index 48931835c..55538647a 100644 --- a/core/oqlclasstreeoptimizer.class.inc.php +++ b/core/oqlclasstreeoptimizer.class.inc.php @@ -1,13 +1,13 @@ oBuild->m_oQBExpressions->GetExpectedFields($oCurrentClassNode->GetNodeClassAlias()); $bCanBeRemoved = empty($aExpectedAttributes); - foreach ($oCurrentClassNode->GetJoins() as $sLeftKey => $aJoins) - { - foreach ($aJoins as $index => $oJoin) - { - if ($this->PruneJoins($oJoin->GetOOQLClassNode())) - { - if ($oJoin->IsOutbound()) - { + foreach ($oCurrentClassNode->GetJoins() as $sLeftKey => $aJoins) { + foreach ($aJoins as $index => $oJoin) { + if ($this->PruneJoins($oJoin->GetOOQLClassNode())) { + if ($oJoin->IsOutbound()) { // If joined class in not the same class than the external key target class // then the join cannot be removed because it is used to filter the request $sJoinedClass = $oJoin->GetOOQLClassNode()->GetNodeClass(); @@ -59,15 +55,11 @@ class OQLClassTreeOptimizer // The join is not used, remove from tree $oCurrentClassNode->RemoveJoin($sLeftKey, $index); } - } - else - { + } else { // Inbound joins cannot be removed $bCanBeRemoved = false; } - } - else - { + } else { // This join is used, so the current node cannot be removed $bCanBeRemoved = false; } @@ -75,4 +67,4 @@ class OQLClassTreeOptimizer } return $bCanBeRemoved; } -} \ No newline at end of file +} diff --git a/core/ormStyle.class.inc.php b/core/ormStyle.class.inc.php index 43f8a0c14..614526a5e 100644 --- a/core/ormStyle.class.inc.php +++ b/core/ormStyle.class.inc.php @@ -1,4 +1,5 @@ sIcon; } -} \ No newline at end of file +} diff --git a/core/ormcaselog.class.inc.php b/core/ormcaselog.class.inc.php index fe089bf0e..f820f1d2f 100644 --- a/core/ormcaselog.class.inc.php +++ b/core/ormcaselog.class.inc.php @@ -1,9 +1,10 @@ m_sLog = $sLog; $this->m_aIndex = $aIndex; $this->m_bModified = false; } - + public function GetText($bConvertToPlainText = false) { - if ($bConvertToPlainText) - { + if ($bConvertToPlainText) { // Rebuild the log, but filtering any HTML markup for the all {@see static::ENUM_FORMAT_HTML} entries in the log return $this->GetAsPlainText(); - } - else - { + } else { return $this->m_sLog; } } - + public static function FromJSON($oJson) { - if (!isset($oJson->items)) - { + if (!isset($oJson->items)) { throw new Exception("Missing 'items' elements"); } $oCaseLog = new ormCaseLog(); - foreach($oJson->items as $oItem) - { + foreach ($oJson->items as $oItem) { $oCaseLog->AddLogEntryFromJSON($oItem); } return $oCaseLog; } /** - * Return a value that will be further JSON encoded - */ + * Return a value that will be further JSON encoded + */ public function GetForJSON() { // Order by ascending date - $aRet = array('entries' => array_reverse($this->GetAsArray())); + $aRet = ['entries' => array_reverse($this->GetAsArray())]; return $aRet; } @@ -118,10 +114,9 @@ class ormCaseLog { */ public function GetAsArray() { - $aEntries = array(); + $aEntries = []; $iPos = 0; - for($index=count($this->m_aIndex)-1 ; $index >= 0 ; $index--) - { + for ($index = count($this->m_aIndex) - 1 ; $index >= 0 ; $index--) { $iPos += $this->m_aIndex[$index]['separator_length']; $sTextEntry = substr($this->m_sLog, $iPos, $this->m_aIndex[$index]['text_length']); $iPos += $this->m_aIndex[$index]['text_length']; @@ -130,27 +125,20 @@ class ormCaseLog { // therefore we have changed the format. To preserve the compatibility with existing // installations of iTop, both format are allowed: // the 'date' item is either a DateTime object, or a unix timestamp - if (is_int($this->m_aIndex[$index]['date'])) - { + if (is_int($this->m_aIndex[$index]['date'])) { // Unix timestamp - $sDate = date(AttributeDateTime::GetInternalFormat(),$this->m_aIndex[$index]['date']); - } - elseif (is_object($this->m_aIndex[$index]['date'])) - { - if (version_compare(phpversion(), '5.3.0', '>=')) - { + $sDate = date(AttributeDateTime::GetInternalFormat(), $this->m_aIndex[$index]['date']); + } elseif (is_object($this->m_aIndex[$index]['date'])) { + if (version_compare(phpversion(), '5.3.0', '>=')) { // DateTime $sDate = $this->m_aIndex[$index]['date']->format(AttributeDateTime::GetInternalFormat()); - } - else - { + } else { // No Warning... but the date is unknown $sDate = ''; } } - $sFormat = array_key_exists('format', $this->m_aIndex[$index]) ? $this->m_aIndex[$index]['format'] : static::ENUM_FORMAT_TEXT; - switch($sFormat) - { + $sFormat = array_key_exists('format', $this->m_aIndex[$index]) ? $this->m_aIndex[$index]['format'] : static::ENUM_FORMAT_TEXT; + switch ($sFormat) { case static::ENUM_FORMAT_TEXT: $sHtmlEntry = utils::TextToHtml($sTextEntry); break; @@ -160,27 +148,26 @@ class ormCaseLog { $sTextEntry = utils::HtmlToText($sHtmlEntry); break; } - $aEntries[] = array( + $aEntries[] = [ 'date' => $sDate, 'user_login' => $this->m_aIndex[$index]['user_name'], 'user_id' => $this->m_aIndex[$index]['user_id'], 'message' => $sTextEntry, 'message_html' => $sHtmlEntry, - ); + ]; } // Process the case of an eventual remainder (quick migration of AttributeText fields) - if ($iPos < (utils::StrLen($this->m_sLog) - 1)) - { + if ($iPos < (utils::StrLen($this->m_sLog) - 1)) { $sTextEntry = substr($this->m_sLog, $iPos); - $aEntries[] = array( + $aEntries[] = [ 'date' => '', 'user_login' => '', 'user_id' => 0, 'message' => $sTextEntry, 'message_html' => utils::TextToHtml($sTextEntry), - ); + ]; } return $aEntries; @@ -195,14 +182,13 @@ class ormCaseLog { { $sPlainText = ''; $aJSON = $this->GetForJSON(); - foreach($aJSON['entries'] as $aData) - { + foreach ($aJSON['entries'] as $aData) { $sSeparator = sprintf(CASELOG_SEPARATOR, $aData['date'], $aData['user_login'], $aData['user_id']); $sPlainText .= $sSeparator.$aData['message']; } - return $sPlainText; + return $sPlainText; } - + public function GetIndex() { return $this->m_aIndex; @@ -210,25 +196,27 @@ class ormCaseLog { public function __toString() { - if($this->IsEmpty()) return ''; + if ($this->IsEmpty()) { + return ''; + } - return $this->m_sLog; + return $this->m_sLog; } public function IsEmpty() - { - return ($this->m_sLog === null); - } + { + return ($this->m_sLog === null); + } /** * @return int The number of entries in this log * @since 3.0.0 */ - public function GetEntryCount(): int - { - return count($this->m_aIndex); - } - + public function GetEntryCount(): int + { + return count($this->m_aIndex); + } + public function ClearModifiedFlag() { $this->m_bModified = false; @@ -236,7 +224,7 @@ class ormCaseLog { /** * Produces an HTML representation, aimed at being used within an email - */ + */ public function GetAsEmailHtml() { $sStyleCaseLogHeader = ''; @@ -245,18 +233,14 @@ class ormCaseLog { $sHtml = '
      '; // Use table-layout:fixed to force the with to be independent from the actual content $iPos = 0; $aIndex = $this->m_aIndex; - for($index=count($aIndex)-1 ; $index >= 0 ; $index--) - { + for ($index = count($aIndex) - 1 ; $index >= 0 ; $index--) { $iPos += $aIndex[$index]['separator_length']; $sTextEntry = substr($this->m_sLog, $iPos, $aIndex[$index]['text_length']); $sCSSClass = 'caselog_entry_html'; - if (!array_key_exists('format', $aIndex[$index]) || ($aIndex[$index]['format'] == static::ENUM_FORMAT_TEXT)) - { + if (!array_key_exists('format', $aIndex[$index]) || ($aIndex[$index]['format'] == static::ENUM_FORMAT_TEXT)) { $sCSSClass = 'caselog_entry'; - $sTextEntry = str_replace(array("\r\n", "\n", "\r"), "
      ", utils::EscapeHtml($sTextEntry)); - } - else - { + $sTextEntry = str_replace(["\r\n", "\n", "\r"], "
      ", utils::EscapeHtml($sTextEntry)); + } else { $sTextEntry = InlineImage::FixUrls($sTextEntry); } $iPos += $aIndex[$index]['text_length']; @@ -266,20 +250,14 @@ class ormCaseLog { // therefore we have changed the format. To preserve the compatibility with existing // installations of iTop, both format are allowed: // the 'date' item is either a DateTime object, or a unix timestamp - if (is_int($aIndex[$index]['date'])) - { + if (is_int($aIndex[$index]['date'])) { // Unix timestamp $sDate = date((string)AttributeDateTime::GetFormat(), $aIndex[$index]['date']); - } - elseif (is_object($aIndex[$index]['date'])) - { - if (version_compare(phpversion(), '5.3.0', '>=')) - { + } elseif (is_object($aIndex[$index]['date'])) { + if (version_compare(phpversion(), '5.3.0', '>=')) { // DateTime $sDate = $aIndex[$index]['date']->format((string)AttributeDateTime::GetFormat()); - } - else - { + } else { // No Warning... but the date is unknown $sDate = ''; } @@ -295,7 +273,7 @@ class ormCaseLog { // Process the case of an eventual remainder (quick migration of AttributeText fields) if ($iPos < (utils::StrLen($this->m_sLog) - 1)) { $sTextEntry = substr($this->m_sLog, $iPos); - $sTextEntry = str_replace(array("\r\n", "\n", "\r"), "
      ", utils::EscapeHtml($sTextEntry)); + $sTextEntry = str_replace(["\r\n", "\n", "\r"], "
      ", utils::EscapeHtml($sTextEntry)); if (count($this->m_aIndex) == 0) { $sHtml .= '
      '; @@ -313,10 +291,10 @@ class ormCaseLog { $sHtml .= '
      '; return $sHtml; } - + /** * Produces an HTML representation, aimed at being used to produce a PDF with TCPDF (no table) - */ + */ public function GetAsSimpleHtml($aTransfoHandler = null) { $sStyleCaseLogEntry = ''; @@ -324,13 +302,13 @@ class ormCaseLog { $sHtml = '
        '; $iPos = 0; $aIndex = $this->m_aIndex; - for($index=count($aIndex)-1 ; $index >= 0 ; $index--) { + for ($index = count($aIndex) - 1 ; $index >= 0 ; $index--) { $iPos += $aIndex[$index]['separator_length']; $sTextEntry = substr($this->m_sLog, $iPos, $aIndex[$index]['text_length']); $sCSSClass = 'case_log_simple_html_entry_html'; if (!array_key_exists('format', $aIndex[$index]) || ($aIndex[$index]['format'] == static::ENUM_FORMAT_TEXT)) { $sCSSClass = 'case_log_simple_html_entry'; - $sTextEntry = str_replace(array("\r\n", "\n", "\r"), "
        ", utils::EscapeHtml($sTextEntry)); + $sTextEntry = str_replace(["\r\n", "\n", "\r"], "
        ", utils::EscapeHtml($sTextEntry)); if (!is_null($aTransfoHandler)) { $sTextEntry = call_user_func($aTransfoHandler, $sTextEntry); } @@ -339,7 +317,7 @@ class ormCaseLog { $sTextEntry = call_user_func($aTransfoHandler, $sTextEntry, true /* wiki "links" only */); } $sTextEntry = InlineImage::FixUrls($sTextEntry); - } + } $iPos += $aIndex[$index]['text_length']; $sEntry = '
      • '; @@ -347,20 +325,14 @@ class ormCaseLog { // therefore we have changed the format. To preserve the compatibility with existing // installations of iTop, both format are allowed: // the 'date' item is either a DateTime object, or a unix timestamp - if (is_int($aIndex[$index]['date'])) - { + if (is_int($aIndex[$index]['date'])) { // Unix timestamp - $sDate = date((string)AttributeDateTime::GetFormat(),$aIndex[$index]['date']); - } - elseif (is_object($aIndex[$index]['date'])) - { - if (version_compare(phpversion(), '5.3.0', '>=')) - { + $sDate = date((string)AttributeDateTime::GetFormat(), $aIndex[$index]['date']); + } elseif (is_object($aIndex[$index]['date'])) { + if (version_compare(phpversion(), '5.3.0', '>=')) { // DateTime $sDate = $aIndex[$index]['date']->format((string)AttributeDateTime::GetFormat()); - } - else - { + } else { // No Warning... but the date is unknown $sDate = ''; } @@ -376,7 +348,7 @@ class ormCaseLog { // Process the case of an eventual remainder (quick migration of AttributeText fields) if ($iPos < (utils::StrLen($this->m_sLog) - 1)) { $sTextEntry = substr($this->m_sLog, $iPos); - $sTextEntry = str_replace(array("\r\n", "\n", "\r"), "
        ", utils::EscapeHtml($sTextEntry)); + $sTextEntry = str_replace(["\r\n", "\n", "\r"], "
        ", utils::EscapeHtml($sTextEntry)); if (count($this->m_aIndex) == 0) { $sHtml .= '
      • '; @@ -397,7 +369,7 @@ class ormCaseLog { /** * Produces an HTML representation, aimed at being used within the iTop framework - */ + */ public function GetAsHTML(WebPage $oP = null, $bEditMode = false, $aTransfoHandler = null) { $bPrintableVersion = (utils::ReadParam('printable', '0') == '1'); @@ -405,35 +377,27 @@ class ormCaseLog { $oBlock = UIContentBlockUIBlockFactory::MakeStandard(null, ['ibo-caselog-list']); $iPos = 0; $aIndex = $this->m_aIndex; - if (($bEditMode) && (count($aIndex) > 0) && $this->m_bModified) - { + if (($bEditMode) && (count($aIndex) > 0) && $this->m_bModified) { // Don't display the first element, that is still considered as editable $aLastEntry = end($aIndex); $iPos = $aLastEntry['separator_length'] + $aLastEntry['text_length']; array_pop($aIndex); } - for($index=count($aIndex)-1 ; $index >= 0 ; $index--) - { - if (!$bPrintableVersion && ($index < count($aIndex) - CASELOG_VISIBLE_ITEMS)) - { + for ($index = count($aIndex) - 1 ; $index >= 0 ; $index--) { + if (!$bPrintableVersion && ($index < count($aIndex) - CASELOG_VISIBLE_ITEMS)) { $bIsOpen = false; - } - else - { + } else { $bIsOpen = true; } $iPos += $aIndex[$index]['separator_length']; $sTextEntry = substr($this->m_sLog, $iPos, $aIndex[$index]['text_length']); if (!array_key_exists('format', $aIndex[$index]) || ($aIndex[$index]['format'] == static::ENUM_FORMAT_TEXT)) { - $sTextEntry = str_replace(array("\r\n", "\n", "\r"), "
        ", utils::EscapeHtml($sTextEntry)); + $sTextEntry = str_replace(["\r\n", "\n", "\r"], "
        ", utils::EscapeHtml($sTextEntry)); if (!is_null($aTransfoHandler)) { $sTextEntry = call_user_func($aTransfoHandler, $sTextEntry); } - } - else - { - if (!is_null($aTransfoHandler)) - { + } else { + if (!is_null($aTransfoHandler)) { $sTextEntry = call_user_func($aTransfoHandler, $sTextEntry, true /* wiki "links" only */); } $sTextEntry = InlineImage::FixUrls($sTextEntry); @@ -444,25 +408,19 @@ class ormCaseLog { // therefore we have changed the format. To preserve the compatibility with existing // installations of iTop, both format are allowed: // the 'date' item is either a DateTime object, or a unix timestamp - if (is_int($aIndex[$index]['date'])) - { + if (is_int($aIndex[$index]['date'])) { // Unix timestamp - $sDate = date((string)AttributeDateTime::GetFormat(),$aIndex[$index]['date']); - } - elseif (is_object($aIndex[$index]['date'])) - { - if (version_compare(phpversion(), '5.3.0', '>=')) - { + $sDate = date((string)AttributeDateTime::GetFormat(), $aIndex[$index]['date']); + } elseif (is_object($aIndex[$index]['date'])) { + if (version_compare(phpversion(), '5.3.0', '>=')) { // DateTime $sDate = $aIndex[$index]['date']->format((string)AttributeDateTime::GetFormat()); - } - else - { + } else { // No Warning... but the date is unknown $sDate = ''; } } - $oCollapsibleBlock = CollapsibleSectionUIBlockFactory::MakeStandard( sprintf(Dict::S('UI:CaseLog:Header_Date_UserName'), $sDate, $aIndex[$index]['user_name'])); + $oCollapsibleBlock = CollapsibleSectionUIBlockFactory::MakeStandard(sprintf(Dict::S('UI:CaseLog:Header_Date_UserName'), $sDate, $aIndex[$index]['user_name'])); $oCollapsibleBlock->AddSubBlock(new Html($sTextEntry)); $oCollapsibleBlock->SetOpenedByDefault($bIsOpen); $oBlock->AddSubBlock($oCollapsibleBlock); @@ -471,7 +429,7 @@ class ormCaseLog { if ($iPos < (utils::StrLen($this->m_sLog) - 1)) { // In this case the format is always "text" $sTextEntry = substr($this->m_sLog, $iPos); - $sTextEntry = str_replace(array("\r\n", "\n", "\r"), "
        ", utils::EscapeHtml($sTextEntry)); + $sTextEntry = str_replace(["\r\n", "\n", "\r"], "
        ", utils::EscapeHtml($sTextEntry)); if (!is_null($aTransfoHandler)) { $sTextEntry = call_user_func($aTransfoHandler, $sTextEntry); } @@ -481,27 +439,22 @@ class ormCaseLog { $oCollapsibleBlock->AddSubBlock(new Html($sTextEntry)); $oCollapsibleBlock->SetOpenedByDefault(true); $oBlock->AddSubBlock($oCollapsibleBlock); - } - else - { - if (!$bPrintableVersion && (count($this->m_aIndex) - CASELOG_VISIBLE_ITEMS > 0)) - { + } else { + if (!$bPrintableVersion && (count($this->m_aIndex) - CASELOG_VISIBLE_ITEMS > 0)) { $bIsOpen = false; - } - else - { + } else { $bIsOpen = true; } - $oCollapsibleBlock = CollapsibleSectionUIBlockFactory::MakeStandard( Dict::S('UI:CaseLog:InitialValue')); + $oCollapsibleBlock = CollapsibleSectionUIBlockFactory::MakeStandard(Dict::S('UI:CaseLog:InitialValue')); $oCollapsibleBlock->AddSubBlock(new Html($sTextEntry)); $oCollapsibleBlock->SetOpenedByDefault($bIsOpen); } } $oBlockRenderer = new BlockRenderer($oBlock); $sHtml = $oBlockRenderer->RenderHtml(); - $sScript = $oBlockRenderer->RenderJsInlineRecursively($oBlock,iUIBlock::ENUM_JS_TYPE_ON_READY); + $sScript = $oBlockRenderer->RenderJsInlineRecursively($oBlock, iUIBlock::ENUM_JS_TYPE_ON_READY); $aJsFiles = $oBlockRenderer->GetJsFiles(); - if ($sScript!=''){ + if ($sScript != '') { if ($oP == null) { $sScript = ''; $sHtml .= $sScript; @@ -510,7 +463,7 @@ class ormCaseLog { } } // Ugly hack as we use a block and strip its content above, we'll also need JS files it depends on - if(count($aJsFiles) > 0){ + if (count($aJsFiles) > 0) { foreach ($aJsFiles as $sFileAbsUrl) { if ($oP === null) { $sScript = ''; @@ -520,7 +473,7 @@ class ormCaseLog { } } } - + return $sHtml; } @@ -535,7 +488,7 @@ class ormCaseLog { * @throws \ArchivedObjectException * @throws \CoreException * @throws \OQLException - * + * * @since 3.0.0 New $iOnBehalfOfId parameter * @since 3.0.0 May throw \ArchivedObjectException exception */ @@ -546,24 +499,19 @@ class ormCaseLog { if ($sOnBehalfOf == '' && $iOnBehalfOfId === null) { $sOnBehalfOf = UserRights::GetUserFriendlyName(); $iUserId = UserRights::GetUserId(); - } - elseif ($iOnBehalfOfId !== null) { + } elseif ($iOnBehalfOfId !== null) { $iUserId = $iOnBehalfOfId; /* @var User $oUser */ $oUser = MetaModel::GetObject('User', $iUserId, false, true); if ($oUser !== null && $sOnBehalfOf === '') { $sOnBehalfOf = $oUser->GetFriendlyName(); } - } - else - { + } else { $iUserId = null; } - if ($this->m_bModified) - { + if ($this->m_bModified) { $aLatestEntry = end($this->m_aIndex); - if ($aLatestEntry['user_name'] == $sOnBehalfOf) - { + if ($aLatestEntry['user_name'] == $sOnBehalfOf) { // Append the new text to the previous one $sPreviousText = substr($this->m_sLog, $aLatestEntry['separator_length'], $aLatestEntry['text_length']); $sText = $sPreviousText."\n".$sText; @@ -578,72 +526,55 @@ class ormCaseLog { $iSepLength = strlen($sSeparator); $iTextlength = strlen($sText); $this->m_sLog = $sSeparator.$sText.$this->m_sLog; // Latest entry printed first - $this->m_aIndex[] = array( + $this->m_aIndex[] = [ 'user_name' => $sOnBehalfOf, 'user_id' => $iUserId, 'date' => time(), 'text_length' => $iTextlength, 'separator_length' => $iSepLength, 'format' => static::ENUM_FORMAT_HTML, - ); + ]; $this->m_bModified = true; } public function AddLogEntryFromJSON($oJson, $bCheckUserId = true) { - if (isset($oJson->user_id)) - { - if (!UserRights::IsAdministrator()) - { + if (isset($oJson->user_id)) { + if (!UserRights::IsAdministrator()) { throw new Exception("Only administrators can set the user id", RestResult::UNAUTHORIZED); } - if ($bCheckUserId && ($oJson->user_id != 0)) - { - try - { + if ($bCheckUserId && ($oJson->user_id != 0)) { + try { $oUser = RestUtils::FindObjectFromKey('User', $oJson->user_id); - } - catch(Exception $e) - { + } catch (Exception $e) { throw new Exception('user_id: '.$e->getMessage(), $e->getCode()); } $iUserId = $oUser->GetKey(); $sOnBehalfOf = $oUser->GetFriendlyName(); - } - else - { + } else { $iUserId = $oJson->user_id; $sOnBehalfOf = $oJson->user_login; } - } - else - { + } else { $iUserId = UserRights::GetUserId(); $sOnBehalfOf = UserRights::GetUserFriendlyName(); } - - if (isset($oJson->date)) - { + + if (isset($oJson->date)) { $oDate = new DateTime($oJson->date); $iDate = (int) $oDate->format('U'); - } - else - { + } else { $iDate = time(); } - if (isset($oJson->format)) - { + if (isset($oJson->format)) { $sFormat = $oJson->format; - } - else - { + } else { // The default is HTML $sFormat = static::ENUM_FORMAT_HTML; } $sText = isset($oJson->message) ? $oJson->message : ''; - if ($sFormat == static::ENUM_FORMAT_HTML) - { + if ($sFormat == static::ENUM_FORMAT_HTML) { $sText = HTMLSanitizer::Sanitize($sText); } @@ -653,14 +584,14 @@ class ormCaseLog { $iSepLength = strlen($sSeparator); $iTextlength = strlen($sText); $this->m_sLog = $sSeparator.$sText.$this->m_sLog; // Latest entry printed first - $this->m_aIndex[] = array( - 'user_name' => $sOnBehalfOf, - 'user_id' => $iUserId, - 'date' => $iDate, - 'text_length' => $iTextlength, + $this->m_aIndex[] = [ + 'user_name' => $sOnBehalfOf, + 'user_id' => $iUserId, + 'date' => $iDate, + 'text_length' => $iTextlength, 'separator_length' => $iSepLength, 'format' => $sFormat, - ); + ]; $this->m_bModified = true; } @@ -668,8 +599,7 @@ class ormCaseLog { public function GetModifiedEntry($sFormat = self::ENUM_FORMAT_TEXT) { $sModifiedEntry = ''; - if ($this->m_bModified) - { + if ($this->m_bModified) { $sModifiedEntry = $this->GetLatestEntry($sFormat); } return $sModifiedEntry; @@ -717,7 +647,7 @@ class ormCaseLog { $iLast = end($aKeys); // Strict standards: the parameter passed to 'end' must be a variable since it is passed by reference return $iLast; } - + /** * Get the text string corresponding to the given entry in the log (zero based index, older entries first) * @param integer $iIndex @@ -727,8 +657,7 @@ class ormCaseLog { { $iPos = 0; $index = count($this->m_aIndex) - 1; - while($index > $iIndex) - { + while ($index > $iIndex) { $iPos += $this->m_aIndex[$index]['separator_length']; $iPos += $this->m_aIndex[$index]['text_length']; $index--; diff --git a/core/ormcustomfieldsvalue.class.inc.php b/core/ormcustomfieldsvalue.class.inc.php index ef8149fa0..d280a4179 100644 --- a/core/ormcustomfieldsvalue.class.inc.php +++ b/core/ormcustomfieldsvalue.class.inc.php @@ -1,4 +1,5 @@ - /** * Base class to hold the value managed by {@see CustomFieldsHandler} and {@see AttributeCustomFields} * diff --git a/core/ormdocument.class.inc.php b/core/ormdocument.class.inc.php index 27af2d970..7f62a23ef 100644 --- a/core/ormdocument.class.inc.php +++ b/core/ormdocument.class.inc.php @@ -1,4 +1,5 @@ file($sPath); } @@ -144,7 +144,9 @@ class ormDocument public function __toString() { - if($this->IsEmpty()) return ''; + if ($this->IsEmpty()) { + return ''; + } return MyHelpers::beautifulstr($this->m_data, 100, true); } @@ -180,7 +182,7 @@ class ormDocument return true; } } - + public function GetMimeType() { return $this->m_sMimeType; @@ -188,8 +190,7 @@ class ormDocument public function GetMainMimeType() { $iSeparatorPos = strpos($this->m_sMimeType, '/'); - if ($iSeparatorPos > 0) - { + if ($iSeparatorPos > 0) { return substr($this->m_sMimeType, 0, $iSeparatorPos); } return $this->m_sMimeType; @@ -267,22 +268,22 @@ class ormDocument } return $sResult; } - + /** * Returns an hyperlink to display the document *inline* * @return string - */ + */ public function GetDisplayLink($sClass, $Id, $sAttCode) { $sUrl = $this->GetDisplayURL($sClass, $Id, $sAttCode); return "".utils::EscapeHtml($this->GetFileName())."\n"; } - + /** * Returns an hyperlink to download the document (content-disposition: attachment) * @return string - */ + */ public function GetDownloadLink($sClass, $Id, $sAttCode) { $sUrl = $this->GetDownloadURL($sClass, $Id, $sAttCode); @@ -298,7 +299,7 @@ class ormDocument { $sSignature = $this->GetSignature(); // TODO: When refactoring this with the URLMaker system, mind to also change calls in the portal (look for the "p_object_document_display" route) - return utils::GetAbsoluteUrlAppRoot() . "pages/ajax.render.php?operation=display_document&class=$sClass&id=$Id&field=$sAttCode&s=$sSignature&cache=86400"; + return utils::GetAbsoluteUrlAppRoot()."pages/ajax.render.php?operation=display_document&class=$sClass&id=$Id&field=$sAttCode&s=$sSignature&cache=86400"; } /** @@ -310,22 +311,21 @@ class ormDocument // Compute a signature to reset the cache anytime the data changes (this is acceptable if used only with icon files) $sSignature = $this->GetSignature(); // TODO: When refactoring this with the URLMaker system, mind to also change calls in the portal (look for the "p_object_document_display" route) - return utils::GetAbsoluteUrlAppRoot() . "pages/ajax.document.php?operation=download_document&class=$sClass&id=$Id&field=$sAttCode&s=$sSignature&cache=86400"; + return utils::GetAbsoluteUrlAppRoot()."pages/ajax.document.php?operation=download_document&class=$sClass&id=$Id&field=$sAttCode&s=$sSignature&cache=86400"; } public function IsPreviewAvailable() { $bRet = false; - switch($this->GetMimeType()) - { + switch ($this->GetMimeType()) { case 'image/png': case 'image/jpg': case 'image/jpeg': case 'image/gif': case 'image/bmp': case 'image/svg+xml': - $bRet = true; - break; + $bRet = true; + break; } return $bRet; } @@ -345,11 +345,9 @@ class ormDocument */ public static function DownloadDocument(WebPage $oPage, $sClass, $id, $sAttCode, $sContentDisposition = 'attachment', $sSecretField = null, $sSecretValue = null) { - try - { + try { $oObj = MetaModel::GetObject($sClass, $id, false, false); - if (!is_object($oObj)) - { + if (!is_object($oObj)) { // If access to the document is not granted, check if the access to the host object is allowed $oObj = MetaModel::GetObject($sClass, $id, false, true); if ($oObj instanceof Attachment) { @@ -364,30 +362,28 @@ class ormDocument throw new Exception("Invalid id ($id) for class '$sClass' - the object does not exist or you are not allowed to view it"); } } - if (($sSecretField != null) && ($oObj->Get($sSecretField) != $sSecretValue)) - { + if (($sSecretField != null) && ($oObj->Get($sSecretField) != $sSecretValue)) { usleep(200); throw new Exception("Invalid secret for class '$sClass' - the object does not exist or you are not allowed to view it"); } /** @var \ormDocument $oDocument */ $oDocument = $oObj->Get($sAttCode); - if (is_object($oDocument)) - { - $aEventData = array( + if (is_object($oDocument)) { + $aEventData = [ 'debug_info' => $oDocument->GetFileName(), 'object' => $oObj, 'att_code' => $sAttCode, 'document' => $oDocument, 'content_disposition' => $sContentDisposition, - ); + ]; EventService::FireEvent(new EventData(\EVENT_DOWNLOAD_DOCUMENT, $sClass, $aEventData)); $oPage->TrashUnexpectedOutput(); $oPage->SetContentType($oDocument->GetMimeType()); - $oPage->SetContentDisposition($sContentDisposition,$oDocument->GetFileName()); + $oPage->SetContentDisposition($sContentDisposition, $oDocument->GetFileName()); $oPage->add($oDocument->GetData()); // Update downloads count only when content disposition is set to "attachment" as other disposition are to display the document within the page - if($sContentDisposition === static::ENUM_CONTENT_DISPOSITION_ATTACHMENT) { + if ($sContentDisposition === static::ENUM_CONTENT_DISPOSITION_ATTACHMENT) { $oDocument->IncreaseDownloadsCount(); $oObj->Set($sAttCode, $oDocument); // $oObj can be a \DBObject or \cmdbAbstractObject so we ahve to protect it @@ -398,9 +394,7 @@ class ormDocument $oObj->DBUpdate(); } } - } - catch(Exception $e) - { + } catch (Exception $e) { $oPage->p($e->getMessage()); } } diff --git a/core/ormlinkset.class.inc.php b/core/ormlinkset.class.inc.php index 66c951996..e767c8c38 100644 --- a/core/ormlinkset.class.inc.php +++ b/core/ormlinkset.class.inc.php @@ -1,4 +1,5 @@ DBObject */ - protected $aPreserved = array(); + protected $aPreserved = []; /** * @var DBObject[] New items */ - protected $aAdded = array(); + protected $aAdded = []; /** * @var DBObject[] Modified items (could also be found in aPreserved) */ - protected $aModified = array(); + protected $aModified = []; /** * @var int[] Removed items */ - protected $aRemoved = array(); + protected $aRemoved = []; /** * @var int Position in the collection @@ -100,13 +100,11 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator $this->oOriginalSet = $oOriginalSet ? clone $oOriginalSet : null; $oAttDef = MetaModel::GetAttributeDef($sHostClass, $sAttCode); - if (!$oAttDef instanceof AttributeLinkedSet) - { + if (!$oAttDef instanceof AttributeLinkedSet) { throw new Exception("ormLinkSet: $sAttCode is not a link set"); } $this->sClass = $oAttDef->GetLinkedClass(); - if ($oOriginalSet && ($oOriginalSet->GetClass() != $this->sClass)) - { + if ($oOriginalSet && ($oOriginalSet->GetClass() != $this->sClass)) { throw new Exception("ormLinkSet: wrong class for the original set, found {$oOriginalSet->GetClass()} while expecting {$oAttDef->GetLinkedClass()}"); } } @@ -140,41 +138,37 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator { assert($oLink instanceof $this->sClass); // No impact on the iteration algorithm - $iObjectId = $oLink->GetKey(); + $iObjectId = $oLink->GetKey(); $this->aAdded[$iObjectId] = $oLink; $this->bHasDelta = true; } - /** - * @param DBObject $oObject - * @param string $sClassAlias - * - * @deprecated Since iTop 2.4, use {@link \ormLinkSet::AddItem()} instead. - */ + /** + * @param DBObject $oObject + * @param string $sClassAlias + * + * @deprecated Since iTop 2.4, use {@link \ormLinkSet::AddItem()} instead. + */ public function AddObject(DBObject $oObject, $sClassAlias = '') - { - DeprecatedCallsLog::NotifyDeprecatedPhpMethod('use \ormLinkSet::AddItem() instead'); - $this->AddItem($oObject); - } + { + DeprecatedCallsLog::NotifyDeprecatedPhpMethod('use \ormLinkSet::AddItem() instead'); + $this->AddItem($oObject); + } /** * @param $iObjectId */ public function RemoveItem($iObjectId) { - if (array_key_exists($iObjectId, $this->aPreserved)) - { + if (array_key_exists($iObjectId, $this->aPreserved)) { unset($this->aPreserved[$iObjectId]); $this->aRemoved[$iObjectId] = $iObjectId; $this->bHasDelta = true; + } else { + if (array_key_exists($iObjectId, $this->aAdded)) { + unset($this->aAdded[$iObjectId]); + } } - else - { - if (array_key_exists($iObjectId, $this->aAdded)) - { - unset($this->aAdded[$iObjectId]); - } - } } /** @@ -185,12 +179,11 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator assert($oLink instanceof $this->sClass); $iObjectId = $oLink->GetKey(); - if (array_key_exists($iObjectId, $this->aPreserved)) - { - unset($this->aPreserved[$iObjectId]); - $this->aModified[$iObjectId] = $oLink; - $this->bHasDelta = true; - } + if (array_key_exists($iObjectId, $this->aPreserved)) { + unset($this->aPreserved[$iObjectId]); + $this->aModified[$iObjectId] = $oLink; + $this->bHasDelta = true; + } } /** @@ -200,33 +193,25 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator */ protected function LoadOriginalIds() { - if ($this->aOriginalObjects === null) - { - if ($this->oOriginalSet) - { + if ($this->aOriginalObjects === null) { + if ($this->oOriginalSet) { $this->aOriginalObjects = $this->GetArrayOfIndex(); $this->aPreserved = $this->aOriginalObjects; // Copy (not effective until aPreserved gets modified) - foreach ($this->aRemoved as $iObjectId) - { - if (array_key_exists($iObjectId, $this->aPreserved)) - { - unset($this->aPreserved[$iObjectId]); - } - } - foreach ($this->aModified as $iObjectId => $oLink) - { - if (array_key_exists($iObjectId, $this->aPreserved)) - { - unset($this->aPreserved[$iObjectId]); - } - } - } - else - { + foreach ($this->aRemoved as $iObjectId) { + if (array_key_exists($iObjectId, $this->aPreserved)) { + unset($this->aPreserved[$iObjectId]); + } + } + foreach ($this->aModified as $iObjectId => $oLink) { + if (array_key_exists($iObjectId, $this->aPreserved)) { + unset($this->aPreserved[$iObjectId]); + } + } + } else { // Nothing to load - $this->aOriginalObjects = array(); - $this->aPreserved = array(); + $this->aOriginalObjects = []; + $this->aPreserved = []; } } } @@ -242,58 +227,53 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator */ protected function GetArrayOfIndex() { - $aRet = array(); + $aRet = []; $this->oOriginalSet->Rewind(); $iRow = 0; - while ($oObject = $this->oOriginalSet->Fetch()) - { + while ($oObject = $this->oOriginalSet->Fetch()) { $aRet[$oObject->GetKey()] = $iRow++; } return $aRet; } - /** - * @param bool $bWithId - * @return array - * @deprecated Since iTop 2.4, use foreach($this as $oItem){} instead - */ - public function ToArray($bWithId = true) - { - DeprecatedCallsLog::NotifyDeprecatedPhpMethod('use foreach($this as $oItem){} instead'); - $aRet = array(); - foreach ($this as $oItem) { - if ($bWithId) { - $aRet[$oItem->GetKey()] = $oItem; - } else { - $aRet[] = $oItem; - } - } - return $aRet; - } + /** + * @param bool $bWithId + * @return array + * @deprecated Since iTop 2.4, use foreach($this as $oItem){} instead + */ + public function ToArray($bWithId = true) + { + DeprecatedCallsLog::NotifyDeprecatedPhpMethod('use foreach($this as $oItem){} instead'); + $aRet = []; + foreach ($this as $oItem) { + if ($bWithId) { + $aRet[$oItem->GetKey()] = $oItem; + } else { + $aRet[] = $oItem; + } + } + return $aRet; + } - /** - * @param string $sAttCode - * @param bool $bWithId - * @return array - */ - public function GetColumnAsArray($sAttCode, $bWithId = true) - { - $aRet = array(); - foreach($this as $oItem) - { - if ($bWithId) - { - $aRet[$oItem->GetKey()] = $oItem->Get($sAttCode); - } - else - { - $aRet[] = $oItem->Get($sAttCode); - } - } - return $aRet; - } + /** + * @param string $sAttCode + * @param bool $bWithId + * @return array + */ + public function GetColumnAsArray($sAttCode, $bWithId = true) + { + $aRet = []; + foreach ($this as $oItem) { + if ($bWithId) { + $aRet[$oItem->GetKey()] = $oItem->Get($sAttCode); + } else { + $aRet[] = $oItem->Get($sAttCode); + } + } + return $aRet; + } - /** + /** * The class of the objects of the collection (at least a common ancestor) * * @return string @@ -331,13 +311,11 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator $this->LoadOriginalIds(); $iCount = $this->Count(); - if ($iPosition >= $iCount) - { + if ($iPosition >= $iCount) { throw new Exception("Invalid position $iPosition: the link set is made of $iCount items."); } $this->rewind(); - for($iPos = 0 ; $iPos < $iPosition ; $iPos++) - { + for ($iPos = 0 ; $iPos < $iPosition ; $iPos++) { $this->next(); } } @@ -355,8 +333,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator $this->LoadOriginalIds(); $ret = $this->current(); - if ($ret === false) - { + if ($ret === false) { $ret = null; } $this->next(); @@ -381,22 +358,16 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator $this->LoadOriginalIds(); $iPreservedCount = count($this->aPreserved); - if ($this->iCursor < $iPreservedCount) - { + if ($this->iCursor < $iPreservedCount) { $sId = key($this->aPreserved); $oRet = MetaModel::GetObject($this->sClass, $sId); - } - else - { - $iModifiedCount = count($this->aModified); - if($this->iCursor < $iPreservedCount + $iModifiedCount) - { - $oRet = current($this->aModified); - } - else - { - $oRet = current($this->aAdded); - } + } else { + $iModifiedCount = count($this->aModified); + if ($this->iCursor < $iPreservedCount + $iModifiedCount) { + $oRet = current($this->aModified); + } else { + $oRet = current($this->aAdded); + } } return $oRet; } @@ -415,21 +386,15 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator $this->LoadOriginalIds(); $iPreservedCount = count($this->aPreserved); - if ($this->iCursor < $iPreservedCount) - { + if ($this->iCursor < $iPreservedCount) { next($this->aPreserved); - } - else - { - $iModifiedCount = count($this->aModified); - if($this->iCursor < $iPreservedCount + $iModifiedCount) - { - next($this->aModified); - } - else - { - next($this->aAdded); - } + } else { + $iModifiedCount = count($this->aModified); + if ($this->iCursor < $iPreservedCount + $iModifiedCount) { + next($this->aModified); + } else { + next($this->aAdded); + } } // Increment AFTER moving the internal cursors because when starting aModified / aAdded, we must leave it intact $this->iCursor++; @@ -477,12 +442,12 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator */ public function rewind(): void { - $this->LoadOriginalIds(); + $this->LoadOriginalIds(); - $this->iCursor = 0; + $this->iCursor = 0; reset($this->aPreserved); - reset($this->aAdded); - reset($this->aModified); + reset($this->aAdded); + reset($this->aModified); } /** @@ -504,19 +469,14 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator public function Equals(ormLinkSet $oFellow) { $bRet = null; - if ($this === $oFellow) - { + if ($this === $oFellow) { $bRet = true; - } - else - { - if ( ($this->oOriginalSet !== $oFellow->oOriginalSet) - && ($this->oOriginalSet->GetFilter()->ToOQL() != $oFellow->oOriginalSet->GetFilter()->ToOQL()) ) - { + } else { + if (($this->oOriginalSet !== $oFellow->oOriginalSet) + && ($this->oOriginalSet->GetFilter()->ToOQL() != $oFellow->oOriginalSet->GetFilter()->ToOQL())) { throw new Exception('ormLinkSet::Equals assumes that compared link sets have the same original scope'); } - if ($this->HasDelta()) - { + if ($this->HasDelta()) { throw new Exception('ormLinkSet::Equals assumes that left link set had no delta'); } $bRet = !$oFellow->HasDelta(); @@ -532,22 +492,18 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator */ public function UpdateFromCompleteList(iDBObjectSetIterator $oFellow) { - if ($oFellow === $this) - { + if ($oFellow === $this) { throw new Exception('ormLinkSet::UpdateFromCompleteList assumes that the passed link set is at least a clone of the current one'); } $bUpdateFromDelta = false; - if ($oFellow instanceof ormLinkSet) - { - if ( ($this->oOriginalSet === $oFellow->oOriginalSet) - || ($this->oOriginalSet->GetFilter()->ToOQL() == $oFellow->oOriginalSet->GetFilter()->ToOQL()) ) - { + if ($oFellow instanceof ormLinkSet) { + if (($this->oOriginalSet === $oFellow->oOriginalSet) + || ($this->oOriginalSet->GetFilter()->ToOQL() == $oFellow->oOriginalSet->GetFilter()->ToOQL())) { $bUpdateFromDelta = true; } } - if ($bUpdateFromDelta) - { + if ($bUpdateFromDelta) { // Same original set -> simply update the delta $this->iCursor = 0; $this->aAdded = $oFellow->aAdded; @@ -555,43 +511,37 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator $this->aModified = $oFellow->aModified; $this->aPreserved = $oFellow->aPreserved; $this->bHasDelta = $oFellow->bHasDelta; - } - else - { + } else { // For backward compatibility reasons, let's rebuild a delta... // Reset the delta $this->iCursor = 0; - $this->aAdded = array(); - $this->aRemoved = array(); - $this->aModified = array(); - $this->aPreserved = ($this->aOriginalObjects === null) ? array() : $this->aOriginalObjects; + $this->aAdded = []; + $this->aRemoved = []; + $this->aModified = []; + $this->aPreserved = ($this->aOriginalObjects === null) ? [] : $this->aOriginalObjects; $this->bHasDelta = false; /** @var \AttributeLinkedSet|\AttributeLinkedSetIndirect $oAttDef */ $oAttDef = MetaModel::GetAttributeDef($this->sHostClass, $this->sAttCode); $sExtKeyToMe = $oAttDef->GetExtKeyToMe(); $sAdditionalKey = null; - if ($oAttDef->IsIndirect() && !$oAttDef->DuplicatesAllowed()) - { + if ($oAttDef->IsIndirect() && !$oAttDef->DuplicatesAllowed()) { $sAdditionalKey = $oAttDef->GetExtKeyToRemote(); } // Compare both collections by iterating the whole sets, order them, a build a fingerprint based on meaningful data (what make the difference) /** @var \DBObject $oLink */ - $oComparator = new DBObjectSetComparator($this, $oFellow, array($sExtKeyToMe), $sAdditionalKey); + $oComparator = new DBObjectSetComparator($this, $oFellow, [$sExtKeyToMe], $sAdditionalKey); $aChanges = $oComparator->GetDifferences(); - foreach ($aChanges['added'] as $oLink) - { + foreach ($aChanges['added'] as $oLink) { $this->AddItem($oLink); } - foreach ($aChanges['modified'] as $oLink) - { + foreach ($aChanges['modified'] as $oLink) { $this->ModifyItem($oLink); } - foreach ($aChanges['removed'] as $oLink) - { + foreach ($aChanges['removed'] as $oLink) { $this->RemoveItem($oLink->GetKey()); } } @@ -607,9 +557,8 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator { $aAdded = $this->aAdded; $aModified = $this->aModified; - $aRemoved = array(); - if (count($this->aRemoved) > 0) - { + $aRemoved = []; + if (count($this->aRemoved) > 0) { $oSearch = new DBObjectSearch($this->sClass); $oSearch->AddCondition('id', $this->aRemoved, 'IN'); $oSet = new DBObjectSet($oSearch); @@ -639,30 +588,23 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator $sExtKeyToMe = $oAttDef->GetExtKeyToMe(); $sExtKeyToRemote = $oAttDef->IsIndirect() ? $oAttDef->GetExtKeyToRemote() : 'n/a'; - $aCheckLinks = array(); - $aCheckRemote = array(); - foreach ($this->aAdded as $oLink) - { - if ($oLink->IsNew()) - { - if ($oAttDef->IsIndirect() && !$oAttDef->DuplicatesAllowed()) - { + $aCheckLinks = []; + $aCheckRemote = []; + foreach ($this->aAdded as $oLink) { + if ($oLink->IsNew()) { + if ($oAttDef->IsIndirect() && !$oAttDef->DuplicatesAllowed()) { //todo: faire un test qui passe dans cette branche ! $aCheckRemote[] = $oLink->Get($sExtKeyToRemote); } - } - else - { + } else { //todo: faire un test qui passe dans cette branche ! $aCheckLinks[] = $oLink->GetKey(); } } - foreach ($this->aRemoved as $iLinkId) - { + foreach ($this->aRemoved as $iLinkId) { $aCheckLinks[] = $iLinkId; } - foreach ($this->aModified as $iLinkId => $oLink) - { + foreach ($this->aModified as $iLinkId => $oLink) { $aCheckLinks[] = $oLink->GetKey(); } @@ -674,11 +616,10 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator // Check for the existing links // /** @var DBObject[] $aExistingLinks */ - $aExistingLinks = array(); + $aExistingLinks = []; /** @var Int[] $aExistingRemote */ - $aExistingRemote = array(); - if (count($aCheckLinks) > 0) - { + $aExistingRemote = []; + if (count($aCheckLinks) > 0) { $oSearch = new DBObjectSearch($this->sClass); $oSearch->AddCondition('id', $aCheckLinks, 'IN'); $oSet = new DBObjectSet($oSearch); @@ -687,8 +628,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator // Check for the existing remote objects // - if (count($aCheckRemote) > 0) - { + if (count($aCheckRemote) > 0) { $oSearch = new DBObjectSearch($this->sClass); $oSearch->AddCondition($sExtKeyToMe, $oHostObject->GetKey(), '='); $oSearch->AddCondition($sExtKeyToRemote, $aCheckRemote, 'IN'); @@ -698,33 +638,27 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator // Write the links according to the existing links // - foreach ($this->aAdded as $oLink) - { + foreach ($this->aAdded as $oLink) { // Make sure that the objects in the set point to "this" $oLink->Set($sExtKeyToMe, $oHostObject->GetKey()); - if ($oLink->IsNew()) - { - if (count($aCheckRemote) > 0) - { - $bIsDuplicate = false; - foreach($aExistingRemote as $sLinkKey => $sExtKey) - { - if ($sExtKey == $oLink->Get($sExtKeyToRemote)) - { - // Do not create a duplicate - // + In the case of a remove action followed by an add action - // of an existing link, - // the final state to consider is add action, - // so suppress the entry in the removed list. - if (array_key_exists($sLinkKey, $this->aRemoved)) - { - unset($this->aRemoved[$sLinkKey]); - } - $bIsDuplicate = true; - break; - } - } + if ($oLink->IsNew()) { + if (count($aCheckRemote) > 0) { + $bIsDuplicate = false; + foreach ($aExistingRemote as $sLinkKey => $sExtKey) { + if ($sExtKey == $oLink->Get($sExtKeyToRemote)) { + // Do not create a duplicate + // + In the case of a remove action followed by an add action + // of an existing link, + // the final state to consider is add action, + // so suppress the entry in the removed list. + if (array_key_exists($sLinkKey, $this->aRemoved)) { + unset($this->aRemoved[$sLinkKey]); + } + $bIsDuplicate = true; + break; + } + } if ($bIsDuplicate) { continue; } @@ -802,8 +736,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator /** @var \AttributeLinkedSet|\AttributeLinkedSetIndirect $oAttDef */ $oAttDef = MetaModel::GetAttributeDef($this->sHostClass, $this->sAttCode); $oLinkSearch = $this->GetFilter(); - if ($oAttDef->IsIndirect()) - { + if ($oAttDef->IsIndirect()) { $oLinkSearch->RenameAlias($oLinkSearch->GetClassAlias(), self::LINK_ALIAS); $sExtKeyToRemote = $oAttDef->GetExtKeyToRemote(); /** @var \AttributeExternalKey $oLinkingAttDef */ @@ -814,8 +747,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator $sTargetClass = $oLinkingAttDef->GetTargetClass(); $oRemoteClassSearch = new DBObjectSearch($sTargetClass, self::REMOTE_ALIAS); - if (!$bShowObsolete && MetaModel::IsObsoletable($sTargetClass)) - { + if (!$bShowObsolete && MetaModel::IsObsoletable($sTargetClass)) { $oNotObsolete = new BinaryExpression( new FieldExpression('obsolescence_flag', self::REMOTE_ALIAS), '=', @@ -824,8 +756,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator $oRemoteClassSearch->AddConditionExpression($oNotObsolete); } - if (!utils::IsArchiveMode() && MetaModel::IsArchivable($sTargetClass)) - { + if (!utils::IsArchiveMode() && MetaModel::IsArchivable($sTargetClass)) { $oNotArchived = new BinaryExpression( new FieldExpression('archive_flag', self::REMOTE_ALIAS), '=', @@ -866,7 +797,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator */ public function GetValues() { - $aValues = array(); + $aValues = []; foreach ($this->aPreserved as $sTagCode => $oTag) { $aValues[] = $sTagCode; } diff --git a/core/ormpassword.class.inc.php b/core/ormpassword.class.inc.php index a90780bdd..f8b4d2122 100644 --- a/core/ormpassword.class.inc.php +++ b/core/ormpassword.class.inc.php @@ -1,9 +1,10 @@ - require_once(APPROOT.'/core/simplecrypt.class.inc.php'); /** @@ -45,7 +45,7 @@ class ormPassword //only used for <= 2.5 hashed password $this->m_sSalt = $sSalt; } - + /** * Encrypts the clear text password, with a unique salt */ @@ -68,17 +68,17 @@ class ormPassword { return utils::IsNullOrEmptyString($this->m_sHashed); } - + public function GetHash() { return $this->m_sHashed; } - + public function GetSalt() { return $this->m_sSalt; } - + /** * Displays the password: displays some stars * @return string @@ -97,19 +97,16 @@ class ormPassword { $bResult = false; $aInfo = password_get_info($this->m_sHashed); - if (is_null($aInfo["algo"]) || $aInfo["algo"] === 0) - { + if (is_null($aInfo["algo"]) || $aInfo["algo"] === 0) { //unknown, assume it's a legacy password $sHashedPwd = $this->ComputeHash($sClearTextPassword); $bResult = ($this->m_sHashed == $sHashedPwd); - } - else - { + } else { $bResult = password_verify($sClearTextPassword, $this->m_sHashed); } return $bResult; } - + /** * Computes the hashed version of a password using a unique salt * for this password. A unique salt is generated if needed @@ -117,11 +114,9 @@ class ormPassword */ protected function ComputeHash($sClearTextPwd) { - if ($this->m_sSalt == null) - { + if ($this->m_sSalt == null) { $this->m_sSalt = SimpleCrypt::GetNewSalt(); } return hash('sha256', $this->m_sSalt.$sClearTextPwd); } } -?> diff --git a/core/ormset.class.inc.php b/core/ormset.class.inc.php index 139207c78..4667f51c2 100644 --- a/core/ormset.class.inc.php +++ b/core/ormset.class.inc.php @@ -1,4 +1,5 @@ GetValues(); - if (!empty($aValue)) - { + if (!empty($aValue)) { return implode(', ', $aValue); - } - else - { + } else { return ' '; } } @@ -86,8 +84,7 @@ class ormSet $this->sAttCode = $sAttCode; $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - if (!$oAttDef instanceof AttributeSet) - { + if (!$oAttDef instanceof AttributeSet) { throw new Exception("ormSet: field {$sClass}:{$sAttCode} is not a set"); } $this->sClass = $sClass; @@ -119,19 +116,16 @@ class ormSet */ public function SetValues($aItems) { - if (!is_array($aItems)) - { + if (!is_array($aItems)) { throw new CoreUnexpectedValue("Wrong value {$aItems} for {$this->sClass}:{$this->sAttCode}"); } - $aValues = array(); + $aValues = []; $iCount = 0; $bError = false; - foreach($aItems as $sItem) - { + foreach ($aItems as $sItem) { $iCount++; - if (($this->iLimit != 0) && ($iCount > $this->iLimit)) - { + if (($this->iLimit != 0) && ($iCount > $this->iLimit)) { $bError = true; continue; } @@ -139,13 +133,12 @@ class ormSet } $this->aPreserved = &$aValues; - $this->aRemoved = array(); - $this->aAdded = array(); - $this->aModified = array(); + $this->aRemoved = []; + $this->aAdded = []; + $this->aModified = []; $this->aOriginalObjects = $aValues; - if ($bError) - { + if ($bError) { throw new CoreException("Maximum number of items ({$this->iLimit}) reached for {$this->sClass}:{$this->sAttCode}"); } } @@ -167,10 +160,9 @@ class ormSet public function GetLabels() { - $aLabels = array(); + $aLabels = []; $aValues = $this->GetValues(); - foreach ($aValues as $sValue) - { + foreach ($aValues as $sValue) { $aLabels[$sValue] = $sValue; } return $aLabels; @@ -213,18 +205,16 @@ class ormSet $oSet->SetValues($aOrigItems); // now remove everything - foreach($aOrigItems as $oItem) - { + foreach ($aOrigItems as $oItem) { $oSet->Remove($oItem); } // now add the tags of the other ItemSet - foreach($oOtherSet->GetValues() as $oItem) - { + foreach ($oOtherSet->GetValues() as $oItem) { $oSet->Add($oItem); } - $aDelta = array(); + $aDelta = []; $aDelta['added'] = $oSet->GetAdded(); $aDelta['removed'] = $oSet->GetRemoved(); @@ -250,17 +240,13 @@ class ormSet */ public function ApplyDelta($aDelta) { - if (isset($aDelta['removed'])) - { - foreach($aDelta['removed'] as $oItem) - { + if (isset($aDelta['removed'])) { + foreach ($aDelta['removed'] as $oItem) { $this->Remove($oItem); } } - if (isset($aDelta['added'])) - { - foreach($aDelta['added'] as $oItem) - { + if (isset($aDelta['added'])) { + foreach ($aDelta['added'] as $oItem) { $this->Add($oItem); } } @@ -276,24 +262,19 @@ class ormSet */ public function Add($oItem) { - if (($this->iLimit != 0) && ($this->Count() > $this->iLimit)) - { + if (($this->iLimit != 0) && ($this->Count() > $this->iLimit)) { throw new CoreException("Maximum number of items ({$this->iLimit}) reached for {$this->sClass}:{$this->sAttCode}"); } - if ($this->IsItemInList($this->aPreserved, $oItem) || $this->IsItemInList($this->aAdded, $oItem)) - { + if ($this->IsItemInList($this->aPreserved, $oItem) || $this->IsItemInList($this->aAdded, $oItem)) { // nothing to do, already existing tag return; } // if removed and added again - if (($this->RemoveItemFromList($this->aRemoved, $oItem)) !== false) - { + if (($this->RemoveItemFromList($this->aRemoved, $oItem)) !== false) { // put it back into preserved $this->aPreserved[] = $oItem; // no need to add it to aModified : was already done when calling RemoveItem method - } - else - { + } else { $this->aAdded[] = $oItem; $this->aModified[] = $oItem; } @@ -304,21 +285,18 @@ class ormSet */ public function Remove($oItem) { - if ($this->IsItemInList($this->aRemoved, $oItem)) - { + if ($this->IsItemInList($this->aRemoved, $oItem)) { // nothing to do, already removed tag return; } - if ($this->RemoveItemFromList($this->aAdded, $oItem) !== false) - { + if ($this->RemoveItemFromList($this->aAdded, $oItem) !== false) { $this->aModified[] = $oItem; return; // if present in added, can't be in preserved ! } - if ($this->RemoveItemFromList($this->aPreserved, $oItem) !== false) - { + if ($this->RemoveItemFromList($this->aPreserved, $oItem) !== false) { $this->aModified[] = $oItem; $this->aRemoved[] = $oItem; } @@ -337,14 +315,11 @@ class ormSet */ private function RemoveItemFromList(&$aItemList, $oItem) { - if (!($this->IsItemInList($aItemList, $oItem))) - { + if (!($this->IsItemInList($aItemList, $oItem))) { return false; } - foreach ($aItemList as $index => $value) - { - if ($value === $oItem) - { + foreach ($aItemList as $index => $value) { + if ($value === $oItem) { unset($aItemList[$index]); return $oItem; } @@ -362,16 +337,13 @@ class ormSet */ public function GenerateDiffFromArray($aItems) { - foreach($this->GetValues() as $oCurrentItem) - { - if (!in_array($oCurrentItem, $aItems)) - { + foreach ($this->GetValues() as $oCurrentItem) { + if (!in_array($oCurrentItem, $aItems)) { $this->Remove($oCurrentItem); } } - foreach($aItems as $oNewItem) - { + foreach ($aItems as $oNewItem) { $this->Add($oNewItem); } } diff --git a/core/ormstopwatch.class.inc.php b/core/ormstopwatch.class.inc.php index f8e38da0f..97383bd49 100644 --- a/core/ormstopwatch.class.inc.php +++ b/core/ormstopwatch.class.inc.php @@ -1,9 +1,10 @@ iLastStart = $iLastStart; $this->iStopped = $iStopped; - $this->aThresholds = array(); + $this->aThresholds = []; } /** * Necessary for the triggers - */ + */ public function __toString() { return (string) $this->iTimeSpent; @@ -64,12 +64,12 @@ class ormStopWatch public function DefineThreshold($iPercent, $tDeadline = null, $bPassed = false, $bTriggered = false, $iOverrun = null, $aHighlightDef = null) { - $this->aThresholds[$iPercent] = array( + $this->aThresholds[$iPercent] = [ 'deadline' => $tDeadline, // unix time (seconds) 'triggered' => $bTriggered, 'overrun' => $iOverrun, 'highlight' => $aHighlightDef, // array('code' => string, 'persistent' => boolean) - ); + ]; } public function MarkThresholdAsTriggered($iPercent) @@ -94,18 +94,14 @@ class ormStopWatch */ public function GetElapsedTime($oAttDef, $oObject) { - if (is_null($this->iLastStart)) - { + if (is_null($this->iLastStart)) { return $this->GetTimeSpent(); - } - else - { + } else { $iElapsed = $this->ComputeDuration($oObject, $oAttDef, $this->iLastStart, time()); return $this->iTimeSpent + $iElapsed; } } - public function GetStartDate() { return $this->iStarted; @@ -123,39 +119,30 @@ class ormStopWatch public function GetThresholdDate($iPercent) { - if (array_key_exists($iPercent, $this->aThresholds)) - { + if (array_key_exists($iPercent, $this->aThresholds)) { return $this->aThresholds[$iPercent]['deadline']; - } - else - { + } else { return null; } } public function GetOverrun($iPercent) { - if (array_key_exists($iPercent, $this->aThresholds)) - { + if (array_key_exists($iPercent, $this->aThresholds)) { return $this->aThresholds[$iPercent]['overrun']; - } - else - { + } else { return null; } } public function IsThresholdPassed($iPercent) { $bRet = false; - if (array_key_exists($iPercent, $this->aThresholds)) - { + if (array_key_exists($iPercent, $this->aThresholds)) { $aThresholdData = $this->aThresholds[$iPercent]; - if (!is_null($aThresholdData['deadline']) && ($aThresholdData['deadline'] <= time())) - { + if (!is_null($aThresholdData['deadline']) && ($aThresholdData['deadline'] <= time())) { $bRet = true; } - if (isset($aThresholdData['overrun']) && ($aThresholdData['overrun'] > 0)) - { + if (isset($aThresholdData['overrun']) && ($aThresholdData['overrun'] > 0)) { $bRet = true; } } @@ -163,34 +150,27 @@ class ormStopWatch } public function IsThresholdTriggered($iPercent) { - if (array_key_exists($iPercent, $this->aThresholds)) - { + if (array_key_exists($iPercent, $this->aThresholds)) { return $this->aThresholds[$iPercent]['triggered']; - } - else - { + } else { return false; } } - + public function GetHighlightCode() { $sCode = ''; // Process the thresholds in ascending order - $aPercents = array(); - foreach($this->aThresholds as $iPercent => $aDefs) - { + $aPercents = []; + foreach ($this->aThresholds as $iPercent => $aDefs) { $aPercents[] = $iPercent; } sort($aPercents, SORT_NUMERIC); - foreach($aPercents as $iPercent) - { + foreach ($aPercents as $iPercent) { $aDefs = $this->aThresholds[$iPercent]; - if (array_key_exists('highlight', $aDefs) && is_array($aDefs['highlight']) && $this->IsThresholdPassed($iPercent)) - { + if (array_key_exists('highlight', $aDefs) && is_array($aDefs['highlight']) && $this->IsThresholdPassed($iPercent)) { // If persistant or SW running... - if (($aDefs['highlight']['persistent'] == true) || (($aDefs['highlight']['persistent'] == false) && !is_null($this->iLastStart))) - { + if (($aDefs['highlight']['persistent'] == true) || (($aDefs['highlight']['persistent'] == false) && !is_null($this->iLastStart))) { $sCode = $aDefs['highlight']['code']; } } @@ -200,47 +180,37 @@ class ormStopWatch public function GetAsHTML($oAttDef, $oHostObject = null) { - $aProperties = array(); + $aProperties = []; $aProperties['States'] = implode(', ', $oAttDef->GetStates()); - if (is_null($this->iLastStart)) - { - if (is_null($this->iStarted)) - { + if (is_null($this->iLastStart)) { + if (is_null($this->iStarted)) { $aProperties['Elapsed'] = 'never started'; - } - else - { + } else { $aProperties['Elapsed'] = $this->iTimeSpent.' s'; } - } - else - { - $aProperties['Elapsed'] = 'running '; + } else { + $aProperties['Elapsed'] = 'running '; } $aProperties['Started'] = $oAttDef->SecondsToDate($this->iStarted); $aProperties['LastStart'] = $oAttDef->SecondsToDate($this->iLastStart); $aProperties['Stopped'] = $oAttDef->SecondsToDate($this->iStopped); - foreach ($this->aThresholds as $iPercent => $aThresholdData) - { + foreach ($this->aThresholds as $iPercent => $aThresholdData) { $sThresholdDesc = $oAttDef->SecondsToDate($aThresholdData['deadline']); - if ($aThresholdData['triggered']) - { + if ($aThresholdData['triggered']) { $sThresholdDesc .= " TRIGGERED"; } - if ($aThresholdData['overrun']) - { + if ($aThresholdData['overrun']) { $sThresholdDesc .= " Overrun:".(int) $aThresholdData['overrun']." sec."; } $aProperties[$iPercent.'%'] = $sThresholdDesc; } $sRes = ""; $sRes .= ""; - foreach ($aProperties as $sProperty => $sValue) - { + foreach ($aProperties as $sProperty => $sValue) { $sRes .= ""; $sCell = str_replace("\n", "
        \n", $sValue ?? ''); $sRes .= ""; @@ -265,9 +235,8 @@ class ormStopWatch /** @var \iMetricComputer $oComputer */ $oComputer = new $sMetricComputer(); - $aCallSpec = array($oComputer, 'ComputeMetric'); - if (!is_callable($aCallSpec)) - { + $aCallSpec = [$oComputer, 'ComputeMetric']; + if (!is_callable($aCallSpec)) { throw new CoreException("Unknown class/verb '$sMetricComputer/ComputeMetric'"); } @@ -287,14 +256,12 @@ class ormStopWatch protected function ComputeDeadline($oObject, $oAttDef, $iPercent, $iStartTime, $iDurationSec) { $sWorkingTimeComputer = $oAttDef->Get('working_time_computing'); - if ($sWorkingTimeComputer == '') - { + if ($sWorkingTimeComputer == '') { $sWorkingTimeComputer = class_exists('SLAComputation') ? 'SLAComputation' : 'DefaultWorkingTimeComputer'; } $oComputer = new $sWorkingTimeComputer(); - $aCallSpec = array($oComputer, 'GetDeadline'); - if (!is_callable($aCallSpec)) - { + $aCallSpec = [$oComputer, 'GetDeadline']; + if (!is_callable($aCallSpec)) { throw new CoreException("Unknown class/verb '$sWorkingTimeComputer/GetDeadline'"); } // GetDeadline($oObject, $iDuration, DateTime $oStartDate) @@ -316,14 +283,12 @@ class ormStopWatch protected function ComputeDuration($oObject, $oAttDef, $iStartTime, $iEndTime) { $sWorkingTimeComputer = $oAttDef->Get('working_time_computing'); - if ($sWorkingTimeComputer == '') - { + if ($sWorkingTimeComputer == '') { $sWorkingTimeComputer = class_exists('SLAComputation') ? 'SLAComputation' : 'DefaultWorkingTimeComputer'; } $oComputer = new $sWorkingTimeComputer(); - $aCallSpec = array($oComputer, 'GetOpenDuration'); - if (!is_callable($aCallSpec)) - { + $aCallSpec = [$oComputer, 'GetOpenDuration']; + if (!is_callable($aCallSpec)) { throw new CoreException("Unknown class/verb '$sWorkingTimeComputer/GetOpenDuration'"); } // GetOpenDuration($oObject, DateTime $oStartDate, DateTime $oEndDate) @@ -339,14 +304,12 @@ class ormStopWatch $this->iStopped = null; $this->iStarted = null; - foreach ($this->aThresholds as $iPercent => &$aThresholdData) - { + foreach ($this->aThresholds as $iPercent => &$aThresholdData) { $aThresholdData['triggered'] = false; $aThresholdData['overrun'] = null; } - if (!is_null($this->iLastStart)) - { + if (!is_null($this->iLastStart)) { // Currently running... starting again from now! $this->iStarted = time(); $this->iLastStart = time(); @@ -357,23 +320,20 @@ class ormStopWatch /** * Start or continue * It is the responsibility of the caller to compute the deadlines - * (to avoid computing twice for the same result) - */ + * (to avoid computing twice for the same result) + */ public function Start($oObject, $oAttDef, $iNow = null) { - if (!is_null($this->iLastStart)) - { + if (!is_null($this->iLastStart)) { // Already started return false; } - if (is_null($iNow)) - { + if (is_null($iNow)) { $iNow = time(); } - if (is_null($this->iStarted)) - { + if (is_null($this->iStarted)) { $this->iStarted = $iNow; } $this->iLastStart = $iNow; @@ -384,39 +344,31 @@ class ormStopWatch /** * Compute or recompute the goal and threshold deadlines - */ + */ public function ComputeDeadlines($oObject, $oAttDef) { - if (is_null($this->iLastStart)) - { + if (is_null($this->iLastStart)) { // Currently stopped - do nothing return false; } $iDurationGoal = $this->ComputeGoal($oObject, $oAttDef); $iComputationRefTime = time(); - foreach ($this->aThresholds as $iPercent => &$aThresholdData) - { - if (is_null($iDurationGoal)) - { + foreach ($this->aThresholds as $iPercent => &$aThresholdData) { + if (is_null($iDurationGoal)) { // No limit: leave null thresholds $aThresholdData['deadline'] = null; - } - else - { + } else { $iThresholdDuration = round($iPercent * $iDurationGoal / 100); - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { $sClass = get_class($oObject); $sAttCode = $oAttDef->GetCode(); - WorkingTimeRecorder::Start($oObject, $iComputationRefTime, "ormStopWatch-Deadline-$iPercent-$sAttCode", 'Core:ExplainWTC:StopWatch-Deadline', array("Class:$sClass/Attribute:$sAttCode", $iPercent)); + WorkingTimeRecorder::Start($oObject, $iComputationRefTime, "ormStopWatch-Deadline-$iPercent-$sAttCode", 'Core:ExplainWTC:StopWatch-Deadline', ["Class:$sClass/Attribute:$sAttCode", $iPercent]); } $iRemaining = $iThresholdDuration - $this->iTimeSpent; - if ($iRemaining < 0) - { - if (class_exists('WorkingTimeRecorder')) - { + if ($iRemaining < 0) { + if (class_exists('WorkingTimeRecorder')) { $sClass = get_class($oObject); $sKey = $oObject->GetKey(); $sAttCode = $oAttDef->GetCode(); @@ -428,13 +380,11 @@ class ormStopWatch $aThresholdData['deadline'] = $this->ComputeDeadline($oObject, $oAttDef, $iPercent, $this->iLastStart, $iRemaining); // OR $aThresholdData['deadline'] = $this->ComputeDeadline($oObject, $oAttDef, $iPercent, $this->iStarted, $iThresholdDuration); - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::End(); } } - if (is_null($aThresholdData['deadline']) || ($aThresholdData['deadline'] > time())) - { + if (is_null($aThresholdData['deadline']) || ($aThresholdData['deadline'] > time())) { // The threshold is in the future, reset $aThresholdData['triggered'] = false; $aThresholdData['overrun'] = null; @@ -452,51 +402,41 @@ class ormStopWatch /** * Stop counting if not already done - */ + */ public function Stop($oObject, $oAttDef, $iNow = null) { - if (is_null($this->iLastStart)) - { + if (is_null($this->iLastStart)) { // Already stopped return false; } - if (is_null($iNow)) - { + if (is_null($iNow)) { $iNow = time(); } - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { $sClass = get_class($oObject); $sAttCode = $oAttDef->GetCode(); - WorkingTimeRecorder::Start($oObject, $iNow, "ormStopWatch-TimeSpent-$sAttCode", 'Core:ExplainWTC:StopWatch-TimeSpent', array("Class:$sClass/Attribute:$sAttCode"), true /*cumulative*/); + WorkingTimeRecorder::Start($oObject, $iNow, "ormStopWatch-TimeSpent-$sAttCode", 'Core:ExplainWTC:StopWatch-TimeSpent', ["Class:$sClass/Attribute:$sAttCode"], true /*cumulative*/); } $iElapsed = $this->ComputeDuration($oObject, $oAttDef, $this->iLastStart, $iNow); $this->iTimeSpent = $this->iTimeSpent + $iElapsed; - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::End(); } - foreach ($this->aThresholds as $iPercent => &$aThresholdData) - { - if (!is_null($aThresholdData['deadline']) && ($iNow > $aThresholdData['deadline'])) - { - if ($aThresholdData['overrun'] > 0) - { + foreach ($this->aThresholds as $iPercent => &$aThresholdData) { + if (!is_null($aThresholdData['deadline']) && ($iNow > $aThresholdData['deadline'])) { + if ($aThresholdData['overrun'] > 0) { // Accumulate from last start $aThresholdData['overrun'] += $iElapsed; - } - else - { + } else { // First stop after the deadline has been passed $iOverrun = $this->ComputeDuration($oObject, $oAttDef, $aThresholdData['deadline'], $iNow); $aThresholdData['overrun'] = $iOverrun; } } - if ($aThresholdData['overrun'] == 0) - { + if ($aThresholdData['overrun'] == 0) { $aThresholdData['deadline'] = null; } } @@ -510,76 +450,65 @@ class ormStopWatch /** * CheckStopWatchThresholds - * Implements the automatic actions + * Implements the automatic actions * * @package itopORM */ class CheckStopWatchThresholds implements iBackgroundProcess { public function GetPeriodicity() - { + { return 10; // seconds } public function Process($iTimeLimit) { - $aList = array(); - foreach (MetaModel::GetClasses() as $sClass) - { - foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - if ($oAttDef instanceof AttributeStopWatch) - { - foreach ($oAttDef->ListThresholds() as $iThreshold => $aThresholdData) - { + $aList = []; + foreach (MetaModel::GetClasses() as $sClass) { + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if ($oAttDef instanceof AttributeStopWatch) { + foreach ($oAttDef->ListThresholds() as $iThreshold => $aThresholdData) { $iPercent = $aThresholdData['percent']; // could be different than the index ! - + $sNow = date(AttributeDateTime::GetSQLFormat()); $sExpression = "SELECT $sClass WHERE {$sAttCode}_laststart AND {$sAttCode}_{$iThreshold}_triggered = 0 AND {$sAttCode}_{$iThreshold}_deadline < :now"; $oFilter = DBObjectSearch::FromOQL($sExpression); - $oSet = new DBObjectSet($oFilter, array(), array('now' => $sNow)); - $oSet->OptimizeColumnLoad(array($sClass => array($sAttCode))); - while ((time() < $iTimeLimit) && ($oObj = $oSet->Fetch())) - { + $oSet = new DBObjectSet($oFilter, [], ['now' => $sNow]); + $oSet->OptimizeColumnLoad([$sClass => [$sAttCode]]); + while ((time() < $iTimeLimit) && ($oObj = $oSet->Fetch())) { $sClass = get_class($oObj); $aList[] = $sClass.'::'.$oObj->GetKey().' '.$sAttCode.' '.$iThreshold; // Execute planned actions // - foreach ($aThresholdData['actions'] as $aActionData) - { + foreach ($aThresholdData['actions'] as $aActionData) { $sVerb = $aActionData['verb']; $aParams = $aActionData['params']; - $aValues = array(); - foreach($aParams as $def) - { - if (is_string($def)) - { + $aValues = []; + foreach ($aParams as $def) { + if (is_string($def)) { // Old method (pre-2.1.0) non typed parameters $aValues[] = $def; - } - else // if(is_array($def)) - { + } else { // if(is_array($def)) $sParamType = array_key_exists('type', $def) ? $def['type'] : 'string'; - switch($sParamType) - { + switch ($sParamType) { case 'int': $value = (int)$def['value']; break; - + case 'float': $value = (float)$def['value']; break; - + case 'bool': $value = (bool)$def['value']; break; - + case 'reference': $value = ${$def['value']}; break; - + case 'string': default: $value = (string)$def['value']; @@ -587,7 +516,7 @@ class CheckStopWatchThresholds implements iBackgroundProcess $aValues[] = $value; } } - $aCallSpec = array($oObj, $sVerb); + $aCallSpec = [$oObj, $sVerb]; call_user_func_array($aCallSpec, $aValues); } @@ -604,22 +533,18 @@ class CheckStopWatchThresholds implements iBackgroundProcess } // Activate any existing trigger - // + // $sClassList = implode("', '", MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL)); $oTriggerSet = new DBObjectSet( DBObjectSearch::FromOQL("SELECT TriggerOnThresholdReached AS t WHERE t.target_class IN ('$sClassList') AND stop_watch_code MATCHES :stop_watch_code AND threshold_index = :threshold_index"), - array(), // order by - array('stop_watch_code' => $sAttCode, 'threshold_index' => $iThreshold) + [], // order by + ['stop_watch_code' => $sAttCode, 'threshold_index' => $iThreshold] ); - while ($oTrigger = $oTriggerSet->Fetch()) - { - try - { + while ($oTrigger = $oTriggerSet->Fetch()) { + try { $oTrigger->DoActivate($oObj->ToArgs('this')); - } - catch(Exception $e) - { + } catch (Exception $e) { utils::EnrichRaisedException($oTrigger, $e); } } diff --git a/core/ormtagset.class.inc.php b/core/ormtagset.class.inc.php index 2f11a9fef..1af654905 100644 --- a/core/ormtagset.class.inc.php +++ b/core/ormtagset.class.inc.php @@ -1,4 +1,5 @@ sClass}:{$this->sAttCode}"); } - $oTags = array(); + $oTags = []; $iCount = 0; $bError = false; - foreach($aTagCodes as $sTagCode) - { + foreach ($aTagCodes as $sTagCode) { $iCount++; - if (($this->iLimit != 0) && ($iCount > $this->iLimit)) - { + if (($this->iLimit != 0) && ($iCount > $this->iLimit)) { $bError = true; continue; } @@ -74,13 +71,12 @@ final class ormTagSet extends ormSet } $this->aPreserved = &$oTags; - $this->aRemoved = array(); - $this->aAdded = array(); - $this->aModified = array(); + $this->aRemoved = []; + $this->aAdded = []; + $this->aModified = []; $this->aOriginalObjects = $oTags; - if ($bError) - { + if ($bError) { throw new CoreException("Maximum number of tags ({$this->iLimit}) reached for {$this->sClass}:{$this->sAttCode}"); } } @@ -90,13 +86,11 @@ final class ormTagSet extends ormSet */ public function GetValues() { - $aValues = array(); - foreach($this->aPreserved as $sTagCode => $oTag) - { + $aValues = []; + foreach ($this->aPreserved as $sTagCode => $oTag) { $aValues[] = $sTagCode; } - foreach($this->aAdded as $sTagCode => $oTag) - { + foreach ($this->aAdded as $sTagCode => $oTag) { $aValues[] = $sTagCode; } @@ -110,25 +104,19 @@ final class ormTagSet extends ormSet */ public function GetLabels() { - $aTags = array(); + $aTags = []; /** @var \TagSetFieldData $oTag */ - foreach($this->aPreserved as $sTagCode => $oTag) - { - try - { + foreach ($this->aPreserved as $sTagCode => $oTag) { + try { $aTags[$sTagCode] = $oTag->Get('label'); - } catch (CoreException $e) - { + } catch (CoreException $e) { IssueLog::Error($e->getMessage()); } } - foreach($this->aAdded as $sTagCode => $oTag) - { - try - { + foreach ($this->aAdded as $sTagCode => $oTag) { + try { $aTags[$sTagCode] = $oTag->Get('label'); - } catch (CoreException $e) - { + } catch (CoreException $e) { IssueLog::Error($e->getMessage()); } } @@ -142,13 +130,11 @@ final class ormTagSet extends ormSet */ public function GetTags() { - $aTags = array(); - foreach($this->aPreserved as $sTagCode => $oTag) - { + $aTags = []; + foreach ($this->aPreserved as $sTagCode => $oTag) { $aTags[$sTagCode] = $oTag; } - foreach($this->aAdded as $sTagCode => $oTag) - { + foreach ($this->aAdded as $sTagCode => $oTag) { $aTags[$sTagCode] = $oTag; } ksort($aTags); @@ -161,9 +147,8 @@ final class ormTagSet extends ormSet */ private function GetAddedCodes() { - $aTags = array(); - foreach($this->aAdded as $sTagCode => $oTag) - { + $aTags = []; + foreach ($this->aAdded as $sTagCode => $oTag) { $aTags[] = $sTagCode; } ksort($aTags); @@ -176,9 +161,8 @@ final class ormTagSet extends ormSet */ private function GetRemovedCodes() { - $aTags = array(); - foreach($this->aRemoved as $sTagCode => $oTag) - { + $aTags = []; + foreach ($this->aRemoved as $sTagCode => $oTag) { $aTags[] = $sTagCode; } ksort($aTags); @@ -191,9 +175,8 @@ final class ormTagSet extends ormSet */ private function GetAddedTags() { - $aTags = array(); - foreach($this->aAdded as $sTagCode => $oTag) - { + $aTags = []; + foreach ($this->aAdded as $sTagCode => $oTag) { $aTags[$sTagCode] = $oTag; } ksort($aTags); @@ -206,9 +189,8 @@ final class ormTagSet extends ormSet */ private function GetRemovedTags() { - $aTags = array(); - foreach($this->aRemoved as $sTagCode => $oTag) - { + $aTags = []; + foreach ($this->aRemoved as $sTagCode => $oTag) { $aTags[$sTagCode] = $oTag; } ksort($aTags); @@ -236,16 +218,14 @@ final class ormTagSet extends ormSet $aOrigTagCodes = $this->GetValues(); $oTag->SetValues($aOrigTagCodes); // now remove everything - foreach($aOrigTagCodes as $sTagCode) - { + foreach ($aOrigTagCodes as $sTagCode) { $oTag->Remove($sTagCode); } // now add the tags of the other TagSet - foreach($oOtherTagSet->GetValues() as $sTagCode) - { + foreach ($oOtherTagSet->GetValues() as $sTagCode) { $oTag->Add($sTagCode); } - $aDelta = array(); + $aDelta = []; $aDelta['added'] = $oTag->GetAddedCodes(); $aDelta['removed'] = $oTag->GetRemovedCodes(); @@ -272,16 +252,14 @@ final class ormTagSet extends ormSet $aOrigTagCodes = $this->GetValues(); $oTag->SetValues($aOrigTagCodes); // now remove everything - foreach($aOrigTagCodes as $sTagCode) - { + foreach ($aOrigTagCodes as $sTagCode) { $oTag->Remove($sTagCode); } // now add the tags of the other TagSet - foreach($oOtherTagSet->GetValues() as $sTagCode) - { + foreach ($oOtherTagSet->GetValues() as $sTagCode) { $oTag->Add($sTagCode); } - $aDelta = array(); + $aDelta = []; $aDelta['added'] = $oTag->GetAddedTags(); $aDelta['removed'] = $oTag->GetRemovedTags(); @@ -332,17 +310,13 @@ final class ormTagSet extends ormSet */ public function ApplyDelta($aDelta) { - if (isset($aDelta['removed'])) - { - foreach($aDelta['removed'] as $oItem) - { + if (isset($aDelta['removed'])) { + foreach ($aDelta['removed'] as $oItem) { $this->Remove($oItem); } } - if (isset($aDelta['added'])) - { - foreach($aDelta['added'] as $oItem) - { + if (isset($aDelta['added'])) { + foreach ($aDelta['added'] as $oItem) { $this->Add($oItem); } } @@ -357,22 +331,19 @@ final class ormTagSet extends ormSet */ public function GenerateDiffFromArray($aItems) { - foreach($this->GetValues() as $oCurrentItem) - { - if (!in_array($oCurrentItem, $aItems)) - { + foreach ($this->GetValues() as $oCurrentItem) { + if (!in_array($oCurrentItem, $aItems)) { $this->Remove($oCurrentItem); } } - foreach($aItems as $oNewItem) - { + foreach ($aItems as $oNewItem) { $this->Add($oNewItem); } // Keep only the aModified list - $this->aRemoved = array(); - $this->aAdded = array(); + $this->aRemoved = []; + $this->aAdded = []; } /** @@ -384,13 +355,11 @@ final class ormTagSet extends ormSet */ public function IsValidTag($sTagCode) { - try - { + try { $this->GetTagFromCode($sTagCode); return true; - } catch (Exception $e) - { + } catch (Exception $e) { return false; } } @@ -403,24 +372,19 @@ final class ormTagSet extends ormSet */ public function Add($sTagCode) { - if (($this->iLimit != 0) && ($this->Count() == $this->iLimit)) - { + if (($this->iLimit != 0) && ($this->Count() == $this->iLimit)) { throw new CoreException("Maximum number of tags ({$this->iLimit}) reached for {$this->sClass}:{$this->sAttCode}"); } - if ($this->IsTagInList($this->aPreserved, $sTagCode) || $this->IsTagInList($this->aAdded, $sTagCode)) - { + if ($this->IsTagInList($this->aPreserved, $sTagCode) || $this->IsTagInList($this->aAdded, $sTagCode)) { // nothing to do, already existing tag return; } // if removed then added again - if (($oTag = $this->RemoveTagFromList($this->aRemoved, $sTagCode)) !== false) - { + if (($oTag = $this->RemoveTagFromList($this->aRemoved, $sTagCode)) !== false) { // put it back into preserved $this->aPreserved[$sTagCode] = $oTag; // no need to add it to aModified : was already done when calling Remove method - } - else - { + } else { $oTag = $this->GetTagFromCode($sTagCode); $this->aAdded[$sTagCode] = $oTag; $this->aModified[$sTagCode] = $oTag; @@ -432,23 +396,20 @@ final class ormTagSet extends ormSet */ public function Remove($sTagCode) { - if ($this->IsTagInList($this->aRemoved, $sTagCode)) - { + if ($this->IsTagInList($this->aRemoved, $sTagCode)) { // nothing to do, already removed tag return; } $oTag = $this->RemoveTagFromList($this->aAdded, $sTagCode); - if ($oTag !== false) - { + if ($oTag !== false) { $this->aModified[$sTagCode] = $oTag; return; // if present in added, can't be in preserved ! } $oTag = $this->RemoveTagFromList($this->aPreserved, $sTagCode); - if ($oTag !== false) - { + if ($oTag !== false) { $this->aModified[$sTagCode] = $oTag; $this->aRemoved[$sTagCode] = $oTag; } @@ -467,8 +428,7 @@ final class ormTagSet extends ormSet */ private function RemoveTagFromList(&$aTagList, $sTagCode) { - if (!($this->IsTagInList($aTagList, $sTagCode))) - { + if (!($this->IsTagInList($aTagList, $sTagCode))) { return false; } @@ -488,10 +448,8 @@ final class ormTagSet extends ormSet private function GetTagFromCode($sTagCode) { $aAllowedTags = $this->GetAllowedTags(); - foreach($aAllowedTags as $oAllowedTag) - { - if ($oAllowedTag->Get('code') === $sTagCode) - { + foreach ($aAllowedTags as $oAllowedTag) { + if ($oAllowedTag->Get('code') === $sTagCode) { return $oAllowedTag; } } @@ -508,10 +466,8 @@ final class ormTagSet extends ormSet public function GetTagFromLabel($sTagLabel) { $aAllowedTags = $this->GetAllowedTags(); - foreach($aAllowedTags as $oAllowedTag) - { - if ($oAllowedTag->Get('label') === $sTagLabel) - { + foreach ($aAllowedTags as $oAllowedTag) { + if ($oAllowedTag->Get('label') === $sTagLabel) { return $oAllowedTag->Get('code'); } } @@ -538,12 +494,10 @@ final class ormTagSet extends ormSet */ public function Equals(ormSet $other) { - if (!($other instanceof ormTagSet)) - { + if (!($other instanceof ormTagSet)) { return false; } - if ($this->GetTagDataClass() !== $other->GetTagDataClass()) - { + if ($this->GetTagDataClass() !== $other->GetTagDataClass()) { return false; } diff --git a/core/ownershiplock.class.inc.php b/core/ownershiplock.class.inc.php index b9d4c751b..a72131adc 100644 --- a/core/ownershiplock.class.inc.php +++ b/core/ownershiplock.class.inc.php @@ -1,4 +1,5 @@ '', 'key_type' => 'autoincrement', - 'name_attcode' => array('obj_class', 'obj_key'), + 'name_attcode' => ['obj_class', 'obj_key'], 'state_attcode' => '', - 'reconc_keys' => array(''), + 'reconc_keys' => [''], 'db_table' => 'priv_ownership_token', 'db_key_field' => 'id', 'db_finalclass_field' => '', - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeDateTime("acquired", array("allowed_values"=>null, "sql"=>'acquired', "default_value"=>'NOW()', "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDateTime("last_seen", array("allowed_values"=>null, "sql"=>'last_seen', "default_value"=>'NOW()', "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("obj_class", array("allowed_values"=>null, "sql"=>'obj_class', "default_value"=>'', "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeInteger("obj_key", array("allowed_values"=>null, "sql"=>'obj_key', "default_value"=>'', "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("token", array("allowed_values"=>null, "sql"=>'token', "default_value"=>'', "is_null_allowed"=>true, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeExternalKey("user_id", array("targetclass"=>"User", "jointype"=> '', "allowed_values"=>null, "sql"=>"user_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_SILENT, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeDateTime("acquired", ["allowed_values" => null, "sql" => 'acquired', "default_value" => 'NOW()', "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDateTime("last_seen", ["allowed_values" => null, "sql" => 'last_seen', "default_value" => 'NOW()', "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("obj_class", ["allowed_values" => null, "sql" => 'obj_class', "default_value" => '', "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeInteger("obj_key", ["allowed_values" => null, "sql" => 'obj_key', "default_value" => '', "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("token", ["allowed_values" => null, "sql" => 'token', "default_value" => '', "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalKey("user_id", ["targetclass" => "User", "jointype" => '', "allowed_values" => null, "sql" => "user_id", "is_null_allowed" => true, "on_target_delete" => DEL_SILENT, "depends_on" => []])); - MetaModel::Init_SetZListItems('details', array ('obj_class', 'obj_key', 'last_seen', 'token')); - MetaModel::Init_SetZListItems('standard_search', array ('obj_class', 'obj_key', 'last_seen', 'token')); - MetaModel::Init_SetZListItems('list', array ('obj_class', 'obj_key', 'last_seen', 'token')); + MetaModel::Init_SetZListItems('details', ['obj_class', 'obj_key', 'last_seen', 'token']); + MetaModel::Init_SetZListItems('standard_search', ['obj_class', 'obj_key', 'last_seen', 'token']); + MetaModel::Init_SetZListItems('list', ['obj_class', 'obj_key', 'last_seen', 'token']); } } @@ -67,7 +68,7 @@ class iTopOwnershipLock protected $sObjClass; protected $iObjKey; protected $oToken; - + /** * Acquires an exclusive lock on the specified DBObject. Once acquired, the lock is identified * by a unique "token" string. @@ -78,15 +79,15 @@ class iTopOwnershipLock public static function AcquireLock($sObjClass, $iObjKey) { $oMutex = new iTopMutex('lock_'.$sObjClass.'::'.$iObjKey); - + $oMutex->Lock(); $oOwnershipLock = new iTopOwnershipLock($sObjClass, $iObjKey); $token = $oOwnershipLock->Acquire(); $oMutex->Unlock(); - - return array('success' => $token !== false, 'token' => $token, 'lock' => $oOwnershipLock, 'acquired' => $oOwnershipLock->oToken->Get('acquired')); + + return ['success' => $token !== false, 'token' => $token, 'lock' => $oOwnershipLock, 'acquired' => $oOwnershipLock->oToken->Get('acquired')]; } - + /** * Extends the ownership lock or acquires it if none exists * Returns a hash array with 3 elements: @@ -99,18 +100,18 @@ class iTopOwnershipLock public static function ExtendLock($sObjClass, $iObjKey, $sToken) { $oMutex = new iTopMutex('lock_'.$sObjClass.'::'.$iObjKey); - + $oMutex->Lock(); $oOwnershipLock = new iTopOwnershipLock($sObjClass, $iObjKey); $aResult = $oOwnershipLock->Extend($sToken); $oMutex->Unlock(); - + return $aResult; } /** * Releases the given lock for the specified object - * + * * @param string $sObjClass The class of the object * @param int $iObjKey The identifier of the object * @param string $sToken The string identifying the lock @@ -119,13 +120,13 @@ class iTopOwnershipLock public static function ReleaseLock($sObjClass, $iObjKey, $sToken) { $oMutex = new iTopMutex('lock_'.$sObjClass.'::'.$iObjKey); - + $oMutex->Lock(); $oOwnershipLock = new iTopOwnershipLock($sObjClass, $iObjKey); $bResult = $oOwnershipLock->Release($sToken); self::DeleteExpiredLocks(); // Cleanup orphan locks $oMutex->Unlock(); - + return $bResult; } @@ -139,17 +140,16 @@ class iTopOwnershipLock public static function KillLock($sObjClass, $iObjKey) { $oMutex = new iTopMutex('lock_'.$sObjClass.'::'.$iObjKey); - + $oMutex->Lock(); $sOQL = "SELECT iTopOwnershipToken WHERE obj_class = :obj_class AND obj_key = :obj_key"; - $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL, array('obj_class' => $sObjClass, 'obj_key' => $iObjKey))); - while($oLock = $oSet->Fetch()) - { + $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL, ['obj_class' => $sObjClass, 'obj_key' => $iObjKey])); + while ($oLock = $oSet->Fetch()) { $oLock->DBDelete(); } $oMutex->Unlock(); } - + /** * Checks if an exclusive lock exists on the specified DBObject. * @param string $sObjClass The class of the object for which to acquire the lock @@ -160,26 +160,24 @@ class iTopOwnershipLock { $bLocked = false; $oMutex = new iTopMutex('lock_'.$sObjClass.'::'.$iObjKey); - + $oMutex->Lock(); $oOwnershipLock = new iTopOwnershipLock($sObjClass, $iObjKey); - if ($oOwnershipLock->IsOwned()) - { + if ($oOwnershipLock->IsOwned()) { $bLocked = true; } $oMutex->Unlock(); - - return array('locked' =>$bLocked, 'owner' => $oOwnershipLock->GetOwner()); + + return ['locked' => $bLocked, 'owner' => $oOwnershipLock->GetOwner()]; } - + /** * Get the current owner of the lock * @return User */ public function GetOwner() { - if ($this->IsTokenValid()) - { + if ($this->IsTokenValid()) { return MetaModel::GetObject('User', $this->oToken->Get('user_id'), false, true); } return null; @@ -194,33 +192,30 @@ class iTopOwnershipLock protected function __construct($sObjClass, $iObjKey) { $sOQL = "SELECT iTopOwnershipToken WHERE obj_class = :obj_class AND obj_key = :obj_key"; - $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL, array('obj_class' => $sObjClass, 'obj_key' => $iObjKey))); + $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL, ['obj_class' => $sObjClass, 'obj_key' => $iObjKey])); $this->oToken = $oSet->Fetch(); $this->sObjClass = $sObjClass; $this->iObjKey = $iObjKey; // IssueLog::Info("iTopOwnershipLock::__construct($sObjClass, $iObjKey) oToken::".($this->oToken ? $this->oToken->GetKey() : 'null')); } - + protected function IsOwned() { return $this->IsTokenValid(); } - + protected function Acquire($sToken = null) { - if ($this->IsTokenValid()) - { + if ($this->IsTokenValid()) { // IssueLog::Info("Acquire($sToken) returns false"); return false; - } - else - { + } else { $sToken = $this->TakeOwnership($sToken); // IssueLog::Info("Acquire($sToken) returns $sToken"); return $sToken; } } - + /** * Extends the ownership lock or acquires it if none exists * Returns a hash array with 3 elements: @@ -233,96 +228,79 @@ class iTopOwnershipLock */ protected function Extend($sToken) { - $aResult = array('status' => true, 'owner' => '', 'operation' => 'renewed'); - - if ($this->IsTokenValid()) - { - if ($sToken === $this->oToken->Get('token')) - { + $aResult = ['status' => true, 'owner' => '', 'operation' => 'renewed']; + + if ($this->IsTokenValid()) { + if ($sToken === $this->oToken->Get('token')) { $this->oToken->Set('last_seen', date(AttributeDateTime::GetSQLFormat())); $this->oToken->DBUpdate(); $aResult['acquired'] = $this->oToken->Get('acquired'); - } - else - { + } else { // IssueLog::Info("Extend($sToken) returns false"); $aResult['status'] = false; $aResult['operation'] = 'lost'; $aResult['owner'] = $this->GetOwner(); $aResult['acquired'] = $this->oToken->Get('acquired'); } - } - else - { + } else { $aResult['status'] = false; $aResult['operation'] = 'expired'; } // IssueLog::Info("Extend($sToken) returns true"); return $aResult; } - + protected function HasOwnership($sToken) { $bRet = false; - if ($this->IsTokenValid()) - { - if ($sToken === $this->oToken->Get('token')) - { + if ($this->IsTokenValid()) { + if ($sToken === $this->oToken->Get('token')) { $bRet = true; } } // IssueLog::Info("HasOwnership($sToken) return $bRet"); return $bRet; } - + protected function Release($sToken) { $bRet = false; // IssueLog::Info("Release... begin [$sToken]"); - if (($this->oToken) && ($sToken === $this->oToken->Get('token'))) - { + if (($this->oToken) && ($sToken === $this->oToken->Get('token'))) { // IssueLog::Info("oToken::".$this->oToken->GetKey().' ('.$sToken.') to be deleted'); $this->oToken->DBDelete(); // IssueLog::Info("oToken deleted"); $this->oToken = null; $bRet = true; - } - else if ($this->oToken == null) - { - // IssueLog::Info("Release FAILED oToken == null !!!"); - } - else - { - // IssueLog::Info("Release FAILED inconsistent tokens: sToken=\"".$sToken.'", oToken->Get(\'token\')="'.$this->oToken->Get('token').'"'); + } elseif ($this->oToken == null) { + // IssueLog::Info("Release FAILED oToken == null !!!"); + } else { + // IssueLog::Info("Release FAILED inconsistent tokens: sToken=\"".$sToken.'", oToken->Get(\'token\')="'.$this->oToken->Get('token').'"'); } // IssueLog::Info("Release... end"); return $bRet; } - + protected function IsTokenValid() { $bRet = false; - if ($this->oToken != null) - { + if ($this->oToken != null) { $sToken = $this->oToken->Get('token'); $sDate = $this->oToken->Get('last_seen'); - if (($sDate != '') && ($sToken != '')) - { + if (($sDate != '') && ($sToken != '')) { $oLastSeenTime = new DateTime($sDate); $iNow = date('U'); - if (($iNow - $oLastSeenTime->format('U')) < MetaModel::GetConfig()->Get('concurrent_lock_expiration_delay')) - { + if (($iNow - $oLastSeenTime->format('U')) < MetaModel::GetConfig()->Get('concurrent_lock_expiration_delay')) { $bRet = true; } } } - return $bRet; + return $bRet; } - + protected function TakeOwnership($sToken = null) { - if ($this->oToken == null) - { + if ($this->oToken == null) { $this->oToken = new iTopOwnershipToken(); $this->oToken->Set('obj_class', $this->sObjClass); $this->oToken->Set('obj_key', $this->iObjKey); @@ -330,23 +308,21 @@ class iTopOwnershipLock $this->oToken->Set('acquired', date(AttributeDateTime::GetSQLFormat())); $this->oToken->Set('user_id', UserRights::GetUserId()); $this->oToken->Set('last_seen', date(AttributeDateTime::GetSQLFormat())); - if ($sToken === null) - { + if ($sToken === null) { $sToken = sprintf('%X', microtime(true)); } $this->oToken->Set('token', $sToken); $this->oToken->DBWrite(); return $this->oToken->Get('token'); } - + protected static function DeleteExpiredLocks() { $sOQL = "SELECT iTopOwnershipToken WHERE last_seen < :last_seen_limit"; - $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL, array('last_seen_limit' => date(AttributeDateTime::GetSQLFormat(), time() - MetaModel::GetConfig()->Get('concurrent_lock_expiration_delay'))))); - while($oToken = $oSet->Fetch()) - { + $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL, ['last_seen_limit' => date(AttributeDateTime::GetSQLFormat(), time() - MetaModel::GetConfig()->Get('concurrent_lock_expiration_delay'))])); + while ($oToken = $oSet->Fetch()) { $oToken->DBDelete(); } - + } } diff --git a/core/pdfbulkexport.class.inc.php b/core/pdfbulkexport.class.inc.php index 64c2daed5..ed21d58c7 100644 --- a/core/pdfbulkexport.class.inc.php +++ b/core/pdfbulkexport.class.inc.php @@ -1,4 +1,5 @@ array('pdf_options')), parent::EnumFormParts()); + return array_merge(['pdf_options' => ['pdf_options']], parent::EnumFormParts()); } /** @@ -125,33 +126,31 @@ EOF break; default: - return parent:: GetFormPart($oP, $sPartId); + return parent::GetFormPart($oP, $sPartId); } } - public function ReadParameters() { parent::ReadParameters(); $this->aStatusInfo['page_size'] = utils::ReadParam('page_size', 'A4', true, 'raw_data'); $this->aStatusInfo['page_orientation'] = utils::ReadParam('page_orientation', 'L', true); - + $sDateFormatRadio = utils::ReadParam('pdf_date_format_radio', ''); - switch($sDateFormatRadio) - { + switch ($sDateFormatRadio) { case 'default': - // Export from the UI => format = same as is the UI - $this->aStatusInfo['date_format'] = (string)AttributeDateTime::GetFormat(); - break; - + // Export from the UI => format = same as is the UI + $this->aStatusInfo['date_format'] = (string)AttributeDateTime::GetFormat(); + break; + case 'custom': - // Custom format specified from the UI - $this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetFormat(), true, 'raw_data'); - break; - + // Custom format specified from the UI + $this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetFormat(), true, 'raw_data'); + break; + default: - // Export from the command line (or scripted) => default format is SQL, as in previous versions of iTop, unless specified otherwise - $this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetSQLFormat(), true, 'raw_data'); + // Export from the command line (or scripted) => default format is SQL, as in previous versions of iTop, unless specified otherwise + $this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetSQLFormat(), true, 'raw_data'); } } @@ -160,8 +159,7 @@ EOF $this->aStatusInfo['tmp_file'] = $this->MakeTmpFile('data'); $sData = parent::GetHeader(); $hFile = @fopen($this->aStatusInfo['tmp_file'], 'ab'); - if ($hFile === false) - { + if ($hFile === false) { throw new Exception('PDFBulkExport: Failed to open temporary data file: "'.$this->aStatusInfo['tmp_file'].'" for writing.'); } fwrite($hFile, $sData."\n"); @@ -180,8 +178,7 @@ EOF AttributeDateTime::SetFormat($oPrevFormat); AttributeDate::SetFormat($oPrevDateFormat); $hFile = @fopen($this->aStatusInfo['tmp_file'], 'ab'); - if ($hFile === false) - { + if ($hFile === false) { throw new Exception('PDFBulkExport: Failed to open temporary data file: "'.$this->aStatusInfo['tmp_file'].'" for writing.'); } fwrite($hFile, $sData."\n"); @@ -214,8 +211,7 @@ EOF */ protected function GetSampleData($oObj, $sAttCode) { - if ($sAttCode !== 'id') - { + if ($sAttCode !== 'id') { $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); // As sample data will be displayed in the web browser, AttributeImage needs to be rendered with a regular HTML format, meaning its "src" looking like "data:image/png;base64,iVBORw0KGgoAAAANSUh..." @@ -245,17 +241,12 @@ EOF $value = $oObj->Get($sAttCode); if ($value instanceof ormDocument) { $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); - if ($oAttDef instanceof AttributeImage) - { + if ($oAttDef instanceof AttributeImage) { $sRet = $this->GetAttributeImageValue($oObj, $sAttCode, static::ENUM_OUTPUT_TYPE_REAL); - } - else - { + } else { $sRet = parent::GetValue($oObj, $sAttCode); } - } - else - { + } else { $sRet = parent::GetValue($oObj, $sAttCode); } } @@ -334,7 +325,7 @@ EOF public function GetSupportedFormats() { - return array('pdf' => Dict::S('Core:BulkExport:PDFFormat')); + return ['pdf' => Dict::S('Core:BulkExport:PDFFormat')]; } public function GetMimeType() diff --git a/core/plugininstanciationmanager.class.inc.php b/core/plugininstanciationmanager.class.inc.php index b5d0ec87c..595c2804d 100644 --- a/core/plugininstanciationmanager.class.inc.php +++ b/core/plugininstanciationmanager.class.inc.php @@ -1,25 +1,21 @@ isInstantiable()) - { + if ($class->isInstantiable()) { $newPerInstanceClasses[$sClassName] = new $sClassName(); } } diff --git a/core/pluginmanager.class.inc.php b/core/pluginmanager.class.inc.php index ef41a4d8d..54c51c694 100644 --- a/core/pluginmanager.class.inc.php +++ b/core/pluginmanager.class.inc.php @@ -1,13 +1,12 @@ m_aExtensionClassNames = $m_aExtensionClassNames; - if ($m_pluginInstanciationManager == null) - { + if ($m_pluginInstanciationManager == null) { $this->m_pluginInstantiationManager = new PluginInstanciationManager(); - } - else - { + } else { $this->m_pluginInstantiationManager = $m_pluginInstanciationManager; } } @@ -38,7 +34,7 @@ class PluginManager */ public function EnumPlugins($sInterface, $sFilterInstanceOf = null, $bCanInstantiatePlugins = true) { - $aPlugins = array(); + $aPlugins = []; if (array_key_exists($sInterface, self::$m_aExtensionClasses)) { $aAllPlugins = self::$m_aExtensionClasses[$sInterface]; @@ -46,17 +42,14 @@ class PluginManager return $aAllPlugins; }; - $aPlugins = array(); + $aPlugins = []; foreach ($aAllPlugins as $sPluginClass => $instance) { if ($instance instanceof $sFilterInstanceOf) { $aPlugins[$sPluginClass] = $instance; } } - } - else - { - if ($bCanInstantiatePlugins && array_key_exists($sInterface, $this->m_aExtensionClassNames)) - { + } else { + if ($bCanInstantiatePlugins && array_key_exists($sInterface, $this->m_aExtensionClassNames)) { $this->InstantiatePlugins($sInterface); return $this->EnumPlugins($sInterface, $sFilterInstanceOf, false); @@ -80,17 +73,12 @@ class PluginManager public function GetPlugins($sInterface, $sClassName, $bCanInstantiatePlugins = true) { $oInstance = null; - if (array_key_exists($sInterface, self::$m_aExtensionClasses)) - { - if (array_key_exists($sClassName, self::$m_aExtensionClasses[$sInterface])) - { + if (array_key_exists($sInterface, self::$m_aExtensionClasses)) { + if (array_key_exists($sClassName, self::$m_aExtensionClasses[$sInterface])) { return self::$m_aExtensionClasses[$sInterface][$sClassName]; } - } - else - { - if ($bCanInstantiatePlugins && array_key_exists($sInterface, $this->m_aExtensionClassNames)) - { + } else { + if ($bCanInstantiatePlugins && array_key_exists($sInterface, $this->m_aExtensionClassNames)) { $this->InstantiatePlugins($sInterface); return $this->GetPlugins($sInterface, $sClassName, false); } diff --git a/core/querybuildercontext.class.inc.php b/core/querybuildercontext.class.inc.php index a3c679508..d17dd0949 100644 --- a/core/querybuildercontext.class.inc.php +++ b/core/querybuildercontext.class.inc.php @@ -1,9 +1,10 @@ m_oQBExpressions = new QueryBuilderExpressions($oFilter, $aGroupByExpr, $aSelectExpr); $this->m_aClassAliases = $oFilter->GetJoinedClasses(); - $this->m_aTableAliases = array(); - $this->m_aFilteredTables = array(); + $this->m_aTableAliases = []; + $this->m_aFilteredTables = []; $this->m_aModifierProperties = $aModifierProperties; - if (is_null($aSelectedClasses)) - { + if (is_null($aSelectedClasses)) { $this->m_aSelectedClasses = $oFilter->GetSelectedClasses(); - } - else - { + } else { // For the unions, the selected classes can be upper in the hierarchy (lowest common ancestor) $this->m_aSelectedClasses = $aSelectedClasses; } // Add all the attribute of interest - foreach ($this->m_aSelectedClasses as $sClassAlias => $sClass) - { + foreach ($this->m_aSelectedClasses as $sClassAlias => $sClass) { $sTableAlias = $sClassAlias; - if (empty($sTableAlias)) - { + if (empty($sTableAlias)) { $sTableAlias = $this->GenerateClassAlias("$sClass", $sClass); $this->m_sEmptyClassAlias = $sTableAlias; } // default to the whole list of attributes + the very std id/finalclass $this->m_oQBExpressions->AddSelect($sClassAlias.'id', new FieldExpression('id', $sTableAlias)); - if (is_null($aAttToLoad) || !array_key_exists($sClassAlias, $aAttToLoad)) - { + if (is_null($aAttToLoad) || !array_key_exists($sClassAlias, $aAttToLoad)) { $sSelectedClass = $this->GetSelectedClass($sClassAlias); $aAttList = MetaModel::ListAttributeDefs($sSelectedClass); - } - else - { + } else { $aAttList = $aAttToLoad[$sClassAlias]; } - foreach ($aAttList as $sAttCode => $oAttDef) - { - if (!$oAttDef->IsScalar()) - { + foreach ($aAttList as $sAttCode => $oAttDef) { + if (!$oAttDef->IsScalar()) { continue; } $oExpression = new FieldExpression($sAttCode, $sTableAlias); @@ -117,13 +108,10 @@ class QueryBuilderContext public function GetModifierProperties($sPluginClass) { - if (array_key_exists($sPluginClass, $this->m_aModifierProperties)) - { + if (array_key_exists($sPluginClass, $this->m_aModifierProperties)) { return $this->m_aModifierProperties[$sPluginClass]; - } - else - { - return array(); + } else { + return []; } } @@ -134,13 +122,10 @@ class QueryBuilderContext public function AddFilteredTable($sTableAlias, $oCondition) { - if (array_key_exists($sTableAlias, $this->m_aFilteredTables)) - { + if (array_key_exists($sTableAlias, $this->m_aFilteredTables)) { $this->m_aFilteredTables[$sTableAlias][] = $oCondition; - } - else - { - $this->m_aFilteredTables[$sTableAlias] = array($oCondition); + } else { + $this->m_aFilteredTables[$sTableAlias] = [$oCondition]; } } @@ -157,5 +142,4 @@ class QueryBuilderContext return $this->m_sEmptyClassAlias; } - } diff --git a/core/querybuilderexpressions.class.inc.php b/core/querybuilderexpressions.class.inc.php index c713610a8..a6e229cef 100644 --- a/core/querybuilderexpressions.class.inc.php +++ b/core/querybuilderexpressions.class.inc.php @@ -26,25 +26,21 @@ class QueryBuilderExpressions public function __construct(DBObjectSearch $oSearch, $aGroupByExpr = null, $aSelectExpr = null) { $this->m_oConditionExpr = $oSearch->GetCriteria(); - if (!$oSearch->GetShowObsoleteData()) - { - foreach ($oSearch->GetSelectedClasses() as $sAlias => $sClass) - { - if (MetaModel::IsObsoletable($sClass)) - { + if (!$oSearch->GetShowObsoleteData()) { + foreach ($oSearch->GetSelectedClasses() as $sAlias => $sClass) { + if (MetaModel::IsObsoletable($sClass)) { $oNotObsolete = new BinaryExpression(new FieldExpression('obsolescence_flag', $sAlias), '=', new ScalarExpression(0)); $this->m_oConditionExpr = $this->m_oConditionExpr->LogAnd($oNotObsolete); } } } - $this->m_aSelectExpr = is_null($aSelectExpr) ? array() : $aSelectExpr; + $this->m_aSelectExpr = is_null($aSelectExpr) ? [] : $aSelectExpr; $this->m_aGroupByExpr = $aGroupByExpr; - $this->m_aJoinFields = array(); - $this->m_aJoinFields = array(); + $this->m_aJoinFields = []; + $this->m_aJoinFields = []; - $this->m_aClassIds = array(); - foreach ($oSearch->GetJoinedClasses() as $sClassAlias => $sClass) - { + $this->m_aClassIds = []; + foreach ($oSearch->GetJoinedClasses() as $sClassAlias => $sClass) { $this->m_aClassIds[$sClassAlias] = new FieldExpression('id', $sClassAlias); } } @@ -117,13 +113,11 @@ class QueryBuilderExpressions */ public function GetMandatoryTables(&$aTables = null) { - if (is_null($aTables)) - { - $aTables = array(); + if (is_null($aTables)) { + $aTables = []; } - foreach ($this->m_aClassIds as $sClass => $oExpression) - { + foreach ($this->m_aClassIds as $sClass => $oExpression) { $oExpression->CollectUsedParents($aTables); } @@ -138,8 +132,7 @@ class QueryBuilderExpressions public function GetUnresolvedFields($sAlias) { $aUnresolved = $this->GetExpectedFields($sAlias); - foreach ($this->m_aJoinFields as $oExpression) - { + foreach ($this->m_aJoinFields as $oExpression) { $oExpression->GetUnresolvedFields($sAlias, $aUnresolved); } return $aUnresolved; @@ -155,17 +148,14 @@ class QueryBuilderExpressions */ public function GetExpectedFields($sAlias) { - $aUnresolved = array(); + $aUnresolved = []; $this->m_oConditionExpr->GetUnresolvedFields($sAlias, $aUnresolved); - foreach ($this->m_aSelectExpr as $sColAlias => $oExpr) - { + foreach ($this->m_aSelectExpr as $sColAlias => $oExpr) { $oExpr->GetUnresolvedFields($sAlias, $aUnresolved); } - if (!empty($this->m_aGroupByExpr)) - { - foreach ($this->m_aGroupByExpr as $sColAlias => $oExpr) - { + if (!empty($this->m_aGroupByExpr)) { + foreach ($this->m_aGroupByExpr as $sColAlias => $oExpr) { $oExpr->GetUnresolvedFields($sAlias, $aUnresolved); } } @@ -175,31 +165,24 @@ class QueryBuilderExpressions public function Translate($aTranslationData, $bMatchAll = true, $bMarkFieldsAsResolved = true) { $this->m_oConditionExpr = $this->m_oConditionExpr->Translate($aTranslationData, $bMatchAll, $bMarkFieldsAsResolved); - foreach ($this->m_aSelectExpr as $sColAlias => $oExpr) - { + foreach ($this->m_aSelectExpr as $sColAlias => $oExpr) { $this->m_aSelectExpr[$sColAlias] = $oExpr->Translate($aTranslationData, $bMatchAll, $bMarkFieldsAsResolved); - if ($this->m_aSelectExpr[$sColAlias] instanceof FieldExpressionResolved) - { + if ($this->m_aSelectExpr[$sColAlias] instanceof FieldExpressionResolved) { // Split the field with the relevant alias - foreach ($this->m_aSelectExpr[$sColAlias]->AdditionalExpressions() as $sSuffix => $oAdditionalExpr) - { + foreach ($this->m_aSelectExpr[$sColAlias]->AdditionalExpressions() as $sSuffix => $oAdditionalExpr) { $this->m_aSelectExpr[$sColAlias.$sSuffix] = $oAdditionalExpr->Translate($aTranslationData, $bMatchAll, $bMarkFieldsAsResolved); } } } - if ($this->m_aGroupByExpr) - { - foreach ($this->m_aGroupByExpr as $sColAlias => $oExpr) - { + if ($this->m_aGroupByExpr) { + foreach ($this->m_aGroupByExpr as $sColAlias => $oExpr) { $this->m_aGroupByExpr[$sColAlias] = $oExpr->Translate($aTranslationData, $bMatchAll, $bMarkFieldsAsResolved); } } - foreach ($this->m_aJoinFields as $index => $oExpression) - { + foreach ($this->m_aJoinFields as $index => $oExpression) { $this->m_aJoinFields[$index] = $oExpression->Translate($aTranslationData, $bMatchAll, $bMarkFieldsAsResolved); } - foreach ($this->m_aClassIds as $sClass => $oExpression) - { + foreach ($this->m_aClassIds as $sClass => $oExpression) { $this->m_aClassIds[$sClass] = $oExpression->Translate($aTranslationData, $bMatchAll, $bMarkFieldsAsResolved); } } @@ -207,20 +190,16 @@ class QueryBuilderExpressions public function RenameParam($sOldName, $sNewName) { $this->m_oConditionExpr->RenameParam($sOldName, $sNewName); - foreach ($this->m_aSelectExpr as $sColAlias => $oExpr) - { + foreach ($this->m_aSelectExpr as $sColAlias => $oExpr) { $this->m_aSelectExpr[$sColAlias] = $oExpr->RenameParam($sOldName, $sNewName); } - if ($this->m_aGroupByExpr) - { - foreach ($this->m_aGroupByExpr as $sColAlias => $oExpr) - { + if ($this->m_aGroupByExpr) { + foreach ($this->m_aGroupByExpr as $sColAlias => $oExpr) { $this->m_aGroupByExpr[$sColAlias] = $oExpr->RenameParam($sOldName, $sNewName); } } - foreach ($this->m_aJoinFields as $index => $oExpression) - { + foreach ($this->m_aJoinFields as $index => $oExpression) { $this->m_aJoinFields[$index] = $oExpression->RenameParam($sOldName, $sNewName); } } -} \ No newline at end of file +} diff --git a/core/querymodifier.class.inc.php b/core/querymodifier.class.inc.php index ab7df0f35..57fe4e79b 100644 --- a/core/querymodifier.class.inc.php +++ b/core/querymodifier.class.inc.php @@ -1,9 +1,10 @@ - /** * Interface iQueryModifier - * Defines the API to tweak queries (e.g. translate data on the fly) + * Defines the API to tweak queries (e.g. translate data on the fly) * * @copyright Copyright (C) 2010-2024 Combodo SAS * @license http://opensource.org/licenses/AGPL-3.0 @@ -31,4 +31,3 @@ interface iQueryModifier public function GetFieldExpression(QueryBuilderContext &$oBuild, $sClass, $sAttCode, $sColId, Expression $oFieldSQLExp, SQLQuery &$oSelect); } -?> diff --git a/core/relationgraph.class.inc.php b/core/relationgraph.class.inc.php index 43b82f703..246b8f360 100644 --- a/core/relationgraph.class.inc.php +++ b/core/relationgraph.class.inc.php @@ -1,4 +1,5 @@ - /** * Data structures (i.e. PHP classes) to build and use relation graphs * * @copyright Copyright (C) 2015-2024 Combodo SARL * @license http://opensource.org/licenses/AGPL-3.0 - * + * */ require_once(APPROOT.'core/simplegraph.class.inc.php'); @@ -61,24 +61,17 @@ class RelationObjectNode extends GraphNode public function GetDotAttributes($bNoLabel = false) { $sDot = parent::GetDotAttributes(); - if ($this->GetProperty('developped', false)) - { + if ($this->GetProperty('developped', false)) { $sDot .= ',fontcolor=black'; - } - else - { + } else { $sDot .= ',fontcolor=lightgrey'; } - if ($this->GetProperty('source', false) || $this->GetProperty('sink', false)) - { + if ($this->GetProperty('source', false) || $this->GetProperty('sink', false)) { $sDot .= ',shape=rectangle'; } - if ($this->GetProperty('is_reached', false)) - { + if ($this->GetProperty('is_reached', false)) { $sDot .= ',fillcolor="#ffdddd"'; - } - else - { + } else { $sDot .= ',fillcolor=white'; } return $sDot; @@ -92,11 +85,9 @@ class RelationObjectNode extends GraphNode */ public function ReachDown($sProperty, $value) { - if (is_null($this->GetProperty($sProperty)) && ($this->GetProperty($sProperty.'_allowed') !== false)) - { + if (is_null($this->GetProperty($sProperty)) && ($this->GetProperty($sProperty.'_allowed') !== false)) { $this->SetProperty($sProperty, $value); - foreach ($this->GetOutgoingEdges() as $oOutgoingEdge) - { + foreach ($this->GetOutgoingEdges() as $oOutgoingEdge) { // Recurse $oOutgoingEdge->GetSinkNode()->ReachDown($sProperty, $value); } @@ -154,11 +145,9 @@ class RelationRedundancyNode extends GraphNode public function ReachDown($sProperty, $value) { $this->SetProperty($sProperty.'_count', $this->GetProperty($sProperty.'_count', 0) + 1); - if ($this->GetProperty($sProperty.'_count') > $this->GetProperty('threshold')) - { + if ($this->GetProperty($sProperty.'_count') > $this->GetProperty('threshold')) { // Looping... though there should be only ONE SINGLE outgoing edge - foreach ($this->GetOutgoingEdges() as $oOutgoingEdge) - { + foreach ($this->GetOutgoingEdges() as $oOutgoingEdge) { // Recurse $oOutgoingEdge->GetSinkNode()->ReachDown($sProperty, $value); } @@ -166,10 +155,9 @@ class RelationRedundancyNode extends GraphNode } } - /** * Helper to name the edges in a unique way - */ + */ class RelationEdge extends GraphEdge { /** @@ -196,11 +184,11 @@ class RelationEdge extends GraphEdge * source: boolean, that node was added as a source node * sink: boolean, that node was added as a sink node * reached: boolean, that node has been marked as reached (impacted by the source nodes) - * developped: boolean, that node has been visited to search for related objects + * developped: boolean, that node has been visited to search for related objects * 1) RelationRedundancyNode * reached_count: int, the number of source nodes having reached=true - * threshold: float, if reached_count > threshold, the sink nodes become reachable - */ + * threshold: float, if reached_count > threshold, the sink nodes become reachable + */ class RelationGraph extends SimpleGraph { protected $aSourceNodes; // Index of source nodes (for a quicker access) @@ -211,10 +199,10 @@ class RelationGraph extends SimpleGraph public function __construct() { parent::__construct(); - $this->aSourceNodes = array(); - $this->aSinkNodes = array(); - $this->aRedundancySettings = array(); - $this->aContextSearches = array(); + $this->aSourceNodes = []; + $this->aSinkNodes = []; + $this->aRedundancySettings = []; + $this->aContextSearches = []; } /** @@ -252,25 +240,25 @@ class RelationGraph extends SimpleGraph */ public function AddContextQuery($key, $sOQL) { - if ($sOQL === '') { return;} - + if ($sOQL === '') { + return; + } + $oSearch = static::MakeSearch($sOQL); $aAliases = $oSearch->GetSelectedClasses(); - if (count($aAliases) < 2 ) - { + if (count($aAliases) < 2) { IssueLog::Error("Invalid context query '$sOQL'. A context query must contain at least two columns."); throw new Exception("Invalid context query '$sOQL'. A context query must contain at least two columns. Columns: ".implode(', ', $aAliases).'. '); } $aAliasNames = array_keys($aAliases); $oCondition = new BinaryExpression(new FieldExpression('id', $aAliasNames[0]), '=', new VariableExpression('id')); $oSearch->AddConditionExpression($oCondition); - + $sClass = $oSearch->GetClass(); - if (!array_key_exists($sClass, $this->aContextSearches)) - { - $this->aContextSearches[$sClass] = array(); + if (!array_key_exists($sClass, $this->aContextSearches)) { + $this->aContextSearches[$sClass] = []; } - $this->aContextSearches[$sClass][] = array('key' => $key, 'search' => $oSearch); + $this->aContextSearches[$sClass][] = ['key' => $key, 'search' => $oSearch]; } /** @@ -286,25 +274,19 @@ class RelationGraph extends SimpleGraph $bRet = false; $sFinalClass = get_class($oObj); $aParentClasses = MetaModel::EnumParentClasses($sFinalClass, ENUM_PARENT_CLASSES_ALL); - - foreach($aParentClasses as $sClass) - { - if (array_key_exists($sClass, $this->aContextSearches)) - { - foreach($this->aContextSearches[$sClass] as $aContextQuery) - { + + foreach ($aParentClasses as $sClass) { + if (array_key_exists($sClass, $this->aContextSearches)) { + foreach ($this->aContextSearches[$sClass] as $aContextQuery) { $aAliases = $aContextQuery['search']->GetSelectedClasses(); $aAliasNames = array_keys($aAliases); $sRootCauseAlias = $aAliasNames[1]; // 1st column (=0) = object, second column = root cause - $oSet = new DBObjectSet($aContextQuery['search'], array(), array('id' => $oObj->GetKey())); - $oSet->OptimizeColumnLoad(array($aAliasNames[0] => array(), $aAliasNames[1] => array())); // Do not load any column... better do a reload than many joins - while($aRow = $oSet->FetchAssoc()) - { - if (!is_null($aRow[$sRootCauseAlias])) - { - if (!array_key_exists($aContextQuery['key'], $aRootCauses)) - { - $aRootCauses[$aContextQuery['key']] = array(); + $oSet = new DBObjectSet($aContextQuery['search'], [], ['id' => $oObj->GetKey()]); + $oSet->OptimizeColumnLoad([$aAliasNames[0] => [], $aAliasNames[1] => []]); // Do not load any column... better do a reload than many joins + while ($aRow = $oSet->FetchAssoc()) { + if (!is_null($aRow[$sRootCauseAlias])) { + if (!array_key_exists($aContextQuery['key'], $aRootCauses)) { + $aRootCauses[$aContextQuery['key']] = []; } $aRootCauses[$aContextQuery['key']][] = $aRow[$sRootCauseAlias]; $bRet = true; @@ -327,47 +309,41 @@ class RelationGraph extends SimpleGraph * @throws \CoreException * @throws \Exception */ - public function ComputeRelatedObjectsDown($sRelCode, $iMaxDepth, $bEnableRedundancy, $aUnreachableObjects = array()) + public function ComputeRelatedObjectsDown($sRelCode, $iMaxDepth, $bEnableRedundancy, $aUnreachableObjects = []) { //echo "
        Sources only...
        \n".$this->DumpAsHtmlImage()."
        \n"; // Build the graph out of the sources - foreach ($this->aSourceNodes as $oSourceNode) - { + foreach ($this->aSourceNodes as $oSourceNode) { $this->AddRelatedObjects($sRelCode, true, $oSourceNode, $iMaxDepth, $bEnableRedundancy); //echo "
        After processing of {$oSourceNode->GetId()}
        \n".$this->DumpAsHtmlImage()."
        \n"; } - + // Mark the unreachable nodes - foreach ($aUnreachableObjects as $oObj) - { + foreach ($aUnreachableObjects as $oObj) { $sNodeId = RelationObjectNode::MakeId($oObj); $oNode = $this->GetNode($sNodeId); - if($oNode) - { + if ($oNode) { $oNode->SetProperty('is_reached_allowed', false); } } - + // Determine the reached nodes - foreach ($this->aSourceNodes as $oSourceNode) - { + foreach ($this->aSourceNodes as $oSourceNode) { $oSourceNode->ReachDown('is_reached', true); //echo "
        After reaching from {$oSourceNode->GetId()}
        \n".$this->DumpAsHtmlImage()."
        \n"; } - + // Mark also the "context" nodes as reached and record the "root causes" for each node $oIterator = new RelationTypeIterator($this, 'Node'); - foreach($oIterator as $oNode) - { + foreach ($oIterator as $oNode) { $oObj = $oNode->GetProperty('object'); - $aRootCauses = array(); - if (!is_null($oObj) && $this->IsPartOfContext($oObj, $aRootCauses)) - { + $aRootCauses = []; + if (!is_null($oObj) && $this->IsPartOfContext($oObj, $aRootCauses)) { $oNode->SetProperty('context_root_causes', $aRootCauses); $oNode->ReachDown('is_reached', true); - } + } } - if ( MetaModel::GetConfig()->Get('relations.complete_analysis')) { + if (MetaModel::GetConfig()->Get('relations.complete_analysis')) { $this->ApplyUserRightsOnGraph(); } } @@ -386,30 +362,26 @@ class RelationGraph extends SimpleGraph { //echo "
        Sinks only...
        \n".$this->DumpAsHtmlImage()."
        \n"; // Build the graph out of the sinks - foreach ($this->aSinkNodes as $oSinkNode) - { + foreach ($this->aSinkNodes as $oSinkNode) { $this->AddRelatedObjects($sRelCode, false, $oSinkNode, $iMaxDepth, $bEnableRedundancy); //echo "
        After processing of {$oSinkNode->GetId()}
        \n".$this->DumpAsHtmlImage()."
        \n"; } // Mark also the "context" nodes as reached and record the "root causes" for each node $oIterator = new RelationTypeIterator($this, 'Node'); - foreach($oIterator as $oNode) - { + foreach ($oIterator as $oNode) { $oObj = $oNode->GetProperty('object'); - $aRootCauses = array(); - if (!is_null($oObj) && $this->IsPartOfContext($oObj, $aRootCauses)) - { + $aRootCauses = []; + if (!is_null($oObj) && $this->IsPartOfContext($oObj, $aRootCauses)) { $oNode->SetProperty('context_root_causes', $aRootCauses); $oNode->ReachDown('is_reached', true); - } + } } - if ( MetaModel::GetConfig()->Get('relations.complete_analysis')) { + if (MetaModel::GetConfig()->Get('relations.complete_analysis')) { $this->ApplyUserRightsOnGraph(); } } - /** * Recursively find related objects, and add them into the graph * @@ -423,27 +395,22 @@ class RelationGraph extends SimpleGraph */ protected function AddRelatedObjects($sRelCode, $bDown, $oObjectNode, $iMaxDepth, $bEnableRedundancy) { - if ($iMaxDepth > 0) - { - if ($oObjectNode instanceof RelationRedundancyNode) - { + if ($iMaxDepth > 0) { + if ($oObjectNode instanceof RelationRedundancyNode) { // Note: this happens when recursing on an existing part of the graph // Skip that redundancy node $aRelatedEdges = $bDown ? $oObjectNode->GetOutgoingEdges() : $oObjectNode->GetIncomingEdges(); - foreach ($aRelatedEdges as $oRelatedEdge) - { + foreach ($aRelatedEdges as $oRelatedEdge) { $oRelatedNode = $bDown ? $oRelatedEdge->GetSinkNode() : $oRelatedEdge->GetSourceNode(); // Recurse (same depth) $this->AddRelatedObjects($sRelCode, $bDown, $oRelatedNode, $iMaxDepth, $bEnableRedundancy); } - } - elseif ($oObjectNode->GetProperty('developped', false)) - { + } elseif ($oObjectNode->GetProperty('developped', false)) { // No need to explore the underlying graph at all. We can stop here since the node has already been developped. // Otherwise in case of "loops" in the graph we would recurse up to the max depth limit // without producing any difference in the resulting graph... but potentially taking a LOOOONG time. return; - + // Former code was //$aRelatedEdges = $bDown ? $oObjectNode->GetOutgoingEdges() : $oObjectNode->GetIncomingEdges(); //foreach ($aRelatedEdges as $oRelatedEdge) @@ -452,60 +419,50 @@ class RelationGraph extends SimpleGraph // // Recurse (decrement the depth) // $this->AddRelatedObjects($sRelCode, $bDown, $oRelatedNode, $iMaxDepth - 1, $bEnableRedundancy); //} - } - else - { + } else { $oObjectNode->SetProperty('developped', true); - + $oObject = $oObjectNode->GetProperty('object'); $iPreviousTimeLimit = ini_get('max_execution_time'); $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop'); - foreach (MetaModel::EnumRelationQueries(get_class($oObject), $sRelCode, $bDown) as $sDummy => $aQueryInfo) - { - $sQuery = $bDown ? $aQueryInfo['sQueryDown'] : $aQueryInfo['sQueryUp']; - try - { + foreach (MetaModel::EnumRelationQueries(get_class($oObject), $sRelCode, $bDown) as $sDummy => $aQueryInfo) { + $sQuery = $bDown ? $aQueryInfo['sQueryDown'] : $aQueryInfo['sQueryUp']; + try { $oFlt = static::MakeSearch($sQuery); - if ( MetaModel::GetConfig()->Get('relations.complete_analysis')) { + if (MetaModel::GetConfig()->Get('relations.complete_analysis')) { //no filter to find all impacts $oFlt->AllowAllData(true); } - $oObjSet = new DBObjectSet($oFlt, array(), $oObject->ToArgsForQuery()); + $oObjSet = new DBObjectSet($oFlt, [], $oObject->ToArgsForQuery()); $oRelatedObj = $oObjSet->Fetch(); - } - catch (Exception $e) - { + } catch (Exception $e) { $sDirection = $bDown ? 'downstream' : 'upstream'; throw new Exception("Wrong query ($sDirection) for the relation $sRelCode/{$aQueryInfo['sDefinedInClass']}/{$aQueryInfo['sNeighbour']}: ".$e->getMessage()); } - if ($oRelatedObj) - { - do - { + if ($oRelatedObj) { + do { set_time_limit(intval($iLoopTimeLimit)); - $sObjectRef = RelationObjectNode::MakeId($oRelatedObj); - $oRelatedNode = $this->GetNode($sObjectRef); - if (is_null($oRelatedNode)) { - $oRelatedNode = new RelationObjectNode($this, $oRelatedObj); - } - $oSourceNode = $bDown ? $oObjectNode : $oRelatedNode; - $oSinkNode = $bDown ? $oRelatedNode : $oObjectNode; - if ($bEnableRedundancy) - { - $oRedundancyNode = $this->ComputeRedundancy($sRelCode, $aQueryInfo, $oSourceNode, $oSinkNode); - } else { - $oRedundancyNode = null; - } - if (!$oRedundancyNode) { - // Direct link (otherwise handled by ComputeRedundancy) - new RelationEdge($this, $oSourceNode, $oSinkNode); - } + $sObjectRef = RelationObjectNode::MakeId($oRelatedObj); + $oRelatedNode = $this->GetNode($sObjectRef); + if (is_null($oRelatedNode)) { + $oRelatedNode = new RelationObjectNode($this, $oRelatedObj); + } + $oSourceNode = $bDown ? $oObjectNode : $oRelatedNode; + $oSinkNode = $bDown ? $oRelatedNode : $oObjectNode; + if ($bEnableRedundancy) { + $oRedundancyNode = $this->ComputeRedundancy($sRelCode, $aQueryInfo, $oSourceNode, $oSinkNode); + } else { + $oRedundancyNode = null; + } + if (!$oRedundancyNode) { + // Direct link (otherwise handled by ComputeRedundancy) + new RelationEdge($this, $oSourceNode, $oSinkNode); + } // Recurse $this->AddRelatedObjects($sRelCode, $bDown, $oRelatedNode, $iMaxDepth - 1, $bEnableRedundancy); - } - while ($oRelatedObj = $oObjSet->Fetch()); + } while ($oRelatedObj = $oObjSet->Fetch()); } } set_time_limit(intval($iPreviousTimeLimit)); @@ -528,48 +485,41 @@ class RelationGraph extends SimpleGraph { $oRedundancyNode = null; $oObject = $oToNode->GetProperty('object'); - if ($this->IsRedundancyEnabled($sRelCode, $aQueryInfo, $oToNode)) - { + if ($this->IsRedundancyEnabled($sRelCode, $aQueryInfo, $oToNode)) { $sUniqueNeighbourId = $aQueryInfo['sDefinedInClass'].'-'.$aQueryInfo['sNeighbour']; $sId = RelationRedundancyNode::MakeId($sRelCode, $sUniqueNeighbourId, $oFromNode->GetProperty('object'), $oToNode->GetProperty('object')); $oRedundancyNode = $this->GetNode($sId); - if (is_null($oRedundancyNode)) - { + if (is_null($oRedundancyNode)) { // Get the upper neighbours $sQuery = $aQueryInfo['sQueryUp']; - if (!$sQuery) - { + if (!$sQuery) { throw new Exception("Redundancy cannot be enabled on the relation $sRelCode/{$aQueryInfo['sDefinedInClass']}/{$aQueryInfo['sNeighbour']}: its direction is \"{$aQueryInfo['sDirection']}\""); } - try - { + try { $oFlt = static::MakeSearch($sQuery); - if ( MetaModel::GetConfig()->Get('relations.complete_analysis')) { + if (MetaModel::GetConfig()->Get('relations.complete_analysis')) { //no filter to find all impacts $oFlt->AllowAllData(true); } - $oObjSet = new DBObjectSet($oFlt, array(), $oObject->ToArgsForQuery()); + $oObjSet = new DBObjectSet($oFlt, [], $oObject->ToArgsForQuery()); $iCount = $oObjSet->Count(); - } - catch (Exception $e) - { + } catch (Exception $e) { throw new Exception("Wrong query (upstream) for the relation $sRelCode/{$aQueryInfo['sDefinedInClass']}/{$aQueryInfo['sNeighbour']}: ".$e->getMessage()); } - + $iMinUp = $this->GetRedundancyMinUp($sRelCode, $aQueryInfo, $oToNode, $iCount); $fThreshold = max(0, $iCount - $iMinUp); $oRedundancyNode = new RelationRedundancyNode($this, $sId, $iMinUp, $fThreshold); new RelationEdge($this, $oRedundancyNode, $oToNode); - - while ($oUpperObj = $oObjSet->Fetch()) - { - $sObjectRef = RelationObjectNode::MakeId($oUpperObj); - $oUpperNode = $this->GetNode($sObjectRef); - if (is_null($oUpperNode)) { - $oUpperNode = new RelationObjectNode($this, $oUpperObj); - } - new RelationEdge($this, $oUpperNode, $oRedundancyNode); + + while ($oUpperObj = $oObjSet->Fetch()) { + $sObjectRef = RelationObjectNode::MakeId($oUpperObj); + $oUpperNode = $this->GetNode($sObjectRef); + if (is_null($oUpperNode)) { + $oUpperNode = new RelationObjectNode($this, $oUpperObj); + } + new RelationEdge($this, $oUpperNode, $oRedundancyNode); } } } @@ -590,8 +540,7 @@ class RelationGraph extends SimpleGraph $bRet = false; $oToObject = $oToNode->GetProperty('object'); $oRedundancyAttDef = $this->FindRedundancyAttribute($sRelCode, $aQueryInfo, get_class($oToObject)); - if ($oRedundancyAttDef) - { + if ($oRedundancyAttDef) { $sValue = $oToObject->Get($oRedundancyAttDef->GetCode()); $bRet = $oRedundancyAttDef->IsEnabled($sValue); } @@ -614,15 +563,11 @@ class RelationGraph extends SimpleGraph $oToObject = $oToNode->GetProperty('object'); $oRedundancyAttDef = $this->FindRedundancyAttribute($sRelCode, $aQueryInfo, get_class($oToObject)); - if ($oRedundancyAttDef) - { + if ($oRedundancyAttDef) { $sValue = $oToObject->Get($oRedundancyAttDef->GetCode()); - if ($oRedundancyAttDef->GetMinUpType($sValue) == 'count') - { + if ($oRedundancyAttDef->GetMinUpType($sValue) == 'count') { $iMinUp = $oRedundancyAttDef->GetMinUpValue($sValue); - } - else - { + } else { $iMinUp = $iUpstreamObjects * $oRedundancyAttDef->GetMinUpValue($sValue) / 100; } } @@ -641,16 +586,11 @@ class RelationGraph extends SimpleGraph protected function FindRedundancyAttribute($sRelCode, $aQueryInfo, $sClass) { $oRet = null; - foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - if ($oAttDef instanceof AttributeRedundancySettings) - { - if ($oAttDef->Get('relation_code') == $sRelCode) - { - if ($oAttDef->Get('from_class') == $aQueryInfo['sFromClass']) - { - if ($oAttDef->Get('neighbour_id') == $aQueryInfo['sNeighbour']) - { + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if ($oAttDef instanceof AttributeRedundancySettings) { + if ($oAttDef->Get('relation_code') == $sRelCode) { + if ($oAttDef->Get('from_class') == $aQueryInfo['sFromClass']) { + if ($oAttDef->Get('neighbour_id') == $aQueryInfo['sNeighbour']) { $oRet = $oAttDef; break; } @@ -660,29 +600,26 @@ class RelationGraph extends SimpleGraph } return $oRet; } - + /** * Get the objects referenced by the graph as a hash array: 'class' => array of objects * @return array Ambigous */ public function GetObjectsByClass() { - $aResults = array(); + $aResults = []; $oIterator = new RelationTypeIterator($this, 'Node'); - foreach($oIterator as $oNode) - { + foreach ($oIterator as $oNode) { $oObj = $oNode->GetProperty('object'); // Some nodes (Redundancy Nodes and Group) do not contain an object - if ($oObj) - { + if ($oObj) { $sObjClass = get_class($oObj); - if (!array_key_exists($sObjClass, $aResults)) - { - $aResults[$sObjClass] = array(); + if (!array_key_exists($sObjClass, $aResults)) { + $aResults[$sObjClass] = []; } $aResults[$sObjClass][] = $oObj; } } - return $aResults; + return $aResults; } /** @@ -695,8 +632,7 @@ class RelationGraph extends SimpleGraph protected static function MakeSearch($sOQL) { $oSearch = DBSearch::FromOQL($sOQL); - if (MetaModel::IsObsoletable($oSearch->GetClass())) - { + if (MetaModel::IsObsoletable($oSearch->GetClass())) { // Exclude obsolete objects anytime $oSearch->AddCondition('obsolescence_flag', 0); } @@ -705,7 +641,6 @@ class RelationGraph extends SimpleGraph return $oSearch; } - /** * @return void * @throws \CoreException @@ -733,7 +668,7 @@ class RelationGraph extends SimpleGraph $sOQL = "SELECT ".$sClass.' WHERE id IN ('.implode(',', $aKeys).')'; $oSearch = DBObjectSearch::FromOQL($sOQL); $aListId = $oSearch->SelectAttributeToArray('id'); - foreach($aListId as$aItem ) { + foreach ($aListId as $aItem) { unset($aArrayTest[$sClass][$aItem['id']]); } } diff --git a/core/restservices.class.inc.php b/core/restservices.class.inc.php index 42899b975..cbe5740f2 100644 --- a/core/restservices.class.inc.php +++ b/core/restservices.class.inc.php @@ -1,9 +1,10 @@ message = ''; $this->class = $sClass; $this->key = $iId; - $this->fields = array(); + $this->fields = []; } /** @@ -84,36 +85,32 @@ class ObjectResult * @param boolean $bExtendedOutput Output all of the link set attributes ? * @param integer $iCode An error code (RestResult::OK is no issue has been found) * @param string $sMessage Description of the error if any, an empty string otherwise - * + * * @return ObjectResult */ - public static function FromDBObject(DBObject $oObj, ?array $aFieldSpec = null, $bExtendedOutput = false, $iCode = 0, $sMessage = '') : ObjectResult { + public static function FromDBObject(DBObject $oObj, ?array $aFieldSpec = null, $bExtendedOutput = false, $iCode = 0, $sMessage = ''): ObjectResult + { $oObjRes = new ObjectResult($oObj::class, $oObj->GetKey()); $oObjRes->code = $iCode; $oObjRes->message = $sMessage; $aFields = null; - if (!is_null($aFieldSpec)) - { + if (!is_null($aFieldSpec)) { // Enum all classes in the hierarchy, starting with the current one - foreach (MetaModel::EnumParentClasses($oObj::class, ENUM_PARENT_CLASSES_ALL, false) as $sRefClass) - { - if (array_key_exists($sRefClass, $aFieldSpec)) - { + foreach (MetaModel::EnumParentClasses($oObj::class, ENUM_PARENT_CLASSES_ALL, false) as $sRefClass) { + if (array_key_exists($sRefClass, $aFieldSpec)) { $aFields = $aFieldSpec[$sRefClass]; break; } } } - if (is_null($aFields)) - { + if (is_null($aFields)) { // No fieldspec given, or not found... - $aFields = array('id', 'friendlyname'); + $aFields = ['id', 'friendlyname']; } - foreach ($aFields as $sAttCode) - { + foreach ($aFields as $sAttCode) { $oObjRes->AddField($oObj, $sAttCode, $bExtendedOutput); } @@ -121,7 +118,6 @@ class ObjectResult } - /** * Helper to make an output value for a given attribute * @@ -138,48 +134,37 @@ class ObjectResult */ protected function MakeResultValue(DBObject $oObject, $sAttCode, $bExtendedOutput = false) { - if ($sAttCode == 'id') - { + if ($sAttCode == 'id') { $value = $oObject->GetKey(); - } - else - { + } else { $sClass = get_class($oObject); $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - if ($oAttDef instanceof AttributeLinkedSet) - { + if ($oAttDef instanceof AttributeLinkedSet) { // Iterate on the set and build an array of array of attcode=>value $oSet = $oObject->Get($sAttCode); - $value = array(); - while ($oLnk = $oSet->Fetch()) - { + $value = []; + while ($oLnk = $oSet->Fetch()) { $sLnkRefClass = $bExtendedOutput ? get_class($oLnk) : $oAttDef->GetLinkedClass(); - $aLnkValues = array(); - foreach (MetaModel::ListAttributeDefs($sLnkRefClass) as $sLnkAttCode => $oLnkAttDef) - { + $aLnkValues = []; + foreach (MetaModel::ListAttributeDefs($sLnkRefClass) as $sLnkAttCode => $oLnkAttDef) { // Skip attributes pointing to the current object (redundant data) - if ($sLnkAttCode == $oAttDef->GetExtKeyToMe()) - { + if ($sLnkAttCode == $oAttDef->GetExtKeyToMe()) { continue; } // Skip any attribute of the link that points to the current object $oLnkAttDef = MetaModel::GetAttributeDef($sLnkRefClass, $sLnkAttCode); - if (method_exists($oLnkAttDef, 'GetKeyAttCode')) - { - if ($oLnkAttDef->GetKeyAttCode() == $oAttDef->GetExtKeyToMe()) - { + if (method_exists($oLnkAttDef, 'GetKeyAttCode')) { + if ($oLnkAttDef->GetKeyAttCode() == $oAttDef->GetExtKeyToMe()) { continue; } } - + $aLnkValues[$sLnkAttCode] = $this->MakeResultValue($oLnk, $sLnkAttCode, $bExtendedOutput); } $value[] = $aLnkValues; } - } - else - { + } else { $value = $oAttDef->GetForJSON($oObject->Get($sAttCode)); } } @@ -205,22 +190,19 @@ class ObjectResult $this->fields[$sAttCode] = $this->MakeResultValue($oObject, $sAttCode, $bExtendedOutput); } -public function SanitizeContent() + public function SanitizeContent() { - foreach($this->fields as $sFieldAttCode => $fieldValue) - { - try { - $oAttDef = MetaModel::GetAttributeDef($this->class, $sFieldAttCode); - } catch (Exception $e) { // for special cases like ID - continue; - } - $this->SanitizeFieldIfSensitive($this->fields, $sFieldAttCode, $fieldValue, $oAttDef); + foreach ($this->fields as $sFieldAttCode => $fieldValue) { + try { + $oAttDef = MetaModel::GetAttributeDef($this->class, $sFieldAttCode); + } catch (Exception $e) { // for special cases like ID + continue; + } + $this->SanitizeFieldIfSensitive($this->fields, $sFieldAttCode, $fieldValue, $oAttDef); } } } - - /** * REST response for services managing objects. Derive this structure to add information and/or constants * @@ -256,12 +238,11 @@ class RestResultWithObjects extends RestResult $this->objects[$sObjKey] = $oObjRes; } -public function SanitizeContent() + public function SanitizeContent() { parent::SanitizeContent(); - foreach($this->objects as $sObjKey => $oObjRes) - { + foreach ($this->objects as $sObjKey => $oObjRes) { $oObjRes->SanitizeContent(); } } @@ -281,7 +262,7 @@ class RestResultWithRelations extends RestResultWithObjects public function __construct() { parent::__construct(); - $this->relations = array(); + $this->relations = []; } /** @@ -293,11 +274,10 @@ class RestResultWithRelations extends RestResultWithObjects */ public function AddRelation($sSrcKey, $sDestKey) { - if (!array_key_exists($sSrcKey, $this->relations)) - { - $this->relations[$sSrcKey] = array(); + if (!array_key_exists($sSrcKey, $this->relations)) { + $this->relations[$sSrcKey] = []; } - $this->relations[$sSrcKey][] = array('key' => $sDestKey); + $this->relations[$sSrcKey][] = ['key' => $sDestKey]; } } @@ -306,7 +286,7 @@ class RestResultWithRelations extends RestResultWithObjects * * @package RESTAPI * @api - * @since 2.0.1 + * @since 2.0.1 */ class RestDelete { @@ -314,37 +294,37 @@ class RestDelete * Result: Object deleted as per the initial request * @api */ - const OK = 0; + public const OK = 0; /** * Result: general issue (user rights or ... ?) * @api */ - const ISSUE = 1; + public const ISSUE = 1; /** * Result: Must be deleted to preserve database integrity * @api */ - const AUTO_DELETE = 2; + public const AUTO_DELETE = 2; /** * Result: Must be deleted to preserve database integrity, but that is NOT possible * @api */ - const AUTO_DELETE_ISSUE = 3; + public const AUTO_DELETE_ISSUE = 3; /** * Result: Must be deleted to preserve database integrity, but this must be requested explicitly * @api */ - const REQUEST_EXPLICITELY = 4; + public const REQUEST_EXPLICITELY = 4; /** * Result: Must be updated to preserve database integrity * @api */ - const AUTO_UPDATE = 5; + public const AUTO_UPDATE = 5; /** * Result: Must be updated to preserve database integrity, but that is NOT possible * @api */ - const AUTO_UPDATE_ISSUE = 6; + public const AUTO_UPDATE_ISSUE = 6; } /** @@ -354,10 +334,10 @@ class RestDelete */ class CoreServices implements iRestServiceProvider, iRestInputSanitizer { - use SanitizeTrait; - /** + use SanitizeTrait; + /** * Enumerate services delivered by this class - * + * * @param string $sVersion The version (e.g. 1.0) supported by the services * @return array An array of hash 'verb' => verb, 'description' => description */ @@ -369,37 +349,36 @@ class CoreServices implements iRestServiceProvider, iRestInputSanitizer // 1.1 - In the reply, objects have a 'key' entry so that it is no more necessary to split class::key programmaticaly // 1.0 - Initial implementation in iTop 2.0.1 // - $aOps = array(); - if (in_array($sVersion, array('1.0', '1.1', '1.2', '1.3', '1.4'))) - { - $aOps[] = array( + $aOps = []; + if (in_array($sVersion, ['1.0', '1.1', '1.2', '1.3', '1.4'])) { + $aOps[] = [ 'verb' => 'core/create', - 'description' => 'Create an object' - ); - $aOps[] = array( + 'description' => 'Create an object', + ]; + $aOps[] = [ 'verb' => 'core/update', - 'description' => 'Update an object' - ); - $aOps[] = array( + 'description' => 'Update an object', + ]; + $aOps[] = [ 'verb' => 'core/apply_stimulus', - 'description' => 'Apply a stimulus to change the state of an object' - ); - $aOps[] = array( + 'description' => 'Apply a stimulus to change the state of an object', + ]; + $aOps[] = [ 'verb' => 'core/get', - 'description' => 'Search for objects' - ); - $aOps[] = array( + 'description' => 'Search for objects', + ]; + $aOps[] = [ 'verb' => 'core/delete', - 'description' => 'Delete objects' - ); - $aOps[] = array( + 'description' => 'Delete objects', + ]; + $aOps[] = [ 'verb' => 'core/get_related', - 'description' => 'Get related objects through the specified relation' - ); - $aOps[] = array( + 'description' => 'Get related objects through the specified relation', + ]; + $aOps[] = [ 'verb' => 'core/check_credentials', - 'description' => 'Check user credentials' - ); + 'description' => 'Check user credentials', + ]; } return $aOps; } @@ -420,457 +399,355 @@ class CoreServices implements iRestServiceProvider, iRestInputSanitizer public function ExecOperation($sVersion, $sVerb, $aParams) { $oResult = new RestResultWithObjects(); - switch ($sVerb) - { - case 'core/create': - RestUtils::InitTrackingComment($aParams); - $sClass = RestUtils::GetClass($aParams, 'class'); - $aFields = RestUtils::GetMandatoryParam($aParams, 'fields'); - $aShowFields = RestUtils::GetFieldList($sClass, $aParams, 'output_fields'); - $bExtendedOutput = (RestUtils::GetOptionalParam($aParams, 'output_fields', '*') == '*+'); + switch ($sVerb) { + case 'core/create': + RestUtils::InitTrackingComment($aParams); + $sClass = RestUtils::GetClass($aParams, 'class'); + $aFields = RestUtils::GetMandatoryParam($aParams, 'fields'); + $aShowFields = RestUtils::GetFieldList($sClass, $aParams, 'output_fields'); + $bExtendedOutput = (RestUtils::GetOptionalParam($aParams, 'output_fields', '*') == '*+'); - if (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY) != UR_ALLOWED_YES) - { - $oResult->code = RestResult::UNAUTHORIZED; - $oResult->message = "The current user does not have enough permissions for creating data of class $sClass"; - } - elseif (UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_MODIFY) != UR_ALLOWED_YES) - { - $oResult->code = RestResult::UNAUTHORIZED; - $oResult->message = "The current user does not have enough permissions for massively creating data of class $sClass"; - } - else - { - $oObject = RestUtils::MakeObjectFromFields($sClass, $aFields); - $oObject->DBInsert(); - $oResult->AddObject(0, 'created', $oObject, $aShowFields, $bExtendedOutput); - } - break; - - case 'core/update': - RestUtils::InitTrackingComment($aParams); - $sClass = RestUtils::GetClass($aParams, 'class'); - $key = RestUtils::GetMandatoryParam($aParams, 'key'); - $aFields = RestUtils::GetMandatoryParam($aParams, 'fields'); - $aShowFields = RestUtils::GetFieldList($sClass, $aParams, 'output_fields'); - $bExtendedOutput = (RestUtils::GetOptionalParam($aParams, 'output_fields', '*') == '*+'); - - // Note: the target class cannot be based on the result of FindObjectFromKey, because in case the user does not have read access, that function already fails with msg 'Nothing found' - $sTargetClass = RestUtils::GetObjectSetFromKey($sClass, $key)->GetFilter()->GetClass(); - if (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_MODIFY) != UR_ALLOWED_YES) - { - $oResult->code = RestResult::UNAUTHORIZED; - $oResult->message = "The current user does not have enough permissions for modifying data of class $sTargetClass"; - } - elseif (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_MODIFY) != UR_ALLOWED_YES) - { - $oResult->code = RestResult::UNAUTHORIZED; - $oResult->message = "The current user does not have enough permissions for massively modifying data of class $sTargetClass"; - } - else - { - $oObject = RestUtils::FindObjectFromKey($sClass, $key); - RestUtils::UpdateObjectFromFields($oObject, $aFields); - $oObject->DBUpdate(); - $oResult->AddObject(0, 'updated', $oObject, $aShowFields, $bExtendedOutput); - } - break; - - case 'core/apply_stimulus': - RestUtils::InitTrackingComment($aParams); - $sClass = RestUtils::GetClass($aParams, 'class'); - $key = RestUtils::GetMandatoryParam($aParams, 'key'); - $aFields = RestUtils::GetMandatoryParam($aParams, 'fields'); - $aShowFields = RestUtils::GetFieldList($sClass, $aParams, 'output_fields'); - $bExtendedOutput = (RestUtils::GetOptionalParam($aParams, 'output_fields', '*') == '*+'); - $sStimulus = RestUtils::GetMandatoryParam($aParams, 'stimulus'); - - // Note: the target class cannot be based on the result of FindObjectFromKey, because in case the user does not have read access, that function already fails with msg 'Nothing found' - $sTargetClass = RestUtils::GetObjectSetFromKey($sClass, $key)->GetFilter()->GetClass(); - if (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_MODIFY) != UR_ALLOWED_YES) - { - $oResult->code = RestResult::UNAUTHORIZED; - $oResult->message = "The current user does not have enough permissions for modifying data of class $sTargetClass"; - } - elseif (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_BULK_MODIFY) != UR_ALLOWED_YES) - { - $oResult->code = RestResult::UNAUTHORIZED; - $oResult->message = "The current user does not have enough permissions for massively modifying data of class $sTargetClass"; - } - else - { - $oObject = RestUtils::FindObjectFromKey($sClass, $key); - RestUtils::UpdateObjectFromFields($oObject, $aFields); - - $aTransitions = $oObject->EnumTransitions(); - $aStimuli = MetaModel::EnumStimuli(get_class($oObject)); - if (!isset($aTransitions[$sStimulus])) - { - // Invalid stimulus - $oResult->code = RestResult::INTERNAL_ERROR; - $oResult->message = "Invalid stimulus: '$sStimulus' on the object ".$oObject->GetName()." in state '".$oObject->GetState()."'"; + if (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY) != UR_ALLOWED_YES) { + $oResult->code = RestResult::UNAUTHORIZED; + $oResult->message = "The current user does not have enough permissions for creating data of class $sClass"; + } elseif (UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_MODIFY) != UR_ALLOWED_YES) { + $oResult->code = RestResult::UNAUTHORIZED; + $oResult->message = "The current user does not have enough permissions for massively creating data of class $sClass"; + } else { + $oObject = RestUtils::MakeObjectFromFields($sClass, $aFields); + $oObject->DBInsert(); + $oResult->AddObject(0, 'created', $oObject, $aShowFields, $bExtendedOutput); } - else - { - $aTransition = $aTransitions[$sStimulus]; - $sTargetState = $aTransition['target_state']; - $aStates = MetaModel::EnumStates($sClass); - $aTargetStateDef = $aStates[$sTargetState]; - $aExpectedAttributes = $aTargetStateDef['attribute_list']; - - $aMissingMandatory = array(); - foreach($aExpectedAttributes as $sAttCode => $iExpectCode) - { - if ( ($iExpectCode & OPT_ATT_MANDATORY) && ($oObject->Get($sAttCode) == '')) - { - $aMissingMandatory[] = $sAttCode; - } - } - if (count($aMissingMandatory) == 0) - { - // If all the mandatory fields are already present, just apply the transition silently... - if ($oObject->ApplyStimulus($sStimulus)) - { - $oObject->DBUpdate(); - $oResult->AddObject(0, 'updated', $oObject, $aShowFields, $bExtendedOutput); - } - } - else - { - // Missing mandatory attributes for the transition + break; + + case 'core/update': + RestUtils::InitTrackingComment($aParams); + $sClass = RestUtils::GetClass($aParams, 'class'); + $key = RestUtils::GetMandatoryParam($aParams, 'key'); + $aFields = RestUtils::GetMandatoryParam($aParams, 'fields'); + $aShowFields = RestUtils::GetFieldList($sClass, $aParams, 'output_fields'); + $bExtendedOutput = (RestUtils::GetOptionalParam($aParams, 'output_fields', '*') == '*+'); + + // Note: the target class cannot be based on the result of FindObjectFromKey, because in case the user does not have read access, that function already fails with msg 'Nothing found' + $sTargetClass = RestUtils::GetObjectSetFromKey($sClass, $key)->GetFilter()->GetClass(); + if (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_MODIFY) != UR_ALLOWED_YES) { + $oResult->code = RestResult::UNAUTHORIZED; + $oResult->message = "The current user does not have enough permissions for modifying data of class $sTargetClass"; + } elseif (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_MODIFY) != UR_ALLOWED_YES) { + $oResult->code = RestResult::UNAUTHORIZED; + $oResult->message = "The current user does not have enough permissions for massively modifying data of class $sTargetClass"; + } else { + $oObject = RestUtils::FindObjectFromKey($sClass, $key); + RestUtils::UpdateObjectFromFields($oObject, $aFields); + $oObject->DBUpdate(); + $oResult->AddObject(0, 'updated', $oObject, $aShowFields, $bExtendedOutput); + } + break; + + case 'core/apply_stimulus': + RestUtils::InitTrackingComment($aParams); + $sClass = RestUtils::GetClass($aParams, 'class'); + $key = RestUtils::GetMandatoryParam($aParams, 'key'); + $aFields = RestUtils::GetMandatoryParam($aParams, 'fields'); + $aShowFields = RestUtils::GetFieldList($sClass, $aParams, 'output_fields'); + $bExtendedOutput = (RestUtils::GetOptionalParam($aParams, 'output_fields', '*') == '*+'); + $sStimulus = RestUtils::GetMandatoryParam($aParams, 'stimulus'); + + // Note: the target class cannot be based on the result of FindObjectFromKey, because in case the user does not have read access, that function already fails with msg 'Nothing found' + $sTargetClass = RestUtils::GetObjectSetFromKey($sClass, $key)->GetFilter()->GetClass(); + if (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_MODIFY) != UR_ALLOWED_YES) { + $oResult->code = RestResult::UNAUTHORIZED; + $oResult->message = "The current user does not have enough permissions for modifying data of class $sTargetClass"; + } elseif (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_BULK_MODIFY) != UR_ALLOWED_YES) { + $oResult->code = RestResult::UNAUTHORIZED; + $oResult->message = "The current user does not have enough permissions for massively modifying data of class $sTargetClass"; + } else { + $oObject = RestUtils::FindObjectFromKey($sClass, $key); + RestUtils::UpdateObjectFromFields($oObject, $aFields); + + $aTransitions = $oObject->EnumTransitions(); + $aStimuli = MetaModel::EnumStimuli(get_class($oObject)); + if (!isset($aTransitions[$sStimulus])) { + // Invalid stimulus $oResult->code = RestResult::INTERNAL_ERROR; - $oResult->message = 'Missing mandatory attribute(s) for applying the stimulus: '.implode(', ', $aMissingMandatory).'.'; + $oResult->message = "Invalid stimulus: '$sStimulus' on the object ".$oObject->GetName()." in state '".$oObject->GetState()."'"; + } else { + $aTransition = $aTransitions[$sStimulus]; + $sTargetState = $aTransition['target_state']; + $aStates = MetaModel::EnumStates($sClass); + $aTargetStateDef = $aStates[$sTargetState]; + $aExpectedAttributes = $aTargetStateDef['attribute_list']; + + $aMissingMandatory = []; + foreach ($aExpectedAttributes as $sAttCode => $iExpectCode) { + if (($iExpectCode & OPT_ATT_MANDATORY) && ($oObject->Get($sAttCode) == '')) { + $aMissingMandatory[] = $sAttCode; + } + } + if (count($aMissingMandatory) == 0) { + // If all the mandatory fields are already present, just apply the transition silently... + if ($oObject->ApplyStimulus($sStimulus)) { + $oObject->DBUpdate(); + $oResult->AddObject(0, 'updated', $oObject, $aShowFields, $bExtendedOutput); + } + } else { + // Missing mandatory attributes for the transition + $oResult->code = RestResult::INTERNAL_ERROR; + $oResult->message = 'Missing mandatory attribute(s) for applying the stimulus: '.implode(', ', $aMissingMandatory).'.'; + } } } - } - break; - - case 'core/get': - $sClass = RestUtils::GetClass($aParams, 'class'); - $key = RestUtils::GetMandatoryParam($aParams, 'key'); - $aShowFields = RestUtils::GetFieldList($sClass, $aParams, 'output_fields'); - $bExtendedOutput = (RestUtils::GetOptionalParam($aParams, 'output_fields', '*') == '*+'); - $iLimit = (int)RestUtils::GetOptionalParam($aParams, 'limit', 0); - $iPage = (int)RestUtils::GetOptionalParam($aParams, 'page', 1); + break; - $oObjectSet = RestUtils::GetObjectSetFromKey($sClass, $key, $iLimit, self::getOffsetFromLimitAndPage($iLimit, $iPage)); - $sTargetClass = $oObjectSet->GetFilter()->GetClass(); - - if (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_READ) != UR_ALLOWED_YES) - { - $oResult->code = RestResult::UNAUTHORIZED; - $oResult->message = "The current user does not have enough permissions for reading data of class $sTargetClass"; - } - elseif (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_BULK_READ) != UR_ALLOWED_YES) - { - $oResult->code = RestResult::UNAUTHORIZED; - $oResult->message = "The current user does not have enough permissions for exporting data of class $sTargetClass"; - } - elseif ($iPage < 1) - { - $oResult->code = RestResult::INVALID_PAGE; - $oResult->message = "The request page number is not valid. It must be an integer greater than 0"; - } - else - { - if (!$bExtendedOutput && RestUtils::GetOptionalParam($aParams, 'output_fields', '*') != '*') - { - $aFields = $aShowFields[$sClass]; - //Id is not a valid attribute to optimize - if (in_array('id', $aFields)) - { - unset($aFields[array_search('id', $aFields)]); - } - $aAttToLoad = array($oObjectSet->GetClassAlias() => $aFields); - $oObjectSet->OptimizeColumnLoad($aAttToLoad); - } + case 'core/get': + $sClass = RestUtils::GetClass($aParams, 'class'); + $key = RestUtils::GetMandatoryParam($aParams, 'key'); + $aShowFields = RestUtils::GetFieldList($sClass, $aParams, 'output_fields'); + $bExtendedOutput = (RestUtils::GetOptionalParam($aParams, 'output_fields', '*') == '*+'); + $iLimit = (int)RestUtils::GetOptionalParam($aParams, 'limit', 0); + $iPage = (int)RestUtils::GetOptionalParam($aParams, 'page', 1); - while ($oObject = $oObjectSet->Fetch()) - { - $oResult->AddObject(0, '', $oObject, $aShowFields, $bExtendedOutput); + $oObjectSet = RestUtils::GetObjectSetFromKey($sClass, $key, $iLimit, self::getOffsetFromLimitAndPage($iLimit, $iPage)); + $sTargetClass = $oObjectSet->GetFilter()->GetClass(); + + if (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_READ) != UR_ALLOWED_YES) { + $oResult->code = RestResult::UNAUTHORIZED; + $oResult->message = "The current user does not have enough permissions for reading data of class $sTargetClass"; + } elseif (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_BULK_READ) != UR_ALLOWED_YES) { + $oResult->code = RestResult::UNAUTHORIZED; + $oResult->message = "The current user does not have enough permissions for exporting data of class $sTargetClass"; + } elseif ($iPage < 1) { + $oResult->code = RestResult::INVALID_PAGE; + $oResult->message = "The request page number is not valid. It must be an integer greater than 0"; + } else { + if (!$bExtendedOutput && RestUtils::GetOptionalParam($aParams, 'output_fields', '*') != '*') { + $aFields = $aShowFields[$sClass]; + //Id is not a valid attribute to optimize + if (in_array('id', $aFields)) { + unset($aFields[array_search('id', $aFields)]); + } + $aAttToLoad = [$oObjectSet->GetClassAlias() => $aFields]; + $oObjectSet->OptimizeColumnLoad($aAttToLoad); + } + + while ($oObject = $oObjectSet->Fetch()) { + $oResult->AddObject(0, '', $oObject, $aShowFields, $bExtendedOutput); + } + $oResult->message = "Found: ".$oObjectSet->Count(); } - $oResult->message = "Found: ".$oObjectSet->Count(); - } - break; + break; - case 'core/delete': - RestUtils::InitTrackingComment($aParams); - $sClass = RestUtils::GetClass($aParams, 'class'); - $key = RestUtils::GetMandatoryParam($aParams, 'key'); - $bSimulate = RestUtils::GetOptionalParam($aParams, 'simulate', false); - - $oObjectSet = RestUtils::GetObjectSetFromKey($sClass, $key); - $sTargetClass = $oObjectSet->GetFilter()->GetClass(); - - if (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_DELETE) != UR_ALLOWED_YES) - { - $oResult->code = RestResult::UNAUTHORIZED; - $oResult->message = "The current user does not have enough permissions for deleting data of class $sTargetClass"; - } - elseif (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_DELETE) != UR_ALLOWED_YES) - { - $oResult->code = RestResult::UNAUTHORIZED; - $oResult->message = "The current user does not have enough permissions for massively deleting data of class $sTargetClass"; - } - else - { - $aObjects = $oObjectSet->ToArray(); - $this->DeleteObjects($oResult, $aObjects, $bSimulate); - } - break; + case 'core/delete': + RestUtils::InitTrackingComment($aParams); + $sClass = RestUtils::GetClass($aParams, 'class'); + $key = RestUtils::GetMandatoryParam($aParams, 'key'); + $bSimulate = RestUtils::GetOptionalParam($aParams, 'simulate', false); - case 'core/get_related': - $oResult = new RestResultWithRelations(); - $sClass = RestUtils::GetClass($aParams, 'class'); - $key = RestUtils::GetMandatoryParam($aParams, 'key'); - $sRelation = RestUtils::GetMandatoryParam($aParams, 'relation'); - $iMaxRecursionDepth = RestUtils::GetOptionalParam($aParams, 'depth', 20 /* = MAX_RECURSION_DEPTH */); - $sDirection = RestUtils::GetOptionalParam($aParams, 'direction', null); - $bEnableRedundancy = RestUtils::GetOptionalParam($aParams, 'redundancy', false); - $bReverse = false; + $oObjectSet = RestUtils::GetObjectSetFromKey($sClass, $key); + $sTargetClass = $oObjectSet->GetFilter()->GetClass(); - if (is_null($sDirection) && ($sRelation == 'depends on')) - { - // Legacy behavior, consider "depends on" as a forward relation - $sRelation = 'impacts'; - $sDirection = 'up'; - $bReverse = true; // emulate the legacy behavior by returning the edges - } - else if(is_null($sDirection)) - { - $sDirection = 'down'; - } - - $oObjectSet = RestUtils::GetObjectSetFromKey($sClass, $key); - if ($sDirection == 'down') - { - $oRelationGraph = $oObjectSet->GetRelatedObjectsDown($sRelation, $iMaxRecursionDepth, $bEnableRedundancy); - } - else if ($sDirection == 'up') - { - $oRelationGraph = $oObjectSet->GetRelatedObjectsUp($sRelation, $iMaxRecursionDepth, $bEnableRedundancy); - } - else - { - $oResult->code = RestResult::INTERNAL_ERROR; - $oResult->message = "Invalid value: '$sDirection' for the parameter 'direction'. Valid values are 'up' and 'down'"; - return $oResult; - - } - - if ($bEnableRedundancy) - { - // Remove the redundancy nodes from the output - $oIterator = new RelationTypeIterator($oRelationGraph, 'Node'); - foreach($oIterator as $oNode) - { - if ($oNode instanceof RelationRedundancyNode) - { - $oRelationGraph->FilterNode($oNode); + if (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_DELETE) != UR_ALLOWED_YES) { + $oResult->code = RestResult::UNAUTHORIZED; + $oResult->message = "The current user does not have enough permissions for deleting data of class $sTargetClass"; + } elseif (UserRights::IsActionAllowed($sTargetClass, UR_ACTION_DELETE) != UR_ALLOWED_YES) { + $oResult->code = RestResult::UNAUTHORIZED; + $oResult->message = "The current user does not have enough permissions for massively deleting data of class $sTargetClass"; + } else { + $aObjects = $oObjectSet->ToArray(); + $this->DeleteObjects($oResult, $aObjects, $bSimulate); + } + break; + + case 'core/get_related': + $oResult = new RestResultWithRelations(); + $sClass = RestUtils::GetClass($aParams, 'class'); + $key = RestUtils::GetMandatoryParam($aParams, 'key'); + $sRelation = RestUtils::GetMandatoryParam($aParams, 'relation'); + $iMaxRecursionDepth = RestUtils::GetOptionalParam($aParams, 'depth', 20 /* = MAX_RECURSION_DEPTH */); + $sDirection = RestUtils::GetOptionalParam($aParams, 'direction', null); + $bEnableRedundancy = RestUtils::GetOptionalParam($aParams, 'redundancy', false); + $bReverse = false; + + if (is_null($sDirection) && ($sRelation == 'depends on')) { + // Legacy behavior, consider "depends on" as a forward relation + $sRelation = 'impacts'; + $sDirection = 'up'; + $bReverse = true; // emulate the legacy behavior by returning the edges + } elseif (is_null($sDirection)) { + $sDirection = 'down'; + } + + $oObjectSet = RestUtils::GetObjectSetFromKey($sClass, $key); + if ($sDirection == 'down') { + $oRelationGraph = $oObjectSet->GetRelatedObjectsDown($sRelation, $iMaxRecursionDepth, $bEnableRedundancy); + } elseif ($sDirection == 'up') { + $oRelationGraph = $oObjectSet->GetRelatedObjectsUp($sRelation, $iMaxRecursionDepth, $bEnableRedundancy); + } else { + $oResult->code = RestResult::INTERNAL_ERROR; + $oResult->message = "Invalid value: '$sDirection' for the parameter 'direction'. Valid values are 'up' and 'down'"; + return $oResult; + + } + + if ($bEnableRedundancy) { + // Remove the redundancy nodes from the output + $oIterator = new RelationTypeIterator($oRelationGraph, 'Node'); + foreach ($oIterator as $oNode) { + if ($oNode instanceof RelationRedundancyNode) { + $oRelationGraph->FilterNode($oNode); + } } } - } - - $aIndexByClass = array(); - $oIterator = new RelationTypeIterator($oRelationGraph); - foreach($oIterator as $oElement) - { - if ($oElement instanceof RelationObjectNode) - { - $oObject = $oElement->GetProperty('object'); - if ($oObject) - { - if ($bEnableRedundancy && $sDirection == 'down') - { - // Add only the "reached" objects - if ($oElement->GetProperty('is_reached')) - { + + $aIndexByClass = []; + $oIterator = new RelationTypeIterator($oRelationGraph); + foreach ($oIterator as $oElement) { + if ($oElement instanceof RelationObjectNode) { + $oObject = $oElement->GetProperty('object'); + if ($oObject) { + if ($bEnableRedundancy && $sDirection == 'down') { + // Add only the "reached" objects + if ($oElement->GetProperty('is_reached')) { + $aIndexByClass[get_class($oObject)][$oObject->GetKey()] = null; + $oResult->AddObject(0, '', $oObject); + } + } else { $aIndexByClass[get_class($oObject)][$oObject->GetKey()] = null; $oResult->AddObject(0, '', $oObject); } } - else - { - $aIndexByClass[get_class($oObject)][$oObject->GetKey()] = null; - $oResult->AddObject(0, '', $oObject); - } - } - } - else if ($oElement instanceof RelationEdge) - { - $oSrcObj = $oElement->GetSourceNode()->GetProperty('object'); - $oDestObj = $oElement->GetSinkNode()->GetProperty('object'); - $sSrcKey = get_class($oSrcObj).'::'.$oSrcObj->GetKey(); - $sDestKey = get_class($oDestObj).'::'.$oDestObj->GetKey(); - if ($bEnableRedundancy) - { - // Add only the edges where both source and destination are "reached" - if ($oElement->GetSourceNode()->GetProperty('is_reached') && $oElement->GetSinkNode()->GetProperty('is_reached')) - { - if ($bReverse) - { - $oResult->AddRelation($sDestKey, $sSrcKey); + } elseif ($oElement instanceof RelationEdge) { + $oSrcObj = $oElement->GetSourceNode()->GetProperty('object'); + $oDestObj = $oElement->GetSinkNode()->GetProperty('object'); + $sSrcKey = get_class($oSrcObj).'::'.$oSrcObj->GetKey(); + $sDestKey = get_class($oDestObj).'::'.$oDestObj->GetKey(); + if ($bEnableRedundancy) { + // Add only the edges where both source and destination are "reached" + if ($oElement->GetSourceNode()->GetProperty('is_reached') && $oElement->GetSinkNode()->GetProperty('is_reached')) { + if ($bReverse) { + $oResult->AddRelation($sDestKey, $sSrcKey); + } else { + $oResult->AddRelation($sSrcKey, $sDestKey); + } } - else - { + } else { + if ($bReverse) { + $oResult->AddRelation($sDestKey, $sSrcKey); + } else { $oResult->AddRelation($sSrcKey, $sDestKey); } } } - else - { - if ($bReverse) - { - $oResult->AddRelation($sDestKey, $sSrcKey); - } - else - { - $oResult->AddRelation($sSrcKey, $sDestKey); - } - } } - } - if (count($aIndexByClass) > 0) - { - $aStats = array(); - $aUnauthorizedClasses = array(); - foreach ($aIndexByClass as $sClass => $aIds) - { - if (UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_READ) != UR_ALLOWED_YES) - { - $aUnauthorizedClasses[$sClass] = true; + if (count($aIndexByClass) > 0) { + $aStats = []; + $aUnauthorizedClasses = []; + foreach ($aIndexByClass as $sClass => $aIds) { + if (UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_READ) != UR_ALLOWED_YES) { + $aUnauthorizedClasses[$sClass] = true; + } + $aStats[] = $sClass.'= '.count($aIds); } - $aStats[] = $sClass.'= '.count($aIds); + if (count($aUnauthorizedClasses) > 0) { + $sClasses = implode(', ', array_keys($aUnauthorizedClasses)); + $oResult = new RestResult(); + $oResult->code = RestResult::UNAUTHORIZED; + $oResult->message = "The current user does not have enough permissions for exporting data of class(es): $sClasses"; + } else { + $oResult->message = "Scope: ".$oObjectSet->Count()."; Related objects: ".implode(', ', $aStats); + } + } else { + $oResult->message = "Nothing found"; } - if (count($aUnauthorizedClasses) > 0) - { - $sClasses = implode(', ', array_keys($aUnauthorizedClasses)); - $oResult = new RestResult(); - $oResult->code = RestResult::UNAUTHORIZED; - $oResult->message = "The current user does not have enough permissions for exporting data of class(es): $sClasses"; - } - else - { - $oResult->message = "Scope: ".$oObjectSet->Count()."; Related objects: ".implode(', ', $aStats); - } - } - else - { - $oResult->message = "Nothing found"; - } - break; - - case 'core/check_credentials': - $oResult = new RestResult(); - $sUser = RestUtils::GetMandatoryParam($aParams, 'user'); - $sPassword = RestUtils::GetMandatoryParam($aParams, 'password'); + break; - if (UserRights::CheckCredentials($sUser, $sPassword) !== true) - { - $oResult->authorized = false; - } - else - { - $oResult->authorized = true; - } - break; - - default: - // unknown operation: handled at a higher level + case 'core/check_credentials': + $oResult = new RestResult(); + $sUser = RestUtils::GetMandatoryParam($aParams, 'user'); + $sPassword = RestUtils::GetMandatoryParam($aParams, 'password'); + + if (UserRights::CheckCredentials($sUser, $sPassword) !== true) { + $oResult->authorized = false; + } else { + $oResult->authorized = true; + } + break; + + default: + // unknown operation: handled at a higher level } return $oResult; } public function SanitizeJsonInput(string $sJsonInput): string { - $sSanitizedJsonInput = $sJsonInput; - $aJsonData = json_decode($sSanitizedJsonInput, true); - $sOperation = $aJsonData['operation']; + $sSanitizedJsonInput = $sJsonInput; + $aJsonData = json_decode($sSanitizedJsonInput, true); + $sOperation = $aJsonData['operation']; - switch ($sOperation) { - case 'core/check_credentials': - if (isset($aJsonData['password'])) { - $aJsonData['password'] = '*****'; - } - break; - case 'core/update': - case 'core/create': - default : - $sClass = $aJsonData['class']; - if (isset($aJsonData['fields'])) { - foreach ($aJsonData['fields'] as $sFieldAttCode => $fieldValue) { - $oAttDef = MetaModel::GetAttributeDef($sClass, $sFieldAttCode); - $this->SanitizeFieldIfSensitive($aJsonData['fields'], $sFieldAttCode, $fieldValue, $oAttDef); - } - } - break; - } + switch ($sOperation) { + case 'core/check_credentials': + if (isset($aJsonData['password'])) { + $aJsonData['password'] = '*****'; + } + break; + case 'core/update': + case 'core/create': + default: + $sClass = $aJsonData['class']; + if (isset($aJsonData['fields'])) { + foreach ($aJsonData['fields'] as $sFieldAttCode => $fieldValue) { + $oAttDef = MetaModel::GetAttributeDef($sClass, $sFieldAttCode); + $this->SanitizeFieldIfSensitive($aJsonData['fields'], $sFieldAttCode, $fieldValue, $oAttDef); + } + } + break; + } return json_encode($aJsonData, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); } /** - * Helper for object deletion + * Helper for object deletion */ public function DeleteObjects($oResult, $aObjects, $bSimulate) { $oDeletionPlan = new DeletionPlan(); - foreach($aObjects as $oObj) - { - if ($bSimulate) - { + foreach ($aObjects as $oObj) { + if ($bSimulate) { $oObj->CheckToDelete($oDeletionPlan); - } - else - { + } else { $oObj->DBDelete($oDeletionPlan); } } - foreach ($oDeletionPlan->ListDeletes() as $sTargetClass => $aDeletes) - { - foreach ($aDeletes as $iId => $aData) - { + foreach ($oDeletionPlan->ListDeletes() as $sTargetClass => $aDeletes) { + foreach ($aDeletes as $iId => $aData) { $oToDelete = $aData['to_delete']; $bAutoDel = (($aData['mode'] == DEL_SILENT) || ($aData['mode'] == DEL_AUTO)); - if (array_key_exists('issue', $aData)) - { - if ($bAutoDel) - { - if (isset($aData['requested_explicitely'])) // i.e. in the initial list of objects to delete - { + if (array_key_exists('issue', $aData)) { + if ($bAutoDel) { + if (isset($aData['requested_explicitely'])) { // i.e. in the initial list of objects to delete $iCode = RestDelete::ISSUE; $sPlanned = 'Cannot be deleted: '.$aData['issue']; - } - else - { + } else { $iCode = RestDelete::AUTO_DELETE_ISSUE; $sPlanned = 'Should be deleted automatically... but: '.$aData['issue']; } - } - else - { + } else { $iCode = RestDelete::REQUEST_EXPLICITELY; $sPlanned = 'Must be deleted explicitely... but: '.$aData['issue']; } - } - else - { - if ($bAutoDel) - { - if (isset($aData['requested_explicitely'])) - { + } else { + if ($bAutoDel) { + if (isset($aData['requested_explicitely'])) { $iCode = RestDelete::OK; - $sPlanned = ''; - } - else - { + $sPlanned = ''; + } else { $iCode = RestDelete::AUTO_DELETE; $sPlanned = 'Deleted automatically'; } - } - else - { + } else { $iCode = RestDelete::REQUEST_EXPLICITELY; $sPlanned = 'Must be deleted explicitely'; } @@ -878,60 +755,43 @@ class CoreServices implements iRestServiceProvider, iRestInputSanitizer $oResult->AddObject($iCode, $sPlanned, $oToDelete); } } - foreach ($oDeletionPlan->ListUpdates() as $sRemoteClass => $aToUpdate) - { - foreach ($aToUpdate as $iId => $aData) - { + foreach ($oDeletionPlan->ListUpdates() as $sRemoteClass => $aToUpdate) { + foreach ($aToUpdate as $iId => $aData) { $oToUpdate = $aData['to_reset']; - if (array_key_exists('issue', $aData)) - { + if (array_key_exists('issue', $aData)) { $iCode = RestDelete::AUTO_UPDATE_ISSUE; $sPlanned = 'Should be updated automatically... but: '.$aData['issue']; - } - else - { + } else { $iCode = RestDelete::AUTO_UPDATE; $sPlanned = 'Reset external keys: '.$aData['attributes_list']; } $oResult->AddObject($iCode, $sPlanned, $oToUpdate); } } - - if ($oDeletionPlan->FoundStopper()) - { - if ($oDeletionPlan->FoundSecurityIssue()) - { + + if ($oDeletionPlan->FoundStopper()) { + if ($oDeletionPlan->FoundSecurityIssue()) { $iRes = RestResult::UNAUTHORIZED; $sRes = 'Deletion not allowed on some objects'; - } - elseif ($oDeletionPlan->FoundManualOperation()) - { - $iRes = RestResult::UNSAFE; + } elseif ($oDeletionPlan->FoundManualOperation()) { + $iRes = RestResult::UNSAFE; $sRes = 'The deletion requires that other objects be deleted/updated, and those operations must be requested explicitely'; - } - else - { - $iRes = RestResult::INTERNAL_ERROR; + } else { + $iRes = RestResult::INTERNAL_ERROR; $sRes = 'Some issues have been encountered. See the list of planned changes for more information about the issue(s).'; - } - } - else - { - $iRes = RestResult::OK; + } + } else { + $iRes = RestResult::OK; $sRes = 'Deleted: '.count($aObjects); $iIndirect = $oDeletionPlan->GetTargetCount() - count($aObjects); - if ($iIndirect > 0) - { + if ($iIndirect > 0) { $sRes .= ' plus (for DB integrity) '.$iIndirect; } } $oResult->code = $iRes; - if ($bSimulate) - { + if ($bSimulate) { $oResult->message = 'SIMULATING: '.$sRes; - } - else - { + } else { $oResult->message = $sRes; } } @@ -950,47 +810,45 @@ class CoreServices implements iRestServiceProvider, iRestInputSanitizer trait SanitizeTrait { - /** - * Sanitize a field if it is sensitive. - * - * @param array $fields The fields array - * @param string $sFieldAttCode The attribute code - * @param mixed $oAttDef The attribute definition - * @throws Exception - */ - private function SanitizeFieldIfSensitive(array &$fields, string $sFieldAttCode, $fieldValue, $oAttDef): void - { - // for simple attribute - if ($oAttDef instanceof iAttributeNoGroupBy) // iAttributeNoGroupBy is equivalent to sensitive attribute - { - $fields[$sFieldAttCode] = '*****'; - return; - } - // for 1-n / n-n relation - if ($oAttDef instanceof AttributeLinkedSet) { - foreach ($fieldValue as $i => $aLnkValues) { - foreach ($aLnkValues as $sLnkAttCode => $sLnkValue) { - $oLnkAttDef = MetaModel::GetAttributeDef($oAttDef->GetLinkedClass(), $sLnkAttCode); - if ($oLnkAttDef instanceof iAttributeNoGroupBy) { // 1-n relation - $fields[$sFieldAttCode][$i][$sLnkAttCode] = '*****'; - } - elseif ($oAttDef instanceof AttributeLinkedSetIndirect && $oLnkAttDef instanceof AttributeExternalField) { // for n-n relation - $oExtKeyAttDef = MetaModel::GetAttributeDef($oLnkAttDef->GetTargetClass(), $oLnkAttDef->GetExtAttCode()); - if ($oExtKeyAttDef instanceof iAttributeNoGroupBy) { - $fields[$sFieldAttCode][$i][$sLnkAttCode] = '*****'; - } - } - } - } - return; - } + /** + * Sanitize a field if it is sensitive. + * + * @param array $fields The fields array + * @param string $sFieldAttCode The attribute code + * @param mixed $oAttDef The attribute definition + * @throws Exception + */ + private function SanitizeFieldIfSensitive(array &$fields, string $sFieldAttCode, $fieldValue, $oAttDef): void + { + // for simple attribute + if ($oAttDef instanceof iAttributeNoGroupBy) { // iAttributeNoGroupBy is equivalent to sensitive attribute + $fields[$sFieldAttCode] = '*****'; + return; + } + // for 1-n / n-n relation + if ($oAttDef instanceof AttributeLinkedSet) { + foreach ($fieldValue as $i => $aLnkValues) { + foreach ($aLnkValues as $sLnkAttCode => $sLnkValue) { + $oLnkAttDef = MetaModel::GetAttributeDef($oAttDef->GetLinkedClass(), $sLnkAttCode); + if ($oLnkAttDef instanceof iAttributeNoGroupBy) { // 1-n relation + $fields[$sFieldAttCode][$i][$sLnkAttCode] = '*****'; + } elseif ($oAttDef instanceof AttributeLinkedSetIndirect && $oLnkAttDef instanceof AttributeExternalField) { // for n-n relation + $oExtKeyAttDef = MetaModel::GetAttributeDef($oLnkAttDef->GetTargetClass(), $oLnkAttDef->GetExtAttCode()); + if ($oExtKeyAttDef instanceof iAttributeNoGroupBy) { + $fields[$sFieldAttCode][$i][$sLnkAttCode] = '*****'; + } + } + } + } + return; + } - // for external attribute - if ($oAttDef instanceof AttributeExternalField) { - $oExtKeyAttDef = MetaModel::GetAttributeDef($oAttDef->GetTargetClass(), $oAttDef->GetExtAttCode()); - if ($oExtKeyAttDef instanceof iAttributeNoGroupBy) { - $fields[$sFieldAttCode] = '*****'; - } - } - } -} \ No newline at end of file + // for external attribute + if ($oAttDef instanceof AttributeExternalField) { + $oExtKeyAttDef = MetaModel::GetAttributeDef($oAttDef->GetTargetClass(), $oAttDef->GetExtAttCode()); + if ($oExtKeyAttDef instanceof iAttributeNoGroupBy) { + $fields[$sFieldAttCode] = '*****'; + } + } + } +} diff --git a/core/simplecrypt.class.inc.php b/core/simplecrypt.class.inc.php index 91c90738d..ea6885d07 100644 --- a/core/simplecrypt.class.inc.php +++ b/core/simplecrypt.class.inc.php @@ -1,4 +1,5 @@ oEngine = new $sEngineName; - } + $sEngineName = 'SimpleCrypt'.$sEngineName.'Engine'; + $this->oEngine = new $sEngineName(); + } - /** - * Encrypts the string with the given key - * @param string $key - * @param string $sString Plaintext string - * @return string Ciphered string - */ - function Encrypt($key, $sString) - { + /** + * Encrypts the string with the given key + * @param string $key + * @param string $sString Plaintext string + * @return string Ciphered string + */ + public function Encrypt($key, $sString) + { - return $this->oEngine->Encrypt($key,$sString); - } + return $this->oEngine->Encrypt($key, $sString); + } + /** + * Decrypts the string by the given key + * @param string $key + * @param string $string Ciphered string + * @return string Plaintext string + */ + public function Decrypt($key, $string) + { + if (is_null($string) || strlen($string) == 0) { + IssueLog::Warning("Cannot decrypt empty/null value"); + return $string; + } + return $this->oEngine->Decrypt($key, $string); + } - /** - * Decrypts the string by the given key - * @param string $key - * @param string $string Ciphered string - * @return string Plaintext string - */ - function Decrypt($key, $string) - { - if (is_null($string) || strlen($string) == 0) { - IssueLog::Warning("Cannot decrypt empty/null value"); - return $string; - } - return $this->oEngine->Decrypt($key,$string); - } - - /** - * Returns a random "salt" value, to be used when "hashing" a password - * using a one-way encryption algorithm, to prevent an attack using a "rainbow table" - * Tryes to use the best available random number generator - * @return string The generated random "salt" - */ - static function GetNewSalt() - { + /** + * Returns a random "salt" value, to be used when "hashing" a password + * using a one-way encryption algorithm, to prevent an attack using a "rainbow table" + * Tryes to use the best available random number generator + * @return string The generated random "salt" + */ + public static function GetNewSalt() + { // Copied from http://www.php.net/manual/en/function.mt-rand.php#83655 // get 128 pseudorandom bits in a string of 16 bytes $sRandomBits = null; // Unix/Linux platform? - $fp = @fopen('/dev/urandom','rb'); - if ($fp !== FALSE) - { + $fp = @fopen('/dev/urandom', 'rb'); + if ($fp !== false) { //echo "Random bits pulled from /dev/urandom
        \n"; - $sRandomBits .= @fread($fp,16); - @fclose($fp); - } - else - { + $sRandomBits .= @fread($fp, 16); + @fclose($fp); + } else { // MS-Windows platform? - if (@class_exists('COM')) - { + if (@class_exists('COM')) { // http://msdn.microsoft.com/en-us/library/aa388176(VS.85).aspx - try - { - $CAPI_Util = new COM('CAPICOM.Utilities.1'); - $sBase64RandomBits = ''.$CAPI_Util->GetRandom(16,0); + try { + $CAPI_Util = new COM('CAPICOM.Utilities.1'); + $sBase64RandomBits = ''.$CAPI_Util->GetRandom(16, 0); - // if we ask for binary data PHP munges it, so we - // request base64 return value. We squeeze out the - // redundancy and useless ==CRLF by hashing... - if ($sBase64RandomBits) - { + // if we ask for binary data PHP munges it, so we + // request base64 return value. We squeeze out the + // redundancy and useless ==CRLF by hashing... + if ($sBase64RandomBits) { //echo "Random bits got from CAPICOM.Utilities.1
        \n"; - $sRandomBits = md5($sBase64RandomBits, TRUE); - } - } - catch (Exception $ex) - { - // echo 'Exception: ' . $ex->getMessage(); + $sRandomBits = md5($sBase64RandomBits, true); + } + } catch (Exception $ex) { + // echo 'Exception: ' . $ex->getMessage(); } } } - if ($sRandomBits == null) - { + if ($sRandomBits == null) { // No "strong" random generator available, use PHP's built-in mechanism //echo "Random bits generated from mt_rand
        \n"; mt_srand(crc32(microtime())); $sRandomBits = ''; - for($i = 0; $i < 4; $i++) - { + for ($i = 0; $i < 4; $i++) { $sRandomBits .= sprintf('%04x', mt_rand(0, 65535)); } - } return $sRandomBits; - } + } } /** @@ -208,8 +189,8 @@ class SimpleCrypt interface CryptEngine { public static function GetNewDefaultParams(); - function Encrypt($key, $sString); - function Decrypt($key, $encrypted_data); + public function Encrypt($key, $sString); + public function Decrypt($key, $encrypted_data); } /** @@ -221,38 +202,36 @@ class SimpleCryptSimpleEngine implements CryptEngine { public static function GetNewDefaultParams() { - return array( 'lib' => 'Simple', 'key' => null); + return [ 'lib' => 'Simple', 'key' => null]; } public function Encrypt($key, $sString) - { - $result = ''; - for($i=1; $i<=strlen($sString); $i++) - { - $char = substr($sString, $i-1, 1); - $keychar = substr($key, ($i % strlen($key))-1, 1); - $char = chr(ord($char)+ord($keychar)); - $result.=$char; - } - return $result; - } + { + $result = ''; + for ($i = 1; $i <= strlen($sString); $i++) { + $char = substr($sString, $i - 1, 1); + $keychar = substr($key, ($i % strlen($key)) - 1, 1); + $char = chr(ord($char) + ord($keychar)); + $result .= $char; + } + return $result; + } - public function Decrypt($key, $encrypted_data) - { - if (is_null($encrypted_data) || strlen($encrypted_data) == 0) { - IssueLog::Warning("Cannot decrypt empty/null value"); - return $encrypted_data; - } - $result = ''; - for($i=1; $i<=strlen($encrypted_data); $i++) - { - $char = substr($encrypted_data, $i-1, 1); - $keychar = substr($key, ($i % strlen($key))-1, 1); - $char = chr(ord($char)-ord($keychar)); - $result.=$char; - } - return $result; - } + public function Decrypt($key, $encrypted_data) + { + if (is_null($encrypted_data) || strlen($encrypted_data) == 0) { + IssueLog::Warning("Cannot decrypt empty/null value"); + return $encrypted_data; + } + $result = ''; + for ($i = 1; $i <= strlen($encrypted_data); $i++) { + $char = substr($encrypted_data, $i - 1, 1); + $keychar = substr($key, ($i % strlen($key)) - 1, 1); + $char = chr(ord($char) - ord($keychar)); + $result .= $char; + } + return $result; + } } /** @@ -262,57 +241,52 @@ class SimpleCryptSimpleEngine implements CryptEngine */ class SimpleCryptMcryptEngine implements CryptEngine { - var $alg = MCRYPT_BLOWFISH; - var $td = null; + public $alg = MCRYPT_BLOWFISH; + public $td = null; public static function GetNewDefaultParams() { - return array('lib' => 'Mcrypt', 'key' => null); + return ['lib' => 'Mcrypt', 'key' => null]; } - public function __construct() { - $this->td = mcrypt_module_open($this->alg,'','cbc',''); + $this->td = mcrypt_module_open($this->alg, '', 'cbc', ''); } - public function Encrypt($key, $sString) - { - $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($this->td), MCRYPT_DEV_URANDOM); // MCRYPT_DEV_URANDOM is now useable since itop requires php >= 5.6 - if (false === $iv) { - throw new Exception('IV generation failed'); - } + public function Encrypt($key, $sString) + { + $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($this->td), MCRYPT_DEV_URANDOM); // MCRYPT_DEV_URANDOM is now useable since itop requires php >= 5.6 + if (false === $iv) { + throw new Exception('IV generation failed'); + } mcrypt_generic_init($this->td, $key, $iv); - if (empty($sString)) - { + if (empty($sString)) { $sString = str_repeat("\0", 8); } $encrypted_data = mcrypt_generic($this->td, $sString); mcrypt_generic_deinit($this->td); - return $iv.$encrypted_data; - } + return $iv.$encrypted_data; + } - public function Decrypt($key, $encrypted_data) - { - $iv = substr($encrypted_data, 0, mcrypt_enc_get_iv_size($this->td)); - $string = substr($encrypted_data, mcrypt_enc_get_iv_size($this->td)); + public function Decrypt($key, $encrypted_data) + { + $iv = substr($encrypted_data, 0, mcrypt_enc_get_iv_size($this->td)); + $string = substr($encrypted_data, mcrypt_enc_get_iv_size($this->td)); $r = mcrypt_generic_init($this->td, $key, $iv); - if (($r < 0) || ($r === false)) - { + if (($r < 0) || ($r === false)) { $decrypted_data = Dict::S("Core:AttributeEncryptFailedToDecrypt"); - } - else - { + } else { $decrypted_data = rtrim(mdecrypt_generic($this->td, $string), "\0"); mcrypt_generic_deinit($this->td); } - return $decrypted_data; - } + return $decrypted_data; + } - public function __destruct() - { - mcrypt_module_close($this->td); - } + public function __destruct() + { + mcrypt_module_close($this->td); + } } /** * SodiumEngine requires Sodium extension @@ -324,7 +298,7 @@ class SimpleCryptSodiumEngine implements CryptEngine { public static function GetNewDefaultParams() { - return array('lib' => 'Sodium', 'key' => bin2hex(sodium_crypto_secretbox_keygen())); + return ['lib' => 'Sodium', 'key' => bin2hex(sodium_crypto_secretbox_keygen())]; } public function Encrypt($key, $sString) @@ -339,17 +313,16 @@ class SimpleCryptSodiumEngine implements CryptEngine public function Decrypt($key, $encrypted_data) { - if (is_null($encrypted_data) || strlen($encrypted_data) == 0) { - IssueLog::Warning("Cannot decrypt empty/null value"); - return $encrypted_data; - } + if (is_null($encrypted_data) || strlen($encrypted_data) == 0) { + IssueLog::Warning("Cannot decrypt empty/null value"); + return $encrypted_data; + } $key = hex2bin($key); $encrypted_data = base64_decode($encrypted_data); $nonce = mb_substr($encrypted_data, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit'); $encrypted_data = mb_substr($encrypted_data, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit'); $plaintext = sodium_crypto_secretbox_open($encrypted_data, $nonce, $key); - if ($plaintext === false) - { + if ($plaintext === false) { $plaintext = Dict::S("Core:AttributeEncryptFailedToDecrypt"); } sodium_memzero($encrypted_data); @@ -362,29 +335,28 @@ class SimpleCryptOpenSSLEngine implements CryptEngine { public static function GetNewDefaultParams() { - return array('lib' => 'OpenSSL', 'key' => bin2hex(openssl_random_pseudo_bytes(32))); + return ['lib' => 'OpenSSL', 'key' => bin2hex(openssl_random_pseudo_bytes(32))]; } public function Encrypt($key, $sString) { $key = hex2bin($key); $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES-256-CBC")); - $encrypted_string = openssl_encrypt($sString, "AES-256-CBC", $key, 0 , $iv); + $encrypted_string = openssl_encrypt($sString, "AES-256-CBC", $key, 0, $iv); return $iv.$encrypted_string; } public function Decrypt($key, $encrypted_data) { - if (is_null($encrypted_data) || strlen($encrypted_data) == 0) { - IssueLog::Warning("Cannot decrypt empty/null value"); - return $encrypted_data; - } + if (is_null($encrypted_data) || strlen($encrypted_data) == 0) { + IssueLog::Warning("Cannot decrypt empty/null value"); + return $encrypted_data; + } $key = hex2bin($key); $iv = mb_substr($encrypted_data, 0, openssl_cipher_iv_length("AES-256-CBC"), '8bit'); $encrypted_data = mb_substr($encrypted_data, openssl_cipher_iv_length("AES-256-CBC"), null, '8bit'); - $plaintext = openssl_decrypt($encrypted_data,"AES-256-CBC", $key, 0 , $iv); - if ($plaintext === false) - { + $plaintext = openssl_decrypt($encrypted_data, "AES-256-CBC", $key, 0, $iv); + if ($plaintext === false) { $plaintext = Dict::S("Core:AttributeEncryptFailedToDecrypt"); } return trim($plaintext); @@ -396,18 +368,16 @@ class SimpleCryptOpenSSLMcryptCompatibilityEngine implements CryptEngine { public static function GetNewDefaultParams() { - return array('lib' => 'OpenSSLMcryptCompatibility', 'key' => null); + return ['lib' => 'OpenSSLMcryptCompatibility', 'key' => null]; } //fix for php < 7.1.8 (keys are Zero padded instead of cycle padded) - static private function MakeOpenSSLBlowfishKey($key) + private static function MakeOpenSSLBlowfishKey($key) { - if("$key" === '') - { + if ("$key" === '') { return $key; } - $len = (16+2)*4; - while(strlen($key) < $len) - { + $len = (16 + 2) * 4; + while (strlen($key) < $len) { $key .= $key; } $key = substr($key, 0, $len); @@ -418,9 +388,9 @@ class SimpleCryptOpenSSLMcryptCompatibilityEngine implements CryptEngine $key = SimpleCryptOpenSSLMcryptCompatibilityEngine::MakeOpenSSLBlowfishKey($key); $blockSize = 8; $len = strlen($sString); - $paddingLen = intval (($len + $blockSize -1) / $blockSize) * $blockSize - $len; + $paddingLen = intval(($len + $blockSize - 1) / $blockSize) * $blockSize - $len; $padding = str_repeat("\0", $paddingLen); - $sData = $sString . $padding; + $sData = $sString.$padding; $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("BF-CBC")); $encrypted_string = openssl_encrypt($sData, "BF-CBC", $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv); return $iv.$encrypted_string; @@ -428,16 +398,15 @@ class SimpleCryptOpenSSLMcryptCompatibilityEngine implements CryptEngine public function Decrypt($key, $encrypted_data) { - if (is_null($encrypted_data) || strlen($encrypted_data) == 0) { - IssueLog::Warning("Cannot decrypt empty/null value"); - return $encrypted_data; - } + if (is_null($encrypted_data) || strlen($encrypted_data) == 0) { + IssueLog::Warning("Cannot decrypt empty/null value"); + return $encrypted_data; + } $key = SimpleCryptOpenSSLMcryptCompatibilityEngine::MakeOpenSSLBlowfishKey($key); $iv = mb_substr($encrypted_data, 0, openssl_cipher_iv_length("BF-CBC"), '8bit'); $encrypted_data = mb_substr($encrypted_data, openssl_cipher_iv_length("BF-CBC"), null, '8bit'); - $plaintext = openssl_decrypt($encrypted_data,"BF-CBC", $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv); - if ($plaintext === false) - { + $plaintext = openssl_decrypt($encrypted_data, "BF-CBC", $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv); + if ($plaintext === false) { $plaintext = Dict::S("Core:AttributeEncryptFailedToDecrypt"); } return trim($plaintext); diff --git a/core/simplegraph.class.inc.php b/core/simplegraph.class.inc.php index 157e9eae1..1bcfa78af 100644 --- a/core/simplegraph.class.inc.php +++ b/core/simplegraph.class.inc.php @@ -1,4 +1,5 @@ sId = $sId; - $this->aProperties = array(); + $this->aProperties = []; } - + /** * Get the identifier of the object in the graph * @return string @@ -51,7 +51,7 @@ class GraphElement { return $this->sId; } - + /** * Get the value of the given named property for the object * @param string $sPropName The name of the property to get @@ -73,7 +73,7 @@ class GraphElement { $this->aProperties[$sPropName] = $value; } - + /** * Get all the known properties of the object * @return Ambigous @@ -91,7 +91,7 @@ class GraphNode extends GraphElement { protected $aIncomingEdges; protected $aOutgoingEdges; - + /** * Create a new node inside a graph * @param SimpleGraph $oGraph @@ -100,16 +100,15 @@ class GraphNode extends GraphElement public function __construct(SimpleGraph $oGraph, $sId) { parent::__construct($sId); - $this->aIncomingEdges = array(); - $this->aOutgoingEdges = array(); + $this->aIncomingEdges = []; + $this->aOutgoingEdges = []; $oGraph->_AddNode($this); } - + public function GetDotAttributes($bNoLabel = false) { $sDot = ''; - if (!$bNoLabel) - { + if (!$bNoLabel) { $sLabel = addslashes($this->GetProperty('label', $this->GetId())); $sDot = 'label="'.$sLabel.'"'; } @@ -133,7 +132,7 @@ class GraphNode extends GraphElement { $this->aOutgoingEdges[$oEdge->GetId()] = $oEdge; } - + /** * INTERNAL USE ONLY * @param GraphEdge $oEdge @@ -151,7 +150,7 @@ class GraphNode extends GraphElement { unset($this->aOutgoingEdges[$oEdge->GetId()]); } - + /** * Get the list of all incoming edges on the current node * @return Ambigous @@ -160,7 +159,7 @@ class GraphNode extends GraphElement { return $this->aIncomingEdges; } - + /** * Get the list of all outgoing edges from the current node * @return Ambigous @@ -169,7 +168,7 @@ class GraphNode extends GraphElement { return $this->aOutgoingEdges; } - + /** * Flood fill the chart with the given value for the specified property * @param string $sPropName The name of the property to set @@ -179,29 +178,24 @@ class GraphNode extends GraphElement */ public function FloodProperty($sPropName, $value, $bFloodDown, $bFloodUp) { - if ($this->GetProperty($sPropName, null) == null) - { + if ($this->GetProperty($sPropName, null) == null) { // Property not already set, let's do it $this->SetProperty($sPropName, $value); - if ($bFloodDown) - { - foreach($this->GetOutgoingEdges() as $oEdge) - { + if ($bFloodDown) { + foreach ($this->GetOutgoingEdges() as $oEdge) { $oEdge->SetProperty($sPropName, $value); $oEdge->GetSinkNode()->FloodProperty($sPropName, $value, $bFloodDown, $bFloodUp); } } - if ($bFloodUp) - { - foreach($this->GetIncomingEdges() as $oEdge) - { + if ($bFloodUp) { + foreach ($this->GetIncomingEdges() as $oEdge) { $oEdge->SetProperty($sPropName, $value); $oEdge->GetSourceNode()->FloodProperty($sPropName, $value, $bFloodDown, $bFloodUp); } } } } - + } /** @@ -237,7 +231,7 @@ class GraphEdge extends GraphElement { return $this->oSourceNode; } - + /** * Get the "sink" node for this edge * @return GraphNode @@ -250,8 +244,7 @@ class GraphEdge extends GraphElement public function GetDotAttributes($bNoLabel = false) { $sDot = ''; - if (!$bNoLabel) - { + if (!$bNoLabel) { $sLabel = addslashes($this->GetProperty('label', '')); $sDot = 'label="'.$sLabel.'"'; } @@ -266,16 +259,16 @@ class SimpleGraph { protected $aNodes; protected $aEdges; - + /** * Creates a new empty graph */ public function __construct() { - $this->aNodes = array(); - $this->aEdges = array(); + $this->aNodes = []; + $this->aEdges = []; } - + /** * INTERNAL USE ONLY * @return Ambigous @@ -284,7 +277,7 @@ class SimpleGraph { return $this->aNodes; } - + /** * INTERNAL USE ONLY * @return Ambigous @@ -293,32 +286,34 @@ class SimpleGraph { return $this->aEdges; } - + /** * INTERNAL USE ONLY * @return Ambigous */ public function _AddNode(GraphNode $oNode) { - if (array_key_exists($oNode->GetId(), $this->aNodes)) throw new SimpleGraphException('Cannot add node (id='.$oNode->GetId().') to the graph. A node with the same id already exists in the graph.'); - + if (array_key_exists($oNode->GetId(), $this->aNodes)) { + throw new SimpleGraphException('Cannot add node (id='.$oNode->GetId().') to the graph. A node with the same id already exists in the graph.'); + } + $this->aNodes[$oNode->GetId()] = $oNode; } - + /** * INTERNAL USE ONLY * @return Ambigous */ public function _RemoveNode(GraphNode $oNode) { - if (!array_key_exists($oNode->GetId(), $this->aNodes)) throw new SimpleGraphException('Cannot remove the node (id='.$oNode->GetId().') from the graph. The node was not found in the graph.'); - - foreach($oNode->GetOutgoingEdges() as $oEdge) - { + if (!array_key_exists($oNode->GetId(), $this->aNodes)) { + throw new SimpleGraphException('Cannot remove the node (id='.$oNode->GetId().') from the graph. The node was not found in the graph.'); + } + + foreach ($oNode->GetOutgoingEdges() as $oEdge) { $this->_RemoveEdge($oEdge); } - foreach($oNode->GetIncomingEdges() as $oEdge) - { + foreach ($oNode->GetIncomingEdges() as $oEdge) { $this->_RemoveEdge($oEdge); } unset($this->aNodes[$oNode->GetId()]); @@ -333,42 +328,37 @@ class SimpleGraph */ public function FilterNode(GraphNode $oNode, $bAllowLoopingEdge = false) { - if (!array_key_exists($oNode->GetId(), $this->aNodes)) throw new SimpleGraphException('Cannot filter the node (id='.$oNode->GetId().') from the graph. The node was not found in the graph.'); - - $aSourceNodes = array(); - $aSinkNodes = array(); - foreach($oNode->GetOutgoingEdges() as $oEdge) - { + if (!array_key_exists($oNode->GetId(), $this->aNodes)) { + throw new SimpleGraphException('Cannot filter the node (id='.$oNode->GetId().') from the graph. The node was not found in the graph.'); + } + + $aSourceNodes = []; + $aSinkNodes = []; + foreach ($oNode->GetOutgoingEdges() as $oEdge) { $sSinkId = $oEdge->GetSinkNode()->GetId(); - if ($sSinkId != $oNode->GetId()) - { + if ($sSinkId != $oNode->GetId()) { $aSinkNodes[$sSinkId] = $oEdge->GetSinkNode(); } $this->_RemoveEdge($oEdge); } - foreach($oNode->GetIncomingEdges() as $oEdge) - { + foreach ($oNode->GetIncomingEdges() as $oEdge) { $sSourceId = $oEdge->GetSourceNode()->GetId(); - if ($sSourceId != $oNode->GetId()) - { + if ($sSourceId != $oNode->GetId()) { $aSourceNodes[$sSourceId] = $oEdge->GetSourceNode(); } $this->_RemoveEdge($oEdge); } unset($this->aNodes[$oNode->GetId()]); - foreach($aSourceNodes as $sSourceId => $oSourceNode) - { - foreach($aSinkNodes as $sSinkId => $oSinkNode) - { - if ($bAllowLoopingEdge || ($oSourceNode->GetId() != $oSinkNode->GetId())) - { + foreach ($aSourceNodes as $sSourceId => $oSourceNode) { + foreach ($aSinkNodes as $sSinkId => $oSinkNode) { + if ($bAllowLoopingEdge || ($oSourceNode->GetId() != $oSinkNode->GetId())) { $oEdge = new RelationEdge($this, $oSourceNode, $oSinkNode); } } } } - + /** * Get the node identified by $sId or null if not found * @param string $sId @@ -376,7 +366,7 @@ class SimpleGraph */ public function GetNode($sId) { - return array_key_exists($sId, $this->aNodes) ? $this->aNodes[$sId] : null; + return array_key_exists($sId, $this->aNodes) ? $this->aNodes[$sId] : null; } /** @@ -386,7 +376,7 @@ class SimpleGraph */ public function HasNode($sId) { - return array_key_exists($sId, $this->aNodes); + return array_key_exists($sId, $this->aNodes); } /** @@ -397,23 +387,19 @@ class SimpleGraph */ public function _AddEdge(GraphEdge $oEdge, $bMustBeUnique = false) { - if (array_key_exists($oEdge->GetId(), $this->aEdges)) - { - if ($bMustBeUnique) - { - throw new SimpleGraphException('Cannot add edge (id=' . $oEdge->GetId() . ') to the graph. An edge with the same id already exists in the graph.'); - } - else - { + if (array_key_exists($oEdge->GetId(), $this->aEdges)) { + if ($bMustBeUnique) { + throw new SimpleGraphException('Cannot add edge (id='.$oEdge->GetId().') to the graph. An edge with the same id already exists in the graph.'); + } else { return; } } - + $this->aEdges[$oEdge->GetId()] = $oEdge; $oEdge->GetSourceNode()->_AddOutgoingEdge($oEdge); $oEdge->GetSinkNode()->_AddIncomingEdge($oEdge); } - + /** * INTERNAL USE ONLY * @param GraphEdge $oEdge @@ -421,14 +407,16 @@ class SimpleGraph */ public function _RemoveEdge(GraphEdge $oEdge) { - if (!array_key_exists($oEdge->GetId(), $this->aEdges)) throw new SimpleGraphException('Cannot remove edge (id='.$oEdge->GetId().') from the graph. The edge was not found.'); - + if (!array_key_exists($oEdge->GetId(), $this->aEdges)) { + throw new SimpleGraphException('Cannot remove edge (id='.$oEdge->GetId().') from the graph. The edge was not found.'); + } + $oEdge->GetSourceNode()->_RemoveOutgoingEdge($oEdge); $oEdge->GetSinkNode()->_RemoveIncomingEdge($oEdge); - + unset($this->aEdges[$oEdge->GetId()]); } - + /** * Get the edge indentified by $sId or null if not found * @param string $sId @@ -438,7 +426,7 @@ class SimpleGraph { return array_key_exists($sId, $this->aEdges) ? $this->aEdges[$sId] : null; } - + /** * Determine if the id already exists in amongst the existing edges * @param string $sId @@ -446,7 +434,7 @@ class SimpleGraph */ public function HasEdge($sId) { - return array_key_exists($sId, $this->aEdges); + return array_key_exists($sId, $this->aEdges); } /** @@ -470,23 +458,20 @@ EOF ; $oIterator = new RelationTypeIterator($this, 'Node'); - - foreach($oIterator as $key => $oNode) - { + + foreach ($oIterator as $key => $oNode) { $sDot .= "\t\"".$oNode->GetId()."\" [ ".$oNode->GetDotAttributes($bNoLabel)." ];\n"; - if (count($oNode->GetOutgoingEdges()) > 0) - { - foreach($oNode->GetOutgoingEdges() as $oEdge) - { + if (count($oNode->GetOutgoingEdges()) > 0) { + foreach ($oNode->GetOutgoingEdges() as $oEdge) { $sDot .= "\t\"".$oNode->GetId()."\" -> \"".$oEdge->GetSinkNode()->GetId()."\" [ ".$oEdge->GetDotAttributes($bNoLabel)." ];\n"; } } } - + $sDot .= "}\n"; - return $sDot; + return $sDot; } - + /** * Get the description of the graph as an embedded PNG image (using a data: url) as * generated by graphviz (requires graphviz to be installed on the machine and the path to @@ -497,51 +482,43 @@ EOF public function DumpAsHtmlImage() { $sDotExecutable = MetaModel::GetConfig()->Get('graphviz_path'); - if (file_exists($sDotExecutable)) - { + if (file_exists($sDotExecutable)) { // create the file with Graphviz - if (!is_dir(APPROOT."data")) - { + if (!is_dir(APPROOT."data")) { @mkdir(APPROOT."data"); } - if (!is_dir(APPROOT."data/tmp")) - { + if (!is_dir(APPROOT."data/tmp")) { @mkdir(APPROOT."data/tmp"); } $sImageFilePath = tempnam(APPROOT."data/tmp", 'png-'); $sDotDescription = $this->GetDotDescription(); $sDotFilePath = tempnam(APPROOT."data/tmp", 'dot-'); - + $rFile = @fopen($sDotFilePath, "w"); @fwrite($rFile, $sDotDescription); @fclose($rFile); - $aOutput = array(); + $aOutput = []; $CommandLine = "\"$sDotExecutable\" -v -Tpng < \"$sDotFilePath\" -o\"$sImageFilePath\" 2>&1"; - + exec($CommandLine, $aOutput, $iRetCode); - if ($iRetCode != 0) - { + if ($iRetCode != 0) { $sHtml = ''; $sHtml .= "

        Error:

        "; $sHtml .= "

        The command:

        $CommandLine
        returned $iRetCode

        "; $sHtml .= "

        The output of the command is:

        \n".implode("\n", $aOutput)."

        "; $sHtml .= "
        "; $sHtml .= "

        Content of the '".basename($sDotFilePath)."' file:

        \n$sDotDescription
        "; - } - else - { + } else { $sHtml = ''; @unlink($sImageFilePath); } @unlink($sDotFilePath); - } - else - { - throw new Exception('graphviz not found'); + } else { + throw new Exception('graphviz not found'); } return $sHtml; } - + /** * Get the description of the graph as text string in the XDot format * including the positions of the nodes and egdes (requires graphviz @@ -553,51 +530,42 @@ EOF public function DumpAsXDot() { $sDotExecutable = MetaModel::GetConfig()->Get('graphviz_path'); - if (file_exists($sDotExecutable)) - { + if (file_exists($sDotExecutable)) { // create the file with Graphviz - if (!is_dir(APPROOT."data")) - { + if (!is_dir(APPROOT."data")) { @mkdir(APPROOT."data"); } - if (!is_dir(APPROOT."data/tmp")) - { + if (!is_dir(APPROOT."data/tmp")) { @mkdir(APPROOT."data/tmp"); } $sXdotFilePath = tempnam(APPROOT."data/tmp", 'xdot-'); $sDotDescription = $this->GetDotDescription(true); // true => don't put (localized) labels in the file, since it makes it harder to parse $sDotFilePath = tempnam(APPROOT."data/tmp", 'dot-'); - + $rFile = @fopen($sDotFilePath, "w"); @fwrite($rFile, $sDotDescription); @fclose($rFile); - $aOutput = array(); + $aOutput = []; $CommandLine = "\"$sDotExecutable\" -v -Tdot < \"$sDotFilePath\" -o\"$sXdotFilePath\" 2>&1"; - + exec($CommandLine, $aOutput, $iRetCode); - if ($iRetCode != 0) - { + if ($iRetCode != 0) { $sHtml = ''; $sHtml .= "

        Error:

        "; $sHtml .= "

        The command:

        $CommandLine
        returned $iRetCode

        "; $sHtml .= "

        The output of the command is:

        \n".implode("\n", $aOutput)."

        "; IssueLog::Error($sHtml); - } - else - { + } else { $sHtml = '
        '.file_get_contents($sXdotFilePath).'
        '; @unlink($sXdotFilePath); } @unlink($sDotFilePath); - } - else - { - throw new Exception('graphviz not found'); + } else { + throw new Exception('graphviz not found'); } return $sHtml; } - - + /** * Get the description of the graph as some HTML text * @return string @@ -606,42 +574,36 @@ EOF { $sHtml = ''; $oIterator = new RelationTypeIterator($this); - - foreach($oIterator as $key => $oElement) - { + + foreach ($oIterator as $key => $oElement) { $sHtml .= "

        $key: ".get_class($oElement)."::".$oElement->GetId()."

        "; - - switch(get_class($oElement)) - { + + switch (get_class($oElement)) { case 'GraphNode': - if (count($oElement->GetIncomingEdges()) > 0) - { + if (count($oElement->GetIncomingEdges()) > 0) { $sHtml .= "
          Incoming edges:\n"; - foreach($oElement->GetIncomingEdges() as $oEdge) - { + foreach ($oElement->GetIncomingEdges() as $oEdge) { $sHtml .= "
        • From: ".$oEdge->GetSourceNode()->GetId()."
        • \n"; } $sHtml .= "
        \n"; } - if (count($oElement->GetOutgoingEdges()) > 0) - { + if (count($oElement->GetOutgoingEdges()) > 0) { $sHtml .= "
          Outgoing edges:\n"; - foreach($oElement->GetOutgoingEdges() as $oEdge) - { + foreach ($oElement->GetOutgoingEdges() as $oEdge) { $sHtml .= "
        • To: ".$oEdge->GetSinkNode()->GetId()."
        • \n"; } $sHtml .= "
        \n"; } break; - + case 'GraphEdge': $sHtml .= "

        From: ".$oElement->GetSourceNode()->GetId().", to:".$oElement->GetSinkNode()->GetId()."

        \n"; break; } } - return $sHtml; + return $sHtml; } - + /** * Split the graph in a array of non connected subgraphs * @return multitype:SimpleGraph unknown @@ -649,48 +611,40 @@ EOF public function GetSubgraphs() { $iNbColors = 0; - $aResult = array(); + $aResult = []; $oIterator = new RelationTypeIterator($this, 'Node'); - foreach($oIterator as $oNode) - { + foreach ($oIterator as $oNode) { $iPrevColor = $oNode->GetProperty('color', null); - - if ($iPrevColor == null) - { + + if ($iPrevColor == null) { $iNbColors++; // Start a new color $oNode->FloodProperty('color', $iNbColors, true, true); } } - if ($iNbColors == 1) - { + if ($iNbColors == 1) { // Everything is connected together, only one subgraph $aResult[] = $this; - } - else - { + } else { // Let's reconstruct each separate graph $sClass = get_class($this); - for($i = 1; $i <= $iNbColors; $i++) - { + for ($i = 1; $i <= $iNbColors; $i++) { $aResult[$i] = new $sClass(); } - - foreach($oIterator as $oNode) - { + + foreach ($oIterator as $oNode) { $iNodeColor = $oNode->GetProperty('color'); $aResult[$iNodeColor]->_AddNode($oNode); } - + $oIter2 = new RelationTypeIterator($this, 'Edge'); - foreach($oIter2 as $oEdge) - { + foreach ($oIter2 as $oEdge) { $iEdgeColor = $oEdge->GetProperty('color'); $aResult[$iEdgeColor]->_AddEdge($oEdge); } } - return $aResult; + return $aResult; } - + /** * Merge back two subgraphs into one * @param SimpleGraph $oGraph @@ -698,13 +652,11 @@ EOF public function Merge(SimpleGraph $oGraph) { $oIter1 = new RelationTypeIterator($oGraph, 'Node'); - foreach($oIter1 as $oNode) - { + foreach ($oIter1 as $oNode) { $this->_AddNode($oNode); } $oIter2 = new RelationTypeIterator($oGraph, 'Edge'); - foreach($oIter2 as $oEdge) - { + foreach ($oIter2 as $oEdge) { $this->_AddEdge($oEdge); } } @@ -718,7 +670,7 @@ class RelationTypeIterator implements Iterator { protected $iCurrentIdx; protected $aList; - + /** * Constructor * @param SimpleGraph $oGraph The graph to browse @@ -727,46 +679,53 @@ class RelationTypeIterator implements Iterator public function __construct(SimpleGraph $oGraph, $sType = null) { $this->iCurrentIdx = -1; - $this->aList = array(); - - switch($sType) - { + $this->aList = []; + + switch ($sType) { case 'Node': - foreach($oGraph->_GetNodes() as $oNode) $this->aList[] = $oNode; - break; - + foreach ($oGraph->_GetNodes() as $oNode) { + $this->aList[] = $oNode; + } + break; + case 'Edge': - foreach($oGraph->_GetEdges() as $oEdge) $this->aList[] = $oEdge; - break; - + foreach ($oGraph->_GetEdges() as $oEdge) { + $this->aList[] = $oEdge; + } + break; + default: - foreach($oGraph->_GetNodes() as $oNode) $this->aList[] = $oNode; - foreach($oGraph->_GetEdges() as $oEdge) $this->aList[] = $oEdge; + foreach ($oGraph->_GetNodes() as $oNode) { + $this->aList[] = $oNode; + } + foreach ($oGraph->_GetEdges() as $oEdge) { + $this->aList[] = $oEdge; + } } } - + public function rewind(): void { $this->iCurrentIdx = 0; } - + public function valid(): bool { return array_key_exists($this->iCurrentIdx, $this->aList); } - + public function next(): void { $this->iCurrentIdx++; } - + // Return type mixed is not supported by PHP 7.4, we can remove the following PHP attribute and add the return type once iTop min PHP version is PHP 8.0+ #[\ReturnTypeWillChange] public function current() { return $this->aList[$this->iCurrentIdx]; } - + // Return type mixed is not supported by PHP 7.4, we can remove the following PHP attribute and add the return type once iTop min PHP version is PHP 8.0+ #[\ReturnTypeWillChange] public function key() diff --git a/core/spreadsheetbulkexport.class.inc.php b/core/spreadsheetbulkexport.class.inc.php index 46f9ea95f..2006729ba 100644 --- a/core/spreadsheetbulkexport.class.inc.php +++ b/core/spreadsheetbulkexport.class.inc.php @@ -1,4 +1,5 @@ array('no-localize'), 'interactive_fields_spreadsheet' => array('interactive_fields_spreadsheet'))); + return array_merge(parent::EnumFormParts(), ['spreadsheet_options' => ['no-localize'], 'interactive_fields_spreadsheet' => ['interactive_fields_spreadsheet']]); } /** @@ -106,7 +107,7 @@ EOF break; default: - return parent:: GetFormPart($oP, $sPartId); + return parent::GetFormPart($oP, $sPartId); } } @@ -116,18 +117,17 @@ EOF $this->aStatusInfo['formatted_text'] = (bool)utils::ReadParam('formatted_text', 1, true); $sDateFormatRadio = utils::ReadParam('spreadsheet_date_format_radio', ''); - switch($sDateFormatRadio) - { + switch ($sDateFormatRadio) { case 'default': // Export from the UI => format = same as is the UI $this->aStatusInfo['date_format'] = (string)AttributeDateTime::GetFormat(); break; - + case 'custom': // Custom format specified from the UI $this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetFormat(), true, 'raw_data'); break; - + default: // Export from the command line (or scripted) => default format is SQL, as in previous versions of iTop, unless specified otherwise $this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetSQLFormat(), true, 'raw_data'); @@ -136,11 +136,9 @@ EOF protected function GetSampleData($oObj, $sAttCode) { - if ($sAttCode != 'id') - { + if ($sAttCode != 'id') { $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); - if ($oAttDef instanceof AttributeDateTime) // AttributeDate is derived from AttributeDateTime - { + if ($oAttDef instanceof AttributeDateTime) { // AttributeDate is derived from AttributeDateTime $sClass = (get_class($oAttDef) == 'AttributeDateTime') ? 'user-formatted-date-time' : 'user-formatted-date'; return '
        '.utils::EscapeHtml($oAttDef->GetEditValue($oObj->Get($sAttCode), $oObj)).'
        '; @@ -152,12 +150,11 @@ EOF protected function GetValue($oObj, $sAttCode) { $bFormattedText = (array_key_exists('formatted_text', $this->aStatusInfo) ? $this->aStatusInfo['formatted_text'] : false); - switch($sAttCode) - { + switch ($sAttCode) { case 'id': $sRet = $oObj->GetKey(); break; - + default: $value = $oObj->Get($sAttCode); $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); @@ -167,28 +164,19 @@ EOF $sRet = $value->GetTimeSpent(); } elseif ($value instanceof ormDocument) { $sRet = ''; - } elseif ($oAttDef instanceof AttributeText) - { - if ($bFormattedText) - { + } elseif ($oAttDef instanceof AttributeText) { + if ($bFormattedText) { // Replace paragraphs (...

        , etc) by line breaks (
        ) since Excel (pre-2016) splits the cells when there is a paragraph $sRet = static::HtmlToSpreadsheet($oObj->GetAsHTML($sAttCode)); - } - else - { + } else { $sRet = utils::HtmlToText($oObj->GetAsHTML($sAttCode)); } - } - elseif ($oAttDef instanceof AttributeString) - { + } elseif ($oAttDef instanceof AttributeString) { $sRet = $oObj->GetAsHTML($sAttCode); - } - elseif ($oAttDef instanceof AttributeCustomFields) - { + } elseif ($oAttDef instanceof AttributeCustomFields) { // Stick to the weird implementation made in GetNextChunk $sRet = utils::TextToHtml($oObj->GetEditValue($sAttCode)); - } - else { + } else { if ($this->bLocalizeOutput) { $sRet = utils::EscapeHtml($oObj->GetEditValue()); } else { @@ -216,34 +204,26 @@ EOF $this->aStatusInfo['position'] = 0; $this->aStatusInfo['total'] = $oSet->Count(); - $aData = array(); - foreach($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) - { + $aData = []; + foreach ($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) { $sColLabel = $aFieldSpec['sColLabel']; - if ($aFieldSpec['sAttCode'] != 'id') - { + if ($aFieldSpec['sAttCode'] != 'id') { $oAttDef = MetaModel::GetAttributeDef($aFieldSpec['sClass'], $aFieldSpec['sAttCode']); $oFinalAttDef = $oAttDef->GetFinalAttDef(); - if (get_class($oFinalAttDef) == 'AttributeDateTime') - { + if (get_class($oFinalAttDef) == 'AttributeDateTime') { $aData[] = $sColLabel.' ('.Dict::S('UI:SplitDateTime-Date').')'; $aData[] = $sColLabel.' ('.Dict::S('UI:SplitDateTime-Time').')'; - } - else - { + } else { $aData[] = $sColLabel; } - } - else - { + } else { $aData[] = $sColLabel; } } $sData = ''; $sData .= "
        $sProperty$sCell
        \n"; $sData .= "\n"; - foreach($aData as $sLabel) - { + foreach ($aData as $sLabel) { $sData .= "\n"; } $sData .= "\n"; @@ -270,47 +250,41 @@ EOF $sData = ''; $iPreviousTimeLimit = ini_get('max_execution_time'); $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop'); - while($aRow = $oSet->FetchAssoc()) - { + while ($aRow = $oSet->FetchAssoc()) { set_time_limit(intval($iLoopTimeLimit)); $sData .= ""; - foreach($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) - { + foreach ($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) { $sAlias = $aFieldSpec['sAlias']; $sAttCode = $aFieldSpec['sAttCode']; $sField = ''; /** @var \DBObject $oObj */ $oObj = $aRow[$sAlias]; - if ($oObj == null) - { + if ($oObj == null) { $sData .= ""; continue; } - switch($sAttCode) - { + switch ($sAttCode) { case 'id': $sField = $oObj->GetKey(); $sData .= ""; break; - + default: $oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode); $oFinalAttDef = $oAttDef->GetFinalAttDef(); - if (get_class($oFinalAttDef) == 'AttributeDateTime') - { + if (get_class($oFinalAttDef) == 'AttributeDateTime') { // Split the date and time in two columns $sDate = $oDateFormat->Format($oObj->Get($sAttCode)); $sTime = $oTimeFormat->Format($oObj->Get($sAttCode)); $sData .= ""; $sData .= ""; - } - else if (get_class($oFinalAttDef) == 'AttributeDate') { + } elseif (get_class($oFinalAttDef) == 'AttributeDate') { $sDate = $oDateFormat->Format($oObj->Get($sAttCode)); $sData .= ""; - } else if ($oAttDef instanceof AttributeCaseLog) { + } elseif ($oAttDef instanceof AttributeCaseLog) { $rawValue = $oObj->Get($sAttCode); $sField = str_replace("\n", "
        ", utils::EscapeHtml($rawValue->__toString())); // Trick for Excel: treat the content as text even if it begins with an equal sign @@ -319,31 +293,22 @@ EOF if ($bFormattedText) { // Replace paragraphs (...

        , etc) by line breaks (
        ) since Excel (pre-2016) splits the cells when there is a paragraph $sField = static::HtmlToSpreadsheet($oObj->GetAsHTML($sAttCode)); - } - else - { + } else { // Convert to plain text $sField = utils::HtmlToText($oObj->GetAsHTML($sAttCode)); } $sData .= "
        "; - } - elseif ($oAttDef instanceof AttributeCustomFields) - { + } elseif ($oAttDef instanceof AttributeCustomFields) { // GetAsHTML returns a table that would not fit $sField = utils::TextToHtml($oObj->GetEditValue($sAttCode)); $sData .= ""; - } - else if ($oAttDef instanceof AttributeString) - { + } elseif ($oAttDef instanceof AttributeString) { $sField = $oObj->GetAsHTML($sAttCode, $this->bLocalizeOutput); $sData .= ""; - } - else if ($oAttDef instanceof AttributeTagSet) - { + } elseif ($oAttDef instanceof AttributeTagSet) { $sField = utils::HtmlEntities($oObj->GetAsCSV($sAttCode, $this->bLocalizeOutput, '')); $sData .= ""; - } - else { + } else { $rawValue = $oObj->Get($sAttCode); if ($this->bLocalizeOutput) { $sField = utils::EscapeHtml($oFinalAttDef->GetEditValue($rawValue)); @@ -360,21 +325,17 @@ EOF } set_time_limit(intval($iPreviousTimeLimit)); $this->aStatusInfo['position'] += $this->iChunkSize; - if ($this->aStatusInfo['total'] == 0) - { + if ($this->aStatusInfo['total'] == 0) { $iPercentage = 100; - } - else - { - $iPercentage = floor(min(100.0, 100.0*$this->aStatusInfo['position']/$this->aStatusInfo['total'])); + } else { + $iPercentage = floor(min(100.0, 100.0 * $this->aStatusInfo['position'] / $this->aStatusInfo['total'])); } - if ($iCount < $this->iChunkSize) - { + if ($iCount < $this->iChunkSize) { $sRetCode = 'done'; } - $aStatus = array('code' => $sRetCode, 'message' => Dict::S('Core:BulkExport:RetrievingData'), 'percentage' => $iPercentage); + $aStatus = ['code' => $sRetCode, 'message' => Dict::S('Core:BulkExport:RetrievingData'), 'percentage' => $iPercentage]; return $sData; } @@ -387,7 +348,7 @@ EOF public function GetSupportedFormats() { - return array('spreadsheet' => Dict::S('Core:BulkExport:SpreadsheetFormat')); + return ['spreadsheet' => Dict::S('Core:BulkExport:SpreadsheetFormat')]; } public function GetMimeType() @@ -410,33 +371,30 @@ EOF */ public static function HtmlToSpreadsheet($sHtml) { - if (trim(strip_tags($sHtml)) === '') - { + if (trim(strip_tags($sHtml)) === '') { // Display this value as an empty cell in the table return ' '; } // The tags listed here are a subset of the whitelist defined in HTMLDOMSanitizer // Tags causing a visual "line break" in the displayed page (i.e. display: block) are to be replaced by a followed by a
        // in order to preserve any inline style/attribute of the removed tag - $aTagsToReplace = array( + $aTagsToReplace = [ 'pre', 'div', 'p', 'hr', 'center', 'h1', 'h2', 'h3', 'h4', 'li', 'fieldset', 'legend', 'nav', 'section', 'tr', 'caption', - ); + ]; // Tags to completely remove from the markup - $aTagsToRemove = array( + $aTagsToRemove = [ 'table', 'thead', 'tbody', 'ul', 'ol', 'td', 'th', - ); + ]; // Remove the englobing
        ...
        to prevent an extra line break $sHtml = preg_replace('|^
        (.*)
        $|s', '$1', $sHtml); // Must use the "s" (. matches newline) modifier - - foreach($aTagsToReplace as $sTag) - { + + foreach ($aTagsToReplace as $sTag) { $sHtml = preg_replace("|<{$sTag} ?([^>]*)>|is", '', $sHtml); $sHtml = preg_replace("||i", '
        ', $sHtml); } - foreach($aTagsToRemove as $sTag) - { + foreach ($aTagsToRemove as $sTag) { $sHtml = preg_replace("|<{$sTag} ?([^>]*)>|is", '', $sHtml); $sHtml = preg_replace("||i", '', $sHtml); } diff --git a/core/sqlobjectquery.class.inc.php b/core/sqlobjectquery.class.inc.php index fe29f4d5b..854d6b01b 100644 --- a/core/sqlobjectquery.class.inc.php +++ b/core/sqlobjectquery.class.inc.php @@ -1,9 +1,10 @@ - /** * SQLObjectQuery * build a mySQL compatible SQL query @@ -25,7 +25,6 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - /** * SQLObjectQuery * build a mySQL compatible SQL query @@ -33,20 +32,19 @@ * @package iTopORM */ - class SQLObjectQuery extends SQLQuery { public $m_aContextData = null; public $m_iOriginalTableCount = 0; private $m_sTable = ''; private $m_sTableAlias = ''; - private $m_aFields = array(); - private $m_aGroupBy = array(); + private $m_aFields = []; + private $m_aGroupBy = []; private $m_oConditionExpr = null; private $m_bToDelete = true; // The current table must be listed for deletion ? - private $m_aValues = array(); // Values to set in case of an update query + private $m_aValues = []; // Values to set in case of an update query private $m_oSelectedIdField = null; - private $m_aJoinSelects = array(); + private $m_aJoinSelects = []; protected $m_bBeautifulQuery = false; // Data set by PrepareRendering() @@ -57,8 +55,7 @@ class SQLObjectQuery extends SQLQuery private $__aSetValues; private $__aSelectedIdFields; - - public function __construct($sTable, $sTableAlias, $aFields, $bToDelete = true, $aValues = array(), $oSelectedIdField = null) + public function __construct($sTable, $sTableAlias, $aFields, $bToDelete = true, $aValues = [], $oSelectedIdField = null) { parent::__construct(); @@ -89,12 +86,11 @@ class SQLObjectQuery extends SQLQuery public function DisplayHtml() { - if (count($this->m_aFields) == 0) $sFields = ""; - else - { - $aFieldDesc = array(); - foreach ($this->m_aFields as $sAlias => $oExpression) - { + if (count($this->m_aFields) == 0) { + $sFields = ""; + } else { + $aFieldDesc = []; + foreach ($this->m_aFields as $sAlias => $oExpression) { $aFieldDesc[] = $oExpression->RenderExpression(false)." as $sAlias"; } $sFields = " => ".implode(', ', $aFieldDesc); @@ -102,26 +98,21 @@ class SQLObjectQuery extends SQLQuery echo "$this->m_sTable$sFields
        \n"; // #@# todo - display html of an expression tree //$this->m_oConditionExpr->DisplayHtml() - if (count($this->m_aJoinSelects) > 0) - { + if (count($this->m_aJoinSelects) > 0) { echo "Joined to...
        \n"; echo "
          \n"; - foreach ($this->m_aJoinSelects as $aJoinInfo) - { + foreach ($this->m_aJoinSelects as $aJoinInfo) { $sJoinType = $aJoinInfo["jointype"]; $oSQLQuery = $aJoinInfo["select"]; - if (isset($aJoinInfo["on_expression"])) - { + if (isset($aJoinInfo["on_expression"])) { $sOnCondition = $aJoinInfo["on_expression"]->RenderExpression(false); echo "
        • Join '$sJoinType', ON ($sOnCondition)".$oSQLQuery->DisplayHtml()."
        • \n"; - } - else - { + } else { $sLeftField = $aJoinInfo["leftfield"]; $sRightField = $aJoinInfo["rightfield"]; $sRightTableAlias = $aJoinInfo["righttablealias"]; - + echo "
        • Join '$sJoinType', $sLeftField, $sRightTableAlias.$sRightField".$oSQLQuery->DisplayHtml()."
        • \n"; } } @@ -161,12 +152,9 @@ class SQLObjectQuery extends SQLQuery public function AddCondition($oConditionExpr) { - if (is_null($this->m_oConditionExpr)) - { + if (is_null($this->m_oConditionExpr)) { $this->m_oConditionExpr = $oConditionExpr; - } - else - { + } else { $this->m_oConditionExpr = $this->m_oConditionExpr->LogAnd($oConditionExpr); } } @@ -180,23 +168,22 @@ class SQLObjectQuery extends SQLQuery // throw new CoreException("Unknown field '$sLeftField' in table '".$this->m_sTable); //} - if (empty($sRightTableAlias)) - { + if (empty($sRightTableAlias)) { $sRightTableAlias = $oSQLQuery->m_sTableAlias; } -// #@# Could not be verified here because the namespace is unknown - do we need to check it there? -// -// if (!CMDBSource::IsField($sRightTable, $sRightField)) -// { -// throw new CoreException("Unknown field '$sRightField' in table '".$sRightTable."'"); -// } - $this->m_aJoinSelects[] = array( + // #@# Could not be verified here because the namespace is unknown - do we need to check it there? + // + // if (!CMDBSource::IsField($sRightTable, $sRightField)) + // { + // throw new CoreException("Unknown field '$sRightField' in table '".$sRightTable."'"); + // } + $this->m_aJoinSelects[] = [ "jointype" => $sJoinType, "select" => $oSQLQuery, "leftfield" => $sLeftField, "rightfield" => $sRightField, - "righttablealias" => $sRightTableAlias - ); + "righttablealias" => $sRightTableAlias, + ]; } public function AddInnerJoin($oSQLQuery, $sLeftField, $sRightField, $sRightTable = '') { @@ -205,11 +192,10 @@ class SQLObjectQuery extends SQLQuery public function AddInnerJoinTree($oSQLQuery, $sLeftFieldLeft, $sLeftFieldRight, $sRightFieldLeft, $sRightFieldRight, $sRightTableAlias = '', $iOperatorCode = TREE_OPERATOR_BELOW, $bInvertOnClause = false) { assert((get_class($oSQLQuery) == __CLASS__) || is_subclass_of($oSQLQuery, __CLASS__)); - if (empty($sRightTableAlias)) - { + if (empty($sRightTableAlias)) { $sRightTableAlias = $oSQLQuery->m_sTableAlias; } - $this->m_aJoinSelects[] = array( + $this->m_aJoinSelects[] = [ "jointype" => 'inner_tree', "select" => $oSQLQuery, "leftfield" => $sLeftFieldLeft, @@ -218,8 +204,8 @@ class SQLObjectQuery extends SQLQuery "rightfield_right" => $sRightFieldRight, "righttablealias" => $sRightTableAlias, "tree_operator" => $iOperatorCode, - 'invert_on_clause' => $bInvertOnClause - ); + 'invert_on_clause' => $bInvertOnClause, + ]; } public function AddLeftJoin($oSQLQuery, $sLeftField, $sRightField) { @@ -228,22 +214,22 @@ class SQLObjectQuery extends SQLQuery public function AddInnerJoinEx(SQLQuery $oSQLQuery, Expression $oOnExpression) { - $this->m_aJoinSelects[] = array( + $this->m_aJoinSelects[] = [ "jointype" => 'inner', "select" => $oSQLQuery, - "on_expression" => $oOnExpression - ); + "on_expression" => $oOnExpression, + ]; } public function AddLeftJoinEx(SQLQuery $oSQLQuery, Expression $oOnExpression) { - $this->m_aJoinSelects[] = array( + $this->m_aJoinSelects[] = [ "jointype" => 'left', "select" => $oSQLQuery, - "on_expression" => $oOnExpression - ); + "on_expression" => $oOnExpression, + ]; } - + // Interface, build the SQL query /** @@ -251,7 +237,7 @@ class SQLObjectQuery extends SQLQuery * @return string * @throws CoreException */ - public function RenderDelete($aArgs = array()) + public function RenderDelete($aArgs = []) { $this->PrepareRendering(); @@ -267,12 +253,9 @@ class SQLObjectQuery extends SQLQuery throw new CoreException("Building a request wich will delete every object of a given table -looks suspicious- please use truncate instead..."); } */ - if (is_null($this->m_oConditionExpr)) - { + if (is_null($this->m_oConditionExpr)) { // Delete all !!! - } - else - { + } else { $sWhere = self::ClauseWhere($this->m_oConditionExpr, $aArgs); return "DELETE $sDelete FROM $sFrom WHERE $sWhere"; } @@ -309,7 +292,7 @@ class SQLObjectQuery extends SQLQuery * @return string * @throws CoreException */ - public function RenderUpdate($aArgs = array()) + public function RenderUpdate($aArgs = []) { $this->PrepareRendering(); $sFrom = self::ClauseFrom($this->__aFrom); @@ -318,7 +301,6 @@ class SQLObjectQuery extends SQLQuery return "UPDATE $sFrom SET $sValues WHERE $sWhere"; } - /** * Generate an INSERT statement. * Note : unlike `RenderUpdate` and `RenderSelect`, it is limited to one and only one table. @@ -328,13 +310,12 @@ class SQLObjectQuery extends SQLQuery * @return string * @throws CoreException */ - public function RenderInsert($aArgs = array()) + public function RenderInsert($aArgs = []) { $this->PrepareRendering(); $aJoinInfo = reset($this->__aFrom); - if ($aJoinInfo['jointype'] != 'first' || count($this->__aFrom) > 1) - { + if ($aJoinInfo['jointype'] != 'first' || count($this->__aFrom) > 1) { throw new CoreException('Cannot render insert'); } @@ -342,9 +323,8 @@ class SQLObjectQuery extends SQLQuery $sColList = '`'.implode('`,`', array_keys($this->m_aValues)).'`'; - $aSetValues = array(); - foreach ($this->__aSetValues as $sFieldSpec => $value) - { + $aSetValues = []; + foreach ($this->__aSetValues as $sFieldSpec => $value) { $aSetValues[] = CMDBSource::Quote($value); } $sValues = implode(',', $aSetValues); @@ -352,7 +332,6 @@ class SQLObjectQuery extends SQLQuery return "INSERT INTO $sFrom ($sColList) VALUES ($sValues)"; } - /** * @param array $aOrderBy * @param array $aArgs @@ -363,7 +342,7 @@ class SQLObjectQuery extends SQLQuery * @return string * @throws CoreException */ - public function RenderSelect($aOrderBy = array(), $aArgs = array(), $iLimitCount = 0, $iLimitStart = 0, $bGetCount = false, $bBeautifulQuery = false) + public function RenderSelect($aOrderBy = [], $aArgs = [], $iLimitCount = 0, $iLimitStart = 0, $bGetCount = false, $bBeautifulQuery = false) { $this->m_bBeautifulQuery = $bBeautifulQuery; $sLineSep = $this->m_bBeautifulQuery ? "\n" : ''; @@ -374,20 +353,15 @@ class SQLObjectQuery extends SQLQuery $sWhere = self::ClauseWhere($this->m_oConditionExpr, $aArgs); // Sanity $iLimitCount = (int)$iLimitCount; - if ($iLimitCount > 0) - { + if ($iLimitCount > 0) { // Sanity $iLimitStart = (int)$iLimitStart; $sLimit = 'LIMIT '.$iLimitStart.', '.$iLimitCount; - } - else - { + } else { $sLimit = ''; } - if ($bGetCount) - { - if (count($this->__aSelectedIdFields) > 0) - { + if ($bGetCount) { + if (count($this->__aSelectedIdFields) > 0) { $aCountFields = []; $aCountI = []; $i = 0; @@ -400,18 +374,13 @@ class SQLObjectQuery extends SQLQuery // Count can be limited for performance reason, in this case the total amount is not important, // we only need to know if the number of entries is greater than a certain amount. $sSQL = "SELECT COUNT(*) AS COUNT FROM (SELECT$sLineSep DISTINCT $sCountFields $sLineSep FROM $sFrom$sLineSep WHERE $sWhere $sLimit) AS _alderaan_ WHERE $sCountI>0"; - } - else - { + } else { $sSQL = "SELECT COUNT(*) AS COUNT FROM (SELECT$sLineSep 1 $sLineSep FROM $sFrom$sLineSep WHERE $sWhere $sLimit) AS _alderaan_"; } - } - else - { + } else { $sSelect = self::ClauseSelect($this->__aFields, $sLineSep); $sOrderBy = self::ClauseOrderBy($aOrderBy, $this->__aFields); - if (!empty($sOrderBy)) - { + if (!empty($sOrderBy)) { $sOrderBy = "ORDER BY $sOrderBy$sLineSep"; } @@ -431,7 +400,7 @@ class SQLObjectQuery extends SQLQuery * @return string * @throws CoreException */ - public function RenderGroupBy($aArgs = array(), $bBeautifulQuery = false, $aOrderBy = array(), $iLimitCount = 0, $iLimitStart = 0) + public function RenderGroupBy($aArgs = [], $bBeautifulQuery = false, $aOrderBy = [], $iLimitCount = 0, $iLimitStart = 0) { $this->m_bBeautifulQuery = $bBeautifulQuery; $sLineSep = $this->m_bBeautifulQuery ? "\n" : ''; @@ -444,34 +413,25 @@ class SQLObjectQuery extends SQLQuery $sWhere = self::ClauseWhere($this->m_oConditionExpr, $aArgs); $sGroupBy = self::ClauseGroupBy($this->__aGroupBy); $sOrderBy = self::ClauseOrderBy($aOrderBy, $this->__aFields); - if (!empty($sGroupBy)) - { + if (!empty($sGroupBy)) { $sGroupBy = "GROUP BY $sGroupBy$sLineSep"; } - if (!empty($sOrderBy)) - { + if (!empty($sOrderBy)) { $sOrderBy = "ORDER BY $sOrderBy$sLineSep"; } - if ($iLimitCount > 0) - { + if ($iLimitCount > 0) { $sLimit = 'LIMIT '.$iLimitStart.', '.$iLimitCount; - } - else - { + } else { $sLimit = ''; } - if (count($this->__aSelectedIdFields) > 0) - { - $aCountFields = array(); - foreach ($this->__aSelectedIdFields as $sFieldExpr) - { + if (count($this->__aSelectedIdFields) > 0) { + $aCountFields = []; + foreach ($this->__aSelectedIdFields as $sFieldExpr) { $aCountFields[] = "COALESCE($sFieldExpr, 0)"; // Null values are excluded from the count } $sCountFields = implode(', ', $aCountFields); $sCountClause = "DISTINCT $sCountFields"; - } - else - { + } else { $sCountClause = '*'; } $sSQL = "SELECT $sSelect,$sLineSep COUNT($sCountClause) AS _itop_count_$sLineSep FROM $sFrom$sLineSep WHERE $sWhere$sLineSep $sGroupBy $sOrderBy$sLineSep $sLimit"; @@ -481,16 +441,15 @@ class SQLObjectQuery extends SQLQuery // Purpose: prepare the query data, once for all private function PrepareRendering() { - if (is_null($this->__aFrom)) - { - $this->__aFrom = array(); - $this->__aFields = array(); - $this->__aGroupBy = array(); - $this->__aDelTables = array(); - $this->__aSetValues = array(); - $this->__aSelectedIdFields = array(); - - $this->PrepareSingleTable($this, $this->__aFrom, '', array('jointype' => 'first')); + if (is_null($this->__aFrom)) { + $this->__aFrom = []; + $this->__aFields = []; + $this->__aGroupBy = []; + $this->__aDelTables = []; + $this->__aSetValues = []; + $this->__aSelectedIdFields = []; + + $this->PrepareSingleTable($this, $this->__aFrom, '', ['jointype' => 'first']); } } @@ -511,118 +470,100 @@ class SQLObjectQuery extends SQLQuery // Handle the various kinds of join (or first table in the list) // - if (empty($aJoinData['righttablealias'])) - { + if (empty($aJoinData['righttablealias'])) { $sRightTableAlias = $this->m_sTableAlias; - } - else - { + } else { $sRightTableAlias = $aJoinData['righttablealias']; } - switch ($aJoinData['jointype']) - { + switch ($aJoinData['jointype']) { case "first": - $aFrom[$this->m_sTableAlias] = array("jointype"=>"first", "tablename"=>$this->m_sTable, "joincondition"=>""); + $aFrom[$this->m_sTableAlias] = ["jointype" => "first", "tablename" => $this->m_sTable, "joincondition" => ""]; break; case "inner": case "left": - if (isset($aJoinData["on_expression"])) - { + if (isset($aJoinData["on_expression"])) { $sJoinCond = $aJoinData["on_expression"]->RenderExpression(true); - } - else - { + } else { $sJoinCond = "`$sCallerAlias`.`{$aJoinData['leftfield']}` = `$sRightTableAlias`.`{$aJoinData['rightfield']}`"; } - $aFrom[$this->m_sTableAlias] = array("jointype"=>$aJoinData['jointype'], "tablename"=>$this->m_sTable, "joincondition"=>"$sJoinCond"); + $aFrom[$this->m_sTableAlias] = ["jointype" => $aJoinData['jointype'], "tablename" => $this->m_sTable, "joincondition" => "$sJoinCond"]; break; case "inner_tree": - if ($aJoinData['invert_on_clause']) - { + if ($aJoinData['invert_on_clause']) { $sRootLeft = "`$sCallerAlias`.`{$aJoinData['leftfield']}`"; $sRootRight = "`$sCallerAlias`.`{$aJoinData['rightfield']}`"; $sNodeLeft = "`$sRightTableAlias`.`{$aJoinData['rightfield_left']}`"; $sNodeRight = "`$sRightTableAlias`.`{$aJoinData['rightfield_right']}`"; - } - else - { + } else { $sNodeLeft = "`$sCallerAlias`.`{$aJoinData['leftfield']}`"; $sNodeRight = "`$sCallerAlias`.`{$aJoinData['rightfield']}`"; $sRootLeft = "`$sRightTableAlias`.`{$aJoinData['rightfield_left']}`"; $sRootRight = "`$sRightTableAlias`.`{$aJoinData['rightfield_right']}`"; } - switch($aJoinData['tree_operator']) - { + switch ($aJoinData['tree_operator']) { case TREE_OPERATOR_BELOW: - $sJoinCond = "$sNodeLeft >= $sRootLeft AND $sNodeLeft <= $sRootRight"; - break; - + $sJoinCond = "$sNodeLeft >= $sRootLeft AND $sNodeLeft <= $sRootRight"; + break; + case TREE_OPERATOR_BELOW_STRICT: - $sJoinCond = "$sNodeLeft > $sRootLeft AND $sNodeLeft < $sRootRight"; - break; - + $sJoinCond = "$sNodeLeft > $sRootLeft AND $sNodeLeft < $sRootRight"; + break; + case TREE_OPERATOR_NOT_BELOW: // Complementary of 'BELOW' - $sJoinCond = "$sNodeLeft < $sRootLeft OR $sNodeLeft > $sRootRight"; - break; - + $sJoinCond = "$sNodeLeft < $sRootLeft OR $sNodeLeft > $sRootRight"; + break; + case TREE_OPERATOR_NOT_BELOW_STRICT: // Complementary of BELOW_STRICT - $sJoinCond = "$sNodeLeft <= $sRootLeft OR $sNodeLeft >= $sRootRight"; - break; + $sJoinCond = "$sNodeLeft <= $sRootLeft OR $sNodeLeft >= $sRootRight"; + break; case TREE_OPERATOR_ABOVE: - $sJoinCond = "$sNodeLeft <= $sRootLeft AND $sNodeRight >= $sRootRight"; - break; - + $sJoinCond = "$sNodeLeft <= $sRootLeft AND $sNodeRight >= $sRootRight"; + break; + case TREE_OPERATOR_ABOVE_STRICT: - $sJoinCond = "$sNodeLeft < $sRootLeft AND $sNodeRight > $sRootRight"; - break; - + $sJoinCond = "$sNodeLeft < $sRootLeft AND $sNodeRight > $sRootRight"; + break; + case TREE_OPERATOR_NOT_ABOVE: // Complementary of 'ABOVE' - $sJoinCond = "$sNodeLeft > $sRootLeft OR $sNodeRight < $sRootRight"; - break; - + $sJoinCond = "$sNodeLeft > $sRootLeft OR $sNodeRight < $sRootRight"; + break; + case TREE_OPERATOR_NOT_ABOVE_STRICT: // Complementary of ABOVE_STRICT - $sJoinCond = "$sNodeLeft >= $sRootLeft OR $sNodeRight <= $sRootRight"; - break; - + $sJoinCond = "$sNodeLeft >= $sRootLeft OR $sNodeRight <= $sRootRight"; + break; + } - $aFrom[$this->m_sTableAlias] = array("jointype"=>$aJoinData['jointype'], "tablename"=>$this->m_sTable, "joincondition"=>"$sJoinCond"); + $aFrom[$this->m_sTableAlias] = ["jointype" => $aJoinData['jointype'], "tablename" => $this->m_sTable, "joincondition" => "$sJoinCond"]; break; } // Given the alias, modify the fields and conditions // before adding them into the current lists // - foreach($this->m_aFields as $sAlias => $oExpression) - { + foreach ($this->m_aFields as $sAlias => $oExpression) { $oRootQuery->__aFields["`$sAlias`"] = $oExpression->RenderExpression(true); } - if ($this->m_aGroupBy) - { - foreach($this->m_aGroupBy as $sAlias => $oExpression) - { + if ($this->m_aGroupBy) { + foreach ($this->m_aGroupBy as $sAlias => $oExpression) { $oRootQuery->__aGroupBy["`$sAlias`"] = $oExpression->RenderExpression(true); } } - if ($this->m_bToDelete) - { + if ($this->m_bToDelete) { $oRootQuery->__aDelTables[] = "`{$this->m_sTableAlias}`"; } - foreach($this->m_aValues as $sFieldName=>$value) - { + foreach ($this->m_aValues as $sFieldName => $value) { $oRootQuery->__aSetValues["`{$this->m_sTableAlias}`.`$sFieldName`"] = $value; // quoted further! } - if (!is_null($this->m_oSelectedIdField)) - { - $oRootQuery->__aSelectedIdFields[] = $this->m_oSelectedIdField->RenderExpression(true); + if (!is_null($this->m_oSelectedIdField)) { + $oRootQuery->__aSelectedIdFields[] = $this->m_oSelectedIdField->RenderExpression(true); } // loop on joins, to complete the list of tables/fields/conditions // - $aTempFrom = array(); // temporary subset of 'from' specs, to be grouped in the final query - foreach ($this->m_aJoinSelects as $aJoinData) - { + $aTempFrom = []; // temporary subset of 'from' specs, to be grouped in the final query + foreach ($this->m_aJoinSelects as $aJoinData) { /** @var \SQLObjectQuery $oRightSelect */ $oRightSelect = $aJoinData["select"]; @@ -636,24 +577,20 @@ class SQLObjectQuery extends SQLQuery public function OptimizeJoins($aUsedTables, $bTopCall = true) { $this->m_iOriginalTableCount = $this->CountTables(); - if ($bTopCall) - { + if ($bTopCall) { // Top call: complete the list of tables absolutely required to perform the right query $this->CollectUsedTables($aUsedTables); } - $aToDiscard = array(); - foreach ($this->m_aJoinSelects as $i => $aJoinInfo) - { + $aToDiscard = []; + foreach ($this->m_aJoinSelects as $i => $aJoinInfo) { $oSQLQuery = $aJoinInfo["select"]; $sTableAlias = $oSQLQuery->GetTableAlias(); - if ($oSQLQuery->OptimizeJoins($aUsedTables, false) && !array_key_exists($sTableAlias, $aUsedTables)) - { + if ($oSQLQuery->OptimizeJoins($aUsedTables, false) && !array_key_exists($sTableAlias, $aUsedTables)) { $aToDiscard[] = $i; } } - foreach ($aToDiscard as $i) - { + foreach ($aToDiscard as $i) { unset($this->m_aJoinSelects[$i]); } @@ -663,8 +600,7 @@ class SQLObjectQuery extends SQLQuery public function CountTables() { $iRet = 1; - foreach ($this->m_aJoinSelects as $i => $aJoinInfo) - { + foreach ($this->m_aJoinSelects as $i => $aJoinInfo) { $oSQLQuery = $aJoinInfo["select"]; $iRet += $oSQLQuery->CountTables(); } @@ -674,34 +610,26 @@ class SQLObjectQuery extends SQLQuery public function CollectUsedTables(&$aTables) { $this->m_oConditionExpr->CollectUsedParents($aTables); - foreach($this->m_aFields as $sFieldAlias => $oField) - { + foreach ($this->m_aFields as $sFieldAlias => $oField) { $oField->CollectUsedParents($aTables); } - if ($this->m_aGroupBy) - { - foreach($this->m_aGroupBy as $sAlias => $oExpression) - { + if ($this->m_aGroupBy) { + foreach ($this->m_aGroupBy as $sAlias => $oExpression) { $oExpression->CollectUsedParents($aTables); } } - if (!is_null($this->m_oSelectedIdField)) - { - $this->m_oSelectedIdField->CollectUsedParents($aTables); + if (!is_null($this->m_oSelectedIdField)) { + $this->m_oSelectedIdField->CollectUsedParents($aTables); } - foreach ($this->m_aJoinSelects as $i => $aJoinInfo) - { + foreach ($this->m_aJoinSelects as $i => $aJoinInfo) { $oSQLQuery = $aJoinInfo["select"]; - if ($oSQLQuery->HasRequiredTables($aTables)) - { + if ($oSQLQuery->HasRequiredTables($aTables)) { // There is something required in the branch, then this node is a MUST - if (isset($aJoinInfo['righttablealias'])) - { + if (isset($aJoinInfo['righttablealias'])) { $aTables[$aJoinInfo['righttablealias']] = true; } - if (isset($aJoinInfo["on_expression"])) - { + if (isset($aJoinInfo["on_expression"])) { $aJoinInfo["on_expression"]->CollectUsedParents($aTables); } } @@ -714,22 +642,17 @@ class SQLObjectQuery extends SQLQuery protected function HasRequiredTables(&$aTables) { $bResult = false; - if (array_key_exists($this->m_sTableAlias, $aTables)) - { + if (array_key_exists($this->m_sTableAlias, $aTables)) { $bResult = true; } - foreach ($this->m_aJoinSelects as $i => $aJoinInfo) - { + foreach ($this->m_aJoinSelects as $i => $aJoinInfo) { $oSQLQuery = $aJoinInfo["select"]; - if ($oSQLQuery->HasRequiredTables($aTables)) - { + if ($oSQLQuery->HasRequiredTables($aTables)) { // There is something required in the branch, then this node is a MUST - if (isset($aJoinInfo['righttablealias'])) - { + if (isset($aJoinInfo['righttablealias'])) { $aTables[$aJoinInfo['righttablealias']] = true; } - if (isset($aJoinInfo["on_expression"])) - { + if (isset($aJoinInfo["on_expression"])) { $aJoinInfo["on_expression"]->CollectUsedParents($aTables); } $bResult = true; diff --git a/core/sqlobjectquerybuilder.class.inc.php b/core/sqlobjectquerybuilder.class.inc.php index 7d9d8e02c..893fbc032 100644 --- a/core/sqlobjectquerybuilder.class.inc.php +++ b/core/sqlobjectquerybuilder.class.inc.php @@ -1,4 +1,5 @@ oDBObjetSearch->GetSelectedClasses() as $sClassAlias => $sClass) - { - $aAttToLoad[$sClassAlias] = array(); + $aAttToLoad = []; + foreach ($this->oDBObjetSearch->GetSelectedClasses() as $sClassAlias => $sClass) { + $aAttToLoad[$sClassAlias] = []; } } $oBuild = new QueryBuilderContext($this->oDBObjetSearch, $aModifierProperties, $aGroupByExpr, $aSelectedClasses, $aSelectExpr, $aAttToLoad); - $oSQLQuery = $this->MakeSQLObjectQueryRoot($oBuild, array(), $aGroupByExpr, $aSelectExpr); + $oSQLQuery = $this->MakeSQLObjectQueryRoot($oBuild, [], $aGroupByExpr, $aSelectExpr); return $oSQLQuery; } @@ -58,9 +56,9 @@ class SQLObjectQueryBuilder public function MakeSQLObjectDeleteQuery() { $aModifierProperties = MetaModel::MakeModifierProperties($this->oDBObjetSearch); - $aAttToLoad = array($this->oDBObjetSearch->GetClassAlias() => array()); + $aAttToLoad = [$this->oDBObjetSearch->GetClassAlias() => []]; $oBuild = new QueryBuilderContext($this->oDBObjetSearch, $aModifierProperties, null, null, null, $aAttToLoad); - $oSQLQuery = $this->MakeSQLObjectQueryRoot($oBuild, array()); + $oSQLQuery = $this->MakeSQLObjectQueryRoot($oBuild, []); return $oSQLQuery; } @@ -73,12 +71,11 @@ class SQLObjectQueryBuilder public function MakeSQLObjectUpdateQuery($aValues) { $aModifierProperties = MetaModel::MakeModifierProperties($this->oDBObjetSearch); - $aRequested = array(); // Requested attributes are the updated attributes - foreach ($aValues as $sAttCode => $value) - { + $aRequested = []; // Requested attributes are the updated attributes + foreach ($aValues as $sAttCode => $value) { $aRequested[$sAttCode] = MetaModel::GetAttributeDef($this->oDBObjetSearch->GetClass(), $sAttCode); } - $aAttToLoad = array($this->oDBObjetSearch->GetClassAlias() => $aRequested); + $aAttToLoad = [$this->oDBObjetSearch->GetClassAlias() => $aRequested]; $oBuild = new QueryBuilderContext($this->oDBObjetSearch, $aModifierProperties, null, null, null, $aAttToLoad); $oSQLQuery = $this->MakeSQLObjectQueryRoot($oBuild, $aValues); return $oSQLQuery; @@ -107,7 +104,6 @@ class SQLObjectQueryBuilder return $this->GetOQLClassTree($oBuild)->RenderDebug(); } - /** * @param \QueryBuilderContext $oBuild * @param array $aValues @@ -117,7 +113,7 @@ class SQLObjectQueryBuilder * @return null|SQLObjectQuery * @throws \CoreException */ - private function MakeSQLObjectQueryRoot($oBuild, $aValues = array(), $aGroupByExpr = null, $aSelectExpr = null) + private function MakeSQLObjectQueryRoot($oBuild, $aValues = [], $aGroupByExpr = null, $aSelectExpr = null) { $oOQLClassNode = $this->GetOQLClassTree($oBuild); @@ -128,38 +124,29 @@ class SQLObjectQueryBuilder */ $oSQLQuery->SetCondition($oBuild->m_oQBExpressions->GetCondition()); - if (is_array($aGroupByExpr)) - { + if (is_array($aGroupByExpr)) { $aCols = $oBuild->m_oQBExpressions->GetGroupBy(); $oSQLQuery->SetGroupBy($aCols); $oSQLQuery->SetSelect($aCols); - if (!empty($aSelectExpr)) - { + if (!empty($aSelectExpr)) { // Get the fields corresponding to the select expressions - foreach($oBuild->m_oQBExpressions->GetSelect() as $sAlias => $oExpr) - { - if (key_exists($sAlias, $aSelectExpr)) - { + foreach ($oBuild->m_oQBExpressions->GetSelect() as $sAlias => $oExpr) { + if (key_exists($sAlias, $aSelectExpr)) { $oSQLQuery->AddSelect($sAlias, $oExpr); } } } - } - else - { + } else { $oSQLQuery->SetSelect($oBuild->m_oQBExpressions->GetSelect()); } // Filter for archive flag // Filter tables as late as possible: do not interfere with the optimization process $aMandatoryTables = $oBuild->m_oQBExpressions->GetMandatoryTables(); - foreach ($oBuild->GetFilteredTables() as $sTableAlias => $aConditions) - { - if ($aMandatoryTables && array_key_exists($sTableAlias, $aMandatoryTables)) - { - foreach ($aConditions as $oCondition) - { + foreach ($oBuild->GetFilteredTables() as $sTableAlias => $aConditions) { + if ($aMandatoryTables && array_key_exists($sTableAlias, $aMandatoryTables)) { + foreach ($aConditions as $oCondition) { $oSQLQuery->AddCondition($oCondition); } } @@ -168,7 +155,6 @@ class SQLObjectQueryBuilder return $oSQLQuery; } - /** * @param \QueryBuilderContext $oBuild * @param \OQLClassNode $oOQLClassNode @@ -184,7 +170,6 @@ class SQLObjectQueryBuilder return $oSQLQuery; } - /** * @param \QueryBuilderContext $oBuild * @param \OQLClassNode $oOQLClassNode @@ -203,39 +188,32 @@ class SQLObjectQueryBuilder $aExpectedAttributes = $oBuild->m_oQBExpressions->GetUnresolvedFields($sClassAlias); $oSelectedIdField = null; - $aTranslation = array(); - $aUpdateValues = array(); + $aTranslation = []; + $aUpdateValues = []; $oIdField = new FieldExpressionResolved(MetaModel::DBGetKey($sClass), $sClassAlias); $aTranslation[$sClassAlias]['id'] = $oIdField; - if ($bIsOnQueriedClass) - { + if ($bIsOnQueriedClass) { // Add this field to the list of queried fields (required for the COUNT to work fine) $oSelectedIdField = $oIdField; - foreach ($aExpectedAttributes as $sAttCode => $oExpression) - { - if (!array_key_exists($sAttCode, $aValues)) - { + foreach ($aExpectedAttributes as $sAttCode => $oExpression) { + if (!array_key_exists($sAttCode, $aValues)) { continue; } $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); // Skip this attribute if not made of SQL columns nor in current table - if (count($oAttDef->GetSQLExpressions()) == 0 || $oAttDef->IsExternalField()) - { + if (count($oAttDef->GetSQLExpressions()) == 0 || $oAttDef->IsExternalField()) { continue; } - foreach ($oAttDef->GetSQLValues($aValues[$sAttCode]) as $sColumn => $sValue) - { + foreach ($oAttDef->GetSQLValues($aValues[$sAttCode]) as $sColumn => $sValue) { $aUpdateValues[$sColumn] = $sValue; } } } - $oBaseSQLQuery = new SQLObjectQuery($sTable, $sClassAlias, array(), $bIsOnQueriedClass, $aUpdateValues, $oSelectedIdField); + $oBaseSQLQuery = new SQLObjectQuery($sTable, $sClassAlias, [], $bIsOnQueriedClass, $aUpdateValues, $oSelectedIdField); - foreach ($aExpectedAttributes as $sAttCode => $oExpression) - { - if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + foreach ($aExpectedAttributes as $sAttCode => $oExpression) { + if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) { continue; } $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); @@ -244,8 +222,7 @@ class SQLObjectQueryBuilder * @var string $sPluginClass * @var iQueryModifier $oQueryModifier */ - foreach (MetaModel::EnumPlugins('iQueryModifier') as $sPluginClass => $oQueryModifier) - { + foreach (MetaModel::EnumPlugins('iQueryModifier') as $sPluginClass => $oQueryModifier) { $oFieldSQLExp = $oQueryModifier->GetFieldExpression($oBuild, $sClass, $sAttCode, '', $oFieldSQLExp, $oBaseSQLQuery); } $aTranslation[$sClassAlias][$sAttCode] = $oFieldSQLExp; @@ -257,10 +234,8 @@ class SQLObjectQueryBuilder // Filter out archived records // - if (MetaModel::IsArchivable($sClass)) - { - if (!$oBuild->GetRootFilter()->GetArchiveMode()) - { + if (MetaModel::IsArchivable($sClass)) { + if (!$oBuild->GetRootFilter()->GetArchiveMode()) { $oNotArchived = new BinaryExpression(new FieldExpressionResolved('archive_flag', $sClassAlias), '=', new ScalarExpression(0)); $oBuild->AddFilteredTable($sClassAlias, $oNotArchived); } @@ -268,10 +243,8 @@ class SQLObjectQueryBuilder // Add Joins $aJoins = $oOQLClassNode->GetJoins(); - foreach ($aJoins as $aJoin) - { - foreach ($aJoin as $oOQLJoin) - { + foreach ($aJoins as $aJoin) { + foreach ($aJoin as $oOQLJoin) { $oJoinedClassNode = $oOQLJoin->GetOOQLClassNode(); $oJoinedSQLQuery = $this->MakeSQLObjectQueryNode($oBuild, $oJoinedClassNode, $aValues); $oOQLJoin->AddToSQLObjectQuery($oBuild, $oBaseSQLQuery, $oJoinedSQLQuery); diff --git a/core/sqlquery.class.inc.php b/core/sqlquery.class.inc.php index b21ffb05b..ec68e5d52 100644 --- a/core/sqlquery.class.inc.php +++ b/core/sqlquery.class.inc.php @@ -1,9 +1,10 @@ - /** * SQLQuery * build an mySQL compatible SQL query @@ -25,7 +25,6 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - /** * SQLQuery * build an mySQL compatible SQL query @@ -35,7 +34,6 @@ require_once('cmdbsource.class.inc.php'); - abstract class SQLQuery { private $m_SourceOQL = ''; @@ -47,7 +45,7 @@ abstract class SQLQuery /** * Perform a deep clone (as opposed to "clone" which does copy a reference to the underlying objects - **/ + **/ public function DeepClone() { return unserialize(serialize($this)); @@ -66,18 +64,17 @@ abstract class SQLQuery abstract public function AddInnerJoin($oSQLQuery, $sLeftField, $sRightField, $sRightTable = ''); abstract public function DisplayHtml(); - abstract public function RenderDelete($aArgs = array()); - abstract public function RenderUpdate($aArgs = array()); - abstract public function RenderSelect($aOrderBy = array(), $aArgs = array(), $iLimitCount = 0, $iLimitStart = 0, $bGetCount = false, $bBeautifulQuery = false); - abstract public function RenderGroupBy($aArgs = array(), $bBeautifulQuery = false, $aOrderBy = array(), $iLimitCount = 0, $iLimitStart = 0); + abstract public function RenderDelete($aArgs = []); + abstract public function RenderUpdate($aArgs = []); + abstract public function RenderSelect($aOrderBy = [], $aArgs = [], $iLimitCount = 0, $iLimitStart = 0, $bGetCount = false, $bBeautifulQuery = false); + abstract public function RenderGroupBy($aArgs = [], $bBeautifulQuery = false, $aOrderBy = [], $iLimitCount = 0, $iLimitStart = 0); abstract public function OptimizeJoins($aUsedTables, $bTopCall = true); protected static function ClauseSelect($aFields, $sLineSep = '') { - $aSelect = array(); - foreach ($aFields as $sFieldAlias => $sSQLExpr) - { + $aSelect = []; + foreach ($aFields as $sFieldAlias => $sSQLExpr) { $aSelect[] = "$sSQLExpr AS $sFieldAlias"; } $sSelect = implode(",$sLineSep ", $aSelect); @@ -92,9 +89,8 @@ abstract class SQLQuery protected static function ClauseDelete($aDelTableAliases) { - $aDelTables = array(); - foreach ($aDelTableAliases as $sTableAlias) - { + $aDelTables = []; + foreach ($aDelTableAliases as $sTableAlias) { $aDelTables[] = "$sTableAlias"; } $sDelTables = implode(', ', $aDelTables); @@ -114,38 +110,30 @@ abstract class SQLQuery $sLineBreak = $sIndent ? "\n".str_repeat($sIndent, $iIndentLevel) : ''; $sFrom = ""; - foreach ($aFrom as $sTableAlias => $aJoinInfo) - { - switch ($aJoinInfo["jointype"]) - { + foreach ($aFrom as $sTableAlias => $aJoinInfo) { + switch ($aJoinInfo["jointype"]) { case "first": $sFrom .= $sLineBreakLong."`".$aJoinInfo["tablename"]."` AS `$sTableAlias`"; $sFrom .= self::ClauseFrom($aJoinInfo["subfrom"], $sIndent, $iIndentLevel + 1); break; case "inner": case "inner_tree": - if (count($aJoinInfo["subfrom"]) > 0) - { + if (count($aJoinInfo["subfrom"]) > 0) { $sFrom .= $sLineBreak."INNER JOIN ($sLineBreakLong`".$aJoinInfo["tablename"]."` AS `$sTableAlias`"; $sFrom .= " ".self::ClauseFrom($aJoinInfo["subfrom"], $sIndent, $iIndentLevel + 1); $sFrom .= $sLineBreak.") ON ".$aJoinInfo["joincondition"]; - } - else - { + } else { // Unions do not suffer parenthesis around the "table AS alias" $sFrom .= $sLineBreak."INNER JOIN $sLineBreakLong`".$aJoinInfo["tablename"]."` AS `$sTableAlias`"; $sFrom .= $sLineBreak." ON ".$aJoinInfo["joincondition"]; } break; case "left": - if (count($aJoinInfo["subfrom"]) > 0) - { + if (count($aJoinInfo["subfrom"]) > 0) { $sFrom .= $sLineBreak."LEFT JOIN ($sLineBreakLong`".$aJoinInfo["tablename"]."` AS `$sTableAlias`"; $sFrom .= " ".self::ClauseFrom($aJoinInfo["subfrom"], $sIndent, $iIndentLevel + 1); $sFrom .= $sLineBreak.") ON ".$aJoinInfo["joincondition"]; - } - else - { + } else { // Unions do not suffer parenthesis around the "table AS alias" $sFrom .= $sLineBreak."LEFT JOIN $sLineBreakLong`".$aJoinInfo["tablename"]."` AS `$sTableAlias`"; $sFrom .= $sLineBreak." ON ".$aJoinInfo["joincondition"]; @@ -160,23 +148,19 @@ abstract class SQLQuery protected static function ClauseValues($aValues) { - $aSetValues = array(); - foreach ($aValues as $sFieldSpec => $value) - { + $aSetValues = []; + foreach ($aValues as $sFieldSpec => $value) { $aSetValues[] = "$sFieldSpec = ".CMDBSource::Quote($value); } $sSetValues = implode(', ', $aSetValues); return $sSetValues; } - protected static function ClauseWhere($oConditionExpr, $aArgs = array()) + protected static function ClauseWhere($oConditionExpr, $aArgs = []) { - if (is_null($oConditionExpr)) - { + if (is_null($oConditionExpr)) { return '1'; - } - else - { + } else { return $oConditionExpr->RenderExpression(true, $aArgs); } } @@ -189,9 +173,8 @@ abstract class SQLQuery */ protected static function ClauseOrderBy($aOrderBy, $aExistingFields) { - $aOrderBySpec = array(); - foreach($aOrderBy as $sFieldAlias => $bAscending) - { + $aOrderBySpec = []; + foreach ($aOrderBy as $sFieldAlias => $bAscending) { // Note: sFieldAlias must have backticks around column aliases $aOrderBySpec[] = $sFieldAlias.($bAscending ? " ASC" : " DESC"); } diff --git a/core/sqlunionquery.class.inc.php b/core/sqlunionquery.class.inc.php index ec008c3be..bfe8e6bf1 100644 --- a/core/sqlunionquery.class.inc.php +++ b/core/sqlunionquery.class.inc.php @@ -1,9 +1,10 @@ - /** * SQLUnionQuery * build a mySQL compatible SQL query @@ -25,7 +25,6 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - /** * SQLUnionQuery * build a mySQL compatible SQL query @@ -33,20 +32,18 @@ * @package iTopORM */ - class SQLUnionQuery extends SQLQuery { protected $aQueries; protected $aGroupBy; protected $aSelectExpr; - public function __construct($aQueries, $aGroupBy, $aSelectExpr = array()) + public function __construct($aQueries, $aGroupBy, $aSelectExpr = []) { parent::__construct(); - $this->aQueries = array(); - foreach ($aQueries as $oSQLQuery) - { + $this->aQueries = []; + foreach ($aQueries as $oSQLQuery) { $this->aQueries[] = $oSQLQuery->DeepClone(); } $this->aGroupBy = $aGroupBy; @@ -55,9 +52,8 @@ class SQLUnionQuery extends SQLQuery public function DisplayHtml() { - $aQueriesHtml = array(); - foreach ($this->aQueries as $oSQLQuery) - { + $aQueriesHtml = []; + foreach ($this->aQueries as $oSQLQuery) { $aQueriesHtml[] = '

          '.$oSQLQuery->DisplayHtml().'

          '; } echo implode('UNION', $aQueriesHtml); @@ -65,8 +61,7 @@ class SQLUnionQuery extends SQLQuery public function AddInnerJoin($oSQLQuery, $sLeftField, $sRightField, $sRightTable = '') { - foreach ($this->aQueries as $oSubSQLQuery) - { + foreach ($this->aQueries as $oSubSQLQuery) { $oSubSQLQuery->AddInnerJoin($oSQLQuery->DeepClone(), $sLeftField, $sRightField, $sRightTable = ''); } } @@ -75,7 +70,7 @@ class SQLUnionQuery extends SQLQuery * @param array $aArgs * @throws Exception */ - public function RenderDelete($aArgs = array()) + public function RenderDelete($aArgs = []) { throw new Exception(__class__.'::'.__function__.'Not implemented !'); } @@ -86,7 +81,7 @@ class SQLUnionQuery extends SQLQuery * @param array $aArgs * @throws Exception */ - public function RenderUpdate($aArgs = array()) + public function RenderUpdate($aArgs = []) { throw new Exception(__class__.'::'.__function__.'Not implemented !'); } @@ -104,47 +99,37 @@ class SQLUnionQuery extends SQLQuery * @return string * @throws \CoreException */ - public function RenderSelect($aOrderBy = array(), $aArgs = array(), $iLimitCount = 0, $iLimitStart = 0, $bGetCount = false, $bBeautifulQuery = false) + public function RenderSelect($aOrderBy = [], $aArgs = [], $iLimitCount = 0, $iLimitStart = 0, $bGetCount = false, $bBeautifulQuery = false) { $this->m_bBeautifulQuery = $bBeautifulQuery; $sLineSep = $this->m_bBeautifulQuery ? "\n" : ''; - $aSelects = array(); - foreach ($this->aQueries as $oSQLQuery) - { + $aSelects = []; + foreach ($this->aQueries as $oSQLQuery) { // Render SELECTS without orderby/limit/count /** @var \SQLObjectQuery $oSQLQuery */ - $aSelects[] = $oSQLQuery->RenderSelect(array(), $aArgs, 0, 0, false, $bBeautifulQuery); + $aSelects[] = $oSQLQuery->RenderSelect([], $aArgs, 0, 0, false, $bBeautifulQuery); } - if ($iLimitCount > 0) - { + if ($iLimitCount > 0) { $sLimitStart = '('; $sLimit = 'LIMIT '.$iLimitStart.', '.$iLimitCount; $sLimitEnd = ')'; - } - else - { + } else { $sLimitStart = ''; $sLimit = ''; $sLimitEnd = ''; } - if ($bGetCount) - { + if ($bGetCount) { $sSelects = "{$sLimitStart}".implode(" {$sLimit}{$sLimitEnd}{$sLineSep} UNION{$sLineSep} {$sLimitStart}", $aSelects)." {$sLimit}{$sLimitEnd}"; $sFrom = "({$sLineSep}{$sSelects}{$sLineSep}) as __selects__"; $sSQL = "SELECT COUNT(*) AS COUNT FROM (SELECT$sLineSep 1 $sLineSep FROM {$sFrom}{$sLineSep}) AS _union_alderaan_"; - } - else - { + } else { $sOrderBy = $this->aQueries[0]->RenderOrderByClause($aOrderBy); - if (!empty($sOrderBy)) - { + if (!empty($sOrderBy)) { $sOrderBy = "ORDER BY {$sOrderBy}{$sLineSep} {$sLimit}"; $sSQL = implode(" {$sLineSep} UNION{$sLineSep} ", $aSelects).$sLineSep.$sOrderBy; - } - else - { + } else { $sSQL = $sLimitStart.implode(" {$sLimit}{$sLimitEnd} {$sLineSep} UNION{$sLineSep} {$sLimitStart}", $aSelects)." {$sLimit}{$sLimitEnd}"; } } @@ -162,29 +147,26 @@ class SQLUnionQuery extends SQLQuery * @return string * @throws CoreException */ - public function RenderGroupBy($aArgs = array(), $bBeautifulQuery = false, $aOrderBy = array(), $iLimitCount = 0, $iLimitStart = 0) + public function RenderGroupBy($aArgs = [], $bBeautifulQuery = false, $aOrderBy = [], $iLimitCount = 0, $iLimitStart = 0) { $this->m_bBeautifulQuery = $bBeautifulQuery; $sLineSep = $this->m_bBeautifulQuery ? "\n" : ''; - $aSelects = array(); - foreach ($this->aQueries as $oSQLQuery) - { + $aSelects = []; + foreach ($this->aQueries as $oSQLQuery) { // Render SELECTS without orderby/limit/count - $aSelects[] = $oSQLQuery->RenderSelect(array(), $aArgs, 0, 0, false, $bBeautifulQuery); + $aSelects[] = $oSQLQuery->RenderSelect([], $aArgs, 0, 0, false, $bBeautifulQuery); } $sSelects = '('.implode(")$sLineSep UNION$sLineSep(", $aSelects).')'; $sFrom = "($sLineSep$sSelects$sLineSep) as __selects__"; - $aSelectAliases = array(); - $aGroupAliases = array(); - foreach ($this->aGroupBy as $sGroupAlias => $trash) - { + $aSelectAliases = []; + $aGroupAliases = []; + foreach ($this->aGroupBy as $sGroupAlias => $trash) { $aSelectAliases[$sGroupAlias] = "`$sGroupAlias`"; $aGroupAliases[] = "`$sGroupAlias`"; } - foreach($this->aSelectExpr as $sSelectAlias => $oExpr) - { + foreach ($this->aSelectExpr as $sSelectAlias => $oExpr) { $aSelectAliases[$sSelectAlias] = $oExpr->RenderExpression(true)." AS `$sSelectAlias`"; } @@ -192,33 +174,25 @@ class SQLUnionQuery extends SQLQuery $sGroupBy = implode(', ', $aGroupAliases); $sOrderBy = self::ClauseOrderBy($aOrderBy, $aSelectAliases); - if (!empty($sGroupBy)) - { + if (!empty($sGroupBy)) { $sGroupBy = "GROUP BY $sGroupBy$sLineSep"; } - if (!empty($sOrderBy)) - { + if (!empty($sOrderBy)) { $sOrderBy = "ORDER BY $sOrderBy$sLineSep"; } - if ($iLimitCount > 0) - { + if ($iLimitCount > 0) { $sLimit = 'LIMIT '.$iLimitStart.', '.$iLimitCount; - } - else - { + } else { $sLimit = ''; } - $sSQL = "SELECT $sSelect,$sLineSep COUNT(*) AS _itop_count_$sLineSep FROM $sFrom$sLineSep $sGroupBy $sOrderBy$sLineSep $sLimit"; return $sSQL; } - public function OptimizeJoins($aUsedTables, $bTopCall = true) { - foreach ($this->aQueries as $oSQLQuery) - { + foreach ($this->aQueries as $oSQLQuery) { $oSQLQuery->OptimizeJoins($aUsedTables); } } diff --git a/core/stimulus.class.inc.php b/core/stimulus.class.inc.php index 261d07948..806f025df 100644 --- a/core/stimulus.class.inc.php +++ b/core/stimulus.class.inc.php @@ -1,9 +1,10 @@ - /** * Object lifecycle management: stimulus * @@ -24,9 +24,8 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - /** - * A stimulus is the trigger that makes the lifecycle go ahead (state machine) + * A stimulus is the trigger that makes the lifecycle go ahead (state machine) * * @package iTopORM */ @@ -36,7 +35,7 @@ class ObjectStimulus { - private $m_aParams = array(); + private $m_aParams = []; private $m_sHostClass = null; private $m_sCode = null; @@ -62,7 +61,7 @@ class ObjectStimulus public function GetLabel() { - return Dict::S('Class:'.$this->m_sHostClass.'/Stimulus:'.$this->m_sCode, $this->m_sCode); + return Dict::S('Class:'.$this->m_sHostClass.'/Stimulus:'.$this->m_sCode, $this->m_sCode); } public function GetDescription() { @@ -72,12 +71,9 @@ class ObjectStimulus public function GetLabel_Obsolete() { // Written for compatibility with a data model written prior to version 0.9.1 - if (array_key_exists('label', $this->m_aParams)) - { + if (array_key_exists('label', $this->m_aParams)) { return $this->m_aParams['label']; - } - else - { + } else { return $this->GetLabel(); } } @@ -85,23 +81,20 @@ class ObjectStimulus public function GetDescription_Obsolete() { // Written for compatibility with a data model written prior to version 0.9.1 - if (array_key_exists('description', $this->m_aParams)) - { + if (array_key_exists('description', $this->m_aParams)) { return $this->m_aParams['description']; - } - else - { + } else { return $this->GetDescription(); } } -// obsolete- public function Get($sParamName) {return $this->m_aParams[$sParamName];} + // obsolete- public function Get($sParamName) {return $this->m_aParams[$sParamName];} // Note: I could factorize this code with the parameter management made for the AttributeDef class // to be overloaded - static protected function ListExpectedParams() + protected static function ListExpectedParams() { - return array(); + return []; } private function ConsistencyCheck() @@ -110,10 +103,8 @@ class ObjectStimulus // Check that any mandatory param has been specified // $aExpectedParams = $this->ListExpectedParams(); - foreach($aExpectedParams as $sParamName) - { - if (!array_key_exists($sParamName, $this->m_aParams)) - { + foreach ($aExpectedParams as $sParamName) { + if (!array_key_exists($sParamName, $this->m_aParams)) { $aBacktrace = debug_backtrace(); $sTargetClass = $aBacktrace[2]["class"]; $sCodeInfo = $aBacktrace[1]["file"]." - ".$aBacktrace[1]["line"]; @@ -123,8 +114,6 @@ class ObjectStimulus } } - - class StimulusUserAction extends ObjectStimulus { // Entry in the menus @@ -134,5 +123,3 @@ class StimulusInternal extends ObjectStimulus { // Applied from page xxxx } - -?> diff --git a/core/tabularbulkexport.class.inc.php b/core/tabularbulkexport.class.inc.php index 18d54dbf7..7968ad4d1 100644 --- a/core/tabularbulkexport.class.inc.php +++ b/core/tabularbulkexport.class.inc.php @@ -1,4 +1,5 @@ array('fields'))); + return array_merge(parent::EnumFormParts(), ['tabular_fields' => ['fields']]); } /** @@ -49,21 +50,17 @@ abstract class TabularBulkExport extends BulkExport protected function SuggestFields($aSuggestedFields) { - $aRet = array(); + $aRet = []; // By defaults all fields are Ok, nothing gets translated but // you can overload this method if some fields are better exported // (in a given format) by using an alternate field, for example id => friendlyname $aAliases = $this->oSearch->GetSelectedClasses(); - foreach($aSuggestedFields as $idx => $sField) - { - if (preg_match('/^([^\\.]+)\\.(.+)$/', $sField, $aMatches)) - { + foreach ($aSuggestedFields as $idx => $sField) { + if (preg_match('/^([^\\.]+)\\.(.+)$/', $sField, $aMatches)) { $sAlias = $aMatches[1]; $sAttCode = $aMatches[2]; $sClass = $aAliases[$sAlias]; - } - else - { + } else { $sAlias = ''; $sAttCode = $sField; $sClass = reset($aAliases); @@ -72,8 +69,7 @@ abstract class TabularBulkExport extends BulkExport $sAttCodeEx = MetaModel::NormalizeFieldSpec($sClass, $sMostRelevantField); // Remove the aliases (if any) from the field names to make them compatible // with the 'short' notation used in this case by the widget - if (count($aAliases) > 1) - { + if (count($aAliases) > 1) { $sAttCodeEx = $sAlias.'.'.$sAttCodeEx; } $aRet[] = $sAttCodeEx; @@ -93,9 +89,8 @@ abstract class TabularBulkExport extends BulkExport protected function GetSubAttributes($sClass, $sAttCode, $oAttDef) { - $aResult = array(); - switch(get_class($oAttDef)) - { + $aResult = []; + switch (get_class($oAttDef)) { case 'AttributeExternalKey': case 'AttributeHierarchicalKey': @@ -103,74 +98,56 @@ abstract class TabularBulkExport extends BulkExport $oKeyAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); $sRemoteClass = $oKeyAttDef->GetTargetClass(); $sFriendlyNameAttCode = MetaModel::GetFriendlyNameAttributeCode($sRemoteClass); - if (!is_null($sFriendlyNameAttCode)) - { + if (!is_null($sFriendlyNameAttCode)) { // The friendly name is made of a single attribute, check if that attribute is present as an external field - foreach(MetaModel::ListAttributeDefs($sClass) as $sSubAttCode => $oSubAttDef) - { - if ($oSubAttDef instanceof AttributeExternalField) - { - if (($oSubAttDef->GetKeyAttCode() == $sAttCode) && ($oSubAttDef->GetExtAttCode() == $sFriendlyNameAttCode)) - { + foreach (MetaModel::ListAttributeDefs($sClass) as $sSubAttCode => $oSubAttDef) { + if ($oSubAttDef instanceof AttributeExternalField) { + if (($oSubAttDef->GetKeyAttCode() == $sAttCode) && ($oSubAttDef->GetExtAttCode() == $sFriendlyNameAttCode)) { $bAddFriendlyName = false; } } } } - $aResult[$sAttCode] = array('code' => $sAttCode, 'unique_label' => $oAttDef->GetLabel(), 'label' => Dict::S('UI:CSVImport:idField'), 'attdef' => $oAttDef); + $aResult[$sAttCode] = ['code' => $sAttCode, 'unique_label' => $oAttDef->GetLabel(), 'label' => Dict::S('UI:CSVImport:idField'), 'attdef' => $oAttDef]; - if ($bAddFriendlyName) - { - if ($this->IsExportableField($sClass, $sAttCode.'->friendlyname')) - { - $aResult[$sAttCode.'->friendlyname'] = array('code' => $sAttCode.'->friendlyname', 'unique_label' => $oAttDef->GetLabel().'->'.Dict::S('Core:FriendlyName-Label'), 'label' => Dict::S('Core:FriendlyName-Label'), 'attdef' => MetaModel::GetAttributeDef($sClass, $sAttCode.'_friendlyname')); + if ($bAddFriendlyName) { + if ($this->IsExportableField($sClass, $sAttCode.'->friendlyname')) { + $aResult[$sAttCode.'->friendlyname'] = ['code' => $sAttCode.'->friendlyname', 'unique_label' => $oAttDef->GetLabel().'->'.Dict::S('Core:FriendlyName-Label'), 'label' => Dict::S('Core:FriendlyName-Label'), 'attdef' => MetaModel::GetAttributeDef($sClass, $sAttCode.'_friendlyname')]; } } - foreach(MetaModel::ListAttributeDefs($sClass) as $sSubAttCode => $oSubAttDef) - { - if ($oSubAttDef instanceof AttributeExternalField) - { - if ($this->IsExportableField($sClass, $sSubAttCode, $oSubAttDef)) - { - if ($oSubAttDef->GetKeyAttCode() == $sAttCode) - { + foreach (MetaModel::ListAttributeDefs($sClass) as $sSubAttCode => $oSubAttDef) { + if ($oSubAttDef instanceof AttributeExternalField) { + if ($this->IsExportableField($sClass, $sSubAttCode, $oSubAttDef)) { + if ($oSubAttDef->GetKeyAttCode() == $sAttCode) { $sAttCodeEx = $sAttCode.'->'.$oSubAttDef->GetExtAttCode(); - $aResult[$sAttCodeEx] = array('code' => $sAttCodeEx, 'unique_label' => $oAttDef->GetLabel().'->'.$oSubAttDef->GetExtAttDef()->GetLabel(), 'label' => MetaModel::GetLabel($sRemoteClass, $oSubAttDef->GetExtAttCode()), 'attdef' => $oSubAttDef); + $aResult[$sAttCodeEx] = ['code' => $sAttCodeEx, 'unique_label' => $oAttDef->GetLabel().'->'.$oSubAttDef->GetExtAttDef()->GetLabel(), 'label' => MetaModel::GetLabel($sRemoteClass, $oSubAttDef->GetExtAttCode()), 'attdef' => $oSubAttDef]; } } } } // Add the reconciliation keys - foreach(MetaModel::GetReconcKeys($sRemoteClass) as $sRemoteAttCode) - { - if (!empty($sRemoteAttCode)) - { - $sAttCodeEx = $sAttCode.'->'.$sRemoteAttCode; - if (!array_key_exists($sAttCodeEx, $aResult)) - { - $oRemoteAttDef = MetaModel::GetAttributeDef($sRemoteClass, $sRemoteAttCode); - if ($this->IsExportableField($sRemoteClass, $sRemoteAttCode, $oRemoteAttDef)) - { - $aResult[$sAttCodeEx] = array('code' => $sAttCodeEx, 'unique_label' => $oAttDef->GetLabel().'->'.$oRemoteAttDef->GetLabel(), 'label' => MetaModel::GetLabel($sRemoteClass, $sRemoteAttCode), 'attdef' => $oRemoteAttDef); - } - } - } - } + foreach (MetaModel::GetReconcKeys($sRemoteClass) as $sRemoteAttCode) { + if (!empty($sRemoteAttCode)) { + $sAttCodeEx = $sAttCode.'->'.$sRemoteAttCode; + if (!array_key_exists($sAttCodeEx, $aResult)) { + $oRemoteAttDef = MetaModel::GetAttributeDef($sRemoteClass, $sRemoteAttCode); + if ($this->IsExportableField($sRemoteClass, $sRemoteAttCode, $oRemoteAttDef)) { + $aResult[$sAttCodeEx] = ['code' => $sAttCodeEx, 'unique_label' => $oAttDef->GetLabel().'->'.$oRemoteAttDef->GetLabel(), 'label' => MetaModel::GetLabel($sRemoteClass, $sRemoteAttCode), 'attdef' => $oRemoteAttDef]; + } + } + } + } break; - + case 'AttributeStopWatch': - foreach(MetaModel::ListAttributeDefs($sClass) as $sSubAttCode => $oSubAttDef) - { - if ($oSubAttDef instanceof AttributeSubItem) - { - if ($oSubAttDef->GetParentAttCode() == $sAttCode) - { - if ($this->IsExportableField($sClass, $sSubAttCode, $oSubAttDef)) - { - $aResult[$sSubAttCode] = array('code' => $sSubAttCode, 'unique_label' => $oSubAttDef->GetLabel(), 'label' => $oSubAttDef->GetLabel(), 'attdef' => $oSubAttDef); + foreach (MetaModel::ListAttributeDefs($sClass) as $sSubAttCode => $oSubAttDef) { + if ($oSubAttDef instanceof AttributeSubItem) { + if ($oSubAttDef->GetParentAttCode() == $sAttCode) { + if ($this->IsExportableField($sClass, $sSubAttCode, $oSubAttDef)) { + $aResult[$sSubAttCode] = ['code' => $sSubAttCode, 'unique_label' => $oSubAttDef->GetLabel(), 'label' => $oSubAttDef->GetLabel(), 'attdef' => $oSubAttDef]; } } } @@ -184,85 +161,66 @@ abstract class TabularBulkExport extends BulkExport { $oSet = new DBObjectSet($this->oSearch); $aSelectedClasses = $this->oSearch->GetSelectedClasses(); - $aAuthorizedClasses = array(); - foreach($aSelectedClasses as $sAlias => $sClassName) - { - if (UserRights::IsActionAllowed($sClassName, UR_ACTION_BULK_READ, $oSet) != UR_ALLOWED_NO) - { + $aAuthorizedClasses = []; + foreach ($aSelectedClasses as $sAlias => $sClassName) { + if (UserRights::IsActionAllowed($sClassName, UR_ACTION_BULK_READ, $oSet) != UR_ALLOWED_NO) { $aAuthorizedClasses[$sAlias] = $sClassName; } } - $aAllFieldsByAlias = array(); - $aAllAttCodes = array(); - foreach($aAuthorizedClasses as $sAlias => $sClass) - { - $aAllFields = array(); - if (count($aAuthorizedClasses) > 1 ) - { + $aAllFieldsByAlias = []; + $aAllAttCodes = []; + foreach ($aAuthorizedClasses as $sAlias => $sClass) { + $aAllFields = []; + if (count($aAuthorizedClasses) > 1) { $sShortAlias = $sAlias.'.'; - } - else - { + } else { $sShortAlias = ''; } - if ($this->IsExportableField($sClass, 'id')) - { + if ($this->IsExportableField($sClass, 'id')) { $sFriendlyNameAttCode = MetaModel::GetFriendlyNameAttributeCode($sClass); - if (is_null($sFriendlyNameAttCode)) - { + if (is_null($sFriendlyNameAttCode)) { // The friendly name is made of several attribute - $aSubAttr = array( - array('attcodeex' => 'id', 'code' => $sShortAlias.'id', 'unique_label' => $sShortAlias.Dict::S('UI:CSVImport:idField'), 'label' => $sShortAlias.'id'), - array('attcodeex' => 'friendlyname', 'code' => $sShortAlias.'friendlyname', 'unique_label' => $sShortAlias.Dict::S('Core:FriendlyName-Label'), 'label' => $sShortAlias.Dict::S('Core:FriendlyName-Label')), - ); - } - else - { + $aSubAttr = [ + ['attcodeex' => 'id', 'code' => $sShortAlias.'id', 'unique_label' => $sShortAlias.Dict::S('UI:CSVImport:idField'), 'label' => $sShortAlias.'id'], + ['attcodeex' => 'friendlyname', 'code' => $sShortAlias.'friendlyname', 'unique_label' => $sShortAlias.Dict::S('Core:FriendlyName-Label'), 'label' => $sShortAlias.Dict::S('Core:FriendlyName-Label')], + ]; + } else { // The friendly name has no added value - $aSubAttr = array(); + $aSubAttr = []; } - $aAllFields[] = array('attcodeex' => 'id', 'code' => $sShortAlias.'id', 'unique_label' => $sShortAlias.Dict::S('UI:CSVImport:idField'), 'label' => Dict::S('UI:CSVImport:idField'), 'subattr' => $aSubAttr); + $aAllFields[] = ['attcodeex' => 'id', 'code' => $sShortAlias.'id', 'unique_label' => $sShortAlias.Dict::S('UI:CSVImport:idField'), 'label' => Dict::S('UI:CSVImport:idField'), 'subattr' => $aSubAttr]; } - foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - if($this->IsSubAttribute($sClass, $sAttCode, $oAttDef)) continue; + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if ($this->IsSubAttribute($sClass, $sAttCode, $oAttDef)) { + continue; + } - if ($this->IsExportableField($sClass, $sAttCode, $oAttDef)) - { + if ($this->IsExportableField($sClass, $sAttCode, $oAttDef)) { $sShortLabel = $oAttDef->GetLabel(); $sLabel = $sShortAlias.$oAttDef->GetLabel(); $aSubAttr = $this->GetSubAttributes($sClass, $sAttCode, $oAttDef); - $aValidSubAttr = array(); - foreach($aSubAttr as $aSubAttDef) - { - $aValidSubAttr[] = array('attcodeex' => $aSubAttDef['code'], 'code' => $sShortAlias.$aSubAttDef['code'], 'label' => $aSubAttDef['label'], 'unique_label' => $sShortAlias.$aSubAttDef['unique_label']); + $aValidSubAttr = []; + foreach ($aSubAttr as $aSubAttDef) { + $aValidSubAttr[] = ['attcodeex' => $aSubAttDef['code'], 'code' => $sShortAlias.$aSubAttDef['code'], 'label' => $aSubAttDef['label'], 'unique_label' => $sShortAlias.$aSubAttDef['unique_label']]; } - $aAllFields[] = array('attcodeex' => $sAttCode, 'code' => $sShortAlias.$sAttCode, 'label' => $sShortLabel, 'unique_label' => $sLabel, 'subattr' => $aValidSubAttr); + $aAllFields[] = ['attcodeex' => $sAttCode, 'code' => $sShortAlias.$sAttCode, 'label' => $sShortLabel, 'unique_label' => $sLabel, 'subattr' => $aValidSubAttr]; } } - usort($aAllFields, array(get_class($this), 'SortOnLabel')); - if (count($aAuthorizedClasses) > 1) - { + usort($aAllFields, [get_class($this), 'SortOnLabel']); + if (count($aAuthorizedClasses) > 1) { $sKey = MetaModel::GetName($sClass).' ('.$sAlias.')'; - } - else - { + } else { $sKey = MetaModel::GetName($sClass); } $aAllFieldsByAlias[$sKey] = $aAllFields; - foreach ($aAllFields as $aFieldSpec) - { + foreach ($aAllFields as $aFieldSpec) { $sAttCode = $aFieldSpec['attcodeex']; - if (count($aFieldSpec['subattr']) > 0) - { - foreach ($aFieldSpec['subattr'] as $aSubFieldSpec) - { + if (count($aFieldSpec['subattr']) > 0) { + foreach ($aFieldSpec['subattr'] as $aSubFieldSpec) { $aAllAttCodes[$sAlias][] = $aSubFieldSpec['attcodeex']; } - } - else - { + } else { $aAllAttCodes[$sAlias][] = $sAttCode; } } @@ -274,19 +232,16 @@ abstract class TabularBulkExport extends BulkExport $oSet = new DBObjectSet($this->oSearch); $iCount = $oSet->Count(); - foreach ($this->oSearch->GetSelectedClasses() as $sAlias => $sClass) - { - $aColumns[$sAlias] = array(); + foreach ($this->oSearch->GetSelectedClasses() as $sAlias => $sClass) { + $aColumns[$sAlias] = []; } $oSet->OptimizeColumnLoad($aColumns); $iPreviewLimit = 3; $oSet->SetLimit($iPreviewLimit); - $aSampleData = array(); - while($aRow = $oSet->FetchAssoc()) - { - $aSampleRow = array(); - foreach($aAuthorizedClasses as $sAlias => $sClass) - { + $aSampleData = []; + while ($aRow = $oSet->FetchAssoc()) { + $aSampleRow = []; + foreach ($aAuthorizedClasses as $sAlias => $sClass) { if (count($aAuthorizedClasses) > 1) { $sShortAlias = $sAlias.'.'; } else { @@ -302,7 +257,7 @@ abstract class TabularBulkExport extends BulkExport $aSampleData[] = $aSampleRow; } $sJSSampleData = json_encode($aSampleData); - $aLabels = array( + $aLabels = [ 'preview_header' => Dict::S('Core:BulkExport:DragAndDropHelp'), 'empty_preview' => Dict::S('Core:BulkExport:EmptyPreview'), 'columns_order' => Dict::S('Core:BulkExport:ColumnsOrder'), @@ -310,7 +265,7 @@ abstract class TabularBulkExport extends BulkExport 'check_all' => Dict::S('Core:BulkExport:CheckAll'), 'uncheck_all' => Dict::S('Core:BulkExport:UncheckAll'), 'no_field_selected' => Dict::S('Core:BulkExport:NoFieldSelected'), - ); + ]; $sJSLabels = json_encode($aLabels); $oP->add_ready_script( <<IsScalar(); } protected function GetSampleData($oObj, $sAttCode) { - if ($sAttCode == 'id') return $oObj->GetKey(); + if ($sAttCode == 'id') { + return $oObj->GetKey(); + } return $oObj->GetEditValue($sAttCode); } @@ -357,31 +317,22 @@ EOF parent::ReadParameters(); $sQueryId = utils::ReadParam('query', null, true); $sFields = utils::ReadParam('fields', null, true, 'raw_data'); - if ((($sFields === null) || ($sFields === '')) && ($sQueryId === null)) - { + if ((($sFields === null) || ($sFields === '')) && ($sQueryId === null)) { throw new BulkExportMissingParameterException('fields'); - } - else - { - if (($sQueryId !== null) && ($sQueryId !== null)) - { - $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', array('query_id' => $sQueryId)); + } else { + if (($sQueryId !== null) && ($sQueryId !== null)) { + $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', ['query_id' => $sQueryId]); $oQueries = new DBObjectSet($oSearch); - if ($oQueries->Count() > 0) - { + if ($oQueries->Count() > 0) { $oQuery = $oQueries->Fetch(); - if (($sFields === null) || ($sFields === '')) - { + if (($sFields === null) || ($sFields === '')) { // No 'fields' parameter supplied, take the fields from the query phrasebook definition $sFields = trim($oQuery->Get('fields')); - if ($sFields === '') - { + if ($sFields === '') { throw new BulkExportMissingParameterException('fields'); } } - } - else - { + } else { throw BulkExportException('Invalid value for the parameter: query. There is no Query Phrasebook with id = '.$sQueryId, Dict::Format('Core:BulkExport:InvalidParameter_Query', $sQueryId)); } } @@ -396,72 +347,55 @@ EOF // $aSelectedClasses = $this->oSearch->GetSelectedClasses(); $aAliases = array_keys($aSelectedClasses); - $aAuthorizedClasses = array(); - foreach($aSelectedClasses as $sAlias => $sClassName) - { - if (UserRights::IsActionAllowed($sClassName, UR_ACTION_BULK_READ) == UR_ALLOWED_YES) - { + $aAuthorizedClasses = []; + foreach ($aSelectedClasses as $sAlias => $sClassName) { + if (UserRights::IsActionAllowed($sClassName, UR_ACTION_BULK_READ) == UR_ALLOWED_YES) { $aAuthorizedClasses[$sAlias] = $sClassName; } } $aFields = explode(',', $sFields); - $this->aStatusInfo['fields'] = array(); - foreach($aFields as $sFieldSpec) - { + $this->aStatusInfo['fields'] = []; + foreach ($aFields as $sFieldSpec) { // Trim the values since it's natural to write: fields=name, first_name, org_name instead of fields=name,first_name,org_name $sExtendedAttCode = trim($sFieldSpec); - if (preg_match('/^([^\.]+)\.(.+)$/', $sExtendedAttCode, $aMatches)) - { + if (preg_match('/^([^\.]+)\.(.+)$/', $sExtendedAttCode, $aMatches)) { $sAlias = $aMatches[1]; $sAttCode = $aMatches[2]; - } - else - { + } else { $sAlias = reset($aAliases); $sAttCode = $sExtendedAttCode; } - if (!array_key_exists($sAlias, $aSelectedClasses)) - { + if (!array_key_exists($sAlias, $aSelectedClasses)) { throw new Exception("Invalid alias '$sAlias' for the column '$sExtendedAttCode'. Availables aliases: '".implode("', '", $aAliases)."'"); } $sClass = $aSelectedClasses[$sAlias]; - if (!array_key_exists($sAlias, $aAuthorizedClasses)) - { + if (!array_key_exists($sAlias, $aAuthorizedClasses)) { throw new Exception("You do not have enough permissions to bulk read data of class '$sClass' (alias: $sAlias)"); } - - if ($this->bLocalizeOutput) - { - try - { + + if ($this->bLocalizeOutput) { + try { $sLabel = MetaModel::GetLabel($sClass, $sAttCode); - } - catch (Exception $e) - { + } catch (Exception $e) { throw new Exception("Wrong field specification '$sFieldSpec': ".$e->getMessage()); - } - } - else - { + } + } else { $sLabel = $sAttCode; } - if (count($aAuthorizedClasses) > 1) - { + if (count($aAuthorizedClasses) > 1) { $sColLabel = $sAlias.'.'.$sLabel; - } - else - { + } else { $sColLabel = $sLabel; } - $this->aStatusInfo['fields'][] = array( + $this->aStatusInfo['fields'][] = [ 'sFieldSpec' => $sExtendedAttCode, 'sAlias' => $sAlias, 'sClass' => $sClass, 'sAttCode' => $sAttCode, 'sLabel' => $sLabel, - 'sColLabel' => $sColLabel - ); + 'sColLabel' => $sColLabel, + ]; } } @@ -470,29 +404,23 @@ EOF */ protected function OptimizeColumnLoad(DBObjectSet $oSet) { - $aColumnsToLoad = array(); + $aColumnsToLoad = []; - foreach($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) - { + foreach ($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) { $sClass = $aFieldSpec['sClass']; $sAlias = $aFieldSpec['sAlias']; $sAttCode = $aFieldSpec['sAttCode']; - - if (!array_key_exists($sAlias, $aColumnsToLoad)) - { - $aColumnsToLoad[$sAlias] = array(); + + if (!array_key_exists($sAlias, $aColumnsToLoad)) { + $aColumnsToLoad[$sAlias] = []; } // id is not a real attribute code and, moreover, is always loaded - if ($sAttCode != 'id') - { + if ($sAttCode != 'id') { // Extended attributes are not recognized by DBObjectSet::OptimizeColumnLoad - if (($iPos = strpos($sAttCode, '->')) === false) - { + if (($iPos = strpos($sAttCode, '->')) === false) { $aColumnsToLoad[$sAlias][] = $sAttCode; $sClass = '???'; - } - else - { + } else { $sExtKeyAttCode = substr($sAttCode, 0, $iPos); $sRemoteAttCode = substr($sAttCode, $iPos + 2); @@ -501,8 +429,7 @@ EOF // Load the external field (if any) to avoid getting the remote object (see DBObject::Get that does the same) $oExtFieldAtt = MetaModel::FindExternalField($sClass, $sExtKeyAttCode, $sRemoteAttCode); - if (!is_null($oExtFieldAtt)) - { + if (!is_null($oExtFieldAtt)) { $aColumnsToLoad[$sAlias][] = $oExtFieldAtt->GetCode(); } } @@ -512,17 +439,14 @@ EOF // Add "always loaded attributes" // $aSelectedClasses = $this->oSearch->GetSelectedClasses(); - foreach ($aSelectedClasses as $sAlias => $sClass) - { - foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - if ($oAttDef->AlwaysLoadInTables()) - { + foreach ($aSelectedClasses as $sAlias => $sClass) { + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if ($oAttDef->AlwaysLoadInTables()) { $aColumnsToLoad[$sAlias][] = $sAttCode; } } } $oSet->OptimizeColumnLoad($aColumnsToLoad); - } + } } diff --git a/core/tagsetfield.class.inc.php b/core/tagsetfield.class.inc.php index 28ad86ad0..3e119831d 100644 --- a/core/tagsetfield.class.inc.php +++ b/core/tagsetfield.class.inc.php @@ -1,4 +1,5 @@ Stores data for {@link AttributeTagSet} fields * @@ -31,7 +31,7 @@ use Combodo\iTop\Application\WebPage\WebPage; */ abstract class TagSetFieldData extends cmdbAbstractObject { - private static $m_aAllowedValues = array(); + private static $m_aAllowedValues = []; /** * @throws \CoreException @@ -39,62 +39,61 @@ abstract class TagSetFieldData extends cmdbAbstractObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ 'category' => 'bizmodel', 'key_type' => 'autoincrement', - 'name_attcode' => array('label'), + 'name_attcode' => ['label'], 'state_attcode' => '', - 'reconc_keys' => array('code'), + 'reconc_keys' => ['code'], 'db_table' => 'priv_tagfielddata', 'db_key_field' => 'id', 'db_finalclass_field' => 'finalclass', - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("code", array( + MetaModel::Init_AddAttribute(new AttributeString("code", [ "allowed_values" => null, "sql" => 'code', "default_value" => '', "is_null_allowed" => false, - "depends_on" => array(), + "depends_on" => [], "validation_pattern" => '^[a-zA-Z][a-zA-Z0-9]{2,}$', - ))); - MetaModel::Init_AddAttribute(new AttributeString("label", array( + ])); + MetaModel::Init_AddAttribute(new AttributeString("label", [ "allowed_values" => null, "sql" => 'label', "default_value" => '', "is_null_allowed" => false, - "depends_on" => array() - ))); - MetaModel::Init_AddAttribute(new AttributeHTML("description", array( + "depends_on" => [], + ])); + MetaModel::Init_AddAttribute(new AttributeHTML("description", [ "allowed_values" => null, "sql" => 'description', "default_value" => '', "is_null_allowed" => true, - "depends_on" => array() - ))); - MetaModel::Init_AddAttribute(new AttributeString("obj_class", array( + "depends_on" => [], + ])); + MetaModel::Init_AddAttribute(new AttributeString("obj_class", [ "allowed_values" => null, "sql" => 'obj_class', "default_value" => '', "is_null_allowed" => false, - "depends_on" => array() - ))); - MetaModel::Init_AddAttribute(new AttributeString("obj_attcode", array( + "depends_on" => [], + ])); + MetaModel::Init_AddAttribute(new AttributeString("obj_attcode", [ "allowed_values" => null, "sql" => 'obj_attcode', "default_value" => '', "is_null_allowed" => false, - "depends_on" => array() - ))); + "depends_on" => [], + ])); - - MetaModel::Init_SetZListItems('details', array('code', 'label', 'description')); - MetaModel::Init_SetZListItems('standard_search', array('code', 'label', 'description')); - MetaModel::Init_SetZListItems('list', array('code', 'label', 'description')); + MetaModel::Init_SetZListItems('details', ['code', 'label', 'description']); + MetaModel::Init_SetZListItems('standard_search', ['code', 'label', 'description']); + MetaModel::Init_SetZListItems('list', ['code', 'label', 'description']); } public function ComputeValues() @@ -122,15 +121,12 @@ abstract class TagSetFieldData extends cmdbAbstractObject */ public static function ExtractTagFieldName($sClassName) { - $aRes = array(); + $aRes = []; // Extract class and attcode from class name using pattern TagSetFieldDataFor__>; - if (preg_match('@^TagSetFieldDataFor_(?\w+)__(?\w+)$@', $sClassName, $aMatches)) - { + if (preg_match('@^TagSetFieldDataFor_(?\w+)__(?\w+)$@', $sClassName, $aMatches)) { $aRes['obj_class'] = $aMatches['class']; $aRes['obj_attcode'] = $aMatches['attcode']; - } - else - { + } else { throw new CoreException("Bad Class name format: $sClassName"); } return $aRes; @@ -146,8 +142,7 @@ abstract class TagSetFieldData extends cmdbAbstractObject parent::DoCheckToDelete($oDeletionPlan); $sTagCode = $this->Get('code'); - if ($this->IsCodeUsed($sTagCode)) - { + if ($this->IsCodeUsed($sTagCode)) { $this->m_aDeleteIssues[] = Dict::S('Core:TagSetFieldData:ErrorDeleteUsedTag'); } // Clear cache @@ -172,34 +167,28 @@ abstract class TagSetFieldData extends cmdbAbstractObject $sAttCode = $this->Get('obj_attcode'); $iMaxLen = 20; $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - if ($oAttDef instanceof AttributeTagSet) - { + if ($oAttDef instanceof AttributeTagSet) { $iMaxLen = $oAttDef->GetTagCodeMaxLength(); } $sTagCode = $this->Get('code'); // Check code syntax $iMax = $iMaxLen - 1; - if (!preg_match("@^[a-zA-Z][a-zA-Z0-9]{2,$iMax}$@", $sTagCode)) - { + if (!preg_match("@^[a-zA-Z][a-zA-Z0-9]{2,$iMax}$@", $sTagCode)) { $this->m_aCheckIssues[] = Dict::Format('Core:TagSetFieldData:ErrorTagCodeSyntax', $iMaxLen); } // Check that the code is not a MySQL stop word $sSQL = "SELECT value FROM information_schema.INNODB_FT_DEFAULT_STOPWORD"; - try - { + try { $aResults = CMDBSource::QueryToArray($sSQL); - } catch (MySQLException $e) - { + } catch (MySQLException $e) { IssueLog::Warning($e->getMessage()); - $aResults = array(); + $aResults = []; } - foreach($aResults as $aResult) - { - if ($aResult['value'] == $sTagCode) - { + foreach ($aResults as $aResult) { + if ($aResult['value'] == $sTagCode) { $this->m_aCheckIssues[] = Dict::S('Core:TagSetFieldData:ErrorTagCodeReservedWord'); break; } @@ -207,8 +196,7 @@ abstract class TagSetFieldData extends cmdbAbstractObject $sTagLabel = $this->Get('label'); $sSepItem = MetaModel::GetConfig()->Get('tag_set_item_separator'); - if (empty($sTagLabel) || (strpos($sTagLabel, $sSepItem) !== false)) - { + if (empty($sTagLabel) || (strpos($sTagLabel, $sSepItem) !== false)) { // Label must not contain | character $this->m_aCheckIssues[] = Dict::Format('Core:TagSetFieldData:ErrorTagLabelSyntax', $sSepItem); } @@ -216,18 +204,14 @@ abstract class TagSetFieldData extends cmdbAbstractObject // Check that code and labels are uniques $id = $this->GetKey(); $sClassName = get_class($this); - if (empty($id)) - { + if (empty($id)) { $oSearch = DBSearch::FromOQL("SELECT $sClassName WHERE (code = :tag_code OR label = :tag_label)"); - } - else - { + } else { $oSearch = DBSearch::FromOQL("SELECT $sClassName WHERE id != :id AND (code = :tag_code OR label = :tag_label)"); } - $aArgs = array('id' => $id, 'tag_code' => $sTagCode, 'tag_label' => $sTagLabel); - $oSet = new DBObjectSet($oSearch, array(), $aArgs); - if ($oSet->CountExceeds(0)) - { + $aArgs = ['id' => $id, 'tag_code' => $sTagCode, 'tag_label' => $sTagLabel]; + $oSet = new DBObjectSet($oSearch, [], $aArgs); + if ($oSet->CountExceeds(0)) { $this->m_aCheckIssues[] = Dict::S('Core:TagSetFieldData:ErrorDuplicateTagCodeOrLabel'); } // Clear cache @@ -244,50 +228,40 @@ abstract class TagSetFieldData extends cmdbAbstractObject { parent::OnUpdate(); $aChanges = $this->ListChanges(); - if (array_key_exists('code', $aChanges)) - { + if (array_key_exists('code', $aChanges)) { $sTagCode = $this->GetOriginal('code'); - if ($this->IsCodeUsed($sTagCode)) - { + if ($this->IsCodeUsed($sTagCode)) { throw new CoreException(Dict::S('Core:TagSetFieldData:ErrorCodeUpdateNotAllowed')); } } - if (array_key_exists('obj_class', $aChanges)) - { + if (array_key_exists('obj_class', $aChanges)) { throw new CoreException(Dict::S('Core:TagSetFieldData:ErrorClassUpdateNotAllowed')); } - if (array_key_exists('obj_attcode', $aChanges)) - { + if (array_key_exists('obj_attcode', $aChanges)) { throw new CoreException(Dict::S('Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed')); } } private function IsCodeUsed($sTagCode) { - try - { + try { $sClass = $this->Get('obj_class'); $sAttCode = $this->Get('obj_attcode'); $oSearch = DBSearch::FromOQL("SELECT $sClass WHERE $sAttCode MATCHES '$sTagCode'"); $oSet = new DBObjectSet($oSearch); - if ($oSet->CountExceeds(0)) - { + if ($oSet->CountExceeds(0)) { return true; } - } - catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Warning($e->getMessage()); } return false; } - public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '') + public function GetAttributeFlags($sAttCode, &$aReasons = [], $sTargetState = '') { - if ($sAttCode == 'code') - { - if ((!$this->IsNew()) && ($this->IsCodeUsed($this->Get('code')))) - { + if ($sAttCode == 'code') { + if ((!$this->IsNew()) && ($this->IsCodeUsed($this->Get('code')))) { return OPT_ATT_READONLY; } } @@ -308,23 +282,20 @@ abstract class TagSetFieldData extends cmdbAbstractObject * @throws \MySQLHasGoneAwayException * @throws \OQLException */ - function DisplayBareRelations(WebPage $oPage, $bEditMode = false) + public function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); - if (!$bEditMode) - { + if (!$bEditMode) { $sClass = $this->Get('obj_class'); $sAttCode = $this->Get('obj_attcode'); $sTagCode = $this->Get('code'); - $oFilter = DBSearch::FromOQL("SELECT $sClass WHERE $sAttCode MATCHES '$sTagCode'"); $oSet = new DBObjectSet($oFilter); $iCount = $oSet->Count(); $oPage->SetCurrentTab('Core:TagSetFieldData:WhereIsThisTagTab', Dict::Format('Core:TagSetFieldData:WhereIsThisTagTab', $iCount)); - if ($iCount === 0) - { + if ($iCount === 0) { $sNoEntries = Dict::S('Core:TagSetFieldData:NoEntryFound'); $oPage->add("

          $sNoEntries

          "); @@ -333,8 +304,7 @@ abstract class TagSetFieldData extends cmdbAbstractObject $oFilter = DBSearch::FromOQL("SELECT $sClass WHERE $sAttCode MATCHES '$sTagCode'"); $oSet = new DBObjectSet($oFilter); - if ($oSet->CountExceeds(0)) - { + if ($oSet->CountExceeds(0)) { $sClassLabel = MetaModel::GetName($sClass); $oPage->add("

          $sClassLabel

          "); $oResultBlock = new DisplayBlock($oFilter, 'list', false); @@ -345,26 +315,20 @@ abstract class TagSetFieldData extends cmdbAbstractObject public static function GetClassName($sClass) { - if ($sClass == 'TagSetFieldData') - { + if ($sClass == 'TagSetFieldData') { $aWords = preg_split('/(?=[A-Z]+)/', $sClass); return trim(implode(' ', $aWords)); } - try - { + try { $aTagFieldInfo = self::ExtractTagFieldName($sClass); - } catch (CoreException $e) - { + } catch (CoreException $e) { return $sClass; } $sClassDesc = MetaModel::GetName($aTagFieldInfo['obj_class']); $sAttDesc = MetaModel::GetAttributeDef($aTagFieldInfo['obj_class'], $aTagFieldInfo['obj_attcode'])->GetLabel(); - if (Dict::Exists("Class:$sClass")) - { + if (Dict::Exists("Class:$sClass")) { $sName = Dict::Format("Class:$sClass", $sClassDesc, $sAttDesc); - } - else - { + } else { $sName = Dict::Format('Class:TagSetFieldData', $sClassDesc, $sAttDesc); } return $sName; @@ -383,8 +347,7 @@ abstract class TagSetFieldData extends cmdbAbstractObject { $sClass = MetaModel::GetAttributeOrigin($sClass, $sAttCode); $sTagDataClass = self::GetTagDataClassName($sClass, $sAttCode); - if (!isset(self::$m_aAllowedValues[$sTagDataClass])) - { + if (!isset(self::$m_aAllowedValues[$sTagDataClass])) { $oSearch = new DBObjectSearch($sTagDataClass); $oSearch->AddCondition('obj_class', $sClass); $oSearch->AddCondition('obj_attcode', $sAttCode); @@ -394,4 +357,4 @@ abstract class TagSetFieldData extends cmdbAbstractObject return self::$m_aAllowedValues[$sTagDataClass]; } -} \ No newline at end of file +} diff --git a/core/tar-itop.class.inc.php b/core/tar-itop.class.inc.php index c7d3dbfd3..744bd1db1 100644 --- a/core/tar-itop.class.inc.php +++ b/core/tar-itop.class.inc.php @@ -1,4 +1,5 @@ - /** * Simple helper class to interpret and transform a template string * @@ -70,22 +70,20 @@ class TemplateString * * @throws \Exception */ - protected function Analyze($aParamTypes = array()) + protected function Analyze($aParamTypes = []) { - if (!is_null($this->m_aPlaceholders)) return; + if (!is_null($this->m_aPlaceholders)) { + return; + } - $this->m_aPlaceholders = array(); - if (preg_match_all('/\\$([a-z0-9_]+(->[a-z0-9_]+)*)\\$/', $this->m_sRaw, $aMatches)) - { - foreach($aMatches[1] as $sPlaceholder) - { + $this->m_aPlaceholders = []; + if (preg_match_all('/\\$([a-z0-9_]+(->[a-z0-9_]+)*)\\$/', $this->m_sRaw, $aMatches)) { + foreach ($aMatches[1] as $sPlaceholder) { $oPlaceholder = new TemplateStringPlaceholder($sPlaceholder); $oPlaceholder->bIsValid = false; - foreach ($aParamTypes as $sParamName => $sClass) - { + foreach ($aParamTypes as $sParamName => $sClass) { $sParamPrefix = $sParamName.'->'; - if (substr($sPlaceholder, 0, strlen($sParamPrefix)) == $sParamPrefix) - { + if (substr($sPlaceholder, 0, strlen($sParamPrefix)) == $sParamPrefix) { // Todo - detect functions (label...) $oPlaceholder->sFunction = ''; @@ -118,20 +116,16 @@ class TemplateString * * @return boolean */ - public function IsValid($aParamTypes = array()) + public function IsValid($aParamTypes = []) { $this->Analyze($aParamTypes); - foreach($this->m_aPlaceholders as $oPlaceholder) - { - if (!$oPlaceholder->bIsValid) - { - if (count($aParamTypes) == 0) - { + foreach ($this->m_aPlaceholders as $oPlaceholder) { + if (!$oPlaceholder->bIsValid) { + if (count($aParamTypes) == 0) { return false; } - if (array_key_exists($oPlaceholder->sParamName, $aParamTypes)) - { + if (array_key_exists($oPlaceholder->sParamName, $aParamTypes)) { return false; } } @@ -146,39 +140,31 @@ class TemplateString * * @return string */ - public function Render($aParamValues = array()) + public function Render($aParamValues = []) { - $aParamTypes = array(); - foreach($aParamValues as $sParamName => $value) - { + $aParamTypes = []; + foreach ($aParamValues as $sParamName => $value) { $aParamTypes[$sParamName] = get_class($value); } $this->Analyze($aParamTypes); - $aSearch = array(); - $aReplace = array(); - foreach($this->m_aPlaceholders as $oPlaceholder) - { - if (array_key_exists($oPlaceholder->sParamName, $aParamValues)) - { + $aSearch = []; + $aReplace = []; + foreach ($this->m_aPlaceholders as $oPlaceholder) { + if (array_key_exists($oPlaceholder->sParamName, $aParamValues)) { $oRef = $aParamValues[$oPlaceholder->sParamName]; - try - { + try { $value = $oRef->Get($oPlaceholder->sAttCode); $aSearch[] = '$'.$oPlaceholder->sToken.'$'; $aReplace[] = $value; $oPlaceholder->bIsValid = true; - } - catch(Exception $e) - { + } catch (Exception $e) { $oPlaceholder->bIsValid = false; } - } - else - { + } else { $oPlaceholder->bIsValid = false; } } return str_replace($aSearch, $aReplace, $this->m_sRaw); } -} \ No newline at end of file +} diff --git a/core/trigger.class.inc.php b/core/trigger.class.inc.php index e458a9959..e6a475166 100644 --- a/core/trigger.class.inc.php +++ b/core/trigger.class.inc.php @@ -1,4 +1,5 @@ "grant_by_profile,core/cmdb", "key_type" => "autoincrement", "name_attcode" => "description", @@ -43,21 +44,23 @@ abstract class Trigger extends cmdbAbstractObject "db_key_field" => "id", "db_finalclass_field" => "realclass", 'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-conflict.svg'), - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("action_list", - array("linked_class" => "lnkTriggerAction", "ext_key_to_me" => "trigger_id", "ext_key_to_remote" => "action_id", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeString("description", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect( + "action_list", + ["linked_class" => "lnkTriggerAction", "ext_key_to_me" => "trigger_id", "ext_key_to_remote" => "action_id", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => []] + )); $aTags = ContextTag::GetTags(); - MetaModel::Init_AddAttribute(new AttributeEnumSet("context", array("allowed_values" => null, "possible_values" => new ValueSetEnumPadded($aTags, true), "sql" => "context", "depends_on" => array(), "is_null_allowed" => true, "max_items" => 12))); + MetaModel::Init_AddAttribute(new AttributeEnumSet("context", ["allowed_values" => null, "possible_values" => new ValueSetEnumPadded($aTags, true), "sql" => "context", "depends_on" => [], "is_null_allowed" => true, "max_items" => 12])); // "complement" is a computed field, fed by Trigger sub-classes, in general in ComputeValues method, for eg. the TriggerOnObject fed it with target_class info - MetaModel::Init_AddAttribute(new AttributeString("complement", array("allowed_values" => null, "sql" => "complement", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("subscription_policy", array("allowed_values" => new ValueSetEnum(Combodo\iTop\Core\Trigger\Enum\SubscriptionPolicy::cases()), "sql" => "subscription_policy", "default_value" => \Combodo\iTop\Core\Trigger\Enum\SubscriptionPolicy::AllowNoChannel->value, "is_null_allowed" => false, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeString("complement", ["allowed_values" => null, "sql" => "complement", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("subscription_policy", ["allowed_values" => new ValueSetEnum(Combodo\iTop\Core\Trigger\Enum\SubscriptionPolicy::cases()), "sql" => "subscription_policy", "default_value" => \Combodo\iTop\Core\Trigger\Enum\SubscriptionPolicy::AllowNoChannel->value, "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('finalclass', 'description', 'context', 'subscription_policy', 'action_list', 'complement')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('finalclass', 'complement')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['finalclass', 'description', 'context', 'subscription_policy', 'action_list', 'complement']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['finalclass', 'complement']); // Attributes to be displayed for a list // Search criteria // MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form @@ -76,17 +79,14 @@ abstract class Trigger extends cmdbAbstractObject $oContext = $this->Get('context'); $bChecked = false; $bValid = false; - foreach ($oContext->GetValues() as $sValue) - { + foreach ($oContext->GetValues() as $sValue) { $bChecked = true; - if (ContextTag::Check($sValue)) - { + if (ContextTag::Check($sValue)) { $bValid = true; break; } } - if ($bChecked && !$bValid) - { + if ($bChecked && !$bValid) { // Trigger does not match the current context return false; } @@ -103,8 +103,7 @@ abstract class Trigger extends cmdbAbstractObject public function DoActivate($aContextArgs) { // Check the context - if (!$this->IsContextValid()) - { + if (!$this->IsContextValid()) { // Trigger does not match the current context $sClass = get_class($this); $sName = $this->Get('friendlyname'); @@ -126,7 +125,7 @@ abstract class Trigger extends cmdbAbstractObject // Execute actions foreach ($aActionListOrdered as $aActionSubList) { - foreach ($aActionSubList as $oLink) /** @var \DBObject $oLink */ { + foreach ($aActionSubList as $oLink) { /** @var \DBObject $oLink */ /** @var \DBObject $oLink */ $iActionId = $oLink->Get('action_id'); /** @var \Action $oAction */ @@ -168,8 +167,8 @@ abstract class TriggerOnObject extends Trigger */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb", "key_type" => "autoincrement", "name_attcode" => "description", @@ -179,17 +178,17 @@ abstract class TriggerOnObject extends Trigger "db_table" => "priv_trigger_onobject", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeClass("target_class", array("class_category" => "bizmodel", "more_values" => "User,UserExternal,UserInternal,UserLDAP,UserLocal", "sql" => "target_class", "default_value" => null, "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeOQL("filter", array("allowed_values" => null, "sql" => "filter", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeClass("target_class", ["class_category" => "bizmodel", "more_values" => "User,UserExternal,UserInternal,UserLDAP,UserLocal", "sql" => "target_class", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeOQL("filter", ["allowed_values" => null, "sql" => "filter", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('description', 'context', 'target_class', 'filter', 'subscription_policy', 'action_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('finalclass', 'target_class', 'description')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['description', 'context', 'target_class', 'filter', 'subscription_policy', 'action_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['finalclass', 'target_class', 'description']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('default_search', array('description', 'target_class')); // Default criteria of the search banner + MetaModel::Init_SetZListItems('default_search', ['description', 'target_class']); // Default criteria of the search banner // MetaModel::Init_SetZListItems('standard_search', array('name', 'target_class', 'description')); // Criteria of the search form } @@ -201,18 +200,14 @@ abstract class TriggerOnObject extends Trigger parent::DoCheckToWrite(); $sFilter = trim($this->Get('filter') ?? ''); - if (strlen($sFilter) > 0) - { - try - { + if (strlen($sFilter) > 0) { + try { $oSearch = DBObjectSearch::FromOQL($sFilter); - if (!MetaModel::IsParentClass($this->Get('target_class'), $oSearch->GetClass())) - { + if (!MetaModel::IsParentClass($this->Get('target_class'), $oSearch->GetClass())) { $this->m_aCheckIssues[] = Dict::Format('TriggerOnObject:WrongFilterClass', $this->Get('target_class')); } - } catch (OqlException $e) - { + } catch (OqlException $e) { $this->m_aCheckIssues[] = Dict::Format('TriggerOnObject:WrongFilterQuery', $e->getMessage()); } } @@ -232,7 +227,6 @@ abstract class TriggerOnObject extends Trigger $this->Set('complement', 'class restriction: '.$this->Get('target_class')); } - /** * Check whether the given object is in the scope of this trigger * and can potentially be the subject of notifications @@ -258,14 +252,12 @@ abstract class TriggerOnObject extends Trigger public function DoActivate($aContextArgs) { $bGo = true; - if (isset($aContextArgs['this->object()'])) - { + if (isset($aContextArgs['this->object()'])) { /** @var \DBObject $oObject */ $oObject = $aContextArgs['this->object()']; $bGo = $this->IsTargetObject($oObject->GetKey(), $oObject->ListPreviousValuesForUpdatedAttributes()); } - if ($bGo) - { + if ($bGo) { parent::DoActivate($aContextArgs); } } @@ -286,8 +278,7 @@ abstract class TriggerOnObject extends Trigger */ public function DoActivateForSpecificAttributes(array $aContextArgs, ?array $aAttributes) { - if (isset($aContextArgs['this->object()'])) - { + if (isset($aContextArgs['this->object()'])) { /** @var \DBObject $oObject */ $oObject = $aContextArgs['this->object()']; if (is_null($aAttributes)) { @@ -314,7 +305,7 @@ abstract class TriggerOnObject extends Trigger * @throws \MySQLHasGoneAwayException * @throws \OQLException */ - public function IsTargetObject($iObjectId, $aChanges = array()) + public function IsTargetObject($iObjectId, $aChanges = []) { $sFilter = trim($this->Get('filter') ?? ''); if (strlen($sFilter) > 0) { @@ -371,8 +362,8 @@ class TriggerOnPortalUpdate extends TriggerOnObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb,application", "key_type" => "autoincrement", "name_attcode" => "description", @@ -382,13 +373,13 @@ class TriggerOnPortalUpdate extends TriggerOnObject "db_table" => "priv_trigger_onportalupdate", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); // Display lists - MetaModel::Init_SetZListItems('details', array('description', 'context', 'target_class', 'filter', 'subscription_policy', 'action_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('finalclass', 'target_class', 'description')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['description', 'context', 'target_class', 'filter', 'subscription_policy', 'action_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['finalclass', 'target_class', 'description']); // Attributes to be displayed for a list // Search criteria } } @@ -404,8 +395,8 @@ abstract class TriggerOnStateChange extends TriggerOnObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb", "key_type" => "autoincrement", "name_attcode" => "description", @@ -415,16 +406,16 @@ abstract class TriggerOnStateChange extends TriggerOnObject "db_table" => "priv_trigger_onstatechange", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeClassState("state", array("class_field" => 'target_class', "allowed_values" => null, "sql" => "state", "default_value" => null, "is_null_allowed" => false, "depends_on" => array('target_class')))); + MetaModel::Init_AddAttribute(new AttributeClassState("state", ["class_field" => 'target_class', "allowed_values" => null, "sql" => "state", "default_value" => null, "is_null_allowed" => false, "depends_on" => ['target_class']])); // Display lists - MetaModel::Init_SetZListItems('details', array('description', 'context', 'target_class', 'filter', 'state', 'subscription_policy', 'action_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('finalclass', 'target_class', 'state')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['description', 'context', 'target_class', 'filter', 'state', 'subscription_policy', 'action_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['finalclass', 'target_class', 'state']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('description', 'target_class', 'state')); // Criteria of the std search form + MetaModel::Init_SetZListItems('standard_search', ['description', 'target_class', 'state']); // Criteria of the std search form // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } } @@ -439,8 +430,8 @@ class TriggerOnStateEnter extends TriggerOnStateChange */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb,application", "key_type" => "autoincrement", "name_attcode" => "description", @@ -450,15 +441,15 @@ class TriggerOnStateEnter extends TriggerOnStateChange "db_table" => "priv_trigger_onstateenter", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); // Display lists - MetaModel::Init_SetZListItems('details', array('description', 'context', 'target_class', 'filter', 'state', 'subscription_policy', 'action_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('target_class', 'state')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['description', 'context', 'target_class', 'filter', 'state', 'subscription_policy', 'action_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['target_class', 'state']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('description', 'target_class', 'state')); // Criteria of the std search form + MetaModel::Init_SetZListItems('standard_search', ['description', 'target_class', 'state']); // Criteria of the std search form // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } } @@ -473,8 +464,8 @@ class TriggerOnStateLeave extends TriggerOnStateChange */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb,application", "key_type" => "autoincrement", "name_attcode" => "description", @@ -484,15 +475,15 @@ class TriggerOnStateLeave extends TriggerOnStateChange "db_table" => "priv_trigger_onstateleave", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); // Display lists - MetaModel::Init_SetZListItems('details', array('description', 'context', 'target_class', 'filter', 'state', 'subscription_policy', 'action_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('target_class', 'state')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['description', 'context', 'target_class', 'filter', 'state', 'subscription_policy', 'action_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['target_class', 'state']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('description', 'target_class', 'state')); // Criteria of the std search form + MetaModel::Init_SetZListItems('standard_search', ['description', 'target_class', 'state']); // Criteria of the std search form // MetaModel::Init_SetZListItems('advanced_search', array('')); // Criteria of the advanced search form } } @@ -507,8 +498,8 @@ class TriggerOnObjectCreate extends TriggerOnObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb,application", "key_type" => "autoincrement", "name_attcode" => "description", @@ -518,15 +509,15 @@ class TriggerOnObjectCreate extends TriggerOnObject "db_table" => "priv_trigger_onobjcreate", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); // Display lists - MetaModel::Init_SetZListItems('details', array('description', 'context', 'target_class', 'filter', 'subscription_policy', 'action_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('finalclass', 'target_class')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['description', 'context', 'target_class', 'filter', 'subscription_policy', 'action_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['finalclass', 'target_class']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('description', 'target_class')); // Criteria of the std search form + MetaModel::Init_SetZListItems('standard_search', ['description', 'target_class']); // Criteria of the std search form // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } } @@ -541,8 +532,8 @@ class TriggerOnObjectDelete extends TriggerOnObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb,application", "key_type" => "autoincrement", "name_attcode" => "description", @@ -552,15 +543,15 @@ class TriggerOnObjectDelete extends TriggerOnObject "db_table" => "priv_trigger_onobjdelete", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); // Display lists - MetaModel::Init_SetZListItems('details', array('description', 'context', 'target_class', 'filter', 'subscription_policy', 'action_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('finalclass', 'target_class')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['description', 'context', 'target_class', 'filter', 'subscription_policy', 'action_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['finalclass', 'target_class']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('description', 'target_class')); // Criteria of the std search form + MetaModel::Init_SetZListItems('standard_search', ['description', 'target_class']); // Criteria of the std search form // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } } @@ -576,8 +567,8 @@ class TriggerOnObjectUpdate extends TriggerOnObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb,application", "key_type" => "autoincrement", "name_attcode" => "description", @@ -587,37 +578,33 @@ class TriggerOnObjectUpdate extends TriggerOnObject "db_table" => "priv_trigger_onobjupdate", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeClassAttCodeSet('target_attcodes', array("allowed_values" => null, "class_field" => "target_class", "sql" => "target_attcodes", "default_value" => null, "is_null_allowed" => true, "max_items" => 20, "min_items" => 0, "attribute_definition_exclusion_list" => "AttributeDashboard,AttributeExternalField,AttributeFinalClass,AttributeFriendlyName,AttributeObsolescenceDate,AttributeObsolescenceFlag,AttributeSubItem", "attribute_definition_list" => null, "depends_on" => array('target_class')))); + MetaModel::Init_AddAttribute(new AttributeClassAttCodeSet('target_attcodes', ["allowed_values" => null, "class_field" => "target_class", "sql" => "target_attcodes", "default_value" => null, "is_null_allowed" => true, "max_items" => 20, "min_items" => 0, "attribute_definition_exclusion_list" => "AttributeDashboard,AttributeExternalField,AttributeFinalClass,AttributeFriendlyName,AttributeObsolescenceDate,AttributeObsolescenceFlag,AttributeSubItem", "attribute_definition_list" => null, "depends_on" => ['target_class']])); // Display lists - MetaModel::Init_SetZListItems('details', array('description', 'context', 'target_class', 'filter', 'target_attcodes', 'subscription_policy', 'action_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('finalclass', 'target_class')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['description', 'context', 'target_class', 'filter', 'target_attcodes', 'subscription_policy', 'action_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['finalclass', 'target_class']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('description', 'target_class')); // Criteria of the std search form + MetaModel::Init_SetZListItems('standard_search', ['description', 'target_class']); // Criteria of the std search form } - public function IsTargetObject($iObjectId, $aChanges = array()) + public function IsTargetObject($iObjectId, $aChanges = []) { - if (!parent::IsTargetObject($iObjectId, $aChanges)) - { + if (!parent::IsTargetObject($iObjectId, $aChanges)) { return false; } // Check the attribute $oAttCodeSet = $this->Get('target_attcodes'); $aAttCodes = $oAttCodeSet->GetValues(); - if (empty($aAttCodes)) - { + if (empty($aAttCodes)) { return true; } - foreach($aAttCodes as $sAttCode) - { - if (array_key_exists($sAttCode, $aChanges)) - { + foreach ($aAttCodes as $sAttCode) { + if (array_key_exists($sAttCode, $aChanges)) { return true; } } @@ -630,26 +617,22 @@ class TriggerOnObjectUpdate extends TriggerOnObject // Remove unwanted attribute codes $aChanges = $this->ListChanges(); - if (isset($aChanges['target_attcodes'])) - { + if (isset($aChanges['target_attcodes'])) { $oAttDef = MetaModel::GetAttributeDef(get_class($this), 'target_attcodes'); - $aArgs = array('this' => $this); + $aArgs = ['this' => $this]; $aAllowedValues = $oAttDef->GetAllowedValues($aArgs); /** @var \ormSet $oValue */ $oValue = $this->Get('target_attcodes'); $aValues = $oValue->GetValues(); $bChanged = false; - foreach($aValues as $key => $sValue) - { - if (!isset($aAllowedValues[$sValue])) - { + foreach ($aValues as $key => $sValue) { + if (!isset($aAllowedValues[$sValue])) { unset($aValues[$key]); $bChanged = true; } } - if ($bChanged) - { + if ($bChanged) { $oValue->SetValues($aValues); $this->Set('target_attcodes', $oValue); } @@ -672,8 +655,8 @@ class TriggerOnObjectMention extends TriggerOnObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb,application", "key_type" => "autoincrement", "name_attcode" => "description", @@ -684,16 +667,16 @@ class TriggerOnObjectMention extends TriggerOnObject "db_key_field" => "id", "db_finalclass_field" => "", "display_template" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeOQL("mentioned_filter", array("allowed_values" => null, "sql" => "mentioned_filter", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeOQL("mentioned_filter", ["allowed_values" => null, "sql" => "mentioned_filter", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('description', 'context', 'target_class', 'filter', 'mentioned_filter', 'subscription_policy', 'action_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('finalclass', 'target_class')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['description', 'context', 'target_class', 'filter', 'mentioned_filter', 'subscription_policy', 'action_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['finalclass', 'target_class']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('description', 'target_class')); // Criteria of the std search form + MetaModel::Init_SetZListItems('standard_search', ['description', 'target_class']); // Criteria of the std search form } /** @@ -711,8 +694,7 @@ class TriggerOnObjectMention extends TriggerOnObject public function IsMentionedObjectInScope(DBObject $oObject) { $sFilter = trim($this->Get('mentioned_filter')); - if (strlen($sFilter) > 0) - { + if (strlen($sFilter) > 0) { $oSearch = DBObjectSearch::FromOQL($sFilter); $sSearchClass = $oSearch->GetClass(); @@ -729,9 +711,7 @@ class TriggerOnObjectMention extends TriggerOnObject $aParams = $oObject->ToArgs('this'); $oSet = new DBObjectSet($oSearch, [], $aParams); $bRet = $oSet->CountExceeds(0); - } - else - { + } else { $bRet = true; } @@ -753,8 +733,8 @@ class TriggerOnAttributeBlobDownload extends TriggerOnObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb,application", "key_type" => "autoincrement", "name_attcode" => "description", @@ -765,7 +745,7 @@ class TriggerOnAttributeBlobDownload extends TriggerOnObject "db_key_field" => "id", "db_finalclass_field" => "", "display_template" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); } @@ -782,42 +762,42 @@ class lnkTriggerAction extends cmdbAbstractObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb,application", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array('action_id', 'trigger_id'), + "reconc_keys" => ['action_id', 'trigger_id'], "db_table" => "priv_link_action_trigger", "db_key_field" => "link_id", "db_finalclass_field" => "", "is_link" => true, - 'uniqueness_rules' => array( - 'no_duplicate' => array( - 'attributes' => array( + 'uniqueness_rules' => [ + 'no_duplicate' => [ + 'attributes' => [ 0 => 'action_id', 1 => 'trigger_id', - ), + ], 'filter' => '', 'disabled' => false, 'is_blocking' => true, - ), - ), - ); + ], + ], + ]; MetaModel::Init_Params($aParams); - MetaModel::Init_AddAttribute(new AttributeExternalKey("action_id", array("targetclass" => "Action", "jointype" => '', "allowed_values" => null, "sql" => "action_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("action_name", array("allowed_values" => null, "extkey_attcode" => 'action_id', "target_attcode" => "name"))); - MetaModel::Init_AddAttribute(new AttributeExternalKey("trigger_id", array("targetclass" => "Trigger", "jointype" => '', "allowed_values" => null, "sql" => "trigger_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("trigger_name", array("allowed_values" => null, "extkey_attcode" => 'trigger_id', "target_attcode" => "description"))); - MetaModel::Init_AddAttribute(new AttributeInteger("order", array("allowed_values" => null, "sql" => "order", "default_value" => 0, "is_null_allowed" => true, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("action_id", ["targetclass" => "Action", "jointype" => '', "allowed_values" => null, "sql" => "action_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("action_name", ["allowed_values" => null, "extkey_attcode" => 'action_id', "target_attcode" => "name"])); + MetaModel::Init_AddAttribute(new AttributeExternalKey("trigger_id", ["targetclass" => "Trigger", "jointype" => '', "allowed_values" => null, "sql" => "trigger_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("trigger_name", ["allowed_values" => null, "extkey_attcode" => 'trigger_id', "target_attcode" => "description"])); + MetaModel::Init_AddAttribute(new AttributeInteger("order", ["allowed_values" => null, "sql" => "order", "default_value" => 0, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('action_id', 'trigger_id', 'order')); // Attributes to be displayed for a list - MetaModel::Init_SetZListItems('list', array('action_id', 'trigger_id', 'order')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['action_id', 'trigger_id', 'order']); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('list', ['action_id', 'trigger_id', 'order']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('action_id', 'trigger_id', 'order')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('action_id', 'trigger_id', 'order')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['action_id', 'trigger_id', 'order']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['action_id', 'trigger_id', 'order']); // Criteria of the advanced search form } } @@ -832,8 +812,8 @@ class TriggerOnThresholdReached extends TriggerOnObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb,application", "key_type" => "autoincrement", "name_attcode" => "description", @@ -843,18 +823,18 @@ class TriggerOnThresholdReached extends TriggerOnObject "db_table" => "priv_trigger_threshold", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeClassAttCodeSet('stop_watch_code', array("allowed_values" => null, "class_field" => "target_class", "sql" => "stop_watch_code", "default_value" => null, "is_null_allowed" => false, "max_items" => 1, "min_items" => 1, "attribute_definition_exclusion_list" => null, "attribute_definition_list" => "AttributeStopWatch", "include_child_classes_attributes" => true, "depends_on" => array('target_class')))); - MetaModel::Init_AddAttribute(new AttributeString("threshold_index", array("allowed_values" => null, "sql" => "threshold_index", "default_value" => null, "is_null_allowed" => false, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeClassAttCodeSet('stop_watch_code', ["allowed_values" => null, "class_field" => "target_class", "sql" => "stop_watch_code", "default_value" => null, "is_null_allowed" => false, "max_items" => 1, "min_items" => 1, "attribute_definition_exclusion_list" => null, "attribute_definition_list" => "AttributeStopWatch", "include_child_classes_attributes" => true, "depends_on" => ['target_class']])); + MetaModel::Init_AddAttribute(new AttributeString("threshold_index", ["allowed_values" => null, "sql" => "threshold_index", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('description', 'context', 'target_class', 'stop_watch_code', 'threshold_index', 'filter', 'subscription_policy', 'action_list')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('target_class', 'threshold_index', 'threshold_index')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['description', 'context', 'target_class', 'stop_watch_code', 'threshold_index', 'filter', 'subscription_policy', 'action_list']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['target_class', 'threshold_index', 'threshold_index']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('description', 'target_class')); // Criteria of the std search form + MetaModel::Init_SetZListItems('standard_search', ['description', 'target_class']); // Criteria of the std search form // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } } diff --git a/core/userrights.class.inc.php b/core/userrights.class.inc.php index 14ea0cb69..317f0fa99 100644 --- a/core/userrights.class.inc.php +++ b/core/userrights.class.inc.php @@ -50,7 +50,7 @@ abstract class UserRightsAddOnAPI * * @return mixed */ - abstract public function GetSelectFilter($sLogin, $sClass, $aSettings = array()); // returns a filter object + abstract public function GetSelectFilter($sLogin, $sClass, $aSettings = []); // returns a filter object /** * @param \User $oUser @@ -110,7 +110,7 @@ abstract class UserRightsAddOnAPI */ public function ListProfiles($oUser) { - return array(); + return []; } /** @@ -127,14 +127,12 @@ abstract class UserRightsAddOnAPI * @throws \MySQLException * @throws \MySQLHasGoneAwayException */ - public function MakeSelectFilter($sClass, $aAllowedOrgs, $aSettings = array(), $sAttCode = null) + public function MakeSelectFilter($sClass, $aAllowedOrgs, $aSettings = [], $sAttCode = null) { - if ($sAttCode == null) - { + if ($sAttCode == null) { $sAttCode = $this->GetOwnerOrganizationAttCode($sClass); } - if (empty($sAttCode)) - { + if (empty($sAttCode)) { return $oFilter = new DBObjectSearch($sClass); } @@ -145,10 +143,8 @@ abstract class UserRightsAddOnAPI $oCondition = new BinaryExpression($oExpression, 'IN', $oListExpr); $oFilter->AddConditionExpression($oCondition); - if ($this->HasSharing()) - { - if (($sAttCode == 'id') && isset($aSettings['bSearchMode']) && $aSettings['bSearchMode']) - { + if ($this->HasSharing()) { + if (($sAttCode == 'id') && isset($aSettings['bSearchMode']) && $aSettings['bSearchMode']) { // Querying organizations (or derived) // and the expected list of organizations will be used as a search criteria // Therefore the query can also return organization having objects shared with the allowed organizations @@ -162,22 +158,19 @@ abstract class UserRightsAddOnAPI $oSearchSharers = new DBObjectSearch('Organization'); $oSearchSharers->AllowAllData(); $oSearchSharers->AddCondition_ReferencedBy($oShareSearch, 'sharing_org_id'); - $aSharers = array(); - foreach($oSearchSharers->SelectAttributeToArray('id') as $aRow) - { + $aSharers = []; + foreach ($oSearchSharers->SelectAttributeToArray('id') as $aRow) { $aSharers[] = $aRow['id']; } // 2) Enlarge the overall results: ... OR id IN(id1, id2, id3) - if (count($aSharers) > 0) - { + if (count($aSharers) > 0) { $oSharersList = ListExpression::FromScalars($aSharers); $oFilter->MergeConditionExpression(new BinaryExpression($oExpression, 'IN', $oSharersList)); } } $aShareProperties = SharedObject::GetSharedClassProperties($sClass); - if ($aShareProperties) - { + if ($aShareProperties) { $sShareClass = $aShareProperties['share_class']; $sShareAttCode = $aShareProperties['attcode']; @@ -187,13 +180,11 @@ abstract class UserRightsAddOnAPI $sHierarchicalKeyCode = MetaModel::IsHierarchicalClass('Organization'); $oOrgField = new FieldExpression('org_id', $sShareClass); $oSearchShares->AddConditionExpression(new BinaryExpression($oOrgField, 'IN', $oListExpr)); - $aShared = array(); - foreach($oSearchShares->SelectAttributeToArray($sShareAttCode) as $aRow) - { + $aShared = []; + foreach ($oSearchShares->SelectAttributeToArray($sShareAttCode) as $aRow) { $aShared[] = $aRow[$sShareAttCode]; } - if (count($aShared) > 0) - { + if (count($aShared) > 0) { $oObjId = new FieldExpression('id', $sClass); $oSharedIdList = ListExpression::FromScalars($aShared); $oFilter->MergeConditionExpression(new BinaryExpression($oObjId, 'IN', $oSharedIdList)); @@ -205,7 +196,6 @@ abstract class UserRightsAddOnAPI } } - require_once(APPROOT.'/application/cmdbabstract.class.inc.php'); abstract class User extends cmdbAbstractObject { @@ -214,31 +204,31 @@ abstract class User extends cmdbAbstractObject */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core,grant_by_profile,silo", "key_type" => "autoincrement", "name_attcode" => "login", "state_attcode" => "status", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_user", "db_key_field" => "id", "db_finalclass_field" => "", "style" => new ormStyle("ibo-dm-class--User", "ibo-dm-class-alt--User", "var(--ibo-dm-class--User--main-color)", "var(--ibo-dm-class--User--complementary-color)", null, "itop-structure/../../images/icons/icons8-security-pass.svg"), - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("contactid", array("targetclass" => "Person", "allowed_values" => null, "sql" => "contactid", "is_null_allowed" => true, "on_target_delete" => DEL_MANUAL, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeExternalField("last_name", array("allowed_values" => null, "extkey_attcode" => 'contactid', "target_attcode" => "name"))); - MetaModel::Init_AddAttribute(new AttributeExternalField("first_name", array("allowed_values" => null, "extkey_attcode" => 'contactid', "target_attcode" => "first_name"))); - MetaModel::Init_AddAttribute(new AttributeExternalField("email", array("allowed_values" => null, "extkey_attcode" => 'contactid', "target_attcode" => "email"))); - MetaModel::Init_AddAttribute(new AttributeExternalField("org_id", array("allowed_values" => null, "extkey_attcode" => 'contactid', "target_attcode" => "org_id"))); + MetaModel::Init_AddAttribute(new AttributeExternalKey("contactid", ["targetclass" => "Person", "allowed_values" => null, "sql" => "contactid", "is_null_allowed" => true, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalField("last_name", ["allowed_values" => null, "extkey_attcode" => 'contactid', "target_attcode" => "name"])); + MetaModel::Init_AddAttribute(new AttributeExternalField("first_name", ["allowed_values" => null, "extkey_attcode" => 'contactid', "target_attcode" => "first_name"])); + MetaModel::Init_AddAttribute(new AttributeExternalField("email", ["allowed_values" => null, "extkey_attcode" => 'contactid', "target_attcode" => "email"])); + MetaModel::Init_AddAttribute(new AttributeExternalField("org_id", ["allowed_values" => null, "extkey_attcode" => 'contactid', "target_attcode" => "org_id"])); - MetaModel::Init_AddAttribute(new AttributeString("login", array("allowed_values" => null, "sql" => "login", "default_value" => null, "is_null_allowed" => false, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeString("login", ["allowed_values" => null, "sql" => "login", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); - MetaModel::Init_AddAttribute(new AttributeApplicationLanguage("language", array("sql" => "language", "default_value" => "EN US", "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeEnum("status", array( + MetaModel::Init_AddAttribute(new AttributeApplicationLanguage("language", ["sql" => "language", "default_value" => "EN US", "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeEnum("status", [ "allowed_values" => new ValueSetEnum('enabled,disabled'), "styled_values" => [ 'enabled' => new ormStyle('ibo-dm-enum--User-status-enabled', 'ibo-dm-enum-alt--User-status-enabled', 'var(--ibo-dm-enum--User-status-enabled--main-color)', 'var(--ibo-dm-enum--User-status-enabled--complementary-color)', null, null), @@ -247,19 +237,19 @@ abstract class User extends cmdbAbstractObject "sql" => "status", "default_value" => "enabled", "is_null_allowed" => false, - "depends_on" => array(), - ))); + "depends_on" => [], + ])); - MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("profile_list",array("linked_class" => "URP_UserProfile", "ext_key_to_me" => "userid", "ext_key_to_remote" => "profileid", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => array(), "display_style" => 'property', "with_php_constraint" => true, "with_php_computation" => true))); - MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("allowed_org_list", array("linked_class" => "URP_UserOrg", "ext_key_to_me" => "userid", "ext_key_to_remote" => "allowed_org_id", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => array(), 'with_php_constraint' => true))); - MetaModel::Init_AddAttribute(new AttributeCaseLog("log", array("sql" => 'log', "is_null_allowed" => true, "default_value" => '', "allowed_values" => null, "depends_on" => array(), "always_load_in_tables" => false))); + MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("profile_list", ["linked_class" => "URP_UserProfile", "ext_key_to_me" => "userid", "ext_key_to_remote" => "profileid", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => [], "display_style" => 'property', "with_php_constraint" => true, "with_php_computation" => true])); + MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("allowed_org_list", ["linked_class" => "URP_UserOrg", "ext_key_to_me" => "userid", "ext_key_to_remote" => "allowed_org_id", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => [], 'with_php_constraint' => true])); + MetaModel::Init_AddAttribute(new AttributeCaseLog("log", ["sql" => 'log', "is_null_allowed" => true, "default_value" => '', "allowed_values" => null, "depends_on" => [], "always_load_in_tables" => false])); // Display lists - MetaModel::Init_SetZListItems('details', array('contactid', 'org_id', 'email', 'login', 'language', 'status', 'profile_list', 'allowed_org_list', 'log')); // Unused as it's an abstract class ! - MetaModel::Init_SetZListItems('list', array('finalclass', 'first_name', 'last_name', 'status', 'org_id')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['contactid', 'org_id', 'email', 'login', 'language', 'status', 'profile_list', 'allowed_org_list', 'log']); // Unused as it's an abstract class ! + MetaModel::Init_SetZListItems('list', ['finalclass', 'first_name', 'last_name', 'status', 'org_id']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('login', 'contactid', 'email', 'language', 'status', 'org_id')); // Criteria of the std search form - MetaModel::Init_SetZListItems('default_search', array('login', 'contactid', 'status', 'org_id')); // Default criteria of the search banner + MetaModel::Init_SetZListItems('standard_search', ['login', 'contactid', 'email', 'language', 'status', 'org_id']); // Criteria of the std search form + MetaModel::Init_SetZListItems('default_search', ['login', 'contactid', 'status', 'org_id']); // Default criteria of the search banner } protected function RegisterEventListeners() @@ -288,25 +278,18 @@ abstract class User extends cmdbAbstractObject */ public function GetFriendlyName() { - if (!MetaModel::IsValidAttCode(get_class($this), 'contactid')) - { + if (!MetaModel::IsValidAttCode(get_class($this), 'contactid')) { return $this->Get('login'); } - if ($this->Get('contactid') != 0) - { + if ($this->Get('contactid') != 0) { $sFirstName = $this->Get('first_name'); $sLastName = $this->Get('last_name'); $sEmail = $this->Get('email'); - if (strlen($sFirstName) > 0) - { + if (strlen($sFirstName) > 0) { return "$sFirstName $sLastName"; - } - elseif (strlen($sEmail) > 0) - { + } elseif (strlen($sEmail) > 0) { return "$sLastName <$sEmail>"; - } - else - { + } else { return $sLastName; } } @@ -343,10 +326,8 @@ abstract class User extends cmdbAbstractObject */ public function GetContactObject() { - if (is_null($this->oContactObject)) - { - if (MetaModel::IsValidAttCode(get_class($this), 'contactid') && ($this->Get('contactid') != 0)) - { + if (is_null($this->oContactObject)) { + if (MetaModel::IsValidAttCode(get_class($this), 'contactid') && ($this->Get('contactid') != 0)) { $this->oContactObject = null; // The User Contact is generally a Person, so try it first if (MetaModel::IsValidClass('Person')) { @@ -373,13 +354,13 @@ abstract class User extends cmdbAbstractObject $aChanges = $this->ListChanges(); if (array_key_exists('login', $aChanges)) { // Check login uniqueness - if ( $this->GetOriginal('login') === null || strcasecmp($this->Get('login'), $this->GetOriginal('login')) !== 0) { + if ($this->GetOriginal('login') === null || strcasecmp($this->Get('login'), $this->GetOriginal('login')) !== 0) { $sNewLogin = $aChanges['login']; $oSearch = DBObjectSearch::FromOQL_AllData("SELECT User WHERE login = :newlogin"); if (!$this->IsNew()) { $oSearch->AddCondition('id', $this->GetKey(), '!='); } - $oSet = new DBObjectSet($oSearch, array(), array('newlogin' => $sNewLogin)); + $oSet = new DBObjectSet($oSearch, [], ['newlogin' => $sNewLogin]); if ($oSet->Count() > 0) { $this->m_aCheckIssues[] = Dict::Format('Class:User/Error:LoginMustBeUnique', $sNewLogin); } @@ -457,7 +438,7 @@ abstract class User extends cmdbAbstractObject } // Warning if the user has no associated contact elseif (empty($this->Get('contactid'))) { - $this->AddCheckWarning(Dict::S('Class:User/Warning:NoContactHasImpact')); + $this->AddCheckWarning(Dict::S('Class:User/Warning:NoContactHasImpact')); } // Allowed orgs must contain the user org (if any) @@ -537,7 +518,7 @@ abstract class User extends cmdbAbstractObject } } - function GetGrantAsHtml($sClass, $iAction) + public function GetGrantAsHtml($sClass, $iAction) { if (UserRights::IsActionAllowed($sClass, $iAction, null, $this)) { return ''.Dict::S('UI:UserManagement:ActionAllowed:Yes').''; @@ -546,10 +527,9 @@ abstract class User extends cmdbAbstractObject } } - function DoShowGrantSumary($oPage, $sClassCategory) + public function DoShowGrantSumary($oPage, $sClassCategory) { - if (UserRights::IsAdministrator($this)) - { + if (UserRights::IsAdministrator($this)) { // Looks dirty, but ok that's THE ONE $oPage->p(Dict::S('UI:UserManagement:AdminProfile+')); return; @@ -557,28 +537,22 @@ abstract class User extends cmdbAbstractObject $oKPI = new ExecutionKPI(); - $aDisplayData = array(); - foreach (MetaModel::GetClasses($sClassCategory) as $sClass) - { + $aDisplayData = []; + foreach (MetaModel::GetClasses($sClassCategory) as $sClass) { $aClassStimuli = MetaModel::EnumStimuli($sClass); - if (count($aClassStimuli) > 0) - { - $aStimuli = array(); - foreach ($aClassStimuli as $sStimulusCode => $oStimulus) - { - if (UserRights::IsStimulusAllowed($sClass, $sStimulusCode, null, $this)) - { + if (count($aClassStimuli) > 0) { + $aStimuli = []; + foreach ($aClassStimuli as $sStimulusCode => $oStimulus) { + if (UserRights::IsStimulusAllowed($sClass, $sStimulusCode, null, $this)) { $aStimuli[] = ''.utils::EscapeHtml($oStimulus->GetLabel()).''; } } $sStimuli = implode(', ', $aStimuli); - } - else - { + } else { $sStimuli = ''.Dict::S('UI:UserManagement:NoLifeCycleApplicable').''; } - $aDisplayData[] = array( + $aDisplayData[] = [ 'class' => MetaModel::GetName($sClass), 'read' => $this->GetGrantAsHtml($sClass, UR_ACTION_READ), 'bulkread' => $this->GetGrantAsHtml($sClass, UR_ACTION_BULK_READ), @@ -587,24 +561,24 @@ abstract class User extends cmdbAbstractObject 'delete' => $this->GetGrantAsHtml($sClass, UR_ACTION_DELETE), 'bulkdelete' => $this->GetGrantAsHtml($sClass, UR_ACTION_BULK_DELETE), 'stimuli' => $sStimuli, - ); + ]; } $oKPI->ComputeAndReport('Computation of user rights'); - $aDisplayConfig = array(); - $aDisplayConfig['class'] = array('label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+')); - $aDisplayConfig['read'] = array('label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+')); - $aDisplayConfig['bulkread'] = array('label' => Dict::S('UI:UserManagement:Action:BulkRead'), 'description' => Dict::S('UI:UserManagement:Action:BulkRead+')); - $aDisplayConfig['write'] = array('label' => Dict::S('UI:UserManagement:Action:Modify'), 'description' => Dict::S('UI:UserManagement:Action:Modify+')); - $aDisplayConfig['bulkwrite'] = array('label' => Dict::S('UI:UserManagement:Action:BulkModify'), 'description' => Dict::S('UI:UserManagement:Action:BulkModify+')); - $aDisplayConfig['delete'] = array('label' => Dict::S('UI:UserManagement:Action:Delete'), 'description' => Dict::S('UI:UserManagement:Action:Delete+')); - $aDisplayConfig['bulkdelete'] = array('label' => Dict::S('UI:UserManagement:Action:BulkDelete'), 'description' => Dict::S('UI:UserManagement:Action:BulkDelete+')); - $aDisplayConfig['stimuli'] = array('label' => Dict::S('UI:UserManagement:Action:Stimuli'), 'description' => Dict::S('UI:UserManagement:Action:Stimuli+')); + $aDisplayConfig = []; + $aDisplayConfig['class'] = ['label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+')]; + $aDisplayConfig['read'] = ['label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+')]; + $aDisplayConfig['bulkread'] = ['label' => Dict::S('UI:UserManagement:Action:BulkRead'), 'description' => Dict::S('UI:UserManagement:Action:BulkRead+')]; + $aDisplayConfig['write'] = ['label' => Dict::S('UI:UserManagement:Action:Modify'), 'description' => Dict::S('UI:UserManagement:Action:Modify+')]; + $aDisplayConfig['bulkwrite'] = ['label' => Dict::S('UI:UserManagement:Action:BulkModify'), 'description' => Dict::S('UI:UserManagement:Action:BulkModify+')]; + $aDisplayConfig['delete'] = ['label' => Dict::S('UI:UserManagement:Action:Delete'), 'description' => Dict::S('UI:UserManagement:Action:Delete+')]; + $aDisplayConfig['bulkdelete'] = ['label' => Dict::S('UI:UserManagement:Action:BulkDelete'), 'description' => Dict::S('UI:UserManagement:Action:BulkDelete+')]; + $aDisplayConfig['stimuli'] = ['label' => Dict::S('UI:UserManagement:Action:Stimuli'), 'description' => Dict::S('UI:UserManagement:Action:Stimuli+')]; $oPage->table($aDisplayConfig, $aDisplayData); } - function DisplayBareRelations(WebPage $oPage, $bEditMode = false) + public function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); @@ -612,8 +586,7 @@ abstract class User extends cmdbAbstractObject $this->DoShowGrantSumary($oPage, 'bizmodel,grant_by_profile'); // debug - if (false) - { + if (false) { $oPage->SetCurrentTab('More on user rigths (dev only)'); $oPage->add("

          User rights

          \n"); $this->DoShowGrantSumary($oPage, 'addon/userrights'); @@ -627,23 +600,21 @@ abstract class User extends cmdbAbstractObject } } - public function CheckToDelete(&$oDeletionPlan) - { - if (MetaModel::GetConfig()->Get('demo_mode')) - { + public function CheckToDelete(&$oDeletionPlan) + { + if (MetaModel::GetConfig()->Get('demo_mode')) { // Users deletion is NOT allowed in demo mode $oDeletionPlan->AddToDelete($this, null); - $oDeletionPlan->SetDeletionIssues($this, array('deletion not allowed in demo mode.'), true); + $oDeletionPlan->SetDeletionIssues($this, ['deletion not allowed in demo mode.'], true); $oDeletionPlan->ComputeResults(); return false; } return parent::CheckToDelete($oDeletionPlan); - } + } protected function DBDeleteSingleObject() { - if (MetaModel::GetConfig()->Get('demo_mode')) - { + if (MetaModel::GetConfig()->Get('demo_mode')) { // Users deletion is NOT allowed in demo mode return; } @@ -677,28 +648,28 @@ abstract class UserInternal extends User // Nothing special, just a base class to categorize this type of authenticated users public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core,grant_by_profile,silo", "key_type" => "autoincrement", "name_attcode" => "login", "state_attcode" => "", - "reconc_keys" => array('login'), + "reconc_keys" => ['login'], "db_table" => "priv_internaluser", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); // When set, this token allows for password reset - MetaModel::Init_AddAttribute(new AttributeOneWayPassword("reset_pwd_token", array("allowed_values" => null, "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); + MetaModel::Init_AddAttribute(new AttributeOneWayPassword("reset_pwd_token", ["allowed_values" => null, "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('contactid', 'org_id', 'email', 'login', 'status', 'language', 'profile_list', 'allowed_org_list', 'log')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('finalclass', 'first_name', 'last_name', 'status', 'org_id')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['contactid', 'org_id', 'email', 'login', 'status', 'language', 'profile_list', 'allowed_org_list', 'log']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['finalclass', 'first_name', 'last_name', 'status', 'org_id']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('login', 'contactid', 'status', 'org_id')); // Criteria of the std search form + MetaModel::Init_SetZListItems('standard_search', ['login', 'contactid', 'status', 'org_id']); // Criteria of the std search form } /** @@ -714,28 +685,23 @@ abstract class UserInternal extends User */ public function GetResetPasswordEmail() { - if (!MetaModel::IsValidAttCode(get_class($this), 'contactid')) - { + if (!MetaModel::IsValidAttCode(get_class($this), 'contactid')) { throw new Exception(Dict::S('UI:ResetPwd-Error-NoContact')); } $iContactId = $this->Get('contactid'); - if ($iContactId == 0) - { + if ($iContactId == 0) { throw new Exception(Dict::S('UI:ResetPwd-Error-NoContact')); } $oContact = MetaModel::GetObject('Contact', $iContactId); // Determine the email attribute (the first one will be our choice) - foreach (MetaModel::ListAttributeDefs(get_class($oContact)) as $sAttCode => $oAttDef) - { - if ($oAttDef instanceof AttributeEmailAddress) - { + foreach (MetaModel::ListAttributeDefs(get_class($oContact)) as $sAttCode => $oAttDef) { + if ($oAttDef instanceof AttributeEmailAddress) { $sEmailAttCode = $sAttCode; // we've got one, exit the loop break; } } - if (!isset($sEmailAttCode)) - { + if (!isset($sEmailAttCode)) { throw new Exception(Dict::S('UI:ResetPwd-Error-NoEmailAtt')); } $sRes = trim($oContact->Get($sEmailAttCode)); @@ -779,11 +745,11 @@ interface iSelfRegister */ class UserRights { - const DEFAULT_USER_CONTACT_ID_ATTCODE = 'contactid'; - const DEFAULT_CONTACT_ORG_ID_ATTCODE = 'org_id'; - const DEFAULT_CONTACT_ORG_ID_FRIENDLYNAME_ATTCODE = self::DEFAULT_CONTACT_ORG_ID_ATTCODE.'_friendlyname'; - const DEFAULT_CONTACT_FIRSTNAME_ATTCODE = 'first_name'; - const DEFAULT_CONTACT_PICTURE_ATTCODE = 'picture'; + public const DEFAULT_USER_CONTACT_ID_ATTCODE = 'contactid'; + public const DEFAULT_CONTACT_ORG_ID_ATTCODE = 'org_id'; + public const DEFAULT_CONTACT_ORG_ID_FRIENDLYNAME_ATTCODE = self::DEFAULT_CONTACT_ORG_ID_ATTCODE.'_friendlyname'; + public const DEFAULT_CONTACT_FIRSTNAME_ATTCODE = 'first_name'; + public const DEFAULT_CONTACT_PICTURE_ATTCODE = 'picture'; public static $m_aCacheUsers; /** @var array Associative array of user's ID => user's picture URL */ @@ -793,8 +759,8 @@ class UserRights protected static $m_oUser = null; protected static $m_oRealUser = null; protected static $m_sSelfRegisterAddOn = null; - protected static $m_aAdmins = array(); - protected static $m_aPortalUsers = array(); + protected static $m_aAdmins = []; + protected static $m_aPortalUsers = []; /** @var array array('sName' => $sName, 'bSuccess' => $bSuccess); */ private static $m_sLastLoginStatus = null; @@ -817,15 +783,13 @@ class UserRights */ public static function SelectModule($sModuleName) { - if (!class_exists($sModuleName)) - { + if (!class_exists($sModuleName)) { throw new CoreException("Could not select this module, '$sModuleName' in not a valid class name"); } - if (!is_subclass_of($sModuleName, 'UserRightsAddOnAPI')) - { + if (!is_subclass_of($sModuleName, 'UserRightsAddOnAPI')) { throw new CoreException("Could not select this module, the class '$sModuleName' is not derived from UserRightsAddOnAPI"); } - self::$m_oAddOn = new $sModuleName; + self::$m_oAddOn = new $sModuleName(); self::$m_oAddOn->Init(); self::ResetCurrentUserData(); } @@ -838,8 +802,7 @@ class UserRights */ public static function SelectSelfRegister($sModuleName) { - if (!class_exists($sModuleName)) - { + if (!class_exists($sModuleName)) { throw new CoreException("Could not select the class, '$sModuleName' for self register, is not a valid class name"); } self::$m_sSelfRegisterAddOn = $sModuleName; @@ -874,12 +837,9 @@ class UserRights */ public static function IsLoggedIn() { - if (self::$m_oUser == null) - { + if (self::$m_oUser == null) { return false; - } - else - { + } else { return true; } } @@ -899,14 +859,12 @@ class UserRights self::ResetCurrentUserData(); $oUser = self::FindUser($sLogin, $sAuthentication); - if (is_null($oUser)) - { + if (is_null($oUser)) { return false; } self::$m_oUser = $oUser; - if (Session::IsSet('impersonate_user')) - { + if (Session::IsSet('impersonate_user')) { self::$m_oRealUser = self::$m_oUser; self::$m_oUser = self::FindUser(Session::Get('impersonate_user')); } @@ -940,31 +898,26 @@ class UserRights public static function CheckCredentials($sLogin, $sPassword, $sLoginMode = 'form', $sAuthentication = 'any') { $oUser = self::FindUser($sLogin, $sAuthentication); - if (is_null($oUser)) - { + if (is_null($oUser)) { // Check if the user does not exist at all or if it is just disabled - if (self::FindUser($sLogin, $sAuthentication, true) == null) - { + if (self::FindUser($sLogin, $sAuthentication, true) == null) { // User does not exist at all $bCheckCredentialsAndCreateUser = self::CheckCredentialsAndCreateUser($sLogin, $sPassword, $sLoginMode, $sAuthentication); - self::$m_sLastLoginStatus = array('sName' => $sLogin, 'bSuccess' => $bCheckCredentialsAndCreateUser); + self::$m_sLastLoginStatus = ['sName' => $sLogin, 'bSuccess' => $bCheckCredentialsAndCreateUser]; return $bCheckCredentialsAndCreateUser; - } - else - { + } else { // User is actually disabled - self::$m_sLastLoginStatus = array('sName' => $sLogin, 'bSuccess' => false); + self::$m_sLastLoginStatus = ['sName' => $sLogin, 'bSuccess' => false]; return false; } } - if (!$oUser->CheckCredentials($sPassword)) - { - self::$m_sLastLoginStatus = array('sName' => $sLogin, 'bSuccess' => false); + if (!$oUser->CheckCredentials($sPassword)) { + self::$m_sLastLoginStatus = ['sName' => $sLogin, 'bSuccess' => false]; return false; } self::UpdateUser($oUser, $sLoginMode, $sAuthentication); - self::$m_sLastLoginStatus = array('sName' => $sLogin, 'bSuccess' => true); + self::$m_sLastLoginStatus = ['sName' => $sLogin, 'bSuccess' => true]; return true; } @@ -979,9 +932,8 @@ class UserRights */ public static function CheckCredentialsAndCreateUser($sName, $sPassword, $sLoginMode, $sAuthentication) { - if (self::$m_sSelfRegisterAddOn != null) - { - return call_user_func(array(self::$m_sSelfRegisterAddOn, 'CheckCredentialsAndCreateUser'), $sName, $sPassword, $sLoginMode, $sAuthentication); + if (self::$m_sSelfRegisterAddOn != null) { + return call_user_func([self::$m_sSelfRegisterAddOn, 'CheckCredentialsAndCreateUser'], $sName, $sPassword, $sLoginMode, $sAuthentication); } } @@ -992,9 +944,8 @@ class UserRights */ public static function UpdateUser($oUser, $sLoginMode, $sAuthentication) { - if (self::$m_sSelfRegisterAddOn != null) - { - call_user_func(array(self::$m_sSelfRegisterAddOn, 'UpdateUser'), $oUser, $sLoginMode, $sAuthentication); + if (self::$m_sSelfRegisterAddOn != null) { + call_user_func([self::$m_sSelfRegisterAddOn, 'UpdateUser'], $oUser, $sLoginMode, $sAuthentication); } } @@ -1003,12 +954,9 @@ class UserRights */ public static function TrustWebServerContext() { - if (!is_null(self::$m_oUser)) - { - return self::$m_oUser->TrustWebServerContext(); - } - else - { + if (!is_null(self::$m_oUser)) { + return self::$m_oUser->TrustWebServerContext(); + } else { return false; } } @@ -1021,16 +969,11 @@ class UserRights */ public static function CanBrowseArchive() { - if (is_null(self::$m_oUser)) - { + if (is_null(self::$m_oUser)) { $bRet = false; - } - elseif (Session::IsSet('archive_allowed')) - { + } elseif (Session::IsSet('archive_allowed')) { $bRet = Session::Get('archive_allowed'); - } - else - { + } else { // As of now, anybody can switch to the archive mode as soon as there is an archivable class $bRet = (count(MetaModel::EnumArchivableClasses()) > 0); Session::Set('archive_allowed', $bRet); @@ -1043,17 +986,13 @@ class UserRights */ public static function CanChangePassword() { - if (MetaModel::DBIsReadOnly()) - { + if (MetaModel::DBIsReadOnly()) { return false; } - if (!is_null(self::$m_oUser)) - { - return self::$m_oUser->CanChangePassword(); - } - else - { + if (!is_null(self::$m_oUser)) { + return self::$m_oUser->CanChangePassword(); + } else { return false; } } @@ -1068,21 +1007,15 @@ class UserRights */ public static function ChangePassword($sOldPassword, $sNewPassword, $sLogin = '') { - if (empty($sLogin)) - { + if (empty($sLogin)) { $oUser = self::$m_oUser; - } - else - { + } else { // find the id out of the login string $oUser = self::FindUser($sLogin); } - if (is_null($oUser)) - { + if (is_null($oUser)) { return false; - } - else - { + } else { $oUser->AllowWrite(true); return $oUser->ChangePassword($sOldPassword, $sNewPassword); } @@ -1097,25 +1030,22 @@ class UserRights */ public static function Impersonate($sLogin) { - if (!self::CheckLogin()) return false; + if (!self::CheckLogin()) { + return false; + } $bRet = false; $oUser = self::FindUser($sLogin); - if ($oUser) - { + if ($oUser) { $bRet = true; - if (is_null(self::$m_oRealUser)) - { + if (is_null(self::$m_oRealUser)) { // First impersonation self::$m_oRealUser = self::$m_oUser; } - if (self::$m_oRealUser && (self::$m_oRealUser->GetKey() == $oUser->GetKey())) - { + if (self::$m_oRealUser && (self::$m_oRealUser->GetKey() == $oUser->GetKey())) { // Equivalent to "Deimpersonate" self::Deimpersonate(); - } - else - { + } else { // Do impersonate! self::$m_oUser = $oUser; Dict::SetUserLanguage(self::GetUserLanguage()); @@ -1136,8 +1066,7 @@ class UserRights */ public static function Deimpersonate() { - if (!is_null(self::$m_oRealUser)) - { + if (!is_null(self::$m_oRealUser)) { self::$m_oUser = self::$m_oRealUser; //N°5135 - fix IsImpersonated() after calling Deimpersonate() self::$m_oRealUser = null; @@ -1156,12 +1085,9 @@ class UserRights */ public static function GetUser() { - if (is_null(self::$m_oUser)) - { + if (is_null(self::$m_oUser)) { return ''; - } - else - { + } else { return self::$m_oUser->Get('login'); } } @@ -1171,12 +1097,9 @@ class UserRights */ public static function GetUserObject() { - if (is_null(self::$m_oUser)) - { + if (is_null(self::$m_oUser)) { return null; - } - else - { + } else { return self::$m_oUser; } } @@ -1198,8 +1121,8 @@ class UserRights $sUserSearch = 'SELECT User WHERE contactid = :id'; $oUserSearch = DBObjectSearch::FromOQL($sUserSearch); $oUserSearch->AllowAllData(); - $oUserSet = new DBObjectSet($oUserSearch, array(), array('id' => $oPerson->GetKey())); - if($oUserSet->Count() > 0 && !($oUserSet->Count() > 1 && $bMustBeUnique)){ + $oUserSet = new DBObjectSet($oUserSearch, [], ['id' => $oPerson->GetKey()]); + if ($oUserSet->Count() > 0 && !($oUserSet->Count() > 1 && $bMustBeUnique)) { return $oUserSet->Fetch(); } return null; @@ -1210,13 +1133,10 @@ class UserRights */ public static function GetUserLanguage() { - if (is_null(self::$m_oUser)) - { + if (is_null(self::$m_oUser)) { return 'EN US'; - } - else - { + } else { return self::$m_oUser->Get('language'); } } @@ -1229,21 +1149,16 @@ class UserRights */ public static function GetUserId($sLogin = '') { - if (empty($sLogin)) - { + if (empty($sLogin)) { // return current user id - if (is_null(self::$m_oUser)) - { + if (is_null(self::$m_oUser)) { return null; } return self::$m_oUser->GetKey(); - } - else - { + } else { // find the id out of the login string $oUser = self::FindUser($sLogin); - if (is_null($oUser)) - { + if (is_null($oUser)) { return null; } return $oUser->GetKey(); @@ -1336,20 +1251,15 @@ class UserRights */ public static function GetContactId($sLogin = '') { - if (empty($sLogin)) - { + if (empty($sLogin)) { $oUser = self::$m_oUser; - } - else - { + } else { $oUser = self::FindUser($sLogin); } - if (is_null($oUser)) - { + if (is_null($oUser)) { return ''; } - if (!MetaModel::IsValidAttCode(get_class($oUser), static::DEFAULT_USER_CONTACT_ID_ATTCODE)) - { + if (!MetaModel::IsValidAttCode(get_class($oUser), static::DEFAULT_USER_CONTACT_ID_ATTCODE)) { return ''; } return $oUser->Get(static::DEFAULT_USER_CONTACT_ID_ATTCODE); @@ -1368,8 +1278,7 @@ class UserRights $sOrgFriendlyname = null; $oContact = static::GetContactObject(); - if(!is_null($oContact) && MetaModel::IsValidAttCode(get_class($oContact), static::DEFAULT_CONTACT_ORG_ID_FRIENDLYNAME_ATTCODE)) - { + if (!is_null($oContact) && MetaModel::IsValidAttCode(get_class($oContact), static::DEFAULT_CONTACT_ORG_ID_FRIENDLYNAME_ATTCODE)) { $sOrgFriendlyname = $oContact->Get(static::DEFAULT_CONTACT_ORG_ID_FRIENDLYNAME_ATTCODE); } @@ -1389,8 +1298,7 @@ class UserRights $sFirstname = null; $oContact = static::GetContactObject(); - if(!is_null($oContact) && MetaModel::IsValidAttCode(get_class($oContact), static::DEFAULT_CONTACT_FIRSTNAME_ATTCODE)) - { + if (!is_null($oContact) && MetaModel::IsValidAttCode(get_class($oContact), static::DEFAULT_CONTACT_FIRSTNAME_ATTCODE)) { $sFirstname = $oContact->Get(static::DEFAULT_CONTACT_FIRSTNAME_ATTCODE); } @@ -1410,8 +1318,7 @@ class UserRights $sFriendlyname = null; $oContact = static::GetContactObject(); - if(!is_null($oContact)) - { + if (!is_null($oContact)) { $sFriendlyname = $oContact->GetRawName(); } @@ -1423,12 +1330,9 @@ class UserRights */ public static function GetContactObject() { - if (is_null(self::$m_oUser)) - { + if (is_null(self::$m_oUser)) { return null; - } - else - { + } else { return self::$m_oUser->GetContactObject(); } } @@ -1443,16 +1347,12 @@ class UserRights */ public static function GetUserFriendlyName($sLogin = '') { - if (empty($sLogin)) - { + if (empty($sLogin)) { $oUser = self::$m_oUser; - } - else - { + } else { $oUser = self::FindUser($sLogin); } - if (is_null($oUser)) - { + if (is_null($oUser)) { return ''; } return $oUser->GetFriendlyName(); @@ -1486,8 +1386,7 @@ class UserRights */ public static function IsImpersonated() { - if (is_null(self::$m_oRealUser)) - { + if (is_null(self::$m_oRealUser)) { return false; } return true; @@ -1498,8 +1397,7 @@ class UserRights */ public static function GetRealUser() { - if (is_null(self::$m_oRealUser)) - { + if (is_null(self::$m_oRealUser)) { return ''; } return self::$m_oRealUser->Get('login'); @@ -1517,7 +1415,8 @@ class UserRights * @return int|string ID of the connected user : if impersonate then use {@see m_oRealUser}, else {@see m_oUser}. If no user set then return '' * @since 2.6.5 2.7.6 3.0.0 N°4289 method creation */ - public static function GetConnectedUserId() { + public static function GetConnectedUserId() + { if (false === is_null(static::$m_oRealUser)) { return static::$m_oRealUser->GetKey(); } @@ -1533,8 +1432,7 @@ class UserRights */ public static function GetRealUserId() { - if (is_null(self::$m_oRealUser)) - { + if (is_null(self::$m_oRealUser)) { return ''; } return self::$m_oRealUser->GetKey(); @@ -1545,8 +1443,7 @@ class UserRights */ public static function GetRealUserFriendlyName() { - if (is_null(self::$m_oRealUser)) - { + if (is_null(self::$m_oRealUser)) { return ''; } return self::$m_oRealUser->GetFriendlyName(); @@ -1557,8 +1454,7 @@ class UserRights */ protected static function CheckLogin() { - if (!self::IsLoggedIn()) - { + if (!self::IsLoggedIn()) { //throw new UserRightException('No user logged in', array()); return false; } @@ -1573,26 +1469,25 @@ class UserRights * * @return bool|\Expression */ - public static function GetSelectFilter($sClass, $aSettings = array()) + public static function GetSelectFilter($sClass, $aSettings = []) { // When initializing, we need to let everything pass trough - if (!self::CheckLogin()) {return true;} + if (!self::CheckLogin()) { + return true; + } - if (self::IsAdministrator()) {return true;} + if (self::IsAdministrator()) { + return true; + } - try - { + try { // Check Bug 1436 for details - if (MetaModel::HasCategory($sClass, 'bizmodel') || MetaModel::HasCategory($sClass, 'silo') || MetaModel::HasCategory($sClass, 'filter')) - { + if (MetaModel::HasCategory($sClass, 'bizmodel') || MetaModel::HasCategory($sClass, 'silo') || MetaModel::HasCategory($sClass, 'filter')) { return self::$m_oAddOn->GetSelectFilter(self::$m_oUser, $sClass, $aSettings); - } - else - { + } else { return true; } - } catch (Exception $e) - { + } catch (Exception $e) { return false; } } @@ -1609,50 +1504,61 @@ class UserRights public static function IsActionAllowed($sClass, $iActionCode, $oInstanceSet = null, $oUser = null) { // When initializing, we need to let everything pass trough - if (!self::CheckLogin()) return UR_ALLOWED_YES; - - if (MetaModel::DBIsReadOnly()) - { - if ($iActionCode == UR_ACTION_CREATE) return UR_ALLOWED_NO; - if ($iActionCode == UR_ACTION_MODIFY) return UR_ALLOWED_NO; - if ($iActionCode == UR_ACTION_BULK_MODIFY) return UR_ALLOWED_NO; - if ($iActionCode == UR_ACTION_DELETE) return UR_ALLOWED_NO; - if ($iActionCode == UR_ACTION_BULK_DELETE) return UR_ALLOWED_NO; + if (!self::CheckLogin()) { + return UR_ALLOWED_YES; } - $aPredefinedObjects = call_user_func(array($sClass, 'GetPredefinedObjects')); - if ($aPredefinedObjects != null) - { + if (MetaModel::DBIsReadOnly()) { + if ($iActionCode == UR_ACTION_CREATE) { + return UR_ALLOWED_NO; + } + if ($iActionCode == UR_ACTION_MODIFY) { + return UR_ALLOWED_NO; + } + if ($iActionCode == UR_ACTION_BULK_MODIFY) { + return UR_ALLOWED_NO; + } + if ($iActionCode == UR_ACTION_DELETE) { + return UR_ALLOWED_NO; + } + if ($iActionCode == UR_ACTION_BULK_DELETE) { + return UR_ALLOWED_NO; + } + } + + $aPredefinedObjects = call_user_func([$sClass, 'GetPredefinedObjects']); + if ($aPredefinedObjects != null) { // As opposed to the read-only DB, modifying an object is allowed // (the constant columns will be marked as read-only) // - if ($iActionCode == UR_ACTION_CREATE) return UR_ALLOWED_NO; - if ($iActionCode == UR_ACTION_DELETE) return UR_ALLOWED_NO; - if ($iActionCode == UR_ACTION_BULK_DELETE) return UR_ALLOWED_NO; + if ($iActionCode == UR_ACTION_CREATE) { + return UR_ALLOWED_NO; + } + if ($iActionCode == UR_ACTION_DELETE) { + return UR_ALLOWED_NO; + } + if ($iActionCode == UR_ACTION_BULK_DELETE) { + return UR_ALLOWED_NO; + } } - if (self::IsAdministrator($oUser)) return UR_ALLOWED_YES; + if (self::IsAdministrator($oUser)) { + return UR_ALLOWED_YES; + } - if (MetaModel::HasCategory($sClass, 'bizmodel') || MetaModel::HasCategory($sClass, 'grant_by_profile')) - { - if (is_null($oUser)) - { + if (MetaModel::HasCategory($sClass, 'bizmodel') || MetaModel::HasCategory($sClass, 'grant_by_profile')) { + if (is_null($oUser)) { $oUser = self::$m_oUser; } - if ($iActionCode == UR_ACTION_CREATE) - { + if ($iActionCode == UR_ACTION_CREATE) { // The addons currently DO NOT handle the case "CREATE" // Therefore it is considered to be equivalent to "MODIFY" $iActionCode = UR_ACTION_MODIFY; } return self::$m_oAddOn->IsActionAllowed($oUser, $sClass, $iActionCode, $oInstanceSet); - } - elseif(($iActionCode == UR_ACTION_READ) && MetaModel::HasCategory($sClass, 'view_in_gui')) - { + } elseif (($iActionCode == UR_ACTION_READ) && MetaModel::HasCategory($sClass, 'view_in_gui')) { return UR_ALLOWED_YES; - } - else - { + } else { // Other classes could be edited/listed by the administrators return UR_ALLOWED_NO; } @@ -1670,25 +1576,24 @@ class UserRights public static function IsStimulusAllowed($sClass, $sStimulusCode, /*dbObjectSet*/ $oInstanceSet = null, $oUser = null) { // When initializing, we need to let everything pass trough - if (!self::CheckLogin()) return true; + if (!self::CheckLogin()) { + return true; + } - if (MetaModel::DBIsReadOnly()) - { + if (MetaModel::DBIsReadOnly()) { return false; } - if (self::IsAdministrator($oUser)) return true; + if (self::IsAdministrator($oUser)) { + return true; + } - if (MetaModel::HasCategory($sClass, 'bizmodel')) - { - if (is_null($oUser)) - { + if (MetaModel::HasCategory($sClass, 'bizmodel')) { + if (is_null($oUser)) { $oUser = self::$m_oUser; } return self::$m_oAddOn->IsStimulusAllowed($oUser, $sClass, $sStimulusCode, $oInstanceSet); - } - else - { + } else { // Other classes could be edited/listed by the administrators return false; } @@ -1707,34 +1612,44 @@ class UserRights public static function IsActionAllowedOnAttribute($sClass, $sAttCode, $iActionCode, /*dbObjectSet*/$oInstanceSet = null, $oUser = null) { // When initializing, we need to let everything pass trough - if (!self::CheckLogin()) return UR_ALLOWED_YES; - - if (MetaModel::DBIsReadOnly()) - { - if ($iActionCode == UR_ACTION_MODIFY) return UR_ALLOWED_NO; - if ($iActionCode == UR_ACTION_DELETE) return UR_ALLOWED_NO; - if ($iActionCode == UR_ACTION_BULK_MODIFY) return UR_ALLOWED_NO; - if ($iActionCode == UR_ACTION_BULK_DELETE) return UR_ALLOWED_NO; + if (!self::CheckLogin()) { + return UR_ALLOWED_YES; } - if (self::IsAdministrator($oUser)) return UR_ALLOWED_YES; + if (MetaModel::DBIsReadOnly()) { + if ($iActionCode == UR_ACTION_MODIFY) { + return UR_ALLOWED_NO; + } + if ($iActionCode == UR_ACTION_DELETE) { + return UR_ALLOWED_NO; + } + if ($iActionCode == UR_ACTION_BULK_MODIFY) { + return UR_ALLOWED_NO; + } + if ($iActionCode == UR_ACTION_BULK_DELETE) { + return UR_ALLOWED_NO; + } + } - if (MetaModel::HasCategory($sClass, 'bizmodel') || MetaModel::HasCategory($sClass, 'grant_by_profile')) - { - if (is_null($oUser)) - { + if (self::IsAdministrator($oUser)) { + return UR_ALLOWED_YES; + } + + if (MetaModel::HasCategory($sClass, 'bizmodel') || MetaModel::HasCategory($sClass, 'grant_by_profile')) { + if (is_null($oUser)) { $oUser = self::$m_oUser; } return self::$m_oAddOn->IsActionAllowedOnAttribute($oUser, $sClass, $sAttCode, $iActionCode, $oInstanceSet); } // this module is forbidden for non admins - if (MetaModel::HasCategory($sClass, 'addon/userrights')) return UR_ALLOWED_NO; + if (MetaModel::HasCategory($sClass, 'addon/userrights')) { + return UR_ALLOWED_NO; + } // the rest is allowed return UR_ALLOWED_YES; - } /** @@ -1744,15 +1659,15 @@ class UserRights */ public static function IsAdministrator($oUser = null) { - if (!self::CheckLogin()) return false; + if (!self::CheckLogin()) { + return false; + } - if (is_null($oUser)) - { + if (is_null($oUser)) { $oUser = self::$m_oUser; } $iUser = $oUser->GetKey(); - if (!isset(self::$m_aAdmins[$iUser])) - { + if (!isset(self::$m_aAdmins[$iUser])) { self::$m_aAdmins[$iUser] = self::$m_oAddOn->IsAdministrator($oUser); } return self::$m_aAdmins[$iUser]; @@ -1765,15 +1680,15 @@ class UserRights */ public static function IsPortalUser($oUser = null) { - if (!self::CheckLogin()) return false; + if (!self::CheckLogin()) { + return false; + } - if (is_null($oUser)) - { + if (is_null($oUser)) { $oUser = self::$m_oUser; } $iUser = $oUser->GetKey(); - if (!isset(self::$m_aPortalUsers[$iUser])) - { + if (!isset(self::$m_aPortalUsers[$iUser])) { self::$m_aPortalUsers[$iUser] = self::$m_oAddOn->IsPortalUser($oUser); } return self::$m_aPortalUsers[$iUser]; @@ -1783,29 +1698,26 @@ class UserRights * @return array */ public static function GetAllowedPortals() - { - $aAllowedPortals = array(); - $aPortalsConf = PortalDispatcherData::GetData(); - $aDispatchers = array(); - foreach ($aPortalsConf as $sPortalId => $aConf) - { - $sHandlerClass = $aConf['handler']; - $aDispatchers[$sPortalId] = new $sHandlerClass($sPortalId); - } + { + $aAllowedPortals = []; + $aPortalsConf = PortalDispatcherData::GetData(); + $aDispatchers = []; + foreach ($aPortalsConf as $sPortalId => $aConf) { + $sHandlerClass = $aConf['handler']; + $aDispatchers[$sPortalId] = new $sHandlerClass($sPortalId); + } - foreach ($aDispatchers as $sPortalId => $oDispatcher) - { - if ($oDispatcher->IsUserAllowed()) - { - $aAllowedPortals[] = array( - 'id' => $sPortalId, - 'label' => $oDispatcher->GetLabel(), - 'url' => $oDispatcher->GetUrl(), - ); - } - } - return $aAllowedPortals; - } + foreach ($aDispatchers as $sPortalId => $oDispatcher) { + if ($oDispatcher->IsUserAllowed()) { + $aAllowedPortals[] = [ + 'id' => $sPortalId, + 'label' => $oDispatcher->GetLabel(), + 'url' => $oDispatcher->GetUrl(), + ]; + } + } + return $aAllowedPortals; + } /** * @see UR_ACTION_READ, UR_ACTION_MODIFY, ... @@ -1819,60 +1731,48 @@ class UserRights * @throws \DictExceptionMissingString * @throws \CoreException */ - public static function GetAllowedClasses($iActionCode, $aCategories = array('bizmodel'), $bWithLabels = false, $oUser = null) - { - $aAllowedClasses = []; - foreach(MetaModel::GetClasses(implode(',', $aCategories)) as $sClass) - { - if(static::IsActionAllowed($sClass, $iActionCode, null, $oUser) === UR_ALLOWED_YES) - { - if($bWithLabels) - { - $aAllowedClasses[$sClass] = MetaModel::GetName($sClass); - } - else - { - $aAllowedClasses[] = $sClass; - } - } - } + public static function GetAllowedClasses($iActionCode, $aCategories = ['bizmodel'], $bWithLabels = false, $oUser = null) + { + $aAllowedClasses = []; + foreach (MetaModel::GetClasses(implode(',', $aCategories)) as $sClass) { + if (static::IsActionAllowed($sClass, $iActionCode, null, $oUser) === UR_ALLOWED_YES) { + if ($bWithLabels) { + $aAllowedClasses[$sClass] = MetaModel::GetName($sClass); + } else { + $aAllowedClasses[] = $sClass; + } + } + } - // Sort by label - if($bWithLabels) - { - asort($aAllowedClasses); - } + // Sort by label + if ($bWithLabels) { + asort($aAllowedClasses); + } - return $aAllowedClasses; - } + return $aAllowedClasses; + } /** * @param \User|null $oUser * * @return array|mixed */ - public static function ListProfiles($oUser = null) + public static function ListProfiles($oUser = null) { - if (is_null($oUser)) - { + if (is_null($oUser)) { $oUser = self::$m_oUser; } - if ($oUser === null) - { + if ($oUser === null) { // Not logged in: no profile at all - $aProfiles = array(); - } - elseif ((self::$m_oUser !== null) && ($oUser->GetKey() == self::$m_oUser->GetKey())) - { + $aProfiles = []; + } elseif ((self::$m_oUser !== null) && ($oUser->GetKey() == self::$m_oUser->GetKey())) { // Data about the current user can be found into the session data - if (Session::IsSet('profile_list')) - { + if (Session::IsSet('profile_list')) { $aProfiles = Session::Get('profile_list'); } } - if (!isset($aProfiles)) - { + if (!isset($aProfiles)) { $aProfiles = self::$m_oAddOn->ListProfiles($oUser); } return $aProfiles; @@ -1897,14 +1797,12 @@ class UserRights */ public static function FlushPrivileges($bResetAdminCache = false) { - if ($bResetAdminCache) - { - self::$m_aAdmins = array(); - self::$m_aPortalUsers = array(); + if ($bResetAdminCache) { + self::$m_aAdmins = []; + self::$m_aPortalUsers = []; } self::_ResetSessionCache(); - if (self::$m_oAddOn) - { + if (self::$m_oAddOn) { self::$m_oAddOn->FlushPrivileges(); } } @@ -1935,25 +1833,25 @@ class UserRights } if (! isset(self::$m_aCacheUsers[$sAuthentication]) || ! array_key_exists($sLogin, self::$m_aCacheUsers[$sAuthentication])) { - switch($sAuthentication) { + switch ($sAuthentication) { case 'external': - $sBaseClass = 'UserExternal'; - break; + $sBaseClass = 'UserExternal'; + break; case 'internal': - $sBaseClass = 'UserInternal'; - break; + $sBaseClass = 'UserInternal'; + break; default: - echo "

          sAuthentication = $sAuthentication

          \n"; - assert(false); // should never happen + echo "

          sAuthentication = $sAuthentication

          \n"; + assert(false); // should never happen } $oSearch = DBObjectSearch::FromOQL("SELECT $sBaseClass WHERE login = :login"); $oSearch->AllowAllData(); if (!$bAllowDisabledUsers) { $oSearch->AddCondition('status', 'enabled'); } - $oSet = new DBObjectSet($oSearch, array(), array('login' => $sLogin)); + $oSet = new DBObjectSet($oSearch, [], ['login' => $sLogin]); $oUser = $oSet->fetch(); self::$m_aCacheUsers[$sAuthentication][$sLogin] = $oUser; @@ -1970,7 +1868,7 @@ class UserRights { self::$m_aCacheUsers = [ 'internal' => [], 'external' => [] ]; } - + /** * @param string$sClass * @param array $aAllowedOrgs @@ -1983,7 +1881,7 @@ class UserRights * @throws \MySQLException * @throws \MySQLHasGoneAwayException */ - public static function MakeSelectFilter($sClass, $aAllowedOrgs, $aSettings = array(), $sAttCode = null) + public static function MakeSelectFilter($sClass, $aAllowedOrgs, $aSettings = [], $sAttCode = null) { return self::$m_oAddOn->MakeSelectFilter($sClass, $aAllowedOrgs, $aSettings, $sAttCode); } @@ -1995,15 +1893,14 @@ class UserRights $oConfig = MetaModel::GetConfig(); $bSessionIdRegeneration = $oConfig->Get('regenerate_session_id_enabled'); - if ($bSessionIdRegeneration) - { + if ($bSessionIdRegeneration) { // Protection against session fixation/injection: generate a new session id. // Alas a PHP bug (technically a bug in the memcache session handler, https://bugs.php.net/bug.php?id=71187) // causes session_regenerate_id to fail with a catchable fatal error in PHP 7.0 if the session handler is memcache(d). // The bug has been fixed in PHP 7.2, but in case session_regenerate_id() // fails we just silently ignore the error and keep the same session id... - $old_error_handler = set_error_handler(array(__CLASS__, 'VoidErrorHandler')); + $old_error_handler = set_error_handler([__CLASS__, 'VoidErrorHandler']); Session::RegenerateId(true); if ($old_error_handler !== null) { set_error_handler($old_error_handler); @@ -2044,10 +1941,10 @@ class UserRights */ class ActionChecker { - var $oFilter; - var $iActionCode; - var $iAllowedCount = null; - var $aAllowedIDs = null; + public $oFilter; + public $iActionCode; + public $iAllowedCount = null; + public $aAllowedIDs = null; public function __construct(DBSearch $oFilter, $iActionCode) { @@ -2063,7 +1960,9 @@ class ActionChecker */ public function GetAllowedCount() { - if ($this->iAllowedCount == null) $this->CheckObjects(); + if ($this->iAllowedCount == null) { + $this->CheckObjects(); + } return $this->iAllowedCount; } @@ -2074,7 +1973,9 @@ class ActionChecker */ public function GetAllowedIDs() { - if ($this->aAllowedIDs == null) $this->IsAllowed(); + if ($this->aAllowedIDs == null) { + $this->IsAllowed(); + } return $this->aAllowedIDs; } @@ -2087,36 +1988,27 @@ class ActionChecker $sClass = $this->oFilter->GetClass(); $oSet = new DBObjectSet($this->oFilter); $iActionAllowed = UserRights::IsActionAllowed($sClass, $this->iActionCode, $oSet); - if ($iActionAllowed == UR_ALLOWED_DEPENDS) - { + if ($iActionAllowed == UR_ALLOWED_DEPENDS) { // Check for each object if the action is allowed or not - $this->aAllowedIDs = array(); + $this->aAllowedIDs = []; $oSet->Rewind(); $this->iAllowedCount = 0; - while($oObj = $oSet->Fetch()) - { - $oObjSet = DBObjectSet::FromArray($sClass, array($oObj)); - if (UserRights::IsActionAllowed($sClass, $this->iActionCode, $oObjSet) == UR_ALLOWED_NO) - { + while ($oObj = $oSet->Fetch()) { + $oObjSet = DBObjectSet::FromArray($sClass, [$oObj]); + if (UserRights::IsActionAllowed($sClass, $this->iActionCode, $oObjSet) == UR_ALLOWED_NO) { $this->aAllowedIDs[$oObj->GetKey()] = false; - } - else - { + } else { // Assume UR_ALLOWED_YES, since there is just one object ! $this->aAllowedIDs[$oObj->GetKey()] = true; $this->iAllowedCount++; } } - } - else if ($iActionAllowed == UR_ALLOWED_YES) - { + } elseif ($iActionAllowed == UR_ALLOWED_YES) { $this->iAllowedCount = $oSet->Count(); - $this->aAllowedIDs = array(); // Optimization: not filled when Ok for all objects - } - else // UR_ALLOWED_NO - { + $this->aAllowedIDs = []; // Optimization: not filled when Ok for all objects + } else { // UR_ALLOWED_NO $this->iAllowedCount = 0; - $this->aAllowedIDs = array(); + $this->aAllowedIDs = []; } return $iActionAllowed; } @@ -2127,7 +2019,7 @@ class ActionChecker */ class StimulusChecker extends ActionChecker { - var $sState = null; + public $sState = null; public mixed $iState = null; @@ -2144,59 +2036,49 @@ class StimulusChecker extends ActionChecker public function IsAllowed() { $sClass = $this->oFilter->GetClass(); - if (MetaModel::IsAbstract($sClass)) return UR_ALLOWED_NO; // Safeguard, not implemented if the base class of the set is abstract ! + if (MetaModel::IsAbstract($sClass)) { + return UR_ALLOWED_NO; + } // Safeguard, not implemented if the base class of the set is abstract ! $oSet = new DBObjectSet($this->oFilter); - $iActionAllowed = UserRights::IsStimulusAllowed($sClass, $this->iActionCode, $oSet); - if ($iActionAllowed == UR_ALLOWED_NO) - { + $iActionAllowed = UserRights::IsStimulusAllowed($sClass, $this->iActionCode, $oSet); + if ($iActionAllowed == UR_ALLOWED_NO) { $this->iAllowedCount = 0; - $this->aAllowedIDs = array(); - } - else // Even if UR_ALLOWED_YES, we need to check if each object is in the appropriate state - { + $this->aAllowedIDs = []; + } else { // Even if UR_ALLOWED_YES, we need to check if each object is in the appropriate state // Hmmm, may not be needed right now because we limit the "multiple" action to object in // the same state... may be useful later on if we want to extend this behavior... // Check for each object if the action is allowed or not - $this->aAllowedIDs = array(); + $this->aAllowedIDs = []; $oSet->Rewind(); $iAllowedCount = 0; $iActionAllowed = UR_ALLOWED_DEPENDS; - while($oObj = $oSet->Fetch()) - { + while ($oObj = $oSet->Fetch()) { $aTransitions = $oObj->EnumTransitions(); - if (array_key_exists($this->iActionCode, $aTransitions)) - { + if (array_key_exists($this->iActionCode, $aTransitions)) { // Temporary optimization possible: since the current implementation // of IsActionAllowed does not perform a 'per instance' check, we could // skip this second validation phase and assume it would return UR_ALLOWED_YES - $oObjSet = DBObjectSet::FromArray($sClass, array($oObj)); - if (!UserRights::IsStimulusAllowed($sClass, $this->iActionCode, $oObjSet)) - { + $oObjSet = DBObjectSet::FromArray($sClass, [$oObj]); + if (!UserRights::IsStimulusAllowed($sClass, $this->iActionCode, $oObjSet)) { $this->aAllowedIDs[$oObj->GetKey()] = false; - } - else - { + } else { // Assume UR_ALLOWED_YES, since there is just one object ! $this->aAllowedIDs[$oObj->GetKey()] = true; $this->iState = $oObj->GetState(); $this->iAllowedCount++; } - } - else - { + } else { $this->aAllowedIDs[$oObj->GetKey()] = false; } } } - if ($this->iAllowedCount == $oSet->Count()) - { + if ($this->iAllowedCount == $oSet->Count()) { $iActionAllowed = UR_ALLOWED_YES; } - if ($this->iAllowedCount == 0) - { + if ($this->iAllowedCount == 0) { $iActionAllowed = UR_ALLOWED_NO; } diff --git a/core/valuesetdef.class.inc.php b/core/valuesetdef.class.inc.php index 47c1ac43a..429fb905a 100644 --- a/core/valuesetdef.class.inc.php +++ b/core/valuesetdef.class.inc.php @@ -1,9 +1,10 @@ - /** * Value set definitions (from a fixed list or from a query, etc.) * @@ -37,16 +37,14 @@ require_once('MyHelpers.class.inc.php'); abstract class ValueSetDefinition { protected $m_bIsLoaded = false; - protected $m_aValues = array(); - + protected $m_aValues = []; // Displayable description that could be computed out of the std usage context public function GetValuesDescription() { - $aValues = $this->GetValues(array(), ''); - $aDisplayedValues = array(); - foreach($aValues as $key => $value) - { + $aValues = $this->GetValues([], ''); + $aDisplayedValues = []; + foreach ($aValues as $key => $value) { $aDisplayedValues[] = "$key => $value"; } $sAllowedValues = implode(', ', $aDisplayedValues); @@ -62,24 +60,18 @@ abstract class ValueSetDefinition */ public function GetValues($aArgs, $sContains = '', $sOperation = 'contains') { - if (!$this->m_bIsLoaded) - { + if (!$this->m_bIsLoaded) { $this->LoadValues($aArgs); $this->m_bIsLoaded = true; } - if (strlen($sContains) == 0) - { + if (strlen($sContains) == 0) { // No filtering $aRet = $this->m_aValues; - } - else - { + } else { // Filter on results containing the needle - $aRet = array(); - foreach ($this->m_aValues as $sKey=>$sValue) - { - if (stripos($sValue, $sContains) !== false) - { + $aRet = []; + foreach ($this->m_aValues as $sKey => $sValue) { + if (stripos($sValue, $sContains) !== false) { $aRet[$sKey] = $sValue; } } @@ -103,9 +95,8 @@ abstract class ValueSetDefinition abstract protected function LoadValues($aArgs); } - /** - * Set of existing values for an attribute, given a search filter + * Set of existing values for an attribute, given a search filter * * @package iTopORM */ @@ -122,11 +113,10 @@ class ValueSetObjects extends ValueSetDefinition private $m_bSort; private $m_iLimit; - /** * @param hash $aOrderBy Array of '[.]attcode' => bAscending - */ - public function __construct($sFilterExp, $sValueAttCode = '', $aOrderBy = array(), $bAllowAllData = false, $aModifierProperties = array()) + */ + public function __construct($sFilterExp, $sValueAttCode = '', $aOrderBy = [], $bAllowAllData = false, $aModifierProperties = []) { $this->m_sContains = ''; $this->m_sOperation = ''; @@ -166,54 +156,48 @@ class ValueSetObjects extends ValueSetDefinition { $this->m_aOrderBy = $aOrderBy; } - public function ToObjectSet($aArgs = array(), $sContains = '', $iAdditionalValue = null) + public function ToObjectSet($aArgs = [], $sContains = '', $iAdditionalValue = null) { - if ($this->m_bAllowAllData) - { + if ($this->m_bAllowAllData) { $oFilter = DBObjectSearch::FromOQL_AllData($this->m_sFilterExpr); - } - else - { + } else { $oFilter = DBObjectSearch::FromOQL($this->m_sFilterExpr); } - if (!is_null($this->m_oExtraCondition)) - { + if (!is_null($this->m_oExtraCondition)) { $oFilter = $oFilter->Intersect($this->m_oExtraCondition); } - foreach($this->m_aModifierProperties as $sPluginClass => $aProperties) - { - foreach ($aProperties as $sProperty => $value) - { + foreach ($this->m_aModifierProperties as $sPluginClass => $aProperties) { + foreach ($aProperties as $sProperty => $value) { $oFilter->SetModifierProperty($sPluginClass, $sProperty, $value); } } - if ($iAdditionalValue > 0) - { + if ($iAdditionalValue > 0) { $oSearchAdditionalValue = new DBObjectSearch($oFilter->GetClass()); - $oSearchAdditionalValue->AddConditionExpression( new BinaryExpression( - new FieldExpression('id', $oSearchAdditionalValue->GetClassAlias()), - '=', - new VariableExpression('current_extkey_id')) - ); + $oSearchAdditionalValue->AddConditionExpression( + new BinaryExpression( + new FieldExpression('id', $oSearchAdditionalValue->GetClassAlias()), + '=', + new VariableExpression('current_extkey_id') + ) + ); $oSearchAdditionalValue->AllowAllData(); $oSearchAdditionalValue->SetArchiveMode(true); - $oSearchAdditionalValue->SetInternalParams( array('current_extkey_id' => $iAdditionalValue) ); + $oSearchAdditionalValue->SetInternalParams(['current_extkey_id' => $iAdditionalValue]); - $oFilter = new DBUnionSearch(array($oFilter, $oSearchAdditionalValue)); + $oFilter = new DBUnionSearch([$oFilter, $oSearchAdditionalValue]); } return new DBObjectSet($oFilter, $this->m_aOrderBy, $aArgs); } - /** - * @inheritDoc - * @throws CoreException - * @throws OQLException - */ - public function GetValues($aArgs, $sContains = '', $sOperation = 'contains') + /** + * @inheritDoc + * @throws CoreException + * @throws OQLException + */ + public function GetValues($aArgs, $sContains = '', $sOperation = 'contains') { - if (!$this->m_bIsLoaded || ($sContains != $this->m_sContains) || ($sOperation != $this->m_sOperation)) - { + if (!$this->m_bIsLoaded || ($sContains != $this->m_sContains) || ($sOperation != $this->m_sOperation)) { $this->LoadValues($aArgs, $sContains, $sOperation); $this->m_bIsLoaded = true; } @@ -236,15 +220,15 @@ class ValueSetObjects extends ValueSetDefinition $this->m_sContains = $sContains; $this->m_sOperation = $sOperation; - $this->m_aValues = array(); + $this->m_aValues = []; $oFilter = $this->GetFilter($sOperation, $sContains); $oObjects = new DBObjectSet($oFilter, $this->m_aOrderBy, $aArgs, null, $this->m_iLimit, 0, $this->m_bSort); if (empty($this->m_sValueAttCode)) { - $aAttToLoad = array($oFilter->GetClassAlias() => array('friendlyname')); + $aAttToLoad = [$oFilter->GetClassAlias() => ['friendlyname']]; } else { - $aAttToLoad = array($oFilter->GetClassAlias() => array($this->m_sValueAttCode)); + $aAttToLoad = [$oFilter->GetClassAlias() => [$this->m_sValueAttCode]]; } $oObjects->OptimizeColumnLoad($aAttToLoad); while ($oObject = $oObjects->Fetch()) { @@ -258,7 +242,6 @@ class ValueSetObjects extends ValueSetDefinition return true; } - /** * Get filter for functions LoadValues and LoadValuesForAutocomplete * @@ -308,7 +291,7 @@ class ValueSetObjects extends ValueSetDefinition $aAttributes = MetaModel::GetFriendlyNameAttributeCodeList($sClass); if (count($aAttributes) > 0) { $sClassAlias = $oFilter->GetClassAlias(); - $aFilters = array(); + $aFilters = []; $oValueExpr = new ScalarExpression($this->m_sContains); foreach ($aAttributes as $sAttribute) { $oNewFilter = $oFilter->DeepClone(); @@ -366,8 +349,7 @@ class ValueSetObjects extends ValueSetDefinition public function GetValuesForAutocomplete($aArgs, $sContains = '', $sOperation = 'contains') { - if (!$this->m_bIsLoaded || ($sContains != $this->m_sContains) || ($sOperation != $this->m_sOperation)) - { + if (!$this->m_bIsLoaded || ($sContains != $this->m_sContains) || ($sOperation != $this->m_sOperation)) { $this->LoadValuesForAutocomplete($aArgs, $sContains, $sOperation); $this->m_bIsLoaded = true; } @@ -387,7 +369,7 @@ class ValueSetObjects extends ValueSetDefinition */ protected function LoadValuesForAutocomplete($aArgs, $sContains = '', $sOperation = 'contains') { - $this->m_aValues = array(); + $this->m_aValues = []; $oFilter = $this->GetFilter($sOperation, $sContains); $sClass = $oFilter->GetClass(); @@ -455,9 +437,8 @@ class ValueSetObjects extends ValueSetDefinition } } - /** - * Fixed set values (could be hardcoded in the business model) + * Fixed set values (could be hardcoded in the business model) * * @package iTopORM */ @@ -525,8 +506,7 @@ class ValueSetEnum extends ValueSetDefinition protected function LoadValues($aArgs) { $aValues = []; - if (is_array($this->m_values)) - { + if (is_array($this->m_values)) { foreach ($this->m_values as $key => $value) { // Handle backed-enum case if (is_object($value) && enum_exists(get_class($value))) { @@ -536,18 +516,13 @@ class ValueSetEnum extends ValueSetDefinition $aValues[$key] = $value; } - } - elseif (is_string($this->m_values) && strlen($this->m_values) > 0) - { - foreach (explode(",", $this->m_values) as $sVal) - { + } elseif (is_string($this->m_values) && strlen($this->m_values) > 0) { + foreach (explode(",", $this->m_values) as $sVal) { $sVal = trim($sVal); - $sKey = $sVal; + $sKey = $sVal; $aValues[$sKey] = $sVal; } - } - else - { + } else { $aValues = []; } $this->m_aValues = $aValues; @@ -564,17 +539,13 @@ class ValueSetEnumPadded extends ValueSetEnum public function __construct($Values, bool $bSortByValues = false) { parent::__construct($Values, $bSortByValues); - if (is_string($Values)) - { + if (is_string($Values)) { $this->LoadValues(null); - } - else - { + } else { $this->m_aValues = $Values; } - $aPaddedValues = array(); - foreach ($this->m_aValues as $sKey => $sVal) - { + $aPaddedValues = []; + foreach ($this->m_aValues as $sKey => $sVal) { // Pad keys to the min. length required by the \AttributeSet $sKey = str_pad($sKey, 3, '_', STR_PAD_LEFT); $aPaddedValues[$sKey] = $sVal; @@ -603,17 +574,15 @@ class ValueSetRange extends ValueSetDefinition protected function LoadValues($aArgs) { $iValue = $this->m_iStart; - for($iValue = $this->m_iStart; $iValue <= $this->m_iEnd; $iValue += $this->m_iStep) - { + for ($iValue = $this->m_iStart; $iValue <= $this->m_iEnd; $iValue += $this->m_iStep) { $this->m_aValues[$iValue] = $iValue; } return true; } } - /** - * Data model classes + * Data model classes * * @package iTopORM */ @@ -631,29 +600,21 @@ class ValueSetEnumClasses extends ValueSetEnum { // Call the parent to parse the additional values... parent::LoadValues($aArgs); - + // Translate the labels of the additional values - foreach($this->m_aValues as $sClass => $void) - { - if (MetaModel::IsValidClass($sClass)) - { + foreach ($this->m_aValues as $sClass => $void) { + if (MetaModel::IsValidClass($sClass)) { $this->m_aValues[$sClass] = MetaModel::GetName($sClass); - } - else - { + } else { unset($this->m_aValues[$sClass]); } } // Then, add the classes from the category definition - foreach (MetaModel::GetClasses($this->m_sCategories) as $sClass) - { - if (MetaModel::IsValidClass($sClass)) - { + foreach (MetaModel::GetClasses($this->m_sCategories) as $sClass) { + if (MetaModel::IsValidClass($sClass)) { $this->m_aValues[$sClass] = MetaModel::GetName($sClass); - } - else - { + } else { unset($this->m_aValues[$sClass]); } } diff --git a/core/xmlbulkexport.class.inc.php b/core/xmlbulkexport.class.inc.php index 5a61eb87d..c31968f3d 100644 --- a/core/xmlbulkexport.class.inc.php +++ b/core/xmlbulkexport.class.inc.php @@ -1,4 +1,5 @@ array('xml_no_options'))); + return array_merge(parent::EnumFormParts(), ['xml_options' => ['xml_no_options']]); } /** @@ -63,17 +64,17 @@ class XMLBulkExport extends BulkExport break; default: - return parent:: GetFormPart($oP, $sPartId); + return parent::GetFormPart($oP, $sPartId); } } - + public function ReadParameters() { parent::ReadParameters(); - + $this->aStatusInfo['linksets'] = (utils::ReadParam('linksets', 0) == 1); } - + protected function GetSampleData($oObj, $sAttCode) { $sRet = ($sAttCode == 'id') ? $oObj->GetKey() : $oObj->GetAsXML($sAttCode); @@ -83,10 +84,8 @@ class XMLBulkExport extends BulkExport public function GetHeader() { // Check permissions - foreach($this->oSearch->GetSelectedClasses() as $sAlias => $sClass) - { - if (UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_READ) != UR_ALLOWED_YES) - { + foreach ($this->oSearch->GetSelectedClasses() as $sAlias => $sClass) { + if (UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_READ) != UR_ALLOWED_YES) { throw new Exception("You do not have enough permissions to bulk read data of class '$sClass' (alias: $sAlias)"); } } @@ -105,36 +104,28 @@ class XMLBulkExport extends BulkExport $iCount = 0; $sData = ''; - + $oSet = new DBObjectSet($this->oSearch); $oSet->SetLimit($this->iChunkSize, $this->aStatusInfo['position']); - + $aClasses = $this->oSearch->GetSelectedClasses(); - $aAuthorizedClasses = array(); - $aClass2Attributes = array(); - foreach($aClasses as $sAlias => $sClassName) - { - if (UserRights::IsActionAllowed($sClassName, UR_ACTION_BULK_READ, $oSet) != UR_ALLOWED_NO) - { + $aAuthorizedClasses = []; + $aClass2Attributes = []; + foreach ($aClasses as $sAlias => $sClassName) { + if (UserRights::IsActionAllowed($sClassName, UR_ACTION_BULK_READ, $oSet) != UR_ALLOWED_NO) { $aAuthorizedClasses[$sAlias] = $sClassName; - $aAttributes = array(); - foreach(MetaModel::ListAttributeDefs($sClassName) as $sAttCode=>$oAttDef) - { - if ($oAttDef->IsLinkSet() && !$this->aStatusInfo['linksets']) - { + $aAttributes = []; + foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) { + if ($oAttDef->IsLinkSet() && !$this->aStatusInfo['linksets']) { continue; } - if ($oAttDef->IsExternalField()) - { + if ($oAttDef->IsExternalField()) { continue; } $aAttributes[$sAttCode] = $oAttDef; - if ($oAttDef->IsExternalKey()) - { - foreach(MetaModel::ListAttributeDefs($sClassName) as $sSubAttCode=>$oSubAttDef) - { - if ($oSubAttDef->IsExternalField() && ($oSubAttDef->GetKeyAttCode() == $sAttCode)) - { + if ($oAttDef->IsExternalKey()) { + foreach (MetaModel::ListAttributeDefs($sClassName) as $sSubAttCode => $oSubAttDef) { + if ($oSubAttDef->IsExternalField() && ($oSubAttDef->GetKeyAttCode() == $sAttCode)) { $aAttributes[$sAttCode.'_friendlyname'] = MetaModel::GetAttributeDef($sClassName, $sAttCode.'_friendlyname'); $aAttributes[$sSubAttCode] = $oSubAttDef; } @@ -147,64 +138,49 @@ class XMLBulkExport extends BulkExport $iPreviousTimeLimit = ini_get('max_execution_time'); $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop'); - - while ($aObjects = $oSet->FetchAssoc()) - { + + while ($aObjects = $oSet->FetchAssoc()) { set_time_limit(intval($iLoopTimeLimit)); - if (count($aAuthorizedClasses) > 1) - { + if (count($aAuthorizedClasses) > 1) { $sData .= "\n"; } - foreach($aAuthorizedClasses as $sAlias => $sClassName) - { + foreach ($aAuthorizedClasses as $sAlias => $sClassName) { $oObj = $aObjects[$sAlias]; - if (is_null($oObj)) - { + if (is_null($oObj)) { $sData .= "<$sClassName alias=\"$sAlias\" id=\"null\">\n"; - } - else - { + } else { $sClassName = get_class($oObj); $sData .= "<$sClassName alias=\"$sAlias\" id=\"".$oObj->GetKey()."\">\n"; } - foreach($aClass2Attributes[$sAlias] as $sAttCode=>$oAttDef) - { - if (is_null($oObj)) - { + foreach ($aClass2Attributes[$sAlias] as $sAttCode => $oAttDef) { + if (is_null($oObj)) { $sData .= "<$sAttCode>null\n"; - } - else - { + } else { $sValue = $oObj->GetAsXML($sAttCode, $this->bLocalizeOutput); $sData .= "<$sAttCode>$sValue\n"; } } $sData .= "\n"; } - if (count($aAuthorizedClasses) > 1) - { + if (count($aAuthorizedClasses) > 1) { $sData .= "\n"; } $iCount++; } - + set_time_limit(intval($iPreviousTimeLimit)); $this->aStatusInfo['position'] += $this->iChunkSize; - if ($this->aStatusInfo['total'] == 0) - { + if ($this->aStatusInfo['total'] == 0) { $iPercentage = 100; - } - else - { - $iPercentage = floor(min(100.0, 100.0*$this->aStatusInfo['position']/$this->aStatusInfo['total'])); + } else { + $iPercentage = floor(min(100.0, 100.0 * $this->aStatusInfo['position'] / $this->aStatusInfo['total'])); } - if ($iCount < $this->iChunkSize) - { + if ($iCount < $this->iChunkSize) { $sRetCode = 'done'; } - $aStatus = array('code' => $sRetCode, 'message' => Dict::S('Core:BulkExport:RetrievingData'), 'percentage' => $iPercentage); + $aStatus = ['code' => $sRetCode, 'message' => Dict::S('Core:BulkExport:RetrievingData'), 'percentage' => $iPercentage]; return $sData; } @@ -217,7 +193,7 @@ class XMLBulkExport extends BulkExport public function GetSupportedFormats() { - return array('xml' => Dict::S('Core:BulkExport:XMLFormat')); + return ['xml' => Dict::S('Core:BulkExport:XMLFormat')]; } public function GetMimeType() diff --git a/datamodels/2.x/authent-cas/dictionaries/cs.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/cs.dict.authent-cas.php index 6786003c8..ff1316346 100644 --- a/datamodels/2.x/authent-cas/dictionaries/cs.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/cs.dict.authent-cas.php @@ -1,16 +1,17 @@ 'Uživatel není oprávněn', 'CAS:Login:SignIn' => 'Přihlásit se prostřednictvím CAS', 'CAS:Login:SignInTooltip' => 'Klikni zde pro příhlášení prostřednictvím CAS serveru', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/da.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/da.dict.authent-cas.php index e1e399ae2..3947deb07 100644 --- a/datamodels/2.x/authent-cas/dictionaries/da.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/da.dict.authent-cas.php @@ -1,16 +1,17 @@ 'User not allowed~~', 'CAS:Login:SignIn' => 'Sign in with CAS~~', 'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server~~', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/de.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/de.dict.authent-cas.php index adba31af2..1e47de290 100644 --- a/datamodels/2.x/authent-cas/dictionaries/de.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/de.dict.authent-cas.php @@ -1,16 +1,17 @@ 'Benutzer ist nicht zugelassen', 'CAS:Login:SignIn' => 'Anmeldung mit CAS', 'CAS:Login:SignInTooltip' => 'Hier klicken, um sich am CAS-Server zu authentifizieren', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/en.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/en.dict.authent-cas.php index ceff23433..514a7798d 100644 --- a/datamodels/2.x/authent-cas/dictionaries/en.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/en.dict.authent-cas.php @@ -1,4 +1,5 @@ 'User not allowed', 'CAS:Login:SignIn' => 'Sign in with CAS', 'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/en_gb.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/en_gb.dict.authent-cas.php index c41eceabb..47c06b8c0 100644 --- a/datamodels/2.x/authent-cas/dictionaries/en_gb.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/en_gb.dict.authent-cas.php @@ -1,4 +1,5 @@ 'User not allowed', 'CAS:Login:SignIn' => 'Sign in with CAS', 'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/es_cr.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/es_cr.dict.authent-cas.php index 294418d1f..315e49c6e 100644 --- a/datamodels/2.x/authent-cas/dictionaries/es_cr.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/es_cr.dict.authent-cas.php @@ -1,14 +1,15 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'CAS:Error:UserNotAllowed' => 'Usuario no permitido', 'CAS:Login:SignIn' => 'Iniciar sesión con CAS', 'CAS:Login:SignInTooltip' => 'Click para autenticarse con servidor CAS', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/fr.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/fr.dict.authent-cas.php index 39ed72684..cf2efb79f 100644 --- a/datamodels/2.x/authent-cas/dictionaries/fr.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/fr.dict.authent-cas.php @@ -1,16 +1,17 @@ 'Utilisateur non autorisé', 'CAS:Login:SignIn' => 'S\'identifier avec CAS', 'CAS:Login:SignInTooltip' => 'Cliquer ici pour s\'identifier avec le serveur CAS', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/hu.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/hu.dict.authent-cas.php index 0040a0e41..5b69248f0 100644 --- a/datamodels/2.x/authent-cas/dictionaries/hu.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/hu.dict.authent-cas.php @@ -1,16 +1,17 @@ 'Nem engedélyezett felhasználó', 'CAS:Login:SignIn' => 'Bejelentkezés CAS szerverrel', 'CAS:Login:SignInTooltip' => 'Kattintson ide az azonosításhoz a CAS szerveren', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/it.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/it.dict.authent-cas.php index 9f7d0ace2..5a20d8229 100644 --- a/datamodels/2.x/authent-cas/dictionaries/it.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/it.dict.authent-cas.php @@ -1,16 +1,17 @@ 'Utente non autorizzato', 'CAS:Login:SignIn' => 'Accedi con CAS', 'CAS:Login:SignInTooltip' => 'Clicca qui per autenticarti con il server CAS', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/ja.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/ja.dict.authent-cas.php index 947cf59ab..1b9f12aeb 100644 --- a/datamodels/2.x/authent-cas/dictionaries/ja.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/ja.dict.authent-cas.php @@ -1,16 +1,17 @@ 'User not allowed~~', 'CAS:Login:SignIn' => 'Sign in with CAS~~', 'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server~~', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/nl.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/nl.dict.authent-cas.php index ee095a33d..de8291ab1 100644 --- a/datamodels/2.x/authent-cas/dictionaries/nl.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/nl.dict.authent-cas.php @@ -1,17 +1,18 @@ (2018 - 2022) * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'CAS:Error:UserNotAllowed' => 'Gebruiker heeft onvoldoende rechten.', 'CAS:Login:SignIn' => 'Inloggen met CAS', 'CAS:Login:SignInTooltip' => 'Klik hier om aan te melden via de CAS-server', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/pl.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/pl.dict.authent-cas.php index e61644cda..d814d8bef 100644 --- a/datamodels/2.x/authent-cas/dictionaries/pl.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/pl.dict.authent-cas.php @@ -1,16 +1,17 @@ 'Użytkownik niedozwolony', 'CAS:Login:SignIn' => 'Zaloguj się za pomocą CAS', 'CAS:Login:SignInTooltip' => 'Kliknij tutaj, aby uwierzytelnić się na serwerze CAS', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/pt_br.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/pt_br.dict.authent-cas.php index b823f19f6..25307081a 100644 --- a/datamodels/2.x/authent-cas/dictionaries/pt_br.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/pt_br.dict.authent-cas.php @@ -1,16 +1,17 @@ 'Usuário não permitido', 'CAS:Login:SignIn' => 'Autenticar com CAS', 'CAS:Login:SignInTooltip' => 'Clique aqui para se autenticar no servidor CAS', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/ru.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/ru.dict.authent-cas.php index a2f065dad..c3833d2d5 100644 --- a/datamodels/2.x/authent-cas/dictionaries/ru.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/ru.dict.authent-cas.php @@ -1,17 +1,18 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'CAS:Error:UserNotAllowed' => 'Вход не разрешён', 'CAS:Login:SignIn' => 'Вход через CAS', 'CAS:Login:SignInTooltip' => 'Нажмите здесь, чтобы войти через CAS сервер', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/sk.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/sk.dict.authent-cas.php index 18457a026..13ab799f1 100644 --- a/datamodels/2.x/authent-cas/dictionaries/sk.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/sk.dict.authent-cas.php @@ -1,16 +1,17 @@ 'User not allowed~~', 'CAS:Login:SignIn' => 'Sign in with CAS~~', 'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server~~', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/tr.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/tr.dict.authent-cas.php index a74c65a06..1d29cf6fe 100644 --- a/datamodels/2.x/authent-cas/dictionaries/tr.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/tr.dict.authent-cas.php @@ -1,16 +1,17 @@ 'User not allowed~~', 'CAS:Login:SignIn' => 'Sign in with CAS~~', 'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server~~', -)); +]); diff --git a/datamodels/2.x/authent-cas/dictionaries/zh_cn.dict.authent-cas.php b/datamodels/2.x/authent-cas/dictionaries/zh_cn.dict.authent-cas.php index be6675f5b..1fc970f5d 100644 --- a/datamodels/2.x/authent-cas/dictionaries/zh_cn.dict.authent-cas.php +++ b/datamodels/2.x/authent-cas/dictionaries/zh_cn.dict.authent-cas.php @@ -1,12 +1,13 @@ '用户被禁止登录', 'CAS:Login:SignIn' => '使用CAS登录', 'CAS:Login:SignInTooltip' => '点击这里使用CAS服务器认证', -)); +]); diff --git a/datamodels/2.x/authent-cas/module.authent-cas.php b/datamodels/2.x/authent-cas/module.authent-cas.php index 6a6685573..ad0e8e728 100644 --- a/datamodels/2.x/authent-cas/module.authent-cas.php +++ b/datamodels/2.x/authent-cas/module.authent-cas.php @@ -1,4 +1,5 @@ 'CAS SSO', @@ -14,36 +15,36 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - - ), + 'dependencies' => [ + + ], 'mandatory' => true, 'visible' => true, // Components // - 'datamodel' => array( + 'datamodel' => [ 'vendor/autoload.php', 'src/CASLoginExtension.php', - ), - 'webservice' => array( - - ), - 'data.struct' => array( + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Authentication 'cas_debug' => false, 'cas_host' => '', @@ -51,6 +52,6 @@ SetupWebPage::AddModule( 'cas_context' => '', 'cas_version' => '', 'service_base_url' => '', - ), - ) + ], + ] ); diff --git a/datamodels/2.x/authent-cas/src/CASLog.php b/datamodels/2.x/authent-cas/src/CASLog.php index 86b41b692..f06a5dae1 100644 --- a/datamodels/2.x/authent-cas/src/CASLog.php +++ b/datamodels/2.x/authent-cas/src/CASLog.php @@ -1,4 +1,5 @@ LogAPI::LEVEL_DEBUG, ]; - public function emergency($message, array $context = array()):void + public function emergency($message, array $context = []): void { CASLog::Error('EMERGENCY: '.$message, CASLog::CHANNEL_DEFAULT, $context); IssueLog::Error('EMERGENCY: '.$message, CASLog::CHANNEL_DEFAULT, $context); } - public function alert($message, array $context = array()):void + public function alert($message, array $context = []): void { CASLog::Error('ALERT: '.$message, CASLog::CHANNEL_DEFAULT, $context); IssueLog::Error('ALERT: '.$message, CASLog::CHANNEL_DEFAULT, $context); } - public function critical($message, array $context = array()):void + public function critical($message, array $context = []): void { CASLog::Error('CRITICAL: '.$message, CASLog::CHANNEL_DEFAULT, $context); IssueLog::Error('CRITICAL: '.$message, CASLog::CHANNEL_DEFAULT, $context); } - public function error($message, array $context = array()):void + public function error($message, array $context = []): void { CASLog::Error('ERROR: '.$message, CASLog::CHANNEL_DEFAULT, $context); IssueLog::Error('ERROR: '.$message, CASLog::CHANNEL_DEFAULT, $context); } - public function warning($message, array $context = array()):void + public function warning($message, array $context = []): void { CASLog::Warning('WARNING: '.$message, CASLog::CHANNEL_DEFAULT, $context); } - public function notice($message, array $context = array()):void + public function notice($message, array $context = []): void { CASLog::Info('NOTICE: '.$message, CASLog::CHANNEL_DEFAULT, $context); } - public function info($message, array $context = array()):void + public function info($message, array $context = []): void { CASLog::Info('INFO: '.$message, CASLog::CHANNEL_DEFAULT, $context); } - public function debug($message, array $context = array()):void + public function debug($message, array $context = []): void { CASLog::Debug('DEBUG: '.$message, CASLog::CHANNEL_DEFAULT, $context); } - public function log($level, $message, array $context = array()):void + public function log($level, $message, array $context = []): void { $sLevel = self::LEVEL_COMPAT[$level] ?? LogAPI::LEVEL_ERROR; CASLog::Log($sLevel, strtoupper($level).": $message", CASLog::CHANNEL_DEFAULT, $context); } -} \ No newline at end of file +} diff --git a/datamodels/2.x/authent-cas/src/CASLoginExtension.php b/datamodels/2.x/authent-cas/src/CASLoginExtension.php index 447b71295..d7825d5e7 100644 --- a/datamodels/2.x/authent-cas/src/CASLoginExtension.php +++ b/datamodels/2.x/authent-cas/src/CASLoginExtension.php @@ -1,4 +1,5 @@ DisplayLogoutPage(false, Dict::S('CAS:Error:UserNotAllowed')); exit(); @@ -135,8 +122,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte protected function OnConnected(&$iErrorCode) { - if (Session::Get('login_mode') == static::LOGIN_MODE) - { + if (Session::Get('login_mode') == static::LOGIN_MODE) { Session::Set('can_logoff', true); return LoginWebPage::CheckLoggedUser($iErrorCode); } @@ -149,8 +135,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte public function LogoutAction() { $sCASLogoutUrl = Config::Get('cas_logout_redirect_service'); - if (empty($sCASLogoutUrl)) - { + if (empty($sCASLogoutUrl)) { $sCASLogoutUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php'; } static::InitCASClient(); @@ -193,8 +178,8 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte // explode the host list separated by comma and use the first host $hosts = explode(',', $_SERVER['HTTP_X_FORWARDED_HOST']); // see rfc7239#5.3 and rfc7230#2.7.1: port is in HTTP_X_FORWARDED_HOST if non default - return $protocol . $hosts[0]; - } else if (!empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) { + return $protocol.$hosts[0]; + } elseif (!empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) { $server_url = $_SERVER['HTTP_X_FORWARDED_SERVER']; } else { if (empty($_SERVER['SERVER_NAME'])) { @@ -214,23 +199,20 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte $server_url .= ':'; $server_url .= $server_port; } - return $protocol . $server_url; + return $protocol.$server_url; } private function DoUserProvisioning($sLogin) { $bCASUserSynchro = Config::Get('cas_user_synchro'); - if (!$bCASUserSynchro) - { + if (!$bCASUserSynchro) { return; } CMDBObject::SetTrackInfo('CAS/LDAP Synchro'); $oUser = LoginWebPage::FindUser($sLogin, false); - if ($oUser) - { - if ($oUser->Get('status') == 'enabled') - { + if ($oUser) { + if ($oUser->Get('status') == 'enabled') { CASUserProvisioning::UpdateUser($oUser); } return; @@ -246,11 +228,11 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte $oLoginContext = new LoginTwigContext(); $oLoginContext->SetLoaderPath(APPROOT.'env-'.utils::GetCurrentEnvironment().'/authent-cas/view'); - $aData = array( + $aData = [ 'sLoginMode' => static::LOGIN_MODE, 'sLabel' => Dict::S('CAS:Login:SignIn'), 'sTooltip' => Dict::S('CAS:Login:SignInTooltip'), - ); + ]; $oLoginContext->AddBlockExtension('login_sso_buttons', new LoginBlockExtension('cas_sso_button.html.twig', $aData)); return $oLoginContext; @@ -284,84 +266,66 @@ class CASUserProvisioning $sCASMemberships = Config::Get('cas_memberof'); $bFound = false; - if (!empty($sCASMemberships)) - { + if (!empty($sCASMemberships)) { $sCASMemberOfName = Config::Get('cas_memberof_attribute_name', 'memberOf'); - if (phpCAS::hasAttribute($sCASMemberOfName)) - { + if (phpCAS::hasAttribute($sCASMemberOfName)) { // A list of groups is specified, the user must a be member of (at least) one of them to pass - $aCASMemberships = array(); + $aCASMemberships = []; $aTmp = explode(';', $sCASMemberships); setlocale(LC_ALL, "en_US.utf8"); // !!! WARNING: this is needed to have the iconv //TRANSLIT working fine below !!! - foreach($aTmp as $sGroupName) - { + foreach ($aTmp as $sGroupName) { $aCASMemberships[] = trim(iconv('UTF-8', 'ASCII//TRANSLIT', $sGroupName)); // Just in case remove accents and spaces... } $aMemberOf = phpCAS::getAttribute($sCASMemberOfName); - if (!is_array($aMemberOf)) $aMemberOf = array($aMemberOf); // Just one entry, turn it into an array - $aFilteredGroupNames = array(); - foreach($aMemberOf as $sGroupName) - { + if (!is_array($aMemberOf)) { + $aMemberOf = [$aMemberOf]; + } // Just one entry, turn it into an array + $aFilteredGroupNames = []; + foreach ($aMemberOf as $sGroupName) { phpCAS::log("Info: user if a member of the group: ".$sGroupName); $sGroupName = trim(iconv('UTF-8', 'ASCII//TRANSLIT', $sGroupName)); // Remove accents and spaces as well $aFilteredGroupNames[] = $sGroupName; $bIsMember = false; - foreach($aCASMemberships as $sCASPattern) - { - if (self::IsPattern($sCASPattern)) - { - if (preg_match($sCASPattern, $sGroupName)) - { + foreach ($aCASMemberships as $sCASPattern) { + if (self::IsPattern($sCASPattern)) { + if (preg_match($sCASPattern, $sGroupName)) { $bIsMember = true; break; } - } - else if ($sCASPattern == $sGroupName) - { + } elseif ($sCASPattern == $sGroupName) { $bIsMember = true; break; } } - if ($bIsMember) - { + if ($bIsMember) { // If needed create a new user for this email/profile $bOk = self::CreateCASUser(phpCAS::getUser(), $aMemberOf); - if($bOk) - { + if ($bOk) { $bFound = true; - } - else - { + } else { phpCAS::log("User ".phpCAS::getUser()." cannot be created in iTop. Logging off..."); } break; } } - if($bOk && !$bFound) - { + if ($bOk && !$bFound) { phpCAS::log("User ".phpCAS::getUser().", none of his/her groups (".implode('; ', $aFilteredGroupNames).") match any of the required groups: ".implode('; ', $aCASMemberships)); } - } - else - { + } else { // Too bad, the user is not part of any of the group => not allowed phpCAS::log("No '$sCASMemberOfName' attribute found for user ".phpCAS::getUser().". Are you using the SAML protocol (S1) ?"); } - } - else - { + } else { // No membership: no way to create the user that should exist prior to authentication phpCAS::log("User ".phpCAS::getUser().": missing user account in iTop (or iTop badly configured, Cf setting cas_memberof)"); $bFound = false; } - if (!$bFound) - { + if (!$bFound) { // The user is not part of the allowed groups, => log out $sCASLogoutUrl = Config::Get('cas_logout_redirect_service'); - if (empty($sCASLogoutUrl)) - { + if (empty($sCASLogoutUrl)) { $sCASLogoutUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php'; } phpCAS::logoutWithRedirectService($sCASLogoutUrl); // Redirects to the CAS logout page @@ -385,10 +349,11 @@ class CASUserProvisioning { $bCASUpdateProfiles = Config::Get('cas_update_profiles'); $sCASMemberOfName = Config::Get('cas_memberof_attribute_name', 'memberOf'); - if ($bCASUpdateProfiles && (phpCAS::hasAttribute($sCASMemberOfName))) - { + if ($bCASUpdateProfiles && (phpCAS::hasAttribute($sCASMemberOfName))) { $aMemberOf = phpCAS::getAttribute($sCASMemberOfName); - if (!is_array($aMemberOf)) $aMemberOf = array($aMemberOf); // Just one entry, turn it into an array + if (!is_array($aMemberOf)) { + $aMemberOf = [$aMemberOf]; + } // Just one entry, turn it into an array self::SetProfilesFromCAS($oUser, $aMemberOf); } @@ -410,30 +375,24 @@ class CASUserProvisioning */ protected static function CreateCASUser($sLogin, $aGroups) { - if (!MetaModel::IsValidClass('URP_Profiles')) - { + if (!MetaModel::IsValidClass('URP_Profiles')) { phpCAS::log("URP_Profiles is not a valid class. Automatic creation of Users is not supported in this context, sorry."); return false; } $oUser = MetaModel::GetObjectByName('UserExternal', $sLogin, false); - if ($oUser == null) - { + if ($oUser == null) { // Create the user, link it to a contact - if (phpCAS::hasAttribute('mail')) - { + if (phpCAS::hasAttribute('mail')) { $sEmail = phpCAS::getAttribute('mail'); - } - else - { + } else { $sEmail = $sLogin; } phpCAS::log("Info: the user '$sLogin' does not exist. A new UserExternal will be created."); $oSearch = new DBObjectSearch('Person'); $oSearch->AddCondition('email', $sEmail); $oSet = new DBObjectSet($oSearch); - switch($oSet->Count()) - { + switch ($oSet->Count()) { case 0: phpCAS::log("Error: found no contact with the email: '$sEmail'. Cannot create the user in iTop."); return false; @@ -453,9 +412,7 @@ class CASUserProvisioning $oUser->Set('login', $sLogin); $oUser->Set('contactid', $iContactId); $oUser->Set('language', MetaModel::GetConfig()->GetDefaultLanguage()); - } - else - { + } else { phpCAS::log("Info: the user '$sLogin' already exists (id=".$oUser->GetKey().")."); } @@ -474,8 +431,7 @@ class CASUserProvisioning */ protected static function SetProfilesFromCAS($oUser, $aGroups) { - if (!MetaModel::IsValidClass('URP_Profiles')) - { + if (!MetaModel::IsValidClass('URP_Profiles')) { phpCAS::log("URP_Profiles is not a valid class. Automatic creation of Users is not supported in this context, sorry."); return false; } @@ -483,56 +439,42 @@ class CASUserProvisioning // read all the existing profiles $oProfilesSearch = new DBObjectSearch('URP_Profiles'); $oProfilesSet = new DBObjectSet($oProfilesSearch); - $aAllProfiles = array(); - while($oProfile = $oProfilesSet->Fetch()) - { + $aAllProfiles = []; + while ($oProfile = $oProfilesSet->Fetch()) { $aAllProfiles[mb_strtolower($oProfile->GetName())] = $oProfile->GetKey(); } // Translate the CAS/LDAP group names into iTop profile names - $aProfiles = array(); + $aProfiles = []; $sPattern = Config::Get('cas_profile_pattern'); - foreach($aGroups as $sGroupName) - { - if (preg_match($sPattern, $sGroupName, $aMatches)) - { - if (array_key_exists(mb_strtolower($aMatches[1]), $aAllProfiles)) - { + foreach ($aGroups as $sGroupName) { + if (preg_match($sPattern, $sGroupName, $aMatches)) { + if (array_key_exists(mb_strtolower($aMatches[1]), $aAllProfiles)) { $aProfiles[] = $aAllProfiles[mb_strtolower($aMatches[1])]; phpCAS::log("Info: Adding the profile '{$aMatches[1]}' from CAS."); - } - else - { + } else { phpCAS::log("Warning: {$aMatches[1]} is not a valid iTop profile (extracted from group name: '$sGroupName'). Ignored."); } - } - else - { + } else { phpCAS::log("Info: The CAS group '$sGroupName' does not seem to match an iTop pattern. Ignored."); } } - if (count($aProfiles) == 0) - { + if (count($aProfiles) == 0) { phpCAS::log("Info: The user '".$oUser->GetName()."' has no profiles retrieved from CAS. Default profile(s) will be used."); // Second attempt: check if there is/are valid default profile(s) $sCASDefaultProfiles = Config::Get('cas_default_profiles'); $aCASDefaultProfiles = explode(';', $sCASDefaultProfiles); - foreach($aCASDefaultProfiles as $sDefaultProfileName) - { - if (array_key_exists(mb_strtolower($sDefaultProfileName), $aAllProfiles)) - { + foreach ($aCASDefaultProfiles as $sDefaultProfileName) { + if (array_key_exists(mb_strtolower($sDefaultProfileName), $aAllProfiles)) { $aProfiles[] = $aAllProfiles[mb_strtolower($sDefaultProfileName)]; phpCAS::log("Info: Adding the default profile '".$aAllProfiles[mb_strtolower($sDefaultProfileName)]."' from CAS."); - } - else - { + } else { phpCAS::log("Warning: the default profile {$sDefaultProfileName} is not a valid iTop profile. Ignored."); } } - if (count($aProfiles) == 0) - { + if (count($aProfiles) == 0) { phpCAS::log("Error: The user '".$oUser->GetName()."' has no profiles in iTop, and therefore cannot be created."); return false; } @@ -542,8 +484,7 @@ class CASUserProvisioning LoginWebPage::SynchronizeProfiles($oUser, $aProfiles, 'CAS/LDAP Synchro'); phpCAS::log("Info: the user '".$oUser->GetName()."' (id=".$oUser->GetKey().") now has the following profiles: '".implode("', '", $aProfiles)."'."); - if ($oUser->IsModified()) - { + if ($oUser->IsModified()) { $oUser->DBWrite(); } @@ -557,13 +498,10 @@ class CASUserProvisioning */ protected static function IsPattern($sCASPattern) { - if ((substr($sCASPattern, 0, 1) == '/') && (substr($sCASPattern, -1) == '/')) - { + if ((substr($sCASPattern, 0, 1) == '/') && (substr($sCASPattern, -1) == '/')) { // the string is enclosed by slashes, let's assume it's a pattern return true; - } - else - { + } else { return false; } } diff --git a/datamodels/2.x/authent-cas/src/Config.php b/datamodels/2.x/authent-cas/src/Config.php index fb447fa83..5d77f7035 100644 --- a/datamodels/2.x/authent-cas/src/Config.php +++ b/datamodels/2.x/authent-cas/src/Config.php @@ -1,4 +1,5 @@ Get($sName); } - if (empty($sValue)) - { + if (empty($sValue)) { return $sDefaultValue; } return $sValue; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/authent-external/dictionaries/cs.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/cs.dict.authent-external.php index dd1c13528..b97173643 100644 --- a/datamodels/2.x/authent-external/dictionaries/cs.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/cs.dict.authent-external.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:UserExternal' => 'Externí uživatel', 'Class:UserExternal+' => 'Uživatel definovaný mimo '.ITOP_APPLICATION_SHORT, -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/da.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/da.dict.authent-external.php index a7e5a551c..e498fe75b 100644 --- a/datamodels/2.x/authent-external/dictionaries/da.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/da.dict.authent-external.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:UserExternal' => 'Extern Bruger', 'Class:UserExternal+' => 'Bruger udenfor '.ITOP_APPLICATION_SHORT, -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/de.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/de.dict.authent-external.php index 8b1e32aa1..2dc3f1e2b 100644 --- a/datamodels/2.x/authent-external/dictionaries/de.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/de.dict.authent-external.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:UserExternal' => 'Externer Benutzer', 'Class:UserExternal+' => 'Extern authentifizierter '.ITOP_APPLICATION_SHORT.'-Benutzer', -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/en.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/en.dict.authent-external.php index e6a585036..881bb4316 100644 --- a/datamodels/2.x/authent-external/dictionaries/en.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/en.dict.authent-external.php @@ -1,4 +1,5 @@ 'External user', 'Class:UserExternal+' => 'User authentified outside of '.ITOP_APPLICATION_SHORT, -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/en_gb.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/en_gb.dict.authent-external.php index 591f5891a..d47bd1665 100644 --- a/datamodels/2.x/authent-external/dictionaries/en_gb.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/en_gb.dict.authent-external.php @@ -1,4 +1,5 @@ 'External user', 'Class:UserExternal+' => 'User authentified outside of '.ITOP_APPLICATION_SHORT, -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/es_cr.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/es_cr.dict.authent-external.php index 8e45454f2..83496e280 100644 --- a/datamodels/2.x/authent-external/dictionaries/es_cr.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/es_cr.dict.authent-external.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:UserExternal' => 'Usuario externo', 'Class:UserExternal+' => 'Usuario autenticado fuera de '.ITOP_APPLICATION_SHORT, -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/fr.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/fr.dict.authent-external.php index 036bd5f0d..bc40e834f 100644 --- a/datamodels/2.x/authent-external/dictionaries/fr.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/fr.dict.authent-external.php @@ -1,15 +1,16 @@ 'Utilisateur externe à '.ITOP_APPLICATION_SHORT, 'Class:UserExternal+' => 'Utilisateur authentifié à l\'extérieur de '.ITOP_APPLICATION_SHORT, -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/hu.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/hu.dict.authent-external.php index 82eaa787a..542ea1627 100644 --- a/datamodels/2.x/authent-external/dictionaries/hu.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/hu.dict.authent-external.php @@ -1,15 +1,16 @@ 'Külső felhasználó', 'Class:UserExternal+' => '', -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/it.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/it.dict.authent-external.php index 9d5cf11e2..39b87d2f4 100644 --- a/datamodels/2.x/authent-external/dictionaries/it.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/it.dict.authent-external.php @@ -1,15 +1,16 @@ 'Esterno utente', 'Class:UserExternal+' => 'Utente autenticato al di fuori di '.ITOP_APPLICATION_SHORT, -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/ja.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/ja.dict.authent-external.php index b1bf9b30e..806afaf2d 100644 --- a/datamodels/2.x/authent-external/dictionaries/ja.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/ja.dict.authent-external.php @@ -1,16 +1,17 @@ * */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:UserExternal' => '外部ユーザー', 'Class:UserExternal+' => '外部認証ユーザー', -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/nl.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/nl.dict.authent-external.php index 18629d91c..587c7836e 100644 --- a/datamodels/2.x/authent-external/dictionaries/nl.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/nl.dict.authent-external.php @@ -1,16 +1,17 @@ (2018 - 2022) * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:UserExternal' => 'Externe gebruiker', 'Class:UserExternal+' => 'Gebruiker aangemeld via externe authenticatie', -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/pl.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/pl.dict.authent-external.php index 1c0a75976..54e791cb7 100644 --- a/datamodels/2.x/authent-external/dictionaries/pl.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/pl.dict.authent-external.php @@ -1,15 +1,16 @@ 'Użytkownik zewnętrzny', 'Class:UserExternal+' => 'Użytkownik uwierzytelniony poza '.ITOP_APPLICATION_SHORT, -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/pt_br.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/pt_br.dict.authent-external.php index b6cb6b369..c7b0275b6 100644 --- a/datamodels/2.x/authent-external/dictionaries/pt_br.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/pt_br.dict.authent-external.php @@ -1,15 +1,16 @@ 'Usuário externo', 'Class:UserExternal+' => '', -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/ru.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/ru.dict.authent-external.php index a31c71b19..61336b211 100644 --- a/datamodels/2.x/authent-external/dictionaries/ru.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/ru.dict.authent-external.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:UserExternal' => 'Внешний пользователь', 'Class:UserExternal+' => 'Пользователь, аутентифицируемый вне '.ITOP_APPLICATION_SHORT, -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/sk.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/sk.dict.authent-external.php index 98fa70a59..0dcc89901 100644 --- a/datamodels/2.x/authent-external/dictionaries/sk.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/sk.dict.authent-external.php @@ -1,15 +1,16 @@ 'Externý užívateľ', 'Class:UserExternal+' => 'User authentified outside of '.ITOP_APPLICATION_SHORT.'~~', -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/tr.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/tr.dict.authent-external.php index 3352e129f..fd2ea3955 100644 --- a/datamodels/2.x/authent-external/dictionaries/tr.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/tr.dict.authent-external.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:UserExternal' => 'Harici kullanıcı', 'Class:UserExternal+' => ITOP_APPLICATION_SHORT.' dışında yetki kontrolü yapılan kullanıcı', -)); +]); diff --git a/datamodels/2.x/authent-external/dictionaries/zh_cn.dict.authent-external.php b/datamodels/2.x/authent-external/dictionaries/zh_cn.dict.authent-external.php index 1fef0be90..a1405c56a 100644 --- a/datamodels/2.x/authent-external/dictionaries/zh_cn.dict.authent-external.php +++ b/datamodels/2.x/authent-external/dictionaries/zh_cn.dict.authent-external.php @@ -1,4 +1,5 @@ '外部用户', 'Class:UserExternal+' => '用户在'.ITOP_APPLICATION_SHORT.'外部验证身份', -)); +]); diff --git a/datamodels/2.x/authent-external/model.authent-external.php b/datamodels/2.x/authent-external/model.authent-external.php index 7c35044d6..81f427b9e 100755 --- a/datamodels/2.x/authent-external/model.authent-external.php +++ b/datamodels/2.x/authent-external/model.authent-external.php @@ -1,9 +1,10 @@ - /** * Authent External * User authentication Module, for authentication outside of the iTop application @@ -30,44 +30,44 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - class UserExternal extends User { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/authentication,grant_by_profile,silo", "key_type" => "autoincrement", "name_attcode" => "login", "state_attcode" => "", - "reconc_keys" => array('login'), + "reconc_keys" => ['login'], "db_table" => "", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); // Display lists - MetaModel::Init_SetZListItems('details', - array( + MetaModel::Init_SetZListItems( + 'details', + [ 'col:col1' => - array( - 'fieldset:User:info' => array('contactid', 'org_id', 'email', 'login', 'language', 'status'), - ), + [ + 'fieldset:User:info' => ['contactid', 'org_id', 'email', 'login', 'language', 'status'], + ], 'col:col2' => - array( - 'fieldset:User:profiles' => array('profile_list'), - ), + [ + 'fieldset:User:profiles' => ['profile_list'], + ], 'allowed_org_list', 'log', - ) + ] ); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('first_name', 'last_name', 'login', 'status')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('list', ['first_name', 'last_name', 'login', 'status']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('login', 'contactid', 'status', 'org_id')); // Criteria of the std search form - MetaModel::Init_SetZListItems('advanced_search', array('login', 'contactid', 'status', 'org_id')); // Criteria of the advanced search form + MetaModel::Init_SetZListItems('standard_search', ['login', 'contactid', 'status', 'org_id']); // Criteria of the std search form + MetaModel::Init_SetZListItems('advanced_search', ['login', 'contactid', 'status', 'org_id']); // Criteria of the advanced search form } /** @@ -97,6 +97,3 @@ class UserExternal extends User return false; } } - - -?> diff --git a/datamodels/2.x/authent-external/module.authent-external.php b/datamodels/2.x/authent-external/module.authent-external.php index bfdce23eb..8b74f196e 100755 --- a/datamodels/2.x/authent-external/module.authent-external.php +++ b/datamodels/2.x/authent-external/module.authent-external.php @@ -1,9 +1,10 @@ - /** * Authent External * Module definition file for the "External Authentication" module @@ -28,7 +28,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file 'authent-external/3.2.1', - array( + [ // Identification // 'label' => 'External user authentication', @@ -36,23 +36,23 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - ), + 'dependencies' => [ + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array( + 'datamodel' => [ 'model.authent-external.php', - ), - 'data.struct' => array( + ], + 'data.struct' => [ //'data.struct.authent-ldap.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.authent-ldap.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -60,6 +60,6 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array(), - ) + 'settings' => [], + ] ); diff --git a/datamodels/2.x/authent-ldap/dictionaries/cs.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/cs.dict.authent-ldap.php index 6174f897b..5c885fa19 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/cs.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/cs.dict.authent-ldap.php @@ -1,27 +1,28 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:UserLDAP' => 'LDAP uživatel', 'Class:UserLDAP+' => 'Uživatel ověřen přes LDAP', 'UserLDAP:server' => 'Specifika LDAP', -)); +]); // // Class: UserLDAP // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/da.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/da.dict.authent-ldap.php index c85699a2d..b63d0677c 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/da.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/da.dict.authent-ldap.php @@ -1,26 +1,27 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:UserLDAP' => 'LDAP-Bruger', 'Class:UserLDAP+' => 'Bruger der godkendes via LDAP', 'UserLDAP:server' => 'LDAP specifics~~', -)); +]); // // Class: UserLDAP // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/de.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/de.dict.authent-ldap.php index 5232e0007..1e52fb4c6 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/de.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/de.dict.authent-ldap.php @@ -1,26 +1,27 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:UserLDAP' => 'LDAP-Benutzer', 'Class:UserLDAP+' => 'Benutzer, der via LDAP authentifiziert wird', 'UserLDAP:server' => 'LDAP-Einstellungen', -)); +]); // // Class: UserLDAP // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:UserLDAP/Attribute:ldap_server' => 'LDAP-Server', 'Class:UserLDAP/Attribute:ldap_server+' => 'Optional: LDAP-Server, der zur Authentifizierung verwendet werden soll, falls mehrere LDAP-Server konfiguriert sind.', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/en.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/en.dict.authent-ldap.php index 05847874f..9a422246c 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/en.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/en.dict.authent-ldap.php @@ -1,4 +1,5 @@ 'LDAP user', 'Class:UserLDAP+' => 'User authenticated by LDAP', 'UserLDAP:server' => 'LDAP specifics', -)); +]); // // Class: UserLDAP // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server', 'Class:UserLDAP/Attribute:ldap_server+' => '', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/en_gb.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/en_gb.dict.authent-ldap.php index 82cd17108..e25d03e56 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/en_gb.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/en_gb.dict.authent-ldap.php @@ -1,4 +1,5 @@ 'LDAP user', 'Class:UserLDAP+' => 'User authenticated by LDAP', 'UserLDAP:server' => 'LDAP specifics', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/es_cr.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/es_cr.dict.authent-ldap.php index ebbf6fb17..4c1c8002a 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/es_cr.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/es_cr.dict.authent-ldap.php @@ -1,23 +1,24 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:UserLDAP' => 'Usuario LDAP', 'Class:UserLDAP+' => 'Usuario autenticado vía LDAP', 'UserLDAP:server' => 'Especificaciones LDAP', -)); +]); // // Class: UserLDAP // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/fr.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/fr.dict.authent-ldap.php index 9a34d5a6e..be0a57a20 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/fr.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/fr.dict.authent-ldap.php @@ -1,25 +1,26 @@ 'Utilisateur LDAP', 'Class:UserLDAP+' => 'Utilisateur authentifié par un serveur LDAP', 'UserLDAP:server' => 'Champs spécifiques pour LDAP', -)); +]); // // Class: UserLDAP // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/hu.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/hu.dict.authent-ldap.php index bc6665ee2..ad3165d9a 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/hu.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/hu.dict.authent-ldap.php @@ -1,25 +1,26 @@ 'LDAP felhasználó', 'Class:UserLDAP+' => 'LDAP vagy AD felhasználó', 'UserLDAP:server' => 'LDAP specifics~~', -)); +]); // // Class: UserLDAP // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/it.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/it.dict.authent-ldap.php index 35fc89014..5573a9193 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/it.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/it.dict.authent-ldap.php @@ -1,25 +1,26 @@ 'Utente LDAP', 'Class:UserLDAP+' => 'Utente autenticato da LDAP', 'UserLDAP:server' => 'Specifiche LDAP', -)); +]); // // Class: UserLDAP // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/ja.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/ja.dict.authent-ldap.php index f22ec305e..5387fdef9 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/ja.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/ja.dict.authent-ldap.php @@ -1,26 +1,27 @@ * */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:UserLDAP' => 'LDAP ユーザー', 'Class:UserLDAP+' => 'LDAP認証ユーザー', 'UserLDAP:server' => 'LDAP specifics~~', -)); +]); // // Class: UserLDAP // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/nl.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/nl.dict.authent-ldap.php index 184b44810..502370f54 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/nl.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/nl.dict.authent-ldap.php @@ -1,26 +1,27 @@ * @author Jeffrey Bostoen (2018 - 2022) */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:UserLDAP' => 'LDAP-gebruiker', 'Class:UserLDAP+' => 'Gebruiker die aanmeldt via LDAP', 'UserLDAP:server' => 'LDAP informatie', -)); +]); // // Class: UserLDAP // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/pl.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/pl.dict.authent-ldap.php index f29cc7105..758477b47 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/pl.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/pl.dict.authent-ldap.php @@ -1,25 +1,26 @@ 'Użytkownik LDAP', 'Class:UserLDAP+' => 'Użytkownik uwierzytelniony przez LDAP', 'UserLDAP:server' => 'Serwer LDAP', -)); +]); // // Class: UserLDAP // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/pt_br.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/pt_br.dict.authent-ldap.php index 149280dc9..a4ab118cc 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/pt_br.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/pt_br.dict.authent-ldap.php @@ -1,25 +1,26 @@ 'Usuário externo via LDAP', 'Class:UserLDAP+' => '', 'UserLDAP:server' => 'LDAP specifics~~', -)); +]); // // Class: UserLDAP // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/ru.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/ru.dict.authent-ldap.php index f43e15d8d..5aa3153d2 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/ru.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/ru.dict.authent-ldap.php @@ -1,26 +1,27 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:UserLDAP' => 'Пользователь LDAP', 'Class:UserLDAP+' => 'Пользователь, аутентифицируемый через LDAP', 'UserLDAP:server' => 'LDAP specifics~~', -)); +]); // // Class: UserLDAP // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/sk.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/sk.dict.authent-ldap.php index d3546c975..50d232a51 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/sk.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/sk.dict.authent-ldap.php @@ -1,25 +1,26 @@ 'LDAP užívateľ', 'Class:UserLDAP+' => 'User authenticated by LDAP~~', 'UserLDAP:server' => 'LDAP specifics~~', -)); +]); // // Class: UserLDAP // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/tr.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/tr.dict.authent-ldap.php index 15362fbb8..e45293a7b 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/tr.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/tr.dict.authent-ldap.php @@ -1,26 +1,27 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:UserLDAP' => 'LDAP kullanıcısı', 'Class:UserLDAP+' => 'Yetki kontrolü LDAP tarafından yapılan', 'UserLDAP:server' => 'LDAP specifics~~', -)); +]); // // Class: UserLDAP // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/dictionaries/zh_cn.dict.authent-ldap.php b/datamodels/2.x/authent-ldap/dictionaries/zh_cn.dict.authent-ldap.php index 17ce45749..77b70b879 100644 --- a/datamodels/2.x/authent-ldap/dictionaries/zh_cn.dict.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/dictionaries/zh_cn.dict.authent-ldap.php @@ -1,4 +1,5 @@ 'LDAP用户', 'Class:UserLDAP+' => '用户身份由LDAP认证', 'UserLDAP:server' => 'LDAP详情', -)); +]); // // Class: UserLDAP // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~', 'Class:UserLDAP/Attribute:ldap_server+' => '~~', -)); +]); diff --git a/datamodels/2.x/authent-ldap/module.authent-ldap.php b/datamodels/2.x/authent-ldap/module.authent-ldap.php index 8e2d12771..b101e39fc 100755 --- a/datamodels/2.x/authent-ldap/module.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/module.authent-ldap.php @@ -1,80 +1,78 @@ 'User authentication based on LDAP', - 'category' => 'authentication', + SetupWebPage::AddModule( + __FILE__, // Path to the current file, all other file names are relative to the directory containing this file + 'authent-ldap/3.2.1', + [ + // Identification + // + 'label' => 'User authentication based on LDAP', + 'category' => 'authentication', - // Setup - // - 'dependencies' => array( - ), - 'mandatory' => false, - 'visible' => true, - 'installer' => 'AuthentLDAPInstaller', + // Setup + // + 'dependencies' => [ + ], + 'mandatory' => false, + 'visible' => true, + 'installer' => 'AuthentLDAPInstaller', - // Components - // - 'datamodel' => array( - ), - 'data.struct' => array( - //'data.struct.authent-ldap.xml', - ), - 'data.sample' => array( - //'data.sample.authent-ldap.xml', - ), - - // Documentation - // - 'doc.manual_setup' => '', - 'doc.more_information' => '', + // Components + // + 'datamodel' => [ + ], + 'data.struct' => [ + //'data.struct.authent-ldap.xml', + ], + 'data.sample' => [ + //'data.sample.authent-ldap.xml', + ], - // Default settings - // - 'settings' => array( - 'host' => 'localhost', // host or IP address of your LDAP server - 'port' => 389, // LDAP port (std: 389) - 'default_user' => '', // User and password used for initial "Anonymous" bind to LDAP - 'default_pwd' => '', // Leave both blank, if anonymous (read-only) bind is allowed - 'base_dn' => 'dc=yourcompany,dc=com', // Base DN for User queries, adjust it to your LDAP schema - 'user_query' => '(&(uid=%1$s)(inetuserstatus=ACTIVE))', // Query used to retrieve each user %1$s => iTop login - // For Windows AD use (samaccountname=%1$s) or (userprincipalname=%1$s) - - // Some extra LDAP options, refer to: http://www.php.net/manual/en/function.ldap-set-option.php for more info - 'options' => array( - LDAP_OPT_PROTOCOL_VERSION => 3, - LDAP_OPT_REFERRALS => 0, - ), - 'start_tls' => false, - 'debug' => false, - 'servers' => array(), - ), - ) -); + // Documentation + // + 'doc.manual_setup' => '', + 'doc.more_information' => '', -// Module installation handler -// -class AuthentLDAPInstaller extends ModuleInstallerAPI -{ - public static function AfterDataLoad(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) + // Default settings + // + 'settings' => [ + 'host' => 'localhost', // host or IP address of your LDAP server + 'port' => 389, // LDAP port (std: 389) + 'default_user' => '', // User and password used for initial "Anonymous" bind to LDAP + 'default_pwd' => '', // Leave both blank, if anonymous (read-only) bind is allowed + 'base_dn' => 'dc=yourcompany,dc=com', // Base DN for User queries, adjust it to your LDAP schema + 'user_query' => '(&(uid=%1$s)(inetuserstatus=ACTIVE))', // Query used to retrieve each user %1$s => iTop login + // For Windows AD use (samaccountname=%1$s) or (userprincipalname=%1$s) + + // Some extra LDAP options, refer to: http://www.php.net/manual/en/function.ldap-set-option.php for more info + 'options' => [ + LDAP_OPT_PROTOCOL_VERSION => 3, + LDAP_OPT_REFERRALS => 0, + ], + 'start_tls' => false, + 'debug' => false, + 'servers' => [], + ], + ] + ); + + // Module installation handler + // + class AuthentLDAPInstaller extends ModuleInstallerAPI { - // Create missing table entries - $sUserLDAPTable = MetaModel::DBGetTable('UserLDAP'); - $sUserTable = MetaModel::DBGetTable('User'); - $sSQL = "insert into $sUserLDAPTable (id) select U.id from $sUserTable as U left join $sUserLDAPTable as L on U.id = L.id where U.finalclass='UserLDAP' and isnull(L.id);"; - CMDBSource::Query($sSQL); + public static function AfterDataLoad(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) + { + // Create missing table entries + $sUserLDAPTable = MetaModel::DBGetTable('UserLDAP'); + $sUserTable = MetaModel::DBGetTable('User'); + $sSQL = "insert into $sUserLDAPTable (id) select U.id from $sUserTable as U left join $sUserLDAPTable as L on U.id = L.id where U.finalclass='UserLDAP' and isnull(L.id);"; + CMDBSource::Query($sSQL); + } } -} } // if (function_exists('ldap_connect')) diff --git a/datamodels/2.x/authent-local/dictionaries/cs.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/cs.dict.authent-local.php index 30ed27bd9..7f1c83b66 100644 --- a/datamodels/2.x/authent-local/dictionaries/cs.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/cs.dict.authent-local.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:UserLocal' => 'interní uživatel '.ITOP_APPLICATION_SHORT, 'Class:UserLocal+' => 'Uživatel ověřen interně v '.ITOP_APPLICATION_SHORT, 'Class:UserLocal/Attribute:password' => 'Heslo', @@ -31,4 +32,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Heslo musí obsahovat minimálně 8 znaků a musí obsahovat minimálně jedno velké písmeno, jedno malé písmeno, jedno číslo a speciální znak.', 'UserLocal:password:expiration' => 'Níže uvedená pole vyžadují rozšíření', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Nastavení exspirace "Jednorázového hesla" nelze u vlastního účtu uživatele.', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/da.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/da.dict.authent-local.php index 0494ea256..79c5c7339 100644 --- a/datamodels/2.x/authent-local/dictionaries/da.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/da.dict.authent-local.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:UserLocal' => ITOP_APPLICATION_SHORT.'-Bruger', 'Class:UserLocal+' => 'Bruger der godkendes af '.ITOP_APPLICATION_SHORT, 'Class:UserLocal/Attribute:password' => 'Password', @@ -30,4 +31,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.~~', 'UserLocal:password:expiration' => 'The fields below require an extension~~', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User~~', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/de.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/de.dict.authent-local.php index 753b10214..269105507 100644 --- a/datamodels/2.x/authent-local/dictionaries/de.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/de.dict.authent-local.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:UserLocal' => ITOP_APPLICATION_SHORT.'-Benutzer', 'Class:UserLocal+' => 'Benutzer, der von '.ITOP_APPLICATION_SHORT.' authentifiziert wird', 'Class:UserLocal/Attribute:password' => 'Passwort', @@ -30,4 +31,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Das Passwort entspricht nicht dem in den Konfigurationsregeln hinterlegten RegEx-Ausdruck', 'UserLocal:password:expiration' => 'Die folgenden Felder benötigen eine '.ITOP_APPLICATION_SHORT.' Erweiterung', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Das setzen des Passwortablaufs auf "Einmalpasswort" ist für den eigenen Benutzer nicht erlaubt.', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/en.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/en.dict.authent-local.php index cd3a825f4..1e588bd5e 100644 --- a/datamodels/2.x/authent-local/dictionaries/en.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/en.dict.authent-local.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT.' user', 'Class:UserLocal+' => 'User authentified by '.ITOP_APPLICATION_SHORT, 'Class:UserLocal/Attribute:password' => 'Password', @@ -57,4 +58,4 @@ Dict::Add('EN US', 'English', 'English', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.', 'UserLocal:password:expiration' => 'The fields below require an extension', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/en_gb.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/en_gb.dict.authent-local.php index b3695a5f4..bc57f4b4e 100644 --- a/datamodels/2.x/authent-local/dictionaries/en_gb.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/en_gb.dict.authent-local.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT.' user', 'Class:UserLocal+' => 'User authentified by '.ITOP_APPLICATION_SHORT, 'Class:UserLocal/Attribute:password' => 'Password', @@ -57,4 +58,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.', 'UserLocal:password:expiration' => 'The fields below require an extension', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/es_cr.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/es_cr.dict.authent-local.php index 2d7442b15..adda854d0 100644 --- a/datamodels/2.x/authent-local/dictionaries/es_cr.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/es_cr.dict.authent-local.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:UserLocal' => 'Usuario de '.ITOP_APPLICATION_SHORT, 'Class:UserLocal+' => 'Usuario Autenticado vía '.ITOP_APPLICATION_SHORT, 'Class:UserLocal/Attribute:password' => 'Contraseña', @@ -27,4 +28,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'La contraseña debe ser de al menos 8 caracteres e incluír mayúsculas, minúsculas, números y caracteres especiales.', 'UserLocal:password:expiration' => 'El siguiente campo requiere una extensión', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Configurar expiración de contraseña para "ontraseña de un solo uso" no está permitido para su propio Usuario', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/fr.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/fr.dict.authent-local.php index 2b6bad021..71bd50a88 100644 --- a/datamodels/2.x/authent-local/dictionaries/fr.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/fr.dict.authent-local.php @@ -1,15 +1,16 @@ 'Utilisateur '.ITOP_APPLICATION_SHORT, 'Class:UserLocal+' => 'Utilisateur authentifié par '.ITOP_APPLICATION_SHORT, 'Class:UserLocal/Attribute:password' => 'Mot de passe', @@ -29,4 +30,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Le mot de passe doit contenir au moins 8 caractères, avec minuscule, majuscule, nombre et caractère spécial.', 'UserLocal:password:expiration' => 'Les champs ci-dessous nécessitent une extension', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Impossible de mettre "Usage unique" comme validité du mot de passe pour son propre utilisateur.', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/hu.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/hu.dict.authent-local.php index 6a6746f42..270ece0e4 100644 --- a/datamodels/2.x/authent-local/dictionaries/hu.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/hu.dict.authent-local.php @@ -1,15 +1,16 @@ ITOP_APPLICATION_SHORT.' felhasználó', 'Class:UserLocal+' => 'Rendszeren belül létrehozott felhasználó', 'Class:UserLocal/Attribute:password' => 'Jelszó', @@ -29,4 +30,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'A jelszónak legalább 8 karakterből kell állnia, és tartalmaznia kell nagybetűket, kisbetűket, numerikus és speciális karaktereket.', 'UserLocal:password:expiration' => 'Az alábbi mezőkhöz egy bővítmény szükséges', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'A jelszó lejárati idejének beállítása "Egyszeri jelszóra" nem engedélyezett a saját Felhasználó számára.', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/it.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/it.dict.authent-local.php index 7ef879aae..3bfd3414c 100644 --- a/datamodels/2.x/authent-local/dictionaries/it.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/it.dict.authent-local.php @@ -1,15 +1,16 @@ 'Utente '.ITOP_APPLICATION_SHORT, 'Class:UserLocal+' => 'Utente autenticato da '.ITOP_APPLICATION_SHORT, 'Class:UserLocal/Attribute:password' => 'Password', @@ -29,4 +30,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'La password deve essere di almeno 8 caratteri e includere lettere maiuscole, minuscole, numeri e caratteri speciali.', 'UserLocal:password:expiration' => 'I campi sottostanti richiedono un\'estensione', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Impostare la scadenza della password su "Password monouso" non è consentito per il proprio utente', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/ja.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/ja.dict.authent-local.php index 42298d14e..bc47d26b3 100644 --- a/datamodels/2.x/authent-local/dictionaries/ja.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/ja.dict.authent-local.php @@ -1,16 +1,17 @@ * */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:UserLocal' => ITOP_APPLICATION_SHORT.'ユーザー', 'Class:UserLocal+' => ITOP_APPLICATION_SHORT.'ローカル認証ユーザー', 'Class:UserLocal/Attribute:password' => 'パスワード', @@ -30,4 +31,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.~~', 'UserLocal:password:expiration' => 'The fields below require an extension~~', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User~~', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/nl.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/nl.dict.authent-local.php index 76f8e26e0..71a666179 100644 --- a/datamodels/2.x/authent-local/dictionaries/nl.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/nl.dict.authent-local.php @@ -1,16 +1,17 @@ (2018 - 2022) * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:UserLocal' => ITOP_APPLICATION_SHORT.'-gebruiker', 'Class:UserLocal+' => 'Gebruiker die aanmeldt met gegevens aangemaakt in het gebruikersbeheer van '.ITOP_APPLICATION_SHORT, 'Class:UserLocal/Attribute:password' => 'Wachtwoord', @@ -30,4 +31,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Het wachtwoord bestaat uit minstens 8 tekens en bestaat uit een mix van minstens 1 hoofdletter, kleine letter, cijfer en speciaal teken.', 'UserLocal:password:expiration' => 'De velden hieronder vereisen een extensie.', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Je kan geen eenmalig wachtwoord instellen voor je eigen gebruiker.', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/pl.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/pl.dict.authent-local.php index 62d4408d6..e671940ee 100644 --- a/datamodels/2.x/authent-local/dictionaries/pl.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/pl.dict.authent-local.php @@ -1,15 +1,16 @@ 'Użytkownik '.ITOP_APPLICATION_SHORT, 'Class:UserLocal+' => 'Użytkownik uwierzytelniony przez '.ITOP_APPLICATION_SHORT, 'Class:UserLocal/Attribute:password' => 'Hasło', @@ -29,4 +30,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Hasło musi mieć co najmniej 8 znaków i zawierać duże, małe litery, cyfry i znaki specjalne.', 'UserLocal:password:expiration' => 'Poniższe pola wymagają rozszerzenia', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Ustawienie wygaśnięcia hasła "Hasło jednorazowe" nie jest dozwolone dla własnego użytkownika', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/pt_br.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/pt_br.dict.authent-local.php index fbfc0fcc8..ba6cee788 100644 --- a/datamodels/2.x/authent-local/dictionaries/pt_br.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/pt_br.dict.authent-local.php @@ -1,15 +1,16 @@ 'Usuário local', 'Class:UserLocal+' => '', 'Class:UserLocal/Attribute:password' => 'Senha', @@ -29,4 +30,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'A senha deve ter no mínimo 8 caracteres e incluir letras maiúsculas, minúsculas, números e símbolos', 'UserLocal:password:expiration' => 'O campo abaixo requer uma extensão', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Definir a expiração da senha para One-Time Password (OTP) não é permitido para o seu próprio usuário', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/ru.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/ru.dict.authent-local.php index 70cfca1fb..94b55aa42 100644 --- a/datamodels/2.x/authent-local/dictionaries/ru.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/ru.dict.authent-local.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:UserLocal' => 'Пользователь '.ITOP_APPLICATION_SHORT, 'Class:UserLocal+' => 'Пользователь, аутентифицируемый через '.ITOP_APPLICATION_SHORT, 'Class:UserLocal/Attribute:password' => 'Пароль', @@ -30,4 +31,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Пароль должен содержать не менее 8 символов и включать прописные, строчные, числовые и специальные символы.', 'UserLocal:password:expiration' => 'Поля требуют наличия доп. расширения', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User~~', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/sk.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/sk.dict.authent-local.php index 21b731614..4042476a3 100644 --- a/datamodels/2.x/authent-local/dictionaries/sk.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/sk.dict.authent-local.php @@ -1,15 +1,16 @@ ITOP_APPLICATION_SHORT.' užívateľ', 'Class:UserLocal+' => 'User authentified by '.ITOP_APPLICATION_SHORT.'~~', 'Class:UserLocal/Attribute:password' => 'Heslo', @@ -29,4 +30,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.~~', 'UserLocal:password:expiration' => 'The fields below require an extension~~', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User~~', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/tr.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/tr.dict.authent-local.php index e5056ea00..58c46cf82 100644 --- a/datamodels/2.x/authent-local/dictionaries/tr.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/tr.dict.authent-local.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:UserLocal' => ITOP_APPLICATION_SHORT.' kullanıcısı', 'Class:UserLocal+' => 'Yetki kontorlünü '.ITOP_APPLICATION_SHORT.' tarafından yapılan kullanıcı', 'Class:UserLocal/Attribute:password' => 'Şifre', @@ -30,4 +31,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.~~', 'UserLocal:password:expiration' => 'The fields below require an extension~~', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User~~', -)); +]); diff --git a/datamodels/2.x/authent-local/dictionaries/zh_cn.dict.authent-local.php b/datamodels/2.x/authent-local/dictionaries/zh_cn.dict.authent-local.php index 269e8ee26..c7da16e7f 100644 --- a/datamodels/2.x/authent-local/dictionaries/zh_cn.dict.authent-local.php +++ b/datamodels/2.x/authent-local/dictionaries/zh_cn.dict.authent-local.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT.' 用户', 'Class:UserLocal+' => '用户由'.ITOP_APPLICATION_SHORT.'验证身份', 'Class:UserLocal/Attribute:password' => '密码', @@ -53,4 +54,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => '密码必须至少8个字符, 包含大小写, 数字和特殊字符.', 'UserLocal:password:expiration' => '下面的区域需要插件扩展', 'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => '不允许用户为自己设置 "一次性密码" 的失效期限', -)); +]); diff --git a/datamodels/2.x/authent-local/model.authent-local.php b/datamodels/2.x/authent-local/model.authent-local.php index 8b7b5992f..bf8888c59 100755 --- a/datamodels/2.x/authent-local/model.authent-local.php +++ b/datamodels/2.x/authent-local/model.authent-local.php @@ -1,4 +1,5 @@ - /** * Authent Local * User authentication Module, password stored in the local database @@ -25,7 +25,6 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - class UserLocalPasswordValidity { /** @var bool */ @@ -53,7 +52,6 @@ class UserLocalPasswordValidity return $this->m_bPasswordValidity; } - /** * @return string */ @@ -65,55 +63,56 @@ class UserLocalPasswordValidity class UserLocal extends UserInternal { - const EXPIRE_CAN = 'can_expire'; - const EXPIRE_NEVER = 'never_expire'; - const EXPIRE_FORCE = 'force_expire'; - const EXPIRE_ONE_TIME_PWD = 'otp_expire'; + public const EXPIRE_CAN = 'can_expire'; + public const EXPIRE_NEVER = 'never_expire'; + public const EXPIRE_FORCE = 'force_expire'; + public const EXPIRE_ONE_TIME_PWD = 'otp_expire'; /** @var UserLocalPasswordValidity|null */ protected $m_oPasswordValidity = null; public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "addon/authentication,grant_by_profile,silo", "key_type" => "autoincrement", "name_attcode" => "login", "state_attcode" => "", - "reconc_keys" => array('login'), + "reconc_keys" => ['login'], "db_table" => "priv_user_local", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeOneWayPassword("password", array("allowed_values"=>null, "sql"=>"pwd", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeOneWayPassword("password", ["allowed_values" => null, "sql" => "pwd", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); - $sExpireEnum = implode(',', array(self::EXPIRE_CAN, self::EXPIRE_NEVER, self::EXPIRE_FORCE, self::EXPIRE_ONE_TIME_PWD)); - MetaModel::Init_AddAttribute(new AttributeEnum("expiration", array("allowed_values"=>new ValueSetEnum($sExpireEnum), "sql"=>"expiration", "default_value"=>self::EXPIRE_NEVER, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDate("password_renewed_date", array("allowed_values"=>null, "sql"=>"password_renewed_date", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); + $sExpireEnum = implode(',', [self::EXPIRE_CAN, self::EXPIRE_NEVER, self::EXPIRE_FORCE, self::EXPIRE_ONE_TIME_PWD]); + MetaModel::Init_AddAttribute(new AttributeEnum("expiration", ["allowed_values" => new ValueSetEnum($sExpireEnum), "sql" => "expiration", "default_value" => self::EXPIRE_NEVER, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDate("password_renewed_date", ["allowed_values" => null, "sql" => "password_renewed_date", "default_value" => "", "is_null_allowed" => true, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', - array( + MetaModel::Init_SetZListItems( + 'details', + [ 'col:col1' => - array( - 'fieldset:User:info' => array('contactid', 'org_id', 'email', 'login', 'password', 'language', 'status'), - ), + [ + 'fieldset:User:info' => ['contactid', 'org_id', 'email', 'login', 'password', 'language', 'status'], + ], 'col:col2' => - array( - 'fieldset:User:profiles' => array('profile_list',), - 'fieldset:UserLocal:password:expiration' => array('expiration', 'password_renewed_date',), - ), + [ + 'fieldset:User:profiles' => ['profile_list',], + 'fieldset:UserLocal:password:expiration' => ['expiration', 'password_renewed_date',], + ], 'allowed_org_list', 'log', - ) + ] ); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('first_name', 'last_name', 'login', 'org_id')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('list', ['first_name', 'last_name', 'login', 'org_id']); // Attributes to be displayed for a list // Search criteria - MetaModel::Init_SetZListItems('standard_search', array('login', 'contactid', 'status', 'org_id')); // Criteria of the std search form + MetaModel::Init_SetZListItems('standard_search', ['login', 'contactid', 'status', 'org_id']); // Criteria of the std search form } public function CheckCredentials($sPassword) @@ -121,8 +120,7 @@ class UserLocal extends UserInternal $oPassword = $this->Get('password'); // ormPassword object // Cannot compare directly the values since they are hashed, so // Let's ask the password to compare the hashed values - if ($oPassword->CheckPassword($sPassword)) - { + if ($oPassword->CheckPassword($sPassword)) { return true; } return false; @@ -135,12 +133,10 @@ class UserLocal extends UserInternal public function CanChangePassword() { - if (MetaModel::GetConfig()->Get('demo_mode')) - { + if (MetaModel::GetConfig()->Get('demo_mode')) { return false; } - if($this->Get('expiration') == self::EXPIRE_ONE_TIME_PWD) - { + if ($this->Get('expiration') == self::EXPIRE_ONE_TIME_PWD) { return false; } return true; @@ -152,8 +148,7 @@ class UserLocal extends UserInternal $oPassword = $this->Get('password'); // Cannot compare directly the values since they are hashed, so // Let's ask the password to compare the hashed values - if ($oPassword->CheckPassword($sOldPassword)) - { + if ($oPassword->CheckPassword($sOldPassword)) { $this->SetPassword($sNewPassword); return $this->IsPasswordValid(); } @@ -173,8 +168,7 @@ class UserLocal extends UserInternal { $result = parent::Set($sAttCode, $value); - if ('password' == $sAttCode) - { + if ('password' == $sAttCode) { $this->ValidatePassword($value); } @@ -199,32 +193,28 @@ class UserLocal extends UserInternal protected function OnWrite() { - if (array_key_exists('password_renewed_date', $this->ListChanges())) - { + if (array_key_exists('password_renewed_date', $this->ListChanges())) { return; } - if (empty($this->m_oPasswordValidity)) - { + if (empty($this->m_oPasswordValidity)) { //password unchanged - if (is_null($this->Get('password_renewed_date'))) - { + if (is_null($this->Get('password_renewed_date'))) { //initialize password_renewed_date with User creation date $sKey = $this->GetKey(); -$sOql = <<Fetch(); - if (! is_null($oCMDBChangeOpCreate)) - { - $oUserCreationDateTime = \DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $oCMDBChangeOpCreate->Get('date')); - $sCreationDate = $oUserCreationDateTime->format(\AttributeDate::GetInternalFormat()); - $this->Set('password_renewed_date', $sCreationDate); - } + $oCmdbChangeOpSearch = \DBObjectSearch::FromOQL($sOql); + $oSet = new \DBObjectSet($oCmdbChangeOpSearch); + $oCMDBChangeOpCreate = $oSet->Fetch(); + if (! is_null($oCMDBChangeOpCreate)) { + $oUserCreationDateTime = \DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $oCMDBChangeOpCreate->Get('date')); + $sCreationDate = $oUserCreationDateTime->format(\AttributeDate::GetInternalFormat()); + $this->Set('password_renewed_date', $sCreationDate); + } } return; } @@ -233,10 +223,8 @@ OQL; $this->Set('password_renewed_date', $sNow); // Reset the "force" expiration flag when the user updates her/his own password! - if ($this->IsCurrentUser()) - { - if (($this->Get('expiration') == self::EXPIRE_FORCE)) - { + if ($this->IsCurrentUser()) { + if (($this->Get('expiration') == self::EXPIRE_FORCE)) { $this->Set('expiration', self::EXPIRE_CAN); } } @@ -244,8 +232,7 @@ OQL; public function IsPasswordValid() { - if (ContextTag::Check(ContextTag::TAG_SETUP)) - { + if (ContextTag::Check(ContextTag::TAG_SETUP)) { // during the setup, the admin account can have whatever password you want ... return true; } @@ -253,17 +240,14 @@ OQL; return (empty($this->m_oPasswordValidity)) || ($this->m_oPasswordValidity->isPasswordValid()); } - public function getPasswordValidityMessage() { - if (ContextTag::Check(ContextTag::TAG_SETUP)) - { + if (ContextTag::Check(ContextTag::TAG_SETUP)) { // during the setup, the admin account can have whatever password you want ... return null; } - if (empty($this->m_oPasswordValidity)) - { + if (empty($this->m_oPasswordValidity)) { return null; } @@ -281,30 +265,25 @@ OQL; */ public function ValidatePassword($proposedValue, $config = null, $aValidatorCollection = null) { - if (null == $config) - { + if (null == $config) { $config = MetaModel::GetConfig(); } //if the $proposedValue is an ormPassword, then it cannot be checked //this if is even more permissive as we can only check against strings - if (!is_string($proposedValue) && !empty($proposedValue)) - { + if (!is_string($proposedValue) && !empty($proposedValue)) { $this->m_oPasswordValidity = new UserLocalPasswordValidity(true); return; } - if (null == $aValidatorCollection) - { + if (null == $aValidatorCollection) { $aValidatorCollection = MetaModel::EnumPlugins('iModuleExtension', 'UserLocalPasswordValidator'); } - foreach ($aValidatorCollection as $oUserLocalPasswordValidator) - { + foreach ($aValidatorCollection as $oUserLocalPasswordValidator) { $this->m_oPasswordValidity = $oUserLocalPasswordValidator->ValidatePassword($proposedValue, $this, $config); - if (!$this->m_oPasswordValidity->isPasswordValid()) - { + if (!$this->m_oPasswordValidity->isPasswordValid()) { return; } } @@ -312,8 +291,7 @@ OQL; public function DoCheckToWrite() { - if (! $this->IsPasswordValid()) - { + if (! $this->IsPasswordValid()) { $this->m_aCheckIssues[] = $this->m_oPasswordValidity->getPasswordValidityMessage(); } @@ -337,13 +315,11 @@ OQL; * @return integer Flags: the binary combination of the flags applicable to this attribute * @throws \CoreException */ - public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '') + public function GetAttributeFlags($sAttCode, &$aReasons = [], $sTargetState = '') { $iFlags = parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState); - if (MetaModel::GetConfig()->Get('demo_mode')) - { - if (strpos('contactid,login,language,password,status,profile_list,allowed_org_list', $sAttCode) !== false) - { + if (MetaModel::GetConfig()->Get('demo_mode')) { + if (strpos('contactid,login,language,password,status,profile_list,allowed_org_list', $sAttCode) !== false) { // contactid and allowed_org_list are disabled to make sure the portal remains accessible $aReasons[] = 'Sorry, this attribute is read-only in the demonstration mode!'; $iFlags |= OPT_ATT_READONLY; @@ -353,8 +329,6 @@ OQL; } } - - interface UserLocalPasswordValidator extends iModuleExtension { /** @@ -384,42 +358,32 @@ class UserPasswordPolicyRegex implements UserLocalPasswordValidator { $sPattern = $config->GetModuleSetting('authent-local', 'password_validation.pattern'); - if ('' == $sPattern) - { + if ('' == $sPattern) { return new UserLocalPasswordValidity(true); } $isMatched = preg_match("/{$sPattern}/", $proposedValue); - if ($isMatched === false) - { + if ($isMatched === false) { return new UserLocalPasswordValidity( false, 'Unknown error : Failed to check the password.' ); } - if ($isMatched === 1) - { + if ($isMatched === 1) { return new UserLocalPasswordValidity(true); } $sUserLanguage = Dict::GetUserLanguage(); $customMessages = $config->GetModuleSetting('authent-local', 'password_validation.message', null); - if (is_string($customMessages) ) - { + if (is_string($customMessages)) { $sMessage = $customMessages; - } - elseif (isset($customMessages) && array_key_exists($sUserLanguage, $customMessages)) - { + } elseif (isset($customMessages) && array_key_exists($sUserLanguage, $customMessages)) { $sMessage = $customMessages[$sUserLanguage]; - } - elseif (isset($customMessages) && array_key_exists('EN US', $customMessages)) - { + } elseif (isset($customMessages) && array_key_exists('EN US', $customMessages)) { $sMessage = $customMessages['EN US']; - } - else - { + } else { $sMessage = Dict::S('Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed'); } diff --git a/datamodels/2.x/authent-local/module.authent-local.php b/datamodels/2.x/authent-local/module.authent-local.php index 4af293ca5..91133191c 100755 --- a/datamodels/2.x/authent-local/module.authent-local.php +++ b/datamodels/2.x/authent-local/module.authent-local.php @@ -1,10 +1,9 @@ 'User authentication based on the local DB', @@ -12,23 +11,23 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - ), + 'dependencies' => [ + ], 'mandatory' => true, 'visible' => true, // Components // - 'datamodel' => array( + 'datamodel' => [ 'model.authent-local.php', - ), - 'data.struct' => array( + ], + 'data.struct' => [ //'data.struct.authent-local.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.authent-local.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -37,8 +36,8 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( + 'settings' => [ // see the './datamodel.authent-local.xml' for the default settings! - ), - ) + ], + ] ); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/cs.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/cs.dict.combodo-backoffice-darkmoon-theme.php index 5f7552566..3c37a1898 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/cs.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/cs.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Dark moon', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/da.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/da.dict.combodo-backoffice-darkmoon-theme.php index 766c596d1..9b218c3b8 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/da.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/da.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Dark moon~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/de.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/de.dict.combodo-backoffice-darkmoon-theme.php index 29da99e39..dfc216344 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/de.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/de.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Dark moon', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/en.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/en.dict.combodo-backoffice-darkmoon-theme.php index 8e0f73f43..1ad68f4c6 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/en.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/en.dict.combodo-backoffice-darkmoon-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'theme:darkmoon' => 'Dark moon', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/en_gb.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/en_gb.dict.combodo-backoffice-darkmoon-theme.php index d83f8d624..36836b389 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/en_gb.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/en_gb.dict.combodo-backoffice-darkmoon-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'theme:darkmoon' => 'Dark moon', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/es_cr.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/es_cr.dict.combodo-backoffice-darkmoon-theme.php index fc444eb60..22b04bdcb 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/es_cr.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/es_cr.dict.combodo-backoffice-darkmoon-theme.php @@ -1,12 +1,13 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'theme:darkmoon' => 'Luna Obscura', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/fr.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/fr.dict.combodo-backoffice-darkmoon-theme.php index 4fdd0c80c..4e9cb2269 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/fr.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/fr.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Dark moon', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/hu.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/hu.dict.combodo-backoffice-darkmoon-theme.php index dbcf9b388..ae3203405 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/hu.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/hu.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Dark moon', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/it.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/it.dict.combodo-backoffice-darkmoon-theme.php index 471e49fe4..03c96b7ef 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/it.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/it.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Luna scura', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/ja.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/ja.dict.combodo-backoffice-darkmoon-theme.php index 37b1553fb..6408c04ad 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/ja.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/ja.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Dark moon~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/nl.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/nl.dict.combodo-backoffice-darkmoon-theme.php index 3cb957862..2734173ef 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/nl.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/nl.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Dark moon', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/pl.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/pl.dict.combodo-backoffice-darkmoon-theme.php index a44b8a1db..52fc1a80b 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/pl.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/pl.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Ciemny Księżyc', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/pt_br.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/pt_br.dict.combodo-backoffice-darkmoon-theme.php index fc25b1b8a..a4048cb3d 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/pt_br.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/pt_br.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Dark moon', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/ru.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/ru.dict.combodo-backoffice-darkmoon-theme.php index 68a0f0161..21c7bfc9e 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/ru.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/ru.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Dark moon~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/sk.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/sk.dict.combodo-backoffice-darkmoon-theme.php index 583c1698a..782b69fea 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/sk.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/sk.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Dark moon~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/tr.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/tr.dict.combodo-backoffice-darkmoon-theme.php index 2f0ab4d7a..7308d3f8c 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/tr.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/tr.dict.combodo-backoffice-darkmoon-theme.php @@ -1,14 +1,15 @@ 'Dark moon~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/zh_cn.dict.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/zh_cn.dict.combodo-backoffice-darkmoon-theme.php index ae505ef77..45857d5b9 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/zh_cn.dict.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/zh_cn.dict.combodo-backoffice-darkmoon-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'theme:darkmoon' => '暗月', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/module.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/module.combodo-backoffice-darkmoon-theme.php index e79558089..b0f0a4cd2 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/module.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/module.combodo-backoffice-darkmoon-theme.php @@ -1,4 +1,5 @@ 'Backoffice: Darkmoon theme', @@ -14,38 +15,35 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - - ), + 'dependencies' => [ + + ], 'mandatory' => true, 'visible' => false, // Components // - 'datamodel' => array( - ), - 'webservice' => array( - - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); - - -?> diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/cs.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/cs.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index 4839b4f0d..4f1020e5d 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/cs.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/cs.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/da.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/da.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index d65c5042f..d1ac08d5e 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/da.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/da.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/de.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/de.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index 69a763af7..435df691f 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/de.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/de.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/en.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/en.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index 67b4c4ad5..827165ba5 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/en.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/en.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/en_gb.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/en_gb.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index fdc270973..de8471393 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/en_gb.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/en_gb.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/es_cr.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/es_cr.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index 8f0eff364..8cb35200c 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/es_cr.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/es_cr.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'theme:fullmoon-high-contrast' => 'Luna Llena (Alto Contraste)', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/fr.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/fr.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index b46ba2eae..aa8169a70 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/fr.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/fr.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,14 +1,15 @@ 'Fullmoon (Contraste élevé)', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/hu.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/hu.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index bec7dda0d..fdb41a65e 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/hu.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/hu.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/it.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/it.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index f1ffcab44..9db1b95ea 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/it.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/it.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/ja.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/ja.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index e20fcc20b..0727744d3 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/ja.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/ja.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/nl.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/nl.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index 77724ddca..4129c13ce 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/nl.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/nl.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/pl.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/pl.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index 6c6dd73e6..e4441e1cd 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/pl.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/pl.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'theme:fullmoon-high-contrast' => 'Pełnia księżyca (wysoki kontrast)', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/pt_br.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/pt_br.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index b338d58e9..133ff1ef8 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/pt_br.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/pt_br.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/ru.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/ru.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index 104ed7824..393d8898a 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/ru.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/ru.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/sk.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/sk.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index c696a01d3..5061c726a 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/sk.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/sk.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/tr.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/tr.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index 19b19c5aa..de9e65c42 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/tr.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/tr.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/zh_cn.dict.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/zh_cn.dict.combodo-backoffice-fullmoon-high-contrast-theme.php index f69ce11c2..de73ad883 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/zh_cn.dict.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/dictionaries/zh_cn.dict.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/module.combodo-backoffice-fullmoon-high-contrast-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/module.combodo-backoffice-fullmoon-high-contrast-theme.php index 7f07ac783..d1f36bf22 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/module.combodo-backoffice-fullmoon-high-contrast-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-high-contrast-theme/module.combodo-backoffice-fullmoon-high-contrast-theme.php @@ -1,4 +1,5 @@ 'Backoffice: Fullmoon with high contrast accessibility theme', @@ -14,38 +15,35 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - - ), + 'dependencies' => [ + + ], 'mandatory' => true, 'visible' => false, // Components // - 'datamodel' => array( - ), - 'webservice' => array( - - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); - - -?> diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/cs.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/cs.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index 1c33f9eb8..6c1c211fe 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/cs.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/cs.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~' -)); \ No newline at end of file +Dict::Add('CS CZ', 'Czech', 'Čeština', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/da.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/da.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index 2a4212157..7bf41187c 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/da.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/da.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~' -)); \ No newline at end of file +Dict::Add('DA DA', 'Danish', 'Dansk', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/de.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/de.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index de617cf57..bce4d7843 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/de.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/de.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('DE DE', 'German', 'Deutsch', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~' -)); \ No newline at end of file +Dict::Add('DE DE', 'German', 'Deutsch', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/en.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/en.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index 47e23c5b1..d895dc8d9 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/en.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/en.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)' -)); \ No newline at end of file +Dict::Add('EN US', 'English', 'English', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/en_gb.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/en_gb.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index 6f5ca93d9..44fb36c68 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/en_gb.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/en_gb.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)' -)); \ No newline at end of file +Dict::Add('EN GB', 'British English', 'British English', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/es_cr.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/es_cr.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index adff0d699..7c865db66 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/es_cr.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/es_cr.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Luna Llena (Protanopia & Deuteranopia)' -)); \ No newline at end of file +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Luna Llena (Protanopia & Deuteranopia)', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/fr.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/fr.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index fb43c4be8..b25ad3c63 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/fr.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/fr.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,14 +1,15 @@ 'Fullmoon (Protanopie et Deuteranopie)' -)); \ No newline at end of file +Dict::Add('FR FR', 'French', 'Français', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopie et Deuteranopie)', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/hu.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/hu.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index 6970fe94b..172bd686e 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/hu.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/hu.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~' -)); \ No newline at end of file +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/it.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/it.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index 7055a1488..117c307f8 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/it.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/it.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('IT IT', 'Italian', 'Italiano', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~' -)); \ No newline at end of file +Dict::Add('IT IT', 'Italian', 'Italiano', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/ja.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/ja.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index 0fc44ae85..206a43095 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/ja.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/ja.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('JA JP', 'Japanese', '日本語', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~' -)); \ No newline at end of file +Dict::Add('JA JP', 'Japanese', '日本語', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/nl.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/nl.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index d48390b17..d5df12bc5 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/nl.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/nl.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~' -)); \ No newline at end of file +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/pl.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/pl.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index b9bccf2e8..e4ea6c7cf 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/pl.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/pl.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('PL PL', 'Polish', 'Polski', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Pełnia Księżyca (Protanopia i Deuteranopia)' -)); \ No newline at end of file +Dict::Add('PL PL', 'Polish', 'Polski', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Pełnia Księżyca (Protanopia i Deuteranopia)', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/pt_br.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/pt_br.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index 598a29822..133a16ee7 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/pt_br.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/pt_br.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~' -)); \ No newline at end of file +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/ru.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/ru.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index 6ee97d350..b56ad3db7 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/ru.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/ru.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('RU RU', 'Russian', 'Русский', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~' -)); \ No newline at end of file +Dict::Add('RU RU', 'Russian', 'Русский', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/sk.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/sk.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index 75bc5e1d8..1d3a58e95 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/sk.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/sk.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~' -)); \ No newline at end of file +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/tr.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/tr.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index ac7c86dd1..40cc3050a 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/tr.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/tr.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~' -)); \ No newline at end of file +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/zh_cn.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/zh_cn.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index 3cbe35326..3d59b91f7 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/zh_cn.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/dictionaries/zh_cn.dict.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( - 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~' -)); \ No newline at end of file +Dict::Add('ZH CN', 'Chinese', '简体中文', [ + 'theme:fullmoon-protanopia-deuteranopia' => 'Fullmoon (Protanopia & Deuteranopia)~~', +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/module.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/module.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php index d030e06fe..6cd013b5f 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/module.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-protanopia-deuteranopia-theme/module.combodo-backoffice-fullmoon-protanopia-deuteranopia-theme.php @@ -1,4 +1,5 @@ 'Backoffice: Fullmoon with protonopia & deuteranopia accessibility theme', @@ -14,38 +15,35 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - - ), + 'dependencies' => [ + + ], 'mandatory' => true, 'visible' => false, // Components // - 'datamodel' => array( - ), - 'webservice' => array( - - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); - - -?> diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/cs.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/cs.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index b06716db8..8d7ead4c8 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/cs.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/cs.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/da.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/da.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index 7414adfca..3cfdc9d0c 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/da.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/da.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/de.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/de.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index aace7b944..29bc5e0f1 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/de.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/de.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/en.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/en.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index c195b2006..f6b239d98 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/en.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/en.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/en_gb.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/en_gb.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index 7b5c7e7af..bc464fc2e 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/en_gb.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/en_gb.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/es_cr.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/es_cr.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index 110ec71ff..7d99a8d0d 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/es_cr.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/es_cr.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'theme:fullmoon-tritanopia' => 'Luna Llena (Tritanopia)', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/fr.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/fr.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index 492829332..e7747f170 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/fr.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/fr.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,14 +1,15 @@ 'Fullmoon (Tritanopie)', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/hu.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/hu.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index d4382ee2f..514c61518 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/hu.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/hu.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/it.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/it.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index 2a1efef4f..2e649ee36 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/it.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/it.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/ja.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/ja.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index 5edf36581..609b12ea7 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/ja.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/ja.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/nl.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/nl.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index 26841f341..7d3c29025 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/nl.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/nl.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/pl.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/pl.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index d85d3c6c6..7e6969fd4 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/pl.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/pl.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'theme:fullmoon-tritanopia' => 'Pełnia Księżyca (Tritanopia)', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/pt_br.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/pt_br.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index 869dab1e1..0051ae66e 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/pt_br.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/pt_br.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/ru.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/ru.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index 687858866..98d655479 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/ru.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/ru.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/sk.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/sk.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index 3be79dccd..726fb2d77 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/sk.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/sk.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/tr.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/tr.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index d9928fb8a..38d329eeb 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/tr.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/tr.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/zh_cn.dict.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/zh_cn.dict.combodo-backoffice-fullmoon-tritanopia-theme.php index eb9e8c95a..1075b9c9f 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/zh_cn.dict.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/dictionaries/zh_cn.dict.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'theme:fullmoon-tritanopia' => 'Fullmoon (Tritanopia)~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/module.combodo-backoffice-fullmoon-tritanopia-theme.php b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/module.combodo-backoffice-fullmoon-tritanopia-theme.php index 4c7a634c2..c9ff6722c 100644 --- a/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/module.combodo-backoffice-fullmoon-tritanopia-theme.php +++ b/datamodels/2.x/combodo-backoffice-fullmoon-tritanopia-theme/module.combodo-backoffice-fullmoon-tritanopia-theme.php @@ -1,4 +1,5 @@ 'Backoffice: Fullmoon with tritanopia accessibility theme', @@ -14,38 +15,35 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - - ), + 'dependencies' => [ + + ], 'mandatory' => true, 'visible' => false, // Components // - 'datamodel' => array( - ), - 'webservice' => array( - - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); - - -?> diff --git a/datamodels/2.x/combodo-db-tools/bin/rebuildhk.php b/datamodels/2.x/combodo-db-tools/bin/rebuildhk.php index e69f631cd..965e562d6 100644 --- a/datamodels/2.x/combodo-db-tools/bin/rebuildhk.php +++ b/datamodels/2.x/combodo-db-tools/bin/rebuildhk.php @@ -1,4 +1,5 @@ $oAttDef) - { + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { // Check (once) all the attributes that are hierarchical keys - if ((MetaModel::GetAttributeOrigin($sClass, $sAttCode) == $sClass) && $oAttDef->IsHierarchicalKey()) - { + if ((MetaModel::GetAttributeOrigin($sClass, $sAttCode) == $sClass) && $oAttDef->IsHierarchicalKey()) { echo "Rebuild hierarchical key $sAttCode from $sClass.\n"; HierarchicalKey::Rebuild($sClass, $sAttCode, $oAttDef); } diff --git a/datamodels/2.x/combodo-db-tools/bin/report.php b/datamodels/2.x/combodo-db-tools/bin/report.php index 13fa41b6f..ae69443fd 100644 --- a/datamodels/2.x/combodo-db-tools/bin/report.php +++ b/datamodels/2.x/combodo-db-tools/bin/report.php @@ -1,4 +1,5 @@ CheckIntegrity([]); -if (empty($aResults)) -{ +if (empty($aResults)) { echo "Database OK\n"; exit(0); } diff --git a/datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php b/datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php index 3bfa47ad9..0dc4e346c 100644 --- a/datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php +++ b/datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php @@ -1,4 +1,5 @@ iTimeLimitPerOperation)) - { + if (!is_null($this->iTimeLimitPerOperation)) { set_time_limit(intval($this->iTimeLimitPerOperation)); } $aWrongRecords = CMDBSource::QueryToArray($sSelWrongRecs.' limit '.self::LIMIT); - if (count($aWrongRecords) > 0) - { - foreach($aWrongRecords as $aRes) - { - if (!isset($aErrorsAndFixes[$sClass][$sErrorDesc])) - { - $aErrorsAndFixes[$sClass][$sErrorDesc] = array( + if (count($aWrongRecords) > 0) { + foreach ($aWrongRecords as $aRes) { + if (!isset($aErrorsAndFixes[$sClass][$sErrorDesc])) { + $aErrorsAndFixes[$sClass][$sErrorDesc] = [ 'count' => 1, 'query' => $sSelWrongRecs, - ); - if (!empty($sFixItRequest)) - { - $aErrorsAndFixes[$sClass][$sErrorDesc]['fixit'] = array($sFixItRequest); - $aErrorsAndFixes[$sClass][$sErrorDesc]['cleanup'] = array($sFixItRequest); + ]; + if (!empty($sFixItRequest)) { + $aErrorsAndFixes[$sClass][$sErrorDesc]['fixit'] = [$sFixItRequest]; + $aErrorsAndFixes[$sClass][$sErrorDesc]['cleanup'] = [$sFixItRequest]; } - } - else - { + } else { $aErrorsAndFixes[$sClass][$sErrorDesc]['count'] += 1; } - if (empty($aValueNames)) - { - $aValues = array('id' => $aRes['id']); - } - else - { - $aValues = array(); - foreach ($aValueNames as $sValueName) - { + if (empty($aValueNames)) { + $aValues = ['id' => $aRes['id']]; + } else { + $aValues = []; + foreach ($aValueNames as $sValueName) { $aValues[$sValueName] = $aRes[$sValueName]; } } - if (isset($aRes['value'])) - { + if (isset($aRes['value'])) { $value = $aRes['value']; $aValues['value'] = $value; - if (!isset($aErrorsAndFixes[$sClass][$sErrorDesc]['values'][$value])) - { + if (!isset($aErrorsAndFixes[$sClass][$sErrorDesc]['values'][$value])) { $aErrorsAndFixes[$sClass][$sErrorDesc]['values'][$value] = 1; - } - else - { + } else { $aErrorsAndFixes[$sClass][$sErrorDesc]['values'][$value] += 1; } } @@ -109,30 +95,24 @@ class DatabaseAnalyzer */ public function CheckIntegrity($aClassSelection) { - $aErrorsAndFixes = array(); + $aErrorsAndFixes = []; - if (empty($aClassSelection)) - { + if (empty($aClassSelection)) { $aClassSelection = MetaModel::GetClasses(); - } - else - { + } else { $aClasses = $aClassSelection; - foreach($aClasses as $sClass) - { + foreach ($aClasses as $sClass) { $aExpectedClasses = MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL); $aClassSelection = array_merge($aClassSelection, $aExpectedClasses); } $aClassSelection = array_unique($aClassSelection); } - foreach ($aClassSelection as $sClass) - { + foreach ($aClassSelection as $sClass) { // Check uniqueness rules $this->CheckUniquenessRules($sClass, $aErrorsAndFixes); - if (!MetaModel::HasTable($sClass)) - { + if (!MetaModel::HasTable($sClass)) { continue; } @@ -140,38 +120,30 @@ class DatabaseAnalyzer $sTable = MetaModel::DBGetTable($sClass); $sKeyField = MetaModel::DBGetKey($sClass); - if (!MetaModel::IsStandaloneClass($sClass)) - { + if (!MetaModel::IsStandaloneClass($sClass)) { $sRootTable = MetaModel::DBGetTable($sRootClass); $sRootKey = MetaModel::DBGetKey($sRootClass); - if (!MetaModel::IsRootClass($sClass)) - { + if (!MetaModel::IsRootClass($sClass)) { $this->CheckRecordsInRootTable($sTable, $sKeyField, $sRootTable, $sRootKey, $sClass, $aErrorsAndFixes); $this->CheckRecordsInChildTable($sRootClass, $sClass, $sRootTable, $sRootKey, $sTable, $sKeyField, $aErrorsAndFixes); - if (!MetaModel::IsLeafClass($sClass)) - { + if (!MetaModel::IsLeafClass($sClass)) { $this->CheckIntermediateFinalClass($sRootClass, $sClass, $sRootTable, $sRootKey, $sTable, $sKeyField, $aErrorsAndFixes); } } } - foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { // Skip this attribute if not defined in this table - if (!MetaModel::IsAttributeOrigin($sClass, $sAttCode)) - { + if (!MetaModel::IsAttributeOrigin($sClass, $sAttCode)) { continue; } - if ($oAttDef->IsExternalKey()) - { + if ($oAttDef->IsExternalKey()) { $this->CheckExternalKeys($oAttDef, $sTable, $sKeyField, $sAttCode, $sClass, $aErrorsAndFixes); if ((MetaModel::GetAttributeOrigin($sClass, $sAttCode) == $sClass) && $oAttDef->IsHierarchicalKey()) { $this->CheckHK($sClass, $sAttCode, $aErrorsAndFixes); } - } - elseif ($oAttDef->IsDirectField() && !($oAttDef instanceof AttributeSet)) - { + } elseif ($oAttDef->IsDirectField() && !($oAttDef instanceof AttributeSet)) { $this->CheckAllowedValues($sClass, $sAttCode, $oAttDef, $sTable, $sKeyField, $aErrorsAndFixes); } } @@ -196,38 +168,33 @@ class DatabaseAnalyzer private function CheckUniquenessRule($sClass, $sUniquenessRuleId, $aUniquenessRuleProperties, &$aErrorsAndFixes) { $sOqlUniquenessQuery = "SELECT $sClass"; - if (!(empty($sUniquenessFilter = $aUniquenessRuleProperties['filter']))) - { + if (!(empty($sUniquenessFilter = $aUniquenessRuleProperties['filter']))) { $sOqlUniquenessQuery .= ' WHERE '.$sUniquenessFilter; } $oUniquenessQuery = DBObjectSearch::FromOQL($sOqlUniquenessQuery); - $aValueNames = array(); - $aGroupByExpr = array(); - foreach ($aUniquenessRuleProperties['attributes'] as $sAttributeCode) - { + $aValueNames = []; + $aGroupByExpr = []; + foreach ($aUniquenessRuleProperties['attributes'] as $sAttributeCode) { $oExpr = Expression::FromOQL("$sClass.$sAttributeCode"); $aGroupByExpr[$sAttributeCode] = $oExpr; $aValueNames[] = $sAttributeCode; } - $aSelectExpr = array(); + $aSelectExpr = []; - $sSQLUniquenessQuery = $oUniquenessQuery->MakeGroupByQuery(array(), $aGroupByExpr, false, $aSelectExpr); + $sSQLUniquenessQuery = $oUniquenessQuery->MakeGroupByQuery([], $aGroupByExpr, false, $aSelectExpr); $sSQLUniquenessQuery .= ' having count(*) > 1'; $sErrorDesc = $this->GetUniquenessRuleMessage($sUniquenessRuleId); $this->ExecQuery($sSQLUniquenessQuery, '', $sErrorDesc, $sClass, $aErrorsAndFixes, $aValueNames); - if (isset($aErrorsAndFixes[$sClass][$sErrorDesc]['res'])) - { - $aFixit = array("-- In order to get the duplicates, run the following queries:"); - foreach ($aErrorsAndFixes[$sClass][$sErrorDesc]['res'] as $aValues) - { + if (isset($aErrorsAndFixes[$sClass][$sErrorDesc]['res'])) { + $aFixit = ["-- In order to get the duplicates, run the following queries:"]; + foreach ($aErrorsAndFixes[$sClass][$sErrorDesc]['res'] as $aValues) { $oFixSearch = new DBObjectSearch($sClass); - foreach ($aValues as $sAttCode => $sValue) - { + foreach ($aValues as $sAttCode => $sValue) { $oFixSearch->AddCondition($sAttCode, $sValue, '='); } $aFixit[] = $oFixSearch->MakeSelectQuery([], [], null, null, 0, 0, false, false).';'; @@ -251,13 +218,10 @@ class DatabaseAnalyzer */ private function CheckUniquenessRules($sClass, &$aErrorsAndFixes) { - if (method_exists('MetaModel', 'GetUniquenessRules')) - { + if (method_exists('MetaModel', 'GetUniquenessRules')) { $aUniquenessRules = MetaModel::GetUniquenessRules($sClass); - foreach ($aUniquenessRules as $sUniquenessRuleId => $aUniquenessRuleProperties) - { - if ($aUniquenessRuleProperties['disabled'] === true) - { + foreach ($aUniquenessRules as $sUniquenessRuleId => $aUniquenessRuleProperties) { + if ($aUniquenessRuleProperties['disabled'] === true) { continue; } $this->CheckUniquenessRule($sClass, $sUniquenessRuleId, $aUniquenessRuleProperties, $aErrorsAndFixes); @@ -375,8 +339,7 @@ class DatabaseAnalyzer $this->ExecQuery($sSelWrongRecs, '', $sErrorDesc, $sClass, $aErrorsAndFixes); $aFixIt = []; // Fix it request needs the values of the enum to generate the requests - if (isset($aErrorsAndFixes[$sClass][$sErrorDesc]['values'])) - { + if (isset($aErrorsAndFixes[$sClass][$sErrorDesc]['values'])) { if ($oAttDef->IsNullAllowed()) { $aFixIt[] = "-- Fix inconsistant values: remove the external key"; foreach (array_keys($aErrorsAndFixes[$sClass][$sErrorDesc]['values']) as $sKey) { @@ -384,8 +347,7 @@ class DatabaseAnalyzer } } else { $aAdditionalFixIt = $this->GetSpecificExternalKeysFixItForNull($sTable, $sExtKeyField, $sFilter, $sJoin); - foreach ($aAdditionalFixIt as $sFixIt) - { + foreach ($aAdditionalFixIt as $sFixIt) { $aFixIt[] = $sFixIt; } @@ -411,11 +373,9 @@ class DatabaseAnalyzer $sErrorDesc = Dict::Format('DBAnalyzer-Integrity-MissingExtKey', $sAttCode, $sTable, $sExtKeyField); $this->ExecQuery($sSelWrongRecs, '', $sErrorDesc, $sClass, $aErrorsAndFixes); $aFixIt = []; - if (isset($aErrorsAndFixes[$sClass][$sErrorDesc]['count']) && ($aErrorsAndFixes[$sClass][$sErrorDesc]['count'] > 0)) - { + if (isset($aErrorsAndFixes[$sClass][$sErrorDesc]['count']) && ($aErrorsAndFixes[$sClass][$sErrorDesc]['count'] > 0)) { $aAdditionalFixIt = $this->GetSpecificExternalKeysFixItForNull($sTable, $sExtKeyField, $sFilter); - foreach ($aAdditionalFixIt as $sFixIt) - { + foreach ($aAdditionalFixIt as $sFixIt) { $aFixIt[] = $sFixIt; } $aFixIt[] = "-- Alternate fix: remove inconsistant entries:"; @@ -429,9 +389,8 @@ class DatabaseAnalyzer private function GetSpecificExternalKeysFixItForNull($sTable, $sExtKeyField, $sFilter, $sJoin = '') { - $aFixIt = array(); - if ($sTable == 'ticket' && $sExtKeyField == 'org_id') - { + $aFixIt = []; + if ($sTable == 'ticket' && $sExtKeyField == 'org_id') { $aFixIt[] = "-- Alternate fix: set the ticket org to the caller org"; $aFixIt[] = "UPDATE ticket JOIN contact AS c ON ticket.caller_id=c.id $sJoin SET ticket.org_id=c.org_id $sFilter"; } @@ -454,8 +413,7 @@ class DatabaseAnalyzer private function CheckAllowedValues($sClass, $sAttCode, AttributeDefinition $oAttDef, $sTable, $sKeyField, &$aErrorsAndFixes) { $aAllowedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode); - if (!is_null($aAllowedValues) && count($aAllowedValues) > 0) - { + if (!is_null($aAllowedValues) && count($aAllowedValues) > 0) { $aAllowedValues = array_keys($aAllowedValues); $sExpectedValues = implode(",", CMDBSource::Quote($aAllowedValues, true)); @@ -478,19 +436,14 @@ class DatabaseAnalyzer $sErrorDesc = Dict::Format('DBAnalyzer-Integrity-InvalidValue', $sAttCode, $sTable, $sMyAttributeField); $this->ExecQuery($sSelWrongRecs, $sFixItRequest, $sErrorDesc, $sClass, $aErrorsAndFixes); // Fix it request needs the values of the enum to generate the requests - if (isset($aErrorsAndFixes[$sClass][$sErrorDesc]['values'])) - { - if (isset($aErrorsAndFixes[$sClass][$sErrorDesc]['fixit'])) - { + if (isset($aErrorsAndFixes[$sClass][$sErrorDesc]['values'])) { + if (isset($aErrorsAndFixes[$sClass][$sErrorDesc]['fixit'])) { $aFixIt = $aErrorsAndFixes[$sClass][$sErrorDesc]['fixit']; $aFixIt[] = "-- Alternative: Replace enums with the appropriate value"; - } - else - { + } else { $aFixIt = ["-- Replace enums with the appropriate value"]; } - foreach (array_keys($aErrorsAndFixes[$sClass][$sErrorDesc]['values']) as $sKey) - { + foreach (array_keys($aErrorsAndFixes[$sClass][$sErrorDesc]['values']) as $sKey) { foreach ($aAllowedValues as $sAllowedValue) { $aFixIt[] = "-- Replace $sKey by $sAllowedValue"; $aFixIt[] = "UPDATE `$sTable` SET `$sTable`.`$sMyAttributeField` = '$sAllowedValue' WHERE `$sTable`.`$sMyAttributeField` = '$sKey'"; diff --git a/datamodels/2.x/combodo-db-tools/dbtools.php b/datamodels/2.x/combodo-db-tools/dbtools.php index d090c5751..9bd7d8590 100644 --- a/datamodels/2.x/combodo-db-tools/dbtools.php +++ b/datamodels/2.x/combodo-db-tools/dbtools.php @@ -1,4 +1,5 @@ SetCurrentTab('DBTools:Inconsistencies'); @@ -120,7 +121,6 @@ function DisplayDBInconsistencies(iTopWebPage &$oP, ApplicationContext &$oAppCon $oForm->AddSubBlock($oInput); $oForm->AddSubBlock($oAppContext->GetForFormBlock()); - if (!empty($sClassSelection)) { $oForm = FormUIBlockFactory::MakeStandard(); $oP->AddUiBlock($oForm); @@ -236,7 +236,7 @@ function DisplayErrorDetails($aResults, $bVerbose) if ($iCount === DatabaseAnalyzer::LIMIT) { $iCount = "$iCount(+)"; } - $sErrorTitle = Dict::Format('DBTools:DetailedErrorTitle', MetaModel::GetName($sClass).' ('.$sClass.')', $iCount, $sErrorLabel); + $sErrorTitle = Dict::Format('DBTools:DetailedErrorTitle', MetaModel::GetName($sClass).' ('.$sClass.')', $iCount, $sErrorLabel); $oCollapsible = CollapsibleSectionUIBlockFactory::MakeStandard($sErrorTitle); $oBlock->AddSubBlock($oCollapsible); @@ -304,14 +304,14 @@ function DisplayLostAttachments(iTopWebPage &$oP, ApplicationContext &$oAppConte { // Retrieve parameters $sStepName = utils::ReadParam('step_name'); - $aRecordsToClean = utils::ReadParam('dbt-cbx', array(), false, 'raw_data'); + $aRecordsToClean = utils::ReadParam('dbt-cbx', [], false, 'raw_data'); $iRestoredItemsCount = 0; $iRecordsToCleanCount = count($aRecordsToClean); - $aErrorsReport = array(); + $aErrorsReport = []; - $bDoAnalyze = in_array($sStepName, array('analyze', 'restore')); - $bDoRestore = in_array($sStepName, array('restore')); + $bDoAnalyze = in_array($sStepName, ['analyze', 'restore']); + $bDoRestore = in_array($sStepName, ['restore']); // Build HTML $oP->SetCurrentTab('DBTools:LostAttachments'); @@ -383,8 +383,7 @@ function DisplayLostAttachments(iTopWebPage &$oP, ApplicationContext &$oAppConte $oOriginObject->DBDelete(); $iRestoredItemsCount++; - } - catch (Exception $e) { + } catch (Exception $e) { $aErrorsReport[] = 'Could not restore attachment from '.$sRecordToClean.', cause: '.$e->getMessage(); } utils::PopArchiveMode(); @@ -396,7 +395,6 @@ function DisplayLostAttachments(iTopWebPage &$oP, ApplicationContext &$oAppConte $sSelWrongRecs = 'SELECT id, secret, "InlineImage" AS current_class, id AS current_id, item_class AS target_class, item_id AS target_id, contents_filename AS filename FROM '.$sInlineImageDBTable.' WHERE contents_mimetype NOT LIKE "image/%"'; $aWrongRecords = CMDBSource::QueryToArray($sSelWrongRecs); - if (empty($aWrongRecords)) { $oAlert = AlertUIBlockFactory::MakeForSuccess(Dict::S('DBTools:LostAttachments:Step:AnalyzeResults:None')); $oForm->AddSubBlock($oAlert); @@ -449,7 +447,6 @@ function DisplayLostAttachments(iTopWebPage &$oP, ApplicationContext &$oAppConte $oButton->SetIsDisabled(true); $oPanel->AddSubBlock($oButton); - // JS to handle checkboxes and button $oP->add_ready_script( <<p(''.$e->getMessage().''); } diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/cs.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/cs.dict.combodo-db-tools.php index 5843b7695..e78162e32 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/cs.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/cs.dict.combodo-db-tools.php @@ -1,15 +1,16 @@ 'Integrita databáze', 'DBTools:Class' => 'Class~~', 'DBTools:Title' => 'Kontrola integrity databáze', @@ -43,17 +44,17 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'DBAnalyzer-Fetch-Count-Error' => 'Fetch count error in `%1$s`, %2$d entries fetched / %3$d counted~~', 'DBAnalyzer-Integrity-FinalClass' => 'Field `%2$s`.`%1$s` must have the same value as `%3$s`.`%1$s`~~', 'DBAnalyzer-Integrity-RootFinalClass' => 'Field `%2$s`.`%1$s` must contain a valid class~~', -)); +]); // Database Info -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'DBTools:DatabaseInfo' => 'Database Information~~', 'DBTools:Base' => 'Base~~', 'DBTools:Size' => 'Velikost', -)); +]); // Lost attachments -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'DBTools:LostAttachments' => 'Lost attachments~~', 'DBTools:LostAttachments:Disclaimer' => 'Here you can search your database for lost or misplaced attachments. This is NOT a data recovery tool, it does not retrieve deleted data.~~', 'DBTools:LostAttachments:Button:Analyze' => 'Analyze~~', @@ -70,5 +71,5 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Restore results:~~', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d attachments were restored.~~', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Stored as inline image~~', - 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools~~' -)); + 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools~~', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/da.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/da.dict.combodo-db-tools.php index e12fb3722..9728a3492 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/da.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/da.dict.combodo-db-tools.php @@ -1,15 +1,16 @@ 'Database integrity~~', 'DBTools:Class' => 'Class~~', 'DBTools:Title' => 'Database integrity check~~', @@ -43,17 +44,17 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'DBAnalyzer-Fetch-Count-Error' => 'Fetch count error in `%1$s`, %2$d entries fetched / %3$d counted~~', 'DBAnalyzer-Integrity-FinalClass' => 'Field `%2$s`.`%1$s` must have the same value as `%3$s`.`%1$s`~~', 'DBAnalyzer-Integrity-RootFinalClass' => 'Field `%2$s`.`%1$s` must contain a valid class~~', -)); +]); // Database Info -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'DBTools:DatabaseInfo' => 'Database Information~~', 'DBTools:Base' => 'Base~~', 'DBTools:Size' => 'Size~~', -)); +]); // Lost attachments -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'DBTools:LostAttachments' => 'Lost attachments~~', 'DBTools:LostAttachments:Disclaimer' => 'Here you can search your database for lost or misplaced attachments. This is NOT a data recovery tool, it does not retrieve deleted data.~~', 'DBTools:LostAttachments:Button:Analyze' => 'Analyze~~', @@ -70,5 +71,5 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Restore results:~~', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d attachments were restored.~~', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Stored as inline image~~', - 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools~~' -)); + 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools~~', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/de.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/de.dict.combodo-db-tools.php index 1aadf0dc3..11fd389b8 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/de.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/de.dict.combodo-db-tools.php @@ -1,15 +1,16 @@ 'DB Tools', 'DBTools:Class' => 'Klasse', 'DBTools:Title' => 'Datenbankpflege-Tools', @@ -43,17 +44,17 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'DBAnalyzer-Fetch-Count-Error' => 'Fetch-Count-Fehler in `%1$s`, %2$d Einträge geholt (fetched) / %3$d gezählt', 'DBAnalyzer-Integrity-FinalClass' => 'Das Feld `%2$s`.`%1$s` muss den gleichen Wert `%3$s`.`%1$s` haben', 'DBAnalyzer-Integrity-RootFinalClass' => 'Das Feld `%2$s`.`%1$s` muss eine gültige Klasse enthalten', -)); +]); // Database Info -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'DBTools:DatabaseInfo' => 'Datenbank-Informationen', 'DBTools:Base' => 'Datenbank', 'DBTools:Size' => 'Größe', -)); +]); // Lost attachments -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'DBTools:LostAttachments' => 'Verlorene Attachments', 'DBTools:LostAttachments:Disclaimer' => 'Hier können Sie Ihre Datenbank nach verlorenen oder falsch platzierten Attachments durchsuchen. Dies ist kein Recovery-Tool - es stellt keine gelöschten Daten wieder her.', 'DBTools:LostAttachments:Button:Analyze' => 'Analysieren', @@ -70,5 +71,5 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Restore-Ergebnisse:', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d Attachments wurden wiederhergestellt.', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Als Inline-Bild gespeichert', - 'DBTools:LostAttachments:History' => 'Attachment "%1$s" mit DB-Tools wiederhergestellt' -)); + 'DBTools:LostAttachments:History' => 'Attachment "%1$s" mit DB-Tools wiederhergestellt', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/en.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/en.dict.combodo-db-tools.php index dd08e6cbe..2190830a9 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/en.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/en.dict.combodo-db-tools.php @@ -1,4 +1,5 @@ 'Database integrity', 'DBTools:Class' => 'Class', @@ -60,17 +61,17 @@ Dict::Add('EN US', 'English', 'English', array( 'DBAnalyzer-Fetch-Count-Error' => 'Fetch count error in `%1$s`, %2$d entries fetched / %3$d counted', 'DBAnalyzer-Integrity-FinalClass' => 'Field `%2$s`.`%1$s` must have the same value as `%3$s`.`%1$s`', 'DBAnalyzer-Integrity-RootFinalClass' => 'Field `%2$s`.`%1$s` must contain a valid class', -)); +]); // Database Info -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'DBTools:DatabaseInfo' => 'Database Information', 'DBTools:Base' => 'Base', 'DBTools:Size' => 'Size', -)); +]); // Lost attachments -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'DBTools:LostAttachments' => 'Lost attachments', 'DBTools:LostAttachments:Disclaimer' => 'Here you can search your database for lost or misplaced attachments. This is NOT a data recovery tool, it does not retrieve deleted data.', @@ -92,5 +93,5 @@ Dict::Add('EN US', 'English', 'English', array( 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d attachments were restored.', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Stored as inline image', - 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools' -)); + 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/en_gb.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/en_gb.dict.combodo-db-tools.php index 12cb4e22a..fc3d275b7 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/en_gb.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/en_gb.dict.combodo-db-tools.php @@ -1,4 +1,5 @@ 'Database integrity', 'DBTools:Class' => 'Class', @@ -60,17 +61,17 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'DBAnalyzer-Fetch-Count-Error' => 'Fetch count error in `%1$s`, %2$d entries fetched / %3$d counted', 'DBAnalyzer-Integrity-FinalClass' => 'Field `%2$s`.`%1$s` must have the same value as `%3$s`.`%1$s`', 'DBAnalyzer-Integrity-RootFinalClass' => 'Field `%2$s`.`%1$s` must contain a valid class', -)); +]); // Database Info -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'DBTools:DatabaseInfo' => 'Database Information', 'DBTools:Base' => 'Base', 'DBTools:Size' => 'Size', -)); +]); // Lost attachments -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'DBTools:LostAttachments' => 'Lost attachments', 'DBTools:LostAttachments:Disclaimer' => 'Here you can search your database for lost or misplaced attachments. This is NOT a data recovery tool, it does not retrieve deleted data.', @@ -92,5 +93,5 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d attachments were restored.', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Stored as inline image', - 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools' -)); + 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/es_cr.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/es_cr.dict.combodo-db-tools.php index 5cc5bce7d..2e5da03c8 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/es_cr.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/es_cr.dict.combodo-db-tools.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:DBToolsMenu' => 'Integridad de Base de Datos', 'DBTools:Class' => 'Clase', 'DBTools:Title' => 'Herramientas de Mantenimiento de Base de Datos', @@ -41,17 +42,17 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'DBAnalyzer-Fetch-Count-Error' => 'Obtener cuenta de errores en `%1$s`, %2$d entradas recuperadas / %3$d contadas', 'DBAnalyzer-Integrity-FinalClass' => 'Campo `%2$s`.`%1$s` debe tener los mismos valores que `%3$s`.`%1$s`', 'DBAnalyzer-Integrity-RootFinalClass' => 'Campo `%2$s`.`%1$s` debe contener un caracter válido', -)); +]); // Database Info -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'DBTools:DatabaseInfo' => 'Información de Base de Datos', 'DBTools:Base' => 'Base', 'DBTools:Size' => 'Tamaño', -)); +]); // Lost attachments -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'DBTools:LostAttachments' => 'Adjuntos perdidos', 'DBTools:LostAttachments:Disclaimer' => 'Aquí usted puede buscar anexos perdidos o fuera de lugar. Esta NO es una herramienta de recuperación de datos, no obtiene datos borrados.', 'DBTools:LostAttachments:Button:Analyze' => 'Analizar', @@ -68,5 +69,5 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Resultados de restauración:', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d adjuntos fueron restaurados.', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Almacenado como imagen en línea', - 'DBTools:LostAttachments:History' => 'Adjunto "%1$s" restaurado con herramientas de base de datos' -)); + 'DBTools:LostAttachments:History' => 'Adjunto "%1$s" restaurado con herramientas de base de datos', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/fr.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/fr.dict.combodo-db-tools.php index e45719241..2fc59c415 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/fr.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/fr.dict.combodo-db-tools.php @@ -1,15 +1,16 @@ 'Intégrité base de données', 'DBTools:Class' => 'Classe', 'DBTools:Title' => 'Contrôle de l\'intégrité de la base de données', @@ -43,17 +44,17 @@ Dict::Add('FR FR', 'French', 'Français', array( 'DBAnalyzer-Fetch-Count-Error' => 'Erreur de récupération dans `%1$s`, %2$d enregistrements récupérés / %3$d comptés', 'DBAnalyzer-Integrity-FinalClass' => 'Le champ `%2$s`.`%1$s` doit avoir la même valeur que `%3$s`.`%1$s`', 'DBAnalyzer-Integrity-RootFinalClass' => 'Le champ `%2$s`.`%1$s` doit contenir une classe valide', -)); +]); // Database Info -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'DBTools:DatabaseInfo' => 'Information Base de Données', 'DBTools:Base' => 'Base', 'DBTools:Size' => 'Taille', -)); +]); // Lost attachments -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'DBTools:LostAttachments' => 'Pièces jointes perdues', 'DBTools:LostAttachments:Disclaimer' => 'Ici vous pouvez retrouver des pièces jointes perdues ou égarées dans votre base de données. Ceci n\'est PAS un outil de récupération des données, il ne récupère pas les données effacées.', 'DBTools:LostAttachments:Button:Analyze' => 'Analyser', @@ -70,5 +71,5 @@ Dict::Add('FR FR', 'French', 'Français', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Résultats de la restauration :', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d pièces jointes ont été restaurées.', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Stockée comme "InlineImage"', - 'DBTools:LostAttachments:History' => 'Pièce jointe "%1$s" restaurée avec l\'outil de BDD' -)); + 'DBTools:LostAttachments:History' => 'Pièce jointe "%1$s" restaurée avec l\'outil de BDD', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/hu.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/hu.dict.combodo-db-tools.php index 41e5604ca..c8d4fe345 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/hu.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/hu.dict.combodo-db-tools.php @@ -1,15 +1,16 @@ 'DB eszközök', 'DBTools:Class' => 'Osztály', 'DBTools:Title' => 'Adatbázis karbantartó eszközök', @@ -43,17 +44,17 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'DBAnalyzer-Fetch-Count-Error' => 'Lekérési hiba a `%1$s` -nál, %2$d bejegyzés lekérve / %3$d megszámlálva', 'DBAnalyzer-Integrity-FinalClass' => 'A `%2$s`.`%1$s` mezőnek ugyanolyan értékűnek kell lennie mint a `%3$s`.`%1$s`', 'DBAnalyzer-Integrity-RootFinalClass' => '`%2$s`.`%1$s` mezőnek érvényes osztályt kell tartalmaznia', -)); +]); // Database Info -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'DBTools:DatabaseInfo' => 'Adatbázis információ', 'DBTools:Base' => 'Bázis', 'DBTools:Size' => 'Méret', -)); +]); // Lost attachments -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'DBTools:LostAttachments' => 'Elveszett mellékletek', 'DBTools:LostAttachments:Disclaimer' => 'Itt kereshet az adatbázisban elveszett vagy elkeveredett mellékletek után. Ez NEM egy adat-visszaállítási eszköz, nem állítja vissza a törölt adatokat.', 'DBTools:LostAttachments:Button:Analyze' => 'Elemzés', @@ -70,5 +71,5 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Visszaállítás eredménye:', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d melléklet lett visszaállítva.', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Soron belüli képként tárolva', - 'DBTools:LostAttachments:History' => 'A "%1$s" melléklet visszaállítva a DB eszközzel' -)); + 'DBTools:LostAttachments:History' => 'A "%1$s" melléklet visszaállítva a DB eszközzel', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/it.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/it.dict.combodo-db-tools.php index a53507f02..6d07f0b85 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/it.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/it.dict.combodo-db-tools.php @@ -1,15 +1,16 @@ 'Strumenti DB', 'DBTools:Class' => 'Classe', 'DBTools:Title' => 'Strumenti di Manutenzione del Database', @@ -43,17 +44,17 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'DBAnalyzer-Fetch-Count-Error' => 'Errore di conteggio di recupero in `%1$s`, %2$d voci recuperate / %3$d conteggiate', 'DBAnalyzer-Integrity-FinalClass' => 'Il campo `%2$s`.`%1$s` deve avere lo stesso valore di `%3$s`.`%1$s`', 'DBAnalyzer-Integrity-RootFinalClass' => 'Il campo `%2$s`.`%1$s` deve contenere una classe valida', -)); +]); // Database Info -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'DBTools:DatabaseInfo' => 'Informazioni Database', 'DBTools:Base' => 'Base~~', 'DBTools:Size' => 'Size~~', -)); +]); // Lost attachments -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'DBTools:LostAttachments' => 'Allegati Persi', 'DBTools:LostAttachments:Disclaimer' => 'Qui puoi cercare nel tuo database gli allegati persi o mal posizionati. Questo NON è uno strumento di recupero dati, non recupera dati cancellati.', 'DBTools:LostAttachments:Button:Analyze' => 'Analizza', @@ -70,5 +71,5 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Risultati del ripristino:', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d allegati sono stati ripristinati.', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Salvato come immagine in linea', - 'DBTools:LostAttachments:History' => 'Allegato "%1$s" ripristinato con gli strumenti DB' -)); + 'DBTools:LostAttachments:History' => 'Allegato "%1$s" ripristinato con gli strumenti DB', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/ja.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/ja.dict.combodo-db-tools.php index 99813c2ac..3691028c2 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/ja.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/ja.dict.combodo-db-tools.php @@ -1,15 +1,16 @@ 'Database integrity~~', 'DBTools:Class' => 'Class~~', 'DBTools:Title' => 'Database integrity check~~', @@ -43,17 +44,17 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'DBAnalyzer-Fetch-Count-Error' => 'Fetch count error in `%1$s`, %2$d entries fetched / %3$d counted~~', 'DBAnalyzer-Integrity-FinalClass' => 'Field `%2$s`.`%1$s` must have the same value as `%3$s`.`%1$s`~~', 'DBAnalyzer-Integrity-RootFinalClass' => 'Field `%2$s`.`%1$s` must contain a valid class~~', -)); +]); // Database Info -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'DBTools:DatabaseInfo' => 'Database Information~~', 'DBTools:Base' => 'Base~~', 'DBTools:Size' => 'Size~~', -)); +]); // Lost attachments -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'DBTools:LostAttachments' => 'Lost attachments~~', 'DBTools:LostAttachments:Disclaimer' => 'Here you can search your database for lost or misplaced attachments. This is NOT a data recovery tool, it does not retrieve deleted data.~~', 'DBTools:LostAttachments:Button:Analyze' => 'Analyze~~', @@ -70,5 +71,5 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Restore results:~~', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d attachments were restored.~~', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Stored as inline image~~', - 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools~~' -)); + 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools~~', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/nl.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/nl.dict.combodo-db-tools.php index 96995895a..46368b9aa 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/nl.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/nl.dict.combodo-db-tools.php @@ -1,16 +1,17 @@ (2018 - 2022) * @author Thomas Casteleyn */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:DBToolsMenu' => 'Databasetools', 'DBTools:Class' => 'Klasse', 'DBTools:Title' => 'Onderhoudstools voor de database', @@ -44,17 +45,17 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'DBAnalyzer-Fetch-Count-Error' => 'Opvraag-fout in "%1$s", %2$d records opgevraagd / %3$d geteld', 'DBAnalyzer-Integrity-FinalClass' => 'Veld `%2$s`.`%1$s` moet dezelfde waarde hebben als `%3$s`.`%1$s`', 'DBAnalyzer-Integrity-RootFinalClass' => 'Veld `%2$s`.`%1$s` moet een geldige klasse bevatten.', -)); +]); // Database Info -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'DBTools:DatabaseInfo' => 'Database-informatie', 'DBTools:Base' => 'Base', 'DBTools:Size' => 'Grootte', -)); +]); // Lost attachments -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'DBTools:LostAttachments' => 'Verloren bijlages', 'DBTools:LostAttachments:Disclaimer' => 'Zoek hier verloren or verkeerd geplaatste bijlages. Dit is geen recovery-tool, het kan geen gewiste data herstellen.', 'DBTools:LostAttachments:Button:Analyze' => 'Analyseer', @@ -71,5 +72,5 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Resultaten herstel:', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d bijlages werden hersteld.', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Opgeslagen als afbeelding in tekst', - 'DBTools:LostAttachments:History' => 'Bijlage "%1$s" werd hersteld met de databasetools' -)); + 'DBTools:LostAttachments:History' => 'Bijlage "%1$s" werd hersteld met de databasetools', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/pl.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/pl.dict.combodo-db-tools.php index ecd3eb768..3eed6bfee 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/pl.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/pl.dict.combodo-db-tools.php @@ -1,15 +1,16 @@ 'Integralność bazy danych', 'DBTools:Class' => 'Klasa', 'DBTools:Title' => 'Narzędzia do konserwacji bazy danych', @@ -43,17 +44,17 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'DBAnalyzer-Fetch-Count-Error' => 'Błąd liczby wpisów w `%1$s`, %2$d pobrane wpisy / %3$d obliczone', 'DBAnalyzer-Integrity-FinalClass' => 'Pole `%2$s`.`%1$s` musi mieć taką samą wartość jak `%3$s`.`%1$s`', 'DBAnalyzer-Integrity-RootFinalClass' => 'Pole `%2$s`.`%1$s` musi zawierać prawidłową klasę', -)); +]); // Database Info -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'DBTools:DatabaseInfo' => 'Informacje o bazie danych', 'DBTools:Base' => 'Baza', 'DBTools:Size' => 'Rozmiar', -)); +]); // Lost attachments -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'DBTools:LostAttachments' => 'Utracone załączniki', 'DBTools:LostAttachments:Disclaimer' => 'Tutaj możesz przeszukiwać bazę danych w poszukiwaniu zagubionych załączników. To NIE jest narzędzie do odzyskiwania danych, nie pobiera usuniętych danych.', 'DBTools:LostAttachments:Button:Analyze' => 'Analiza', @@ -70,5 +71,5 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Wyniki przywracania:', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d załączniki zostały przywrócone.', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Zapisane jako obraz w treści', - 'DBTools:LostAttachments:History' => 'Załącznik "%1$s" przywrócony za pomocą narzędzi DB' -)); + 'DBTools:LostAttachments:History' => 'Załącznik "%1$s" przywrócony za pomocą narzędzi DB', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/pt_br.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/pt_br.dict.combodo-db-tools.php index fd53129ef..639f407a7 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/pt_br.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/pt_br.dict.combodo-db-tools.php @@ -1,15 +1,16 @@ 'Ferramentas de Banco de Dados', 'DBTools:Class' => 'Classe', 'DBTools:Title' => 'Manutenção do Banco de Dados', @@ -43,17 +44,17 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'DBAnalyzer-Fetch-Count-Error' => 'Erro na busca em `%1$s`, %2$d registros buscados / %3$d contados', 'DBAnalyzer-Integrity-FinalClass' => 'Campo `%2$s`.`%1$s` precisa ter o mesmo valor que `%3$s`.`%1$s`', 'DBAnalyzer-Integrity-RootFinalClass' => 'Campo `%2$s`.`%1$s` precisa conter uma classe válida', -)); +]); // Database Info -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'DBTools:DatabaseInfo' => 'Informação do banco de dados', 'DBTools:Base' => 'Banco', 'DBTools:Size' => 'Tamanho', -)); +]); // Lost attachments -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'DBTools:LostAttachments' => 'Anexos perdidos', 'DBTools:LostAttachments:Disclaimer' => 'Aqui você procurará no seu banco de dados por anexos perdidos. Isto NÃO é uma ferramenta de recuperação de dados, pois não busca dados apagados', 'DBTools:LostAttachments:Button:Analyze' => 'Analisar', @@ -70,5 +71,5 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Resultado da restauração:', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d anexo(s) recuperado(s)', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Armazenar como imagem embutida', - 'DBTools:LostAttachments:History' => 'Anexo "%1$s" recuperado com as Ferramentas de Banco de Dados' -)); + 'DBTools:LostAttachments:History' => 'Anexo "%1$s" recuperado com as Ferramentas de Banco de Dados', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/ru.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/ru.dict.combodo-db-tools.php index 18d0de306..ebf2a9f6d 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/ru.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/ru.dict.combodo-db-tools.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:DBToolsMenu' => 'Инструменты БД', 'DBTools:Class' => 'Класс', 'DBTools:Title' => 'Инструменты обслуживания базы данных', @@ -44,17 +45,17 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'DBAnalyzer-Fetch-Count-Error' => 'Fetch count error in `%1$s`, %2$d entries fetched / %3$d counted~~', 'DBAnalyzer-Integrity-FinalClass' => 'Field `%2$s`.`%1$s` must have the same value as `%3$s`.`%1$s`~~', 'DBAnalyzer-Integrity-RootFinalClass' => 'Field `%2$s`.`%1$s` must contain a valid class~~', -)); +]); // Database Info -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'DBTools:DatabaseInfo' => 'Информация о базе данных', 'DBTools:Base' => 'База', 'DBTools:Size' => 'Размер', -)); +]); // Lost attachments -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'DBTools:LostAttachments' => 'Потерянные вложения', 'DBTools:LostAttachments:Disclaimer' => 'Здесь вы можете найти потерянные или ошибочно перемещённые вложения в вашей базе данных. Это не инструмент восстановления данных, он не восстанавливает удаленные данные.', 'DBTools:LostAttachments:Button:Analyze' => 'Анализировать', @@ -71,5 +72,5 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Результат восстановления:', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d вложения были восстановлены.', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Хранится в качестве "InlineImage"', - 'DBTools:LostAttachments:History' => 'Вложение "%1$s" восстановлено с помощью инструментов обслуживания БД' -)); + 'DBTools:LostAttachments:History' => 'Вложение "%1$s" восстановлено с помощью инструментов обслуживания БД', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/sk.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/sk.dict.combodo-db-tools.php index 5e15401a5..8c4d21139 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/sk.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/sk.dict.combodo-db-tools.php @@ -1,15 +1,16 @@ 'Database integrity~~', 'DBTools:Class' => 'Class~~', 'DBTools:Title' => 'Database integrity check~~', @@ -43,17 +44,17 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'DBAnalyzer-Fetch-Count-Error' => 'Fetch count error in `%1$s`, %2$d entries fetched / %3$d counted~~', 'DBAnalyzer-Integrity-FinalClass' => 'Field `%2$s`.`%1$s` must have the same value as `%3$s`.`%1$s`~~', 'DBAnalyzer-Integrity-RootFinalClass' => 'Field `%2$s`.`%1$s` must contain a valid class~~', -)); +]); // Database Info -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'DBTools:DatabaseInfo' => 'Database Information~~', 'DBTools:Base' => 'Base~~', 'DBTools:Size' => 'Size~~', -)); +]); // Lost attachments -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'DBTools:LostAttachments' => 'Lost attachments~~', 'DBTools:LostAttachments:Disclaimer' => 'Here you can search your database for lost or misplaced attachments. This is NOT a data recovery tool, it does not retrieve deleted data.~~', 'DBTools:LostAttachments:Button:Analyze' => 'Analyze~~', @@ -70,5 +71,5 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Restore results:~~', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d attachments were restored.~~', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Stored as inline image~~', - 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools~~' -)); + 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools~~', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/tr.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/tr.dict.combodo-db-tools.php index 14a5d6605..b04493308 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/tr.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/tr.dict.combodo-db-tools.php @@ -1,15 +1,16 @@ 'Database integrity~~', 'DBTools:Class' => 'Class~~', 'DBTools:Title' => 'Database integrity check~~', @@ -43,17 +44,17 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'DBAnalyzer-Fetch-Count-Error' => 'Fetch count error in `%1$s`, %2$d entries fetched / %3$d counted~~', 'DBAnalyzer-Integrity-FinalClass' => 'Field `%2$s`.`%1$s` must have the same value as `%3$s`.`%1$s`~~', 'DBAnalyzer-Integrity-RootFinalClass' => 'Field `%2$s`.`%1$s` must contain a valid class~~', -)); +]); // Database Info -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'DBTools:DatabaseInfo' => 'Database Information~~', 'DBTools:Base' => 'Base~~', 'DBTools:Size' => 'Size~~', -)); +]); // Lost attachments -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'DBTools:LostAttachments' => 'Lost attachments~~', 'DBTools:LostAttachments:Disclaimer' => 'Here you can search your database for lost or misplaced attachments. This is NOT a data recovery tool, it does not retrieve deleted data.~~', 'DBTools:LostAttachments:Button:Analyze' => 'Analyze~~', @@ -70,5 +71,5 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'DBTools:LostAttachments:Step:RestoreResults' => 'Restore results:~~', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d attachments were restored.~~', 'DBTools:LostAttachments:StoredAsInlineImage' => 'Stored as inline image~~', - 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools~~' -)); + 'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools~~', +]); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/zh_cn.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/zh_cn.dict.combodo-db-tools.php index d8709b309..25efc74ab 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/zh_cn.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/zh_cn.dict.combodo-db-tools.php @@ -1,4 +1,5 @@ */ // Database inconsistencies -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ // Dictionary entries go here 'Menu:DBToolsMenu' => '数据库工具', 'DBTools:Class' => '类型', @@ -56,17 +57,17 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'DBAnalyzer-Fetch-Count-Error' => '读取计数出错于 `%1$s`, %2$d个记录已读取 / %3$d已', 'DBAnalyzer-Integrity-FinalClass' => '字段 `%2$s`.`%1$s` 必须是相同的值, 而不是 `%3$s`.`%1$s`', 'DBAnalyzer-Integrity-RootFinalClass' => '字段 `%2$s`.`%1$s` 必须包含一个有效的类型', -)); +]); // Database Info -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'DBTools:DatabaseInfo' => '数据库信息', 'DBTools:Base' => '数据库', 'DBTools:Size' => '大小', -)); +]); // Lost attachments -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'DBTools:LostAttachments' => '附件缺失', 'DBTools:LostAttachments:Disclaimer' => '可以在此搜索数据库中丢失或错放的附件. 这不是数据恢复工具, 其无法恢复已删除的数据.', 'DBTools:LostAttachments:Button:Analyze' => '分析', @@ -83,5 +84,5 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'DBTools:LostAttachments:Step:RestoreResults' => '还原结果:', 'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d的附件被还原.', 'DBTools:LostAttachments:StoredAsInlineImage' => '存储为内嵌图像', - 'DBTools:LostAttachments:History' => '附件 "%1$s" 已使用数据库工具还原' -)); + 'DBTools:LostAttachments:History' => '附件 "%1$s" 已使用数据库工具还原', +]); diff --git a/datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php index 65533f1ae..939abb2c3 100644 --- a/datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php @@ -1,4 +1,5 @@ 'Database maintenance tools', @@ -33,21 +34,21 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-structure/3.0.0', - ), + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array( + 'datamodel' => [ 'src/Service/DBToolsUtils.php', - 'src/Service/DBAnalyzerUtils.php', - ), - 'webservice' => array(), - 'data.struct' => array(), - 'data.sample' => array(), + 'src/Service/DBAnalyzerUtils.php', + ], + 'webservice' => [], + 'data.struct' => [], + 'data.sample' => [], // Documentation // @@ -56,6 +57,6 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array(), - ) + 'settings' => [], + ] ); diff --git a/datamodels/2.x/combodo-db-tools/src/Service/DBAnalyzerUtils.php b/datamodels/2.x/combodo-db-tools/src/Service/DBAnalyzerUtils.php index b7c5e5ad5..289086aed 100644 --- a/datamodels/2.x/combodo-db-tools/src/Service/DBAnalyzerUtils.php +++ b/datamodels/2.x/combodo-db-tools/src/Service/DBAnalyzerUtils.php @@ -1,10 +1,10 @@ $aErrorList) - { + foreach ($aResults as $sClass => $aErrorList) { fwrite($fReport, ''); - foreach ($aErrorList as $sErrorLabel => $aError) - { + foreach ($aErrorList as $sErrorLabel => $aError) { fwrite($fReport, "\r\n-- \r\n"); fwrite($fReport, '-- Class: '.MetaModel::GetName($sClass).' ('.$sClass.")\r\n"); $iCount = $aError['count']; @@ -48,13 +46,11 @@ class DBAnalyzerUtils $sQuery = $aError['query']; fwrite($fReport, '-- Query: '.$sQuery."\r\n"); } - - if (isset($aError['fixit'])) - { + + if (isset($aError['fixit'])) { fwrite($fReport, "\r\n-- Fix it (indication):\r\n\r\n"); $aFixitQueries = $aError['fixit']; - foreach ($aFixitQueries as $sFixitQuery) - { + foreach ($aFixitQueries as $sFixitQuery) { fwrite($fReport, "$sFixitQuery\r\n"); } fwrite($fReport, "\r\n"); diff --git a/datamodels/2.x/combodo-db-tools/src/Service/DBToolsUtils.php b/datamodels/2.x/combodo-db-tools/src/Service/DBToolsUtils.php index 006e4a013..09dcf4824 100644 --- a/datamodels/2.x/combodo-db-tools/src/Service/DBToolsUtils.php +++ b/datamodels/2.x/combodo-db-tools/src/Service/DBToolsUtils.php @@ -1,13 +1,12 @@ fetch_assoc(); - $sSize = $aRow['sz']; - return (int)$sSize; - } - - return 0; - } /** * @return int * @throws \CoreException * @throws \MySQLException * @throws \MySQLHasGoneAwayException */ - public final static function GetDBDataSize() + final public static function GetDatabaseSize() + { + self::AnalyzeTables(); + $sSchema = CMDBSource::DBName(); + + $sReq = <<fetch_assoc(); + $sSize = $aRow['sz']; + return (int)$sSize; + } + + return 0; + } + /** + * @return int + * @throws \CoreException + * @throws \MySQLException + * @throws \MySQLHasGoneAwayException + */ + final public static function GetDBDataSize() { self::AnalyzeTables(); $sSchema = CMDBSource::DBName(); @@ -75,8 +73,7 @@ WHERE table_schema = '$sSchema'; EOF; $oResult = CMDBSource::Query($sReq); - if ($oResult !== false) - { + if ($oResult !== false) { $aRow = $oResult->fetch_assoc(); $sSize = $aRow['sz']; return (int)$sSize; @@ -90,7 +87,7 @@ EOF; * @throws \MySQLException * @throws \MySQLHasGoneAwayException */ - public final static function GetDBIndexSize() + final public static function GetDBIndexSize() { self::AnalyzeTables(); $sSchema = CMDBSource::DBName(); @@ -102,8 +99,7 @@ WHERE table_schema = '$sSchema'; EOF; $oResult = CMDBSource::Query($sReq); - if ($oResult !== false) - { + if ($oResult !== false) { $aRow = $oResult->fetch_assoc(); $sSize = $aRow['sz']; return (int)$sSize; @@ -112,10 +108,10 @@ EOF; return 0; } - public final static function GetDatamodelVersion() + final public static function GetDatamodelVersion() { $oFilter = DBObjectSearch::FromOQL('SELECT ModuleInstallation AS mi WHERE mi.name="datamodel"'); - $oSet = new DBObjectSet($oFilter, array('installed' => false)); // Most recent first + $oSet = new DBObjectSet($oFilter, ['installed' => false]); // Most recent first $oSet->SetLimit(1); /** @var \DBObject $oModuleInstallation */ $oModuleInstallation = $oSet->Fetch(); @@ -125,15 +121,13 @@ EOF; public static function GetPreviousInstallations($iLimitCount = 10) { $oFilter = DBObjectSearch::FromOQL('SELECT ModuleInstallation AS mi WHERE mi.parent_id=0 AND mi.name!="datamodel"'); - $oSet = new DBObjectSet($oFilter, array('installed' => false)); // Most recent first + $oSet = new DBObjectSet($oFilter, ['installed' => false]); // Most recent first $oSet->SetLimit($iLimitCount); $aRawValues = $oSet->ToArrayOfValues(); - $aValues = array(); - foreach ($aRawValues as $aRawValue) - { - $aValue = array(); - foreach ($aRawValue as $sAliasAttCode => $sValue) - { + $aValues = []; + foreach ($aRawValues as $aRawValue) { + $aValue = []; + foreach ($aRawValue as $sAliasAttCode => $sValue) { // remove 'mi.' from AttCode $sAttCode = substr($sAliasAttCode, 3); $aValue[$sAttCode] = $sValue; @@ -161,33 +155,30 @@ AND table_type = 'BASE TABLE'; EOF; $oResult = CMDBSource::Query($sReq); - if ($oResult !== false) - { + if ($oResult !== false) { return $oResult->fetch_all(MYSQLI_ASSOC); } - return array(); + return []; } public static function GetDBVariables() { $sReq = 'SHOW variables'; $oResult = CMDBSource::Query($sReq); - if ($oResult !== false) - { + if ($oResult !== false) { return $oResult->fetch_all(MYSQLI_ASSOC); } - return array(); + return []; } public static function GetDBStatus() { $sReq = 'SHOW status'; $oResult = CMDBSource::Query($sReq); - if ($oResult !== false) - { + if ($oResult !== false) { return $oResult->fetch_all(MYSQLI_ASSOC); } - return array(); + return []; } } diff --git a/datamodels/2.x/itop-attachments/ajax.itop-attachment.php b/datamodels/2.x/itop-attachments/ajax.itop-attachment.php index ad54f0330..66de967dd 100644 --- a/datamodels/2.x/itop-attachments/ajax.itop-attachment.php +++ b/datamodels/2.x/itop-attachments/ajax.itop-attachment.php @@ -1,4 +1,5 @@ SetContentType('text/html'); $oAttachmentsRenderer = AttachmentsRendererFactory::GetInstance($oPage, $sClass, $sId, $iTransactionId); @@ -45,18 +46,14 @@ function RenderAttachments(AjaxPage $oPage, $iTransactionId) $bIsReadOnlyState = (is_null($oObject)) ? false : AttachmentPlugIn::IsReadonlyState($oObject, $oObject->GetState(), AttachmentPlugIn::ENUM_GUI_BACKOFFICE); - if ($bEditMode && !$bIsReadOnlyState) - { + if ($bEditMode && !$bIsReadOnlyState) { $oAttachmentsRenderer->AddAttachmentsListContent(true, $aAttachmentsDeleted); - } - else - { + } else { $oAttachmentsRenderer->RenderViewAttachmentsList(); } } -try -{ +try { require_once APPROOT.'/application/startup.inc.php'; require_once APPROOT.'/application/loginwebpage.class.inc.php'; LoginWebPage::DoLoginEx(null /* any portal */, false); @@ -65,35 +62,27 @@ try $sOperation = utils::ReadParam('operation', ''); - switch ($sOperation) - { + switch ($sOperation) { case 'add': $oPage = new JsonPage(); $oPage->SetOutputDataOnly(true); - $aResult = array( + $aResult = [ 'error' => '', 'att_id' => 0, 'preview' => 'false', 'msg' => '', - ); + ]; $sClass = stripslashes(utils::ReadParam('obj_class', '', false, 'class')); $sTempId = utils::ReadParam('temp_id', '', false, 'transaction_id'); - if (empty($sClass)) - { + if (empty($sClass)) { $aResult['error'] = "Missing argument 'obj_class'"; - } - elseif (empty($sTempId)) - { + } elseif (empty($sTempId)) { $aResult['error'] = "Missing argument 'temp_id'"; - } - else - { - try - { + } else { + try { $oDoc = utils::ReadPostedDocument('file'); - if ($oDoc->IsEmpty()) - { + if ($oDoc->IsEmpty()) { throw new FileUploadException(Dict::S('Attachments:Error:UploadedFileEmpty')); } /** @var Attachment $oAttachment */ @@ -109,9 +98,7 @@ try $aResult['icon'] = utils::GetAbsoluteUrlAppRoot().AttachmentPlugIn::GetFileIcon($oDoc->GetFileName()); $aResult['att_id'] = $iAttId; $aResult['preview'] = $oDoc->IsPreviewAvailable() ? 'true' : 'false'; - } - catch (FileUploadException $e) - { + } catch (FileUploadException $e) { $aResult['error'] = $e->GetMessage(); } } @@ -121,9 +108,8 @@ try case 'remove': $iAttachmentId = utils::ReadParam('att_id', ''); $oSearch = DBObjectSearch::FromOQL("SELECT Attachment WHERE id = :id"); - $oSet = new DBObjectSet($oSearch, array(), array('id' => $iAttachmentId)); - while ($oAttachment = $oSet->Fetch()) - { + $oSet = new DBObjectSet($oSearch, [], ['id' => $iAttachmentId]); + while ($oAttachment = $oSet->Fetch()) { $oAttachment->DBDelete(); } break; @@ -138,8 +124,7 @@ try } $oPage->output(); -} -catch (Exception $e) { +} catch (Exception $e) { // note: transform to cope with XSS attacks echo utils::EscapeHtml($e->GetMessage()); IssueLog::Error($e->getMessage()); diff --git a/datamodels/2.x/itop-attachments/dictionaries/cs.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/cs.dict.itop-attachments.php index aaf5d5df6..a0e940831 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/cs.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/cs.dict.itop-attachments.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Attachments:TabTitle_Count' => 'Přílohy (%1$d)', 'Attachments:EmptyTabTitle' => 'Přílohy', 'Attachments:FieldsetTitle' => 'Přílohy', @@ -32,13 +33,13 @@ nebe se zeptejte'.ITOP_APPLICATION_SHORT.' správce '.ITOP_APPLICATION_SHORT.' z 'Attachments:Render:Icons' => 'Zobrazit jako ikony', 'Attachments:Render:Table' => 'Zobrazit jako seznam', 'UI:Attachments:DropYourFileHint' => 'Drop files anywhere in this area~~', -)); +]); // // Class: Attachment // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Attachment' => 'Příloha', 'Class:Attachment+' => '~~', 'Class:Attachment/Attribute:expire' => 'Exspirace', @@ -53,10 +54,9 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Attachment/Attribute:item_org_id+' => '~~', 'Class:Attachment/Attribute:contents' => 'Obsah', 'Class:Attachment/Attribute:contents+' => '~~', -)); +]); - -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Attachments:File:Thumbnail' => 'Ikona', 'Attachments:File:Name' => 'Jméno souboru', 'Attachments:File:Date' => 'Datum nahrání', @@ -64,25 +64,25 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Attachments:File:Size' => 'Velikost', 'Attachments:File:MimeType' => 'Typ', 'Attachments:File:DownloadsCount' => 'Staženo', -)); +]); // // Class: Attachment // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Attachment/Attribute:creation_date' => 'Datum vytvoření', 'Class:Attachment/Attribute:creation_date+' => '~~', 'Class:Attachment/Attribute:user_id' => 'Jméno uživatele', 'Class:Attachment/Attribute:user_id+' => '~~', 'Class:Attachment/Attribute:contact_id' => 'Kontakt', 'Class:Attachment/Attribute:contact_id+' => '~~', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (on object\'s attachment download)~~', 'Class:TriggerOnAttachmentDownload+' => 'Trigger on object\'s attachment download of [a child class of] the given class~~', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/da.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/da.dict.itop-attachments.php index b429308be..8bc93652c 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/da.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/da.dict.itop-attachments.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Attachments:TabTitle_Count' => 'Vedhæftninger (%1$d)', 'Attachments:EmptyTabTitle' => 'Vedhæftninger', 'Attachments:FieldsetTitle' => 'Vedhæftninger', @@ -31,13 +32,13 @@ or ask your '.ITOP_APPLICATION_SHORT.' administrator if the '.ITOP_APPLICATION_S 'Attachments:Render:Icons' => 'Display as icons~~', 'Attachments:Render:Table' => 'Display as list~~', 'UI:Attachments:DropYourFileHint' => 'Drop files anywhere in this area~~', -)); +]); // // Class: Attachment // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Attachment' => 'Attachment~~', 'Class:Attachment+' => '~~', 'Class:Attachment/Attribute:expire' => 'Expire~~', @@ -52,10 +53,9 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Attachment/Attribute:item_org_id+' => '~~', 'Class:Attachment/Attribute:contents' => 'Contents~~', 'Class:Attachment/Attribute:contents+' => '~~', -)); +]); - -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Attachments:File:Thumbnail' => 'Icon~~', 'Attachments:File:Name' => 'File name~~', 'Attachments:File:Date' => 'Upload date~~', @@ -63,25 +63,25 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Attachments:File:Size' => 'Size~~', 'Attachments:File:MimeType' => 'Type~~', 'Attachments:File:DownloadsCount' => 'Downloads~~', -)); +]); // // Class: Attachment // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Attachment/Attribute:creation_date' => 'Creation date~~', 'Class:Attachment/Attribute:creation_date+' => '~~', 'Class:Attachment/Attribute:user_id' => 'User id~~', 'Class:Attachment/Attribute:user_id+' => '~~', 'Class:Attachment/Attribute:contact_id' => 'Contact id~~', 'Class:Attachment/Attribute:contact_id+' => '~~', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (on object\'s attachment download)~~', 'Class:TriggerOnAttachmentDownload+' => 'Trigger on object\'s attachment download of [a child class of] the given class~~', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/de.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/de.dict.itop-attachments.php index 04e12e82d..9989b6ca6 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/de.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/de.dict.itop-attachments.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Attachments:TabTitle_Count' => 'Attachments (%1$d)', 'Attachments:EmptyTabTitle' => 'Attachments', 'Attachments:FieldsetTitle' => 'Attachments', @@ -31,13 +32,13 @@ oder melden Sie dem '.ITOP_APPLICATION_SHORT.' Administrator diesen Fehler, weil 'Attachments:Render:Icons' => 'Als Icons anzeigen', 'Attachments:Render:Table' => 'Als Liste anzeigen', 'UI:Attachments:DropYourFileHint' => 'Dateien in diesem Bereich ablegen...', -)); +]); // // Class: Attachment // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Attachment' => 'Attachment', 'Class:Attachment+' => '', 'Class:Attachment/Attribute:expire' => 'Läuft ab', @@ -52,10 +53,9 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Attachment/Attribute:item_org_id+' => '', 'Class:Attachment/Attribute:contents' => 'Inhalt', 'Class:Attachment/Attribute:contents+' => '', -)); +]); - -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Attachments:File:Thumbnail' => 'Icon', 'Attachments:File:Name' => 'Dateiname', 'Attachments:File:Date' => 'Upload-Datum', @@ -63,25 +63,25 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Attachments:File:Size' => 'Größe', 'Attachments:File:MimeType' => 'Typ', 'Attachments:File:DownloadsCount' => 'Downloads', -)); +]); // // Class: Attachment // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Attachment/Attribute:creation_date' => 'Erstellungsdatum', 'Class:Attachment/Attribute:creation_date+' => '', 'Class:Attachment/Attribute:user_id' => 'Benutzer ID', 'Class:Attachment/Attribute:user_id+' => '', 'Class:Attachment/Attribute:contact_id' => 'Kontakt ID', 'Class:Attachment/Attribute:contact_id+' => '', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (beim Herunterladen eines Attachment eines Objekts)', 'Class:TriggerOnAttachmentDownload+' => 'Trigger für das Herunterladen des Attachments der angegebenen Klasse oder einer Unterklasse', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/en.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/en.dict.itop-attachments.php index ce049282d..1c21fb820 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/en.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/en.dict.itop-attachments.php @@ -1,4 +1,5 @@ 'Attachments (%1$d)', 'Attachments:EmptyTabTitle' => 'Attachments', 'Attachments:FieldsetTitle' => 'Attachments', @@ -38,13 +39,13 @@ or ask your '.ITOP_APPLICATION_SHORT.' administrator if the '.ITOP_APPLICATION_S 'Attachments:Render:Icons' => 'Display as icons', 'Attachments:Render:Table' => 'Display as list', 'UI:Attachments:DropYourFileHint' => 'Drop files anywhere in this area', -)); +]); // // Class: Attachment // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Attachment' => 'Attachment', 'Class:Attachment+' => '', 'Class:Attachment/Attribute:expire' => 'Expire', @@ -59,10 +60,9 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Attachment/Attribute:item_org_id+' => '', 'Class:Attachment/Attribute:contents' => 'Contents', 'Class:Attachment/Attribute:contents+' => '', -)); +]); - -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Attachments:File:Thumbnail' => 'Icon', 'Attachments:File:Name' => 'File name', 'Attachments:File:Date' => 'Upload date', @@ -70,25 +70,25 @@ Dict::Add('EN US', 'English', 'English', array( 'Attachments:File:Size' => 'Size', 'Attachments:File:MimeType' => 'Type', 'Attachments:File:DownloadsCount' => 'Downloads', -)); +]); // // Class: Attachment // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Attachment/Attribute:creation_date' => 'Creation date', 'Class:Attachment/Attribute:creation_date+' => '', 'Class:Attachment/Attribute:user_id' => 'User id', 'Class:Attachment/Attribute:user_id+' => '', 'Class:Attachment/Attribute:contact_id' => 'Contact id', 'Class:Attachment/Attribute:contact_id+' => '', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (on object\'s attachment download)', 'Class:TriggerOnAttachmentDownload+' => 'Trigger on object\'s attachment download of [a child class of] the given class', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/en_gb.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/en_gb.dict.itop-attachments.php index 34dc682b6..bf350abeb 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/en_gb.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/en_gb.dict.itop-attachments.php @@ -1,10 +1,11 @@ 'Attachments (%1$d)', 'Attachments:EmptyTabTitle' => 'Attachments', 'Attachments:FieldsetTitle' => 'Attachments', @@ -25,13 +26,13 @@ or ask your '.ITOP_APPLICATION_SHORT.' administrator if the '.ITOP_APPLICATION_S 'Attachments:Render:Icons' => 'Display as icons', 'Attachments:Render:Table' => 'Display as list', 'UI:Attachments:DropYourFileHint' => 'Drop files anywhere in this area', -)); +]); // // Class: Attachment // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Attachment' => 'Attachment', 'Class:Attachment+' => '', 'Class:Attachment/Attribute:expire' => 'Expire', @@ -46,10 +47,9 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Attachment/Attribute:item_org_id+' => '', 'Class:Attachment/Attribute:contents' => 'Contents', 'Class:Attachment/Attribute:contents+' => '', -)); +]); - -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Attachments:File:Thumbnail' => 'Icon', 'Attachments:File:Name' => 'File name', 'Attachments:File:Date' => 'Upload date', @@ -57,25 +57,25 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Attachments:File:Size' => 'Size', 'Attachments:File:MimeType' => 'Type', 'Attachments:File:DownloadsCount' => 'Downloads', -)); +]); // // Class: Attachment // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Attachment/Attribute:creation_date' => 'Creation date', 'Class:Attachment/Attribute:creation_date+' => '', 'Class:Attachment/Attribute:user_id' => 'User id', 'Class:Attachment/Attribute:user_id+' => '', 'Class:Attachment/Attribute:contact_id' => 'Contact id', 'Class:Attachment/Attribute:contact_id+' => '', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (on object\'s attachment download)', 'Class:TriggerOnAttachmentDownload+' => 'Trigger on object\'s attachment download of [a child class of] the given class', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/es_cr.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/es_cr.dict.itop-attachments.php index 55575c40b..21a0a27f8 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/es_cr.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/es_cr.dict.itop-attachments.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Attachments:TabTitle_Count' => 'Anexos (%1$d)', 'Attachments:EmptyTabTitle' => 'Anexos', 'Attachments:FieldsetTitle' => 'Anexos', @@ -28,13 +29,13 @@ o pregunte al administador de iTop si el servidor que ha quedado sin espacio en 'Attachments:Render:Icons' => 'Desplegar como icono', 'Attachments:Render:Table' => 'Desplegar como lista', 'UI:Attachments:DropYourFileHint' => 'Arrastre los archivos en cualquier lugar de esta área', -)); +]); // // Class: Attachment // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Attachment' => 'Anexo', 'Class:Attachment+' => 'Anexo', 'Class:Attachment/Attribute:expire' => 'Expira', @@ -49,10 +50,9 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Attachment/Attribute:item_org_id+' => '', 'Class:Attachment/Attribute:contents' => 'Contenido', 'Class:Attachment/Attribute:contents+' => '', -)); +]); - -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Attachments:File:Thumbnail' => 'Ícono', 'Attachments:File:Name' => 'Nombre de Archivo', 'Attachments:File:Date' => 'Fecha de Carga', @@ -60,25 +60,25 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Attachments:File:Size' => 'Tamaño', 'Attachments:File:MimeType' => 'Tipo', 'Attachments:File:DownloadsCount' => 'Descargas', -)); +]); // // Class: Attachment // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Attachment/Attribute:creation_date' => 'Fecha de Creación', 'Class:Attachment/Attribute:creation_date+' => '', 'Class:Attachment/Attribute:user_id' => 'Id del Usuario', 'Class:Attachment/Attribute:user_id+' => '', 'Class:Attachment/Attribute:contact_id' => 'Id del Contacto', 'Class:Attachment/Attribute:contact_id+' => '', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TriggerOnAttachmentDownload' => 'Disparador (al descargar el archivo adjunto del objeto)', 'Class:TriggerOnAttachmentDownload+' => 'Disparador al descargar el archivo adjunto del objeto de [una clase secundaria de] la clase dada', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/fr.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/fr.dict.itop-attachments.php index c73417092..83f4d66cb 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/fr.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/fr.dict.itop-attachments.php @@ -1,15 +1,16 @@ 'Pièces jointes (%1$d)', 'Attachments:EmptyTabTitle' => 'Pièces jointes', 'Attachments:FieldsetTitle' => 'Pièces jointes', @@ -30,13 +31,13 @@ Soit demandez à votre administrateur système s\'il reste de la place disque di 'Attachments:Render:Icons' => 'Affichage en icônes', 'Attachments:Render:Table' => 'Affichage en liste', 'UI:Attachments:DropYourFileHint' => 'Déposez vos fichiers dans cet espace', -)); +]); // // Class: Attachment // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Attachment' => 'Attachement', 'Class:Attachment+' => '', 'Class:Attachment/Attribute:expire' => 'Expire', @@ -51,10 +52,9 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Attachment/Attribute:item_org_id+' => '', 'Class:Attachment/Attribute:contents' => 'Contenu', 'Class:Attachment/Attribute:contents+' => '', -)); +]); - -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Attachments:File:Thumbnail' => 'Icône', 'Attachments:File:Name' => 'Nom du fichier', 'Attachments:File:Date' => 'Date de chargement', @@ -62,25 +62,25 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Attachments:File:Size' => 'Taille', 'Attachments:File:MimeType' => 'Type', 'Attachments:File:DownloadsCount' => 'Téléchargements', -)); +]); // // Class: Attachment // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Attachment/Attribute:creation_date' => 'Date de création', 'Class:Attachment/Attribute:creation_date+' => '', 'Class:Attachment/Attribute:user_id' => 'Utilisateur', 'Class:Attachment/Attribute:user_id+' => '', 'Class:Attachment/Attribute:contact_id' => 'Contact', 'Class:Attachment/Attribute:contact_id+' => '', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TriggerOnAttachmentDownload' => 'Déclencheur sur le téléchargement d\'une pièce jointe d\'un objet', 'Class:TriggerOnAttachmentDownload+' => '', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/hu.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/hu.dict.itop-attachments.php index c9e097676..892931854 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/hu.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/hu.dict.itop-attachments.php @@ -1,15 +1,16 @@ 'Mellékletek (%1$d)', 'Attachments:EmptyTabTitle' => 'Mellékletek', 'Attachments:FieldsetTitle' => 'Mellékletek', @@ -28,13 +29,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Attachments:Render:Icons' => 'Mutassa ikonként', 'Attachments:Render:Table' => 'Mutassa listaként', 'UI:Attachments:DropYourFileHint' => 'Húzza a fájlokat erre a területre', -)); +]); // // Class: Attachment // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Attachment' => 'Mellékletek', 'Class:Attachment+' => '~~', 'Class:Attachment/Attribute:expire' => 'Lejárat', @@ -49,10 +50,9 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Attachment/Attribute:item_org_id+' => '~~', 'Class:Attachment/Attribute:contents' => 'Tartalom', 'Class:Attachment/Attribute:contents+' => '~~', -)); +]); - -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Attachments:File:Thumbnail' => 'Ikon', 'Attachments:File:Name' => 'Fájlnév', 'Attachments:File:Date' => 'Feltöltés dátuma', @@ -60,25 +60,25 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Attachments:File:Size' => 'Méret', 'Attachments:File:MimeType' => 'Típus', 'Attachments:File:DownloadsCount' => 'Downloads~~', -)); +]); // // Class: Attachment // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Attachment/Attribute:creation_date' => 'Létrehozás dátuma', 'Class:Attachment/Attribute:creation_date+' => '~~', 'Class:Attachment/Attribute:user_id' => 'Felhasználó', 'Class:Attachment/Attribute:user_id+' => '~~', 'Class:Attachment/Attribute:contact_id' => 'Kapcsolattartó', 'Class:Attachment/Attribute:contact_id+' => '~~', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (on object\'s attachment download)~~', 'Class:TriggerOnAttachmentDownload+' => 'Trigger on object\'s attachment download of [a child class of] the given class~~', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/it.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/it.dict.itop-attachments.php index 4c2f440bd..cc3cbc96b 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/it.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/it.dict.itop-attachments.php @@ -1,15 +1,16 @@ 'Allegati (%1$d)', 'Attachments:EmptyTabTitle' => 'Allegati', 'Attachments:FieldsetTitle' => 'Allegati', @@ -30,13 +31,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Attachments:Render:Icons' => 'Visualizza come icone', 'Attachments:Render:Table' => 'Visualizza come lista', 'UI:Attachments:DropYourFileHint' => 'Rilascia i file ovunque in quest\'area', -)); +]); // // Class: Attachment // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Attachment' => 'Allegato', 'Class:Attachment+' => '~~', 'Class:Attachment/Attribute:expire' => 'Scadenza', @@ -51,10 +52,9 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Attachment/Attribute:item_org_id+' => '~~', 'Class:Attachment/Attribute:contents' => 'Contenuti', 'Class:Attachment/Attribute:contents+' => '~~', -)); +]); - -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Attachments:File:Thumbnail' => 'Icona', 'Attachments:File:Name' => 'Nome del file', 'Attachments:File:Date' => 'Data di caricamento', @@ -62,25 +62,25 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Attachments:File:Size' => 'Dimensione', 'Attachments:File:MimeType' => 'Tipo', 'Attachments:File:DownloadsCount' => 'Download', -)); +]); // // Class: Attachment // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Attachment/Attribute:creation_date' => 'Data di creazione', 'Class:Attachment/Attribute:creation_date+' => '~~', 'Class:Attachment/Attribute:user_id' => 'ID utente', 'Class:Attachment/Attribute:user_id+' => '~~', 'Class:Attachment/Attribute:contact_id' => 'ID contatto', 'Class:Attachment/Attribute:contact_id+' => '~~', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (al download di un allegato dell\'oggetto)', 'Class:TriggerOnAttachmentDownload+' => 'Trigger al download di un allegato di un oggetto di [una sottoclasse di] la classe data', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/ja.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/ja.dict.itop-attachments.php index 61decc9b7..5b812530b 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/ja.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/ja.dict.itop-attachments.php @@ -1,15 +1,16 @@ '添付 (%1$d)', 'Attachments:EmptyTabTitle' => '添付', 'Attachments:FieldsetTitle' => '添付', @@ -30,13 +31,13 @@ or ask your '.ITOP_APPLICATION_SHORT.' administrator if the '.ITOP_APPLICATION_S 'Attachments:Render:Icons' => 'Display as icons~~', 'Attachments:Render:Table' => 'Display as list~~', 'UI:Attachments:DropYourFileHint' => 'Drop files anywhere in this area~~', -)); +]); // // Class: Attachment // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Attachment' => 'Attachment~~', 'Class:Attachment+' => '~~', 'Class:Attachment/Attribute:expire' => 'Expire~~', @@ -51,10 +52,9 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Attachment/Attribute:item_org_id+' => '~~', 'Class:Attachment/Attribute:contents' => 'Contents~~', 'Class:Attachment/Attribute:contents+' => '~~', -)); +]); - -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Attachments:File:Thumbnail' => 'Icon~~', 'Attachments:File:Name' => 'File name~~', 'Attachments:File:Date' => 'Upload date~~', @@ -62,25 +62,25 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Attachments:File:Size' => 'Size~~', 'Attachments:File:MimeType' => 'Type~~', 'Attachments:File:DownloadsCount' => 'Downloads~~', -)); +]); // // Class: Attachment // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Attachment/Attribute:creation_date' => 'Creation date~~', 'Class:Attachment/Attribute:creation_date+' => '~~', 'Class:Attachment/Attribute:user_id' => 'User id~~', 'Class:Attachment/Attribute:user_id+' => '~~', 'Class:Attachment/Attribute:contact_id' => 'Contact id~~', 'Class:Attachment/Attribute:contact_id+' => '~~', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (on object\'s attachment download)~~', 'Class:TriggerOnAttachmentDownload+' => 'Trigger on object\'s attachment download of [a child class of] the given class~~', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/nl.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/nl.dict.itop-attachments.php index 7d9f96f01..e8e4c2005 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/nl.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/nl.dict.itop-attachments.php @@ -1,17 +1,18 @@ * @author Jeffrey Bostoen (2018 - 2022) * @author Thomas Casteleyn */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Attachments:TabTitle_Count' => 'Bijlagen (%1$d)', 'Attachments:EmptyTabTitle' => 'Bijlagen', 'Attachments:FieldsetTitle' => 'Bijlagen', @@ -32,13 +33,13 @@ of vraag de iTop administrator om de opslagruimte van de iTop-server na te kijke 'Attachments:Render:Icons' => 'Toon als pictogram', 'Attachments:Render:Table' => 'Toon als lijst', 'UI:Attachments:DropYourFileHint' => 'Sleep bestanden in dit gebied', -)); +]); // // Class: Attachment // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Attachment' => 'Bijlage', 'Class:Attachment+' => '', 'Class:Attachment/Attribute:expire' => 'Vervalt', @@ -53,10 +54,9 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Attachment/Attribute:item_org_id+' => '', 'Class:Attachment/Attribute:contents' => 'Inhoud', 'Class:Attachment/Attribute:contents+' => '', -)); +]); - -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Attachments:File:Thumbnail' => 'Pictogram', 'Attachments:File:Name' => 'Bestandsnaam', 'Attachments:File:Date' => 'Geüpload op', @@ -64,25 +64,25 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Attachments:File:Size' => 'Grootte', 'Attachments:File:MimeType' => 'Type', 'Attachments:File:DownloadsCount' => 'Downloads', -)); +]); // // Class: Attachment // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Attachment/Attribute:creation_date' => 'Datum creatie', 'Class:Attachment/Attribute:creation_date+' => '', 'Class:Attachment/Attribute:user_id' => 'ID Gebruiker', 'Class:Attachment/Attribute:user_id+' => '', 'Class:Attachment/Attribute:contact_id' => 'ID Contact', 'Class:Attachment/Attribute:contact_id+' => '', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (Bij het downloaden van een bijlage)', 'Class:TriggerOnAttachmentDownload+' => 'Trigger bij het downloaden van een bijlage van een object van de opgegeven klasse (of subklasse ervan)', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/pl.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/pl.dict.itop-attachments.php index ae5a16bdf..38b80a0e5 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/pl.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/pl.dict.itop-attachments.php @@ -1,15 +1,16 @@ 'Załączniki (%1$d)', 'Attachments:EmptyTabTitle' => 'Załączniki', 'Attachments:FieldsetTitle' => 'Załączniki', @@ -30,13 +31,13 @@ lub zapytaj administratora '.ITOP_APPLICATION_SHORT.', czy dysk serwera '.ITOP_A 'Attachments:Render:Icons' => 'Wyświetlaj jako ikony', 'Attachments:Render:Table' => 'Wyświetl jako listę', 'UI:Attachments:DropYourFileHint' => 'Upuść pliki w dowolnym miejscu w tym obszarze', -)); +]); // // Class: Attachment // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Attachment' => 'Załącznik', 'Class:Attachment+' => '', 'Class:Attachment/Attribute:expire' => 'Wygasa', @@ -51,10 +52,9 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Attachment/Attribute:item_org_id+' => '', 'Class:Attachment/Attribute:contents' => 'Zawartość', 'Class:Attachment/Attribute:contents+' => '', -)); +]); - -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Attachments:File:Thumbnail' => 'Ikona', 'Attachments:File:Name' => 'Nazwa pliku', 'Attachments:File:Date' => 'Data przesłania', @@ -62,25 +62,25 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Attachments:File:Size' => 'Rozmiar', 'Attachments:File:MimeType' => 'Typ', 'Attachments:File:DownloadsCount' => 'Pobrano', -)); +]); // // Class: Attachment // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Attachment/Attribute:creation_date' => 'Data utworzenia', 'Class:Attachment/Attribute:creation_date+' => '', 'Class:Attachment/Attribute:user_id' => 'Id użytkownika', 'Class:Attachment/Attribute:user_id+' => '', 'Class:Attachment/Attribute:contact_id' => 'Id kontaktu', 'Class:Attachment/Attribute:contact_id+' => '', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TriggerOnAttachmentDownload' => 'Wyzwalacz (po pobraniu załącznika obiektu)', 'Class:TriggerOnAttachmentDownload+' => 'Wyzwalacz po pobraniu załącznika obiektu [klasy podrzędnej] danej klasy', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/pt_br.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/pt_br.dict.itop-attachments.php index f652e848e..929dee4ad 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/pt_br.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/pt_br.dict.itop-attachments.php @@ -1,15 +1,16 @@ 'Anexos (%1$d)', 'Attachments:EmptyTabTitle' => 'Anexos', 'Attachments:FieldsetTitle' => 'Anexos', @@ -30,13 +31,13 @@ ou entre em contato com o seu administrador do '.ITOP_APPLICATION_SHORT.' pois o 'Attachments:Render:Icons' => 'Exibir como ícones', 'Attachments:Render:Table' => 'Exibir como lista', 'UI:Attachments:DropYourFileHint' => 'Solte arquivos em qualquer lugar nesta área', -)); +]); // // Class: Attachment // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Attachment' => 'Anexo', 'Class:Attachment+' => '', 'Class:Attachment/Attribute:expire' => 'Expira', @@ -51,10 +52,9 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Attachment/Attribute:item_org_id+' => '', 'Class:Attachment/Attribute:contents' => 'Conteúdo', 'Class:Attachment/Attribute:contents+' => '', -)); +]); - -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Attachments:File:Thumbnail' => 'Ícone', 'Attachments:File:Name' => 'Nome do arquivo', 'Attachments:File:Date' => 'Data de envio', @@ -62,25 +62,25 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Attachments:File:Size' => 'Tamanho', 'Attachments:File:MimeType' => 'Tipo', 'Attachments:File:DownloadsCount' => 'Downloads~~', -)); +]); // // Class: Attachment // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Attachment/Attribute:creation_date' => 'Data de criação', 'Class:Attachment/Attribute:creation_date+' => '', 'Class:Attachment/Attribute:user_id' => 'Identificador do usuário', 'Class:Attachment/Attribute:user_id+' => '', 'Class:Attachment/Attribute:contact_id' => 'Identificador do contato', 'Class:Attachment/Attribute:contact_id+' => '', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (on object\'s attachment download)~~', 'Class:TriggerOnAttachmentDownload+' => 'Trigger on object\'s attachment download of [a child class of] the given class~~', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/ru.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/ru.dict.itop-attachments.php index fd12232f3..afe99a087 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/ru.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/ru.dict.itop-attachments.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Attachments:TabTitle_Count' => 'Вложения (%1$d)', 'Attachments:EmptyTabTitle' => 'Вложения', 'Attachments:FieldsetTitle' => 'Вложения', @@ -31,13 +32,13 @@ or ask your '.ITOP_APPLICATION_SHORT.' administrator if the '.ITOP_APPLICATION_S 'Attachments:Render:Icons' => 'Display as icons~~', 'Attachments:Render:Table' => 'Display as list~~', 'UI:Attachments:DropYourFileHint' => 'Drop files anywhere in this area~~', -)); +]); // // Class: Attachment // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Attachment' => 'Вложение', 'Class:Attachment+' => '', 'Class:Attachment/Attribute:expire' => 'Истекает', @@ -52,10 +53,9 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Attachment/Attribute:item_org_id+' => '', 'Class:Attachment/Attribute:contents' => 'Содержимое', 'Class:Attachment/Attribute:contents+' => '', -)); +]); - -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Attachments:File:Thumbnail' => 'Предпросмотр', 'Attachments:File:Name' => 'Имя файла', 'Attachments:File:Date' => 'Дата', @@ -63,25 +63,25 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Attachments:File:Size' => 'Размер', 'Attachments:File:MimeType' => 'Тип', 'Attachments:File:DownloadsCount' => 'Downloads~~', -)); +]); // // Class: Attachment // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Attachment/Attribute:creation_date' => 'Дата создания', 'Class:Attachment/Attribute:creation_date+' => '', 'Class:Attachment/Attribute:user_id' => 'Пользователь', 'Class:Attachment/Attribute:user_id+' => '', 'Class:Attachment/Attribute:contact_id' => 'Контакт', 'Class:Attachment/Attribute:contact_id+' => '', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (on object\'s attachment download)~~', 'Class:TriggerOnAttachmentDownload+' => 'Trigger on object\'s attachment download of [a child class of] the given class~~', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/sk.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/sk.dict.itop-attachments.php index d514632d7..4e6216829 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/sk.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/sk.dict.itop-attachments.php @@ -1,15 +1,16 @@ 'Prílohy (%1$d)', 'Attachments:EmptyTabTitle' => 'Prílohy', 'Attachments:FieldsetTitle' => 'Prílohy', @@ -30,13 +31,13 @@ or ask your '.ITOP_APPLICATION_SHORT.' administrator if the '.ITOP_APPLICATION_S 'Attachments:Render:Icons' => 'Display as icons~~', 'Attachments:Render:Table' => 'Display as list~~', 'UI:Attachments:DropYourFileHint' => 'Drop files anywhere in this area~~', -)); +]); // // Class: Attachment // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Attachment' => 'Attachment~~', 'Class:Attachment+' => '~~', 'Class:Attachment/Attribute:expire' => 'Expire~~', @@ -51,10 +52,9 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Attachment/Attribute:item_org_id+' => '~~', 'Class:Attachment/Attribute:contents' => 'Contents~~', 'Class:Attachment/Attribute:contents+' => '~~', -)); +]); - -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Attachments:File:Thumbnail' => 'Icon~~', 'Attachments:File:Name' => 'File name~~', 'Attachments:File:Date' => 'Upload date~~', @@ -62,25 +62,25 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Attachments:File:Size' => 'Size~~', 'Attachments:File:MimeType' => 'Type~~', 'Attachments:File:DownloadsCount' => 'Downloads~~', -)); +]); // // Class: Attachment // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Attachment/Attribute:creation_date' => 'Creation date~~', 'Class:Attachment/Attribute:creation_date+' => '~~', 'Class:Attachment/Attribute:user_id' => 'User id~~', 'Class:Attachment/Attribute:user_id+' => '~~', 'Class:Attachment/Attribute:contact_id' => 'Contact id~~', 'Class:Attachment/Attribute:contact_id+' => '~~', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (on object\'s attachment download)~~', 'Class:TriggerOnAttachmentDownload+' => 'Trigger on object\'s attachment download of [a child class of] the given class~~', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/tr.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/tr.dict.itop-attachments.php index 01f9d94cf..05445c4be 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/tr.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/tr.dict.itop-attachments.php @@ -1,15 +1,16 @@ 'Attachments (%1$d)~~', 'Attachments:EmptyTabTitle' => 'Attachments~~', 'Attachments:FieldsetTitle' => 'Attachments~~', @@ -30,13 +31,13 @@ or ask your '.ITOP_APPLICATION_SHORT.' administrator if the '.ITOP_APPLICATION_S 'Attachments:Render:Icons' => 'Display as icons~~', 'Attachments:Render:Table' => 'Display as list~~', 'UI:Attachments:DropYourFileHint' => 'Drop files anywhere in this area~~', -)); +]); // // Class: Attachment // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Attachment' => 'Attachment~~', 'Class:Attachment+' => '~~', 'Class:Attachment/Attribute:expire' => 'Expire~~', @@ -51,10 +52,9 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Attachment/Attribute:item_org_id+' => '~~', 'Class:Attachment/Attribute:contents' => 'Contents~~', 'Class:Attachment/Attribute:contents+' => '~~', -)); +]); - -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Attachments:File:Thumbnail' => 'Icon~~', 'Attachments:File:Name' => 'File name~~', 'Attachments:File:Date' => 'Upload date~~', @@ -62,25 +62,25 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Attachments:File:Size' => 'Size~~', 'Attachments:File:MimeType' => 'Type~~', 'Attachments:File:DownloadsCount' => 'Downloads~~', -)); +]); // // Class: Attachment // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Attachment/Attribute:creation_date' => 'Creation date~~', 'Class:Attachment/Attribute:creation_date+' => '~~', 'Class:Attachment/Attribute:user_id' => 'User id~~', 'Class:Attachment/Attribute:user_id+' => '~~', 'Class:Attachment/Attribute:contact_id' => 'Contact id~~', 'Class:Attachment/Attribute:contact_id+' => '~~', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TriggerOnAttachmentDownload' => 'Trigger (on object\'s attachment download)~~', 'Class:TriggerOnAttachmentDownload+' => 'Trigger on object\'s attachment download of [a child class of] the given class~~', -)); +]); diff --git a/datamodels/2.x/itop-attachments/dictionaries/zh_cn.dict.itop-attachments.php b/datamodels/2.x/itop-attachments/dictionaries/zh_cn.dict.itop-attachments.php index b6a355b49..3646f1bcf 100644 --- a/datamodels/2.x/itop-attachments/dictionaries/zh_cn.dict.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/dictionaries/zh_cn.dict.itop-attachments.php @@ -1,4 +1,5 @@ '附件 (%1$d)', 'Attachments:EmptyTabTitle' => '附件', 'Attachments:FieldsetTitle' => '附件', @@ -30,13 +31,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Attachments:Render:Icons' => '显示为图标', 'Attachments:Render:Table' => '显示为列表', 'UI:Attachments:DropYourFileHint' => '将文件拖放到此区域的任意位置', -)); +]); // // Class: Attachment // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Attachment' => '附件', 'Class:Attachment+' => '', 'Class:Attachment/Attribute:expire' => '过期', @@ -51,10 +52,9 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Attachment/Attribute:item_org_id+' => '', 'Class:Attachment/Attribute:contents' => '内容', 'Class:Attachment/Attribute:contents+' => '', -)); +]); - -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Attachments:File:Thumbnail' => '图标', 'Attachments:File:Name' => '文件名', 'Attachments:File:Date' => '上传日期', @@ -62,25 +62,25 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Attachments:File:Size' => '大小', 'Attachments:File:MimeType' => '类型', 'Attachments:File:DownloadsCount' => '下载', -)); +]); // // Class: Attachment // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Attachment/Attribute:creation_date' => '创建日期', 'Class:Attachment/Attribute:creation_date+' => '~~', 'Class:Attachment/Attribute:user_id' => '用户编号', 'Class:Attachment/Attribute:user_id+' => '~~', 'Class:Attachment/Attribute:contact_id' => '联系人编号', 'Class:Attachment/Attribute:contact_id+' => '~~', -)); +]); // // Class: TriggerOnAttachmentDownload // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TriggerOnAttachmentDownload' => '触发器 (于对象附件下载时)', 'Class:TriggerOnAttachmentDownload+' => '触发器于指定类型 [子类型] 对象附件下载时', -)); +]); diff --git a/datamodels/2.x/itop-attachments/main.itop-attachments.php b/datamodels/2.x/itop-attachments/main.itop-attachments.php index 1fbe5a8b0..cd23cb06e 100644 --- a/datamodels/2.x/itop-attachments/main.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/main.itop-attachments.php @@ -1,4 +1,5 @@ GetAttachmentsPosition() == 'properties') - { + if ($this->GetAttachmentsPosition() == 'properties') { $this->DisplayAttachments($oObject, $oPage, $bEditMode); } } public function OnDisplayRelations($oObject, WebPage $oPage, $bEditMode = false) { - if ($this->GetAttachmentsPosition() == 'relations') - { + if ($this->GetAttachmentsPosition() == 'relations') { $this->DisplayAttachments($oObject, $oPage, $bEditMode); } } public function OnFormSubmit($oObject, $sFormPrefix = '') { - if ($this->IsTargetObject($oObject)) - { + if ($this->IsTargetObject($oObject)) { // For new objects attachments are processed in OnDBInsert - if (!$oObject->IsNew()) - { + if (!$oObject->IsNew()) { self::UpdateAttachments($oObject); } } @@ -52,12 +49,9 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt public static function GetMaxUploadSize() { $sMaxUpload = ini_get('upload_max_filesize'); - if (!$sMaxUpload) - { + if (!$sMaxUpload) { $result = false; - } - else - { + } else { $result = utils::ConvertToBytes($sMaxUpload); } @@ -70,13 +64,11 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt * @return bool * @since 3.2.1 N°7534 */ - public static function IsAttachmentAllowedForObject(cmdbAbstractObject $oObject) : bool + public static function IsAttachmentAllowedForObject(cmdbAbstractObject $oObject): bool { - $aAllowedClasses = MetaModel::GetModuleSetting('itop-attachments', 'allowed_classes', array('Ticket')); - foreach ($aAllowedClasses as $sAllowedClass) - { - if ($oObject instanceof $sAllowedClass) - { + $aAllowedClasses = MetaModel::GetModuleSetting('itop-attachments', 'allowed_classes', ['Ticket']); + foreach ($aAllowedClasses as $sAllowedClass) { + if ($oObject instanceof $sAllowedClass) { return true; } } @@ -91,24 +83,15 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt public static function GetMaxUpload() { $iMaxUpload = static::GetMaxUploadSize(); - if (!$iMaxUpload) - { + if (!$iMaxUpload) { $sRet = Dict::S('Attachments:UploadNotAllowedOnThisSystem'); - } - else - { - if ($iMaxUpload > 1024 * 1024 * 1024) - { + } else { + if ($iMaxUpload > 1024 * 1024 * 1024) { $sRet = Dict::Format('Attachment:Max_Go', sprintf('%0.2f', $iMaxUpload / (1024 * 1024 * 1024))); - } - else - { - if ($iMaxUpload > 1024 * 1024) - { + } else { + if ($iMaxUpload > 1024 * 1024) { $sRet = Dict::Format('Attachment:Max_Mo', sprintf('%0.2f', $iMaxUpload / (1024 * 1024))); - } - else - { + } else { $sRet = Dict::Format('Attachment:Max_Ko', sprintf('%0.2f', $iMaxUpload / (1024))); } } @@ -127,9 +110,8 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt // Delete all "pending" attachments for this form $sOQL = 'SELECT Attachment WHERE temp_id = :temp_id'; $oSearch = DBObjectSearch::FromOQL($sOQL); - $oSet = new DBObjectSet($oSearch, array(), array('temp_id' => $sTempId)); - while ($oAttachment = $oSet->Fetch()) - { + $oSet = new DBObjectSet($oSearch, [], ['temp_id' => $sTempId]); + while ($oAttachment = $oSet->Fetch()) { $oAttachment->DBDelete(); // Pending attachment, don't mention it in the history } @@ -137,7 +119,7 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt public function EnumUsedAttributes($oObject) { - return array(); + return []; } public function GetIcon($oObject) @@ -148,14 +130,14 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt public function GetHilightClass($oObject) { // Possible return values are: - // HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING, HILIGHT_CLASS_OK, HILIGHT_CLASS_NONE + // HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING, HILIGHT_CLASS_OK, HILIGHT_CLASS_NONE return HILIGHT_CLASS_NONE; } public function EnumAllowedActions(DBObjectSet $oSet) { // No action - return array(); + return []; } public function OnIsModified($oObject) @@ -165,23 +147,21 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt public function OnCheckToWrite($oObject) { - return array(); + return []; } public function OnCheckToDelete($oObject) { - return array(); + return []; } public function OnDBUpdate($oObject, $oChange = null) { - if ($this->IsTargetObject($oObject)) - { + if ($this->IsTargetObject($oObject)) { // Get all current attachments $oSearch = DBObjectSearch::FromOQL("SELECT Attachment WHERE item_class = :class AND item_id = :item_id"); - $oSet = new DBObjectSet($oSearch, array(), array('class' => get_class($oObject), 'item_id' => $oObject->GetKey())); - while ($oAttachment = $oSet->Fetch()) - { + $oSet = new DBObjectSet($oSearch, [], ['class' => get_class($oObject), 'item_id' => $oObject->GetKey()]); + while ($oAttachment = $oSet->Fetch()) { $oAttachment->SetItem($oObject, true /*updateonchange*/); } } @@ -189,20 +169,17 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt public function OnDBInsert($oObject, $oChange = null) { - if ($this->IsTargetObject($oObject)) - { + if ($this->IsTargetObject($oObject)) { self::UpdateAttachments($oObject, $oChange); } } public function OnDBDelete($oObject, $oChange = null) { - if ($this->IsTargetObject($oObject)) - { + if ($this->IsTargetObject($oObject)) { $oSearch = DBObjectSearch::FromOQL("SELECT Attachment WHERE item_class = :class AND item_id = :item_id"); - $oSet = new DBObjectSet($oSearch, array(), array('class' => get_class($oObject), 'item_id' => $oObject->GetKey())); - while ($oAttachment = $oSet->Fetch()) - { + $oSet = new DBObjectSet($oSearch, [], ['class' => get_class($oObject), 'item_id' => $oObject->GetKey()]); + while ($oAttachment = $oSet->Fetch()) { $oAttachment->DBDelete(); } } @@ -216,11 +193,9 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt protected function IsTargetObject($oObject) { - $aAllowedClasses = MetaModel::GetModuleSetting('itop-attachments', 'allowed_classes', array('Ticket')); - foreach ($aAllowedClasses as $sAllowedClass) - { - if ($oObject instanceof $sAllowedClass) - { + $aAllowedClasses = MetaModel::GetModuleSetting('itop-attachments', 'allowed_classes', ['Ticket']); + foreach ($aAllowedClasses as $sAllowedClass) { + if ($oObject instanceof $sAllowedClass) { return true; } } @@ -233,7 +208,7 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt return MetaModel::GetModuleSetting('itop-attachments', 'position', 'relations'); } - var $m_bDeleteEnabled = true; + public $m_bDeleteEnabled = true; public function EnableDelete($bEnabled) { @@ -254,34 +229,28 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt public function DisplayAttachments(DBObject $oObject, WebPage $oPage, $bEditMode = false) { // Exit here if the class is not allowed - if (!$this->IsTargetObject($oObject)) - { + if (!$this->IsTargetObject($oObject)) { return; } $sObjClass = get_class($oObject); $iObjKey = $oObject->GetKey(); $sTransactionId = $oPage->GetTransactionId(); - if ($bEditMode && empty($sTransactionId)) - { + if ($bEditMode && empty($sTransactionId)) { throw new InvalidParameterException('Attachments renderer : invalid transaction id'); } $oAttachmentsRenderer = AttachmentsRendererFactory::GetInstance($oPage, $sObjClass, $iObjKey, $sTransactionId); - if ($this->GetAttachmentsPosition() === 'relations') - { + if ($this->GetAttachmentsPosition() === 'relations') { $iCount = $oAttachmentsRenderer->GetAttachmentsSet()->Count() + $oAttachmentsRenderer->GetTempAttachmentsSet()->Count(); $sTitle = ($iCount > 0) ? Dict::Format('Attachments:TabTitle_Count', $iCount) : Dict::S('Attachments:EmptyTabTitle'); $oPage->SetCurrentTab('Attachments:Tab', $sTitle); } - + $bIsReadOnlyState = self::IsReadonlyState($oObject, $oObject->GetState(), AttachmentPlugIn::ENUM_GUI_BACKOFFICE); - if ($bEditMode && !$bIsReadOnlyState) - { + if ($bEditMode && !$bIsReadOnlyState) { $oAttachmentsRenderer->RenderEditAttachmentsList(); - } - else - { + } else { $oAttachmentsRenderer->RenderViewAttachmentsList(); } } @@ -307,27 +276,23 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt { self::$m_bIsModified = false; - if (utils::ReadParam('attachment_plugin', 'not-in-form') == 'not-in-form') - { + if (utils::ReadParam('attachment_plugin', 'not-in-form') == 'not-in-form') { // Workaround to an issue in iTop < 2.0 // Leave silently if there is no trace of the attachment form return; } $sTransactionId = utils::ReadParam('transaction_id', null, false, 'transaction_id'); - if (!is_null($sTransactionId)) - { - $aActions = array(); - $aRemovedAttachmentIds = utils::ReadParam('removed_attachments', array()); + if (!is_null($sTransactionId)) { + $aActions = []; + $aRemovedAttachmentIds = utils::ReadParam('removed_attachments', []); // Get all current attachments $oSearch = DBObjectSearch::FromOQL("SELECT Attachment WHERE item_class = :class AND item_id = :item_id"); $oSearch->AllowAllData(); - $oSet = new DBObjectSet($oSearch, array(), array('class' => get_class($oObject), 'item_id' => $oObject->GetKey())); - while ($oAttachment = $oSet->Fetch()) - { + $oSet = new DBObjectSet($oSearch, [], ['class' => get_class($oObject), 'item_id' => $oObject->GetKey()]); + while ($oAttachment = $oSet->Fetch()) { // Remove attachments that are no longer attached to the current object - if (in_array($oAttachment->GetKey(), $aRemovedAttachmentIds)) - { + if (in_array($oAttachment->GetKey(), $aRemovedAttachmentIds)) { $aData = ['attachment' => $oAttachment]; $oObject->FireEvent(EVENT_REMOVE_ATTACHMENT_FROM_OBJECT, $aData); $oAttachment->DBDelete(); @@ -342,16 +307,12 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt $sOQL = 'SELECT Attachment WHERE temp_id = :temp_id'; $oSearch = DBObjectSearch::FromOQL($sOQL); $oSearch->AllowAllData(); - $oSet = new DBObjectSet($oSearch, array(), array('temp_id' => $sTempId)); - while ($oAttachment = $oSet->Fetch()) - { - if (in_array($oAttachment->GetKey(), $aRemovedAttachmentIds)) - { + $oSet = new DBObjectSet($oSearch, [], ['temp_id' => $sTempId]); + while ($oAttachment = $oSet->Fetch()) { + if (in_array($oAttachment->GetKey(), $aRemovedAttachmentIds)) { $oAttachment->DBDelete(); // temporary attachment removed, don't even mention it in the history - } - else - { + } else { $oAttachment->SetItem($oObject); $oAttachment->Set('temp_id', ''); $oAttachment->DBUpdate(); @@ -361,10 +322,8 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt $oObject->FireEvent(EVENT_ADD_ATTACHMENT_TO_OBJECT, $aData); } } - if (count($aActions) > 0) - { - foreach ($aActions as $oChangeOp) - { + if (count($aActions) > 0) { + foreach ($aActions as $oChangeOp) { self::RecordHistory($oChange, $oObject, $oChangeOp); } self::$m_bIsModified = true; @@ -375,11 +334,10 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt public static function CopyAttachments($oObject, $sTransactionId) { $oSearch = DBObjectSearch::FromOQL("SELECT Attachment WHERE item_class = :class AND item_id = :item_id"); - $oSet = new DBObjectSet($oSearch, array(), array('class' => get_class($oObject), 'item_id' => $oObject->GetKey())); + $oSet = new DBObjectSet($oSearch, [], ['class' => get_class($oObject), 'item_id' => $oObject->GetKey()]); // Attach new (temporary) attachments $sTempId = utils::GetUploadTempId($sTransactionId); - while ($oAttachment = $oSet->Fetch()) - { + while ($oAttachment = $oSet->Fetch()) { $oTempAttachment = clone $oAttachment; $oTempAttachment->Set('expire', time() + utils::GetConfig()->Get('draft_attachments_lifetime')); $oTempAttachment->Set('item_id', null); @@ -392,15 +350,11 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt public static function GetFileIcon($sFileName) { $aPathParts = pathinfo($sFileName); - if (!array_key_exists('extension', $aPathParts)) - { + if (!array_key_exists('extension', $aPathParts)) { // No extension: use the default icon $sIcon = 'icons8-file.svg'; - } - else - { - switch (strtolower($aPathParts['extension'])) - { + } else { + switch (strtolower($aPathParts['extension'])) { case 'doc': case 'docx': $sIcon = 'icons8-word.svg'; @@ -433,7 +387,7 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt case 'vb': $sIcon = 'icons8-code-file.svg'; break; - + case 'pdf': $sIcon = 'icons8-pdf.svg'; break; @@ -486,7 +440,7 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt case 'ai': $sIcon = 'icons8-image-file.svg'; break; - + case 'zip': case 'gz': case 'tgz': @@ -520,34 +474,34 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt case 'wma': $sIcon = 'icons8-audio-file.svg'; break; - + case 'csv': $sIcon = 'icons8-csv.svg'; break; - + case 'log': $sIcon = 'icons8-event-log.svg'; break; - + case 'sql': $sIcon = 'icons8-sql.svg'; break; - + case 'xml': $sIcon = 'icons8-xml-file.svg'; - break; - + break; + case 'email': case 'eml': case 'emlx': case 'msg': $sIcon = 'icons8-mail.svg'; break; - + case 'patch': $sIcon = 'icons8-bandage.svg'; break; - + default: $sIcon = 'icons8-file.svg'; break; @@ -560,8 +514,7 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt ///////////////////////////////////////////////////////////////////////// private static function RecordHistory($oChange, $oTargetObject, $oMyChangeOp) { - if (!is_null($oChange)) - { + if (!is_null($oChange)) { $oMyChangeOp->Set("change", $oChange->GetKey()); } $oMyChangeOp->Set("objclass", get_class($oTargetObject)); @@ -574,14 +527,11 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt { $oBlob = $oAttachment->Get('contents'); $sFileName = $oBlob->GetFileName(); - if ($bCreate) - { + if ($bCreate) { $oChangeOp = new CMDBChangeOpAttachmentAdded(); $oChangeOp->Set('attachment_id', $oAttachment->GetKey()); $oChangeOp->Set('filename', $sFileName); - } - else - { + } else { $oChangeOp = new CMDBChangeOpAttachmentRemoved(); $oChangeOp->Set('filename', $sFileName); } @@ -603,44 +553,36 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt */ public static function IsReadonlyState(DBObject $oObject, $sState, $sGUI = self::ENUM_GUI_ALL) { - $aParamDefaultValue = array( - static::ENUM_GUI_ALL => array( - 'Ticket' => array('closed'), - ), - ); + $aParamDefaultValue = [ + static::ENUM_GUI_ALL => [ + 'Ticket' => ['closed'], + ], + ]; $bReadonly = false; $sClass = get_class($oObject); $aReadonlyStatus = MetaModel::GetModuleSetting('itop-attachments', 'readonly_states', $aParamDefaultValue); - if (!empty($aReadonlyStatus)) - { + if (!empty($aReadonlyStatus)) { // Merging GUIs entries - $aEntries = array(); + $aEntries = []; // - All - if (array_key_exists(static::ENUM_GUI_ALL, $aReadonlyStatus)) - { + if (array_key_exists(static::ENUM_GUI_ALL, $aReadonlyStatus)) { $aEntries = array_merge_recursive($aEntries, $aReadonlyStatus[static::ENUM_GUI_ALL]); } // - Backoffice & Portals - foreach (array(static::ENUM_GUI_BACKOFFICE, static::ENUM_GUI_PORTALS) as $sEnumGUI) - { - if (in_array($sGUI, array(static::ENUM_GUI_ALL, $sEnumGUI))) - { - if (array_key_exists($sEnumGUI, $aReadonlyStatus)) - { + foreach ([static::ENUM_GUI_BACKOFFICE, static::ENUM_GUI_PORTALS] as $sEnumGUI) { + if (in_array($sGUI, [static::ENUM_GUI_ALL, $sEnumGUI])) { + if (array_key_exists($sEnumGUI, $aReadonlyStatus)) { $aEntries = array_merge_recursive($aEntries, $aReadonlyStatus[$sEnumGUI]); } } } $aParentClasses = array_reverse(MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL)); - foreach ($aParentClasses as $sParentClass) - { - if (array_key_exists($sParentClass, $aEntries)) - { + foreach ($aParentClasses as $sParentClass) { + if (array_key_exists($sParentClass, $aEntries)) { // If we found an ancestor of the object's class, we stop looking event if the current state is not specified - if (in_array($oObject->GetState(), $aEntries[$sParentClass])) - { + if (in_array($oObject->GetState(), $aEntries[$sParentClass])) { $bReadonly = true; } break; @@ -664,38 +606,38 @@ class CMDBChangeOpAttachmentAdded extends CMDBChangeOp { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_attachment_added", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeExternalKey("attachment_id", array( + MetaModel::Init_AddAttribute(new AttributeExternalKey("attachment_id", [ "targetclass" => "Attachment", "allowed_values" => null, "sql" => "attachment_id", "is_null_allowed" => true, "on_target_delete" => DEL_SILENT, - "depends_on" => array(), - ))); - MetaModel::Init_AddAttribute(new AttributeString("filename", array( + "depends_on" => [], + ])); + MetaModel::Init_AddAttribute(new AttributeString("filename", [ "allowed_values" => null, "sql" => "filename", "default_value" => "", "is_null_allowed" => false, - "depends_on" => array(), - ))); + "depends_on" => [], + ])); // Display lists - MetaModel::Init_SetZListItems('details', array('attachment_id')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('attachment_id')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['attachment_id']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['attachment_id']); // Attributes to be displayed for a list } /** @@ -715,12 +657,15 @@ class CMDBChangeOpAttachmentAdded extends CMDBChangeOp $oAttachment = $oMonoObjectSet->Fetch(); $oDoc = $oAttachment->Get('contents'); $sPreview = $oDoc->IsPreviewAvailable() ? 'data-preview="true"' : ''; - $sResult = Dict::Format('Attachments:History_File_Added', - ''.$sFilename.''); - } - else - { + $sResult = Dict::Format( + 'Attachments:History_File_Added', + ''.$sFilename.'' + ); + } else { $sResult = Dict::Format('Attachments:History_File_Added', ''.$sFilename.''); } @@ -732,30 +677,30 @@ class CMDBChangeOpAttachmentRemoved extends CMDBChangeOp { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core/cmdb, grant_by_profile", "key_type" => "", "name_attcode" => "change", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_changeop_attachment_removed", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("filename", array( + MetaModel::Init_AddAttribute(new AttributeString("filename", [ "allowed_values" => null, "sql" => "filename", "default_value" => "", "is_null_allowed" => false, - "depends_on" => array(), - ))); + "depends_on" => [], + ])); // Display lists - MetaModel::Init_SetZListItems('details', array('filename')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('filename')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['filename']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['filename']); // Attributes to be displayed for a list } /** @@ -764,8 +709,10 @@ class CMDBChangeOpAttachmentRemoved extends CMDBChangeOp public function GetDescription() { // Temporary, until we change the options of GetDescription() -needs a more global revision - $sResult = Dict::Format('Attachments:History_File_Removed', - ''.utils::EscapeHtml($this->Get('filename')).''); + $sResult = Dict::Format( + 'Attachments:History_File_Removed', + ''.utils::EscapeHtml($this->Get('filename')).'' + ); return $sResult; } @@ -785,8 +732,8 @@ class TriggerOnAttachmentDownload extends TriggerOnAttributeBlobDownload */ public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "grant_by_profile,core/cmdb,application", "key_type" => "autoincrement", "name_attcode" => "description", @@ -797,13 +744,12 @@ class TriggerOnAttachmentDownload extends TriggerOnAttributeBlobDownload "db_key_field" => "id", "db_finalclass_field" => "", "display_template" => "", - ); + ]; MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); } } - class AttachmentsHelper { /** @@ -815,29 +761,22 @@ class AttachmentsHelper public static function GetAttachmentsDateAddedFromDb($sObjClass, $iObjKey) { $sQuery = "SELECT CMDBChangeOpAttachmentAdded WHERE objclass='$sObjClass' AND objkey=$iObjKey"; - try - { + try { $oSearch = DBObjectSearch::FromOQL($sQuery); - } - catch (OQLException $e) - { - return array(); + } catch (OQLException $e) { + return []; } $oSet = new DBObjectSet($oSearch); - try - { - $aAttachmentDates = array(); - while ($oChangeOpAttAdded = $oSet->Fetch()) - { + try { + $aAttachmentDates = []; + while ($oChangeOpAttAdded = $oSet->Fetch()) { $iAttachmentId = $oChangeOpAttAdded->Get('attachment_id'); $sAttachmentDate = $oChangeOpAttAdded->Get('date'); $aAttachmentDates[$iAttachmentId] = $sAttachmentDate; } - } - catch (Exception $e) - { - return array(); + } catch (Exception $e) { + return []; } return $aAttachmentDates; diff --git a/datamodels/2.x/itop-attachments/module.itop-attachments.php b/datamodels/2.x/itop-attachments/module.itop-attachments.php index 6c097cc57..b3559c85f 100644 --- a/datamodels/2.x/itop-attachments/module.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/module.itop-attachments.php @@ -1,9 +1,10 @@ - SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file 'itop-attachments/3.2.1', - array( + [ // Identification // 'label' => 'Tickets Attachments', @@ -28,49 +28,48 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array(), + 'dependencies' => [], 'mandatory' => false, 'visible' => true, 'installer' => 'AttachmentInstaller', // Components // - 'datamodel' => array( + 'datamodel' => [ 'vendor/autoload.php', 'main.itop-attachments.php', 'renderers.itop-attachments.php', - ), - 'webservice' => array( - - ), - 'dictionary' => array( + ], + 'webservice' => [ - ), - 'data.struct' => array( + ], + 'dictionary' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( - 'allowed_classes' => array('Ticket'), // List of classes for which to manage "Attachments" + 'settings' => [ + 'allowed_classes' => ['Ticket'], // List of classes for which to manage "Attachments" 'position' => 'relations', // Where to display the attachments: relations | properties 'preview_max_width' => 290, 'icon_preview_max_size' => 500000, // Maximum size for attachment preview to be displayed as an icon. In bits - ), - ) + ], + ] ); -if (!class_exists('AttachmentInstaller')) -{ +if (!class_exists('AttachmentInstaller')) { // Module installation handler // class AttachmentInstaller extends ModuleInstallerAPI @@ -91,7 +90,8 @@ if (!class_exists('AttachmentInstaller')) * @throws \MySQLException * @throws \MySQLHasGoneAwayException */ - public static function GetOrphanAttachmentIds($sTableName, $iBulkSize){ + public static function GetOrphanAttachmentIds($sTableName, $iBulkSize) + { $sSqlQuery = <<fetch_array()){ + while ($aRow = $oQueryResult->fetch_array()) { $aIds[] = $aRow['attachment_id']; } @@ -114,15 +114,13 @@ SQL; */ public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) { - if ($sPreviousVersion != '') - { + if ($sPreviousVersion != '') { // Migrating from a previous version // Check for records where item_id = '', since they are not attached to any object and cannot be migrated to the objkey schema $sTableName = MetaModel::DBGetTable('Attachment'); $sCountQuery = "SELECT COUNT(*) FROM `$sTableName` WHERE (`item_id`='' OR `item_id` IS NULL)"; $iCount = CMDBSource::QueryToScalar($sCountQuery); - if ($iCount > 0) - { + if ($iCount > 0) { SetupLog::Info("Cleanup of orphan attachments that cannot be migrated to the new ObjKey model: $iCount record(s) must be deleted."); $iBulkSize = 100; @@ -138,7 +136,7 @@ SQL; $iDeletedCount += count($aIds); $fElapsed = microtime(true) - $fStartTime; - if ($fElapsed > $iMaxDuration){ + if ($fElapsed > $iMaxDuration) { SetupLog::Info(sprintf("Cleanup of orphan attachments interrupted after %.3f s. $iDeletedCount records were deleted among $iCount.", $fElapsed)); break; } @@ -146,12 +144,10 @@ SQL; $aIds = self::GetOrphanAttachmentIds($sTableName, $iBulkSize); } - if (count($aIds) === 0){ + if (count($aIds) === 0) { SetupLog::Info("Cleanup of orphan attachments successfully completed."); } - } - else - { + } else { SetupLog::Info("No orphan attachment found."); } } @@ -166,7 +162,7 @@ SQL; public static function AfterDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) { // For each record having item_org_id unset, - // get the org_id from the container object + // get the org_id from the container object // // Prerequisite: change null into 0 (workaround to the fact that we cannot use IS NULL in OQL) SetupLog::Info("Initializing attachment/item_org_id - null to zero"); @@ -182,11 +178,10 @@ SQL; 'Attachment' => [ 'item_class', 'item_id', - ] + ], ]); $iUpdated = 0; - while ($oAttachment = $oSet->Fetch()) - { + while ($oAttachment = $oSet->Fetch()) { if (empty($oAttachment->Get('item_class'))) { //do not treat orphan attachment continue; diff --git a/datamodels/2.x/itop-attachments/renderers.itop-attachments.php b/datamodels/2.x/itop-attachments/renderers.itop-attachments.php index b521cd1cf..1ebbdf001 100644 --- a/datamodels/2.x/itop-attachments/renderers.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/renderers.itop-attachments.php @@ -1,4 +1,5 @@ AllowAllData(); - $this->oAttachmentsSet = new DBObjectSet($oSearch, array(), array('class' => $sObjClass, 'item_id' => $iObjKey)); + $this->oAttachmentsSet = new DBObjectSet($oSearch, [], ['class' => $sObjClass, 'item_id' => $iObjKey]); $oSearchTemp = DBObjectSearch::FromOQL('SELECT Attachment WHERE temp_id = :temp_id'); $oSearchTemp->AllowAllData(); - $this->oTempAttachmentsSet = new DBObjectSet($oSearchTemp, array(), array('temp_id' => $this->sTransactionId)); + $this->oTempAttachmentsSet = new DBObjectSet($oSearchTemp, [], ['temp_id' => $this->sTransactionId]); } /** @@ -154,7 +152,7 @@ abstract class AbstractAttachmentsRenderer * * @return void will print using {@link oPage} */ - public function RenderEditAttachmentsList($aAttachmentsDeleted = array()) + public function RenderEditAttachmentsList($aAttachmentsDeleted = []) { $this->AddUploadButton(); @@ -174,11 +172,11 @@ abstract class AbstractAttachmentsRenderer * @throws \CoreUnexpectedValue * @throws \MySQLException */ - abstract public function AddAttachmentsListContent($bWithDeleteButton, $aAttachmentsDeleted = array()); + abstract public function AddAttachmentsListContent($bWithDeleteButton, $aAttachmentsDeleted = []); public function RenderViewAttachmentsList() { - $this->AddAttachmentsListContent(false, array()); + $this->AddAttachmentsListContent(false, []); } protected function AddUploadButton() @@ -196,12 +194,11 @@ abstract class AbstractAttachmentsRenderer $oAddButton = FileSelectUIBlockFactory::MakeStandard('file', 'file'); $oAddButton->SetShowFilename(false); $this->oPage->AddUiBlock($oAddButton); - $this->oPage->add(' ' . $sMaxUploadLabel); + $this->oPage->add(' '.$sMaxUploadLabel); $this->oPage->add(''); $this->oPage->add('
          '); $this->oPage->add(file_get_contents(APPROOT.'images/illustrations/undraw_upload.svg')); $this->oPage->add(Dict::S('UI:Attachments:DropYourFileHint').'
          '); - $this->oPage->LinkScriptFromAppRoot('node_modules/blueimp-file-upload/js/jquery.iframe-transport.js'); $this->oPage->LinkScriptFromAppRoot('node_modules/blueimp-file-upload/js/jquery.fileupload.js'); @@ -365,15 +362,18 @@ JS protected function GetDeleteAttachmentButton($iAttId) { - $oButton = ButtonUIBlockFactory::MakeIconAction('fas fa-trash', Dict::S('Attachments:DeleteBtn'), + $oButton = ButtonUIBlockFactory::MakeIconAction( + 'fas fa-trash', + Dict::S('Attachments:DeleteBtn'), '', Dict::S('Attachments:DeleteBtn'), false, - "btn_remove_".$iAttId); + "btn_remove_".$iAttId + ); $oButton->AddCSSClass('btn_hidden') ->SetOnClickJsCode("RemoveAttachment(".$iAttId.");") ->SetColor(Button::ENUM_COLOR_SCHEME_DESTRUCTIVE); - + return $oButton; } @@ -399,22 +399,19 @@ JS; } } - /** * Class TableDetailsAttachmentsRenderer */ class TableDetailsAttachmentsRenderer extends AbstractAttachmentsRenderer { - public function AddAttachmentsListContent($bWithDeleteButton, $aAttachmentsDeleted = array()) + public function AddAttachmentsListContent($bWithDeleteButton, $aAttachmentsDeleted = []) { - if ($this->GetAttachmentsCount() === 0) - { + if ($this->GetAttachmentsCount() === 0) { $this->oPage->add(Dict::S('Attachments:NoAttachment')); return; } - $sThumbnail = Dict::S('Attachments:File:Thumbnail'); $sFileName = Dict::S('Attachments:File:Name'); $sFileSize = Dict::S('Attachments:File:Size'); @@ -423,37 +420,34 @@ class TableDetailsAttachmentsRenderer extends AbstractAttachmentsRenderer $sFileType = Dict::S('Attachments:File:MimeType'); $sFileDownloadsCount = Dict::S('Attachments:File:DownloadsCount'); - if ($bWithDeleteButton) - { + if ($bWithDeleteButton) { $this->oPage->add_script($this->GetDeleteAttachmentJs()); } $bIsEven = false; $aAttachmentsDate = AttachmentsHelper::GetAttachmentsDateAddedFromDb($this->sObjClass, $this->iObjKey); - $aData = array(); - while ($oAttachment = $this->oAttachmentsSet->Fetch()) - { + $aData = []; + while ($oAttachment = $this->oAttachmentsSet->Fetch()) { $bIsEven = ($bIsEven) ? false : true; $aData[] = $this->AddAttachmentsTableLine($bWithDeleteButton, $bIsEven, $oAttachment, $aAttachmentsDate, $aAttachmentsDeleted); } - while ($oTempAttachment = $this->oTempAttachmentsSet->Fetch()) - { + while ($oTempAttachment = $this->oTempAttachmentsSet->Fetch()) { $bIsEven = ($bIsEven) ? false : true; $aData[] = $this->AddAttachmentsTableLine($bWithDeleteButton, $bIsEven, $oTempAttachment, $aAttachmentsDate, $aAttachmentsDeleted); } - $aAttribs = array( - 'icon' => array('label' => $sThumbnail, 'description' => $sThumbnail), - 'filename' => array('label' => $sFileName, 'description' => $sFileName), - 'formatted-size' => array('label' => $sFileSize, 'description' => $sFileSize), - 'upload-date' => array('label' => $sFileDate, 'description' => $sFileDate), - 'uploader' => array('label' => $sFileUploader, 'description' => $sFileUploader), - 'type' => array('label' => $sFileType, 'description' => $sFileType), - 'downloads-count' => array('label' => $sFileDownloadsCount, 'description' => $sFileDownloadsCount), - ); + $aAttribs = [ + 'icon' => ['label' => $sThumbnail, 'description' => $sThumbnail], + 'filename' => ['label' => $sFileName, 'description' => $sFileName], + 'formatted-size' => ['label' => $sFileSize, 'description' => $sFileSize], + 'upload-date' => ['label' => $sFileDate, 'description' => $sFileDate], + 'uploader' => ['label' => $sFileUploader, 'description' => $sFileUploader], + 'type' => ['label' => $sFileType, 'description' => $sFileType], + 'downloads-count' => ['label' => $sFileDownloadsCount, 'description' => $sFileDownloadsCount], + ]; if ($bWithDeleteButton) { - $aAttribs['delete'] = array('label' => '', 'description' => ''); + $aAttribs['delete'] = ['label' => '', 'description' => '']; } $oPanel = PanelUIBlockFactory::MakeNeutral(''); $oPanel->AddCSSClass('ibo-datatable-panel'); @@ -465,7 +459,7 @@ class TableDetailsAttachmentsRenderer extends AbstractAttachmentsRenderer $sTableId = $oAttachmentTableBlock->GetId(); - foreach ($aData as $aAtt){ + foreach ($aData as $aAtt) { $sJS = $aAtt['js']; $this->oPage->add_ready_script( <<GetKey(); $bIsDeletedAttachment = false; - if (in_array($iAttachmentId, $aAttachmentsDeleted, true)) - { + if (in_array($iAttachmentId, $aAttachmentsDeleted, true)) { $bIsDeletedAttachment = true; } @@ -512,11 +505,9 @@ JS $sFileFormattedSize = $oDoc->GetFormattedSize(); $bIsTempAttachment = ($oAttachment->Get('item_id') === 0); $sAttachmentDateFormatted = ''; - if (!$bIsTempAttachment) - { + if (!$bIsTempAttachment) { $sAttachmentDate = $oAttachment->Get('creation_date'); - if (empty($sAttachmentDate) && array_key_exists($iAttachmentId, $aAttachmentsDate)) - { + if (empty($sAttachmentDate) && array_key_exists($iAttachmentId, $aAttachmentsDate)) { $sAttachmentDate = $aAttachmentsDate[$iAttachmentId]; } $oAttachmentDate = DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $sAttachmentDate); @@ -536,19 +527,16 @@ JS $sPreviewNotAvailable = Dict::S('Attachments:PreviewNotAvailable'); $sPreviewMarkup = $sPreviewNotAvailable; - if ($oDoc->IsPreviewAvailable()) - { + if ($oDoc->IsPreviewAvailable()) { $sIconClass = ' preview'; $sAttachmentPreviewUrl = $sDocDisplayUrl; - if ($oDoc->GetSize() <= $iMaxSizeForPreview) - { + if ($oDoc->GetSize() <= $iMaxSizeForPreview) { $sAttachmentThumbUrl = $sDocDisplayUrl; } $sPreviewMarkup = utils::HtmlEntities(''); } - - $aAttachmentLine = array( + $aAttachmentLine = [ '@id' => $sTrId, '@meta' => 'data-file-type="'.utils::HtmlEntities($sFileType).'" data-file-size-raw="'.utils::HtmlEntities($iFileSize).'" data-file-size-formatted="'.utils::HtmlEntities($sFileFormattedSize).'" data-file-uploader="'.utils::HtmlEntities($sAttachmentUploader).'"', 'icon' => '', @@ -559,16 +547,15 @@ JS 'type' => $sFileType, 'downloads-count' => $oDoc->GetDownloadsCount(), 'js' => '', - ); + ]; if ($bIsDeletedAttachment) { $aAttachmentLine['@class'] = 'ibo-is-hidden'; } - if ($bWithDeleteButton) - { + if ($bWithDeleteButton) { $sDeleteButton = $this->GetDeleteAttachmentButton($iAttachmentId); - + $oBlockRenderer = new BlockRenderer($sDeleteButton); $aAttachmentLine['js'] .= $oBlockRenderer->RenderJsInline($sDeleteButton::ENUM_JS_TYPE_ON_INIT); $aAttachmentLine['delete'] = $oBlockRenderer->RenderHtml(); diff --git a/datamodels/2.x/itop-attachments/src/Hook/EventListener.php b/datamodels/2.x/itop-attachments/src/Hook/EventListener.php index 273f9506e..4f89f19ea 100644 --- a/datamodels/2.x/itop-attachments/src/Hook/EventListener.php +++ b/datamodels/2.x/itop-attachments/src/Hook/EventListener.php @@ -69,7 +69,7 @@ class EventListener implements iEventServiceSetup 'attachment->data' => $oDocument->GetData(), 'attachment->data_as_base64' => base64_encode($oDocument->GetData()), ]; - $aTriggerParams = array('class_list' => MetaModel::EnumParentClasses($oAttachment->Get('item_class'), ENUM_PARENT_CLASSES_ALL)); + $aTriggerParams = ['class_list' => MetaModel::EnumParentClasses($oAttachment->Get('item_class'), ENUM_PARENT_CLASSES_ALL)]; $oTriggerSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT $sTriggerClass AS t WHERE t.target_class IN (:class_list)"), [], $aTriggerParams); /** @var \Trigger $oTrigger */ @@ -86,4 +86,4 @@ class EventListener implements iEventServiceSetup } } } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-backup/ajax.backup.php b/datamodels/2.x/itop-backup/ajax.backup.php index b8ec98180..71ca5da0c 100644 --- a/datamodels/2.x/itop-backup/ajax.backup.php +++ b/datamodels/2.x/itop-backup/ajax.backup.php @@ -1,4 +1,5 @@ SetContentType('text/html'); - - /** * Check security */ -switch ($sOperation) -{ +switch ($sOperation) { /** * Can't use normal check methods (DoLogin for ex) as the datamodel can't be loaded here * So we're only using a token generated in the restore_token operation @@ -68,8 +62,10 @@ switch ($sOperation) case 'restore_exec': IssueLog::Enable(APPROOT.'log/error.log'); if (utils::GetConfig()->Get('demo_mode')) { - DisplayErrorAndDie($oPage, - '
          Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the feature is disabled.
          '); + DisplayErrorAndDie( + $oPage, + '
          Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the feature is disabled.
          ' + ); } $sToken = utils::ReadParam('token', '', false, 'raw_data'); @@ -93,38 +89,30 @@ switch ($sOperation) $sTransactionId = utils::ReadParam('transaction_id', '', true, 'transaction_id'); // the consumer page is not reloaded after download, we need to keep the transaction_id $bRemoveTransactionId = ($sOperation !== 'download'); - if (!utils::IsTransactionValid($sTransactionId, $bRemoveTransactionId)) - { + if (!utils::IsTransactionValid($sTransactionId, $bRemoveTransactionId)) { $sEscapedOperation = utils::HtmlEntities($sOperation); DisplayErrorAndDie($oPage, "
          Error: invalid Transaction ID. The operation '$sEscapedOperation' was NOT performed!
          "); } ApplicationMenu::CheckMenuIdEnabled('BackupStatus'); - if (utils::GetConfig()->Get('demo_mode')) - { + if (utils::GetConfig()->Get('demo_mode')) { DisplayErrorAndDie($oPage, '
          Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the feature is disabled.
          '); } break; } - /** * Backup from an interactive session */ -try -{ - switch ($sOperation) - { +try { + switch ($sOperation) { case 'backup': - try - { + try { set_time_limit(0); $oBB = new BackupExec(APPROOT.'data/backups/manual/', 0 /*iRetentionCount*/); $sRes = $oBB->Process(time() + 36000); // 10 hours to complete should be sufficient! - } - catch (Exception $e) - { + } catch (Exception $e) { $oPage->p('Error: '.$e->getMessage()); IssueLog::Error($sOperation.' - '.$e->getMessage()); } @@ -132,21 +120,20 @@ try $oPage->output(); break; - /* - * Fix a specific token : - * We can't load the MetaModel because in DBRestore, after restore is done we're launching a compile ! - * So as LoginWebPage::DoLogin needs a loaded DataModel, we can't use it - * Also, we can't use \utils::IsTransactionValid as it uses \MetaModel::GetConfig - * As a result we're setting a token file to make sure the restore is called by an authenticated user with the correct rights ! - */ + /* + * Fix a specific token : + * We can't load the MetaModel because in DBRestore, after restore is done we're launching a compile ! + * So as LoginWebPage::DoLogin needs a loaded DataModel, we can't use it + * Also, we can't use \utils::IsTransactionValid as it uses \MetaModel::GetConfig + * As a result we're setting a token file to make sure the restore is called by an authenticated user with the correct rights ! + */ case 'restore_get_token': $oPage = new JsonPage(); $oPage->SetOutputDataOnly(true); $sEnvironment = utils::ReadParam('environment', 'production', false, 'raw_data'); $oRestoreMutex = new iTopMutex('restore.'.$sEnvironment); - if ($oRestoreMutex->IsLocked()) - { + if ($oRestoreMutex->IsLocked()) { DisplayErrorAndDie($oPage, '

          '.Dict::S('bkp-restore-running').'

          '); } @@ -159,10 +146,10 @@ try $oPage->output(); break; - /* - * We can't call \LoginWebPage::DoLogin because DBRestore will do a compile after restoring the DB - * Authentication is checked with a token file (see $sOperation='restore_get_token') - */ + /* + * We can't call \LoginWebPage::DoLogin because DBRestore will do a compile after restoring the DB + * Authentication is checked with a token file (see $sOperation='restore_get_token') + */ case 'restore_exec': require_once(APPROOT."setup/runtimeenv.class.inc.php"); require_once(APPROOT.'/application/utils.inc.php'); @@ -170,8 +157,7 @@ try require_once(__DIR__.'/dbrestore.class.inc.php'); $sEnvironment = utils::ReadParam('environment', 'production', false, 'raw_data'); - try - { + try { set_time_limit(0); // Get the file and destroy the token (single usage) @@ -190,14 +176,10 @@ try $sRes = $oDBRS->RestoreFromCompressedBackup($sBackupFile, $sEnvironment); IssueLog::Info('Backup Restore - Done, releasing the LOCK'); - } - catch (Exception $e) - { + } catch (Exception $e) { $oPage->p('Error: '.$e->getMessage()); IssueLog::Error($sOperation.' - '.$e->getMessage()); - } - finally - { + } finally { unlink($tokenRealPath); } @@ -212,16 +194,12 @@ try $oBackup = new DBBackupScheduled(); $sBackupDir = APPROOT.'data/backups/'; $sBackupFilePath = utils::RealPath($sBackupDir.$sFile, $sBackupDir); - if ($sBackupFilePath === false) - { + if ($sBackupFilePath === false) { throw new CoreUnexpectedValue('Invalid file path'); } $oBackup->DownloadBackup($sBackupFilePath); break; } -} -catch (Exception $e) -{ +} catch (Exception $e) { IssueLog::Error($sOperation.' - '.$e->getMessage()); } - diff --git a/datamodels/2.x/itop-backup/backup.php b/datamodels/2.x/itop-backup/backup.php index 09f22fcc1..49c5252e6 100644 --- a/datamodels/2.x/itop-backup/backup.php +++ b/datamodels/2.x/itop-backup/backup.php @@ -1,4 +1,5 @@ p('Perform a backup of the iTop database by running mysqldump'); $oP->p('Parameters:'); - if (utils::IsModeCLI()) - { + if (utils::IsModeCLI()) { $oP->p('auth_user: login, must be administrator'); $oP->p('auth_pwd: ...'); } @@ -74,13 +71,10 @@ function Usage($oP) $oP->p('simulate [optional]: set to check the name of the file that would be created'); $oP->p('mysql_bindir [optional]: specify the path for mysqldump'); - if (utils::IsModeCLI()) - { + if (utils::IsModeCLI()) { $oP->p('Example: php -q backup.php --auth_user=admin --auth_pwd=myPassw0rd'); $oP->p('Known limitation: the current directory must be the directory of backup.php'); - } - else - { + } else { $oP->p('Example: .../backup.php?backup_file=/tmp/backup.__DB__-__SUBNAME__.%Y-%m'); } } @@ -91,67 +85,53 @@ function Usage($oP) * @throws \DictExceptionUnknownLanguage * @throws \OQLException */ -function ExecuteMainOperation($oP){ +function ExecuteMainOperation($oP) +{ - if (utils::IsModeCLI()) - { + if (utils::IsModeCLI()) { $oP->p(date('Y-m-d H:i:s')." - running backup utility"); $sAuthUser = ReadMandatoryParam($oP, 'auth_user'); $sAuthPwd = ReadMandatoryParam($oP, 'auth_pwd'); $bDownloadBackup = false; - if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) - { + if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) { UserRights::Login($sAuthUser); // Login & set the user's language - } - else - { + } else { ExitError($oP, "Access restricted or wrong credentials ('$sAuthUser')"); } - } - else - { + } else { require_once(APPROOT.'application/loginwebpage.class.inc.php'); LoginWebPage::DoLogin(); // Check user rights and prompt if needed $bDownloadBackup = utils::ReadParam('download', false); } - if (!UserRights::IsAdministrator()) - { + if (!UserRights::IsAdministrator()) { ExitError($oP, "Access restricted to administors"); } - if (CheckParam('?') || CheckParam('h') || CheckParam('help')) - { + if (CheckParam('?') || CheckParam('h') || CheckParam('help')) { Usage($oP); $oP->output(); exit; } - $sDefaultBackupFileName = SetupUtils::GetTmpDir().'/'."__DB__-%Y-%m-%d"; $sBackupFile = utils::ReadParam('backup_file', $sDefaultBackupFileName, true, 'raw_data'); -// Interpret strftime specifications (like %Y) and database placeholders + // Interpret strftime specifications (like %Y) and database placeholders $oBackup = new MyDBBackup($oP); $oBackup->SetMySQLBinDir(MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'mysql_bindir', '')); $sBackupFile = $oBackup->MakeName($sBackupFile); $bSimulate = utils::ReadParam('simulate', false, true); $res = false; - if ($bSimulate) - { + if ($bSimulate) { $oP->p("Simulate: would create file '$sBackupFile'"); - } - elseif (MetaModel::GetConfig()->Get('demo_mode')) - { + } elseif (MetaModel::GetConfig()->Get('demo_mode')) { $oP->p("Sorry, iTop is in demonstration mode: the feature is disabled"); - } - else - { + } else { $oBackup->CreateCompressedBackup($sBackupFile); } - if ($res && $bDownloadBackup) - { + if ($res && $bDownloadBackup) { $oBackup->DownloadBackup($sBackupFile); } } diff --git a/datamodels/2.x/itop-backup/check-backup.php b/datamodels/2.x/itop-backup/check-backup.php index 2319f630f..04dfada1e 100644 --- a/datamodels/2.x/itop-backup/check-backup.php +++ b/datamodels/2.x/itop-backup/check-backup.php @@ -1,4 +1,5 @@ GetMessage()."\n"; return; } @@ -151,60 +130,52 @@ function RaiseAlarm($sMessage) $oConfig = GetConfig(); $sItopRootConfig = $oConfig->GetModuleSetting('itop-backup', 'itop_backup_incident'); - if (empty($sItopRootConfig)) - { + if (empty($sItopRootConfig)) { // by default getting self ! // we could have '' as config value... $sItopRootConfig = $oConfig->Get('app_root_url'); } - try - { + try { $sWsdlUri = $sItopRootConfig.'/webservices/itop.wsdl.php'; $aSOAPMapping = SOAPMapping::GetMapping(); ini_set("soap.wsdl_cache_enabled", "0"); $oSoapClient = new SoapClient( $sWsdlUri, - array( + [ 'trace' => 1, 'classmap' => $aSOAPMapping, // defined in itopsoaptypes.class.inc.php - ) + ] ); - } - catch (Exception $e) - { + } catch (Exception $e) { echo "ERROR: Failed to read WSDL of the target iTop ($sItopRootConfig)\n"; return; } - try - { - $oRes = $oSoapClient->CreateIncidentTicket - ( + try { + $oRes = $oSoapClient->CreateIncidentTicket( $sTicketLogin, /* login */ $sTicketPwd, /* password */ $sTicketTitle, /* title */ $sMessage, /* description */ null, /* caller */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', $sTicketCustomer))), /* customer */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', $sTicketService))), /* service */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', $sTicketSubcategory))), /* service subcategory */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', $sTicketCustomer)]), /* customer */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', $sTicketService)]), /* service */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', $sTicketSubcategory)]), /* service subcategory */ '', /* product */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', $sTicketWorkgroup))), /* workgroup */ - array( + new SOAPExternalKeySearch([new SOAPSearchCondition('name', $sTicketWorkgroup)]), /* workgroup */ + [ new SOAPLinkCreationSpec( 'Server', - array(new SOAPSearchCondition('name', $sTicketImpactedServer)), - array() + [new SOAPSearchCondition('name', $sTicketImpactedServer)], + [] ), - ), /* impacted cis */ + ], /* impacted cis */ '1', /* impact */ '1' /* urgency */ ); - } - catch(Exception $e) - { + } catch (Exception $e) { echo "The ticket could not be created: SOAP Exception = '".$e->getMessage()."'\n"; return; @@ -214,102 +185,76 @@ function RaiseAlarm($sMessage) //print_r($oRes); //echo "\n"; - if ($oRes->status) - { + if ($oRes->status) { $sTicketName = $oRes->result[0]->values[1]->value; echo "Created ticket: $sTicketName\n"; - } - else - { + } else { echo "ERROR: Failed to create the ticket in target iTop ($sItopRootConfig)\n"; - foreach ($oRes->errors->messages as $oMessage) - { + foreach ($oRes->errors->messages as $oMessage) { echo $oMessage->text."\n"; } - } + } } - ////////// // Main -try -{ +try { utils::UseParamFile(); -} -catch(Exception $e) -{ +} catch (Exception $e) { echo "Error: ".$e->GetMessage()."\n"; exit; } - -if (utils::IsModeCLI()) -{ +if (utils::IsModeCLI()) { SetupUtils::CheckPhpAndExtensionsForCli(new CLIPage('Check backup utility')); echo date('Y-m-d H:i:s')." - running check-backup utility\n"; - try - { + try { $sAuthUser = ReadMandatoryParam('auth_user'); $sAuthPwd = ReadMandatoryParam('auth_pwd'); - } - catch (Exception $e) - { + } catch (Exception $e) { $sMessage = $e->getMessage(); ToolsLog::Error($sMessage); echo $sMessage; exit; } $bDownloadBackup = false; - if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) - { + if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) { UserRights::Login($sAuthUser); // Login & set the user's language - } - else - { + } else { ExitError($oP, "Access restricted or wrong credentials ('$sAuthUser')"); } -} -else -{ +} else { require_once(APPROOT.'application/loginwebpage.class.inc.php'); LoginWebPage::DoLogin(); // Check user rights and prompt if needed $bDownloadBackup = utils::ReadParam('download', false); } -if (!UserRights::IsAdministrator()) -{ +if (!UserRights::IsAdministrator()) { ExitError($oP, "Access restricted to administors"); } - - // N°1802 : was moved from script param to config file (avoid direct call with untrusted param value) $sItopRootParam = utils::ReadParam('check_ticket_itop', null, true, 'raw_data'); -if (!empty($sItopRootParam)) -{ +if (!empty($sItopRootParam)) { echo "ERROR: parameter 'check_ticket_itop' should now be specified in the config file 'itop_backup_incident' parameter\n"; return; } - $sZipArchiveFile = MakeArchiveFileName().'.tar.gz'; $sZipArchiveFileForDisplay = utils::HtmlEntities($sZipArchiveFile); echo date('Y-m-d H:i:s')." - Checking file: $sZipArchiveFileForDisplay\n"; - -if (!file_exists($sZipArchiveFile)) -{ +if (!file_exists($sZipArchiveFile)) { RaiseAlarm("Missing backup file '$sZipArchiveFileForDisplay'"); return; } $aStat = stat($sZipArchiveFile); -if (!$aStat) -{ +if (!$aStat) { RaiseAlarm("Failed to stat backup file '$sZipArchiveFileForDisplay'"); return; @@ -317,37 +262,28 @@ if (!$aStat) $iSize = (int)$aStat['size']; $iMIN = utils::ReadParam('check_size_min', 0); -if ($iSize <= $iMIN) -{ +if ($iSize <= $iMIN) { RaiseAlarm("Backup file '$sZipArchiveFileForDisplay' too small (Found: $iSize, while expecting $iMIN bytes)"); return; } - echo "Found the archive\n"; $sOldArchiveFile = MakeArchiveFileName(time() - 86400).'.tar.gz'; // yesterday's archive $sOldArchiveFileForDisplay = utils::HtmlEntities($sOldArchiveFile); -if (file_exists($sOldArchiveFile)) -{ - if ($aOldStat = stat($sOldArchiveFile)) - { +if (file_exists($sOldArchiveFile)) { + if ($aOldStat = stat($sOldArchiveFile)) { echo "Comparing its size with older file: $sOldArchiveFileForDisplay\n"; $iOldSize = (int)$aOldStat['size']; $fVariationPercent = 100 * ($iSize - $iOldSize) / $iOldSize; $sVariation = round($fVariationPercent, 2)." percent(s)"; $iREDUCTIONMAX = utils::ReadParam('check_size_reduction_max'); - if ($fVariationPercent < -$iREDUCTIONMAX) - { + if ($fVariationPercent < -$iREDUCTIONMAX) { RaiseAlarm("Backup file '$sZipArchiveFileForDisplay' changed by $sVariation, expecting a reduction limited to $iREDUCTIONMAX percents of the original size"); - } - elseif ($fVariationPercent < 0) - { + } elseif ($fVariationPercent < 0) { echo "Size variation: $sVariation (the maximum allowed reduction is $iREDUCTIONMAX) \n"; - } - else - { + } else { echo "The archive grew by: $sVariation\n"; } } diff --git a/datamodels/2.x/itop-backup/common.cli-execution.php b/datamodels/2.x/itop-backup/common.cli-execution.php index 358803f23..756896066 100644 --- a/datamodels/2.x/itop-backup/common.cli-execution.php +++ b/datamodels/2.x/itop-backup/common.cli-execution.php @@ -1,4 +1,5 @@ GetMessage()); } diff --git a/datamodels/2.x/itop-backup/dbrestore.class.inc.php b/datamodels/2.x/itop-backup/dbrestore.class.inc.php index e5adbd04b..ca211cc9c 100644 --- a/datamodels/2.x/itop-backup/dbrestore.class.inc.php +++ b/datamodels/2.x/itop-backup/dbrestore.class.inc.php @@ -1,9 +1,10 @@ - class DBRestore extends DBBackup { /** @var string */ @@ -54,12 +54,9 @@ class DBRestore extends DBBackup $sPwd = self::EscapeShellArg($this->sDBPwd); $sDBName = self::EscapeShellArg($this->sDBName); $sMySQLExe = DBBackup::MakeSafeMySQLCommand($this->sMySQLBinDir, 'mysql'); - if (is_null($this->iDBPort)) - { + if (is_null($this->iDBPort)) { $sPortOption = ''; - } - else - { + } else { $sPortOption = '--port='.$this->iDBPort.' '; } $sTlsOptions = self::GetMysqlCliTlsOptions($this->oConfig); @@ -70,26 +67,20 @@ class DBRestore extends DBBackup // Now run the command for real $this->LogInfo("Executing command: $sCommandDisplay"); - $aOutput = array(); + $aOutput = []; $iRetCode = 0; exec($sCommand, $aOutput, $iRetCode); - foreach($aOutput as $sLine) - { + foreach ($aOutput as $sLine) { $this->LogInfo("mysql said: $sLine"); } - if ($iRetCode != 0) - { + if ($iRetCode != 0) { $this->LogError("Failed to execute: $sCommandDisplay. The command returned:$iRetCode"); - foreach($aOutput as $sLine) - { + foreach ($aOutput as $sLine) { $this->LogError("mysql said: $sLine"); } - if (count($aOutput) == 1) - { + if (count($aOutput) == 1) { $sMoreInfo = trim($aOutput[0]); - } - else - { + } else { $sMoreInfo = "Check the log file '".realpath(APPROOT.'/log/error.log')."' for more information."; } throw new BackupException("Failed to execute mysql: ".$sMoreInfo); @@ -132,7 +123,6 @@ class DBRestore extends DBBackup //safe zone for db backup => cron is stopped/ itop in readonly $this->LogInfo("Starting restore of ".basename($sFile)); - $sNormalizedFile = strtolower(basename($sFile)); if (substr($sNormalizedFile, -4) == '.zip') { $this->LogInfo('zip file detected'); @@ -180,9 +170,9 @@ class DBRestore extends DBBackup @chmod($sConfigFile, 0770); // Allow overwriting the file rename($sDataDir.'/config-itop.php', $sConfigFile); @chmod($sConfigFile, 0440); // Read-only - + $aExtraFiles = $this->ListExtraFiles($sDataDir); - foreach($aExtraFiles as $sSourceFilePath => $sDestinationFilePath) { + foreach ($aExtraFiles as $sSourceFilePath => $sDestinationFilePath) { SetupUtils::builddir(dirname($sDestinationFilePath)); rename($sSourceFilePath, $sDestinationFilePath); } @@ -203,9 +193,7 @@ class DBRestore extends DBBackup $this->LogInfo("Keep maintenance mode after restore"); } } - } - finally - { + } finally { IssueLog::Info('Backup Restore - LOCK released.'); $oRestoreMutex->Unlock(); } @@ -221,10 +209,9 @@ class DBRestore extends DBBackup { $aExtraFiles = []; $aStandardFiles = ['config-itop.php', 'itop-dump.sql', 'production-modules', 'delta.xml']; - $oDirectoryIterator = new RecursiveDirectoryIterator($sDataDir, FilesystemIterator::CURRENT_AS_FILEINFO|FilesystemIterator::SKIP_DOTS); + $oDirectoryIterator = new RecursiveDirectoryIterator($sDataDir, FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS); $oIterator = new RecursiveIteratorIterator($oDirectoryIterator); - foreach ($oIterator as $oFileInfo) - { + foreach ($oIterator as $oFileInfo) { if (in_array($oFileInfo->getFilename(), $aStandardFiles)) { continue; } diff --git a/datamodels/2.x/itop-backup/dictionaries/cs.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/cs.dict.itop-backup.php index 3965ef59b..2cae140fd 100644 --- a/datamodels/2.x/itop-backup/dictionaries/cs.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/cs.dict.itop-backup.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'bkp-backup-running' => 'Probíhá záloha. Vyčkejte prosím...', 'bkp-restore-running' => 'Probíhá obnova ze zálohy. Vyčkejte prosím...', 'Menu:BackupStatus' => 'Plánované zálohování', @@ -46,4 +47,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'bkp-wait-backup' => 'Vyčkejte prosím na dokončení zálohy...', 'bkp-wait-restore' => 'Vyčkejte prosím na dokončení obnovy', 'bkp-success-restore' => 'Obnova úspěšně dokončena.', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/da.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/da.dict.itop-backup.php index 6f5425f9c..dd95b5385 100644 --- a/datamodels/2.x/itop-backup/dictionaries/da.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/da.dict.itop-backup.php @@ -1,15 +1,16 @@ 'A backup is running. Please wait...~~', 'bkp-restore-running' => 'A restore is running. Please wait...~~', 'Menu:BackupStatus' => 'Backups~~', @@ -44,4 +45,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'bkp-wait-backup' => 'Please wait for the backup to complete...~~', 'bkp-wait-restore' => 'Please wait for the restore to complete...~~', 'bkp-success-restore' => 'Restore successfully completed.~~', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/de.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/de.dict.itop-backup.php index 95c1228b4..bbd871757 100644 --- a/datamodels/2.x/itop-backup/dictionaries/de.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/de.dict.itop-backup.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'bkp-backup-running' => 'Backup wird durchgeführt. Bitte warten ...', 'bkp-restore-running' => 'Wiederherstellung läuft. Bitte warten ...', 'Menu:BackupStatus' => 'Geplante Backups', @@ -45,4 +46,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'bkp-wait-backup' => 'Bitte warten, bis das Backup abgeschlossen ist ...', 'bkp-wait-restore' => 'Bitte warten, bis die Wiederherstellung abgeschlossen ist ...', 'bkp-success-restore' => 'Wiederherstellung erfolgreich.', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/en.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/en.dict.itop-backup.php index 2e769a829..2981bdb01 100644 --- a/datamodels/2.x/itop-backup/dictionaries/en.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/en.dict.itop-backup.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'bkp-backup-running' => 'A backup is running. Please wait...', 'bkp-restore-running' => 'A restore is running. Please wait...', @@ -58,4 +59,4 @@ Dict::Add('EN US', 'English', 'English', array( 'bkp-wait-backup' => 'Please wait for the backup to complete...', 'bkp-wait-restore' => 'Please wait for the restore to complete...', 'bkp-success-restore' => 'Restore successfully completed.', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/en_gb.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/en_gb.dict.itop-backup.php index d55fa56f2..54c8e4aa1 100644 --- a/datamodels/2.x/itop-backup/dictionaries/en_gb.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/en_gb.dict.itop-backup.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'bkp-backup-running' => 'A backup is running. Please wait...', 'bkp-restore-running' => 'A restore is running. Please wait...', @@ -58,4 +59,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'bkp-wait-backup' => 'Please wait for the backup to complete...', 'bkp-wait-restore' => 'Please wait for the restore to complete...', 'bkp-success-restore' => 'Restore successfully completed.', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/es_cr.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/es_cr.dict.itop-backup.php index 39264ade5..1d4a1d511 100644 --- a/datamodels/2.x/itop-backup/dictionaries/es_cr.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/es_cr.dict.itop-backup.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'bkp-backup-running' => 'Un respaldo está en ejecuión. Por favor espere...', 'bkp-restore-running' => 'Una restauración está en ejecución. Por favor espere...', 'Menu:BackupStatus' => 'Respaldos programados', @@ -42,4 +43,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'bkp-wait-backup' => 'Por favor espera a que se complete el respaldo...', 'bkp-wait-restore' => 'Por favor espera a que se complete la restauración...', 'bkp-success-restore' => 'Restauración completada exitosamente.', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/fr.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/fr.dict.itop-backup.php index eafd907d1..2351c1b83 100644 --- a/datamodels/2.x/itop-backup/dictionaries/fr.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/fr.dict.itop-backup.php @@ -1,15 +1,16 @@ 'Une sauvegarde est en cours. Veuillez patienter...', 'bkp-restore-running' => 'Une restauration des données est en cours. Veuillez patienter...', 'Menu:BackupStatus' => 'Sauvegardes', @@ -44,4 +45,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'bkp-wait-backup' => 'Sauvegarde en cours...', 'bkp-wait-restore' => 'Restauration des données en cours...', 'bkp-success-restore' => 'Restauration des données terminée.', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/hu.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/hu.dict.itop-backup.php index 204913831..2462fd87f 100644 --- a/datamodels/2.x/itop-backup/dictionaries/hu.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/hu.dict.itop-backup.php @@ -1,15 +1,16 @@ 'A mentés fut. Kérem várjon...', 'bkp-restore-running' => 'A visszaállítás fut. Kérem várjon...', 'Menu:BackupStatus' => 'Biztonsági mentés', @@ -44,4 +45,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'bkp-wait-backup' => 'Várjon a mentés befejezéséig...', 'bkp-wait-restore' => 'Várjon a visszaállítás befejezéséig...', 'bkp-success-restore' => 'A visszaállítás sikerült.', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/it.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/it.dict.itop-backup.php index 0caba5143..4dbc18575 100644 --- a/datamodels/2.x/itop-backup/dictionaries/it.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/it.dict.itop-backup.php @@ -1,15 +1,16 @@ 'Un backup è in corso. Attendere prego...', 'bkp-restore-running' => 'Un ripristino è in corso. Attendere prego...', 'Menu:BackupStatus' => 'Backup programmati', @@ -44,4 +45,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'bkp-wait-backup' => 'Attendere il completamento del backup...', 'bkp-wait-restore' => 'Attendere il completamento del ripristino...', 'bkp-success-restore' => 'Ripristino completato con successo.', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/ja.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/ja.dict.itop-backup.php index 80fe821e5..ebf8d2d9b 100644 --- a/datamodels/2.x/itop-backup/dictionaries/ja.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/ja.dict.itop-backup.php @@ -1,15 +1,16 @@ 'A backup is running. Please wait...~~', 'bkp-restore-running' => 'A restore is running. Please wait...~~', 'Menu:BackupStatus' => 'Backups~~', @@ -44,4 +45,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'bkp-wait-backup' => 'Please wait for the backup to complete...~~', 'bkp-wait-restore' => 'Please wait for the restore to complete...~~', 'bkp-success-restore' => 'Restore successfully completed.~~', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/nl.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/nl.dict.itop-backup.php index 679a57342..13d0cb64e 100644 --- a/datamodels/2.x/itop-backup/dictionaries/nl.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/nl.dict.itop-backup.php @@ -1,16 +1,17 @@ * @author Jeffrey Bostoen (2018 - 2022) */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'bkp-backup-running' => 'Er wordt een backup gemaakt. Even geduld...', 'bkp-restore-running' => 'Er wordt een herstel uitgevoerd. Even geduld...', 'Menu:BackupStatus' => 'Geplande backups', @@ -45,4 +46,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'bkp-wait-backup' => 'Wacht tot de backup gemaakt is...', 'bkp-wait-restore' => 'Wacht tot de backup hersteld is...', 'bkp-success-restore' => 'Herstel is succesvol voltooid.', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/pl.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/pl.dict.itop-backup.php index 15d89d120..355651020 100644 --- a/datamodels/2.x/itop-backup/dictionaries/pl.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/pl.dict.itop-backup.php @@ -1,15 +1,16 @@ 'Kopia zapasowa jest uruchomiona. Proszę czekać...', 'bkp-restore-running' => 'Trwa przywracanie. Proszę czekać...', 'Menu:BackupStatus' => 'Kopie zapasowe', @@ -44,4 +45,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'bkp-wait-backup' => 'Poczekaj na zakończenie tworzenia kopii zapasowej...', 'bkp-wait-restore' => 'Poczekaj na zakończenie przywracania...', 'bkp-success-restore' => 'Przywracanie zakończone pomyślnie.', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/pt_br.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/pt_br.dict.itop-backup.php index f5c284932..ec485b8ff 100644 --- a/datamodels/2.x/itop-backup/dictionaries/pt_br.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/pt_br.dict.itop-backup.php @@ -1,15 +1,16 @@ 'Um backup está sendo executado. Por favor, espere...', 'bkp-restore-running' => 'Uma restauração está sendo executada. Por favor, espere...', 'Menu:BackupStatus' => 'Backups agendados', @@ -44,4 +45,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'bkp-wait-backup' => 'Por favor, aguarde a conclusão do backup...', 'bkp-wait-restore' => 'Por favor, aguarde a conclusão da restauração...', 'bkp-success-restore' => 'Restauração concluída com sucesso', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/ru.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/ru.dict.itop-backup.php index dc1e09fd5..72ca9d203 100644 --- a/datamodels/2.x/itop-backup/dictionaries/ru.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/ru.dict.itop-backup.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'bkp-backup-running' => 'Выполняется резервное копирование. Пожалуйста, подождите...', 'bkp-restore-running' => 'Выполняется восстановление из резервной копии. Пожалуйста, подождите...', 'Menu:BackupStatus' => 'Резервное копирование', @@ -45,4 +46,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'bkp-wait-backup' => 'Пожалуйста, дождитесь завершения резервного копирования...', 'bkp-wait-restore' => 'Пожалуйста, дождитесь завершения восстановления...', 'bkp-success-restore' => 'Восстановление успешно завершено.', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/sk.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/sk.dict.itop-backup.php index 897753655..416736cf6 100644 --- a/datamodels/2.x/itop-backup/dictionaries/sk.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/sk.dict.itop-backup.php @@ -1,15 +1,16 @@ 'A backup is running. Please wait...~~', 'bkp-restore-running' => 'A restore is running. Please wait...~~', 'Menu:BackupStatus' => 'Backups~~', @@ -44,4 +45,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'bkp-wait-backup' => 'Please wait for the backup to complete...~~', 'bkp-wait-restore' => 'Please wait for the restore to complete...~~', 'bkp-success-restore' => 'Restore successfully completed.~~', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/tr.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/tr.dict.itop-backup.php index 563cf3ccb..1b1a064c3 100644 --- a/datamodels/2.x/itop-backup/dictionaries/tr.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/tr.dict.itop-backup.php @@ -1,15 +1,16 @@ 'A backup is running. Please wait...~~', 'bkp-restore-running' => 'A restore is running. Please wait...~~', 'Menu:BackupStatus' => 'Backups~~', @@ -44,4 +45,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'bkp-wait-backup' => 'Please wait for the backup to complete...~~', 'bkp-wait-restore' => 'Please wait for the restore to complete...~~', 'bkp-success-restore' => 'Restore successfully completed.~~', -)); +]); diff --git a/datamodels/2.x/itop-backup/dictionaries/zh_cn.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/zh_cn.dict.itop-backup.php index 5b28812ee..8837151e6 100644 --- a/datamodels/2.x/itop-backup/dictionaries/zh_cn.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/zh_cn.dict.itop-backup.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'bkp-backup-running' => '备份正在进行, 请稍候...', 'bkp-restore-running' => '还原正在进行, 请稍等...', 'Menu:BackupStatus' => '定时备份', @@ -55,4 +56,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'bkp-wait-backup' => '请等待备份完成...', 'bkp-wait-restore' => '请等待还原完成...', 'bkp-success-restore' => '还原成功.', -)); +]); diff --git a/datamodels/2.x/itop-backup/main.itop-backup.php b/datamodels/2.x/itop-backup/main.itop-backup.php index 37db9cbd9..daa3d25cc 100644 --- a/datamodels/2.x/itop-backup/main.itop-backup.php +++ b/datamodels/2.x/itop-backup/main.itop-backup.php @@ -1,4 +1,5 @@ IsLocked()) - { + if ($oRestoreMutex->IsLocked()) { IssueLog::Info(__class__.'::'.__function__.' A user is trying to use iTop while a restore is running. The requested page is in read-only mode.'); MetaModel::GetConfig()->Set('access_mode', ACCESS_READONLY, 'itop-backup'); MetaModel::GetConfig()->Set('access_message', ' - '.dict::S('bkp-restore-running'), 'itop-backup'); } - } - catch(Exception $e) - { + } catch (Exception $e) { IssueLog::Error(__class__.'::'.__function__.' Failed to check if a backup/restore is running: '.$e->getMessage()); } } @@ -65,22 +60,20 @@ class DBBackupScheduled extends DBBackup */ public function ListFiles($sBackupDir) { - $aFiles = array(); - $aTimes = array(); + $aFiles = []; + $aTimes = []; // Legacy format -limited to 4 Gb - foreach(glob($sBackupDir.'*.zip') as $sFilePath) - { + foreach (glob($sBackupDir.'*.zip') as $sFilePath) { $aFiles[] = $sFilePath; $aTimes[] = filemtime($sFilePath); // unix time } // Modern format - foreach(glob($sBackupDir.'*.tar.gz') as $sFilePath) - { + foreach (glob($sBackupDir.'*.tar.gz') as $sFilePath) { $aFiles[] = $sFilePath; $aTimes[] = filemtime($sFilePath); // unix time } array_multisort($aTimes, $aFiles); - + return $aFiles; } } @@ -107,20 +100,14 @@ class BackupExec extends AbstractWeeklyScheduledProcess */ public function __construct($sBackupDir = null, $iRetentionCount = null) { - if (is_null($sBackupDir)) - { + if (is_null($sBackupDir)) { $this->sBackupDir = APPROOT.'data/backups/auto/'; - } - else - { + } else { $this->sBackupDir = $sBackupDir; } - if (is_null($iRetentionCount)) - { + if (is_null($iRetentionCount)) { $this->iRetentionCount = MetaModel::GetConfig()->GetModuleSetting($this->GetModuleName(), 'retention_count', 5); - } - else - { + } else { $this->iRetentionCount = $iRetentionCount; } } @@ -135,53 +122,43 @@ class BackupExec extends AbstractWeeklyScheduledProcess $oMutex = new iTopMutex('backup.'.utils::GetCurrentEnvironment()); $oMutex->Lock(); - try - { + try { // Make sure the target directory exists SetupUtils::builddir($this->sBackupDir); - + $oBackup = new DBBackupScheduled(); // Eliminate files exceeding the retention setting // - if ($this->iRetentionCount > 0) - { + if ($this->iRetentionCount > 0) { $aFiles = $oBackup->ListFiles($this->sBackupDir); - while (count($aFiles) >= $this->iRetentionCount) - { + while (count($aFiles) >= $this->iRetentionCount) { $sFileToDelete = array_shift($aFiles); unlink($sFileToDelete); - if (file_exists($sFileToDelete)) - { + if (file_exists($sFileToDelete)) { // Ok, do not loop indefinitely on this break; } } } - + // Do execute the backup // $oBackup->SetMySQLBinDir(MetaModel::GetConfig()->GetModuleSetting($this->GetModuleName(), 'mysql_bindir', '')); $sBackupFileFormat = MetaModel::GetConfig()->GetModuleSetting($this->GetModuleName(), 'file_name_format', '__DB__-%Y-%m-%d_%H_%M'); $sName = $oBackup->MakeName($sBackupFileFormat); - if ($sName == '') - { + if ($sName == '') { $sName = $oBackup->MakeName(BACKUP_DEFAULT_FORMAT); } $sBackupFile = $this->sBackupDir.$sName; $sSourceConfigFile = APPCONF.utils::GetCurrentEnvironment().'/'.ITOP_CONFIG_FILE; - try - { + try { $oBackup->CreateCompressedBackup($sBackupFile, $sSourceConfigFile); - } - catch (BackupException $e) - { + } catch (BackupException $e) { throw new ProcessFatalException($e->getMessage()); } - } - catch (Exception $e) - { + } catch (Exception $e) { $oMutex->Unlock(); throw $e; } diff --git a/datamodels/2.x/itop-backup/module.itop-backup.php b/datamodels/2.x/itop-backup/module.itop-backup.php index 1f8cf7c0d..239156e83 100644 --- a/datamodels/2.x/itop-backup/module.itop-backup.php +++ b/datamodels/2.x/itop-backup/module.itop-backup.php @@ -1,10 +1,9 @@ 'Backup utilities', @@ -12,31 +11,31 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - ), + 'dependencies' => [ + ], 'mandatory' => true, 'visible' => false, // Components // - 'datamodel' => array( + 'datamodel' => [ 'main.itop-backup.php', - ), - 'webservice' => array( + ], + 'webservice' => [ //'webservices.itop-backup.php', - ), - 'dictionary' => array( + ], + 'dictionary' => [ 'en.dict.itop-backup.php', 'fr.dict.itop-backup.php', //'de.dict.itop-backup.php', - ), - 'data.struct' => array( + ], + 'data.struct' => [ //'data.struct.itop-backup.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.itop-backup.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -44,14 +43,14 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( + 'settings' => [ 'mysql_bindir' => '', 'week_days' => 'monday, tuesday, wednesday, thursday, friday', 'time' => '23:30', //'file_name_format' => '__DB__-%Y-%m-%d_%H_%M', - 'retention_count' => 5, + 'retention_count' => 5, 'enabled' => true, 'itop_backup_incident' => '', - ), - ) + ], + ] ); diff --git a/datamodels/2.x/itop-backup/restore.php b/datamodels/2.x/itop-backup/restore.php index 9b00e2e4f..395f1c15c 100644 --- a/datamodels/2.x/itop-backup/restore.php +++ b/datamodels/2.x/itop-backup/restore.php @@ -1,4 +1,5 @@ p('Restore an iTop from a backup file'); $oP->p('Parameters:'); - if (utils::IsModeCLI()) - { + if (utils::IsModeCLI()) { $oP->p('auth_user: login, must be administrator'); $oP->p('auth_pwd: ...'); } $oP->p('backup_file [optional]: name of the file to store the backup into. Follows the PHP strftime() (https://www.php.net/manual/fr/function.strftime.php) format spec. The following placeholders are available: __HOST__, __DB__, __SUBNAME__'); $oP->p('mysql_bindir [optional]: specify the path for mysql executable'); - if (utils::IsModeCLI()) - { + if (utils::IsModeCLI()) { $oP->p('Example: php -q restore.php --auth_user=admin --auth_pwd=myPassw0rd --backup_file=/tmp/backup.zip'); $oP->p('Known limitation: the current directory must be the directory of backup.php'); - } - else - { + } else { $oP->p('Example: .../restore.php?backup_file=/tmp/backup.zip'); } } -function GetOperationName() { +function GetOperationName() +{ return "iTop - iTop Restore"; } @@ -94,39 +88,32 @@ function GetOperationName() { * @throws \DictExceptionUnknownLanguage * @throws \OQLException */ -function ExecuteMainOperation($oP){ - if (utils::IsModeCLI()) - { +function ExecuteMainOperation($oP) +{ + if (utils::IsModeCLI()) { $oP->p(date('Y-m-d H:i:s')." - running restore utility"); $sAuthUser = ReadMandatoryParam($oP, 'auth_user'); $sAuthPwd = ReadMandatoryParam($oP, 'auth_pwd'); $sBackupFile = ReadMandatoryParam($oP, 'backup_file'); - if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) - { + if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) { UserRights::Login($sAuthUser); // Login & set the user's language - } - else - { + } else { ExitError($oP, "Access restricted or wrong credentials ('$sAuthUser')"); } - if (!is_file($sBackupFile) || !is_readable($sBackupFile)){ + if (!is_file($sBackupFile) || !is_readable($sBackupFile)) { ExitError($oP, "Cannot access backup file ('$sBackupFile')"); } - } - else - { + } else { require_once(APPROOT.'application/loginwebpage.class.inc.php'); LoginWebPage::DoLogin(); // Check user rights and prompt if needed } - if (!UserRights::IsAdministrator()) - { + if (!UserRights::IsAdministrator()) { ExitError($oP, "Access restricted to administrators"); } - if (CheckParam('?') || CheckParam('h') || CheckParam('help')) - { + if (CheckParam('?') || CheckParam('h') || CheckParam('help')) { Usage($oP); $oP->output(); exit; @@ -136,12 +123,9 @@ function ExecuteMainOperation($oP){ $oRestore = new MyCliRestore($oP); $oRestore->SetMySQLBinDir(MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'mysql_bindir', '')); - if (MetaModel::GetConfig()->Get('demo_mode')) - { + if (MetaModel::GetConfig()->Get('demo_mode')) { $oP->p("Sorry, iTop is in demonstration mode: the feature is disabled"); - } - else - { + } else { $sEnvironment = utils::ReadParam('environment', 'production', false, 'raw_data'); $oRestore->RestoreFromCompressedBackup($sBackupFile, $sEnvironment); } diff --git a/datamodels/2.x/itop-backup/status.php b/datamodels/2.x/itop-backup/status.php index 48f2a39e0..5eead230d 100644 --- a/datamodels/2.x/itop-backup/status.php +++ b/datamodels/2.x/itop-backup/status.php @@ -1,4 +1,5 @@ &1"; - $aOutput = array(); + $aOutput = []; $iRetCode = 0; exec($sCommand, $aOutput, $iRetCode); if ($iRetCode == 0) { @@ -175,7 +175,7 @@ try { // Week Days // $sScheduleInfo = empty($sZipNameInfo) ? '' : $sZipNameInfo.'
          '; - $aWeekDayToString = array( + $aWeekDayToString = [ 1 => Dict::S('DayOfWeek-Monday'), 2 => Dict::S('DayOfWeek-Tuesday'), 3 => Dict::S('DayOfWeek-Wednesday'), @@ -183,8 +183,8 @@ try { 5 => Dict::S('DayOfWeek-Friday'), 6 => Dict::S('DayOfWeek-Saturday'), 7 => Dict::S('DayOfWeek-Sunday'), - ); - $aDayLabels = array(); + ]; + $aDayLabels = []; $oBackupExec = new BackupExec(); foreach ($oBackupExec->InterpretWeekDays() as $iDay) { $aDayLabels[] = $aWeekDayToString[$iDay]; @@ -202,11 +202,10 @@ try { ->SetIsCollapsible(false) ); - //--- List of backups // $aFiles = $oBackup->ListFiles($sBackupDirAuto); - $aFilesToDelete = array(); + $aFilesToDelete = []; while (count($aFiles) > $iRetention - 1) { $aFilesToDelete[] = array_shift($aFiles); } @@ -217,10 +216,10 @@ try { } else { $sDisableRestore = ''; } - $sRestore= Dict::S('bkp-button-restore-now'); + $sRestore = Dict::S('bkp-button-restore-now'); //--- 1st table: list the backups made in the background // - $aDetails = array(); + $aDetails = []; $sButtonOnClickJS = ''; foreach ($oBackup->ListFiles($sBackupDirAuto) as $sBackupFile) { $sFileName = basename($sBackupFile); @@ -228,12 +227,14 @@ try { if (MetaModel::GetConfig()->Get('demo_mode')) { $sName = $sFileName; } else { - $sAjax = utils::GetAbsoluteUrlModulePage('itop-backup', 'ajax.backup.php', - array( + $sAjax = utils::GetAbsoluteUrlModulePage( + 'itop-backup', + 'ajax.backup.php', + [ 'operation' => 'download', 'file' => $sFilePath, 'transaction_id' => $sTransactionId, - ) + ] ); $sName = "".$sFileName.''; } @@ -243,21 +244,21 @@ try { $oButton = ButtonUIBlockFactory::MakeNeutral($sRestore); $oButton->SetIsDisabled($oRestoreMutex->IsLocked()); if (in_array($sBackupFile, $aFilesToDelete)) { - $aDetails[] = array( + $aDetails[] = [ 'file' => $sName.' *', 'size' => $sSize, 'actions' => BlockRenderer::RenderBlockTemplates($oButton), - ); + ]; } else { - $aDetails[] = array('file' => $sName, 'size' => $sSize, 'actions' => BlockRenderer::RenderBlockTemplates($oButton)); + $aDetails[] = ['file' => $sName, 'size' => $sSize, 'actions' => BlockRenderer::RenderBlockTemplates($oButton)]; } $sButtonOnClickJS .= '$("#'.$oButton->GetId().'").off("click").on("click", function () {LaunchRestoreNow("'.$sFileEscaped.'", "'.$sConfirmRestore.'");});'; } - $aConfig = array( - 'file' => array('label' => Dict::S('bkp-table-file'), 'description' => Dict::S('bkp-table-file+')), - 'size' => array('label' => Dict::S('bkp-table-size'), 'description' => Dict::S('bkp-table-size+')), - 'actions' => array('label' => Dict::S('bkp-table-actions'), 'description' => Dict::S('bkp-table-actions+')), - ); + $aConfig = [ + 'file' => ['label' => Dict::S('bkp-table-file'), 'description' => Dict::S('bkp-table-file+')], + 'size' => ['label' => Dict::S('bkp-table-size'), 'description' => Dict::S('bkp-table-size+')], + 'actions' => ['label' => Dict::S('bkp-table-actions'), 'description' => Dict::S('bkp-table-actions+')], + ]; $sTableId = 'datatable_background_backups'; $oP->AddUiBlock( GenerateBackupsList( @@ -276,10 +277,9 @@ $('#$sTableId').on('init.dt draw.dt', function(){ JS ); - //--- 2nd table: list the backups made manually // - $aDetails = array(); + $aDetails = []; $sButtonOnClickJS = ''; foreach ($oBackup->ListFiles($sBackupDirManual) as $sBackupFile) { $sFileName = basename($sBackupFile); @@ -287,12 +287,14 @@ JS if (MetaModel::GetConfig()->Get('demo_mode')) { $sName = $sFileName; } else { - $sAjax = utils::GetAbsoluteUrlModulePage('itop-backup', 'ajax.backup.php', - array( + $sAjax = utils::GetAbsoluteUrlModulePage( + 'itop-backup', + 'ajax.backup.php', + [ 'operation' => 'download', 'file' => $sFilePath, 'transaction_id' => $sTransactionId, - ) + ] ); $sName = "".$sFileName.''; } @@ -301,14 +303,14 @@ JS $sFileEscaped = addslashes($sFilePath); $oButton = ButtonUIBlockFactory::MakeNeutral("$sRestore"); $oButton->SetIsDisabled($oRestoreMutex->IsLocked()); - $aDetails[] = array('file' => $sName, 'size' => $sSize, 'actions' => BlockRenderer::RenderBlockTemplates($oButton)); + $aDetails[] = ['file' => $sName, 'size' => $sSize, 'actions' => BlockRenderer::RenderBlockTemplates($oButton)]; $sButtonOnClickJS .= '$("#'.$oButton->GetId().'").off("click").on("click", function () {LaunchRestoreNow("'.$sFileEscaped.'", "'.$sConfirmRestore.'");});'; } - $aConfig = array( - 'file' => array('label' => Dict::S('bkp-table-file'), 'description' => Dict::S('bkp-table-file+')), - 'size' => array('label' => Dict::S('bkp-table-size'), 'description' => Dict::S('bkp-table-size+')), - 'actions' => array('label' => Dict::S('bkp-table-actions'), 'description' => Dict::S('bkp-table-actions+')), - ); + $aConfig = [ + 'file' => ['label' => Dict::S('bkp-table-file'), 'description' => Dict::S('bkp-table-file+')], + 'size' => ['label' => Dict::S('bkp-table-size'), 'description' => Dict::S('bkp-table-size+')], + 'actions' => ['label' => Dict::S('bkp-table-actions'), 'description' => Dict::S('bkp-table-actions+')], + ]; $sTableId = 'datatable_manual_backups'; $oP->AddUiBlock( GenerateBackupsList( @@ -327,14 +329,12 @@ $('#$sTableId').on('init.dt draw.dt', function(){ JS ); - //--- Backup now $oBlockForBackupNow = new UIContentBlock(); $oBlockForBackupNow->AddSubBlock(TitleUIBlockFactory::MakeNeutral(Dict::S('bkp-button-backup-now'), 2)); $oP->AddUiBlock($oBlockForBackupNow); - // Ongoing operation ? // $oBackupMutex = new iTopMutex('backup.'.utils::GetCurrentEnvironment()); @@ -358,15 +358,16 @@ JS // /** @var \BackgroundTask $oTask */ $oTask = MetaModel::GetObjectByName(BackgroundTask::class, BackupExec::class, false); - if ($oTask) - { + if ($oTask) { $oTimezone = new DateTimeZone(MetaModel::GetConfig()->Get('timezone')); $oNext = new DateTime($oTask->Get('next_run_date'), $oTimezone); - $sNextOccurrence = Dict::Format('bkp-next-backup', $aWeekDayToString[$oNext->Format('N')], $oNext->Format('Y-m-d'), - $oNext->Format('H:i')); - } - else - { + $sNextOccurrence = Dict::Format( + 'bkp-next-backup', + $aWeekDayToString[$oNext->Format('N')], + $oNext->Format('Y-m-d'), + $oNext->Format('H:i') + ); + } else { $sNextOccurrence = Dict::S('bkp-next-backup-unknown'); } $oBlockForBackupNow->AddSubBlock( @@ -377,7 +378,7 @@ JS // Do backup now // - $sBackUpNow= Dict::S('bkp-button-backup-now'); + $sBackUpNow = Dict::S('bkp-button-backup-now'); $oLaunchBackupButton = ButtonUIBlockFactory::MakeForPrimaryAction($sBackUpNow); $oLaunchBackupButton->SetOnClickJsCode('LaunchBackupNow();'); $oBlockForBackupNow->AddSubBlock($oLaunchBackupButton); @@ -400,7 +401,6 @@ JS $sPleaseWaitRestore = addslashes(Dict::S('bkp-wait-restore')); $sRestoreDone = addslashes(Dict::S('bkp-success-restore')); - $sMySQLBinDir = addslashes(MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'mysql_bindir', '')); $sDBHost = addslashes(MetaModel::GetConfig()->Get('db_host')); $sDBUser = addslashes(MetaModel::GetConfig()->Get('db_user')); @@ -495,13 +495,10 @@ function LaunchRestoreNow(sBackupFile, sConfirmationMessage) JS ); - if (MetaModel::GetConfig()->Get('demo_mode')) - { + if (MetaModel::GetConfig()->Get('demo_mode')) { $oP->add_ready_script("$('button').prop('disabled', true).attr('title', 'Disabled in demonstration mode')"); } -} -catch(Exception $e) -{ +} catch (Exception $e) { $oP = new iTopWebPage(Dict::S('bkp-status-title')); $oP->p(''.$e->getMessage().''); } diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/cs.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/cs.dict.itop-bridge-cmdb-services.php index 3e5daacb9..f90b23f16 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/cs.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/cs.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkFunctionalCIToProviderContract' => 'Spojení (Funkční konfigurační položka / Smlouva s poskytovatelem)', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -22,13 +23,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Název konfigurační položky', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkFunctionalCIToService' => 'Spojení (Funkční konfigurační položka / Služba)', 'Class:lnkFunctionalCIToService+' => '', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s~~', @@ -40,26 +41,26 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'Název konfigurační položky', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Smlouvy s poskytovateli', 'Class:FunctionalCI/Attribute:providercontracts_list+' => '', 'Class:FunctionalCI/Attribute:services_list' => 'Služby', 'Class:FunctionalCI/Attribute:services_list+' => '', -)); +]); // // Class: Document // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Document/Attribute:contracts_list' => 'Smlouvy', 'Class:Document/Attribute:contracts_list+' => 'Všechny smlouvy spojené s tímto dokumentem', 'Class:Document/Attribute:services_list' => 'Služby', 'Class:Document/Attribute:services_list+' => 'Všechny služby spojené s tímto dokumentem', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/da.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/da.dict.itop-bridge-cmdb-services.php index 8d439efb7..d06a49259 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/da.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/da.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkFunctionalCIToProviderContract' => 'Sammenhæng FunctionalCI/Leverandør Kontrakt', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -22,13 +23,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI navn', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkFunctionalCIToService' => 'Sammenhæng FunctionalCI/Ydelse', 'Class:lnkFunctionalCIToService+' => '', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s~~', @@ -40,26 +41,26 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'CI navn', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Leverandør kontrakter', 'Class:FunctionalCI/Attribute:providercontracts_list+' => '', 'Class:FunctionalCI/Attribute:services_list' => 'Ydelser', 'Class:FunctionalCI/Attribute:services_list+' => '', -)); +]); // // Class: Document // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Document/Attribute:contracts_list' => 'Kontrakter', 'Class:Document/Attribute:contracts_list+' => 'All the contracts linked to this document~~', 'Class:Document/Attribute:services_list' => 'Ydelser', 'Class:Document/Attribute:services_list+' => 'All the services linked to this document~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/de.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/de.dict.itop-bridge-cmdb-services.php index 773c808cf..89130c183 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/de.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/de.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkFunctionalCIToProviderContract' => 'Verknüpfung FunctionalCI/Provider-Vertrag', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -22,13 +23,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI-Name', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkFunctionalCIToService' => 'Verknüpfung FunctionalCI/Service', 'Class:lnkFunctionalCIToService+' => '', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s', @@ -40,26 +41,26 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'CI-Name', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Provider-Verträge', 'Class:FunctionalCI/Attribute:providercontracts_list+' => '', 'Class:FunctionalCI/Attribute:services_list' => 'Services', 'Class:FunctionalCI/Attribute:services_list+' => '', -)); +]); // // Class: Document // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Document/Attribute:contracts_list' => 'Verträge', 'Class:Document/Attribute:contracts_list+' => 'Alle mit diesem Dokument verknüpften Verträge', 'Class:Document/Attribute:services_list' => 'Services', 'Class:Document/Attribute:services_list+' => 'Alle mit diesem Dokument verknüpften Services', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/en.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/en.dict.itop-bridge-cmdb-services.php index 9edcf479e..b0dae014c 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/en.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/en.dict.itop-bridge-cmdb-services.php @@ -1,4 +1,5 @@ 'Link FunctionalCI / ProviderContract', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -44,13 +45,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI Name', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkFunctionalCIToService' => 'Link FunctionalCI / Service', 'Class:lnkFunctionalCIToService+' => '', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s', @@ -62,26 +63,26 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'CI Name', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Provider contracts', 'Class:FunctionalCI/Attribute:providercontracts_list+' => 'All the provider contracts for this configuration item', 'Class:FunctionalCI/Attribute:services_list' => 'Services', 'Class:FunctionalCI/Attribute:services_list+' => 'All the services impacted by this configuration item', -)); +]); // // Class: Document // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Document/Attribute:contracts_list' => 'Contracts', 'Class:Document/Attribute:contracts_list+' => 'All the contracts linked to this document', 'Class:Document/Attribute:services_list' => 'Services', 'Class:Document/Attribute:services_list+' => 'All the services linked to this document', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/en_gb.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/en_gb.dict.itop-bridge-cmdb-services.php index d07dc2c98..18f5b02c6 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/en_gb.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/en_gb.dict.itop-bridge-cmdb-services.php @@ -1,4 +1,5 @@ 'Link FunctionalCI / ProviderContract', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -29,13 +30,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI Name', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkFunctionalCIToService' => 'Link FunctionalCI / Service', 'Class:lnkFunctionalCIToService+' => '', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s', @@ -47,26 +48,26 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'CI Name', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Provider contracts', 'Class:FunctionalCI/Attribute:providercontracts_list+' => 'All the provider contracts for this configuration item', 'Class:FunctionalCI/Attribute:services_list' => 'Services', 'Class:FunctionalCI/Attribute:services_list+' => 'All the services impacted by this configuration item', -)); +]); // // Class: Document // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Document/Attribute:contracts_list' => 'Contracts', 'Class:Document/Attribute:contracts_list+' => 'All the contracts linked to this document', 'Class:Document/Attribute:services_list' => 'Services', 'Class:Document/Attribute:services_list+' => 'All the services linked to this document', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/es_cr.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/es_cr.dict.itop-bridge-cmdb-services.php index e3058c5b0..ceae7cea0 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/es_cr.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/es_cr.dict.itop-bridge-cmdb-services.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkFunctionalCIToProviderContract' => 'Relación EC Funcional y Contrato con Proveedor', 'Class:lnkFunctionalCIToProviderContract+' => 'Relación EC Funcional y Contrato con Proveedor', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -19,13 +20,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => 'Elemento de Configuración', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Elemento de Configuración', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => 'Elemento de Configuración', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkFunctionalCIToService' => 'Relación EC Funcional y Servicio', 'Class:lnkFunctionalCIToService+' => 'Relación EC Funcional y Servicio', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s', @@ -37,26 +38,26 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => 'Elemento de Configuración', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'EC', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => 'Elemento de Configuración', -)); +]); // // Class: FunctionalCI // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Contratos', 'Class:FunctionalCI/Attribute:providercontracts_list+' => 'Contratos', 'Class:FunctionalCI/Attribute:services_list' => 'Servicios', 'Class:FunctionalCI/Attribute:services_list+' => 'Servicios', -)); +]); // // Class: Document // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Document/Attribute:contracts_list' => 'Contratos', 'Class:Document/Attribute:contracts_list+' => 'Contratos Referenciados con este Documento', 'Class:Document/Attribute:services_list' => 'Servicios', 'Class:Document/Attribute:services_list+' => 'Servicios Referenciados con este Documento', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/fr.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/fr.dict.itop-bridge-cmdb-services.php index 8be11b0c0..165798d72 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/fr.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/fr.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkFunctionalCIToProviderContract' => 'Lien CI / Contrat fournisseur', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -22,13 +23,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Nom CI', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkFunctionalCIToService' => 'Lien CI / Service', 'Class:lnkFunctionalCIToService+' => '', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s', @@ -40,26 +41,26 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'Nom CI', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Contrats fournisseur', 'Class:FunctionalCI/Attribute:providercontracts_list+' => '', 'Class:FunctionalCI/Attribute:services_list' => 'Services', 'Class:FunctionalCI/Attribute:services_list+' => '', -)); +]); // // Class: Document // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Document/Attribute:contracts_list' => 'Contrats', 'Class:Document/Attribute:contracts_list+' => 'Tous les contrats liés à ce document', 'Class:Document/Attribute:services_list' => 'Services', 'Class:Document/Attribute:services_list+' => 'Tous les services liés à ce document', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/hu.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/hu.dict.itop-bridge-cmdb-services.php index 2d3a63a5a..e5c1c27fe 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/hu.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/hu.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkFunctionalCIToProviderContract' => 'Funkcionális CI / Szolgáltatói szerződés', 'Class:lnkFunctionalCIToProviderContract+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -22,13 +23,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI név', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkFunctionalCIToService' => 'Funkcionális CI / Szolgáltatás', 'Class:lnkFunctionalCIToService+' => '~~', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s~~', @@ -40,26 +41,26 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'CI név', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: FunctionalCI // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Szolgáltatói szerződések', 'Class:FunctionalCI/Attribute:providercontracts_list+' => 'Ehhez a konfigurációs elemhez tartozó szolgáltatói szerződések', 'Class:FunctionalCI/Attribute:services_list' => 'Szolgáltatások', 'Class:FunctionalCI/Attribute:services_list+' => 'Szolgáltatások amelyek hatással vannak erre a konfigurációs elemre', -)); +]); // // Class: Document // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Document/Attribute:contracts_list' => 'Szerződések', 'Class:Document/Attribute:contracts_list+' => 'Ehhez a dokumentumhoz kapcsolódó szerződések', 'Class:Document/Attribute:services_list' => 'Szolgáltatások', 'Class:Document/Attribute:services_list+' => 'Ehhez a dokumentumhoz kapcsolódó szolgáltatások', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/it.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/it.dict.itop-bridge-cmdb-services.php index bfe5a99ca..1b61e6d31 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/it.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/it.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkFunctionalCIToProviderContract' => 'Link FunctionalCI / ProviderContract', 'Class:lnkFunctionalCIToProviderContract+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -22,13 +23,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Nome CI', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkFunctionalCIToService' => 'Link FunctionalCI / Service', 'Class:lnkFunctionalCIToService+' => '~~', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s', @@ -40,26 +41,26 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'Nome CI ', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: FunctionalCI // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Contratti fornitori', 'Class:FunctionalCI/Attribute:providercontracts_list+' => 'Tutti i contratti del fornitore per questo elemento di configurazione', 'Class:FunctionalCI/Attribute:services_list' => 'Servizi', 'Class:FunctionalCI/Attribute:services_list+' => 'Tutti i servizi impattati da questo elemento di configurazione', -)); +]); // // Class: Document // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Document/Attribute:contracts_list' => 'Contratti', 'Class:Document/Attribute:contracts_list+' => 'Tutti i contratti collegati a questo documento', 'Class:Document/Attribute:services_list' => 'Servizi', 'Class:Document/Attribute:services_list+' => 'Tutti i servizi collegati a questo documento', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/ja.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/ja.dict.itop-bridge-cmdb-services.php index a1f31ac45..acf893e39 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/ja.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/ja.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkFunctionalCIToProviderContract' => 'リンク 機能的CI/プロバイダー契約', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -22,13 +23,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI名', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkFunctionalCIToService' => 'リンク 機能的CI/サービス', 'Class:lnkFunctionalCIToService+' => '', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s~~', @@ -40,26 +41,26 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'CI名', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'プロバイダー契約', 'Class:FunctionalCI/Attribute:providercontracts_list+' => '', 'Class:FunctionalCI/Attribute:services_list' => 'サービス', 'Class:FunctionalCI/Attribute:services_list+' => '', -)); +]); // // Class: Document // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Document/Attribute:contracts_list' => '契約', 'Class:Document/Attribute:contracts_list+' => 'All the contracts linked to this document~~', 'Class:Document/Attribute:services_list' => 'サービス', 'Class:Document/Attribute:services_list+' => 'All the services linked to this document~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/nl.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/nl.dict.itop-bridge-cmdb-services.php index fc450d90b..3625d88f7 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/nl.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/nl.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkFunctionalCIToProviderContract' => 'Link Functioneel CI / Leverancierscontract', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -22,13 +23,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Naam CI', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkFunctionalCIToService' => 'Link Functioneel CI / Service', 'Class:lnkFunctionalCIToService+' => '', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s', @@ -40,26 +41,26 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'Naam CI', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Leverancierscontracten', 'Class:FunctionalCI/Attribute:providercontracts_list+' => 'Alle leverancierscontracten voor dit configuratie-item', 'Class:FunctionalCI/Attribute:services_list' => 'Services', 'Class:FunctionalCI/Attribute:services_list+' => 'Alle services die impact hebben op dit configuratie-item', -)); +]); // // Class: Document // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Document/Attribute:contracts_list' => 'Contracten', 'Class:Document/Attribute:contracts_list+' => 'Alle contracten gerelateerd aan dit document', 'Class:Document/Attribute:services_list' => 'Services', 'Class:Document/Attribute:services_list+' => 'Alle services gerelateerd aan dit document.', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/pl.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/pl.dict.itop-bridge-cmdb-services.php index e173e5c80..4b86574e8 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/pl.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/pl.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkFunctionalCIToProviderContract' => 'Połączenie Konfiguracja / Umowa z dostawcą', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -22,13 +23,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Nazwa konfiguracji', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkFunctionalCIToService' => 'Połączenie Konfiguracja / Usługa', 'Class:lnkFunctionalCIToService+' => '', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s', @@ -40,26 +41,26 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'Nazwa konfiguracji', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Umowy z dostawcami', 'Class:FunctionalCI/Attribute:providercontracts_list+' => 'Wszystkie umowy dostawcy dla tej konfiguracji', 'Class:FunctionalCI/Attribute:services_list' => 'Usługi', 'Class:FunctionalCI/Attribute:services_list+' => 'Wszystkie usługi, na które ma wpływ tą konfigurację', -)); +]); // // Class: Document // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Document/Attribute:contracts_list' => 'Umowy', 'Class:Document/Attribute:contracts_list+' => 'Wszystkie umowy powiązane z tym dokumentem', 'Class:Document/Attribute:services_list' => 'Usługi', 'Class:Document/Attribute:services_list+' => 'Wszystkie usługi powiązane z tym dokumentem', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/pt_br.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/pt_br.dict.itop-bridge-cmdb-services.php index 28b30d4df..00d0d11c9 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/pt_br.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/pt_br.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkFunctionalCIToProviderContract' => 'Link IC / Contrato de provedor', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -22,13 +23,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Nome do IC', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkFunctionalCIToService' => 'Link IC / Serviço', 'Class:lnkFunctionalCIToService+' => '', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s~~', @@ -40,26 +41,26 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'Nome do IC', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Contrato de provedor', 'Class:FunctionalCI/Attribute:providercontracts_list+' => 'Todos os contratos para esse item de configuração', 'Class:FunctionalCI/Attribute:services_list' => 'Serviços', 'Class:FunctionalCI/Attribute:services_list+' => 'Todos os serviços impactados por esse item de configuração', -)); +]); // // Class: Document // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Document/Attribute:contracts_list' => 'Contratos', 'Class:Document/Attribute:contracts_list+' => 'Todos os contratos associados a este documento', 'Class:Document/Attribute:services_list' => 'Services', 'Class:Document/Attribute:services_list+' => 'Todos os serviços associados a este documento', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/ru.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/ru.dict.itop-bridge-cmdb-services.php index 95c650ee8..5acfa0868 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/ru.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/ru.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkFunctionalCIToProviderContract' => 'Связь Функциональная КЕ/Договор с поставщиком', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -22,13 +23,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'КЕ', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkFunctionalCIToService' => 'Связь Функциональная КЕ/Услуга', 'Class:lnkFunctionalCIToService+' => '', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s~~', @@ -40,26 +41,26 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'КЕ', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Договоры', 'Class:FunctionalCI/Attribute:providercontracts_list+' => 'Связанные договоры', 'Class:FunctionalCI/Attribute:services_list' => 'Услуги', 'Class:FunctionalCI/Attribute:services_list+' => 'Связанные услуги', -)); +]); // // Class: Document // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Document/Attribute:contracts_list' => 'Договоры', 'Class:Document/Attribute:contracts_list+' => 'Связанные договоры', 'Class:Document/Attribute:services_list' => 'Услуги', 'Class:Document/Attribute:services_list+' => 'Связанные услуги', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/sk.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/sk.dict.itop-bridge-cmdb-services.php index 0e6a9aaf8..c6d2b1a6f 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/sk.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/sk.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkFunctionalCIToProviderContract' => 'väzba - Komponent / Poskytovateľská zmluva', 'Class:lnkFunctionalCIToProviderContract+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -22,13 +23,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Názov CI', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkFunctionalCIToService' => 'väzba - Komponent / Služba', 'Class:lnkFunctionalCIToService+' => '~~', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s~~', @@ -40,26 +41,26 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'Názov CI', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: FunctionalCI // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Poskytovateľské zmluvy', 'Class:FunctionalCI/Attribute:providercontracts_list+' => 'All the provider contracts for this configuration item~~', 'Class:FunctionalCI/Attribute:services_list' => 'Služby', 'Class:FunctionalCI/Attribute:services_list+' => 'All the services impacted by this configuration item~~', -)); +]); // // Class: Document // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Document/Attribute:contracts_list' => 'Zmluvy', 'Class:Document/Attribute:contracts_list+' => 'All the contracts linked to this document~~', 'Class:Document/Attribute:services_list' => 'Služby', 'Class:Document/Attribute:services_list+' => 'All the services linked to this document~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/tr.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/tr.dict.itop-bridge-cmdb-services.php index 84f84bd91..22f698a0f 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/tr.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/tr.dict.itop-bridge-cmdb-services.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkFunctionalCIToProviderContract' => 'İşlevsel CI / Sağlayıcı Sözleşmesi bağla', 'Class:lnkFunctionalCIToProviderContract+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -22,13 +23,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI Adı', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkFunctionalCIToService' => 'İşlevsel CI / servis bağla', 'Class:lnkFunctionalCIToService+' => '~~', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s~~', @@ -40,26 +41,26 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => 'CI Adı', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: FunctionalCI // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => 'Tedarikçi Sözleşmeleri', 'Class:FunctionalCI/Attribute:providercontracts_list+' => 'Bu yapılandırma öğesi için tüm tedarikçi sözleşmeleri', 'Class:FunctionalCI/Attribute:services_list' => 'Hizmetler', 'Class:FunctionalCI/Attribute:services_list+' => 'Bu yapılandırma öğesinden etkilenen tüm hizmetler', -)); +]); // // Class: Document // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Document/Attribute:contracts_list' => 'Contracts~~', 'Class:Document/Attribute:contracts_list+' => 'All the contracts linked to this document~~', 'Class:Document/Attribute:services_list' => 'Services~~', 'Class:Document/Attribute:services_list+' => 'All the services linked to this document~~', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/zh_cn.dict.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/zh_cn.dict.itop-bridge-cmdb-services.php index e901cc002..7f04afd1a 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/zh_cn.dict.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/dictionaries/zh_cn.dict.itop-bridge-cmdb-services.php @@ -1,4 +1,5 @@ '关联功能配置项/供应商合同', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -42,13 +43,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => '配置项名称', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkFunctionalCIToService // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkFunctionalCIToService' => '关联 功能配置项/服务', 'Class:lnkFunctionalCIToService+' => '', 'Class:lnkFunctionalCIToService/Name' => '%1$s / %2$s~~', @@ -60,26 +61,26 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkFunctionalCIToService/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name' => '配置项名称', 'Class:lnkFunctionalCIToService/Attribute:functionalci_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:FunctionalCI/Attribute:providercontracts_list' => '供应商合同', 'Class:FunctionalCI/Attribute:providercontracts_list+' => '此配置项的所有供应商合同', 'Class:FunctionalCI/Attribute:services_list' => '服务', 'Class:FunctionalCI/Attribute:services_list+' => '此配置项影响的所有服务', -)); +]); // // Class: Document // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Document/Attribute:contracts_list' => '合同', 'Class:Document/Attribute:contracts_list+' => '此文档关联的所有合同', 'Class:Document/Attribute:services_list' => '服务', 'Class:Document/Attribute:services_list+' => '此文档关联的所有服务', -)); \ No newline at end of file +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-services/module.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/module.itop-bridge-cmdb-services.php index 8de2a0998..3adbebba9 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/module.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/module.itop-bridge-cmdb-services.php @@ -1,4 +1,5 @@ 'Bridge for CMDB and Services', @@ -14,40 +15,37 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-config-mgmt/2.7.1', 'itop-service-mgmt/2.7.1 || itop-service-mgmt-provider/2.7.1', - ), + ], 'mandatory' => false, 'visible' => false, 'auto_select' => 'SetupInfo::ModuleIsSelected("itop-config-mgmt") && (SetupInfo::ModuleIsSelected("itop-service-mgmt") || SetupInfo::ModuleIsSelected("itop-service-mgmt-provider")) ', // Components // - 'datamodel' => array( - ), - 'webservice' => array( - - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); - - -?> diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/cs.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/cs.dict.itop-bridge-cmdb-ticket.php index c856c4e2d..93b89370e 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/cs.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/cs.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkFunctionalCIToTicket' => 'Spojení (Funkční konfigurační položka / Tiket)', 'Class:lnkFunctionalCIToTicket+' => '', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s~~', @@ -30,12 +31,12 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Přidán manuálně', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Automaticky', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Není zasažen', -)); +]); // // Class: FunctionalCI // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Tikety', 'Class:FunctionalCI/Attribute:tickets_list+' => 'Všechny tikety této konfigurační položky', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/da.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/da.dict.itop-bridge-cmdb-ticket.php index 704a84cd7..fdb57dd55 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/da.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/da.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkFunctionalCIToTicket' => 'Sammenhæng FunctionalCI/Ticket', 'Class:lnkFunctionalCIToTicket+' => '', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s~~', @@ -30,12 +31,12 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Added manually~~', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Computed~~', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Not impacted~~', -)); +]); // // Class: FunctionalCI // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Tickets', 'Class:FunctionalCI/Attribute:tickets_list+' => 'All the tickets for this configuration item~~', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/de.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/de.dict.itop-bridge-cmdb-ticket.php index a522698b0..545fd22aa 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/de.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/de.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkFunctionalCIToTicket' => 'Verknüpfung FunctionalCI/Ticket', 'Class:lnkFunctionalCIToTicket+' => '', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s', @@ -30,12 +31,12 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Manuell hinzugefügt', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Berechnet', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Nicht betroffen', -)); +]); // // Class: FunctionalCI // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Tickets', 'Class:FunctionalCI/Attribute:tickets_list+' => 'Alle Ticket, die mit diesem CI verknüpft sind', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/en.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/en.dict.itop-bridge-cmdb-ticket.php index c69a8ae27..076cd5bf4 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/en.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/en.dict.itop-bridge-cmdb-ticket.php @@ -1,4 +1,5 @@ 'Link FunctionalCI / Ticket', 'Class:lnkFunctionalCIToTicket+' => '', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s', @@ -53,12 +54,12 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Added manually', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Computed', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Not impacted', -)); +]); // // Class: FunctionalCI // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Tickets', 'Class:FunctionalCI/Attribute:tickets_list+' => 'All the tickets for this configuration item', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/en_gb.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/en_gb.dict.itop-bridge-cmdb-ticket.php index fdcef8fba..c08edddbe 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/en_gb.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/en_gb.dict.itop-bridge-cmdb-ticket.php @@ -1,4 +1,5 @@ 'Link FunctionalCI / Ticket', 'Class:lnkFunctionalCIToTicket+' => '', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s', @@ -53,12 +54,12 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Added manually', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Computed', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Not impacted', -)); +]); // // Class: FunctionalCI // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Tickets', 'Class:FunctionalCI/Attribute:tickets_list+' => 'All the tickets for this configuration item', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/es_cr.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/es_cr.dict.itop-bridge-cmdb-ticket.php index 8364e3074..4954fc22d 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/es_cr.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/es_cr.dict.itop-bridge-cmdb-ticket.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkFunctionalCIToTicket' => 'Relación EC Funcional y Ticket', 'Class:lnkFunctionalCIToTicket+' => 'Relación EC Funcional y Ticket', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s', @@ -27,12 +28,12 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Agregado Manualmente', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Calculado', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'No impactado', -)); +]); // // Class: FunctionalCI // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Tickets', 'Class:FunctionalCI/Attribute:tickets_list+' => 'Tickets relacionados con este EC', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/fr.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/fr.dict.itop-bridge-cmdb-ticket.php index 2382d140b..2a6d179a8 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/fr.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/fr.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkFunctionalCIToTicket' => 'Lien CI / Ticket', 'Class:lnkFunctionalCIToTicket+' => '', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s', @@ -30,12 +31,12 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Ajouté manuellement', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Calculé', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Non impacté', -)); +]); // // Class: FunctionalCI // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Tickets', 'Class:FunctionalCI/Attribute:tickets_list+' => 'Tous les tickets de cet élément de configuration', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/hu.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/hu.dict.itop-bridge-cmdb-ticket.php index 6d6a2a40a..db489a74d 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/hu.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/hu.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkFunctionalCIToTicket' => 'Funkcionális CI / Hibajegy', 'Class:lnkFunctionalCIToTicket+' => '~~', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s~~', @@ -30,12 +31,12 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Kézzel hozzáadva', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Számított', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Nincs hatása', -)); +]); // // Class: FunctionalCI // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Hibajegyek', 'Class:FunctionalCI/Attribute:tickets_list+' => 'All the tickets for this configuration item~~', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/it.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/it.dict.itop-bridge-cmdb-ticket.php index c3625b449..160afe8a3 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/it.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/it.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkFunctionalCIToTicket' => 'Link FunctionalCI / Ticket~~', 'Class:lnkFunctionalCIToTicket+' => '~~', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s~~', @@ -30,12 +31,12 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Aggiunto manualmente', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Calcolato', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Non impattato', -)); +]); // // Class: FunctionalCI // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Tickets~~', 'Class:FunctionalCI/Attribute:tickets_list+' => 'Tutti i ticket per questo elemento di configurazione', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/ja.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/ja.dict.itop-bridge-cmdb-ticket.php index 3a4bd19ea..692b081cc 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/ja.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/ja.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkFunctionalCIToTicket' => 'リンク 機能的CI/チケット', 'Class:lnkFunctionalCIToTicket+' => '', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s~~', @@ -30,12 +31,12 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Added manually~~', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Computed~~', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Not impacted~~', -)); +]); // // Class: FunctionalCI // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'チケット', 'Class:FunctionalCI/Attribute:tickets_list+' => 'All the tickets for this configuration item~~', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/nl.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/nl.dict.itop-bridge-cmdb-ticket.php index 79707f254..833c0f395 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/nl.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/nl.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkFunctionalCIToTicket' => 'Link Functioneel CI / Ticket', 'Class:lnkFunctionalCIToTicket+' => '', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s', @@ -30,12 +31,12 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Manueel toegevoegd', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Automatisch afgeleid', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Niet geïmpacteerd', -)); +]); // // Class: FunctionalCI // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Tickets', 'Class:FunctionalCI/Attribute:tickets_list+' => 'Alle tickets voor dit configuratie-item', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/pl.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/pl.dict.itop-bridge-cmdb-ticket.php index a60c65c6c..867797b3b 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/pl.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/pl.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkFunctionalCIToTicket' => 'Połączenie Konfiguracja / Zgłoszenie', 'Class:lnkFunctionalCIToTicket+' => '', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s', @@ -30,12 +31,12 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Dodane ręcznie', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Obliczone', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Nie dotyczy', -)); +]); // // Class: FunctionalCI // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Zgłoszenia', 'Class:FunctionalCI/Attribute:tickets_list+' => 'Wszystkie zgłoszenia dla tej konfiguracji', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/pt_br.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/pt_br.dict.itop-bridge-cmdb-ticket.php index 6fff7ce7c..009071aa1 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/pt_br.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/pt_br.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkFunctionalCIToTicket' => 'Link IC / Solicitação', 'Class:lnkFunctionalCIToTicket+' => '', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s~~', @@ -30,12 +31,12 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Adicionado manualmente', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Computado', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Não impactado', -)); +]); // // Class: FunctionalCI // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Solicitações', 'Class:FunctionalCI/Attribute:tickets_list+' => 'Todos as solicitações para este item de configuração', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/ru.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/ru.dict.itop-bridge-cmdb-ticket.php index a8d95d96d..f137fe68e 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/ru.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/ru.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkFunctionalCIToTicket' => 'Связь Функциональная КЕ/Тикет', 'Class:lnkFunctionalCIToTicket+' => '', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s~~', @@ -30,12 +31,12 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Добавлено вручную', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Вычислено', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Не влияет', -)); +]); // // Class: FunctionalCI // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Тикеты', 'Class:FunctionalCI/Attribute:tickets_list+' => 'Связанные тикеты', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/sk.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/sk.dict.itop-bridge-cmdb-ticket.php index 0f941a8ed..e46a482ef 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/sk.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/sk.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkFunctionalCIToTicket' => 'väzba - Komponent / Ticket', 'Class:lnkFunctionalCIToTicket+' => '~~', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s~~', @@ -30,12 +31,12 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Added manually~~', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Computed~~', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Not impacted~~', -)); +]); // // Class: FunctionalCI // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Tickety', 'Class:FunctionalCI/Attribute:tickets_list+' => 'All the tickets for this configuration item~~', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/tr.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/tr.dict.itop-bridge-cmdb-ticket.php index 6a4c00387..72f8c5743 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/tr.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/tr.dict.itop-bridge-cmdb-ticket.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkFunctionalCIToTicket' => 'İşlevsel CI / Çağrı kaydı bağla', 'Class:lnkFunctionalCIToTicket+' => '~~', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s~~', @@ -30,12 +31,12 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => 'Elle eklendi', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => 'Hesaplandı', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => 'Etkilemedi', -)); +]); // // Class: FunctionalCI // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:FunctionalCI/Attribute:tickets_list' => 'Çağrı Kayıtları', 'Class:FunctionalCI/Attribute:tickets_list+' => 'Bu yapılandırma öğesi için tüm çağrı kayıtları', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/zh_cn.dict.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/zh_cn.dict.itop-bridge-cmdb-ticket.php index 28b79e87d..5ec96a13f 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/zh_cn.dict.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/zh_cn.dict.itop-bridge-cmdb-ticket.php @@ -1,4 +1,5 @@ '关联 功能配置项/工单', 'Class:lnkFunctionalCIToTicket+' => '', 'Class:lnkFunctionalCIToTicket/Name' => '%1$s / %2$s', @@ -50,12 +51,12 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:manual' => '手动添加', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:computed' => '自动添加', 'Class:lnkFunctionalCIToTicket/Attribute:impact_code/Value:not_impacted' => '不通知', -)); +]); // // Class: FunctionalCI // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:FunctionalCI/Attribute:tickets_list' => '工单', 'Class:FunctionalCI/Attribute:tickets_list+' => '此配置项包含的所有工单', -)); +]); diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/module.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/module.itop-bridge-cmdb-ticket.php index 5d7a13453..ca16921a2 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/module.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/module.itop-bridge-cmdb-ticket.php @@ -1,4 +1,5 @@ 'Bridge for CMDB and Ticket', @@ -14,40 +15,37 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-config-mgmt/2.7.1', 'itop-tickets/2.7.0', - ), + ], 'mandatory' => false, 'visible' => false, 'auto_select' => 'SetupInfo::ModuleIsSelected("itop-config-mgmt") && SetupInfo::ModuleIsSelected("itop-tickets") ', // Components // - 'datamodel' => array( - ), - 'webservice' => array( - - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); - - -?> diff --git a/datamodels/2.x/itop-bridge-datacenter-mgmt-services/module.itop-bridge-datacenter-mgmt-services.php b/datamodels/2.x/itop-bridge-datacenter-mgmt-services/module.itop-bridge-datacenter-mgmt-services.php index d4a54883e..91657bdc9 100644 --- a/datamodels/2.x/itop-bridge-datacenter-mgmt-services/module.itop-bridge-datacenter-mgmt-services.php +++ b/datamodels/2.x/itop-bridge-datacenter-mgmt-services/module.itop-bridge-datacenter-mgmt-services.php @@ -1,4 +1,5 @@ 'Bridge for CMDB Virtualization objects and Services', @@ -14,28 +15,28 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-config-mgmt/2.7.1', 'itop-service-mgmt/2.7.1 || itop-service-mgmt-provider/2.7.1', 'itop-datacenter-mgmt/3.1.0', - ), + ], 'mandatory' => false, 'visible' => false, 'auto_select' => 'SetupInfo::ModuleIsSelected("itop-datacenter-mgmt") && (SetupInfo::ModuleIsSelected("itop-service-mgmt") || SetupInfo::ModuleIsSelected("itop-service-mgmt-provider")) ', // Components // - 'datamodel' => array( - ), - 'webservice' => array( + 'datamodel' => [ + ], + 'webservice' => [ - ), - 'data.struct' => array( + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), + ], // Documentation // @@ -44,11 +45,8 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); - - -?> diff --git a/datamodels/2.x/itop-bridge-endusers-devices-services/module.itop-bridge-endusers-devices-services.php b/datamodels/2.x/itop-bridge-endusers-devices-services/module.itop-bridge-endusers-devices-services.php index 6235d7ed8..f4657e159 100644 --- a/datamodels/2.x/itop-bridge-endusers-devices-services/module.itop-bridge-endusers-devices-services.php +++ b/datamodels/2.x/itop-bridge-endusers-devices-services/module.itop-bridge-endusers-devices-services.php @@ -1,4 +1,5 @@ 'Bridge for CMDB endusers objects and Services', @@ -14,29 +15,29 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-config-mgmt/2.7.1', 'itop-service-mgmt/2.7.1 || itop-service-mgmt-provider/2.7.1', 'itop-endusers-devices/3.1.0', - ), + ], 'mandatory' => false, 'visible' => false, 'auto_select' => 'SetupInfo::ModuleIsSelected("itop-endusers-devices") && (SetupInfo::ModuleIsSelected("itop-service-mgmt") || SetupInfo::ModuleIsSelected("itop-service-mgmt-provider")) ', // Components // - 'datamodel' => array( - ), - 'webservice' => array( + 'datamodel' => [ + ], + 'webservice' => [ - ), - 'data.struct' => array( + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), + ], // Documentation // @@ -45,11 +46,8 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); - - -?> diff --git a/datamodels/2.x/itop-bridge-storage-mgmt-services/module.itop-bridge-storage-mgmt-services.php b/datamodels/2.x/itop-bridge-storage-mgmt-services/module.itop-bridge-storage-mgmt-services.php index 6df1eac3f..10a0e5151 100644 --- a/datamodels/2.x/itop-bridge-storage-mgmt-services/module.itop-bridge-storage-mgmt-services.php +++ b/datamodels/2.x/itop-bridge-storage-mgmt-services/module.itop-bridge-storage-mgmt-services.php @@ -1,4 +1,5 @@ 'Bridge for CMDB Virtualization objects and Services', @@ -14,28 +15,28 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-config-mgmt/2.7.1', 'itop-service-mgmt/2.7.1 || itop-service-mgmt-provider/2.7.1', 'itop-storage-mgmt/3.1.0', - ), + ], 'mandatory' => false, 'visible' => false, 'auto_select' => 'SetupInfo::ModuleIsSelected("itop-storage-mgmt") && (SetupInfo::ModuleIsSelected("itop-service-mgmt") || SetupInfo::ModuleIsSelected("itop-service-mgmt-provider")) ', // Components // - 'datamodel' => array( - ), - 'webservice' => array( + 'datamodel' => [ + ], + 'webservice' => [ - ), - 'data.struct' => array( + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), + ], // Documentation // @@ -44,11 +45,8 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); - - -?> diff --git a/datamodels/2.x/itop-bridge-virtualization-mgmt-services/module.itop-bridge-virtualization-mgmt-services.php b/datamodels/2.x/itop-bridge-virtualization-mgmt-services/module.itop-bridge-virtualization-mgmt-services.php index 17a628884..039e40ef2 100644 --- a/datamodels/2.x/itop-bridge-virtualization-mgmt-services/module.itop-bridge-virtualization-mgmt-services.php +++ b/datamodels/2.x/itop-bridge-virtualization-mgmt-services/module.itop-bridge-virtualization-mgmt-services.php @@ -1,4 +1,5 @@ 'Bridge for CMDB Virtualization objects and Services', @@ -14,28 +15,28 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-config-mgmt/2.7.1', 'itop-service-mgmt/2.7.1 || itop-service-mgmt-provider/2.7.1', 'itop-virtualization-mgmt/3.1.0', - ), + ], 'mandatory' => false, 'visible' => false, 'auto_select' => 'SetupInfo::ModuleIsSelected("itop-virtualization-mgmt") && (SetupInfo::ModuleIsSelected("itop-service-mgmt") || SetupInfo::ModuleIsSelected("itop-service-mgmt-provider")) ', // Components // - 'datamodel' => array( - ), - 'webservice' => array( + 'datamodel' => [ + ], + 'webservice' => [ - ), - 'data.struct' => array( + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), + ], // Documentation // @@ -44,11 +45,8 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); - - -?> diff --git a/datamodels/2.x/itop-bridge-virtualization-storage/module.itop-bridge-virtualization-storage.php b/datamodels/2.x/itop-bridge-virtualization-storage/module.itop-bridge-virtualization-storage.php index 37d005a77..8e8449767 100644 --- a/datamodels/2.x/itop-bridge-virtualization-storage/module.itop-bridge-virtualization-storage.php +++ b/datamodels/2.x/itop-bridge-virtualization-storage/module.itop-bridge-virtualization-storage.php @@ -1,10 +1,9 @@ 'Links between virtualization and storage', @@ -12,25 +11,25 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-storage-mgmt/2.2.0', 'itop-virtualization-mgmt/2.2.0', - ), + ], 'mandatory' => false, 'visible' => false, 'auto_select' => 'SetupInfo::ModuleIsSelected("itop-storage-mgmt") && SetupInfo::ModuleIsSelected("itop-virtualization-mgmt")', // Components // - 'datamodel' => array( - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'data.struct' => [ //'data.struct.itop-change-mgmt.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.itop-change-mgmt.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -38,7 +37,7 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/cs.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/cs.dict.itop-change-mgmt-itil.php index d0ffcb93c..9a8032808 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/cs.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/cs.dict.itop-change-mgmt-itil.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:ChangeManagement' => 'Řízení změn', 'Menu:Change:Overview' => 'Přehled', 'Menu:Change:Overview+' => '', @@ -35,7 +36,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Změny v posledních 7 dnech podle stavu', 'Tickets:Related:OpenChanges' => 'Otevřené změny', 'Tickets:Related:RecentChanges' => 'Nedávné změny (72h)', -)); +]); // Dictionnay conventions // Class: @@ -47,12 +48,11 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Change' => 'Změna', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Stav', @@ -149,13 +149,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Ukončit', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:RoutineChange' => 'Standardní změna', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Potvrdit', @@ -180,13 +180,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Ukončit', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ApprovedChange' => 'Schválená změna', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Datum schválení', @@ -215,13 +215,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Ukončit', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:NormalChange' => 'Normální změna', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Datum přijetí', @@ -250,13 +250,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Ukončit', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:EmergencyChange' => 'Naléhavá změna', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Potvrdit', @@ -281,4 +281,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Ukončit', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/da.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/da.dict.itop-change-mgmt-itil.php index 16d7b76f1..8213673c3 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/da.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/da.dict.itop-change-mgmt-itil.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:ChangeManagement' => 'Change Management', 'Menu:Change:Overview' => 'Oversigt', 'Menu:Change:Overview+' => '', @@ -34,7 +35,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Changes de sidste 7 dage efter status', 'Tickets:Related:OpenChanges' => 'Open changes~~', 'Tickets:Related:RecentChanges' => 'Recent changes (72h)~~', -)); +]); // Dictionnay conventions // Class: @@ -46,12 +47,11 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Change' => 'Change', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -148,13 +148,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Afslut', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:RoutineChange' => 'Rutine Ændring', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Valider', @@ -179,13 +179,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Afslut', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ApprovedChange' => 'Godkendte Changes', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Dato for godkendelse', @@ -214,13 +214,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Afslut', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:NormalChange' => 'Normal Ændring', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Dato for accept', @@ -249,13 +249,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Afslut', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:EmergencyChange' => 'Emergency Ændring', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Valider', @@ -280,4 +280,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Afslut', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/de.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/de.dict.itop-change-mgmt-itil.php index dbca03ccc..5e6a360a4 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/de.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/de.dict.itop-change-mgmt-itil.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:ChangeManagement' => 'Change Management', 'Menu:Change:Overview' => 'Übersicht', 'Menu:Change:Overview+' => '', @@ -34,7 +35,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Changes der letzten sieben Tage nach Status', 'Tickets:Related:OpenChanges' => 'Offene Changes', 'Tickets:Related:RecentChanges' => 'Kürzlich erfolgte Changes (72h)', -)); +]); // Dictionnay conventions // Class: @@ -46,12 +47,11 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Change' => 'Change', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -148,13 +148,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Abschließen', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:RoutineChange' => 'Routine Change', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Validieren', @@ -179,13 +179,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Abschließen', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ApprovedChange' => 'Genehmigte Changes', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Datum der Genehmigung', @@ -214,13 +214,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Abschließen', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:NormalChange' => 'Normaler Change', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Datum der Annahme', @@ -249,13 +249,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Abschließen', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:EmergencyChange' => 'Emergency Change', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Validieren', @@ -280,4 +280,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Abschließen', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/en.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/en.dict.itop-change-mgmt-itil.php index 330a1d415..d8b464bae 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/en.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/en.dict.itop-change-mgmt-itil.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Menu:ChangeManagement' => 'Change management', 'Menu:Change:Overview' => 'Overview', 'Menu:Change:Overview+' => '', @@ -45,7 +46,7 @@ Dict::Add('EN US', 'English', 'English', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Changes by status for the last 7 days', 'Tickets:Related:OpenChanges' => 'Open changes', 'Tickets:Related:RecentChanges' => 'Recent changes (72h)', -)); +]); // Dictionnay conventions // Class: @@ -57,12 +58,11 @@ Dict::Add('EN US', 'English', 'English', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Change' => 'Change', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -159,13 +159,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Finish', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:RoutineChange' => 'Routine Change', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Validate', @@ -190,13 +190,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Finish', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ApprovedChange' => 'Approved Changes', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Approval Date', @@ -225,13 +225,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Finish', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:NormalChange' => 'Normal Change', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Acceptance date', @@ -260,13 +260,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Finish', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:EmergencyChange' => 'Emergency Change', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Validate', @@ -291,4 +291,4 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Finish', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/en_gb.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/en_gb.dict.itop-change-mgmt-itil.php index 6a0b4bbed..cf7da1ad2 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/en_gb.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/en_gb.dict.itop-change-mgmt-itil.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Menu:ChangeManagement' => 'Change management', 'Menu:Change:Overview' => 'Overview', 'Menu:Change:Overview+' => '', @@ -45,7 +46,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Changes by status for the last 7 days', 'Tickets:Related:OpenChanges' => 'Open changes', 'Tickets:Related:RecentChanges' => 'Recent changes (72h)', -)); +]); // Dictionnay conventions // Class: @@ -57,12 +58,11 @@ Dict::Add('EN GB', 'British English', 'British English', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Change' => 'Change', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -159,13 +159,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Finish', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:RoutineChange' => 'Routine Change', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Validate', @@ -190,13 +190,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Finish', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ApprovedChange' => 'Approved Changes', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Approval Date', @@ -225,13 +225,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Finish', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:NormalChange' => 'Normal Change', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Acceptance date', @@ -260,13 +260,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Finish', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:EmergencyChange' => 'Emergency Change', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Validate', @@ -291,4 +291,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Finish', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/es_cr.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/es_cr.dict.itop-change-mgmt-itil.php index 8f273d42e..89adf3b8d 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/es_cr.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/es_cr.dict.itop-change-mgmt-itil.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:ChangeManagement' => 'Administración de Cambios', 'Menu:Change:Overview' => 'Resumen de cambios', 'Menu:Change:Overview+' => 'Resumen de cambios', @@ -31,7 +32,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Cambios por estatus de los últimos 7 días', 'Tickets:Related:OpenChanges' => 'Cambios abiertos', 'Tickets:Related:RecentChanges' => 'Cambios recientes (72 hrs)', -)); +]); // Dictionnay conventions // Class: @@ -43,12 +44,11 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Change' => 'Cambio', 'Class:Change+' => 'Cambio', 'Class:Change/Attribute:status' => 'Estatus', @@ -145,13 +145,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Change/Stimulus:ev_monitor+' => 'Monitorear', 'Class:Change/Stimulus:ev_finish' => 'Finalizar', 'Class:Change/Stimulus:ev_finish+' => 'Finalizar', -)); +]); // // Class: RoutineChange // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:RoutineChange' => 'Cambio Rutinario', 'Class:RoutineChange+' => 'Cambio Rutinario', 'Class:RoutineChange/Stimulus:ev_validate' => 'Validar', @@ -176,13 +176,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => 'Monitorear', 'Class:RoutineChange/Stimulus:ev_finish' => 'Finalizar', 'Class:RoutineChange/Stimulus:ev_finish+' => 'Finalizar', -)); +]); // // Class: ApprovedChange // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ApprovedChange' => 'Cambios Aprobados', 'Class:ApprovedChange+' => 'Cambios Aprobados', 'Class:ApprovedChange/Attribute:approval_date' => 'Fecha de Aprobación', @@ -211,13 +211,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => 'Monitorear', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Finalizar', 'Class:ApprovedChange/Stimulus:ev_finish+' => 'Finalizar', -)); +]); // // Class: NormalChange // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:NormalChange' => 'Cambio Normal', 'Class:NormalChange+' => 'Cambio Normal', 'Class:NormalChange/Attribute:acceptance_date' => 'Fecha de Aceptación', @@ -246,13 +246,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:NormalChange/Stimulus:ev_monitor+' => 'Monitorear', 'Class:NormalChange/Stimulus:ev_finish' => 'Finalizar', 'Class:NormalChange/Stimulus:ev_finish+' => 'Finalizar', -)); +]); // // Class: EmergencyChange // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:EmergencyChange' => 'Cambio de Emergencia', 'Class:EmergencyChange+' => 'Cambio de Emergencia', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Validar', @@ -277,4 +277,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => 'Monitorear', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Finalizar', 'Class:EmergencyChange/Stimulus:ev_finish+' => 'Finalizar', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/fr.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/fr.dict.itop-change-mgmt-itil.php index dd5420085..130b2cb73 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/fr.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/fr.dict.itop-change-mgmt-itil.php @@ -1,15 +1,16 @@ 'Gestion des changements', 'Menu:Change:Overview' => 'Vue d\'ensemble', 'Menu:Change:Overview+' => '', @@ -33,7 +34,7 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Changements par statut', 'Tickets:Related:OpenChanges' => 'Changements en cours', 'Tickets:Related:RecentChanges' => 'Changements récents (72h)', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('FR FR', 'French', 'Français', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Change' => 'Ticket de Changement', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Etat', @@ -170,14 +170,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Change/Stimulus:ev_monitor' => 'Marquer comme suivi', 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Fermer', - 'Class:Change/Stimulus:ev_finish+' => '' -)); + 'Class:Change/Stimulus:ev_finish+' => '', +]); // // Class: RoutineChange // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:RoutineChange' => 'Changement de Routine', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Valider', @@ -202,13 +202,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Fermer', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ApprovedChange' => 'Changement pré-approuvé', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Date d\'approbation', @@ -237,13 +237,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Fermer', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:NormalChange' => 'Changement Normal', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Date d\'acceptation', @@ -272,13 +272,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Fermer', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:EmergencyChange' => 'Changement urgent', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Valider', @@ -303,4 +303,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Fermer', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/hu.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/hu.dict.itop-change-mgmt-itil.php index 2067759c5..30bd09d0c 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/hu.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/hu.dict.itop-change-mgmt-itil.php @@ -1,15 +1,16 @@ 'Változáskezelés', 'Menu:Change:Overview' => 'Áttekintő', 'Menu:Change:Overview+' => 'Áttekintő oldal', @@ -33,7 +34,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Változások állapotuk szerint az elmúlt 7 napban', 'Tickets:Related:OpenChanges' => 'Nyitott változások', 'Tickets:Related:RecentChanges' => 'Legutóbbi változások (72h)', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Change' => 'Változás', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Állapot', @@ -147,13 +147,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Befejezés', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:RoutineChange' => 'Szokásos változás', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Ellenőrzés', @@ -178,13 +178,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Befejezés', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ApprovedChange' => 'Jóváhagyott változások', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Jóváhagyás dátuma', @@ -213,13 +213,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Befejezés', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:NormalChange' => 'Normál változás', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Elfogadás dátuma', @@ -248,13 +248,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Befejezés', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:EmergencyChange' => 'Sürgős változás', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Ellenőrzés', @@ -279,4 +279,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Befejezés', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/it.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/it.dict.itop-change-mgmt-itil.php index bb13366fe..4f8a4058f 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/it.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/it.dict.itop-change-mgmt-itil.php @@ -1,15 +1,16 @@ 'Gestione dei cambi', 'Menu:Change:Overview' => 'Panoramica', 'Menu:Change:Overview+' => '', @@ -33,7 +34,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Cambiamenti per stato negli ultimi 7 giorni', 'Tickets:Related:OpenChanges' => 'Cambiamenti aperti', 'Tickets:Related:RecentChanges' => 'Cambiamenti recenti (72h)', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Change' => 'Cambio', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Stato', @@ -147,13 +147,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Fine', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:RoutineChange' => 'Routine di cambi', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Convalida', @@ -178,13 +178,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Fine', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ApprovedChange' => 'Cambi approvati', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Data di approvazione', @@ -213,13 +213,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Fine', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:NormalChange' => 'Cambi normali', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Data di approvazione', @@ -248,13 +248,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Fine', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:EmergencyChange' => 'Cambi di emergenza', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Convalida', @@ -279,4 +279,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Fine', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/ja.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/ja.dict.itop-change-mgmt-itil.php index 34c84ec98..c5a3994b3 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/ja.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/ja.dict.itop-change-mgmt-itil.php @@ -1,15 +1,16 @@ '変更管理', 'Menu:Change:Overview' => '概要', 'Menu:Change:Overview+' => '', @@ -33,7 +34,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => '最近7日間の状態別変更', 'Tickets:Related:OpenChanges' => 'Open changes~~', 'Tickets:Related:RecentChanges' => 'Recent changes (72h)~~', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Change' => '変更', 'Class:Change+' => '', 'Class:Change/Attribute:status' => '状態', @@ -147,13 +147,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => '終了', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:RoutineChange' => 'ルーチン変更', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => '受け付け', @@ -178,13 +178,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => '終了', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ApprovedChange' => '承認済の変更', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => '承認日', @@ -213,13 +213,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => '終了', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:NormalChange' => '通常変更', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => '受理日', @@ -248,13 +248,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => '終了', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:EmergencyChange' => '緊急変更', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => '受け付け', @@ -279,4 +279,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => '終了', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/nl.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/nl.dict.itop-change-mgmt-itil.php index ba63fba30..32194c4a4 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/nl.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/nl.dict.itop-change-mgmt-itil.php @@ -1,17 +1,18 @@ (2018 - 2022) * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:ChangeManagement' => 'Change Management', 'Menu:Change:Overview' => 'Overzicht', 'Menu:Change:Overview+' => '', @@ -35,7 +36,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Changes per status van de afgelopen 7 dagen', 'Tickets:Related:OpenChanges' => 'Open changes', 'Tickets:Related:RecentChanges' => 'Recente changes (72u)', -)); +]); // Dictionnay conventions // Class: @@ -47,12 +48,11 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Change' => 'Change', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -149,13 +149,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Sluit af', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:RoutineChange' => 'Routine Change', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Valideer', @@ -180,13 +180,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Sluit af', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ApprovedChange' => 'Goedgekeurde Changes', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Datum goedkeuring', @@ -215,13 +215,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Sluit af', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:NormalChange' => 'Normale Change', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Datum acceptatie', @@ -250,13 +250,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Sluit af', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:EmergencyChange' => 'Dringende Change', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Valideer', @@ -281,4 +281,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Sluit af', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/pl.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/pl.dict.itop-change-mgmt-itil.php index ea8cb1fd6..8c569fb57 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/pl.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/pl.dict.itop-change-mgmt-itil.php @@ -1,15 +1,16 @@ 'Zarządzanie zmianami', 'Menu:Change:Overview' => 'Przegląd', 'Menu:Change:Overview+' => '', @@ -33,7 +34,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Zmiany według statusu z ostatnich 7 dni', 'Tickets:Related:OpenChanges' => 'Otwarte zmiany', 'Tickets:Related:RecentChanges' => 'Ostatnie zmiany (72h)', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Change' => 'Zmiana', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -147,13 +147,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Zakończona', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:RoutineChange' => 'Rutynowa zmiana', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Sprawdzona', @@ -178,13 +178,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Zakończona', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ApprovedChange' => 'Zatwierdzone zmiany', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Data zatwierdzenia', @@ -213,13 +213,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Zakończona', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:NormalChange' => 'Normalna zmiana', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Data akceptacji', @@ -248,13 +248,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Zakończona', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:EmergencyChange' => 'Awaryjna zmiana', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Sprawdzona', @@ -279,4 +279,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Zakończona', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/pt_br.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/pt_br.dict.itop-change-mgmt-itil.php index 38f9babea..97400b264 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/pt_br.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/pt_br.dict.itop-change-mgmt-itil.php @@ -1,15 +1,16 @@ 'Gerenciamento de Mudanças', 'Menu:Change:Overview' => 'Visão geral', 'Menu:Change:Overview+' => '', @@ -33,7 +34,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Mudanças por domínio nos últimos 7 dias', 'Tickets:Related:OpenChanges' => 'Mudanças abertas', 'Tickets:Related:RecentChanges' => 'Mudanças recentes (72h)', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Change' => 'Mudança', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -147,13 +147,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Finalizar', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:RoutineChange' => 'Mudança de rotina', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Validar', @@ -178,13 +178,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Finalizar', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ApprovedChange' => 'Mudanças aprovadas', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Data de aprovação', @@ -213,13 +213,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Finalizar', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:NormalChange' => 'Mudança normal', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Data de aceitação', @@ -248,13 +248,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Finalizar', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:EmergencyChange' => 'Mudança emergencial', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Validar', @@ -279,4 +279,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Finalizar', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/ru.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/ru.dict.itop-change-mgmt-itil.php index d5a085407..c12e14f6d 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/ru.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/ru.dict.itop-change-mgmt-itil.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:ChangeManagement' => 'Управление изменениями', 'Menu:Change:Overview' => 'Обзор', 'Menu:Change:Overview+' => 'Управление изменениями - Обзор', @@ -34,7 +35,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Изменения по статусу за 7 дней', 'Tickets:Related:OpenChanges' => 'Открытые изменения', 'Tickets:Related:RecentChanges' => 'Недавние изменения (72ч)', -)); +]); // Dictionnay conventions // Class: @@ -46,12 +47,11 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Change' => 'Изменение', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Статус', @@ -148,13 +148,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Закончить', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:RoutineChange' => 'Стандартное изменение', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Подтвердить', @@ -179,13 +179,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Закончить', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ApprovedChange' => 'Утверждаемые изменения', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Дата утверждения', @@ -214,13 +214,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Закончить', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:NormalChange' => 'Нормальное изменение', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Дата принятия', @@ -249,13 +249,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Закончить', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:EmergencyChange' => 'Экстренное изменение', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Подтвердить', @@ -280,4 +280,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Закончить', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/sk.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/sk.dict.itop-change-mgmt-itil.php index ea5318cd8..3c3dd1ee0 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/sk.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/sk.dict.itop-change-mgmt-itil.php @@ -1,15 +1,16 @@ 'Manažment zmien', 'Menu:Change:Overview' => 'Prehľad', 'Menu:Change:Overview+' => '~~', @@ -33,7 +34,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Zmeny podľa stavu za posledných 7 dní', 'Tickets:Related:OpenChanges' => 'Open changes~~', 'Tickets:Related:RecentChanges' => 'Recent changes (72h)~~', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Change' => 'Zmena', 'Class:Change+' => '~~', 'Class:Change/Attribute:status' => 'Stav', @@ -147,13 +147,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Change/Stimulus:ev_monitor+' => '~~', 'Class:Change/Stimulus:ev_finish' => 'Zatvoriť', 'Class:Change/Stimulus:ev_finish+' => '~~', -)); +]); // // Class: RoutineChange // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:RoutineChange' => 'Routine Change~~', 'Class:RoutineChange+' => '~~', 'Class:RoutineChange/Stimulus:ev_validate' => 'Validate~~', @@ -178,13 +178,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '~~', 'Class:RoutineChange/Stimulus:ev_finish' => 'Finish~~', 'Class:RoutineChange/Stimulus:ev_finish+' => '~~', -)); +]); // // Class: ApprovedChange // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ApprovedChange' => 'Approved Changes~~', 'Class:ApprovedChange+' => '~~', 'Class:ApprovedChange/Attribute:approval_date' => 'Approval Date~~', @@ -213,13 +213,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '~~', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Finish~~', 'Class:ApprovedChange/Stimulus:ev_finish+' => '~~', -)); +]); // // Class: NormalChange // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:NormalChange' => 'Normal Change~~', 'Class:NormalChange+' => '~~', 'Class:NormalChange/Attribute:acceptance_date' => 'Acceptance date~~', @@ -248,13 +248,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '~~', 'Class:NormalChange/Stimulus:ev_finish' => 'Finish~~', 'Class:NormalChange/Stimulus:ev_finish+' => '~~', -)); +]); // // Class: EmergencyChange // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:EmergencyChange' => 'Emergency Change~~', 'Class:EmergencyChange+' => '~~', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Validate~~', @@ -279,4 +279,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '~~', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Finish~~', 'Class:EmergencyChange/Stimulus:ev_finish+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/tr.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/tr.dict.itop-change-mgmt-itil.php index a6104462c..54b48064d 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/tr.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/tr.dict.itop-change-mgmt-itil.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Menu:ChangeManagement' => 'Değişiklik Yönetimi', 'Menu:Change:Overview' => 'Özet', 'Menu:Change:Overview+' => '', @@ -34,7 +35,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Son 7 gün için duruma göre değişiklikler', 'Tickets:Related:OpenChanges' => 'Açık değişiklikler', 'Tickets:Related:RecentChanges' => 'Son değişiklikler (72H)', -)); +]); // Dictionnay conventions // Class: @@ -46,12 +47,11 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Change' => 'Değişiklik', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Durumu', @@ -148,13 +148,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => 'Bitir', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:RoutineChange' => 'Sıradan değişiklik', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => 'Doğrulanan', @@ -179,13 +179,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => 'Bitir', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ApprovedChange' => 'Onaylanan değişiklik', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => 'Onay tarihi', @@ -214,13 +214,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => 'Bitir', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:NormalChange' => 'Normal değişiklik', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => 'Kabul tarihi', @@ -249,13 +249,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => 'Bitir', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:EmergencyChange' => 'Acil değişiklik', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => 'Doğrula', @@ -280,4 +280,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => 'Bitir', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/zh_cn.dict.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/zh_cn.dict.itop-change-mgmt-itil.php index b9c3d56c4..4e1c7a201 100644 --- a/datamodels/2.x/itop-change-mgmt-itil/dictionaries/zh_cn.dict.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/dictionaries/zh_cn.dict.itop-change-mgmt-itil.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Menu:ChangeManagement' => '变更管理', 'Menu:Change:Overview' => '概况', 'Menu:Change:Overview+' => '', @@ -44,7 +45,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => '最近一周的变更 (按状态)', 'Tickets:Related:OpenChanges' => '打开的变更', 'Tickets:Related:RecentChanges' => '最近的变更 (72小时)', -)); +]); // Dictionnay conventions // Class: @@ -56,12 +57,11 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Change' => '变更', 'Class:Change+' => '', 'Class:Change/Attribute:status' => '状态', @@ -158,13 +158,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Change/Stimulus:ev_monitor+' => '', 'Class:Change/Stimulus:ev_finish' => '完成', 'Class:Change/Stimulus:ev_finish+' => '', -)); +]); // // Class: RoutineChange // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:RoutineChange' => '例行变更', 'Class:RoutineChange+' => '', 'Class:RoutineChange/Stimulus:ev_validate' => '同意', @@ -189,13 +189,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:RoutineChange/Stimulus:ev_monitor+' => '', 'Class:RoutineChange/Stimulus:ev_finish' => '完成', 'Class:RoutineChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: ApprovedChange // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ApprovedChange' => '已批准的变更', 'Class:ApprovedChange+' => '', 'Class:ApprovedChange/Attribute:approval_date' => '批准日期', @@ -224,13 +224,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:ApprovedChange/Stimulus:ev_monitor+' => '', 'Class:ApprovedChange/Stimulus:ev_finish' => '完成', 'Class:ApprovedChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: NormalChange // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:NormalChange' => '正常变更', 'Class:NormalChange+' => '', 'Class:NormalChange/Attribute:acceptance_date' => '审核日期', @@ -259,13 +259,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:NormalChange/Stimulus:ev_monitor+' => '', 'Class:NormalChange/Stimulus:ev_finish' => '完成', 'Class:NormalChange/Stimulus:ev_finish+' => '', -)); +]); // // Class: EmergencyChange // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:EmergencyChange' => '紧急变更', 'Class:EmergencyChange+' => '', 'Class:EmergencyChange/Stimulus:ev_validate' => '同意', @@ -290,4 +290,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:EmergencyChange/Stimulus:ev_monitor+' => '', 'Class:EmergencyChange/Stimulus:ev_finish' => '完成', 'Class:EmergencyChange/Stimulus:ev_finish+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt-itil/module.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/module.itop-change-mgmt-itil.php index 4872ba178..c07b4352c 100755 --- a/datamodels/2.x/itop-change-mgmt-itil/module.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/module.itop-change-mgmt-itil.php @@ -1,10 +1,9 @@ 'Change Management ITIL', @@ -12,24 +11,24 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-config-mgmt/2.2.0', 'itop-tickets/2.0.0', - ), + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array( - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'data.struct' => [ //'data.struct.itop-change-mgmt.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.itop-change-mgmt.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -37,7 +36,7 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/cs.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/cs.dict.itop-change-mgmt.php index e84f21e46..63d619c9b 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/cs.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/cs.dict.itop-change-mgmt.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:ChangeManagement' => 'Řízení změn', 'Menu:Change:Overview' => 'Přehled', 'Menu:Change:Overview+' => '', @@ -35,7 +36,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Změny v posledních 7 dnech podle stavu', 'Tickets:Related:OpenChanges' => 'Otevřené změny', 'Tickets:Related:RecentChanges' => 'Nedávné změny (72h)', -)); +]); // Dictionnay conventions // Class: @@ -47,12 +48,11 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Change' => 'Změna', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Stav', @@ -127,4 +127,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Change/Attribute:outage/Value:no+' => '', 'Class:Change/Attribute:outage/Value:yes' => 'Ano', 'Class:Change/Attribute:outage/Value:yes+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/da.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/da.dict.itop-change-mgmt.php index 0c137e803..8ac59adbb 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/da.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/da.dict.itop-change-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:ChangeManagement' => 'Change Management', 'Menu:Change:Overview' => 'Oversigt', 'Menu:Change:Overview+' => '', @@ -34,7 +35,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Changes de sidste 7 dage efter status', 'Tickets:Related:OpenChanges' => 'Open changes~~', 'Tickets:Related:RecentChanges' => 'Recent changes (72h)~~', -)); +]); // Dictionnay conventions // Class: @@ -46,12 +47,11 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Change' => 'Change', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -126,4 +126,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Change/Attribute:outage/Value:no+' => '~~', 'Class:Change/Attribute:outage/Value:yes' => 'Ja', 'Class:Change/Attribute:outage/Value:yes+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/de.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/de.dict.itop-change-mgmt.php index 105155257..43104ecf9 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/de.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/de.dict.itop-change-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:ChangeManagement' => 'Change Management', 'Menu:Change:Overview' => 'Übersicht', 'Menu:Change:Overview+' => '', @@ -34,7 +35,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Changes der letzten sieben Tage nach Status', 'Tickets:Related:OpenChanges' => 'Offene Changes', 'Tickets:Related:RecentChanges' => 'Kürzlich erfolgte Changes (72h)', -)); +]); // Dictionnay conventions // Class: @@ -46,12 +47,11 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Change' => 'Change', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -126,4 +126,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Change/Attribute:outage/Value:no+' => '', 'Class:Change/Attribute:outage/Value:yes' => 'Ja', 'Class:Change/Attribute:outage/Value:yes+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/en.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/en.dict.itop-change-mgmt.php index 8ffa07117..9324d8b04 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/en.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/en.dict.itop-change-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Menu:ChangeManagement' => 'Change management', 'Menu:Change:Overview' => 'Overview', 'Menu:Change:Overview+' => '', @@ -45,7 +46,7 @@ Dict::Add('EN US', 'English', 'English', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Changes by status for the last 7 days', 'Tickets:Related:OpenChanges' => 'Open changes', 'Tickets:Related:RecentChanges' => 'Recent changes (72h)', -)); +]); // Dictionnay conventions // Class: @@ -57,12 +58,11 @@ Dict::Add('EN US', 'English', 'English', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Change' => 'Change', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -137,4 +137,4 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Change/Attribute:outage/Value:no+' => '', 'Class:Change/Attribute:outage/Value:yes' => 'Yes', 'Class:Change/Attribute:outage/Value:yes+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/en_gb.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/en_gb.dict.itop-change-mgmt.php index 00da2d6ca..35427ccad 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/en_gb.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/en_gb.dict.itop-change-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Menu:ChangeManagement' => 'Change management', 'Menu:Change:Overview' => 'Overview', 'Menu:Change:Overview+' => '', @@ -45,7 +46,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Changes by status for the last 7 days', 'Tickets:Related:OpenChanges' => 'Open changes', 'Tickets:Related:RecentChanges' => 'Recent changes (72h)', -)); +]); // Dictionnay conventions // Class: @@ -57,12 +58,11 @@ Dict::Add('EN GB', 'British English', 'British English', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Change' => 'Change', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -137,4 +137,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Change/Attribute:outage/Value:no+' => '', 'Class:Change/Attribute:outage/Value:yes' => 'Yes', 'Class:Change/Attribute:outage/Value:yes+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/es_cr.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/es_cr.dict.itop-change-mgmt.php index 1414bd03b..91c0d5575 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/es_cr.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/es_cr.dict.itop-change-mgmt.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:ChangeManagement' => 'Administración de Cambios', 'Menu:Change:Overview' => 'Resumen de Cambios', 'Menu:Change:Overview+' => 'Resumen de Cambios', @@ -31,7 +32,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Cambios por Estatus de los Últimos 7 días', 'Tickets:Related:OpenChanges' => 'Cambios Abiertos', 'Tickets:Related:RecentChanges' => 'Cambios Recientes (72 hrs)', -)); +]); // Dictionnay conventions // Class: @@ -43,12 +44,11 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Change' => 'Cambio', 'Class:Change+' => 'Cambio', 'Class:Change/Attribute:status' => 'Estatus', @@ -123,4 +123,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Change/Attribute:outage/Value:no+' => 'No', 'Class:Change/Attribute:outage/Value:yes' => 'Si', 'Class:Change/Attribute:outage/Value:yes+' => 'Si', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/fr.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/fr.dict.itop-change-mgmt.php index 06f4f24e7..2a4bf9fb0 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/fr.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/fr.dict.itop-change-mgmt.php @@ -1,15 +1,16 @@ 'Gestion des changements', 'Menu:Change:Overview' => 'Vue d\'ensemble', 'Menu:Change:Overview+' => '', @@ -33,7 +34,7 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Changements par statut', 'Tickets:Related:OpenChanges' => 'Changements en cours', 'Tickets:Related:RecentChanges' => 'Changements récents (72h)', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('FR FR', 'French', 'Français', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Change' => 'Ticket de Changement', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Etat', @@ -148,5 +148,5 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Change/Attribute:outage/Value:no' => 'Non', 'Class:Change/Attribute:outage/Value:no+' => '', 'Class:Change/Attribute:outage/Value:yes' => 'Oui', - 'Class:Change/Attribute:outage/Value:yes+' => '' -)); + 'Class:Change/Attribute:outage/Value:yes+' => '', +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/hu.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/hu.dict.itop-change-mgmt.php index f6cb1f74f..e2857a54a 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/hu.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/hu.dict.itop-change-mgmt.php @@ -1,15 +1,16 @@ 'Változáskezelés', 'Menu:Change:Overview' => 'Áttekintő', 'Menu:Change:Overview+' => 'Áttekintő oldal', @@ -33,7 +34,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Változások állapotuk szerint az elmúlt 7 napban', 'Tickets:Related:OpenChanges' => 'Nyitott változások', 'Tickets:Related:RecentChanges' => 'Legutóbbi változások (72h)', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Change' => 'Változás', 'Class:Change+' => '~~', 'Class:Change/Attribute:status' => 'Állapot', @@ -125,4 +125,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Change/Attribute:outage/Value:no+' => '~~', 'Class:Change/Attribute:outage/Value:yes' => 'Igen', 'Class:Change/Attribute:outage/Value:yes+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/it.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/it.dict.itop-change-mgmt.php index c694d45ea..4cf2e12b6 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/it.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/it.dict.itop-change-mgmt.php @@ -1,15 +1,16 @@ 'Gestione dei cambi', 'Menu:Change:Overview' => 'Panoramica', 'Menu:Change:Overview+' => '~~', @@ -33,7 +34,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Cambiamenti per stato negli ultimi 7 giorni', 'Tickets:Related:OpenChanges' => 'Cambiamenti aperti', 'Tickets:Related:RecentChanges' => 'Cambiamenti recenti (72h)', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Change' => 'Cambio', 'Class:Change+' => '~~', 'Class:Change/Attribute:status' => 'Stato', @@ -125,4 +125,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Change/Attribute:outage/Value:no+' => '~~', 'Class:Change/Attribute:outage/Value:yes' => 'Si', 'Class:Change/Attribute:outage/Value:yes+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/ja.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/ja.dict.itop-change-mgmt.php index 08a6b91e9..2cf1eea0e 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/ja.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/ja.dict.itop-change-mgmt.php @@ -1,15 +1,16 @@ '変更管理', 'Menu:Change:Overview' => '概要', 'Menu:Change:Overview+' => '', @@ -33,7 +34,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => '最近7日間の状態別変更', 'Tickets:Related:OpenChanges' => 'Open changes~~', 'Tickets:Related:RecentChanges' => 'Recent changes (72h)~~', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Change' => '変更', 'Class:Change+' => '', 'Class:Change/Attribute:status' => '状態', @@ -125,4 +125,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Change/Attribute:outage/Value:no+' => '~~', 'Class:Change/Attribute:outage/Value:yes' => 'はい', 'Class:Change/Attribute:outage/Value:yes+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/nl.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/nl.dict.itop-change-mgmt.php index ca4ddb219..6197896a9 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/nl.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/nl.dict.itop-change-mgmt.php @@ -1,17 +1,18 @@ * @author Jeffrey Bostoen (2018 - 2022) * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:ChangeManagement' => 'Change Management', 'Menu:Change:Overview' => 'Overzicht', 'Menu:Change:Overview+' => '', @@ -35,7 +36,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Changes per status van de afgelopen 7 dagen', 'Tickets:Related:OpenChanges' => 'Open changes', 'Tickets:Related:RecentChanges' => 'Recente changes (72u)', -)); +]); // Dictionnay conventions // Class: @@ -47,12 +48,11 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Change' => 'Change', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -127,4 +127,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Change/Attribute:outage/Value:no+' => '', 'Class:Change/Attribute:outage/Value:yes' => 'Ja', 'Class:Change/Attribute:outage/Value:yes+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/pl.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/pl.dict.itop-change-mgmt.php index c400f73c5..295b5a9b7 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/pl.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/pl.dict.itop-change-mgmt.php @@ -1,15 +1,16 @@ 'Zarządzanie zmianami', 'Menu:Change:Overview' => 'Przegląd', 'Menu:Change:Overview+' => '', @@ -33,7 +34,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Zmiany według statusu z ostatnich 7 dni', 'Tickets:Related:OpenChanges' => 'Otwarte zmiany', 'Tickets:Related:RecentChanges' => 'Ostatnie zmiany (72h)', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Change' => 'Zmiana', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -125,4 +125,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Change/Attribute:outage/Value:no+' => '', 'Class:Change/Attribute:outage/Value:yes' => 'Tak', 'Class:Change/Attribute:outage/Value:yes+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/pt_br.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/pt_br.dict.itop-change-mgmt.php index 23e35d4e9..923e9a82b 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/pt_br.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/pt_br.dict.itop-change-mgmt.php @@ -1,15 +1,16 @@ 'Gerenciamento de mudanças', 'Menu:Change:Overview' => 'Visão geral', 'Menu:Change:Overview+' => '', @@ -33,7 +34,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Mudanças por status nos últimos 7 dias', 'Tickets:Related:OpenChanges' => 'Mudanças abertas', 'Tickets:Related:RecentChanges' => 'Mudanças recentes (72h)', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Change' => 'Mudança', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Status', @@ -125,4 +125,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Change/Attribute:outage/Value:no+' => '', 'Class:Change/Attribute:outage/Value:yes' => 'Sim', 'Class:Change/Attribute:outage/Value:yes+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/ru.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/ru.dict.itop-change-mgmt.php index f0b2e1ff3..e75d1a0f6 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/ru.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/ru.dict.itop-change-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:ChangeManagement' => 'Управление изменениями', 'Menu:Change:Overview' => 'Обзор', 'Menu:Change:Overview+' => 'Управление изменениями - Обзор', @@ -34,7 +35,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Изменения по статусу за 7 дней', 'Tickets:Related:OpenChanges' => 'Открытые изменения', 'Tickets:Related:RecentChanges' => 'Недавние изменения (72ч)', -)); +]); // Dictionnay conventions // Class: @@ -46,12 +47,11 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Change' => 'Изменение', 'Class:Change+' => '', 'Class:Change/Attribute:status' => 'Статус', @@ -126,4 +126,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Change/Attribute:outage/Value:no+' => '', 'Class:Change/Attribute:outage/Value:yes' => 'Да', 'Class:Change/Attribute:outage/Value:yes+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/sk.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/sk.dict.itop-change-mgmt.php index eddbfd09f..0c2831ce2 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/sk.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/sk.dict.itop-change-mgmt.php @@ -1,15 +1,16 @@ 'Manažment zmien', 'Menu:Change:Overview' => 'Prehľad', 'Menu:Change:Overview+' => '~~', @@ -33,7 +34,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Zmeny podľa stavu za posledných 7 dní', 'Tickets:Related:OpenChanges' => 'Open changes~~', 'Tickets:Related:RecentChanges' => 'Recent changes (72h)~~', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Change' => 'Zmena', 'Class:Change+' => '~~', 'Class:Change/Attribute:status' => 'Stav', @@ -125,4 +125,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Change/Attribute:outage/Value:no+' => '~~', 'Class:Change/Attribute:outage/Value:yes' => 'Yes~~', 'Class:Change/Attribute:outage/Value:yes+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/tr.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/tr.dict.itop-change-mgmt.php index 66561be5b..e12737655 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/tr.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/tr.dict.itop-change-mgmt.php @@ -1,15 +1,16 @@ 'Değişiklik yönetimi', 'Menu:Change:Overview' => 'Özet', 'Menu:Change:Overview+' => '~~', @@ -33,7 +34,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => 'Son 7 gün için duruma göre değişiklikler', 'Tickets:Related:OpenChanges' => 'Açık değişiklikler', 'Tickets:Related:RecentChanges' => 'Son değişiklikler (72H)', -)); +]); // Dictionnay conventions // Class: @@ -45,12 +46,11 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Change' => 'Değişiklik', 'Class:Change+' => '~~', 'Class:Change/Attribute:status' => 'Durumu', @@ -125,4 +125,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Change/Attribute:outage/Value:no+' => '~~', 'Class:Change/Attribute:outage/Value:yes' => 'Evet', 'Class:Change/Attribute:outage/Value:yes+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/dictionaries/zh_cn.dict.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/dictionaries/zh_cn.dict.itop-change-mgmt.php index b665f9cd6..7422b8883 100644 --- a/datamodels/2.x/itop-change-mgmt/dictionaries/zh_cn.dict.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/dictionaries/zh_cn.dict.itop-change-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Menu:ChangeManagement' => '变更管理', 'Menu:Change:Overview' => '概况', 'Menu:Change:Overview+' => '', @@ -44,7 +45,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI-ChangeManagementOverview-ChangeByStatus-last-7-days' => '最近一周的变更 (按状态)', 'Tickets:Related:OpenChanges' => '打开的变更', 'Tickets:Related:RecentChanges' => '最近的变更 (72小时)', -)); +]); // Dictionnay conventions // Class: @@ -56,12 +57,11 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( // Class:/Stimulus: // Class:/Stimulus:+ - // // Class: Change // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Change' => '变更', 'Class:Change+' => '', 'Class:Change/Attribute:status' => '状态', @@ -136,4 +136,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Change/Attribute:outage/Value:no+' => '', 'Class:Change/Attribute:outage/Value:yes' => '是', 'Class:Change/Attribute:outage/Value:yes+' => '', -)); +]); diff --git a/datamodels/2.x/itop-change-mgmt/module.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/module.itop-change-mgmt.php index 91e33408d..7cb28e861 100755 --- a/datamodels/2.x/itop-change-mgmt/module.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/module.itop-change-mgmt.php @@ -1,10 +1,9 @@ 'Change Management', @@ -12,25 +11,25 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-config-mgmt/2.2.0', 'itop-tickets/2.0.0', - ), + ], 'mandatory' => false, 'visible' => true, 'installer' => 'ChangeManagementInstaller', // Components // - 'datamodel' => array( - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'data.struct' => [ //'data.struct.itop-change-mgmt.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.itop-change-mgmt.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -38,9 +37,9 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); // Module installation handler @@ -63,7 +62,7 @@ class ChangeManagementInstaller extends ModuleInstallerAPI { // If you want to migrate data from one format to another, do it here } - + /** * Handler called after the creation/update of the database schema * @param $oConfiguration Config The new configuration of the application @@ -82,8 +81,7 @@ class ChangeManagementInstaller extends ModuleInstallerAPI $sField = 'start_date'; - if (CMDBSource::IsField($sSourceTable, $sField) && CMDBSource::IsField($sTargetTable, $sField) && CMDBSource::IsField($sSourceTable, $sSourceKeyField) && CMDBSource::IsField($sTargetTable, $sTargetKeyField)) - { + if (CMDBSource::IsField($sSourceTable, $sField) && CMDBSource::IsField($sTargetTable, $sField) && CMDBSource::IsField($sSourceTable, $sSourceKeyField) && CMDBSource::IsField($sTargetTable, $sTargetKeyField)) { SetupLog::Info("Issue #464 - Copying change/start_date into ticket/start_date"); $sRepair = "UPDATE `$sTargetTable`, `$sSourceTable` SET `$sTargetTable`.`$sField` = `$sSourceTable`.`$sField` WHERE `$sTargetTable`.`$sField` IS NULL AND`$sTargetTable`.`$sTargetKeyField` = `$sSourceTable`.`$sSourceKeyField`"; CMDBSource::Query($sRepair); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/cs.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/cs.dict.itop-config-mgmt.php index 793f75851..902afc29a 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/cs.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/cs.dict.itop-config-mgmt.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Relation:impacts/Description' => 'Prvky ovlivněné objektem', 'Relation:impacts/DownStream' => 'Dopad na', 'Relation:impacts/DownStream+' => 'Elements impacted by~~', @@ -23,8 +24,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Relation:impacts/LoadData' => 'Load data~~', 'Relation:impacts/NoFilteredData' => 'please select objects and load data~~', 'Relation:impacts/FilteredData' => 'Filtered data~~', -)); - +]); // Dictionnay conventions // Class: @@ -67,7 +67,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( // Class: lnkContactToFunctionalCI // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkContactToFunctionalCI' => 'Spojení (Kontakt / Funkční konfigurační položka)', 'Class:lnkContactToFunctionalCI+' => '', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -79,13 +79,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Název kontaktu', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:FunctionalCI' => 'Funkční konfigurační položka', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => 'Název', @@ -118,13 +118,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:FunctionalCI/Attribute:finalclass+' => '', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Aktivní tikety', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Active Tickets which are impacting this functional CI~~', -)); +]); // // Class: PhysicalDevice // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:PhysicalDevice' => 'Fyzické zařízení', 'Class:PhysicalDevice+' => '', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -158,13 +158,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Konec záruky', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '', -)); +]); // // Class: Rack // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Rack' => 'Rack', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s', @@ -174,64 +174,64 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Rack/Attribute:device_list+' => 'Všechna zařízení umístěná v tomto racku', 'Class:Rack/Attribute:enclosure_list' => 'Šasi', 'Class:Rack/Attribute:enclosure_list+' => 'Všechna šasi umístěná v tomto racku', -)); +]); // // Class: TelephonyCI // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TelephonyCI' => 'Konfigurační položka Telefonie', 'Class:TelephonyCI+' => '', 'Class:TelephonyCI/Attribute:phonenumber' => 'Telefonní číslo', 'Class:TelephonyCI/Attribute:phonenumber+' => '', -)); +]); // // Class: Phone // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Phone' => 'Telefon', 'Class:Phone+' => '', -)); +]); // // Class: MobilePhone // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:MobilePhone' => 'Mobilní telefon', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'Hardware PIN', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:IPPhone' => 'IP telefon', 'Class:IPPhone+' => '', -)); +]); // // Class: Tablet // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Tablet' => 'Tablet', 'Class:Tablet+' => '', -)); +]); // // Class: ConnectableCI // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ConnectableCI' => 'Připojitelná konfigurační položka', 'Class:ConnectableCI+' => '', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s', @@ -239,13 +239,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'Všechny síťová zařízení, která jsou připojena k tomuto zařízení', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Síťová rozhraní', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'Všechna fyzická síťové rozhraní', -)); +]); // // Class: DatacenterDevice // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:DatacenterDevice' => 'Zařízení datového centra', 'Class:DatacenterDevice+' => '', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s', @@ -277,13 +277,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'Zařízení je v provozu, pokud je funkční alespoň jeden zdroj', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'Zařízení je v provozu, pouze pokud jsou funknčí všechny zdroje', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'Zařízení je v provozu, pokud je alespoň %1$s %% zdrojů funkčních', -)); +]); // // Class: NetworkDevice // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:NetworkDevice' => 'Síťový prvek', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -299,13 +299,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Server' => 'Server', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s', @@ -327,61 +327,61 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => 'Logické svazky', 'Class:Server/Attribute:logicalvolumes_list+' => 'All the logical volumes connected to this server~~', -)); +]); // // Class: StorageSystem // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:StorageSystem' => 'Úložný systém', 'Class:StorageSystem+' => '', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s~~', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Logické svazky', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'Všechny logické svazky připojené k tomuto úložnému systému', -)); +]); // // Class: SANSwitch // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:SANSwitch' => 'SAN Switch', 'Class:SANSwitch+' => '', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Zařízení', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'Všechna zařízení připojená k tomuto SAN switchi', -)); +]); // // Class: TapeLibrary // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TapeLibrary' => 'Pásková knihovna', 'Class:TapeLibrary+' => '', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s~~', 'Class:TapeLibrary/Attribute:tapes_list' => 'Pásky', 'Class:TapeLibrary/Attribute:tapes_list+' => 'Všechny pásky v této páskové knihovně', -)); +]); // // Class: NAS // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '', 'Class:NAS/ComplementaryName' => '%1$s - %2$s~~', 'Class:NAS/Attribute:nasfilesystem_list' => 'Souborové systémy', 'Class:NAS/Attribute:nasfilesystem_list+' => 'Všechny souborové systémy na tomto NASu', -)); +]); // // Class: PC // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:PC' => 'PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s~~', @@ -403,45 +403,45 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:PC/Attribute:type/Value:desktop+' => 'desktop', 'Class:PC/Attribute:type/Value:laptop' => 'notebook', 'Class:PC/Attribute:type/Value:laptop+' => 'notebook', -)); +]); // // Class: Printer // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Printer' => 'Tiskárna', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerConnection // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:PowerConnection' => 'Připojení k napájení', 'Class:PowerConnection+' => '', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerSource // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:PowerSource' => 'Zdroj napájení', 'Class:PowerSource+' => '', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s', 'Class:PowerSource/Attribute:pdus_list' => 'PDU', 'Class:PowerSource/Attribute:pdus_list+' => 'Všechny jednotky pro rozvod energie využívající tento zdroj napájení', -)); +]); // // Class: PDU // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s~~', @@ -453,23 +453,23 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:PDU/Attribute:powerstart_id+' => '', 'Class:PDU/Attribute:powerstart_name' => 'Název zdroje energie', 'Class:PDU/Attribute:powerstart_name+' => '', -)); +]); // // Class: Peripheral // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Peripheral' => 'Periferie', 'Class:Peripheral+' => '', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: Enclosure // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Enclosure' => 'Šasi', 'Class:Enclosure+' => '', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -481,13 +481,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Enclosure/Attribute:nb_u+' => '', 'Class:Enclosure/Attribute:device_list' => 'Zařízení', 'Class:Enclosure/Attribute:device_list+' => 'Všechna zařízení v tom to šasi', -)); +]); // // Class: ApplicationSolution // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ApplicationSolution' => 'Aplikační řešení', 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'Konfigurační položky', @@ -504,13 +504,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'Řešení je v provozu, pokud jsou funkční všechny konfigurační položky', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'Řešení je v provozu, pokud je funkčních alespoň %1$s konfiguračních položek', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'Řešení je v provozu, pokud je funkčních alespoň %1$s %% konfiguračních položek', -)); +]); // // Class: BusinessProcess // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:BusinessProcess' => 'Obchodní proces', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Aplikační řešení', @@ -521,13 +521,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => '', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'neaktivní', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => '', -)); +]); // // Class: SoftwareInstance // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:SoftwareInstance' => 'Instance softwaru', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'Systém', @@ -550,64 +550,64 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => '', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'neaktivní', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => '', -)); +]); // // Class: Middleware // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Middleware' => 'Middleware', 'Class:Middleware+' => '', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Instance middlewaru', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'Všechny instance tohoto middlewaru', -)); +]); // // Class: DBServer // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:DBServer' => 'DB Server', 'Class:DBServer+' => '', 'Class:DBServer/Attribute:dbschema_list' => 'DB schémata', 'Class:DBServer/Attribute:dbschema_list+' => 'Všechna DB schémata pro tento DB server', -)); +]); // // Class: WebServer // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:WebServer' => 'Web server', 'Class:WebServer+' => '', 'Class:WebServer/Attribute:webapp_list' => 'Web aplikace', 'Class:WebServer/Attribute:webapp_list+' => 'Všechny webové aplikace dostupné na tomto web serveru', -)); +]); // // Class: PCSoftware // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:PCSoftware' => 'PC Software', 'Class:PCSoftware+' => '', -)); +]); // // Class: OtherSoftware // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:OtherSoftware' => 'Ostatní Software', 'Class:OtherSoftware+' => '', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:MiddlewareInstance' => 'Instance middlewaru', 'Class:MiddlewareInstance+' => '', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s', @@ -615,13 +615,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Název middlewaru', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '', -)); +]); // // Class: DatabaseSchema // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:DatabaseSchema' => 'DB Schéma', 'Class:DatabaseSchema+' => '', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s', @@ -629,13 +629,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'Název DB serveru', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '', -)); +]); // // Class: WebApplication // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:WebApplication' => 'Web aplikace', 'Class:WebApplication+' => '', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s', @@ -645,14 +645,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:WebApplication/Attribute:webserver_name+' => '', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '', -)); - +]); // // Class: VirtualDevice // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:VirtualDevice' => 'Virtuální zařízení', 'Class:VirtualDevice+' => '', 'Class:VirtualDevice/Attribute:status' => 'Stav', @@ -667,24 +666,24 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => '', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Logické svazky', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'Všechny logické svazky používané tímto zařízením', -)); +]); // // Class: VirtualHost // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:VirtualHost' => 'Virtual host', 'Class:VirtualHost+' => '', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Virtuální stroje (VM)', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'Všechny virtuální stroje hostované na tomto virtual hostu', -)); +]); // // Class: Hypervisor // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Hypervisor' => 'Hypervisor', 'Class:Hypervisor+' => '', 'Class:Hypervisor/Attribute:farm_id' => 'Farma', @@ -695,13 +694,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Hypervisor/Attribute:server_id+' => '', 'Class:Hypervisor/Attribute:server_name' => 'Název serveru', 'Class:Hypervisor/Attribute:server_name+' => '', -)); +]); // // Class: Farm // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Farm' => 'Farma', 'Class:Farm+' => '', 'Class:Farm/Attribute:hypervisor_list' => 'Hypervisory', @@ -710,13 +709,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Farm/Attribute:redundancy/disabled' => 'Farma je v provozu, pouze pokud jsou funknční všechny Hypervisory', 'Class:Farm/Attribute:redundancy/count' => 'Farma je v provozu, pokud je funkčních alespoň %1$s Hypervisorů', 'Class:Farm/Attribute:redundancy/percent' => 'Farma je v provozu, pokud je funkčních alespoň %1$s %% Hypervisorů', -)); +]); // // Class: VirtualMachine // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:VirtualMachine' => 'Virtuální stroj (VM)', 'Class:VirtualMachine+' => '', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s', @@ -744,13 +743,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:VirtualMachine/Attribute:managementip+' => '', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Síťová rozhraní', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'Všechna logická síťová rozhraní', -)); +]); // // Class: LogicalVolume // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:LogicalVolume' => 'Logický svazek', 'Class:LogicalVolume+' => '', 'Class:LogicalVolume/Attribute:name' => 'Název', @@ -771,13 +770,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'Všechny servery užívající tento svazek', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Virtuální zařízení', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'Všechna virtuální zařízení užívající tento svazek', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkServerToVolume' => 'Spojení (Server / Svazek)', 'Class:lnkServerToVolume+' => '', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s~~', @@ -791,13 +790,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '', 'Class:lnkServerToVolume/Attribute:size_used' => 'Využitá velikost', 'Class:lnkServerToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkVirtualDeviceToVolume' => 'Spojení (Virtuální zařízení / Svazek)', 'Class:lnkVirtualDeviceToVolume+' => '', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s', @@ -811,13 +810,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Využitá velikost', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkSanToDatacenterDevice' => 'Spojení (SAN / Zařízení datového centra)', 'Class:lnkSanToDatacenterDevice+' => '', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s~~', @@ -833,13 +832,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'FC zařízení', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '', -)); +]); // // Class: Tape // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Tape' => 'Páska', 'Class:Tape+' => '', 'Class:Tape/Attribute:name' => 'Název', @@ -852,13 +851,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Tape/Attribute:tapelibrary_id+' => '', 'Class:Tape/Attribute:tapelibrary_name' => 'Název páskové knihovny', 'Class:Tape/Attribute:tapelibrary_name+' => '', -)); +]); // // Class: NASFileSystem // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:NASFileSystem' => 'Souborový systém nas', 'Class:NASFileSystem+' => '', 'Class:NASFileSystem/Attribute:name' => 'Název', @@ -873,13 +872,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:NASFileSystem/Attribute:nas_id+' => '', 'Class:NASFileSystem/Attribute:nas_name' => 'Název NAS', 'Class:NASFileSystem/Attribute:nas_name+' => '', -)); +]); // // Class: Software // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Software' => 'Software', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s~~', @@ -909,13 +908,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Software/Attribute:softwarepatch_list+' => 'Všechny záplaty (patche) pro tento software', 'Class:Software/Attribute:softwarelicence_list' => 'Licence softwaru', 'Class:Software/Attribute:softwarelicence_list+' => 'Všechny licence pro tento software', -)); +]); // // Class: Patch // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Patch' => 'Záplata (patch)', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => 'Název', @@ -926,13 +925,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Typ', 'Class:Patch/Attribute:finalclass+' => '', -)); +]); // // Class: OSPatch // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:OSPatch' => 'Záplata (patch) OS', 'Class:OSPatch+' => '', 'Class:OSPatch/Attribute:functionalcis_list' => 'Zařízení', @@ -941,13 +940,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:OSPatch/Attribute:osversion_id+' => '', 'Class:OSPatch/Attribute:osversion_name' => 'Název verze OS', 'Class:OSPatch/Attribute:osversion_name+' => '', -)); +]); // // Class: SoftwarePatch // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:SoftwarePatch' => 'Záplata (patch) softwaru', 'Class:SoftwarePatch+' => '', 'Class:SoftwarePatch/Attribute:software_id' => 'Software', @@ -956,13 +955,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:SoftwarePatch/Attribute:software_name+' => '', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Instance softwaru', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'Všechny systémy, kde je tato záplata (patch) softwaru instalována', -)); +]); // // Class: Licence // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Licence' => 'Licence', 'Class:Licence+' => '', 'Class:Licence/Attribute:name' => 'Název', @@ -991,13 +990,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => '', 'Class:Licence/Attribute:finalclass' => 'Typ', 'Class:Licence/Attribute:finalclass+' => '', -)); +]); // // Class: OSLicence // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:OSLicence' => 'Licence OS', 'Class:OSLicence+' => '', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1009,13 +1008,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'Všechny virtuální stroje (VM), kde je tato licence použita', 'Class:OSLicence/Attribute:servers_list' => 'Servery', 'Class:OSLicence/Attribute:servers_list+' => 'Všechny servery, kde je tato licence použita', -)); +]); // // Class: SoftwareLicence // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:SoftwareLicence' => 'Licence softwaru', 'Class:SoftwareLicence+' => '', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1025,13 +1024,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:SoftwareLicence/Attribute:software_name+' => '', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Instance softwaru', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'Všechny systémy, kde je tato licence použita', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkDocumentToLicence' => 'Spojení (Dokument / Licence)', 'Class:lnkDocumentToLicence+' => '', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s~~', @@ -1043,35 +1042,35 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Název dokumentu', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '', -)); +]); // // Class: OSVersion // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:OSVersion' => 'Verze OS', 'Class:OSVersion+' => '', 'Class:OSVersion/Attribute:osfamily_id' => 'Rodina OS', 'Class:OSVersion/Attribute:osfamily_id+' => '', 'Class:OSVersion/Attribute:osfamily_name' => 'Název rodiny OS', 'Class:OSVersion/Attribute:osfamily_name+' => '', -)); +]); // // Class: OSFamily // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:OSFamily' => 'Rodina OS', 'Class:OSFamily+' => '', -)); +]); // // Class: Brand // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Brand' => 'Výrobce', 'Class:Brand+' => '', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1080,13 +1079,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'Všechna fyzická zařízení odpovídající této značce', 'Class:Brand/UniquenessRule:name+' => 'Jméno značky musí být unikátní', 'Class:Brand/UniquenessRule:name' => 'Tato značka již existuje', -)); +]); // // Class: Model // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Model' => 'Model', 'Class:Model+' => '', 'Class:Model/ComplementaryName' => '%1$s - %2$s~~', @@ -1138,37 +1137,37 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Model/Attribute:physicaldevices_list+' => 'Všechna fyzická zařízení odpovídající tomuto modelu', 'Class:Model/UniquenessRule:name_brand+' => 'Name must be unique in the brand~~', 'Class:Model/UniquenessRule:name_brand' => 'this model already exists for this brand~~', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:NetworkDeviceType' => 'Typ síťového zařízení', 'Class:NetworkDeviceType+' => '', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Síťová zařízení', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'Všechna síťová zařízení odpovídající tomuto typu', -)); +]); // // Class: IOSVersion // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:IOSVersion' => 'Verze IOS', 'Class:IOSVersion+' => '', 'Class:IOSVersion/Attribute:brand_id' => 'Výrobce', 'Class:IOSVersion/Attribute:brand_id+' => '', 'Class:IOSVersion/Attribute:brand_name' => 'Název výrobce', 'Class:IOSVersion/Attribute:brand_name+' => '', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkDocumentToPatch' => 'Spojení (Dokument / Záplata (patch))', 'Class:lnkDocumentToPatch+' => '', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s~~', @@ -1180,13 +1179,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Název dokumentu', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Spojení (Instance softwaru / Záplata (patch) softwaru)', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s~~', @@ -1198,13 +1197,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Název instance softwaru', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkFunctionalCIToOSPatch' => 'Spojení (Funkční konfigurační položka / Záplata (patch) OS)', 'Class:lnkFunctionalCIToOSPatch+' => '', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s~~', @@ -1216,13 +1215,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'Název funkční konfigurační položky', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkDocumentToSoftware' => 'Spojení (Dokument / Software)', 'Class:lnkDocumentToSoftware+' => '', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s~~', @@ -1234,13 +1233,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Název dokumentu', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '', -)); +]); // // Class: Subnet // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Subnet' => 'Podsíť (subnet)', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s~~', @@ -1259,13 +1258,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLAN', 'Class:Subnet/Attribute:vlans_list+' => '', -)); +]); // // Class: VLAN // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:VLAN' => 'VLAN', 'Class:VLAN+' => '', 'Class:VLAN/Attribute:vlan_tag' => 'VLAN Tag', @@ -1280,13 +1279,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:VLAN/Attribute:subnets_list+' => '', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Fyzická síťová rozhraní', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkSubnetToVLAN' => 'Spojení (Podsíť (subnet) / VLAN)', 'Class:lnkSubnetToVLAN+' => '', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s', @@ -1300,26 +1299,26 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '', -)); +]); // // Class: NetworkInterface // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:NetworkInterface' => 'Síťové rozhraní', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'Název', 'Class:NetworkInterface/Attribute:name+' => '', 'Class:NetworkInterface/Attribute:finalclass' => 'Typ', 'Class:NetworkInterface/Attribute:finalclass+' => '', -)); +]); // // Class: IPInterface // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:IPInterface' => 'IP rozhraní', 'Class:IPInterface+' => '', 'Class:IPInterface/Attribute:ipaddress' => 'IP adresa', @@ -1334,13 +1333,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:IPInterface/Attribute:ipmask+' => '', 'Class:IPInterface/Attribute:speed' => 'Rychlost', 'Class:IPInterface/Attribute:speed+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:PhysicalInterface' => 'Fyzické rozhraní', 'Class:PhysicalInterface+' => '', 'Class:PhysicalInterface/Name' => '%2$s %1$s', @@ -1350,13 +1349,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLAN', 'Class:PhysicalInterface/Attribute:vlans_list+' => '', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Spojení (Fyzické rozhraní / VLAN)', 'Class:lnkPhysicalInterfaceToVLAN+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s~~', @@ -1372,27 +1371,26 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '', -)); - +]); // // Class: LogicalInterface // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:LogicalInterface' => 'Logické rozhraní', 'Class:LogicalInterface+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Virtuální stroj (VM)', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Název virtuálního stroje (VM)', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:FiberChannelInterface' => 'FC rozhraní', 'Class:FiberChannelInterface+' => '', 'Class:FiberChannelInterface/Attribute:speed' => 'Rychlost', @@ -1405,13 +1403,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Název zařízení', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Spojení (Připojitelná konfigurační položka / Síťový prvek)', 'Class:lnkConnectableCIToNetworkDevice+' => '', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s~~', @@ -1433,13 +1431,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'down link', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'up link', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'up link', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Spojení (Aplikační řešení / Funkční konfigurační položka)', 'Class:lnkApplicationSolutionToFunctionalCI+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1451,13 +1449,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'Název funkční konfigurační položky', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Spojení (Aplikační řešení / Obchodní proces)', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s~~', @@ -1469,13 +1467,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Název aplikačního řešení', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', -)); +]); // // Class: Group // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Group' => 'Skupina', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s', @@ -1505,13 +1503,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Group/Attribute:ci_list+' => 'Všechny konfigurační položky spojené s touto skupinou', 'Class:Group/Attribute:parent_id_friendlyname' => 'Nadřazená skupina', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkGroupToCI' => 'Spojení (Skupina / Konfigurační položka)', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s~~', @@ -1525,11 +1523,11 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Důvod', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Server:baseinfo' => 'Obecné informace', 'Server:Date' => 'Data', 'Server:moreinfo' => 'Více informací', @@ -1542,14 +1540,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Subnet/Tab:FreeIPs-count' => 'Počet volných adres: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Tady je výčet volných IP adres (10)', 'Class:Document:PreviewTab' => 'Náhled', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkDocumentToFunctionalCI' => 'Spojení (Dokument / Funkční konfigurační položka)', 'Class:lnkDocumentToFunctionalCI+' => '', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1561,13 +1558,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Název dokumentu', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '', -)); +]); // // Application Menu // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:Application' => 'Aplikace', 'Menu:Application+' => 'Všechny aplikace', 'Menu:DBServer' => 'Databázové servery', @@ -1612,15 +1609,15 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Menu:OSVersion+' => '', 'Menu:Software' => 'Katalog softwaru', 'Menu:Software+' => 'Katalog softwaru', -)); +]); // // Class: PhysicalInterface // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/da.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/da.dict.itop-config-mgmt.php index dc9b35d33..888320caa 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/da.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/da.dict.itop-config-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Relation:impacts/Description' => 'Elementer berørt af ...', 'Relation:impacts/DownStream' => 'Påvrikning ...', 'Relation:impacts/DownStream+' => 'Elements impacted by~~', @@ -22,8 +23,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Relation:impacts/LoadData' => 'Load data~~', 'Relation:impacts/NoFilteredData' => 'please select objects and load data~~', 'Relation:impacts/FilteredData' => 'Filtered data~~', -)); - +]); // Dictionnay conventions // Class: @@ -66,7 +66,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( // Class: lnkContactToFunctionalCI // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkContactToFunctionalCI' => 'Sammenhæng Kontakt/FunctionalCI', 'Class:lnkContactToFunctionalCI+' => '', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -78,13 +78,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Kontakt navn', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:FunctionalCI' => 'Funktionelle CI', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => 'Navn', @@ -117,13 +117,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:FunctionalCI/Attribute:finalclass+' => '', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Active Tickets~~', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Active Tickets which are impacting this functional CI~~', -)); +]); // // Class: PhysicalDevice // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:PhysicalDevice' => 'Fysiske enheder', 'Class:PhysicalDevice+' => '', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -157,13 +157,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Udløb garanti', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '', -)); +]); // // Class: Rack // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Rack' => 'Rack', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s~~', @@ -173,64 +173,64 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Rack/Attribute:device_list+' => 'All the physical devices racked into this rack~~', 'Class:Rack/Attribute:enclosure_list' => 'Enclosures', 'Class:Rack/Attribute:enclosure_list+' => 'All the enclosures in this rack~~', -)); +]); // // Class: TelephonyCI // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TelephonyCI' => 'Telefoni CI', 'Class:TelephonyCI+' => '', 'Class:TelephonyCI/Attribute:phonenumber' => 'Telefonnummer', 'Class:TelephonyCI/Attribute:phonenumber+' => '', -)); +]); // // Class: Phone // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Phone' => 'Telefon', 'Class:Phone+' => '', -)); +]); // // Class: MobilePhone // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:MobilePhone' => 'Mobiltelefon', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'Hardware PIN', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:IPPhone' => 'IP-Telefon', 'Class:IPPhone+' => '', -)); +]); // // Class: Tablet // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Tablet' => 'Tablet', 'Class:Tablet+' => '', -)); +]); // // Class: ConnectableCI // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ConnectableCI' => 'Forbindbare CI', 'Class:ConnectableCI+' => 'Fysiske CI', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s~~', @@ -238,13 +238,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'All network devices connected to this device~~', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Netværks interfaces', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'All the physical network interfaces~~', -)); +]); // // Class: DatacenterDevice // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:DatacenterDevice' => 'Datacenterenhed', 'Class:DatacenterDevice+' => '', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -276,13 +276,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'The device %2$s is up if at least one power connection (A or B) is up~~', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'The device %2$s is up if all its power connections are up~~', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'The device %2$s is up if at least %1$s %% of its power connections are up~~', -)); +]); // // Class: NetworkDevice // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:NetworkDevice' => 'Netværks enhed', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -298,13 +298,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Server' => 'Server', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s~~', @@ -326,61 +326,61 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => 'Logical Volumes', 'Class:Server/Attribute:logicalvolumes_list+' => 'All the logical volumes connected to this server~~', -)); +]); // // Class: StorageSystem // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:StorageSystem' => 'Storage-System', 'Class:StorageSystem+' => '', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s~~', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Logical Volumes', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'All the logical volumes in this storage system~~', -)); +]); // // Class: SANSwitch // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:SANSwitch' => 'SAN-Switch', 'Class:SANSwitch+' => '', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s~~', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Enhed', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'All the devices connected to this SAN switch~~', -)); +]); // // Class: TapeLibrary // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TapeLibrary' => 'Tape-Library', 'Class:TapeLibrary+' => '', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s~~', 'Class:TapeLibrary/Attribute:tapes_list' => 'Bånd', 'Class:TapeLibrary/Attribute:tapes_list+' => 'All the tapes in the tape library~~', -)); +]); // // Class: NAS // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '', 'Class:NAS/ComplementaryName' => '%1$s - %2$s~~', 'Class:NAS/Attribute:nasfilesystem_list' => 'NAS filsystem liste', 'Class:NAS/Attribute:nasfilesystem_list+' => 'All the file systems in this NAS~~', -)); +]); // // Class: PC // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:PC' => 'PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s~~', @@ -402,45 +402,45 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:PC/Attribute:type/Value:desktop+' => '', 'Class:PC/Attribute:type/Value:laptop' => 'Bærbar', 'Class:PC/Attribute:type/Value:laptop+' => '', -)); +]); // // Class: Printer // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Printer' => 'Printer', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerConnection // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:PowerConnection' => 'Strømtilslutning', 'Class:PowerConnection+' => '', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerSource // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:PowerSource' => 'Strømkilde', 'Class:PowerSource+' => '', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s~~', 'Class:PowerSource/Attribute:pdus_list' => 'PDUs', 'Class:PowerSource/Attribute:pdus_list+' => 'All the PDUs using this power source~~', -)); +]); // // Class: PDU // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s~~', @@ -452,23 +452,23 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:PDU/Attribute:powerstart_id+' => '', 'Class:PDU/Attribute:powerstart_name' => 'Power start navn', 'Class:PDU/Attribute:powerstart_name+' => '', -)); +]); // // Class: Peripheral // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Peripheral' => 'Perifer enhed', 'Class:Peripheral+' => '', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: Enclosure // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Enclosure' => 'Enclosure', 'Class:Enclosure+' => '', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -480,13 +480,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Enclosure/Attribute:nb_u+' => '', 'Class:Enclosure/Attribute:device_list' => 'Enhed', 'Class:Enclosure/Attribute:device_list+' => 'All the devices in this enclosure~~', -)); +]); // // Class: ApplicationSolution // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ApplicationSolution' => 'Anvendelsområde', 'Class:ApplicationSolution+' => 'Hvilken applikations løsning anvendes den i?', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'CIs', @@ -503,13 +503,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'The solution is up if all CIs are up~~', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'The solution is up if at least %1$s CI(s) is(are) up~~', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'The solution is up if at least %1$s %% of the CIs are up~~', -)); +]); // // Class: BusinessProcess // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:BusinessProcess' => 'Forretningsproces', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Anvendelsområder', @@ -520,13 +520,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => '', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'Inaktiv', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => '', -)); +]); // // Class: SoftwareInstance // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:SoftwareInstance' => 'Software instans', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'System', @@ -549,64 +549,64 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => '', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'Inaktiv', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => '', -)); +]); // // Class: Middleware // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Middleware' => 'Middleware', 'Class:Middleware+' => '', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Middleware-Instans(er)', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'All the middleware instances provided by this middleware~~', -)); +]); // // Class: DBServer // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:DBServer' => 'DB Server', 'Class:DBServer+' => '', 'Class:DBServer/Attribute:dbschema_list' => 'DB Schema', 'Class:DBServer/Attribute:dbschema_list+' => 'All the database schemas for this DB server~~', -)); +]); // // Class: WebServer // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:WebServer' => 'Web Server', 'Class:WebServer+' => '', 'Class:WebServer/Attribute:webapp_list' => 'Web Applikationer', 'Class:WebServer/Attribute:webapp_list+' => 'All the web applications available on this web server~~', -)); +]); // // Class: PCSoftware // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:PCSoftware' => 'PC-Software', 'Class:PCSoftware+' => '', -)); +]); // // Class: OtherSoftware // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:OtherSoftware' => 'Andet Software', 'Class:OtherSoftware+' => '', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:MiddlewareInstance' => 'Middleware instans', 'Class:MiddlewareInstance+' => '', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s~~', @@ -614,13 +614,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Middleware navn', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '', -)); +]); // // Class: DatabaseSchema // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:DatabaseSchema' => 'Datenbase schema', 'Class:DatabaseSchema+' => '', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s~~', @@ -628,13 +628,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'DB servernavn', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '', -)); +]); // // Class: WebApplication // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:WebApplication' => 'Webapplikation', 'Class:WebApplication+' => '', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s~~', @@ -644,14 +644,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:WebApplication/Attribute:webserver_name+' => '', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '', -)); - +]); // // Class: VirtualDevice // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:VirtualDevice' => 'Virtuel enhed', 'Class:VirtualDevice+' => '', 'Class:VirtualDevice/Attribute:status' => 'Status', @@ -666,24 +665,24 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => '', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Logiske Volumes', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'All the logical volumes used by this device~~', -)); +]); // // Class: VirtualHost // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:VirtualHost' => 'Host', 'Class:VirtualHost+' => '', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Virtuelle Maskiner', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'All the virtual machines hosted by this host~~', -)); +]); // // Class: Hypervisor // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Hypervisor' => 'Hypervisor', 'Class:Hypervisor+' => '', 'Class:Hypervisor/Attribute:farm_id' => 'Farm', @@ -694,13 +693,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Hypervisor/Attribute:server_id+' => '', 'Class:Hypervisor/Attribute:server_name' => 'Servernavn', 'Class:Hypervisor/Attribute:server_name+' => '', -)); +]); // // Class: Farm // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Farm' => 'Farm', 'Class:Farm+' => '', 'Class:Farm/Attribute:hypervisor_list' => 'Hypervisorer', @@ -709,13 +708,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Farm/Attribute:redundancy/disabled' => 'The farm is up if all the hypervisors are up~~', 'Class:Farm/Attribute:redundancy/count' => 'The farm is up if at least %1$s hypervisor(s) is(are) up~~', 'Class:Farm/Attribute:redundancy/percent' => 'The farm is up if at least %1$s %% of the hypervisors are up~~', -)); +]); // // Class: VirtualMachine // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:VirtualMachine' => 'Virtuel Maskine', 'Class:VirtualMachine+' => '', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s~~', @@ -743,13 +742,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:VirtualMachine/Attribute:managementip+' => '~~', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Netværks interface', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'All the logical network interfaces~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:LogicalVolume' => 'Logical Volume', 'Class:LogicalVolume+' => '', 'Class:LogicalVolume/Attribute:name' => 'Navn', @@ -770,13 +769,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'All the servers using this volume~~', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Virtuelle enheder', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'All the virtual devices using this volume~~', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkServerToVolume' => 'Sammenhæng Server/Volume', 'Class:lnkServerToVolume+' => '', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s~~', @@ -790,13 +789,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '', 'Class:lnkServerToVolume/Attribute:size_used' => 'Størrelse anvendt', 'Class:lnkServerToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkVirtualDeviceToVolume' => 'Sammenhæng virtuel enhed/volume', 'Class:lnkVirtualDeviceToVolume+' => '', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s~~', @@ -810,13 +809,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Størrelse anvendt', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkSanToDatacenterDevice' => 'Sammenhæng SAN/Datacenterenhed', 'Class:lnkSanToDatacenterDevice+' => '', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s~~', @@ -832,13 +831,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'Enhed FC', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '', -)); +]); // // Class: Tape // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Tape' => 'Bånd', 'Class:Tape+' => '', 'Class:Tape/Attribute:name' => 'Navn', @@ -851,13 +850,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Tape/Attribute:tapelibrary_id+' => '', 'Class:Tape/Attribute:tapelibrary_name' => 'Tape Library navn', 'Class:Tape/Attribute:tapelibrary_name+' => '', -)); +]); // // Class: NASFileSystem // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:NASFileSystem' => 'NAS filsystem', 'Class:NASFileSystem+' => '', 'Class:NASFileSystem/Attribute:name' => 'Navn', @@ -872,13 +871,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:NASFileSystem/Attribute:nas_id+' => '', 'Class:NASFileSystem/Attribute:nas_name' => 'NAS navn', 'Class:NASFileSystem/Attribute:nas_name+' => '', -)); +]); // // Class: Software // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Software' => 'Software', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s~~', @@ -908,13 +907,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Software/Attribute:softwarepatch_list+' => 'All the patchs for this software~~', 'Class:Software/Attribute:softwarelicence_list' => 'Software Licenser', 'Class:Software/Attribute:softwarelicence_list+' => 'All the licenses for this software~~', -)); +]); // // Class: Patch // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Patch' => 'Patch', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => 'Navn', @@ -925,13 +924,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Type', 'Class:Patch/Attribute:finalclass+' => '', -)); +]); // // Class: OSPatch // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:OSPatch' => 'OS-Patch', 'Class:OSPatch+' => '', 'Class:OSPatch/Attribute:functionalcis_list' => 'Enhed', @@ -940,13 +939,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:OSPatch/Attribute:osversion_id+' => '', 'Class:OSPatch/Attribute:osversion_name' => 'OS versionsnavn', 'Class:OSPatch/Attribute:osversion_name+' => '', -)); +]); // // Class: SoftwarePatch // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:SoftwarePatch' => 'Software-Patch', 'Class:SoftwarePatch+' => '', 'Class:SoftwarePatch/Attribute:software_id' => 'Software', @@ -955,13 +954,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:SoftwarePatch/Attribute:software_name+' => '', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Software Instanser', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'All the systems where this software patch is installed~~', -)); +]); // // Class: Licence // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Licence' => 'Licens', 'Class:Licence+' => '', 'Class:Licence/Attribute:name' => 'Navn', @@ -990,13 +989,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => '', 'Class:Licence/Attribute:finalclass' => 'Type', 'Class:Licence/Attribute:finalclass+' => '', -)); +]); // // Class: OSLicence // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:OSLicence' => 'OS-Licens', 'Class:OSLicence+' => '', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1008,13 +1007,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'All the virtual machines where this license is used~~', 'Class:OSLicence/Attribute:servers_list' => 'Server', 'Class:OSLicence/Attribute:servers_list+' => 'All the servers where this license is used~~', -)); +]); // // Class: SoftwareLicence // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:SoftwareLicence' => 'Software-Licens', 'Class:SoftwareLicence+' => '', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1024,13 +1023,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:SoftwareLicence/Attribute:software_name+' => '', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Software Instanser', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'All the systems where this license is used~~', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkDocumentToLicence' => 'Sammenhæng Dokument/Licens', 'Class:lnkDocumentToLicence+' => '', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s~~', @@ -1042,35 +1041,35 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Dokumentnavn', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '', -)); +]); // // Class: OSVersion // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:OSVersion' => 'OS-Version', 'Class:OSVersion+' => '', 'Class:OSVersion/Attribute:osfamily_id' => 'OS-Familie', 'Class:OSVersion/Attribute:osfamily_id+' => '', 'Class:OSVersion/Attribute:osfamily_name' => 'OS familienavn', 'Class:OSVersion/Attribute:osfamily_name+' => '', -)); +]); // // Class: OSFamily // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:OSFamily' => 'OS-Familie', 'Class:OSFamily+' => '', -)); +]); // // Class: Brand // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Brand' => 'Mærke', 'Class:Brand+' => '', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1079,13 +1078,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'All the physical devices corresponding to this brand~~', 'Class:Brand/UniquenessRule:name+' => 'The name must be unique~~', 'Class:Brand/UniquenessRule:name' => 'This brand already exists~~', -)); +]); // // Class: Model // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Model' => 'Model', 'Class:Model+' => '', 'Class:Model/ComplementaryName' => '%1$s - %2$s~~', @@ -1137,37 +1136,37 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Model/Attribute:physicaldevices_list+' => 'All the physical devices corresponding to this model~~', 'Class:Model/UniquenessRule:name_brand+' => 'Name must be unique in the brand~~', 'Class:Model/UniquenessRule:name_brand' => 'this model already exists for this brand~~', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:NetworkDeviceType' => 'Netværksenhed type', 'Class:NetworkDeviceType+' => '', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Netværks enheder', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'All the network devices corresponding to this type~~', -)); +]); // // Class: IOSVersion // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:IOSVersion' => 'IOS-Version', 'Class:IOSVersion+' => '', 'Class:IOSVersion/Attribute:brand_id' => 'Mærke', 'Class:IOSVersion/Attribute:brand_id+' => '', 'Class:IOSVersion/Attribute:brand_name' => 'Mærkenavn', 'Class:IOSVersion/Attribute:brand_name+' => '', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkDocumentToPatch' => 'Sammenhæng Dokument/Patch', 'Class:lnkDocumentToPatch+' => '', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s~~', @@ -1179,13 +1178,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Dokumentnavn', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Sammenhæng Software-Instans/Softeware-Patch', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s~~', @@ -1197,13 +1196,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Software Instans navn', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkFunctionalCIToOSPatch' => 'Sammenhæng FunctionalCI/OS-Patch', 'Class:lnkFunctionalCIToOSPatch+' => '', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s~~', @@ -1215,13 +1214,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'FunctionalCI navn', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkDocumentToSoftware' => 'Sammenhæng Dokument/Software', 'Class:lnkDocumentToSoftware+' => '', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s~~', @@ -1233,13 +1232,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Dokumentnavn', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '', -)); +]); // // Class: Subnet // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Subnet' => 'Subnet', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s~~', @@ -1258,13 +1257,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLANs~~', 'Class:Subnet/Attribute:vlans_list+' => '~~', -)); +]); // // Class: VLAN // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:VLAN' => 'VLAN~~', 'Class:VLAN+' => '~~', 'Class:VLAN/Attribute:vlan_tag' => 'VLAN Tag~~', @@ -1279,13 +1278,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:VLAN/Attribute:subnets_list+' => '~~', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Physical network interfaces~~', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '~~', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkSubnetToVLAN' => 'Link Subnet / VLAN~~', 'Class:lnkSubnetToVLAN+' => '~~', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s~~', @@ -1299,26 +1298,26 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '~~', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'VLAN Tag~~', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '~~', -)); +]); // // Class: NetworkInterface // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:NetworkInterface' => 'Netværks interface', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'Navn', 'Class:NetworkInterface/Attribute:name+' => '', 'Class:NetworkInterface/Attribute:finalclass' => 'Type', 'Class:NetworkInterface/Attribute:finalclass+' => '', -)); +]); // // Class: IPInterface // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:IPInterface' => 'IP-Interface', 'Class:IPInterface+' => '', 'Class:IPInterface/Attribute:ipaddress' => 'IP Adresse', @@ -1333,13 +1332,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:IPInterface/Attribute:ipmask+' => '', 'Class:IPInterface/Attribute:speed' => 'Hastighed', 'Class:IPInterface/Attribute:speed+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:PhysicalInterface' => 'Fysiske interface', 'Class:PhysicalInterface+' => '', 'Class:PhysicalInterface/Name' => '%2$s %1$s~~', @@ -1349,13 +1348,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLANs~~', 'Class:PhysicalInterface/Attribute:vlans_list+' => '~~', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Link PhysicalInterface / VLAN~~', 'Class:lnkPhysicalInterfaceToVLAN+' => '~~', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s~~', @@ -1371,27 +1370,26 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '~~', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'VLAN Tag~~', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '~~', -)); - +]); // // Class: LogicalInterface // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:LogicalInterface' => 'Logiske interface', 'Class:LogicalInterface+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Virtuel maskine', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Virtuel maskinnavn', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:FiberChannelInterface' => 'Fiber Channel Interface', 'Class:FiberChannelInterface+' => '', 'Class:FiberChannelInterface/Attribute:speed' => 'Hastighed', @@ -1404,13 +1402,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Enhedsnavn', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Sammenhæng ConnectableCI/NetworkDevice', 'Class:lnkConnectableCIToNetworkDevice+' => '', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s~~', @@ -1432,13 +1430,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => '', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'Uplink', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => '', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Sammenhæng Applikationssuite/FunctionalCI', 'Class:lnkApplicationSolutionToFunctionalCI+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1450,13 +1448,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'FunctionalCI navn', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Sammenhæng Applikationssuite/Forretningsproces', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s~~', @@ -1468,13 +1466,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Applikations løsning navn', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', -)); +]); // // Class: Group // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Group' => 'Gruppe', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s~~', @@ -1504,13 +1502,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Group/Attribute:ci_list+' => 'All the configuration items linked to this group~~', 'Class:Group/Attribute:parent_id_friendlyname' => 'Parent Gruppe', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkGroupToCI' => 'Gruppe/CI', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s~~', @@ -1524,11 +1522,11 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Årsag', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Server:baseinfo' => 'Almindelig Informationen', 'Server:Date' => 'Dato', 'Server:moreinfo' => 'Yderligere Information', @@ -1541,14 +1539,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Subnet/Tab:FreeIPs-count' => 'Ledige IP: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Her er et udtræk af 10 ledige IP adresser', 'Class:Document:PreviewTab' => 'Preview~~', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkDocumentToFunctionalCI' => 'Sammenhæng Dokument/FunctionalCI', 'Class:lnkDocumentToFunctionalCI+' => '', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1560,13 +1557,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Dokument navn', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '', -)); +]); // // Application Menu // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:Application' => 'Anvendelse', 'Menu:Application+' => 'Alle Anvendelser', 'Menu:DBServer' => 'Database server', @@ -1611,15 +1608,15 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Menu:OSVersion+' => '~~', 'Menu:Software' => 'Software Katalog', 'Menu:Software+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/de.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/de.dict.itop-config-mgmt.php index 54e16a1c3..4f930e8aa 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/de.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/de.dict.itop-config-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Relation:impacts/Description' => 'Elemente betroffen von', 'Relation:impacts/DownStream' => 'Auswirkung ...', 'Relation:impacts/DownStream+' => 'Elemente betroffen von', @@ -22,8 +23,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Relation:impacts/LoadData' => 'Daten laden', 'Relation:impacts/NoFilteredData' => 'Bitte wählen Sie Objekte', 'Relation:impacts/FilteredData' => 'Daten sind über den Tab "Grafische Ansicht" gefiltert', -)); - +]); // Dictionnay conventions // Class: @@ -66,7 +66,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( // Class: lnkContactToFunctionalCI // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkContactToFunctionalCI' => 'Verknüpfung Kontakt/FunctionalCI', 'Class:lnkContactToFunctionalCI+' => '', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s', @@ -78,13 +78,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Kontakt-Name', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:FunctionalCI' => 'Funktionales CI', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => 'Name', @@ -117,13 +117,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:FunctionalCI/Attribute:finalclass+' => 'Name der instanziierbaren Klasse', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Offene Tickets', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Offene Tickets, die sich auf dieses CI auswirken', -)); +]); // // Class: PhysicalDevice // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:PhysicalDevice' => 'Physisches Gerät', 'Class:PhysicalDevice+' => '', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s', @@ -157,13 +157,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Garantieende', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '', -)); +]); // // Class: Rack // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Rack' => 'Rack', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s', @@ -173,64 +173,64 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Rack/Attribute:device_list+' => 'Alle physischen Geräte, die in dieses Rack eingebaut sind', 'Class:Rack/Attribute:enclosure_list' => 'Enclosures', 'Class:Rack/Attribute:enclosure_list+' => 'Alle Enclosures in diesem Rack', -)); +]); // // Class: TelephonyCI // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TelephonyCI' => 'Telefonie-CI', 'Class:TelephonyCI+' => '', 'Class:TelephonyCI/Attribute:phonenumber' => 'Telefonnummer', 'Class:TelephonyCI/Attribute:phonenumber+' => '', -)); +]); // // Class: Phone // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Phone' => 'Telefon', 'Class:Phone+' => '', -)); +]); // // Class: MobilePhone // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:MobilePhone' => 'Mobiltelefon', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'Hardware-PIN', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:IPPhone' => 'IP-Telefon', 'Class:IPPhone+' => '', -)); +]); // // Class: Tablet // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Tablet' => 'Tablet', 'Class:Tablet+' => '', -)); +]); // // Class: ConnectableCI // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ConnectableCI' => 'Verknüpfbares CI', 'Class:ConnectableCI+' => 'Physisches CI', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s', @@ -238,13 +238,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'Alle Netzwerkgeräte, die mit diesem Gerät verbunden sind', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Netzwerkinterfaces', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'Alle physischen Netzwerkinterfaces des Geräts', -)); +]); // // Class: DatacenterDevice // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:DatacenterDevice' => 'Datacenter-Gerät', 'Class:DatacenterDevice+' => '', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s', @@ -276,13 +276,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'Das Gerät läuft, wenn mindestens eine der Stromversorgungen (A oder B) läuft.', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'Das Gerät läuft, wenn alle seine Stromversorgungen laufen.', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'Das Gerät läuft, wenn mindestens %1$s %% seiner Stromversorgungen laufen.', -)); +]); // // Class: NetworkDevice // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:NetworkDevice' => 'Netzwerk-Gerät', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s', @@ -298,13 +298,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Server' => 'Server', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s', @@ -326,61 +326,61 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => 'Logische Volumes', 'Class:Server/Attribute:logicalvolumes_list+' => 'Alle mit diesem Server verbundenen logischen Volumes', -)); +]); // // Class: StorageSystem // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:StorageSystem' => 'Storage-System', 'Class:StorageSystem+' => '', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Logische Volumes', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'Alle logischen Volumes in diesem Storage-System', -)); +]); // // Class: SANSwitch // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:SANSwitch' => 'SAN-Switch', 'Class:SANSwitch+' => '', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Geräte', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'Alle Geräte, die mit diesem SAN-Switche verbundenen sind', -)); +]); // // Class: TapeLibrary // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TapeLibrary' => 'Tape-Library', 'Class:TapeLibrary+' => '', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s', 'Class:TapeLibrary/Attribute:tapes_list' => 'Tapes', 'Class:TapeLibrary/Attribute:tapes_list+' => 'Alle Tapes in der Tape-Library', -)); +]); // // Class: NAS // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '', 'Class:NAS/ComplementaryName' => '%1$s - %2$s', 'Class:NAS/Attribute:nasfilesystem_list' => 'Dateisysteme', 'Class:NAS/Attribute:nasfilesystem_list+' => 'Alle Dateisysteme in diesem NAS', -)); +]); // // Class: PC // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:PC' => 'PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s', @@ -402,45 +402,45 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:PC/Attribute:type/Value:desktop+' => 'Desktop', 'Class:PC/Attribute:type/Value:laptop' => 'Laptop', 'Class:PC/Attribute:type/Value:laptop+' => 'Laptop', -)); +]); // // Class: Printer // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Printer' => 'Drucker', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerConnection // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:PowerConnection' => 'Stromverbindung', 'Class:PowerConnection+' => '', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerSource // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:PowerSource' => 'Stromquelle', 'Class:PowerSource+' => '', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s', 'Class:PowerSource/Attribute:pdus_list' => 'PDUs', 'Class:PowerSource/Attribute:pdus_list+' => 'Alle PDUs, die diese Stromquelle nutzen', -)); +]); // // Class: PDU // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s', @@ -452,23 +452,23 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:PDU/Attribute:powerstart_id+' => '', 'Class:PDU/Attribute:powerstart_name' => 'Eingangs-Stromverbindung', 'Class:PDU/Attribute:powerstart_name+' => '', -)); +]); // // Class: Peripheral // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Peripheral' => 'Peripheriegerät', 'Class:Peripheral+' => '', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: Enclosure // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Enclosure' => 'Enclosure', 'Class:Enclosure+' => '', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -480,13 +480,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Enclosure/Attribute:nb_u+' => '', 'Class:Enclosure/Attribute:device_list' => 'Geräte', 'Class:Enclosure/Attribute:device_list+' => 'Alle Geräte in diesem Enclosure', -)); +]); // // Class: ApplicationSolution // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ApplicationSolution' => 'Anwendungslösung', 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'CIs', @@ -503,13 +503,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'Die Lösung läuft, wenn alle ihre CIs laufen.', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'Die Lösung läuft, wenn mindestens %1$s CI(s) laufen.', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'Die Lösung läuft, wenn mindestens %1$s %% der CIs laufen.', -)); +]); // // Class: BusinessProcess // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:BusinessProcess' => 'Business-Prozess', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Anwendungslösungen', @@ -520,13 +520,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => '', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'inaktiv', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => '', -)); +]); // // Class: SoftwareInstance // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:SoftwareInstance' => 'Software-Instanz', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'System', @@ -549,64 +549,64 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => '', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'Inaktiv', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => '', -)); +]); // // Class: Middleware // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Middleware' => 'Middleware', 'Class:Middleware+' => '', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Middleware-Instanzen', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'Alle Middleware-Instanzen, die von dieser Middleware bereitgestellt werden', -)); +]); // // Class: DBServer // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:DBServer' => 'DB Server', 'Class:DBServer+' => '', 'Class:DBServer/Attribute:dbschema_list' => 'DB Schemata', 'Class:DBServer/Attribute:dbschema_list+' => 'Alle Datenbankschemata für diesen DB-Server', -)); +]); // // Class: WebServer // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:WebServer' => 'Web Server', 'Class:WebServer+' => '', 'Class:WebServer/Attribute:webapp_list' => 'Webapplikationen', 'Class:WebServer/Attribute:webapp_list+' => 'Alle auf diesem Webserver verfügbaren Webanwendungen', -)); +]); // // Class: PCSoftware // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:PCSoftware' => 'PC-Software', 'Class:PCSoftware+' => '', -)); +]); // // Class: OtherSoftware // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:OtherSoftware' => 'Andere Software', 'Class:OtherSoftware+' => '', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:MiddlewareInstance' => 'Middleware-Instanz', 'Class:MiddlewareInstance+' => '', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s', @@ -614,13 +614,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Middleware-Name', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '', -)); +]); // // Class: DatabaseSchema // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:DatabaseSchema' => 'Datenbank-Schema', 'Class:DatabaseSchema+' => '', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s', @@ -628,13 +628,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'DB-Servername', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '', -)); +]); // // Class: WebApplication // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:WebApplication' => 'Webapplikation', 'Class:WebApplication+' => '', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s', @@ -644,14 +644,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:WebApplication/Attribute:webserver_name+' => '', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '', -)); - +]); // // Class: VirtualDevice // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:VirtualDevice' => 'Virtuelles Gerät', 'Class:VirtualDevice+' => '', 'Class:VirtualDevice/Attribute:status' => 'Status', @@ -666,24 +665,24 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => '', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Logische Volumes', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'Alle von diesem Gerät verwendeten logischen Volumes', -)); +]); // // Class: VirtualHost // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:VirtualHost' => 'Host', 'Class:VirtualHost+' => '', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Virtuelle Maschinen', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'Alle virtuellen Maschinen, die von diesem Host gehostet werden', -)); +]); // // Class: Hypervisor // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Hypervisor' => 'Hypervisor', 'Class:Hypervisor+' => '', 'Class:Hypervisor/Attribute:farm_id' => 'Farm', @@ -694,13 +693,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Hypervisor/Attribute:server_id+' => '', 'Class:Hypervisor/Attribute:server_name' => 'Servername', 'Class:Hypervisor/Attribute:server_name+' => '', -)); +]); // // Class: Farm // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Farm' => 'Farm', 'Class:Farm+' => '', 'Class:Farm/Attribute:hypervisor_list' => 'Hypervisoren', @@ -709,13 +708,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Farm/Attribute:redundancy/disabled' => 'Die Farm läuft, wenn alle Hypervisoren laufen.', 'Class:Farm/Attribute:redundancy/count' => 'Die Farm läuft, wenn mindestens %1$s Hypervisor(en) läuft/laufen.', 'Class:Farm/Attribute:redundancy/percent' => 'Die Farm läuft, wenn mindestens %1$s %% der Hypervisoren laufen.', -)); +]); // // Class: VirtualMachine // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:VirtualMachine' => 'Virtuelle Maschine', 'Class:VirtualMachine+' => '', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s', @@ -743,13 +742,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:VirtualMachine/Attribute:managementip+' => '', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Netzwerk-Interfaces', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'Alle logischen Netzwerk-Interfaces', -)); +]); // // Class: LogicalVolume // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:LogicalVolume' => 'Logisches Volume', 'Class:LogicalVolume+' => '', 'Class:LogicalVolume/Attribute:name' => 'Name', @@ -770,13 +769,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'Alle Server, die dieses Volume verwenden', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Virtuelle Geräte', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'Alle virtuellen Maschinen, die dieses Volume verwenden', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkServerToVolume' => 'Verknüpfung Server/Volume', 'Class:lnkServerToVolume+' => '', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s', @@ -790,13 +789,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '', 'Class:lnkServerToVolume/Attribute:size_used' => 'Größe verwendet', 'Class:lnkServerToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkVirtualDeviceToVolume' => 'Verknüpfung Virtuelles Gerät/Volume', 'Class:lnkVirtualDeviceToVolume+' => '', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s', @@ -810,13 +809,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Größe verwendet', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkSanToDatacenterDevice' => 'Verknüpfung SAN/Datacenter-Gerät', 'Class:lnkSanToDatacenterDevice+' => '', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s', @@ -832,13 +831,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'Gerät FC', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '', -)); +]); // // Class: Tape // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Tape' => 'Tape', 'Class:Tape+' => '', 'Class:Tape/Attribute:name' => 'Name', @@ -851,13 +850,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Tape/Attribute:tapelibrary_id+' => '', 'Class:Tape/Attribute:tapelibrary_name' => 'Tape-Library-Name', 'Class:Tape/Attribute:tapelibrary_name+' => '', -)); +]); // // Class: NASFileSystem // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:NASFileSystem' => 'NAS-Dateisystem', 'Class:NASFileSystem+' => '', 'Class:NASFileSystem/Attribute:name' => 'Name', @@ -872,13 +871,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:NASFileSystem/Attribute:nas_id+' => '', 'Class:NASFileSystem/Attribute:nas_name' => 'NAS-Name', 'Class:NASFileSystem/Attribute:nas_name+' => '', -)); +]); // // Class: Software // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Software' => 'Software', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s', @@ -908,13 +907,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Software/Attribute:softwarepatch_list+' => 'Alle Software-Patches für diese Software', 'Class:Software/Attribute:softwarelicence_list' => 'Softwarelizenzen', 'Class:Software/Attribute:softwarelicence_list+' => 'Alle Lizenzen für diese Software', -)); +]); // // Class: Patch // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Patch' => 'Patch', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => 'Name', @@ -925,13 +924,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Typ', 'Class:Patch/Attribute:finalclass+' => '', -)); +]); // // Class: OSPatch // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:OSPatch' => 'OS-Patch', 'Class:OSPatch+' => '', 'Class:OSPatch/Attribute:functionalcis_list' => 'Geräte', @@ -940,13 +939,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:OSPatch/Attribute:osversion_id+' => '', 'Class:OSPatch/Attribute:osversion_name' => 'OS-Versionsname', 'Class:OSPatch/Attribute:osversion_name+' => '', -)); +]); // // Class: SoftwarePatch // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:SoftwarePatch' => 'Software-Patch', 'Class:SoftwarePatch+' => '', 'Class:SoftwarePatch/Attribute:software_id' => 'Software', @@ -955,13 +954,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:SoftwarePatch/Attribute:software_name+' => '', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Software-Instanzen', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'Alle Systeme, auf denen dieser Software-Patch installiert ist', -)); +]); // // Class: Licence // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Licence' => 'Lizenz', 'Class:Licence+' => '', 'Class:Licence/Attribute:name' => 'Name', @@ -990,13 +989,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => 'ja', 'Class:Licence/Attribute:finalclass' => 'Typ', 'Class:Licence/Attribute:finalclass+' => 'Name der instanziierbaren Klasse', -)); +]); // // Class: OSLicence // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:OSLicence' => 'OS-Lizenz', 'Class:OSLicence+' => '', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s', @@ -1008,13 +1007,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'Alle virtuellen Maschinen, auf denen diese Lizenz verwendet wird', 'Class:OSLicence/Attribute:servers_list' => 'Server', 'Class:OSLicence/Attribute:servers_list+' => 'Alle Server, auf denen diese Lizenz verwendet wird', -)); +]); // // Class: SoftwareLicence // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:SoftwareLicence' => 'Software-Lizenz', 'Class:SoftwareLicence+' => '', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s', @@ -1024,13 +1023,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:SoftwareLicence/Attribute:software_name+' => '', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Software-Instanzen', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'Alle Systeme, in denen diese Lizenz verwendet wird', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkDocumentToLicence' => 'Verknüpfung Dokument/Lizenz', 'Class:lnkDocumentToLicence+' => '', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s', @@ -1042,35 +1041,35 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Dokumenten-Name', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '', -)); +]); // // Class: OSVersion // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:OSVersion' => 'OS-Version', 'Class:OSVersion+' => '', 'Class:OSVersion/Attribute:osfamily_id' => 'OS-Familie', 'Class:OSVersion/Attribute:osfamily_id+' => '', 'Class:OSVersion/Attribute:osfamily_name' => 'OS-Familienname', 'Class:OSVersion/Attribute:osfamily_name+' => '', -)); +]); // // Class: OSFamily // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:OSFamily' => 'OS-Familie', 'Class:OSFamily+' => '', -)); +]); // // Class: Brand // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Brand' => 'Marke', 'Class:Brand+' => '', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1079,13 +1078,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'Alle physischen Geräte dieser Marke', 'Class:Brand/UniquenessRule:name+' => 'Der Name muss eindeutig sein', 'Class:Brand/UniquenessRule:name' => 'Diese Marke existiert bereits', -)); +]); // // Class: Model // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Model' => 'Modell', 'Class:Model+' => '', 'Class:Model/ComplementaryName' => '%1$s - %2$s', @@ -1137,37 +1136,37 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Model/Attribute:physicaldevices_list+' => 'Alle physischen Geräte, die diesem Modell entsprechen', 'Class:Model/UniquenessRule:name_brand+' => 'Der Modellname für eine Marke muss eindeutig sein', 'Class:Model/UniquenessRule:name_brand' => 'Es existiert bereits ein Modell mit diesem Namen für diese Marke', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:NetworkDeviceType' => 'Netzwerkgerätetyp', 'Class:NetworkDeviceType+' => '', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Netzwerkgeräte', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'Alle Netzwerkgeräte, die diesem Typ entsprechen', -)); +]); // // Class: IOSVersion // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:IOSVersion' => 'IOS-Version', 'Class:IOSVersion+' => '', 'Class:IOSVersion/Attribute:brand_id' => 'Marke', 'Class:IOSVersion/Attribute:brand_id+' => '', 'Class:IOSVersion/Attribute:brand_name' => 'Markenname', 'Class:IOSVersion/Attribute:brand_name+' => '', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkDocumentToPatch' => 'Verknüpfung Dokument/Patch', 'Class:lnkDocumentToPatch+' => '', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s', @@ -1179,13 +1178,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Dokument-Name', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Verknüpfung Software-Instanz/Softeware-Patch', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s', @@ -1197,13 +1196,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Software-Instanz-Name', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkFunctionalCIToOSPatch' => 'Verknüpfung FunctionalCI/OS-Patch', 'Class:lnkFunctionalCIToOSPatch+' => '', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s', @@ -1215,13 +1214,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'FunctionalCI-Name', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkDocumentToSoftware' => 'Verknüpfung Dokument/Software', 'Class:lnkDocumentToSoftware+' => '', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s', @@ -1233,13 +1232,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Dokument-Name', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '', -)); +]); // // Class: Subnet // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Subnet' => 'Subnetz', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s', @@ -1258,13 +1257,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLANs', 'Class:Subnet/Attribute:vlans_list+' => '', -)); +]); // // Class: VLAN // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:VLAN' => 'VLAN', 'Class:VLAN+' => '', 'Class:VLAN/Attribute:vlan_tag' => 'VLAN-Tag', @@ -1279,13 +1278,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:VLAN/Attribute:subnets_list+' => '', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Physische Interfaces', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkSubnetToVLAN' => 'Verknüpfung Subnetz/VLAN', 'Class:lnkSubnetToVLAN+' => '', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s', @@ -1299,26 +1298,26 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '', -)); +]); // // Class: NetworkInterface // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:NetworkInterface' => 'Netzwerk-Interface', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'Name', 'Class:NetworkInterface/Attribute:name+' => '', 'Class:NetworkInterface/Attribute:finalclass' => 'Typ', 'Class:NetworkInterface/Attribute:finalclass+' => 'Name der instanziierbaren Klasse', -)); +]); // // Class: IPInterface // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:IPInterface' => 'IP-Interface', 'Class:IPInterface+' => '', 'Class:IPInterface/Attribute:ipaddress' => 'IP-Adresse', @@ -1333,13 +1332,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:IPInterface/Attribute:ipmask+' => '', 'Class:IPInterface/Attribute:speed' => 'Geschwindigkeit', 'Class:IPInterface/Attribute:speed+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:PhysicalInterface' => 'Physisches Interface', 'Class:PhysicalInterface+' => '', 'Class:PhysicalInterface/Name' => '%2$s %1$s', @@ -1349,13 +1348,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLANs', 'Class:PhysicalInterface/Attribute:vlans_list+' => '', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Verknüpfung Physisches Interface / VLAN', 'Class:lnkPhysicalInterfaceToVLAN+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s', @@ -1371,27 +1370,26 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '', -)); - +]); // // Class: LogicalInterface // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:LogicalInterface' => 'Logisches Interface', 'Class:LogicalInterface+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Virtuelle Maschine', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Virtuelle Maschine-Name', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:FiberChannelInterface' => 'Fiber Channel Interface', 'Class:FiberChannelInterface+' => '', 'Class:FiberChannelInterface/Attribute:speed' => 'Geschwindigkeit', @@ -1404,13 +1402,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Gerätename', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Verknüpfung ConnectableCI/NetworkDevice', 'Class:lnkConnectableCIToNetworkDevice+' => '', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s', @@ -1432,13 +1430,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => '', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'Uplink', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => '', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Verknüpfung Anwendungslösung/FunctionalCI', 'Class:lnkApplicationSolutionToFunctionalCI+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s', @@ -1450,13 +1448,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'FunctionalCI-Name', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Verknüpfung Anwendungslösung/Business-Prozess', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s', @@ -1468,13 +1466,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Anwendungslösung-Name', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', -)); +]); // // Class: Group // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Group' => 'Gruppe', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s', @@ -1504,13 +1502,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Group/Attribute:ci_list+' => 'Alle mit dieser Gruppe verknüpften CIs', 'Class:Group/Attribute:parent_id_friendlyname' => 'Parent-Gruppe', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkGroupToCI' => 'Gruppe/CI', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s', @@ -1524,11 +1522,11 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Grund', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Server:baseinfo' => 'Allgemeine Informationen', 'Server:Date' => 'Datum', 'Server:moreinfo' => 'Weitere Informationen', @@ -1541,14 +1539,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Subnet/Tab:FreeIPs-count' => 'Freie IPs: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Hier ist eine Auflistung von 10 freien IP Adressen', 'Class:Document:PreviewTab' => 'Vorschau', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkDocumentToFunctionalCI' => 'Verknüpfung Dokument/FunctionalCI', 'Class:lnkDocumentToFunctionalCI+' => '', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s', @@ -1560,13 +1557,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Dokument-Name', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '', -)); +]); // // Application Menu // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:Application' => 'Anwendungen', 'Menu:Application+' => 'Alle Anwendungen', 'Menu:DBServer' => 'Datenbank-Server', @@ -1611,15 +1608,15 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Menu:OSVersion+' => '', 'Menu:Software' => 'Software-Katalog', 'Menu:Software+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/en.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/en.dict.itop-config-mgmt.php index aac80aee8..70843b1f2 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/en.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/en.dict.itop-config-mgmt.php @@ -1,4 +1,5 @@ 'Elements impacted by', 'Relation:impacts/DownStream' => 'Impacts...', 'Relation:impacts/DownStream+' => 'Elements impacted by', @@ -39,8 +40,7 @@ Dict::Add('EN US', 'English', 'English', array( 'Relation:impacts/LoadData' => 'Load data', 'Relation:impacts/NoFilteredData' => 'please select objects and load data', 'Relation:impacts/FilteredData' => 'Filtered data', -)); - +]); // Dictionnay conventions // Class: @@ -83,7 +83,7 @@ Dict::Add('EN US', 'English', 'English', array( // Class: lnkContactToFunctionalCI // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkContactToFunctionalCI' => 'Link Contact / FunctionalCI', 'Class:lnkContactToFunctionalCI+' => '', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s', @@ -95,13 +95,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Contact name', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:FunctionalCI' => 'Functional CI', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => 'Name', @@ -134,13 +134,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:FunctionalCI/Attribute:finalclass+' => 'Name of the final class', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Active Tickets', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Active Tickets which are impacting this functional CI', -)); +]); // // Class: PhysicalDevice // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:PhysicalDevice' => 'Physical Device', 'Class:PhysicalDevice+' => '', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s', @@ -174,13 +174,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'End of warranty', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '', -)); +]); // // Class: Rack // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Rack' => 'Rack', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s', @@ -190,64 +190,64 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Rack/Attribute:device_list+' => 'All the physical devices racked into this rack', 'Class:Rack/Attribute:enclosure_list' => 'Enclosures', 'Class:Rack/Attribute:enclosure_list+' => 'All the enclosures in this rack', -)); +]); // // Class: TelephonyCI // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TelephonyCI' => 'Telephony CI', 'Class:TelephonyCI+' => '', 'Class:TelephonyCI/Attribute:phonenumber' => 'Phone number', 'Class:TelephonyCI/Attribute:phonenumber+' => '', -)); +]); // // Class: Phone // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Phone' => 'Phone', 'Class:Phone+' => '', -)); +]); // // Class: MobilePhone // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:MobilePhone' => 'Mobile Phone', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'Hardware PIN', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:IPPhone' => 'IP Phone', 'Class:IPPhone+' => '', -)); +]); // // Class: Tablet // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Tablet' => 'Tablet', 'Class:Tablet+' => '', -)); +]); // // Class: ConnectableCI // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ConnectableCI' => 'Connectable CI', 'Class:ConnectableCI+' => 'Physical CI', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s', @@ -255,13 +255,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'All network devices connected to this device', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Network interfaces', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'All the physical network interfaces', -)); +]); // // Class: DatacenterDevice // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:DatacenterDevice' => 'Datacenter Device', 'Class:DatacenterDevice+' => '', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s', @@ -294,13 +294,13 @@ Dict::Add('EN US', 'English', 'English', array( // Unused yet 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'The device %2$s is up if all its power connections are up', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'The device %2$s is up if at least %1$s %% of its power connections are up', -)); +]); // // Class: NetworkDevice // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:NetworkDevice' => 'Network Device', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s', @@ -316,13 +316,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Server' => 'Server', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s', @@ -344,61 +344,61 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => 'Logical volumes', 'Class:Server/Attribute:logicalvolumes_list+' => 'All the logical volumes connected to this server', -)); +]); // // Class: StorageSystem // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:StorageSystem' => 'Storage System', 'Class:StorageSystem+' => '', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Logical volumes', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'All the logical volumes in this storage system', -)); +]); // // Class: SANSwitch // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:SANSwitch' => 'SAN Switch', 'Class:SANSwitch+' => '', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Devices', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'All the devices connected to this SAN switch', -)); +]); // // Class: TapeLibrary // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TapeLibrary' => 'Tape Library', 'Class:TapeLibrary+' => '', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s', 'Class:TapeLibrary/Attribute:tapes_list' => 'Tapes', 'Class:TapeLibrary/Attribute:tapes_list+' => 'All the tapes in the tape library', -)); +]); // // Class: NAS // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '', 'Class:NAS/ComplementaryName' => '%1$s - %2$s', 'Class:NAS/Attribute:nasfilesystem_list' => 'Filesystems', 'Class:NAS/Attribute:nasfilesystem_list+' => 'All the file systems in this NAS', -)); +]); // // Class: PC // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:PC' => 'PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s', @@ -420,45 +420,45 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:PC/Attribute:type/Value:desktop+' => 'desktop', 'Class:PC/Attribute:type/Value:laptop' => 'laptop', 'Class:PC/Attribute:type/Value:laptop+' => 'laptop', -)); +]); // // Class: Printer // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Printer' => 'Printer', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerConnection // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:PowerConnection' => 'Power Connection', 'Class:PowerConnection+' => '', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerSource // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:PowerSource' => 'Power Source', 'Class:PowerSource+' => '', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s', 'Class:PowerSource/Attribute:pdus_list' => 'PDUs', 'Class:PowerSource/Attribute:pdus_list+' => 'All the PDUs using this power source', -)); +]); // // Class: PDU // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s', @@ -470,23 +470,23 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:PDU/Attribute:powerstart_id+' => '', 'Class:PDU/Attribute:powerstart_name' => 'Power start name', 'Class:PDU/Attribute:powerstart_name+' => '', -)); +]); // // Class: Peripheral // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Peripheral' => 'Peripheral', 'Class:Peripheral+' => '', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: Enclosure // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Enclosure' => 'Enclosure', 'Class:Enclosure+' => '', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -498,13 +498,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Enclosure/Attribute:nb_u+' => '', 'Class:Enclosure/Attribute:device_list' => 'Devices', 'Class:Enclosure/Attribute:device_list+' => 'All the devices in this enclosure', -)); +]); // // Class: ApplicationSolution // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ApplicationSolution' => 'Application Solution', 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'CIs', @@ -521,13 +521,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'The solution is up if all CIs are up', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'The solution is up if at least %1$s CI(s) is(are) up', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'The solution is up if at least %1$s %% of the CIs are up', -)); +]); // // Class: BusinessProcess // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:BusinessProcess' => 'Business Process', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Application solutions', @@ -538,13 +538,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => 'active', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'inactive', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => 'inactive', -)); +]); // // Class: SoftwareInstance // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:SoftwareInstance' => 'Software Instance', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'System', @@ -567,64 +567,64 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => 'active', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'inactive', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => 'inactive', -)); +]); // // Class: Middleware // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Middleware' => 'Middleware', 'Class:Middleware+' => '', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Middleware instances', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'All the middleware instances provided by this middleware', -)); +]); // // Class: DBServer // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:DBServer' => 'DB Server', 'Class:DBServer+' => '', 'Class:DBServer/Attribute:dbschema_list' => 'DB schemas', 'Class:DBServer/Attribute:dbschema_list+' => 'All the database schemas for this DB server', -)); +]); // // Class: WebServer // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:WebServer' => 'Web server', 'Class:WebServer+' => '', 'Class:WebServer/Attribute:webapp_list' => 'Web applications', 'Class:WebServer/Attribute:webapp_list+' => 'All the web applications available on this web server', -)); +]); // // Class: PCSoftware // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:PCSoftware' => 'PC Software', 'Class:PCSoftware+' => '', -)); +]); // // Class: OtherSoftware // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:OtherSoftware' => 'Other Software', 'Class:OtherSoftware+' => '', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:MiddlewareInstance' => 'Middleware Instance', 'Class:MiddlewareInstance+' => '', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s', @@ -632,13 +632,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Middleware name', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '', -)); +]); // // Class: DatabaseSchema // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:DatabaseSchema' => 'Database Schema', 'Class:DatabaseSchema+' => '', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s', @@ -646,13 +646,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'DB server name', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '', -)); +]); // // Class: WebApplication // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:WebApplication' => 'Web Application', 'Class:WebApplication+' => '', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s', @@ -662,14 +662,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:WebApplication/Attribute:webserver_name+' => '', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '', -)); - +]); // // Class: VirtualDevice // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:VirtualDevice' => 'Virtual Device', 'Class:VirtualDevice+' => '', 'Class:VirtualDevice/Attribute:status' => 'Status', @@ -684,24 +683,24 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => 'stock', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Logical volumes', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'All the logical volumes used by this device', -)); +]); // // Class: VirtualHost // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:VirtualHost' => 'Virtual Host', 'Class:VirtualHost+' => '', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Virtual machines', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'All the virtual machines hosted by this host', -)); +]); // // Class: Hypervisor // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Hypervisor' => 'Hypervisor', 'Class:Hypervisor+' => '', 'Class:Hypervisor/Attribute:farm_id' => 'Farm', @@ -712,13 +711,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Hypervisor/Attribute:server_id+' => '', 'Class:Hypervisor/Attribute:server_name' => 'Server name', 'Class:Hypervisor/Attribute:server_name+' => '', -)); +]); // // Class: Farm // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Farm' => 'Farm', 'Class:Farm+' => '', 'Class:Farm/Attribute:hypervisor_list' => 'Hypervisors', @@ -727,13 +726,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Farm/Attribute:redundancy/disabled' => 'The farm is up if all the hypervisors are up', 'Class:Farm/Attribute:redundancy/count' => 'The farm is up if at least %1$s hypervisor(s) is(are) up', 'Class:Farm/Attribute:redundancy/percent' => 'The farm is up if at least %1$s %% of the hypervisors are up', -)); +]); // // Class: VirtualMachine // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:VirtualMachine' => 'Virtual Machine', 'Class:VirtualMachine+' => '', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s', @@ -761,13 +760,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:VirtualMachine/Attribute:managementip+' => '', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Network Interfaces', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'All the logical network interfaces', -)); +]); // // Class: LogicalVolume // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:LogicalVolume' => 'Logical Volume', 'Class:LogicalVolume+' => '', 'Class:LogicalVolume/Attribute:name' => 'Name', @@ -788,13 +787,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'All the servers using this volume', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Virtual devices', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'All the virtual devices using this volume', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkServerToVolume' => 'Link Server / Volume', 'Class:lnkServerToVolume+' => '', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s', @@ -808,13 +807,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '', 'Class:lnkServerToVolume/Attribute:size_used' => 'Size used', 'Class:lnkServerToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkVirtualDeviceToVolume' => 'Link Virtual Device / Volume', 'Class:lnkVirtualDeviceToVolume+' => '', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s', @@ -828,13 +827,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Size used', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkSanToDatacenterDevice' => 'Link SAN / Datacenter Device', 'Class:lnkSanToDatacenterDevice+' => '', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s', @@ -850,13 +849,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'Device fc', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '', -)); +]); // // Class: Tape // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Tape' => 'Tape', 'Class:Tape+' => '', 'Class:Tape/Attribute:name' => 'Name', @@ -869,13 +868,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Tape/Attribute:tapelibrary_id+' => '', 'Class:Tape/Attribute:tapelibrary_name' => 'Tape library name', 'Class:Tape/Attribute:tapelibrary_name+' => '', -)); +]); // // Class: NASFileSystem // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:NASFileSystem' => 'NAS File System', 'Class:NASFileSystem+' => '', 'Class:NASFileSystem/Attribute:name' => 'Name', @@ -890,13 +889,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:NASFileSystem/Attribute:nas_id+' => '', 'Class:NASFileSystem/Attribute:nas_name' => 'NAS name', 'Class:NASFileSystem/Attribute:nas_name+' => '', -)); +]); // // Class: Software // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Software' => 'Software', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s', @@ -926,13 +925,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Software/Attribute:softwarepatch_list+' => 'All the patchs for this software', 'Class:Software/Attribute:softwarelicence_list' => 'Software Licenses', 'Class:Software/Attribute:softwarelicence_list+' => 'All the licenses for this software', -)); +]); // // Class: Patch // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Patch' => 'Patch', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => 'Name', @@ -943,13 +942,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Patch sub-class', 'Class:Patch/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: OSPatch // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:OSPatch' => 'OS Patch', 'Class:OSPatch+' => '', 'Class:OSPatch/Attribute:functionalcis_list' => 'Devices', @@ -958,13 +957,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:OSPatch/Attribute:osversion_id+' => '', 'Class:OSPatch/Attribute:osversion_name' => 'OS version name', 'Class:OSPatch/Attribute:osversion_name+' => '', -)); +]); // // Class: SoftwarePatch // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:SoftwarePatch' => 'Software Patch', 'Class:SoftwarePatch+' => '', 'Class:SoftwarePatch/Attribute:software_id' => 'Software', @@ -973,13 +972,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:SoftwarePatch/Attribute:software_name+' => '', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Software instances', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'All the systems where this software patch is installed', -)); +]); // // Class: Licence // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Licence' => 'License', 'Class:Licence+' => '', @@ -1009,13 +1008,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => 'yes', 'Class:Licence/Attribute:finalclass' => 'License sub-class', 'Class:Licence/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: OSLicence // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:OSLicence' => 'OS License', 'Class:OSLicence+' => '', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s', @@ -1027,13 +1026,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'All the virtual machines where this license is used', 'Class:OSLicence/Attribute:servers_list' => 'Servers', 'Class:OSLicence/Attribute:servers_list+' => 'All the servers where this license is used', -)); +]); // // Class: SoftwareLicence // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:SoftwareLicence' => 'Software License', 'Class:SoftwareLicence+' => '', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s', @@ -1043,13 +1042,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:SoftwareLicence/Attribute:software_name+' => '', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Software instances', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'All the systems where this license is used', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkDocumentToLicence' => 'Link Document / License', 'Class:lnkDocumentToLicence+' => '', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s', @@ -1061,35 +1060,35 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Document name', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '', -)); +]); // // Class: OSVersion // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:OSVersion' => 'OS Version', 'Class:OSVersion+' => '', 'Class:OSVersion/Attribute:osfamily_id' => 'OS family', 'Class:OSVersion/Attribute:osfamily_id+' => '', 'Class:OSVersion/Attribute:osfamily_name' => 'OS family name', 'Class:OSVersion/Attribute:osfamily_name+' => '', -)); +]); // // Class: OSFamily // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:OSFamily' => 'OS Family', 'Class:OSFamily+' => '', -)); +]); // // Class: Brand // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Brand' => 'Brand', 'Class:Brand+' => '', 'Class:Brand/Attribute:logo' => 'Logo', @@ -1098,13 +1097,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'All the physical devices corresponding to this brand', 'Class:Brand/UniquenessRule:name+' => 'The name must be unique', 'Class:Brand/UniquenessRule:name' => 'This brand already exists', -)); +]); // // Class: Model // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Model' => 'Model', 'Class:Model+' => '', 'Class:Model/ComplementaryName' => '%1$s - %2$s', @@ -1156,37 +1155,37 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Model/Attribute:physicaldevices_list+' => 'All the physical devices corresponding to this model', 'Class:Model/UniquenessRule:name_brand+' => 'Name must be unique in the brand', 'Class:Model/UniquenessRule:name_brand' => 'this model already exists for this brand', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:NetworkDeviceType' => 'Network Device Type', 'Class:NetworkDeviceType+' => '', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Network devices', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'All the network devices corresponding to this type', -)); +]); // // Class: IOSVersion // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:IOSVersion' => 'IOS Version', 'Class:IOSVersion+' => '', 'Class:IOSVersion/Attribute:brand_id' => 'Brand', 'Class:IOSVersion/Attribute:brand_id+' => '', 'Class:IOSVersion/Attribute:brand_name' => 'Brand name', 'Class:IOSVersion/Attribute:brand_name+' => '', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkDocumentToPatch' => 'Link Document / Patch', 'Class:lnkDocumentToPatch+' => '', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s', @@ -1198,13 +1197,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Document name', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Link Software Instance / Software Patch', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s', @@ -1216,13 +1215,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Software instance name', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkFunctionalCIToOSPatch' => 'Link FunctionalCI / OS patch', 'Class:lnkFunctionalCIToOSPatch+' => '', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s', @@ -1234,13 +1233,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'Functionalci name', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkDocumentToSoftware' => 'Link Document / Software', 'Class:lnkDocumentToSoftware+' => '', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s', @@ -1252,13 +1251,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Document name', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '', -)); +]); // // Class: Subnet // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Subnet' => 'Subnet', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s', @@ -1277,13 +1276,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLANs', 'Class:Subnet/Attribute:vlans_list+' => '', -)); +]); // // Class: VLAN // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:VLAN' => 'VLAN', 'Class:VLAN+' => '', 'Class:VLAN/Attribute:vlan_tag' => 'VLAN Tag', @@ -1298,13 +1297,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:VLAN/Attribute:subnets_list+' => '', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Physical network interfaces', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkSubnetToVLAN' => 'Link Subnet / VLAN', 'Class:lnkSubnetToVLAN+' => '', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s', @@ -1318,32 +1317,31 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '', -)); +]); // // Class: NetworkInterface // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:NetworkInterface' => 'Network Interface', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'Name', 'Class:NetworkInterface/Attribute:name+' => '', 'Class:NetworkInterface/Attribute:finalclass' => 'NetworkInterface sub-class', 'Class:NetworkInterface/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: IPInterface // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:IPInterface' => 'IP Interface', 'Class:IPInterface+' => '', 'Class:IPInterface/Attribute:ipaddress' => 'IP address', 'Class:IPInterface/Attribute:ipaddress+' => '', - 'Class:IPInterface/Attribute:macaddress' => 'MAC address', 'Class:IPInterface/Attribute:macaddress+' => '', 'Class:IPInterface/Attribute:comment' => 'Comment', @@ -1354,13 +1352,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:IPInterface/Attribute:ipmask+' => '', 'Class:IPInterface/Attribute:speed' => 'Speed', 'Class:IPInterface/Attribute:speed+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:PhysicalInterface' => 'Physical Interface', 'Class:PhysicalInterface+' => '', 'Class:PhysicalInterface/Name' => '%2$s %1$s', @@ -1370,13 +1368,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLANs', 'Class:PhysicalInterface/Attribute:vlans_list+' => '', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Link PhysicalInterface / VLAN', 'Class:lnkPhysicalInterfaceToVLAN+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s', @@ -1392,27 +1390,26 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '', -)); - +]); // // Class: LogicalInterface // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:LogicalInterface' => 'Logical Interface', 'Class:LogicalInterface+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Virtual machine', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Virtual machine name', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:FiberChannelInterface' => 'Fiber Channel Interface', 'Class:FiberChannelInterface+' => '', 'Class:FiberChannelInterface/Attribute:speed' => 'Speed', @@ -1425,13 +1422,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Device name', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Link ConnectableCI / NetworkDevice', 'Class:lnkConnectableCIToNetworkDevice+' => '', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s', @@ -1453,13 +1450,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'down link', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'up link', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'up link', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Link ApplicationSolution / FunctionalCI', 'Class:lnkApplicationSolutionToFunctionalCI+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s', @@ -1471,13 +1468,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'Functionalci name', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Link ApplicationSolution / BusinessProcess', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s', @@ -1489,13 +1486,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Application solution name', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', -)); +]); // // Class: Group // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Group' => 'Group', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s', @@ -1526,13 +1523,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Group/Attribute:ci_list+' => 'All the configuration items linked to this group', 'Class:Group/Attribute:parent_id_friendlyname' => 'Parent Group', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkGroupToCI' => 'Link Group / CI', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s', @@ -1546,11 +1543,11 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Reason', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Server:baseinfo' => 'General information', 'Server:Date' => 'Dates', 'Server:moreinfo' => 'More information', @@ -1563,14 +1560,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Subnet/Tab:FreeIPs-count' => 'Free IPs: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Here is an extract of 10 free IP addresses', 'Class:Document:PreviewTab' => 'Preview', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkDocumentToFunctionalCI' => 'Link Document / FunctionalCI', 'Class:lnkDocumentToFunctionalCI+' => '', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s', @@ -1582,13 +1578,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Document name', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '', -)); +]); // // Application Menu // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Menu:Application' => 'Applications', 'Menu:Application+' => 'All applications', 'Menu:DBServer' => 'Database servers', @@ -1633,15 +1629,15 @@ Dict::Add('EN US', 'English', 'English', array( 'Menu:OSVersion+' => '', 'Menu:Software' => 'Software catalog', 'Menu:Software+' => 'Software catalog', -)); +]); // // Class: PhysicalInterface // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id', 'Class:PhysicalInterface/Attribute:org_id+' => '', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id', 'Class:PhysicalInterface/Attribute:location_id+' => '', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/en_gb.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/en_gb.dict.itop-config-mgmt.php index 3f55ece4a..3f3e74dd4 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/en_gb.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/en_gb.dict.itop-config-mgmt.php @@ -1,4 +1,5 @@ 'Elements impacted by', 'Relation:impacts/DownStream' => 'Impacts...', 'Relation:impacts/DownStream+' => 'Elements impacted by', @@ -39,8 +40,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Relation:impacts/LoadData' => 'Load data', 'Relation:impacts/NoFilteredData' => 'please select objects and load data', 'Relation:impacts/FilteredData' => 'Filtered data', -)); - +]); // Dictionnay conventions // Class: @@ -83,7 +83,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( // Class: lnkContactToFunctionalCI // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkContactToFunctionalCI' => 'Link Contact / FunctionalCI', 'Class:lnkContactToFunctionalCI+' => '', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s', @@ -95,13 +95,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Contact name', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:FunctionalCI' => 'Functional CI', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => 'Name', @@ -134,13 +134,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:FunctionalCI/Attribute:finalclass+' => 'Name of the final class', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Active Tickets', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Active Tickets which are impacting this functional CI', -)); +]); // // Class: PhysicalDevice // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:PhysicalDevice' => 'Physical Device', 'Class:PhysicalDevice+' => '', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s', @@ -174,13 +174,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'End of warranty', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '', -)); +]); // // Class: Rack // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Rack' => 'Rack', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s', @@ -190,64 +190,64 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Rack/Attribute:device_list+' => 'All the physical devices racked into this rack', 'Class:Rack/Attribute:enclosure_list' => 'Enclosures', 'Class:Rack/Attribute:enclosure_list+' => 'All the enclosures in this rack', -)); +]); // // Class: TelephonyCI // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TelephonyCI' => 'Telephony CI', 'Class:TelephonyCI+' => '', 'Class:TelephonyCI/Attribute:phonenumber' => 'Phone number', 'Class:TelephonyCI/Attribute:phonenumber+' => '', -)); +]); // // Class: Phone // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Phone' => 'Phone', 'Class:Phone+' => '', -)); +]); // // Class: MobilePhone // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:MobilePhone' => 'Mobile Phone', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'Hardware PIN', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:IPPhone' => 'IP Phone', 'Class:IPPhone+' => '', -)); +]); // // Class: Tablet // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Tablet' => 'Tablet', 'Class:Tablet+' => '', -)); +]); // // Class: ConnectableCI // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ConnectableCI' => 'Connectable CI', 'Class:ConnectableCI+' => 'Physical CI', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s', @@ -255,13 +255,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'All network devices connected to this device', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Network interfaces', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'All the physical network interfaces', -)); +]); // // Class: DatacenterDevice // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:DatacenterDevice' => 'Datacentre Device', 'Class:DatacenterDevice+' => '', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s', @@ -294,13 +294,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( // Unused yet 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'The device %2$s is up if all its power connections are up', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'The device %2$s is up if at least %1$s %% of its power connections are up', -)); +]); // // Class: NetworkDevice // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:NetworkDevice' => 'Network Device', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s', @@ -316,13 +316,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Server' => 'Server', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s', @@ -344,61 +344,61 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => 'Logical volumes', 'Class:Server/Attribute:logicalvolumes_list+' => 'All the logical volumes connected to this server', -)); +]); // // Class: StorageSystem // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:StorageSystem' => 'Storage System', 'Class:StorageSystem+' => '', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Logical volumes', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'All the logical volumes in this storage system', -)); +]); // // Class: SANSwitch // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:SANSwitch' => 'SAN Switch', 'Class:SANSwitch+' => '', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Devices', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'All the devices connected to this SAN switch', -)); +]); // // Class: TapeLibrary // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TapeLibrary' => 'Tape Library', 'Class:TapeLibrary+' => '', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s', 'Class:TapeLibrary/Attribute:tapes_list' => 'Tapes', 'Class:TapeLibrary/Attribute:tapes_list+' => 'All the tapes in the tape library', -)); +]); // // Class: NAS // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '', 'Class:NAS/ComplementaryName' => '%1$s - %2$s', 'Class:NAS/Attribute:nasfilesystem_list' => 'Filesystems', 'Class:NAS/Attribute:nasfilesystem_list+' => 'All the file systems in this NAS', -)); +]); // // Class: PC // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:PC' => 'PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s', @@ -420,45 +420,45 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:PC/Attribute:type/Value:desktop+' => 'desktop', 'Class:PC/Attribute:type/Value:laptop' => 'laptop', 'Class:PC/Attribute:type/Value:laptop+' => 'laptop', -)); +]); // // Class: Printer // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Printer' => 'Printer', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerConnection // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:PowerConnection' => 'Power Connection', 'Class:PowerConnection+' => '', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerSource // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:PowerSource' => 'Power Source', 'Class:PowerSource+' => '', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s', 'Class:PowerSource/Attribute:pdus_list' => 'PDUs', 'Class:PowerSource/Attribute:pdus_list+' => 'All the PDUs using this power source', -)); +]); // // Class: PDU // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s', @@ -470,23 +470,23 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:PDU/Attribute:powerstart_id+' => '', 'Class:PDU/Attribute:powerstart_name' => 'Power start name', 'Class:PDU/Attribute:powerstart_name+' => '', -)); +]); // // Class: Peripheral // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Peripheral' => 'Peripheral', 'Class:Peripheral+' => '', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: Enclosure // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Enclosure' => 'Enclosure', 'Class:Enclosure+' => '', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -498,13 +498,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Enclosure/Attribute:nb_u+' => '', 'Class:Enclosure/Attribute:device_list' => 'Devices', 'Class:Enclosure/Attribute:device_list+' => 'All the devices in this enclosure', -)); +]); // // Class: ApplicationSolution // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ApplicationSolution' => 'Application Solution', 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'CIs', @@ -521,13 +521,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'The solution is up if all CIs are up', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'The solution is up if at least %1$s CI(s) is(are) up', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'The solution is up if at least %1$s %% of the CIs are up', -)); +]); // // Class: BusinessProcess // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:BusinessProcess' => 'Business Process', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Application solutions', @@ -538,13 +538,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => 'active', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'inactive', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => 'inactive', -)); +]); // // Class: SoftwareInstance // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:SoftwareInstance' => 'Software Instance', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'System', @@ -567,64 +567,64 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => 'active', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'inactive', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => 'inactive', -)); +]); // // Class: Middleware // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Middleware' => 'Middleware', 'Class:Middleware+' => '', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Middleware instances', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'All the middleware instances provided by this middleware', -)); +]); // // Class: DBServer // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:DBServer' => 'DB Server', 'Class:DBServer+' => '', 'Class:DBServer/Attribute:dbschema_list' => 'DB schemas', 'Class:DBServer/Attribute:dbschema_list+' => 'All the database schemas for this DB server', -)); +]); // // Class: WebServer // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:WebServer' => 'Web server', 'Class:WebServer+' => '', 'Class:WebServer/Attribute:webapp_list' => 'Web applications', 'Class:WebServer/Attribute:webapp_list+' => 'All the web applications available on this web server', -)); +]); // // Class: PCSoftware // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:PCSoftware' => 'PC Software', 'Class:PCSoftware+' => '', -)); +]); // // Class: OtherSoftware // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:OtherSoftware' => 'Other Software', 'Class:OtherSoftware+' => '', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:MiddlewareInstance' => 'Middleware Instance', 'Class:MiddlewareInstance+' => '', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s', @@ -632,13 +632,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Middleware name', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '', -)); +]); // // Class: DatabaseSchema // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:DatabaseSchema' => 'Database Schema', 'Class:DatabaseSchema+' => '', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s', @@ -646,13 +646,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'DB server name', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '', -)); +]); // // Class: WebApplication // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:WebApplication' => 'Web Application', 'Class:WebApplication+' => '', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s', @@ -662,14 +662,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:WebApplication/Attribute:webserver_name+' => '', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '', -)); - +]); // // Class: VirtualDevice // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:VirtualDevice' => 'Virtual Device', 'Class:VirtualDevice+' => '', 'Class:VirtualDevice/Attribute:status' => 'Status', @@ -684,24 +683,24 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => 'stock', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Logical volumes', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'All the logical volumes used by this device', -)); +]); // // Class: VirtualHost // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:VirtualHost' => 'Virtual Host', 'Class:VirtualHost+' => '', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Virtual machines', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'All the virtual machines hosted by this host', -)); +]); // // Class: Hypervisor // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Hypervisor' => 'Hypervisor', 'Class:Hypervisor+' => '', 'Class:Hypervisor/Attribute:farm_id' => 'Farm', @@ -712,13 +711,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Hypervisor/Attribute:server_id+' => '', 'Class:Hypervisor/Attribute:server_name' => 'Server name', 'Class:Hypervisor/Attribute:server_name+' => '', -)); +]); // // Class: Farm // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Farm' => 'Farm', 'Class:Farm+' => '', 'Class:Farm/Attribute:hypervisor_list' => 'Hypervisors', @@ -727,13 +726,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Farm/Attribute:redundancy/disabled' => 'The farm is up if all the hypervisors are up', 'Class:Farm/Attribute:redundancy/count' => 'The farm is up if at least %1$s hypervisor(s) is(are) up', 'Class:Farm/Attribute:redundancy/percent' => 'The farm is up if at least %1$s %% of the hypervisors are up', -)); +]); // // Class: VirtualMachine // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:VirtualMachine' => 'Virtual Machine', 'Class:VirtualMachine+' => '', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s', @@ -761,13 +760,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:VirtualMachine/Attribute:managementip+' => '', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Network Interfaces', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'All the logical network interfaces', -)); +]); // // Class: LogicalVolume // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:LogicalVolume' => 'Logical Volume', 'Class:LogicalVolume+' => '', 'Class:LogicalVolume/Attribute:name' => 'Name', @@ -788,13 +787,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'All the servers using this volume', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Virtual devices', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'All the virtual devices using this volume', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkServerToVolume' => 'Link Server / Volume', 'Class:lnkServerToVolume+' => '', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s', @@ -808,13 +807,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '', 'Class:lnkServerToVolume/Attribute:size_used' => 'Size used', 'Class:lnkServerToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkVirtualDeviceToVolume' => 'Link Virtual Device / Volume', 'Class:lnkVirtualDeviceToVolume+' => '', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s', @@ -828,13 +827,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Size used', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkSanToDatacenterDevice' => 'Link SAN / Datacentre Device', 'Class:lnkSanToDatacenterDevice+' => '', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s', @@ -850,13 +849,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'Device fc', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '', -)); +]); // // Class: Tape // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Tape' => 'Tape', 'Class:Tape+' => '', 'Class:Tape/Attribute:name' => 'Name', @@ -869,13 +868,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Tape/Attribute:tapelibrary_id+' => '', 'Class:Tape/Attribute:tapelibrary_name' => 'Tape library name', 'Class:Tape/Attribute:tapelibrary_name+' => '', -)); +]); // // Class: NASFileSystem // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:NASFileSystem' => 'NAS File System', 'Class:NASFileSystem+' => '', 'Class:NASFileSystem/Attribute:name' => 'Name', @@ -890,13 +889,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:NASFileSystem/Attribute:nas_id+' => '', 'Class:NASFileSystem/Attribute:nas_name' => 'NAS name', 'Class:NASFileSystem/Attribute:nas_name+' => '', -)); +]); // // Class: Software // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Software' => 'Software', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s', @@ -926,13 +925,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Software/Attribute:softwarepatch_list+' => 'All the patches for this software', 'Class:Software/Attribute:softwarelicence_list' => 'Software Licences', 'Class:Software/Attribute:softwarelicence_list+' => 'All the licences for this software', -)); +]); // // Class: Patch // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Patch' => 'Patch', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => 'Name', @@ -943,13 +942,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Patch sub-class', 'Class:Patch/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: OSPatch // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:OSPatch' => 'OS Patch', 'Class:OSPatch+' => '', 'Class:OSPatch/Attribute:functionalcis_list' => 'Devices', @@ -958,13 +957,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:OSPatch/Attribute:osversion_id+' => '', 'Class:OSPatch/Attribute:osversion_name' => 'OS version name', 'Class:OSPatch/Attribute:osversion_name+' => '', -)); +]); // // Class: SoftwarePatch // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:SoftwarePatch' => 'Software Patch', 'Class:SoftwarePatch+' => '', 'Class:SoftwarePatch/Attribute:software_id' => 'Software', @@ -973,13 +972,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:SoftwarePatch/Attribute:software_name+' => '', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Software instances', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'All the systems where this software patch is installed', -)); +]); // // Class: Licence // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Licence' => 'Licence', 'Class:Licence+' => '', @@ -1009,13 +1008,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => 'yes', 'Class:Licence/Attribute:finalclass' => 'Licence sub-class', 'Class:Licence/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: OSLicence // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:OSLicence' => 'OS Licence', 'Class:OSLicence+' => '', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s', @@ -1027,13 +1026,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'All the virtual machines where this licence is used', 'Class:OSLicence/Attribute:servers_list' => 'Servers', 'Class:OSLicence/Attribute:servers_list+' => 'All the servers where this licence is used', -)); +]); // // Class: SoftwareLicence // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:SoftwareLicence' => 'Software Licence', 'Class:SoftwareLicence+' => '', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s', @@ -1043,13 +1042,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:SoftwareLicence/Attribute:software_name+' => '', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Software instances', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'All the systems where this licence is used', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkDocumentToLicence' => 'Link Document / Licence', 'Class:lnkDocumentToLicence+' => '', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s', @@ -1061,35 +1060,35 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Document name', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '', -)); +]); // // Class: OSVersion // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:OSVersion' => 'OS Version', 'Class:OSVersion+' => '', 'Class:OSVersion/Attribute:osfamily_id' => 'OS family', 'Class:OSVersion/Attribute:osfamily_id+' => '', 'Class:OSVersion/Attribute:osfamily_name' => 'OS family name', 'Class:OSVersion/Attribute:osfamily_name+' => '', -)); +]); // // Class: OSFamily // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:OSFamily' => 'OS Family', 'Class:OSFamily+' => '', -)); +]); // // Class: Brand // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Brand' => 'Brand', 'Class:Brand+' => '', 'Class:Brand/Attribute:logo' => 'Logo', @@ -1098,13 +1097,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'All the physical devices corresponding to this brand', 'Class:Brand/UniquenessRule:name+' => 'The name must be unique', 'Class:Brand/UniquenessRule:name' => 'This brand already exists', -)); +]); // // Class: Model // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Model' => 'Model', 'Class:Model+' => '', 'Class:Model/ComplementaryName' => '%1$s - %2$s', @@ -1156,37 +1155,37 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Model/Attribute:physicaldevices_list+' => 'All the physical devices corresponding to this model', 'Class:Model/UniquenessRule:name_brand+' => 'Name must be unique in the brand', 'Class:Model/UniquenessRule:name_brand' => 'this model already exists for this brand', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:NetworkDeviceType' => 'Network Device Type', 'Class:NetworkDeviceType+' => '', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Network devices', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'All the network devices corresponding to this type', -)); +]); // // Class: IOSVersion // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:IOSVersion' => 'IOS Version', 'Class:IOSVersion+' => '', 'Class:IOSVersion/Attribute:brand_id' => 'Brand', 'Class:IOSVersion/Attribute:brand_id+' => '', 'Class:IOSVersion/Attribute:brand_name' => 'Brand name', 'Class:IOSVersion/Attribute:brand_name+' => '', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkDocumentToPatch' => 'Link Document / Patch', 'Class:lnkDocumentToPatch+' => '', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s', @@ -1198,13 +1197,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Document name', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Link Software Instance / Software Patch', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s', @@ -1216,13 +1215,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Software instance name', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkFunctionalCIToOSPatch' => 'Link FunctionalCI / OS patch', 'Class:lnkFunctionalCIToOSPatch+' => '', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s', @@ -1234,13 +1233,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'Functionalci name', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkDocumentToSoftware' => 'Link Document / Software', 'Class:lnkDocumentToSoftware+' => '', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s', @@ -1252,13 +1251,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Document name', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '', -)); +]); // // Class: Subnet // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Subnet' => 'Subnet', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s', @@ -1277,13 +1276,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLANs', 'Class:Subnet/Attribute:vlans_list+' => '', -)); +]); // // Class: VLAN // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:VLAN' => 'VLAN', 'Class:VLAN+' => '', 'Class:VLAN/Attribute:vlan_tag' => 'VLAN Tag', @@ -1298,13 +1297,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:VLAN/Attribute:subnets_list+' => '', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Physical network interfaces', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkSubnetToVLAN' => 'Link Subnet / VLAN', 'Class:lnkSubnetToVLAN+' => '', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s', @@ -1318,32 +1317,31 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '', -)); +]); // // Class: NetworkInterface // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:NetworkInterface' => 'Network Interface', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'Name', 'Class:NetworkInterface/Attribute:name+' => '', 'Class:NetworkInterface/Attribute:finalclass' => 'NetworkInterface sub-class', 'Class:NetworkInterface/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: IPInterface // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:IPInterface' => 'IP Interface', 'Class:IPInterface+' => '', 'Class:IPInterface/Attribute:ipaddress' => 'IP address', 'Class:IPInterface/Attribute:ipaddress+' => '', - 'Class:IPInterface/Attribute:macaddress' => 'MAC address', 'Class:IPInterface/Attribute:macaddress+' => '', 'Class:IPInterface/Attribute:comment' => 'Comment', @@ -1354,13 +1352,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:IPInterface/Attribute:ipmask+' => '', 'Class:IPInterface/Attribute:speed' => 'Speed', 'Class:IPInterface/Attribute:speed+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:PhysicalInterface' => 'Physical Interface', 'Class:PhysicalInterface+' => '', 'Class:PhysicalInterface/Name' => '%2$s %1$s', @@ -1370,13 +1368,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLANs', 'Class:PhysicalInterface/Attribute:vlans_list+' => '', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Link PhysicalInterface / VLAN', 'Class:lnkPhysicalInterfaceToVLAN+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s', @@ -1392,27 +1390,26 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '', -)); - +]); // // Class: LogicalInterface // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:LogicalInterface' => 'Logical Interface', 'Class:LogicalInterface+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Virtual machine', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Virtual machine name', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:FiberChannelInterface' => 'Fibre Channel Interface', 'Class:FiberChannelInterface+' => '', 'Class:FiberChannelInterface/Attribute:speed' => 'Speed', @@ -1425,13 +1422,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Device name', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Link ConnectableCI / NetworkDevice', 'Class:lnkConnectableCIToNetworkDevice+' => '', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s', @@ -1453,13 +1450,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'down link', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'up link', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'up link', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Link ApplicationSolution / FunctionalCI', 'Class:lnkApplicationSolutionToFunctionalCI+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s', @@ -1471,13 +1468,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'Functionalci name', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Link ApplicationSolution / BusinessProcess', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s', @@ -1489,13 +1486,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Application solution name', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', -)); +]); // // Class: Group // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Group' => 'Group', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s', @@ -1526,13 +1523,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Group/Attribute:ci_list+' => 'All the configuration items linked to this group', 'Class:Group/Attribute:parent_id_friendlyname' => 'Parent Group', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkGroupToCI' => 'Link Group / CI', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s', @@ -1546,11 +1543,11 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Reason', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Server:baseinfo' => 'General information', 'Server:Date' => 'Dates', 'Server:moreinfo' => 'More information', @@ -1563,14 +1560,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Subnet/Tab:FreeIPs-count' => 'Free IPs: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Here is an extract of 10 free IP addresses', 'Class:Document:PreviewTab' => 'Preview', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkDocumentToFunctionalCI' => 'Link Document / FunctionalCI', 'Class:lnkDocumentToFunctionalCI+' => '', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s', @@ -1582,13 +1578,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Document name', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '', -)); +]); // // Application Menu // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Menu:Application' => 'Applications', 'Menu:Application+' => 'All applications', 'Menu:DBServer' => 'Database servers', @@ -1633,5 +1629,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Menu:OSVersion+' => '', 'Menu:Software' => 'Software catalogue', 'Menu:Software+' => 'Software catalogue', -)); -?> +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/es_cr.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/es_cr.dict.itop-config-mgmt.php index 42261df42..a9690d96b 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/es_cr.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/es_cr.dict.itop-config-mgmt.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Relation:impacts/Description' => 'Elementos Impactados por', 'Relation:impacts/DownStream' => 'Impacto...', 'Relation:impacts/DownStream+' => 'Elementos Impactados por', @@ -19,8 +20,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Relation:impacts/LoadData' => 'Cargar datos', 'Relation:impacts/NoFilteredData' => 'por favor seleccione objetos y cargue datos', 'Relation:impacts/FilteredData' => 'Datos filtrados', -)); - +]); // Dictionnay conventions // Class: @@ -63,7 +63,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( // Class: lnkContactToFunctionalCI // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkContactToFunctionalCI' => 'Relación Contacto y EC Funcional', 'Class:lnkContactToFunctionalCI+' => 'Relación Contacto y EC Funcional', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s', @@ -75,13 +75,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => 'Contacto', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Contacto', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => 'Contacto', -)); +]); // // Class: FunctionalCI // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:FunctionalCI' => 'EC Funcional', 'Class:FunctionalCI+' => 'Elemento de Configuración Funcional', 'Class:FunctionalCI/Attribute:name' => 'Nombre', @@ -114,13 +114,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:FunctionalCI/Attribute:finalclass+' => 'Clase', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Tickets Activos', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Tickets activos que están impactando este EC funcional', -)); +]); // // Class: PhysicalDevice // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:PhysicalDevice' => 'Dispositivo Físico', 'Class:PhysicalDevice+' => 'Dispositivo Físico', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s', @@ -154,13 +154,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => 'Fecha de Compra', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Vencimiento de Garantía', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => 'Vencimiento de Garantía', -)); +]); // // Class: Rack // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Rack' => 'Rack', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s', @@ -170,64 +170,64 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Rack/Attribute:device_list+' => 'Dispositivos', 'Class:Rack/Attribute:enclosure_list' => 'Enclosures', 'Class:Rack/Attribute:enclosure_list+' => 'Enclosures', -)); +]); // // Class: TelephonyCI // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TelephonyCI' => 'EC Telefónico', 'Class:TelephonyCI+' => 'EC Telefónico', 'Class:TelephonyCI/Attribute:phonenumber' => 'Número Telefónico', 'Class:TelephonyCI/Attribute:phonenumber+' => 'Número Telefónico', -)); +]); // // Class: Phone // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Phone' => 'Teléfono', 'Class:Phone+' => 'Teléfono', -)); +]); // // Class: MobilePhone // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:MobilePhone' => 'Teléfono Móvil', 'Class:MobilePhone+' => 'Teléfono Móvil', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => 'IMEI', 'Class:MobilePhone/Attribute:hw_pin' => 'PIN', 'Class:MobilePhone/Attribute:hw_pin+' => 'PIN', -)); +]); // // Class: IPPhone // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:IPPhone' => 'Teléfono IP', 'Class:IPPhone+' => 'Teléfono IP', -)); +]); // // Class: Tablet // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Tablet' => 'Tableta', 'Class:Tablet+' => 'Tableta', -)); +]); // // Class: ConnectableCI // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ConnectableCI' => 'EC Conectable', 'Class:ConnectableCI+' => 'EC Físico', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s', @@ -235,13 +235,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'Dispositivos de Red', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Interfases de Red', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'Interfases de Red', -)); +]); // // Class: DatacenterDevice // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:DatacenterDevice' => 'Dispositivos de Centro de Datos', 'Class:DatacenterDevice+' => 'Dispositivos de Centro de Datos', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s', @@ -273,13 +273,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'El dispositivo está arriba si almenos una conexión eléctrica (A o B) está arriba', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'El dispositivo está arriba si todas la conexiones eléctricas están arriba', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'El dispositivo está arriba si al menos %1$s %% de sus conexiones eléctricas están arriba', -)); +]); // // Class: NetworkDevice // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:NetworkDevice' => 'Dispositivo de Red', 'Class:NetworkDevice+' => 'Dispositivo de Red', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s', @@ -295,13 +295,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => 'Versión IOS', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => 'RAM', -)); +]); // // Class: Server // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Server' => 'Servidor', 'Class:Server+' => 'Servidor', 'Class:Server/ComplementaryName' => '%1$s - %2$s', @@ -323,61 +323,61 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Server/Attribute:ram+' => 'RAM', 'Class:Server/Attribute:logicalvolumes_list' => 'Volumenes Lógicos', 'Class:Server/Attribute:logicalvolumes_list+' => 'Volumenes Lógicos', -)); +]); // // Class: StorageSystem // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:StorageSystem' => 'Sistema de Almacenamiento', 'Class:StorageSystem+' => 'Sistema de Almacenamiento', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Volumenes Lógicos', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'Volumenes Lógicos', -)); +]); // // Class: SANSwitch // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:SANSwitch' => 'Switch de SAN', 'Class:SANSwitch+' => 'Switch de SAN', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Dispositivos', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'Dispositivos', -)); +]); // // Class: TapeLibrary // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TapeLibrary' => 'Libreria de Cintas', 'Class:TapeLibrary+' => 'Libreria de Cintas', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s', 'Class:TapeLibrary/Attribute:tapes_list' => 'Cintas', 'Class:TapeLibrary/Attribute:tapes_list+' => 'Cintas', -)); +]); // // Class: NAS // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => 'NAS', 'Class:NAS/ComplementaryName' => '%1$s - %2$s', 'Class:NAS/Attribute:nasfilesystem_list' => 'Filesystems', 'Class:NAS/Attribute:nasfilesystem_list+' => 'Filesystems', -)); +]); // // Class: PC // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:PC' => 'PC/Laptop', 'Class:PC+' => 'PC/Laptop', 'Class:PC/ComplementaryName' => '%1$s - %2$s', @@ -399,45 +399,45 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:PC/Attribute:type/Value:desktop+' => 'Escritorio', 'Class:PC/Attribute:type/Value:laptop' => 'Laptop', 'Class:PC/Attribute:type/Value:laptop+' => 'Laptop', -)); +]); // // Class: Printer // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Printer' => 'Impresora', 'Class:Printer+' => 'Impresora', 'Class:Printer/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerConnection // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:PowerConnection' => 'Conexión Eléctrica', 'Class:PowerConnection+' => 'Conexión Eléctrica', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerSource // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:PowerSource' => 'Fuente de Poder', 'Class:PowerSource+' => 'Fuente de Poder', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s', 'Class:PowerSource/Attribute:pdus_list' => 'PDUs', 'Class:PowerSource/Attribute:pdus_list+' => 'PDUs', -)); +]); // // Class: PDU // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => 'PDU', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s', @@ -449,23 +449,23 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:PDU/Attribute:powerstart_id+' => 'Conector de Poder', 'Class:PDU/Attribute:powerstart_name' => 'Conector de Poder', 'Class:PDU/Attribute:powerstart_name+' => 'Conector de Poder', -)); +]); // // Class: Peripheral // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Peripheral' => 'Periférico', 'Class:Peripheral+' => 'Periférico', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: Enclosure // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Enclosure' => 'Enclosure', 'Class:Enclosure+' => 'Enclosure', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -477,13 +477,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Enclosure/Attribute:nb_u+' => 'Unidades de Rack', 'Class:Enclosure/Attribute:device_list' => 'Dispositivos', 'Class:Enclosure/Attribute:device_list+' => 'Dispositivos', -)); +]); // // Class: ApplicationSolution // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ApplicationSolution' => 'Solución Aplicativa', 'Class:ApplicationSolution+' => 'Solución Aplicativa', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'ECs', @@ -500,13 +500,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'La solución está arriba si todos los ECs están arriba', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'La solución está arriba si al menos %1$s EC(s) está(n) arriba', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'La solución está arriba si al menos %1$s %% de los ECs están arriba', -)); +]); // // Class: BusinessProcess // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:BusinessProcess' => 'Proceso de Negocio', 'Class:BusinessProcess+' => 'Proceso de Negocio', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Soluciones Aplicativas', @@ -517,13 +517,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => 'Activo', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'Inactivo', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => 'Inactivo', -)); +]); // // Class: SoftwareInstance // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:SoftwareInstance' => 'Instalación de Software', 'Class:SoftwareInstance+' => 'Instalación de Software', 'Class:SoftwareInstance/Attribute:system_id' => 'Sistema', @@ -546,64 +546,64 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => 'Activo', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'Inactivo', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => 'Inactivo', -)); +]); // // Class: Middleware // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Middleware' => 'Middleware', 'Class:Middleware+' => 'Middleware', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Instalaciones de Middleware', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'Instalaciones de Middleware', -)); +]); // // Class: DBServer // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:DBServer' => 'Servidor de Base de Datos', 'Class:DBServer+' => 'Servidor de Base de Datos', 'Class:DBServer/Attribute:dbschema_list' => 'Esquema de BD', 'Class:DBServer/Attribute:dbschema_list+' => 'Esquema de BD', -)); +]); // // Class: WebServer // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:WebServer' => 'Servidor Web', 'Class:WebServer+' => 'Servidor Web', 'Class:WebServer/Attribute:webapp_list' => 'Aplicaciones Web', 'Class:WebServer/Attribute:webapp_list+' => 'Aplicaciones Web', -)); +]); // // Class: PCSoftware // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:PCSoftware' => 'Software de PC', 'Class:PCSoftware+' => 'Software de PC', -)); +]); // // Class: OtherSoftware // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:OtherSoftware' => 'Otro Software', 'Class:OtherSoftware+' => 'Otro Software', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:MiddlewareInstance' => 'Instalación de Middleware', 'Class:MiddlewareInstance+' => 'Instalación de Middleware', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s', @@ -611,13 +611,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => 'Middleware', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Middleware', 'Class:MiddlewareInstance/Attribute:middleware_name+' => 'Middleware', -)); +]); // // Class: DatabaseSchema // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:DatabaseSchema' => 'Esquema de Base de Datos', 'Class:DatabaseSchema+' => 'Esquema de Base de Datos', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s', @@ -625,13 +625,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => 'Servidor de Base de Datos', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'Servidor de Base de Datos', 'Class:DatabaseSchema/Attribute:dbserver_name+' => 'Servidor de Base de Datos', -)); +]); // // Class: WebApplication // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:WebApplication' => 'Aplicación Web', 'Class:WebApplication+' => 'Aplicación Web', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s', @@ -641,14 +641,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:WebApplication/Attribute:webserver_name+' => 'Servidor Web', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => 'URL de Uso', -)); - +]); // // Class: VirtualDevice // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:VirtualDevice' => 'Dispositivo Virtual', 'Class:VirtualDevice+' => 'Dispositivo Virtual', 'Class:VirtualDevice/Attribute:status' => 'Estatus', @@ -663,24 +662,24 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => 'En inventario', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Volumenes Lógicos', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'Volumenes Lógicos', -)); +]); // // Class: VirtualHost // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:VirtualHost' => 'Host Virtual', 'Class:VirtualHost+' => 'Host Virtual', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Máquinas Virtuales', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'Máquinas Virtuales', -)); +]); // // Class: Hypervisor // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Hypervisor' => 'Hypervisor', 'Class:Hypervisor+' => 'Hypervisor', 'Class:Hypervisor/Attribute:farm_id' => 'Granja', @@ -691,13 +690,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Hypervisor/Attribute:server_id+' => 'Servidor', 'Class:Hypervisor/Attribute:server_name' => 'Servidor', 'Class:Hypervisor/Attribute:server_name+' => 'Servidor', -)); +]); // // Class: Farm // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Farm' => 'Granja', 'Class:Farm+' => 'Granja', 'Class:Farm/Attribute:hypervisor_list' => 'Hypervisores', @@ -706,13 +705,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Farm/Attribute:redundancy/disabled' => 'La granja está arriba si todos los hipervisores están arriba', 'Class:Farm/Attribute:redundancy/count' => 'La granja está arriba si al menos %1$s hipervisor(es) está(n) arriba', 'Class:Farm/Attribute:redundancy/percent' => 'La granja está arriba si al menos %1$s %% de los hipervisores están arriba', -)); +]); // // Class: VirtualMachine // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:VirtualMachine' => 'Máquina Virtual', 'Class:VirtualMachine+' => 'Máquina Virtual', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s', @@ -740,13 +739,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:VirtualMachine/Attribute:managementip+' => 'IP', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Interfases de Red', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'Interfases de Red', -)); +]); // // Class: LogicalVolume // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:LogicalVolume' => 'Volumen Lógico', 'Class:LogicalVolume+' => 'Volumen Lógico', 'Class:LogicalVolume/Attribute:name' => 'Nombre', @@ -767,13 +766,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'Servidores', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Dispositivos Virtuales', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'Dispositivos Virtuales', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkServerToVolume' => 'Relación Servidor y Volumen', 'Class:lnkServerToVolume+' => 'Relación Servidor y Volumen', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s', @@ -787,13 +786,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkServerToVolume/Attribute:server_name+' => 'Servidor', 'Class:lnkServerToVolume/Attribute:size_used' => 'Tamaño Asignado', 'Class:lnkServerToVolume/Attribute:size_used+' => 'Tamaño Asignado', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkVirtualDeviceToVolume' => 'Relación Dispositivo Virtual y Volumen', 'Class:lnkVirtualDeviceToVolume+' => 'Relación Dispositivo Virtual y Volumen', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s', @@ -807,13 +806,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => 'Dispositivo Virtual', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Tamaño Asignado', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => 'Tamaño Asignado', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkSanToDatacenterDevice' => 'Relación SAN y Dispositivo del Centro de Datos', 'Class:lnkSanToDatacenterDevice+' => 'Relación SAN y Dispositivo del Centro de Datos', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s', @@ -829,13 +828,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => 'FC en SAN', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'FC en Dispositivo', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => 'FC en Dispositivo', -)); +]); // // Class: Tape // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Tape' => 'Cinta', 'Class:Tape+' => 'Cinta', 'Class:Tape/Attribute:name' => 'Nombre', @@ -848,13 +847,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Tape/Attribute:tapelibrary_id+' => 'Liberia de Cintas', 'Class:Tape/Attribute:tapelibrary_name' => 'Liberia de Cintas', 'Class:Tape/Attribute:tapelibrary_name+' => 'Liberia de Cintas', -)); +]); // // Class: NASFileSystem // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:NASFileSystem' => 'Filesysten en NAS', 'Class:NASFileSystem+' => 'Filesysten en NAS', 'Class:NASFileSystem/Attribute:name' => 'Nombre', @@ -869,13 +868,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:NASFileSystem/Attribute:nas_id+' => 'NAS', 'Class:NASFileSystem/Attribute:nas_name' => 'NAS', 'Class:NASFileSystem/Attribute:nas_name+' => 'NAS', -)); +]); // // Class: Software // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Software' => 'Software', 'Class:Software+' => 'Software', 'Class:Software/ComplementaryName' => '%1$s - %2$s', @@ -905,13 +904,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Software/Attribute:softwarepatch_list+' => 'Parches de Software', 'Class:Software/Attribute:softwarelicence_list' => 'Licencias de Software', 'Class:Software/Attribute:softwarelicence_list+' => 'Licencias de Software', -)); +]); // // Class: Patch // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Patch' => 'Parche', 'Class:Patch+' => 'Parche', 'Class:Patch/Attribute:name' => 'Nombre', @@ -922,13 +921,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Patch/Attribute:description+' => 'Descripción', 'Class:Patch/Attribute:finalclass' => 'Clase', 'Class:Patch/Attribute:finalclass+' => 'Clase', -)); +]); // // Class: OSPatch // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:OSPatch' => 'Parche de SO', 'Class:OSPatch+' => 'Parche de SO', 'Class:OSPatch/Attribute:functionalcis_list' => 'Dispositivos', @@ -937,13 +936,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:OSPatch/Attribute:osversion_id+' => 'Versión de SO', 'Class:OSPatch/Attribute:osversion_name' => 'Versión de SO', 'Class:OSPatch/Attribute:osversion_name+' => 'Versión de SO', -)); +]); // // Class: SoftwarePatch // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:SoftwarePatch' => 'Parche de Software', 'Class:SoftwarePatch+' => 'Parche de Software', 'Class:SoftwarePatch/Attribute:software_id' => 'Software', @@ -952,13 +951,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:SoftwarePatch/Attribute:software_name+' => 'Software', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Instalaciones de Software', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'Instalaciones de Software', -)); +]); // // Class: Licence // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Licence' => 'Licencia', 'Class:Licence+' => 'Licencia', 'Class:Licence/Attribute:name' => 'Nombre', @@ -987,13 +986,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => 'Si', 'Class:Licence/Attribute:finalclass' => 'Clase', 'Class:Licence/Attribute:finalclass+' => 'Clase', -)); +]); // // Class: OSLicence // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:OSLicence' => 'Licencia de SO', 'Class:OSLicence+' => 'Licencia de SO', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s', @@ -1005,13 +1004,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'Máquinas Virtuales', 'Class:OSLicence/Attribute:servers_list' => 'Servidores', 'Class:OSLicence/Attribute:servers_list+' => 'Servidores', -)); +]); // // Class: SoftwareLicence // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:SoftwareLicence' => 'Licencia de Software', 'Class:SoftwareLicence+' => 'Licencia de Software', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s', @@ -1021,13 +1020,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:SoftwareLicence/Attribute:software_name+' => 'Software', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Instalaciones de Software', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'Instalaciones de Software', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkDocumentToLicence' => 'Relación Documento y Licencia', 'Class:lnkDocumentToLicence+' => 'Relación Documento y Licencia', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s', @@ -1039,35 +1038,35 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => 'Documento', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Documento', 'Class:lnkDocumentToLicence/Attribute:document_name+' => 'Documento', -)); +]); // // Class: OSVersion // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:OSVersion' => 'Versión de SO', 'Class:OSVersion+' => 'Versión de SO', 'Class:OSVersion/Attribute:osfamily_id' => 'Familia de SO', 'Class:OSVersion/Attribute:osfamily_id+' => 'Familia de SO', 'Class:OSVersion/Attribute:osfamily_name' => 'Familia de SO', 'Class:OSVersion/Attribute:osfamily_name+' => 'Familia de SO', -)); +]); // // Class: OSFamily // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:OSFamily' => 'Familia de SO', 'Class:OSFamily+' => 'Familia de SO', -)); +]); // // Class: Brand // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Brand' => 'Marca', 'Class:Brand+' => 'Marca', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1076,13 +1075,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'Dispositivo Físico', 'Class:Brand/UniquenessRule:name+' => 'El nombre debe ser único', 'Class:Brand/UniquenessRule:name' => 'Esta Marca ya existe', -)); +]); // // Class: Model // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Model' => 'Modelo', 'Class:Model+' => 'Modelo', 'Class:Model/ComplementaryName' => '%1$s - %2$s', @@ -1134,37 +1133,37 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Model/Attribute:physicaldevices_list+' => 'Dispositivo Físico', 'Class:Model/UniquenessRule:name_brand+' => 'El nombre debe ser único dentro de la Marca', 'Class:Model/UniquenessRule:name_brand' => 'este modelo ya existe para esta Marca', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:NetworkDeviceType' => 'Tipo Dispositivo de Red', 'Class:NetworkDeviceType+' => 'Tipo de Dispositivo de Red', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Dispositivos de Red', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'Dispositivos de Red', -)); +]); // // Class: IOSVersion // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:IOSVersion' => 'Versión de IOS', 'Class:IOSVersion+' => 'Versión de IOS', 'Class:IOSVersion/Attribute:brand_id' => 'Marca', 'Class:IOSVersion/Attribute:brand_id+' => 'Marca', 'Class:IOSVersion/Attribute:brand_name' => 'Marca', 'Class:IOSVersion/Attribute:brand_name+' => 'Marca', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkDocumentToPatch' => 'Relación Documentos y Parche', 'Class:lnkDocumentToPatch+' => 'Relación Documentos y Parche', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s', @@ -1176,13 +1175,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => 'Documento', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Documento', 'Class:lnkDocumentToPatch/Attribute:document_name+' => 'Documento', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Relación Instalación de Software y Parche de Software', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => 'Relación Instalación de Software y Parche de Software', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s', @@ -1194,13 +1193,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => 'Instalación de Software', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Instalación de Software', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => 'Instalación de Software', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkFunctionalCIToOSPatch' => 'Relación EC Funcional y Parche de SO', 'Class:lnkFunctionalCIToOSPatch+' => 'Relación EC Funcional y Parche de SO', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s', @@ -1212,13 +1211,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => 'EC Funcional', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'EC Funcional', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => 'EC Funcional', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkDocumentToSoftware' => 'Relación Documento y Software', 'Class:lnkDocumentToSoftware+' => 'Relación Documento y Software', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s', @@ -1230,13 +1229,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => 'Documento', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Documento', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => 'Documento', -)); +]); // // Class: Subnet // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Subnet' => 'SubRed', 'Class:Subnet+' => 'SubRed', 'Class:Subnet/Name' => '%1$s/%2$s', @@ -1255,13 +1254,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'vLANs', 'Class:Subnet/Attribute:vlans_list+' => 'Virtual LANs', -)); +]); // // Class: VLAN // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:VLAN' => 'vLAN', 'Class:VLAN+' => 'Red Virtual de Área Local', 'Class:VLAN/Attribute:vlan_tag' => 'Etiqueta vLAN', @@ -1276,13 +1275,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:VLAN/Attribute:subnets_list+' => 'Subredes', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Interfases Físicas de Red', 'Class:VLAN/Attribute:physicalinterfaces_list+' => 'Interfases Físicas de Red', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkSubnetToVLAN' => 'Relación Subred / vLAN', 'Class:lnkSubnetToVLAN+' => 'Relación Subred / vLAN', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s', @@ -1296,26 +1295,26 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => 'vLAN', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'Etiqueta vLAN', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => 'Etiqueta vLAN', -)); +]); // // Class: NetworkInterface // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:NetworkInterface' => 'Interfaz de Red', 'Class:NetworkInterface+' => 'Interfaz de Red', 'Class:NetworkInterface/Attribute:name' => 'Nombre', 'Class:NetworkInterface/Attribute:name+' => 'Nombre de la Interfaz de Red', 'Class:NetworkInterface/Attribute:finalclass' => 'Clase', 'Class:NetworkInterface/Attribute:finalclass+' => 'Clase', -)); +]); // // Class: IPInterface // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:IPInterface' => 'Interfaz IP', 'Class:IPInterface+' => 'Interfaz IP', 'Class:IPInterface/Attribute:ipaddress' => 'Dirección IP', @@ -1330,13 +1329,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:IPInterface/Attribute:ipmask+' => 'Máscara de Red', 'Class:IPInterface/Attribute:speed' => 'Velocidad', 'Class:IPInterface/Attribute:speed+' => 'Velocidad', -)); +]); // // Class: PhysicalInterface // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:PhysicalInterface' => 'Interfaz Física', 'Class:PhysicalInterface+' => 'Interfaz Física', 'Class:PhysicalInterface/Name' => '%2$s %1$s', @@ -1346,13 +1345,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => 'Dispositivo', 'Class:PhysicalInterface/Attribute:vlans_list' => 'vLANs', 'Class:PhysicalInterface/Attribute:vlans_list+' => 'vLANS', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Relación Interfaz Física / VLAN', 'Class:lnkPhysicalInterfaceToVLAN+' => 'Relación Interfaz Física / VLAN', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s', @@ -1368,27 +1367,26 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => 'vLAN', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'Etiqueta VLAN', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => 'Etiqueta VLAN', -)); - +]); // // Class: LogicalInterface // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:LogicalInterface' => 'Interfaz Lógica', 'Class:LogicalInterface+' => 'Interfaz Lógica', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Máquina Virtual', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => 'Máquina Virtual', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Máquina Virtual', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => 'Máquina Virtual', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:FiberChannelInterface' => 'Intefaz de Fibra Óptica', 'Class:FiberChannelInterface+' => 'Intefaz de Fibra Óptica', 'Class:FiberChannelInterface/Attribute:speed' => 'Velocidad', @@ -1401,13 +1399,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => 'Dispositivo', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Dispositivo', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => 'Dispositivo', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Relación EC Conectable y Dispositivo de Red', 'Class:lnkConnectableCIToNetworkDevice+' => 'Relación EC Conectable y Dispositivo de Red', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s', @@ -1429,13 +1427,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'Down Link', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'Up Link', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'Up Link', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Relación Solución Aplicativa y EC Funcional', 'Class:lnkApplicationSolutionToFunctionalCI+' => 'Relación Solución Aplicativa y EC Funcional', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s', @@ -1447,13 +1445,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => 'EC Funcional', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'EC Funcional', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => 'EC Funcional', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Relación Solución Aplicativa y Proceso de Negocio', 'Class:lnkApplicationSolutionToBusinessProcess+' => 'Relación Solución Aplicativa y Proceso de Negocio', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s', @@ -1465,13 +1463,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => 'Solución Aplicativa', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Solución Aplicativa', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => 'Solución Aplicativa', -)); +]); // // Class: Group // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Group' => 'Grupo', 'Class:Group+' => 'Grupo', 'Class:Group/ComplementaryName' => '%1$s - %2$s', @@ -1501,13 +1499,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Group/Attribute:ci_list+' => 'ECs Relacionados', 'Class:Group/Attribute:parent_id_friendlyname' => 'Grupo Padre', 'Class:Group/Attribute:parent_id_friendlyname+' => 'Grupo Padre', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkGroupToCI' => 'Relación Grupo y EC', 'Class:lnkGroupToCI+' => 'Relación Grupo y EC', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s', @@ -1521,11 +1519,11 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => 'Elemento de Configuración', 'Class:lnkGroupToCI/Attribute:reason' => 'Motivo', 'Class:lnkGroupToCI/Attribute:reason+' => 'Motivo', -)); +]); // Add translation for Fieldsets -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Server:baseinfo' => 'Información General', 'Server:Date' => 'Fecha', 'Server:moreinfo' => 'Más Información', @@ -1538,14 +1536,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Subnet/Tab:FreeIPs-count' => 'IPs Libres: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Aquí está un extracto de 10 direcciones IP Libres', 'Class:Document:PreviewTab' => 'Vista Previa', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkDocumentToFunctionalCI' => 'Relación Documento y EC Funcional', 'Class:lnkDocumentToFunctionalCI+' => 'Relación Documento y EC Funcional', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s', @@ -1557,13 +1554,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => 'Documento', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Documento', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => 'Documento', -)); +]); // // Application Menu // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:Application' => 'Aplicaciones', 'Menu:Application+' => 'Aplicaciones/Programas', 'Menu:DBServer' => 'Servidores de Base de Datos', @@ -1608,15 +1605,15 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Menu:OSVersion+' => '', 'Menu:Software' => 'Catálogo de Software', 'Menu:Software+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/fr.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/fr.dict.itop-config-mgmt.php index 42e652143..fb9829abf 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/fr.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/fr.dict.itop-config-mgmt.php @@ -1,15 +1,16 @@ 'Eléments impactés par', 'Relation:impacts/DownStream' => 'Impacte...', 'Relation:impacts/DownStream+' => 'Eléments impactés par', @@ -21,8 +22,7 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Relation:impacts/LoadData' => 'Charger les données', 'Relation:impacts/NoFilteredData' => 'Veuillez sélectionner des objets et lancer le chargement des données', 'Relation:impacts/FilteredData' => 'Données filtrées', -)); - +]); // Dictionnay conventions // Class: @@ -65,7 +65,7 @@ Dict::Add('FR FR', 'French', 'Français', array( // Class: lnkContactToFunctionalCI // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkContactToFunctionalCI' => 'Lien Contact / CI Fonctionnel', 'Class:lnkContactToFunctionalCI+' => '', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s', @@ -77,13 +77,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Nom contact', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:FunctionalCI' => 'CI Fonctionnel', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => 'Nom', @@ -125,14 +125,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:FunctionalCI/Attribute:finalclass' => 'Sous-classe de CI', 'Class:FunctionalCI/Attribute:finalclass+' => 'Nom de la classe instanciable', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Tickets en cours', - 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Tickets ouverts impactant cet élément de configuration' -)); + 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Tickets ouverts impactant cet élément de configuration', +]); // // Class: PhysicalDevice // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:PhysicalDevice' => 'Matériel physique', 'Class:PhysicalDevice+' => '', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s', @@ -166,13 +166,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Date de fin de garantie', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '', -)); +]); // // Class: Rack // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Rack' => 'Rack', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s', @@ -193,65 +193,65 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Rack/Attribute:enclosure_list/UI:Links:Delete:Button+' => 'Supprimer ce %4$s', 'Class:Rack/Attribute:enclosure_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:Rack/Attribute:enclosure_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', - 'Class:Rack/Attribute:enclosure_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s' -)); + 'Class:Rack/Attribute:enclosure_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s', +]); // // Class: TelephonyCI // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TelephonyCI' => 'CI Téléphonie', 'Class:TelephonyCI+' => '', 'Class:TelephonyCI/Attribute:phonenumber' => 'Numéro', 'Class:TelephonyCI/Attribute:phonenumber+' => '', -)); +]); // // Class: Phone // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Phone' => 'Téléphone', 'Class:Phone+' => '', -)); +]); // // Class: MobilePhone // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:MobilePhone' => 'Téléphone mobile', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'PIN', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:IPPhone' => 'Téléphone IP', 'Class:IPPhone+' => '', -)); +]); // // Class: Tablet // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Tablet' => 'Tablette', 'Class:Tablet+' => '', -)); +]); // // Class: ConnectableCI // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ConnectableCI' => 'CI connecté', 'Class:ConnectableCI+' => '', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s', @@ -264,14 +264,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:ConnectableCI/Attribute:physicalinterface_list/UI:Links:Delete:Button+' => 'Supprimer cette %4$s', 'Class:ConnectableCI/Attribute:physicalinterface_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:ConnectableCI/Attribute:physicalinterface_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:ConnectableCI/Attribute:physicalinterface_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s' -)); + 'Class:ConnectableCI/Attribute:physicalinterface_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s', +]); // // Class: DatacenterDevice // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:DatacenterDevice' => 'Matériel Datacenter', 'Class:DatacenterDevice+' => '', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s', @@ -308,14 +308,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:DatacenterDevice/Attribute:redundancy' => 'Redondance', 'Class:DatacenterDevice/Attribute:redundancy/count' => 'Le %2$s est alimenté si au moins une source électrique (A ou B) est opérationnelle', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'Le %2$s est alimenté si toutes ses sources électriques sont opérationnelles', - 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'Le %2$s est alimenté si au moins %1$s %% de ses sources électriques sont opérationnelles' -)); + 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'Le %2$s est alimenté si au moins %1$s %% de ses sources électriques sont opérationnelles', +]); // // Class: NetworkDevice // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:NetworkDevice' => 'Equipement réseau', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s', @@ -331,13 +331,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Server' => 'Serveur', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s', @@ -359,13 +359,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => 'Volumes logiques', 'Class:Server/Attribute:logicalvolumes_list+' => 'Tous les volumes logiques connectés à ce serveur', -)); +]); // // Class: StorageSystem // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:StorageSystem' => 'Système de stockage', 'Class:StorageSystem+' => '', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s', @@ -376,26 +376,26 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:StorageSystem/Attribute:logicalvolume_list/UI:Links:Delete:Button+' => 'Supprimer ce %4$s', 'Class:StorageSystem/Attribute:logicalvolume_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:StorageSystem/Attribute:logicalvolume_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', - 'Class:StorageSystem/Attribute:logicalvolume_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s' -)); + 'Class:StorageSystem/Attribute:logicalvolume_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s', +]); // // Class: SANSwitch // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:SANSwitch' => 'Switch SAN', 'Class:SANSwitch+' => '', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Matériels connectés', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'Tous les matériels connectés à ce switch SAN', -)); +]); // // Class: TapeLibrary // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TapeLibrary' => 'Bandothèque', 'Class:TapeLibrary+' => '', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s', @@ -406,14 +406,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:TapeLibrary/Attribute:tapes_list/UI:Links:Delete:Button+' => 'Supprimer cette %4$s', 'Class:TapeLibrary/Attribute:tapes_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:TapeLibrary/Attribute:tapes_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:TapeLibrary/Attribute:tapes_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de sa %1$s' -)); + 'Class:TapeLibrary/Attribute:tapes_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de sa %1$s', +]); // // Class: NAS // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '', 'Class:NAS/ComplementaryName' => '%1$s - %2$s', @@ -424,14 +424,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:NAS/Attribute:nasfilesystem_list/UI:Links:Delete:Button+' => 'Supprimer ce %4$s', 'Class:NAS/Attribute:nasfilesystem_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:NAS/Attribute:nasfilesystem_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', - 'Class:NAS/Attribute:nasfilesystem_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s' -)); + 'Class:NAS/Attribute:nasfilesystem_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s', +]); // // Class: PC // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:PC' => 'PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s', @@ -453,33 +453,33 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:PC/Attribute:type/Value:desktop+' => 'desktop', 'Class:PC/Attribute:type/Value:laptop' => 'laptop', 'Class:PC/Attribute:type/Value:laptop+' => 'laptop', -)); +]); // // Class: Printer // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Printer' => 'Imprimante', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerConnection // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:PowerConnection' => 'Connexion électrique', 'Class:PowerConnection+' => '', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerSource // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:PowerSource' => 'Arrivée électrique', 'Class:PowerSource+' => '', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s', @@ -490,14 +490,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:PowerSource/Attribute:pdus_list/UI:Links:Delete:Button+' => 'Supprimer ce %4$s', 'Class:PowerSource/Attribute:pdus_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:PowerSource/Attribute:pdus_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', - 'Class:PowerSource/Attribute:pdus_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s' -)); + 'Class:PowerSource/Attribute:pdus_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s', +]); // // Class: PDU // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s', @@ -509,23 +509,23 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:PDU/Attribute:powerstart_id+' => '', 'Class:PDU/Attribute:powerstart_name' => 'Nom Arrivée électrique', 'Class:PDU/Attribute:powerstart_name+' => '', -)); +]); // // Class: Peripheral // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Peripheral' => 'Périphérique', 'Class:Peripheral+' => '', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: Enclosure // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Enclosure' => 'Chassis', 'Class:Enclosure+' => '', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -542,14 +542,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Enclosure/Attribute:device_list/UI:Links:Delete:Button+' => 'Supprimer ce %4$s', 'Class:Enclosure/Attribute:device_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:Enclosure/Attribute:device_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', - 'Class:Enclosure/Attribute:device_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s' -)); + 'Class:Enclosure/Attribute:device_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s', +]); // // Class: ApplicationSolution // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ApplicationSolution' => 'Solution applicative', 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'CIs', @@ -566,13 +566,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'La solution est opérationelle si tous les CIs qui la composent sont opérationnels', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'Nombre minimal de CIs pour que la solution soit opérationnelle : %1$s', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'Pourcentage minimal de CIs pour que la solution soit opérationnelle : %1$s %%', -)); +]); // // Class: BusinessProcess // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:BusinessProcess' => 'Processus métier', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Solutions applicatives', @@ -586,14 +586,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:BusinessProcess/Attribute:status/Value:active' => 'Actif', 'Class:BusinessProcess/Attribute:status/Value:active+' => '', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'Inactif', - 'Class:BusinessProcess/Attribute:status/Value:inactive+' => '' -)); + 'Class:BusinessProcess/Attribute:status/Value:inactive+' => '', +]); // // Class: SoftwareInstance // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:SoftwareInstance' => 'Instance logiciel', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'Système', @@ -616,13 +616,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => '', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'Inactif', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => '', -)); +]); // // Class: Middleware // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Middleware' => 'Middleware', 'Class:Middleware+' => '', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Instance Middleware', @@ -632,14 +632,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Middleware/Attribute:middlewareinstance_list/UI:Links:Delete:Button+' => 'Supprimer cette %4$s', 'Class:Middleware/Attribute:middlewareinstance_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:Middleware/Attribute:middlewareinstance_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:Middleware/Attribute:middlewareinstance_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s' -)); + 'Class:Middleware/Attribute:middlewareinstance_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s', +]); // // Class: DBServer // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:DBServer' => 'Serveur de base de données', 'Class:DBServer+' => '', 'Class:DBServer/Attribute:dbschema_list' => 'Instances de base de données', @@ -649,14 +649,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:DBServer/Attribute:dbschema_list/UI:Links:Delete:Button+' => 'Supprimer cette %4$s', 'Class:DBServer/Attribute:dbschema_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:DBServer/Attribute:dbschema_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:DBServer/Attribute:dbschema_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s' -)); + 'Class:DBServer/Attribute:dbschema_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s', +]); // // Class: WebServer // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:WebServer' => 'Serveur Web', 'Class:WebServer+' => '', 'Class:WebServer/Attribute:webapp_list' => 'Application Web', @@ -666,32 +666,32 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:WebServer/Attribute:webapp_list/UI:Links:Delete:Button+' => 'Supprimer cette %4$s', 'Class:WebServer/Attribute:webapp_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:WebServer/Attribute:webapp_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:WebServer/Attribute:webapp_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s' -)); + 'Class:WebServer/Attribute:webapp_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s', +]); // // Class: PCSoftware // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:PCSoftware' => 'Logiciel PC', 'Class:PCSoftware+' => 'Application logicielle sur PC', -)); +]); // // Class: OtherSoftware // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:OtherSoftware' => 'Autre logiciel', 'Class:OtherSoftware+' => '', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:MiddlewareInstance' => 'Instance Middleware', 'Class:MiddlewareInstance+' => '', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s', @@ -699,13 +699,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Nom Middleware', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '', -)); +]); // // Class: DatabaseSchema // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:DatabaseSchema' => 'Instance de base de données', 'Class:DatabaseSchema+' => '', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s', @@ -713,13 +713,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'Nom Serveur de base de données', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '', -)); +]); // // Class: WebApplication // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:WebApplication' => 'Application Web', 'Class:WebApplication+' => '', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s', @@ -729,14 +729,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:WebApplication/Attribute:webserver_name+' => '', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '', -)); - +]); // // Class: VirtualDevice // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:VirtualDevice' => 'Equipement Virtuel', 'Class:VirtualDevice+' => '', 'Class:VirtualDevice/Attribute:status' => 'Etat', @@ -751,13 +750,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => '', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Volumes logiques', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'Tous les volumes logiques utilisés par ce matériel', -)); +]); // // Class: VirtualHost // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:VirtualHost' => 'Hôte Virtuel', 'Class:VirtualHost+' => '', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Machines virtuelles', @@ -767,14 +766,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:VirtualHost/Attribute:virtualmachine_list/UI:Links:Delete:Button+' => 'Supprimer cette %4$s', 'Class:VirtualHost/Attribute:virtualmachine_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:VirtualHost/Attribute:virtualmachine_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:VirtualHost/Attribute:virtualmachine_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s' -)); + 'Class:VirtualHost/Attribute:virtualmachine_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s', +]); // // Class: Hypervisor // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Hypervisor' => 'Hyperviseur', 'Class:Hypervisor+' => '', 'Class:Hypervisor/Attribute:farm_id' => 'vCluster', @@ -785,13 +784,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Hypervisor/Attribute:server_id+' => '', 'Class:Hypervisor/Attribute:server_name' => 'Nom serveur', 'Class:Hypervisor/Attribute:server_name+' => '', -)); +]); // // Class: Farm // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Farm' => 'vCluster', 'Class:Farm+' => '', 'Class:Farm/Attribute:hypervisor_list' => 'Hyperviseurs', @@ -805,14 +804,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Farm/Attribute:redundancy' => 'Haute disponibilité', 'Class:Farm/Attribute:redundancy/disabled' => 'Le vCluster est opérationnel si tous les hyperviseurs qui le composent sont opérationnels', 'Class:Farm/Attribute:redundancy/count' => 'Nombre minimal d\'hyperviseurs pour que le vCluster soit opérationnel : %1$s', - 'Class:Farm/Attribute:redundancy/percent' => 'Pourcentage minimal d\'hyperviseurs pour que le vCluster soit opérationnel : %1$s %%' -)); + 'Class:Farm/Attribute:redundancy/percent' => 'Pourcentage minimal d\'hyperviseurs pour que le vCluster soit opérationnel : %1$s %%', +]); // // Class: VirtualMachine // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:VirtualMachine' => 'Machine virtuelle', 'Class:VirtualMachine+' => '', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s', @@ -845,14 +844,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:VirtualMachine/Attribute:logicalinterface_list/UI:Links:Delete:Button+' => 'Supprimer cette %4$s', 'Class:VirtualMachine/Attribute:logicalinterface_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:VirtualMachine/Attribute:logicalinterface_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:VirtualMachine/Attribute:logicalinterface_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s' -)); + 'Class:VirtualMachine/Attribute:logicalinterface_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s', +]); // // Class: LogicalVolume // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:LogicalVolume' => 'Volume logique', 'Class:LogicalVolume+' => '', 'Class:LogicalVolume/Attribute:name' => 'Nom', @@ -873,13 +872,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'Tous les serveurs utilisant ce volume', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Machines virtuelles', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'Toutes les machines virtuelles utilisant ce volume', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkServerToVolume' => 'Lien Serveur / Volume', 'Class:lnkServerToVolume+' => '', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s', @@ -893,13 +892,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '', 'Class:lnkServerToVolume/Attribute:size_used' => 'Taille utilisée', 'Class:lnkServerToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkVirtualDeviceToVolume' => 'Lien Device virtuel / Volume', 'Class:lnkVirtualDeviceToVolume+' => '', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s', @@ -913,13 +912,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Taille utilisée', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkSanToDatacenterDevice' => 'Lien San / Device', 'Class:lnkSanToDatacenterDevice+' => '', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s', @@ -935,13 +934,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'Device FC', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '', -)); +]); // // Class: Tape // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Tape' => 'Bande', 'Class:Tape+' => '', 'Class:Tape/Attribute:name' => 'Nom', @@ -954,13 +953,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Tape/Attribute:tapelibrary_id+' => '', 'Class:Tape/Attribute:tapelibrary_name' => 'Nom Bandothèque', 'Class:Tape/Attribute:tapelibrary_name+' => '', -)); +]); // // Class: NASFileSystem // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:NASFileSystem' => 'Système de fichier NAS', 'Class:NASFileSystem+' => '', 'Class:NASFileSystem/Attribute:name' => 'Nom', @@ -975,13 +974,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:NASFileSystem/Attribute:nas_id+' => '', 'Class:NASFileSystem/Attribute:nas_name' => 'Nom NAS', 'Class:NASFileSystem/Attribute:nas_name+' => '', -)); +]); // // Class: Software // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Software' => 'Logiciel', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s', @@ -1028,14 +1027,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Software/Attribute:softwarelicence_list/UI:Links:Delete:Button+' => 'Supprimer cette %4$s', 'Class:Software/Attribute:softwarelicence_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:Software/Attribute:softwarelicence_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:Software/Attribute:softwarelicence_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s' -)); + 'Class:Software/Attribute:softwarelicence_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s', +]); // // Class: Patch // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Patch' => 'Patch', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => 'Nom', @@ -1046,13 +1045,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Sous-classe de Patch', 'Class:Patch/Attribute:finalclass+' => 'Nom de la classe instanciable', -)); +]); // // Class: OSPatch // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:OSPatch' => 'Patch OS', 'Class:OSPatch+' => '', 'Class:OSPatch/Attribute:functionalcis_list' => 'Systèmes', @@ -1061,13 +1060,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:OSPatch/Attribute:osversion_id+' => '', 'Class:OSPatch/Attribute:osversion_name' => 'Nom Version OS', 'Class:OSPatch/Attribute:osversion_name+' => '', -)); +]); // // Class: SoftwarePatch // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:SoftwarePatch' => 'Patch Logiciel', 'Class:SoftwarePatch+' => '', 'Class:SoftwarePatch/Attribute:software_id' => 'Logiciel', @@ -1079,14 +1078,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:SoftwarePatch/Attribute:softwareinstances_list/UI:Links:Add:Button+' => 'Ajouter une %4$s', 'Class:SoftwarePatch/Attribute:softwareinstances_list/UI:Links:Add:Modal:Title' => 'Ajouter une %4$s à %2$s', 'Class:SoftwarePatch/Attribute:softwareinstances_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:SoftwarePatch/Attribute:softwareinstances_list/UI:Links:Remove:Modal:Title' => 'Retirer une %4$s' -)); + 'Class:SoftwarePatch/Attribute:softwareinstances_list/UI:Links:Remove:Modal:Title' => 'Retirer une %4$s', +]); // // Class: Licence // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Licence' => 'License', 'Class:Licence+' => '', 'Class:Licence/Attribute:name' => 'Nom', @@ -1120,14 +1119,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Licence/Attribute:perpetual/Value:yes' => 'oui', 'Class:Licence/Attribute:perpetual/Value:yes+' => 'oui', 'Class:Licence/Attribute:finalclass' => 'Sous-classe de License', - 'Class:Licence/Attribute:finalclass+' => 'Nom de la classe instanciable' -)); + 'Class:Licence/Attribute:finalclass+' => 'Nom de la classe instanciable', +]); // // Class: OSLicence // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:OSLicence' => 'Licence OS', 'Class:OSLicence+' => '', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s', @@ -1150,14 +1149,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:OSLicence/Attribute:servers_list/UI:Links:Delete:Button+' => 'Supprimer ce %4$s', 'Class:OSLicence/Attribute:servers_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:OSLicence/Attribute:servers_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', - 'Class:OSLicence/Attribute:servers_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de sa %1$s' -)); + 'Class:OSLicence/Attribute:servers_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de sa %1$s', +]); // // Class: SoftwareLicence // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:SoftwareLicence' => 'Licence Logiciel', 'Class:SoftwareLicence+' => '', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s', @@ -1172,14 +1171,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:SoftwareLicence/Attribute:softwareinstance_list/UI:Links:Delete:Button+' => 'Supprimer cette %4$s', 'Class:SoftwareLicence/Attribute:softwareinstance_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:SoftwareLicence/Attribute:softwareinstance_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:SoftwareLicence/Attribute:softwareinstance_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de sa %1$s' -)); + 'Class:SoftwareLicence/Attribute:softwareinstance_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de sa %1$s', +]); // // Class: lnkDocumentToLicence // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkDocumentToLicence' => 'Lien Document / Licence', 'Class:lnkDocumentToLicence+' => '', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s', @@ -1191,35 +1190,35 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Nom Document', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '', -)); +]); // // Class: OSVersion // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:OSVersion' => 'Version OS', 'Class:OSVersion+' => '', 'Class:OSVersion/Attribute:osfamily_id' => 'Famille OS', 'Class:OSVersion/Attribute:osfamily_id+' => '', 'Class:OSVersion/Attribute:osfamily_name' => 'Nom Famille OS', 'Class:OSVersion/Attribute:osfamily_name+' => '', -)); +]); // // Class: OSFamily // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:OSFamily' => 'Famille OS', 'Class:OSFamily+' => '', -)); +]); // // Class: Brand // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Brand' => 'Marque', 'Class:Brand+' => '', 'Class:Brand/Attribute:logo' => 'Logo', @@ -1233,14 +1232,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Brand/Attribute:physicaldevices_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', 'Class:Brand/Attribute:physicaldevices_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de sa %1$s', 'Class:Brand/UniquenessRule:name+' => 'Le nom doit être unique', - 'Class:Brand/UniquenessRule:name' => 'cette marque existe déjà' -)); + 'Class:Brand/UniquenessRule:name' => 'cette marque existe déjà', +]); // // Class: Model // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Model' => 'Modèle', 'Class:Model+' => '', 'Class:Model/ComplementaryName' => '%1$s - %2$s', @@ -1297,14 +1296,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Model/Attribute:physicaldevices_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', 'Class:Model/Attribute:physicaldevices_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s', 'Class:Model/UniquenessRule:name_brand+' => 'Le nom doit être unique dans une marque', - 'Class:Model/UniquenessRule:name_brand' => 'ce modèle existe déjà dans cette marque' -)); + 'Class:Model/UniquenessRule:name_brand' => 'ce modèle existe déjà dans cette marque', +]); // // Class: NetworkDeviceType // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:NetworkDeviceType' => 'Type d\'équipement réseau', 'Class:NetworkDeviceType+' => '', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Equipements réseaux', @@ -1314,27 +1313,27 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list/UI:Links:Delete:Button+' => 'Supprimer ce %4$s', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', - 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s' -)); + 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s', +]); // // Class: IOSVersion // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:IOSVersion' => 'Version IOS', 'Class:IOSVersion+' => '', 'Class:IOSVersion/Attribute:brand_id' => 'Marque', 'Class:IOSVersion/Attribute:brand_id+' => '', 'Class:IOSVersion/Attribute:brand_name' => 'Nom Marque', 'Class:IOSVersion/Attribute:brand_name+' => '', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkDocumentToPatch' => 'Lien Document / Patch', 'Class:lnkDocumentToPatch+' => '', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s', @@ -1346,13 +1345,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Nom document', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Lien Instance logiciel / Patch logiciel', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s', @@ -1364,13 +1363,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Nom instance logicielle', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkFunctionalCIToOSPatch' => 'Lien CI Fonctionnel / Patch OS', 'Class:lnkFunctionalCIToOSPatch+' => '', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s', @@ -1382,13 +1381,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'Nom CI', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkDocumentToSoftware' => 'Lien Document / Logiciel', 'Class:lnkDocumentToSoftware+' => '', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s', @@ -1400,13 +1399,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Nom document', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '', -)); +]); // // Class: Subnet // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Subnet' => 'Subnet', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s', @@ -1425,13 +1424,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLANs', 'Class:Subnet/Attribute:vlans_list+' => '', -)); +]); // // Class: VLAN // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:VLAN' => 'VLAN', 'Class:VLAN+' => '', 'Class:VLAN/Attribute:vlan_tag' => 'VLAN Tag', @@ -1449,14 +1448,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:VLAN/Attribute:physicalinterfaces_list/UI:Links:Add:Button+' => 'Ajouter une %4$s', 'Class:VLAN/Attribute:physicalinterfaces_list/UI:Links:Add:Modal:Title' => 'Ajouter une %4$s à %2$s', 'Class:VLAN/Attribute:physicalinterfaces_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:VLAN/Attribute:physicalinterfaces_list/UI:Links:Remove:Modal:Title' => 'Retirer une %4$s' -)); + 'Class:VLAN/Attribute:physicalinterfaces_list/UI:Links:Remove:Modal:Title' => 'Retirer une %4$s', +]); // // Class: lnkSubnetToVLAN // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkSubnetToVLAN' => 'Lien Subnet / VLAN', 'Class:lnkSubnetToVLAN+' => '', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s', @@ -1470,26 +1469,26 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '', -)); +]); // // Class: NetworkInterface // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:NetworkInterface' => 'Interface Réseau', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'Nom', 'Class:NetworkInterface/Attribute:name+' => '', 'Class:NetworkInterface/Attribute:finalclass' => 'Sous-classe d\'Interface Réseau', 'Class:NetworkInterface/Attribute:finalclass+' => 'Nom de la classe instanciable', -)); +]); // // Class: IPInterface // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:IPInterface' => 'Interface IP', 'Class:IPInterface+' => '', 'Class:IPInterface/Attribute:ipaddress' => 'Adresse IP', @@ -1504,13 +1503,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:IPInterface/Attribute:ipmask+' => '', 'Class:IPInterface/Attribute:speed' => 'Vitesse', 'Class:IPInterface/Attribute:speed+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:PhysicalInterface' => 'Interface physique', 'Class:PhysicalInterface+' => '', 'Class:PhysicalInterface/Name' => '%2$s %1$s', @@ -1520,13 +1519,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLANs', 'Class:PhysicalInterface/Attribute:vlans_list+' => '', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Lien Interface réseau / VLAN', 'Class:lnkPhysicalInterfaceToVLAN+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s', @@ -1542,27 +1541,26 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '', -)); - +]); // // Class: LogicalInterface // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:LogicalInterface' => 'Interface logique', 'Class:LogicalInterface+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Machine virtuelle', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Nom Machine virtuelle', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:FiberChannelInterface' => 'Interface Fibre', 'Class:FiberChannelInterface+' => '', 'Class:FiberChannelInterface/Attribute:speed' => 'Vitesse', @@ -1575,13 +1573,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Nom Matériel', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Lien Device / Equipement réseau', 'Class:lnkConnectableCIToNetworkDevice+' => '', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s', @@ -1603,13 +1601,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'lien descendant', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'lien montant', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'lien montant', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Lien Solution Applicative / CI Fonctionnel', 'Class:lnkApplicationSolutionToFunctionalCI+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s', @@ -1621,13 +1619,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'Nom CI', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Lien Solution Applicative / Processus métier', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s', @@ -1639,13 +1637,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Nom Solution applicative', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', -)); +]); // // Class: Group // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Group' => 'Groupe', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s', @@ -1675,13 +1673,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Group/Attribute:ci_list+' => 'Tous les éléments de configuration liés à ce groupe', 'Class:Group/Attribute:parent_id_friendlyname' => 'Nom usuel du parent', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkGroupToCI' => 'Lien Groupe / CI', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s', @@ -1695,11 +1693,11 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Raison', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Server:baseinfo' => 'Informations générales', 'Server:Date' => 'Dates', 'Server:moreinfo' => 'Informations complémentaires', @@ -1712,14 +1710,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Subnet/Tab:FreeIPs-count' => 'IP disponibles: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Voici un échantillon de dix addresses IP disponibles', 'Class:Document:PreviewTab' => 'Aperçu', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkDocumentToFunctionalCI' => 'Lien Document / CI Fonctionnel', 'Class:lnkDocumentToFunctionalCI+' => '', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s', @@ -1731,13 +1728,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Nom Document', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '', -)); +]); // // Application Menu // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Menu:Application' => 'Logiciels', 'Menu:Application+' => 'Tous les logiciels', 'Menu:DBServer' => 'Serveur de base de données', @@ -1782,15 +1779,15 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Menu:OSVersion+' => '', 'Menu:Software' => 'Catalogue des logiciels de références', 'Menu:Software+' => 'Catalogue des logiciels de références', -)); +]); // // Class: PhysicalInterface // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/hu.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/hu.dict.itop-config-mgmt.php index 1c0bab98e..9dae7cbc6 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/hu.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/hu.dict.itop-config-mgmt.php @@ -1,15 +1,16 @@ 'Konfigurációs elem működését befolyásolják', 'Relation:impacts/DownStream' => 'Hatáselemzés', 'Relation:impacts/DownStream+' => 'Konfigurációs elem működését befolyásolják', @@ -21,8 +22,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Relation:impacts/LoadData' => 'Adat betöltés', 'Relation:impacts/NoFilteredData' => 'kérjük, válassza ki az objektumokat a grafikus nézetben', 'Relation:impacts/FilteredData' => 'Filtered data~~', -)); - +]); // Dictionnay conventions // Class: @@ -65,7 +65,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( // Class: lnkContactToFunctionalCI // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkContactToFunctionalCI' => 'Kapcsolattartó / Funkcionális CI', 'Class:lnkContactToFunctionalCI+' => '~~', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -77,13 +77,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '~~', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Kapcsolattartó név', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '~~', -)); +]); // // Class: FunctionalCI // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:FunctionalCI' => 'Funkcionális CI', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => 'CI Név', @@ -116,13 +116,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:FunctionalCI/Attribute:finalclass+' => '', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Nyitott hibajegyek', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Active Tickets which are impacting this functional CI~~', -)); +]); // // Class: PhysicalDevice // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:PhysicalDevice' => 'Fizikai eszköz', 'Class:PhysicalDevice+' => '~~', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -156,13 +156,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '~~', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Garanciaidő vége', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '~~', -)); +]); // // Class: Rack // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Rack' => 'Rack', 'Class:Rack+' => '~~', 'Class:Rack/ComplementaryName' => '%1$s - %2$s~~', @@ -172,64 +172,64 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Rack/Attribute:device_list+' => 'Minden fizikai eszköz amely ebbe a rack-be lett beszerelve', 'Class:Rack/Attribute:enclosure_list' => 'Beépítőkeretek', 'Class:Rack/Attribute:enclosure_list+' => 'Minden beépítőkeret ebben a rack-ben', -)); +]); // // Class: TelephonyCI // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TelephonyCI' => 'Telefónia CI', 'Class:TelephonyCI+' => '~~', 'Class:TelephonyCI/Attribute:phonenumber' => 'Telefonszám', 'Class:TelephonyCI/Attribute:phonenumber+' => '~~', -)); +]); // // Class: Phone // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Phone' => 'Telefon', 'Class:Phone+' => '~~', -)); +]); // // Class: MobilePhone // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:MobilePhone' => 'Mobiltelefon', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'PIN', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:IPPhone' => 'Egyéb eszköz', 'Class:IPPhone+' => '~~', -)); +]); // // Class: Tablet // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Tablet' => 'Táblagép', 'Class:Tablet+' => '~~', -)); +]); // // Class: ConnectableCI // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ConnectableCI' => 'Kapcsolható CI', 'Class:ConnectableCI+' => '', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s~~', @@ -237,13 +237,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'Hálózati eszközök, melyek ehhez a konfigurációs elemhez kapcsolódnak', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Hálózati csatolók', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'A konfigurációs elem fizikai hálózati csatolói', -)); +]); // // Class: DatacenterDevice // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:DatacenterDevice' => 'Adatközpont eszköz', 'Class:DatacenterDevice+' => '~~', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -275,13 +275,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'A készülék akkor működik, ha legalább az egyik tápcsatlakozás (A vagy B) működik.', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'A készülék akkor működik, ha az összes tápcsatlakozása működik.', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'Az eszköz akkor működik, ha legalább %1$s a %%-ből tápcsatlakozása működik.', -)); +]); // // Class: NetworkDevice // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:NetworkDevice' => 'Hálózati eszköz', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -297,13 +297,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => 'Műveleti memória', -)); +]); // // Class: Server // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Server' => 'Szerver', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s~~', @@ -325,61 +325,61 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Server/Attribute:ram+' => 'Műveleti memória', 'Class:Server/Attribute:logicalvolumes_list' => 'Logikai kötetek', 'Class:Server/Attribute:logicalvolumes_list+' => 'Logikai kötetek, melyek ehhez a szerverhez kapcsolódnak', -)); +]); // // Class: StorageSystem // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:StorageSystem' => 'Tárolórendszer', 'Class:StorageSystem+' => '', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s~~', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Logikai kötetek', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'Logikai kötetek ebben a tárolórendszerben', -)); +]); // // Class: SANSwitch // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:SANSwitch' => 'SAN Switch', 'Class:SANSwitch+' => 'Tárolórendszer switch', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s~~', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Kapcsolódó eszközök', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'Ehhez a SAN-switch-hez csatlakozó konfigurációs elemek', -)); +]); // // Class: TapeLibrary // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TapeLibrary' => 'Szalagos tároló', 'Class:TapeLibrary+' => 'Mágnesszalagos tároló', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s~~', 'Class:TapeLibrary/Attribute:tapes_list' => 'Szalagok', 'Class:TapeLibrary/Attribute:tapes_list+' => 'Szalagok (kazetták) a szalagos tárolóhoz', -)); +]); // // Class: NAS // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => 'Hálózati adattároló', 'Class:NAS/ComplementaryName' => '%1$s - %2$s~~', 'Class:NAS/Attribute:nasfilesystem_list' => 'Fájlrendszerek', 'Class:NAS/Attribute:nasfilesystem_list+' => 'A NAS fájlrendszerei', -)); +]); // // Class: PC // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:PC' => 'PC', 'Class:PC+' => 'Személyi számítógép', 'Class:PC/ComplementaryName' => '%1$s - %2$s~~', @@ -401,45 +401,45 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:PC/Attribute:type/Value:desktop+' => 'desktop~~', 'Class:PC/Attribute:type/Value:laptop' => 'Laptop', 'Class:PC/Attribute:type/Value:laptop+' => 'laptop~~', -)); +]); // // Class: Printer // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Printer' => 'Nyomtató', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerConnection // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:PowerConnection' => 'Tápellátás', 'Class:PowerConnection+' => '~~', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerSource // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:PowerSource' => 'Áramforrás', 'Class:PowerSource+' => 'UPS, generátor, akkumulátor stb.', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s~~', 'Class:PowerSource/Attribute:pdus_list' => 'PDU-k', 'Class:PowerSource/Attribute:pdus_list+' => 'Tápelosztók amik ezt az áramforrást használják', -)); +]); // // Class: PDU // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => 'Tápelosztó a rack-ben', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s~~', @@ -451,23 +451,23 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:PDU/Attribute:powerstart_id+' => '~~', 'Class:PDU/Attribute:powerstart_name' => 'Áramforrás név', 'Class:PDU/Attribute:powerstart_name+' => '~~', -)); +]); // // Class: Peripheral // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Peripheral' => 'Periféria', 'Class:Peripheral+' => '~~', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: Enclosure // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Enclosure' => 'Beépítőkeret', 'Class:Enclosure+' => 'Rack-be szerelhető készülékszerelvény', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -479,13 +479,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Enclosure/Attribute:nb_u+' => '~~', 'Class:Enclosure/Attribute:device_list' => 'Eszközök', 'Class:Enclosure/Attribute:device_list+' => '', -)); +]); // // Class: ApplicationSolution // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ApplicationSolution' => 'Alkalmazásmegoldás', 'Class:ApplicationSolution+' => 'Több alkalmazás és CI kombinációja egy adott feladatra', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'CI-k', @@ -502,13 +502,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'A megoldás akkor működik, ha minden CI működik.', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'A megoldás akkor működik, ha legalább %1$s CI működik', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'A megoldás akkor működik, ha legalább %1$s a %%-ből CI működik', -)); +]); // // Class: BusinessProcess // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:BusinessProcess' => 'Üzleti folyamat', 'Class:BusinessProcess+' => 'Személyek, szolgáltatások és CI-k értékteremtő kombinációja', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Alkalmazásmegoldások', @@ -519,13 +519,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => 'active~~', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'Inaktív', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => 'inactive~~', -)); +]); // // Class: SoftwareInstance // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:SoftwareInstance' => 'Szoftverpéldány', 'Class:SoftwareInstance+' => 'A szoftver telepített példányai', 'Class:SoftwareInstance/Attribute:system_id' => 'Rendszer', @@ -548,64 +548,64 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => '', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'Inaktív', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => '', -)); +]); // // Class: Middleware // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Middleware' => 'Middleware', 'Class:Middleware+' => 'Köztes szoftver rendszerek összekötéséhez', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Middleware példányok', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'Middleware példányok melyeket ez a middleware biztosít', -)); +]); // // Class: DBServer // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:DBServer' => 'Adatbázis szerver', 'Class:DBServer+' => 'Adatbázis kiszolgáló', 'Class:DBServer/Attribute:dbschema_list' => 'DB sémák', 'Class:DBServer/Attribute:dbschema_list+' => 'A DB szerver adatbázis sémái', -)); +]); // // Class: WebServer // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:WebServer' => 'Webszerver', 'Class:WebServer+' => 'Webkiszolgáló', 'Class:WebServer/Attribute:webapp_list' => 'Webalkalmazások', 'Class:WebServer/Attribute:webapp_list+' => 'Webalkalmazások, melyek elérhetőek ezen a webszerveren', -)); +]); // // Class: PCSoftware // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:PCSoftware' => 'PC Szoftver', 'Class:PCSoftware+' => 'Személyi számítógép szoftverei', -)); +]); // // Class: OtherSoftware // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:OtherSoftware' => 'Egyéb szoftver', 'Class:OtherSoftware+' => '~~', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:MiddlewareInstance' => 'Middleware Példány', 'Class:MiddlewareInstance+' => '~~', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s~~', @@ -613,13 +613,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '~~', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Middleware név', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '~~', -)); +]); // // Class: DatabaseSchema // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:DatabaseSchema' => 'Adatbázis séma', 'Class:DatabaseSchema+' => '~~', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s~~', @@ -627,13 +627,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '~~', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'DB szerver név', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '~~', -)); +]); // // Class: WebApplication // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:WebApplication' => 'Webalkalmazás', 'Class:WebApplication+' => '~~', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s~~', @@ -643,14 +643,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:WebApplication/Attribute:webserver_name+' => '~~', 'Class:WebApplication/Attribute:url' => 'URL~~', 'Class:WebApplication/Attribute:url+' => '~~', -)); - +]); // // Class: VirtualDevice // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:VirtualDevice' => 'Virtuális eszköz', 'Class:VirtualDevice+' => '~~', 'Class:VirtualDevice/Attribute:status' => 'Állapot', @@ -665,24 +664,24 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => 'stock~~', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Logikai kötetek', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'Logikai kötetek, amiket ez az eszköz használ', -)); +]); // // Class: VirtualHost // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:VirtualHost' => 'Virtuális gazdagép', 'Class:VirtualHost+' => '~~', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Virtuális gépek', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'Virtuális gépek, amelyeket ez a gazdagép futtat', -)); +]); // // Class: Hypervisor // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Hypervisor' => 'Hypervisor', 'Class:Hypervisor+' => 'Virtuális gépeket futtató szoftver', 'Class:Hypervisor/Attribute:farm_id' => 'Szerverfarm', @@ -693,13 +692,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Hypervisor/Attribute:server_id+' => '~~', 'Class:Hypervisor/Attribute:server_name' => 'Szerver név', 'Class:Hypervisor/Attribute:server_name+' => '~~', -)); +]); // // Class: Farm // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Farm' => 'Szerverfarm', 'Class:Farm+' => 'Szerverek egy klaszterben', 'Class:Farm/Attribute:hypervisor_list' => 'Hypervisor-ok', @@ -708,13 +707,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Farm/Attribute:redundancy/disabled' => 'A farm működik, ha az összes hypervisor működik.', 'Class:Farm/Attribute:redundancy/count' => 'A farm működik, ha legalább %1$s hypervisor működik', 'Class:Farm/Attribute:redundancy/percent' => 'A farm működik, ha legalább %1$s a %%-ből hypervisor működik.', -)); +]); // // Class: VirtualMachine // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:VirtualMachine' => 'Virtuális gép', 'Class:VirtualMachine+' => '~~', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s~~', @@ -742,13 +741,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:VirtualMachine/Attribute:managementip+' => '~~', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Hálózati csatolók', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'Logikai hálózati csatolók', -)); +]); // // Class: LogicalVolume // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:LogicalVolume' => 'Logikai kötet', 'Class:LogicalVolume+' => '~~', 'Class:LogicalVolume/Attribute:name' => 'Név', @@ -769,13 +768,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'Szerverek, melyek ezt a kötetet használják', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Virtuális eszközök', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'Virtuális eszközök, melyek ezt a kötetet használják', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkServerToVolume' => 'Szerver / Kötet', 'Class:lnkServerToVolume+' => '~~', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s~~', @@ -789,13 +788,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '~~', 'Class:lnkServerToVolume/Attribute:size_used' => 'Felhasznált tárhely', 'Class:lnkServerToVolume/Attribute:size_used+' => '~~', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkVirtualDeviceToVolume' => 'Virtuális eszköz / Kötet', 'Class:lnkVirtualDeviceToVolume+' => '~~', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s~~', @@ -809,13 +808,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '~~', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Felhasznált tárhely', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '~~', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkSanToDatacenterDevice' => 'SAN / Adatközpont eszköz', 'Class:lnkSanToDatacenterDevice+' => '~~', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s~~', @@ -831,13 +830,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '~~', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'Eszköz FC port', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '~~', -)); +]); // // Class: Tape // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Tape' => 'Szalag', 'Class:Tape+' => '~~', 'Class:Tape/Attribute:name' => 'Szalag név', @@ -850,13 +849,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Tape/Attribute:tapelibrary_id+' => '~~', 'Class:Tape/Attribute:tapelibrary_name' => 'Szalagos tároló név', 'Class:Tape/Attribute:tapelibrary_name+' => '~~', -)); +]); // // Class: NASFileSystem // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:NASFileSystem' => 'NAS Fájlrendszer', 'Class:NASFileSystem+' => '~~', 'Class:NASFileSystem/Attribute:name' => 'Fájlrendszer név', @@ -871,13 +870,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:NASFileSystem/Attribute:nas_id+' => '~~', 'Class:NASFileSystem/Attribute:nas_name' => 'NAS név', 'Class:NASFileSystem/Attribute:nas_name+' => '~~', -)); +]); // // Class: Software // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Software' => 'Szoftver', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s~~', @@ -907,13 +906,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Software/Attribute:softwarepatch_list+' => 'A szoftver javítócsomagjai', 'Class:Software/Attribute:softwarelicence_list' => 'Szoftver licencek', 'Class:Software/Attribute:softwarelicence_list+' => 'A szoftver licencei', -)); +]); // // Class: Patch // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Patch' => 'Szervizcsomag', 'Class:Patch+' => 'Szoftver patch', 'Class:Patch/Attribute:name' => 'Szervizcsomag név', @@ -924,13 +923,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Szervizcsomag típus', 'Class:Patch/Attribute:finalclass+' => 'A végső osztály neve', -)); +]); // // Class: OSPatch // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:OSPatch' => 'OS javítócsomag', 'Class:OSPatch+' => 'Operációs rendszer szervizcsomag', 'Class:OSPatch/Attribute:functionalcis_list' => 'Eszközök', @@ -939,13 +938,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:OSPatch/Attribute:osversion_id+' => '~~', 'Class:OSPatch/Attribute:osversion_name' => 'OS verzió név', 'Class:OSPatch/Attribute:osversion_name+' => '~~', -)); +]); // // Class: SoftwarePatch // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:SoftwarePatch' => 'Szoftver szervizcsomag', 'Class:SoftwarePatch+' => '~~', 'Class:SoftwarePatch/Attribute:software_id' => 'Szoftver', @@ -954,13 +953,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:SoftwarePatch/Attribute:software_name+' => '~~', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Szoftverpéldányok', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'Rendszerek, amelyekre telepítve van ez a szoftverjavítás', -)); +]); // // Class: Licence // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Licence' => 'Licenc', 'Class:Licence+' => '', 'Class:Licence/Attribute:name' => 'Licenc név', @@ -989,13 +988,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => 'yes~~', 'Class:Licence/Attribute:finalclass' => 'Licenc típus', 'Class:Licence/Attribute:finalclass+' => 'A végső osztály neve', -)); +]); // // Class: OSLicence // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:OSLicence' => 'OS Licenc', 'Class:OSLicence+' => '~~', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1007,13 +1006,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'Virtuális gépek, melyek ezt a licencet használják', 'Class:OSLicence/Attribute:servers_list' => 'Szerverek', 'Class:OSLicence/Attribute:servers_list+' => 'Szerverek, melyek ezt a licencet használják', -)); +]); // // Class: SoftwareLicence // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:SoftwareLicence' => 'Szoftver licenc', 'Class:SoftwareLicence+' => '~~', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1023,13 +1022,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:SoftwareLicence/Attribute:software_name+' => '~~', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Szoftverpéldányok', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'Rendszerek, melyek ezt a licencet használják', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkDocumentToLicence' => 'Dokumentum / Licenc', 'Class:lnkDocumentToLicence+' => '~~', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s~~', @@ -1041,35 +1040,35 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '~~', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Dokumentum név', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '~~', -)); +]); // // Class: OSVersion // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:OSVersion' => 'OS Verzió', 'Class:OSVersion+' => '~~', 'Class:OSVersion/Attribute:osfamily_id' => 'OS család', 'Class:OSVersion/Attribute:osfamily_id+' => '~~', 'Class:OSVersion/Attribute:osfamily_name' => 'OS család név', 'Class:OSVersion/Attribute:osfamily_name+' => '~~', -)); +]); // // Class: OSFamily // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:OSFamily' => 'OS család', 'Class:OSFamily+' => '~~', -)); +]); // // Class: Brand // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Brand' => 'Gyártó', 'Class:Brand+' => '~~', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1078,13 +1077,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'Ennek a gyártónak a fizikai eszközei', 'Class:Brand/UniquenessRule:name+' => '', 'Class:Brand/UniquenessRule:name' => 'Ez a gyártó már létezik', -)); +]); // // Class: Model // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Model' => 'Modell', 'Class:Model+' => '~~', 'Class:Model/ComplementaryName' => '%1$s - %2$s~~', @@ -1136,37 +1135,37 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Model/Attribute:physicaldevices_list+' => 'Fizikai eszközök melyek ehhez a modellszámhoz tartoznak', 'Class:Model/UniquenessRule:name_brand+' => 'A névnek egyedinek kell lennie a gyártón belül', 'Class:Model/UniquenessRule:name_brand' => 'A gyártó ezen modellje már létezik', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:NetworkDeviceType' => 'Hálózati eszköz típus', 'Class:NetworkDeviceType+' => '~~', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Hálózati eszközök', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'Ilyen típusú hálózati eszközök', -)); +]); // // Class: IOSVersion // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:IOSVersion' => 'IOS Verzió', 'Class:IOSVersion+' => 'A hálózati eszköz firmware-je', 'Class:IOSVersion/Attribute:brand_id' => 'Gyártó', 'Class:IOSVersion/Attribute:brand_id+' => '~~', 'Class:IOSVersion/Attribute:brand_name' => 'Gyártó név', 'Class:IOSVersion/Attribute:brand_name+' => '~~', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkDocumentToPatch' => 'Dokumentum / Szervizcsomag', 'Class:lnkDocumentToPatch+' => '~~', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s~~', @@ -1178,13 +1177,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '~~', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Dokumentum név', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Szoftverpéldány / Szoftver szervizcsomag', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '~~', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s~~', @@ -1196,13 +1195,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '~~', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Szoftverpéldány név', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '~~', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkFunctionalCIToOSPatch' => 'Funkcionális CI / OS szervizcsomag', 'Class:lnkFunctionalCIToOSPatch+' => '~~', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s~~', @@ -1214,13 +1213,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'Funkcionális CI név', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkDocumentToSoftware' => 'Dokumentum / Szoftver', 'Class:lnkDocumentToSoftware+' => '~~', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s~~', @@ -1232,13 +1231,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '~~', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Dokumentum név', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '~~', -)); +]); // // Class: Subnet // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Subnet' => 'Alhálózat', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s~~', @@ -1257,13 +1256,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLAN-ok', 'Class:Subnet/Attribute:vlans_list+' => '', -)); +]); // // Class: VLAN // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:VLAN' => 'VLAN', 'Class:VLAN+' => '~~', 'Class:VLAN/Attribute:vlan_tag' => 'VLAN Tag', @@ -1278,13 +1277,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:VLAN/Attribute:subnets_list+' => '~~', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Fizikai hálózati csatolók', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '~~', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkSubnetToVLAN' => 'Alhálózat / VLAN', 'Class:lnkSubnetToVLAN+' => '~~', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s~~', @@ -1298,26 +1297,26 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '~~', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '~~', -)); +]); // // Class: NetworkInterface // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:NetworkInterface' => 'Hálózati csatoló', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'Név', 'Class:NetworkInterface/Attribute:name+' => '~~', 'Class:NetworkInterface/Attribute:finalclass' => 'Hálózati csatoló típus', 'Class:NetworkInterface/Attribute:finalclass+' => 'A végső osztály neve', -)); +]); // // Class: IPInterface // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:IPInterface' => 'IP csatoló', 'Class:IPInterface+' => '~~', 'Class:IPInterface/Attribute:ipaddress' => 'IP cím', @@ -1332,13 +1331,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:IPInterface/Attribute:ipmask+' => '~~', 'Class:IPInterface/Attribute:speed' => 'Sebesség', 'Class:IPInterface/Attribute:speed+' => '~~', -)); +]); // // Class: PhysicalInterface // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:PhysicalInterface' => 'Fizikai csatoló', 'Class:PhysicalInterface+' => '~~', 'Class:PhysicalInterface/Name' => '%2$s %1$s~~', @@ -1348,13 +1347,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '~~', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLAN-ok', 'Class:PhysicalInterface/Attribute:vlans_list+' => '~~', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Fizikai csatoló / VLAN', 'Class:lnkPhysicalInterfaceToVLAN+' => '~~', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s~~', @@ -1370,27 +1369,26 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '~~', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '~~', -)); - +]); // // Class: LogicalInterface // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:LogicalInterface' => 'Logikai csatoló', 'Class:LogicalInterface+' => '~~', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Virtuális gép', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '~~', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Virtuális gép név', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:FiberChannelInterface' => 'FC csatoló', 'Class:FiberChannelInterface+' => '~~', 'Class:FiberChannelInterface/Attribute:speed' => 'Sebesség', @@ -1403,13 +1401,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '~~', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Eszköz név', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '~~', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Kapcsolható CI / Hálózati eszköz', 'Class:lnkConnectableCIToNetworkDevice+' => 'Hálózati csatlakozással rendelkező eszközök', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s~~', @@ -1431,13 +1429,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'bejövő link', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'Kimenő', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'kimenő link', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Alkalmazásmegoldás / Funkcionális CI', 'Class:lnkApplicationSolutionToFunctionalCI+' => '~~', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1449,13 +1447,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '~~', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'Funkcionális CI név', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Alkalmazásmegoldás / Üzleti folyamat', 'Class:lnkApplicationSolutionToBusinessProcess+' => '~~', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s~~', @@ -1467,13 +1465,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '~~', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Alkalmazásmegoldás név', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '~~', -)); +]); // // Class: Group // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Group' => 'Csoport', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s~~', @@ -1503,13 +1501,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Group/Attribute:ci_list+' => '', 'Class:Group/Attribute:parent_id_friendlyname' => 'Fölérendelt csoport név', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkGroupToCI' => 'CI csoport / CI', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s~~', @@ -1523,11 +1521,11 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Indoklás', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Server:baseinfo' => 'Általános információ', 'Server:Date' => 'Dátumok', 'Server:moreinfo' => 'További információ', @@ -1540,14 +1538,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Subnet/Tab:FreeIPs-count' => 'Szabad IP címek: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => '10 szabad IP cím kivonata', 'Class:Document:PreviewTab' => 'Előnézet', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkDocumentToFunctionalCI' => 'Dokumentum / Funkcionális CI', 'Class:lnkDocumentToFunctionalCI+' => '~~', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1559,13 +1556,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '~~', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Dokumentum név', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '~~', -)); +]); // // Application Menu // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Menu:Application' => 'Alkalmazások', 'Menu:Application+' => '', 'Menu:DBServer' => 'Adatbázis szerverek', @@ -1610,15 +1607,15 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Menu:OSVersion+' => '', 'Menu:Software' => 'Szoftverkatalógus', 'Menu:Software+' => 'Szoftverek', -)); +]); // // Class: PhysicalInterface // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/it.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/it.dict.itop-config-mgmt.php index f6e21c99c..918b71719 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/it.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/it.dict.itop-config-mgmt.php @@ -1,15 +1,16 @@ 'Elementi impattati da...', 'Relation:impacts/DownStream' => 'Impatto...', 'Relation:impacts/DownStream+' => 'Elementi impattati da...', @@ -21,8 +22,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Relation:impacts/LoadData' => 'Carica dati', 'Relation:impacts/NoFilteredData' => 'seleziona oggetti e carica dati', 'Relation:impacts/FilteredData' => 'Dati filtrati', -)); - +]); // Dictionnay conventions // Class: @@ -65,7 +65,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( // Class: lnkContactToFunctionalCI // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkContactToFunctionalCI' => 'Link Contact / FunctionalCI', 'Class:lnkContactToFunctionalCI+' => '~~', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s', @@ -77,13 +77,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '~~', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Nome Contatto', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '~~', -)); +]); // // Class: FunctionalCI // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:FunctionalCI' => 'CI Funzionale', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => 'Nome', @@ -116,13 +116,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:FunctionalCI/Attribute:finalclass+' => '', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Ticket attivi', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Ticket attivi che stanno influenzando questa CI funzionale', -)); +]); // // Class: PhysicalDevice // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:PhysicalDevice' => 'Dispositivo Fisico', 'Class:PhysicalDevice+' => '~~', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s', @@ -156,13 +156,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '~~', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Scadenza garanzia', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '~~', -)); +]); // // Class: Rack // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Rack' => 'Rack', 'Class:Rack+' => '~~', 'Class:Rack/ComplementaryName' => '%1$s - %2$s', @@ -172,64 +172,64 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Rack/Attribute:device_list+' => 'Tutti i dispositivi fisici installati in questo rack', 'Class:Rack/Attribute:enclosure_list' => 'Contenitori', 'Class:Rack/Attribute:enclosure_list+' => 'Tutti i contenitori in questo rack', -)); +]); // // Class: TelephonyCI // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TelephonyCI' => 'CI Telefoni', 'Class:TelephonyCI+' => '~~', 'Class:TelephonyCI/Attribute:phonenumber' => 'Numero di telefono', 'Class:TelephonyCI/Attribute:phonenumber+' => '~~', -)); +]); // // Class: Phone // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Phone' => 'Telefono fisso', 'Class:Phone+' => '~~', -)); +]); // // Class: MobilePhone // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:MobilePhone' => 'Cellulari', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'Hardware PIN', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:IPPhone' => 'Telefoni IP / VoIP', 'Class:IPPhone+' => '~~', -)); +]); // // Class: Tablet // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Tablet' => 'Tablet', 'Class:Tablet+' => '~~', -)); +]); // // Class: ConnectableCI // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ConnectableCI' => 'CI collegabile', 'Class:ConnectableCI+' => 'CI fisico', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s', @@ -237,13 +237,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'Tutti i dispositivi di rete collegati a questo dispositivo', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Interfacce di Rete', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'Tutte le interfacce di rete fisiche', -)); +]); // // Class: DatacenterDevice // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:DatacenterDevice' => 'Datacenter Device', 'Class:DatacenterDevice+' => '~~', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s', @@ -275,13 +275,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'Il dispositivo è operativo se almeno una connessione elettrica (A o B) è attiva', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'Il dispositivo è operativo se tutte le sue connessioni elettriche sono attive', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'Il dispositivo è operativo se almeno il %1$s %% delle sue connessioni elettriche sono attive', -)); +]); // // Class: NetworkDevice // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:NetworkDevice' => 'Dispositivi di rete', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s', @@ -297,13 +297,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '~~', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Server' => 'Server', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s', @@ -325,61 +325,61 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => 'Volumi Logici', 'Class:Server/Attribute:logicalvolumes_list+' => 'Tutti i volumi logici collegati a questo server', -)); +]); // // Class: StorageSystem // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:StorageSystem' => 'Sistema di Archiviazione', 'Class:StorageSystem+' => '~~', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Volumi Logici', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'Tutti i volumi logici in questo sistema di archiviazione', -)); +]); // // Class: SANSwitch // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:SANSwitch' => 'SAN Switch', 'Class:SANSwitch+' => '~~', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Dispositivi', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'Tutti i dispositivi collegati a questo switch SAN', -)); +]); // // Class: TapeLibrary // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TapeLibrary' => 'Libreria di Nastri', 'Class:TapeLibrary+' => '~~', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s', 'Class:TapeLibrary/Attribute:tapes_list' => 'Nastri', 'Class:TapeLibrary/Attribute:tapes_list+' => 'Tutti i nastri nella libreria di nastri', -)); +]); // // Class: NAS // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '~~', 'Class:NAS/ComplementaryName' => '%1$s - %2$s', 'Class:NAS/Attribute:nasfilesystem_list' => 'File System', 'Class:NAS/Attribute:nasfilesystem_list+' => 'Tutti i file system in questo NAS', -)); +]); // // Class: PC // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:PC' => 'PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s', @@ -401,45 +401,45 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:PC/Attribute:type/Value:desktop+' => 'desktop~~', 'Class:PC/Attribute:type/Value:laptop' => 'laptop~~', 'Class:PC/Attribute:type/Value:laptop+' => 'laptop~~', -)); +]); // // Class: Printer // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Printer' => 'Stampante', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerConnection // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:PowerConnection' => 'Connessione di Alimentazione', 'Class:PowerConnection+' => '~~', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerSource // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:PowerSource' => 'Sorgente di Alimentazione', 'Class:PowerSource+' => '~~', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s', 'Class:PowerSource/Attribute:pdus_list' => 'PDU', 'Class:PowerSource/Attribute:pdus_list+' => 'Tutte le PDU che utilizzano questa sorgente di alimentazione', -)); +]); // // Class: PDU // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '~~', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s', @@ -451,23 +451,23 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:PDU/Attribute:powerstart_id+' => '~~', 'Class:PDU/Attribute:powerstart_name' => 'Nome Avvio Alimentazione', 'Class:PDU/Attribute:powerstart_name+' => '~~', -)); +]); // // Class: Peripheral // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Peripheral' => 'Periferica', 'Class:Peripheral+' => '~~', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: Enclosure // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Enclosure' => 'Contenitore', 'Class:Enclosure+' => '~~', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -479,13 +479,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Enclosure/Attribute:nb_u+' => '~~', 'Class:Enclosure/Attribute:device_list' => 'Dispositivi', 'Class:Enclosure/Attribute:device_list+' => 'Tutti i dispositivi in questo contenitore', -)); +]); // // Class: ApplicationSolution // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ApplicationSolution' => 'Soluzione Applicativa', 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'CIs', @@ -502,13 +502,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'La soluzione è attiva se tutti gli elementi di configurazione sono attivi', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'La soluzione è attiva se almeno %1$s elemento(i) di configurazione sono attivi', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'La soluzione è attiva se almeno il %1$s %% degli elementi di configurazione sono attivi', -)); +]); // // Class: BusinessProcess // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:BusinessProcess' => 'Processi Aziendali', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Soluzioni Applicative', @@ -519,13 +519,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => 'attivo', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'inattivo', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => 'inattivo', -)); +]); // // Class: SoftwareInstance // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:SoftwareInstance' => 'Istanza Software', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'Sistema', @@ -548,64 +548,64 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => 'attivo', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'inattivo', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => 'inattivo', -)); +]); // // Class: Middleware // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Middleware' => 'Middleware', 'Class:Middleware+' => '~~', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Istanze Middleware', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'Tutte le istanze del middleware fornite da questo middleware', -)); +]); // // Class: DBServer // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:DBServer' => 'Database', 'Class:DBServer+' => 'Database server SW', 'Class:DBServer/Attribute:dbschema_list' => 'Schema Database', 'Class:DBServer/Attribute:dbschema_list+' => 'Tutti gli schemi del database per questo server di database', -)); +]); // // Class: WebServer // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:WebServer' => 'Server Web', 'Class:WebServer+' => '~~', 'Class:WebServer/Attribute:webapp_list' => 'Applicazioni Web', 'Class:WebServer/Attribute:webapp_list+' => 'Tutte le applicazioni web disponibili su questo server web', -)); +]); // // Class: PCSoftware // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:PCSoftware' => 'Software PC', 'Class:PCSoftware+' => '~~', -)); +]); // // Class: OtherSoftware // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:OtherSoftware' => 'Altro Software', 'Class:OtherSoftware+' => '~~', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:MiddlewareInstance' => 'Istanza Middleware', 'Class:MiddlewareInstance+' => '~~', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s', @@ -613,13 +613,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '~~', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Nome Middleware', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '~~', -)); +]); // // Class: DatabaseSchema // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:DatabaseSchema' => 'Schema del Database', 'Class:DatabaseSchema+' => '~~', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s', @@ -627,13 +627,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '~~', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'Nome Server del Database', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '~~', -)); +]); // // Class: WebApplication // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:WebApplication' => 'Web Application', 'Class:WebApplication+' => '~~', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s', @@ -643,14 +643,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:WebApplication/Attribute:webserver_name+' => '~~', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '~~', -)); - +]); // // Class: VirtualDevice // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:VirtualDevice' => 'Dispositivo Virtuale', 'Class:VirtualDevice+' => '~~', 'Class:VirtualDevice/Attribute:status' => 'Stato', @@ -665,24 +664,24 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => 'In Stock', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Volumi Logici', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'Tutti i volumi logici utilizzati da questo dispositivo', -)); +]); // // Class: VirtualHost // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:VirtualHost' => 'Host Virtuale', 'Class:VirtualHost+' => '~~', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Macchine Virtuali', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'Tutte le macchine virtuali ospitate da questo host', -)); +]); // // Class: Hypervisor // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Hypervisor' => 'Hypervisor', 'Class:Hypervisor+' => '~~', 'Class:Hypervisor/Attribute:farm_id' => 'Farm', @@ -693,13 +692,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Hypervisor/Attribute:server_id+' => '~~', 'Class:Hypervisor/Attribute:server_name' => 'Nome Server', 'Class:Hypervisor/Attribute:server_name+' => '~~', -)); +]); // // Class: Farm // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Farm' => 'Farm', 'Class:Farm+' => '~~', 'Class:Farm/Attribute:hypervisor_list' => 'Hypervisors', @@ -708,13 +707,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Farm/Attribute:redundancy/disabled' => 'La farm è attiva se tutti gli hypervisor sono attivi', 'Class:Farm/Attribute:redundancy/count' => 'La farm è attiva se almeno %1$s hypervisor è(sono) attivo(i)', 'Class:Farm/Attribute:redundancy/percent' => 'La farm è attiva se almeno %1$s %% degli hypervisor è attivo', -)); +]); // // Class: VirtualMachine // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:VirtualMachine' => 'Macchina Virtuale', 'Class:VirtualMachine+' => '~~', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s', @@ -742,13 +741,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:VirtualMachine/Attribute:managementip+' => '~~', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Interfacce di Rete Logiche', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'Tutte le interfacce di rete logiche', -)); +]); // // Class: LogicalVolume // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:LogicalVolume' => 'Volume Logico', 'Class:LogicalVolume+' => '~~', 'Class:LogicalVolume/Attribute:name' => 'Nome', @@ -769,13 +768,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'Tutti i server che utilizzano questo volume', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Dispositivi Virtuali', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'Tutti i dispositivi virtuali che utilizzano questo volume', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkServerToVolume' => 'Collegamento Server / Volume', 'Class:lnkServerToVolume+' => '~~', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s', @@ -789,13 +788,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '~~', 'Class:lnkServerToVolume/Attribute:size_used' => 'Dimensione utilizzata', 'Class:lnkServerToVolume/Attribute:size_used+' => '~~', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkVirtualDeviceToVolume' => 'Collegamento Dispositivo Virtuale / Volume', 'Class:lnkVirtualDeviceToVolume+' => '~~', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s', @@ -809,13 +808,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '~~', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Dimensione utilizzata', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '~~', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkSanToDatacenterDevice' => 'Collegamento SAN / Dispositivo Datacenter', 'Class:lnkSanToDatacenterDevice+' => '~~', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s', @@ -831,13 +830,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '~~', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'Porta Dispositivo FC', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '~~', -)); +]); // // Class: Tape // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Tape' => 'Nastro', 'Class:Tape+' => '~~', 'Class:Tape/Attribute:name' => 'Nome', @@ -850,13 +849,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Tape/Attribute:tapelibrary_id+' => '~~', 'Class:Tape/Attribute:tapelibrary_name' => 'Nome della libreria di nastri', 'Class:Tape/Attribute:tapelibrary_name+' => '~~', -)); +]); // // Class: NASFileSystem // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:NASFileSystem' => 'File System NAS', 'Class:NASFileSystem+' => '~~', 'Class:NASFileSystem/Attribute:name' => 'Nome', @@ -871,13 +870,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:NASFileSystem/Attribute:nas_id+' => '~~', 'Class:NASFileSystem/Attribute:nas_name' => 'Nome del NAS', 'Class:NASFileSystem/Attribute:nas_name+' => '~~', -)); +]); // // Class: Software // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Software' => 'Software', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s', @@ -907,13 +906,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Software/Attribute:softwarepatch_list+' => 'Tutte le patch per questo software', 'Class:Software/Attribute:softwarelicence_list' => 'Licenze Software', 'Class:Software/Attribute:softwarelicence_list+' => 'Tutte le licenze per questo software', -)); +]); // // Class: Patch // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Patch' => 'Patch', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => 'Nome', @@ -924,13 +923,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Tipo', 'Class:Patch/Attribute:finalclass+' => 'Nome della classe finale', -)); +]); // // Class: OSPatch // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:OSPatch' => 'Patch del Sistema Operativo', 'Class:OSPatch+' => '~~', 'Class:OSPatch/Attribute:functionalcis_list' => 'Dispositivi', @@ -939,13 +938,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:OSPatch/Attribute:osversion_id+' => '~~', 'Class:OSPatch/Attribute:osversion_name' => 'Nome della Versione del Sistema Operativo', 'Class:OSPatch/Attribute:osversion_name+' => '~~', -)); +]); // // Class: SoftwarePatch // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:SoftwarePatch' => 'Patch del Software', 'Class:SoftwarePatch+' => '~~', 'Class:SoftwarePatch/Attribute:software_id' => 'Software', @@ -954,13 +953,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:SoftwarePatch/Attribute:software_name+' => '~~', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Istanze del Software', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'Tutti i sistemi in cui questa patch del software è installata', -)); +]); // // Class: Licence // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Licence' => 'Licenza', 'Class:Licence+' => '', 'Class:Licence/Attribute:name' => 'Nome', @@ -989,13 +988,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => 'sì', 'Class:Licence/Attribute:finalclass' => 'Tipo', 'Class:Licence/Attribute:finalclass+' => 'Nome della classe finale', -)); +]); // // Class: OSLicence // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:OSLicence' => 'Licenza OS', 'Class:OSLicence+' => '~~', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s', @@ -1007,13 +1006,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'Tutte le macchine virtuali in cui questa licenza è utilizzata', 'Class:OSLicence/Attribute:servers_list' => 'Server', 'Class:OSLicence/Attribute:servers_list+' => 'Tutti i server in cui questa licenza è utilizzata', -)); +]); // // Class: SoftwareLicence // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:SoftwareLicence' => 'Licenza software', 'Class:SoftwareLicence+' => '~~', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s', @@ -1023,13 +1022,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:SoftwareLicence/Attribute:software_name+' => '~~', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Istanze software', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'Tutti i sistemi in cui questa licenza è utilizzata', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkDocumentToLicence' => 'Link Documento/Licenza', 'Class:lnkDocumentToLicence+' => '~~', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s', @@ -1041,35 +1040,35 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '~~', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Nome documento', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '~~', -)); +]); // // Class: OSVersion // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:OSVersion' => 'Versione del Sistema Operativo', 'Class:OSVersion+' => '~~', 'Class:OSVersion/Attribute:osfamily_id' => 'Famiglia del Sistema Operativo', 'Class:OSVersion/Attribute:osfamily_id+' => '~~', 'Class:OSVersion/Attribute:osfamily_name' => 'Nome della Famiglia del Sistema Operativo', 'Class:OSVersion/Attribute:osfamily_name+' => '~~', -)); +]); // // Class: OSFamily // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:OSFamily' => 'Famiglia del Sistema Operativo', 'Class:OSFamily+' => '~~', -)); +]); // // Class: Brand // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Brand' => 'Marca', 'Class:Brand+' => '~~', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1078,13 +1077,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'Tutti i dispositivi fisici corrispondenti a questa marca', 'Class:Brand/UniquenessRule:name+' => 'Il nome deve essere univoco', 'Class:Brand/UniquenessRule:name' => 'Questa marca esiste già', -)); +]); // // Class: Model // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Model' => 'Modello', 'Class:Model+' => '~~', 'Class:Model/Attribute/type/Value:NAS+' => 'NAS', @@ -1161,37 +1160,37 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Model/Attribute:physicaldevices_list+' => 'Tutti i dispositivi fisici corrispondenti a questo modello', 'Class:Model/UniquenessRule:name_brand+' => 'Il nome deve essere univoco nella marca', 'Class:Model/UniquenessRule:name_brand' => 'Questo modello esiste già per questa marca', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:NetworkDeviceType' => 'Tipo di Dispositivo di Rete', 'Class:NetworkDeviceType+' => '~~', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Dispositivi di Rete', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'Tutti i dispositivi di rete corrispondenti a questo tipo', -)); +]); // // Class: IOSVersion // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:IOSVersion' => 'Versione IOS', 'Class:IOSVersion+' => '~~', 'Class:IOSVersion/Attribute:brand_id' => 'Marca', 'Class:IOSVersion/Attribute:brand_id+' => '~~', 'Class:IOSVersion/Attribute:brand_name' => 'Nome della Marca', 'Class:IOSVersion/Attribute:brand_name+' => '~~', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkDocumentToPatch' => 'Collegamento Documento / Patch', 'Class:lnkDocumentToPatch+' => '~~', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s', @@ -1203,13 +1202,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '~~', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Nome del Documento', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Collegamento Istanzia Software / Patch Software', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '~~', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s', @@ -1221,13 +1220,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '~~', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Nome dell\'Istanza Software', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '~~', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkFunctionalCIToOSPatch' => 'Collegamento CI Funzionale / Patch OS', 'Class:lnkFunctionalCIToOSPatch+' => '~~', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s', @@ -1239,13 +1238,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'Nome del CI Funzionale', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkDocumentToSoftware' => 'Collegamento Documento / Software', 'Class:lnkDocumentToSoftware+' => '~~', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s', @@ -1257,13 +1256,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '~~', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Nome del Documento', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '~~', -)); +]); // // Class: Subnet // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Subnet' => 'Subnet', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s', @@ -1282,13 +1281,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLANs', 'Class:Subnet/Attribute:vlans_list+' => '~~', -)); +]); // // Class: VLAN // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:VLAN' => 'VLAN', 'Class:VLAN+' => '~~', 'Class:VLAN/Attribute:vlan_tag' => 'VLAN Tag', @@ -1303,13 +1302,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:VLAN/Attribute:subnets_list+' => '~~', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Interfacce di rete fisiche', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '~~', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkSubnetToVLAN' => 'Link Subnet / VLAN', 'Class:lnkSubnetToVLAN+' => '~~', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s', @@ -1323,26 +1322,26 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '~~', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'VLAN Tag', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '~~', -)); +]); // // Class: NetworkInterface // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:NetworkInterface' => 'Interfaccia di Rete', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'Nome', 'Class:NetworkInterface/Attribute:name+' => '~~', 'Class:NetworkInterface/Attribute:finalclass' => 'Tipo', 'Class:NetworkInterface/Attribute:finalclass+' => 'Nome della classe finale', -)); +]); // // Class: IPInterface // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:IPInterface' => 'Interfaccia IP', 'Class:IPInterface+' => '~~', 'Class:IPInterface/Attribute:ipaddress' => 'Indirizzo IP', @@ -1357,13 +1356,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:IPInterface/Attribute:ipmask+' => '~~', 'Class:IPInterface/Attribute:speed' => 'Velocità', 'Class:IPInterface/Attribute:speed+' => '~~', -)); +]); // // Class: PhysicalInterface // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:PhysicalInterface' => 'Interfaccia Fisica', 'Class:PhysicalInterface+' => '~~', 'Class:PhysicalInterface/Name' => '%2$s %1$s', @@ -1373,13 +1372,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '~~', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLAN', 'Class:PhysicalInterface/Attribute:vlans_list+' => '~~', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Collegamento Interfaccia Fisica / VLAN', 'Class:lnkPhysicalInterfaceToVLAN+' => '~~', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s', @@ -1395,27 +1394,26 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '~~', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'Tag VLAN', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '~~', -)); - +]); // // Class: LogicalInterface // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:LogicalInterface' => 'Interfaccia Logica', 'Class:LogicalInterface+' => '~~', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Macchina Virtuale', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '~~', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Nome Macchina Virtuale', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:FiberChannelInterface' => 'Interfaccia Fibre Channel', 'Class:FiberChannelInterface+' => '~~', 'Class:FiberChannelInterface/Attribute:speed' => 'Velocità', @@ -1428,13 +1426,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '~~', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Nome Dispositivo', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '~~', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Collega CI collegabile / Dispositivo di rete', 'Class:lnkConnectableCIToNetworkDevice+' => '~~', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s', @@ -1456,13 +1454,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'Collegamento verso il basso', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'Collegamento verso l\'alto', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'Collegamento verso l\'alto', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Collega Soluzione Applicativa / CI Funzionale', 'Class:lnkApplicationSolutionToFunctionalCI+' => '~~', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s', @@ -1474,13 +1472,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '~~', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'Nome CI Funzionale', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Collega Soluzione Applicativa / Processo Aziendale', 'Class:lnkApplicationSolutionToBusinessProcess+' => '~~', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s', @@ -1492,13 +1490,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '~~', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Nome Soluzione Applicativa', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '~~', -)); +]); // // Class: Group // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Group' => 'Gruppo', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s', @@ -1528,13 +1526,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Group/Attribute:ci_list+' => 'Tutti gli elementi di configurazione collegati a questo gruppo', 'Class:Group/Attribute:parent_id_friendlyname' => 'Nome del Gruppo Padre', 'Class:Group/Attribute:parent_id_friendlyname+' => '~~', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkGroupToCI' => 'Gruppo / CI', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s', @@ -1548,11 +1546,11 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Motivo', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Server:baseinfo' => 'Informazioni generali', 'Server:Date' => 'Date', 'Server:moreinfo' => 'Ulteriori informazioni', @@ -1565,14 +1563,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Subnet/Tab:FreeIPs-count' => 'IP liberi: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Ecco un estratto di 10 indirizzi IP liberi', 'Class:Document:PreviewTab' => 'Anteprima', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkDocumentToFunctionalCI' => 'Collegamento Documento / FunctionalCI', 'Class:lnkDocumentToFunctionalCI+' => '~~', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s', @@ -1584,13 +1581,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '~~', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Nome documento', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '~~', -)); +]); // // Application Menu // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Menu:Application' => 'Applicazioni', 'Menu:Application+' => 'Tutte le applicazioni', 'Menu:DBServer' => 'Server di Database', @@ -1635,15 +1632,15 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Menu:OSVersion+' => '~~', 'Menu:Software' => 'Catalogo Software', 'Menu:Software+' => 'Catalogo Software', -)); +]); // // Class: PhysicalInterface // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/ja.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/ja.dict.itop-config-mgmt.php index fa5a6aafa..1851ae423 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/ja.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/ja.dict.itop-config-mgmt.php @@ -1,15 +1,16 @@ 'インパクトを受ける要素', 'Relation:impacts/DownStream' => 'インパクト...', 'Relation:impacts/DownStream+' => 'インパクトを受ける要素', @@ -21,8 +22,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Relation:impacts/LoadData' => 'Load data~~', 'Relation:impacts/NoFilteredData' => 'please select objects and load data~~', 'Relation:impacts/FilteredData' => 'Filtered data~~', -)); - +]); // Dictionnay conventions // Class: @@ -65,7 +65,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( // Class: lnkContactToFunctionalCI // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkContactToFunctionalCI' => 'リンク 連絡先/機能的CI', 'Class:lnkContactToFunctionalCI+' => '', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -77,13 +77,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => '連絡先名', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:FunctionalCI' => '機能的CI', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => '名前', @@ -116,13 +116,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:FunctionalCI/Attribute:finalclass+' => '', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Active Tickets~~', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Active Tickets which are impacting this functional CI~~', -)); +]); // // Class: PhysicalDevice // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:PhysicalDevice' => '物理的デバイス', 'Class:PhysicalDevice+' => '', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -156,13 +156,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '', 'Class:PhysicalDevice/Attribute:end_of_warranty' => '保障終了日', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '', -)); +]); // // Class: Rack // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Rack' => 'ラック', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s~~', @@ -172,64 +172,64 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Rack/Attribute:device_list+' => 'All the physical devices racked into this rack~~', 'Class:Rack/Attribute:enclosure_list' => 'エンクロージャ', 'Class:Rack/Attribute:enclosure_list+' => 'All the enclosures in this rack~~', -)); +]); // // Class: TelephonyCI // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TelephonyCI' => '電話 CI', 'Class:TelephonyCI+' => '', 'Class:TelephonyCI/Attribute:phonenumber' => '電話番号', 'Class:TelephonyCI/Attribute:phonenumber+' => '', -)); +]); // // Class: Phone // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Phone' => '電話', 'Class:Phone+' => '', -)); +]); // // Class: MobilePhone // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:MobilePhone' => '携帯電話', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'ハードウエアPIN', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:IPPhone' => 'IP電話', 'Class:IPPhone+' => '', -)); +]); // // Class: Tablet // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Tablet' => 'タブレット', 'Class:Tablet+' => '', -)); +]); // // Class: ConnectableCI // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ConnectableCI' => '接続可能なCI', 'Class:ConnectableCI+' => '物理的なCI', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s~~', @@ -237,13 +237,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'All network devices connected to this device~~', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'ネットワークインターフェース', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'All the physical network interfaces~~', -)); +]); // // Class: DatacenterDevice // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:DatacenterDevice' => 'データセンターデバイス', 'Class:DatacenterDevice+' => '', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -275,13 +275,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'The device %2$s is up if at least one power connection (A or B) is up~~', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'The device %2$s is up if all its power connections are up~~', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'The device %2$s is up if at least %1$s %% of its power connections are up~~', -)); +]); // // Class: NetworkDevice // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:NetworkDevice' => 'ネットワークデバイス', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -297,13 +297,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Server' => 'サーバ', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s~~', @@ -325,61 +325,61 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => '論理ボリューム', 'Class:Server/Attribute:logicalvolumes_list+' => 'All the logical volumes connected to this server~~', -)); +]); // // Class: StorageSystem // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:StorageSystem' => 'ストレージシステム', 'Class:StorageSystem+' => '', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s~~', 'Class:StorageSystem/Attribute:logicalvolume_list' => '論理ボリューム', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'All the logical volumes in this storage system~~', -)); +]); // // Class: SANSwitch // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:SANSwitch' => 'SANスイッチ', 'Class:SANSwitch+' => '', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s~~', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'デバイス', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'All the devices connected to this SAN switch~~', -)); +]); // // Class: TapeLibrary // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TapeLibrary' => 'テープライブラリ', 'Class:TapeLibrary+' => '', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s~~', 'Class:TapeLibrary/Attribute:tapes_list' => 'テープ', 'Class:TapeLibrary/Attribute:tapes_list+' => 'All the tapes in the tape library~~', -)); +]); // // Class: NAS // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '', 'Class:NAS/ComplementaryName' => '%1$s - %2$s~~', 'Class:NAS/Attribute:nasfilesystem_list' => 'ファイルシステム', 'Class:NAS/Attribute:nasfilesystem_list+' => 'All the file systems in this NAS~~', -)); +]); // // Class: PC // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:PC' => 'PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s~~', @@ -401,45 +401,45 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:PC/Attribute:type/Value:desktop+' => 'デスクトップ', 'Class:PC/Attribute:type/Value:laptop' => 'ラップトップ', 'Class:PC/Attribute:type/Value:laptop+' => 'ラップトップ', -)); +]); // // Class: Printer // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Printer' => 'プリンター', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerConnection // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:PowerConnection' => '電源接続', 'Class:PowerConnection+' => '', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerSource // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:PowerSource' => '電源', 'Class:PowerSource+' => '', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s~~', 'Class:PowerSource/Attribute:pdus_list' => 'PDU', 'Class:PowerSource/Attribute:pdus_list+' => 'All the PDUs using this power source~~', -)); +]); // // Class: PDU // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s~~', @@ -451,23 +451,23 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:PDU/Attribute:powerstart_id+' => '', 'Class:PDU/Attribute:powerstart_name' => 'パワースタート名', 'Class:PDU/Attribute:powerstart_name+' => '', -)); +]); // // Class: Peripheral // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Peripheral' => '周辺', 'Class:Peripheral+' => '', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: Enclosure // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Enclosure' => 'エンクロージャ', 'Class:Enclosure+' => '', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -479,13 +479,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Enclosure/Attribute:nb_u+' => '', 'Class:Enclosure/Attribute:device_list' => 'デバイス', 'Class:Enclosure/Attribute:device_list+' => 'All the devices in this enclosure~~', -)); +]); // // Class: ApplicationSolution // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ApplicationSolution' => 'アプリケーションソリューション', 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'CI', @@ -502,13 +502,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'The solution is up if all CIs are up~~', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'The solution is up if at least %1$s CI(s) is(are) up~~', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'The solution is up if at least %1$s %% of the CIs are up~~', -)); +]); // // Class: BusinessProcess // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:BusinessProcess' => 'ビジネスプロセス', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'アプリケーションソリューション', @@ -519,13 +519,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => 'アクティブ', 'Class:BusinessProcess/Attribute:status/Value:inactive' => '非アクティブ', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => '非アクティブ', -)); +]); // // Class: SoftwareInstance // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:SoftwareInstance' => 'ソフトウエアインスタンス', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'システム', @@ -548,64 +548,64 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => 'アクティブ', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => '非アクティブ', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => '非アクティブ', -)); +]); // // Class: Middleware // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Middleware' => 'ミドルウエア', 'Class:Middleware+' => '', 'Class:Middleware/Attribute:middlewareinstance_list' => 'ミドルウエアインスタンス', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'All the middleware instances provided by this middleware~~', -)); +]); // // Class: DBServer // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:DBServer' => 'DBサーバ', 'Class:DBServer+' => '', 'Class:DBServer/Attribute:dbschema_list' => 'DBスキーマ', 'Class:DBServer/Attribute:dbschema_list+' => 'All the database schemas for this DB server~~', -)); +]); // // Class: WebServer // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:WebServer' => 'Webサーバ', 'Class:WebServer+' => '', 'Class:WebServer/Attribute:webapp_list' => 'Webアプリケーション', 'Class:WebServer/Attribute:webapp_list+' => 'All the web applications available on this web server~~', -)); +]); // // Class: PCSoftware // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:PCSoftware' => 'PCソフトウエア', 'Class:PCSoftware+' => '', -)); +]); // // Class: OtherSoftware // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:OtherSoftware' => '他のソフトウエア', 'Class:OtherSoftware+' => '', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:MiddlewareInstance' => 'ミドルウエアインスタンス', 'Class:MiddlewareInstance+' => '', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s~~', @@ -613,13 +613,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'ミドルウエア名', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '', -)); +]); // // Class: DatabaseSchema // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:DatabaseSchema' => 'DBスキーマ', 'Class:DatabaseSchema+' => '', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s~~', @@ -627,13 +627,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'DBサーバ名', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '', -)); +]); // // Class: WebApplication // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:WebApplication' => 'Webアプリケーション', 'Class:WebApplication+' => '', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s~~', @@ -643,14 +643,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:WebApplication/Attribute:webserver_name+' => '', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '', -)); - +]); // // Class: VirtualDevice // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:VirtualDevice' => 'バーチャルデバイス', 'Class:VirtualDevice+' => '', 'Class:VirtualDevice/Attribute:status' => '状態', @@ -665,24 +664,24 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => '保存', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => '論理ボリューム', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'All the logical volumes used by this device~~', -)); +]); // // Class: VirtualHost // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:VirtualHost' => '仮想ホスト', 'Class:VirtualHost+' => '', 'Class:VirtualHost/Attribute:virtualmachine_list' => '仮想マシン', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'All the virtual machines hosted by this host~~', -)); +]); // // Class: Hypervisor // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Hypervisor' => 'ハイパーバイザー', 'Class:Hypervisor+' => '', 'Class:Hypervisor/Attribute:farm_id' => 'ファーム', @@ -693,13 +692,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Hypervisor/Attribute:server_id+' => '', 'Class:Hypervisor/Attribute:server_name' => 'サーバ名', 'Class:Hypervisor/Attribute:server_name+' => '', -)); +]); // // Class: Farm // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Farm' => 'ファーム', 'Class:Farm+' => '', 'Class:Farm/Attribute:hypervisor_list' => 'ハイパーバイザー', @@ -708,13 +707,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Farm/Attribute:redundancy/disabled' => 'The farm is up if all the hypervisors are up~~', 'Class:Farm/Attribute:redundancy/count' => 'The farm is up if at least %1$s hypervisor(s) is(are) up~~', 'Class:Farm/Attribute:redundancy/percent' => 'The farm is up if at least %1$s %% of the hypervisors are up~~', -)); +]); // // Class: VirtualMachine // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:VirtualMachine' => '仮想マシン', 'Class:VirtualMachine+' => '', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s~~', @@ -742,13 +741,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:VirtualMachine/Attribute:managementip+' => '', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'ネットワークインターフェース', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'All the logical network interfaces~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:LogicalVolume' => '論理ボリューム', 'Class:LogicalVolume+' => '', 'Class:LogicalVolume/Attribute:name' => '名前', @@ -769,13 +768,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'All the servers using this volume~~', 'Class:LogicalVolume/Attribute:virtualdevices_list' => '仮想デバイス', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'All the virtual devices using this volume~~', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkServerToVolume' => 'リンクサーバ/ボリューム', 'Class:lnkServerToVolume+' => '', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s~~', @@ -789,13 +788,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '', 'Class:lnkServerToVolume/Attribute:size_used' => '使用サイズ', 'Class:lnkServerToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkVirtualDeviceToVolume' => 'リンク 仮想デバイス/ボリューム', 'Class:lnkVirtualDeviceToVolume+' => '', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s~~', @@ -809,13 +808,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => '使用サイズ', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkSanToDatacenterDevice' => 'リンク San/データセンターデバイス', 'Class:lnkSanToDatacenterDevice+' => '', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s~~', @@ -831,13 +830,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'デバイスfc', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '', -)); +]); // // Class: Tape // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Tape' => 'テープ', 'Class:Tape+' => '', 'Class:Tape/Attribute:name' => '名前', @@ -850,13 +849,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Tape/Attribute:tapelibrary_id+' => '', 'Class:Tape/Attribute:tapelibrary_name' => 'テープライブラリ名', 'Class:Tape/Attribute:tapelibrary_name+' => '', -)); +]); // // Class: NASFileSystem // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:NASFileSystem' => 'NASファイルシステム', 'Class:NASFileSystem+' => '', 'Class:NASFileSystem/Attribute:name' => '名前', @@ -871,13 +870,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:NASFileSystem/Attribute:nas_id+' => '', 'Class:NASFileSystem/Attribute:nas_name' => 'NAS名', 'Class:NASFileSystem/Attribute:nas_name+' => '', -)); +]); // // Class: Software // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Software' => 'ソフトウエア', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s~~', @@ -907,13 +906,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Software/Attribute:softwarepatch_list+' => 'All the patchs for this software~~', 'Class:Software/Attribute:softwarelicence_list' => 'ソフトウエアライセンス', 'Class:Software/Attribute:softwarelicence_list+' => 'All the licenses for this software~~', -)); +]); // // Class: Patch // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Patch' => 'パッチ', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => '名前', @@ -924,13 +923,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'タイプ', 'Class:Patch/Attribute:finalclass+' => '', -)); +]); // // Class: OSPatch // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:OSPatch' => 'OSパッチ', 'Class:OSPatch+' => '', 'Class:OSPatch/Attribute:functionalcis_list' => 'デバイス', @@ -939,13 +938,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:OSPatch/Attribute:osversion_id+' => '', 'Class:OSPatch/Attribute:osversion_name' => 'OSバージョン名', 'Class:OSPatch/Attribute:osversion_name+' => '', -)); +]); // // Class: SoftwarePatch // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:SoftwarePatch' => 'ソフトウエアパッチ', 'Class:SoftwarePatch+' => '', 'Class:SoftwarePatch/Attribute:software_id' => 'ソフトウエア', @@ -954,13 +953,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:SoftwarePatch/Attribute:software_name+' => '', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'ソフトウエアインスタンス', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'All the systems where this software patch is installed~~', -)); +]); // // Class: Licence // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Licence' => 'ライセンス', 'Class:Licence+' => '', 'Class:Licence/Attribute:name' => '名前', @@ -989,13 +988,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => '', 'Class:Licence/Attribute:finalclass' => 'タイプ', 'Class:Licence/Attribute:finalclass+' => '', -)); +]); // // Class: OSLicence // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:OSLicence' => 'OSライセンス', 'Class:OSLicence+' => '', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1007,13 +1006,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'All the virtual machines where this license is used~~', 'Class:OSLicence/Attribute:servers_list' => 'サーバ', 'Class:OSLicence/Attribute:servers_list+' => 'All the servers where this license is used~~', -)); +]); // // Class: SoftwareLicence // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:SoftwareLicence' => 'ソフトウエアライセンス', 'Class:SoftwareLicence+' => '', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1023,13 +1022,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:SoftwareLicence/Attribute:software_name+' => '', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'ソフトウエアインスタンス', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'All the systems where this license is used~~', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkDocumentToLicence' => 'リンク 文書/ライセンス', 'Class:lnkDocumentToLicence+' => '', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s~~', @@ -1041,35 +1040,35 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '', 'Class:lnkDocumentToLicence/Attribute:document_name' => '文書名', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '', -)); +]); // // Class: OSVersion // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:OSVersion' => 'OSバージョン', 'Class:OSVersion+' => '', 'Class:OSVersion/Attribute:osfamily_id' => 'OSファミリ', 'Class:OSVersion/Attribute:osfamily_id+' => '', 'Class:OSVersion/Attribute:osfamily_name' => 'OSファミリ名', 'Class:OSVersion/Attribute:osfamily_name+' => '', -)); +]); // // Class: OSFamily // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:OSFamily' => 'OSファミリ', 'Class:OSFamily+' => '', -)); +]); // // Class: Brand // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Brand' => 'ブランド', 'Class:Brand+' => '', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1078,13 +1077,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'All the physical devices corresponding to this brand~~', 'Class:Brand/UniquenessRule:name+' => 'The name must be unique~~', 'Class:Brand/UniquenessRule:name' => 'This brand already exists~~', -)); +]); // // Class: Model // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Model' => 'モデル', 'Class:Model+' => '', 'Class:Model/ComplementaryName' => '%1$s - %2$s~~', @@ -1136,37 +1135,37 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Model/Attribute:physicaldevices_list+' => 'All the physical devices corresponding to this model~~', 'Class:Model/UniquenessRule:name_brand+' => 'Name must be unique in the brand~~', 'Class:Model/UniquenessRule:name_brand' => 'this model already exists for this brand~~', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:NetworkDeviceType' => 'ネットワークデバイスタイプ', 'Class:NetworkDeviceType+' => '', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'ネットワークデバイス', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'All the network devices corresponding to this type~~', -)); +]); // // Class: IOSVersion // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:IOSVersion' => 'IOSバージョン', 'Class:IOSVersion+' => '', 'Class:IOSVersion/Attribute:brand_id' => 'ブランド', 'Class:IOSVersion/Attribute:brand_id+' => '', 'Class:IOSVersion/Attribute:brand_name' => 'ブランド名', 'Class:IOSVersion/Attribute:brand_name+' => '', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkDocumentToPatch' => 'リンク 文書/パッチ', 'Class:lnkDocumentToPatch+' => '', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s~~', @@ -1178,13 +1177,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '', 'Class:lnkDocumentToPatch/Attribute:document_name' => '文書名', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'リンク ソフトウエアインスタンス/ソフトウエアパッチ', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s~~', @@ -1196,13 +1195,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'ソフトウエアインスタンス名', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkFunctionalCIToOSPatch' => 'リンク 機能的CI/OSパッチ', 'Class:lnkFunctionalCIToOSPatch+' => '', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s~~', @@ -1214,13 +1213,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => '機能的ci名', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkDocumentToSoftware' => 'リンク 文書/ソフトウエア', 'Class:lnkDocumentToSoftware+' => '', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s~~', @@ -1232,13 +1231,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '', 'Class:lnkDocumentToSoftware/Attribute:document_name' => '文書名', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '', -)); +]); // // Class: Subnet // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Subnet' => 'サブネット', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s~~', @@ -1257,13 +1256,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLANs~~', 'Class:Subnet/Attribute:vlans_list+' => '~~', -)); +]); // // Class: VLAN // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:VLAN' => 'VLAN~~', 'Class:VLAN+' => '~~', 'Class:VLAN/Attribute:vlan_tag' => 'VLAN Tag~~', @@ -1278,13 +1277,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:VLAN/Attribute:subnets_list+' => '~~', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Physical network interfaces~~', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '~~', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkSubnetToVLAN' => 'Link Subnet / VLAN~~', 'Class:lnkSubnetToVLAN+' => '~~', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s~~', @@ -1298,26 +1297,26 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '~~', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'VLAN Tag~~', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '~~', -)); +]); // // Class: NetworkInterface // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:NetworkInterface' => 'ネットワークインターフェース', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => '名前', 'Class:NetworkInterface/Attribute:name+' => '', 'Class:NetworkInterface/Attribute:finalclass' => 'タイプ', 'Class:NetworkInterface/Attribute:finalclass+' => '', -)); +]); // // Class: IPInterface // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:IPInterface' => 'IPインターフェース', 'Class:IPInterface+' => '', 'Class:IPInterface/Attribute:ipaddress' => 'IPアドレス', @@ -1332,13 +1331,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:IPInterface/Attribute:ipmask+' => '', 'Class:IPInterface/Attribute:speed' => '速度', 'Class:IPInterface/Attribute:speed+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:PhysicalInterface' => '物理インターフェース', 'Class:PhysicalInterface+' => '', 'Class:PhysicalInterface/Name' => '%2$s %1$s~~', @@ -1348,13 +1347,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLANs~~', 'Class:PhysicalInterface/Attribute:vlans_list+' => '~~', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Link PhysicalInterface / VLAN~~', 'Class:lnkPhysicalInterfaceToVLAN+' => '~~', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s~~', @@ -1370,27 +1369,26 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '~~', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'VLAN Tag~~', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '~~', -)); - +]); // // Class: LogicalInterface // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:LogicalInterface' => '論理インターフェース', 'Class:LogicalInterface+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_id' => '仮想マシン', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_name' => '仮想マシン名', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:FiberChannelInterface' => 'ファイバーチャネルインターフェース', 'Class:FiberChannelInterface+' => '', 'Class:FiberChannelInterface/Attribute:speed' => '速度', @@ -1403,13 +1401,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'デバイス名', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkConnectableCIToNetworkDevice' => 'リンク 接続可能CI/ネットワークデバイス', 'Class:lnkConnectableCIToNetworkDevice+' => '', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s~~', @@ -1431,13 +1429,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'ダウンリンク', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'アップリンク', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'アップリンク', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'リンク アプリケーションソリューション/機能的CI', 'Class:lnkApplicationSolutionToFunctionalCI+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1449,13 +1447,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => '機能的ci名', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'リンク アプリケーション/ビジネスプロセス', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s~~', @@ -1467,13 +1465,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'アプリケーションソリューション名', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', -)); +]); // // Class: Group // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Group' => 'グループ', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s~~', @@ -1503,13 +1501,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Group/Attribute:ci_list+' => 'All the configuration items linked to this group~~', 'Class:Group/Attribute:parent_id_friendlyname' => '親グループ', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkGroupToCI' => 'リンク グループ/CI', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s~~', @@ -1523,11 +1521,11 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => '理由', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Server:baseinfo' => '基本情報', 'Server:Date' => '日付', 'Server:moreinfo' => '追加情報', @@ -1540,14 +1538,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Subnet/Tab:FreeIPs-count' => 'フリーIP: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => '10個のフリーなIPアドレス', 'Class:Document:PreviewTab' => 'プレビュー', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkDocumentToFunctionalCI' => 'リンク 文書/機能的CI', 'Class:lnkDocumentToFunctionalCI+' => '', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1559,13 +1556,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => '文書名', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '', -)); +]); // // Application Menu // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Menu:Application' => 'アプリケーション', 'Menu:Application+' => '全アプリケーション', 'Menu:DBServer' => 'DBサーバ', @@ -1610,15 +1607,15 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Menu:OSVersion+' => '', 'Menu:Software' => 'ソフトウエアカタログ', 'Menu:Software+' => 'ソフトウエアカタログ', -)); +]); // // Class: PhysicalInterface // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/nl.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/nl.dict.itop-config-mgmt.php index a5d59c0de..487f54498 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/nl.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/nl.dict.itop-config-mgmt.php @@ -1,17 +1,18 @@ * @author Thomas Casteleyn * @author Jeffrey Bostoen (2018 - 2022) */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Relation:impacts/Description' => 'Elementen met impact van', 'Relation:impacts/DownStream' => 'Impact op...', 'Relation:impacts/DownStream+' => 'Elementen geïmpacteerd door', @@ -23,8 +24,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Relation:impacts/LoadData' => 'Laad data', 'Relation:impacts/NoFilteredData' => 'Gelieve objecten te selecteren en data te laden', 'Relation:impacts/FilteredData' => 'Gefilterde data', -)); - +]); // Dictionnay conventions // Class: @@ -67,7 +67,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( // Class: lnkContactToFunctionalCI // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkContactToFunctionalCI' => 'Link Contact / Functioneel CI', 'Class:lnkContactToFunctionalCI+' => '', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s', @@ -79,13 +79,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Naam contact', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:FunctionalCI' => 'Functioneel CI', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => 'Naam', @@ -118,13 +118,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:FunctionalCI/Attribute:finalclass+' => '', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Actieve tickets', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Actieve tickets die dit configuratie-item impacteren', -)); +]); // // Class: PhysicalDevice // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:PhysicalDevice' => 'Fysieke Apparaat', 'Class:PhysicalDevice+' => '', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s', @@ -158,13 +158,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Einde garantieperiode', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '', -)); +]); // // Class: Rack // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Rack' => 'Rack', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s', @@ -174,64 +174,64 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Rack/Attribute:device_list+' => 'Alle fysieke apparaten die zich bevinden in dit rack', 'Class:Rack/Attribute:enclosure_list' => 'Enclosures', 'Class:Rack/Attribute:enclosure_list+' => 'Alle enclosures in dit rack', -)); +]); // // Class: TelephonyCI // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TelephonyCI' => 'Telefonie CI', 'Class:TelephonyCI+' => '', 'Class:TelephonyCI/Attribute:phonenumber' => 'Telefoonnummer', 'Class:TelephonyCI/Attribute:phonenumber+' => '', -)); +]); // // Class: Phone // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Phone' => 'Telefoon', 'Class:Phone+' => '', -)); +]); // // Class: MobilePhone // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:MobilePhone' => 'Mobiele telefoon', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'PIN-code', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:IPPhone' => 'IP-telefoon', 'Class:IPPhone+' => '', -)); +]); // // Class: Tablet // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Tablet' => 'Tablet', 'Class:Tablet+' => '', -)); +]); // // Class: ConnectableCI // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ConnectableCI' => 'Aansluitbaar CI', 'Class:ConnectableCI+' => 'Fysiek CI', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s', @@ -239,13 +239,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'Alle netwerkapparaten die verbonden zijn met dit apparaat', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Netwerkinterfaces', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'Alle fysieke netwerkinterfaces', -)); +]); // // Class: DatacenterDevice // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:DatacenterDevice' => 'Datacenterapparaat', 'Class:DatacenterDevice+' => '', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s', @@ -277,13 +277,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'Het toestel werkt zodra stroombron A of B beschikbaar is', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'Het toestel werkt zodra alle stroomverbindingen beschikbaar zijn', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'Het toestel werkt zodra minstens %1$s %% van de stroomverbindingen beschikbaar is', -)); +]); // // Class: NetworkDevice // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:NetworkDevice' => 'Netwerkapparaat', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s', @@ -299,13 +299,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Server' => 'Server', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s', @@ -327,61 +327,61 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => 'Logische volumes', 'Class:Server/Attribute:logicalvolumes_list+' => 'Alle logische volumes die verbonden zijn met deze server', -)); +]); // // Class: StorageSystem // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:StorageSystem' => 'Opslagsysteem', 'Class:StorageSystem+' => '', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Logische volumes', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'Alle logische volumes in dit opslagsysteem', -)); +]); // // Class: SANSwitch // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:SANSwitch' => 'SAN-switch', 'Class:SANSwitch+' => '', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Apparaten', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'Alle apparaten verbonden met deze SAN-switch', -)); +]); // // Class: TapeLibrary // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TapeLibrary' => 'Tapebibliotheek', 'Class:TapeLibrary+' => '', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s', 'Class:TapeLibrary/Attribute:tapes_list' => 'Tapes', 'Class:TapeLibrary/Attribute:tapes_list+' => 'Alle tapes in de tapebibliotheek', -)); +]); // // Class: NAS // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '', 'Class:NAS/ComplementaryName' => '%1$s - %2$s', 'Class:NAS/Attribute:nasfilesystem_list' => 'Bestandssysteem', 'Class:NAS/Attribute:nasfilesystem_list+' => 'Alle bestandsystemen in deze NAS', -)); +]); // // Class: PC // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:PC' => 'PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s', @@ -403,45 +403,45 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:PC/Attribute:type/Value:desktop+' => 'Desktop', 'Class:PC/Attribute:type/Value:laptop' => 'Laptop', 'Class:PC/Attribute:type/Value:laptop+' => 'Laptop', -)); +]); // // Class: Printer // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Printer' => 'Printer', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerConnection // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:PowerConnection' => 'Stroomverbinding', 'Class:PowerConnection+' => '', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerSource // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:PowerSource' => 'Stroombron', 'Class:PowerSource+' => '', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s', 'Class:PowerSource/Attribute:pdus_list' => 'PDU\'s', 'Class:PowerSource/Attribute:pdus_list+' => 'Alle PDU\'s die gebruik maken van deze stroombron', -)); +]); // // Class: PDU // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s', @@ -453,23 +453,23 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:PDU/Attribute:powerstart_id+' => '', 'Class:PDU/Attribute:powerstart_name' => 'Naam Power start', 'Class:PDU/Attribute:powerstart_name+' => '', -)); +]); // // Class: Peripheral // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Peripheral' => 'Randapparatuur', 'Class:Peripheral+' => '', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: Enclosure // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Enclosure' => 'Enclosure', 'Class:Enclosure+' => '', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -481,13 +481,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Enclosure/Attribute:nb_u+' => '', 'Class:Enclosure/Attribute:device_list' => 'Apparaten', 'Class:Enclosure/Attribute:device_list+' => 'Alle apparaten in deze enclosure', -)); +]); // // Class: ApplicationSolution // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ApplicationSolution' => 'Applicatie-oplossing', 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'CI\'s', @@ -504,13 +504,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'De oplossing werkt als alle configuratie-items actief zijn', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'De oplossing werkt als minstens %1$s configuratie-item(s) actief is/zijn', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'De oplossing werkt als minstens %1$s %% van de configuratie-items actief zijn', -)); +]); // // Class: BusinessProcess // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:BusinessProcess' => 'Bedrijfsproces', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Applicatie-oplossing', @@ -521,13 +521,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => 'Actief', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'Inactief', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => 'Inactief', -)); +]); // // Class: SoftwareInstance // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:SoftwareInstance' => 'Software-instantie', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'Systeem', @@ -550,64 +550,64 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => 'Actief', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'Inactief', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => 'Inactief', -)); +]); // // Class: Middleware // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Middleware' => 'Middleware', 'Class:Middleware+' => '', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Middleware-instanties', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'Alle middleware-instanties die geleverd worden door deze middleware', -)); +]); // // Class: DBServer // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:DBServer' => 'Databaseserver', 'Class:DBServer+' => '', 'Class:DBServer/Attribute:dbschema_list' => 'Databaseschema\'s', 'Class:DBServer/Attribute:dbschema_list+' => 'Alle databaseschema\'s voor deze databaseserver', -)); +]); // // Class: WebServer // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:WebServer' => 'Webserver', 'Class:WebServer+' => '', 'Class:WebServer/Attribute:webapp_list' => 'Webapplicaties', 'Class:WebServer/Attribute:webapp_list+' => 'Alle webapplicaties die beschikbaar zijn voor deze webserver', -)); +]); // // Class: PCSoftware // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:PCSoftware' => 'PC-software', 'Class:PCSoftware+' => '', -)); +]); // // Class: OtherSoftware // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:OtherSoftware' => 'Overige software', 'Class:OtherSoftware+' => '', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:MiddlewareInstance' => 'Middleware-instantie', 'Class:MiddlewareInstance+' => '', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s', @@ -615,13 +615,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Naam middleware', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '', -)); +]); // // Class: DatabaseSchema // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:DatabaseSchema' => 'Databaseschema', 'Class:DatabaseSchema+' => '', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s', @@ -629,13 +629,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'Naam databaseserver', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '', -)); +]); // // Class: WebApplication // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:WebApplication' => 'Webapplicatie', 'Class:WebApplication+' => '', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s', @@ -645,14 +645,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:WebApplication/Attribute:webserver_name+' => '', 'Class:WebApplication/Attribute:url' => 'Link (URL)', 'Class:WebApplication/Attribute:url+' => '', -)); - +]); // // Class: VirtualDevice // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:VirtualDevice' => 'Virtueel apparaat', 'Class:VirtualDevice+' => '', 'Class:VirtualDevice/Attribute:status' => 'Status', @@ -667,24 +666,24 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => 'Voorraad', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Logical volumes', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'Alle logische volumes die door dit apparaat gebruikt worden', -)); +]); // // Class: VirtualHost // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:VirtualHost' => 'Virtuele host', 'Class:VirtualHost+' => '', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Virtuele machines', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'Alle virtuele machines die op deze host draaien', -)); +]); // // Class: Hypervisor // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Hypervisor' => 'Hypervisor', 'Class:Hypervisor+' => '', 'Class:Hypervisor/Attribute:farm_id' => 'Farm', @@ -695,13 +694,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Hypervisor/Attribute:server_id+' => '', 'Class:Hypervisor/Attribute:server_name' => 'Naam server', 'Class:Hypervisor/Attribute:server_name+' => '', -)); +]); // // Class: Farm // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Farm' => 'Farm', 'Class:Farm+' => '', 'Class:Farm/Attribute:hypervisor_list' => 'Hypervisors', @@ -710,13 +709,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Farm/Attribute:redundancy/disabled' => 'De farm is beschikbaar als alle hypervisors beschikbaar zijn.', 'Class:Farm/Attribute:redundancy/count' => 'De farm is beschikbaar als minstens %1$s hypervisor(s) actief is/zijn', 'Class:Farm/Attribute:redundancy/percent' => 'De farm is beschikbaar als minstens %1$s %% hypervisors beschikbaar zijn', -)); +]); // // Class: VirtualMachine // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:VirtualMachine' => 'Virtuele machine', 'Class:VirtualMachine+' => '', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s', @@ -744,13 +743,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:VirtualMachine/Attribute:managementip+' => '', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Netwerkinterfaces', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'Alle logische netwerkinterfaces', -)); +]); // // Class: LogicalVolume // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:LogicalVolume' => 'Logisch volume', 'Class:LogicalVolume+' => '', 'Class:LogicalVolume/Attribute:name' => 'Naam', @@ -771,13 +770,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'Alle servers die dit volume gebruiken', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Virtuele apparaten', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'Alle virtuele apparaten die dit volume gebruiken', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkServerToVolume' => 'Link Server / Volume', 'Class:lnkServerToVolume+' => '', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s', @@ -791,13 +790,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '', 'Class:lnkServerToVolume/Attribute:size_used' => 'Gebruikte grootte', 'Class:lnkServerToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkVirtualDeviceToVolume' => 'Link Virtueel apparaat / Volume', 'Class:lnkVirtualDeviceToVolume+' => '', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s', @@ -811,13 +810,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Gebruikte grootte', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkSanToDatacenterDevice' => 'Link SAN / Datacenterapparaat', 'Class:lnkSanToDatacenterDevice+' => '', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s', @@ -833,13 +832,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'FC-poort apparaat', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '', -)); +]); // // Class: Tape // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Tape' => 'Tape', 'Class:Tape+' => '', 'Class:Tape/Attribute:name' => 'Naam', @@ -852,13 +851,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Tape/Attribute:tapelibrary_id+' => '', 'Class:Tape/Attribute:tapelibrary_name' => 'Tapebibliotheek naam', 'Class:Tape/Attribute:tapelibrary_name+' => '', -)); +]); // // Class: NASFileSystem // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:NASFileSystem' => 'NAS-bestandssysteem', 'Class:NASFileSystem+' => '', 'Class:NASFileSystem/Attribute:name' => 'Naam', @@ -873,13 +872,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:NASFileSystem/Attribute:nas_id+' => '', 'Class:NASFileSystem/Attribute:nas_name' => 'Naam NAS', 'Class:NASFileSystem/Attribute:nas_name+' => '', -)); +]); // // Class: Software // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Software' => 'Software', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s', @@ -909,13 +908,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Software/Attribute:softwarepatch_list+' => 'Alle patches voor deze software', 'Class:Software/Attribute:softwarelicence_list' => 'Softwarelicenties', 'Class:Software/Attribute:softwarelicence_list+' => 'Alle licenties voor deze software', -)); +]); // // Class: Patch // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Patch' => 'Patch', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => 'Naam', @@ -926,13 +925,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Subklasse patch', 'Class:Patch/Attribute:finalclass+' => '', -)); +]); // // Class: OSPatch // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:OSPatch' => 'Besturingssysteempatch', 'Class:OSPatch+' => '', 'Class:OSPatch/Attribute:functionalcis_list' => 'Apparaten', @@ -941,13 +940,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:OSPatch/Attribute:osversion_id+' => '', 'Class:OSPatch/Attribute:osversion_name' => 'Naam versie besturingssysteem', 'Class:OSPatch/Attribute:osversion_name+' => '', -)); +]); // // Class: SoftwarePatch // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:SoftwarePatch' => 'Softwarepatch', 'Class:SoftwarePatch+' => '', 'Class:SoftwarePatch/Attribute:software_id' => 'Software', @@ -956,13 +955,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:SoftwarePatch/Attribute:software_name+' => '', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Software-instanties', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'Alle systemen waarop deze patch is geïnstalleerd', -)); +]); // // Class: Licence // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Licence' => 'Licentie', 'Class:Licence+' => '', 'Class:Licence/Attribute:name' => 'Naam', @@ -991,13 +990,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => 'Ja', 'Class:Licence/Attribute:finalclass' => 'Subklasse licentie', 'Class:Licence/Attribute:finalclass+' => '', -)); +]); // // Class: OSLicence // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:OSLicence' => 'Besturingssysteemlicentie', 'Class:OSLicence+' => '', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s', @@ -1009,13 +1008,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'Alle virtuele machines die gebruik maken van deze licentie', 'Class:OSLicence/Attribute:servers_list' => 'Servers', 'Class:OSLicence/Attribute:servers_list+' => 'Alle servers die gebruik maken van deze licentie', -)); +]); // // Class: SoftwareLicence // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:SoftwareLicence' => 'Softwarelicentie', 'Class:SoftwareLicence+' => '', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s', @@ -1025,13 +1024,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:SoftwareLicence/Attribute:software_name+' => '', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Software-instanties', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'Alle systemen die gebruik maken van deze licentie', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkDocumentToLicence' => 'Link Document / Licentie', 'Class:lnkDocumentToLicence+' => '', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s', @@ -1043,35 +1042,35 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Naam document', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '', -)); +]); // // Class: OSVersion // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:OSVersion' => 'Versie Besturingssysteem', 'Class:OSVersion+' => '', 'Class:OSVersion/Attribute:osfamily_id' => 'Soort besturingssysteem', 'Class:OSVersion/Attribute:osfamily_id+' => '', 'Class:OSVersion/Attribute:osfamily_name' => 'Naam soort besturingssysteem', 'Class:OSVersion/Attribute:osfamily_name+' => '', -)); +]); // // Class: OSFamily // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:OSFamily' => 'Soort Besturingssysteem', 'Class:OSFamily+' => '', -)); +]); // // Class: Brand // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Brand' => 'Merk', 'Class:Brand+' => '', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1080,13 +1079,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'Alle fysieke apparaten van dit merk', 'Class:Brand/UniquenessRule:name+' => 'De naam van het merk moet uniek zijn', 'Class:Brand/UniquenessRule:name' => 'De naam van het merk bestaat al', -)); +]); // // Class: Model // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Model' => 'Model', 'Class:Model+' => '', 'Class:Model/ComplementaryName' => '%1$s - %2$s', @@ -1138,37 +1137,37 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Model/Attribute:physicaldevices_list+' => 'Alle fysieke apparaten van dit model', 'Class:Model/UniquenessRule:name_brand+' => 'De naam van het merk moet uniek zijn', 'Class:Model/UniquenessRule:name_brand' => 'De naam van dit model bestaat al voor dit merk', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:NetworkDeviceType' => 'Soort netwerkapparaat', 'Class:NetworkDeviceType+' => '', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Netwerkapparaten', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'Alle netwerkapparaten van deze soort', -)); +]); // // Class: IOSVersion // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:IOSVersion' => 'Versie IOS', 'Class:IOSVersion+' => '', 'Class:IOSVersion/Attribute:brand_id' => 'Merk', 'Class:IOSVersion/Attribute:brand_id+' => '', 'Class:IOSVersion/Attribute:brand_name' => 'Naam merk', 'Class:IOSVersion/Attribute:brand_name+' => '', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkDocumentToPatch' => 'Link Document / Patch', 'Class:lnkDocumentToPatch+' => '', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s', @@ -1180,13 +1179,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Naam document', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Link Software-instantie / Softwarepatch', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s', @@ -1198,13 +1197,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Software instantie naam', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkFunctionalCIToOSPatch' => 'Link Functioneel CI / Besturingssysteempatch', 'Class:lnkFunctionalCIToOSPatch+' => '', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s', @@ -1216,13 +1215,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'Naam functioneel CI', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkDocumentToSoftware' => 'Link Document / Software', 'Class:lnkDocumentToSoftware+' => '', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s', @@ -1234,13 +1233,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Naam document', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '', -)); +]); // // Class: Subnet // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Subnet' => 'Subnet', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s', @@ -1259,13 +1258,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLAN\'s', 'Class:Subnet/Attribute:vlans_list+' => '', -)); +]); // // Class: VLAN // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:VLAN' => 'VLAN', 'Class:VLAN+' => '', 'Class:VLAN/Attribute:vlan_tag' => 'VLAN-tag', @@ -1280,13 +1279,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:VLAN/Attribute:subnets_list+' => '', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Fysieke netwerkinterfaces', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkSubnetToVLAN' => 'Link Subnet / VLAN', 'Class:lnkSubnetToVLAN+' => '', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s', @@ -1300,26 +1299,26 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'Tag VLAN', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '', -)); +]); // // Class: NetworkInterface // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:NetworkInterface' => 'Netwerkinterface', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'Naam', 'Class:NetworkInterface/Attribute:name+' => '', 'Class:NetworkInterface/Attribute:finalclass' => 'Subklasse netwerkinterface', 'Class:NetworkInterface/Attribute:finalclass+' => '', -)); +]); // // Class: IPInterface // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:IPInterface' => 'IP-interface', 'Class:IPInterface+' => '', 'Class:IPInterface/Attribute:ipaddress' => 'IP-adres', @@ -1334,13 +1333,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:IPInterface/Attribute:ipmask+' => '', 'Class:IPInterface/Attribute:speed' => 'Snelheid', 'Class:IPInterface/Attribute:speed+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:PhysicalInterface' => 'Fysieke interface', 'Class:PhysicalInterface+' => '', 'Class:PhysicalInterface/Name' => '%2$s %1$s', @@ -1350,13 +1349,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLAN\'s', 'Class:PhysicalInterface/Attribute:vlans_list+' => '', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Link Fysieke interface / VLAN', 'Class:lnkPhysicalInterfaceToVLAN+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s', @@ -1372,27 +1371,26 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'Tag VLAN', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '', -)); - +]); // // Class: LogicalInterface // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:LogicalInterface' => 'Logische interface', 'Class:LogicalInterface+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Virtuele machine', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Naam virtuele machine', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:FiberChannelInterface' => 'Fiber Channel-interface', 'Class:FiberChannelInterface+' => '', 'Class:FiberChannelInterface/Attribute:speed' => 'Snelheid', @@ -1405,13 +1403,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Naam apparaat', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Link ConnectableCI / Netwerkapparaat', 'Class:lnkConnectableCIToNetworkDevice+' => '', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s', @@ -1433,13 +1431,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'downlink', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'uplink', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'uplink', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Link Applicatie-oplossing / Functioneel CI', 'Class:lnkApplicationSolutionToFunctionalCI+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s', @@ -1451,13 +1449,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'Naam functioneel CI', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Link ApplicationSolution / Bedrijfsproces', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s', @@ -1469,13 +1467,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Naam applicatie-oplossing', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', -)); +]); // // Class: Group // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Group' => 'Groep', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s', @@ -1505,13 +1503,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Group/Attribute:ci_list+' => 'Alle configuratie-items gelinkt aan deze groep', 'Class:Group/Attribute:parent_id_friendlyname' => 'Hoofdgroep', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkGroupToCI' => 'Link Groep / CI', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s', @@ -1525,11 +1523,11 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Reden', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Server:baseinfo' => 'Globale informatie', 'Server:Date' => 'Datum', 'Server:moreinfo' => 'Meer informatie', @@ -1542,14 +1540,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Subnet/Tab:FreeIPs-count' => 'Beschikbare IP-adressen: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Dit zijn 10 beschikbare IP-adressen', 'Class:Document:PreviewTab' => 'Voorbeeld', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkDocumentToFunctionalCI' => 'Link Document / Functioneel CI', 'Class:lnkDocumentToFunctionalCI+' => '', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s', @@ -1561,13 +1558,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Naam document', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '', -)); +]); // // Application Menu // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:Application' => 'Applicaties', 'Menu:Application+' => 'Alle applicaties', 'Menu:DBServer' => 'Databaseservers', @@ -1612,15 +1609,15 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Menu:OSVersion+' => '', 'Menu:Software' => 'Softwarecatalogus', 'Menu:Software+' => 'Softwarecatalogus', -)); +]); // // Class: PhysicalInterface // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/pl.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/pl.dict.itop-config-mgmt.php index 4f454e1e4..84bd23043 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/pl.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/pl.dict.itop-config-mgmt.php @@ -1,15 +1,16 @@ 'Elementy, na które ma wpływ', 'Relation:impacts/DownStream' => 'Wpływa na...', 'Relation:impacts/DownStream+' => 'Elementy, na które ma wpływ', @@ -21,8 +22,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Relation:impacts/LoadData' => 'Załaduj dane', 'Relation:impacts/NoFilteredData' => 'wybierz obiekty i załaduj dane', 'Relation:impacts/FilteredData' => 'Filtrowane dane', -)); - +]); // Dictionnay conventions // Class: @@ -65,7 +65,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( // Class: lnkContactToFunctionalCI // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkContactToFunctionalCI' => 'Połączenie Kontakt / Konfiguracja', 'Class:lnkContactToFunctionalCI+' => '', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s', @@ -77,13 +77,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Nazwa kontaktu', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:FunctionalCI' => 'Konfiguracje', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => 'Nazwa', @@ -116,13 +116,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:FunctionalCI/Attribute:finalclass+' => 'Nazwa ostatniej klasy', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Aktywne zgłoszenia', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Aktywne zgłoszenia, które mają wpływ na ten element konfiguracji CI', -)); +]); // // Class: PhysicalDevice // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:PhysicalDevice' => 'Urządzenie fizyczne', 'Class:PhysicalDevice+' => '', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s', @@ -156,13 +156,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Koniec gwarancji', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '', -)); +]); // // Class: Rack // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Rack' => 'Szafa', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s', @@ -172,64 +172,64 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Rack/Attribute:device_list+' => 'Wszystkie fizyczne urządzenia zamontowane w tej szafie', 'Class:Rack/Attribute:enclosure_list' => 'Obudowy', 'Class:Rack/Attribute:enclosure_list+' => 'Wszystkie obudowy w tej szafie', -)); +]); // // Class: TelephonyCI // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TelephonyCI' => 'Konfiguracje telefoniczne', 'Class:TelephonyCI+' => '', 'Class:TelephonyCI/Attribute:phonenumber' => 'Numer telefonu', 'Class:TelephonyCI/Attribute:phonenumber+' => '', -)); +]); // // Class: Phone // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Phone' => 'Telefon', 'Class:Phone+' => '', -)); +]); // // Class: MobilePhone // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:MobilePhone' => 'Telefon komórkowy', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'PIN sprzętu', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:IPPhone' => 'Telefon IP', 'Class:IPPhone+' => '', -)); +]); // // Class: Tablet // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Tablet' => 'Tablet', 'Class:Tablet+' => '', -)); +]); // // Class: ConnectableCI // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ConnectableCI' => 'Konfiguracje podłączeń', 'Class:ConnectableCI+' => 'Konfiguracje fizyczne', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s', @@ -237,13 +237,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'Wszystkie urządzenia sieciowe podłączone do tego urządzenia', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Interfejsy sieciowe', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'Wszystkie fizyczne interfejsy sieciowe', -)); +]); // // Class: DatacenterDevice // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:DatacenterDevice' => 'Urządzenie Datacenter', 'Class:DatacenterDevice+' => '', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s', @@ -275,13 +275,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'Urządzenie działa, jeśli co najmniej jedno złącze zasilania (A lub B) jest włączone', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'Urządzenie działa, jeśli wszystkie jego połączenia zasilania są włączone', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'Urządzenie działa, jeśli przynajmniej %1$s %% z jego połączeń zasilania są wyłączone', -)); +]); // // Class: NetworkDevice // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:NetworkDevice' => 'Urządzenie sieciowe', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s', @@ -297,13 +297,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Server' => 'Serwer', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s', @@ -325,61 +325,61 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => 'Woluminy logiczne', 'Class:Server/Attribute:logicalvolumes_list+' => 'Wszystkie woluminy logiczne podłączone do tego serwera', -)); +]); // // Class: StorageSystem // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:StorageSystem' => 'System pamięci masowej', 'Class:StorageSystem+' => '', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Woluminy logiczne', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'Wszystkie woluminy logiczne w tym systemie pamięci masowej', -)); +]); // // Class: SANSwitch // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:SANSwitch' => 'Przełącznik SAN', 'Class:SANSwitch+' => '', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Urządzenia Datacenter', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'Wszystkie urządzenia Datacenter podłączone do tego przełącznika SAN', -)); +]); // // Class: TapeLibrary // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TapeLibrary' => 'Biblioteka taśm', 'Class:TapeLibrary+' => '', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s', 'Class:TapeLibrary/Attribute:tapes_list' => 'Taśmy', 'Class:TapeLibrary/Attribute:tapes_list+' => 'Wszystkie taśmy w bibliotece taśm', -)); +]); // // Class: NAS // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '', 'Class:NAS/ComplementaryName' => '%1$s - %2$s', 'Class:NAS/Attribute:nasfilesystem_list' => 'Systemy plików', 'Class:NAS/Attribute:nasfilesystem_list+' => 'Wszystkie systemy plików na tym serwerze NAS', -)); +]); // // Class: PC // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:PC' => 'Komputer PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s', @@ -401,45 +401,45 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:PC/Attribute:type/Value:desktop+' => 'desktop', 'Class:PC/Attribute:type/Value:laptop' => 'laptop', 'Class:PC/Attribute:type/Value:laptop+' => 'laptop', -)); +]); // // Class: Printer // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Printer' => 'Drukarka', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerConnection // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:PowerConnection' => 'Podłączenie zasilania', 'Class:PowerConnection+' => '', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerSource // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:PowerSource' => 'Źródło zasilania', 'Class:PowerSource+' => '', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s', 'Class:PowerSource/Attribute:pdus_list' => 'PDU', 'Class:PowerSource/Attribute:pdus_list+' => 'Wszystkie PDU korzystające z tego źródła zasilania', -)); +]); // // Class: PDU // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s', @@ -451,23 +451,23 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:PDU/Attribute:powerstart_id+' => '', 'Class:PDU/Attribute:powerstart_name' => 'Nazwa dystrybucji zasilania', 'Class:PDU/Attribute:powerstart_name+' => '', -)); +]); // // Class: Peripheral // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Peripheral' => 'Peryferia', 'Class:Peripheral+' => '', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: Enclosure // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Enclosure' => 'Obudowa', 'Class:Enclosure+' => '', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -479,13 +479,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Enclosure/Attribute:nb_u+' => '', 'Class:Enclosure/Attribute:device_list' => 'Urządzenia', 'Class:Enclosure/Attribute:device_list+' => 'Wszystkie urządzenia w tej obudowie', -)); +]); // // Class: ApplicationSolution // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ApplicationSolution' => 'Zastosowane rozwiązanie', 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'Konfiguracje', @@ -502,13 +502,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'Rozwiązanie działa, jeśli wszystkie elementy konfiguracji działają', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'Rozwiązanie jest gotowe, jeśli przynajmniej %1$s element(y) konfiguracji jest(są) włączony(e)', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'Rozwiązanie jest gotowe, jeśli przynajmniej %1$s %% elementów konfiguracji jest włączonych', -)); +]); // // Class: BusinessProcess // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:BusinessProcess' => 'Proces biznesowy', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Rozwiązania aplikacyjne', @@ -519,13 +519,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => 'aktywny', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'nieaktywny', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => 'nieaktywny', -)); +]); // // Class: SoftwareInstance // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:SoftwareInstance' => 'Instancja oprogramowania', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'System', @@ -548,64 +548,64 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => 'aktywna', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'nieaktywna', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => 'nieaktywna', -)); +]); // // Class: Middleware // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Middleware' => 'Oprogramowanie pośredniczące', 'Class:Middleware+' => '', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Instancje oprogramowania pośredniczące', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'Wszystkie wystąpienia oprogramowania pośredniczącego zapewniane przez to oprogramowanie pośredniczące', -)); +]); // // Class: DBServer // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:DBServer' => 'Serwer bazy danych', 'Class:DBServer+' => '', 'Class:DBServer/Attribute:dbschema_list' => 'Schematy bazy danych', 'Class:DBServer/Attribute:dbschema_list+' => 'Wszystkie schematy bazy danych dla tego serwera bazy danych', -)); +]); // // Class: WebServer // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:WebServer' => 'Serwer WWW', 'Class:WebServer+' => '', 'Class:WebServer/Attribute:webapp_list' => 'Aplikacje WWW', 'Class:WebServer/Attribute:webapp_list+' => 'Wszystkie aplikacje WWW dostępne na tym serwerze WWW', -)); +]); // // Class: PCSoftware // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:PCSoftware' => 'Oprogramowanie komputerowe', 'Class:PCSoftware+' => '', -)); +]); // // Class: OtherSoftware // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:OtherSoftware' => 'Inne oprogramowanie', 'Class:OtherSoftware+' => '', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:MiddlewareInstance' => 'Instancja oprogramowania pośredniczącego', 'Class:MiddlewareInstance+' => '', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s', @@ -613,13 +613,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Nazwa oprogramowania pośredniczącego', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '', -)); +]); // // Class: DatabaseSchema // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:DatabaseSchema' => 'Schemat bazy danych', 'Class:DatabaseSchema+' => '', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s', @@ -627,13 +627,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'Nazwa serwera bazy danych', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '', -)); +]); // // Class: WebApplication // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:WebApplication' => 'Aplikacja WWW', 'Class:WebApplication+' => '', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s', @@ -643,14 +643,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:WebApplication/Attribute:webserver_name+' => '', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '', -)); - +]); // // Class: VirtualDevice // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:VirtualDevice' => 'Urządzenie wirtualne', 'Class:VirtualDevice+' => '', 'Class:VirtualDevice/Attribute:status' => 'Status', @@ -665,24 +664,24 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => 'na zapasie', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Woluminy logiczne', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'Wszystkie woluminy logiczne używane przez to urządzenie', -)); +]); // // Class: VirtualHost // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:VirtualHost' => 'Host wirtualny', 'Class:VirtualHost+' => '', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Maszyny wirtualne', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'Wszystkie maszyny wirtualne hostowane przez tego hosta', -)); +]); // // Class: Hypervisor // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Hypervisor' => 'Nadzorca (Hiperwizor)', 'Class:Hypervisor+' => '', 'Class:Hypervisor/Attribute:farm_id' => 'Farma', @@ -693,13 +692,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Hypervisor/Attribute:server_id+' => '', 'Class:Hypervisor/Attribute:server_name' => 'Nazwa serwera', 'Class:Hypervisor/Attribute:server_name+' => '', -)); +]); // // Class: Farm // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Farm' => 'Farma', 'Class:Farm+' => '', 'Class:Farm/Attribute:hypervisor_list' => 'Nadzorcy (Hiperwizory)', @@ -708,13 +707,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Farm/Attribute:redundancy/disabled' => 'Farma działa, jeśli wszystkie hiperwizory działają', 'Class:Farm/Attribute:redundancy/count' => 'Farma działa, jeśli co najmniej %1$s hiperwizor(y) działa(ją)', 'Class:Farm/Attribute:redundancy/percent' => 'Farma działa, jeśli co najmniej %1$s %% hiperwizorów działa', -)); +]); // // Class: VirtualMachine // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:VirtualMachine' => 'Maszyna wirtualna', 'Class:VirtualMachine+' => '', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s', @@ -742,13 +741,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:VirtualMachine/Attribute:managementip+' => '', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Interfejsy sieciowe', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'Wszystkie logiczne interfejsy sieciowe', -)); +]); // // Class: LogicalVolume // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:LogicalVolume' => 'Wolumin logiczny', 'Class:LogicalVolume+' => '', 'Class:LogicalVolume/Attribute:name' => 'Nazwa', @@ -769,13 +768,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'Wszystkie serwery korzystające z tego woluminu', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Urządzenia wirtualne', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'Wszystkie urządzenia wirtualne korzystające z tego woluminu', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkServerToVolume' => 'Połączenie serwer / wolumin', 'Class:lnkServerToVolume+' => '', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s', @@ -789,13 +788,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '', 'Class:lnkServerToVolume/Attribute:size_used' => 'Używany rozmiar', 'Class:lnkServerToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkVirtualDeviceToVolume' => 'Połączenie urządzenie wirtualne / wolumin', 'Class:lnkVirtualDeviceToVolume+' => '', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s', @@ -809,13 +808,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Używany rozmiar', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkSanToDatacenterDevice' => 'Połączenie przełącznik SAN / Datacenter', 'Class:lnkSanToDatacenterDevice+' => '', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s', @@ -831,13 +830,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'Urządzenie fc (FibreChannel)', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '', -)); +]); // // Class: Tape // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Tape' => 'Taśma', 'Class:Tape+' => '', 'Class:Tape/Attribute:name' => 'Nazwa', @@ -850,13 +849,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Tape/Attribute:tapelibrary_id+' => '', 'Class:Tape/Attribute:tapelibrary_name' => 'Nazwa biblioteki taśm', 'Class:Tape/Attribute:tapelibrary_name+' => '', -)); +]); // // Class: NASFileSystem // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:NASFileSystem' => 'System plików NAS', 'Class:NASFileSystem+' => '', 'Class:NASFileSystem/Attribute:name' => 'Nazwa', @@ -871,13 +870,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:NASFileSystem/Attribute:nas_id+' => '', 'Class:NASFileSystem/Attribute:nas_name' => 'Nazwa NAS', 'Class:NASFileSystem/Attribute:nas_name+' => '', -)); +]); // // Class: Software // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Software' => 'Oprogramowanie', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s', @@ -907,13 +906,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Software/Attribute:softwarepatch_list+' => 'Wszystkie poprawki do tego oprogramowania', 'Class:Software/Attribute:softwarelicence_list' => 'Licencje na oprogramowanie', 'Class:Software/Attribute:softwarelicence_list+' => 'Wszystkie licencje na to oprogramowanie', -)); +]); // // Class: Patch // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Patch' => 'Poprawka', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => 'Nazwa', @@ -924,13 +923,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Podklasa poprawki', 'Class:Patch/Attribute:finalclass+' => 'Nazwa ostatniej klasy', -)); +]); // // Class: OSPatch // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:OSPatch' => 'Poprawka OS', 'Class:OSPatch+' => '', 'Class:OSPatch/Attribute:functionalcis_list' => 'Urządzenia', @@ -939,13 +938,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:OSPatch/Attribute:osversion_id+' => '', 'Class:OSPatch/Attribute:osversion_name' => 'Nazwa wersji OS', 'Class:OSPatch/Attribute:osversion_name+' => '', -)); +]); // // Class: SoftwarePatch // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:SoftwarePatch' => 'Poprawka oprogramowania', 'Class:SoftwarePatch+' => '', 'Class:SoftwarePatch/Attribute:software_id' => 'Oprogramowanie', @@ -954,13 +953,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:SoftwarePatch/Attribute:software_name+' => '', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Instancje oprogramowania', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'Wszystkie systemy, w których jest zainstalowana ta poprawka oprogramowania', -)); +]); // // Class: Licence // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Licence' => 'Licencja', 'Class:Licence+' => '', 'Class:Licence/Attribute:name' => 'Nazwa', @@ -989,13 +988,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => 'tak', 'Class:Licence/Attribute:finalclass' => 'Podklasa licencji', 'Class:Licence/Attribute:finalclass+' => 'Nazwa ostatniej klasy', -)); +]); // // Class: OSLicence // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:OSLicence' => 'Licencja OS', 'Class:OSLicence+' => '', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s', @@ -1007,13 +1006,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'Wszystkie maszyny wirtualne, na których jest używana ta licencja', 'Class:OSLicence/Attribute:servers_list' => 'Serwery', 'Class:OSLicence/Attribute:servers_list+' => 'Wszystkie serwery, na których jest używana ta licencja', -)); +]); // // Class: SoftwareLicence // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:SoftwareLicence' => 'Licencja oprogramowania', 'Class:SoftwareLicence+' => '', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s', @@ -1023,13 +1022,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:SoftwareLicence/Attribute:software_name+' => '', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Instancje oprogramowania', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'Wszystkie systemy, na których używana jest ta licencja', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkDocumentToLicence' => 'Połączenie dokument / licencjia', 'Class:lnkDocumentToLicence+' => '', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s', @@ -1041,35 +1040,35 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Nazwa dokumentu', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '', -)); +]); // // Class: OSVersion // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:OSVersion' => 'Wersja OS', 'Class:OSVersion+' => '', 'Class:OSVersion/Attribute:osfamily_id' => 'Rodzina OS', 'Class:OSVersion/Attribute:osfamily_id+' => '', 'Class:OSVersion/Attribute:osfamily_name' => 'Nazwa rodziny OS', 'Class:OSVersion/Attribute:osfamily_name+' => '', -)); +]); // // Class: OSFamily // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:OSFamily' => 'Rodzina OS', 'Class:OSFamily+' => '', -)); +]); // // Class: Brand // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Brand' => 'Marka', 'Class:Brand+' => '', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1078,13 +1077,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'Wszystkie fizyczne urządzenia tej marki', 'Class:Brand/UniquenessRule:name+' => 'Nazwa musi być niepowtarzalna', 'Class:Brand/UniquenessRule:name' => 'Ta marka już istnieje', -)); +]); // // Class: Model // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Model' => 'Model', 'Class:Model+' => '', 'Class:Model/ComplementaryName' => '%1$s - %2$s', @@ -1136,37 +1135,37 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Model/Attribute:physicaldevices_list+' => 'Wszystkie fizyczne urządzenia odpowiadające temu modelowi', 'Class:Model/UniquenessRule:name_brand+' => 'Nazwa musi być niepowtarzalna w ramach marki', 'Class:Model/UniquenessRule:name_brand' => 'ten model już istnieje dla tej marki', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:NetworkDeviceType' => 'Typ urządzenia sieciowego', 'Class:NetworkDeviceType+' => '', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Urządzenia sieciowe', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'Wszystkie urządzenia sieciowe odpowiadające temu typowi', -)); +]); // // Class: IOSVersion // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:IOSVersion' => 'Wersja IOS', 'Class:IOSVersion+' => '', 'Class:IOSVersion/Attribute:brand_id' => 'Marka', 'Class:IOSVersion/Attribute:brand_id+' => '', 'Class:IOSVersion/Attribute:brand_name' => 'Nazwa marki', 'Class:IOSVersion/Attribute:brand_name+' => '', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkDocumentToPatch' => 'Połączenie dokument / poprawka', 'Class:lnkDocumentToPatch+' => '', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s', @@ -1178,13 +1177,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Nazwa dokumentu', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Połączenie instancja oprogramowania / poprawkę oprogramowania', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s', @@ -1196,13 +1195,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Nazwa instancji oprogramowania', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkFunctionalCIToOSPatch' => 'Połączenie Konfiguracja / Poprawka OS', 'Class:lnkFunctionalCIToOSPatch+' => '', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s', @@ -1214,13 +1213,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'Nazwa konfiguracji', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkDocumentToSoftware' => 'Połączenie dokument / oprogramowanie', 'Class:lnkDocumentToSoftware+' => '', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s', @@ -1232,13 +1231,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Nazwa dokumentu', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '', -)); +]); // // Class: Subnet // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Subnet' => 'Podsieć', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s', @@ -1257,13 +1256,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'Sieci VLAN', 'Class:Subnet/Attribute:vlans_list+' => '', -)); +]); // // Class: VLAN // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:VLAN' => 'Sieć VLAN', 'Class:VLAN+' => '', 'Class:VLAN/Attribute:vlan_tag' => 'Tag sieci VLAN', @@ -1278,13 +1277,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:VLAN/Attribute:subnets_list+' => '', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Fizyczne interfejsy sieciowe', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkSubnetToVLAN' => 'Połączenie podsieć / sieć VLAN', 'Class:lnkSubnetToVLAN+' => '', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s', @@ -1298,26 +1297,26 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'Tag sieci VLAN', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '', -)); +]); // // Class: NetworkInterface // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:NetworkInterface' => 'Interfejs sieciowy', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'Nazwa', 'Class:NetworkInterface/Attribute:name+' => '', 'Class:NetworkInterface/Attribute:finalclass' => 'Podklasa interfejsu sieciowego', 'Class:NetworkInterface/Attribute:finalclass+' => 'Nazwa ostatniej klasy', -)); +]); // // Class: IPInterface // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:IPInterface' => 'Interfejs IP', 'Class:IPInterface+' => '', 'Class:IPInterface/Attribute:ipaddress' => 'Adres IP', @@ -1332,13 +1331,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:IPInterface/Attribute:ipmask+' => '', 'Class:IPInterface/Attribute:speed' => 'Prędkość', 'Class:IPInterface/Attribute:speed+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:PhysicalInterface' => 'Interfejs fizyczny', 'Class:PhysicalInterface+' => '', 'Class:PhysicalInterface/Name' => '%2$s %1$s', @@ -1348,13 +1347,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '', 'Class:PhysicalInterface/Attribute:vlans_list' => 'Sieci VLAN', 'Class:PhysicalInterface/Attribute:vlans_list+' => '', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Połączenie interfejs fizyczny / sieć VLAN', 'Class:lnkPhysicalInterfaceToVLAN+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s', @@ -1370,27 +1369,26 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'Tag sieci VLAN', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '', -)); - +]); // // Class: LogicalInterface // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:LogicalInterface' => 'Interfejs logiczny', 'Class:LogicalInterface+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Maszyna wirtualna', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Nazwa maszyny wirtualnej', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:FiberChannelInterface' => 'Interfejs Fibre Channel', 'Class:FiberChannelInterface+' => '', 'Class:FiberChannelInterface/Attribute:speed' => 'Prędkość', @@ -1403,13 +1401,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Nazwa urządzenia', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Połączenie Konfiguracja podłączeń / Urządzenie sieciowe', 'Class:lnkConnectableCIToNetworkDevice+' => '', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s', @@ -1431,13 +1429,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'rozłączone', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'połączone', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'połączone', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Połączenie Zastosowane rozwiązanie / Konfiguracja', 'Class:lnkApplicationSolutionToFunctionalCI+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s', @@ -1449,13 +1447,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'Nazwa konfiguracji', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Połączenie Zastosowane rozwiązanie / proces biznesowy', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s', @@ -1467,13 +1465,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Nazwa zastosowanego rozwiązania', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', -)); +]); // // Class: Group // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Group' => 'Grupa', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s', @@ -1503,13 +1501,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Group/Attribute:ci_list+' => 'Wszystkie elementy konfiguracji połączone z tą grupą', 'Class:Group/Attribute:parent_id_friendlyname' => 'Grupa nadrzędna', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkGroupToCI' => 'Połączenie Grupa / Konfiguracja', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s', @@ -1523,11 +1521,11 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Powód', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Server:baseinfo' => 'Informacje ogólne', 'Server:Date' => 'Daty', 'Server:moreinfo' => 'Więcej informacji', @@ -1540,14 +1538,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Subnet/Tab:FreeIPs-count' => 'Wolne adresy IP: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Oto fragment 10 bezpłatnych adresów IP', 'Class:Document:PreviewTab' => 'Podgląd', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkDocumentToFunctionalCI' => 'Połączenie Dokument / Konfiguracja', 'Class:lnkDocumentToFunctionalCI+' => '', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s', @@ -1559,13 +1556,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Nazwa dokumentu', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '', -)); +]); // // Application Menu // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Menu:Application' => 'Aplikacje', 'Menu:Application+' => 'Wszystkie aplikacje', 'Menu:DBServer' => 'Serwery baz danych', @@ -1610,15 +1607,15 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Menu:OSVersion+' => '', 'Menu:Software' => 'Katalog oprogramowania', 'Menu:Software+' => 'Katalog oprogramowania', -)); +]); // // Class: PhysicalInterface // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/pt_br.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/pt_br.dict.itop-config-mgmt.php index 420ff1747..3323f1e67 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/pt_br.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/pt_br.dict.itop-config-mgmt.php @@ -1,15 +1,16 @@ 'Elementos impactados por', 'Relation:impacts/DownStream' => 'Impacto...', 'Relation:impacts/DownStream+' => 'Elementos impactados por', @@ -21,8 +22,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Relation:impacts/LoadData' => 'Load data~~', 'Relation:impacts/NoFilteredData' => 'please select objects and load data~~', 'Relation:impacts/FilteredData' => 'Filtered data~~', -)); - +]); // Dictionnay conventions // Class: @@ -65,7 +65,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( // Class: lnkContactToFunctionalCI // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkContactToFunctionalCI' => 'Link Contato / IC', 'Class:lnkContactToFunctionalCI+' => '', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -77,13 +77,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Nome do contato', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:FunctionalCI' => 'Item de Configuração', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => 'Nome', @@ -116,13 +116,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:FunctionalCI/Attribute:finalclass+' => '', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Solicitações Ativas', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Active Tickets which are impacting this functional CI~~', -)); +]); // // Class: PhysicalDevice // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:PhysicalDevice' => 'Dispositivo Físico', 'Class:PhysicalDevice+' => 'Lista de Dispositivos Físicos', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -156,13 +156,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Fim da garantia', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '', -)); +]); // // Class: Rack // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Rack' => 'Rack', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s~~', @@ -172,64 +172,64 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Rack/Attribute:device_list+' => 'Todos os dispositivos físicos empilhados neste rack', 'Class:Rack/Attribute:enclosure_list' => 'Gavetas', 'Class:Rack/Attribute:enclosure_list+' => 'Todas as gavetas neste rack', -)); +]); // // Class: TelephonyCI // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TelephonyCI' => 'Telefonia', 'Class:TelephonyCI+' => '', 'Class:TelephonyCI/Attribute:phonenumber' => 'Número de telefone', 'Class:TelephonyCI/Attribute:phonenumber+' => '', -)); +]); // // Class: Phone // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Phone' => 'Telefone', 'Class:Phone+' => '', -)); +]); // // Class: MobilePhone // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:MobilePhone' => 'Telefone Celular', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'Hardware PIN', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:IPPhone' => 'Telefone IP', 'Class:IPPhone+' => '', -)); +]); // // Class: Tablet // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Tablet' => 'Tablet', 'Class:Tablet+' => '', -)); +]); // // Class: ConnectableCI // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ConnectableCI' => 'Conectividade', 'Class:ConnectableCI+' => 'Físico', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s~~', @@ -237,13 +237,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'Todos os dispositivos de rede conectados neste dispositivo', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Interface de rede', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'Todas as interfaces de rede', -)); +]); // // Class: DatacenterDevice // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:DatacenterDevice' => 'Dispositivo de Datacenter', 'Class:DatacenterDevice+' => '', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -275,13 +275,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'O dispositivo está ativo se pelo menos uma conexão de energia (A ou B) estiver ativa', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'O dispositivo está ativo se todas as conexões de energia estiverem ativadas', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'O dispositivo está ativo se pelo menos %1$s %% de suas conexões de energia estiverem funcionando', -)); +]); // // Class: NetworkDevice // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:NetworkDevice' => 'Dispositivo de Rede', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -297,13 +297,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Server' => 'Servidor', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s~~', @@ -325,61 +325,61 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => 'Volumes lógicos', 'Class:Server/Attribute:logicalvolumes_list+' => 'Todos os volumoes lógicos associados a este servidor', -)); +]); // // Class: StorageSystem // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:StorageSystem' => 'Sistema de Storage', 'Class:StorageSystem+' => '', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s~~', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Volumes lógicos', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'Todos os volumes lógicos neste sistema storage', -)); +]); // // Class: SANSwitch // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:SANSwitch' => 'Switch SAN', 'Class:SANSwitch+' => '', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s~~', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Dispositivos', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'Todos os dispositivos associados a este switch SAN', -)); +]); // // Class: TapeLibrary // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TapeLibrary' => 'Biblioteca de Fitas', 'Class:TapeLibrary+' => '', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s~~', 'Class:TapeLibrary/Attribute:tapes_list' => 'Fitas', 'Class:TapeLibrary/Attribute:tapes_list+' => 'Todas as fitas associadas à esta biblioteca de fitas', -)); +]); // // Class: NAS // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '', 'Class:NAS/ComplementaryName' => '%1$s - %2$s~~', 'Class:NAS/Attribute:nasfilesystem_list' => 'Sistemas de arquivos', 'Class:NAS/Attribute:nasfilesystem_list+' => 'Todos os sistemas de arquivos para esse NAS', -)); +]); // // Class: PC // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:PC' => 'PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s~~', @@ -401,45 +401,45 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:PC/Attribute:type/Value:desktop+' => '', 'Class:PC/Attribute:type/Value:laptop' => 'Laptop', 'Class:PC/Attribute:type/Value:laptop+' => '', -)); +]); // // Class: Printer // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Printer' => 'Impressora', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerConnection // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:PowerConnection' => 'Conexão de Energia', 'Class:PowerConnection+' => '', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerSource // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:PowerSource' => 'Fonte de Energia', 'Class:PowerSource+' => '', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s~~', 'Class:PowerSource/Attribute:pdus_list' => 'PDUs', 'Class:PowerSource/Attribute:pdus_list+' => 'Todos os PDUs utilizando essa fonte de energia', -)); +]); // // Class: PDU // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s~~', @@ -451,23 +451,23 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:PDU/Attribute:powerstart_id+' => '', 'Class:PDU/Attribute:powerstart_name' => 'Nome da fonte de energia', 'Class:PDU/Attribute:powerstart_name+' => '', -)); +]); // // Class: Peripheral // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Peripheral' => 'Periférico', 'Class:Peripheral+' => '', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: Enclosure // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Enclosure' => 'Gaveta', 'Class:Enclosure+' => '', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -479,13 +479,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Enclosure/Attribute:nb_u+' => '', 'Class:Enclosure/Attribute:device_list' => 'Dispositivos', 'Class:Enclosure/Attribute:device_list+' => 'Todos os dispositivos para essa gaveta', -)); +]); // // Class: ApplicationSolution // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ApplicationSolution' => 'Solução de Aplicação', 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'ICs', @@ -502,13 +502,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'A solução está funcionando se todos os ICs estiverem funcionando', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'A solução está funcionando se no mínimo %1$s IC(s) estiver(em) funcionando', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'A solução está funcionando se no mínimo %1$s %% dos ICs estiverem funcionando', -)); +]); // // Class: BusinessProcess // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:BusinessProcess' => 'Processo de Negócio', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Soluções de aplicação', @@ -519,13 +519,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => '', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'Inativo', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => '', -)); +]); // // Class: SoftwareInstance // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:SoftwareInstance' => 'Instância de Software', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'Sistema', @@ -548,64 +548,64 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => 'Ativo', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'Inativo', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => 'Inativo', -)); +]); // // Class: Middleware // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Middleware' => 'Middleware', 'Class:Middleware+' => '', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Instância Middleware', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'Todos as instância middleware fornecida por essa middleware', -)); +]); // // Class: DBServer // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:DBServer' => 'Servidor de DB', 'Class:DBServer+' => '', 'Class:DBServer/Attribute:dbschema_list' => 'Esquemas de DB', 'Class:DBServer/Attribute:dbschema_list+' => 'Todos os esquemas para esse servidor de banco de dados', -)); +]); // // Class: WebServer // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:WebServer' => 'Servidor Web', 'Class:WebServer+' => '', 'Class:WebServer/Attribute:webapp_list' => 'Aplicações Web', 'Class:WebServer/Attribute:webapp_list+' => 'Todas as aplicações web disponíveis para esse servidor web', -)); +]); // // Class: PCSoftware // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:PCSoftware' => 'Software de PC', 'Class:PCSoftware+' => '', -)); +]); // // Class: OtherSoftware // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:OtherSoftware' => 'Outro Software', 'Class:OtherSoftware+' => '', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:MiddlewareInstance' => 'Instância Middleware', 'Class:MiddlewareInstance+' => '', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s~~', @@ -613,13 +613,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Nome do middleware', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '', -)); +]); // // Class: DatabaseSchema // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:DatabaseSchema' => 'Esquema de DB', 'Class:DatabaseSchema+' => '', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s~~', @@ -627,13 +627,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'Nome do servidor de DB', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '', -)); +]); // // Class: WebApplication // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:WebApplication' => 'Aplicação Web', 'Class:WebApplication+' => '', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s~~', @@ -643,14 +643,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:WebApplication/Attribute:webserver_name+' => '', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '', -)); - +]); // // Class: VirtualDevice // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:VirtualDevice' => 'Dispositivo Virtual', 'Class:VirtualDevice+' => '', 'Class:VirtualDevice/Attribute:status' => 'Status', @@ -665,24 +664,24 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => 'Suporte', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Volume lógico', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'Todos os volumes lógicos associados a este dispositivo', -)); +]); // // Class: VirtualHost // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:VirtualHost' => 'Host Virtual', 'Class:VirtualHost+' => '', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Máquinas Virtuais', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'Todas as máquinas virtuais hospedadas neste Host', -)); +]); // // Class: Hypervisor // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Hypervisor' => 'Hypervisor', 'Class:Hypervisor+' => '', 'Class:Hypervisor/Attribute:farm_id' => 'Cluster/HA', @@ -693,13 +692,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Hypervisor/Attribute:server_id+' => '', 'Class:Hypervisor/Attribute:server_name' => 'Nome do servidor', 'Class:Hypervisor/Attribute:server_name+' => '', -)); +]); // // Class: Farm // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Farm' => 'Cluster/HA', 'Class:Farm+' => '', 'Class:Farm/Attribute:hypervisor_list' => 'Hypervisors', @@ -708,13 +707,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Farm/Attribute:redundancy/disabled' => 'O farm está ativo se todos os hipervisores estiverem em alta', 'Class:Farm/Attribute:redundancy/count' => 'O farm está ativo se pelo menos %1$s hypervisor(es) estiver (ão) para cima', 'Class:Farm/Attribute:redundancy/percent' => 'O farm está ativo se pelo menos %1$s %% dos hipervisores estiverem em alta', -)); +]); // // Class: VirtualMachine // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:VirtualMachine' => 'Máquina Virtual', 'Class:VirtualMachine+' => '', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s~~', @@ -742,13 +741,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:VirtualMachine/Attribute:managementip+' => '', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Placas de rede', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'Todas as placas de rede', -)); +]); // // Class: LogicalVolume // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:LogicalVolume' => 'Volume lógico', 'Class:LogicalVolume+' => '', 'Class:LogicalVolume/Attribute:name' => 'Nome', @@ -769,13 +768,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'Todos os servidores usando esse volume', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Dispositivos virtuais', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'Todos os dispositivos virtuais usando esse volume', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkServerToVolume' => 'Link Servidor / Volume', 'Class:lnkServerToVolume+' => '', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s~~', @@ -789,13 +788,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '', 'Class:lnkServerToVolume/Attribute:size_used' => 'Tamanho utilizado', 'Class:lnkServerToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkVirtualDeviceToVolume' => 'Link Dispositivo Virtual / Volume', 'Class:lnkVirtualDeviceToVolume+' => '', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s~~', @@ -809,13 +808,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Tamanho utilizado', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkSanToDatacenterDevice' => 'Link SAN / Dispositivo Datacenter', 'Class:lnkSanToDatacenterDevice+' => '', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s~~', @@ -831,13 +830,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'Dispositivo de FC', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '', -)); +]); // // Class: Tape // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Tape' => 'Fita', 'Class:Tape+' => '', 'Class:Tape/Attribute:name' => 'Nome', @@ -850,13 +849,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Tape/Attribute:tapelibrary_id+' => '', 'Class:Tape/Attribute:tapelibrary_name' => 'Nome da biblioteca de fitas', 'Class:Tape/Attribute:tapelibrary_name+' => '', -)); +]); // // Class: NASFileSystem // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:NASFileSystem' => 'Sistema de arquivos NAS', 'Class:NASFileSystem+' => '', 'Class:NASFileSystem/Attribute:name' => 'Nome', @@ -871,13 +870,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:NASFileSystem/Attribute:nas_id+' => '', 'Class:NASFileSystem/Attribute:nas_name' => 'Nome do NAS', 'Class:NASFileSystem/Attribute:nas_name+' => '', -)); +]); // // Class: Software // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Software' => 'Software', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s~~', @@ -907,13 +906,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Software/Attribute:softwarepatch_list+' => 'Todas as atualizações para esse software', 'Class:Software/Attribute:softwarelicence_list' => 'Licenças de Software', 'Class:Software/Attribute:softwarelicence_list+' => 'Todas as licenças software para esse software', -)); +]); // // Class: Patch // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Patch' => 'Atualização', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => 'Nome', @@ -924,13 +923,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Tipo', 'Class:Patch/Attribute:finalclass+' => '', -)); +]); // // Class: OSPatch // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:OSPatch' => 'Atualização de SO', 'Class:OSPatch+' => '', 'Class:OSPatch/Attribute:functionalcis_list' => 'Dispositivos', @@ -939,13 +938,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:OSPatch/Attribute:osversion_id+' => '', 'Class:OSPatch/Attribute:osversion_name' => 'Nome da versão do SO', 'Class:OSPatch/Attribute:osversion_name+' => '', -)); +]); // // Class: SoftwarePatch // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:SoftwarePatch' => 'Atualização de Software', 'Class:SoftwarePatch+' => '', 'Class:SoftwarePatch/Attribute:software_id' => 'Software', @@ -954,13 +953,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:SoftwarePatch/Attribute:software_name+' => '', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Instâncias do Software', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'Todos os sistemas onde essa atualização de software está instalada', -)); +]); // // Class: Licence // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Licence' => 'Licença', 'Class:Licence+' => '', 'Class:Licence/Attribute:name' => 'Nome', @@ -989,13 +988,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => 'Sim', 'Class:Licence/Attribute:finalclass' => 'Tipo', 'Class:Licence/Attribute:finalclass+' => '', -)); +]); // // Class: OSLicence // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:OSLicence' => 'Licença de SO', 'Class:OSLicence+' => '', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1007,13 +1006,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'Todas as máquinas virtuais onde essa licença é utilizada', 'Class:OSLicence/Attribute:servers_list' => 'servidores', 'Class:OSLicence/Attribute:servers_list+' => 'Todos os servidores onde essa licença é utilizada', -)); +]); // // Class: SoftwareLicence // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:SoftwareLicence' => 'Licença de software', 'Class:SoftwareLicence+' => '', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1023,13 +1022,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:SoftwareLicence/Attribute:software_name+' => '', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Instâncias do software', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'Todos os sistemas onde essa licença é utilizada', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkDocumentToLicence' => 'Link Documento / Licença', 'Class:lnkDocumentToLicence+' => '', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s~~', @@ -1041,35 +1040,35 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Nome do documento', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '', -)); +]); // // Class: OSVersion // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:OSVersion' => 'Versão do OS', 'Class:OSVersion+' => '', 'Class:OSVersion/Attribute:osfamily_id' => 'Família do SO', 'Class:OSVersion/Attribute:osfamily_id+' => '', 'Class:OSVersion/Attribute:osfamily_name' => 'Nome da família do SO', 'Class:OSVersion/Attribute:osfamily_name+' => '', -)); +]); // // Class: OSFamily // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:OSFamily' => 'Família do OS', 'Class:OSFamily+' => '', -)); +]); // // Class: Brand // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Brand' => 'Fabricante', 'Class:Brand+' => '', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1078,13 +1077,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'Todos os dispositivos físicos correspondentes a esse(a) fabricante', 'Class:Brand/UniquenessRule:name+' => 'O nome do(a) fabricante deve ser único', 'Class:Brand/UniquenessRule:name' => 'Esse(a) fabricante já existe', -)); +]); // // Class: Model // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Model' => 'Modelo', 'Class:Model+' => '', 'Class:Model/ComplementaryName' => '%1$s - %2$s~~', @@ -1136,37 +1135,37 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Model/Attribute:physicaldevices_list+' => 'Todos os dispositivos físicos correspondentes a este modelo', 'Class:Model/UniquenessRule:name_brand+' => 'O nome do modelo deve ser único', 'Class:Model/UniquenessRule:name_brand' => 'Este modelo já existe', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:NetworkDeviceType' => 'Tipo de dispositivo de rede', 'Class:NetworkDeviceType+' => '', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Dispositivo de rede', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'Todos os dispositivo de rede correspondentes a este tipo', -)); +]); // // Class: IOSVersion // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:IOSVersion' => 'Versão do IOS', 'Class:IOSVersion+' => '', 'Class:IOSVersion/Attribute:brand_id' => 'Fabricante', 'Class:IOSVersion/Attribute:brand_id+' => '', 'Class:IOSVersion/Attribute:brand_name' => 'Nome do fabricante', 'Class:IOSVersion/Attribute:brand_name+' => '', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkDocumentToPatch' => 'Link Documento / Atualização', 'Class:lnkDocumentToPatch+' => '', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s~~', @@ -1178,13 +1177,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Nome do documento', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Link Instância de Software / Atualização de Software', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s~~', @@ -1196,13 +1195,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Nome da instância de software', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkFunctionalCIToOSPatch' => 'Link IC / Atualização de SO', 'Class:lnkFunctionalCIToOSPatch+' => '', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s~~', @@ -1214,13 +1213,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'Nome do IC', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkDocumentToSoftware' => 'Link Documento / Software', 'Class:lnkDocumentToSoftware+' => '', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s~~', @@ -1232,13 +1231,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Nome do documento', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '', -)); +]); // // Class: Subnet // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Subnet' => 'Sub-rede', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s~~', @@ -1257,13 +1256,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLANs', 'Class:Subnet/Attribute:vlans_list+' => '', -)); +]); // // Class: VLAN // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:VLAN' => 'VLAN', 'Class:VLAN+' => '', 'Class:VLAN/Attribute:vlan_tag' => 'Nome da VLAN', @@ -1278,13 +1277,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:VLAN/Attribute:subnets_list+' => '', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Interfaces de rede física', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkSubnetToVLAN' => 'Link Sub-rede / VLAN', 'Class:lnkSubnetToVLAN+' => '', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s~~', @@ -1298,26 +1297,26 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'Nome da VLAN', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '', -)); +]); // // Class: NetworkInterface // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:NetworkInterface' => 'Placa de Rede', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'Nome', 'Class:NetworkInterface/Attribute:name+' => '', 'Class:NetworkInterface/Attribute:finalclass' => 'Tipo', 'Class:NetworkInterface/Attribute:finalclass+' => '', -)); +]); // // Class: IPInterface // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:IPInterface' => 'Endereço IP', 'Class:IPInterface+' => '', 'Class:IPInterface/Attribute:ipaddress' => 'Endereço IP', @@ -1332,13 +1331,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:IPInterface/Attribute:ipmask+' => '', 'Class:IPInterface/Attribute:speed' => 'Velocidade', 'Class:IPInterface/Attribute:speed+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:PhysicalInterface' => 'Placa física', 'Class:PhysicalInterface+' => '', 'Class:PhysicalInterface/Name' => '%2$s %1$s~~', @@ -1348,13 +1347,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLANs', 'Class:PhysicalInterface/Attribute:vlans_list+' => '', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Link Interfaces físicas / VLAN', 'Class:lnkPhysicalInterfaceToVLAN+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s~~', @@ -1370,27 +1369,26 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'Nome da VLAN', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '', -)); - +]); // // Class: LogicalInterface // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:LogicalInterface' => 'Placa lógica', 'Class:LogicalInterface+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Máquina virtual', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Nome da máquina virtual', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:FiberChannelInterface' => 'Placa Fiber Channel', 'Class:FiberChannelInterface+' => '', 'Class:FiberChannelInterface/Attribute:speed' => 'Velocidade', @@ -1403,13 +1401,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Nome do dispositivo', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Link ConnectableCI / NetworkDevice', 'Class:lnkConnectableCIToNetworkDevice+' => '', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s~~', @@ -1431,13 +1429,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'Link down', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'Link up', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'Link up', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Link Solução de Aplicação / IC', 'Class:lnkApplicationSolutionToFunctionalCI+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1449,13 +1447,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'Nome do IC', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Link ApplicationSolution / BusinessProcess', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s~~', @@ -1467,13 +1465,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Nome da solução de aplicação', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', -)); +]); // // Class: Group // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Group' => 'Grupo', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s~~', @@ -1503,13 +1501,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Group/Attribute:ci_list+' => 'Todos os itens de configuração associados a este grupo', 'Class:Group/Attribute:parent_id_friendlyname' => 'Grupo pai', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkGroupToCI' => 'Link Grupo / IC', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s~~', @@ -1523,11 +1521,11 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Motivo do link', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Server:baseinfo' => 'Informações gerais', 'Server:Date' => 'Data', 'Server:moreinfo' => 'Mais informações', @@ -1540,14 +1538,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Subnet/Tab:FreeIPs-count' => 'IPs livres: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Aqui uma faixa de 10 endereços IPs livres', 'Class:Document:PreviewTab' => 'Visualização', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkDocumentToFunctionalCI' => 'Link de Documento / IC', 'Class:lnkDocumentToFunctionalCI+' => '', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1559,13 +1556,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Nome do documento', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '', -)); +]); // // Application Menu // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Menu:Application' => 'Aplicações', 'Menu:Application+' => 'Lista de Aplicações', 'Menu:DBServer' => 'Servidores de Banco de Dados', @@ -1610,15 +1607,15 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Menu:OSVersion+' => 'Lista de Versões do SO', 'Menu:Software' => 'Catálogo de Software', 'Menu:Software+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/ru.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/ru.dict.itop-config-mgmt.php index 393bfdd32..861fd5db7 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/ru.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/ru.dict.itop-config-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Relation:impacts/Description' => 'Элементы, на которые влияет', 'Relation:impacts/DownStream' => 'Влияет на...', 'Relation:impacts/DownStream+' => 'Элементы, на которые влияет', @@ -22,8 +23,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Relation:impacts/LoadData' => 'Load data~~', 'Relation:impacts/NoFilteredData' => 'please select objects and load data~~', 'Relation:impacts/FilteredData' => 'Filtered data~~', -)); - +]); // Dictionnay conventions // Class: @@ -66,7 +66,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( // Class: lnkContactToFunctionalCI // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkContactToFunctionalCI' => 'Связь Контакт/Функциональная КЕ', 'Class:lnkContactToFunctionalCI+' => '', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -78,13 +78,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Контакт', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:FunctionalCI' => 'Функциональные КЕ', 'Class:FunctionalCI+' => 'Функциональные КЕ', 'Class:FunctionalCI/Attribute:name' => 'Название', @@ -117,13 +117,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:FunctionalCI/Attribute:finalclass+' => '', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Активные тикеты', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Active Tickets which are impacting this functional CI~~', -)); +]); // // Class: PhysicalDevice // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:PhysicalDevice' => 'Физические устройства', 'Class:PhysicalDevice+' => '', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -157,13 +157,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Окончание гарантии', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '', -)); +]); // // Class: Rack // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Rack' => 'Стойка', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s~~', @@ -173,64 +173,64 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Rack/Attribute:device_list+' => 'Устройства в стойке', 'Class:Rack/Attribute:enclosure_list' => 'Крейты', 'Class:Rack/Attribute:enclosure_list+' => 'Крейты в стойке', -)); +]); // // Class: TelephonyCI // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TelephonyCI' => 'Телефония', 'Class:TelephonyCI+' => '', 'Class:TelephonyCI/Attribute:phonenumber' => 'Абонентский номер', 'Class:TelephonyCI/Attribute:phonenumber+' => '', -)); +]); // // Class: Phone // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Phone' => 'Телефон', 'Class:Phone+' => '', -)); +]); // // Class: MobilePhone // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:MobilePhone' => 'Мобильный телефон', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'Аппаратный PIN', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:IPPhone' => 'IP-телефон', 'Class:IPPhone+' => '', -)); +]); // // Class: Tablet // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Tablet' => 'Планшет', 'Class:Tablet+' => '', -)); +]); // // Class: ConnectableCI // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ConnectableCI' => 'Подключаемые КЕ', 'Class:ConnectableCI+' => 'Подключаемые КЕ', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s~~', @@ -238,13 +238,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'Связанные сетевые устройства', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Сетевые интерфейсы', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'Сетевые интерфейсы', -)); +]); // // Class: DatacenterDevice // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:DatacenterDevice' => 'Устройства дата-центра', 'Class:DatacenterDevice+' => 'Устройства дата-центра', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -276,13 +276,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'Устройство в работе, если по крайней мере один источник питания (А или Б) в работе', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'Устройство в работе, если все источники питания в работе', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'Устройство в работе, если по крайней мере %1$s %% источников питания в работе', -)); +]); // // Class: NetworkDevice // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:NetworkDevice' => 'Сетевое устройство', 'Class:NetworkDevice+' => 'Сетевое устройство', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -298,13 +298,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => 'ОЗУ', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Server' => 'Сервер', 'Class:Server+' => 'Сервер', 'Class:Server/ComplementaryName' => '%1$s - %2$s~~', @@ -326,61 +326,61 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => 'Логические тома', 'Class:Server/Attribute:logicalvolumes_list+' => 'Подключенные логические тома', -)); +]); // // Class: StorageSystem // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:StorageSystem' => 'Система хранения', 'Class:StorageSystem+' => 'Система хранения', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s~~', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Логические тома', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'Логические тома', -)); +]); // // Class: SANSwitch // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:SANSwitch' => 'SAN коммутатор', 'Class:SANSwitch+' => 'SAN коммутатор', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s~~', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Устройства', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'Подключенные устройства', -)); +]); // // Class: TapeLibrary // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TapeLibrary' => 'Ленточная библиотека', 'Class:TapeLibrary+' => 'Ленточная библиотека', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s~~', 'Class:TapeLibrary/Attribute:tapes_list' => 'Ленты', 'Class:TapeLibrary/Attribute:tapes_list+' => 'Ленты', -)); +]); // // Class: NAS // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:NAS' => 'Сетевое хранилище', 'Class:NAS+' => 'Сетевое хранилище', 'Class:NAS/ComplementaryName' => '%1$s - %2$s~~', 'Class:NAS/Attribute:nasfilesystem_list' => 'Файловые системы', 'Class:NAS/Attribute:nasfilesystem_list+' => 'Файловые системы', -)); +]); // // Class: PC // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:PC' => 'Персональный компьютер', 'Class:PC+' => 'Персональный компьютер', 'Class:PC/ComplementaryName' => '%1$s - %2$s~~', @@ -402,45 +402,45 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:PC/Attribute:type/Value:desktop+' => 'Настольный', 'Class:PC/Attribute:type/Value:laptop' => 'Ноутбук', 'Class:PC/Attribute:type/Value:laptop+' => 'Ноутбук', -)); +]); // // Class: Printer // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Printer' => 'Принтер', 'Class:Printer+' => 'Принтер', 'Class:Printer/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerConnection // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:PowerConnection' => 'Электропитание', 'Class:PowerConnection+' => 'Подключения электропитания', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerSource // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:PowerSource' => 'Источник электропитания', 'Class:PowerSource+' => 'Источник электропитания', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s~~', 'Class:PowerSource/Attribute:pdus_list' => 'Распределители', 'Class:PowerSource/Attribute:pdus_list+' => 'Распределители электропитания (PDU)', -)); +]); // // Class: PDU // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:PDU' => 'Распределитель ЭП', 'Class:PDU+' => 'Распределитель электропитания', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s~~', @@ -452,23 +452,23 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:PDU/Attribute:powerstart_id+' => '', 'Class:PDU/Attribute:powerstart_name' => 'Источник электропитания', 'Class:PDU/Attribute:powerstart_name+' => '', -)); +]); // // Class: Peripheral // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Peripheral' => 'Периферийное устройство', 'Class:Peripheral+' => 'Периферийное устройство', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: Enclosure // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Enclosure' => 'Крейт', 'Class:Enclosure+' => 'Крейт, шасси и т.п.', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -480,13 +480,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Enclosure/Attribute:nb_u+' => 'Количество юнитов', 'Class:Enclosure/Attribute:device_list' => 'Устройства', 'Class:Enclosure/Attribute:device_list+' => 'Устройства в крейте', -)); +]); // // Class: ApplicationSolution // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ApplicationSolution' => 'Прикладное решение', 'Class:ApplicationSolution+' => 'Прикладное решение', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'КЕ', @@ -503,13 +503,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'Прикладное решение в работе, если все КЕ в работе', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'Прикладное решение в работе, если по крайней мере %1$s КЕ в работе', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'Прикладное решение в работе, если по крайней мере %1$s %% КЕ в работе', -)); +]); // // Class: BusinessProcess // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:BusinessProcess' => 'Бизнес-процесс', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Прикладные решения', @@ -520,13 +520,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => 'Активный', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'Неактивный', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => 'Неактивный', -)); +]); // // Class: SoftwareInstance // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:SoftwareInstance' => 'Экземпляр ПО', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'Система', @@ -549,64 +549,64 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => 'Активный', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'Неактивный', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => 'Неактивный', -)); +]); // // Class: Middleware // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Middleware' => 'Промежуточное ПО', 'Class:Middleware+' => 'Промежуточное программое обеспечение', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Экземпляры промежуточного ПО', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'Экземпляры этого промежуточного ПО', -)); +]); // // Class: DBServer // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:DBServer' => 'Сервер БД', 'Class:DBServer+' => 'Сервер баз данных', 'Class:DBServer/Attribute:dbschema_list' => 'Схемы БД', 'Class:DBServer/Attribute:dbschema_list+' => 'Все схемы БД данного сервера', -)); +]); // // Class: WebServer // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:WebServer' => 'Веб-сервер', 'Class:WebServer+' => 'Сервер веб-приложений', 'Class:WebServer/Attribute:webapp_list' => 'Веб-приложения', 'Class:WebServer/Attribute:webapp_list+' => 'Все веб-приложения на этом сервере', -)); +]); // // Class: PCSoftware // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:PCSoftware' => 'ПО для ПК', 'Class:PCSoftware+' => 'Программое обеспечение для ПК', -)); +]); // // Class: OtherSoftware // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:OtherSoftware' => 'Другое ПО', 'Class:OtherSoftware+' => 'Другое программное обеспечение', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:MiddlewareInstance' => 'Экземпляр промежуточного ПО', 'Class:MiddlewareInstance+' => 'Экземпляр промежуточного ПО', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s~~', @@ -614,13 +614,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Промежуточное ПО', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '', -)); +]); // // Class: DatabaseSchema // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:DatabaseSchema' => 'Схема базы данных', 'Class:DatabaseSchema+' => 'Схема базы данных', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s~~', @@ -628,13 +628,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'Сервер БД', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '', -)); +]); // // Class: WebApplication // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:WebApplication' => 'Веб-приложение', 'Class:WebApplication+' => 'Веб-приложение', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s~~', @@ -644,14 +644,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:WebApplication/Attribute:webserver_name+' => '', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '', -)); - +]); // // Class: VirtualDevice // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:VirtualDevice' => 'Виртуальное устройство', 'Class:VirtualDevice+' => 'Виртуальное устройство', 'Class:VirtualDevice/Attribute:status' => 'Статус', @@ -666,24 +665,24 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => 'Резерв', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Логические тома', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'Логические тома, используемые этим устройством', -)); +]); // // Class: VirtualHost // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:VirtualHost' => 'Виртуальный хост', 'Class:VirtualHost+' => 'Виртуальный хост', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Виртуальные машины', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'Все виртуальные машины, размещенные на этом хосте', -)); +]); // // Class: Hypervisor // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Hypervisor' => 'Гипервизор', 'Class:Hypervisor+' => 'Гипервизор', 'Class:Hypervisor/Attribute:farm_id' => 'Ферма', @@ -694,13 +693,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Hypervisor/Attribute:server_id+' => '', 'Class:Hypervisor/Attribute:server_name' => 'Сервер', 'Class:Hypervisor/Attribute:server_name+' => '', -)); +]); // // Class: Farm // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Farm' => 'Ферма', 'Class:Farm+' => 'Ферма', 'Class:Farm/Attribute:hypervisor_list' => 'Гипервизоры', @@ -709,13 +708,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Farm/Attribute:redundancy/disabled' => 'Ферма в работе, если все гипервизоры в работе', 'Class:Farm/Attribute:redundancy/count' => 'Ферма в работе, если по крайней мере %1$s гипервизор(-ов) в работе', 'Class:Farm/Attribute:redundancy/percent' => 'Ферма в работе, если по крайней мере %1$s %% гипервизоров в работе', -)); +]); // // Class: VirtualMachine // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:VirtualMachine' => 'Виртуальная машина', 'Class:VirtualMachine+' => 'Виртуальная машина', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s~~', @@ -743,13 +742,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:VirtualMachine/Attribute:managementip+' => '', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Сетевые интерфейсы', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'Сетевые интерфейсы', -)); +]); // // Class: LogicalVolume // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:LogicalVolume' => 'Логический том', 'Class:LogicalVolume+' => 'Логический том', 'Class:LogicalVolume/Attribute:name' => 'Название', @@ -770,13 +769,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'Серверы, использующие этот том', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Виртуальные устройства', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'Виртуальные устройства, использующие этот том', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkServerToVolume' => 'Связь Сервер/Том', 'Class:lnkServerToVolume+' => 'Связь Сервер/Том', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s~~', @@ -790,13 +789,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '', 'Class:lnkServerToVolume/Attribute:size_used' => 'Используемый размер', 'Class:lnkServerToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkVirtualDeviceToVolume' => 'Связь Виртуальное устройство/Том', 'Class:lnkVirtualDeviceToVolume+' => 'Связь Виртуальное устройство/Том', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s~~', @@ -810,13 +809,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Используемый размер', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkSanToDatacenterDevice' => 'Связь SAN коммутатор/Устройство дата-центра', 'Class:lnkSanToDatacenterDevice+' => 'Связь SAN коммутатор/Устройство дата-центра', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s~~', @@ -832,13 +831,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'FC порт подкл. устр.', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '', -)); +]); // // Class: Tape // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Tape' => 'Лента', 'Class:Tape+' => 'Лента', 'Class:Tape/Attribute:name' => 'Название', @@ -851,13 +850,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Tape/Attribute:tapelibrary_id+' => '', 'Class:Tape/Attribute:tapelibrary_name' => 'Ленточная библиотека', 'Class:Tape/Attribute:tapelibrary_name+' => '', -)); +]); // // Class: NASFileSystem // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:NASFileSystem' => 'Файловая система NAS', 'Class:NASFileSystem+' => 'Файловая система NAS', 'Class:NASFileSystem/Attribute:name' => 'Название', @@ -872,13 +871,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:NASFileSystem/Attribute:nas_id+' => '', 'Class:NASFileSystem/Attribute:nas_name' => 'Сетевое хранилище', 'Class:NASFileSystem/Attribute:nas_name+' => '', -)); +]); // // Class: Software // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Software' => 'Программное обеспечение', 'Class:Software+' => 'Программное обеспечение', 'Class:Software/ComplementaryName' => '%1$s - %2$s~~', @@ -908,13 +907,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Software/Attribute:softwarepatch_list+' => 'Патчи для этого ПО', 'Class:Software/Attribute:softwarelicence_list' => 'Лицензии ПО', 'Class:Software/Attribute:softwarelicence_list+' => 'Лицензии для этого ПО', -)); +]); // // Class: Patch // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Patch' => 'Патч', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => 'Название', @@ -925,13 +924,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Тип', 'Class:Patch/Attribute:finalclass+' => '', -)); +]); // // Class: OSPatch // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:OSPatch' => 'Патч ОС', 'Class:OSPatch+' => '', 'Class:OSPatch/Attribute:functionalcis_list' => 'Устройства', @@ -940,13 +939,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:OSPatch/Attribute:osversion_id+' => '', 'Class:OSPatch/Attribute:osversion_name' => 'Версия ОС', 'Class:OSPatch/Attribute:osversion_name+' => '', -)); +]); // // Class: SoftwarePatch // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:SoftwarePatch' => 'Патч ПО', 'Class:SoftwarePatch+' => '', 'Class:SoftwarePatch/Attribute:software_id' => 'ПО', @@ -955,13 +954,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:SoftwarePatch/Attribute:software_name+' => '', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Экземпляры ПО', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'Экземпляры ПО, где установлен этот патч', -)); +]); // // Class: Licence // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Licence' => 'Лицензия', 'Class:Licence+' => 'Лицензия', 'Class:Licence/Attribute:name' => 'Название', @@ -990,13 +989,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => 'Да', 'Class:Licence/Attribute:finalclass' => 'Тип', 'Class:Licence/Attribute:finalclass+' => '', -)); +]); // // Class: OSLicence // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:OSLicence' => 'Лицензия ОС', 'Class:OSLicence+' => 'Лицензия ОС', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1008,13 +1007,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'Все виртуальные машины, где используется данная лицензия', 'Class:OSLicence/Attribute:servers_list' => 'Серверы', 'Class:OSLicence/Attribute:servers_list+' => 'Все серверы, где используется данная лицензия', -)); +]); // // Class: SoftwareLicence // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:SoftwareLicence' => 'Лицензия ПО', 'Class:SoftwareLicence+' => 'Лицензия ПО', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1024,13 +1023,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:SoftwareLicence/Attribute:software_name+' => '', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Экземпляры ПО', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'Экземпляры ПО, где используется данная лицензия', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkDocumentToLicence' => 'Связь Документ/Лицензия', 'Class:lnkDocumentToLicence+' => '', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s~~', @@ -1042,35 +1041,35 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Документ', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '', -)); +]); // // Class: OSVersion // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:OSVersion' => 'Версия ОС', 'Class:OSVersion+' => 'Версия ОС', 'Class:OSVersion/Attribute:osfamily_id' => 'Семейство ОС', 'Class:OSVersion/Attribute:osfamily_id+' => '', 'Class:OSVersion/Attribute:osfamily_name' => 'Семейство ОС', 'Class:OSVersion/Attribute:osfamily_name+' => '', -)); +]); // // Class: OSFamily // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:OSFamily' => 'Семейство ОС', 'Class:OSFamily+' => '', -)); +]); // // Class: Brand // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Brand' => 'Бренд', 'Class:Brand+' => '', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1079,13 +1078,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'Все устройства этого бренда', 'Class:Brand/UniquenessRule:name+' => 'Название должно быть уникальным', 'Class:Brand/UniquenessRule:name' => 'Этот бренд уже существует', -)); +]); // // Class: Model // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Model' => 'Модель', 'Class:Model+' => '', 'Class:Model/ComplementaryName' => '%1$s - %2$s~~', @@ -1137,37 +1136,37 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Model/Attribute:physicaldevices_list+' => 'Все устройства этой модели', 'Class:Model/UniquenessRule:name_brand+' => 'Название должно быть уникальным внутри бренда', 'Class:Model/UniquenessRule:name_brand' => 'эта модель уже существует для этого бренда', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:NetworkDeviceType' => 'Тип сетевого устройства', 'Class:NetworkDeviceType+' => '', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Устройства', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'Все сетевые устройства этого типа', -)); +]); // // Class: IOSVersion // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:IOSVersion' => 'Версия IOS', 'Class:IOSVersion+' => '', 'Class:IOSVersion/Attribute:brand_id' => 'Бренд', 'Class:IOSVersion/Attribute:brand_id+' => '', 'Class:IOSVersion/Attribute:brand_name' => 'Бренд', 'Class:IOSVersion/Attribute:brand_name+' => '', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkDocumentToPatch' => 'Связь Документ/Патч', 'Class:lnkDocumentToPatch+' => '', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s~~', @@ -1179,13 +1178,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Документ', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Связь Экземпляр ПО/Патч ПО', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s~~', @@ -1197,13 +1196,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Экземпляр ПО', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkFunctionalCIToOSPatch' => 'Связь Функциональная КЕ/Патч ОС', 'Class:lnkFunctionalCIToOSPatch+' => '', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s~~', @@ -1215,13 +1214,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'Функциональная КЕ', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkDocumentToSoftware' => 'Связь Документ/ПО', 'Class:lnkDocumentToSoftware+' => '', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s~~', @@ -1233,13 +1232,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Документ', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '', -)); +]); // // Class: Subnet // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Subnet' => 'Подсеть', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s~~', @@ -1258,13 +1257,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLAN', 'Class:Subnet/Attribute:vlans_list+' => '', -)); +]); // // Class: VLAN // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:VLAN' => 'VLAN', 'Class:VLAN+' => '', 'Class:VLAN/Attribute:vlan_tag' => 'Тег VLAN', @@ -1279,13 +1278,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:VLAN/Attribute:subnets_list+' => '', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Физические интерфейсы', 'Class:VLAN/Attribute:physicalinterfaces_list+' => 'Физические интерфейсы', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkSubnetToVLAN' => 'Связь Подсеть/VLAN', 'Class:lnkSubnetToVLAN+' => '', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s~~', @@ -1299,26 +1298,26 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'Тег VLAN', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '', -)); +]); // // Class: NetworkInterface // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:NetworkInterface' => 'Сетевой интерфейс', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'Название', 'Class:NetworkInterface/Attribute:name+' => '', 'Class:NetworkInterface/Attribute:finalclass' => 'Тип', 'Class:NetworkInterface/Attribute:finalclass+' => '', -)); +]); // // Class: IPInterface // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:IPInterface' => 'IP интерфейс', 'Class:IPInterface+' => '', 'Class:IPInterface/Attribute:ipaddress' => 'IP-адрес', @@ -1333,13 +1332,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:IPInterface/Attribute:ipmask+' => '', 'Class:IPInterface/Attribute:speed' => 'Скорость', 'Class:IPInterface/Attribute:speed+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:PhysicalInterface' => 'Физический интерфейс', 'Class:PhysicalInterface+' => '', 'Class:PhysicalInterface/Name' => '%2$s %1$s~~', @@ -1349,13 +1348,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLAN', 'Class:PhysicalInterface/Attribute:vlans_list+' => '', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Связь Физический интерфейс/VLAN', 'Class:lnkPhysicalInterfaceToVLAN+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s~~', @@ -1371,27 +1370,26 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'Тег VLAN', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '', -)); - +]); // // Class: LogicalInterface // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:LogicalInterface' => 'Логический интерфейс', 'Class:LogicalInterface+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Виртуальная машина', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Виртуальная машина', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:FiberChannelInterface' => 'Оптический интерфейс', 'Class:FiberChannelInterface+' => '', 'Class:FiberChannelInterface/Attribute:speed' => 'Скорость', @@ -1404,13 +1402,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Устройство', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkConnectableCIToNetworkDevice' => 'Связь Подключаемая КЕ/Сетевое устройство', 'Class:lnkConnectableCIToNetworkDevice+' => '', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s~~', @@ -1432,13 +1430,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'down link', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'Uplink', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'up link', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Связь Прикладное решение/Функциональная КЕ', 'Class:lnkApplicationSolutionToFunctionalCI+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1450,13 +1448,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'Функциональная КЕ', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Связь Прикладное решение/Бизнес-процесс', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s~~', @@ -1468,13 +1466,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Прикладное решение', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', -)); +]); // // Class: Group // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Group' => 'Группа', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s~~', @@ -1504,13 +1502,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Group/Attribute:ci_list+' => 'Связанные конфигурационные единицы', 'Class:Group/Attribute:parent_id_friendlyname' => 'Родительская группа', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkGroupToCI' => 'Связь Группа/КЕ', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s~~', @@ -1524,11 +1522,11 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Основание', 'Class:lnkGroupToCI/Attribute:reason+' => 'Основание, причина и т.п.', -)); +]); // Add translation for Fieldsets -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Server:baseinfo' => 'Основное', 'Server:Date' => 'Даты', 'Server:moreinfo' => 'Спецификация', @@ -1541,14 +1539,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Subnet/Tab:FreeIPs-count' => 'Свободных IP-адресов: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Вот выборка из 10 свободных IP-адресов', 'Class:Document:PreviewTab' => 'Просмотр', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkDocumentToFunctionalCI' => 'Связь Документ/Функциональная КЕ', 'Class:lnkDocumentToFunctionalCI+' => '', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1560,13 +1557,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Документ', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '', -)); +]); // // Application Menu // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:Application' => 'Приложения', 'Menu:Application+' => 'Все приложения', 'Menu:DBServer' => 'Серверы баз данных', @@ -1611,15 +1608,15 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Menu:OSVersion+' => 'Версия ОС', 'Menu:Software' => 'Каталог ПО', 'Menu:Software+' => 'Каталог ПО', -)); +]); // // Class: PhysicalInterface // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/sk.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/sk.dict.itop-config-mgmt.php index 1666e63a8..d1d80a81a 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/sk.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/sk.dict.itop-config-mgmt.php @@ -1,15 +1,16 @@ 'Prvky zasiahnuté', 'Relation:impacts/DownStream' => 'Impacts...~~', 'Relation:impacts/DownStream+' => 'Elements impacted by~~', @@ -21,8 +22,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Relation:impacts/LoadData' => 'Load data~~', 'Relation:impacts/NoFilteredData' => 'please select objects and load data~~', 'Relation:impacts/FilteredData' => 'Filtered data~~', -)); - +]); // Dictionnay conventions // Class: @@ -65,7 +65,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( // Class: lnkContactToFunctionalCI // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkContactToFunctionalCI' => 'väzba - Kontakt / Komponent', 'Class:lnkContactToFunctionalCI+' => '~~', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -77,13 +77,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '~~', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Názov kontaktu', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '~~', -)); +]); // // Class: FunctionalCI // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:FunctionalCI' => 'Komponent', 'Class:FunctionalCI+' => '~~', 'Class:FunctionalCI/Attribute:name' => 'Názov', @@ -116,13 +116,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:FunctionalCI/Attribute:finalclass+' => 'Name of the final class~~', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Active Tickets~~', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Active Tickets which are impacting this functional CI~~', -)); +]); // // Class: PhysicalDevice // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:PhysicalDevice' => 'Fyzické zariadenie', 'Class:PhysicalDevice+' => '~~', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -156,13 +156,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '~~', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Koniec záruky', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '~~', -)); +]); // // Class: Rack // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Rack' => 'stojan (Rack)', 'Class:Rack+' => '~~', 'Class:Rack/ComplementaryName' => '%1$s - %2$s~~', @@ -172,64 +172,64 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Rack/Attribute:device_list+' => 'All the physical devices racked into this rack~~', 'Class:Rack/Attribute:enclosure_list' => 'Kryt', 'Class:Rack/Attribute:enclosure_list+' => 'All the enclosures in this rack~~', -)); +]); // // Class: TelephonyCI // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TelephonyCI' => 'Telefónne zariadenie', 'Class:TelephonyCI+' => '~~', 'Class:TelephonyCI/Attribute:phonenumber' => 'Telefónne číslo', 'Class:TelephonyCI/Attribute:phonenumber+' => '~~', -)); +]); // // Class: Phone // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Phone' => 'Telefón', 'Class:Phone+' => '~~', -)); +]); // // Class: MobilePhone // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:MobilePhone' => 'Mobilný telefón', 'Class:MobilePhone+' => '~~', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '~~', 'Class:MobilePhone/Attribute:hw_pin' => 'HW PIN', 'Class:MobilePhone/Attribute:hw_pin+' => '~~', -)); +]); // // Class: IPPhone // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:IPPhone' => 'IP telefón', 'Class:IPPhone+' => '~~', -)); +]); // // Class: Tablet // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Tablet' => 'Tablet', 'Class:Tablet+' => '~~', -)); +]); // // Class: ConnectableCI // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ConnectableCI' => 'Pripojiteľné zariadenie', 'Class:ConnectableCI+' => 'Physical CI~~', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s~~', @@ -237,13 +237,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'All network devices connected to this device~~', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Sieťové rozhrania', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'All the physical network interfaces~~', -)); +]); // // Class: DatacenterDevice // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:DatacenterDevice' => 'Zariadenie dátového centra', 'Class:DatacenterDevice+' => '~~', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -275,13 +275,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'The device %2$s is up if at least one power connection (A or B) is up~~', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'The device %2$s is up if all its power connections are up~~', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'The device %2$s is up if at least %1$s %% of its power connections are up~~', -)); +]); // // Class: NetworkDevice // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:NetworkDevice' => 'Sieťové zariadenie', 'Class:NetworkDevice+' => '~~', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -297,13 +297,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '~~', 'Class:NetworkDevice/Attribute:ram' => 'Operačná pamäť', 'Class:NetworkDevice/Attribute:ram+' => '~~', -)); +]); // // Class: Server // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Server' => 'Server', 'Class:Server+' => '~~', 'Class:Server/ComplementaryName' => '%1$s - %2$s~~', @@ -325,61 +325,61 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Server/Attribute:ram+' => '~~', 'Class:Server/Attribute:logicalvolumes_list' => 'Logické disky', 'Class:Server/Attribute:logicalvolumes_list+' => 'All the logical volumes connected to this server~~', -)); +]); // // Class: StorageSystem // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:StorageSystem' => 'Úložiskový systém', 'Class:StorageSystem+' => '~~', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s~~', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Logické disky', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'All the logical volumes in this storage system~~', -)); +]); // // Class: SANSwitch // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:SANSwitch' => 'SAN prepínač', 'Class:SANSwitch+' => '~~', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s~~', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Zariadenia', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'All the devices connected to this SAN switch~~', -)); +]); // // Class: TapeLibrary // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TapeLibrary' => 'Pásková knižnica', 'Class:TapeLibrary+' => '~~', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s~~', 'Class:TapeLibrary/Attribute:tapes_list' => 'Pásky', 'Class:TapeLibrary/Attribute:tapes_list+' => 'All the tapes in the tape library~~', -)); +]); // // Class: NAS // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '~~', 'Class:NAS/ComplementaryName' => '%1$s - %2$s~~', 'Class:NAS/Attribute:nasfilesystem_list' => 'Súborové systémy', 'Class:NAS/Attribute:nasfilesystem_list+' => 'All the file systems in this NAS~~', -)); +]); // // Class: PC // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:PC' => 'PC', 'Class:PC+' => '~~', 'Class:PC/ComplementaryName' => '%1$s - %2$s~~', @@ -401,45 +401,45 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:PC/Attribute:type/Value:desktop+' => 'desktop~~', 'Class:PC/Attribute:type/Value:laptop' => 'Laptop', 'Class:PC/Attribute:type/Value:laptop+' => 'laptop~~', -)); +]); // // Class: Printer // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Printer' => 'Tlačiareň', 'Class:Printer+' => '~~', 'Class:Printer/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerConnection // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:PowerConnection' => 'Elektrická prípojka', 'Class:PowerConnection+' => '~~', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerSource // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:PowerSource' => 'Napájací zdroj', 'Class:PowerSource+' => '~~', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s~~', 'Class:PowerSource/Attribute:pdus_list' => 'Napäťové distribučné jednotky (PDU)', 'Class:PowerSource/Attribute:pdus_list+' => 'All the PDUs using this power source~~', -)); +]); // // Class: PDU // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:PDU' => 'Napäťová distribučná jednotka (PDU)', 'Class:PDU+' => '~~', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s~~', @@ -451,23 +451,23 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:PDU/Attribute:powerstart_id+' => '~~', 'Class:PDU/Attribute:powerstart_name' => 'Názov Power start-u', 'Class:PDU/Attribute:powerstart_name+' => '~~', -)); +]); // // Class: Peripheral // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Peripheral' => 'Periférie', 'Class:Peripheral+' => '~~', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: Enclosure // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Enclosure' => 'Kryt (enclosure)', 'Class:Enclosure+' => '~~', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -479,13 +479,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Enclosure/Attribute:nb_u+' => '~~', 'Class:Enclosure/Attribute:device_list' => 'Zariadenia', 'Class:Enclosure/Attribute:device_list+' => 'All the devices in this enclosure~~', -)); +]); // // Class: ApplicationSolution // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ApplicationSolution' => 'Aplikačné riešenie', 'Class:ApplicationSolution+' => '~~', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'Komponenty', @@ -502,13 +502,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'The solution is up if all CIs are up~~', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'The solution is up if at least %1$s CI(s) is(are) up~~', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'The solution is up if at least %1$s %% of the CIs are up~~', -)); +]); // // Class: BusinessProcess // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:BusinessProcess' => 'Biznis proces', 'Class:BusinessProcess+' => '~~', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Aplikačné riešenia', @@ -519,13 +519,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => 'active~~', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'Neaktívny', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => 'inactive~~', -)); +]); // // Class: SoftwareInstance // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:SoftwareInstance' => 'Softvérová inštancia', 'Class:SoftwareInstance+' => '~~', 'Class:SoftwareInstance/Attribute:system_id' => 'Systém', @@ -548,64 +548,64 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => 'active~~', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'neaktívna', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => 'inactive~~', -)); +]); // // Class: Middleware // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Middleware' => 'Middleware', 'Class:Middleware+' => '~~', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Middleware inštancie', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'All the middleware instances provided by this middleware~~', -)); +]); // // Class: DBServer // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:DBServer' => 'DB Server', 'Class:DBServer+' => '~~', 'Class:DBServer/Attribute:dbschema_list' => 'DB schémy', 'Class:DBServer/Attribute:dbschema_list+' => 'All the database schemas for this DB server~~', -)); +]); // // Class: WebServer // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:WebServer' => 'Web server', 'Class:WebServer+' => '~~', 'Class:WebServer/Attribute:webapp_list' => 'Webové aplikácie', 'Class:WebServer/Attribute:webapp_list+' => 'All the web applications available on this web server~~', -)); +]); // // Class: PCSoftware // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:PCSoftware' => 'PC softvér', 'Class:PCSoftware+' => '~~', -)); +]); // // Class: OtherSoftware // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:OtherSoftware' => 'Iný softvér', 'Class:OtherSoftware+' => '~~', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:MiddlewareInstance' => 'Middleware inštancia', 'Class:MiddlewareInstance+' => '~~', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s~~', @@ -613,13 +613,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '~~', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Názov Middleware-u', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '~~', -)); +]); // // Class: DatabaseSchema // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:DatabaseSchema' => 'Databázová schéma', 'Class:DatabaseSchema+' => '~~', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s~~', @@ -627,13 +627,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '~~', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'Názov DB serveru', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '~~', -)); +]); // // Class: WebApplication // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:WebApplication' => 'Webová Aplikácia', 'Class:WebApplication+' => '~~', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s~~', @@ -643,14 +643,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:WebApplication/Attribute:webserver_name+' => '~~', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '~~', -)); - +]); // // Class: VirtualDevice // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:VirtualDevice' => 'Virtuálne zariadenie', 'Class:VirtualDevice+' => '~~', 'Class:VirtualDevice/Attribute:status' => 'Stav', @@ -665,24 +664,24 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => 'stock~~', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Zoznam logických dielov', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'All the logical volumes used by this device~~', -)); +]); // // Class: VirtualHost // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:VirtualHost' => 'Virtuálny host', 'Class:VirtualHost+' => '~~', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Zoznam virtuálnych strojov', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'All the virtual machines hosted by this host~~', -)); +]); // // Class: Hypervisor // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Hypervisor' => 'Hypervisor', 'Class:Hypervisor+' => '~~', 'Class:Hypervisor/Attribute:farm_id' => 'Farma', @@ -693,13 +692,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Hypervisor/Attribute:server_id+' => '~~', 'Class:Hypervisor/Attribute:server_name' => 'Názov serveru', 'Class:Hypervisor/Attribute:server_name+' => '~~', -)); +]); // // Class: Farm // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Farm' => 'Farma', 'Class:Farm+' => '~~', 'Class:Farm/Attribute:hypervisor_list' => 'Hypervisori', @@ -708,13 +707,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Farm/Attribute:redundancy/disabled' => 'The farm is up if all the hypervisors are up~~', 'Class:Farm/Attribute:redundancy/count' => 'The farm is up if at least %1$s hypervisor(s) is(are) up~~', 'Class:Farm/Attribute:redundancy/percent' => 'The farm is up if at least %1$s %% of the hypervisors are up~~', -)); +]); // // Class: VirtualMachine // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:VirtualMachine' => 'Virtuálne zariadenie', 'Class:VirtualMachine+' => '~~', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s~~', @@ -742,13 +741,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:VirtualMachine/Attribute:managementip+' => '~~', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Zoznam sieťových rozhraní', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'All the logical network interfaces~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:LogicalVolume' => 'Logické disky', 'Class:LogicalVolume+' => '~~', 'Class:LogicalVolume/Attribute:name' => 'Názov', @@ -769,13 +768,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'All the servers using this volume~~', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Virtuálne zariadenia', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'All the virtual devices using this volume~~', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkServerToVolume' => 'väzba - Server / Logický Disk', 'Class:lnkServerToVolume+' => '~~', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s~~', @@ -789,13 +788,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '~~', 'Class:lnkServerToVolume/Attribute:size_used' => 'Použité miesto', 'Class:lnkServerToVolume/Attribute:size_used+' => '~~', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkVirtualDeviceToVolume' => 'väzba Virtuálne zariadenie / Logický disk', 'Class:lnkVirtualDeviceToVolume+' => '~~', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s~~', @@ -809,13 +808,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '~~', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Použité miesto', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '~~', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkSanToDatacenterDevice' => 'väzba - SAN / Zariadenie', 'Class:lnkSanToDatacenterDevice+' => '~~', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s~~', @@ -831,13 +830,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '~~', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => '(FC) Port zariadenia', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '~~', -)); +]); // // Class: Tape // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Tape' => 'Páska', 'Class:Tape+' => '~~', 'Class:Tape/Attribute:name' => 'Názov', @@ -850,13 +849,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Tape/Attribute:tapelibrary_id+' => '~~', 'Class:Tape/Attribute:tapelibrary_name' => 'Názov knižnice pásiek', 'Class:Tape/Attribute:tapelibrary_name+' => '~~', -)); +]); // // Class: NASFileSystem // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:NASFileSystem' => 'NAS Súborový systém', 'Class:NASFileSystem+' => '~~', 'Class:NASFileSystem/Attribute:name' => 'Názov', @@ -871,13 +870,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:NASFileSystem/Attribute:nas_id+' => '~~', 'Class:NASFileSystem/Attribute:nas_name' => 'Názov NAS', 'Class:NASFileSystem/Attribute:nas_name+' => '~~', -)); +]); // // Class: Software // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Software' => 'Softvér', 'Class:Software+' => '~~', 'Class:Software/ComplementaryName' => '%1$s - %2$s~~', @@ -907,13 +906,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Software/Attribute:softwarepatch_list+' => 'All the patchs for this software~~', 'Class:Software/Attribute:softwarelicence_list' => 'Softvérové licencie', 'Class:Software/Attribute:softwarelicence_list+' => 'All the licenses for this software~~', -)); +]); // // Class: Patch // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Patch' => 'Záplata', 'Class:Patch+' => '~~', 'Class:Patch/Attribute:name' => 'Názov', @@ -924,13 +923,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Patch/Attribute:description+' => '~~', 'Class:Patch/Attribute:finalclass' => 'Typ', 'Class:Patch/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: OSPatch // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:OSPatch' => 'Záplata OS', 'Class:OSPatch+' => '~~', 'Class:OSPatch/Attribute:functionalcis_list' => 'Zariadenia', @@ -939,13 +938,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:OSPatch/Attribute:osversion_id+' => '~~', 'Class:OSPatch/Attribute:osversion_name' => 'Názov OS verzie', 'Class:OSPatch/Attribute:osversion_name+' => '~~', -)); +]); // // Class: SoftwarePatch // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:SoftwarePatch' => 'Softvérová záplata', 'Class:SoftwarePatch+' => '~~', 'Class:SoftwarePatch/Attribute:software_id' => 'Softvér', @@ -954,13 +953,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:SoftwarePatch/Attribute:software_name+' => '~~', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Inštancie softvéru', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'All the systems where this software patch is installed~~', -)); +]); // // Class: Licence // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Licence' => 'Licencia', 'Class:Licence+' => '~~', 'Class:Licence/Attribute:name' => 'Názov', @@ -989,13 +988,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => 'yes~~', 'Class:Licence/Attribute:finalclass' => 'Typ', 'Class:Licence/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: OSLicence // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:OSLicence' => 'Licencia OS', 'Class:OSLicence+' => '~~', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1007,13 +1006,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'All the virtual machines where this license is used~~', 'Class:OSLicence/Attribute:servers_list' => 'Servery', 'Class:OSLicence/Attribute:servers_list+' => 'All the servers where this license is used~~', -)); +]); // // Class: SoftwareLicence // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:SoftwareLicence' => 'Softvérová licencia', 'Class:SoftwareLicence+' => '~~', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1023,13 +1022,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:SoftwareLicence/Attribute:software_name+' => '~~', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Inštancie softvéru', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'All the systems where this license is used~~', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkDocumentToLicence' => 'väzba Dokument/Licencia', 'Class:lnkDocumentToLicence+' => '~~', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s~~', @@ -1041,35 +1040,35 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '~~', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Názov dokumentu', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '~~', -)); +]); // // Class: OSVersion // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:OSVersion' => 'Verzia OS', 'Class:OSVersion+' => '~~', 'Class:OSVersion/Attribute:osfamily_id' => 'Kategória OS', 'Class:OSVersion/Attribute:osfamily_id+' => '~~', 'Class:OSVersion/Attribute:osfamily_name' => 'Názov kategórie OS', 'Class:OSVersion/Attribute:osfamily_name+' => '~~', -)); +]); // // Class: OSFamily // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:OSFamily' => 'Kategória OS', 'Class:OSFamily+' => '~~', -)); +]); // // Class: Brand // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Brand' => 'Značka', 'Class:Brand+' => '~~', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1078,13 +1077,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'All the physical devices corresponding to this brand~~', 'Class:Brand/UniquenessRule:name+' => 'The name must be unique~~', 'Class:Brand/UniquenessRule:name' => 'This brand already exists~~', -)); +]); // // Class: Model // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Model' => 'Model', 'Class:Model+' => '~~', 'Class:Model/ComplementaryName' => '%1$s - %2$s~~', @@ -1136,37 +1135,37 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Model/Attribute:physicaldevices_list+' => 'All the physical devices corresponding to this model~~', 'Class:Model/UniquenessRule:name_brand+' => 'Name must be unique in the brand~~', 'Class:Model/UniquenessRule:name_brand' => 'this model already exists for this brand~~', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:NetworkDeviceType' => 'Typ sieťového zariadenia', 'Class:NetworkDeviceType+' => '~~', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Sieťové zariadenia', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'All the network devices corresponding to this type~~', -)); +]); // // Class: IOSVersion // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:IOSVersion' => 'Verzia IOSu', 'Class:IOSVersion+' => '~~', 'Class:IOSVersion/Attribute:brand_id' => 'Značka', 'Class:IOSVersion/Attribute:brand_id+' => '~~', 'Class:IOSVersion/Attribute:brand_name' => 'Názov značky', 'Class:IOSVersion/Attribute:brand_name+' => '~~', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkDocumentToPatch' => 'väzba - Dokument / Záplata', 'Class:lnkDocumentToPatch+' => '~~', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s~~', @@ -1178,13 +1177,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '~~', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Názov dokumentu', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'väzba - Softvérová inštancia / Softvérová záplata', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '~~', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s~~', @@ -1196,13 +1195,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '~~', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Názov softvérovej inštancie', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '~~', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkFunctionalCIToOSPatch' => 'väzba - Komponent / Záplata OS', 'Class:lnkFunctionalCIToOSPatch+' => '~~', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s~~', @@ -1214,13 +1213,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'Názov funkčných CI', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkDocumentToSoftware' => 'väzba Dokument / Softvér', 'Class:lnkDocumentToSoftware+' => '~~', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s~~', @@ -1232,13 +1231,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '~~', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Názov dokumentu', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '~~', -)); +]); // // Class: Subnet // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Subnet' => 'Podsieť', 'Class:Subnet+' => '~~', 'Class:Subnet/Name' => '%1$s/%2$s~~', @@ -1257,13 +1256,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Subnet/Attribute:ip_mask+' => '~~', 'Class:Subnet/Attribute:vlans_list' => 'VLANs~~', 'Class:Subnet/Attribute:vlans_list+' => '~~', -)); +]); // // Class: VLAN // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:VLAN' => 'VLAN~~', 'Class:VLAN+' => '~~', 'Class:VLAN/Attribute:vlan_tag' => 'VLAN Tag~~', @@ -1278,13 +1277,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:VLAN/Attribute:subnets_list+' => '~~', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Physical network interfaces~~', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '~~', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkSubnetToVLAN' => 'Link Subnet / VLAN~~', 'Class:lnkSubnetToVLAN+' => '~~', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s~~', @@ -1298,26 +1297,26 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '~~', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'VLAN Tag~~', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '~~', -)); +]); // // Class: NetworkInterface // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:NetworkInterface' => 'Sieťové rozhranie', 'Class:NetworkInterface+' => '~~', 'Class:NetworkInterface/Attribute:name' => 'Názov', 'Class:NetworkInterface/Attribute:name+' => '~~', 'Class:NetworkInterface/Attribute:finalclass' => 'Typ', 'Class:NetworkInterface/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: IPInterface // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:IPInterface' => 'IP rozhranie', 'Class:IPInterface+' => '~~', 'Class:IPInterface/Attribute:ipaddress' => 'IP Adresa', @@ -1332,13 +1331,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:IPInterface/Attribute:ipmask+' => '~~', 'Class:IPInterface/Attribute:speed' => 'Rýchlosť', 'Class:IPInterface/Attribute:speed+' => '~~', -)); +]); // // Class: PhysicalInterface // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:PhysicalInterface' => 'Fyzické rozhranie', 'Class:PhysicalInterface+' => '~~', 'Class:PhysicalInterface/Name' => '%2$s %1$s~~', @@ -1348,13 +1347,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '~~', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLANs~~', 'Class:PhysicalInterface/Attribute:vlans_list+' => '~~', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Link PhysicalInterface / VLAN~~', 'Class:lnkPhysicalInterfaceToVLAN+' => '~~', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s~~', @@ -1370,27 +1369,26 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '~~', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'VLAN Tag~~', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '~~', -)); - +]); // // Class: LogicalInterface // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:LogicalInterface' => 'Logické rozhranie', 'Class:LogicalInterface+' => '~~', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Virtuálne zariadenie', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '~~', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Názov virtuálneho stroja', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:FiberChannelInterface' => 'Optické rozhranie', 'Class:FiberChannelInterface+' => '~~', 'Class:FiberChannelInterface/Attribute:speed' => 'Rýchlosť', @@ -1403,13 +1401,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '~~', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Názov zariadenia', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '~~', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkConnectableCIToNetworkDevice' => 'väzba - Komponent / Sieťové zariadenie', 'Class:lnkConnectableCIToNetworkDevice+' => '~~', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s~~', @@ -1431,13 +1429,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'down link~~', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'uplink', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'up link~~', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'väzba - Aplikačné riešenie / Komponent', 'Class:lnkApplicationSolutionToFunctionalCI+' => '~~', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1449,13 +1447,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '~~', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'Názov funkčných CI', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'väzba - Aplikačné riešenie / Biznis proces', 'Class:lnkApplicationSolutionToBusinessProcess+' => '~~', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s~~', @@ -1467,13 +1465,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '~~', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Názov aplikačného riešenia', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '~~', -)); +]); // // Class: Group // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Group' => 'Skupina', 'Class:Group+' => '~~', 'Class:Group/ComplementaryName' => '%1$s - %2$s~~', @@ -1503,13 +1501,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Group/Attribute:ci_list+' => 'All the configuration items linked to this group~~', 'Class:Group/Attribute:parent_id_friendlyname' => 'Priateľské meno rodičovskej skupiny', 'Class:Group/Attribute:parent_id_friendlyname+' => '~~', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkGroupToCI' => 'väzba - Skupina / Zariadenie', 'Class:lnkGroupToCI+' => '~~', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s~~', @@ -1523,11 +1521,11 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '~~', 'Class:lnkGroupToCI/Attribute:reason' => 'Dôvod', 'Class:lnkGroupToCI/Attribute:reason+' => '~~', -)); +]); // Add translation for Fieldsets -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Server:baseinfo' => 'Všeobecné informácie', 'Server:Date' => 'Dátum', 'Server:moreinfo' => 'Viac informácií', @@ -1540,14 +1538,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Subnet/Tab:FreeIPs-count' => 'Voľných IP adries: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Tu je extrakt 10 voľných IP adries', 'Class:Document:PreviewTab' => 'Preview~~', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkDocumentToFunctionalCI' => 'väzba - Dokument / Komponent', 'Class:lnkDocumentToFunctionalCI+' => '~~', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1559,13 +1556,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '~~', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Názov dokumentu', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '~~', -)); +]); // // Application Menu // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Menu:Application' => 'Aplikácie', 'Menu:Application+' => 'All applications~~', 'Menu:DBServer' => 'Databázové servery', @@ -1610,15 +1607,15 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Menu:OSVersion+' => '~~', 'Menu:Software' => 'Katalóg softvéru', 'Menu:Software+' => 'Software catalog~~', -)); +]); // // Class: PhysicalInterface // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/tr.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/tr.dict.itop-config-mgmt.php index 89d42aac9..ad2b07d0c 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/tr.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/tr.dict.itop-config-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Relation:impacts/Description' => 'Etkilenen kalemler', 'Relation:impacts/DownStream' => 'Etkiler...', 'Relation:impacts/DownStream+' => 'Etkilenen kalemler', @@ -22,8 +23,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Relation:impacts/LoadData' => 'Load data~~', 'Relation:impacts/NoFilteredData' => 'please select objects and load data~~', 'Relation:impacts/FilteredData' => 'Filtered data~~', -)); - +]); // Dictionnay conventions // Class: @@ -66,7 +66,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( // Class: lnkContactToFunctionalCI // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkContactToFunctionalCI' => 'Kişi / İşlevsel CI bağla', 'Class:lnkContactToFunctionalCI+' => '~~', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -78,13 +78,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '~~', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => 'Kişi Adı', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '~~', -)); +]); // // Class: FunctionalCI // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:FunctionalCI' => 'Fonksiyonel KK', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => 'Adı', @@ -117,13 +117,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:FunctionalCI/Attribute:finalclass+' => '', 'Class:FunctionalCI/Tab:OpenedTickets' => 'Aktif Çağrı Kayıtları', 'Class:FunctionalCI/Tab:OpenedTickets+' => 'Active Tickets which are impacting this functional CI~~', -)); +]); // // Class: PhysicalDevice // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:PhysicalDevice' => 'Fiziksel cihaz', 'Class:PhysicalDevice+' => '~~', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -157,13 +157,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '~~', 'Class:PhysicalDevice/Attribute:end_of_warranty' => 'Garantinin sonu', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '~~', -)); +]); // // Class: Rack // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Rack' => 'Raf', 'Class:Rack+' => '~~', 'Class:Rack/ComplementaryName' => '%1$s - %2$s~~', @@ -173,64 +173,64 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Rack/Attribute:device_list+' => 'Bu rafa yerleştirilmiş tüm fiziksel cihazlar', 'Class:Rack/Attribute:enclosure_list' => 'Muhafazalar', 'Class:Rack/Attribute:enclosure_list+' => 'Bu raftaki tüm muhafazalar', -)); +]); // // Class: TelephonyCI // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TelephonyCI' => 'Telefon CI', 'Class:TelephonyCI+' => '~~', 'Class:TelephonyCI/Attribute:phonenumber' => 'Telefon numarası', 'Class:TelephonyCI/Attribute:phonenumber+' => '~~', -)); +]); // // Class: Phone // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Phone' => 'Telefon', 'Class:Phone+' => '~~', -)); +]); // // Class: MobilePhone // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:MobilePhone' => 'Cep telefonu', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => 'Hardware PIN', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:IPPhone' => 'IP telefonu', 'Class:IPPhone+' => '~~', -)); +]); // // Class: Tablet // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Tablet' => 'Tablet', 'Class:Tablet+' => '~~', -)); +]); // // Class: ConnectableCI // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ConnectableCI' => 'Bağlanabilir KK', 'Class:ConnectableCI+' => 'Fiziksel KK', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s~~', @@ -238,13 +238,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => 'Bu cihaza bağlı tüm ağ cihazları', 'Class:ConnectableCI/Attribute:physicalinterface_list' => 'Ağ arayüzleri', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => 'Tüm fiziksel ağ arayüzleri', -)); +]); // // Class: DatacenterDevice // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:DatacenterDevice' => 'Veri merkezi cihazı', 'Class:DatacenterDevice+' => '~~', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -276,13 +276,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:DatacenterDevice/Attribute:redundancy/count' => 'En az bir güç bağlantısı (A veya B) ayakta ise, cihaz ayaktadır', 'Class:DatacenterDevice/Attribute:redundancy/disabled' => 'Tüm güç bağlantıları ayakta ise, cihaz ayaktadır', 'Class:DatacenterDevice/Attribute:redundancy/percent' => 'En az %1$s %% güç bağlantısı ayakta ise cihaz ayaktadır', -)); +]); // // Class: NetworkDevice // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:NetworkDevice' => 'Ağ Cihazı', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s~~', @@ -298,13 +298,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '~~', 'Class:NetworkDevice/Attribute:ram' => 'RAM', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Server' => 'Sunucu', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s~~', @@ -326,61 +326,61 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => 'Mantıksal depolama alanları', 'Class:Server/Attribute:logicalvolumes_list+' => 'Bu sunucuya bağlı tüm mantıksal depolama alanları', -)); +]); // // Class: StorageSystem // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:StorageSystem' => 'Depolama sistemi', 'Class:StorageSystem+' => '~~', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s~~', 'Class:StorageSystem/Attribute:logicalvolume_list' => 'Mantıksal depolama alanları', 'Class:StorageSystem/Attribute:logicalvolume_list+' => 'Bu depolama sistemindeki tüm mantıksal depolama alanları', -)); +]); // // Class: SANSwitch // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:SANSwitch' => 'SAN Anahtarı', 'Class:SANSwitch+' => '~~', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s~~', 'Class:SANSwitch/Attribute:datacenterdevice_list' => 'Cihazlar', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => 'Bu SAN anahtarına bağlı tüm cihazlar', -)); +]); // // Class: TapeLibrary // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TapeLibrary' => 'Teyp Kütüphanesi', 'Class:TapeLibrary+' => '~~', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s~~', 'Class:TapeLibrary/Attribute:tapes_list' => 'Teypler', 'Class:TapeLibrary/Attribute:tapes_list+' => 'Teyp kitaplığındaki tüm teypler', -)); +]); // // Class: NAS // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '~~', 'Class:NAS/ComplementaryName' => '%1$s - %2$s~~', 'Class:NAS/Attribute:nasfilesystem_list' => 'Dosya sistemleri', 'Class:NAS/Attribute:nasfilesystem_list+' => 'Bu NAS\'daki tüm dosya sistemleri', -)); +]); // // Class: PC // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:PC' => 'PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s~~', @@ -402,45 +402,45 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:PC/Attribute:type/Value:desktop+' => 'masaüstü', 'Class:PC/Attribute:type/Value:laptop' => 'dizüstü', 'Class:PC/Attribute:type/Value:laptop+' => 'dizüstü', -)); +]); // // Class: Printer // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Printer' => 'Yazıcı', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerConnection // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:PowerConnection' => 'Güç Bağlantısı', 'Class:PowerConnection+' => '~~', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: PowerSource // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:PowerSource' => 'Güç Kaynağı', 'Class:PowerSource+' => '~~', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s~~', 'Class:PowerSource/Attribute:pdus_list' => 'PDU\'lar', 'Class:PowerSource/Attribute:pdus_list+' => 'Bu güç kaynağını kullanan tüm PDU\'lar', -)); +]); // // Class: PDU // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '~~', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s~~', @@ -452,23 +452,23 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:PDU/Attribute:powerstart_id+' => '~~', 'Class:PDU/Attribute:powerstart_name' => 'Güç başlatıcı adı', 'Class:PDU/Attribute:powerstart_name+' => '~~', -)); +]); // // Class: Peripheral // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Peripheral' => 'Çevresel Birim', 'Class:Peripheral+' => '~~', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s~~', -)); +]); // // Class: Enclosure // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Enclosure' => 'Muhafaza', 'Class:Enclosure+' => '~~', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -480,13 +480,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Enclosure/Attribute:nb_u+' => '~~', 'Class:Enclosure/Attribute:device_list' => 'Cihazlar', 'Class:Enclosure/Attribute:device_list+' => 'Bu muhafazadaki tüm cihazlar', -)); +]); // // Class: ApplicationSolution // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ApplicationSolution' => 'Uygulama çözümleri', 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'CIs', @@ -503,13 +503,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => 'Tüm CI\'ler hazır ise sistem hazırdır', 'Class:ApplicationSolution/Attribute:redundancy/count' => 'CI\'lerin en az %1$s \'i hazır ise sistem hazırdır', 'Class:ApplicationSolution/Attribute:redundancy/percent' => 'CI\'lerin en az %1$s %% \'i hazır ise sistem hazırdır.', -)); +]); // // Class: BusinessProcess // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:BusinessProcess' => 'İş süreci', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Uygulama sistemleri', @@ -520,13 +520,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => 'Aktif', 'Class:BusinessProcess/Attribute:status/Value:inactive' => 'Aktif değil', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => 'Aktif değil', -)); +]); // // Class: SoftwareInstance // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:SoftwareInstance' => 'Yazılım Kurulumu', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => 'Sistem', @@ -549,64 +549,64 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => 'Aktif', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => 'Aktif değil', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => 'Aktif değil', -)); +]); // // Class: Middleware // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Middleware' => 'Ara katman yazılımı', 'Class:Middleware+' => '~~', 'Class:Middleware/Attribute:middlewareinstance_list' => 'Ara katman yazılımı olayları', 'Class:Middleware/Attribute:middlewareinstance_list+' => 'Bu ara katman yazılımı tarafından sağlanan tüm ara katman yazılımı olayları', -)); +]); // // Class: DBServer // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:DBServer' => 'Veritabanı', 'Class:DBServer+' => 'Veritabanı yazılımı', 'Class:DBServer/Attribute:dbschema_list' => 'Veritabanı şemaları', 'Class:DBServer/Attribute:dbschema_list+' => 'Bu veritabanı sunucusu için tüm veritabanı şemaları', -)); +]); // // Class: WebServer // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:WebServer' => 'Web Sunucusu', 'Class:WebServer+' => '~~', 'Class:WebServer/Attribute:webapp_list' => 'Web Uygulamaları', 'Class:WebServer/Attribute:webapp_list+' => 'Bu web sunucusunda mevcut tüm web uygulamaları', -)); +]); // // Class: PCSoftware // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:PCSoftware' => 'PC yazılımı', 'Class:PCSoftware+' => '~~', -)); +]); // // Class: OtherSoftware // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:OtherSoftware' => 'Diğer yazılım', 'Class:OtherSoftware+' => '~~', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:MiddlewareInstance' => 'Ara katman yazılımı olayı', 'Class:MiddlewareInstance+' => '~~', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s~~', @@ -614,13 +614,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '~~', 'Class:MiddlewareInstance/Attribute:middleware_name' => 'Ara katman yazılımı adı', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '~~', -)); +]); // // Class: DatabaseSchema // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:DatabaseSchema' => 'Veritabanı Şeması', 'Class:DatabaseSchema+' => '~~', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s~~', @@ -628,13 +628,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '~~', 'Class:DatabaseSchema/Attribute:dbserver_name' => 'Veritabanı sunucu adı', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '~~', -)); +]); // // Class: WebApplication // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:WebApplication' => 'Web Uygulaması', 'Class:WebApplication+' => '~~', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s~~', @@ -644,14 +644,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:WebApplication/Attribute:webserver_name+' => '~~', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '~~', -)); - +]); // // Class: VirtualDevice // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:VirtualDevice' => 'Sanal cihaz', 'Class:VirtualDevice+' => '~~', 'Class:VirtualDevice/Attribute:status' => 'Durum', @@ -666,24 +665,24 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => 'stok', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => 'Mantıksal depolama alanları', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => 'Bu cihaz tarafından kullanılan tüm mantıksal depolama alanları', -)); +]); // // Class: VirtualHost // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:VirtualHost' => 'Sanal Ana Makine', 'Class:VirtualHost+' => '~~', 'Class:VirtualHost/Attribute:virtualmachine_list' => 'Sanal Makineler', 'Class:VirtualHost/Attribute:virtualmachine_list+' => 'Bu ana makine üzerinde çalışan tüm sanal makineler', -)); +]); // // Class: Hypervisor // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Hypervisor' => 'Hipervizör', 'Class:Hypervisor+' => '~~', 'Class:Hypervisor/Attribute:farm_id' => 'Çiftlik', @@ -694,13 +693,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Hypervisor/Attribute:server_id+' => '~~', 'Class:Hypervisor/Attribute:server_name' => 'Sunucu adı', 'Class:Hypervisor/Attribute:server_name+' => '~~', -)); +]); // // Class: Farm // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Farm' => 'Çiftlik', 'Class:Farm+' => '~~', 'Class:Farm/Attribute:hypervisor_list' => 'Hipervizörler', @@ -709,13 +708,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Farm/Attribute:redundancy/disabled' => 'Tüm hipervizörler ayakta ise çiftlik ayaktadır', 'Class:Farm/Attribute:redundancy/count' => 'Hipervizörlerin en az %1$s \'i ayakta ise çiftlik ayaktadır', 'Class:Farm/Attribute:redundancy/percent' => 'Hipervizörlerin en az %1$s %% \'i ayakta ise çiftlik ayaktadır.', -)); +]); // // Class: VirtualMachine // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:VirtualMachine' => 'Sanal makine', 'Class:VirtualMachine+' => '~~', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s~~', @@ -743,13 +742,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:VirtualMachine/Attribute:managementip+' => '~~', 'Class:VirtualMachine/Attribute:logicalinterface_list' => 'Ağ arayüzleri', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => 'Tüm mantıksal ağ arayüzleri', -)); +]); // // Class: LogicalVolume // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:LogicalVolume' => 'Mantıksal Depolama Alanları', 'Class:LogicalVolume+' => '~~', 'Class:LogicalVolume/Attribute:name' => 'İsim', @@ -770,13 +769,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:LogicalVolume/Attribute:servers_list+' => 'Bu depolama alanını kullanan tüm sunucular', 'Class:LogicalVolume/Attribute:virtualdevices_list' => 'Sanal Cihazlar', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => 'Bu depolama alanını kullanan tüm sanal cihazlar', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkServerToVolume' => 'Bağlantılı sunucu / Depolama alanı', 'Class:lnkServerToVolume+' => '~~', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s~~', @@ -790,13 +789,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '~~', 'Class:lnkServerToVolume/Attribute:size_used' => 'Kullanılan boyut', 'Class:lnkServerToVolume/Attribute:size_used+' => '~~', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkVirtualDeviceToVolume' => 'Sanal cihaz / Depolama alanı bağla', 'Class:lnkVirtualDeviceToVolume+' => '~~', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s~~', @@ -810,13 +809,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '~~', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => 'Kullanılan boyut', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '~~', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkSanToDatacenterDevice' => 'SAN/ Veri merkezi cihazı bağla', 'Class:lnkSanToDatacenterDevice+' => '~~', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s~~', @@ -832,13 +831,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '~~', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => 'Cihaz FC', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '~~', -)); +]); // // Class: Tape // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Tape' => 'Teyp', 'Class:Tape+' => '~~', 'Class:Tape/Attribute:name' => 'İsim', @@ -851,13 +850,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Tape/Attribute:tapelibrary_id+' => '~~', 'Class:Tape/Attribute:tapelibrary_name' => 'Teyp Kütüphanesi Adı', 'Class:Tape/Attribute:tapelibrary_name+' => '~~', -)); +]); // // Class: NASFileSystem // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:NASFileSystem' => 'NAS dosya sistemi', 'Class:NASFileSystem+' => '~~', 'Class:NASFileSystem/Attribute:name' => 'İsim', @@ -872,13 +871,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:NASFileSystem/Attribute:nas_id+' => '~~', 'Class:NASFileSystem/Attribute:nas_name' => 'NAS Adı', 'Class:NASFileSystem/Attribute:nas_name+' => '~~', -)); +]); // // Class: Software // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Software' => 'Yazılım', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s~~', @@ -908,13 +907,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Software/Attribute:softwarepatch_list+' => 'Bu yazılım için tüm yamalar', 'Class:Software/Attribute:softwarelicence_list' => 'Yazılım Lisansları', 'Class:Software/Attribute:softwarelicence_list+' => 'Bu yazılımın tüm lisansları', -)); +]); // // Class: Patch // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Patch' => 'Yama', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => 'Adı', @@ -925,13 +924,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => 'Tip', 'Class:Patch/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: OSPatch // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:OSPatch' => 'İşletim sistemi yaması', 'Class:OSPatch+' => '~~', 'Class:OSPatch/Attribute:functionalcis_list' => 'Cihazlar', @@ -940,13 +939,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:OSPatch/Attribute:osversion_id+' => '~~', 'Class:OSPatch/Attribute:osversion_name' => 'OS Sürüm Adı', 'Class:OSPatch/Attribute:osversion_name+' => '~~', -)); +]); // // Class: SoftwarePatch // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:SoftwarePatch' => 'Yazılım yaması', 'Class:SoftwarePatch+' => '~~', 'Class:SoftwarePatch/Attribute:software_id' => 'Yazılım', @@ -955,13 +954,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:SoftwarePatch/Attribute:software_name+' => '~~', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => 'Yazılım olayları', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => 'Bu yazılım yamasının kurulduğu tüm sistemler', -)); +]); // // Class: Licence // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Licence' => 'Lisans', 'Class:Licence+' => '', 'Class:Licence/Attribute:name' => 'Adı', @@ -990,13 +989,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => 'evet', 'Class:Licence/Attribute:finalclass' => 'Tip', 'Class:Licence/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: OSLicence // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:OSLicence' => 'OS Lisansı', 'Class:OSLicence+' => '~~', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1008,13 +1007,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => 'Bu lisansın kullanıldığı tüm sanal makineler', 'Class:OSLicence/Attribute:servers_list' => 'Sunucular', 'Class:OSLicence/Attribute:servers_list+' => 'Bu lisansın kullanıldığı tüm sunucular', -)); +]); // // Class: SoftwareLicence // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:SoftwareLicence' => 'Yazılım Lisansı', 'Class:SoftwareLicence+' => '~~', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s~~', @@ -1024,13 +1023,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:SoftwareLicence/Attribute:software_name+' => '~~', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => 'Yazılım olayları', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => 'Bu lisansın kullanıldığı tüm sistemler', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkDocumentToLicence' => 'Belge / lisans bağla', 'Class:lnkDocumentToLicence+' => '~~', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s~~', @@ -1042,35 +1041,35 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '~~', 'Class:lnkDocumentToLicence/Attribute:document_name' => 'Belge Adı', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '~~', -)); +]); // // Class: OSVersion // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:OSVersion' => 'OS Sürümü', 'Class:OSVersion+' => '~~', 'Class:OSVersion/Attribute:osfamily_id' => 'OS ailesi', 'Class:OSVersion/Attribute:osfamily_id+' => '~~', 'Class:OSVersion/Attribute:osfamily_name' => 'OS Aile Adı', 'Class:OSVersion/Attribute:osfamily_name+' => '~~', -)); +]); // // Class: OSFamily // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:OSFamily' => 'OS ailesi', 'Class:OSFamily+' => '~~', -)); +]); // // Class: Brand // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Brand' => 'Marka', 'Class:Brand+' => '~~', 'Class:Brand/Attribute:logo' => 'Logo~~', @@ -1079,13 +1078,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Brand/Attribute:physicaldevices_list+' => 'Bu markaya karşılık gelen tüm fiziksel cihazlar', 'Class:Brand/UniquenessRule:name+' => 'The name must be unique~~', 'Class:Brand/UniquenessRule:name' => 'This brand already exists~~', -)); +]); // // Class: Model // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Model' => 'Model', 'Class:Model+' => '~~', 'Class:Model/ComplementaryName' => '%1$s - %2$s~~', @@ -1137,37 +1136,37 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Model/Attribute:physicaldevices_list+' => 'Bu modele karşılık gelen tüm fiziksel cihazlar', 'Class:Model/UniquenessRule:name_brand+' => 'Name must be unique in the brand~~', 'Class:Model/UniquenessRule:name_brand' => 'this model already exists for this brand~~', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:NetworkDeviceType' => 'Ağ Cihazı Tipi', 'Class:NetworkDeviceType+' => '~~', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => 'Ağ Aygıtları', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => 'Bu türde karşılık gelen tüm ağ aygıtları', -)); +]); // // Class: IOSVersion // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:IOSVersion' => 'IOS sürümü', 'Class:IOSVersion+' => '~~', 'Class:IOSVersion/Attribute:brand_id' => 'Marka', 'Class:IOSVersion/Attribute:brand_id+' => '~~', 'Class:IOSVersion/Attribute:brand_name' => 'Marka Adı', 'Class:IOSVersion/Attribute:brand_name+' => '~~', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkDocumentToPatch' => 'Bağlantılı belge / yama', 'Class:lnkDocumentToPatch+' => '~~', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s~~', @@ -1179,13 +1178,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '~~', 'Class:lnkDocumentToPatch/Attribute:document_name' => 'Belge Adı', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => 'Yazılımı olayı / Yazılım yaması bağla', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '~~', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s~~', @@ -1197,13 +1196,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '~~', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => 'Yazılım olayı adı', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '~~', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkFunctionalCIToOSPatch' => 'İşlevsel CI / OS Yaması bağla', 'Class:lnkFunctionalCIToOSPatch+' => '~~', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s~~', @@ -1215,13 +1214,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => 'İşlevsel CI Adı', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkDocumentToSoftware' => 'Belge / yazılım bağla', 'Class:lnkDocumentToSoftware+' => '~~', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s~~', @@ -1233,13 +1232,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '~~', 'Class:lnkDocumentToSoftware/Attribute:document_name' => 'Belge Adı', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '~~', -)); +]); // // Class: Subnet // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Subnet' => 'Subnet', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s~~', @@ -1258,13 +1257,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLAN \'lar', 'Class:Subnet/Attribute:vlans_list+' => '~~', -)); +]); // // Class: VLAN // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:VLAN' => 'Vlan', 'Class:VLAN+' => '~~', 'Class:VLAN/Attribute:vlan_tag' => 'Vlan etiketi', @@ -1279,13 +1278,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:VLAN/Attribute:subnets_list+' => '~~', 'Class:VLAN/Attribute:physicalinterfaces_list' => 'Fiziksel Ağ Arayüzleri', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '~~', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkSubnetToVLAN' => 'Alt Ağ / VLAN bağla', 'Class:lnkSubnetToVLAN+' => '~~', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s~~', @@ -1299,26 +1298,26 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '~~', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'VLAN Etiketi', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '~~', -)); +]); // // Class: NetworkInterface // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:NetworkInterface' => 'Network arayüzü', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => 'İsim', 'Class:NetworkInterface/Attribute:name+' => '~~', 'Class:NetworkInterface/Attribute:finalclass' => 'Tip', 'Class:NetworkInterface/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: IPInterface // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:IPInterface' => 'IP arayüzü', 'Class:IPInterface+' => '~~', 'Class:IPInterface/Attribute:ipaddress' => 'IP adresi', @@ -1333,13 +1332,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:IPInterface/Attribute:ipmask+' => '~~', 'Class:IPInterface/Attribute:speed' => 'Hız', 'Class:IPInterface/Attribute:speed+' => '~~', -)); +]); // // Class: PhysicalInterface // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:PhysicalInterface' => 'Fiziksel arayüz', 'Class:PhysicalInterface+' => '~~', 'Class:PhysicalInterface/Name' => '%2$s %1$s~~', @@ -1349,13 +1348,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '~~', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLAN\'lar', 'Class:PhysicalInterface/Attribute:vlans_list+' => '~~', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkPhysicalInterfaceToVLAN' => 'Fiziksel Arabirim / VLAN bağla', 'Class:lnkPhysicalInterfaceToVLAN+' => '~~', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s~~', @@ -1371,27 +1370,26 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '~~', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'VLAN etiketi', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '~~', -)); - +]); // // Class: LogicalInterface // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:LogicalInterface' => 'Mantıksal arabirim', 'Class:LogicalInterface+' => '~~', 'Class:LogicalInterface/Attribute:virtualmachine_id' => 'Sanal makine', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '~~', 'Class:LogicalInterface/Attribute:virtualmachine_name' => 'Sanal Makine Adı', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:FiberChannelInterface' => 'Fiber Kanal Arabirimi', 'Class:FiberChannelInterface+' => '~~', 'Class:FiberChannelInterface/Attribute:speed' => 'Hız', @@ -1404,13 +1402,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '~~', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => 'Cihaz adı', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '~~', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkConnectableCIToNetworkDevice' => 'İlişkilendirilebilir CI / Ağ cihazı bağla', 'Class:lnkConnectableCIToNetworkDevice+' => '~~', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s~~', @@ -1432,13 +1430,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => 'aşağı bağlantı', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => 'yukarı bağlantı', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => 'yukarı bağlantı', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkApplicationSolutionToFunctionalCI' => 'Uygulama Çözümü / İşlevsel CI bağla', 'Class:lnkApplicationSolutionToFunctionalCI+' => '~~', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1450,13 +1448,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '~~', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'İşlevsel CI Adı', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkApplicationSolutionToBusinessProcess' => 'Uygulama Çözümü / İş Süreci bağla', 'Class:lnkApplicationSolutionToBusinessProcess+' => '~~', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s~~', @@ -1468,13 +1466,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '~~', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Uygulama Çözümü Adı', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '~~', -)); +]); // // Class: Group // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Group' => 'Grup', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s~~', @@ -1504,13 +1502,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Group/Attribute:ci_list+' => 'All the configuration items linked to this group~~', 'Class:Group/Attribute:parent_id_friendlyname' => 'Ana Grup', 'Class:Group/Attribute:parent_id_friendlyname+' => '~~', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkGroupToCI' => 'Grup / KK', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s~~', @@ -1524,11 +1522,11 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => 'Sebep', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Server:baseinfo' => 'Genel Bilgi', 'Server:Date' => 'Tarihler', 'Server:moreinfo' => 'Daha fazla bilgi', @@ -1541,14 +1539,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Subnet/Tab:FreeIPs-count' => 'Boş IPler: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => 'Boş IP adresleri', 'Class:Document:PreviewTab' => 'Ön görünüm', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkDocumentToFunctionalCI' => 'Belge / İşlevsel CI bağla', 'Class:lnkDocumentToFunctionalCI+' => '~~', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -1560,13 +1557,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '~~', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => 'Belge Adı', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '~~', -)); +]); // // Application Menu // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Menu:Application' => 'Uygulamalar', 'Menu:Application+' => 'Tüm Uygulamalar', 'Menu:DBServer' => 'Veritabanı sunucuları', @@ -1611,15 +1608,15 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Menu:OSVersion+' => '~~', 'Menu:Software' => 'Yazılım Kataloğu', 'Menu:Software+' => 'Yazılım Kataloğu', -)); +]); // // Class: PhysicalInterface // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/dictionaries/zh_cn.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/dictionaries/zh_cn.dict.itop-config-mgmt.php index 60a170281..19702c15e 100644 --- a/datamodels/2.x/itop-config-mgmt/dictionaries/zh_cn.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/dictionaries/zh_cn.dict.itop-config-mgmt.php @@ -1,4 +1,5 @@ '被影响的元素', 'Relation:impacts/DownStream' => '影响...', 'Relation:impacts/DownStream+' => '被影响的元素', @@ -37,8 +38,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Relation:impacts/LoadData' => '加载数据', 'Relation:impacts/NoFilteredData' => 'please select objects and load data~~', 'Relation:impacts/FilteredData' => 'Filtered data~~', -)); - +]); // Dictionnay conventions // Class: @@ -81,7 +81,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( // Class: lnkContactToFunctionalCI // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkContactToFunctionalCI' => '关联联系人/功能项', 'Class:lnkContactToFunctionalCI+' => '', 'Class:lnkContactToFunctionalCI/Name' => '%1$s / %2$s', @@ -93,13 +93,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkContactToFunctionalCI/Attribute:contact_id+' => '', 'Class:lnkContactToFunctionalCI/Attribute:contact_name' => '联系人名称', 'Class:lnkContactToFunctionalCI/Attribute:contact_name+' => '', -)); +]); // // Class: FunctionalCI // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:FunctionalCI' => '功能配置项', 'Class:FunctionalCI+' => '', 'Class:FunctionalCI/Attribute:name' => '名称', @@ -132,13 +132,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:FunctionalCI/Attribute:finalclass+' => '根本属性的名称', 'Class:FunctionalCI/Tab:OpenedTickets' => '活跃的工单', 'Class:FunctionalCI/Tab:OpenedTickets+' => '影响当前功能配置项的活跃工单', -)); +]); // // Class: PhysicalDevice // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:PhysicalDevice' => '物理设备', 'Class:PhysicalDevice+' => '', 'Class:PhysicalDevice/ComplementaryName' => '%1$s - %2$s', @@ -172,13 +172,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:PhysicalDevice/Attribute:purchase_date+' => '', 'Class:PhysicalDevice/Attribute:end_of_warranty' => '过保日期', 'Class:PhysicalDevice/Attribute:end_of_warranty+' => '', -)); +]); // // Class: Rack // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Rack' => '机架', 'Class:Rack+' => '', 'Class:Rack/ComplementaryName' => '%1$s - %2$s', @@ -188,64 +188,64 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Rack/Attribute:device_list+' => '此机架托管的所有物理设备', 'Class:Rack/Attribute:enclosure_list' => '机柜', 'Class:Rack/Attribute:enclosure_list+' => '此机架上的所有机柜', -)); +]); // // Class: TelephonyCI // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TelephonyCI' => '通讯项', 'Class:TelephonyCI+' => '', 'Class:TelephonyCI/Attribute:phonenumber' => '电话号码', 'Class:TelephonyCI/Attribute:phonenumber+' => '', -)); +]); // // Class: Phone // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Phone' => '电话', 'Class:Phone+' => '', -)); +]); // // Class: MobilePhone // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:MobilePhone' => '手机', 'Class:MobilePhone+' => '', 'Class:MobilePhone/Attribute:imei' => 'IMEI', 'Class:MobilePhone/Attribute:imei+' => '', 'Class:MobilePhone/Attribute:hw_pin' => '硬件 PIN 码', 'Class:MobilePhone/Attribute:hw_pin+' => '', -)); +]); // // Class: IPPhone // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:IPPhone' => 'IP 电话', 'Class:IPPhone+' => '', -)); +]); // // Class: Tablet // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Tablet' => '平板', 'Class:Tablet+' => '', -)); +]); // // Class: ConnectableCI // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ConnectableCI' => '可连接的配置项', 'Class:ConnectableCI+' => '物理配置项', 'Class:ConnectableCI/ComplementaryName' => '%1$s - %2$s', @@ -253,13 +253,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:ConnectableCI/Attribute:networkdevice_list+' => '所有连接到这台设备的网络设备', 'Class:ConnectableCI/Attribute:physicalinterface_list' => '网卡', 'Class:ConnectableCI/Attribute:physicalinterface_list+' => '所有物理网卡', -)); +]); // // Class: DatacenterDevice // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:DatacenterDevice' => '数据中心设备', 'Class:DatacenterDevice+' => '', 'Class:DatacenterDevice/ComplementaryName' => '%1$s - %2$s', @@ -292,13 +292,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( // Unused yet 'Class:DatacenterDevice/Attribute:redundancy/disabled' => '所有电源正常, 此设备才正常', 'Class:DatacenterDevice/Attribute:redundancy/percent' => '至少%1$s %%路电源正常, 设备才正常', -)); +]); // // Class: NetworkDevice // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:NetworkDevice' => '网络设备', 'Class:NetworkDevice+' => '', 'Class:NetworkDevice/ComplementaryName' => '%1$s - %2$s', @@ -314,13 +314,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:NetworkDevice/Attribute:iosversion_name+' => '', 'Class:NetworkDevice/Attribute:ram' => '内存', 'Class:NetworkDevice/Attribute:ram+' => '', -)); +]); // // Class: Server // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Server' => '服务器', 'Class:Server+' => '', 'Class:Server/ComplementaryName' => '%1$s - %2$s', @@ -342,61 +342,61 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Server/Attribute:ram+' => '', 'Class:Server/Attribute:logicalvolumes_list' => '逻辑卷', 'Class:Server/Attribute:logicalvolumes_list+' => '连接到此服务器的所有逻辑卷', -)); +]); // // Class: StorageSystem // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:StorageSystem' => '存储系统', 'Class:StorageSystem+' => '', 'Class:StorageSystem/ComplementaryName' => '%1$s - %2$s', 'Class:StorageSystem/Attribute:logicalvolume_list' => '逻辑卷', 'Class:StorageSystem/Attribute:logicalvolume_list+' => '此存储系统包含的所有逻辑卷', -)); +]); // // Class: SANSwitch // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:SANSwitch' => 'SAN交换机', 'Class:SANSwitch+' => '', 'Class:SANSwitch/ComplementaryName' => '%1$s - %2$s', 'Class:SANSwitch/Attribute:datacenterdevice_list' => '设备', 'Class:SANSwitch/Attribute:datacenterdevice_list+' => '连接到此SAN交换机的所有设备', -)); +]); // // Class: TapeLibrary // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TapeLibrary' => '磁带库', 'Class:TapeLibrary+' => '', 'Class:TapeLibrary/ComplementaryName' => '%1$s - %2$s', 'Class:TapeLibrary/Attribute:tapes_list' => '磁带', 'Class:TapeLibrary/Attribute:tapes_list+' => '此磁带库里的所有磁带', -)); +]); // // Class: NAS // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:NAS' => 'NAS', 'Class:NAS+' => '', 'Class:NAS/ComplementaryName' => '%1$s - %2$s', 'Class:NAS/Attribute:nasfilesystem_list' => '文件系统', 'Class:NAS/Attribute:nasfilesystem_list+' => '此NAS里的所有文件系统', -)); +]); // // Class: PC // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:PC' => 'PC', 'Class:PC+' => '', 'Class:PC/ComplementaryName' => '%1$s - %2$s', @@ -418,45 +418,45 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:PC/Attribute:type/Value:desktop+' => '台式机', 'Class:PC/Attribute:type/Value:laptop' => '笔记本', 'Class:PC/Attribute:type/Value:laptop+' => '笔记本', -)); +]); // // Class: Printer // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Printer' => '打印机', 'Class:Printer+' => '', 'Class:Printer/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerConnection // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:PowerConnection' => '供电线路', 'Class:PowerConnection+' => '', 'Class:PowerConnection/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: PowerSource // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:PowerSource' => '电源', 'Class:PowerSource+' => '', 'Class:PowerSource/ComplementaryName' => '%1$s - %2$s', 'Class:PowerSource/Attribute:pdus_list' => 'PDU', 'Class:PowerSource/Attribute:pdus_list+' => '使用此电源的所有 PDU', -)); +]); // // Class: PDU // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:PDU' => 'PDU', 'Class:PDU+' => '', 'Class:PDU/ComplementaryName' => '%1$s - %2$s - %3$s - %4$s', @@ -468,23 +468,23 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:PDU/Attribute:powerstart_id+' => '', 'Class:PDU/Attribute:powerstart_name' => '上级电源名称', 'Class:PDU/Attribute:powerstart_name+' => '', -)); +]); // // Class: Peripheral // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Peripheral' => '配件', 'Class:Peripheral+' => '', 'Class:Peripheral/ComplementaryName' => '%1$s - %2$s', -)); +]); // // Class: Enclosure // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Enclosure' => '机柜', 'Class:Enclosure+' => '', 'Class:Enclosure/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -496,13 +496,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Enclosure/Attribute:nb_u+' => '', 'Class:Enclosure/Attribute:device_list' => '设备', 'Class:Enclosure/Attribute:device_list+' => '此机柜的所有设备', -)); +]); // // Class: ApplicationSolution // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ApplicationSolution' => '应用方案', 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => '配置项', @@ -519,13 +519,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:ApplicationSolution/Attribute:redundancy/disabled' => '所有配置项正常, 此应用方案才正常', 'Class:ApplicationSolution/Attribute:redundancy/count' => '至少%1$s个配置项正常时此应用方案才正常', 'Class:ApplicationSolution/Attribute:redundancy/percent' => '至少%1$s %%的配置项正常, 此应用方案才正常', -)); +]); // // Class: BusinessProcess // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:BusinessProcess' => '业务流程', 'Class:BusinessProcess+' => '', 'Class:BusinessProcess/Attribute:applicationsolutions_list' => '应用方案', @@ -536,13 +536,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:BusinessProcess/Attribute:status/Value:active+' => '启用', 'Class:BusinessProcess/Attribute:status/Value:inactive' => '停用', 'Class:BusinessProcess/Attribute:status/Value:inactive+' => '停用', -)); +]); // // Class: SoftwareInstance // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:SoftwareInstance' => '软件实例', 'Class:SoftwareInstance+' => '', 'Class:SoftwareInstance/Attribute:system_id' => '系统', @@ -565,64 +565,64 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:SoftwareInstance/Attribute:status/Value:active+' => '启用', 'Class:SoftwareInstance/Attribute:status/Value:inactive' => '停用', 'Class:SoftwareInstance/Attribute:status/Value:inactive+' => '停用', -)); +]); // // Class: Middleware // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Middleware' => '中间件', 'Class:Middleware+' => '', 'Class:Middleware/Attribute:middlewareinstance_list' => '中间件实例', 'Class:Middleware/Attribute:middlewareinstance_list+' => '此中间件的所有实例', -)); +]); // // Class: DBServer // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:DBServer' => '数据库服务器', 'Class:DBServer+' => '', 'Class:DBServer/Attribute:dbschema_list' => '数据库', 'Class:DBServer/Attribute:dbschema_list+' => '此数据库服务器上的所有数据库架构', -)); +]); // // Class: WebServer // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:WebServer' => 'Web服务器', 'Class:WebServer+' => '', 'Class:WebServer/Attribute:webapp_list' => 'Web应用', 'Class:WebServer/Attribute:webapp_list+' => '此web服务器上的所有web应用', -)); +]); // // Class: PCSoftware // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:PCSoftware' => 'PC 软件', 'Class:PCSoftware+' => '', -)); +]); // // Class: OtherSoftware // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:OtherSoftware' => '其它软件', 'Class:OtherSoftware+' => '', -)); +]); // // Class: MiddlewareInstance // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:MiddlewareInstance' => '中间件实例', 'Class:MiddlewareInstance+' => '', 'Class:MiddlewareInstance/ComplementaryName' => '%1$s - %2$s', @@ -630,13 +630,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:MiddlewareInstance/Attribute:middleware_id+' => '', 'Class:MiddlewareInstance/Attribute:middleware_name' => '名称', 'Class:MiddlewareInstance/Attribute:middleware_name+' => '', -)); +]); // // Class: DatabaseSchema // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:DatabaseSchema' => '数据库', 'Class:DatabaseSchema+' => '', 'Class:DatabaseSchema/ComplementaryName' => '%1$s - %2$s', @@ -644,13 +644,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:DatabaseSchema/Attribute:dbserver_id+' => '', 'Class:DatabaseSchema/Attribute:dbserver_name' => '名称', 'Class:DatabaseSchema/Attribute:dbserver_name+' => '', -)); +]); // // Class: WebApplication // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:WebApplication' => 'Web 应用', 'Class:WebApplication+' => '', 'Class:WebApplication/ComplementaryName' => '%1$s - %2$s', @@ -660,14 +660,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:WebApplication/Attribute:webserver_name+' => '', 'Class:WebApplication/Attribute:url' => 'URL', 'Class:WebApplication/Attribute:url+' => '', -)); - +]); // // Class: VirtualDevice // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:VirtualDevice' => '虚拟设备', 'Class:VirtualDevice+' => '', 'Class:VirtualDevice/Attribute:status' => '状态', @@ -682,24 +681,24 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:VirtualDevice/Attribute:status/Value:stock+' => '库存', 'Class:VirtualDevice/Attribute:logicalvolumes_list' => '逻辑卷', 'Class:VirtualDevice/Attribute:logicalvolumes_list+' => '此设备使用的所有逻辑卷', -)); +]); // // Class: VirtualHost // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:VirtualHost' => '宿主机', 'Class:VirtualHost+' => '', 'Class:VirtualHost/Attribute:virtualmachine_list' => '虚拟机', 'Class:VirtualHost/Attribute:virtualmachine_list+' => '此宿主机托管的所有虚拟机', -)); +]); // // Class: Hypervisor // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Hypervisor' => '虚拟机管理器', 'Class:Hypervisor+' => '', 'Class:Hypervisor/Attribute:farm_id' => '集群', @@ -710,13 +709,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Hypervisor/Attribute:server_id+' => '', 'Class:Hypervisor/Attribute:server_name' => '名称', 'Class:Hypervisor/Attribute:server_name+' => '', -)); +]); // // Class: Farm // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Farm' => '集群', 'Class:Farm+' => '', 'Class:Farm/Attribute:hypervisor_list' => '虚拟机管理器', @@ -725,13 +724,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Farm/Attribute:redundancy/disabled' => '所有虚拟机管理器正常, 集群才正常', 'Class:Farm/Attribute:redundancy/count' => '至少%1$s个虚拟机管理器是正常的, 集群才是正常的', 'Class:Farm/Attribute:redundancy/percent' => '至少%1$s %%的虚拟机管理器是正常的, 集群才正常', -)); +]); // // Class: VirtualMachine // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:VirtualMachine' => '虚拟机', 'Class:VirtualMachine+' => '', 'Class:VirtualMachine/ComplementaryName' => '%1$s - %2$s', @@ -759,13 +758,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:VirtualMachine/Attribute:managementip+' => '', 'Class:VirtualMachine/Attribute:logicalinterface_list' => '网卡', 'Class:VirtualMachine/Attribute:logicalinterface_list+' => '所有逻辑网卡', -)); +]); // // Class: LogicalVolume // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:LogicalVolume' => '逻辑卷', 'Class:LogicalVolume+' => '', 'Class:LogicalVolume/Attribute:name' => '名称', @@ -786,13 +785,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:LogicalVolume/Attribute:servers_list+' => '使用此逻辑卷的服务器', 'Class:LogicalVolume/Attribute:virtualdevices_list' => '虚拟设备', 'Class:LogicalVolume/Attribute:virtualdevices_list+' => '使用此逻辑卷的所有虚拟设备', -)); +]); // // Class: lnkServerToVolume // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkServerToVolume' => '关联服务器/逻辑卷', 'Class:lnkServerToVolume+' => '', 'Class:lnkServerToVolume/Name' => '%1$s / %2$s', @@ -806,13 +805,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkServerToVolume/Attribute:server_name+' => '', 'Class:lnkServerToVolume/Attribute:size_used' => '已用容量', 'Class:lnkServerToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkVirtualDeviceToVolume // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkVirtualDeviceToVolume' => '关联虚拟设备/逻辑卷', 'Class:lnkVirtualDeviceToVolume+' => '', 'Class:lnkVirtualDeviceToVolume/Name' => '%1$s / %2$s', @@ -826,13 +825,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkVirtualDeviceToVolume/Attribute:virtualdevice_name+' => '', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used' => '已用容量', 'Class:lnkVirtualDeviceToVolume/Attribute:size_used+' => '', -)); +]); // // Class: lnkSanToDatacenterDevice // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkSanToDatacenterDevice' => '关联 SAN/数据中心设备', 'Class:lnkSanToDatacenterDevice+' => '', 'Class:lnkSanToDatacenterDevice/Name' => '%1$s / %2$s', @@ -848,13 +847,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkSanToDatacenterDevice/Attribute:san_port+' => '', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port' => '设备光口', 'Class:lnkSanToDatacenterDevice/Attribute:datacenterdevice_port+' => '', -)); +]); // // Class: Tape // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Tape' => '磁带', 'Class:Tape+' => '', 'Class:Tape/Attribute:name' => '名称', @@ -867,13 +866,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Tape/Attribute:tapelibrary_id+' => '', 'Class:Tape/Attribute:tapelibrary_name' => '名称', 'Class:Tape/Attribute:tapelibrary_name+' => '', -)); +]); // // Class: NASFileSystem // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:NASFileSystem' => 'NAS 文件系统', 'Class:NASFileSystem+' => '', 'Class:NASFileSystem/Attribute:name' => '名称', @@ -888,13 +887,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:NASFileSystem/Attribute:nas_id+' => '', 'Class:NASFileSystem/Attribute:nas_name' => 'NAS 名称', 'Class:NASFileSystem/Attribute:nas_name+' => '', -)); +]); // // Class: Software // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Software' => '软件', 'Class:Software+' => '', 'Class:Software/ComplementaryName' => '%1$s - %2$s', @@ -924,13 +923,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Software/Attribute:softwarepatch_list+' => '此软件的所有补丁', 'Class:Software/Attribute:softwarelicence_list' => '软件许可证', 'Class:Software/Attribute:softwarelicence_list+' => '此软件的所有许可证', -)); +]); // // Class: Patch // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Patch' => '补丁', 'Class:Patch+' => '', 'Class:Patch/Attribute:name' => '名称', @@ -941,13 +940,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Patch/Attribute:description+' => '', 'Class:Patch/Attribute:finalclass' => '补丁类型', 'Class:Patch/Attribute:finalclass+' => '根本属性的名称', -)); +]); // // Class: OSPatch // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:OSPatch' => '操作系统补丁', 'Class:OSPatch+' => '', 'Class:OSPatch/Attribute:functionalcis_list' => '设备', @@ -956,13 +955,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:OSPatch/Attribute:osversion_id+' => '', 'Class:OSPatch/Attribute:osversion_name' => '名称', 'Class:OSPatch/Attribute:osversion_name+' => '', -)); +]); // // Class: SoftwarePatch // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:SoftwarePatch' => '软件补丁', 'Class:SoftwarePatch+' => '', 'Class:SoftwarePatch/Attribute:software_id' => '软件', @@ -971,13 +970,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:SoftwarePatch/Attribute:software_name+' => '', 'Class:SoftwarePatch/Attribute:softwareinstances_list' => '软件实例', 'Class:SoftwarePatch/Attribute:softwareinstances_list+' => '已安装此软件补丁的所有系统', -)); +]); // // Class: Licence // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Licence' => '许可证', 'Class:Licence+' => '', 'Class:Licence/Attribute:name' => '名称', @@ -1006,13 +1005,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Licence/Attribute:perpetual/Value:yes+' => '是', 'Class:Licence/Attribute:finalclass' => '许可证类型', 'Class:Licence/Attribute:finalclass+' => '根本属性的名称', -)); +]); // // Class: OSLicence // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:OSLicence' => '操作系统许可证', 'Class:OSLicence+' => '', 'Class:OSLicence/ComplementaryName' => '%1$s - %2$s', @@ -1024,13 +1023,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:OSLicence/Attribute:virtualmachines_list+' => '使用此许可证的所有虚拟机', 'Class:OSLicence/Attribute:servers_list' => '服务器', 'Class:OSLicence/Attribute:servers_list+' => '使用此许可证的所有服务器', -)); +]); // // Class: SoftwareLicence // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:SoftwareLicence' => '软件许可证', 'Class:SoftwareLicence+' => '', 'Class:SoftwareLicence/ComplementaryName' => '%1$s - %2$s', @@ -1040,13 +1039,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:SoftwareLicence/Attribute:software_name+' => '', 'Class:SoftwareLicence/Attribute:softwareinstance_list' => '软件实例', 'Class:SoftwareLicence/Attribute:softwareinstance_list+' => '使用此许可证的所有系统', -)); +]); // // Class: lnkDocumentToLicence // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkDocumentToLicence' => '关联文档/许可证', 'Class:lnkDocumentToLicence+' => '', 'Class:lnkDocumentToLicence/Name' => '%1$s / %2$s', @@ -1058,35 +1057,35 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkDocumentToLicence/Attribute:document_id+' => '', 'Class:lnkDocumentToLicence/Attribute:document_name' => '文档名称', 'Class:lnkDocumentToLicence/Attribute:document_name+' => '', -)); +]); // // Class: OSVersion // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:OSVersion' => '操作系统版本', 'Class:OSVersion+' => '', 'Class:OSVersion/Attribute:osfamily_id' => '操作系统家族', 'Class:OSVersion/Attribute:osfamily_id+' => '', 'Class:OSVersion/Attribute:osfamily_name' => '名称', 'Class:OSVersion/Attribute:osfamily_name+' => '', -)); +]); // // Class: OSFamily // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:OSFamily' => '操作系统家族', 'Class:OSFamily+' => '', -)); +]); // // Class: Brand // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Brand' => '品牌', 'Class:Brand+' => '', 'Class:Brand/Attribute:logo' => 'Logo', @@ -1095,13 +1094,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Brand/Attribute:physicaldevices_list+' => '此品牌的所有物理设备', 'Class:Brand/UniquenessRule:name+' => '名称必须唯一', 'Class:Brand/UniquenessRule:name' => '此品牌已存在', -)); +]); // // Class: Model // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Model' => '型号', 'Class:Model+' => '', 'Class:Model/ComplementaryName' => '%1$s - %2$s', @@ -1153,37 +1152,37 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Model/Attribute:physicaldevices_list+' => '此型号的所有物理设备', 'Class:Model/UniquenessRule:name_brand+' => '名称必须唯一', 'Class:Model/UniquenessRule:name_brand' => '此型号已存在', -)); +]); // // Class: NetworkDeviceType // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:NetworkDeviceType' => '网络设备类型', 'Class:NetworkDeviceType+' => '', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list' => '网络设备', 'Class:NetworkDeviceType/Attribute:networkdevicesdevices_list+' => '此类型的所有网络设备', -)); +]); // // Class: IOSVersion // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:IOSVersion' => 'IOS 版本', 'Class:IOSVersion+' => '', 'Class:IOSVersion/Attribute:brand_id' => '品牌', 'Class:IOSVersion/Attribute:brand_id+' => '', 'Class:IOSVersion/Attribute:brand_name' => '名称', 'Class:IOSVersion/Attribute:brand_name+' => '', -)); +]); // // Class: lnkDocumentToPatch // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkDocumentToPatch' => '关联文档/补丁', 'Class:lnkDocumentToPatch+' => '', 'Class:lnkDocumentToPatch/Name' => '%1$s / %2$s', @@ -1195,13 +1194,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkDocumentToPatch/Attribute:document_id+' => '', 'Class:lnkDocumentToPatch/Attribute:document_name' => '文档名称', 'Class:lnkDocumentToPatch/Attribute:document_name+' => '', -)); +]); // // Class: lnkSoftwareInstanceToSoftwarePatch // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkSoftwareInstanceToSoftwarePatch' => ' 关联软件实例/软件补丁', 'Class:lnkSoftwareInstanceToSoftwarePatch+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Name' => '%1$s / %2$s', @@ -1213,13 +1212,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_id+' => '', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name' => '软件实例名称', 'Class:lnkSoftwareInstanceToSoftwarePatch/Attribute:softwareinstance_name+' => '', -)); +]); // // Class: lnkFunctionalCIToOSPatch // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkFunctionalCIToOSPatch' => '关联功能项/操作系统补丁', 'Class:lnkFunctionalCIToOSPatch+' => '', 'Class:lnkFunctionalCIToOSPatch/Name' => '%1$s / %2$s', @@ -1231,13 +1230,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name' => '功能项名称', 'Class:lnkFunctionalCIToOSPatch/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkDocumentToSoftware // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkDocumentToSoftware' => '关联文档/软件', 'Class:lnkDocumentToSoftware+' => '', 'Class:lnkDocumentToSoftware/Name' => '%1$s / %2$s', @@ -1249,13 +1248,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkDocumentToSoftware/Attribute:document_id+' => '', 'Class:lnkDocumentToSoftware/Attribute:document_name' => '文档名称', 'Class:lnkDocumentToSoftware/Attribute:document_name+' => '', -)); +]); // // Class: Subnet // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Subnet' => '子网', 'Class:Subnet+' => '', 'Class:Subnet/Name' => '%1$s/%2$s', @@ -1274,13 +1273,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Subnet/Attribute:ip_mask+' => '', 'Class:Subnet/Attribute:vlans_list' => 'VLAN', 'Class:Subnet/Attribute:vlans_list+' => '', -)); +]); // // Class: VLAN // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:VLAN' => 'VLAN', 'Class:VLAN+' => '', 'Class:VLAN/Attribute:vlan_tag' => 'VLAN 标记', @@ -1295,13 +1294,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:VLAN/Attribute:subnets_list+' => '', 'Class:VLAN/Attribute:physicalinterfaces_list' => '物理网卡', 'Class:VLAN/Attribute:physicalinterfaces_list+' => '', -)); +]); // // Class: lnkSubnetToVLAN // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkSubnetToVLAN' => '关联子网/VLAN', 'Class:lnkSubnetToVLAN+' => '', 'Class:lnkSubnetToVLAN/Name' => '%1$s / %2$s', @@ -1315,26 +1314,26 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkSubnetToVLAN/Attribute:vlan_id+' => '', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag' => 'VLAN 标记', 'Class:lnkSubnetToVLAN/Attribute:vlan_tag+' => '', -)); +]); // // Class: NetworkInterface // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:NetworkInterface' => '网卡', 'Class:NetworkInterface+' => '', 'Class:NetworkInterface/Attribute:name' => '名称', 'Class:NetworkInterface/Attribute:name+' => '', 'Class:NetworkInterface/Attribute:finalclass' => '网卡类型', 'Class:NetworkInterface/Attribute:finalclass+' => '根本属性的名称', -)); +]); // // Class: IPInterface // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:IPInterface' => 'IP 接口', 'Class:IPInterface+' => '', 'Class:IPInterface/Attribute:ipaddress' => 'IP 地址', @@ -1349,13 +1348,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:IPInterface/Attribute:ipmask+' => '', 'Class:IPInterface/Attribute:speed' => '速率', 'Class:IPInterface/Attribute:speed+' => '', -)); +]); // // Class: PhysicalInterface // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:PhysicalInterface' => '物理网卡', 'Class:PhysicalInterface+' => '', 'Class:PhysicalInterface/Name' => '%2$s %1$s', @@ -1365,13 +1364,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:PhysicalInterface/Attribute:connectableci_name+' => '', 'Class:PhysicalInterface/Attribute:vlans_list' => 'VLAN', 'Class:PhysicalInterface/Attribute:vlans_list+' => '', -)); +]); // // Class: lnkPhysicalInterfaceToVLAN // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkPhysicalInterfaceToVLAN' => '关联物理网卡/VLAN', 'Class:lnkPhysicalInterfaceToVLAN+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Name' => '%1$s %2$s / %3$s', @@ -1387,27 +1386,26 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_id+' => '', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag' => 'VLAN 标记', 'Class:lnkPhysicalInterfaceToVLAN/Attribute:vlan_tag+' => '', -)); - +]); // // Class: LogicalInterface // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:LogicalInterface' => '逻辑网卡', 'Class:LogicalInterface+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_id' => '虚拟机', 'Class:LogicalInterface/Attribute:virtualmachine_id+' => '', 'Class:LogicalInterface/Attribute:virtualmachine_name' => '虚拟机名称', 'Class:LogicalInterface/Attribute:virtualmachine_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:FiberChannelInterface' => '光纤接口', 'Class:FiberChannelInterface+' => '', 'Class:FiberChannelInterface/Attribute:speed' => '速率', @@ -1420,13 +1418,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:FiberChannelInterface/Attribute:datacenterdevice_id+' => '', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name' => '设备名称', 'Class:FiberChannelInterface/Attribute:datacenterdevice_name+' => '', -)); +]); // // Class: lnkConnectableCIToNetworkDevice // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkConnectableCIToNetworkDevice' => '关联可连接项/网络设备', 'Class:lnkConnectableCIToNetworkDevice+' => '', 'Class:lnkConnectableCIToNetworkDevice/Name' => '%1$s / %2$s', @@ -1448,13 +1446,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:downlink+' => '下联', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink' => '上联', 'Class:lnkConnectableCIToNetworkDevice/Attribute:connection_type/Value:uplink+' => '上联', -)); +]); // // Class: lnkApplicationSolutionToFunctionalCI // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkApplicationSolutionToFunctionalCI' => '关联应用方案/功能项', 'Class:lnkApplicationSolutionToFunctionalCI+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Name' => '%1$s / %2$s', @@ -1466,13 +1464,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => '功能项名称', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: lnkApplicationSolutionToBusinessProcess // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkApplicationSolutionToBusinessProcess' => '关联应用方案/业务流程', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Name' => '%1$s / %2$s', @@ -1484,13 +1482,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => '应用方案名称', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', -)); +]); // // Class: Group // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Group' => '配置组', 'Class:Group+' => '', 'Class:Group/ComplementaryName' => '%1$s - %2$s', @@ -1520,13 +1518,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Group/Attribute:ci_list+' => '此组关联的所有配置项', 'Class:Group/Attribute:parent_id_friendlyname' => '上级配置组', 'Class:Group/Attribute:parent_id_friendlyname+' => '', -)); +]); // // Class: lnkGroupToCI // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkGroupToCI' => '关联配置组/配置项', 'Class:lnkGroupToCI+' => '', 'Class:lnkGroupToCI/Name' => '%1$s / %2$s', @@ -1540,11 +1538,11 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkGroupToCI/Attribute:ci_name+' => '', 'Class:lnkGroupToCI/Attribute:reason' => '原因', 'Class:lnkGroupToCI/Attribute:reason+' => '', -)); +]); // Add translation for Fieldsets -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Server:baseinfo' => '基本信息', 'Server:Date' => '日期', 'Server:moreinfo' => '更多信息', @@ -1557,14 +1555,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Subnet/Tab:FreeIPs-count' => '空闲 IP: %1$s', 'Class:Subnet/Tab:FreeIPs-explain' => '以下是抽取的10个空闲 IP', 'Class:Document:PreviewTab' => '预览', -)); - +]); // // Class: lnkDocumentToFunctionalCI // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkDocumentToFunctionalCI' => '关联文档/功能项', 'Class:lnkDocumentToFunctionalCI+' => '', 'Class:lnkDocumentToFunctionalCI/Name' => '%1$s / %2$s', @@ -1576,13 +1573,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkDocumentToFunctionalCI/Attribute:document_id+' => '', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name' => '文档名称', 'Class:lnkDocumentToFunctionalCI/Attribute:document_name+' => '', -)); +]); // // Application Menu // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Menu:Application' => '应用', 'Menu:Application+' => '所有应用', 'Menu:DBServer' => '数据库服务器', @@ -1627,15 +1624,15 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Menu:OSVersion+' => '', 'Menu:Software' => '软件清单', 'Menu:Software+' => '软件清单', -)); +]); // // Class: PhysicalInterface // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:PhysicalInterface/Attribute:org_id' => 'Org id~~', 'Class:PhysicalInterface/Attribute:org_id+' => '~~', 'Class:PhysicalInterface/Attribute:location_id' => 'Location id~~', 'Class:PhysicalInterface/Attribute:location_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-config-mgmt/main.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/main.itop-config-mgmt.php index 88c16a25a..faf7e17b2 100755 --- a/datamodels/2.x/itop-config-mgmt/main.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/main.itop-config-mgmt.php @@ -1,9 +1,10 @@ - // Starting with iTop 1.2 you can restrict the list of organizations displayed in the drop-down list // by specifying a query as shown below. Note that this is NOT a security settings, since the // choice 'All Organizations' will always be available in the menu ApplicationMenu::SetFavoriteSiloQuery('SELECT Organization'); - -?> diff --git a/datamodels/2.x/itop-config-mgmt/module.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/module.itop-config-mgmt.php index 931cfc8a8..2ab5adc1c 100755 --- a/datamodels/2.x/itop-config-mgmt/module.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/module.itop-config-mgmt.php @@ -1,10 +1,9 @@ 'Configuration Management (CMDB)', @@ -12,25 +11,25 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-structure/2.7.1', - ), + ], 'mandatory' => false, 'visible' => true, 'installer' => 'ConfigMgmtInstaller', // Components // - 'datamodel' => array( + 'datamodel' => [ 'model.itop-config-mgmt.php', 'main.itop-config-mgmt.php', - ), - 'data.struct' => array( + ], + 'data.struct' => [ 'data/en_us.data.itop-brand.xml', 'data/en_us.data.itop-osfamily.xml', 'data/en_us.data.itop-osversion.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ 'data.sample.model.xml', 'data.sample.networkdevicetype.xml', 'data.sample.servers.xml', @@ -42,8 +41,8 @@ SetupWebPage::AddModule( 'data.sample.webapp.xml', 'data.sample.applications.xml', 'data.sample.applicationsolutionci.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -51,13 +50,12 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); -if (!class_exists('ConfigMgmtInstaller')) -{ +if (!class_exists('ConfigMgmtInstaller')) { // Module installation handler // class ConfigMgmtInstaller extends ModuleInstallerAPI @@ -76,8 +74,7 @@ if (!class_exists('ConfigMgmtInstaller')) */ public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) { - if (strlen($sPreviousVersion) > 0) - { + if (strlen($sPreviousVersion) > 0) { // If you want to migrate data from one format to another, do it here self::RenameEnumValueInDB('Software', 'type', 'DBserver', 'DBServer'); self::RenameEnumValueInDB('Software', 'type', 'Webserver', 'WebServer'); @@ -95,7 +92,7 @@ if (!class_exists('ConfigMgmtInstaller')) self::RenameClassInDB('IPinterface', 'IPInterface'); } } - + /** * Handler called after the creation/update of the database schema * @param $oConfiguration Config The new configuration of the application diff --git a/datamodels/2.x/itop-config/config.php b/datamodels/2.x/itop-config/config.php index 475ef2a31..908ebd702 100644 --- a/datamodels/2.x/itop-config/config.php +++ b/datamodels/2.x/itop-config/config.php @@ -1,4 +1,5 @@ AddUiBlock($oAlert); } @@ -300,7 +299,8 @@ var EditorUtils = (function() { })(); JS ); - $oP->add_ready_script(<<<'JS' + $oP->add_ready_script( + <<<'JS' var editor = ace.edit("new_config"); var configurationSource = $('input[name="new_config"]'); @@ -344,7 +344,8 @@ JS ); $sConfirmCancel = addslashes(Dict::S('config-confirm-cancel')); - $oP->add_script(<<add_script( + << * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:ConfigFileEditor' => 'Plain text editor~~', 'config-edit-title' => 'Editor konfiguračního souboru', 'config-edit-intro' => 'Při úpravách konfiguračního souboru buďte velice opatrní. Nesprávné nastavení může vést k nedostupnosti '.ITOP_APPLICATION_SHORT, 'Menu:ConfigEditor' => 'Konfigurace', @@ -28,5 +29,5 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'config-error-transaction' => 'Chyba: Neplatné ID transakce. Konfigurace nebyla změněna.', 'config-error-file-changed' => 'Chyba: Konfigurační soubor se od doby, kdy jste jej otevřeli, změnil a nelze jej uložit. Obnovte a znovu použijte změny.', 'config-not-allowed-in-demo' => 'Omlouvám se, '.ITOP_APPLICATION_SHORT.' je v předváděcí režimu: Konfigurace nemůže být editována', - 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT.' interactive edition of the configuration as been disabled. See \'config_editor\' => \'disabled\' in the configuration file.~~' -)); + 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT.' interactive edition of the configuration as been disabled. See \'config_editor\' => \'disabled\' in the configuration file.~~', +]); diff --git a/datamodels/2.x/itop-config/dictionaries/da.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/da.dict.itop-config.php index dcd0577cc..bb2f3e9db 100644 --- a/datamodels/2.x/itop-config/dictionaries/da.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/da.dict.itop-config.php @@ -1,15 +1,16 @@ 'Plain text editor~~', 'config-edit-title' => 'Configuration File Editor~~', 'config-edit-intro' => 'Be very cautious when editing the configuration file.~~', @@ -28,4 +29,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'config-error-file-changed' => 'Error: The Configuration file has changed since you opened it and cannot be saved. Refresh and apply your changes again.~~', 'config-not-allowed-in-demo' => 'Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the configuration file cannot be edited.~~', 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT.' interactive edition of the configuration as been disabled. See \'config_editor\' => \'disabled\' in the configuration file.~~', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/de.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/de.dict.itop-config.php index 05d6f4606..ee21d8a39 100644 --- a/datamodels/2.x/itop-config/dictionaries/de.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/de.dict.itop-config.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:ConfigFileEditor' => 'Plain text editor~~', 'config-edit-title' => 'Konfigurations-Editor', 'config-edit-intro' => 'Achtung: Eine falsche Konfiguration kann dazu führen, dass '.ITOP_APPLICATION_SHORT.' für alle Benutzer unbenutzbar ist!', @@ -29,4 +30,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'config-error-file-changed' => 'Fehler: Die Konfigurationsdatei hat sich seit dem Öffnen geändert und kann nicht gespeichert werden. Aktualisieren Sie die Datei und wenden Sie Ihre Änderungen erneut an.', 'config-not-allowed-in-demo' => 'Entschuldigung, '.ITOP_APPLICATION_SHORT.' befindet sich im Demo-Modus: Die Konfigurationsdatei kann nicht bearbeitet werden.', 'config-interactive-not-allowed' => 'Die interaktive Bearbeitung der '.ITOP_APPLICATION_SHORT.' Konfiguration wurde deaktiviert. Siehe \'config_editor\' => \'disabled\' in der Konfigurationsdatei.', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/en.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/en.dict.itop-config.php index ffbecacbe..ffb92c6c2 100644 --- a/datamodels/2.x/itop-config/dictionaries/en.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/en.dict.itop-config.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Menu:ConfigFileEditor' => 'Plain text editor', 'config-edit-title' => 'Configuration File Editor', @@ -40,4 +41,4 @@ Dict::Add('EN US', 'English', 'English', array( 'config-error-file-changed' => 'Error: The Configuration file has changed since you opened it and cannot be saved. Refresh and apply your changes again.', 'config-not-allowed-in-demo' => 'Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the configuration file cannot be edited.', 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT." interactive edition of the configuration as been disabled. See 'config_editor' => 'disabled' in the configuration file.", -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/en_gb.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/en_gb.dict.itop-config.php index 41ba17f08..47ac04d74 100644 --- a/datamodels/2.x/itop-config/dictionaries/en_gb.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/en_gb.dict.itop-config.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Menu:ConfigFileEditor' => 'Plain text editor', 'config-edit-title' => 'Configuration File Editor', @@ -40,4 +41,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'config-error-file-changed' => 'Error: The Configuration file has changed since you opened it and cannot be saved. Refresh and apply your changes again.', 'config-not-allowed-in-demo' => 'Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the configuration file cannot be edited.', 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT." interactive edition of the configuration as been disabled. See 'config_editor' => 'disabled' in the configuration file.", -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/es_cr.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/es_cr.dict.itop-config.php index cb97826f8..93ebac689 100644 --- a/datamodels/2.x/itop-config/dictionaries/es_cr.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/es_cr.dict.itop-config.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:ConfigFileEditor' => 'Plain text editor~~', 'config-edit-title' => 'Editor de Archivo de Configuración', 'config-edit-intro' => 'Sea muy cuidadoso cuando edite el archivo de configuración. En particular, sólo los elementos superiores (ejem.: the global configuration y modules settings) deberian ser editados.', @@ -26,4 +27,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'config-error-file-changed' => 'Error: el archivo de configuración ha cambiado desde que lo abrió y no se puede guardar. Actualice y aplique sus cambios nuevamente.', 'config-not-allowed-in-demo' => 'Lo sentimos, '.ITOP_APPLICATION_SHORT.' está en modo de demostración: el archivo de configuración no se puede editar.', 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT.' edición interactiva de la configuración como deshabilitada. Consulte \'config_editor\' => \'disabled\' en el archivo de configuración.', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/fr.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/fr.dict.itop-config.php index 9df9c5dde..b9116a892 100644 --- a/datamodels/2.x/itop-config/dictionaries/fr.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/fr.dict.itop-config.php @@ -1,15 +1,16 @@ 'Éditeur de texte brut', 'config-edit-title' => 'Éditeur du Fichier de Configuration', 'config-edit-intro' => 'Attention: une configuration incorrecte peut rendre '.ITOP_APPLICATION_SHORT.' inopérant pour tous les utilisateurs!', @@ -27,4 +28,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'config-error-file-changed' => 'Erreur : La configuration a été modifiée depuis que vous l\'avez ouvert. Vos modifications ne peuvent PAS être enregistrées. Rechargez la page et recommencez.', 'config-not-allowed-in-demo' => 'Désolé, '.ITOP_APPLICATION_SHORT.' est en mode démonstration : la configuration ne peut pas être modifiée.', 'config-interactive-not-allowed' => 'La modification interactive de la configuration n\'est pas autorisée. Voir le paramètre \'config_editor\' => \'disabled\' dans le fichier de configuration.', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/hu.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/hu.dict.itop-config.php index 56983cc4b..d1b248903 100644 --- a/datamodels/2.x/itop-config/dictionaries/hu.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/hu.dict.itop-config.php @@ -1,15 +1,16 @@ 'Plain text editor~~', 'config-edit-title' => 'Konfigurációs fájl szerkesztő', 'config-edit-intro' => 'Legyen nagyon óvatos a konfiguráció szerkesztésénél!', @@ -28,4 +29,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'config-error-file-changed' => 'Error: The Configuration file has changed since you opened it and cannot be saved. Refresh and apply your changes again.~~', 'config-not-allowed-in-demo' => 'Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the configuration file cannot be edited.~~', 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT.' interactive edition of the configuration as been disabled. See \'config_editor\' => \'disabled\' in the configuration file.~~', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/it.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/it.dict.itop-config.php index 3cc7c45ab..3695db674 100644 --- a/datamodels/2.x/itop-config/dictionaries/it.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/it.dict.itop-config.php @@ -1,15 +1,16 @@ 'Plain text editor~~', 'config-edit-title' => 'Editor del File di Configurazione', 'config-edit-intro' => 'Prestare molta attenzione durante la modifica del file di configurazione.', @@ -28,4 +29,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'config-error-file-changed' => 'Errore: Il file di Configurazione è stato modificato da quando lo hai aperto e non può essere salvato. Aggiorna e applica nuovamente le tue modifiche.', 'config-not-allowed-in-demo' => 'Spiacente, '.ITOP_APPLICATION_SHORT.' è in modalità dimostrativa: il file di configurazione non può essere modificato.', 'config-interactive-not-allowed' => 'La modifica interattiva della configurazione di '.ITOP_APPLICATION_SHORT.' è stata disabilitata. Vedere \'config_editor\' => \'disabled\' nel file di configurazione.', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/ja.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/ja.dict.itop-config.php index 1a8c11c26..51f85973b 100644 --- a/datamodels/2.x/itop-config/dictionaries/ja.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/ja.dict.itop-config.php @@ -1,15 +1,16 @@ 'Plain text editor~~', 'config-edit-title' => 'Configuration File Editor~~', 'config-edit-intro' => 'Be very cautious when editing the configuration file.~~', @@ -28,4 +29,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'config-error-file-changed' => 'Error: The Configuration file has changed since you opened it and cannot be saved. Refresh and apply your changes again.~~', 'config-not-allowed-in-demo' => 'Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the configuration file cannot be edited.~~', 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT.' interactive edition of the configuration as been disabled. See \'config_editor\' => \'disabled\' in the configuration file.~~', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/nl.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/nl.dict.itop-config.php index 2da9a55ce..a5415ad28 100644 --- a/datamodels/2.x/itop-config/dictionaries/nl.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/nl.dict.itop-config.php @@ -1,16 +1,17 @@ (2018 - 2022) * @author Thomas Casteleyn */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:ConfigFileEditor' => 'Plain text editor~~', 'config-edit-title' => 'Aanpassen configuratie', 'config-edit-intro' => 'Wees uiterst voorzichtig bij het aanpassen van de configuratie.', @@ -29,4 +30,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'config-error-file-changed' => 'Fout: Het configuratiebestand is gewijzigd sinds je het geopend hebt en kan niet opgeslagen worden. Herlaad en pas je wijzigingen opnieuw toe.', 'config-not-allowed-in-demo' => 'Sorry, '.ITOP_APPLICATION_SHORT.' is in demo mode: Het configuratiebestand kan niet aangepast worden.', 'config-interactive-not-allowed' => 'Interactieve aanpassing van de '.ITOP_APPLICATION_SHORT.' configuratie is uitgeschackeld. Zie \'config_editor\' => \'disabled\' in het configuratiebestand.', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/pl.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/pl.dict.itop-config.php index ac2e607b0..7f538de52 100644 --- a/datamodels/2.x/itop-config/dictionaries/pl.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/pl.dict.itop-config.php @@ -1,15 +1,16 @@ 'Plain text editor~~', 'config-edit-title' => 'Edycja pliku konfiguracyjnego', 'config-edit-intro' => 'Zachowaj ostrożność podczas edycji pliku konfiguracyjnego.', @@ -28,4 +29,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'config-error-file-changed' => 'Błąd: Plik konfiguracyjny został zmieniony od czasu jego otwarcia i nie można go zapisać. Odśwież i ponownie zastosuj zmiany.', 'config-not-allowed-in-demo' => 'Sorry, '.ITOP_APPLICATION_SHORT.' jest w trybie demonstracyjnym: nie można edytować pliku konfiguracyjnego.', 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT.' interaktywna edycja konfiguracji została wyłączona. Zobacz \'config_editor\' => \'disabled\' w pliku konfiguracyjnym.', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/pt_br.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/pt_br.dict.itop-config.php index e468a8b1d..afe20cd88 100644 --- a/datamodels/2.x/itop-config/dictionaries/pt_br.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/pt_br.dict.itop-config.php @@ -1,15 +1,16 @@ 'Plain text editor~~', 'config-edit-title' => 'Editor do arquivo de configuração', 'config-edit-intro' => 'Tenha cuidado ao editar o arquivo de configuração', @@ -28,4 +29,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'config-error-file-changed' => 'Error: The Configuration file has changed since you opened it and cannot be saved. Refresh and apply your changes again.~~', 'config-not-allowed-in-demo' => 'Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the configuration file cannot be edited.~~', 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT.' interactive edition of the configuration as been disabled. See \'config_editor\' => \'disabled\' in the configuration file.~~', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/ru.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/ru.dict.itop-config.php index 8b2004333..c559d6972 100644 --- a/datamodels/2.x/itop-config/dictionaries/ru.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/ru.dict.itop-config.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:ConfigFileEditor' => 'Plain text editor~~', 'config-edit-title' => 'Редактор файла конфигурации', 'config-edit-intro' => 'Будьте очень осторожны при редактировании файла конфигурации. В частности, отредактированы могут быть только глобальная конфигурация и настройки модулей.', @@ -29,4 +30,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'config-error-file-changed' => 'Error: The Configuration file has changed since you opened it and cannot be saved. Refresh and apply your changes again.~~', 'config-not-allowed-in-demo' => 'Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the configuration file cannot be edited.~~', 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT.' interactive edition of the configuration as been disabled. See \'config_editor\' => \'disabled\' in the configuration file.~~', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/sk.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/sk.dict.itop-config.php index 2aa45484a..a875ccdb7 100644 --- a/datamodels/2.x/itop-config/dictionaries/sk.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/sk.dict.itop-config.php @@ -1,15 +1,16 @@ 'Plain text editor~~', 'config-edit-title' => 'Configuration File Editor~~', 'config-edit-intro' => 'Be very cautious when editing the configuration file.~~', @@ -28,4 +29,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'config-error-file-changed' => 'Error: The Configuration file has changed since you opened it and cannot be saved. Refresh and apply your changes again.~~', 'config-not-allowed-in-demo' => 'Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the configuration file cannot be edited.~~', 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT.' interactive edition of the configuration as been disabled. See \'config_editor\' => \'disabled\' in the configuration file.~~', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/tr.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/tr.dict.itop-config.php index 77d5dac0f..4b08939a9 100644 --- a/datamodels/2.x/itop-config/dictionaries/tr.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/tr.dict.itop-config.php @@ -1,15 +1,16 @@ 'Plain text editor~~', 'config-edit-title' => 'Configuration File Editor~~', 'config-edit-intro' => 'Be very cautious when editing the configuration file.~~', @@ -28,4 +29,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'config-error-file-changed' => 'Error: The Configuration file has changed since you opened it and cannot be saved. Refresh and apply your changes again.~~', 'config-not-allowed-in-demo' => 'Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the configuration file cannot be edited.~~', 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT.' interactive edition of the configuration as been disabled. See \'config_editor\' => \'disabled\' in the configuration file.~~', -)); +]); diff --git a/datamodels/2.x/itop-config/dictionaries/zh_cn.dict.itop-config.php b/datamodels/2.x/itop-config/dictionaries/zh_cn.dict.itop-config.php index d12deeb12..4faec9e35 100644 --- a/datamodels/2.x/itop-config/dictionaries/zh_cn.dict.itop-config.php +++ b/datamodels/2.x/itop-config/dictionaries/zh_cn.dict.itop-config.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Menu:ConfigFileEditor' => 'Plain text editor~~', 'Menu:ConfigEditor' => '编辑配置文件', 'config-edit-title' => '配置文件编辑器', @@ -39,4 +40,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'config-error-file-changed' => '错误: 配置文件在您打开以后已被更改, 无法保存. 请刷新并再次保存.', 'config-not-allowed-in-demo' => '抱歉, '.ITOP_APPLICATION_SHORT.'处于演示模式: 不能编辑配置文件.', 'config-interactive-not-allowed' => ITOP_APPLICATION_SHORT.'交互式配置编辑器已禁用. 请在配置文件中查看 \'config_editor\' => \'disabled\'.', -)); +]); diff --git a/datamodels/2.x/itop-config/module.itop-config.php b/datamodels/2.x/itop-config/module.itop-config.php index ae55bd875..e6446f23c 100644 --- a/datamodels/2.x/itop-config/module.itop-config.php +++ b/datamodels/2.x/itop-config/module.itop-config.php @@ -1,10 +1,9 @@ 'Configuration editor', @@ -12,25 +11,25 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array(), + 'dependencies' => [], 'mandatory' => true, 'visible' => false, // Components // - 'datamodel' => array( + 'datamodel' => [ 'src/Validator/ConfigNodesVisitor.php', 'src/Validator/iTopConfigAstValidator.php', 'src/Validator/iTopConfigSyntaxValidator.php', -), - 'webservice' => array(), - 'dictionary' => array( +], + 'webservice' => [], + 'dictionary' => [ 'en.dict.itop-config.php', 'fr.dict.itop-config.php', - ), - 'data.struct' => array(), - 'data.sample' => array(), - + ], + 'data.struct' => [], + 'data.sample' => [], + // Documentation // 'doc.manual_setup' => '', @@ -38,6 +37,6 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array(), - ) + 'settings' => [], + ] ); diff --git a/datamodels/2.x/itop-config/src/Validator/ConfigNodesVisitor.php b/datamodels/2.x/itop-config/src/Validator/ConfigNodesVisitor.php index 295a63ddf..15c09f238 100644 --- a/datamodels/2.x/itop-config/src/Validator/ConfigNodesVisitor.php +++ b/datamodels/2.x/itop-config/src/Validator/ConfigNodesVisitor.php @@ -1,4 +1,5 @@ aAllowedNodeClasses = array( + $this->aAllowedNodeClasses = [ Node\Scalar::class, Node\Name::class, @@ -53,7 +53,7 @@ class ConfigNodesVisitor extends NodeVisitorAbstract Node\Stmt\Const_::class, Node\Stmt\Global_::class, - ); + ]; } /** @@ -74,10 +74,8 @@ class ConfigNodesVisitor extends NodeVisitorAbstract */ public function ValidateNode(Node $node) { - foreach ($this->aAllowedNodeClasses as $sAllowedNodeClass) - { - if ($node instanceof $sAllowedNodeClass) - { + foreach ($this->aAllowedNodeClasses as $sAllowedNodeClass) { + if ($node instanceof $sAllowedNodeClass) { return; } } @@ -92,47 +90,37 @@ class ConfigNodesVisitor extends NodeVisitorAbstract */ private function ThrowInvalidConf(Node $node) { - if (in_array('name', $node->getSubNodeNames())) - { + if (in_array('name', $node->getSubNodeNames())) { $sMessage = sprintf( "Invalid configuration: %s of type %s is forbidden in line %d", $node->name, $node->getType(), $node->getLine() ); - } - elseif (in_array('class', $node->getSubNodeNames())) - { + } elseif (in_array('class', $node->getSubNodeNames())) { - if (in_array('name', $node->class->getSubNodeNames())) - { + if (in_array('name', $node->class->getSubNodeNames())) { $sMessage = sprintf( "Invalid configuration: usage of the class '%s' (%s) is forbidden in line %d", is_object($node->class) ? $node->class->name : $node->class, $node->getType(), $node->getLine() ); - } - else - { + } else { $sMessage = sprintf( "Invalid configuration: usage of %s is forbidden in line %d", $node->getType(), $node->getLine() ); } - } - elseif ($node->hasAttribute('name')) - { + } elseif ($node->hasAttribute('name')) { $sMessage = sprintf( "Invalid configuration: %s of type %s is forbidden in line %d", $node->getAttribute('name'), $node->getType(), $node->getLine() ); - } - else - { + } else { $sMessage = sprintf( "Invalid configuration: %s is forbidden in line %d", $node->getType(), @@ -142,4 +130,4 @@ class ConfigNodesVisitor extends NodeVisitorAbstract throw new \Exception($sMessage); } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-config/src/Validator/iTopConfigAstValidator.php b/datamodels/2.x/itop-config/src/Validator/iTopConfigAstValidator.php index ffcfff8fc..10754ba62 100644 --- a/datamodels/2.x/itop-config/src/Validator/iTopConfigAstValidator.php +++ b/datamodels/2.x/itop-config/src/Validator/iTopConfigAstValidator.php @@ -1,4 +1,5 @@ parse($sConfig); } catch (\Error $e) { - $sMessage = 'Invalid configuration: '. \Dict::Format('config-parse-error', $e->getMessage(), $e->getLine()); + $sMessage = 'Invalid configuration: '.\Dict::Format('config-parse-error', $e->getMessage(), $e->getLine()); throw new \Exception($sMessage, 0, $e); - }catch (\Exception $e) { - $sMessage = 'Invalid configuration: '. \Dict::Format('config-parse-error', $e->getMessage(), $e->getLine()); + } catch (\Exception $e) { + $sMessage = 'Invalid configuration: '.\Dict::Format('config-parse-error', $e->getMessage(), $e->getLine()); throw new \Exception($sMessage, 0, $e); } @@ -41,4 +41,4 @@ class iTopConfigAstValidator $oTraverser->addVisitor($oNodeVisitor); $oTraverser->traverse($aInitialNodes); } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-config/src/Validator/iTopConfigSyntaxValidator.php b/datamodels/2.x/itop-config/src/Validator/iTopConfigSyntaxValidator.php index 7c5c6a168..a5b81568c 100644 --- a/datamodels/2.x/itop-config/src/Validator/iTopConfigSyntaxValidator.php +++ b/datamodels/2.x/itop-config/src/Validator/iTopConfigSyntaxValidator.php @@ -1,4 +1,5 @@ = 7.0.0 syntax errors are thrown as Error - $sConfig = preg_replace(array('#^\s*<\?php#', '#\?>\s*$#'), '', $sRawConfig); + $sConfig = preg_replace(['#^\s*<\?php#', '#\?>\s*$#'], '', $sRawConfig); eval('if(0){'.trim($sConfig).'}'); $sNoise = trim(ob_get_contents()); - } - catch (\Error $e) - { + } catch (\Error $e) { // ParseError only thrown in PHP7 throw new \Exception('Error in configuration: '.$e->getMessage().' at line '.$e->getLine()); - } - finally - { + } finally { ob_end_clean(); } - if (strlen($sNoise) > 0) - { - if (preg_match("/(Error|Parse error|Notice|Warning): (.+) in \S+ : eval\(\)'d code on line (\d+)/i", strip_tags($sNoise), $aMatches)) - { + if (strlen($sNoise) > 0) { + if (preg_match("/(Error|Parse error|Notice|Warning): (.+) in \S+ : eval\(\)'d code on line (\d+)/i", strip_tags($sNoise), $aMatches)) { $sMessage = $aMatches[2]; $sLine = $aMatches[3]; $sMessage = \Dict::Format('config-parse-error', $sMessage, $sLine); throw new \Exception($sMessage); - } - else - { + } else { // Note: sNoise is an html output, but so far it was ok for me (e.g. showing the entire call stack) throw new \Exception('Syntax error in configuration file: '.$sNoise.''); } } } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-core-update/dictionaries/cs.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/cs.dict.itop-core-update.php index d3c50742a..55d49ed70 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/cs.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/cs.dict.itop-core-update.php @@ -1,15 +1,16 @@ 'Application Upgrade~~', 'itop-core-update:UI:SelectUpdateFile' => 'Application Upgrade~~', 'itop-core-update:UI:ConfirmUpdate' => 'Confirm Application Upgrade~~', @@ -94,6 +95,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:ModuleInstallation/Attribute:name' => 'Jméno', 'Class:ModuleInstallation/Attribute:version' => 'Verze', 'Class:ModuleInstallation/Attribute:comment' => 'Komentář', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/da.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/da.dict.itop-core-update.php index 918c906d4..0e358f817 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/da.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/da.dict.itop-core-update.php @@ -1,15 +1,16 @@ 'Application Upgrade~~', 'itop-core-update:UI:SelectUpdateFile' => 'Application Upgrade~~', 'itop-core-update:UI:ConfirmUpdate' => 'Confirm Application Upgrade~~', @@ -94,6 +95,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:ModuleInstallation/Attribute:name' => 'Name~~', 'Class:ModuleInstallation/Attribute:version' => 'Version~~', 'Class:ModuleInstallation/Attribute:comment' => 'Comment~~', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/de.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/de.dict.itop-core-update.php index d0693952f..664cc6c92 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/de.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/de.dict.itop-core-update.php @@ -1,15 +1,16 @@ 'Anwendungsupgrade', 'itop-core-update:UI:SelectUpdateFile' => 'Upgrade-Datei hochladen', 'itop-core-update:UI:ConfirmUpdate' => 'Upgrade bestätigen', @@ -94,6 +95,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ModuleInstallation/Attribute:name' => 'Name', 'Class:ModuleInstallation/Attribute:version' => 'Version', 'Class:ModuleInstallation/Attribute:comment' => 'Kommentar', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/en.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/en.dict.itop-core-update.php index 1d41b246a..03b081061 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/en.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/en.dict.itop-core-update.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'iTopUpdate:UI:PageTitle' => 'Application Upgrade', - 'itop-core-update:UI:SelectUpdateFile' => 'Application Upgrade', - 'itop-core-update:UI:ConfirmUpdate' => 'Confirm Application Upgrade', - 'itop-core-update:UI:UpdateCoreFiles' => 'Application Upgrading', + 'itop-core-update:UI:SelectUpdateFile' => 'Application Upgrade', + 'itop-core-update:UI:ConfirmUpdate' => 'Confirm Application Upgrade', + 'itop-core-update:UI:UpdateCoreFiles' => 'Application Upgrading', 'iTopUpdate:UI:MaintenanceModeActive' => 'The application is currently under maintenance in read-only mode. You have to run a setup to return in normal mode.', 'itop-core-update:UI:UpdateDone' => 'Application Upgrade', @@ -39,74 +40,72 @@ Dict::Add('EN US', 'English', 'English', array( 'iTopUpdate:UI:DoUpdate' => 'Upgrade', 'iTopUpdate:UI:CurrentVersion' => 'Current installed version', 'iTopUpdate:UI:NewVersion' => 'Newly installed version', - 'iTopUpdate:UI:Back' => 'Back', - 'iTopUpdate:UI:Cancel' => 'Cancel', - 'iTopUpdate:UI:Continue' => 'Continue', + 'iTopUpdate:UI:Back' => 'Back', + 'iTopUpdate:UI:Cancel' => 'Cancel', + 'iTopUpdate:UI:Continue' => 'Continue', 'iTopUpdate:UI:RunSetup' => 'Run Setup', - 'iTopUpdate:UI:WithDBBackup' => 'Database backup', - 'iTopUpdate:UI:WithFilesBackup' => 'Application files backup', - 'iTopUpdate:UI:WithoutBackup' => 'No backup is planned', - 'iTopUpdate:UI:Backup' => 'Backup generated before update', + 'iTopUpdate:UI:WithDBBackup' => 'Database backup', + 'iTopUpdate:UI:WithFilesBackup' => 'Application files backup', + 'iTopUpdate:UI:WithoutBackup' => 'No backup is planned', + 'iTopUpdate:UI:Backup' => 'Backup generated before update', 'iTopUpdate:UI:DoFilesArchive' => 'Archive application files', 'iTopUpdate:UI:UploadArchive' => 'Select a package to upload', 'iTopUpdate:UI:ServerFile' => 'Path of a package already on the server', 'iTopUpdate:UI:WarningReadOnlyDuringUpdate' => 'During the upgrade, the application will be read-only.', - 'iTopUpdate:UI:Status' => 'Status', - 'iTopUpdate:UI:Action' => 'Update', - 'iTopUpdate:UI:Setup' => ITOP_APPLICATION_SHORT.' Setup', - 'iTopUpdate:UI:History' => 'Versions History', - 'iTopUpdate:UI:Progress' => 'Progress of the upgrade', + 'iTopUpdate:UI:Status' => 'Status', + 'iTopUpdate:UI:Action' => 'Update', + 'iTopUpdate:UI:Setup' => ITOP_APPLICATION_SHORT.' Setup', + 'iTopUpdate:UI:History' => 'Versions History', + 'iTopUpdate:UI:Progress' => 'Progress of the upgrade', - 'iTopUpdate:UI:DoBackup:Label' => 'Backup files and database', - 'iTopUpdate:UI:DoBackup:Warning' => 'Backup is not recommended due to limited available disk space', + 'iTopUpdate:UI:DoBackup:Label' => 'Backup files and database', + 'iTopUpdate:UI:DoBackup:Warning' => 'Backup is not recommended due to limited available disk space', - 'iTopUpdate:UI:DiskFreeSpace' => 'Disk free space', - 'iTopUpdate:UI:ItopDiskSpace' => ITOP_APPLICATION_SHORT.' disk space', - 'iTopUpdate:UI:DBDiskSpace' => 'Database disk space', + 'iTopUpdate:UI:DiskFreeSpace' => 'Disk free space', + 'iTopUpdate:UI:ItopDiskSpace' => ITOP_APPLICATION_SHORT.' disk space', + 'iTopUpdate:UI:DBDiskSpace' => 'Database disk space', 'iTopUpdate:UI:FileUploadMaxSize' => 'File upload max size', 'iTopUpdate:UI:PostMaxSize' => 'PHP ini value post_max_size: %1$s', 'iTopUpdate:UI:UploadMaxFileSize' => 'PHP ini value upload_max_filesize: %1$s', - 'iTopUpdate:UI:CanCoreUpdate:Loading' => 'Checking files', - 'iTopUpdate:UI:CanCoreUpdate:Error' => 'Checking files failed (%1$s)', - 'iTopUpdate:UI:CanCoreUpdate:ErrorFileNotExist' => 'Checking files failed (File not exist %1$s)', - 'iTopUpdate:UI:CanCoreUpdate:Failed' => 'Checking files failed', - 'iTopUpdate:UI:CanCoreUpdate:Yes' => 'Application can be updated', + 'iTopUpdate:UI:CanCoreUpdate:Loading' => 'Checking files', + 'iTopUpdate:UI:CanCoreUpdate:Error' => 'Checking files failed (%1$s)', + 'iTopUpdate:UI:CanCoreUpdate:ErrorFileNotExist' => 'Checking files failed (File not exist %1$s)', + 'iTopUpdate:UI:CanCoreUpdate:Failed' => 'Checking files failed', + 'iTopUpdate:UI:CanCoreUpdate:Yes' => 'Application can be updated', 'iTopUpdate:UI:CanCoreUpdate:No' => 'Application cannot be updated: %1$s', 'iTopUpdate:UI:CanCoreUpdate:Warning' => 'Warning: application update can fail: %1$s', 'iTopUpdate:UI:CannotUpdateUseSetup' => 'Some modified files were detected, a partial update cannot be executed.
          Follow the procedure in order to manually upgrade your iTop. You must use the setup to update the application.', - 'iTopUpdate:UI:CheckInProgress'=>'Please wait during integrity check', - - + 'iTopUpdate:UI:CheckInProgress' => 'Please wait during integrity check', 'iTopUpdate:UI:SetupLaunch' => 'Launch '.ITOP_APPLICATION_SHORT.' Setup', 'iTopUpdate:UI:SetupLaunchConfirm' => 'This will launch '.ITOP_APPLICATION_SHORT.' setup, are you sure?', 'iTopUpdate:UI:FastSetupLaunch' => 'Fast Setup', // Setup Messages - 'iTopUpdate:UI:SetupMessage:Ready' => 'Ready to start', + 'iTopUpdate:UI:SetupMessage:Ready' => 'Ready to start', 'iTopUpdate:UI:SetupMessage:EnterMaintenance' => 'Entering maintenance mode', 'iTopUpdate:UI:SetupMessage:Backup' => 'Database backup', 'iTopUpdate:UI:SetupMessage:FilesArchive' => 'Archive application files', - 'iTopUpdate:UI:SetupMessage:CopyFiles' => 'Copy new version files', + 'iTopUpdate:UI:SetupMessage:CopyFiles' => 'Copy new version files', 'iTopUpdate:UI:SetupMessage:CheckCompile' => 'Check application upgrade', 'iTopUpdate:UI:SetupMessage:Compile' => 'Upgrade application', 'iTopUpdate:UI:SetupMessage:UpdateDatabase' => 'Upgrade database', 'iTopUpdate:UI:SetupMessage:ExitMaintenance' => 'Exiting maintenance mode', - 'iTopUpdate:UI:SetupMessage:UpdateDone' => 'Upgrade completed', + 'iTopUpdate:UI:SetupMessage:UpdateDone' => 'Upgrade completed', // Errors 'iTopUpdate:Error:MissingFunction' => 'Impossible to start upgrade, missing function', 'iTopUpdate:Error:MissingFile' => 'Missing file: %1$s', 'iTopUpdate:Error:CorruptedFile' => 'File %1$s is corrupted', - 'iTopUpdate:Error:BadFileFormat' => 'Upgrade file is not a zip file', - 'iTopUpdate:Error:BadFileContent' => 'Upgrade file is not an application archive', - 'iTopUpdate:Error:BadItopProduct' => 'Upgrade file is not compatible with your application', + 'iTopUpdate:Error:BadFileFormat' => 'Upgrade file is not a zip file', + 'iTopUpdate:Error:BadFileContent' => 'Upgrade file is not an application archive', + 'iTopUpdate:Error:BadItopProduct' => 'Upgrade file is not compatible with your application', 'iTopUpdate:Error:Copy' => 'Error, cannot copy \'%1$s\' to \'%2$s\'', - 'iTopUpdate:Error:FileNotFound' => 'File not found', - 'iTopUpdate:Error:NoFile' => 'No file provided', + 'iTopUpdate:Error:FileNotFound' => 'File not found', + 'iTopUpdate:Error:NoFile' => 'No file provided', 'iTopUpdate:Error:InvalidToken' => 'Invalid token', 'iTopUpdate:Error:UpdateFailed' => 'Upgrade failed ', 'iTopUpdate:Error:FileUploadMaxSizeTooSmall' => 'The upload max size seems too small for update. Please change the PHP configuration.', @@ -117,11 +116,9 @@ Dict::Add('EN US', 'English', 'English', array( 'Menu:iTopUpdate' => 'Application upgrade', 'Menu:iTopUpdate+' => 'Application upgrade', - // Missing itop entries - 'Class:ModuleInstallation/Attribute:installed' => 'Installed on', - 'Class:ModuleInstallation/Attribute:name' => 'Name', - 'Class:ModuleInstallation/Attribute:version' => 'Version', - 'Class:ModuleInstallation/Attribute:comment' => 'Comment', -)); - - + // Missing itop entries + 'Class:ModuleInstallation/Attribute:installed' => 'Installed on', + 'Class:ModuleInstallation/Attribute:name' => 'Name', + 'Class:ModuleInstallation/Attribute:version' => 'Version', + 'Class:ModuleInstallation/Attribute:comment' => 'Comment', +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/en_gb.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/en_gb.dict.itop-core-update.php index c1f19010c..25eb1a825 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/en_gb.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/en_gb.dict.itop-core-update.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'iTopUpdate:UI:PageTitle' => 'Application Upgrade', 'itop-core-update:UI:SelectUpdateFile' => 'Application Upgrade', 'itop-core-update:UI:ConfirmUpdate' => 'Confirm Application Upgrade', @@ -54,7 +55,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'iTopUpdate:UI:Status' => 'Status', 'iTopUpdate:UI:Action' => 'Update', - 'iTopUpdate:UI:Setup' => ITOP_APPLICATION_SHORT.' Setup', + 'iTopUpdate:UI:Setup' => ITOP_APPLICATION_SHORT.' Setup', 'iTopUpdate:UI:History' => 'Versions History', 'iTopUpdate:UI:Progress' => 'Progress of the upgrade', @@ -62,7 +63,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'iTopUpdate:UI:DoBackup:Warning' => 'Backup is not recommended due to limited available disk space', 'iTopUpdate:UI:DiskFreeSpace' => 'Disk free space', - 'iTopUpdate:UI:ItopDiskSpace' => ITOP_APPLICATION_SHORT.' disk space', + 'iTopUpdate:UI:ItopDiskSpace' => ITOP_APPLICATION_SHORT.' disk space', 'iTopUpdate:UI:DBDiskSpace' => 'Database disk space', 'iTopUpdate:UI:FileUploadMaxSize' => 'File upload max size', @@ -79,8 +80,6 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'iTopUpdate:UI:CannotUpdateUseSetup' => 'Some modified files were detected, a partial update cannot be executed.
          Follow the procedure in order to manually upgrade your iTop. You must use the setup to update the application.', 'iTopUpdate:UI:CheckInProgress' => 'Please wait during integrity check', - - 'iTopUpdate:UI:SetupLaunch' => 'Launch '.ITOP_APPLICATION_SHORT.' Setup', 'iTopUpdate:UI:SetupLaunchConfirm' => 'This will launch '.ITOP_APPLICATION_SHORT.' setup, are you sure?', 'iTopUpdate:UI:FastSetupLaunch' => 'Fast Setup', @@ -117,11 +116,9 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Menu:iTopUpdate' => 'Application upgrade', 'Menu:iTopUpdate+' => 'Application upgrade', - // Missing itop entries + // Missing itop entries 'Class:ModuleInstallation/Attribute:installed' => 'Installed on', 'Class:ModuleInstallation/Attribute:name' => 'Name', 'Class:ModuleInstallation/Attribute:version' => 'Version', 'Class:ModuleInstallation/Attribute:comment' => 'Comment', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/es_cr.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/es_cr.dict.itop-core-update.php index 7c0afaf41..89f6852a1 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/es_cr.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/es_cr.dict.itop-core-update.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'iTopUpdate:UI:PageTitle' => 'Actualización de aplicación', 'itop-core-update:UI:SelectUpdateFile' => 'Seleccionar archivo', 'itop-core-update:UI:ConfirmUpdate' => 'Confirmar actualización', @@ -92,6 +93,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:ModuleInstallation/Attribute:name' => 'Nombre', 'Class:ModuleInstallation/Attribute:version' => 'Versión', 'Class:ModuleInstallation/Attribute:comment' => 'Comentario', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/fr.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/fr.dict.itop-core-update.php index aaddb57c3..ec69140c0 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/fr.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/fr.dict.itop-core-update.php @@ -1,15 +1,16 @@ 'Mise à jour de l\'application', 'itop-core-update:UI:SelectUpdateFile' => 'Mise à jour', 'itop-core-update:UI:ConfirmUpdate' => 'Confirmation de la mise à jour', @@ -94,6 +95,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:ModuleInstallation/Attribute:name' => 'Nom', 'Class:ModuleInstallation/Attribute:version' => 'Version', 'Class:ModuleInstallation/Attribute:comment' => 'Commentaire', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/hu.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/hu.dict.itop-core-update.php index 8353eb2d9..0573fa06a 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/hu.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/hu.dict.itop-core-update.php @@ -1,15 +1,16 @@ 'Alkalmazásfrissítés', 'itop-core-update:UI:SelectUpdateFile' => 'Alkalmazásfrissítés', 'itop-core-update:UI:ConfirmUpdate' => 'Alkalmazásfrissítés', @@ -94,6 +95,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:ModuleInstallation/Attribute:name' => 'Név', 'Class:ModuleInstallation/Attribute:version' => 'Verzió', 'Class:ModuleInstallation/Attribute:comment' => 'Megjegyzés', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/it.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/it.dict.itop-core-update.php index 03b82dab6..5f98580d0 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/it.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/it.dict.itop-core-update.php @@ -1,15 +1,16 @@ 'Aggiornamento dell\'Applicazione', 'itop-core-update:UI:SelectUpdateFile' => 'Aggiornamento dell\'Applicazione', 'itop-core-update:UI:ConfirmUpdate' => 'Aggiornamento dell\'Applicazione', @@ -94,6 +95,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:ModuleInstallation/Attribute:name' => 'Nome', 'Class:ModuleInstallation/Attribute:version' => 'Versione', 'Class:ModuleInstallation/Attribute:comment' => 'Commento', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/ja.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/ja.dict.itop-core-update.php index 4ceaa8bd5..ad9aad2c0 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/ja.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/ja.dict.itop-core-update.php @@ -1,15 +1,16 @@ 'Application Upgrade~~', 'itop-core-update:UI:SelectUpdateFile' => 'Application Upgrade~~', 'itop-core-update:UI:ConfirmUpdate' => 'Confirm Application Upgrade~~', @@ -94,6 +95,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:ModuleInstallation/Attribute:name' => 'Name~~', 'Class:ModuleInstallation/Attribute:version' => 'Version~~', 'Class:ModuleInstallation/Attribute:comment' => 'Comment~~', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/nl.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/nl.dict.itop-core-update.php index 63c2db4f9..271ea5690 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/nl.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/nl.dict.itop-core-update.php @@ -1,16 +1,17 @@ (2018 - 2022) * @author Thomas Casteleyn */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'iTopUpdate:UI:PageTitle' => 'Upgraden toepassing', 'itop-core-update:UI:SelectUpdateFile' => 'Upgrade', 'itop-core-update:UI:ConfirmUpdate' => 'Upgrade', @@ -95,6 +96,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:ModuleInstallation/Attribute:name' => 'Naam', 'Class:ModuleInstallation/Attribute:version' => 'Versie', 'Class:ModuleInstallation/Attribute:comment' => 'Opmerkingen', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/pl.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/pl.dict.itop-core-update.php index 80f68c2e5..afcb92c59 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/pl.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/pl.dict.itop-core-update.php @@ -1,15 +1,16 @@ 'Aktualizacja aplikacji', 'itop-core-update:UI:SelectUpdateFile' => 'Aktualizacja aplikacji', 'itop-core-update:UI:ConfirmUpdate' => 'Potwierdź aktualizację aplikacji', @@ -91,7 +92,5 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:ModuleInstallation/Attribute:installed' => 'Zainstalowano', 'Class:ModuleInstallation/Attribute:name' => 'Nazwa', 'Class:ModuleInstallation/Attribute:version' => 'Wersja', - 'Class:ModuleInstallation/Attribute:comment' => 'Komentarz' -)); - - + 'Class:ModuleInstallation/Attribute:comment' => 'Komentarz', +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/pt_br.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/pt_br.dict.itop-core-update.php index 57bc60f0f..b12380873 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/pt_br.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/pt_br.dict.itop-core-update.php @@ -1,15 +1,16 @@ 'Atualização do '.ITOP_APPLICATION_SHORT, 'itop-core-update:UI:SelectUpdateFile' => 'Atualização do '.ITOP_APPLICATION_SHORT, 'itop-core-update:UI:ConfirmUpdate' => 'Atualização do '.ITOP_APPLICATION_SHORT, 'itop-core-update:UI:UpdateCoreFiles' => 'Atualização do '.ITOP_APPLICATION_SHORT, 'iTopUpdate:UI:MaintenanceModeActive' => 'O '.ITOP_APPLICATION_SHORT.' encontra-se em manutenção, nenhum usuário pode acessar a aplicação. Você precisa rodar o Setup ou restaurar os arquivos da aplicação para voltar ao modo normal', 'itop-core-update:UI:UpdateDone' => 'Atualização do '.ITOP_APPLICATION_SHORT, 'itop-core-update/Operation:SelectUpdateFile/Title' => 'Atualização do '.ITOP_APPLICATION_SHORT, 'itop-core-update/Operation:ConfirmUpdate/Title' => 'Confirmar Atualização do '.ITOP_APPLICATION_SHORT, 'itop-core-update/Operation:UpdateCoreFiles/Title' => 'Aplicação em Atualização', 'itop-core-update/Operation:UpdateDone/Title' => 'Atualização do '.ITOP_APPLICATION_SHORT.' finalizada', @@ -84,7 +85,5 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Menu:iTopUpdate' => 'Atualização do '.ITOP_APPLICATION_SHORT, 'Menu:iTopUpdate+' => 'Atualização do '.ITOP_APPLICATION_SHORT, 'Class:ModuleInstallation/Attribute:installed' => 'Instalado em', 'Class:ModuleInstallation/Attribute:name' => 'Nome', 'Class:ModuleInstallation/Attribute:version' => 'Versão', - 'Class:ModuleInstallation/Attribute:comment' => 'Comentário' -)); - - + 'Class:ModuleInstallation/Attribute:comment' => 'Comentário', +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/ru.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/ru.dict.itop-core-update.php index 4bd1ba980..2ab106ec1 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/ru.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/ru.dict.itop-core-update.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'iTopUpdate:UI:PageTitle' => 'Обновление приложения', 'itop-core-update:UI:SelectUpdateFile' => 'Обновление', 'itop-core-update:UI:ConfirmUpdate' => 'Обновление', @@ -95,6 +96,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:ModuleInstallation/Attribute:name' => 'Название', 'Class:ModuleInstallation/Attribute:version' => 'Версия', 'Class:ModuleInstallation/Attribute:comment' => 'Комментарий', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/sk.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/sk.dict.itop-core-update.php index d483ad5ae..b5299012b 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/sk.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/sk.dict.itop-core-update.php @@ -1,15 +1,16 @@ 'Application Upgrade~~', 'itop-core-update:UI:SelectUpdateFile' => 'Application Upgrade~~', 'itop-core-update:UI:ConfirmUpdate' => 'Confirm Application Upgrade~~', @@ -94,6 +95,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:ModuleInstallation/Attribute:name' => 'Name~~', 'Class:ModuleInstallation/Attribute:version' => 'Version~~', 'Class:ModuleInstallation/Attribute:comment' => 'Comment~~', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/tr.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/tr.dict.itop-core-update.php index 9890c206b..ffc058193 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/tr.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/tr.dict.itop-core-update.php @@ -1,15 +1,16 @@ 'Application Upgrade~~', 'itop-core-update:UI:SelectUpdateFile' => 'Application Upgrade~~', 'itop-core-update:UI:ConfirmUpdate' => 'Confirm Application Upgrade~~', @@ -94,6 +95,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:ModuleInstallation/Attribute:name' => 'Name~~', 'Class:ModuleInstallation/Attribute:version' => 'Version~~', 'Class:ModuleInstallation/Attribute:comment' => 'Comment~~', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/dictionaries/zh_cn.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/dictionaries/zh_cn.dict.itop-core-update.php index 55dc4fe94..21dcedc57 100644 --- a/datamodels/2.x/itop-core-update/dictionaries/zh_cn.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/dictionaries/zh_cn.dict.itop-core-update.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'iTopUpdate:UI:PageTitle' => '应用升级', 'itop-core-update:UI:SelectUpdateFile' => '应用升级', 'itop-core-update:UI:ConfirmUpdate' => ' 升级', @@ -106,11 +107,9 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Menu:iTopUpdate' => '应用升级', 'Menu:iTopUpdate+' => '应用升级', - // Missing itop entries + // Missing itop entries 'Class:ModuleInstallation/Attribute:installed' => '安装时间', 'Class:ModuleInstallation/Attribute:name' => '名称', 'Class:ModuleInstallation/Attribute:version' => '版本', 'Class:ModuleInstallation/Attribute:comment' => '备注', -)); - - +]); diff --git a/datamodels/2.x/itop-core-update/module.itop-core-update.php b/datamodels/2.x/itop-core-update/module.itop-core-update.php index b8cb778ed..668d2f987 100644 --- a/datamodels/2.x/itop-core-update/module.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/module.itop-core-update.php @@ -1,4 +1,5 @@ [ - 'itop-files-information/2.7.0', - 'combodo-db-tools/2.7.0', + 'itop-files-information/2.7.0', + 'combodo-db-tools/2.7.0', ], 'mandatory' => false, 'visible' => true, diff --git a/datamodels/2.x/itop-core-update/src/Controller/AjaxController.php b/datamodels/2.x/itop-core-update/src/Controller/AjaxController.php index 6199dcab5..34f772dd4 100644 --- a/datamodels/2.x/itop-core-update/src/Controller/AjaxController.php +++ b/datamodels/2.x/itop-core-update/src/Controller/AjaxController.php @@ -1,10 +1,10 @@ getMessage()); - } catch (Exception $e) - { + } catch (Exception $e) { $aParams['bStatus'] = false; $aParams['sMessage'] = Dict::Format('iTopUpdate:UI:CanCoreUpdate:Error', $e->getMessage()); } @@ -122,13 +115,11 @@ class AjaxController extends Controller public function OperationEnterMaintenance() { $aParams = []; - try - { + try { SetupUtils::CheckSetupToken(); SetupUtils::EnterReadOnlyMode(MetaModel::GetConfig()); $iResponseCode = 200; - } catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Error("EnterMaintenance: ".$e->getMessage()); $aParams['sError'] = $e->getMessage(); $iResponseCode = 500; @@ -139,13 +130,11 @@ class AjaxController extends Controller public function OperationExitMaintenance() { $aParams = []; - try - { + try { SetupUtils::CheckSetupToken(true); SetupUtils::ExitReadOnlyMode(); $iResponseCode = 200; - } catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Error("ExitMaintenance: ".$e->getMessage()); $aParams['sError'] = $e->getMessage(); $iResponseCode = 500; @@ -156,13 +145,11 @@ class AjaxController extends Controller public function OperationBackup() { $aParams = []; - try - { + try { SetupUtils::CheckSetupToken(); CoreUpdater::Backup(); $iResponseCode = 200; - } catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Error("Backup: ".$e->getMessage()); $aParams['sError'] = $e->getMessage(); $iResponseCode = 500; @@ -173,13 +160,11 @@ class AjaxController extends Controller public function OperationFilesArchive() { $aParams = []; - try - { + try { SetupUtils::CheckSetupToken(); CoreUpdater::CreateItopArchive(); $iResponseCode = 200; - } catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Error("FilesArchive: ".$e->getMessage()); $aParams['sError'] = $e->getMessage(); $iResponseCode = 500; @@ -190,13 +175,11 @@ class AjaxController extends Controller public function OperationCopyFiles() { $aParams = []; - try - { + try { SetupUtils::CheckSetupToken(); CoreUpdater::CopyCoreFiles(); $iResponseCode = 200; - } catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Error("CopyFiles: ".$e->getMessage()); $aParams['sError'] = $e->getMessage(); $iResponseCode = 500; @@ -208,14 +191,11 @@ class AjaxController extends Controller public function OperationCheckCompile() { $aParams = []; - try - { + try { SetupUtils::CheckSetupToken(); CoreUpdater::CheckCompile(); $iResponseCode = 200; - } - catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Error("Compile: ".$e->getMessage()); $aParams['sError'] = $e->getMessage(); $iResponseCode = 500; @@ -227,14 +207,11 @@ class AjaxController extends Controller public function OperationCompile() { $aParams = []; - try - { + try { SetupUtils::CheckSetupToken(); CoreUpdater::Compile(); $iResponseCode = 200; - } - catch (Exception $e) - { + } catch (Exception $e) { IssueLog::Error("Compile: ".$e->getMessage()); $aParams['sError'] = $e->getMessage(); $iResponseCode = 500; @@ -246,13 +223,11 @@ class AjaxController extends Controller public function OperationUpdateDatabase() { $aParams = []; - try - { + try { SetupUtils::CheckSetupToken(); CoreUpdater::UpdateDatabase(); $iResponseCode = 200; - } - catch (Exception $e) { + } catch (Exception $e) { IssueLog::Error("Compile: ".$e->getMessage()); $aParams['sError'] = $e->getMessage(); $iResponseCode = 500; @@ -261,7 +236,7 @@ class AjaxController extends Controller $this->DisplayJSONPage($aParams, $iResponseCode); } - function OperationRebuildToolkitEnvironment() + public function OperationRebuildToolkitEnvironment() { $sTransactionId = utils::GetNewTransactionId(); $aParams = []; @@ -275,8 +250,7 @@ class AjaxController extends Controller $oEnvironment = new RunTimeEnvironment('production'); $oEnvironment->WriteConfigFileSafe($oConfig); $oEnvironment->CompileFrom('production'); - } - catch (Exception $e) { + } catch (Exception $e) { IssueLog::Error('RebuildToolkitEnvironment: '.$e->getMessage()); $aParams['sError'] = $e->getMessage(); $iResponseCode = 500; diff --git a/datamodels/2.x/itop-core-update/src/Controller/UpdateController.php b/datamodels/2.x/itop-core-update/src/Controller/UpdateController.php index 12bb7053c..259dbf262 100644 --- a/datamodels/2.x/itop-core-update/src/Controller/UpdateController.php +++ b/datamodels/2.x/itop-core-update/src/Controller/UpdateController.php @@ -1,4 +1,5 @@ Get('setup.launch_button.enabled'); if (is_null($bConfigParamSetupLaunchButtonEnabled)) { $bIsSetupLaunchButtonEnabled = utils::IsDevelopmentEnvironment(); - } else if (false === $bConfigParamSetupLaunchButtonEnabled) { + } elseif (false === $bConfigParamSetupLaunchButtonEnabled) { $bIsSetupLaunchButtonEnabled = false; } else { $bIsSetupLaunchButtonEnabled = $bConfigParamSetupLaunchButtonEnabled || utils::IsDevelopmentEnvironment(); @@ -108,8 +109,7 @@ class UpdateController extends Controller } else { throw new Exception(Dict::S('iTopUpdate:Error:NoFile')); } - } - catch (Exception $e) { + } catch (Exception $e) { $iError = UPLOAD_ERR_NO_FILE; $sError = $e->getMessage(); } @@ -163,19 +163,19 @@ class UpdateController extends Controller $this->DisplaySetupPage($aParams); } - public function OperationRunSetup() - { - SetupUtils::CheckSetupToken(true); - $sConfigFile = APPCONF.'production/'.ITOP_CONFIG_FILE; - @chmod($sConfigFile, 0770); - $sRedirectURL = utils::GetAbsoluteUrlAppRoot().'setup/index.php'; - header("Location: $sRedirectURL"); - } + public function OperationRunSetup() + { + SetupUtils::CheckSetupToken(true); + $sConfigFile = APPCONF.'production/'.ITOP_CONFIG_FILE; + @chmod($sConfigFile, 0770); + $sRedirectURL = utils::GetAbsoluteUrlAppRoot().'setup/index.php'; + header("Location: $sRedirectURL"); + } - private function GetPreviousInstallations() - { - return DBToolsUtils::GetPreviousInstallations(); - } + private function GetPreviousInstallations() + { + return DBToolsUtils::GetPreviousInstallations(); + } // Returns a file size limit in bytes based on the PHP upload_max_filesize // and post_max_size diff --git a/datamodels/2.x/itop-core-update/src/Service/CoreUpdater.php b/datamodels/2.x/itop-core-update/src/Service/CoreUpdater.php index e7ae76b16..33457a611 100644 --- a/datamodels/2.x/itop-core-update/src/Service/CoreUpdater.php +++ b/datamodels/2.x/itop-core-update/src/Service/CoreUpdater.php @@ -1,4 +1,5 @@ getMessage()); SetupLog::Info('itop-core-update: ended'); throw $e; - } finally - { + } finally { self::RRmdir(self::UPDATE_DIR); } } @@ -94,8 +85,7 @@ final class CoreUpdater */ public static function CheckCompile() { - try - { + try { // Compile code SetupLog::Info('itop-core-update: Start checking compilation'); @@ -107,15 +97,11 @@ final class CoreUpdater $oRuntimeEnv->Rollback(); SetupLog::Info('itop-core-update: Checking compilation done'); - } - catch (Exception $e) - { + } catch (Exception $e) { SetupLog::error($e->getMessage()); - try - { + try { SetupUtils::ExitReadOnlyMode(); - } catch (Exception $e1) - { + } catch (Exception $e1) { IssueLog::Error("ExitMaintenance: ".$e1->getMessage()); } throw $e; @@ -127,8 +113,7 @@ final class CoreUpdater */ public static function Compile() { - try - { + try { // Compile code SetupLog::Info('itop-core-update: Start compilation'); @@ -138,15 +123,11 @@ final class CoreUpdater $oRuntimeEnv->CompileFrom('production'); SetupLog::Info('itop-core-update: Compilation done'); - } - catch (Exception $e) - { + } catch (Exception $e) { SetupLog::error($e->getMessage()); - try - { + try { SetupUtils::ExitReadOnlyMode(); - } catch (Exception $e1) - { + } catch (Exception $e1) { IssueLog::Error("ExitMaintenance: ".$e1->getMessage()); } throw $e; @@ -158,8 +139,7 @@ final class CoreUpdater */ public static function UpdateDatabase() { - try - { + try { SetupLog::Info('itop-core-update: Start Update database'); $sFinalEnv = 'production'; @@ -172,18 +152,14 @@ final class CoreUpdater $sModulesDirToKeep = $oRuntimeEnv->GetBuildDir(); $aDirsToScanForModules = [ $sModulesDirToKeep, - APPROOT.'extensions' + APPROOT.'extensions', ]; $aAvailableModules = $oRuntimeEnv->AnalyzeInstallation($oConfig, $aDirsToScanForModules); $aSelectedModules = []; - foreach ($aAvailableModules as $sModuleId => $aModule) - { - if (($sModuleId == ROOT_MODULE) || ($sModuleId == DATAMODEL_MODULE)) - { + foreach ($aAvailableModules as $sModuleId => $aModule) { + if (($sModuleId == ROOT_MODULE) || ($sModuleId == DATAMODEL_MODULE)) { continue; - } - else - { + } else { $aSelectedModules[] = $sModuleId; } } @@ -198,32 +174,30 @@ final class CoreUpdater $oExtensionsMap = new iTopExtensionsMap(); // Default choices = as before $oExtensionsMap->LoadChoicesFromDatabase($oConfig); - foreach ($oExtensionsMap->GetAllExtensions() as $oExtension) - { + foreach ($oExtensionsMap->GetAllExtensions() as $oExtension) { // Plus all "remote" extensions - if ($oExtension->sSource == iTopExtension::SOURCE_REMOTE) - { + if ($oExtension->sSource == iTopExtension::SOURCE_REMOTE) { $oExtensionsMap->MarkAsChosen($oExtension->sCode); } } $aSelectedExtensionCodes = []; - foreach ($oExtensionsMap->GetChoices() as $oExtension) - { + foreach ($oExtensionsMap->GetChoices() as $oExtension) { $aSelectedExtensionCodes[] = $oExtension->sCode; } - $oRuntimeEnv->RecordInstallation($oConfig, $sDataModelVersion, $aSelectedModules, - $aSelectedExtensionCodes, 'Done by the iTop Core Updater'); + $oRuntimeEnv->RecordInstallation( + $oConfig, + $sDataModelVersion, + $aSelectedModules, + $aSelectedExtensionCodes, + 'Done by the iTop Core Updater' + ); SetupLog::Info('itop-core-update: Update database done'); - } - catch (Exception $e) - { + } catch (Exception $e) { SetupLog::error($e->getMessage()); - try - { + try { SetupUtils::ExitReadOnlyMode(); - } catch (Exception $e1) - { + } catch (Exception $e1) { IssueLog::Error("ExitMaintenance: ".$e1->getMessage()); } throw $e; @@ -247,8 +221,7 @@ final class CoreUpdater */ private static function ExtractUpdateFile($sArchiveFile) { - if (!utils::EndsWith($sArchiveFile, '.zip')) - { + if (!utils::EndsWith($sArchiveFile, '.zip')) { throw new Exception(Dict::S('iTopUpdate:Error:BadFileFormat')); } @@ -267,8 +240,7 @@ final class CoreUpdater { $sBackupName = self::GetBackupName(); $sBackupFile = self::GetBackupFile(); - if (file_exists($sBackupFile)) - { + if (file_exists($sBackupFile)) { @unlink($sBackupFile); } @@ -282,14 +254,12 @@ final class CoreUpdater { set_time_limit(0); $sItopArchiveFile = self::GetItopArchiveFile(); - if (file_exists($sItopArchiveFile)) - { + if (file_exists($sItopArchiveFile)) { @unlink($sItopArchiveFile); } $sTempFile = sys_get_temp_dir().'/'.basename($sItopArchiveFile); - if (file_exists($sTempFile)) - { + if (file_exists($sTempFile)) { @unlink($sTempFile); } @@ -303,17 +273,13 @@ final class CoreUpdater self::ZipFolder(realpath(APPROOT), $oZipArchive, strlen("$sParentPath/")); $oZipArchive->close(); - if (!file_exists($sTempFile)) - { + if (!file_exists($sTempFile)) { SetupLog::Error("Failed to create itop archive $sTempFile"); } - if (@rename($sTempFile, $sItopArchiveFile)) - { + if (@rename($sTempFile, $sItopArchiveFile)) { SetupLog::Info("Archive $sItopArchiveFile Created"); - } - else - { + } else { SetupLog::Error("Failed to create archive $sItopArchiveFile"); } } @@ -335,12 +301,10 @@ final class CoreUpdater $oMutex = new iTopMutex('backup.'.utils::GetCurrentEnvironment()); $oMutex->Lock(); - try - { + try { $oBackup->CreateCompressedBackup($sTargetFile); SetupLog::Info('itop-core-update: Backup done: '.$sTargetFile); - } catch (Exception $e) - { + } catch (Exception $e) { $oMutex->Unlock(); throw $e; } @@ -355,61 +319,44 @@ final class CoreUpdater */ public static function CopyDir($sSource, $sDest) { - if (is_dir($sSource)) - { - if (!is_dir($sDest)) - { + if (is_dir($sSource)) { + if (!is_dir($sDest)) { @mkdir($sDest, 0755); } $aFiles = scandir($sSource); - if (sizeof($aFiles) > 0) - { - foreach ($aFiles as $sFile) - { - if ($sFile == '.' || $sFile == '..' || $sFile == '.svn' || $sFile == '.git') - { + if (sizeof($aFiles) > 0) { + foreach ($aFiles as $sFile) { + if ($sFile == '.' || $sFile == '..' || $sFile == '.svn' || $sFile == '.git') { // Skip continue; } - if (is_dir($sSource.'/'.$sFile)) - { + if (is_dir($sSource.'/'.$sFile)) { // Recurse self::CopyDir($sSource.'/'.$sFile, $sDest.'/'.$sFile); - } - else - { - if (is_link($sDest.'/'.$sFile)) - { + } else { + if (is_link($sDest.'/'.$sFile)) { unlink($sDest.'/'.$sFile); } self::CopyFile($sSource.'/'.$sFile, $sDest.'/'.$sFile); } } } - } - elseif (is_file($sSource)) - { + } elseif (is_file($sSource)) { self::CopyFile($sSource, $sDest); } } public static function RRmdir($sDir) { - if (is_dir($sDir)) - { + if (is_dir($sDir)) { $oDir = @opendir($sDir); - while (false !== ($sFile = @readdir($oDir))) - { - if (($sFile != '.') && ($sFile != '..')) - { + while (false !== ($sFile = @readdir($oDir))) { + if (($sFile != '.') && ($sFile != '..')) { $sFull = $sDir.'/'.$sFile; - if (is_dir($sFull)) - { + if (is_dir($sFull)) { self::RRmdir($sFull); - } - else - { + } else { @unlink($sFull); } } @@ -427,14 +374,11 @@ final class CoreUpdater */ public static function CopyFile($sSource, $sDest) { - if (is_file($sSource)) - { - if (!@copy($sSource, $sDest)) - { + if (is_file($sSource)) { + if (!@copy($sSource, $sDest)) { // Try changing the mode of the file @chmod($sDest, 0644); - if (!@copy($sSource, $sDest)) - { + if (!@copy($sSource, $sDest)) { throw new Exception(Dict::Format('iTopUpdate:Error:Copy', $sSource, $sDest)); } } @@ -451,28 +395,22 @@ final class CoreUpdater private static function ZipFolder($sFolder, &$oZipArchive, $iStrippedLength) { $oFolder = opendir($sFolder); - while (false !== ($sFile = readdir($oFolder))) - { - if (($sFile == '.') || ($sFile == '..')) - { + while (false !== ($sFile = readdir($oFolder))) { + if (($sFile == '.') || ($sFile == '..')) { continue; } $sFilePath = "$sFolder/$sFile"; $sLocalItopPath = utils::LocalPath($sFilePath); - if ($sLocalItopPath == 'data/backups' || $sLocalItopPath == 'log') - { + if ($sLocalItopPath == 'data/backups' || $sLocalItopPath == 'log') { continue; } // Remove prefix from file path before add to zip. $sLocalPath = substr($sFilePath, $iStrippedLength); - if (is_file($sFilePath)) - { + if (is_file($sFilePath)) { $oZipArchive->addFile($sFilePath, $sLocalPath); - } - elseif (is_dir($sFilePath)) - { + } elseif (is_dir($sFilePath)) { // Add sub-directory. $oZipArchive->addEmptyDir($sLocalPath); self::ZipFolder($sFilePath, $oZipArchive, $iStrippedLength); @@ -524,8 +462,7 @@ final class CoreUpdater */ public static function ExtractDownloadedFile($sArchiveFile) { - try - { + try { // Extract archive file self::ExtractUpdateFile($sArchiveFile); @@ -536,12 +473,10 @@ final class CoreUpdater FilesIntegrity::CheckInstallationIntegrity($sRootPath); SetupLog::Info('itop-core-update: Files integrity OK'); - } catch (Exception $e) - { + } catch (Exception $e) { self::RRmdir(self::UPDATE_DIR); throw $e; - } finally - { + } finally { self::RRmdir(self::DOWNLOAD_DIR); } } @@ -552,51 +487,42 @@ final class CoreUpdater */ public static function GetVersionToInstall() { - try - { + try { $sConfigFile = self::UPDATE_DIR.'web/core/config.class.inc.php'; - if (!is_file($sConfigFile)) - { + if (!is_file($sConfigFile)) { throw new Exception(Dict::S(Dict::S('iTopUpdate:Error:BadFileContent'))); } $sContents = file_get_contents($sConfigFile); preg_match_all("@define\('(?ITOP_[^']*)', '(?[^']*)'\);@", $sContents, $aMatches); - if (empty($aMatches)) - { + if (empty($aMatches)) { throw new Exception(Dict::S(Dict::S('iTopUpdate:Error:BadFileContent'))); } $aValues = []; - foreach ($aMatches['name'] as $index => $sName) - { + foreach ($aMatches['name'] as $index => $sName) { $aValues[$sName] = $aMatches['value'][$index]; } - if ($aValues['ITOP_APPLICATION'] != ITOP_APPLICATION) - { + if ($aValues['ITOP_APPLICATION'] != ITOP_APPLICATION) { throw new Exception(Dict::S('iTopUpdate:Error:BadItopProduct')); } // Extract updater file from the new version if available - if (is_file(APPROOT.'setup/appupgradecheck.php')) - { + if (is_file(APPROOT.'setup/appupgradecheck.php')) { // Remove previous specific updater @unlink(APPROOT.'setup/appupgradecheck.php'); } - if (is_file(self::UPDATE_DIR.'web/setup/appupgradecheck.php')) - { + if (is_file(self::UPDATE_DIR.'web/setup/appupgradecheck.php')) { SetupLog::Info('itop-core-update: Use updater provided in the archive'); self::CopyFile(self::UPDATE_DIR.'web/setup/appupgradecheck.php', APPROOT.'setup/appupgradecheck.php'); @include_once(APPROOT.'setup/appupgradecheck.php'); } - if (function_exists('AppUpgradeCheckInstall')) - { + if (function_exists('AppUpgradeCheckInstall')) { AppUpgradeCheckInstall(); } return Dict::Format('UI:iTopVersion:Long', $aValues['ITOP_APPLICATION'], $aValues['ITOP_VERSION'], $aValues['ITOP_REVISION'], $aValues['ITOP_BUILD_DATE']); - } catch (Exception $e) - { + } catch (Exception $e) { self::RRmdir(self::UPDATE_DIR); self::RRmdir(self::DOWNLOAD_DIR); throw $e; diff --git a/datamodels/2.x/itop-core-update/src/Service/RunTimeEnvironmentCoreUpdater.php b/datamodels/2.x/itop-core-update/src/Service/RunTimeEnvironmentCoreUpdater.php index 0607f6dd5..dd5a6de40 100644 --- a/datamodels/2.x/itop-core-update/src/Service/RunTimeEnvironmentCoreUpdater.php +++ b/datamodels/2.x/itop-core-update/src/Service/RunTimeEnvironmentCoreUpdater.php @@ -1,10 +1,10 @@ sTargetEnv) - { - if (is_dir(APPROOT.'/env-'.$this->sTargetEnv)) - { + if ($sEnvironment != $this->sTargetEnv) { + if (is_dir(APPROOT.'/env-'.$this->sTargetEnv)) { SetupUtils::rrmdir(APPROOT.'/env-'.$this->sTargetEnv); } - if (is_dir(APPROOT.'/data/'.$this->sTargetEnv.'-modules')) - { + if (is_dir(APPROOT.'/data/'.$this->sTargetEnv.'-modules')) { SetupUtils::rrmdir(APPROOT.'/data/'.$this->sTargetEnv.'-modules'); } SetupUtils::copydir(APPROOT.'/data/'.$sEnvironment.'-modules', APPROOT.'/data/'.$this->sTargetEnv.'-modules'); @@ -63,17 +60,14 @@ class RunTimeEnvironmentCoreUpdater extends RunTimeEnvironment */ public static function CheckDirectory($sDir) { - if (!is_dir($sDir)) - { - if (!@mkdir($sDir,0770)) - { + if (!is_dir($sDir)) { + if (!@mkdir($sDir, 0770)) { throw new Exception('Creating directory '.$sDir.' is denied (Check access rights)'); } } // Try create a file $sTempFile = $sDir.'/__itop_temp_file__'; - if (!@touch($sTempFile)) - { + if (!@touch($sTempFile)) { throw new Exception('Write access to '.$sDir.' is denied (Check access rights)'); } @unlink($sTempFile); @@ -93,8 +87,7 @@ class RunTimeEnvironmentCoreUpdater extends RunTimeEnvironment $oConfig->UpdateIncludes('env-'.$this->sTargetEnv); - if (is_null($sEnvironmentLabel)) - { + if (is_null($sEnvironmentLabel)) { $sEnvironmentLabel = $this->sTargetEnv; } $oConfig->Set('app_env_label', $sEnvironmentLabel, 'application updater'); @@ -110,19 +103,14 @@ class RunTimeEnvironmentCoreUpdater extends RunTimeEnvironment */ protected function GetConfig($sEnvironment = null) { - if (is_null($sEnvironment)) - { + if (is_null($sEnvironment)) { $sEnvironment = $this->sTargetEnv; } $sFile = APPCONF.$sEnvironment.'/'.ITOP_CONFIG_FILE; - if (file_exists($sFile)) - { - try - { + if (file_exists($sFile)) { + try { return new Config($sFile); - } - catch (Exception $e) - { + } catch (Exception $e) { } } throw new Exception('No configuration file available'); @@ -134,8 +122,7 @@ class RunTimeEnvironmentCoreUpdater extends RunTimeEnvironment // Add new mandatory modules from datamodel 2.x only $sSourceDirFull = APPROOT.$sSourceDir; - if (!is_dir($sSourceDirFull)) - { + if (!is_dir($sSourceDirFull)) { throw new Exception("The source directory '$sSourceDirFull' does not exist (or could not be read)"); } $aDirsToCompile = [$sSourceDirFull]; @@ -148,7 +135,7 @@ class RunTimeEnvironmentCoreUpdater extends RunTimeEnvironment $aAvailableModules[$oModule->GetName()] = $oModule; } // TODO check the auto-selected modules here - foreach($this->oExtensionsMap->GetAllExtensions() as $oExtension) { + foreach ($this->oExtensionsMap->GetAllExtensions() as $oExtension) { if ($oExtension->bMarkedAsChosen) { foreach ($oExtension->aModules as $sModuleName) { if (!isset($aRet[$sModuleName]) && isset($aAvailableModules[$sModuleName])) { diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/cs.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/cs.dict.itop-datacenter-mgmt.php index ef8abdc01..55bb8e390 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/cs.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/cs.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/da.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/da.dict.itop-datacenter-mgmt.php index c334a1b47..2ab69e587 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/da.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/da.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/de.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/de.dict.itop-datacenter-mgmt.php index 8cf9a4957..f42435a94 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/de.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/de.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/en.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/en.dict.itop-datacenter-mgmt.php index 555c82307..9a265de96 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/en.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/en.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/en_gb.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/en_gb.dict.itop-datacenter-mgmt.php index 8308d6eea..1b018e263 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/en_gb.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/en_gb.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/es_cr.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/es_cr.dict.itop-datacenter-mgmt.php index a22194dd0..a14e3f8a2 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/es_cr.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/es_cr.dict.itop-datacenter-mgmt.php @@ -1,12 +1,13 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/fr.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/fr.dict.itop-datacenter-mgmt.php index 6aee58321..d9310acb4 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/fr.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/fr.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/hu.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/hu.dict.itop-datacenter-mgmt.php index 488d1cc4a..1ce4019db 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/hu.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/hu.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/it.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/it.dict.itop-datacenter-mgmt.php index 80e7164e8..0e7f36b06 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/it.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/it.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/ja.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/ja.dict.itop-datacenter-mgmt.php index 14d7ec5b6..1090e8f27 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/ja.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/ja.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/nl.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/nl.dict.itop-datacenter-mgmt.php index 397cb5aa2..c096fc613 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/nl.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/nl.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/pl.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/pl.dict.itop-datacenter-mgmt.php index ada3bd825..31ffd29f6 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/pl.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/pl.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/pt_br.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/pt_br.dict.itop-datacenter-mgmt.php index 260282dd4..f9a517ce2 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/pt_br.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/pt_br.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/ru.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/ru.dict.itop-datacenter-mgmt.php index 8390045f5..b37587fc4 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/ru.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/ru.dict.itop-datacenter-mgmt.php @@ -1,15 +1,16 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/sk.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/sk.dict.itop-datacenter-mgmt.php index 5fa616311..66d6409fb 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/sk.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/sk.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/tr.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/tr.dict.itop-datacenter-mgmt.php index 4f74143f6..9fcd8912e 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/tr.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/tr.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/zh_cn.dict.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/zh_cn.dict.itop-datacenter-mgmt.php index fafe9e9fe..018caee25 100644 --- a/datamodels/2.x/itop-datacenter-mgmt/dictionaries/zh_cn.dict.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/dictionaries/zh_cn.dict.itop-datacenter-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-datacenter-mgmt/module.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/module.itop-datacenter-mgmt.php index b2ac817cc..d332c48fe 100755 --- a/datamodels/2.x/itop-datacenter-mgmt/module.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/module.itop-datacenter-mgmt.php @@ -1,9 +1,10 @@ 'Datacenter Management', @@ -27,36 +28,35 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - 'itop-config-mgmt/2.2.0' - ), + 'dependencies' => [ + 'itop-config-mgmt/2.2.0', + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array(), - 'webservice' => array( - - ), - 'data.struct' => array( + 'datamodel' => [], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, 'data.sample.racks.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); - diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/cs.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/cs.dict.itop-endusers-devices.php index ef8abdc01..55bb8e390 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/cs.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/cs.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/da.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/da.dict.itop-endusers-devices.php index c334a1b47..2ab69e587 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/da.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/da.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/de.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/de.dict.itop-endusers-devices.php index 8cf9a4957..f42435a94 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/de.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/de.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/en.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/en.dict.itop-endusers-devices.php index 555c82307..9a265de96 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/en.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/en.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/en_gb.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/en_gb.dict.itop-endusers-devices.php index 8308d6eea..1b018e263 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/en_gb.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/en_gb.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/es_cr.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/es_cr.dict.itop-endusers-devices.php index a22194dd0..a14e3f8a2 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/es_cr.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/es_cr.dict.itop-endusers-devices.php @@ -1,12 +1,13 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/fr.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/fr.dict.itop-endusers-devices.php index 6aee58321..d9310acb4 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/fr.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/fr.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/hu.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/hu.dict.itop-endusers-devices.php index 488d1cc4a..1ce4019db 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/hu.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/hu.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/it.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/it.dict.itop-endusers-devices.php index 80e7164e8..0e7f36b06 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/it.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/it.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/ja.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/ja.dict.itop-endusers-devices.php index 14d7ec5b6..1090e8f27 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/ja.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/ja.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/nl.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/nl.dict.itop-endusers-devices.php index 397cb5aa2..c096fc613 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/nl.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/nl.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/pl.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/pl.dict.itop-endusers-devices.php index ada3bd825..31ffd29f6 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/pl.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/pl.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/pt_br.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/pt_br.dict.itop-endusers-devices.php index 260282dd4..f9a517ce2 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/pt_br.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/pt_br.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/ru.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/ru.dict.itop-endusers-devices.php index 8390045f5..b37587fc4 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/ru.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/ru.dict.itop-endusers-devices.php @@ -1,15 +1,16 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/sk.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/sk.dict.itop-endusers-devices.php index 5fa616311..66d6409fb 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/sk.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/sk.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/tr.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/tr.dict.itop-endusers-devices.php index 4f74143f6..9fcd8912e 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/tr.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/tr.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/dictionaries/zh_cn.dict.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/dictionaries/zh_cn.dict.itop-endusers-devices.php index fafe9e9fe..018caee25 100644 --- a/datamodels/2.x/itop-endusers-devices/dictionaries/zh_cn.dict.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/dictionaries/zh_cn.dict.itop-endusers-devices.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-endusers-devices/module.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/module.itop-endusers-devices.php index 0c93ca9f0..7927a3d2a 100644 --- a/datamodels/2.x/itop-endusers-devices/module.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/module.itop-endusers-devices.php @@ -1,4 +1,5 @@ 'End-user Devices Management', @@ -34,42 +35,41 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - 'itop-config-mgmt/2.2.0' - ), + 'dependencies' => [ + 'itop-config-mgmt/2.2.0', + ], 'mandatory' => false, 'visible' => true, 'installer' => 'EndUserMgmtInstaller', // Components // - 'datamodel' => array( - ), - 'webservice' => array( - - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); -if (!class_exists('EndUserMgmtInstaller')) -{ +if (!class_exists('EndUserMgmtInstaller')) { // Module installation handler // class EndUserMgmtInstaller extends ModuleInstallerAPI @@ -88,13 +88,12 @@ if (!class_exists('EndUserMgmtInstaller')) */ public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) { - if (strlen($sPreviousVersion) > 0) - { + if (strlen($sPreviousVersion) > 0) { // If you want to migrate data from one format to another, do it here self::RenameClassInDB('IpPhone', 'IPPhone'); } } - + /** * Handler called after the creation/update of the database schema * @param $oConfiguration Config The new configuration of the application @@ -106,4 +105,3 @@ if (!class_exists('EndUserMgmtInstaller')) } } } - diff --git a/datamodels/2.x/itop-faq-light/dictionaries/cs.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/cs.dict.itop-faq-light.php index f42da12f8..810e31695 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/cs.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/cs.dict.itop-faq-light.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:FAQ' => 'FAQ', 'Class:FAQ+' => 'Často kladené dotazy', 'Class:FAQ/Attribute:title' => 'Název', @@ -29,21 +30,21 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:FAQ/Attribute:key_words' => 'Klíčová slova', 'Class:FAQ/Attribute:key_words+' => '', 'Class:FAQ/Attribute:domains' => 'Domény', -)); +]); // // Class: FAQCategory // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:FAQCategory' => 'Kategorie FAQ', 'Class:FAQCategory+' => 'Kategorie pro FAQ', 'Class:FAQCategory/Attribute:name' => 'Název', 'Class:FAQCategory/Attribute:name+' => '', 'Class:FAQCategory/Attribute:faq_list' => 'FAQ', 'Class:FAQCategory/Attribute:faq_list+' => 'Všechny často kladené dotazy v této kategorii', -)); -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +]); +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:ProblemManagement' => 'Správa problémů', 'Menu:ProblemManagement+' => 'Správa problémů', 'Menu:Problem:Shortcuts' => 'Odkazy', @@ -54,4 +55,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Brick:Portal:FAQ:Menu' => 'FAQ', 'Brick:Portal:FAQ:Title' => 'Často kladené dotazy (FAQ)', 'Brick:Portal:FAQ:Title+' => '

          Spěcháte?

          Podívejte se na seznam nejčastějších otázek a (možná) najdete hledanou odpověď ihned.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/da.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/da.dict.itop-faq-light.php index 1aab60647..b4d675ebc 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/da.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/da.dict.itop-faq-light.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:FAQ' => 'FAQ', 'Class:FAQ+' => '', 'Class:FAQ/Attribute:title' => 'Titel', @@ -28,21 +29,21 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:FAQ/Attribute:key_words' => 'Nøgleord', 'Class:FAQ/Attribute:key_words+' => '', 'Class:FAQ/Attribute:domains' => 'Domains~~', -)); +]); // // Class: FAQCategory // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:FAQCategory' => 'FAQ-Kategori', 'Class:FAQCategory+' => '', 'Class:FAQCategory/Attribute:name' => 'Navn', 'Class:FAQCategory/Attribute:name+' => '', 'Class:FAQCategory/Attribute:faq_list' => 'FAQs', 'Class:FAQCategory/Attribute:faq_list+' => 'All the frequently asked questions related to this category~~', -)); -Dict::Add('DA DA', 'Danish', 'Dansk', array( +]); +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:ProblemManagement' => 'Problem Management', 'Menu:ProblemManagement+' => 'Problem Management', 'Menu:Problem:Shortcuts' => 'Genvej', @@ -53,4 +54,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Brick:Portal:FAQ:Menu' => 'FAQ~~', 'Brick:Portal:FAQ:Title' => 'Frequently Asked Questions~~', 'Brick:Portal:FAQ:Title+' => '

          In a hurry?

          Check out the list of most common questions and (maybe) find the expected answer right away.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/de.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/de.dict.itop-faq-light.php index 54d1c19bf..5185ea461 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/de.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/de.dict.itop-faq-light.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:FAQ' => 'FAQ', 'Class:FAQ+' => '', 'Class:FAQ/Attribute:title' => 'Titel', @@ -28,21 +29,21 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:FAQ/Attribute:key_words' => 'Schlüsselwörter', 'Class:FAQ/Attribute:key_words+' => '', 'Class:FAQ/Attribute:domains' => 'Domäne', -)); +]); // // Class: FAQCategory // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:FAQCategory' => 'FAQ-Kategorie', 'Class:FAQCategory+' => '', 'Class:FAQCategory/Attribute:name' => 'Name', 'Class:FAQCategory/Attribute:name+' => '', 'Class:FAQCategory/Attribute:faq_list' => 'FAQs', 'Class:FAQCategory/Attribute:faq_list+' => 'Alle FAQ-Einträge (frequently asked questions) verknüpft mit dieser Kategorie', -)); -Dict::Add('DE DE', 'German', 'Deutsch', array( +]); +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:ProblemManagement' => 'Problem Management', 'Menu:ProblemManagement+' => 'Problem Management', 'Menu:Problem:Shortcuts' => 'Shortcuts', @@ -53,4 +54,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Brick:Portal:FAQ:Menu' => 'FAQ', 'Brick:Portal:FAQ:Title' => 'Oft gestellte Fragen (FAQs)', 'Brick:Portal:FAQ:Title+' => '

          In Eile?

          Sehen Sie sich die meistgestellten Fragen an (FAQs) und finden Sie (eventuell) die Antwort direkt dort.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/en.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/en.dict.itop-faq-light.php index 286299a54..1eb79cc9d 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/en.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/en.dict.itop-faq-light.php @@ -1,4 +1,5 @@ 'FAQ', 'Class:FAQ+' => 'Frequently asked questions', 'Class:FAQ/Attribute:title' => 'Title', @@ -68,21 +69,21 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:FAQ/Attribute:key_words' => 'Key words', 'Class:FAQ/Attribute:key_words+' => '', 'Class:FAQ/Attribute:domains' => 'Domains', -)); +]); // // Class: FAQCategory // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:FAQCategory' => 'FAQ Category', 'Class:FAQCategory+' => 'Category for FAQ', 'Class:FAQCategory/Attribute:name' => 'Name', 'Class:FAQCategory/Attribute:name+' => '', 'Class:FAQCategory/Attribute:faq_list' => 'FAQs', 'Class:FAQCategory/Attribute:faq_list+' => 'All the frequently asked questions related to this category', -)); -Dict::Add('EN US', 'English', 'English', array( +]); +Dict::Add('EN US', 'English', 'English', [ 'Menu:ProblemManagement' => 'Problem management', 'Menu:ProblemManagement+' => 'Problem management', 'Menu:Problem:Shortcuts' => 'Shortcuts', @@ -93,4 +94,4 @@ Dict::Add('EN US', 'English', 'English', array( 'Brick:Portal:FAQ:Menu' => 'FAQ', 'Brick:Portal:FAQ:Title' => 'Frequently Asked Questions', 'Brick:Portal:FAQ:Title+' => '

          In a hurry?

          Check out the list of most common questions and (maybe) find the expected answer right away.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/en_gb.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/en_gb.dict.itop-faq-light.php index 3e9c272d1..39fea55a8 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/en_gb.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/en_gb.dict.itop-faq-light.php @@ -1,4 +1,5 @@ 'FAQ', 'Class:FAQ+' => 'Frequently asked questions', 'Class:FAQ/Attribute:title' => 'Title', @@ -68,21 +69,21 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:FAQ/Attribute:key_words' => 'Key words', 'Class:FAQ/Attribute:key_words+' => '', 'Class:FAQ/Attribute:domains' => 'Domains', -)); +]); // // Class: FAQCategory // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:FAQCategory' => 'FAQ Category', 'Class:FAQCategory+' => 'Category for FAQ', 'Class:FAQCategory/Attribute:name' => 'Name', 'Class:FAQCategory/Attribute:name+' => '', 'Class:FAQCategory/Attribute:faq_list' => 'FAQs', 'Class:FAQCategory/Attribute:faq_list+' => 'All the frequently asked questions related to this category', -)); -Dict::Add('EN GB', 'British English', 'British English', array( +]); +Dict::Add('EN GB', 'British English', 'British English', [ 'Menu:ProblemManagement' => 'Problem management', 'Menu:ProblemManagement+' => 'Problem management', 'Menu:Problem:Shortcuts' => 'Shortcuts', @@ -93,4 +94,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Brick:Portal:FAQ:Menu' => 'FAQ', 'Brick:Portal:FAQ:Title' => 'Frequently Asked Questions', 'Brick:Portal:FAQ:Title+' => '

          In a hurry?

          Check out the list of most common questions and (maybe) find the expected answer right away.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/es_cr.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/es_cr.dict.itop-faq-light.php index e3ecbb1d2..9de92593f 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/es_cr.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/es_cr.dict.itop-faq-light.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:FAQ' => 'Preguntas y Respuestas Frecuentes', 'Class:FAQ+' => 'Preguntas y Respuestas Frecuentes', 'Class:FAQ/Attribute:title' => 'Asunto', @@ -25,21 +26,21 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:FAQ/Attribute:key_words' => 'Palabras Clave', 'Class:FAQ/Attribute:key_words+' => 'Palabras Clave', 'Class:FAQ/Attribute:domains' => 'Ámbito', -)); +]); // // Class: FAQCategory // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:FAQCategory' => 'Categoría de Preguntas y Respuesta Frecuentes', 'Class:FAQCategory+' => 'Categoría de Preguntas y Respuesta Frecuentes', 'Class:FAQCategory/Attribute:name' => 'Nombre', 'Class:FAQCategory/Attribute:name+' => 'Nombre de Categoría de Preguntas y Respuestas Frecuentes', 'Class:FAQCategory/Attribute:faq_list' => 'FAQs', 'Class:FAQCategory/Attribute:faq_list+' => 'FAQs', -)); -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +]); +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:ProblemManagement' => 'Administración de Problemas', 'Menu:ProblemManagement+' => 'GestAdministraciónión de problemas', 'Menu:Problem:Shortcuts' => 'Acceso Rápido', @@ -50,4 +51,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Brick:Portal:FAQ:Menu' => 'Preguntas y Respuestas', 'Brick:Portal:FAQ:Title' => 'Preguntas y Respuestas Frecuentes', 'Brick:Portal:FAQ:Title+' => '

          ¿En una prisa?

          Vea la lista de las preguntas más comunes y encontrará (tal vez) la respuesta inmediata a sus necesidades.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/fr.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/fr.dict.itop-faq-light.php index 7350bdf9d..9c7ad2e3d 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/fr.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/fr.dict.itop-faq-light.php @@ -1,15 +1,16 @@ 'FAQ', 'Class:FAQ+' => 'Question fréquement posée', 'Class:FAQ/Attribute:title' => 'Titre', @@ -27,13 +28,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:FAQ/Attribute:key_words' => 'Mots clés', 'Class:FAQ/Attribute:key_words+' => '', 'Class:FAQ/Attribute:domains' => 'Domaines', -)); +]); // // Class: FAQCategory // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:FAQCategory' => 'Catégorie de FAQ', 'Class:FAQCategory+' => 'Catégorie de FAQ', 'Class:FAQCategory/Attribute:name' => 'Nom', @@ -45,9 +46,9 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:FAQCategory/Attribute:faq_list/UI:Links:Delete:Button+' => 'Supprimer cette %4$s', 'Class:FAQCategory/Attribute:faq_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:FAQCategory/Attribute:faq_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:FAQCategory/Attribute:faq_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de sa %1$s' -)); -Dict::Add('FR FR', 'French', 'Français', array( + 'Class:FAQCategory/Attribute:faq_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de sa %1$s', +]); +Dict::Add('FR FR', 'French', 'Français', [ 'Menu:ProblemManagement' => 'Gestion des problèmes', 'Menu:ProblemManagement+' => 'Gestion des problèmes', 'Menu:Problem:Shortcuts' => 'Raccourcis', @@ -58,4 +59,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Brick:Portal:FAQ:Menu' => 'FAQ', 'Brick:Portal:FAQ:Title' => 'Foire Aux Questions', 'Brick:Portal:FAQ:Title+' => '

          Vous êtes pressé ?

          Consultez la liste des questions les plus fréquentes et vous trouverez (peut-être) immédiatement la réponse à votre besoin.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/hu.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/hu.dict.itop-faq-light.php index b6946c0d8..da6880f56 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/hu.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/hu.dict.itop-faq-light.php @@ -1,15 +1,16 @@ 'Tudástár', 'Class:FAQ+' => 'Gyakran Ismételt Kérdések', 'Class:FAQ/Attribute:title' => 'Cím', @@ -27,21 +28,21 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:FAQ/Attribute:key_words' => 'Kulcsszavak', 'Class:FAQ/Attribute:key_words+' => 'A keresést segítő kulcsszavak', 'Class:FAQ/Attribute:domains' => 'Hibatartomány', -)); +]); // // Class: FAQCategory // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:FAQCategory' => 'Tudástár kategória', 'Class:FAQCategory+' => '', 'Class:FAQCategory/Attribute:name' => 'Kategória név', 'Class:FAQCategory/Attribute:name+' => '~~', 'Class:FAQCategory/Attribute:faq_list' => 'Tudástárak', 'Class:FAQCategory/Attribute:faq_list+' => 'Gyakori kérdések ehhez a kategóriához kapcsolódóan', -)); -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +]); +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Menu:ProblemManagement' => 'Problémakezelés', 'Menu:ProblemManagement+' => '', 'Menu:Problem:Shortcuts' => 'Gyorsgombok', @@ -52,4 +53,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Brick:Portal:FAQ:Menu' => 'Tudástár', 'Brick:Portal:FAQ:Title' => 'Tudástárak', 'Brick:Portal:FAQ:Title+' => '

          Siet?

          Nézze át a leggyakoribb kérdések listáját, és (talán) azonnal megtalálja a keresett választ.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/it.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/it.dict.itop-faq-light.php index 8ab56a64c..ba67e6768 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/it.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/it.dict.itop-faq-light.php @@ -1,15 +1,16 @@ 'FAQ', 'Class:FAQ+' => 'Domande frequenti', 'Class:FAQ/Attribute:title' => 'Titolo', @@ -27,21 +28,21 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:FAQ/Attribute:key_words' => 'Parola Chiave', 'Class:FAQ/Attribute:key_words+' => '~~', 'Class:FAQ/Attribute:domains' => 'Dominio', -)); +]); // // Class: FAQCategory // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:FAQCategory' => 'Categoria FAQ', 'Class:FAQCategory+' => 'Categoria per FAQ', 'Class:FAQCategory/Attribute:name' => 'Nome', 'Class:FAQCategory/Attribute:name+' => '~~', 'Class:FAQCategory/Attribute:faq_list' => 'FAQs', 'Class:FAQCategory/Attribute:faq_list+' => 'Tutte le faq legate a questa categoria', -)); -Dict::Add('IT IT', 'Italian', 'Italiano', array( +]); +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Menu:ProblemManagement' => 'Gestione dei problemi', 'Menu:ProblemManagement+' => 'Gestione dei problemi', 'Menu:Problem:Shortcuts' => 'Scorciatoia', @@ -52,4 +53,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Brick:Portal:FAQ:Menu' => 'FAQ', 'Brick:Portal:FAQ:Title' => 'Domande frequenti', 'Brick:Portal:FAQ:Title+' => '

          Sei di fretta?

          Verifica nella lista delle FAQ se trovi la risposta al tuo problema.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/ja.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/ja.dict.itop-faq-light.php index ffb4500c2..1be2bc35a 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/ja.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/ja.dict.itop-faq-light.php @@ -1,15 +1,16 @@ 'FAQ', 'Class:FAQ+' => 'よくある質問', 'Class:FAQ/Attribute:title' => 'タイトル', @@ -27,21 +28,21 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:FAQ/Attribute:key_words' => 'キーワード', 'Class:FAQ/Attribute:key_words+' => '', 'Class:FAQ/Attribute:domains' => 'Domains~~', -)); +]); // // Class: FAQCategory // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:FAQCategory' => 'FAQカテゴリ', 'Class:FAQCategory+' => 'FAQのためのカテゴリ', 'Class:FAQCategory/Attribute:name' => '名前', 'Class:FAQCategory/Attribute:name+' => '', 'Class:FAQCategory/Attribute:faq_list' => 'FAQ', 'Class:FAQCategory/Attribute:faq_list+' => 'All the frequently asked questions related to this category~~', -)); -Dict::Add('JA JP', 'Japanese', '日本語', array( +]); +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Menu:ProblemManagement' => '問題管理', 'Menu:ProblemManagement+' => '問題管理', 'Menu:Problem:Shortcuts' => 'ショートカット', @@ -52,4 +53,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Brick:Portal:FAQ:Menu' => 'FAQ~~', 'Brick:Portal:FAQ:Title' => 'Frequently Asked Questions~~', 'Brick:Portal:FAQ:Title+' => '

          In a hurry?

          Check out the list of most common questions and (maybe) find the expected answer right away.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/nl.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/nl.dict.itop-faq-light.php index c1fac557d..b32956b88 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/nl.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/nl.dict.itop-faq-light.php @@ -1,17 +1,18 @@ * @author Jeffrey Bostoen (2018 - 2022) * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:FAQ' => 'FAQ', 'Class:FAQ+' => 'Veelgestelde vragen', 'Class:FAQ/Attribute:title' => 'Titel', @@ -29,21 +30,21 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:FAQ/Attribute:key_words' => 'Zoektermen', 'Class:FAQ/Attribute:key_words+' => '', 'Class:FAQ/Attribute:domains' => 'Domeinen', -)); +]); // // Class: FAQCategory // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:FAQCategory' => 'FAQ-categorie', 'Class:FAQCategory+' => 'Categorie voor de FAQ', 'Class:FAQCategory/Attribute:name' => 'Naam', 'Class:FAQCategory/Attribute:name+' => '', 'Class:FAQCategory/Attribute:faq_list' => 'FAQ\'s', 'Class:FAQCategory/Attribute:faq_list+' => 'Alle veelgestelde vragen gerelateerd aan deze categorie', -)); -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +]); +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:ProblemManagement' => 'Probleem Management', 'Menu:ProblemManagement+' => 'Probleem Management', 'Menu:Problem:Shortcuts' => 'Snelkoppelingen', @@ -54,4 +55,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Brick:Portal:FAQ:Menu' => 'FAQ', 'Brick:Portal:FAQ:Title' => 'Veelgestelde vragen', 'Brick:Portal:FAQ:Title+' => '

          Gehaast?

          Bekijk deze lijst van veelgestelde vragen. Misschien staat er al een antwoord tussen.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/pl.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/pl.dict.itop-faq-light.php index 9ab828e43..075070bf9 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/pl.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/pl.dict.itop-faq-light.php @@ -1,15 +1,16 @@ 'Pytania FAQ', 'Class:FAQ+' => 'Często Zadawane Pytania', 'Class:FAQ/Attribute:title' => 'Tytuł', @@ -27,21 +28,21 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:FAQ/Attribute:key_words' => 'Słowa kluczowe', 'Class:FAQ/Attribute:key_words+' => '', 'Class:FAQ/Attribute:domains' => 'Domeny', -)); +]); // // Class: FAQCategory // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:FAQCategory' => 'Kategoria FAQ', 'Class:FAQCategory+' => 'Kategoria FAQ', 'Class:FAQCategory/Attribute:name' => 'Nazwa', 'Class:FAQCategory/Attribute:name+' => '', 'Class:FAQCategory/Attribute:faq_list' => 'Pytania FAQ', 'Class:FAQCategory/Attribute:faq_list+' => 'Wszystkie najczęściej zadawane pytania związane z tą kategorią', -)); -Dict::Add('PL PL', 'Polish', 'Polski', array( +]); +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Menu:ProblemManagement' => 'Zarządzanie problemami', 'Menu:ProblemManagement+' => 'Zarządzanie problemami', 'Menu:Problem:Shortcuts' => 'Skróty', @@ -52,4 +53,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Brick:Portal:FAQ:Menu' => 'Pytania FAQ', 'Brick:Portal:FAQ:Title' => 'Często Zadawane Pytania', 'Brick:Portal:FAQ:Title+' => '

          W pośpiechu?

          Sprawdź listę najczęściej zadawanych pytań i (być może) od razu znajdź oczekiwaną odpowiedź.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/pt_br.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/pt_br.dict.itop-faq-light.php index bd1b8df01..7d125c0cf 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/pt_br.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/pt_br.dict.itop-faq-light.php @@ -1,15 +1,16 @@ 'FAQ', 'Class:FAQ+' => 'Perguntas frequentes (FAQ)', 'Class:FAQ/Attribute:title' => 'Título', @@ -27,21 +28,21 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:FAQ/Attribute:key_words' => 'Palavras-chaves', 'Class:FAQ/Attribute:key_words+' => '', 'Class:FAQ/Attribute:domains' => 'Domínios', -)); +]); // // Class: FAQCategory // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:FAQCategory' => 'Categorias de FAQ', 'Class:FAQCategory+' => '', 'Class:FAQCategory/Attribute:name' => 'Nome', 'Class:FAQCategory/Attribute:name+' => '', 'Class:FAQCategory/Attribute:faq_list' => 'FAQs', 'Class:FAQCategory/Attribute:faq_list+' => 'Todas as perguntas frequentes associadas à esta categoria', -)); -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +]); +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Menu:ProblemManagement' => 'Gerencimento de problemas', 'Menu:ProblemManagement+' => '', 'Menu:Problem:Shortcuts' => 'Atalhos', @@ -52,4 +53,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Brick:Portal:FAQ:Menu' => 'FAQ', 'Brick:Portal:FAQ:Title' => 'Perguntas frequentes (FAQ)', 'Brick:Portal:FAQ:Title+' => '

          Com pressa?

          Confira a lista de perguntas mais comuns e (talvez) encontre a resposta esperada imediatamente.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/ru.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/ru.dict.itop-faq-light.php index 665d15072..fa4f51731 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/ru.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/ru.dict.itop-faq-light.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:FAQ' => 'FAQ', 'Class:FAQ+' => 'Часто задаваемые вопросы', 'Class:FAQ/Attribute:title' => 'Название', @@ -28,21 +29,21 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:FAQ/Attribute:key_words' => 'Ключевые слова', 'Class:FAQ/Attribute:key_words+' => '', 'Class:FAQ/Attribute:domains' => 'Домены', -)); +]); // // Class: FAQCategory // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:FAQCategory' => 'Категории FAQ', 'Class:FAQCategory+' => 'Категории FAQ', 'Class:FAQCategory/Attribute:name' => 'Название', 'Class:FAQCategory/Attribute:name+' => '', 'Class:FAQCategory/Attribute:faq_list' => 'FAQ', 'Class:FAQCategory/Attribute:faq_list+' => 'Связанные FAQ', -)); -Dict::Add('RU RU', 'Russian', 'Русский', array( +]); +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:ProblemManagement' => 'Управление проблемами', 'Menu:ProblemManagement+' => 'Управление проблемами', 'Menu:Problem:Shortcuts' => 'Ярлыки', @@ -53,4 +54,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Brick:Portal:FAQ:Menu' => 'FAQ', 'Brick:Portal:FAQ:Title' => 'Часто задаваемые вопросы', 'Brick:Portal:FAQ:Title+' => '

          Торопитесь?

          Проверьте список часто задаваемых вопросов, возможно, ответ уже есть.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/sk.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/sk.dict.itop-faq-light.php index 802cd2b76..eb2138a0d 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/sk.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/sk.dict.itop-faq-light.php @@ -1,15 +1,16 @@ 'FAQ~~', 'Class:FAQ+' => 'Frequently asked questions~~', 'Class:FAQ/Attribute:title' => 'Title~~', @@ -27,21 +28,21 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:FAQ/Attribute:key_words' => 'Key words~~', 'Class:FAQ/Attribute:key_words+' => '~~', 'Class:FAQ/Attribute:domains' => 'Domains~~', -)); +]); // // Class: FAQCategory // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:FAQCategory' => 'FAQ Category~~', 'Class:FAQCategory+' => 'Category for FAQ~~', 'Class:FAQCategory/Attribute:name' => 'Name~~', 'Class:FAQCategory/Attribute:name+' => '~~', 'Class:FAQCategory/Attribute:faq_list' => 'FAQs~~', 'Class:FAQCategory/Attribute:faq_list+' => 'All the frequently asked questions related to this category~~', -)); -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +]); +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Menu:ProblemManagement' => 'Problem management~~', 'Menu:ProblemManagement+' => 'Problem management~~', 'Menu:Problem:Shortcuts' => 'Shortcuts~~', @@ -52,4 +53,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Brick:Portal:FAQ:Menu' => 'FAQ~~', 'Brick:Portal:FAQ:Title' => 'Frequently Asked Questions~~', 'Brick:Portal:FAQ:Title+' => '

          In a hurry?

          Check out the list of most common questions and (maybe) find the expected answer right away.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/tr.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/tr.dict.itop-faq-light.php index 2c3ca4b98..04714267f 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/tr.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/tr.dict.itop-faq-light.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:FAQ' => 'SSS', 'Class:FAQ+' => 'Sıkça Sorulan Sorular', 'Class:FAQ/Attribute:title' => 'Başlık', @@ -28,21 +29,21 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:FAQ/Attribute:key_words' => 'Anahtar Kelimeler', 'Class:FAQ/Attribute:key_words+' => '~~', 'Class:FAQ/Attribute:domains' => 'Domains~~', -)); +]); // // Class: FAQCategory // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:FAQCategory' => 'SSS Kategori', 'Class:FAQCategory+' => 'SSS için kategori', 'Class:FAQCategory/Attribute:name' => 'İsim', 'Class:FAQCategory/Attribute:name+' => '~~', 'Class:FAQCategory/Attribute:faq_list' => 'SSS', 'Class:FAQCategory/Attribute:faq_list+' => 'Bu kategoriyle ilgili tüm sık sorulan sorular', -)); -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +]); +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Menu:ProblemManagement' => 'Problem yönetimi', 'Menu:ProblemManagement+' => 'Problem yönetimi', 'Menu:Problem:Shortcuts' => 'Kısayollar', @@ -53,4 +54,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Brick:Portal:FAQ:Menu' => 'SSS', 'Brick:Portal:FAQ:Title' => 'Sıkça Sorulan Sorular', 'Brick:Portal:FAQ:Title+' => '

          In a hurry?

          Check out the list of most common questions and (maybe) find the expected answer right away.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/dictionaries/zh_cn.dict.itop-faq-light.php b/datamodels/2.x/itop-faq-light/dictionaries/zh_cn.dict.itop-faq-light.php index a860cf223..22f187e0f 100644 --- a/datamodels/2.x/itop-faq-light/dictionaries/zh_cn.dict.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/dictionaries/zh_cn.dict.itop-faq-light.php @@ -1,4 +1,5 @@ 'FAQ', 'Class:FAQ+' => '常见问题', 'Class:FAQ/Attribute:title' => '标题', @@ -63,21 +64,21 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:FAQ/Attribute:key_words' => '关键字', 'Class:FAQ/Attribute:key_words+' => '', 'Class:FAQ/Attribute:domains' => '范围', -)); +]); // // Class: FAQCategory // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:FAQCategory' => 'FAQ 类别', 'Class:FAQCategory+' => 'FAQ 类别', 'Class:FAQCategory/Attribute:name' => '名称', 'Class:FAQCategory/Attribute:name+' => '', 'Class:FAQCategory/Attribute:faq_list' => 'FAQ', 'Class:FAQCategory/Attribute:faq_list+' => '此类别 FAQ 相关的所有常见问题', -)); -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +]); +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Menu:ProblemManagement' => '问题管理', 'Menu:ProblemManagement+' => '问题管理', 'Menu:Problem:Shortcuts' => '快捷方式', @@ -88,4 +89,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Brick:Portal:FAQ:Menu' => 'FAQ', 'Brick:Portal:FAQ:Title' => '常见问题', 'Brick:Portal:FAQ:Title+' => '

          需要帮助?

          查阅列表中的常见问题, 或许可以立即找到令您满意的答案.

          ', -)); +]); diff --git a/datamodels/2.x/itop-faq-light/module.itop-faq-light.php b/datamodels/2.x/itop-faq-light/module.itop-faq-light.php index 3278338e5..54870ddb8 100755 --- a/datamodels/2.x/itop-faq-light/module.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/module.itop-faq-light.php @@ -1,10 +1,9 @@ 'Frequently Asked Questions Database', @@ -12,24 +11,24 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-structure/3.0.0 || itop-portal/3.0.0', - ), + ], 'mandatory' => false, 'visible' => true, 'installer' => 'FAQLightInstaller', // Components // - 'datamodel' => array( - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'data.struct' => [ //'data.struct.itop-knownerror-mgmt.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ 'data.sample.faq-domains.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', // No manual installation instructions @@ -37,13 +36,12 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); -if (!class_exists('FAQLightInstaller')) -{ +if (!class_exists('FAQLightInstaller')) { // Module installation handler // class FAQLightInstaller extends ModuleInstallerAPI @@ -62,13 +60,12 @@ if (!class_exists('FAQLightInstaller')) */ public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) { - if (strlen($sPreviousVersion) > 0) - { + if (strlen($sPreviousVersion) > 0) { // If you want to migrate data from one format to another, do it here self::RenameClassInDB('FAQcategory', 'FAQCategory'); } } - + /** * Handler called after the creation/update of the database schema * @param $oConfiguration Config The new configuration of the application diff --git a/datamodels/2.x/itop-files-information/dictionaries/cs.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/cs.dict.itop-files-information.php index d6087e6d5..48be608df 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/cs.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/cs.dict.itop-files-information.php @@ -1,19 +1,18 @@ 'Chybějící soubor: %1$s', 'FilesInformation:Error:CorruptedFile' => 'Soubor %1$s je poškozený', 'FilesInformation:Error:ListCorruptedFile' => 'Poškozené soubory: %1$s', 'FilesInformation:Error:CantWriteToFile' => 'Nelze zapisovat do souboru %1$s', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/da.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/da.dict.itop-files-information.php index 54229d9a6..7ba28a190 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/da.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/da.dict.itop-files-information.php @@ -1,19 +1,18 @@ 'Missing file: %1$s~~', 'FilesInformation:Error:CorruptedFile' => 'File %1$s is corrupted~~', 'FilesInformation:Error:ListCorruptedFile' => 'File(s) corrupted: %1$s ~~', 'FilesInformation:Error:CantWriteToFile' => 'Can not write to file %1$s~~', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/de.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/de.dict.itop-files-information.php index 20255c7c9..86ba9849a 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/de.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/de.dict.itop-files-information.php @@ -1,19 +1,18 @@ 'Fehlende Datei: %1$s', 'FilesInformation:Error:CorruptedFile' => 'Datei %1$s ist beschädigt', 'FilesInformation:Error:ListCorruptedFile' => 'Beschädigte Datei(en): %1$s', 'FilesInformation:Error:CantWriteToFile' => 'Datei %1$s kann nicht geschrieben werden', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/en.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/en.dict.itop-files-information.php index 5595fd0d1..24a93da30 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/en.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/en.dict.itop-files-information.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ // Errors 'FilesInformation:Error:MissingFile' => 'Missing file: %1$s', 'FilesInformation:Error:CorruptedFile' => 'File %1$s is corrupted', 'FilesInformation:Error:ListCorruptedFile' => 'File(s) corrupted: %1$s ', 'FilesInformation:Error:CantWriteToFile' => 'Can not write to file %1$s', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/en_gb.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/en_gb.dict.itop-files-information.php index 2778a5ef1..bf50cc419 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/en_gb.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/en_gb.dict.itop-files-information.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ // Errors 'FilesInformation:Error:MissingFile' => 'Missing file: %1$s', 'FilesInformation:Error:CorruptedFile' => 'File %1$s is corrupted', 'FilesInformation:Error:ListCorruptedFile' => 'File(s) corrupted: %1$s', 'FilesInformation:Error:CantWriteToFile' => 'Can not write to file %1$s', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/es_cr.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/es_cr.dict.itop-files-information.php index ecc4fea09..b330b5ec1 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/es_cr.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/es_cr.dict.itop-files-information.php @@ -1,17 +1,16 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'FilesInformation:Error:MissingFile' => 'Archivo faltante: %1$s', 'FilesInformation:Error:CorruptedFile' => 'El archivo %1$s está corrupto', 'FilesInformation:Error:ListCorruptedFile' => 'Archivo(s) corrupto(s): %1$s', 'FilesInformation:Error:CantWriteToFile' => 'No se puede escribir al archivo %1$s', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/fr.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/fr.dict.itop-files-information.php index ce5acd6dd..87e7b31d7 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/fr.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/fr.dict.itop-files-information.php @@ -1,19 +1,18 @@ 'Ficher manquant : %1$s', 'FilesInformation:Error:CorruptedFile' => 'Le fichier %1$s est corrompu', 'FilesInformation:Error:ListCorruptedFile' => 'Fichier(s) corrompu(s): %1$s', 'FilesInformation:Error:CantWriteToFile' => 'Impossible de modifier le fichier %1$s', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/hu.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/hu.dict.itop-files-information.php index 4ecd2346e..57faa0414 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/hu.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/hu.dict.itop-files-information.php @@ -1,19 +1,18 @@ 'Hiányzó fájl: %1$s', 'FilesInformation:Error:CorruptedFile' => 'A %1$s fájl megsérült', 'FilesInformation:Error:ListCorruptedFile' => 'Sérült fájl(ok): %1$s', 'FilesInformation:Error:CantWriteToFile' => 'A %1$s nem írható', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/it.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/it.dict.itop-files-information.php index 71e9641cb..42e7804ae 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/it.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/it.dict.itop-files-information.php @@ -1,19 +1,18 @@ 'File mancante: %1$s', 'FilesInformation:Error:CorruptedFile' => 'File %1$s corrotto', 'FilesInformation:Error:ListCorruptedFile' => 'File(s) corrotto(i): %1$s', 'FilesInformation:Error:CantWriteToFile' => 'Impossibile scrivere nel file %1$s', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/ja.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/ja.dict.itop-files-information.php index 1797fdf19..4c396b168 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/ja.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/ja.dict.itop-files-information.php @@ -1,19 +1,18 @@ 'Missing file: %1$s~~', 'FilesInformation:Error:CorruptedFile' => 'File %1$s is corrupted~~', 'FilesInformation:Error:ListCorruptedFile' => 'File(s) corrupted: %1$s ~~', 'FilesInformation:Error:CantWriteToFile' => 'Can not write to file %1$s~~', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/nl.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/nl.dict.itop-files-information.php index cc7c3963f..79283a68d 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/nl.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/nl.dict.itop-files-information.php @@ -1,20 +1,19 @@ (2018 - 2022) * @author Thomas Casteleyn */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'FilesInformation:Error:MissingFile' => 'Ontbrekend bestand: %1$s', 'FilesInformation:Error:CorruptedFile' => 'Corrupt bestand: %1$s', 'FilesInformation:Error:ListCorruptedFile' => 'Corrupt(e) bestand(en): %1$s', 'FilesInformation:Error:CantWriteToFile' => 'Kan niet schrijven naar bestand %1$s', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/pl.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/pl.dict.itop-files-information.php index b3a9d459b..52c0094c7 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/pl.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/pl.dict.itop-files-information.php @@ -1,19 +1,18 @@ 'Brakujący plik: %1$s', 'FilesInformation:Error:CorruptedFile' => 'Plik %1$s jest uszkodzony', 'FilesInformation:Error:ListCorruptedFile' => 'Uszkodzone pliki: %1$s', 'FilesInformation:Error:CantWriteToFile' => 'Nie można zapisać do pliku %1$s', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/pt_br.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/pt_br.dict.itop-files-information.php index a27c6a6d8..fe8f2544b 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/pt_br.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/pt_br.dict.itop-files-information.php @@ -1,19 +1,18 @@ 'Arquivo ausente: %1$s', 'FilesInformation:Error:CorruptedFile' => 'Arquivo %1$s está corrompido', 'FilesInformation:Error:ListCorruptedFile' => 'File(s) corrupted: %1$s ~~', 'FilesInformation:Error:CantWriteToFile' => 'Sem permissão de escrita no arquivo %1$s', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/ru.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/ru.dict.itop-files-information.php index 0793f3f23..1fac09eb9 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/ru.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/ru.dict.itop-files-information.php @@ -1,20 +1,19 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'FilesInformation:Error:MissingFile' => 'Файл %1$s отсутствует', 'FilesInformation:Error:CorruptedFile' => 'Файл %1$s повреждён', 'FilesInformation:Error:ListCorruptedFile' => 'File(s) corrupted: %1$s ~~', 'FilesInformation:Error:CantWriteToFile' => 'Невозможно выполнить запись в файл %1$s', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/sk.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/sk.dict.itop-files-information.php index 3c5cba937..a1f2e14bf 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/sk.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/sk.dict.itop-files-information.php @@ -1,19 +1,18 @@ 'Missing file: %1$s~~', 'FilesInformation:Error:CorruptedFile' => 'File %1$s is corrupted~~', 'FilesInformation:Error:ListCorruptedFile' => 'File(s) corrupted: %1$s ~~', 'FilesInformation:Error:CantWriteToFile' => 'Can not write to file %1$s~~', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/tr.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/tr.dict.itop-files-information.php index e76e01f87..83579ead2 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/tr.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/tr.dict.itop-files-information.php @@ -1,19 +1,18 @@ 'Missing file: %1$s~~', 'FilesInformation:Error:CorruptedFile' => 'File %1$s is corrupted~~', 'FilesInformation:Error:ListCorruptedFile' => 'File(s) corrupted: %1$s ~~', 'FilesInformation:Error:CantWriteToFile' => 'Can not write to file %1$s~~', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/dictionaries/zh_cn.dict.itop-files-information.php b/datamodels/2.x/itop-files-information/dictionaries/zh_cn.dict.itop-files-information.php index 9d6092044..2dc15df14 100644 --- a/datamodels/2.x/itop-files-information/dictionaries/zh_cn.dict.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/dictionaries/zh_cn.dict.itop-files-information.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ // Errors 'FilesInformation:Error:MissingFile' => '文件丢失: %1$s', 'FilesInformation:Error:CorruptedFile' => '文件 %1$s 已损坏', 'FilesInformation:Error:ListCorruptedFile' => '已损坏的文件: %1$s', 'FilesInformation:Error:CantWriteToFile' => '文件 %1$s 无法写入', -)); - - +]); diff --git a/datamodels/2.x/itop-files-information/module.itop-files-information.php b/datamodels/2.x/itop-files-information/module.itop-files-information.php index 936fad8d8..2a9768875 100644 --- a/datamodels/2.x/itop-files-information/module.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/module.itop-files-information.php @@ -1,4 +1,5 @@ 'iTop files information', @@ -33,22 +34,22 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - ), + 'dependencies' => [ + ], 'mandatory' => false, 'visible' => false, // Components // - 'datamodel' => array( - 'src/Service/FilesInformation.php', - 'src/Service/FilesInformationException.php', + 'datamodel' => [ + 'src/Service/FilesInformation.php', + 'src/Service/FilesInformationException.php', 'src/Service/FilesInformationUtils.php', 'src/Service/FilesIntegrity.php', - ), - 'webservice' => array(), - 'data.struct' => array(), - 'data.sample' => array(), + ], + 'webservice' => [], + 'data.struct' => [], + 'data.sample' => [], // Documentation // @@ -57,6 +58,6 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array(), - ) + 'settings' => [], + ] ); diff --git a/datamodels/2.x/itop-files-information/src/Service/FilesInformation.php b/datamodels/2.x/itop-files-information/src/Service/FilesInformation.php index 773f47a49..c0d86165a 100644 --- a/datamodels/2.x/itop-files-information/src/Service/FilesInformation.php +++ b/datamodels/2.x/itop-files-information/src/Service/FilesInformation.php @@ -1,20 +1,19 @@ getMessage(); - return 'Warning'; - } + try { + FilesIntegrity::CheckInstallationIntegrity(APPROOT, false); + } catch (FileIntegrityException $e) { + $sMessage = $e->getMessage(); + return 'Warning'; + } - return 'Yes'; - } + return 'Yes'; + } /** * @param string $sRootPath @@ -75,32 +66,27 @@ class FilesInformation * @return bool * @throws \Combodo\iTop\FilesInformation\Service\FileNotExistException */ - private static function CanWriteRecursive($sRootPath = '', &$sMessage = null, $aInstalledFiles = array()) - { - $aDirStats = FilesInformationUtils::Scan($sRootPath, false); - foreach ($aDirStats as $sFileName => $aFileStats) - { - // For name normalization - $sLocalPath = utils::LocalPath(APPROOT.$sRootPath.DIRECTORY_SEPARATOR.$sFileName); - if (($sLocalPath === false) || !isset($aInstalledFiles[$sLocalPath])) - { - continue; - } - if (!self::CanWriteToFile($aFileStats)) - { - $sMessage = Dict::Format('FilesInformation:Error:CantWriteToFile', $sRootPath.DIRECTORY_SEPARATOR.$sFileName); - return false; - } - if (($sFileName != '.') && ($aFileStats['type'] == 'dir')) - { - if (!self::CanWriteRecursive($sRootPath.DIRECTORY_SEPARATOR.$sFileName, $sMessage, $aInstalledFiles)) - { - return false; - } - } - } - return true; - } + private static function CanWriteRecursive($sRootPath = '', &$sMessage = null, $aInstalledFiles = []) + { + $aDirStats = FilesInformationUtils::Scan($sRootPath, false); + foreach ($aDirStats as $sFileName => $aFileStats) { + // For name normalization + $sLocalPath = utils::LocalPath(APPROOT.$sRootPath.DIRECTORY_SEPARATOR.$sFileName); + if (($sLocalPath === false) || !isset($aInstalledFiles[$sLocalPath])) { + continue; + } + if (!self::CanWriteToFile($aFileStats)) { + $sMessage = Dict::Format('FilesInformation:Error:CantWriteToFile', $sRootPath.DIRECTORY_SEPARATOR.$sFileName); + return false; + } + if (($sFileName != '.') && ($aFileStats['type'] == 'dir')) { + if (!self::CanWriteRecursive($sRootPath.DIRECTORY_SEPARATOR.$sFileName, $sMessage, $aInstalledFiles)) { + return false; + } + } + } + return true; + } /** * Check if iTop can write @@ -110,48 +96,45 @@ class FilesInformation * @throws \Combodo\iTop\FilesInformation\Service\FileNotExistException */ public static function IsWritable($sFilename) - { - $aFileStats = FilesInformationUtils::GetFileStat(utils::LocalPath($sFilename)); - return self::CanWriteToFile($aFileStats); - } + { + $aFileStats = FilesInformationUtils::GetFileStat(utils::LocalPath($sFilename)); + return self::CanWriteToFile($aFileStats); + } - private static function CanWriteToFile($aFileStats) - { - if ($aFileStats['writable']) - { - return true; - } - if ($aFileStats['file_owner'] == self::$sItopOwner) - { - // If iTop owns the file, no pb to write - return true; - } - return false; - } + private static function CanWriteToFile($aFileStats) + { + if ($aFileStats['writable']) { + return true; + } + if ($aFileStats['file_owner'] == self::$sItopOwner) { + // If iTop owns the file, no pb to write + return true; + } + return false; + } - /** - * @throws \Combodo\iTop\FilesInformation\Service\FileNotExistException - */ - private static function Init() - { - clearstatcache(); + /** + * @throws \Combodo\iTop\FilesInformation\Service\FileNotExistException + */ + private static function Init() + { + clearstatcache(); - $sSourceConfigFile = MetaModel::GetConfig()->GetLoadedFile(); - $sSourceConfigFile = utils::LocalPath($sSourceConfigFile); + $sSourceConfigFile = MetaModel::GetConfig()->GetLoadedFile(); + $sSourceConfigFile = utils::LocalPath($sSourceConfigFile); - $aConfigFiles = FilesInformationUtils::Scan(dirname($sSourceConfigFile)); - if (!isset($aConfigFiles[basename($sSourceConfigFile)])) - { - return; - } - $aConfigStats = $aConfigFiles[basename($sSourceConfigFile)]; - self::$sItopOwner = $aConfigStats['file_owner']; - } + $aConfigFiles = FilesInformationUtils::Scan(dirname($sSourceConfigFile)); + if (!isset($aConfigFiles[basename($sSourceConfigFile)])) { + return; + } + $aConfigStats = $aConfigFiles[basename($sSourceConfigFile)]; + self::$sItopOwner = $aConfigStats['file_owner']; + } - public static function GetItopDiskSpace() - { - return FilesInformationUtils::GetDirSize(realpath(APPROOT)); - } + public static function GetItopDiskSpace() + { + return FilesInformationUtils::GetDirSize(realpath(APPROOT)); + } /** * @param $sLocalDirPath @@ -160,12 +143,11 @@ class FilesInformation * @throws \Combodo\iTop\FilesInformation\Service\FileNotExistException */ public static function GetDirInfo($sLocalDirPath) - { - if (utils::AbsolutePath($sLocalDirPath) === false) - { - return array(); - } - return FilesInformationUtils::Scan($sLocalDirPath); - } + { + if (utils::AbsolutePath($sLocalDirPath) === false) { + return []; + } + return FilesInformationUtils::Scan($sLocalDirPath); + } } diff --git a/datamodels/2.x/itop-files-information/src/Service/FilesInformationException.php b/datamodels/2.x/itop-files-information/src/Service/FilesInformationException.php index 9c0670bc5..69ac966aa 100644 --- a/datamodels/2.x/itop-files-information/src/Service/FilesInformationException.php +++ b/datamodels/2.x/itop-files-information/src/Service/FilesInformationException.php @@ -1,25 +1,22 @@ 'socket', - 0120000=>'link', - 0100000=>'file', - 0060000=>'block', - 0040000=>'dir', - 0020000=>'char', - 0010000=>'fifo' - ); - $iRawMode = $aStats['mode']; - $iMode = decoct($iRawMode & 0170000); // File Encoding Bit + $aTypes = [ + 0140000 => 'socket', + 0120000 => 'link', + 0100000 => 'file', + 0060000 => 'block', + 0040000 => 'dir', + 0020000 => 'char', + 0010000 => 'fifo', + ]; + $iRawMode = $aStats['mode']; + $iMode = decoct($iRawMode & 0170000); // File Encoding Bit - $sDisplayMode =(array_key_exists(octdec($iMode),$aTypes))?$aTypes[octdec($iMode)][0]:'u'; - $sDisplayMode.=(($iRawMode&0x0100)?'r':'-').(($iRawMode&0x0080)?'w':'-'); - $sDisplayMode.=(($iRawMode&0x0040)?(($iRawMode&0x0800)?'s':'x'):(($iRawMode&0x0800)?'S':'-')); - $sDisplayMode.=(($iRawMode&0x0020)?'r':'-').(($iRawMode&0x0010)?'w':'-'); - $sDisplayMode.=(($iRawMode&0x0008)?(($iRawMode&0x0400)?'s':'x'):(($iRawMode&0x0400)?'S':'-')); - $sDisplayMode.=(($iRawMode&0x0004)?'r':'-').(($iRawMode&0x0002)?'w':'-'); - $sDisplayMode.=(($iRawMode&0x0001)?(($iRawMode&0x0200)?'t':'x'):(($iRawMode&0x0200)?'T':'-')); + $sDisplayMode = (array_key_exists(octdec($iMode), $aTypes)) ? $aTypes[octdec($iMode)][0] : 'u'; + $sDisplayMode .= (($iRawMode & 0x0100) ? 'r' : '-').(($iRawMode & 0x0080) ? 'w' : '-'); + $sDisplayMode .= (($iRawMode & 0x0040) ? (($iRawMode & 0x0800) ? 's' : 'x') : (($iRawMode & 0x0800) ? 'S' : '-')); + $sDisplayMode .= (($iRawMode & 0x0020) ? 'r' : '-').(($iRawMode & 0x0010) ? 'w' : '-'); + $sDisplayMode .= (($iRawMode & 0x0008) ? (($iRawMode & 0x0400) ? 's' : 'x') : (($iRawMode & 0x0400) ? 'S' : '-')); + $sDisplayMode .= (($iRawMode & 0x0004) ? 'r' : '-').(($iRawMode & 0x0002) ? 'w' : '-'); + $sDisplayMode .= (($iRawMode & 0x0001) ? (($iRawMode & 0x0200) ? 't' : 'x') : (($iRawMode & 0x0200) ? 'T' : '-')); - $aFileStats['display_mode'] = $sDisplayMode; - $aFileStats['type'] = $aTypes[octdec($iMode)]; - $aFileStats['readable'] = is_readable($sFile); - $aFileStats['writable'] = is_writable($sFile); - $aFileStats['file_owner'] = $aStats['uid']; - $aFileStats['file_group'] = $aStats['gid']; - if (function_exists('posix_getpwuid')) - { - $aPwUid = @posix_getpwuid($aStats['uid']); - if (isset($aPwUid['name'])) - { - $aFileStats['owner_name'] = $aPwUid['name']; - } - } - if (empty($aFileStats['owner_name'])) - { - $aFileStats['owner_name'] = ''; - } - if (function_exists('posix_getgrgid')) - { - $aGrGid = @posix_getgrgid($aStats['gid']); - if (isset($aGrGid['name'])) - { - $aFileStats['group_name'] = $aGrGid['name']; - } - } - if (empty($aFileStats['group_name'])) - { - $aFileStats['group_name'] = ''; - } - $aFileStats['mtime'] = date('Y-m-d H:i:s', $aStats['mtime']); - $aFileStats['ctime'] = date('Y-m-d H:i:s', $aStats['ctime']); + $aFileStats['display_mode'] = $sDisplayMode; + $aFileStats['type'] = $aTypes[octdec($iMode)]; + $aFileStats['readable'] = is_readable($sFile); + $aFileStats['writable'] = is_writable($sFile); + $aFileStats['file_owner'] = $aStats['uid']; + $aFileStats['file_group'] = $aStats['gid']; + if (function_exists('posix_getpwuid')) { + $aPwUid = @posix_getpwuid($aStats['uid']); + if (isset($aPwUid['name'])) { + $aFileStats['owner_name'] = $aPwUid['name']; + } + } + if (empty($aFileStats['owner_name'])) { + $aFileStats['owner_name'] = ''; + } + if (function_exists('posix_getgrgid')) { + $aGrGid = @posix_getgrgid($aStats['gid']); + if (isset($aGrGid['name'])) { + $aFileStats['group_name'] = $aGrGid['name']; + } + } + if (empty($aFileStats['group_name'])) { + $aFileStats['group_name'] = ''; + } + $aFileStats['mtime'] = date('Y-m-d H:i:s', $aStats['mtime']); + $aFileStats['ctime'] = date('Y-m-d H:i:s', $aStats['ctime']); - return $aFileStats; - } + return $aFileStats; + } - /** - * @param string $sPath relative iTop path - * - * @return string absolute path - * @throws \Combodo\iTop\FilesInformation\Service\FileNotExistException - */ - public static function GetAbsolutePath($sPath) - { - $sRootPath = realpath(APPROOT); - $sFullPath = realpath($sRootPath.DIRECTORY_SEPARATOR.$sPath); - if (($sFullPath === false) || !utils::StartsWith($sFullPath, $sRootPath)) - { - throw new FileNotExistException($sPath); - } - return $sFullPath; - } + /** + * @param string $sPath relative iTop path + * + * @return string absolute path + * @throws \Combodo\iTop\FilesInformation\Service\FileNotExistException + */ + public static function GetAbsolutePath($sPath) + { + $sRootPath = realpath(APPROOT); + $sFullPath = realpath($sRootPath.DIRECTORY_SEPARATOR.$sPath); + if (($sFullPath === false) || !utils::StartsWith($sFullPath, $sRootPath)) { + throw new FileNotExistException($sPath); + } + return $sFullPath; + } - public static function GetDirSize($sRealRootPath) - { - $aFiles = scandir($sRealRootPath); - $iSize = 0; - foreach ($aFiles as $sScanFile) - { - if (($sScanFile == '.') || ($sScanFile == '..')) - { - continue; - } - $sFile = $sRealRootPath.DIRECTORY_SEPARATOR.$sScanFile; - if (is_dir($sFile)) - { - $iSize += self::GetDirSize($sFile); - } - else - { - $aStats = @stat($sFile); - if (is_array($aStats)) { - $iSize += $aStats['size']; - } - } - } - return $iSize; - } + public static function GetDirSize($sRealRootPath) + { + $aFiles = scandir($sRealRootPath); + $iSize = 0; + foreach ($aFiles as $sScanFile) { + if (($sScanFile == '.') || ($sScanFile == '..')) { + continue; + } + $sFile = $sRealRootPath.DIRECTORY_SEPARATOR.$sScanFile; + if (is_dir($sFile)) { + $iSize += self::GetDirSize($sFile); + } else { + $aStats = @stat($sFile); + if (is_array($aStats)) { + $iSize += $aStats['size']; + } + } + } + return $iSize; + } } diff --git a/datamodels/2.x/itop-files-information/src/Service/FilesIntegrity.php b/datamodels/2.x/itop-files-information/src/Service/FilesIntegrity.php index dfb04438b..b45360c51 100644 --- a/datamodels/2.x/itop-files-information/src/Service/FilesIntegrity.php +++ b/datamodels/2.x/itop-files-information/src/Service/FilesIntegrity.php @@ -1,13 +1,12 @@ load($sManifest); $oXPath = new DOMXPath($oManifestDocument); $oNodeList = $oXPath->query('/files'); - if ($oNodeList->length == 0) - { + if ($oNodeList->length == 0) { // no files return false; } - foreach ($oNodeList as $oItems) - { - foreach ($oItems->childNodes as $oFileNode) - { - if (($oFileNode instanceof DOMNode)) - { - if ($oFileNode->hasChildNodes()) - { - $aFileInfo = array(); + foreach ($oNodeList as $oItems) { + foreach ($oItems->childNodes as $oFileNode) { + if (($oFileNode instanceof DOMNode)) { + if ($oFileNode->hasChildNodes()) { + $aFileInfo = []; $sFilePath = uniqid(); // just in case no path... - foreach ($oFileNode->childNodes as $oFileInfo) - { - if ($oFileInfo instanceof DOMElement) - { + foreach ($oFileNode->childNodes as $oFileInfo) { + if ($oFileInfo instanceof DOMElement) { $aFileInfo[$oFileInfo->tagName] = $oFileInfo->textContent; - if ($oFileInfo->tagName == 'path') - { + if ($oFileInfo->tagName == 'path') { $sFilePath = $oFileInfo->textContent; } } @@ -88,51 +77,44 @@ class FilesIntegrity { $aFilesInfo = FilesIntegrity::GetInstalledFiles($sRootPath.'manifest.xml'); - if ($aFilesInfo === false) - { + if ($aFilesInfo === false) { throw new FileIntegrityException(Dict::Format('FilesInformation:Error:MissingFile', 'manifest.xml')); } $bHasErrors = false; - $sErrorFiles =""; + $sErrorFiles = ""; @clearstatcache(); - foreach ($aFilesInfo as $aFileInfo) - { + foreach ($aFilesInfo as $aFileInfo) { $sFile = $sRootPath.$aFileInfo['path']; - if (is_file($sFile)) - { + if (is_file($sFile)) { $aStats = @stat($sFile); $iSize = $aStats['size']; $sContent = file_get_contents($sFile); $sChecksum = md5($sContent); - if (($iSize != $aFileInfo['size']) || ($sChecksum != $aFileInfo['md5'])) - { - if($bExitAtFirstError) { + if (($iSize != $aFileInfo['size']) || ($sChecksum != $aFileInfo['md5'])) { + if ($bExitAtFirstError) { throw new FileIntegrityException(Dict::Format('FilesInformation:Error:CorruptedFile', $sFile)); } else { $bHasErrors = true; - $sErrorFiles .='
        • '.$aFileInfo['path'].'
        • '; + $sErrorFiles .= '
        • '.$aFileInfo['path'].'
        • '; } } } // Packed with missing files... } - if($bHasErrors){ - throw new FileIntegrityException(Dict::Format('FilesInformation:Error:ListCorruptedFile','
            '.$sErrorFiles.'
          ')); + if ($bHasErrors) { + throw new FileIntegrityException(Dict::Format('FilesInformation:Error:ListCorruptedFile', '
            '.$sErrorFiles.'
          ')); } } public static function IsInstallationConform($sRootPath, &$sErrorMsg) { $sErrorMsg = ''; - try - { + try { self::CheckInstallationIntegrity($sRootPath); return true; - } - catch (FileIntegrityException $e) - { + } catch (FileIntegrityException $e) { $sErrorMsg = $e->getMessage(); } return false; diff --git a/datamodels/2.x/itop-full-itil/module.itop-full-itil.php b/datamodels/2.x/itop-full-itil/module.itop-full-itil.php index 1df0822cd..f10d8d715 100644 --- a/datamodels/2.x/itop-full-itil/module.itop-full-itil.php +++ b/datamodels/2.x/itop-full-itil/module.itop-full-itil.php @@ -7,35 +7,35 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file 'itop-full-itil/3.2.1', - array( + [ // Identification // 'label' => 'Bridge - Request management ITIL + Incident management ITIL', 'category' => 'business', // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-request-mgmt-itil/2.3.0', 'itop-incident-mgmt-itil/2.3.0', - ), + ], 'mandatory' => false, 'visible' => false, 'auto_select' => 'SetupInfo::ModuleIsSelected("itop-request-mgmt-itil") && SetupInfo::ModuleIsSelected("itop-incident-mgmt-itil")', // Components // - 'datamodel' => array(), - 'webservice' => array(), - 'data.struct' => array(// add your 'structure' definition XML files here, - ), - 'data.sample' => array(// add your sample data XML files here, - ), + 'datamodel' => [], + 'webservice' => [], + 'data.struct' => [// add your 'structure' definition XML files here, + ], + 'data.sample' => [// add your sample data XML files here, + ], // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array(// Module specific settings go here, if any - ), - ) + 'settings' => [// Module specific settings go here, if any + ], + ] ); diff --git a/datamodels/2.x/itop-hub-connector/TokenValidation.php b/datamodels/2.x/itop-hub-connector/TokenValidation.php index 6a30079cf..950a47771 100644 --- a/datamodels/2.x/itop-hub-connector/TokenValidation.php +++ b/datamodels/2.x/itop-hub-connector/TokenValidation.php @@ -6,7 +6,7 @@ class TokenValidation public function __construct() { } - public function isSetupTokenValid($sParamToken) : bool + public function isSetupTokenValid($sParamToken): bool { if (!file_exists(APPROOT.'data/.setup')) { return false; @@ -16,4 +16,4 @@ class TokenValidation return $sParamToken === $sSetupToken; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-hub-connector/ajax.php b/datamodels/2.x/itop-hub-connector/ajax.php index 415c0d710..0f8d0e0b4 100644 --- a/datamodels/2.x/itop-hub-connector/ajax.php +++ b/datamodels/2.x/itop-hub-connector/ajax.php @@ -1,4 +1,5 @@ SetMySQLBinDir(MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'mysql_bindir', '')); $sSourceConfigFile = APPCONF.utils::GetCurrentEnvironment().'/'.ITOP_CONFIG_FILE; - + $oMutex = new iTopMutex('backup.'.utils::GetCurrentEnvironment()); $oMutex->Lock(); - try - { + try { $oBackup->CreateCompressedBackup($sTargetFile, $sSourceConfigFile); - } - catch (Exception $e) - { + } catch (Exception $e) { $oMutex->Unlock(); throw $e; } @@ -101,22 +98,22 @@ function DoBackup($sTargetFile) /** * Outputs the status of the current ajax execution (as a JSON structure) - * + * * @param string $sMessage * @param bool $bSuccess * @param number $iErrorCode * @param array $aMoreFields * Extra fields to pass to the caller, if needed */ -function ReportStatus($sMessage, $bSuccess, $iErrorCode = 0, $aMoreFields = array()) +function ReportStatus($sMessage, $bSuccess, $iErrorCode = 0, $aMoreFields = []) { // Do not use AjaxPage during setup phases, because it uses InterfaceDiscovery in Twig compilation $oPage = new JsonPage(); - $aResult = array( + $aResult = [ 'code' => $iErrorCode, 'message' => $sMessage, - 'fields' => $aMoreFields - ); + 'fields' => $aMoreFields, + ]; $oPage->SetData($aResult); $oPage->SetOutputDataOnly(true); $oPage->output(); @@ -124,154 +121,137 @@ function ReportStatus($sMessage, $bSuccess, $iErrorCode = 0, $aMoreFields = arra /** * Helper to output the status of a successful execution - * + * * @param string $sMessage * @param array $aMoreFields * Extra fields to pass to the caller, if needed */ -function ReportSuccess($sMessage, $aMoreFields = array()) +function ReportSuccess($sMessage, $aMoreFields = []) { ReportStatus($sMessage, true, 0, $aMoreFields); } /** * Helper to output the status of a failed execution - * + * * @param string $sMessage * @param number $iErrorCode * @param array $aMoreFields * Extra fields to pass to the caller, if needed */ -function ReportError($sMessage, $iErrorCode, $aMoreFields = array()) +function ReportError($sMessage, $iErrorCode, $aMoreFields = []) { - if ($iErrorCode==0) - { + if ($iErrorCode == 0) { // 0 means no error, so change it if no meaningful error code is supplied $iErrorCode = -1; } ReportStatus($sMessage, false, $iErrorCode, $aMoreFields); } -try -{ +try { SetupUtils::ExitMaintenanceMode(false); // Reset maintenance mode in case of problem utils::PushArchiveMode(false); - + ini_set('max_execution_time', max(3600, ini_get('max_execution_time'))); // Under Windows SQL/backup operations are part of the PHP timeout and require extra time ini_set('display_errors', 1); // Make sure that fatal errors remain visible from the end-user - + // Most of the ajax calls are done without the MetaModel being loaded - // Therefore, the language must be passed as an argument, - // and the dictionnaries be loaded here + // Therefore, the language must be passed as an argument, + // and the dictionnaries be loaded here $sLanguage = utils::ReadParam('language', ''); - if ($sLanguage!='') - { - foreach (glob(APPROOT.'env-production/dictionaries/*.dict.php') as $sFilePath) - { - require_once ($sFilePath); + if ($sLanguage != '') { + foreach (glob(APPROOT.'env-production/dictionaries/*.dict.php') as $sFilePath) { + require_once($sFilePath); } - + $aLanguages = Dict::GetLanguages(); - if (array_key_exists($sLanguage, $aLanguages)) - { + if (array_key_exists($sLanguage, $aLanguages)) { Dict::SetUserLanguage($sLanguage); } } $sOperation = utils::ReadParam('operation', ''); - switch ($sOperation) - { + switch ($sOperation) { case 'check_before_backup': - require_once (APPROOT.'/application/startup.inc.php'); - require_once (APPROOT.'/application/loginwebpage.class.inc.php'); + require_once(APPROOT.'/application/startup.inc.php'); + require_once(APPROOT.'/application/loginwebpage.class.inc.php'); LoginWebPage::DoLogin(true); // Check user rights and prompt if needed (must be admin) $sDBBackupPath = APPROOT.'data/backups/manual'; $aChecks = SetupUtils::CheckBackupPrerequisites($sDBBackupPath); $bFailed = false; - foreach ($aChecks as $oCheckResult) - { - if ($oCheckResult->iSeverity==CheckResult::ERROR) - { + foreach ($aChecks as $oCheckResult) { + if ($oCheckResult->iSeverity == CheckResult::ERROR) { $bFailed = true; ReportError($oCheckResult->sLabel, -2); } } - if (!$bFailed) - { + if (!$bFailed) { // Continue the checks $fFreeSpace = SetupUtils::CheckDiskSpace($sDBBackupPath); - if ($fFreeSpace!==false) - { + if ($fFreeSpace !== false) { $sMessage = Dict::Format('iTopHub:BackupFreeDiskSpaceIn', SetupUtils::HumanReadableSize($fFreeSpace), dirname($sDBBackupPath)); ReportSuccess($sMessage); - } - else - { + } else { ReportError(Dict::S('iTopHub:FailedToCheckFreeDiskSpace'), -1); } } - break; - + break; + case 'do_backup': - require_once (APPROOT.'/application/startup.inc.php'); - require_once (APPROOT.'/application/loginwebpage.class.inc.php'); + require_once(APPROOT.'/application/startup.inc.php'); + require_once(APPROOT.'/application/loginwebpage.class.inc.php'); LoginWebPage::DoLogin(true); // Check user rights and prompt if needed (must be admin) - try - { - if (MetaModel::GetConfig()->Get('demo_mode')) throw new Exception('Sorry the installation of extensions is not allowed in demo mode'); + try { + if (MetaModel::GetConfig()->Get('demo_mode')) { + throw new Exception('Sorry the installation of extensions is not allowed in demo mode'); + } SetupLog::Info('Backup starts...'); set_time_limit(0); $sBackupPath = APPROOT.'/data/backups/manual/backup-'; $iSuffix = 1; $sSuffix = ''; // Generate a unique name... - do - { + do { $sBackupFile = $sBackupPath.date('Y-m-d-His').$sSuffix; $sSuffix = '-'.$iSuffix; $iSuffix++ ; - } - while (file_exists($sBackupFile)); + } while (file_exists($sBackupFile)); $oBackup = DoBackup($sBackupFile); $aErrors = $oBackup->GetErrors(); - if (count($aErrors)>0) - { + if (count($aErrors) > 0) { SetupLog::Error('Backup failed.'); SetupLog::Error(implode("\n", $aErrors)); - ReportError(Dict::S('iTopHub:BackupFailed'), -1, $aErrors); - } - else - { + ReportError(Dict::S('iTopHub:BackupFailed'), -1, $aErrors); + } else { SetupLog::Info('Backup successfully completed.'); ReportSuccess(Dict::S('iTopHub:BackupOk')); } - } - catch (Exception $e) - { + } catch (Exception $e) { SetupLog::Error($e->getMessage()); ReportError($e->getMessage(), $e->getCode()); } - break; - + break; + case 'compile': SetupLog::Info('Deployment starts...'); $sAuthent = utils::ReadParam('authent', '', false, 'raw_data'); - if (!file_exists(APPROOT.'data/hub/compile_authent') || $sAuthent !== file_get_contents(APPROOT.'data/hub/compile_authent')) - { - throw new SecurityException(Dict::S('iTopHub:FailAuthent')); + if (!file_exists(APPROOT.'data/hub/compile_authent') || $sAuthent !== file_get_contents(APPROOT.'data/hub/compile_authent')) { + throw new SecurityException(Dict::S('iTopHub:FailAuthent')); } // First step: prepare the datamodel, if it fails, roll-back - $aSelectedExtensionCodes = utils::ReadParam('extension_codes', array()); - $aSelectedExtensionDirs = utils::ReadParam('extension_dirs', array()); + $aSelectedExtensionCodes = utils::ReadParam('extension_codes', []); + $aSelectedExtensionDirs = utils::ReadParam('extension_dirs', []); $oRuntimeEnv = new HubRunTimeEnvironment('production', false); // use a temp environment: production-build $oRuntimeEnv->MoveSelectedExtensions(APPROOT.'/data/downloaded-extensions/', $aSelectedExtensionDirs); $oConfig = new Config(APPCONF.'production/'.ITOP_CONFIG_FILE); - if ($oConfig->Get('demo_mode')) throw new Exception('Sorry the installation of extensions is not allowed in demo mode'); + if ($oConfig->Get('demo_mode')) { + throw new Exception('Sorry the installation of extensions is not allowed in demo mode'); + } $aSelectModules = $oRuntimeEnv->CompileFrom('production', false); // WARNING symlinks does not seem to be compatible with manual Commit @@ -289,21 +269,19 @@ try $oRuntimeEnv->Commit(); // Report the success in a way that will be detected by the ajax caller - SetupLog::Info('Compilation completed...'); + SetupLog::Info('Compilation completed...'); ReportSuccess('Ok'); // No access to Dict::S here - break; - + break; + case 'move_to_production': // Second step: update the schema and the data // Everything happening below is based on env-production $oRuntimeEnv = new RunTimeEnvironment('production', true); - try - { + try { SetupLog::Info('Move to production starts...'); - $sAuthent = utils::ReadParam('authent', '', false, 'raw_data'); - if (!file_exists(APPROOT.'data/hub/compile_authent') || $sAuthent !== file_get_contents(APPROOT.'data/hub/compile_authent')) - { + $sAuthent = utils::ReadParam('authent', '', false, 'raw_data'); + if (!file_exists(APPROOT.'data/hub/compile_authent') || $sAuthent !== file_get_contents(APPROOT.'data/hub/compile_authent')) { throw new SecurityException(Dict::S('iTopHub:FailAuthent')); } unlink(APPROOT.'data/hub/compile_authent'); @@ -315,15 +293,11 @@ try $aAvailableModules = $oRuntimeEnv->AnalyzeInstallation($oConfig, $oRuntimeEnv->GetBuildDir(), true); - $aSelectedModules = array(); - foreach ($aAvailableModules as $sModuleId => $aModule) - { - if (($sModuleId == ROOT_MODULE) || ($sModuleId == DATAMODEL_MODULE)) - { + $aSelectedModules = []; + foreach ($aAvailableModules as $sModuleId => $aModule) { + if (($sModuleId == ROOT_MODULE) || ($sModuleId == DATAMODEL_MODULE)) { continue; - } - else - { + } else { $aSelectedModules[] = $sModuleId; } } @@ -349,17 +323,14 @@ try // Default choices = as before $oExtensionsMap->LoadChoicesFromDatabase($oConfig); - foreach ($oExtensionsMap->GetAllExtensions() as $oExtension) - { + foreach ($oExtensionsMap->GetAllExtensions() as $oExtension) { // Plus all "remote" extensions - if ($oExtension->sSource==iTopExtension::SOURCE_REMOTE) - { + if ($oExtension->sSource == iTopExtension::SOURCE_REMOTE) { $oExtensionsMap->MarkAsChosen($oExtension->sCode); } } - $aSelectedExtensionCodes = array(); - foreach ($oExtensionsMap->GetChoices() as $oExtension) - { + $aSelectedExtensionCodes = []; + foreach ($oExtensionsMap->GetChoices() as $oExtension) { $aSelectedExtensionCodes[] = $oExtension->sCode; } $aSelectedExtensions = $oExtensionsMap->GetChoices(); @@ -368,34 +339,27 @@ try // Report the success in a way that will be detected by the ajax caller SetupLog::Info('Deployment successfully completed.'); ReportSuccess(Dict::S('iTopHub:CompiledOK')); - } - catch (Exception $e) - { - if(file_exists(APPROOT.'data/hub/compile_authent')) - { + } catch (Exception $e) { + if (file_exists(APPROOT.'data/hub/compile_authent')) { unlink(APPROOT.'data/hub/compile_authent'); } // Note: at this point, the dictionnary is not necessarily loaded SetupLog::Error(get_class($e).': '.Dict::S('iTopHub:ConfigurationSafelyReverted')."\n".$e->getMessage()); SetupLog::Error('Debug trace: '.$e->getTraceAsString()); ReportError($e->getMessage(), $e->getCode()); - } - finally - { + } finally { SetupUtils::ExitReadOnlyMode(); } - break; - + break; + default: ReportError("Invalid operation: '$sOperation'", -1); } -} -catch (Exception $e) -{ +} catch (Exception $e) { SetupLog::Error(get_class($e).': '.Dict::S('iTopHub:ConfigurationSafelyReverted')."\n".$e->getMessage()); SetupLog::Error('Debug trace: '.$e->getTraceAsString()); - + utils::PopArchiveMode(); - + ReportError($e->getMessage(), $e->getCode()); } diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/cs.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/cs.dict.itop-hub-connector.php index ee2afc836..7aea723da 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/cs.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/cs.dict.itop-hub-connector.php @@ -1,15 +1,16 @@ 'iTop Hub~~', 'Menu:iTopHub:Register' => 'Připojit k iTop Hubu', 'Menu:iTopHub:Register+' => 'Go to iTop Hub to update your '.ITOP_APPLICATION_SHORT.' instance~~', @@ -64,6 +65,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s verze: %2$s.', 'iTopHub:InstallationStatus:Installed' => 'Installed~~', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Verze %1$s Není instalována.', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/da.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/da.dict.itop-hub-connector.php index 70f952278..693b402e7 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/da.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/da.dict.itop-hub-connector.php @@ -1,15 +1,16 @@ 'iTop Hub~~', 'Menu:iTopHub:Register' => 'Connect to iTop Hub~~', 'Menu:iTopHub:Register+' => 'Go to iTop Hub to update your '.ITOP_APPLICATION_SHORT.' instance~~', @@ -64,6 +65,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s version: %2$s.~~', 'iTopHub:InstallationStatus:Installed' => 'Installed~~', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Version %1$s NOT installed.~~', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/de.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/de.dict.itop-hub-connector.php index 1f1a34ef1..20e2d7f6c 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/de.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/de.dict.itop-hub-connector.php @@ -1,15 +1,16 @@ 'iTop Hub', 'Menu:iTopHub:Register' => 'Mit dem iTop Hub verbinden', 'Menu:iTopHub:Register+' => ITOP_APPLICATION_SHORT.'-Instanzen über den iTop Hub updaten', @@ -64,6 +65,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s Version: %2$s.', 'iTopHub:InstallationStatus:Installed' => 'Installiert', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Version %1$s NICHT installiert.', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/en.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/en.dict.itop-hub-connector.php index 89476440a..a1394be6a 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/en.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/en.dict.itop-hub-connector.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ // Dictionary entries go here 'Menu:iTopHub' => 'iTop Hub', 'Menu:iTopHub:Register' => 'Connect to iTop Hub', @@ -82,6 +83,4 @@ Dict::Add('EN US', 'English', 'English', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s version: %2$s.', 'iTopHub:InstallationStatus:Installed' => 'Installed', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Version %1$s NOT installed.', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/en_gb.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/en_gb.dict.itop-hub-connector.php index 4bf8d19bd..964270992 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/en_gb.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/en_gb.dict.itop-hub-connector.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ // Dictionary entries go here 'Menu:iTopHub' => 'iTop Hub', 'Menu:iTopHub:Register' => 'Connect to iTop Hub', @@ -82,6 +83,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s version: %2$s.', 'iTopHub:InstallationStatus:Installed' => 'Installed', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Version %1$s NOT installed.', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/es_cr.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/es_cr.dict.itop-hub-connector.php index f20da88df..0e9bf5c24 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/es_cr.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/es_cr.dict.itop-hub-connector.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:iTopHub' => 'iTop Hub', 'Menu:iTopHub:Register' => 'Conectar a iTop Hub', 'Menu:iTopHub:Register+' => 'Ir a iTop Hub para actualizar su instancia de '.ITOP_APPLICATION_SHORT, @@ -62,6 +63,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s versión: %2$s.', 'iTopHub:InstallationStatus:Installed' => 'Instalada', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Versión %1$s NO está instalada.', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/fr.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/fr.dict.itop-hub-connector.php index 6e37c9299..95bf943fc 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/fr.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/fr.dict.itop-hub-connector.php @@ -1,15 +1,16 @@ 'iTop Hub', 'Menu:iTopHub:Register' => 'Se connecter à iTop Hub', 'Menu:iTopHub:Register+' => 'Connectez-vous à iTop Hub pour enregistrer cette instance d\''.ITOP_APPLICATION_SHORT, @@ -64,6 +65,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s version: %2$s.', 'iTopHub:InstallationStatus:Installed' => 'Installée', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Version %1$s NON installée.', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/hu.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/hu.dict.itop-hub-connector.php index 51a5d95eb..6ff3ece1a 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/hu.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/hu.dict.itop-hub-connector.php @@ -1,15 +1,16 @@ 'iTop Hub', 'Menu:iTopHub:Register' => 'Kapcsolódás az iTop Hub-ra', 'Menu:iTopHub:Register+' => 'Továbblépés az iTop Hub-ra a '.ITOP_APPLICATION_SHORT.' példányának frissítéséhez', @@ -64,6 +65,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s verzió: %2$s.', 'iTopHub:InstallationStatus:Installed' => 'Telepítve', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'A %1$s verzió NINCS telepítve.', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/it.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/it.dict.itop-hub-connector.php index c459ae1aa..fb7839db8 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/it.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/it.dict.itop-hub-connector.php @@ -1,15 +1,16 @@ 'iTop Hub', 'Menu:iTopHub:Register' => 'Connetti a iTop Hub', 'Menu:iTopHub:Register+' => 'Vai a iTop Hub per aggiornare la tua istanza di '.ITOP_APPLICATION_SHORT, @@ -64,6 +65,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'iTopHub:InstallationStatus:Installed_Version' => 'Versione %1$s di %2$s installata.', 'iTopHub:InstallationStatus:Installed' => 'Installata', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Versione %1$s NON installata.', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/ja.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/ja.dict.itop-hub-connector.php index 55ce12d11..c48970f29 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/ja.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/ja.dict.itop-hub-connector.php @@ -1,15 +1,16 @@ 'iTop Hub~~', 'Menu:iTopHub:Register' => 'Connect to iTop Hub~~', 'Menu:iTopHub:Register+' => 'Go to iTop Hub to update your '.ITOP_APPLICATION_SHORT.' instance~~', @@ -64,6 +65,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s version: %2$s.~~', 'iTopHub:InstallationStatus:Installed' => 'Installed~~', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Version %1$s NOT installed.~~', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/nl.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/nl.dict.itop-hub-connector.php index 25014f6f8..227c8f6fa 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/nl.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/nl.dict.itop-hub-connector.php @@ -1,16 +1,17 @@ (2018 - 2022) * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:iTopHub' => 'iTop Hub', 'Menu:iTopHub:Register' => 'Verbinding maken met iTop Hub', 'Menu:iTopHub:Register+' => 'Ga naar de iTop Hub om je iTop bij te werken.', @@ -65,6 +66,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s versie: %2$s.', 'iTopHub:InstallationStatus:Installed' => 'Geïnstalleerd', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Versie %1$s is NIET geïnstalleerd.', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/pl.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/pl.dict.itop-hub-connector.php index 808ba8b28..b74cd4e87 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/pl.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/pl.dict.itop-hub-connector.php @@ -1,15 +1,16 @@ 'iTop Hub', 'Menu:iTopHub:Register' => 'Połącz się z iTop Hub', 'Menu:iTopHub:Register+' => 'Przejdź do iTop Hub, aby zaktualizować swoją instancję '.ITOP_APPLICATION_SHORT, @@ -64,6 +65,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s wersja: %2$s.', 'iTopHub:InstallationStatus:Installed' => 'Zainstalowana', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Wersja %1$s NIE zainstalowana.', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/pt_br.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/pt_br.dict.itop-hub-connector.php index acf4f97a0..80d7db582 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/pt_br.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/pt_br.dict.itop-hub-connector.php @@ -1,15 +1,16 @@ 'iTop Hub', 'Menu:iTopHub:Register' => 'Conectar ao iTop Hub', 'Menu:iTopHub:Register+' => 'Vá para o iTop Hub para atualizar sua instância '.ITOP_APPLICATION_SHORT, @@ -64,6 +65,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s versão: %2$s', 'iTopHub:InstallationStatus:Installed' => 'Instalado', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Versão %1$s NÃO instalada', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/ru.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/ru.dict.itop-hub-connector.php index 90221d642..a7ef34c80 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/ru.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/ru.dict.itop-hub-connector.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:iTopHub' => 'iTop Hub', 'Menu:iTopHub:Register' => 'Подключение к iTop Hub', 'Menu:iTopHub:Register+' => 'Перейдите в iTop Hub, чтобы обновить ваш экземпляр '.ITOP_APPLICATION_SHORT, @@ -65,6 +66,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s version: %2$s.~~', 'iTopHub:InstallationStatus:Installed' => 'Installed~~', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Version %1$s NOT installed.~~', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/sk.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/sk.dict.itop-hub-connector.php index 28321dc29..13a281734 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/sk.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/sk.dict.itop-hub-connector.php @@ -1,15 +1,16 @@ 'iTop Hub~~', 'Menu:iTopHub:Register' => 'Connect to iTop Hub~~', 'Menu:iTopHub:Register+' => 'Go to iTop Hub to update your '.ITOP_APPLICATION_SHORT.' instance~~', @@ -64,6 +65,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s version: %2$s.~~', 'iTopHub:InstallationStatus:Installed' => 'Installed~~', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Version %1$s NOT installed.~~', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/tr.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/tr.dict.itop-hub-connector.php index a8b2b6e03..9b2d786f8 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/tr.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/tr.dict.itop-hub-connector.php @@ -1,15 +1,16 @@ 'iTop Hub~~', 'Menu:iTopHub:Register' => 'Connect to iTop Hub~~', 'Menu:iTopHub:Register+' => 'Go to iTop Hub to update your '.ITOP_APPLICATION_SHORT.' instance~~', @@ -64,6 +65,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s version: %2$s.~~', 'iTopHub:InstallationStatus:Installed' => 'Installed~~', 'iTopHub:InstallationStatus:Version_NotInstalled' => 'Version %1$s NOT installed.~~', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/dictionaries/zh_cn.dict.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/dictionaries/zh_cn.dict.itop-hub-connector.php index 9c209d9a2..0f3c4866e 100644 --- a/datamodels/2.x/itop-hub-connector/dictionaries/zh_cn.dict.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/dictionaries/zh_cn.dict.itop-hub-connector.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ // Dictionary entries go here 'Menu:iTopHub' => 'iTop Hub', 'Menu:iTopHub:Register' => '进入iTop Hub', @@ -76,6 +77,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'iTopHub:InstallationStatus:Installed_Version' => '%1$s 版本: %2$s.', 'iTopHub:InstallationStatus:Installed' => '已安装', 'iTopHub:InstallationStatus:Version_NotInstalled' => '版本 %1$s 未被 安装.', -)); - - +]); diff --git a/datamodels/2.x/itop-hub-connector/hubconnectorpage.class.inc.php b/datamodels/2.x/itop-hub-connector/hubconnectorpage.class.inc.php index 257080513..f1f07bd76 100644 --- a/datamodels/2.x/itop-hub-connector/hubconnectorpage.class.inc.php +++ b/datamodels/2.x/itop-hub-connector/hubconnectorpage.class.inc.php @@ -18,11 +18,13 @@ class HubConnectorPage extends NiceWebPage $sUserPrefs = appUserPreferences::GetAsJSON(); $this->LinkScriptFromAppRoot('js/utils.js'); - $this->add_script(<<add_script( + <<add_style(<<add_style( + <<MakeURL('route_mark_all_messages_as_read'); } - + public function GetFetchURL() { return $this->MakeURL('route_fetch_unread_messages'); } - + public function GetViewAllURL() { return $sBaseUrl = $this->oConfig->GetModuleSetting('itop-hub-connector', 'url').MetaModel::GetModuleSetting('itop-hub-connector', 'route_view_all_messages'); } - + /** * {@inheritDoc} * @see iNewsroomProvider::GetPlaceholders() */ public function GetPlaceholders() { - return array( - '%connect_to_itop_hub%' => utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'launch.php', array('target' => 'view_dashboard')), - ); + return [ + '%connect_to_itop_hub%' => utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'launch.php', ['target' => 'view_dashboard']), + ]; } - + /** * {@inheritDoc} * @see NewsroomProviderBase::GetPreferencesUrl() @@ -72,15 +70,15 @@ class HubNewsroomProvider extends NewsroomProviderBase { return null; } - + private function MakeURL($sRouteCode) { $sBaseUrl = $this->oConfig->GetModuleSetting('itop-hub-connector', 'url').MetaModel::GetModuleSetting('itop-hub-connector', $sRouteCode); - + $sParameters = 'uuid[bdd]='.urlencode((string) trim(DBProperty::GetProperty('database_uuid', ''), '{}')); $sParameters .= '&uuid[file]='.urlencode((string) trim(@file_get_contents(APPROOT."data/instance.txt"), "{} \n")); $sParameters .= '&uuid[user]='.urlencode(UserRights::GetUserId()); - + return $sBaseUrl.'?'.$sParameters; } } diff --git a/datamodels/2.x/itop-hub-connector/land.php b/datamodels/2.x/itop-hub-connector/land.php index ee0046a0a..aa00ab67f 100644 --- a/datamodels/2.x/itop-hub-connector/land.php +++ b/datamodels/2.x/itop-hub-connector/land.php @@ -16,7 +16,7 @@ function DisplayStatus(WebPage $oPage) $oPage->add('
          '); // Now scan the extensions and display a report of the extensions brought by the hub $sPath = APPROOT.'data/downloaded-extensions/'; - $aExtraDirs = array(); + $aExtraDirs = []; if (is_dir($sPath)) { $aExtraDirs[] = $sPath; // Also read the extra downloaded-modules directory } @@ -25,7 +25,7 @@ function DisplayStatus(WebPage $oPage) foreach ($oExtensionsMap->GetAllExtensions() as $oExtension) { if ($oExtension->sSource == iTopExtension::SOURCE_REMOTE) { - $aCSSClasses = array('landing-extension'); + $aCSSClasses = ['landing-extension']; if ($oExtension->sInstalledVersion === '') { $aCSSClasses[] = 'landing-installation'; $sInstallation = Dict::Format('iTopHub:InstallationStatus:Version_NotInstalled', $oExtension->sVersion); @@ -68,12 +68,11 @@ function DoLanding(WebPage $oPage) $oPage->add('

          '.Dict::S('iTopHub:Uncompressing').'

          '); - $sProduct = utils::ReadParam('applicationName', '', false, 'raw_data'); $sVersion = utils::ReadParam('applicationVersion', '', false, 'raw_data'); $sInstanceUUID = utils::ReadParam('uuidFile', '', false, 'raw_data'); $sDatabaseUUID = utils::ReadParam('uuidBdd', '', false, 'raw_data'); - $aExtensions = utils::ReadParam('extensions', array(), false, 'raw_data'); + $aExtensions = utils::ReadParam('extensions', [], false, 'raw_data'); // Basic consistency validation if ($sProduct != ITOP_APPLICATION) { @@ -128,7 +127,7 @@ function DoLanding(WebPage $oPage) } // Now scan the extensions and display a report of the extensions brought by the hub - $sNextPage = utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'land.php', array('operation' => 'install')); + $sNextPage = utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'land.php', ['operation' => 'install']); $oPage->add_ready_script("window.location.href='$sNextPage'"); } @@ -148,11 +147,10 @@ function DoInstall(WebPage $oPage) $oPage->set_title(Dict::S('iTopHub:Landing:Install')); $oPage->add('
          '); - // Now scan the extensions and display a report of the extensions brought by the hub // Now scan the extensions and display a report of the extensions brought by the hub $sPath = APPROOT.'data/downloaded-extensions/'; - $aExtraDirs = array(); + $aExtraDirs = []; if (is_dir($sPath)) { $aExtraDirs[] = $sPath; // Also read the extra downloaded-modules directory } @@ -175,14 +173,14 @@ function DoInstall(WebPage $oPage) $oPage->add('
          '); $oPage->add('
          '); } else { - $aCSSClasses = array('landing-extension'); + $aCSSClasses = ['landing-extension']; if ($oExtension->sInstalledVersion === '') { $aCSSClasses[] = 'landing-installation'; $sInstallation = Dict::Format('iTopHub:InstallationEffect:Install', $oExtension->sVersion); - } else if ($oExtension->sInstalledVersion == $oExtension->sVersion) { + } elseif ($oExtension->sInstalledVersion == $oExtension->sVersion) { $aCSSClasses[] = 'landing-no-change'; $sInstallation = Dict::Format('iTopHub:InstallationEffect:NoChange', $oExtension->sVersion); - } else if (version_compare($oExtension->sInstalledVersion, $oExtension->sVersion, '<')) { + } elseif (version_compare($oExtension->sInstalledVersion, $oExtension->sVersion, '<')) { $aCSSClasses[] = 'landing-upgrade'; $sInstallation = Dict::Format('iTopHub:InstallationEffect:Upgrade', $oExtension->sInstalledVersion, $oExtension->sVersion); } else { @@ -213,10 +211,8 @@ function DoInstall(WebPage $oPage) $oPage->add(''); // module-selection-body - $oPage->LinkStylesheetFromAppRoot('css/font-awesome/css/all.min.css'); - $oPage->add('
          '); $oPage->add('
          '.Dict::S('iTopHub:DBBackupLabel').''); $oPage->add('
          '); @@ -224,22 +220,22 @@ function DoInstall(WebPage $oPage) $oPage->add('
          '); $oPage->add('

          '); - $sIframeUrl = utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'launch.php', array('target' => 'inform_after_setup')); - $sStatusPageUrl = utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'land.php', array('operation' => 'done')); + $sIframeUrl = utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'launch.php', ['target' => 'inform_after_setup']); + $sStatusPageUrl = utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'land.php', ['operation' => 'done']); - $aWidgetParams = array( - 'self_url' => utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'ajax.php', array('maintenance' => true)), + $aWidgetParams = [ + 'self_url' => utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'ajax.php', ['maintenance' => true]), 'iframe_url' => $sIframeUrl, 'redirect_after_completion_url' => $sStatusPageUrl, 'mysql_bindir' => MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'mysql_bindir', ''), - 'labels' => array( + 'labels' => [ 'database_backup' => Dict::S('iTopHub:InstallationProgress:DatabaseBackup'), 'extensions_installation' => Dict::S('iTopHub:InstallationProgress:ExtensionsInstallation'), 'installation_successful' => Dict::S('iTopHub:InstallationProgress:InstallationSuccessful'), 'rollback' => Dict::S('iTopHub:ConfigurationSafelyReverted'), - ), + ], 'authent' => $sUID, - ); + ]; $sWidgetParams = json_encode($aWidgetParams); @@ -249,7 +245,6 @@ function DoInstall(WebPage $oPage) $oPage->add('
          '); } - try { require_once(APPROOT.'/application/application.inc.php'); require_once(APPROOT.'/setup/setuppage.class.inc.php'); @@ -266,7 +261,8 @@ try { $oPage->LinkScriptFromModule('itop-hub-connector/js/hub.js'); $oPage->LinkStylesheetFromAppRoot('css/font-combodo/font-combodo.css'); - $oPage->add_style(<<add_style( + <<output(); -} -catch (Exception $e) { +} catch (Exception $e) { require_once(APPROOT.'/setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); $oP->add("

          ".Dict::S('UI:FatalErrorMessage')."

          \n"); @@ -312,7 +307,7 @@ catch (Exception $e) { $oLog->Set('issue', 'PHP Exception'); $oLog->Set('impact', 'Page could not be displayed'); $oLog->Set('callstack', $e->getTrace()); - $oLog->Set('data', array()); + $oLog->Set('data', []); $oLog->DBInsertNoReload(); } diff --git a/datamodels/2.x/itop-hub-connector/launch.php b/datamodels/2.x/itop-hub-connector/launch.php index 1e87fd37a..a17a8a309 100644 --- a/datamodels/2.x/itop-hub-connector/launch.php +++ b/datamodels/2.x/itop-hub-connector/launch.php @@ -114,7 +114,7 @@ use Combodo\iTop\Application\WebPage\NiceWebPage; */ function CleanVersionNumber($sString) { - $aMatches = array(); + $aMatches = []; if (preg_match("|^([0-9\\.]+)-|", $sString, $aMatches)) { return $aMatches[1]; } @@ -124,11 +124,11 @@ function CleanVersionNumber($sString) function collect_configuration() { - $aConfiguration = array( - 'php' => array(), - 'mysql' => array(), - 'apache' => array(), - ); + $aConfiguration = [ + 'php' => [], + 'mysql' => [], + 'apache' => [], + ]; // Database information $m_oMysqli = CMDBSource::GetMysqli(); @@ -170,7 +170,7 @@ function collect_configuration() // PHP extensions if (!MetaModel::GetConfig()->GetModuleSetting('itop-hub-connector', 'php_extensions_enable', true)) { - $aConfiguration['php_extensions'] = array(); + $aConfiguration['php_extensions'] = []; } else { foreach (get_loaded_extensions() as $extension) { $aConfiguration['php_extensions'][$extension] = $extension; @@ -178,8 +178,8 @@ function collect_configuration() } // Collect some PHP settings having a known impact on iTop - $aIniGet = MetaModel::GetConfig()->GetModuleSetting('itop-hub-connector', 'php_settings_array', array()); // by default, on the time of the writting, it values are : array('post_max_size', 'upload_max_filesize', 'apc.enabled', 'timezone', 'memory_limit', 'max_execution_time'); - $aConfiguration['php_settings'] = array(); + $aIniGet = MetaModel::GetConfig()->GetModuleSetting('itop-hub-connector', 'php_settings_array', []); // by default, on the time of the writting, it values are : array('post_max_size', 'upload_max_filesize', 'apc.enabled', 'timezone', 'memory_limit', 'max_execution_time'); + $aConfiguration['php_settings'] = []; foreach ($aIniGet as $iniGet) { $aConfiguration['php_settings'][$iniGet] = (string)ini_get($iniGet); } @@ -197,22 +197,22 @@ function collect_configuration() // iTop Installation Options, i.e. "Extensions" $oExtensionMap = new iTopExtensionsMap(); $oExtensionMap->LoadChoicesFromDatabase($oConfig); - $aConfiguration['itop_extensions'] = array(); + $aConfiguration['itop_extensions'] = []; foreach ($oExtensionMap->GetChoices() as $oExtension) { switch ($oExtension->sSource) { case iTopExtension::SOURCE_MANUAL: case iTopExtension::SOURCE_REMOTE: - $aConfiguration['itop_extensions'][$oExtension->sCode] = array( + $aConfiguration['itop_extensions'][$oExtension->sCode] = [ 'label' => $oExtension->sLabel, 'value' => $oExtension->sInstalledVersion, - ); + ]; break; default: - $aConfiguration['itop_installation_options'][$oExtension->sCode] = array( + $aConfiguration['itop_installation_options'][$oExtension->sCode] = [ 'label' => $oExtension->sLabel, 'value' => true, - ); + ]; } } @@ -223,13 +223,13 @@ function MakeDataToPost($sTargetRoute) { if (MetaModel::GetConfig()->Get('demo_mode')) { // Don't expose such information in demo mode - $aDataToPost = array('disabled' => true, 'reason' => 'demo_mode'); + $aDataToPost = ['disabled' => true, 'reason' => 'demo_mode']; } else { $aConfiguration = collect_configuration(); - $aDataToPost = array( + $aDataToPost = [ 'itop_hub_target_route' => $sTargetRoute, - 'itop_stack' => array( + 'itop_stack' => [ "uuidBdd" => (string)trim(DBProperty::GetProperty('database_uuid', ''), '{}'), // TODO check if empty and... regenerate a new UUID ?? "uuidFile" => (string)trim(@file_get_contents(APPROOT."data/instance.txt"), "{} \n"), // TODO check if empty and... regenerate a new UUID ?? 'instance_friendly_name' => (string)$_SERVER['SERVER_NAME'], @@ -242,8 +242,8 @@ function MakeDataToPost($sTargetRoute) 'itop_modules' => (object)$aConfiguration['itop_modules'], 'itop_extensions' => (object)$aConfiguration['itop_extensions'], 'itop_installation_options' => (object)$aConfiguration['itop_installation_options'], - ), - 'server_stack' => array( + ], + 'server_stack' => [ 'os_name' => (string)PHP_OS, 'web_server_name' => (string)$aConfiguration['web_server_name'], 'web_server_version' => (string)$aConfiguration['web_server_version'], @@ -253,8 +253,8 @@ function MakeDataToPost($sTargetRoute) 'php_version' => (string)CleanVersionNumber(phpversion()), 'php_settings' => (object)$aConfiguration['php_settings'], 'php_extensions' => (object)$aConfiguration['php_extensions'], - ), - ); + ], + ]; } return $aDataToPost; @@ -282,23 +282,23 @@ try { switch ($sTargetRoute) { case 'inform_after_setup': - // Hidden IFRAME at the end of the setup - require_once (APPROOT.'/application/ajaxwebpage.class.inc.php'); + // Hidden IFRAME at the end of the setup + require_once(APPROOT.'/application/ajaxwebpage.class.inc.php'); - $sParamToken = utils::ReadParam('setup_token'); - $oTokenValidation = new TokenValidation(); - $bIsTokenValid = $oTokenValidation->isSetupTokenValid($sParamToken); - if (UserRights::IsAdministrator() || $bIsTokenValid) { - $oPage = new NiceWebPage(''); - $aDataToPost = MakeDataToPost($sTargetRoute); - $oPage->add('
          '); - $oPage->add(''); - $oPage->add_ready_script('$("#hub_launch_form").submit();'); - } else { - IssueLog::Error('TokenValidation failed on inform_after_setup page'); - throw new Exception("Not allowed"); - } - break; + $sParamToken = utils::ReadParam('setup_token'); + $oTokenValidation = new TokenValidation(); + $bIsTokenValid = $oTokenValidation->isSetupTokenValid($sParamToken); + if (UserRights::IsAdministrator() || $bIsTokenValid) { + $oPage = new NiceWebPage(''); + $aDataToPost = MakeDataToPost($sTargetRoute); + $oPage->add(''); + $oPage->add(''); + $oPage->add_ready_script('$("#hub_launch_form").submit();'); + } else { + IssueLog::Error('TokenValidation failed on inform_after_setup page'); + throw new Exception("Not allowed"); + } + break; default: // All other cases, special "Hub like" web page @@ -337,7 +337,8 @@ try { $sButtonLabelClose = Dict::S('iTopHub:CloseBtn'); $sButtonLabelGo = Dict::S('iTopHub:GoBtn'); $sButtonLabelTooltip = Dict::S('iTopHub:GoBtn:Tooltip'); - $oPage->add(<<add( + << @@ -405,8 +406,7 @@ JS } $oPage->output(); -} -catch (CoreException $e) { +} catch (CoreException $e) { require_once(APPROOT.'/setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); $oP->add("

          ".Dict::S('UI:FatalErrorMessage')."

          \n"); @@ -431,8 +431,7 @@ catch (CoreException $e) { // For debugging only // throw $e; -} -catch (Exception $e) { +} catch (Exception $e) { require_once(APPROOT.'/setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); $oP->add("

          ".Dict::S('UI:FatalErrorMessage')."

          \n"); @@ -448,11 +447,10 @@ catch (Exception $e) { $oLog->Set('issue', 'PHP Exception'); $oLog->Set('impact', 'Page could not be displayed'); $oLog->Set('callstack', $e->getTrace()); - $oLog->Set('data', array()); + $oLog->Set('data', []); $oLog->DBInsertNoReload(); } IssueLog::Error($e->getMessage()); } } - diff --git a/datamodels/2.x/itop-hub-connector/menus.php b/datamodels/2.x/itop-hub-connector/menus.php index 56d548748..bd0b0aff3 100644 --- a/datamodels/2.x/itop-hub-connector/menus.php +++ b/datamodels/2.x/itop-hub-connector/menus.php @@ -17,16 +17,15 @@ class ItopHubMenusHandler extends ModuleHandlerAPI public static function OnMenuCreation() { // Add the admin menus - if (UserRights::IsAdministrator()) - { + if (UserRights::IsAdministrator()) { $sRootUrl = utils::GetAbsoluteUrlAppRoot().'pages/exec.php?exec_module=itop-hub-connector&exec_page=launch.php'; $sMyExtensionsUrl = utils::GetAbsoluteUrlAppRoot().'pages/exec.php?exec_module=itop-hub-connector&exec_page=myextensions.php'; - + $oHubMenu = new MenuGroup('iTopHub', 999 /* fRank */, 'fc fc-itophub-icon fc-1-5x'); $fRank = 1; new WebPageMenuNode('iTopHub:Register', $sRootUrl.'&target=view_dashboard', $oHubMenu->GetIndex(), $fRank++); new WebPageMenuNode('iTopHub:MyExtensions', $sMyExtensionsUrl, $oHubMenu->GetIndex(), $fRank++); new WebPageMenuNode('iTopHub:BrowseExtensions', $sRootUrl.'&target=browse_extensions', $oHubMenu->GetIndex(), $fRank++); - } + } } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-hub-connector/module.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/module.itop-hub-connector.php index 1147e66f4..670bbb1c4 100644 --- a/datamodels/2.x/itop-hub-connector/module.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/module.itop-hub-connector.php @@ -1,4 +1,5 @@ 'iTop Hub Connector', @@ -14,31 +15,31 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-config-mgmt/2.4.0', // Actually this module requires iTop 2.4.1 minimum - ), + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array( + 'datamodel' => [ 'menus.php', - 'hubnewsroomprovider.class.inc.php', - ), - 'webservice' => array( - - ), - 'data.struct' => array( + 'hubnewsroomprovider.class.inc.php', + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any - ) + 'doc.more_information' => '', // hyperlink to more information, if any + ] ); diff --git a/datamodels/2.x/itop-hub-connector/myextensions.php b/datamodels/2.x/itop-hub-connector/myextensions.php index 08a3a8701..6da581a46 100644 --- a/datamodels/2.x/itop-hub-connector/myextensions.php +++ b/datamodels/2.x/itop-hub-connector/myextensions.php @@ -1,4 +1,5 @@ SetBreadCrumbEntry('ui-hub-myextensions', Dict::S('Menu:iTopHub:MyExtensions'), Dict::S('Menu:iTopHub:MyExtensions+'), '', 'fas fa-puzzle-piece', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); - function GetExtensionInfoComponent(iTopExtension $oExtension): UIBlock { $sExtensionDescription = Dict::Format('UI:About:Extension_Version', $oExtension->sVersion); @@ -40,16 +40,12 @@ function GetExtensionInfoComponent(iTopExtension $oExtension): UIBlock ->SetOpenedByDefault(false); } - try { $oExtensionsMap = new iTopExtensionsMap(); $oExtensionsMap->LoadChoicesFromDatabase(MetaModel::GetConfig()); $oPage->AddUiBlock(TitleUIBlockFactory::MakeForPage(Dict::S('iTopHub:InstalledExtensions'))); - - - /**------------------------------------------------------------------------------------------------------ * Remotely deployed ext */ @@ -80,13 +76,12 @@ try { $oHubButtonContainer = UIContentBlockUIBlockFactory::MakeStandard() ->AddCSSClass('hub-button'); $oPage->AddSubBlock($oHubButtonContainer); - $sUrl = utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'launch.php', array('target' => 'browse_extensions')); + $sUrl = utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'launch.php', ['target' => 'browse_extensions']); $oHubButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('iTopHub:GetMoreExtensions'), 'install-extensions-button') ->SetOnClickJsCode("window.location.href='$sUrl'") ->SetIconClass('fa-fw fc fc-itophub-icon fc-1-5x'); $oHubButtonContainer->AddSubBlock($oHubButton); - /**------------------------------------------------------------------------------------------------------ * Manually deployed ext * Only if there are some ! @@ -121,8 +116,7 @@ try { } CSS ); -} -catch (Exception $e) { +} catch (Exception $e) { $oPage->p(''.Dict::Format('UI:Error_Details', $e->getMessage()).''); } diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/cs.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/cs.dict.itop-incident-mgmt-itil.php index 40e1e1216..ebf984888 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/cs.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/cs.dict.itop-incident-mgmt-itil.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:IncidentManagement' => 'Správa incidentů', 'Menu:IncidentManagement+' => 'Správa incidentů', 'Menu:Incident:Overview' => 'Přehled', @@ -33,8 +34,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Otevřené incidenty podle stavu', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Otevřené incidenty podle řešitele', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Otevřené incidenty podle zákazníka', -)); - +]); // Dictionnay conventions // Class: @@ -50,7 +50,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( // Class: Incident // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Incident' => 'Incident', 'Class:Incident+' => '', 'Class:Incident/Attribute:status' => 'Stav', @@ -229,4 +229,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Incident/Method:ResolveChildTickets' => 'Vyřešit podřízené tikety', 'Class:Incident/Method:ResolveChildTickets+' => 'Kaskádovat vyřešení do podřízeného tiketu (ev_autoresolve) a sjednotit následující vlastnosti: služba, tým, řešitel, informace o vyřešení', 'Tickets:Related:OpenIncidents' => 'Otevřené incidenty', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/da.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/da.dict.itop-incident-mgmt-itil.php index c481df220..70a8988b5 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/da.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/da.dict.itop-incident-mgmt-itil.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:IncidentManagement' => 'Incident Management', 'Menu:IncidentManagement+' => '', 'Menu:Incident:Overview' => 'Oversigt', @@ -32,8 +33,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Åbne Incidents efter status', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Åbne Incidents efter tildelt til', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Åbne Incidents efter bruger', -)); - +]); // Dictionnay conventions // Class: @@ -49,7 +49,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( // Class: Incident // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Incident' => 'Incident', 'Class:Incident+' => '', 'Class:Incident/Attribute:status' => 'Status', @@ -228,4 +228,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Incident/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:Incident/Method:ResolveChildTickets+' => 'Cascade the resolution to child ticket (ev_autoresolve), and align the following characteristics: service, team, agent, resolution info~~', 'Tickets:Related:OpenIncidents' => 'Open incidents~~', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/de.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/de.dict.itop-incident-mgmt-itil.php index ac5e0fd3a..8f43454f5 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/de.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/de.dict.itop-incident-mgmt-itil.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:IncidentManagement' => 'Incident Management', 'Menu:IncidentManagement+' => '', 'Menu:Incident:Overview' => 'Übersicht', @@ -32,8 +33,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Offene Incidents nach Status', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Offene Incidents nach Bearbeiter', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Offene Incidents nach Kunde', -)); - +]); // Dictionnay conventions // Class: @@ -49,7 +49,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( // Class: Incident // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Incident' => 'Incident', 'Class:Incident+' => '', 'Class:Incident/Attribute:status' => 'Status', @@ -228,4 +228,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Incident/Method:ResolveChildTickets' => 'Kind-Tickets lösen', 'Class:Incident/Method:ResolveChildTickets+' => 'Lösung auf Kind-Tickets übertragen (ev_autoresolve), und folgende Ticket-Eigenschaften angleichen: Service, Team, Agent, Lösungsinformationen', 'Tickets:Related:OpenIncidents' => 'Offene Incidents', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/en.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/en.dict.itop-incident-mgmt-itil.php index f86fef6fa..e8c208a84 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/en.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/en.dict.itop-incident-mgmt-itil.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Menu:IncidentManagement' => 'Incident Management', 'Menu:IncidentManagement+' => '', 'Menu:Incident:Overview' => 'Overview', @@ -43,8 +44,7 @@ Dict::Add('EN US', 'English', 'English', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Open incidents by status', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Open incidents by agent', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Open incidents by customer', -)); - +]); // Dictionnay conventions // Class: @@ -60,7 +60,7 @@ Dict::Add('EN US', 'English', 'English', array( // Class: Incident // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Incident' => 'Incident', 'Class:Incident+' => '', 'Class:Incident/Attribute:status' => 'Status', @@ -240,4 +240,4 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Incident/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:Incident/Method:ResolveChildTickets+' => 'Cascade the resolution to child ticket (ev_autoresolve), and align the following characteristics: service, team, agent, resolution info', 'Tickets:Related:OpenIncidents' => 'Open incidents', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/en_gb.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/en_gb.dict.itop-incident-mgmt-itil.php index 7060b695d..c907e409e 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/en_gb.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/en_gb.dict.itop-incident-mgmt-itil.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Menu:IncidentManagement' => 'Incident Management', 'Menu:IncidentManagement+' => '', 'Menu:Incident:Overview' => 'Overview', @@ -43,8 +44,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Open incidents by status', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Open incidents by agent', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Open incidents by customer', -)); - +]); // Dictionnay conventions // Class: @@ -60,7 +60,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( // Class: Incident // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Incident' => 'Incident', 'Class:Incident+' => '', 'Class:Incident/Attribute:status' => 'Status', @@ -240,4 +240,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Incident/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:Incident/Method:ResolveChildTickets+' => 'Cascade the resolution to child ticket (ev_autoresolve), and align the following characteristics: service, team, agent, resolution info.', 'Tickets:Related:OpenIncidents' => 'Open incidents', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/es_cr.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/es_cr.dict.itop-incident-mgmt-itil.php index e7af15f39..ef00043f3 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/es_cr.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/es_cr.dict.itop-incident-mgmt-itil.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:IncidentManagement' => 'Administración de Incidentes', 'Menu:IncidentManagement+' => 'Administración de Incidentes', 'Menu:Incident:Overview' => 'Resumen de Incidentes', @@ -29,8 +30,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Incidentes Abiertos por Estatus', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Incidentes Abiertos por Analista', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Incidentes Abiertos por Cliente', -)); - +]); // Dictionnay conventions // Class: @@ -46,7 +46,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( // Class: Incident // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Incident' => 'Incidente', 'Class:Incident+' => 'Incidente', 'Class:Incident/Attribute:status' => 'Estatus', @@ -225,4 +225,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Incident/Method:ResolveChildTickets' => 'Resolver tickets hijos', 'Class:Incident/Method:ResolveChildTickets+' => 'Cascadear la solución a los tickets hijos (ev_autoresolve), y alinear las siguientes características: servicio, equipo, agente, información de solución', 'Tickets:Related:OpenIncidents' => 'Incidentes Abiertos', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/fr.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/fr.dict.itop-incident-mgmt-itil.php index 59186123b..be954c8b2 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/fr.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/fr.dict.itop-incident-mgmt-itil.php @@ -1,15 +1,16 @@ 'Gestion des incidents', 'Menu:IncidentManagement+' => '', 'Menu:Incident:Overview' => 'Vue d\'ensemble', @@ -31,8 +32,7 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Incidents ouverts par statut', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Incidents ouverts par agent', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Incidents ouverts par client', -)); - +]); // Dictionnay conventions // Class: @@ -48,7 +48,7 @@ Dict::Add('FR FR', 'French', 'Français', array( // Class: Incident // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Incident' => 'Incident', 'Class:Incident+' => '', 'Class:Incident/Attribute:status' => 'Etat', @@ -238,5 +238,5 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Incident/Error:CannotAssignParentIncidentIdToSelf' => 'L\'incident parent ne peut pas être lui-même', 'Class:Incident/Method:ResolveChildTickets' => 'ResolveChildTickets (résoudre les tickets fils)', 'Class:Incident/Method:ResolveChildTickets+' => 'Cascader l\'action de résolution du ticket (ev_autoresolve) vers les requêtes et incidents fils, et aligner les caractéristiques suivantes : service, équipe, agent, information de résolution', - 'Tickets:Related:OpenIncidents' => 'Incidents ouverts' -)); + 'Tickets:Related:OpenIncidents' => 'Incidents ouverts', +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/hu.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/hu.dict.itop-incident-mgmt-itil.php index c24a2ec38..aa1aae11b 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/hu.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/hu.dict.itop-incident-mgmt-itil.php @@ -1,15 +1,16 @@ 'Incidenskezelés', 'Menu:IncidentManagement+' => '', 'Menu:Incident:Overview' => 'Áttekintő', @@ -31,8 +32,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Nyitott incidensek állapotuk szerint', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Nyitott incidensek ügyintézőnként', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Nyitott incidensek ügyfelenként', -)); - +]); // Dictionnay conventions // Class: @@ -48,7 +48,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( // Class: Incident // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Incident' => 'Incidens', 'Class:Incident+' => '~~', 'Class:Incident/Attribute:status' => 'Állapot', @@ -227,4 +227,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Incident/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:Incident/Method:ResolveChildTickets+' => 'A megoldás kaszkádozása a kapcsolódó jegyhez (ev_autoresolve), és a következő jellemzők összehangolása: szolgáltatás, csapat, ügyintéző, megoldási információ.', 'Tickets:Related:OpenIncidents' => 'Nyitott incidensek', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/it.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/it.dict.itop-incident-mgmt-itil.php index f284ae4e4..bc13c691d 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/it.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/it.dict.itop-incident-mgmt-itil.php @@ -1,15 +1,16 @@ 'Getione incidente', 'Menu:IncidentManagement+' => 'Gestione incidente', 'Menu:Incident:Overview' => 'Overview', @@ -31,8 +32,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Incidenti aperti per stato', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Incidenti aperti per agente', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Incidenti aperti per cliente', -)); - +]); // Dictionnay conventions // Class: @@ -48,7 +48,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( // Class: Incident // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Incident' => 'Incidente', 'Class:Incident+' => '~~', 'Class:Incident/Attribute:status' => 'Stato', @@ -227,4 +227,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Incident/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:Incident/Method:ResolveChildTickets+' => 'Risoluzione a cascata delle richieste figlie (ev_autoresolve), e allineare le seguenti caratteristiche: servizio, team, agente e risoluzione', 'Tickets:Related:OpenIncidents' => 'Incidenti aperti', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/ja.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/ja.dict.itop-incident-mgmt-itil.php index 9f8cd14a7..93a4e88c9 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/ja.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/ja.dict.itop-incident-mgmt-itil.php @@ -1,15 +1,16 @@ 'インシデント管理', 'Menu:IncidentManagement+' => 'インシデント管理', 'Menu:Incident:Overview' => '概要', @@ -31,8 +32,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => '状態別オープンインシデント', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'エージェント別オープンインシデント', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => '顧客別オープンインシデント', -)); - +]); // Dictionnay conventions // Class: @@ -48,7 +48,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( // Class: Incident // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Incident' => 'インシデント', 'Class:Incident+' => '', 'Class:Incident/Attribute:status' => '状態', @@ -227,4 +227,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Incident/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:Incident/Method:ResolveChildTickets+' => 'Cascade the resolution to child ticket (ev_autoresolve), and align the following characteristics: service, team, agent, resolution info~~', 'Tickets:Related:OpenIncidents' => 'Open incidents~~', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/nl.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/nl.dict.itop-incident-mgmt-itil.php index ccad06ca4..3b193b491 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/nl.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/nl.dict.itop-incident-mgmt-itil.php @@ -1,17 +1,18 @@ * @author Jeffrey Bostoen (2018 - 2022) * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:IncidentManagement' => 'Incident Management', 'Menu:IncidentManagement+' => 'Incident Management', 'Menu:Incident:Overview' => 'Overzicht', @@ -33,8 +34,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Open incidenten per status', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Open incidenten per agent', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Open incidenten per klant', -)); - +]); // Dictionnay conventions // Class: @@ -50,7 +50,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( // Class: Incident // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Incident' => 'Incident', 'Class:Incident+' => '', 'Class:Incident/Attribute:status' => 'Status', @@ -229,4 +229,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Incident/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:Incident/Method:ResolveChildTickets+' => 'Pas de oplossing ook toe op subverzoeken (ev_autoresolve) en neem deze kenmerken over: service, team, agent, oplossing', 'Tickets:Related:OpenIncidents' => 'Open incidenten', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/pl.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/pl.dict.itop-incident-mgmt-itil.php index d3f5e1389..4fffa27ba 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/pl.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/pl.dict.itop-incident-mgmt-itil.php @@ -1,15 +1,16 @@ 'Zarządzanie incydentami', 'Menu:IncidentManagement+' => 'Zarządzanie incydentami', 'Menu:Incident:Overview' => 'Przegląd', @@ -31,8 +32,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Otwarte incydenty według statusu', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Otwarte incydenty według agenta', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Otwarte incydenty według klienta', -)); - +]); // Dictionnay conventions // Class: @@ -48,7 +48,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( // Class: Incident // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Incident' => 'Incydent', 'Class:Incident+' => '', 'Class:Incident/Attribute:status' => 'Status', @@ -227,4 +227,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Incident/Method:ResolveChildTickets' => 'Rozpatrz zgłoszenia podrzędne', 'Class:Incident/Method:ResolveChildTickets+' => 'Połącz rozwiązanie kaskadowo ze zgłoszeniem podrzędnym (ev_autoresolve) i dopasuj następujące cechy: usługa, zespół, agent, informacje o rozwiązaniu', 'Tickets:Related:OpenIncidents' => 'Otwarte incydenty', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/pt_br.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/pt_br.dict.itop-incident-mgmt-itil.php index d16020de7..620fe51f4 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/pt_br.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/pt_br.dict.itop-incident-mgmt-itil.php @@ -1,15 +1,16 @@ 'Gerenciamento de Incidentes', 'Menu:IncidentManagement+' => '', 'Menu:Incident:Overview' => 'Visão geral', @@ -31,8 +32,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Incidentes abertos por status', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Incidentes abertos por agente', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Incidentes abertos por cliente', -)); - +]); // Dictionnay conventions // Class: @@ -48,7 +48,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( // Class: Incident // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Incident' => 'Incidente', 'Class:Incident+' => '', 'Class:Incident/Attribute:status' => 'Status', @@ -227,4 +227,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Incident/Method:ResolveChildTickets' => 'ResolveChildTickets (resolver solicitações filhas)', 'Class:Incident/Method:ResolveChildTickets+' => 'Conecte a solução a solicitação filha (ev_autoresolve) e alinhe as seguintes características: serviço, equipe, agente, informação da solução', 'Tickets:Related:OpenIncidents' => 'Incidentes abertos', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/ru.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/ru.dict.itop-incident-mgmt-itil.php index d7d5b0a0c..164be4711 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/ru.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/ru.dict.itop-incident-mgmt-itil.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:IncidentManagement' => 'Управление инцидентами', 'Menu:IncidentManagement+' => 'Управление инцидентами', 'Menu:Incident:Overview' => 'Обзор', @@ -32,8 +33,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Открытые инциденты по статусу', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Открытые инциденты по агенту', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Открытые инциденты по заказчику', -)); - +]); // Dictionnay conventions // Class: @@ -49,7 +49,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( // Class: Incident // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Incident' => 'Инцидент', 'Class:Incident+' => '', 'Class:Incident/Attribute:status' => 'Статус', @@ -228,4 +228,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Incident/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:Incident/Method:ResolveChildTickets+' => 'Каскадное решение дочерних тикетов (ev_autoresolve) с установкой следующих параметров: услуга, команда, агент, информация о решении.', 'Tickets:Related:OpenIncidents' => 'Открытые инциденты', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/sk.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/sk.dict.itop-incident-mgmt-itil.php index 16b90ce35..bd61d5b8c 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/sk.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/sk.dict.itop-incident-mgmt-itil.php @@ -1,15 +1,16 @@ 'Incident Management~~', 'Menu:IncidentManagement+' => '~~', 'Menu:Incident:Overview' => 'Overview~~', @@ -31,8 +32,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Open incidents by status~~', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Open incidents by agent~~', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Open incidents by customer~~', -)); - +]); // Dictionnay conventions // Class: @@ -48,7 +48,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( // Class: Incident // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Incident' => 'Incident~~', 'Class:Incident+' => '~~', 'Class:Incident/Attribute:status' => 'Status~~', @@ -227,4 +227,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Incident/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:Incident/Method:ResolveChildTickets+' => 'Cascade the resolution to child ticket (ev_autoresolve), and align the following characteristics: service, team, agent, resolution info~~', 'Tickets:Related:OpenIncidents' => 'Open incidents~~', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/tr.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/tr.dict.itop-incident-mgmt-itil.php index c1a2a255c..804ac0727 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/tr.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/tr.dict.itop-incident-mgmt-itil.php @@ -1,15 +1,16 @@ 'Incident Management~~', 'Menu:IncidentManagement+' => '', 'Menu:Incident:Overview' => 'Overview~~', @@ -31,8 +32,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => 'Open incidents by status~~', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => 'Open incidents by agent~~', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => 'Open incidents by customer~~', -)); - +]); // Dictionnay conventions // Class: @@ -48,7 +48,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( // Class: Incident // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Incident' => 'Incident~~', 'Class:Incident+' => '~~', 'Class:Incident/Attribute:status' => 'Status~~', @@ -227,4 +227,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Incident/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:Incident/Method:ResolveChildTickets+' => 'Cascade the resolution to child ticket (ev_autoresolve), and align the following characteristics: service, team, agent, resolution info~~', 'Tickets:Related:OpenIncidents' => 'Open incidents~~', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/zh_cn.dict.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/zh_cn.dict.itop-incident-mgmt-itil.php index 1e173704f..8d1d1fc08 100644 --- a/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/zh_cn.dict.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/dictionaries/zh_cn.dict.itop-incident-mgmt-itil.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Menu:IncidentManagement' => '事件管理', 'Menu:IncidentManagement+' => '事件管理', 'Menu:Incident:Overview' => '概况', @@ -42,8 +43,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI-IncidentManagementOverview-OpenIncidentByStatus' => '打开的事件 (按状态)', 'UI-IncidentManagementOverview-OpenIncidentByAgent' => '打开的事件 (按办理人)', 'UI-IncidentManagementOverview-OpenIncidentByCustomer' => '打开的事件 (按客户)', -)); - +]); // Dictionnay conventions // Class: @@ -59,7 +59,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( // Class: Incident // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Incident' => '事件', 'Class:Incident+' => '', 'Class:Incident/Attribute:status' => '状态', @@ -238,4 +238,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Incident/Method:ResolveChildTickets' => '解决子工单', 'Class:Incident/Method:ResolveChildTickets+' => '递归解决子工单 (自动解决), 并调整相关字段与父级工单保持一致: 服务, 团队, 办理人, 解决方案', 'Tickets:Related:OpenIncidents' => '打开的事件', -)); +]); diff --git a/datamodels/2.x/itop-incident-mgmt-itil/module.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/module.itop-incident-mgmt-itil.php index 43cfad300..297f6b1d6 100755 --- a/datamodels/2.x/itop-incident-mgmt-itil/module.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/module.itop-incident-mgmt-itil.php @@ -1,10 +1,9 @@ 'Incident Management ITIL', @@ -12,25 +11,25 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-config-mgmt/2.4.0', 'itop-tickets/2.4.0', 'itop-profiles-itil/2.3.0', - ), + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array( - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'data.struct' => [ - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.itop-request-mgmt.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -38,7 +37,7 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/cs.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/cs.dict.itop-knownerror-mgmt.php index 17dd0642f..6fb42938f 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/cs.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/cs.dict.itop-knownerror-mgmt.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:KnownError' => 'Známá chyba', 'Class:KnownError+' => 'Pro známou příčinu zdokumentovaná chyba', 'Class:KnownError/Attribute:name' => 'Název', @@ -54,13 +55,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:KnownError/Attribute:ci_list+' => 'Všechny konfigurační položky vztahující se k této známé chybě', 'Class:KnownError/Attribute:document_list' => 'Dokumenty', 'Class:KnownError/Attribute:document_list+' => 'Všechny dokumenty spojené s touto známou chybou', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkErrorToFunctionalCI' => 'Spojení (Chyba / Funkční konfigurační položka)', 'Class:lnkErrorToFunctionalCI+' => 'Konfigurační položky vztahující se k chybě', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -74,13 +75,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Důvod', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkDocumentToError' => 'Spojení (Dokument / Chyba)', 'Class:lnkDocumentToError+' => 'Spojení mezi dokumentem a známou chybou', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s~~', @@ -94,9 +95,9 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '', 'Class:lnkDocumentToError/Attribute:link_type' => 'link_type', 'Class:lnkDocumentToError/Attribute:link_type+' => '', -)); +]); -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:ProblemManagement' => 'Správa problémů', 'Menu:ProblemManagement+' => 'Správa problémů', 'Menu:Problem:Shortcuts' => 'Odkazy', @@ -106,4 +107,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Menu:SearchError+' => 'Hledat známé chyby', 'Menu:Problem:KnownErrors' => 'Všechny známé chyby', 'Menu:Problem:KnownErrors+' => 'Všechny známé chyby', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/da.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/da.dict.itop-knownerror-mgmt.php index 4ab68201e..59ac84ed7 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/da.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/da.dict.itop-knownerror-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:KnownError' => 'Known Error', 'Class:KnownError+' => 'Dokumenterede fejl for et bestående Issue', 'Class:KnownError/Attribute:name' => 'Navn', @@ -53,13 +54,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:KnownError/Attribute:ci_list+' => 'All the configuration items that are related to this known error~~', 'Class:KnownError/Attribute:document_list' => 'Dokumenter', 'Class:KnownError/Attribute:document_list+' => 'All the documents linked to this known error~~', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkErrorToFunctionalCI' => 'Sammenhæng Fejl/FunctionalCI', 'Class:lnkErrorToFunctionalCI+' => '', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -73,13 +74,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Årsag', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkDocumentToError' => 'Sammenhæng Dokumenter/Fejl', 'Class:lnkDocumentToError+' => '', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s~~', @@ -93,9 +94,9 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '', 'Class:lnkDocumentToError/Attribute:link_type' => 'Sammenhængstype', 'Class:lnkDocumentToError/Attribute:link_type+' => '', -)); +]); -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:ProblemManagement' => 'Problem Management', 'Menu:ProblemManagement+' => 'Problem Management', 'Menu:Problem:Shortcuts' => 'Genvej', @@ -105,4 +106,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Menu:SearchError+' => '', 'Menu:Problem:KnownErrors' => 'Alle kendte Fejl', 'Menu:Problem:KnownErrors+' => 'Alle kendte Fejl', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/de.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/de.dict.itop-knownerror-mgmt.php index 371463a81..ceaf541f2 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/de.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/de.dict.itop-knownerror-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:KnownError' => 'Known Error', 'Class:KnownError+' => 'Dokumentierter Fehler für ein Problem', 'Class:KnownError/Attribute:name' => 'Name', @@ -53,13 +54,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:KnownError/Attribute:ci_list+' => 'Alle CIs, die mit diesem Known Error verknüpft sind', 'Class:KnownError/Attribute:document_list' => 'Dokumente', 'Class:KnownError/Attribute:document_list+' => 'Alle Dokumente, die mit diesem Known Error verknüpft sind', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkErrorToFunctionalCI' => 'Verknüpfung KnownError/FunctionalCI', 'Class:lnkErrorToFunctionalCI+' => '', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s', @@ -73,13 +74,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Begründung', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkDocumentToError' => 'Verknüpfung Dokumente/KnownError', 'Class:lnkDocumentToError+' => '', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s', @@ -93,9 +94,9 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '', 'Class:lnkDocumentToError/Attribute:link_type' => 'Verknüpfungstyp', 'Class:lnkDocumentToError/Attribute:link_type+' => '', -)); +]); -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:ProblemManagement' => 'Problem Management', 'Menu:ProblemManagement+' => 'Problem Management', 'Menu:Problem:Shortcuts' => 'Shortcuts', @@ -105,4 +106,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Menu:SearchError+' => 'Nach dokumentierten Fehlern suchen', 'Menu:Problem:KnownErrors' => 'Alle Known Errors', 'Menu:Problem:KnownErrors+' => 'Alle Known Errors', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/en.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/en.dict.itop-knownerror-mgmt.php index 98c62365d..462f41f42 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/en.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/en.dict.itop-knownerror-mgmt.php @@ -1,4 +1,5 @@ 'Known Error', 'Class:KnownError+' => 'Error documented for a known issue', 'Class:KnownError/Attribute:name' => 'Name', @@ -93,13 +94,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:KnownError/Attribute:ci_list+' => 'All the configuration items that are related to this known error', 'Class:KnownError/Attribute:document_list' => 'Documents', 'Class:KnownError/Attribute:document_list+' => 'All the documents linked to this known error', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkErrorToFunctionalCI' => 'Link Error / FunctionalCI', 'Class:lnkErrorToFunctionalCI+' => 'Infra related to a known error', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s', @@ -113,13 +114,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Reason', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkDocumentToError' => 'Link Documents / Errors', 'Class:lnkDocumentToError+' => 'A link between a document and a known error', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s', @@ -133,9 +134,9 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '', 'Class:lnkDocumentToError/Attribute:link_type' => 'link_type', 'Class:lnkDocumentToError/Attribute:link_type+' => '', -)); +]); -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Menu:ProblemManagement' => 'Problem Management', 'Menu:ProblemManagement+' => 'Problem Management', 'Menu:Problem:Shortcuts' => 'Shortcuts', @@ -145,4 +146,4 @@ Dict::Add('EN US', 'English', 'English', array( 'Menu:SearchError+' => 'Search for known errors', 'Menu:Problem:KnownErrors' => 'All known errors', 'Menu:Problem:KnownErrors+' => 'All known errors', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/en_gb.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/en_gb.dict.itop-knownerror-mgmt.php index 5ec73a845..9c5187cf5 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/en_gb.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/en_gb.dict.itop-knownerror-mgmt.php @@ -1,4 +1,5 @@ 'Known Error', 'Class:KnownError+' => 'Error documented for a known issue', 'Class:KnownError/Attribute:name' => 'Name', @@ -93,13 +94,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:KnownError/Attribute:ci_list+' => 'All the configuration items that are related to this known error', 'Class:KnownError/Attribute:document_list' => 'Documents', 'Class:KnownError/Attribute:document_list+' => 'All the documents linked to this known error', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkErrorToFunctionalCI' => 'Link Error / FunctionalCI', 'Class:lnkErrorToFunctionalCI+' => 'Infra related to a known error', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s', @@ -113,13 +114,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Reason', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkDocumentToError' => 'Link Documents / Errors', 'Class:lnkDocumentToError+' => 'A link between a document and a known error', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s', @@ -133,9 +134,9 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '', 'Class:lnkDocumentToError/Attribute:link_type' => 'link_type', 'Class:lnkDocumentToError/Attribute:link_type+' => '', -)); +]); -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Menu:ProblemManagement' => 'Problem Management', 'Menu:ProblemManagement+' => 'Problem Management', 'Menu:Problem:Shortcuts' => 'Shortcuts', @@ -145,4 +146,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Menu:SearchError+' => 'Search for known errors', 'Menu:Problem:KnownErrors' => 'All known errors', 'Menu:Problem:KnownErrors+' => 'All known errors', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/es_cr.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/es_cr.dict.itop-knownerror-mgmt.php index 90eade30d..dc336528f 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/es_cr.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/es_cr.dict.itop-knownerror-mgmt.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:KnownError' => 'Error Conocido', 'Class:KnownError+' => 'Documentación para un error conocido', 'Class:KnownError/Attribute:name' => 'Nombre', @@ -50,13 +51,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:KnownError/Attribute:ci_list+' => 'ECs', 'Class:KnownError/Attribute:document_list' => 'Documentos', 'Class:KnownError/Attribute:document_list+' => 'Documentos', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkErrorToFunctionalCI' => 'Relación Error Conocido y EC Funcional', 'Class:lnkErrorToFunctionalCI+' => 'Relación Error Conocido y EC Funcional', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s', @@ -70,13 +71,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => 'Error Conocido', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Motivo', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => 'Motivo', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkDocumentToError' => 'Relación Documento y Error Conocido', 'Class:lnkDocumentToError+' => 'Relación Documento y Error Conocido', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s', @@ -90,9 +91,9 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkDocumentToError/Attribute:error_name+' => 'Error Conocido', 'Class:lnkDocumentToError/Attribute:link_type' => 'Tipo', 'Class:lnkDocumentToError/Attribute:link_type+' => 'Tipo', -)); +]); -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:ProblemManagement' => 'Administración de Problemas', 'Menu:ProblemManagement+' => 'GestAdministraciónión de problemas', 'Menu:Problem:Shortcuts' => 'Acceso Rápido', @@ -102,4 +103,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Menu:SearchError+' => 'Búsqueda de Errores Conocidos', 'Menu:Problem:KnownErrors' => 'Errores Conocidos', 'Menu:Problem:KnownErrors+' => 'Errores Conocidos', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/fr.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/fr.dict.itop-knownerror-mgmt.php index e7929a33e..980599b3c 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/fr.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/fr.dict.itop-knownerror-mgmt.php @@ -1,15 +1,16 @@ 'Erreur Connue', 'Class:KnownError+' => 'Erreur documenté pour un problème connu', 'Class:KnownError/Attribute:name' => 'Nom', @@ -52,13 +53,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:KnownError/Attribute:ci_list+' => 'Tous les éléments de configuration liés à cette erreur connue', 'Class:KnownError/Attribute:document_list' => 'Documents', 'Class:KnownError/Attribute:document_list+' => 'Tous les documents liés à cette erreur connue', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkErrorToFunctionalCI' => 'Lien Erreur / CI', 'Class:lnkErrorToFunctionalCI+' => 'Lien entre une erreur et un ci', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s', @@ -72,13 +73,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Reason', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkDocumentToError' => 'Lien Documents / Errors', 'Class:lnkDocumentToError+' => 'Lien entre un document et une erreur', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s', @@ -92,9 +93,9 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '', 'Class:lnkDocumentToError/Attribute:link_type' => 'link_type', 'Class:lnkDocumentToError/Attribute:link_type+' => '', -)); +]); -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Menu:ProblemManagement' => 'Gestion des problèmes', 'Menu:ProblemManagement+' => 'Gestion des problèmes', 'Menu:Problem:Shortcuts' => 'Raccourcis', @@ -104,4 +105,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Menu:SearchError+' => 'Rechercher une erreur connue', 'Menu:Problem:KnownErrors' => 'Toutes les erreurs connues', 'Menu:Problem:KnownErrors+' => 'Toutes les erreurs connues', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/hu.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/hu.dict.itop-knownerror-mgmt.php index 712057073..417998fe5 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/hu.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/hu.dict.itop-knownerror-mgmt.php @@ -1,15 +1,16 @@ 'Ismert hiba', 'Class:KnownError+' => '', 'Class:KnownError/Attribute:name' => 'Ismert hiba név', @@ -52,13 +53,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:KnownError/Attribute:ci_list+' => '', 'Class:KnownError/Attribute:document_list' => 'Dokumentumok', 'Class:KnownError/Attribute:document_list+' => '', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkErrorToFunctionalCI' => 'Hiba / Funkcionális CI', 'Class:lnkErrorToFunctionalCI+' => 'Infra ismert hibához kapcsolódóan', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -72,13 +73,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '~~', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Hibaok', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '~~', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkDocumentToError' => 'Dokumentumok / Hibák', 'Class:lnkDocumentToError+' => '', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s~~', @@ -92,9 +93,9 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '~~', 'Class:lnkDocumentToError/Attribute:link_type' => 'link_type', 'Class:lnkDocumentToError/Attribute:link_type+' => '~~', -)); +]); -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Menu:ProblemManagement' => 'Problémakezelés', 'Menu:ProblemManagement+' => '', 'Menu:Problem:Shortcuts' => 'Gyorsgomb', @@ -104,4 +105,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Menu:SearchError+' => '', 'Menu:Problem:KnownErrors' => 'Ismert hibák', 'Menu:Problem:KnownErrors+' => '', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/it.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/it.dict.itop-knownerror-mgmt.php index 66de1325b..c25cba1b2 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/it.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/it.dict.itop-knownerror-mgmt.php @@ -1,15 +1,16 @@ 'Errori conosciuti', 'Class:KnownError+' => 'Errori documentati per problemi noti', 'Class:KnownError/Attribute:name' => 'Nome', @@ -52,13 +53,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:KnownError/Attribute:ci_list+' => 'All the configuration items that are related to this known error~~', 'Class:KnownError/Attribute:document_list' => 'Documenti', 'Class:KnownError/Attribute:document_list+' => 'All the documents linked to this known error~~', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkErrorToFunctionalCI' => 'Link Errore /CIFunzionale', 'Class:lnkErrorToFunctionalCI+' => 'Infra impattata dal errore conosciuto', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -72,13 +73,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '~~', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Ragione', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '~~', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkDocumentToError' => 'Link Documento / Errore', 'Class:lnkDocumentToError+' => 'Link tra il documento e l\'errore conosciuto', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s~~', @@ -92,9 +93,9 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '~~', 'Class:lnkDocumentToError/Attribute:link_type' => 'link_type', 'Class:lnkDocumentToError/Attribute:link_type+' => '~~', -)); +]); -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Menu:ProblemManagement' => 'Gestione dei Problemi', 'Menu:ProblemManagement+' => 'Gestione dei Problemi', 'Menu:Problem:Shortcuts' => 'Scorciatoia', @@ -104,4 +105,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Menu:SearchError+' => 'Ricerca per Errori Conosciuti', 'Menu:Problem:KnownErrors' => 'Tutti gli errori conosciuti', 'Menu:Problem:KnownErrors+' => 'Tutti gli errori conosciuti', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/ja.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/ja.dict.itop-knownerror-mgmt.php index 23e2bf599..eb3d35313 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/ja.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/ja.dict.itop-knownerror-mgmt.php @@ -1,15 +1,16 @@ '既知のエラー', 'Class:KnownError+' => '既知の課題として文書化されたエラー', 'Class:KnownError/Attribute:name' => '名前', @@ -52,13 +53,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:KnownError/Attribute:ci_list+' => 'All the configuration items that are related to this known error~~', 'Class:KnownError/Attribute:document_list' => '文書', 'Class:KnownError/Attribute:document_list+' => 'All the documents linked to this known error~~', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkErrorToFunctionalCI' => 'リンク エラー/機能的CI', 'Class:lnkErrorToFunctionalCI+' => '既知のエラーに関連するインフラ', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -72,13 +73,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => '理由', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkDocumentToError' => 'リンク 文書/エラー', 'Class:lnkDocumentToError+' => '文書と既知のエラー間のリンク', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s~~', @@ -92,9 +93,9 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '', 'Class:lnkDocumentToError/Attribute:link_type' => 'リンクタイプ', 'Class:lnkDocumentToError/Attribute:link_type+' => '', -)); +]); -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Menu:ProblemManagement' => '問題管理', 'Menu:ProblemManagement+' => '問題管理', 'Menu:Problem:Shortcuts' => 'ショートカット', @@ -104,4 +105,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Menu:SearchError+' => '既知のエラー検索', 'Menu:Problem:KnownErrors' => '全ての既知のエラー', 'Menu:Problem:KnownErrors+' => '全ての既知のエラー', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/nl.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/nl.dict.itop-knownerror-mgmt.php index 1868438ca..3ad762c67 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/nl.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/nl.dict.itop-knownerror-mgmt.php @@ -1,17 +1,18 @@ * @author Jeffrey Bostoen (2018 - 2022) * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:KnownError' => 'Gekende fout', 'Class:KnownError+' => 'Gedocumenteerde fout voor een gekend probleem', 'Class:KnownError/Attribute:name' => 'Naam', @@ -54,13 +55,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:KnownError/Attribute:ci_list+' => 'Alle configuratie-items gerelateerd aan deze gekende fout', 'Class:KnownError/Attribute:document_list' => 'Documenten', 'Class:KnownError/Attribute:document_list+' => 'Alle documenten gerelateerd aan deze gekende fout', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkErrorToFunctionalCI' => 'Link Fout / Functioneel CI', 'Class:lnkErrorToFunctionalCI+' => 'Infrastructuur gelinkt aan een gekende fout', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s', @@ -74,13 +75,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Reden', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkDocumentToError' => 'Link Document / Fout', 'Class:lnkDocumentToError+' => 'Een link tussen een document en een gekende fout', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s', @@ -94,9 +95,9 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '', 'Class:lnkDocumentToError/Attribute:link_type' => 'Soort link', 'Class:lnkDocumentToError/Attribute:link_type+' => '', -)); +]); -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:ProblemManagement' => 'Probleem Management', 'Menu:ProblemManagement+' => 'Probleem Management', 'Menu:Problem:Shortcuts' => 'Snelkoppelingen', @@ -106,4 +107,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Menu:SearchError+' => 'Zoek naar gekende fouten', 'Menu:Problem:KnownErrors' => 'Alle gekende fouten', 'Menu:Problem:KnownErrors+' => 'Alle gekende fouten', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/pl.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/pl.dict.itop-knownerror-mgmt.php index 5e2202173..378ea72df 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/pl.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/pl.dict.itop-knownerror-mgmt.php @@ -1,15 +1,16 @@ 'Znany błąd', 'Class:KnownError+' => 'Udokumentowano błąd dotyczący znanego problemu', 'Class:KnownError/Attribute:name' => 'Nazwa', @@ -52,13 +53,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:KnownError/Attribute:ci_list+' => 'Wszystkie elementy konfiguracji związane z tym znanym błędem', 'Class:KnownError/Attribute:document_list' => 'Dokumenty', 'Class:KnownError/Attribute:document_list+' => 'Wszystkie dokumenty związane z tym znanym błędem', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkErrorToFunctionalCI' => 'Połączenie Błąd / Konfiguracja', 'Class:lnkErrorToFunctionalCI+' => 'Konfiguracje związane ze znanym błędem', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s', @@ -72,13 +73,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Powód', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkDocumentToError' => 'Połączenie Dokumenty / Błędy', 'Class:lnkDocumentToError+' => 'Łącze między dokumentem a znanym błędem', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s', @@ -92,9 +93,9 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '', 'Class:lnkDocumentToError/Attribute:link_type' => 'link_type', 'Class:lnkDocumentToError/Attribute:link_type+' => '', -)); +]); -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Menu:ProblemManagement' => 'Zarządzanie problemami', 'Menu:ProblemManagement+' => 'Zarządzanie problemami', 'Menu:Problem:Shortcuts' => 'Skróty', @@ -104,4 +105,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Menu:SearchError+' => 'Wyszukaj znane błędy', 'Menu:Problem:KnownErrors' => 'Wszystkie znane błędy', 'Menu:Problem:KnownErrors+' => 'Wszystkie znane błędy', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/pt_br.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/pt_br.dict.itop-knownerror-mgmt.php index c875a2222..fa09367a3 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/pt_br.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/pt_br.dict.itop-knownerror-mgmt.php @@ -1,15 +1,16 @@ 'Erro Conhecido', 'Class:KnownError+' => 'Erro documentado de um problema conhecido', 'Class:KnownError/Attribute:name' => 'Nome', @@ -52,13 +53,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:KnownError/Attribute:ci_list+' => 'Todos os itens de configuração associados a este erro conhecido', 'Class:KnownError/Attribute:document_list' => 'Documentos', 'Class:KnownError/Attribute:document_list+' => 'Todos os documentos associados a este erro conhecido', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkErrorToFunctionalCI' => 'Link Erro Conhecido / IC', 'Class:lnkErrorToFunctionalCI+' => 'Infraestrutura associada a este erro conhecido', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -72,13 +73,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Motivo do link', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkDocumentToError' => 'Link Documentos / Erros', 'Class:lnkDocumentToError+' => 'Uma ligação entre um documento e um erro conhecido', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s~~', @@ -92,9 +93,9 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '', 'Class:lnkDocumentToError/Attribute:link_type' => 'Tipo de link', 'Class:lnkDocumentToError/Attribute:link_type+' => '', -)); +]); -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Menu:ProblemManagement' => 'Gerenciamento de Problemas', 'Menu:ProblemManagement+' => 'Lista de Gerenciamento de Problemas', 'Menu:Problem:Shortcuts' => 'Atalhos', @@ -104,4 +105,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Menu:SearchError+' => '', 'Menu:Problem:KnownErrors' => 'Erros Conhecidos', 'Menu:Problem:KnownErrors+' => 'Erro documentado de um problema conhecido', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/ru.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/ru.dict.itop-knownerror-mgmt.php index 1f4448907..2e8384529 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/ru.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/ru.dict.itop-knownerror-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:KnownError' => 'Известная ошибка', 'Class:KnownError+' => 'Проблема, имеющая задокументированные корневую причину и обходное решение', 'Class:KnownError/Attribute:name' => 'Название', @@ -53,13 +54,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:KnownError/Attribute:ci_list+' => 'Связанный конфигурационные единицы', 'Class:KnownError/Attribute:document_list' => 'Документы', 'Class:KnownError/Attribute:document_list+' => 'Связанные документы', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkErrorToFunctionalCI' => 'Связь Известная ошибка/Функциональная КЕ', 'Class:lnkErrorToFunctionalCI+' => 'Infra related to a known error', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -73,13 +74,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Причина', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkDocumentToError' => 'Связь Документ/Известная ошибка', 'Class:lnkDocumentToError+' => 'A link between a document and a known error', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s~~', @@ -93,9 +94,9 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '', 'Class:lnkDocumentToError/Attribute:link_type' => 'Тип связи', 'Class:lnkDocumentToError/Attribute:link_type+' => '', -)); +]); -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:ProblemManagement' => 'Управление проблемами', 'Menu:ProblemManagement+' => 'Управление проблемами', 'Menu:Problem:Shortcuts' => 'Ярлыки', @@ -105,4 +106,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Menu:SearchError+' => 'Поиск известных ошибок', 'Menu:Problem:KnownErrors' => 'Известные ошибки', 'Menu:Problem:KnownErrors+' => 'База известных ошибок', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/sk.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/sk.dict.itop-knownerror-mgmt.php index 2ca2a77b4..0a3fc3605 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/sk.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/sk.dict.itop-knownerror-mgmt.php @@ -1,15 +1,16 @@ 'Known Error~~', 'Class:KnownError+' => 'Error documented for a known issue~~', 'Class:KnownError/Attribute:name' => 'Name~~', @@ -52,13 +53,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:KnownError/Attribute:ci_list+' => 'All the configuration items that are related to this known error~~', 'Class:KnownError/Attribute:document_list' => 'Documents~~', 'Class:KnownError/Attribute:document_list+' => 'All the documents linked to this known error~~', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkErrorToFunctionalCI' => 'Link Error / FunctionalCI~~', 'Class:lnkErrorToFunctionalCI+' => 'Infra related to a known error~~', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -72,13 +73,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '~~', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Reason~~', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '~~', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkDocumentToError' => 'Link Documents / Errors~~', 'Class:lnkDocumentToError+' => 'A link between a document and a known error~~', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s~~', @@ -92,9 +93,9 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '~~', 'Class:lnkDocumentToError/Attribute:link_type' => 'link_type~~', 'Class:lnkDocumentToError/Attribute:link_type+' => '~~', -)); +]); -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Menu:ProblemManagement' => 'Problem Management~~', 'Menu:ProblemManagement+' => 'Problem Management~~', 'Menu:Problem:Shortcuts' => 'Shortcuts~~', @@ -104,4 +105,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Menu:SearchError+' => 'Search for known errors~~', 'Menu:Problem:KnownErrors' => 'All known errors~~', 'Menu:Problem:KnownErrors+' => 'All known errors~~', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/tr.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/tr.dict.itop-knownerror-mgmt.php index 588d2ded5..5d52a8aa1 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/tr.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/tr.dict.itop-knownerror-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:KnownError' => 'Bilinen hata', 'Class:KnownError+' => 'Hata bilinen hatalara kaydedildi', 'Class:KnownError/Attribute:name' => 'Adı', @@ -53,13 +54,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:KnownError/Attribute:ci_list+' => 'All the configuration items that are related to this known error~~', 'Class:KnownError/Attribute:document_list' => 'Dokümanlar', 'Class:KnownError/Attribute:document_list+' => 'All the documents linked to this known error~~', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkErrorToFunctionalCI' => 'Hata / İşlevsel CI bağla', 'Class:lnkErrorToFunctionalCI+' => ' Bilinen bir hatayla ilgili alt bilgi', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -73,13 +74,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '~~', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => 'Sebep', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '~~', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkDocumentToError' => 'Belge / hata bağla', 'Class:lnkDocumentToError+' => 'Bir belge ile bilinen bir hata arasındaki bağlantı', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s~~', @@ -93,9 +94,9 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '~~', 'Class:lnkDocumentToError/Attribute:link_type' => 'Bağlantı tipi', 'Class:lnkDocumentToError/Attribute:link_type+' => '~~', -)); +]); -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Menu:ProblemManagement' => 'Problem Yönetimi', 'Menu:ProblemManagement+' => 'Problem Yönetimi', 'Menu:Problem:Shortcuts' => 'Kısayollar', @@ -105,4 +106,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Menu:SearchError+' => 'Bilinen hataları ara', 'Menu:Problem:KnownErrors' => 'Tüm bilinen hatalar', 'Menu:Problem:KnownErrors+' => 'Tüm bilinen hatalar', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/zh_cn.dict.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/zh_cn.dict.itop-knownerror-mgmt.php index f0a7a34ea..1fce2651a 100644 --- a/datamodels/2.x/itop-knownerror-mgmt/dictionaries/zh_cn.dict.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/dictionaries/zh_cn.dict.itop-knownerror-mgmt.php @@ -1,4 +1,5 @@ '已知错误', 'Class:KnownError+' => '记录一个已知错误', 'Class:KnownError/Attribute:name' => '名称', @@ -88,13 +89,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:KnownError/Attribute:ci_list+' => '此已知错误相关的所有配置项', 'Class:KnownError/Attribute:document_list' => '文档', 'Class:KnownError/Attribute:document_list+' => '此已知错误相关的所有文档', -)); +]); // // Class: lnkErrorToFunctionalCI // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkErrorToFunctionalCI' => '关联已知问题/功能配置项', 'Class:lnkErrorToFunctionalCI+' => '已知问题和功能配置项之间的关联', 'Class:lnkErrorToFunctionalCI/Name' => '%1$s / %2$s', @@ -108,13 +109,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkErrorToFunctionalCI/Attribute:error_name+' => '', 'Class:lnkErrorToFunctionalCI/Attribute:reason' => '原因', 'Class:lnkErrorToFunctionalCI/Attribute:reason+' => '', -)); +]); // // Class: lnkDocumentToError // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkDocumentToError' => '关联文档/已知问题', 'Class:lnkDocumentToError+' => '文档和已知问题之间的关联', 'Class:lnkDocumentToError/Name' => '%1$s / %2$s', @@ -128,9 +129,9 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkDocumentToError/Attribute:error_name+' => '', 'Class:lnkDocumentToError/Attribute:link_type' => '关联类型', 'Class:lnkDocumentToError/Attribute:link_type+' => '', -)); +]); -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Menu:ProblemManagement' => '问题管理', 'Menu:ProblemManagement+' => '问题管理', 'Menu:Problem:Shortcuts' => '快捷方式', @@ -140,4 +141,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Menu:SearchError+' => '搜索已知问题', 'Menu:Problem:KnownErrors' => '所有已知错误', 'Menu:Problem:KnownErrors+' => '所有已知错误', -)); +]); diff --git a/datamodels/2.x/itop-knownerror-mgmt/module.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/module.itop-knownerror-mgmt.php index 9e1d39203..d11cd8553 100755 --- a/datamodels/2.x/itop-knownerror-mgmt/module.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/module.itop-knownerror-mgmt.php @@ -1,10 +1,9 @@ 'Known Errors Database', @@ -12,22 +11,22 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-config-mgmt/2.2.0', - ), + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array( - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'data.struct' => [ //'data.struct.itop-knownerror-mgmt.xml', - ), - 'data.sample' => array( - ), - + ], + 'data.sample' => [ + ], + // Documentation // 'doc.manual_setup' => '', // No manual installation instructions @@ -35,7 +34,7 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); diff --git a/datamodels/2.x/itop-oauth-client/ajax.php b/datamodels/2.x/itop-oauth-client/ajax.php index 09b6e516d..c5714153b 100644 --- a/datamodels/2.x/itop-oauth-client/ajax.php +++ b/datamodels/2.x/itop-oauth-client/ajax.php @@ -1,4 +1,5 @@ = 0) { +if (version_compare(ITOP_DESIGN_LATEST_VERSION, '3.0') >= 0) { $sTemplates = MODULESROOT.'itop-oauth-client/templates'; } else { $sTemplates = MODULESROOT.'itop-oauth-client/templates/legacy'; @@ -19,5 +20,3 @@ if (version_compare(ITOP_DESIGN_LATEST_VERSION , '3.0') >= 0) { $oUpdateController = new AjaxOauthClientController($sTemplates, 'itop-oauth-client'); $oUpdateController->SetMenuId('OAuthClient'); $oUpdateController->HandleOperation(); - - diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/cs.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/cs.dict.itop-oauth-client.php index bfd6f406b..7c5cdc210 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/cs.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/cs.dict.itop-oauth-client.php @@ -1,10 +1,11 @@ 'This url must be copied in the OAuth2 configuration of the provider Erase the field to recalculate default value~~', 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', - 'Class:OAuthClient/Attribute:mailbox_list+' => '~~' + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', ]); // // Class: OAuthClientAzure // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:OAuthClientAzure' => 'OAuth Mail Access for Microsoft Azure~~', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientAzure/Attribute:scope' => 'Scope~~', @@ -93,13 +94,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'No~~', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant~~', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".~~', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google~~', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientGoogle/Attribute:scope' => 'Scope~~', @@ -120,4 +121,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'At least one OAuth client must have this flag to “Yes”, if you want iTop to use it for sending mails~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Yes~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'No~~', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/da.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/da.dict.itop-oauth-client.php index 500af50f3..7e0f7716d 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/da.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/da.dict.itop-oauth-client.php @@ -1,10 +1,11 @@ 'This url must be copied in the OAuth2 configuration of the provider Erase the field to recalculate default value~~', 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', - 'Class:OAuthClient/Attribute:mailbox_list+' => '~~' + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', ]); // // Class: OAuthClientAzure // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:OAuthClientAzure' => 'OAuth Mail Access for Microsoft Azure~~', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientAzure/Attribute:scope' => 'Scope~~', @@ -93,13 +94,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'No~~', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant~~', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".~~', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google~~', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientGoogle/Attribute:scope' => 'Scope~~', @@ -120,4 +121,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'At least one OAuth client must have this flag to “Yes”, if you want iTop to use it for sending mails~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Yes~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'No~~', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/de.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/de.dict.itop-oauth-client.php index 9047e6860..7d2a3dbd1 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/de.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/de.dict.itop-oauth-client.php @@ -1,4 +1,5 @@ 'Diese URL muss in die oAuth2-Konfiguration des Providers kopiert werden. Löschen Sie das Feld, um den Standardwert neu zu berechnen.', 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailpostfächer', - 'Class:OAuthClient/Attribute:mailbox_list+' => '' + 'Class:OAuthClient/Attribute:mailbox_list+' => '', ]); // // Class: OAuthClientAzure // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:OAuthClientAzure' => 'Mailpostfach-OAuth-Client für Microsoft Azure', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)', 'Class:OAuthClientAzure/Attribute:scope' => 'Scope', @@ -93,13 +94,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'Nein', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant-ID der konfigurierten Anwendung. Bei einer Multi-Tenant-Anwendung verwenden Sie "common".', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:OAuthClientGoogle' => 'Mailpostfach-OAuth-Client für Google', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)', 'Class:OAuthClientGoogle/Attribute:scope' => 'Scope', @@ -120,4 +121,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'Mindestens ein oAuth-Client muss dieses Flag auf "Ja" gesetzt haben, um über diesen Weg Mails durch iTop senden zu lassen.', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Ja', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'Nein', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/en.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/en.dict.itop-oauth-client.php index b8c0a3498..02160ebac 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/en.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/en.dict.itop-oauth-client.php @@ -1,4 +1,5 @@ 'OAuth Mail Access for Microsoft Azure', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)', 'Class:OAuthClientAzure/Attribute:scope' => 'Scope', @@ -93,15 +94,15 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp+' => 'At least one OAuth client must have this flag to “Yes”, if you want iTop to use it for sending mails', 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:yes' => 'Yes', 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'No', - 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant', - 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".', -)); + 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant', + 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".', +]); // // Class: OAuthClientGoogle // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)', 'Class:OAuthClientGoogle/Attribute:scope' => 'Scope', @@ -122,4 +123,4 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'At least one OAuth client must have this flag to “Yes”, if you want iTop to use it for sending mails', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Yes', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'No', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/en_gb.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/en_gb.dict.itop-oauth-client.php index 4bc16fd69..f3171148e 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/en_gb.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/en_gb.dict.itop-oauth-client.php @@ -1,4 +1,5 @@ 'OAuth Mail Access for Microsoft Azure', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)', 'Class:OAuthClientAzure/Attribute:scope' => 'Scope', @@ -95,13 +96,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'No', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)', 'Class:OAuthClientGoogle/Attribute:scope' => 'Scope', @@ -122,4 +123,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'At least one OAuth client must have this flag to “Yes”, if you want iTop to use it for sending mails.', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Yes', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'No', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/es_cr.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/es_cr.dict.itop-oauth-client.php index 7210a8dc3..123b7da5b 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/es_cr.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/es_cr.dict.itop-oauth-client.php @@ -1,4 +1,5 @@ 'Esta url debe copiarse en la configuración OAuth2 del proveedor Borre el campo para recalcular el valor predeterminado', 'Class:OAuthClient/Attribute:mailbox_list' => 'Lista de Buzones', - 'Class:OAuthClient/Attribute:mailbox_list+' => 'Lista de Buzones' + 'Class:OAuthClient/Attribute:mailbox_list+' => 'Lista de Buzones', ]); // // Class: OAuthClientAzure // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:OAuthClientAzure' => 'Cliente OAuth para Microsoft Azure', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)', 'Class:OAuthClientAzure/Attribute:scope' => 'Alcance', @@ -91,13 +92,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'No', 'Class:OAuthClientAzure/Attribute:tenant' => 'Inquilino', 'Class:OAuthClientAzure/Attribute:tenant+' => 'ID de inquilino de la aplicación configurada. Para aplicaciones multiinquilino, utilice "common".', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:OAuthClientGoogle' => 'Cliente OAuth para Google', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)', 'Class:OAuthClientGoogle/Attribute:scope' => 'Alcance', @@ -118,4 +119,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'Al menos un cliente OAuth debe tener este indicador en "Sí", si desea que iTop lo use para enviar correos electrónicos.', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Si', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'No', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/fr.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/fr.dict.itop-oauth-client.php index e377a8a4f..0030dbda9 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/fr.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/fr.dict.itop-oauth-client.php @@ -1,4 +1,5 @@ 'Supprimer cette %4$s', 'Class:OAuthClient/Attribute:mailbox_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:OAuthClient/Attribute:mailbox_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:OAuthClient/Attribute:mailbox_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s' + 'Class:OAuthClient/Attribute:mailbox_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s', ]); // // Class: OAuthClientAzure // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:OAuthClientAzure' => 'Client OAuth pour Microsoft Azure', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)', 'Class:OAuthClientAzure/Attribute:scope' => 'Niveaux d\'accès', @@ -97,13 +98,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'Non', 'Class:OAuthClientAzure/Attribute:tenant' => 'Locataire', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Locataire (Tenant ID) de l\'application configurée. Pour des applications à locataires multiples, veuillez saisir "common".', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:OAuthClientGoogle' => 'Client OAuth pour Google', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)', 'Class:OAuthClientGoogle/Attribute:scope' => 'Niveaux d\'accès', @@ -124,4 +125,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'Le Client OAuth utilisé pour l\'envoi d\'emails doit être à \'Oui\'', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Oui', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'Non', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/hu.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/hu.dict.itop-oauth-client.php index eab6f3168..56f0e031a 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/hu.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/hu.dict.itop-oauth-client.php @@ -1,4 +1,5 @@ 'This url must be copied in the OAuth2 configuration of the provider Erase the field to recalculate default value~~', 'Class:OAuthClient/Attribute:mailbox_list' => 'Postafiók lista', - 'Class:OAuthClient/Attribute:mailbox_list+' => '~~' + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', ]); // // Class: OAuthClientAzure // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:OAuthClientAzure' => 'OAuth Mail Access for Microsoft Azure~~', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)', 'Class:OAuthClientAzure/Attribute:scope' => 'Scope~~', @@ -93,13 +94,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'No~~', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant~~', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".~~', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google~~', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)', 'Class:OAuthClientGoogle/Attribute:scope' => 'Scope~~', @@ -120,4 +121,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'At least one OAuth client must have this flag to “Yes”, if you want iTop to use it for sending mails~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Yes~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'No~~', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/it.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/it.dict.itop-oauth-client.php index f69131458..b1460fee8 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/it.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/it.dict.itop-oauth-client.php @@ -1,4 +1,5 @@ 'This url must be copied in the OAuth2 configuration of the provider Erase the field to recalculate default value~~', 'Class:OAuthClient/Attribute:mailbox_list' => 'Lista delle caselle di posta', - 'Class:OAuthClient/Attribute:mailbox_list+' => '~~' + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', ]); // // Class: OAuthClientAzure // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:OAuthClientAzure' => 'OAuth Mail Access for Microsoft Azure~~', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)', 'Class:OAuthClientAzure/Attribute:scope' => 'Ambito', @@ -92,13 +93,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'No', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant~~', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".~~', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google~~', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)', 'Class:OAuthClientGoogle/Attribute:scope' => 'Ambito', @@ -119,4 +120,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'Almeno un client OAuth deve avere questo flag impostato su “Sì”, se si desidera che iTop lo utilizzi per inviare email', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Sì', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'No', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/ja.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/ja.dict.itop-oauth-client.php index 1b5ac0281..69b0e4338 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/ja.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/ja.dict.itop-oauth-client.php @@ -1,10 +1,11 @@ 'This url must be copied in the OAuth2 configuration of the provider Erase the field to recalculate default value~~', 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', - 'Class:OAuthClient/Attribute:mailbox_list+' => '~~' + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', ]); // // Class: OAuthClientAzure // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:OAuthClientAzure' => 'OAuth Mail Access for Microsoft Azure~~', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientAzure/Attribute:scope' => 'Scope~~', @@ -93,13 +94,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'No~~', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant~~', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".~~', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google~~', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientGoogle/Attribute:scope' => 'Scope~~', @@ -120,4 +121,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'At least one OAuth client must have this flag to “Yes”, if you want iTop to use it for sending mails~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Yes~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'No~~', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/nl.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/nl.dict.itop-oauth-client.php index 699ceffdf..57ed991db 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/nl.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/nl.dict.itop-oauth-client.php @@ -1,10 +1,11 @@ @@ -63,14 +64,14 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:OAuthClient/Attribute:redirect_url+' => 'This url must be copied in the OAuth2 configuration of the provider Erase the field to recalculate default value~~', 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', - 'Class:OAuthClient/Attribute:mailbox_list+' => '' + 'Class:OAuthClient/Attribute:mailbox_list+' => '', ]); // // Class: OAuthClientAzure // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:OAuthClientAzure' => 'OAuth Mail Access for Microsoft Azure~~', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)', 'Class:OAuthClientAzure/Attribute:scope' => 'Scope~~', @@ -93,13 +94,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'Nee', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant~~', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".~~', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google~~', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)', 'Class:OAuthClientGoogle/Attribute:scope' => 'Scope~~', @@ -120,4 +121,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'At least one OAuth client must have this flag to “Yes”, if you want iTop to use it for sending mails~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Ja', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'Nee', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/pl.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/pl.dict.itop-oauth-client.php index ff229ef08..2ad2102c7 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/pl.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/pl.dict.itop-oauth-client.php @@ -1,4 +1,5 @@ 'Ten adres URL należy skopiować w konfiguracji OAuth2 dostawcy Usuń pole, aby ponownie obliczyć wartość domyślną', 'Class:OAuthClient/Attribute:mailbox_list' => 'Skrzynki pocztowe', - 'Class:OAuthClient/Attribute:mailbox_list+' => '' + 'Class:OAuthClient/Attribute:mailbox_list+' => '', ]); // // Class: OAuthClientAzure // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:OAuthClientAzure' => 'OAuth Mail Access for Microsoft Azure~~', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)', 'Class:OAuthClientAzure/Attribute:scope' => 'Zakres', @@ -176,14 +177,14 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:yes' => 'Tak', 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'Nie', 'Class:OAuthClientAzure/Attribute:tenant' => 'Dzierżawa', - 'Class:OAuthClientAzure/Attribute:tenant+' => 'Identyfikator dzierżawy skonfigurowanej aplikacji. W przypadku aplikacji z wieloma dzierżawcami użyj „wspólnego”.' -)); + 'Class:OAuthClientAzure/Attribute:tenant+' => 'Identyfikator dzierżawy skonfigurowanej aplikacji. W przypadku aplikacji z wieloma dzierżawcami użyj „wspólnego”.', +]); // // Class: OAuthClientGoogle // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google~~', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)', 'Class:OAuthClientGoogle/Attribute:scope' => 'Zakres', @@ -251,5 +252,5 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( yes +' => '', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Tak', - 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'Nie' -)); + 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'Nie', +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/pt_br.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/pt_br.dict.itop-oauth-client.php index eeb5ae2ee..81f0655bd 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/pt_br.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/pt_br.dict.itop-oauth-client.php @@ -1,10 +1,11 @@ 'This url must be copied in the OAuth2 configuration of the provider Erase the field to recalculate default value~~', 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', - 'Class:OAuthClient/Attribute:mailbox_list+' => '~~' + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', ]); // // Class: OAuthClientAzure // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:OAuthClientAzure' => 'OAuth Mail Access for Microsoft Azure~~', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientAzure/Attribute:scope' => 'Scope~~', @@ -93,13 +94,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'No~~', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant~~', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".~~', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google~~', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientGoogle/Attribute:scope' => 'Scope~~', @@ -120,4 +121,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'At least one OAuth client must have this flag to “Yes”, if you want iTop to use it for sending mails~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Yes~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'No~~', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/ru.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/ru.dict.itop-oauth-client.php index 483f34534..81af8c72e 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/ru.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/ru.dict.itop-oauth-client.php @@ -1,10 +1,11 @@ 'This url must be copied in the OAuth2 configuration of the provider Erase the field to recalculate default value~~', 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', - 'Class:OAuthClient/Attribute:mailbox_list+' => '~~' + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', ]); // // Class: OAuthClientAzure // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:OAuthClientAzure' => 'OAuth Mail Access for Microsoft Azure~~', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientAzure/Attribute:scope' => 'Scope~~', @@ -93,13 +94,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'No~~', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant~~', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".~~', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google~~', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientGoogle/Attribute:scope' => 'Scope~~', @@ -120,4 +121,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'At least one OAuth client must have this flag to “Yes”, if you want iTop to use it for sending mails~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Yes~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'No~~', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/sk.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/sk.dict.itop-oauth-client.php index 4edbefe08..37bbe223b 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/sk.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/sk.dict.itop-oauth-client.php @@ -1,10 +1,11 @@ 'OAuth Mail Access for Microsoft Azure~~', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientAzure/Attribute:scope' => 'Scope~~', @@ -92,13 +93,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'No~~', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant~~', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".~~', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google~~', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientGoogle/Attribute:scope' => 'Scope~~', @@ -119,4 +120,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'At least one OAuth client must have this flag to “Yes”, if you want iTop to use it for sending mails~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Yes~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'No~~', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/tr.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/tr.dict.itop-oauth-client.php index fb05cd185..21d60974e 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/tr.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/tr.dict.itop-oauth-client.php @@ -1,10 +1,11 @@ 'This url must be copied in the OAuth2 configuration of the provider Erase the field to recalculate default value~~', 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', - 'Class:OAuthClient/Attribute:mailbox_list+' => '~~' + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', ]); // // Class: OAuthClientAzure // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:OAuthClientAzure' => 'OAuth Mail Access for Microsoft Azure~~', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientAzure/Attribute:scope' => 'Scope~~', @@ -93,13 +94,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => 'No~~', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant~~', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".~~', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google~~', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', 'Class:OAuthClientGoogle/Attribute:scope' => 'Scope~~', @@ -120,4 +121,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => 'At least one OAuth client must have this flag to “Yes”, if you want iTop to use it for sending mails~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => 'Yes~~', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => 'No~~', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/dictionaries/zh_cn.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/dictionaries/zh_cn.dict.itop-oauth-client.php index a4b173be6..048ad3b9e 100644 --- a/datamodels/2.x/itop-oauth-client/dictionaries/zh_cn.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/dictionaries/zh_cn.dict.itop-oauth-client.php @@ -1,4 +1,5 @@ 'OAuth Mail Access for Microsoft Azure~~', 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)', 'Class:OAuthClientAzure/Attribute:scope' => '范围', @@ -91,13 +92,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:OAuthClientAzure/Attribute:used_for_smtp/Value:no' => '否', 'Class:OAuthClientAzure/Attribute:tenant' => 'Tenant~~', 'Class:OAuthClientAzure/Attribute:tenant+' => 'Tenant ID of the configured application. For multi-tenant application, use "common".~~', -)); +]); // // Class: OAuthClientGoogle // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:OAuthClientGoogle' => 'OAuth Mail Access for Google~~', 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)', 'Class:OAuthClientGoogle/Attribute:scope' => '范围', @@ -118,4 +119,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:OAuthClientGoogle/Attribute:used_for_smtp+' => '如果您需要系统使用其发送邮件, 则至少需要有一个OAuth客户端标记为 "是"', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:yes' => '是', 'Class:OAuthClientGoogle/Attribute:used_for_smtp/Value:no' => '否', -)); +]); diff --git a/datamodels/2.x/itop-oauth-client/index.php b/datamodels/2.x/itop-oauth-client/index.php index da490e18e..888a68d92 100644 --- a/datamodels/2.x/itop-oauth-client/index.php +++ b/datamodels/2.x/itop-oauth-client/index.php @@ -1,4 +1,5 @@ = 0) { +if (version_compare(ITOP_DESIGN_LATEST_VERSION, '3.0') >= 0) { $sTemplates = MODULESROOT.'itop-oauth-client/templates'; } else { $sTemplates = MODULESROOT.'itop-oauth-client/templates/legacy'; @@ -20,5 +21,3 @@ $oUpdateController = new OAuthClientController($sTemplates, 'itop-oauth-client') $oUpdateController->AllowOnlyAdmin(); $oUpdateController->SetDefaultOperation('CreateMailbox'); $oUpdateController->HandleOperation(); - - diff --git a/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php index 080609c61..d5d3cdc2c 100644 --- a/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php @@ -1,4 +1,5 @@ 'OAuth 2.0 client', @@ -14,39 +15,38 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-welcome-itil/3.1.0,', - ), + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array( + 'datamodel' => [ 'vendor/autoload.php', 'src/Service/PopupMenuExtension.php', 'src/Service/ApplicationUIExtension.php', - ), - 'webservice' => array( - - ), - 'data.struct' => array( + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); - diff --git a/datamodels/2.x/itop-oauth-client/src/Controller/AjaxOauthClientController.php b/datamodels/2.x/itop-oauth-client/src/Controller/AjaxOauthClientController.php index 4c8fac7c2..fd6839691 100644 --- a/datamodels/2.x/itop-oauth-client/src/Controller/AjaxOauthClientController.php +++ b/datamodels/2.x/itop-oauth-client/src/Controller/AjaxOauthClientController.php @@ -1,4 +1,5 @@ 'success', 'data' => []]; - try { - $sAuthorizationUrl = OAuthClientProviderFactory::GetAuthorizationUrl($oOAuthClient); - $aResult['data']['authorization_url'] = $sAuthorizationUrl; - } catch (Exception $oException) { - $aResult['status'] = 'error'; - $aResult['error_description'] = $oException->getMessage(); - } + try { + $sAuthorizationUrl = OAuthClientProviderFactory::GetAuthorizationUrl($oOAuthClient); + $aResult['data']['authorization_url'] = $sAuthorizationUrl; + } catch (Exception $oException) { + $aResult['status'] = 'error'; + $aResult['error_description'] = $oException->getMessage(); + } $this->DisplayJSONPage($aResult); } @@ -76,8 +77,7 @@ class AjaxOauthClientController extends Controller $oAccessToken = OAuthClientProviderFactory::GetAccessTokenFromCode($oOAuthClient, $sCode); $oOAuthClient->SetAccessToken($oAccessToken); $aResult['status'] = 'success'; - } - catch (IdentityProviderException $e) { + } catch (IdentityProviderException $e) { $aResult['status'] = 'error'; $aResult['error_description'] = $e->getMessage(); } @@ -124,4 +124,4 @@ class AjaxOauthClientController extends Controller $this->DisplayJSONPage($aResult); } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-oauth-client/src/Controller/OAuthClientController.php b/datamodels/2.x/itop-oauth-client/src/Controller/OAuthClientController.php index 0d1322e29..f8454a1c8 100644 --- a/datamodels/2.x/itop-oauth-client/src/Controller/OAuthClientController.php +++ b/datamodels/2.x/itop-oauth-client/src/Controller/OAuthClientController.php @@ -1,4 +1,5 @@ DisplayPage($aParams); } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-oauth-client/src/Service/ApplicationUIExtension.php b/datamodels/2.x/itop-oauth-client/src/Service/ApplicationUIExtension.php index 9b67aa56e..8c0499687 100644 --- a/datamodels/2.x/itop-oauth-client/src/Service/ApplicationUIExtension.php +++ b/datamodels/2.x/itop-oauth-client/src/Service/ApplicationUIExtension.php @@ -1,4 +1,5 @@ 'Uživatelský portál %1$s', 'Page:PleaseWait' => 'Počkejte prosím', 'Page:Home' => 'Domů', @@ -53,19 +54,19 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Otevřít / Stáhnout', 'Portal:Calendar-FirstDayOfWeek' => 'cs', //work with moment.js locales -)); +]); // Object form -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Zavřít tento vstup', 'Portal:Form:Close:Warning' => 'Opravdu chcete opustit tento formulář? Data vložená do formuláře budou ztracena ', 'Portal:Error:ObjectCannotBeCreated' => 'Chyba: objekt nelze vytvořit. Před opětovným odesláním tohoto formuláře zkontrolujte související objekty a přílohy.', 'Portal:Error:ObjectCannotBeUpdated' => 'Chyba: objekt nelze vytvořit. Před opětovným odesláním tohoto formuláře zkontrolujte související objekty a přílohy.', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Brick:Portal:UserProfile:Name' => 'Uživatelský profil', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'Můj profil', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Odhlásit', @@ -76,15 +77,15 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Nepodařilo se změnit heslo, kontaktujte prosím administrátora', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Osobní informace', 'Brick:Portal:UserProfile:Photo:Title' => 'Foto', -)); +]); // AggregatePageBrick -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Nástěnka', -)); +]); // BrowseBrick brick -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Brick:Portal:Browse:Name' => 'Procházet položky', 'Brick:Portal:Browse:Mode:List' => 'Seznam', 'Brick:Portal:Browse:Mode:Tree' => 'Strom', @@ -97,10 +98,10 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Rozbalit vše', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Sbalit vše', 'Brick:Portal:Browse:Filter:NoData' => 'Žádná položka', -)); +]); // ManageBrick brick -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Brick:Portal:Manage:Name' => 'Spravovat položky', 'Brick:Portal:Manage:Table:NoData' => 'Žádná položka', 'Brick:Portal:Manage:Table:ItemActions' => 'Akce', @@ -115,10 +116,10 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Brick:Portal:Manage:fct:avg' => 'Průměr', 'Brick:Portal:Manage:fct:min' => 'Min', 'Brick:Portal:Manage:fct:max' => 'Max', -)); +]); // ObjectBrick brick -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Brick:Portal:Object:Name' => 'Objekt', 'Brick:Portal:Object:Form:Create:Title' => 'Nový %1$s', 'Brick:Portal:Object:Form:Edit:Title' => 'Aktualizace %2$s (%1$s)', @@ -130,18 +131,18 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Vybrat %1$s (%2$s)', 'Brick:Portal:Object:Copy:TextToCopy' => '%1$s: %2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Zkopíruj odkaz na objekt', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Zkopírováno' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Zkopírováno', +]); // CreateBrick brick -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Brick:Portal:Create:Name' => 'Rychlé vytvoření', 'Brick:Portal:Create:ChooseType' => 'Vyberte typ', -)); +]); // Filter brick -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Brick:Portal:Filter:Name' => 'Předfiltrování dlaždice', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'např. připojení k wifi', 'Brick:Portal:Filter:SearchInput:Submit' => 'Vyhledat', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/da.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/da.dict.itop-portal-base.php index 4a4d36a6d..9524f975e 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/da.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/da.dict.itop-portal-base.php @@ -1,15 +1,16 @@ '%1$s User portal~~', 'Page:PleaseWait' => 'Please wait...~~', 'Page:Home' => 'Home~~', @@ -53,19 +54,19 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Portal:File:DisplayInfo' => '%1$s~~', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Open / Download~~', 'Portal:Calendar-FirstDayOfWeek' => 'da', //work with moment.js locales -)); +]); // Object form -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Close this entry~~', 'Portal:Form:Close:Warning' => 'Do you want to leave this form? Data entered may be lost~~', 'Portal:Error:ObjectCannotBeCreated' => 'Error: object cannot be created. Check associated objects and attachments before submitting this form again.~~', 'Portal:Error:ObjectCannotBeUpdated' => 'Error: object cannot be updated. Check associated objects and attachments before submitting this form again.~~', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Brick:Portal:UserProfile:Name' => 'User profile~~', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'My profile~~', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Logoff~~', @@ -76,15 +77,15 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Can\'t change password, please contact your %1$s administrator~~', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Personal information~~', 'Brick:Portal:UserProfile:Photo:Title' => 'Photo~~', -)); +]); // AggregatePageBrick -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Dashboard~~', -)); +]); // BrowseBrick brick -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Brick:Portal:Browse:Name' => 'Browse throught items~~', 'Brick:Portal:Browse:Mode:List' => 'List~~', 'Brick:Portal:Browse:Mode:Tree' => 'Tree~~', @@ -97,10 +98,10 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Expand all~~', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Collapse all~~', 'Brick:Portal:Browse:Filter:NoData' => 'No item~~', -)); +]); // ManageBrick brick -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Brick:Portal:Manage:Name' => 'Manage items~~', 'Brick:Portal:Manage:Table:NoData' => 'No item.~~', 'Brick:Portal:Manage:Table:ItemActions' => 'Actions~~', @@ -115,10 +116,10 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Brick:Portal:Manage:fct:avg' => 'Average~~', 'Brick:Portal:Manage:fct:min' => 'Min~~', 'Brick:Portal:Manage:fct:max' => 'Max~~', -)); +]); // ObjectBrick brick -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Brick:Portal:Object:Name' => 'Object~~', 'Brick:Portal:Object:Form:Create:Title' => 'New %1$s~~', 'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)~~', @@ -130,18 +131,18 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)~~', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link~~', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~', +]); // CreateBrick brick -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Brick:Portal:Create:Name' => 'Quick creation~~', 'Brick:Portal:Create:ChooseType' => 'Please, choose a type~~', -)); +]); // Filter brick -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Brick:Portal:Filter:Name' => 'Prefilter a brick~~', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'eg. connect wifi~~', 'Brick:Portal:Filter:SearchInput:Submit' => 'Search~~', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/de.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/de.dict.itop-portal-base.php index f4e34d8d8..032dad176 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/de.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/de.dict.itop-portal-base.php @@ -1,15 +1,16 @@ '%1$s - Benutzer Portal', 'Page:PleaseWait' => 'Bitte warten...', 'Page:Home' => 'Start', @@ -53,19 +54,19 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Öffnen / Download', 'Portal:Calendar-FirstDayOfWeek' => 'de', //work with moment.js locales -)); +]); // Object form -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Dieses Objekt schließen', 'Portal:Form:Close:Warning' => 'Soll diese Eingabemaske verlassen werden? Eingegebene Daten werden nicht gespeichert.', 'Portal:Error:ObjectCannotBeCreated' => 'Error: Objekt kann nicht erzeugt werden. Prüfen Sie verknüpfte Objekte und Anhänge bevor Sie dieses Formular erneut abschicken.', 'Portal:Error:ObjectCannotBeUpdated' => 'Error: Objekt kann nicht geupdated werden. Prüfen Sie verknüpfte Objekte und Anhänge bevor Sie dieses Formular erneut abschicken.', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Brick:Portal:UserProfile:Name' => 'Benutzer Profil', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'Mein Profil', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Abmelden', @@ -76,15 +77,15 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Passwort kann nicht geändert werden - bitte kontaktieren Sie Ihren %1$s Administrator', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Persönliche Informationen', 'Brick:Portal:UserProfile:Photo:Title' => 'Foto', -)); +]); // AggregatePageBrick -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Dashboard', -)); +]); // BrowseBrick brick -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Brick:Portal:Browse:Name' => 'Liste durchgehen', 'Brick:Portal:Browse:Mode:List' => 'Liste', 'Brick:Portal:Browse:Mode:Tree' => 'Baum', @@ -97,10 +98,10 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Alle expandieren', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Alle kollabieren', 'Brick:Portal:Browse:Filter:NoData' => 'Kein Eintrag', -)); +]); // ManageBrick brick -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Brick:Portal:Manage:Name' => 'Einträge managen', 'Brick:Portal:Manage:Table:NoData' => 'Kein Eintrag.', 'Brick:Portal:Manage:Table:ItemActions' => 'Aktionen', @@ -115,10 +116,10 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Brick:Portal:Manage:fct:avg' => 'Durchschnitt', 'Brick:Portal:Manage:fct:min' => 'Minimum', 'Brick:Portal:Manage:fct:max' => 'Maximum', -)); +]); // ObjectBrick brick -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Brick:Portal:Object:Name' => 'Object', 'Brick:Portal:Object:Form:Create:Title' => 'Neue %1$s', 'Brick:Portal:Object:Form:Edit:Title' => 'Wird aktualisiert %2$s (%1$s)', @@ -130,18 +131,18 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Objektverknüpfung kopieren', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Kopiert' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Kopiert', +]); // CreateBrick brick -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Brick:Portal:Create:Name' => 'Schnelles Erstellen', 'Brick:Portal:Create:ChooseType' => 'Bitte wählen Sie einen Typ', -)); +]); // Filter brick -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Brick:Portal:Filter:Name' => 'Brick vorfiltern', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'z.B. connect wifi', 'Brick:Portal:Filter:SearchInput:Submit' => 'Suchen', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/en.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/en.dict.itop-portal-base.php index 77c9033d6..e05b6faa9 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/en.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/en.dict.itop-portal-base.php @@ -1,4 +1,5 @@ '%1$s User portal', 'Page:PleaseWait' => 'Please wait...', 'Page:Home' => 'Home', @@ -62,19 +63,19 @@ Dict::Add('EN US', 'English', 'English', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Open / Download', 'Portal:Calendar-FirstDayOfWeek' => 'en-us', //work with moment.js locales -)); +]); // Object form -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Close this entry', 'Portal:Form:Close:Warning' => 'Do you want to leave this form? Data entered may be lost', 'Portal:Error:ObjectCannotBeCreated' => 'Error: object cannot be created. Check associated objects and attachments before submitting this form again.', 'Portal:Error:ObjectCannotBeUpdated' => 'Error: object cannot be updated. Check associated objects and attachments before submitting this form again.', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s', +]); // UserProfile brick -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Brick:Portal:UserProfile:Name' => 'User profile', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'My profile', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Logoff', @@ -85,15 +86,15 @@ Dict::Add('EN US', 'English', 'English', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Can\'t change password, please contact your %1$s administrator', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Personal information', 'Brick:Portal:UserProfile:Photo:Title' => 'Photo', -)); +]); // AggregatePageBrick -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Dashboard', -)); +]); // BrowseBrick brick -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Brick:Portal:Browse:Name' => 'Browse throught items', 'Brick:Portal:Browse:Mode:List' => 'List', 'Brick:Portal:Browse:Mode:Tree' => 'Tree', @@ -106,10 +107,10 @@ Dict::Add('EN US', 'English', 'English', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Expand all', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Collapse all', 'Brick:Portal:Browse:Filter:NoData' => 'No item', -)); +]); // ManageBrick brick -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Brick:Portal:Manage:Name' => 'Manage items', 'Brick:Portal:Manage:Table:NoData' => 'No item.', 'Brick:Portal:Manage:Table:ItemActions' => 'Actions', @@ -124,10 +125,10 @@ Dict::Add('EN US', 'English', 'English', array( 'Brick:Portal:Manage:fct:avg' => 'Average', 'Brick:Portal:Manage:fct:min' => 'Min', 'Brick:Portal:Manage:fct:max' => 'Max', -)); +]); // ObjectBrick brick -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Brick:Portal:Object:Name' => 'Object', 'Brick:Portal:Object:Form:Create:Title' => 'New %1$s', 'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)', @@ -139,18 +140,18 @@ Dict::Add('EN US', 'English', 'English', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied', +]); // CreateBrick brick -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Brick:Portal:Create:Name' => 'Quick creation', 'Brick:Portal:Create:ChooseType' => 'Please, choose a type', -)); +]); // Filter brick -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Brick:Portal:Filter:Name' => 'Prefilter a brick', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'eg. connect wifi', 'Brick:Portal:Filter:SearchInput:Submit' => 'Search', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/en_gb.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/en_gb.dict.itop-portal-base.php index 60473c6e2..993262f7f 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/en_gb.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/en_gb.dict.itop-portal-base.php @@ -1,11 +1,12 @@ '%1$s User portal', 'Page:PleaseWait' => 'Please wait...', 'Page:Home' => 'Home', @@ -49,19 +50,19 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Open / Download', 'Portal:Calendar-FirstDayOfWeek' => 'en-gb', -)); +]); // Object form -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Close this entry', 'Portal:Form:Close:Warning' => 'Do you want to leave this form? Data entered may be lost', 'Portal:Error:ObjectCannotBeCreated' => 'Error: object cannot be created. Check associated objects and attachments before submitting this form again.', 'Portal:Error:ObjectCannotBeUpdated' => 'Error: object cannot be updated. Check associated objects and attachments before submitting this form again.', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s', +]); // UserProfile brick -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Brick:Portal:UserProfile:Name' => 'User profile', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'My profile', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Log off', @@ -72,15 +73,15 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Can\'t change password, please contact your %1$s administrator', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Personal information', 'Brick:Portal:UserProfile:Photo:Title' => 'Photo', -)); +]); // AggregatePageBrick -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Dashboard', -)); +]); // BrowseBrick brick -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Brick:Portal:Browse:Name' => 'Browse through items', 'Brick:Portal:Browse:Mode:List' => 'List', 'Brick:Portal:Browse:Mode:Tree' => 'Tree', @@ -93,10 +94,10 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Expand all', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Collapse all', 'Brick:Portal:Browse:Filter:NoData' => 'No item', -)); +]); // ManageBrick brick -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Brick:Portal:Manage:Name' => 'Manage items', 'Brick:Portal:Manage:Table:NoData' => 'No item.', 'Brick:Portal:Manage:Table:ItemActions' => 'Actions', @@ -111,10 +112,10 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Brick:Portal:Manage:fct:avg' => 'Average', 'Brick:Portal:Manage:fct:min' => 'Min', 'Brick:Portal:Manage:fct:max' => 'Max', -)); +]); // ObjectBrick brick -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Brick:Portal:Object:Name' => 'Object', 'Brick:Portal:Object:Form:Create:Title' => 'New %1$s', 'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)', @@ -126,18 +127,18 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied', +]); // CreateBrick brick -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Brick:Portal:Create:Name' => 'Quick creation', 'Brick:Portal:Create:ChooseType' => 'Please, choose a type', -)); +]); // Filter brick -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Brick:Portal:Filter:Name' => 'Prefilter a brick', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'eg. connect wifi', 'Brick:Portal:Filter:SearchInput:Submit' => 'Search', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/es_cr.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/es_cr.dict.itop-portal-base.php index 4796806c4..b4b84bb8e 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/es_cr.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/es_cr.dict.itop-portal-base.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Page:DefaultTitle' => '%1$s - Portal de Usuario', 'Page:PleaseWait' => 'Por favor espere...', 'Page:Home' => 'Inicio', @@ -51,19 +52,19 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Abierto / Descarga', 'Portal:Calendar-FirstDayOfWeek' => 'es', //work with moment.js locales -)); +]); // Object form -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Cerrar este registro', 'Portal:Form:Close:Warning' => '¿Desea abandorar este formulario? Datos modificados se perderan', 'Portal:Error:ObjectCannotBeCreated' => 'Error: no se puede crear el objeto. Verifique los objetos asociados y archivos adjuntos antes de enviar nuevamente este formulario.', 'Portal:Error:ObjectCannotBeUpdated' => 'Error: no se puede actualizar el objeto. Verifique los objetos asociados y archivos adjuntos antes de enviar nuevamente este formulario.', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Brick:Portal:UserProfile:Name' => 'Perfil del usuario', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'Mi perfil', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Cerrar Sesión', @@ -74,15 +75,15 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'No se puede cambiar la contraseña, póngase en contacto con el administrador de %1$s', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Información Personal', 'Brick:Portal:UserProfile:Photo:Title' => 'Foto', -)); +]); // AggregatePageBrick -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Tablero de Control', -)); +]); // BrowseBrick brick -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Brick:Portal:Browse:Name' => 'Buscar en todos los elementos', 'Brick:Portal:Browse:Mode:List' => 'Lista', 'Brick:Portal:Browse:Mode:Tree' => 'Árbol', @@ -95,10 +96,10 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Expandir todo', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Desplegar todo', 'Brick:Portal:Browse:Filter:NoData' => 'Sin elementos', -)); +]); // ManageBrick brick -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Brick:Portal:Manage:Name' => 'Administrar elementos', 'Brick:Portal:Manage:Table:NoData' => 'Sin elementos', 'Brick:Portal:Manage:Table:ItemActions' => 'Acciones', @@ -113,10 +114,10 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Brick:Portal:Manage:fct:avg' => 'Promedio', 'Brick:Portal:Manage:fct:min' => 'Mínimo', 'Brick:Portal:Manage:fct:max' => 'Máximo', -)); +]); // ObjectBrick brick -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Brick:Portal:Object:Name' => 'Objecto', 'Brick:Portal:Object:Form:Create:Title' => 'Nuevo %1$s', 'Brick:Portal:Object:Form:Edit:Title' => 'Actualizando %2$s (%1$s)', @@ -128,18 +129,18 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Selección %1$s (%2$s)', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Copiar liga al objeto', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copiado' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copiado', +]); // CreateBrick brick -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Brick:Portal:Create:Name' => 'Creación rápida', 'Brick:Portal:Create:ChooseType' => 'Por favor, seleccione un tipo', -)); +]); // Filter brick -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Brick:Portal:Filter:Name' => 'Prefiltrar bloque', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'Ej.:. Conectar a WiFi', 'Brick:Portal:Filter:SearchInput:Submit' => 'Buscar', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/fr.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/fr.dict.itop-portal-base.php index 3c9639b66..d9b309270 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/fr.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/fr.dict.itop-portal-base.php @@ -1,15 +1,16 @@ 'Portail utilisateur %1$s', 'Page:PleaseWait' => 'Veuillez patienter...', 'Page:Home' => 'Accueil', @@ -53,19 +54,19 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Ouvrir / Télécharger', 'Portal:Calendar-FirstDayOfWeek' => 'fr', //work with moment.js locales -)); +]); // Object form -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Fermer cette entrée', 'Portal:Form:Close:Warning' => 'Voulez-vous quitter ce formulaire ? Les données saisies seront perdues', 'Portal:Error:ObjectCannotBeCreated' => 'Erreur: L\'objet n\'a pas été créé. Vérifiez les objets liés et les attachements avant de soumettre à nouveau le formulaire.', 'Portal:Error:ObjectCannotBeUpdated' => 'Erreur: L\'objet n\'a pas été modifié. Vérifiez les objets liés et les attachements avant de soumettre à nouveau le formulaire.', - 'Portal:Error:CheckToWriteFailed' => 'Erreur durant la validation du champ \'%1$s\' : %2$s', -)); + 'Portal:Error:CheckToWriteFailed' => 'Erreur durant la validation du champ \'%1$s\' : %2$s', +]); // UserProfile brick -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Brick:Portal:UserProfile:Name' => 'Profil utilisateur', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'Mon profil', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Déconnexion', @@ -76,15 +77,15 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Impossible de modifier votre mot de passe, veuillez contacter votre administrateur %1$s', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Informations personnelles', 'Brick:Portal:UserProfile:Photo:Title' => 'Photo', -)); +]); // AggregatePageBrick -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Tableau de bord', -)); +]); // BrowseBrick brick -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Brick:Portal:Browse:Name' => 'Navigation dans les éléments', 'Brick:Portal:Browse:Mode:List' => 'Liste', 'Brick:Portal:Browse:Mode:Tree' => 'Hiérarchie', @@ -97,10 +98,10 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Tout déplier', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Tout replier', 'Brick:Portal:Browse:Filter:NoData' => 'Aucun élément', -)); +]); // ManageBrick brick -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Brick:Portal:Manage:Name' => 'Gestion d\'éléments', 'Brick:Portal:Manage:Table:NoData' => 'Aucun élément', 'Brick:Portal:Manage:Table:ItemActions' => 'Actions', @@ -115,10 +116,10 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Brick:Portal:Manage:fct:avg' => 'Moyenne', 'Brick:Portal:Manage:fct:min' => 'Min', 'Brick:Portal:Manage:fct:max' => 'Max', -)); +]); // ObjectBrick brick -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Brick:Portal:Object:Name' => 'Objet', 'Brick:Portal:Object:Form:Create:Title' => 'Création de %1$s', 'Brick:Portal:Object:Form:Edit:Title' => 'Modification de %2$s (%1$s)', @@ -130,18 +131,18 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Sélection de %1$s (%2$s)', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Copier l\'url de l\'objet', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copié' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copié', +]); // CreateBrick brick -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Brick:Portal:Create:Name' => 'Création rapide', 'Brick:Portal:Create:ChooseType' => 'Veuillez choisir le type', -)); +]); // Filter brick -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Brick:Portal:Filter:Name' => 'Préfiltre une brique', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'ex : connecter wifi', 'Brick:Portal:Filter:SearchInput:Submit' => 'Rechercher', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/hu.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/hu.dict.itop-portal-base.php index c67914d2e..c5c05fd88 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/hu.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/hu.dict.itop-portal-base.php @@ -1,15 +1,16 @@ '%1$s Felhasználói portál', 'Page:PleaseWait' => 'Kérem várjon...', 'Page:Home' => 'Kezdőlap', @@ -53,19 +54,19 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Megnyitás / Letöltés', 'Portal:Calendar-FirstDayOfWeek' => 'hu', //work with moment.js locales -)); +]); // Object form -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Bejegyzés bezárása', 'Portal:Form:Close:Warning' => 'Szeretné elhagyni ezt az űrlapot? A megadott adatok elveszhetnek', 'Portal:Error:ObjectCannotBeCreated' => 'Hiba: az objektum nem hozható létre. Ellenőrizze a kapcsolódó objektumokat és mellékleteket, mielőtt újra elküldi ezt az űrlapot.', 'Portal:Error:ObjectCannotBeUpdated' => 'Hiba: az objektum nem frissíthető. Ellenőrizze a kapcsolódó objektumokat és mellékleteket, mielőtt újra elküldi ezt az űrlapot.', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Brick:Portal:UserProfile:Name' => 'Felhasználói profil', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'Saját profil', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Kijelentkezés', @@ -76,15 +77,15 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Nem tudja megváltoztatni a jelszót, lépjen kapcsolatba a %1$s rendszergazdával', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Személyi adatok', 'Brick:Portal:UserProfile:Photo:Title' => 'Fénykép', -)); +]); // AggregatePageBrick -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Műszerfal', -)); +]); // BrowseBrick brick -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Brick:Portal:Browse:Name' => 'Böngésszen az elemek között', 'Brick:Portal:Browse:Mode:List' => 'Lista', 'Brick:Portal:Browse:Mode:Tree' => 'Fa', @@ -97,10 +98,10 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Összes kinyitása', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Összecsukás', 'Brick:Portal:Browse:Filter:NoData' => 'Nincs elem', -)); +]); // ManageBrick brick -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Brick:Portal:Manage:Name' => 'Elemek kezelése', 'Brick:Portal:Manage:Table:NoData' => 'Nincs elem', 'Brick:Portal:Manage:Table:ItemActions' => 'Műveletek', @@ -115,10 +116,10 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Brick:Portal:Manage:fct:avg' => 'Átlag', 'Brick:Portal:Manage:fct:min' => 'Minimum', 'Brick:Portal:Manage:fct:max' => 'Maximum', -)); +]); // ObjectBrick brick -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Brick:Portal:Object:Name' => 'Objektum', 'Brick:Portal:Object:Form:Create:Title' => 'Új %1$s', 'Brick:Portal:Object:Form:Edit:Title' => '%2$s frissítése (%1$s)', @@ -130,18 +131,18 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => '%1$s kiválasztása (%2$s)', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Objektum hivatkozás másolása', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Másolva' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Másolva', +]); // CreateBrick brick -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Brick:Portal:Create:Name' => 'Gyors létrehozás', 'Brick:Portal:Create:ChooseType' => 'Válasszon típust', -)); +]); // Filter brick -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Brick:Portal:Filter:Name' => 'Tégla előszűrése', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'pl. wifi kapcsolat', 'Brick:Portal:Filter:SearchInput:Submit' => 'Keresés', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/it.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/it.dict.itop-portal-base.php index 873e82818..8f7899204 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/it.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/it.dict.itop-portal-base.php @@ -1,15 +1,16 @@ '%1$s Portale Utente', 'Page:PleaseWait' => 'Attendere…', 'Page:Home' => 'Home', @@ -53,19 +54,19 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Open / Download~~', 'Portal:Calendar-FirstDayOfWeek' => 'it', //work with moment.js locales -)); +]); // Object form -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Close this entry~~', 'Portal:Form:Close:Warning' => 'Do you want to leave this form? Data entered may be lost~~', 'Portal:Error:ObjectCannotBeCreated' => 'Error: object cannot be created. Check associated objects and attachments before submitting this form again.~~', 'Portal:Error:ObjectCannotBeUpdated' => 'Error: object cannot be updated. Check associated objects and attachments before submitting this form again.~~', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Brick:Portal:UserProfile:Name' => 'User profile~~', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'My profile~~', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Logoff~~', @@ -76,15 +77,15 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Can\'t change password, please contact your %1$s administrator~~', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Personal information~~', 'Brick:Portal:UserProfile:Photo:Title' => 'Photo~~', -)); +]); // AggregatePageBrick -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Dashboard~~', -)); +]); // BrowseBrick brick -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Brick:Portal:Browse:Name' => 'Browse throught items~~', 'Brick:Portal:Browse:Mode:List' => 'List~~', 'Brick:Portal:Browse:Mode:Tree' => 'Tree~~', @@ -97,10 +98,10 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Expand all~~', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Collapse all~~', 'Brick:Portal:Browse:Filter:NoData' => 'No item~~', -)); +]); // ManageBrick brick -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Brick:Portal:Manage:Name' => 'Manage items~~', 'Brick:Portal:Manage:Table:NoData' => 'No item.~~', 'Brick:Portal:Manage:Table:ItemActions' => 'Actions~~', @@ -115,10 +116,10 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Brick:Portal:Manage:fct:avg' => 'Average~~', 'Brick:Portal:Manage:fct:min' => 'Min~~', 'Brick:Portal:Manage:fct:max' => 'Max~~', -)); +]); // ObjectBrick brick -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Brick:Portal:Object:Name' => 'Object~~', 'Brick:Portal:Object:Form:Create:Title' => 'New %1$s~~', 'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)~~', @@ -130,18 +131,18 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)~~', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link~~', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~', +]); // CreateBrick brick -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Brick:Portal:Create:Name' => 'Quick creation~~', 'Brick:Portal:Create:ChooseType' => 'Please, choose a type~~', -)); +]); // Filter brick -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Brick:Portal:Filter:Name' => 'Prefilter a brick~~', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'eg. connect wifi~~', 'Brick:Portal:Filter:SearchInput:Submit' => 'Search~~', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/ja.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/ja.dict.itop-portal-base.php index 1e4d8039c..5e40b7e1b 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/ja.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/ja.dict.itop-portal-base.php @@ -1,15 +1,16 @@ '%1$s User portal~~', 'Page:PleaseWait' => 'Please wait...~~', 'Page:Home' => 'Home~~', @@ -53,19 +54,19 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Portal:File:DisplayInfo' => '%1$s~~', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Open / Download~~', 'Portal:Calendar-FirstDayOfWeek' => 'ja', //work with moment.js locales -)); +]); // Object form -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Close this entry~~', 'Portal:Form:Close:Warning' => 'Do you want to leave this form? Data entered may be lost~~', 'Portal:Error:ObjectCannotBeCreated' => 'Error: object cannot be created. Check associated objects and attachments before submitting this form again.~~', 'Portal:Error:ObjectCannotBeUpdated' => 'Error: object cannot be updated. Check associated objects and attachments before submitting this form again.~~', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Brick:Portal:UserProfile:Name' => 'User profile~~', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'My profile~~', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Logoff~~', @@ -76,15 +77,15 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Can\'t change password, please contact your %1$s administrator~~', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Personal information~~', 'Brick:Portal:UserProfile:Photo:Title' => 'Photo~~', -)); +]); // AggregatePageBrick -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Dashboard~~', -)); +]); // BrowseBrick brick -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Brick:Portal:Browse:Name' => 'Browse throught items~~', 'Brick:Portal:Browse:Mode:List' => 'List~~', 'Brick:Portal:Browse:Mode:Tree' => 'Tree~~', @@ -97,10 +98,10 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Expand all~~', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Collapse all~~', 'Brick:Portal:Browse:Filter:NoData' => 'No item~~', -)); +]); // ManageBrick brick -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Brick:Portal:Manage:Name' => 'Manage items~~', 'Brick:Portal:Manage:Table:NoData' => 'No item.~~', 'Brick:Portal:Manage:Table:ItemActions' => 'Actions~~', @@ -115,10 +116,10 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Brick:Portal:Manage:fct:avg' => 'Average~~', 'Brick:Portal:Manage:fct:min' => 'Min~~', 'Brick:Portal:Manage:fct:max' => 'Max~~', -)); +]); // ObjectBrick brick -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Brick:Portal:Object:Name' => 'Object~~', 'Brick:Portal:Object:Form:Create:Title' => 'New %1$s~~', 'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)~~', @@ -130,18 +131,18 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)~~', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link~~', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~', +]); // CreateBrick brick -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Brick:Portal:Create:Name' => 'Quick creation~~', 'Brick:Portal:Create:ChooseType' => 'Please, choose a type~~', -)); +]); // Filter brick -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Brick:Portal:Filter:Name' => 'Prefilter a brick~~', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'eg. connect wifi~~', 'Brick:Portal:Filter:SearchInput:Submit' => 'Search~~', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/nl.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/nl.dict.itop-portal-base.php index 9a64d7124..eec6ab796 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/nl.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/nl.dict.itop-portal-base.php @@ -1,16 +1,17 @@ (2018 - 2022) * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Page:DefaultTitle' => '%1$s Gebruikersportaal', 'Page:PleaseWait' => 'Even geduld...', 'Page:Home' => 'Welkom', @@ -54,19 +55,19 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Open / Download', 'Portal:Calendar-FirstDayOfWeek' => 'nl', //work with moment.js locales -)); +]); // Object form -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Sluit dit item.', 'Portal:Form:Close:Warning' => 'Ben je zeker dat je dit venster wil sluiten? Ingevoerde gegevens kunnen verloren gaan.', 'Portal:Error:ObjectCannotBeCreated' => 'Fout: object kan niet worden aangemaakt. Kijk verwante objecten en bijlagen na vooraleer dit formulier opnieuw te versturen.', 'Portal:Error:ObjectCannotBeUpdated' => 'Fout: object kan niet worden aangepast. Kijk verwante objecten en bijlagen na vooraleer dit formulier opnieuw te versturen.', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Brick:Portal:UserProfile:Name' => 'Gebruikersprofiel', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'Mijn profiel', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Uitloggen', @@ -77,15 +78,15 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Jouw wachtwoord kan niet gewijzigd worden. Neem contact op met de beheerder', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Persoonlijke informatie', 'Brick:Portal:UserProfile:Photo:Title' => 'Foto', -)); +]); // AggregatePageBrick -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Dashboard', -)); +]); // BrowseBrick brick -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Brick:Portal:Browse:Name' => 'Bladeren', 'Brick:Portal:Browse:Mode:List' => 'Lijst', 'Brick:Portal:Browse:Mode:Tree' => 'Boomstructuur', @@ -98,10 +99,10 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Toon alles', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Verberg alles', 'Brick:Portal:Browse:Filter:NoData' => 'Geen gegevens', -)); +]); // ManageBrick brick -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Brick:Portal:Manage:Name' => 'Beheer items', 'Brick:Portal:Manage:Table:NoData' => 'Geen gegevens', 'Brick:Portal:Manage:Table:ItemActions' => 'Acties', @@ -116,10 +117,10 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Brick:Portal:Manage:fct:avg' => 'Gemiddelde', 'Brick:Portal:Manage:fct:min' => 'Min', 'Brick:Portal:Manage:fct:max' => 'Max', -)); +]); // ObjectBrick brick -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Brick:Portal:Object:Name' => 'Object', 'Brick:Portal:Object:Form:Create:Title' => 'Nieuw %1$s', 'Brick:Portal:Object:Form:Edit:Title' => 'Verwerken %2$s (%1$s)', @@ -131,18 +132,18 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Selecteer %1$s (%2$s)', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Kopieer link naar object', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Gekopieerd' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Gekopieerd', +]); // CreateBrick brick -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Brick:Portal:Create:Name' => 'Snel aanmaken', 'Brick:Portal:Create:ChooseType' => 'Geef een type op.', -)); +]); // Filter brick -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Brick:Portal:Filter:Name' => 'Voorfilteren van een bouwsteen', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'bv. wifi-verbinding', 'Brick:Portal:Filter:SearchInput:Submit' => 'Zoek', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/pl.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/pl.dict.itop-portal-base.php index e40d2bf68..99f65024f 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/pl.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/pl.dict.itop-portal-base.php @@ -1,15 +1,16 @@ '%1$s portal użytkownika', 'Page:PleaseWait' => 'Proszę czekać...', 'Page:Home' => 'Start', @@ -53,19 +54,19 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Open / Pobierz', 'Portal:Calendar-FirstDayOfWeek' => 'en-us', //work with moment.js locales -)); +]); // Object form -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Zamknij ten wpis', 'Portal:Form:Close:Warning' => 'Chcesz opuścić ten formularz? Wprowadzone dane mogą zostać utracone', 'Portal:Error:ObjectCannotBeCreated' => 'Błąd: nie można utworzyć obiektu. Sprawdź powiązane obiekty i załączniki przed ponownym przesłaniem tego formularza.', 'Portal:Error:ObjectCannotBeUpdated' => 'Błąd: nie można zaktualizować obiektu. Sprawdź powiązane obiekty i załączniki przed ponownym przesłaniem tego formularza.', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Brick:Portal:UserProfile:Name' => 'Profil użytkownika', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'Mój profil', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Wyloguj', @@ -76,15 +77,15 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Nie można zmienić hasła. Skontaktuj się z administratorem %1$s', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Informacje osobiste', 'Brick:Portal:UserProfile:Photo:Title' => 'Zdjęcie', -)); +]); // AggregatePageBrick -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Pulpit', -)); +]); // BrowseBrick brick -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Brick:Portal:Browse:Name' => 'Przeglądaj elementy', 'Brick:Portal:Browse:Mode:List' => 'Lista', 'Brick:Portal:Browse:Mode:Tree' => 'Drzewo', @@ -97,10 +98,10 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Rozwiń wszystkie', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Zwiń wszystkie', 'Brick:Portal:Browse:Filter:NoData' => 'Brak elementu', -)); +]); // ManageBrick brick -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Brick:Portal:Manage:Name' => 'Zarządzaj elementami', 'Brick:Portal:Manage:Table:NoData' => 'Brak elementu.', 'Brick:Portal:Manage:Table:ItemActions' => 'Akcje', @@ -115,10 +116,10 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Brick:Portal:Manage:fct:avg' => 'Średnia', 'Brick:Portal:Manage:fct:min' => 'Minimum', 'Brick:Portal:Manage:fct:max' => 'Maksimum', -)); +]); // ObjectBrick brick -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Brick:Portal:Object:Name' => 'Obiekty', 'Brick:Portal:Object:Form:Create:Title' => 'Nowy %1$s', 'Brick:Portal:Object:Form:Edit:Title' => 'Aktualizacja %2$s (%1$s)', @@ -130,18 +131,18 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Wybierz %1$s (%2$s)', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Skopiuj obiekt', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Skopiowano' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Skopiowano', +]); // CreateBrick brick -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Brick:Portal:Create:Name' => 'Szybkie tworzenie', 'Brick:Portal:Create:ChooseType' => 'Proszę wybrać typ', -)); +]); // Filter brick -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Brick:Portal:Filter:Name' => 'Wstępny filtr', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'na przykład. podłącz wifi', 'Brick:Portal:Filter:SearchInput:Submit' => 'Szukaj', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/pt_br.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/pt_br.dict.itop-portal-base.php index 55f1d46be..cd4df36a9 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/pt_br.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/pt_br.dict.itop-portal-base.php @@ -1,15 +1,16 @@ 'Portal do Usuário do '.ITOP_APPLICATION_SHORT, 'Page:PleaseWait' => 'Aguarde...', 'Page:Home' => 'Página inicial', @@ -53,19 +54,19 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Abrir / Download', 'Portal:Calendar-FirstDayOfWeek' => 'pt-br', //work with moment.js locales -)); +]); // Object form -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Fechar esta solicitação', 'Portal:Form:Close:Warning' => 'Você deseja abandonar esta página? Os dados digitados podem ser perdidos', 'Portal:Error:ObjectCannotBeCreated' => 'Erro: objeto não pode ser criado. Verifique os objetos e anexos associados antes de enviar novamente este formulário', 'Portal:Error:ObjectCannotBeUpdated' => 'Erro: objeto não pode ser atualizado. Verifique os objetos e anexos associados antes de enviar novamente este formulário', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Brick:Portal:UserProfile:Name' => 'Perfil de Usuário', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'Meu Perfil', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Sair', @@ -76,15 +77,15 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Não foi possível alterar sua senha, entre em contato com a T.I.', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Informações pessoais', 'Brick:Portal:UserProfile:Photo:Title' => 'Imagem', -)); +]); // AggregatePageBrick -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Painel do '.ITOP_APPLICATION_SHORT, -)); +]); // BrowseBrick brick -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Brick:Portal:Browse:Name' => 'Navegar por itens', 'Brick:Portal:Browse:Mode:List' => 'Lista', 'Brick:Portal:Browse:Mode:Tree' => 'Cascata', @@ -97,10 +98,10 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Expandir todos', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Recolher todos', 'Brick:Portal:Browse:Filter:NoData' => 'Sem dados', -)); +]); // ManageBrick brick -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Brick:Portal:Manage:Name' => 'Gerenciar itens', 'Brick:Portal:Manage:Table:NoData' => 'Sem dados', 'Brick:Portal:Manage:Table:ItemActions' => 'Ações', @@ -115,10 +116,10 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Brick:Portal:Manage:fct:avg' => 'Média', 'Brick:Portal:Manage:fct:min' => 'Min.', 'Brick:Portal:Manage:fct:max' => 'Máx.', -)); +]); // ObjectBrick brick -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Brick:Portal:Object:Name' => 'Objeto', 'Brick:Portal:Object:Form:Create:Title' => 'Novo %1$s', 'Brick:Portal:Object:Form:Edit:Title' => 'Alterar %2$s (%1$s)', @@ -130,18 +131,18 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Selecinar %1$s (%2$s)', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Copiar', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copiado' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copiado', +]); // CreateBrick brick -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Brick:Portal:Create:Name' => 'Criação rápida', 'Brick:Portal:Create:ChooseType' => 'Por favor, escolha um tipo:', -)); +]); // Filter brick -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Brick:Portal:Filter:Name' => 'Filtro ativado', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'ex. conectar ao WiFi', 'Brick:Portal:Filter:SearchInput:Submit' => 'Pesquisa', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/ru.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/ru.dict.itop-portal-base.php index cebdc662f..1151afc68 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/ru.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/ru.dict.itop-portal-base.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Page:DefaultTitle' => 'Пользовательский портал %1$s', 'Page:PleaseWait' => 'Пожалуйста, подождите...', 'Page:Home' => 'Домашняя страница', @@ -54,19 +55,19 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Открыть / Скачать', 'Portal:Calendar-FirstDayOfWeek' => 'ru', //work with moment.js locales -)); +]); // Object form -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Close this entry~~', 'Portal:Form:Close:Warning' => 'Вы действительно хотите закрыть эту форму? Введённые данные могут быть утеряны.', 'Portal:Error:ObjectCannotBeCreated' => 'Error: object cannot be created. Check associated objects and attachments before submitting this form again.~~', 'Portal:Error:ObjectCannotBeUpdated' => 'Error: object cannot be updated. Check associated objects and attachments before submitting this form again.~~', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Brick:Portal:UserProfile:Name' => 'Профиль пользователя', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'Мой профиль', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Выйти', @@ -77,15 +78,15 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Не удалось изменить пароль, пожалуйста, свяжитесь с вашим администратором %1$s.', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Персональная информация', 'Brick:Portal:UserProfile:Photo:Title' => 'Фотография', -)); +]); // AggregatePageBrick -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Дашборд', -)); +]); // BrowseBrick brick -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Brick:Portal:Browse:Name' => 'Просмотр элементов', 'Brick:Portal:Browse:Mode:List' => 'Список', 'Brick:Portal:Browse:Mode:Tree' => 'Дерево', @@ -98,10 +99,10 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Развернуть все', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Свернуть все', 'Brick:Portal:Browse:Filter:NoData' => 'Нет элементов', -)); +]); // ManageBrick brick -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Brick:Portal:Manage:Name' => 'Управление элементами', 'Brick:Portal:Manage:Table:NoData' => 'Нет элементов', 'Brick:Portal:Manage:Table:ItemActions' => 'Действия', @@ -116,10 +117,10 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Brick:Portal:Manage:fct:avg' => 'Среднее', 'Brick:Portal:Manage:fct:min' => 'Минимум', 'Brick:Portal:Manage:fct:max' => 'Максимум', -)); +]); // ObjectBrick brick -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Brick:Portal:Object:Name' => 'Object', 'Brick:Portal:Object:Form:Create:Title' => 'Создать %1$s', 'Brick:Portal:Object:Form:Edit:Title' => 'Обновление %2$s (%1$s)', @@ -131,18 +132,18 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Выбрать %1$s (%2$s)', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Скопировать ссылку на объект', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Ссылка скопирована' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Ссылка скопирована', +]); // CreateBrick brick -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Brick:Portal:Create:Name' => 'Быстрое создание', 'Brick:Portal:Create:ChooseType' => 'Пожалуйста, выберите тип', -)); +]); // Filter brick -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Brick:Portal:Filter:Name' => 'Фильтр', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'например, подключить wi-fi', 'Brick:Portal:Filter:SearchInput:Submit' => 'Искать', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/sk.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/sk.dict.itop-portal-base.php index 08dcd1c36..ebb1f0589 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/sk.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/sk.dict.itop-portal-base.php @@ -1,15 +1,16 @@ '%1$s User portal~~', 'Page:PleaseWait' => 'Please wait...~~', 'Page:Home' => 'Home~~', @@ -53,19 +54,19 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Portal:File:DisplayInfo' => '%1$s~~', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Open / Download~~', 'Portal:Calendar-FirstDayOfWeek' => 'en-us~~', //work with moment.js locales -)); +]); // Object form -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Close this entry~~', 'Portal:Form:Close:Warning' => 'Do you want to leave this form? Data entered may be lost~~', 'Portal:Error:ObjectCannotBeCreated' => 'Error: object cannot be created. Check associated objects and attachments before submitting this form again.~~', 'Portal:Error:ObjectCannotBeUpdated' => 'Error: object cannot be updated. Check associated objects and attachments before submitting this form again.~~', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Brick:Portal:UserProfile:Name' => 'User profile~~', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'My profile~~', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Logoff~~', @@ -76,15 +77,15 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Can\'t change password, please contact your %1$s administrator~~', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Personal information~~', 'Brick:Portal:UserProfile:Photo:Title' => 'Photo~~', -)); +]); // AggregatePageBrick -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Dashboard~~', -)); +]); // BrowseBrick brick -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Brick:Portal:Browse:Name' => 'Browse throught items~~', 'Brick:Portal:Browse:Mode:List' => 'List~~', 'Brick:Portal:Browse:Mode:Tree' => 'Tree~~', @@ -97,10 +98,10 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Expand all~~', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Collapse all~~', 'Brick:Portal:Browse:Filter:NoData' => 'No item~~', -)); +]); // ManageBrick brick -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Brick:Portal:Manage:Name' => 'Manage items~~', 'Brick:Portal:Manage:Table:NoData' => 'No item.~~', 'Brick:Portal:Manage:Table:ItemActions' => 'Actions~~', @@ -115,10 +116,10 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Brick:Portal:Manage:fct:avg' => 'Average~~', 'Brick:Portal:Manage:fct:min' => 'Min~~', 'Brick:Portal:Manage:fct:max' => 'Max~~', -)); +]); // ObjectBrick brick -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Brick:Portal:Object:Name' => 'Object~~', 'Brick:Portal:Object:Form:Create:Title' => 'New %1$s~~', 'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)~~', @@ -130,18 +131,18 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)~~', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link~~', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~', +]); // CreateBrick brick -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Brick:Portal:Create:Name' => 'Quick creation~~', 'Brick:Portal:Create:ChooseType' => 'Please, choose a type~~', -)); +]); // Filter brick -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Brick:Portal:Filter:Name' => 'Prefilter a brick~~', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'eg. connect wifi~~', 'Brick:Portal:Filter:SearchInput:Submit' => 'Search~~', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/tr.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/tr.dict.itop-portal-base.php index 36f3d35ea..d4bcb1eb9 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/tr.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/tr.dict.itop-portal-base.php @@ -1,15 +1,16 @@ '%1$s User portal~~', 'Page:PleaseWait' => 'Please wait...~~', 'Page:Home' => 'Home~~', @@ -53,19 +54,19 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Portal:File:DisplayInfo' => '%1$s~~', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) Open / Download~~', 'Portal:Calendar-FirstDayOfWeek' => 'tr', //work with moment.js locales -)); +]); // Object form -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Close this entry~~', 'Portal:Form:Close:Warning' => 'Do you want to leave this form? Data entered may be lost~~', 'Portal:Error:ObjectCannotBeCreated' => 'Error: object cannot be created. Check associated objects and attachments before submitting this form again.~~', 'Portal:Error:ObjectCannotBeUpdated' => 'Error: object cannot be updated. Check associated objects and attachments before submitting this form again.~~', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Brick:Portal:UserProfile:Name' => 'User profile~~', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'My profile~~', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Logoff~~', @@ -76,15 +77,15 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Can\'t change password, please contact your %1$s administrator~~', 'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Personal information~~', 'Brick:Portal:UserProfile:Photo:Title' => 'Photo~~', -)); +]); // AggregatePageBrick -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Brick:Portal:AggregatePage:DefaultTitle' => 'Dashboard~~', -)); +]); // BrowseBrick brick -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Brick:Portal:Browse:Name' => 'Browse throught items~~', 'Brick:Portal:Browse:Mode:List' => 'List~~', 'Brick:Portal:Browse:Mode:Tree' => 'Tree~~', @@ -97,10 +98,10 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Brick:Portal:Browse:Tree:ExpandAll' => 'Expand all~~', 'Brick:Portal:Browse:Tree:CollapseAll' => 'Collapse all~~', 'Brick:Portal:Browse:Filter:NoData' => 'No item~~', -)); +]); // ManageBrick brick -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Brick:Portal:Manage:Name' => 'Manage items~~', 'Brick:Portal:Manage:Table:NoData' => 'No item.~~', 'Brick:Portal:Manage:Table:ItemActions' => 'Actions~~', @@ -115,10 +116,10 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Brick:Portal:Manage:fct:avg' => 'Average~~', 'Brick:Portal:Manage:fct:min' => 'Min~~', 'Brick:Portal:Manage:fct:max' => 'Max~~', -)); +]); // ObjectBrick brick -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Brick:Portal:Object:Name' => 'Object~~', 'Brick:Portal:Object:Form:Create:Title' => 'New %1$s~~', 'Brick:Portal:Object:Form:Edit:Title' => 'Updating %2$s (%1$s)~~', @@ -130,18 +131,18 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => 'Select %1$s (%2$s)~~', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => 'Copy object link~~', - 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => 'Copied~~', +]); // CreateBrick brick -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Brick:Portal:Create:Name' => 'Quick creation~~', 'Brick:Portal:Create:ChooseType' => 'Please, choose a type~~', -)); +]); // Filter brick -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Brick:Portal:Filter:Name' => 'Prefilter a brick~~', 'Brick:Portal:Filter:SearchInput:Placeholder' => 'eg. connect wifi~~', 'Brick:Portal:Filter:SearchInput:Submit' => 'Search~~', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/dictionaries/zh_cn.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/dictionaries/zh_cn.dict.itop-portal-base.php index 58c9f5964..b9f984ffc 100644 --- a/datamodels/2.x/itop-portal-base/dictionaries/zh_cn.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/dictionaries/zh_cn.dict.itop-portal-base.php @@ -1,4 +1,5 @@ '%1$s 用户门户', 'Page:PleaseWait' => '请稍候...', 'Page:Home' => '主页', @@ -62,19 +63,19 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Portal:File:DisplayInfo' => '%1$s', 'Portal:File:DisplayInfo+' => '%1$s (%2$s) 打开 / 下载', 'Portal:Calendar-FirstDayOfWeek' => 'zh-cn', //work with moment.js locales -)); +]); // Object form -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Portal:Form:Caselog:Entry:Close:Tooltip' => '关闭此条目', 'Portal:Form:Close:Warning' => '确定要离开表单吗? 已输入数据会丢失', 'Portal:Error:ObjectCannotBeCreated' => '错误: 无法创建对象. 请在再次提交表单前检查相关对象和附件.', 'Portal:Error:ObjectCannotBeUpdated' => '错误: 无法更新对象. 请在再次提交表单前检查相关对象和附件.', - 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', -)); + 'Portal:Error:CheckToWriteFailed' => 'Error during validation of field \'%1$s\': %2$s~~', +]); // UserProfile brick -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Brick:Portal:UserProfile:Name' => '用户资料', 'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => '我的资料', 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => '注销', @@ -85,15 +86,15 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => '无法修改密码, 请联系管理员', 'Brick:Portal:UserProfile:PersonalInformations:Title' => '人员信息', 'Brick:Portal:UserProfile:Photo:Title' => '头像', -)); +]); // AggregatePageBrick -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Brick:Portal:AggregatePage:DefaultTitle' => '仪表盘', -)); +]); // BrowseBrick brick -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Brick:Portal:Browse:Name' => '浏览项目', 'Brick:Portal:Browse:Mode:List' => '列表', 'Brick:Portal:Browse:Mode:Tree' => '树形', @@ -106,10 +107,10 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Brick:Portal:Browse:Tree:ExpandAll' => '全部展开', 'Brick:Portal:Browse:Tree:CollapseAll' => '全部收起', 'Brick:Portal:Browse:Filter:NoData' => '没有项目', -)); +]); // ManageBrick brick -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Brick:Portal:Manage:Name' => '管理项目', 'Brick:Portal:Manage:Table:NoData' => '没有项目.', 'Brick:Portal:Manage:Table:ItemActions' => '操作', @@ -124,10 +125,10 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Brick:Portal:Manage:fct:avg' => '平均', 'Brick:Portal:Manage:fct:min' => '最小', 'Brick:Portal:Manage:fct:max' => '最大', -)); +]); // ObjectBrick brick -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Brick:Portal:Object:Name' => '对象', 'Brick:Portal:Object:Form:Create:Title' => '新建 %1$s', 'Brick:Portal:Object:Form:Edit:Title' => '正在更新 %2$s (%1$s)', @@ -139,18 +140,18 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Brick:Portal:Object:Search:Hierarchy:Title' => '选择 %1$s (%2$s)', 'Brick:Portal:Object:Copy:TextToCopy' => '%2$s', 'Brick:Portal:Object:Copy:Tooltip' => '复制对象链接', - 'Brick:Portal:Object:Copy:CopiedTooltip' => '已复制' -)); + 'Brick:Portal:Object:Copy:CopiedTooltip' => '已复制', +]); // CreateBrick brick -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Brick:Portal:Create:Name' => '快速创建', 'Brick:Portal:Create:ChooseType' => '请选择类型', -)); +]); // Filter brick -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Brick:Portal:Filter:Name' => '预筛选组件', 'Brick:Portal:Filter:SearchInput:Placeholder' => '例如. 连接wifi', 'Brick:Portal:Filter:SearchInput:Submit' => '搜索', -)); +]); diff --git a/datamodels/2.x/itop-portal-base/index.php b/datamodels/2.x/itop-portal-base/index.php index 57f0c99fe..0042a3c26 100644 --- a/datamodels/2.x/itop-portal-base/index.php +++ b/datamodels/2.x/itop-portal-base/index.php @@ -24,12 +24,9 @@ */ // Load current environment -if (file_exists(__DIR__.'/../../approot.inc.php')) -{ +if (file_exists(__DIR__.'/../../approot.inc.php')) { require_once __DIR__.'/../../approot.inc.php'; // When in env-xxxx folder -} -else -{ +} else { require_once __DIR__.'/../../../approot.inc.php'; // When in datamodels/x.x folder } require_once APPROOT.'application/startup.inc.php'; diff --git a/datamodels/2.x/itop-portal-base/module.itop-portal-base.php b/datamodels/2.x/itop-portal-base/module.itop-portal-base.php index 40b6c8db6..221bb3900 100644 --- a/datamodels/2.x/itop-portal-base/module.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/module.itop-portal-base.php @@ -1,4 +1,5 @@ 'Portal Development Library', 'category' => 'Portal', // Setup - 'dependencies' => array( - ), + 'dependencies' => [ + ], 'mandatory' => true, 'visible' => false, // Components - 'datamodel' => array( + 'datamodel' => [ // Note: The autoloader is there instead of portal/config/bootstrap.php in order to be available for other modules with a dependency on this one. // eg. If a module has a class extending \Combodo\iTop\Portal\Controller\AbstractController, it needs to find it even if the portal kernel is not loaded. 'portal/vendor/autoload.php', - ), - 'webservice' => array( + ], + 'webservice' => [ //'webservices.itop-portal-base.php', - ), - 'dictionary' => array( - ), - 'data.struct' => array( + ], + 'dictionary' => [ + ], + 'data.struct' => [ //'data.struct.itop-portal-base.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.itop-portal-base.xml', - ), + ], // Documentation 'doc.manual_setup' => '', 'doc.more_information' => '', // Default settings - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); diff --git a/datamodels/2.x/itop-portal-base/portal/config/bootstrap.php b/datamodels/2.x/itop-portal-base/portal/config/bootstrap.php index bb1abef1a..d92a2fcb0 100644 --- a/datamodels/2.x/itop-portal-base/portal/config/bootstrap.php +++ b/datamodels/2.x/itop-portal-base/portal/config/bootstrap.php @@ -28,14 +28,10 @@ use Symfony\Component\Dotenv\Dotenv; require_once APPROOT.'/lib/autoload.php'; // Load current environment if necessary (typically from CLI as the app is not started yet) -if (!defined('MODULESROOT')) -{ - if (file_exists(__DIR__.'/../../../../approot.inc.php')) - { +if (!defined('MODULESROOT')) { + if (file_exists(__DIR__.'/../../../../approot.inc.php')) { require_once __DIR__.'/../../../../approot.inc.php'; // When in env-xxxx folder - } - else - { + } else { require_once __DIR__.'/../../../../../approot.inc.php'; // When in datamodels/x.x folder } require_once APPROOT.'/application/startup.inc.php'; @@ -62,7 +58,7 @@ if (!class_exists(Dotenv::class)) { } if (null === $sEnv = (isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : null))) { - $oDotenv->populate(array('APP_ENV' => $sEnv = 'prod')); + $oDotenv->populate(['APP_ENV' => $sEnv = 'prod']); } if ('test' !== $sEnv && file_exists($sPathDist = "$sPath.local")) { @@ -83,31 +79,27 @@ if (!class_exists(Dotenv::class)) { $_SERVER += $_ENV; $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = (isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : null)) ?: 'prod'; $_SERVER['APP_DEBUG'] = isset($_SERVER['APP_DEBUG']) ? $_SERVER['APP_DEBUG'] : (isset($_ENV['APP_DEBUG']) ? $_ENV['APP_DEBUG'] : ('prod' !== $_SERVER['APP_ENV'])); -$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int)$_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], - FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; +$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int)$_SERVER['APP_DEBUG'] || filter_var( + $_SERVER['APP_DEBUG'], + FILTER_VALIDATE_BOOLEAN +) ? '1' : '0'; -if ($_SERVER['APP_DEBUG']) -{ +if ($_SERVER['APP_DEBUG']) { umask(0000); - if (class_exists(Debug::class)) - { + if (class_exists(Debug::class)) { Debug::enable(); } } -if (isset($_ENV['PORTAL_ID'])) -{ +if (isset($_ENV['PORTAL_ID'])) { // Nothing to do } // Note: Default value is set to "false" to differentiate an empty value from a non given parameter -elseif ($sPortalId = utils::ReadParam('portal_id', false, true)) -{ +elseif ($sPortalId = utils::ReadParam('portal_id', false, true)) { $_ENV['PORTAL_ID'] = $sPortalId; -} -elseif (defined('PORTAL_ID')) -{ +} elseif (defined('PORTAL_ID')) { $_ENV['PORTAL_ID'] = PORTAL_ID; @trigger_error( sprintf( @@ -118,16 +110,14 @@ elseif (defined('PORTAL_ID')) ); } -if (empty($_ENV['PORTAL_ID'])) -{ +if (empty($_ENV['PORTAL_ID'])) { echo "Missing argument 'portal_id'"; exit; } // Make sure that the PORTAL_ID constant is also defined // Note: This is widely used in extensions, snippets and all -if (!defined('PORTAL_ID')) -{ +if (!defined('PORTAL_ID')) { define('PORTAL_ID', $_ENV['PORTAL_ID']); } @@ -138,4 +128,4 @@ $_ENV['COMBODO_CONF_APP_ICON_URL'] = MetaModel::GetConfig()->Get('app_icon_url') $_ENV['COMBODO_MODULES_ABSOLUTE_URL'] = utils::GetAbsoluteUrlModulesRoot(); $_ENV['COMBODO_PORTAL_BASE_ABSOLUTE_URL'] = utils::GetAbsoluteUrlModulesRoot().'itop-portal-base/portal/public/'; $_ENV['COMBODO_PORTAL_BASE_ABSOLUTE_PATH'] = MODULESROOT.'/itop-portal-base/portal/public/'; -$_ENV['COMBODO_PORTAL_INSTANCE_ABSOLUTE_URL'] = utils::GetAbsoluteUrlModulesRoot().$_ENV['PORTAL_ID'].'/'; \ No newline at end of file +$_ENV['COMBODO_PORTAL_INSTANCE_ABSOLUTE_URL'] = utils::GetAbsoluteUrlModulesRoot().$_ENV['PORTAL_ID'].'/'; diff --git a/datamodels/2.x/itop-portal-base/portal/config/bridge.php b/datamodels/2.x/itop-portal-base/portal/config/bridge.php index 5c10a65e5..b53eb55d2 100644 --- a/datamodels/2.x/itop-portal-base/portal/config/bridge.php +++ b/datamodels/2.x/itop-portal-base/portal/config/bridge.php @@ -7,4 +7,4 @@ return static function (ContainerConfigurator $container) { // kernel.secret $container->parameters()->set('kernel.secret', MetaModel::GetConfig()->Get('application.secret')); -}; \ No newline at end of file +}; diff --git a/datamodels/2.x/itop-portal-base/portal/config/bundles.php b/datamodels/2.x/itop-portal-base/portal/config/bundles.php index 6ebf3e509..bbf6fba32 100644 --- a/datamodels/2.x/itop-portal-base/portal/config/bundles.php +++ b/datamodels/2.x/itop-portal-base/portal/config/bundles.php @@ -1,4 +1,5 @@ ComputeAndReport('Load portal lists definition'); // A dedicated listener 'CssFromSassCompiler' exists to compile files again when by-passing HTTP cache. // This is to keep developers comfort when tuning the SCSS files. $oKPI = new ExecutionKPI(); -$aImportPaths = array($_ENV['COMBODO_PORTAL_BASE_ABSOLUTE_PATH'].'css/'); +$aImportPaths = [$_ENV['COMBODO_PORTAL_BASE_ABSOLUTE_PATH'].'css/']; $aPortalConf = $container->getParameter('combodo.portal.instance.conf'); -foreach ($aPortalConf['properties']['themes'] as $sKey => $value) -{ - if (!is_array($value)) - { - $aPortalConf['properties']['themes'][$sKey] = utils::GetCSSFromSASS('env-'.utils::GetCurrentEnvironment().'/'.$value, - $aImportPaths); - } - else - { - $aValues = array(); - foreach ($value as $sSubValue) - { - $aValues[] = utils::GetCSSFromSASS('env-'.utils::GetCurrentEnvironment().'/'.$sSubValue, - $aImportPaths); +foreach ($aPortalConf['properties']['themes'] as $sKey => $value) { + if (!is_array($value)) { + $aPortalConf['properties']['themes'][$sKey] = utils::GetCSSFromSASS( + 'env-'.utils::GetCurrentEnvironment().'/'.$value, + $aImportPaths + ); + } else { + $aValues = []; + foreach ($value as $sSubValue) { + $aValues[] = utils::GetCSSFromSASS( + 'env-'.utils::GetCurrentEnvironment().'/'.$sSubValue, + $aImportPaths + ); } $aPortalConf['properties']['themes'][$sKey] = $aValues; } } $oKPI->ComputeAndReport('Generating CSS files'); -$container->setParameter('combodo.portal.instance.conf', $aPortalConf); \ No newline at end of file +$container->setParameter('combodo.portal.instance.conf', $aPortalConf); diff --git a/datamodels/2.x/itop-portal-base/portal/config/routes/extensions_extra_routes.php b/datamodels/2.x/itop-portal-base/portal/config/routes/extensions_extra_routes.php index b3ccae635..950114683 100644 --- a/datamodels/2.x/itop-portal-base/portal/config/routes/extensions_extra_routes.php +++ b/datamodels/2.x/itop-portal-base/portal/config/routes/extensions_extra_routes.php @@ -1,4 +1,5 @@ autoconfigure(); } -}; \ No newline at end of file +}; diff --git a/datamodels/2.x/itop-portal-base/portal/public/index.php b/datamodels/2.x/itop-portal-base/portal/public/index.php index a8ba043db..c790eabcf 100644 --- a/datamodels/2.x/itop-portal-base/portal/public/index.php +++ b/datamodels/2.x/itop-portal-base/portal/public/index.php @@ -1,4 +1,5 @@ handle($oRequest); $oResponse->send(); $oKPI->ComputeAndReport('Page execution and rendering'); - $oKPI = new ExecutionKPI(); $oKernel->terminate($oRequest, $oResponse); $oKPI->ComputeAndReport('Symfony kernel termination'); - -ExecutionKPI::ReportStats(); \ No newline at end of file +ExecutionKPI::ReportStats(); diff --git a/datamodels/2.x/itop-portal-base/portal/src/Brick/AbstractBrick.php b/datamodels/2.x/itop-portal-base/portal/src/Brick/AbstractBrick.php index 7374083d5..476300178 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Brick/AbstractBrick.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Brick/AbstractBrick.php @@ -43,34 +43,34 @@ use ModuleDesign; abstract class AbstractBrick implements TemplatesProviderInterface { /** @var string ENUM_DATA_LOADING_LAZY */ - const ENUM_DATA_LOADING_LAZY = 'lazy'; + public const ENUM_DATA_LOADING_LAZY = 'lazy'; /** @var string ENUM_DATA_LOADING_FULL */ - const ENUM_DATA_LOADING_FULL = 'full'; + public const ENUM_DATA_LOADING_FULL = 'full'; /** @var string ENUM_DATA_LOADING_AUTO */ - const ENUM_DATA_LOADING_AUTO = 'auto'; + public const ENUM_DATA_LOADING_AUTO = 'auto'; /** @var bool DEFAULT_MANDATORY */ - const DEFAULT_MANDATORY = true; + public const DEFAULT_MANDATORY = true; /** @var bool DEFAULT_ACTIVE */ - const DEFAULT_ACTIVE = true; + public const DEFAULT_ACTIVE = true; /** @var bool DEFAULT_VISIBLE */ - const DEFAULT_VISIBLE = true; + public const DEFAULT_VISIBLE = true; /** @var float DEFAULT_RANK */ - const DEFAULT_RANK = 1.0; + public const DEFAULT_RANK = 1.0; /** @var string|null DEFAULT_PAGE_TEMPLATE_PATH @deprecated since 3.2.1 */ - const DEFAULT_PAGE_TEMPLATE_PATH = null; + public const DEFAULT_PAGE_TEMPLATE_PATH = null; /** @var string DEFAULT_TITLE */ - const DEFAULT_TITLE = ''; + public const DEFAULT_TITLE = ''; /** @var string|null DEFAULT_DESCRIPTION */ - const DEFAULT_DESCRIPTION = null; + public const DEFAULT_DESCRIPTION = null; /** @var string DEFAULT_DATA_LOADING */ - const DEFAULT_DATA_LOADING = self::ENUM_DATA_LOADING_AUTO; + public const DEFAULT_DATA_LOADING = self::ENUM_DATA_LOADING_AUTO; /** @var string DEFAULT_ALLOWED_PROFILES_OQL */ - const DEFAULT_ALLOWED_PROFILES_OQL = ''; + public const DEFAULT_ALLOWED_PROFILES_OQL = ''; /** @var string DEFAULT_DENIED_PROFILES_OQL */ - const DEFAULT_DENIED_PROFILES_OQL = ''; + public const DEFAULT_DENIED_PROFILES_OQL = ''; /** @var string TEMPLATES_BASE_PATH */ - const TEMPLATES_BASE_PATH = 'itop-portal-base/portal/templates/bricks/'; + public const TEMPLATES_BASE_PATH = 'itop-portal-base/portal/templates/bricks/'; /** @var string $sId */ protected $sId; @@ -105,8 +105,9 @@ abstract class AbstractBrick implements TemplatesProviderInterface /** @inheritdoc */ public static function RegisterTemplates(TemplatesRegister $oTemplatesRegister): void { - $oTemplatesRegister->RegisterTemplates(self::class, - TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH . 'layout.html.twig'), + $oTemplatesRegister->RegisterTemplates( + self::class, + TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH.'layout.html.twig'), ); } @@ -135,9 +136,9 @@ abstract class AbstractBrick implements TemplatesProviderInterface * * @return array */ - static function GetEnumDataLoadingValues() + public static function GetEnumDataLoadingValues() { - return array(self::ENUM_DATA_LOADING_LAZY, self::ENUM_DATA_LOADING_FULL, self::ENUM_DATA_LOADING_AUTO); + return [self::ENUM_DATA_LOADING_LAZY, self::ENUM_DATA_LOADING_FULL, self::ENUM_DATA_LOADING_AUTO]; } /** @@ -155,8 +156,8 @@ abstract class AbstractBrick implements TemplatesProviderInterface $this->sTitle = static::DEFAULT_TITLE; $this->sDescription = static::DEFAULT_DESCRIPTION; $this->sDataLoading = static::DEFAULT_DATA_LOADING; - $this->aAllowedProfiles = array(); - $this->aDeniedProfiles = array(); + $this->aAllowedProfiles = []; + $this->aDeniedProfiles = []; $this->sAllowedProfilesOql = static::DEFAULT_ALLOWED_PROFILES_OQL; $this->sDeniedProfilesOql = static::DEFAULT_DENIED_PROFILES_OQL; } @@ -297,8 +298,8 @@ abstract class AbstractBrick implements TemplatesProviderInterface * Sets the brick id * * @param string $sId - * - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetId($sId) { @@ -310,8 +311,8 @@ abstract class AbstractBrick implements TemplatesProviderInterface * Sets if the brick is mandatory * * @param boolean $bMandatory - * - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetMandatory($bMandatory) { @@ -336,8 +337,8 @@ abstract class AbstractBrick implements TemplatesProviderInterface * Sets if the brick is active * * @param boolean $bActive - * - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetActive($bActive) { @@ -349,8 +350,8 @@ abstract class AbstractBrick implements TemplatesProviderInterface * Sets the rank of the brick * * @param float $fRank - * - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetRank($fRank) { @@ -362,15 +363,15 @@ abstract class AbstractBrick implements TemplatesProviderInterface * Sets the page template path of the brick * * @param string $sPageTemplatePath - * - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick * * @deprecated since 3.2.1 use SetTemplatePath('page') instead */ public function SetPageTemplatePath($sPageTemplatePath) { $this->sPageTemplatePath = $sPageTemplatePath; - $this->SetTemplatePath( 'page', $sPageTemplatePath); + $this->SetTemplatePath('page', $sPageTemplatePath); return $this; } @@ -378,8 +379,8 @@ abstract class AbstractBrick implements TemplatesProviderInterface * Sets the title of the brick * * @param string $sTitle - * - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetTitle($sTitle) { @@ -391,8 +392,8 @@ abstract class AbstractBrick implements TemplatesProviderInterface * Sets the description of the brick * * @param string $sDescription - * - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetDescription($sDescription) { @@ -404,8 +405,8 @@ abstract class AbstractBrick implements TemplatesProviderInterface * Sets the data loading mode of the brick * * @param string $sDataLoading - * - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetDataLoading($sDataLoading) { @@ -444,8 +445,8 @@ abstract class AbstractBrick implements TemplatesProviderInterface * Sets the allowed profiles oql query for the brick * * @param string $sAllowedProfilesOql - * - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetAllowedProfilesOql($sAllowedProfilesOql) { @@ -457,8 +458,8 @@ abstract class AbstractBrick implements TemplatesProviderInterface * Sets the denied profiles oql query for the brick * * @param string $sDeniedProfilesOql - * - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetDeniedProfilesOql($sDeniedProfilesOql) { @@ -489,8 +490,7 @@ abstract class AbstractBrick implements TemplatesProviderInterface */ public function RemoveAllowedProfile($sProfile) { - if (isset($this->aAllowedProfiles[$sProfile])) - { + if (isset($this->aAllowedProfiles[$sProfile])) { unset($this->aAllowedProfiles[$sProfile]); } @@ -530,8 +530,7 @@ abstract class AbstractBrick implements TemplatesProviderInterface */ public function RemoveDeniedProfile($sProfile) { - if (isset($this->aDeniedProfiles[$sProfile])) - { + if (isset($this->aDeniedProfiles[$sProfile])) { unset($this->aDeniedProfiles[$sProfile]); } @@ -560,7 +559,7 @@ abstract class AbstractBrick implements TemplatesProviderInterface */ public function IsGrantedForProfile($sProfile) { - return $this->IsGrantedForProfiles(array($sProfile)); + return $this->IsGrantedForProfiles([$sProfile]); } /** @@ -577,27 +576,21 @@ abstract class AbstractBrick implements TemplatesProviderInterface { $bGranted = true; - if ($this->HasAllowedProfiles()) - { + if ($this->HasAllowedProfiles()) { // We set $bGranted to false as the user must explicitly have an allowed profile to be granted $bGranted = false; - foreach ($aProfiles as $sProfile) - { - if (in_array($sProfile, $this->aAllowedProfiles)) - { + foreach ($aProfiles as $sProfile) { + if (in_array($sProfile, $this->aAllowedProfiles)) { $bGranted = true; break; } } } - if ($this->HasDeniedProfiles()) - { - foreach ($aProfiles as $sProfile) - { - if (in_array($sProfile, $this->aDeniedProfiles)) - { + if ($this->HasDeniedProfiles()) { + foreach ($aProfiles as $sProfile) { + if (in_array($sProfile, $this->aDeniedProfiles)) { $bGranted = false; break; } @@ -629,18 +622,15 @@ abstract class AbstractBrick implements TemplatesProviderInterface public function LoadFromXml(DesignElement $oMDElement) { // Checking mandatory elements - if (!$oMDElement->hasAttribute('id')) - { + if (!$oMDElement->hasAttribute('id')) { throw new DOMFormatException('Brick node must have both id and xsi:type attributes defined', 0, null, $oMDElement); } $this->SetId($oMDElement->getAttribute('id')); // Checking others elements /** @var \Combodo\iTop\DesignElement $oBrickSubNode */ - foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) - { - switch ($oBrickSubNode->nodeName) - { + foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) { + switch ($oBrickSubNode->nodeName) { case 'mandatory': $this->SetMandatory(($oBrickSubNode->GetText() === 'no') ? false : true); break; @@ -649,15 +639,13 @@ abstract class AbstractBrick implements TemplatesProviderInterface break; case 'rank': $oOptionalNode = $oBrickSubNode->GetOptionalElement('default'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $this->SetRank((float)$oOptionalNode->GetText(static::DEFAULT_RANK)); } break; case 'templates': $oTemplateNodeList = $oBrickSubNode->GetNodes('template[@id='.ModuleDesign::XPathQuote('page').']'); - if ($oTemplateNodeList->length > 0) - { + if ($oTemplateNodeList->length > 0) { /** @var \Combodo\iTop\DesignElement $oTemplateNode */ $oTemplateNode = $oTemplateNodeList->item(0); $this->SetTemplatePath('page', $oTemplateNode->GetText(static::DEFAULT_PAGE_TEMPLATE_PATH)); @@ -665,8 +653,7 @@ abstract class AbstractBrick implements TemplatesProviderInterface break; case 'title': $oOptionalNode = $oBrickSubNode->GetOptionalElement('default'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $this->SetTitle($oOptionalNode->GetText(static::DEFAULT_TITLE)); } break; @@ -678,16 +665,17 @@ abstract class AbstractBrick implements TemplatesProviderInterface break; case 'security': /** @var \Combodo\iTop\DesignElement $oSecurityNode */ - foreach ($oBrickSubNode->GetNodes('*') as $oSecurityNode) - { - if ($oSecurityNode->nodeType === XML_TEXT_NODE && $oSecurityNode->GetText() === '') - { - throw new DOMFormatException('Brick security node "'.$oSecurityNode->nodeName.'" must contain an OQL query, it cannot be empty', - null, null, $oMDElement); + foreach ($oBrickSubNode->GetNodes('*') as $oSecurityNode) { + if ($oSecurityNode->nodeType === XML_TEXT_NODE && $oSecurityNode->GetText() === '') { + throw new DOMFormatException( + 'Brick security node "'.$oSecurityNode->nodeName.'" must contain an OQL query, it cannot be empty', + null, + null, + $oMDElement + ); } - switch ($oSecurityNode->nodeName) - { + switch ($oSecurityNode->nodeName) { case 'denied_profiles': $this->SetDeniedProfilesOql($oSecurityNode->GetText()); break; diff --git a/datamodels/2.x/itop-portal-base/portal/src/Brick/AggregatePageBrick.php b/datamodels/2.x/itop-portal-base/portal/src/Brick/AggregatePageBrick.php index 4c3873901..1a378345a 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Brick/AggregatePageBrick.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Brick/AggregatePageBrick.php @@ -38,11 +38,11 @@ use DOMFormatException; class AggregatePageBrick extends PortalBrick { // Overloaded constants - const DEFAULT_DECORATION_CLASS_HOME = 'fas fa-tachometer-alt'; - const DEFAULT_DECORATION_CLASS_NAVIGATION_MENU = 'fas fa-tachometer-alt fa-2x'; + public const DEFAULT_DECORATION_CLASS_HOME = 'fas fa-tachometer-alt'; + public const DEFAULT_DECORATION_CLASS_NAVIGATION_MENU = 'fas fa-tachometer-alt fa-2x'; /** @var string @deprecated since 3.2.1 */ - const DEFAULT_PAGE_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/aggregate-page/layout.html.twig'; + public const DEFAULT_PAGE_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/aggregate-page/layout.html.twig'; // Overloaded variables public static $sRouteName = 'p_aggregatepage_brick'; @@ -50,21 +50,22 @@ class AggregatePageBrick extends PortalBrick /** * @var string[] list of bricks to use, ordered by rank (key=id, value=rank) */ - private $aAggregatePageBricks = array(); + private $aAggregatePageBricks = []; /** @inheritdoc */ public static function RegisterTemplates(TemplatesRegister $oTemplatesRegister): void { parent::RegisterTemplates($oTemplatesRegister); - $oTemplatesRegister->RegisterTemplates(self::class, - TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH . 'aggregate-page/layout.html.twig') + $oTemplatesRegister->RegisterTemplates( + self::class, + TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH.'aggregate-page/layout.html.twig') ); } /** * AggregatePageBrick constructor. */ - function __construct() + public function __construct() { parent::__construct(); @@ -83,25 +84,24 @@ class AggregatePageBrick extends PortalBrick parent::LoadFromXml($oMDElement); /** @var \Combodo\iTop\DesignElement $oBrickSubNode */ - foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) - { - switch ($oBrickSubNode->nodeName) - { + foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) { + switch ($oBrickSubNode->nodeName) { case 'aggregate_page_bricks': /** @var \Combodo\iTop\DesignElement $oAggregatePageBrickNode */ - foreach ($oBrickSubNode->GetNodes('./aggregate_page_brick') as $oAggregatePageBrickNode) - { - if (!$oAggregatePageBrickNode->hasAttribute('id')) - { - throw new DOMFormatException('AggregatePageBrick : must have an id attribute', 0, - null, $oAggregatePageBrickNode); + foreach ($oBrickSubNode->GetNodes('./aggregate_page_brick') as $oAggregatePageBrickNode) { + if (!$oAggregatePageBrickNode->hasAttribute('id')) { + throw new DOMFormatException( + 'AggregatePageBrick : must have an id attribute', + 0, + null, + $oAggregatePageBrickNode + ); } $sBrickName = $oAggregatePageBrickNode->getAttribute('id'); $iBrickRank = static::DEFAULT_RANK; $oOptionalNode = $oAggregatePageBrickNode->GetOptionalElement('rank'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $iBrickRank = $oOptionalNode->GetText(); } @@ -123,5 +123,4 @@ class AggregatePageBrick extends PortalBrick return $this->aAggregatePageBricks; } - -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Brick/BrickCollection.php b/datamodels/2.x/itop-portal-base/portal/src/Brick/BrickCollection.php index d6de6cf96..46979725b 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Brick/BrickCollection.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Brick/BrickCollection.php @@ -1,4 +1,5 @@ aAllowedBricks = null; $this->iDisplayedInHome = 0; $this->iDisplayedInNavigationMenu = 0; - $this->aHomeOrdering = array(); - $this->aNavigationMenuOrdering = array(); + $this->aHomeOrdering = []; + $this->aNavigationMenuOrdering = []; $this->Load(); } @@ -84,8 +85,7 @@ class BrickCollection public function __call($method, $arguments) { // Made for cleaner/easier access from twig (eg. app['brick_collection'].bricks) - switch ($method) - { + switch ($method) { case 'bricks': return $this->GetBricks(); break; @@ -128,10 +128,8 @@ class BrickCollection */ public function GetBrickById($sId) { - foreach ($this->GetBricks() as $oBrick) - { - if ($oBrick->GetId() === $sId) - { + foreach ($this->GetBricks() as $oBrick) { + if ($oBrick->GetId() === $sId) { return $oBrick; } } @@ -146,19 +144,15 @@ class BrickCollection { $aRawBrickList = $this->GetRawBrickList(); - foreach ($aRawBrickList as $oBrick) - { + foreach ($aRawBrickList as $oBrick) { ApplicationHelper::LoadBrickSecurity($oBrick); - if ($oBrick->GetActive() && $oBrick->IsGrantedForProfiles(UserRights::ListProfiles())) - { + if ($oBrick->GetActive() && $oBrick->IsGrantedForProfiles(UserRights::ListProfiles())) { $this->aAllowedBricks[] = $oBrick; - if ($oBrick->GetVisibleHome()) - { + if ($oBrick->GetVisibleHome()) { $this->iDisplayedInHome++; } - if ($oBrick->GetVisibleNavigationMenu()) - { + if ($oBrick->GetVisibleNavigationMenu()) { $this->iDisplayedInNavigationMenu++; } } @@ -191,35 +185,30 @@ class BrickCollection */ private function GetRawBrickList() { - $aBricks = array(); + $aBricks = []; /** @var \Combodo\iTop\DesignElement $oBrickNode */ - foreach ($this->oModuleDesign->GetNodes('/module_design/bricks/brick') as $oBrickNode) - { + foreach ($this->oModuleDesign->GetNodes('/module_design/bricks/brick') as $oBrickNode) { $sBrickClass = $oBrickNode->getAttribute('xsi:type'); - try - { - if (class_exists($sBrickClass)) - { + try { + if (class_exists($sBrickClass)) { /** @var \Combodo\iTop\Portal\Brick\PortalBrick $oBrick */ $oBrick = new $sBrickClass(); - + // Load the brick specific properties from its XML definition $oBrick->LoadFromXml($oBrickNode); $aBricks[] = $oBrick; + } else { + throw new DOMFormatException( + 'Unknown brick class "'.$sBrickClass.'" from xsi:type attribute', + null, + null, + $oBrickNode + ); } - else - { - throw new DOMFormatException('Unknown brick class "'.$sBrickClass.'" from xsi:type attribute', null, - null, $oBrickNode); - } - } - catch (DOMFormatException $e) - { + } catch (DOMFormatException $e) { throw new Exception('Could not create brick ('.$sBrickClass.') from XML because of a DOM problem : '.$e->getMessage()); - } - catch (Exception $e) - { + } catch (Exception $e) { throw new Exception('Could not create brick ('.$sBrickClass.') from XML : '.$oBrickNode->Dump().' '.$e->getMessage()); } } @@ -227,4 +216,4 @@ class BrickCollection return $aBricks; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Brick/BrickNotFoundException.php b/datamodels/2.x/itop-portal-base/portal/src/Brick/BrickNotFoundException.php index 583291f86..c0b2c100c 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Brick/BrickNotFoundException.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Brick/BrickNotFoundException.php @@ -1,4 +1,5 @@ RegisterTemplates(self::class, - TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH . 'browse/layout.html.twig'), - TemplateDefinitionDto::Create('page_list', static::TEMPLATES_BASE_PATH . 'browse/mode_list.html.twig'), - TemplateDefinitionDto::Create('page_tree', static::TEMPLATES_BASE_PATH . 'browse/mode_tree.html.twig'), - TemplateDefinitionDto::Create('page_mosaic', static::TEMPLATES_BASE_PATH . 'browse/mode_mosaic.html.twig'), + $oTemplatesRegister->RegisterTemplates( + self::class, + TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH.'browse/layout.html.twig'), + TemplateDefinitionDto::Create('page_list', static::TEMPLATES_BASE_PATH.'browse/mode_list.html.twig'), + TemplateDefinitionDto::Create('page_tree', static::TEMPLATES_BASE_PATH.'browse/mode_tree.html.twig'), + TemplateDefinitionDto::Create('page_mosaic', static::TEMPLATES_BASE_PATH.'browse/mode_mosaic.html.twig'), ); } @@ -135,15 +135,15 @@ class BrowseBrick extends PortalBrick { parent::__construct(); - $this->aLevels = array(); - $this->aAvailablesBrowseModes = array(); + $this->aLevels = []; + $this->aAvailablesBrowseModes = []; $this->sDefaultBrowseMode = static::DEFAULT_BROWSE_MODE; $this->iDefaultListLength = static::DEFAULT_LIST_LENGTH; } /** * Compare function to sort actions by their rank attribute - * + * * @param array $aAction1 * @param array $aAction2 * @@ -154,13 +154,10 @@ class BrowseBrick extends PortalBrick $bIsAction1RankSet = array_key_exists('rank', $aAction1); $bIsAction2RankSet = array_key_exists('rank', $aAction2); - if($bIsAction1RankSet && $bIsAction2RankSet) - { - //If a1 == a2 return 0, if a1 > a2 return 1 else return -1 + if ($bIsAction1RankSet && $bIsAction2RankSet) { + //If a1 == a2 return 0, if a1 > a2 return 1 else return -1 return ($aAction1['rank'] === $aAction2['rank'] ? $aAction1['default_rank'] - $aAction2['default_rank'] : $aAction1['rank'] - $aAction2['rank']); - } - else - { + } else { //If a1 == a2 == null return 0, if a2 is null and not a1 return 1 else return -1 return ($bIsAction1RankSet === $bIsAction2RankSet ? $aAction1['default_rank'] - $aAction2['default_rank'] : ($bIsAction1RankSet ? 1 : -1)); } @@ -255,7 +252,8 @@ class BrowseBrick extends PortalBrick * * @return $this */ - public function SetDefaultListLength($iDefaultListLength) { + public function SetDefaultListLength($iDefaultListLength) + { $this->iDefaultListLength = $iDefaultListLength; return $this; } @@ -293,8 +291,7 @@ class BrowseBrick extends PortalBrick */ public function RemoveLevels($sLevel) { - if (isset($this->aLevels[$sLevel])) - { + if (isset($this->aLevels[$sLevel])) { unset($this->aLevels[$sLevel]); } @@ -309,7 +306,7 @@ class BrowseBrick extends PortalBrick * * @return \Combodo\iTop\Portal\Brick\BrowseBrick */ - public function AddAvailableBrowseMode($sModeId, $aData = array()) + public function AddAvailableBrowseMode($sModeId, $aData = []) { $this->aAvailablesBrowseModes[$sModeId] = $aData; @@ -325,8 +322,7 @@ class BrowseBrick extends PortalBrick */ public function RemoveAvailableBrowseMode($sModeId) { - if (isset($this->aAvailablesBrowseModes[$sModeId])) - { + if (isset($this->aAvailablesBrowseModes[$sModeId])) { unset($this->aAvailablesBrowseModes[$sModeId]); } @@ -349,43 +345,38 @@ class BrowseBrick extends PortalBrick // Checking specific elements /** @var \Combodo\iTop\DesignElement $oBrickSubNode */ - foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) - { - switch ($oBrickSubNode->nodeName) - { + foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) { + switch ($oBrickSubNode->nodeName) { case 'levels': /** @var \Combodo\iTop\DesignElement $oLevelNode */ - foreach ($oBrickSubNode->GetNodes('*') as $oLevelNode) - { - if ($oLevelNode->nodeName === 'level') - { + foreach ($oBrickSubNode->GetNodes('*') as $oLevelNode) { + if ($oLevelNode->nodeName === 'level') { $this->AddLevel($this->LoadLevelFromXml($oLevelNode)); } } break; case 'browse_modes': /** @var \Combodo\iTop\DesignElement $oBrowseModeNode */ - foreach ($oBrickSubNode->GetNodes('*') as $oBrowseModeNode) - { - switch ($oBrowseModeNode->nodeName) - { + foreach ($oBrickSubNode->GetNodes('*') as $oBrowseModeNode) { + switch ($oBrowseModeNode->nodeName) { case 'availables': /** @var \Combodo\iTop\DesignElement $oModeNode */ - foreach ($oBrowseModeNode->GetNodes('*') as $oModeNode) - { - if (!$oModeNode->hasAttribute('id')) - { - throw new DOMFormatException('BrowseBrick: Browse mode must have a unique ID attribute', 0, - null, $oModeNode); + foreach ($oBrowseModeNode->GetNodes('*') as $oModeNode) { + if (!$oModeNode->hasAttribute('id')) { + throw new DOMFormatException( + 'BrowseBrick: Browse mode must have a unique ID attribute', + 0, + null, + $oModeNode + ); } $sModeId = $oModeNode->getAttribute('id'); - $aModeData = array(); + $aModeData = []; // Checking if the browse mode has a specific template $oTemplateNode = $oModeNode->GetOptionalElement('template'); - if (($oTemplateNode !== null) && ($oTemplateNode->GetText() !== null)) - { + if (($oTemplateNode !== null) && ($oTemplateNode->GetText() !== null)) { $this->SetTemplatePath('page_'.$sModeId, $oTemplateNode->GetText()); } @@ -400,12 +391,12 @@ class BrowseBrick extends PortalBrick break; case 'default_list_length': $iNodeDefaultListLength = (int)$oBrickSubNode->GetText(static::DEFAULT_LIST_LENGTH); - if(!in_array($iNodeDefaultListLength, array(10, 20, 50, -1),true)) - { + if (!in_array($iNodeDefaultListLength, [10, 20, 50, -1], true)) { throw new DOMFormatException( 'BrowseBrick: Default list length must be contained in list length options. Expected -1/10/20/50, '.$iNodeDefaultListLength.' given.', null, - null, $oBrickSubNode + null, + $oBrickSubNode ); } $this->SetDefaultListLength($iNodeDefaultListLength); @@ -414,19 +405,18 @@ class BrowseBrick extends PortalBrick } // Checking that the brick has at least a browse mode - if (count($this->GetAvailablesBrowseModes()) === 0) - { + if (count($this->GetAvailablesBrowseModes()) === 0) { throw new DOMFormatException('BrowseBrick : Must have at least one browse mode', 0, null, $oMDElement); } // Checking that default browse mode in among the available - if (!in_array($this->sDefaultBrowseMode, array_keys($this->aAvailablesBrowseModes))) - { - throw new DOMFormatException('BrowseBrick : Default browse mode "'.$this->sDefaultBrowseMode.'" must be one of the available browse modes ('.implode(', ', - $this->aAvailablesBrowseModes).')', null, null, $oMDElement); + if (!in_array($this->sDefaultBrowseMode, array_keys($this->aAvailablesBrowseModes))) { + throw new DOMFormatException('BrowseBrick : Default browse mode "'.$this->sDefaultBrowseMode.'" must be one of the available browse modes ('.implode( + ', ', + $this->aAvailablesBrowseModes + ).')', null, null, $oMDElement); } // Checking that the brick has at least a level - if (count($this->GetLevels()) === 0) - { + if (count($this->GetLevels()) === 0) { throw new DOMFormatException('BrowseBrick : Must have at least one level', 0, null, $oMDElement); } @@ -444,39 +434,41 @@ class BrowseBrick extends PortalBrick */ protected function LoadLevelFromXml(DesignElement $oMDElement) { - $aLevel = array( + $aLevel = [ 'parent_att' => null, 'tooltip_att' => null, 'description_att' => null, 'image_att' => null, 'title' => null, 'name_att' => static::DEFAULT_LEVEL_NAME_ATT, - 'fields' => array(), - 'actions' => array('default' => array('type' => static::DEFAULT_ACTION, 'rules' => array())), - ); + 'fields' => [], + 'actions' => ['default' => ['type' => static::DEFAULT_ACTION, 'rules' => []]], + ]; // Getting level ID - if ($oMDElement->hasAttribute('id') && $oMDElement->getAttribute('id') !== '') - { + if ($oMDElement->hasAttribute('id') && $oMDElement->getAttribute('id') !== '') { $aLevel['id'] = $oMDElement->getAttribute('id'); - } - else - { - throw new DOMFormatException('BrowseBrick : level tag without "id" attribute. It must have one and it must not be empty', null, - null, $oMDElement); + } else { + throw new DOMFormatException( + 'BrowseBrick : level tag without "id" attribute. It must have one and it must not be empty', + null, + null, + $oMDElement + ); } // Getting level properties /** @var \Combodo\iTop\DesignElement $oLevelPropertyNode */ - foreach ($oMDElement->GetNodes('*') as $oLevelPropertyNode) - { - switch ($oLevelPropertyNode->nodeName) - { + foreach ($oMDElement->GetNodes('*') as $oLevelPropertyNode) { + switch ($oLevelPropertyNode->nodeName) { case 'class': $sClass = $oLevelPropertyNode->GetText(); - if ($sClass === '') - { - throw new DOMFormatException('BrowseBrick : class tag is empty. Must contain Classname', null, null, - $oLevelPropertyNode); + if ($sClass === '') { + throw new DOMFormatException( + 'BrowseBrick : class tag is empty. Must contain Classname', + null, + null, + $oLevelPropertyNode + ); } $aLevel['oql'] = 'SELECT '.$sClass; @@ -484,10 +476,13 @@ class BrowseBrick extends PortalBrick case 'oql': $sOql = $oLevelPropertyNode->GetText(); - if ($sOql === '') - { - throw new DOMFormatException('BrowseBrick : oql tag is empty. Must contain OQL statement', null, null, - $oLevelPropertyNode); + if ($sOql === '') { + throw new DOMFormatException( + 'BrowseBrick : oql tag is empty. Must contain OQL statement', + null, + null, + $oLevelPropertyNode + ); } $aLevel['oql'] = $sOql; @@ -508,25 +503,23 @@ class BrowseBrick extends PortalBrick case 'fields': $sTagName = $oLevelPropertyNode->nodeName; - if ($oLevelPropertyNode->hasChildNodes()) - { - $aLevel[$sTagName] = array(); + if ($oLevelPropertyNode->hasChildNodes()) { + $aLevel[$sTagName] = []; /** @var \Combodo\iTop\DesignElement $oFieldNode */ - foreach ($oLevelPropertyNode->GetNodes('*') as $oFieldNode) - { - if ($oFieldNode->hasAttribute('id') && $oFieldNode->getAttribute('id') !== '') - { - $aLevel[$sTagName][$oFieldNode->getAttribute('id')] = array('hidden' => false); - } - else - { - throw new DOMFormatException('BrowseBrick : '.$sTagName.'/* tag must have an "id" attribute and it must not be empty', - null, null, $oFieldNode); + foreach ($oLevelPropertyNode->GetNodes('*') as $oFieldNode) { + if ($oFieldNode->hasAttribute('id') && $oFieldNode->getAttribute('id') !== '') { + $aLevel[$sTagName][$oFieldNode->getAttribute('id')] = ['hidden' => false]; + } else { + throw new DOMFormatException( + 'BrowseBrick : '.$sTagName.'/* tag must have an "id" attribute and it must not be empty', + null, + null, + $oFieldNode + ); } $oFieldSubNode = $oFieldNode->GetOptionalElement('hidden'); - if ($oFieldSubNode !== null) - { + if ($oFieldSubNode !== null) { $aLevel[$sTagName][$oFieldNode->getAttribute('id')]['hidden'] = ($oFieldSubNode->GetText() === 'true') ? true : false; } } @@ -536,94 +529,84 @@ class BrowseBrick extends PortalBrick case 'actions': $sTagName = $oLevelPropertyNode->nodeName; - if ($oLevelPropertyNode->hasChildNodes()) - { - $aLevel[$sTagName] = array(); + if ($oLevelPropertyNode->hasChildNodes()) { + $aLevel[$sTagName] = []; $iActionDefaultRank = 0; /** @var \Combodo\iTop\DesignElement $oActionNode */ - foreach ($oLevelPropertyNode->GetNodes('*') as $oActionNode) - { - if ($oActionNode->hasAttribute('id') && $oActionNode->getAttribute('id') !== '') - { - $aTmpAction = array( + foreach ($oLevelPropertyNode->GetNodes('*') as $oActionNode) { + if ($oActionNode->hasAttribute('id') && $oActionNode->getAttribute('id') !== '') { + $aTmpAction = [ 'type' => null, - 'rules' => array(), - ); + 'rules' => [], + ]; // Action type $aTmpAction['type'] = ($oActionNode->hasAttribute('xsi:type') && $oActionNode->getAttribute('xsi:type') !== '') ? $oActionNode->getAttribute('xsi:type') : static::DEFAULT_ACTION; // Action destination class - if ($aTmpAction['type'] === static::ENUM_ACTION_CREATE_FROM_THIS) - { - if ($oActionNode->GetOptionalElement('factory_method') !== null) - { - $aTmpAction['factory'] = array( + if ($aTmpAction['type'] === static::ENUM_ACTION_CREATE_FROM_THIS) { + if ($oActionNode->GetOptionalElement('factory_method') !== null) { + $aTmpAction['factory'] = [ 'type' => static::ENUM_FACTORY_TYPE_METHOD, 'value' => $oActionNode->GetOptionalElement('factory_method')->GetText(), - ); - } - else - { - $aTmpAction['factory'] = array( + ]; + } else { + $aTmpAction['factory'] = [ 'type' => static::ENUM_FACTORY_TYPE_CLASS, 'value' => $oActionNode->GetUniqueElement('class')->GetText(), - ); + ]; } } // Action title $oActionTitleNode = $oActionNode->GetOptionalElement('title'); - if ($oActionTitleNode !== null) - { + if ($oActionTitleNode !== null) { $aTmpAction['title'] = $oActionTitleNode->GetText(); } // Action icon class $oActionIconClassNode = $oActionNode->GetOptionalElement('icon_class'); - if ($oActionIconClassNode !== null) - { + if ($oActionIconClassNode !== null) { $aTmpAction['icon_class'] = $oActionIconClassNode->GetText(); } // Action opening target $oActionOpeningTargetNode = $oActionNode->GetOptionalElement('opening_target'); - if ($oActionOpeningTargetNode !== null) - { + if ($oActionOpeningTargetNode !== null) { $aTmpAction['opening_target'] = $oActionOpeningTargetNode->GetText(static::DEFAULT_ACTION_OPENING_TARGET); - } - else - { + } else { $aTmpAction['opening_target'] = static::DEFAULT_ACTION_OPENING_TARGET; } // - Checking that opening target is among authorized modes - if (!in_array($aTmpAction['opening_target'], static::$aOpeningTargets)) - { - throw new DOMFormatException('BrowseBrick : '.$sTagName.'/action/opening_target has a wrong value. "'.$aTmpAction['opening_target'].'" given, '.implode('|', - static::$aOpeningTargets).' expected.', null, null, $oActionOpeningTargetNode); + if (!in_array($aTmpAction['opening_target'], static::$aOpeningTargets)) { + throw new DOMFormatException('BrowseBrick : '.$sTagName.'/action/opening_target has a wrong value. "'.$aTmpAction['opening_target'].'" given, '.implode( + '|', + static::$aOpeningTargets + ).' expected.', null, null, $oActionOpeningTargetNode); } $oActionRankNode = $oActionNode->GetOptionalElement('rank'); - if ($oActionRankNode !== null) - { + if ($oActionRankNode !== null) { $aTmpAction['rank'] = (int)$oActionRankNode->GetText(); } // Action rules /** @var \Combodo\iTop\DesignElement $oRuleNode */ - foreach ($oActionNode->GetNodes('./rules/rule') as $oRuleNode) - { - if ($oRuleNode->hasAttribute('id') && $oRuleNode->getAttribute('id') !== '') - { + foreach ($oActionNode->GetNodes('./rules/rule') as $oRuleNode) { + if ($oRuleNode->hasAttribute('id') && $oRuleNode->getAttribute('id') !== '') { $aTmpAction['rules'][] = $oRuleNode->getAttribute('id'); - } - else - { - throw new DOMFormatException('BrowseBrick : '.$sTagName.'/rules/rule tag must have an "id" attribute and it must not be empty', - null, null, $oRuleNode); + } else { + throw new DOMFormatException( + 'BrowseBrick : '.$sTagName.'/rules/rule tag must have an "id" attribute and it must not be empty', + null, + null, + $oRuleNode + ); } } $aTmpAction['default_rank'] = $iActionDefaultRank++; $aLevel[$sTagName][$oActionNode->getAttribute('id')] = $aTmpAction; - } - else - { - throw new DOMFormatException('BrowseBrick : '.$sTagName.'/* tag must have an "id" attribute and it must not be empty', - null, null, $oActionNode); + } else { + throw new DOMFormatException( + 'BrowseBrick : '.$sTagName.'/* tag must have an "id" attribute and it must not be empty', + null, + null, + $oActionNode + ); } } uasort($aLevel[$sTagName], [$this, 'CompareActionsByRank']); @@ -631,10 +614,8 @@ class BrowseBrick extends PortalBrick break; case 'levels': - foreach ($oLevelPropertyNode->GetNodes('*') as $oSubLevelNode) - { - if ($oSubLevelNode->nodeName === 'level') - { + foreach ($oLevelPropertyNode->GetNodes('*') as $oSubLevelNode) { + if ($oSubLevelNode->nodeName === 'level') { $aLevel['levels'][] = $this->LoadLevelFromXml($oSubLevelNode); } } @@ -644,8 +625,7 @@ class BrowseBrick extends PortalBrick } // Checking if level has an oql - if (!isset($aLevel['oql']) || $aLevel['oql'] === '') - { + if (!isset($aLevel['oql']) || $aLevel['oql'] === '') { throw new DOMFormatException('BrowseBrick : must have a valid tag', null, null, $oMDElement); } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Brick/CreateBrick.php b/datamodels/2.x/itop-portal-base/portal/src/Brick/CreateBrick.php index 62c9e08fb..337834a4f 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Brick/CreateBrick.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Brick/CreateBrick.php @@ -35,10 +35,10 @@ use DOMFormatException; class CreateBrick extends PortalBrick { // Overloaded constants - const DEFAULT_DECORATION_CLASS_HOME = 'fas fa-plus'; - const DEFAULT_DECORATION_CLASS_NAVIGATION_MENU = 'fas fa-plus fa-2x'; + public const DEFAULT_DECORATION_CLASS_HOME = 'fas fa-plus'; + public const DEFAULT_DECORATION_CLASS_NAVIGATION_MENU = 'fas fa-plus fa-2x'; /** @var string DEFAULT_CLASS */ - const DEFAULT_CLASS = ''; + public const DEFAULT_CLASS = ''; // Overloaded variables public static $sRouteName = 'p_create_brick'; @@ -48,14 +48,15 @@ class CreateBrick extends PortalBrick /** @var array $aRules */ protected $aRules; - const DEFAULT_PAGE_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/create/modal.html.twig'; + public const DEFAULT_PAGE_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/create/modal.html.twig'; /** @inheritdoc */ public static function RegisterTemplates(TemplatesRegister $oTemplatesRegister): void { parent::RegisterTemplates($oTemplatesRegister); - $oTemplatesRegister->RegisterTemplates(self::class, - TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH . 'create/modal.html.twig') + $oTemplatesRegister->RegisterTemplates( + self::class, + TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH.'create/modal.html.twig') ); } @@ -67,7 +68,7 @@ class CreateBrick extends PortalBrick parent::__construct(); $this->sClass = static::DEFAULT_CLASS; - $this->aRules = array(); + $this->aRules = []; } /** @@ -134,26 +135,24 @@ class CreateBrick extends PortalBrick // Checking specific elements /** @var \Combodo\iTop\DesignElement $oBrickSubNode */ - foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) - { - switch ($oBrickSubNode->nodeName) - { + foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) { + switch ($oBrickSubNode->nodeName) { case 'class': $this->SetClass($oBrickSubNode->GetText(self::DEFAULT_CLASS)); break; case 'rules': /** @var \Combodo\iTop\DesignElement $oRuleNode */ - foreach ($oBrickSubNode->GetNodes('*') as $oRuleNode) - { - if ($oRuleNode->hasAttribute('id') && $oRuleNode->getAttribute('id') !== '') - { + foreach ($oBrickSubNode->GetNodes('*') as $oRuleNode) { + if ($oRuleNode->hasAttribute('id') && $oRuleNode->getAttribute('id') !== '') { $this->aRules[] = $oRuleNode->getAttribute('id'); - } - else - { - throw new DOMFormatException('CreateBrick: /rules/rule tag must have an "id" attribute and it must not be empty', - null, null, $oRuleNode); + } else { + throw new DOMFormatException( + 'CreateBrick: /rules/rule tag must have an "id" attribute and it must not be empty', + null, + null, + $oRuleNode + ); } } break; diff --git a/datamodels/2.x/itop-portal-base/portal/src/Brick/FilterBrick.php b/datamodels/2.x/itop-portal-base/portal/src/Brick/FilterBrick.php index 3ed96552d..72541996c 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Brick/FilterBrick.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Brick/FilterBrick.php @@ -35,21 +35,21 @@ use DOMFormatException; class FilterBrick extends PortalBrick { // Overloaded constants - const DEFAULT_VISIBLE_NAVIGATION_MENU = false; - /** - * @deprecated 3.2.1 - */ - const DEFAULT_TILE_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/filter/tile.html.twig'; - const DEFAULT_DECORATION_CLASS_HOME = 'fas fa-search'; - const DEFAULT_DECORATION_CLASS_NAVIGATION_MENU = 'fas fa-search fa-2x'; - /** @var string DEFAULT_TARGET_BRICK_CLASS */ - const DEFAULT_TARGET_BRICK_CLASS = 'Combodo\\iTop\\Portal\\Brick\\BrowseBrick'; + public const DEFAULT_VISIBLE_NAVIGATION_MENU = false; + /** + * @deprecated 3.2.1 + */ + public const DEFAULT_TILE_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/filter/tile.html.twig'; + public const DEFAULT_DECORATION_CLASS_HOME = 'fas fa-search'; + public const DEFAULT_DECORATION_CLASS_NAVIGATION_MENU = 'fas fa-search fa-2x'; + /** @var string DEFAULT_TARGET_BRICK_CLASS */ + public const DEFAULT_TARGET_BRICK_CLASS = 'Combodo\\iTop\\Portal\\Brick\\BrowseBrick'; /** @var string DEFAULT_SEARCH_PLACEHOLDER_VALUE */ - const DEFAULT_SEARCH_PLACEHOLDER_VALUE = 'Brick:Portal:Filter:SearchInput:Placeholder'; + public const DEFAULT_SEARCH_PLACEHOLDER_VALUE = 'Brick:Portal:Filter:SearchInput:Placeholder'; /** @var string DEFAULT_SEARCH_SUBMIT_LABEL */ - const DEFAULT_SEARCH_SUBMIT_LABEL = 'Brick:Portal:Filter:SearchInput:Submit'; + public const DEFAULT_SEARCH_SUBMIT_LABEL = 'Brick:Portal:Filter:SearchInput:Submit'; /** @var string DEFAULT_SEARCH_SUBMIT_CLASS */ - const DEFAULT_SEARCH_SUBMIT_CLASS = ''; + public const DEFAULT_SEARCH_SUBMIT_CLASS = ''; /** @var string $sTargetBrickId */ protected $sTargetBrickId; @@ -68,8 +68,9 @@ class FilterBrick extends PortalBrick public static function RegisterTemplates(TemplatesRegister $oTemplatesRegister): void { parent::RegisterTemplates($oTemplatesRegister); - $oTemplatesRegister->RegisterTemplates(self::class, - TemplateDefinitionDto::Create('tile', static::TEMPLATES_BASE_PATH . 'filter/tile.html.twig') + $oTemplatesRegister->RegisterTemplates( + self::class, + TemplateDefinitionDto::Create('tile', static::TEMPLATES_BASE_PATH.'filter/tile.html.twig') ); } @@ -98,9 +99,9 @@ class FilterBrick extends PortalBrick * @return string */ public function GetTargetBrickClass() - { - return $this->sTargetBrickClass; - } + { + return $this->sTargetBrickClass; + } /** * @return string @@ -149,9 +150,9 @@ class FilterBrick extends PortalBrick * @param string $sTargetBrickClass */ public function SetTargetBrickClass($sTargetBrickClass) - { - $this->sTargetBrickClass = $sTargetBrickClass; - } + { + $this->sTargetBrickClass = $sTargetBrickClass; + } /** * @param string $sTargetBrickTab @@ -197,38 +198,34 @@ class FilterBrick extends PortalBrick return $this; } - /** - * Load the brick's data from the xml passed as a ModuleDesignElement. - * This is used to set all the brick attributes at once. - * - * @param \Combodo\iTop\DesignElement $oMDElement - * - * @return \Combodo\iTop\Portal\Brick\FilterBrick - * - * @throws \DOMFormatException - */ + /** + * Load the brick's data from the xml passed as a ModuleDesignElement. + * This is used to set all the brick attributes at once. + * + * @param \Combodo\iTop\DesignElement $oMDElement + * + * @return \Combodo\iTop\Portal\Brick\FilterBrick + * + * @throws \DOMFormatException + */ public function LoadFromXml(DesignElement $oMDElement) { parent::LoadFromXml($oMDElement); // Checking specific elements /** @var \Combodo\iTop\DesignElement $oBrickSubNode */ - foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) - { - switch ($oBrickSubNode->nodeName) - { + foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) { + switch ($oBrickSubNode->nodeName) { case 'target_brick': /** @var \Combodo\iTop\DesignElement $oTargetBrickNode */ - foreach ($oBrickSubNode->GetNodes('*') as $oTargetBrickNode) - { - switch ($oTargetBrickNode->nodeName) - { - case 'id': - $this->SetTargetBrickId($oTargetBrickNode->GetText()); - break; - case 'type': - $this->SetTargetBrickClass($oTargetBrickNode->GetText()); - break; + foreach ($oBrickSubNode->GetNodes('*') as $oTargetBrickNode) { + switch ($oTargetBrickNode->nodeName) { + case 'id': + $this->SetTargetBrickId($oTargetBrickNode->GetText()); + break; + case 'type': + $this->SetTargetBrickClass($oTargetBrickNode->GetText()); + break; case 'tab': $this->SetTargetBrickTab($oTargetBrickNode->GetText()); break; @@ -236,12 +233,12 @@ class FilterBrick extends PortalBrick } break; case 'search_placeholder_value': - // Note: We don't put the default value constant if the node is empty because we might actually want this to be empty + // Note: We don't put the default value constant if the node is empty because we might actually want this to be empty $this->SetSearchPlaceholderValue($oBrickSubNode->GetText('')); break; case 'search_submit_label': - // Note: We don't put the default value constant if the node is empty because we might actually want this to be empty - $this->SetSearchSubmitLabel($oBrickSubNode->GetText('')); + // Note: We don't put the default value constant if the node is empty because we might actually want this to be empty + $this->SetSearchSubmitLabel($oBrickSubNode->GetText('')); break; case 'search_submit_class': $this->SetSearchSubmitClass($oBrickSubNode->GetText(static::DEFAULT_SEARCH_SUBMIT_CLASS)); @@ -250,8 +247,7 @@ class FilterBrick extends PortalBrick } // Checking that the brick has at least a target brick id - if (($this->GetTargetBrickId() === null) || ($this->GetTargetBrickId() === '')) - { + if (($this->GetTargetBrickId() === null) || ($this->GetTargetBrickId() === '')) { throw new DOMFormatException('FilterBrick : Must have a target brick id', 0, null, $oMDElement); } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Brick/ManageBrick.php b/datamodels/2.x/itop-portal-base/portal/src/Brick/ManageBrick.php index b770b6c40..c1a716bb8 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Brick/ManageBrick.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Brick/ManageBrick.php @@ -32,126 +32,126 @@ use ModuleDesign; class ManageBrick extends PortalBrick { /** @var string ENUM_ACTION_VIEW */ - const ENUM_ACTION_VIEW = 'view'; + public const ENUM_ACTION_VIEW = 'view'; /** @var string ENUM_ACTION_EDIT */ - const ENUM_ACTION_EDIT = 'edit'; + public const ENUM_ACTION_EDIT = 'edit'; /** @var string ENUM_TILE_MODE_TEXT */ - const ENUM_TILE_MODE_TEXT = 'text'; + public const ENUM_TILE_MODE_TEXT = 'text'; /** @var string ENUM_TILE_MODE_BADGE */ - const ENUM_TILE_MODE_BADGE = 'badge'; + public const ENUM_TILE_MODE_BADGE = 'badge'; /** @var string ENUM_TILE_MODE_PIE */ - const ENUM_TILE_MODE_PIE = 'pie-chart'; + public const ENUM_TILE_MODE_PIE = 'pie-chart'; /** @var string ENUM_TILE_MODE_BAR */ - const ENUM_TILE_MODE_BAR = 'bar-chart'; + public const ENUM_TILE_MODE_BAR = 'bar-chart'; /** @var string ENUM_TILE_MODE_TOP */ - const ENUM_TILE_MODE_TOP = 'top-list'; + public const ENUM_TILE_MODE_TOP = 'top-list'; /** @var string ENUM_DISPLAY_MODE_LIST */ - const ENUM_DISPLAY_MODE_LIST = 'list'; + public const ENUM_DISPLAY_MODE_LIST = 'list'; /** @var string ENUM_DISPLAY_MODE_PIE */ - const ENUM_DISPLAY_MODE_PIE = 'pie-chart'; + public const ENUM_DISPLAY_MODE_PIE = 'pie-chart'; /** @var string ENUM_DISPLAY_MODE_BAR */ - const ENUM_DISPLAY_MODE_BAR = 'bar-chart'; + public const ENUM_DISPLAY_MODE_BAR = 'bar-chart'; /** @var string ENUM_PAGE_TEMPLATE_PATH_TABLE * @deprecated since 3.2.1 * */ - const ENUM_PAGE_TEMPLATE_PATH_TABLE = 'itop-portal-base/portal/templates/bricks/manage/layout-table.html.twig'; + public const ENUM_PAGE_TEMPLATE_PATH_TABLE = 'itop-portal-base/portal/templates/bricks/manage/layout-table.html.twig'; /** @var string ENUM_PAGE_TEMPLATE_PATH_CHART * @deprecated since 3.2.1 * */ - const ENUM_PAGE_TEMPLATE_PATH_CHART = 'itop-portal-base/portal/templates/bricks/manage/layout-chart.html.twig'; + public const ENUM_PAGE_TEMPLATE_PATH_CHART = 'itop-portal-base/portal/templates/bricks/manage/layout-chart.html.twig'; /** Overloaded constants */ - const DEFAULT_DECORATION_CLASS_HOME = 'fas fa-pen-square'; - const DEFAULT_DECORATION_CLASS_NAVIGATION_MENU = 'fas fa-pen-square fa-2x'; + public const DEFAULT_DECORATION_CLASS_HOME = 'fas fa-pen-square'; + public const DEFAULT_DECORATION_CLASS_NAVIGATION_MENU = 'fas fa-pen-square fa-2x'; /** * @deprecated 3.2.1 */ - const DEFAULT_PAGE_TEMPLATE_PATH = self::ENUM_PAGE_TEMPLATE_PATH_TABLE; - const DEFAULT_DATA_LOADING = self::ENUM_DATA_LOADING_LAZY; + public const DEFAULT_PAGE_TEMPLATE_PATH = self::ENUM_PAGE_TEMPLATE_PATH_TABLE; + public const DEFAULT_DATA_LOADING = self::ENUM_DATA_LOADING_LAZY; /** * @deprecated 3.2.1 */ - const DEFAULT_TILE_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/manage/tile-default.html.twig'; - const DEFAULT_TILE_CONTROLLER_ACTION = 'Combodo\\iTop\\Portal\\Controller\\ManageBrickController::TileAction'; + public const DEFAULT_TILE_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/manage/tile-default.html.twig'; + public const DEFAULT_TILE_CONTROLLER_ACTION = 'Combodo\\iTop\\Portal\\Controller\\ManageBrickController::TileAction'; /** @var string DEFAULT_OQL */ - const DEFAULT_OQL = ''; + public const DEFAULT_OQL = ''; /** @var string DEFAULT_OPENING_MODE */ - const DEFAULT_OPENING_MODE = self::ENUM_ACTION_EDIT; + public const DEFAULT_OPENING_MODE = self::ENUM_ACTION_EDIT; /** @var int DEFAULT_LIST_LENGTH */ - const DEFAULT_LIST_LENGTH = 20; + public const DEFAULT_LIST_LENGTH = 20; /** @var string DEFAULT_ZLIST_FIELDS */ - const DEFAULT_ZLIST_FIELDS = 'list'; + public const DEFAULT_ZLIST_FIELDS = 'list'; /** @var bool DEFAULT_SHOW_TAB_COUNTS */ - const DEFAULT_SHOW_TAB_COUNTS = false; + public const DEFAULT_SHOW_TAB_COUNTS = false; /** @var string DEFAULT_DISPLAY_MODE */ - const DEFAULT_DISPLAY_MODE = self::ENUM_DISPLAY_MODE_LIST; + public const DEFAULT_DISPLAY_MODE = self::ENUM_DISPLAY_MODE_LIST; /** @var string DEFAULT_TILE_MODE */ - const DEFAULT_TILE_MODE = self::ENUM_TILE_MODE_TEXT; + public const DEFAULT_TILE_MODE = self::ENUM_TILE_MODE_TEXT; /** @var int DEFAULT_GROUP_LIMIT */ - const DEFAULT_GROUP_LIMIT = 0; + public const DEFAULT_GROUP_LIMIT = 0; /** @var bool DEFAULT_GROUP_SHOW_OTHERS */ - const DEFAULT_GROUP_SHOW_OTHERS = true; + public const DEFAULT_GROUP_SHOW_OTHERS = true; /** @var array $aDisplayModes */ - public static array $aDisplayModes = array( + public static array $aDisplayModes = [ self::ENUM_DISPLAY_MODE_LIST, self::ENUM_DISPLAY_MODE_PIE, self::ENUM_DISPLAY_MODE_BAR, - ); + ]; /** @var array $aTileModes */ - public static array $aTileModes = array( + public static array $aTileModes = [ self::ENUM_TILE_MODE_TEXT, self::ENUM_TILE_MODE_BADGE, self::ENUM_TILE_MODE_PIE, self::ENUM_TILE_MODE_BAR, self::ENUM_TILE_MODE_TOP, - ); + ]; /** @var array $aPresentationData * @deprecated since 3.2.1 */ - public static $aPresentationData = array( - self::ENUM_TILE_MODE_BADGE => array( + public static $aPresentationData = [ + self::ENUM_TILE_MODE_BADGE => [ 'decorationCssClass' => 'fas fa-id-card fa-2x', 'tileTemplate' => 'itop-portal-base/portal/templates/bricks/manage/tile-badge.html.twig', 'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_TABLE, 'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_LIST, 'need_details' => true, - ), - self::ENUM_TILE_MODE_TOP => array( + ], + self::ENUM_TILE_MODE_TOP => [ 'decorationCssClass' => 'fas fa-signal fa-rotate-270 fa-2x', 'tileTemplate' => 'itop-portal-base/portal/templates/bricks/manage/tile-top-list.html.twig', 'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_TABLE, 'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_LIST, 'need_details' => true, - ), - self::ENUM_TILE_MODE_PIE => array( + ], + self::ENUM_TILE_MODE_PIE => [ 'decorationCssClass' => 'fas fa-chart-pie fa-2x', 'tileTemplate' => 'itop-portal-base/portal/templates/bricks/manage/tile-chart.html.twig', 'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_CHART, 'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_PIE, 'need_details' => false, - ), - self::ENUM_TILE_MODE_BAR => array( + ], + self::ENUM_TILE_MODE_BAR => [ 'decorationCssClass' => 'fas fa-chart-bar fa-2x', 'tileTemplate' => 'itop-portal-base/portal/templates/bricks/manage/tile-chart.html.twig', 'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_CHART, 'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_BAR, 'need_details' => false, - ), - self::ENUM_TILE_MODE_TEXT => array( + ], + self::ENUM_TILE_MODE_TEXT => [ 'decorationCssClass' => 'fas fa-pen-square fa-2x', 'tileTemplate' => self::DEFAULT_TILE_TEMPLATE_PATH, 'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_TABLE, 'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_LIST, 'need_details' => true, - ), - ); + ], + ]; /** @var array $aDefaultTileData */ private static array $aDefaultTileData = [ @@ -201,7 +201,7 @@ class ManageBrick extends PortalBrick /** @var bool $bShowTabCounts */ protected $bShowTabCounts; /** @var array $aAvailableDisplayModes */ - protected $aAvailableDisplayModes = array(); + protected $aAvailableDisplayModes = []; /** @var string $sDefaultDisplayMode */ protected $sDefaultDisplayMode; /** @var string $sTileMode */ @@ -217,16 +217,17 @@ class ManageBrick extends PortalBrick public static function RegisterTemplates(TemplatesRegister $oTemplatesRegister): void { parent::RegisterTemplates($oTemplatesRegister); - $oTemplatesRegister->RegisterTemplates(self::class, - TemplateDefinitionDto::Create('tile', static::TEMPLATES_BASE_PATH . 'manage/tile-default.html.twig'), - TemplateDefinitionDto::Create('tile_badge', static::TEMPLATES_BASE_PATH. 'manage/tile-badge.html.twig'), - TemplateDefinitionDto::Create('tile_chart', static::TEMPLATES_BASE_PATH . 'manage/tile-chart.html.twig'), - TemplateDefinitionDto::Create('tile_top_list', static::TEMPLATES_BASE_PATH . 'manage/tile-top-list.html.twig'), - TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH . 'manage/layout.html.twig'), - TemplateDefinitionDto::Create('page_table', static::TEMPLATES_BASE_PATH . 'manage/layout-table.html.twig'), - TemplateDefinitionDto::Create('page_chart', static::TEMPLATES_BASE_PATH . 'manage/layout-chart.html.twig'), - TemplateDefinitionDto::Create('mode_chart_bar', static::TEMPLATES_BASE_PATH . 'manage/mode-bar-chart.html.twig', true, self::ENUM_DISPLAY_MODE_BAR), - TemplateDefinitionDto::Create('mode_chart_pie', static::TEMPLATES_BASE_PATH . 'manage/mode-pie-chart.html.twig', true,self::ENUM_DISPLAY_MODE_PIE), + $oTemplatesRegister->RegisterTemplates( + self::class, + TemplateDefinitionDto::Create('tile', static::TEMPLATES_BASE_PATH.'manage/tile-default.html.twig'), + TemplateDefinitionDto::Create('tile_badge', static::TEMPLATES_BASE_PATH.'manage/tile-badge.html.twig'), + TemplateDefinitionDto::Create('tile_chart', static::TEMPLATES_BASE_PATH.'manage/tile-chart.html.twig'), + TemplateDefinitionDto::Create('tile_top_list', static::TEMPLATES_BASE_PATH.'manage/tile-top-list.html.twig'), + TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH.'manage/layout.html.twig'), + TemplateDefinitionDto::Create('page_table', static::TEMPLATES_BASE_PATH.'manage/layout-table.html.twig'), + TemplateDefinitionDto::Create('page_chart', static::TEMPLATES_BASE_PATH.'manage/layout-chart.html.twig'), + TemplateDefinitionDto::Create('mode_chart_bar', static::TEMPLATES_BASE_PATH.'manage/mode-bar-chart.html.twig', true, self::ENUM_DISPLAY_MODE_BAR), + TemplateDefinitionDto::Create('mode_chart_pie', static::TEMPLATES_BASE_PATH.'manage/mode-pie-chart.html.twig', true, self::ENUM_DISPLAY_MODE_PIE), ); } @@ -239,9 +240,9 @@ class ManageBrick extends PortalBrick $this->sOql = static::DEFAULT_OQL; $this->sOpeningMode = static::DEFAULT_OPENING_MODE; - $this->aGrouping = array(); - $this->aFields = array(); - $this->aExportFields = array(); + $this->aGrouping = []; + $this->aFields = []; + $this->aExportFields = []; $this->bShowTabCounts = static::DEFAULT_SHOW_TAB_COUNTS; $this->sDefaultDisplayMode = static::DEFAULT_DISPLAY_MODE; @@ -251,7 +252,7 @@ class ManageBrick extends PortalBrick $this->iDefaultListLength = static::DEFAULT_LIST_LENGTH; // This is hardcoded for now, we might allow area grouping on another attribute in the future - $this->AddGrouping('areas', array('attribute' => 'finalclass')); + $this->AddGrouping('areas', ['attribute' => 'finalclass']); } /** @@ -263,13 +264,11 @@ class ManageBrick extends PortalBrick * * @return bool */ - static public function AreDetailsNeededForDisplayMode($sDisplayMode) + public static function AreDetailsNeededForDisplayMode($sDisplayMode) { $bNeedDetails = false; - foreach (static::$aPresentationData as $aData) - { - if ($aData['layoutDisplayMode'] === $sDisplayMode) - { + foreach (static::$aPresentationData as $aData) { + if ($aData['layoutDisplayMode'] === $sDisplayMode) { $bNeedDetails = $aData['need_details']; break; } @@ -278,7 +277,6 @@ class ManageBrick extends PortalBrick return $bNeedDetails; } - /** * Returns if the $sLayoutMode need objects details for rendering. * @@ -301,13 +299,11 @@ class ManageBrick extends PortalBrick * @param string $sDisplayMode * @return string */ - static public function GetPageTemplateFromDisplayMode($sDisplayMode) + public static function GetPageTemplateFromDisplayMode($sDisplayMode) { $sTemplate = static::DEFAULT_PAGE_TEMPLATE_PATH; - foreach (static::$aPresentationData as $aData) - { - if ($aData['layoutDisplayMode'] === $sDisplayMode) - { + foreach (static::$aPresentationData as $aData) { + if ($aData['layoutDisplayMode'] === $sDisplayMode) { $sTemplate = $aData['layoutTemplate']; break; } @@ -484,8 +480,7 @@ class ManageBrick extends PortalBrick */ public function GetPresentationDataForTileMode($sTileMode) { - if (isset(static::$aPresentationData[$sTileMode])) - { + if (isset(static::$aPresentationData[$sTileMode])) { return static::$aPresentationData[$sTileMode]; } @@ -580,7 +575,7 @@ class ManageBrick extends PortalBrick /** * Returns the default lists length to display - * + * * @return int */ public function GetDefaultListLength() @@ -590,12 +585,13 @@ class ManageBrick extends PortalBrick /** * Sets the default lists length to display - * + * * @param int $iDefaultListLength - * + * * @return $this */ - public function SetDefaultListLength($iDefaultListLength) { + public function SetDefaultListLength($iDefaultListLength) + { $this->iDefaultListLength = $iDefaultListLength; return $this; } @@ -615,8 +611,7 @@ class ManageBrick extends PortalBrick $this->aGrouping[$sName] = $aGrouping; // Sorting - if (!$this->IsGroupingByDistinctValues($sName)) - { + if (!$this->IsGroupingByDistinctValues($sName)) { usort($this->aGrouping[$sName]['groups'], function ($a, $b) { if ($a['rank'] === $b['rank']) { return 0; @@ -638,8 +633,7 @@ class ManageBrick extends PortalBrick */ public function RemoveGrouping($sName) { - if (isset($this->aGrouping[$sName])) - { + if (isset($this->aGrouping[$sName])) { unset($this->aGrouping[$sName]); } @@ -655,8 +649,7 @@ class ManageBrick extends PortalBrick */ public function AddField($sAttCode) { - if (!in_array($sAttCode, $this->aFields)) - { + if (!in_array($sAttCode, $this->aFields)) { $this->aFields[] = $sAttCode; } @@ -672,8 +665,7 @@ class ManageBrick extends PortalBrick */ public function RemoveField($sAttCode) { - if (isset($this->aFields[$sAttCode])) - { + if (isset($this->aFields[$sAttCode])) { unset($this->aFields[$sAttCode]); } @@ -682,8 +674,7 @@ class ManageBrick extends PortalBrick public function AddExportField($sAttCode) { - if (!in_array($sAttCode, $this->aExportFields)) - { + if (!in_array($sAttCode, $this->aExportFields)) { $this->aExportFields[] = $sAttCode; } @@ -692,8 +683,7 @@ class ManageBrick extends PortalBrick public function RemoveExportField($sAttCode) { - if (isset($this->aExportFields[$sAttCode])) - { + if (isset($this->aExportFields[$sAttCode])) { unset($this->aExportFields[$sAttCode]); } @@ -749,10 +739,11 @@ class ManageBrick extends PortalBrick */ public function AddAvailableDisplayMode($sModeId) { - if (!in_array($sModeId, static::$aDisplayModes)) - { - throw new Exception('ManageBrick: Display mode "'.$sModeId.'" must be one of the allowed display modes ('.implode(', ', - static::$aDisplayModes).')'); + if (!in_array($sModeId, static::$aDisplayModes)) { + throw new Exception('ManageBrick: Display mode "'.$sModeId.'" must be one of the allowed display modes ('.implode( + ', ', + static::$aDisplayModes + ).')'); } $this->aAvailableDisplayModes[] = $sModeId; @@ -769,8 +760,7 @@ class ManageBrick extends PortalBrick */ public function RemoveAvailableDisplayMode($sModeId) { - if (isset($this->aAvailableDisplayModes[$sModeId])) - { + if (isset($this->aAvailableDisplayModes[$sModeId])) { unset($this->aAvailableDisplayModes[$sModeId]); } @@ -843,16 +833,17 @@ class ManageBrick extends PortalBrick // Checking specific elements /** @var \Combodo\iTop\DesignElement $oBrickSubNode */ - foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) - { - switch ($oBrickSubNode->nodeName) - { + foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) { + switch ($oBrickSubNode->nodeName) { case 'class': $sClass = $oBrickSubNode->GetText(); - if ($sClass === '') - { - throw new DOMFormatException('ManageBrick: class tag is empty. Must contain Classname', null, - null, $oBrickSubNode); + if ($sClass === '') { + throw new DOMFormatException( + 'ManageBrick: class tag is empty. Must contain Classname', + null, + null, + $oBrickSubNode + ); } $this->SetOql('SELECT '.$sClass); @@ -860,10 +851,13 @@ class ManageBrick extends PortalBrick case 'oql': $sOql = $oBrickSubNode->GetText(); - if ($sOql === '') - { - throw new DOMFormatException('ManageBrick: oql tag is empty. Must contain OQL statement', null, - null, $oBrickSubNode); + if ($sOql === '') { + throw new DOMFormatException( + 'ManageBrick: oql tag is empty. Must contain OQL statement', + null, + null, + $oBrickSubNode + ); } $this->SetOql($sOql); @@ -871,10 +865,13 @@ class ManageBrick extends PortalBrick case 'opening_mode': $sOpeningMode = $oBrickSubNode->GetText(static::DEFAULT_OPENING_MODE); - if (!in_array($sOpeningMode, array(static::ENUM_ACTION_VIEW, static::ENUM_ACTION_EDIT))) - { - throw new DOMFormatException('ManageBrick: opening_mode tag value must be edit|view ("'.$sOpeningMode.'" given)', - null, null, $oBrickSubNode); + if (!in_array($sOpeningMode, [static::ENUM_ACTION_VIEW, static::ENUM_ACTION_EDIT])) { + throw new DOMFormatException( + 'ManageBrick: opening_mode tag value must be edit|view ("'.$sOpeningMode.'" given)', + null, + null, + $oBrickSubNode + ); } $this->SetOpeningMode($sOpeningMode); @@ -882,26 +879,31 @@ class ManageBrick extends PortalBrick case 'display_modes': /** @var \Combodo\iTop\DesignElement $oDisplayNode */ - foreach ($oBrickSubNode->GetNodes('./*') as $oDisplayNode) - { - switch ($oDisplayNode->nodeName) - { - case 'availables'; + foreach ($oBrickSubNode->GetNodes('./*') as $oDisplayNode) { + switch ($oDisplayNode->nodeName) { + case 'availables': /** @var \Combodo\iTop\DesignElement $oModeNode */ - foreach ($oDisplayNode->GetNodes('*') as $oModeNode) - { - if (!$oModeNode->hasAttribute('id')) - { - throw new DOMFormatException('ManageBrick: Display mode must have a unique ID attribute', - 0, null, $oModeNode); + foreach ($oDisplayNode->GetNodes('*') as $oModeNode) { + if (!$oModeNode->hasAttribute('id')) { + throw new DOMFormatException( + 'ManageBrick: Display mode must have a unique ID attribute', + 0, + null, + $oModeNode + ); } $sModeId = $oModeNode->getAttribute('id'); - if (!in_array($sModeId, static::$aDisplayModes)) - { - throw new DOMFormatException('ManageBrick: Display mode has an invalid value. Expected '.implode('/', - static::$aDisplayModes.', "'.$sModeId.'" given.'), - null, null, $oModeNode); + if (!in_array($sModeId, static::$aDisplayModes)) { + throw new DOMFormatException( + 'ManageBrick: Display mode has an invalid value. Expected '.implode( + '/', + static::$aDisplayModes.', "'.$sModeId.'" given.' + ), + null, + null, + $oModeNode + ); } $this->AddAvailableDisplayMode($sModeId); @@ -912,9 +914,9 @@ class ManageBrick extends PortalBrick $this->SetDefaultDisplayMode($oDisplayNode->GetText(static::DEFAULT_DISPLAY_MODE)); break; - case 'tile'; + case 'tile': $this->SetTileMode($oDisplayNode->GetText(static::DEFAULT_TILE_MODE)); - if($this->sDecorationClassHome === static::DEFAULT_DECORATION_CLASS_HOME){ + if ($this->sDecorationClassHome === static::DEFAULT_DECORATION_CLASS_HOME) { $this->sDecorationClassHome = static::$aDefaultTileData[$this->GetTileMode()]['decorationCssClass']; $this->SetDecorationClassNavigationMenu(static::$aDefaultTileData[$this->GetTileMode()]['decorationCssClass']); $this->SetDecorationClassHome(static::$aDefaultTileData[$this->GetTileMode()]['decorationCssClass']); @@ -926,12 +928,14 @@ class ManageBrick extends PortalBrick case 'fields': /** @var \Combodo\iTop\DesignElement $oFieldNode */ - foreach ($oBrickSubNode->GetNodes('./field') as $oFieldNode) - { - if (!$oFieldNode->hasAttribute('id')) - { - throw new DOMFormatException('ManageBrick : Field must have a unique ID attribute', 0, - null, $oFieldNode); + foreach ($oBrickSubNode->GetNodes('./field') as $oFieldNode) { + if (!$oFieldNode->hasAttribute('id')) { + throw new DOMFormatException( + 'ManageBrick : Field must have a unique ID attribute', + 0, + null, + $oFieldNode + ); } $this->AddField($oFieldNode->getAttribute('id')); } @@ -939,19 +943,18 @@ class ManageBrick extends PortalBrick case 'export': /** @var \Combodo\iTop\DesignElement $oExportNode */ - foreach ($oBrickSubNode->GetNodes('./*') as $oExportNode) - { - switch ($oExportNode->nodeName) - { + foreach ($oBrickSubNode->GetNodes('./*') as $oExportNode) { + switch ($oExportNode->nodeName) { case 'fields': /** @var \Combodo\iTop\DesignElement $oFieldNode */ - foreach ($oExportNode->GetNodes('./field') as $oFieldNode) - { - if (!$oFieldNode->hasAttribute('id')) - { - throw new DOMFormatException('ManageBrick : Field must have a unique ID attribute', + foreach ($oExportNode->GetNodes('./field') as $oFieldNode) { + if (!$oFieldNode->hasAttribute('id')) { + throw new DOMFormatException( + 'ManageBrick : Field must have a unique ID attribute', 0, - null, $oFieldNode); + null, + $oFieldNode + ); } $this->AddExportField($oFieldNode->getAttribute('id')); } @@ -966,12 +969,12 @@ class ManageBrick extends PortalBrick break; case 'default_list_length': $iNodeDefaultListLength = (int)$oBrickSubNode->GetText(static::DEFAULT_LIST_LENGTH); - if(!in_array($iNodeDefaultListLength, array(10, 20, 50, -1),true)) - { + if (!in_array($iNodeDefaultListLength, [10, 20, 50, -1], true)) { throw new DOMFormatException( 'ManageBrick : Default list length must be contained in list length options. Expected -1/10/20/50, '.$iNodeDefaultListLength.' given.', null, - null, $oBrickSubNode + null, + $oBrickSubNode ); } $this->SetDefaultListLength($iNodeDefaultListLength); @@ -979,25 +982,21 @@ class ManageBrick extends PortalBrick case 'grouping': // Tabs grouping /** @var \Combodo\iTop\DesignElement $oGroupingNode */ - foreach ($oBrickSubNode->GetNodes('./tabs/*') as $oGroupingNode) - { - switch ($oGroupingNode->nodeName) - { - case 'show_tab_counts'; + foreach ($oBrickSubNode->GetNodes('./tabs/*') as $oGroupingNode) { + switch ($oGroupingNode->nodeName) { + case 'show_tab_counts': $bShowTabCounts = ($oGroupingNode->GetText(static::DEFAULT_SHOW_TAB_COUNTS) === 'true') ? true : false; $this->SetShowTabCounts($bShowTabCounts); break; case 'attribute': $sAttribute = $oGroupingNode->GetText(); - if ($sAttribute !== '') - { - $this->AddGrouping('tabs', array('attribute' => $sAttribute)); + if ($sAttribute !== '') { + $this->AddGrouping('tabs', ['attribute' => $sAttribute]); } break; case 'limit': $iLimit = $oGroupingNode->GetText(); - if (is_numeric($iLimit)) - { + if (is_numeric($iLimit)) { $this->iGroupLimit = $iLimit; } break; @@ -1005,24 +1004,24 @@ class ManageBrick extends PortalBrick $this->bGroupShowOthers = ($oGroupingNode->GetText() === 'true') ? true : false; break; case 'groups': - $aGroups = array(); + $aGroups = []; /** @var \Combodo\iTop\DesignElement $oGroupNode */ - foreach ($oGroupingNode->GetNodes('./group') as $oGroupNode) - { - if (!$oGroupNode->hasAttribute('id')) - { - throw new DOMFormatException('ManageBrick : Group must have a unique ID attribute', - 0, null, $oGroupNode); + foreach ($oGroupingNode->GetNodes('./group') as $oGroupNode) { + if (!$oGroupNode->hasAttribute('id')) { + throw new DOMFormatException( + 'ManageBrick : Group must have a unique ID attribute', + 0, + null, + $oGroupNode + ); } $sGroupId = $oGroupNode->getAttribute('id'); - $aGroup = array(); + $aGroup = []; $aGroup['id'] = $sGroupId; // We don't put the group id as the $aGroups key because the array will be sorted later in AddGrouping, which replace array keys by integer ordered keys /** @var \Combodo\iTop\DesignElement $oGroupProperty */ - foreach ($oGroupNode->GetNodes('*') as $oGroupProperty) - { - switch ($oGroupProperty->nodeName) - { + foreach ($oGroupNode->GetNodes('*') as $oGroupProperty) { + switch ($oGroupProperty->nodeName) { case 'rank': $aGroup[$oGroupProperty->nodeName] = (int)$oGroupProperty->GetText(0); break; @@ -1035,19 +1034,25 @@ class ManageBrick extends PortalBrick } // Checking constitancy - if (!isset($aGroup['title']) || $aGroup['title'] === '') - { - throw new DOMFormatException('ManageBrick : Group must have a title tag and it must not be empty', - 0, null, $oGroupNode); + if (!isset($aGroup['title']) || $aGroup['title'] === '') { + throw new DOMFormatException( + 'ManageBrick : Group must have a title tag and it must not be empty', + 0, + null, + $oGroupNode + ); } - if (!isset($aGroup['condition']) || $aGroup['condition'] === '') - { - throw new DOMFormatException('ManageBrick : Group must have a condition tag and it must not be empty', - 0, null, $oGroupNode); + if (!isset($aGroup['condition']) || $aGroup['condition'] === '') { + throw new DOMFormatException( + 'ManageBrick : Group must have a condition tag and it must not be empty', + 0, + null, + $oGroupNode + ); } $aGroups[] = $aGroup; } - $this->AddGrouping('tabs', array('groups' => $aGroups)); + $this->AddGrouping('tabs', ['groups' => $aGroups]); break; } } @@ -1069,62 +1074,58 @@ class ManageBrick extends PortalBrick } // Checking if has an oql - if ($this->GetOql() === '') - { + if ($this->GetOql() === '') { throw new DOMFormatException('ManageBrick: must have a valid tag', null, null, $oMDElement); } // Checking that the brick has at least a display mode - if (count($this->GetAvailablesDisplayModes()) === 0) - { + if (count($this->GetAvailablesDisplayModes()) === 0) { $this->AddAvailableDisplayMode(static::DEFAULT_DISPLAY_MODE); } // Checking that default display mode in among the availables - if (!in_array($this->sDefaultDisplayMode, $this->aAvailableDisplayModes)) - { - throw new DOMFormatException('ManageBrick: Default display mode "'.$this->sDefaultDisplayMode.'" must be one of the available display modes ('.implode(', ', - $this->aAvailableDisplayModes).')', null, null, $oMDElement); + if (!in_array($this->sDefaultDisplayMode, $this->aAvailableDisplayModes)) { + throw new DOMFormatException('ManageBrick: Default display mode "'.$this->sDefaultDisplayMode.'" must be one of the available display modes ('.implode( + ', ', + $this->aAvailableDisplayModes + ).')', null, null, $oMDElement); } // Checking that tile mode in among the availables - if (!in_array($this->sTileMode, static::$aTileModes)) - { - throw new DOMFormatException('ManageBrick: Tile mode "'.$this->sTileMode.'" must be one of the allowed tile modes ('.implode(', ', - static::$aTileModes).')', null, null, $oMDElement); + if (!in_array($this->sTileMode, static::$aTileModes)) { + throw new DOMFormatException('ManageBrick: Tile mode "'.$this->sTileMode.'" must be one of the allowed tile modes ('.implode( + ', ', + static::$aTileModes + ).')', null, null, $oMDElement); } // Checking if specified fields, if not we put those from the details zlist - if (empty($this->aFields)) - { + if (empty($this->aFields)) { $sClass = DBSearch::FromOQL($this->GetOql()); - $aFields = MetaModel::FlattenZList(MetaModel::GetZListItems($sClass->GetClass(), - static::DEFAULT_ZLIST_FIELDS)); + $aFields = MetaModel::FlattenZList(MetaModel::GetZListItems( + $sClass->GetClass(), + static::DEFAULT_ZLIST_FIELDS + )); $this->SetFields($aFields); } // Default Export Fields - if ($bUseListFieldsForExport) - { - foreach ($this->GetFields() as $sAttCode) - { + if ($bUseListFieldsForExport) { + foreach ($this->GetFields() as $sAttCode) { $this->AddExportField($sAttCode); } } // Checking the navigation icon $sDecorationClassNavigationMenu = $this->GetDecorationClassNavigationMenu(); - if (empty($sDecorationClassNavigationMenu) && isset(static::$aDefaultTileData[$this->sTileMode])) - { + if (empty($sDecorationClassNavigationMenu) && isset(static::$aDefaultTileData[$this->sTileMode])) { /** @var string $sDecorationClassNavigationMenu */ $sDecorationClassNavigationMenu = static::$aDefaultTileData[$this->sTileMode]['decorationCssClass']; - if (!empty($sDecorationClassNavigationMenu)) - { + if (!empty($sDecorationClassNavigationMenu)) { $this->SetDecorationClassNavigationMenu($sDecorationClassNavigationMenu); } } $sTitle = $this->GetTitleHome(); - if (empty($sTitle)) - { + if (empty($sTitle)) { $sOql = $this->GetOql(); $oSearch = DBSearch::FromOQL($sOql); $sClassName = MetaModel::GetName($oSearch->GetClass()); diff --git a/datamodels/2.x/itop-portal-base/portal/src/Brick/PortalBrick.php b/datamodels/2.x/itop-portal-base/portal/src/Brick/PortalBrick.php index ef5a0d12c..6358a0d93 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Brick/PortalBrick.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Brick/PortalBrick.php @@ -38,37 +38,37 @@ use ModuleDesign; abstract class PortalBrick extends AbstractBrick { /** @var string ENUM_OPENING_TARGET_MODAL */ - const ENUM_OPENING_TARGET_MODAL = 'modal'; + public const ENUM_OPENING_TARGET_MODAL = 'modal'; /** @var string ENUM_OPENING_TARGET_SELF */ - const ENUM_OPENING_TARGET_SELF = 'self'; + public const ENUM_OPENING_TARGET_SELF = 'self'; /** @var string ENUM_OPENING_TARGET_NEW */ - const ENUM_OPENING_TARGET_NEW = 'new'; + public const ENUM_OPENING_TARGET_NEW = 'new'; /** @var int DEFAULT_WIDTH */ - const DEFAULT_WIDTH = 6; + public const DEFAULT_WIDTH = 6; /** @var int DEFAULT_HEIGHT */ - const DEFAULT_HEIGHT = 1; + public const DEFAULT_HEIGHT = 1; /** @var bool DEFAULT_MODAL */ - const DEFAULT_MODAL = false; + public const DEFAULT_MODAL = false; /** @var bool DEFAULT_VISIBLE_HOME */ - const DEFAULT_VISIBLE_HOME = true; + public const DEFAULT_VISIBLE_HOME = true; /** @var bool DEFAULT_VISIBLE_NAVIGATION_MENU */ - const DEFAULT_VISIBLE_NAVIGATION_MENU = true; + public const DEFAULT_VISIBLE_NAVIGATION_MENU = true; /** @var string DEFAULT_DECORATION_CLASS_HOME */ - const DEFAULT_DECORATION_CLASS_HOME = ''; + public const DEFAULT_DECORATION_CLASS_HOME = ''; /** @var string DEFAULT_DECORATION_CLASS_NAVIGATION_MENU */ - const DEFAULT_DECORATION_CLASS_NAVIGATION_MENU = ''; + public const DEFAULT_DECORATION_CLASS_NAVIGATION_MENU = ''; /** @var string DEFAULT_TILE_TEMPLATE_PATH */ - const DEFAULT_TILE_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/tile.html.twig'; + public const DEFAULT_TILE_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/tile.html.twig'; /** @var string|null DEFAULT_TILE_CONTROLLER_ACTION */ - const DEFAULT_TILE_CONTROLLER_ACTION = null; + public const DEFAULT_TILE_CONTROLLER_ACTION = null; /** @var string DEFAULT_OPENING_TARGET */ - const DEFAULT_OPENING_TARGET = self::ENUM_OPENING_TARGET_MODAL; + public const DEFAULT_OPENING_TARGET = self::ENUM_OPENING_TARGET_MODAL; /** @var string|null $sRouteName */ - static $sRouteName = null; + public static $sRouteName = null; /** @var array $aOpeningTargets */ - static $aOpeningTargets = array(self::ENUM_OPENING_TARGET_MODAL, self::ENUM_OPENING_TARGET_SELF, self::ENUM_OPENING_TARGET_NEW); + public static $aOpeningTargets = [self::ENUM_OPENING_TARGET_MODAL, self::ENUM_OPENING_TARGET_SELF, self::ENUM_OPENING_TARGET_NEW]; /** @var int $iWidth */ protected $iWidth; @@ -103,14 +103,13 @@ abstract class PortalBrick extends AbstractBrick /** @var string $sTitleNavigationMenu */ protected $sTitleNavigationMenu; - - /** @inheritdoc */ public static function RegisterTemplates(TemplatesRegister $oTemplatesRegister): void { parent::RegisterTemplates($oTemplatesRegister); - $oTemplatesRegister->RegisterTemplates(self::class, - TemplateDefinitionDto::Create('tile', static::TEMPLATES_BASE_PATH . 'tile.html.twig'), + $oTemplatesRegister->RegisterTemplates( + self::class, + TemplateDefinitionDto::Create('tile', static::TEMPLATES_BASE_PATH.'tile.html.twig'), ); } @@ -500,10 +499,8 @@ abstract class PortalBrick extends AbstractBrick // Checking specific elements /** @var \Combodo\iTop\DesignElement $oBrickSubNode */ - foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) - { - switch ($oBrickSubNode->nodeName) - { + foreach ($oMDElement->GetNodes('./*') as $oBrickSubNode) { + switch ($oBrickSubNode->nodeName) { case 'width': $sWidth = $oBrickSubNode->GetText(static::DEFAULT_WIDTH); $this->bIsWidthPixel = str_contains($sWidth, 'px'); @@ -522,23 +519,20 @@ abstract class PortalBrick extends AbstractBrick case 'visible': // Default value $oOptionalNode = $oBrickSubNode->GetOptionalElement('default'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $optionalNodeValue = ($oOptionalNode->GetText() === 'false') ? false : true; $this->SetVisibleHome($optionalNodeValue); $this->SetVisibleNavigationMenu($optionalNodeValue); } // Home value $oOptionalNode = $oBrickSubNode->GetOptionalElement('home'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $optionalNodeValue = ($oOptionalNode->GetText() === 'false') ? false : true; $this->SetVisibleHome($optionalNodeValue); } // Navigation menu value $oOptionalNode = $oBrickSubNode->GetOptionalElement('navigation_menu'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $optionalNodeValue = ($oOptionalNode->GetText() === 'false') ? false : true; $this->SetVisibleNavigationMenu($optionalNodeValue); } @@ -546,8 +540,7 @@ abstract class PortalBrick extends AbstractBrick case 'templates': $oTemplateNodeList = $oBrickSubNode->GetNodes('template[@id='.ModuleDesign::XPathQuote('tile').']'); - if ($oTemplateNodeList->length > 0) - { + if ($oTemplateNodeList->length > 0) { /** @var \Combodo\iTop\DesignElement $oTemplateNode */ $oTemplateNode = $oTemplateNodeList->item(0); $this->SetTemplatePath('tile', $oTemplateNode->GetText(static::DEFAULT_TILE_TEMPLATE_PATH)); @@ -560,23 +553,20 @@ abstract class PortalBrick extends AbstractBrick $this->SetRankNavigationMenu($this->fRank); // Default value $oOptionalNode = $oBrickSubNode->GetOptionalElement('default'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $optionalNodeValue = $oOptionalNode->GetText(static::DEFAULT_RANK); $this->SetRankHome($optionalNodeValue); $this->SetRankNavigationMenu($optionalNodeValue); } // Home value $oOptionalNode = $oBrickSubNode->GetOptionalElement('home'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $optionalNodeValue = $oOptionalNode->GetText(static::DEFAULT_RANK); $this->SetRankHome($optionalNodeValue); } // Navigation menu value $oOptionalNode = $oBrickSubNode->GetOptionalElement('navigation_menu'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $optionalNodeValue = $oOptionalNode->GetText(static::DEFAULT_RANK); $this->SetRankNavigationMenu($optionalNodeValue); } @@ -588,23 +578,20 @@ abstract class PortalBrick extends AbstractBrick $this->SetTitleNavigationMenu($this->sTitle); // Default value $oOptionalNode = $oBrickSubNode->GetOptionalElement('default'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $optionalNodeValue = $oOptionalNode->GetText(static::DEFAULT_TITLE); $this->SetTitleHome($optionalNodeValue); $this->SetTitleNavigationMenu($optionalNodeValue); } // Home value $oOptionalNode = $oBrickSubNode->GetOptionalElement('home'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $optionalNodeValue = $oOptionalNode->GetText(static::DEFAULT_TITLE); $this->SetTitleHome($optionalNodeValue); } // Navigation menu value $oOptionalNode = $oBrickSubNode->GetOptionalElement('navigation_menu'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $optionalNodeValue = $oOptionalNode->GetText(static::DEFAULT_TITLE); $this->SetTitleNavigationMenu($optionalNodeValue); $this->SetTitle($optionalNodeValue); @@ -617,23 +604,20 @@ abstract class PortalBrick extends AbstractBrick $this->SetDecorationClassNavigationMenu(static::DEFAULT_DECORATION_CLASS_NAVIGATION_MENU); // Default value $oOptionalNode = $oBrickSubNode->GetOptionalElement('default'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $optionalNodeValue = $oOptionalNode->GetText(static::DEFAULT_DECORATION_CLASS_NAVIGATION_MENU); $this->SetDecorationClassHome($optionalNodeValue); $this->SetDecorationClassNavigationMenu($optionalNodeValue); } // Home value $oOptionalNode = $oBrickSubNode->GetOptionalElement('home'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $optionalNodeValue = $oOptionalNode->GetText(static::DEFAULT_DECORATION_CLASS_HOME); $this->SetDecorationClassHome($optionalNodeValue); } // Navigation menu value $oOptionalNode = $oBrickSubNode->GetOptionalElement('navigation_menu'); - if ($oOptionalNode !== null) - { + if ($oOptionalNode !== null) { $optionalNodeValue = $oOptionalNode->GetText(static::DEFAULT_DECORATION_CLASS_NAVIGATION_MENU); $this->SetDecorationClassNavigationMenu($optionalNodeValue); } @@ -645,11 +629,16 @@ abstract class PortalBrick extends AbstractBrick case 'opening_target': $sOpeningTarget = $oBrickSubNode->GetText(static::DEFAULT_OPENING_TARGET); - if (!in_array($sOpeningTarget, - array(static::ENUM_OPENING_TARGET_MODAL, static::ENUM_OPENING_TARGET_NEW, static::ENUM_OPENING_TARGET_SELF))) - { - throw new DOMFormatException('PortalBrick : opening_target tag value must be modal|new|self ("'.$sOpeningTarget.'" given)', - null, null, $oBrickSubNode); + if (!in_array( + $sOpeningTarget, + [static::ENUM_OPENING_TARGET_MODAL, static::ENUM_OPENING_TARGET_NEW, static::ENUM_OPENING_TARGET_SELF] + )) { + throw new DOMFormatException( + 'PortalBrick : opening_target tag value must be modal|new|self ("'.$sOpeningTarget.'" given)', + null, + null, + $oBrickSubNode + ); } $this->SetOpeningTarget($sOpeningTarget); diff --git a/datamodels/2.x/itop-portal-base/portal/src/Brick/PropertyNotFoundException.php b/datamodels/2.x/itop-portal-base/portal/src/Brick/PropertyNotFoundException.php index d5d13de52..0bb858ff9 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Brick/PropertyNotFoundException.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Brick/PropertyNotFoundException.php @@ -31,5 +31,4 @@ use Exception; */ class PropertyNotFoundException extends Exception { - -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Brick/UserProfileBrick.php b/datamodels/2.x/itop-portal-base/portal/src/Brick/UserProfileBrick.php index 45fbbfb00..d7b06917a 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Brick/UserProfileBrick.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Brick/UserProfileBrick.php @@ -1,4 +1,5 @@ RegisterTemplates(self::class, - TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH . 'user-profile/layout.html.twig'), + $oTemplatesRegister->RegisterTemplates( + self::class, + TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH.'user-profile/layout.html.twig'), TemplateDefinitionDto::Create('user_info', static::TEMPLATES_BASE_PATH.'user-profile/user_info.html.twig'), TemplateDefinitionDto::Create('user_info_ready_js', static::TEMPLATES_BASE_PATH.'user-profile/user_info.ready.js.twig'), ); @@ -75,12 +77,12 @@ class UserProfileBrick extends PortalBrick { parent::__construct(); - $this->aForm = array( + $this->aForm = [ 'id' => 'default-user-profile', 'type' => 'zlist', 'fields' => 'details', 'layout' => null, - ); + ]; $this->bShowPictureForm = static::DEFAULT_SHOW_PICTURE_FORM; $this->bShowPreferencesForm = static::DEFAULT_SHOW_PREFERENCES_FORM; $this->bShowPasswordForm = static::DEFAULT_SHOW_PASSWORD_FORM; @@ -191,13 +193,13 @@ class UserProfileBrick extends PortalBrick // Enumerating fields if ($oBrickSubNode->GetOptionalElement('fields') !== null) { $this->aForm['type'] = 'custom_list'; - $this->aForm['fields'] = array(); + $this->aForm['fields'] = []; /** @var \Combodo\iTop\DesignElement $oFieldNode */ foreach ($oBrickSubNode->GetOptionalElement('fields')->GetNodes('field') as $oFieldNode) { $sFieldId = $oFieldNode->getAttribute('id'); if ($sFieldId !== '') { - $aField = array(); + $aField = []; // Parsing field options like read_only, hidden and mandatory if ($oFieldNode->GetOptionalElement('read_only')) { $aField['readonly'] = ($oFieldNode->GetOptionalElement('read_only')->GetText('true') === 'true') ? true : false; @@ -223,10 +225,10 @@ class UserProfileBrick extends PortalBrick $sXml = preg_replace('/^.+\n/', '', $sXml); $sXml = preg_replace('/\n.+$/', '', $sXml); - $this->aForm['layout'] = array( + $this->aForm['layout'] = [ 'type' => (preg_match('/\{\{|\{\#|\{\%/', $sXml) === 1) ? 'twig' : 'xhtml', 'content' => $sXml, - ); + ]; } break; diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/AbstractController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/AbstractController.php index 6115b3c55..423fb685a 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/AbstractController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/AbstractController.php @@ -37,14 +37,15 @@ use Symfony\Contracts\Service\Attribute\Required; */ abstract class AbstractController extends SymfonyAbstractController implements TemplatesProviderInterface { - const TEMPLATES_BASE_PATH = 'itop-portal-base/portal/templates/'; + public const TEMPLATES_BASE_PATH = 'itop-portal-base/portal/templates/'; /** @inheritdoc */ public static function RegisterTemplates(TemplatesRegister $oTemplatesRegister): void { - $oTemplatesRegister->RegisterTemplates(self::class, - TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH . 'layout.html.twig'), - TemplateDefinitionDto::Create('modal', static::TEMPLATES_BASE_PATH . 'modal/layout.html.twig'), + $oTemplatesRegister->RegisterTemplates( + self::class, + TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH.'layout.html.twig'), + TemplateDefinitionDto::Create('modal', static::TEMPLATES_BASE_PATH.'modal/layout.html.twig'), TemplateDefinitionDto::Create('loader', static::TEMPLATES_BASE_PATH.'helpers/loader.html.twig'), TemplateDefinitionDto::Create('tagset_clic_handler_js', static::TEMPLATES_BASE_PATH.'helpers/tagset_clic_handler.js.twig'), TemplateDefinitionDto::Create('session_message', static::TEMPLATES_BASE_PATH.'helpers/session_messages/session_message.html.twig'), diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/AggregatePageBrickController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/AggregatePageBrickController.php index 5cad88064..777938d69 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/AggregatePageBrickController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/AggregatePageBrickController.php @@ -29,7 +29,6 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; use UserRights; - /** * Class AggregatePageBrickController * @@ -41,7 +40,6 @@ use UserRights; */ class AggregatePageBrickController extends BrickController { - /** * Constructor. * @@ -51,8 +49,7 @@ class AggregatePageBrickController extends BrickController */ public function __construct( protected BrickCollection $oBrickCollection - ) - { + ) { } @@ -76,11 +73,11 @@ class AggregatePageBrickController extends BrickController $aTilesRendering = $this->GetBricksTileRendering($oRequest, $aAggregatePageBricks); $sLayoutTemplate = $oBrick->GetTemplatePath('page'); - $aData = array( + $aData = [ 'oBrick' => $oBrick, 'aggregatepage_bricks' => $aAggregatePageBricks, 'aTilesRendering' => $aTilesRendering, - ); + ]; $oResponse = $this->render($sLayoutTemplate, $aData); return $oResponse; @@ -94,15 +91,11 @@ class AggregatePageBrickController extends BrickController */ private function GetOrderedAggregatePageBricksObjectsById($aAggregatePageBricksConf) { - $aAggregatePageBricks = array(); - foreach ($aAggregatePageBricksConf as $sBrickId => $iBrickRank) - { - try - { + $aAggregatePageBricks = []; + foreach ($aAggregatePageBricksConf as $sBrickId => $iBrickRank) { + try { $oPortalBrick = $this->oBrickCollection->GetBrickById($sBrickId); - } - catch (BrickNotFoundException $oException) - { + } catch (BrickNotFoundException $oException) { IssueLog::Debug('AggregatePageBrick: Could not display brick, either wrong id or user profile not allowed', LogChannels::PORTAL, [ 'brick_id' => $sBrickId, 'user_profiles' => UserRights::ListProfiles(), @@ -124,21 +117,17 @@ class AggregatePageBrickController extends BrickController */ private function GetBricksTileRendering(Request $oRequest, $aBricks) { - $aTilesRendering = array(); - foreach ($aBricks as $oBrick) - { - if ($oBrick->GetTileControllerAction() !== null) - { + $aTilesRendering = []; + foreach ($aBricks as $oBrick) { + if ($oBrick->GetTileControllerAction() !== null) { $aControllerActionParts = explode('::', $oBrick->GetTileControllerAction()); - if (count($aControllerActionParts) !== 2) - { + if (count($aControllerActionParts) !== 2) { throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, 'Tile controller action must be of form "\Namespace\ControllerClass::FunctionName" for brick "'.$oBrick->GetId().'"'); } - $aRouteParams = array(); + $aRouteParams = []; // Add sBrickId in the route params as it is necessary for each brick actions - if (is_a($aControllerActionParts[0], BrickController::class, true)) - { + if (is_a($aControllerActionParts[0], BrickController::class, true)) { $aRouteParams['sBrickId'] = $oBrick->GetId(); } @@ -150,4 +139,4 @@ class AggregatePageBrickController extends BrickController return $aTilesRendering; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/BrickController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/BrickController.php index 254d1a596..81cbe8e5a 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/BrickController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/BrickController.php @@ -29,5 +29,4 @@ namespace Combodo\iTop\Portal\Controller; */ abstract class BrickController extends AbstractController { - } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/BrowseBrickController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/BrowseBrickController.php index 1c3eeb31f..281413583 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/BrowseBrickController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/BrowseBrickController.php @@ -51,7 +51,6 @@ use VariableExpression; */ class BrowseBrickController extends BrickController { - /** * Constructor. * @@ -67,12 +66,10 @@ class BrowseBrickController extends BrickController protected RequestManipulatorHelper $oRequestManipulatorHelper, protected BrickControllerHelper $oBrickControllerHelper, protected BrickCollection $oBrickCollection - ) - { + ) { } - /** * @param \Symfony\Component\HttpFoundation\Request $oRequest * @param string $sBrickId @@ -103,85 +100,92 @@ class BrowseBrickController extends BrickController // Getting current browse mode (First from router parameter, then default brick value) $sBrowseMode = (!empty($sBrowseMode)) ? $sBrowseMode : $oBrick->GetDefaultBrowseMode(); // Getting current dataloading mode (First from router parameter, then query parameter, then default brick value) - $sDataLoading = ($sDataLoading !== null) ? $sDataLoading : $this->oRequestManipulatorHelper->ReadParam('sDataLoading', - $oBrick->GetDataLoading()); + $sDataLoading = ($sDataLoading !== null) ? $sDataLoading : $this->oRequestManipulatorHelper->ReadParam( + 'sDataLoading', + $oBrick->GetDataLoading() + ); // Getting search value $sRawSearchValue = $this->oRequestManipulatorHelper->ReadParam('sSearchValue', ''); $sSearchValue = html_entity_decode($sRawSearchValue); - if (strlen($sSearchValue) > 0) - { + if (strlen($sSearchValue) > 0) { $sDataLoading = AbstractBrick::ENUM_DATA_LOADING_LAZY; } - $aData = array(); - $aLevelsProperties = array(); - $aLevelsClasses = array(); + $aData = []; + $aLevelsProperties = []; + $aLevelsClasses = []; $this->oBrowseBrickHelper->TreeToFlatLevelsProperties($oBrick->GetLevels(), $aLevelsProperties); // Consistency checks - if (!in_array($sBrowseMode, array_keys($aBrowseModes))) - { - throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, - 'Browse brick "'.$sBrickId.'" : Unknown browse mode "'.$sBrowseMode.'", availables are '.implode(' / ', - array_keys($aBrowseModes))); + if (!in_array($sBrowseMode, array_keys($aBrowseModes))) { + throw new HttpException( + Response::HTTP_INTERNAL_SERVER_ERROR, + 'Browse brick "'.$sBrickId.'" : Unknown browse mode "'.$sBrowseMode.'", availables are '.implode( + ' / ', + array_keys($aBrowseModes) + ) + ); } - if (empty($aLevelsProperties)) - { + if (empty($aLevelsProperties)) { throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, 'Browse brick "'.$sBrickId.'" : No levels to display.'); } // Building DBObjectSearch $oQuery = null; // ... In this case only we have to build a specific query for the current level only - if (in_array($sBrowseMode, array( + if (in_array($sBrowseMode, [ BrowseBrick::ENUM_BROWSE_MODE_TREE, BrowseBrick::ENUM_BROWSE_MODE_MOSAIC, - )) && ($sDataLoading === AbstractBrick::ENUM_DATA_LOADING_LAZY)) - { + ]) && ($sDataLoading === AbstractBrick::ENUM_DATA_LOADING_LAZY)) { // Will be handled later in the pagination part } // .. Otherwise - else - { + else { // We iterate (in reverse mode /!\) over the levels to build the whole query, starting from the bottom $aLevelsPropertiesKeys = array_keys($aLevelsProperties); $iLoopMax = count($aLevelsPropertiesKeys) - 1; $oFullBinExpr = null; - for ($i = $iLoopMax; $i >= 0; $i--) - { + for ($i = $iLoopMax; $i >= 0; $i--) { // Retrieving class alias for all depth array_unshift($aLevelsClasses, $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search']->GetClassAlias()); // Joining queries from bottom-up - if ($i < $iLoopMax) - { - $aRealiasingMap = array(); + if ($i < $iLoopMax) { + $aRealiasingMap = []; $oParentAtt = MetaModel::GetAttributeDef($aLevelsProperties[$aLevelsPropertiesKeys[$i + 1]]['search']->GetClass(), $aLevelsProperties[$aLevelsPropertiesKeys[$i + 1]]['parent_att']); // If we work on a n:n link - if($oParentAtt instanceof AttributeLinkedSetIndirect) - { + if ($oParentAtt instanceof AttributeLinkedSetIndirect) { // Create a DBSearch from Link class $oSubSearch = new DBObjectSearch($oParentAtt->GetLinkedClass()); // Join it to the bottom query - $oSubSearch = $oSubSearch->Join($aLevelsProperties[$aLevelsPropertiesKeys[$i + 1]]['search'], - DBSearch::JOIN_POINTING_TO, $oParentAtt->GetExtKeyToMe(), TREE_OPERATOR_EQUALS, $aRealiasingMap); + $oSubSearch = $oSubSearch->Join( + $aLevelsProperties[$aLevelsPropertiesKeys[$i + 1]]['search'], + DBSearch::JOIN_POINTING_TO, + $oParentAtt->GetExtKeyToMe(), + TREE_OPERATOR_EQUALS, + $aRealiasingMap + ); // Join our Link class + bottom query to the up query - $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search'] = $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search'] ->Join($oSubSearch, DBSearch::JOIN_REFERENCED_BY, - $oParentAtt->GetExtKeyToRemote(), TREE_OPERATOR_EQUALS, $aRealiasingMap); + $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search'] = $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search'] ->Join( + $oSubSearch, + DBSearch::JOIN_REFERENCED_BY, + $oParentAtt->GetExtKeyToRemote(), + TREE_OPERATOR_EQUALS, + $aRealiasingMap + ); + } else { + $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search'] = $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search']->Join( + $aLevelsProperties[$aLevelsPropertiesKeys[$i + 1]]['search'], + DBSearch::JOIN_REFERENCED_BY, + $aLevelsProperties[$aLevelsPropertiesKeys[$i + 1]]['parent_att'], + TREE_OPERATOR_EQUALS, + $aRealiasingMap + ); } - else - { - $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search'] = $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search']->Join($aLevelsProperties[$aLevelsPropertiesKeys[$i + 1]]['search'], - DBSearch::JOIN_REFERENCED_BY, $aLevelsProperties[$aLevelsPropertiesKeys[$i + 1]]['parent_att'], - TREE_OPERATOR_EQUALS, $aRealiasingMap); - } - foreach ($aLevelsPropertiesKeys as $sLevelAlias) - { - if (array_key_exists($sLevelAlias, $aRealiasingMap)) - { + foreach ($aLevelsPropertiesKeys as $sLevelAlias) { + if (array_key_exists($sLevelAlias, $aRealiasingMap)) { /** @since 2.7.2 */ - foreach ($aRealiasingMap[$sLevelAlias] as $sAliasToChange) - { + foreach ($aRealiasingMap[$sLevelAlias] as $sAliasToChange) { $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search']->RenameAlias($sAliasToChange, $sLevelAlias); } } @@ -190,8 +194,7 @@ class BrowseBrickController extends BrickController // Adding search clause // Note : For know the search is naive and looks only for the exact match. It doesn't search for words separately - if (strlen($sSearchValue) > 0) - { + if (strlen($sSearchValue) > 0) { // - Cleaning the search value by exploding and trimming spaces $aExplodedSearchValues = explode(' ', $sSearchValue); $aSearchValues = []; @@ -202,25 +205,21 @@ class BrowseBrickController extends BrickController } // - Retrieving fields to search - $aSearchFields = array($aLevelsProperties[$aLevelsPropertiesKeys[$i]]['name_att']); - if (!empty($aLevelsProperties[$aLevelsPropertiesKeys[$i]]['fields'])) - { + $aSearchFields = [$aLevelsProperties[$aLevelsPropertiesKeys[$i]]['name_att']]; + if (!empty($aLevelsProperties[$aLevelsPropertiesKeys[$i]]['fields'])) { $sTmpFieldClass = $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search']->GetClass(); - foreach ($aLevelsProperties[$aLevelsPropertiesKeys[$i]]['fields'] as $aTmpField) - { + foreach ($aLevelsProperties[$aLevelsPropertiesKeys[$i]]['fields'] as $aTmpField) { $sTmpFieldAttCode = $aTmpField['code']; // Skip invalid attcodes - if(!MetaModel::IsValidAttCode($sTmpFieldClass, $sTmpFieldAttCode)) - { + if (!MetaModel::IsValidAttCode($sTmpFieldClass, $sTmpFieldAttCode)) { continue; } // For external key, force search on the friendlyname instead of the ID. // This should be addressed more globally with the bigger issue, see N°1970 $oTmpFieldAttDef = MetaModel::GetAttributeDef($sTmpFieldClass, $sTmpFieldAttCode); - if($oTmpFieldAttDef instanceof AttributeExternalKey) - { + if ($oTmpFieldAttDef instanceof AttributeExternalKey) { $sTmpFieldAttCode .= '_friendlyname'; } @@ -231,60 +230,49 @@ class BrowseBrickController extends BrickController $oLevelBinExpr = null; $iFieldLoopMax = count($aSearchFields) - 1; $iSearchLoopMax = count($aSearchValues) - 1; - for ($j = 0; $j <= $iFieldLoopMax; $j++) - { + for ($j = 0; $j <= $iFieldLoopMax; $j++) { $sTmpFieldAttCode = $aSearchFields[$j]; $oFieldBinExpr = null; //$oFieldBinExpr = new BinaryExpression(new FieldExpression($aSearchFields[$j], $aLevelsPropertiesKeys[$i]), ) - for ($k = 0; $k <= $iSearchLoopMax; $k++) - { - $oSearchBinExpr = new BinaryExpression(new FieldExpression($sTmpFieldAttCode, $aLevelsPropertiesKeys[$i]), - 'LIKE', new VariableExpression('search_value_'.$k)); - if ($k === 0) - { + for ($k = 0; $k <= $iSearchLoopMax; $k++) { + $oSearchBinExpr = new BinaryExpression( + new FieldExpression($sTmpFieldAttCode, $aLevelsPropertiesKeys[$i]), + 'LIKE', + new VariableExpression('search_value_'.$k) + ); + if ($k === 0) { $oFieldBinExpr = $oSearchBinExpr; - } - else - { + } else { $oFieldBinExpr = new BinaryExpression($oFieldBinExpr, 'AND', $oSearchBinExpr); } } - if ($j === 0) - { + if ($j === 0) { $oLevelBinExpr = $oFieldBinExpr; - } - else - { + } else { $oLevelBinExpr = new BinaryExpression($oLevelBinExpr, 'OR', $oFieldBinExpr); } } // - Building query for the level - if ($i === $iLoopMax) - { + if ($i === $iLoopMax) { $oFullBinExpr = $oLevelBinExpr; - } - else - { + } else { $oFullBinExpr = new BinaryExpression($oFullBinExpr, 'OR', $oLevelBinExpr); } // - Adding it to the query when complete - if ($i === 0) - { + if ($i === 0) { $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search']->AddConditionExpression($oFullBinExpr); } } // Setting selected classes and binding parameters - if ($i === 0) - { + if ($i === 0) { $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search']->SetSelectedClasses($aLevelsClasses); - if (strlen($sSearchValue) > 0) - { + if (strlen($sSearchValue) > 0) { // Note : This could be way more simpler if we had a SetInternalParam($sParam, $value) verb $aQueryParams = $aLevelsProperties[$aLevelsPropertiesKeys[$i]]['search']->GetInternalParams(); // Note : $iSearchloopMax was initialized on the previous loop @@ -302,23 +290,26 @@ class BrowseBrickController extends BrickController // - Check how many records there is. // - Update $sDataLoading with its new value regarding the number of record and the threshold $oCountSet = new DBObjectSet($oQuery); - $fThreshold = (float)MetaModel::GetModuleSetting($sPortalId, - 'lazy_loading_threshold'); + $fThreshold = (float)MetaModel::GetModuleSetting( + $sPortalId, + 'lazy_loading_threshold' + ); $sDataLoading = ($oCountSet->Count() > $fThreshold) ? AbstractBrick::ENUM_DATA_LOADING_LAZY : AbstractBrick::ENUM_DATA_LOADING_FULL; unset($oCountSet); } } // Setting query pagination if needed - if ($sDataLoading === AbstractBrick::ENUM_DATA_LOADING_LAZY) - { - switch ($sBrowseMode) - { + if ($sDataLoading === AbstractBrick::ENUM_DATA_LOADING_LAZY) { + switch ($sBrowseMode) { case BrowseBrick::ENUM_BROWSE_MODE_LIST: // Retrieving parameters $iPageNumber = (int)$this->oRequestManipulatorHelper->ReadParam('iPageNumber', 1, FILTER_SANITIZE_NUMBER_INT); - $iListLength = (int)$this->oRequestManipulatorHelper->ReadParam('iListLength', BrowseBrick::DEFAULT_LIST_LENGTH, - FILTER_SANITIZE_NUMBER_INT); + $iListLength = (int)$this->oRequestManipulatorHelper->ReadParam( + 'iListLength', + BrowseBrick::DEFAULT_LIST_LENGTH, + FILTER_SANITIZE_NUMBER_INT + ); // Getting total records number $oCountSet = new DBObjectSet($oQuery); @@ -337,36 +328,26 @@ class BrowseBrickController extends BrickController $sNodeId = $this->oRequestManipulatorHelper->ReadParam('sNodeId', ''); // If no values for those parameters, we might be loading page in lazy mode for the first time, therefore the URL doesn't have those information. - if (empty($sLevelAlias)) - { + if (empty($sLevelAlias)) { reset($aLevelsProperties); $oQuery = $aLevelsProperties[key($aLevelsProperties)]['search']; - if (!empty($sNodeId)) - { + if (!empty($sNodeId)) { $oQuery->AddCondition('id', $sNodeId); } } // Else we need to find the OQL for that particular level - else - { + else { $bFoundLevel = false; - foreach ($aLevelsProperties as $aLevelProperties) - { - if ($aLevelProperties['alias'] === $sLevelAlias) - { - if (isset($aLevelProperties['levels']) && !empty($aLevelProperties['levels']) && isset($aLevelsProperties[$aLevelProperties['levels'][0]])) - { + foreach ($aLevelsProperties as $aLevelProperties) { + if ($aLevelProperties['alias'] === $sLevelAlias) { + if (isset($aLevelProperties['levels']) && !empty($aLevelProperties['levels']) && isset($aLevelsProperties[$aLevelProperties['levels'][0]])) { $oQuery = $aLevelsProperties[$aLevelProperties['levels'][0]]['search']; - if (!empty($sNodeId)) - { + if (!empty($sNodeId)) { $sParentAttCode = $aLevelsProperties[$aLevelProperties['levels'][0]]['parent_att']; $oParentAtt = MetaModel::GetAttributeDef($oQuery->GetClass(), $sParentAttCode); - if($oParentAtt instanceof AttributeLinkedSetIndirect) - { + if ($oParentAtt instanceof AttributeLinkedSetIndirect) { $oQuery->AddConditionAdvanced($sParentAttCode.'->'.$oParentAtt->GetExtKeyToRemote(), $sNodeId); - } - else - { + } else { $oQuery->AddCondition($sParentAttCode, $sNodeId); } } @@ -376,10 +357,11 @@ class BrowseBrickController extends BrickController } } - if (!$bFoundLevel) - { - throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, - 'Browse brick "'.$sBrickId.'" : Level alias "'.$sLevelAlias.'" is not defined for that brick.'); + if (!$bFoundLevel) { + throw new HttpException( + Response::HTTP_INTERNAL_SERVER_ERROR, + 'Browse brick "'.$sBrickId.'" : Level alias "'.$sLevelAlias.'" is not defined for that brick.' + ); } } @@ -394,34 +376,26 @@ class BrowseBrickController extends BrickController $oSet = new DBObjectSet($oQuery); break; } - } - else - { + } else { $oSet = new DBObjectSet($oQuery); } // Optimizing the ObjectSet to retrieve only necessary columns - $aColumnAttrs = array(); - foreach ($oSet->GetFilter()->GetSelectedClasses() as $sTmpClassAlias => $sTmpClassName) - { - if (isset($aLevelsProperties[$sTmpClassAlias])) - { + $aColumnAttrs = []; + foreach ($oSet->GetFilter()->GetSelectedClasses() as $sTmpClassAlias => $sTmpClassName) { + if (isset($aLevelsProperties[$sTmpClassAlias])) { $aTmpLevelProperties = $aLevelsProperties[$sTmpClassAlias]; // Mandatory main attribute - $aTmpColumnAttrs = array($aTmpLevelProperties['name_att']); + $aTmpColumnAttrs = [$aTmpLevelProperties['name_att']]; // Optional attributes, only if in list mode - if ($sBrowseMode === BrowseBrick::ENUM_BROWSE_MODE_LIST) - { - foreach ($aTmpLevelProperties['fields'] as $aTmpField) - { + if ($sBrowseMode === BrowseBrick::ENUM_BROWSE_MODE_LIST) { + foreach ($aTmpLevelProperties['fields'] as $aTmpField) { $aTmpColumnAttrs[] = $aTmpField['code']; } } // Optional attributes - foreach (BrowseBrickHelper::OPTIONAL_ATTRIBUTES as $sOptionalAttribute) - { - if ($aTmpLevelProperties[$sOptionalAttribute] !== null) - { + foreach (BrowseBrickHelper::OPTIONAL_ATTRIBUTES as $sOptionalAttribute) { + if ($aTmpLevelProperties[$sOptionalAttribute] !== null) { $aTmpColumnAttrs[] = $aTmpLevelProperties[$sOptionalAttribute]; } } @@ -434,20 +408,15 @@ class BrowseBrickController extends BrickController // Setting specified column sort, setting default datamodel one otherwise $aSortedParams = $this->oBrickControllerHelper->ExtractSortParams(); - if (!empty($aSortedParams)) - { + if (!empty($aSortedParams)) { $oSet->SetOrderBy($aSortedParams); - } - else - { + } else { $oSet->SetOrderByClasses(); } // Retrieving results and organizing them for templating - $aItems = array(); - while ($aCurrentRow = $oSet->FetchAssoc()) - { - switch ($sBrowseMode) - { + $aItems = []; + while ($aCurrentRow = $oSet->FetchAssoc()) { + switch ($sBrowseMode) { case BrowseBrick::ENUM_BROWSE_MODE_TREE: case BrowseBrick::ENUM_BROWSE_MODE_MOSAIC: $this->oBrowseBrickHelper->AddToTreeItems($aItems, $aCurrentRow, $aLevelsProperties, null); @@ -460,22 +429,21 @@ class BrowseBrickController extends BrickController } } - IssueLog::Debug('Portal BrowseBrick query', LogChannels::PORTAL, array( + IssueLog::Debug('Portal BrowseBrick query', LogChannels::PORTAL, [ 'sPortalId' => $sPortalId, 'sBrickId' => $sBrickId, 'oql' => $oSet->GetFilter()->ToOQL(), - )); - + ]); // Preparing response if ($oRequest->isXmlHttpRequest()) { - $aData = $aData + array( + $aData = $aData + [ 'data' => $aItems, 'levelsProperties' => $aLevelsProperties, - ); + ]; $oResponse = new JsonResponse($aData); } else { - $aData = $aData + array( + $aData = $aData + [ 'oBrick' => $oBrick, 'sBrickId' => $sBrickId, 'sBrowseMode' => $sBrowseMode, @@ -486,7 +454,7 @@ class BrowseBrickController extends BrickController 'iItemsCount' => count($aItems), 'aLevelsProperties' => json_encode($aLevelsProperties), 'iDefaultLengthList' => $oBrick->GetDefaultListLength(), - ); + ]; // Note : To extend this brick's template, depending on what you want to do : // a) Modify the whole template : @@ -495,13 +463,10 @@ class BrowseBrickController extends BrickController // - Create a template for that browse mode, // - Add the mode to those available in the brick configuration, // - Create a router and add a route for the new browse mode - if ($oBrick->HasInstanceOverriddenTemplate('page')) - { + if ($oBrick->HasInstanceOverriddenTemplate('page')) { $sTemplatePath = $oBrick->GetTemplatePath('page'); - } - else - { - $sTemplatePath = $oBrick->GetTemplatePath('page_' .$sBrowseMode); + } else { + $sTemplatePath = $oBrick->GetTemplatePath('page_'.$sBrowseMode); } $oResponse = $this->render($sTemplatePath, $aData); } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/CreateBrickController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/CreateBrickController.php index 3e6cafb25..f79643d54 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/CreateBrickController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/CreateBrickController.php @@ -33,7 +33,6 @@ use Symfony\Component\HttpFoundation\Request; */ class CreateBrickController extends BrickController { - /** * Constructor. * @@ -43,8 +42,7 @@ class CreateBrickController extends BrickController */ public function __construct( protected BrickCollection $oBrickCollection - ) - { + ) { } /** @@ -60,16 +58,15 @@ class CreateBrickController extends BrickController /** @var \Combodo\iTop\Portal\Brick\CreateBrick $oBrick */ $oBrick = $this->oBrickCollection->GetBrickById($sBrickId); - $aRouteParams = array( + $aRouteParams = [ 'sBrickId' => $sBrickId, 'sObjectClass' => $oBrick->GetClass(), 'ar_token' => null, - ); + ]; // Checking for actions rules $aRules = $oBrick->GetRules(); - if (!empty($aRules)) - { + if (!empty($aRules)) { $aRouteParams['ar_token'] = ContextManipulatorHelper::PrepareAndEncodeRulesToken($aRules); } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/DefaultController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/DefaultController.php index e8e2d0ae3..1fe241a6b 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/DefaultController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/DefaultController.php @@ -39,8 +39,9 @@ class DefaultController extends AbstractController public static function RegisterTemplates(TemplatesRegister $oTemplatesRegister): void { parent::RegisterTemplates($oTemplatesRegister); - $oTemplatesRegister->RegisterTemplates(self::class, - TemplateDefinitionDto::Create('home', static::TEMPLATES_BASE_PATH . 'home/layout.html.twig'), + $oTemplatesRegister->RegisterTemplates( + self::class, + TemplateDefinitionDto::Create('home', static::TEMPLATES_BASE_PATH.'home/layout.html.twig'), ); } @@ -53,26 +54,24 @@ class DefaultController extends AbstractController */ public function HomeAction(Request $oRequest, BrickCollection $oBricksCollection) { - $aData = array(); + $aData = []; // Rendering tiles - $aData['aTilesRendering'] = array(); - foreach ($oBricksCollection->GetBricks() as $oBrick) - { + $aData['aTilesRendering'] = []; + foreach ($oBricksCollection->GetBricks() as $oBrick) { // Doing it only for tile visible on home page to avoid unnecessary rendering - if (($oBrick->GetVisibleHome() === true) && ($oBrick->GetTileControllerAction() !== null)) - { + if (($oBrick->GetVisibleHome() === true) && ($oBrick->GetTileControllerAction() !== null)) { $aControllerActionParts = explode('::', $oBrick->GetTileControllerAction()); - if (count($aControllerActionParts) !== 2) - { - return new Response('Tile controller action must be of form "\Namespace\ControllerClass::FunctionName" for brick "'.$oBrick->GetId().'"', - 500); + if (count($aControllerActionParts) !== 2) { + return new Response( + 'Tile controller action must be of form "\Namespace\ControllerClass::FunctionName" for brick "'.$oBrick->GetId().'"', + 500 + ); } - $aRouteParams = array(); + $aRouteParams = []; // Add sBrickId in the route params as it is necessary for each brick actions - if (is_a($aControllerActionParts[0], BrickController::class, true)) - { + if (is_a($aControllerActionParts[0], BrickController::class, true)) { $aRouteParams['sBrickId'] = $oBrick->GetId(); } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/ManageBrickController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/ManageBrickController.php index dbc289ade..58bac2008 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/ManageBrickController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/ManageBrickController.php @@ -72,18 +72,19 @@ use utils; */ class ManageBrickController extends BrickController { - /** - * @var string EXCEL_EXPORT_TEMPLATE_PATH + /** + * @var string EXCEL_EXPORT_TEMPLATE_PATH * @deprecated since 3.2.1 */ - const EXCEL_EXPORT_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/manage/popup-export-excel.html.twig'; - + public const EXCEL_EXPORT_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/manage/popup-export-excel.html.twig'; + /** @inheritdoc */ public static function RegisterTemplates(TemplatesRegister $oTemplatesRegister): void { parent::RegisterTemplates($oTemplatesRegister); - $oTemplatesRegister->RegisterTemplates(self::class, - TemplateDefinitionDto::Create('modal_export_excel', static::TEMPLATES_BASE_PATH . 'bricks/manage/popup-export-excel.html.twig'), + $oTemplatesRegister->RegisterTemplates( + self::class, + TemplateDefinitionDto::Create('modal_export_excel', static::TEMPLATES_BASE_PATH.'bricks/manage/popup-export-excel.html.twig'), ); } @@ -104,8 +105,7 @@ class ManageBrickController extends BrickController protected RequestManipulatorHelper $oRequestManipulatorHelper, protected SecurityHelper $oSecurityHelper, protected BrickControllerHelper $oBrickControllerHelper - ) - { + ) { } @@ -138,17 +138,15 @@ class ManageBrickController extends BrickController $aData = $this->GetData($oRequest, $sBrickId, $sGroupingTab, $oBrick->IsDetailsNeeded($sDisplayMode)); $aExportFields = $oBrick->GetExportFields(); - $aData = $aData + array( + $aData = $aData + [ 'sDisplayMode' => $sDisplayMode, 'bCanExport' => !empty($aExportFields), 'iDefaultListLength' => $oBrick->GetDefaultListLength(), - ); + ]; // Preparing response if ($oRequest->isXmlHttpRequest()) { $oResponse = new JsonResponse($aData); - } - else - { + } else { $sLayoutTemplate = $oBrick->GetPageTemplate($sDisplayMode); $oResponse = $this->render($sLayoutTemplate, $aData); } @@ -171,14 +169,11 @@ class ManageBrickController extends BrickController /** @var \Combodo\iTop\Portal\Brick\ManageBrick $oBrick */ $oBrick = $this->oBrickCollection->GetBrickById($sBrickId); - try - { + try { $aData = $this->GetData($oRequest, $sBrickId, null); - } - catch (Exception $e) - { + } catch (Exception $e) { // TODO Default values - $aData = array(); + $aData = []; } return $this->render($oBrick->GetTileTemplate(), $aData); @@ -210,37 +205,28 @@ class ManageBrickController extends BrickController $sClass = $oQuery->GetClass(); $aData = $this->GetData($oRequest, $sBrickId, $sGroupingTab, true); - if (isset($aData['aQueries']) && count($aData['aQueries']) === 1) - { + if (isset($aData['aQueries']) && count($aData['aQueries']) === 1) { $aQueries = $aData['aQueries']; reset($aQueries); $sKey = key($aQueries); $oSearch = $aData['aQueries'][$sKey]; - } - else - { + } else { $this->oScopeValidatorHelper->AddScopeToQuery($oQuery, $sClass); - $aData = array(); + $aData = []; $this->ManageSearchValue($aData, $oQuery, $sClass); // Grouping tab - if ($oBrick->HasGroupingTabs()) - { + if ($oBrick->HasGroupingTabs()) { $aGroupingTabs = $oBrick->GetGroupingTabs(); // If tabs are made of the distinct values of an attribute, we have a find them via a query - if ($oBrick->IsGroupingTabsByDistinctValues()) - { + if ($oBrick->IsGroupingTabsByDistinctValues()) { $sGroupingTabAttCode = $aGroupingTabs['attribute']; $aGroupingTabsValues = $this->GroupByAttribute($oQuery, $sGroupingTabAttCode, $oBrick); $oQuery = $oQuery->Intersect($aGroupingTabsValues[$sGroupingTab]['condition']); - } - else - { - foreach ($aGroupingTabs['groups'] as $aGroup) - { - if ($aGroup['id'] === $sGroupingTab) - { + } else { + foreach ($aGroupingTabs['groups'] as $aGroup) { + if ($aGroup['id'] === $sGroupingTab) { $oConditionQuery = $oQuery->Intersect(DBSearch::FromOQL($aGroup['condition'])); $oQuery = $oQuery->Intersect($oConditionQuery); break; @@ -251,29 +237,27 @@ class ManageBrickController extends BrickController // Finalclass $oConditionQuery = DBSearch::CloneWithAlias($oQuery, 'GARE'); - $oExpression = new BinaryExpression(new FieldExpression('finalclass', 'GARE'), '=', - new UnaryExpression($sGroupingArea)); + $oExpression = new BinaryExpression( + new FieldExpression('finalclass', 'GARE'), + '=', + new UnaryExpression($sGroupingArea) + ); $oConditionQuery->AddConditionExpression($oExpression); /** @var DBSearch $oSearch */ $oSearch = $oQuery->Intersect($oConditionQuery); } $aColumnsAttrs = $oBrick->GetExportFields(); - $aFields = array(); + $aFields = []; $sTitleAttrCode = 'friendlyname'; - if (!in_array($sTitleAttrCode, $aColumnsAttrs)) - { + if (!in_array($sTitleAttrCode, $aColumnsAttrs)) { $aFields[] = $sTitleAttrCode; } - foreach ($aColumnsAttrs as $sAttCode) - { + foreach ($aColumnsAttrs as $sAttCode) { $oAttributeDef = MetaModel::GetAttributeDef($sGroupingArea, $sAttCode); - if ($oAttributeDef->IsExternalKey(EXTKEY_ABSOLUTE)) - { + if ($oAttributeDef->IsExternalKey(EXTKEY_ABSOLUTE)) { $aFields[] = $sAttCode.'_friendlyname'; - } - else - { + } else { $aFields[] = $sAttCode; } } @@ -288,12 +272,12 @@ class ManageBrickController extends BrickController $oExporter->SetLocalizeOutput(true); $oExporter->SetFields($sFields); - $aData = array( + $aData = [ 'oBrick' => $oBrick, 'sBrickId' => $sBrickId, 'sToken' => $oExporter->SaveState(), - 'sWikiUrl' => 'https://www.itophub.io/wiki/page?id='.utils::GetItopVersionWikiSyntax().'%3Auser%3Alists#excel_export', - ); + 'sWikiUrl' => 'https://www.itophub.io/wiki/page?id='.utils::GetItopVersionWikiSyntax().'%3Auser%3Alists#excel_export', + ]; return $this->render($this->GetTemplatePath('modal_export_excel'), $aData); } @@ -323,10 +307,10 @@ class ManageBrickController extends BrickController /** @var \Combodo\iTop\Portal\Brick\ManageBrick $oBrick */ $oBrick = $this->oBrickCollection->GetBrickById($sBrickId); - $aData = array(); - $aGroupingTabsValues = array(); - $aGroupingAreasValues = array(); - $aQueries = array(); + $aData = []; + $aGroupingTabsValues = []; + $aGroupingAreasValues = []; + $aQueries = []; $bHasScope = true; // Getting current data loading mode (First from router parameter, then query parameter, then default brick value) @@ -334,8 +318,7 @@ class ManageBrickController extends BrickController // - Retrieving the grouping areas to display $sGroupingArea = $this->oRequestManipulatorHelper->ReadParam('sGroupingArea', ''); - if (!empty($sGroupingArea)) - { + if (!empty($sGroupingArea)) { $bNeedDetails = true; } @@ -343,9 +326,8 @@ class ManageBrickController extends BrickController $aColumnsAttrs = $oBrick->GetFields(); // Adding friendlyname attribute to the list if not already in it $sTitleAttrCode = 'friendlyname'; - if (($sTitleAttrCode !== null) && !in_array($sTitleAttrCode, $aColumnsAttrs)) - { - $aColumnsAttrs = array_merge(array($sTitleAttrCode), $aColumnsAttrs); + if (($sTitleAttrCode !== null) && !in_array($sTitleAttrCode, $aColumnsAttrs)) { + $aColumnsAttrs = array_merge([$sTitleAttrCode], $aColumnsAttrs); } // Starting to build query @@ -356,100 +338,78 @@ class ManageBrickController extends BrickController // Preparing tabs // - We need to retrieve distinct values for the grouping attribute $iCount = 0; - if ($oBrick->HasGroupingTabs()) - { + if ($oBrick->HasGroupingTabs()) { $aGroupingTabs = $oBrick->GetGroupingTabs(); // If tabs are made of the distinct values of an attribute, we have a find them via a query - if ($oBrick->IsGroupingTabsByDistinctValues()) - { + if ($oBrick->IsGroupingTabsByDistinctValues()) { $sGroupingTabAttCode = $aGroupingTabs['attribute']; $aGroupingTabsValues = $this->GroupByAttribute($oQuery, $sGroupingTabAttCode, $oBrick); - foreach ($aGroupingTabsValues as $aResult) - { + foreach ($aGroupingTabsValues as $aResult) { $iCount += $aResult['count']; } } // Otherwise we create the tabs from the SQL expressions - else - { - $aConditionQueryGrouping = array(); - foreach ($aGroupingTabs['groups'] as $aGroup) - { + else { + $aConditionQueryGrouping = []; + foreach ($aGroupingTabs['groups'] as $aGroup) { $oDBSearch = DBSearch::FromOQL($aGroup['condition']); $oConditionQuery = $oQuery->Intersect($oDBSearch); // - Restricting query to scope - array_push($aConditionQueryGrouping,$oDBSearch); + array_push($aConditionQueryGrouping, $oDBSearch); $bHasScope = $this->oScopeValidatorHelper->AddScopeToQuery($oConditionQuery, $oConditionQuery->GetClass()); - if ($bHasScope) - { + if ($bHasScope) { // - Building ObjectSet $oConditionSet = new DBObjectSet($oConditionQuery); $iGroupCount = $oConditionSet->Count(); - } - else - { + } else { $oConditionSet = null; $iGroupCount = 0; } - $aGroupingTabsValues[$aGroup['id']] = array( + $aGroupingTabsValues[$aGroup['id']] = [ 'value' => $aGroup['id'], 'label' => Dict::S($aGroup['title']), 'label_html' => Dict::S($aGroup['title']), - 'description' => array_key_exists('description',$aGroup) ? Dict::S($aGroup['description']) : null, + 'description' => array_key_exists('description', $aGroup) ? Dict::S($aGroup['description']) : null, 'condition' => $oConditionQuery, 'count' => $iGroupCount, - ); + ]; } - try - { + try { $oConditionQuery = $oQuery->Intersect(new DBUnionSearch($aConditionQueryGrouping)); $bHasScope = $this->oScopeValidatorHelper->AddScopeToQuery($oConditionQuery, $oConditionQuery->GetClass()); - if ($bHasScope) - { + if ($bHasScope) { // - Building ObjectSet $oConditionSet = new DBObjectSet($oConditionQuery); $iCount = $oConditionSet->Count(); - } - else - { + } else { $oConditionSet = null; $iCount = 0; } - } - catch (Exception $e){ + } catch (Exception $e) { $oConditionSet = null; $iCount = -1; } } - } - else - { + } else { $oConditionQuery = $this->GetScopedQuery($oBrick, $sClass); - if (!is_null($oConditionQuery)) - { + if (!is_null($oConditionQuery)) { $oSet = new DBObjectSet($oConditionQuery); $iCount = $oSet->Count(); } } // - Retrieving the current grouping tab to display if necessary and altering the query to do so - if (empty($sGroupingTab)) - { - if ($oBrick->HasGroupingTabs()) - { + if (empty($sGroupingTab)) { + if ($oBrick->HasGroupingTabs()) { reset($aGroupingTabsValues); $sGroupingTab = key($aGroupingTabsValues); - if ($aGroupingTabsValues[$sGroupingTab]['condition'] !== null) - { + if ($aGroupingTabsValues[$sGroupingTab]['condition'] !== null) { $oQuery = $aGroupingTabsValues[$sGroupingTab]['condition']->DeepClone(); } } - } - else - { - if ($aGroupingTabsValues[$sGroupingTab]['condition'] !== null) - { + } else { + if ($aGroupingTabsValues[$sGroupingTab]['condition'] !== null) { $oQuery = $aGroupingTabsValues[$sGroupingTab]['condition']->DeepClone(); } } @@ -464,60 +424,56 @@ class ManageBrickController extends BrickController // - We need to retrieve distinct values for the grouping attribute // Note : Will have to be changed when we consider grouping on something else than the finalclass $sParentAlias = $oQuery->GetClassAlias(); - if ($bNeedDetails) - { + if ($bNeedDetails) { $sGroupingAreaAttCode = 'finalclass'; // For root classes - if (MetaModel::IsValidAttCode($sClass, $sGroupingAreaAttCode)) - { + if (MetaModel::IsValidAttCode($sClass, $sGroupingAreaAttCode)) { $oDistinctQuery = $this->GetScopedQuery($oBrick, $sClass); // Adding grouping conditions $oFieldExp = new FieldExpression($sGroupingAreaAttCode, $oDistinctQuery->GetClassAlias()); - $sDistinctSql = $oDistinctQuery->MakeGroupByQuery(array(), array('grouped_by_1' => $oFieldExp), true); + $sDistinctSql = $oDistinctQuery->MakeGroupByQuery([], ['grouped_by_1' => $oFieldExp], true); $aDistinctResults = CMDBSource::QueryToArray($sDistinctSql); - foreach ($aDistinctResults as $aDistinctResult) - { + foreach ($aDistinctResults as $aDistinctResult) { $oConditionQuery = DBSearch::CloneWithAlias($oQuery, 'GARE'); - $oExpression = new BinaryExpression(new FieldExpression($sGroupingAreaAttCode, 'GARE'), '=', - new UnaryExpression($aDistinctResult['grouped_by_1'])); + $oExpression = new BinaryExpression( + new FieldExpression($sGroupingAreaAttCode, 'GARE'), + '=', + new UnaryExpression($aDistinctResult['grouped_by_1']) + ); $oConditionQuery->AddConditionExpression($oExpression); - $aGroupingAreasValues[$aDistinctResult['grouped_by_1']] = array( + $aGroupingAreasValues[$aDistinctResult['grouped_by_1']] = [ 'value' => $aDistinctResult['grouped_by_1'], 'label' => MetaModel::GetName($aDistinctResult['grouped_by_1']), // Caution : This works only because we froze the grouping areas on the finalclass attribute. 'condition' => $oConditionQuery, 'count' => $aDistinctResult['_itop_count_'], - ); + ]; unset($oConditionQuery); } unset($aDistinctResults); } // For leaf classes - else - { - $aGroupingAreasValues[$sClass] = array( + else { + $aGroupingAreasValues[$sClass] = [ 'value' => $sClass, 'label' => MetaModel::GetName($sClass), // Caution : This works only because we froze the grouping areas on the finalclass attribute. 'condition' => null, 'count' => 0, - ); + ]; } // - If specified or lazy loading, we truncate the $aGroupingAreasValues to keep only this one - if (!empty($sGroupingArea)) - { - $aGroupingAreasValues = array($sGroupingArea => $aGroupingAreasValues[$sGroupingArea]); + if (!empty($sGroupingArea)) { + $aGroupingAreasValues = [$sGroupingArea => $aGroupingAreasValues[$sGroupingArea]]; } // - Preparing the queries - foreach ($aGroupingAreasValues as $sKey => $aGroupingAreasValue) - { + foreach ($aGroupingAreasValues as $sKey => $aGroupingAreasValue) { $oAreaQuery = DBSearch::CloneWithAlias($oQuery, $sParentAlias); - if ($aGroupingAreasValue['condition'] !== null) - { + if ($aGroupingAreasValue['condition'] !== null) { $oAreaQuery = $aGroupingAreasValue['condition']->DeepClone(); } @@ -525,8 +481,7 @@ class ManageBrickController extends BrickController // Note: Will need to moved the scope restriction on queries elsewhere when we consider grouping on something else than finalclass // Note: We now get view scope instead of edit scope as we allowed users to view/edit objects in the brick regarding their rights $bHasScope = $this->oScopeValidatorHelper->AddScopeToQuery($oAreaQuery, $aGroupingAreasValue['value']); - if (!$bHasScope) - { + if (!$bHasScope) { // if no scope apply does not allow any data $oAreaQuery = null; } @@ -538,71 +493,64 @@ class ManageBrickController extends BrickController // Testing appropriate data loading mode if we are in auto // - For all (html) tables, this doesn't care for the grouping ares (finalclass) - if ($sDataLoading === AbstractBrick::ENUM_DATA_LOADING_AUTO) - { + if ($sDataLoading === AbstractBrick::ENUM_DATA_LOADING_AUTO) { // - Check how many records there is. // - Update $sDataLoading with its new value regarding the number of record and the threshold $oCountSet = new DBObjectSet($oQuery); - $oCountSet->OptimizeColumnLoad(array($oQuery->GetClassAlias() => array())); - $fThreshold = (float)MetaModel::GetModuleSetting($sPortalId, - 'lazy_loading_threshold'); + $oCountSet->OptimizeColumnLoad([$oQuery->GetClassAlias() => []]); + $fThreshold = (float)MetaModel::GetModuleSetting( + $sPortalId, + 'lazy_loading_threshold' + ); $sDataLoading = ($oCountSet->Count() > $fThreshold) ? AbstractBrick::ENUM_DATA_LOADING_LAZY : AbstractBrick::ENUM_DATA_LOADING_FULL; unset($oCountSet); } // Preparing data sets - $aSets = array(); + $aSets = []; /** @var DBSearch $oQuery */ - foreach ($aQueries as $sKey => $oQuery) - { + foreach ($aQueries as $sKey => $oQuery) { // Checking if we have a valid query - if ($oQuery !== null) - { + if ($oQuery !== null) { // - Adding search clause if necessary $this->ManageSearchValue($aData, $oQuery, $sKey, $aColumnsAttrs); - + // Setting query pagination if needed - if ($sDataLoading === AbstractBrick::ENUM_DATA_LOADING_LAZY) - { + if ($sDataLoading === AbstractBrick::ENUM_DATA_LOADING_LAZY) { // Retrieving parameters $iPageNumber = (int)$this->oRequestManipulatorHelper->ReadParam('iPageNumber', 1, FILTER_SANITIZE_NUMBER_INT); - $iListLength = (int)$this->oRequestManipulatorHelper->ReadParam('iListLength', ManageBrick::DEFAULT_LIST_LENGTH, - FILTER_SANITIZE_NUMBER_INT); + $iListLength = (int)$this->oRequestManipulatorHelper->ReadParam( + 'iListLength', + ManageBrick::DEFAULT_LIST_LENGTH, + FILTER_SANITIZE_NUMBER_INT + ); // Getting total records number $oCountSet = new DBObjectSet($oQuery); - $oCountSet->OptimizeColumnLoad(array($oQuery->GetClassAlias() => $aColumnsAttrs)); + $oCountSet->OptimizeColumnLoad([$oQuery->GetClassAlias() => $aColumnsAttrs]); $aData['recordsTotal'] = $oCountSet->Count(); $aData['recordsFiltered'] = $oCountSet->Count(); unset($oCountSet); $oSet = new DBObjectSet($oQuery); $oSet->SetLimit($iListLength, $iListLength * ($iPageNumber - 1)); - } - else - { + } else { $oSet = new DBObjectSet($oQuery); } // Setting specified column sort, setting default datamodel one otherwise - if (!empty($aSortedParams)) - { + if (!empty($aSortedParams)) { $oSet->SetOrderBy($aSortedParams); - } - else - { + } else { $oSet->SetOrderByClasses(); } // Adding always_in_tables attributes - $aColumnsToLoad = array($oQuery->GetClassAlias() => $aColumnsAttrs); - foreach ($oQuery->GetSelectedClasses() as $sAlias => $sClassSelected) - { + $aColumnsToLoad = [$oQuery->GetClassAlias() => $aColumnsAttrs]; + foreach ($oQuery->GetSelectedClasses() as $sAlias => $sClassSelected) { /** @var AttributeDefinition $oAttDef */ - foreach (MetaModel::ListAttributeDefs($sClassSelected) as $sAttCode => $oAttDef) - { - if ($oAttDef->AlwaysLoadInTables()) - { + foreach (MetaModel::ListAttributeDefs($sClassSelected) as $sAttCode => $oAttDef) { + if ($oAttDef->AlwaysLoadInTables()) { $aColumnsToLoad[$sAlias][] = $sAttCode; } } @@ -610,17 +558,18 @@ class ManageBrickController extends BrickController // Note: $aColumnToLoad already contains array of aliases => attcodes $oSet->OptimizeColumnLoad($aColumnsToLoad); - $this->oSecurityHelper->PreloadForCache($oSet->GetFilter(), - $aColumnsToLoad[$oQuery->GetClassAlias()] /* preloading only extkeys from the main class */); + $this->oSecurityHelper->PreloadForCache( + $oSet->GetFilter(), + $aColumnsToLoad[$oQuery->GetClassAlias()] /* preloading only extkeys from the main class */ + ); $aSets[$sKey] = $oSet; } } // Retrieving and preparing data for rendering - $aGroupingAreasData = array(); + $aGroupingAreasData = []; $bHasObjectListItemExtension = false; - foreach ($aSets as $sKey => $oSet) - { + foreach ($aSets as $sKey => $oSet) { // Set properties $sCurrentClass = $sKey; @@ -628,94 +577,88 @@ class ManageBrickController extends BrickController $sMainActionAttrCode = $aColumnsAttrs[0]; // Loading columns definition - $aColumnsDefinition = array(); - foreach ($aColumnsAttrs as $sColumnAttr) - { + $aColumnsDefinition = []; + foreach ($aColumnsAttrs as $sColumnAttr) { $oAttDef = MetaModel::GetAttributeDef($sKey, $sColumnAttr); - $aColumnsDefinition[$sColumnAttr] = array( + $aColumnsDefinition[$sColumnAttr] = [ 'title' => $oAttDef->GetLabel(), 'type' => ($oAttDef instanceof AttributeDateTime) ? 'moment-'.$oAttDef->GetFormat()->ToMomentJS() : 'html', // Special sorting for Date & Time - ); + ]; } // Getting items - $aItems = array(); + $aItems = []; // ... For each item /** @var DBObject $oCurrentRow */ - while ($oCurrentRow = $oSet->Fetch()) - { + while ($oCurrentRow = $oSet->Fetch()) { $sCurrentObjectClass = get_class($oCurrentRow); $sCurrentObjectId = $oCurrentRow->GetKey(); // ... Retrieving item's attributes values - $aItemAttrs = array(); - foreach ($aColumnsAttrs as $sItemAttr) - { - $aActions = array(); + $aItemAttrs = []; + foreach ($aColumnsAttrs as $sItemAttr) { + $aActions = []; // Set the edit action to the main (first) attribute only //if ($sItemAttr === $sTitleAttrCode) - if ($sItemAttr === $sMainActionAttrCode) - { + if ($sItemAttr === $sMainActionAttrCode) { // Checking if we can edit the object - if (($oBrick->GetOpeningMode() === ManageBrick::ENUM_ACTION_EDIT) && $this->oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, - $sCurrentClass, $oCurrentRow->GetKey())) - { + if (($oBrick->GetOpeningMode() === ManageBrick::ENUM_ACTION_EDIT) && $this->oSecurityHelper->IsActionAllowed( + UR_ACTION_MODIFY, + $sCurrentClass, + $oCurrentRow->GetKey() + )) { $sActionType = ManageBrick::ENUM_ACTION_EDIT; } // - Otherwise, check if view is allowed - elseif ($this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sCurrentClass, - $oCurrentRow->GetKey())) - { + elseif ($this->oSecurityHelper->IsActionAllowed( + UR_ACTION_READ, + $sCurrentClass, + $oCurrentRow->GetKey() + )) { $sActionType = ManageBrick::ENUM_ACTION_VIEW; - } - else - { + } else { $sActionType = null; } // - Then set allowed action - if ($sActionType !== null) - { - $aActions[] = array( + if ($sActionType !== null) { + $aActions[] = [ 'type' => $sActionType, 'class' => $sCurrentClass, 'id' => $oCurrentRow->GetKey(), 'opening_target' => $oBrick->GetOpeningTarget(), - ); + ]; } } /** @var \AttributeDefinition $oAttDef */ $oAttDef = MetaModel::GetAttributeDef($sCurrentClass, $sItemAttr); $sAttDefClass = get_class($oAttDef); - if ($oAttDef->IsExternalKey()) - { + if ($oAttDef->IsExternalKey()) { /** @var \AttributeExternalKey $oAttDef */ $sValue = $oCurrentRow->GetAsHTML($sItemAttr.'_friendlyname'); $sSortValue = $oCurrentRow->Get($sItemAttr.'_friendlyname'); // Adding a view action on the external keys - if ($oCurrentRow->Get($sItemAttr) !== $oAttDef->GetNullValue()) - { + if ($oCurrentRow->Get($sItemAttr) !== $oAttDef->GetNullValue()) { // Checking if we can view the object - if (($this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $oAttDef->GetTargetClass(), - $oCurrentRow->Get($sItemAttr)))) - { - $aActions[] = array( + if (($this->oSecurityHelper->IsActionAllowed( + UR_ACTION_READ, + $oAttDef->GetTargetClass(), + $oCurrentRow->Get($sItemAttr) + ))) { + $aActions[] = [ 'type' => ManageBrick::ENUM_ACTION_VIEW, 'class' => $oAttDef->GetTargetClass(), 'id' => $oCurrentRow->Get($sItemAttr), 'opening_target' => $oBrick->GetOpeningTarget(), - ); + ]; } } - } - elseif ($oAttDef instanceof AttributeImage) - { + } elseif ($oAttDef instanceof AttributeImage) { /** @var \ormDocument $oOrmDoc */ $oOrmDoc = $oCurrentRow->Get($sItemAttr); - if (is_object($oOrmDoc) && !$oOrmDoc->IsEmpty()) - { + if (is_object($oOrmDoc) && !$oOrmDoc->IsEmpty()) { $sUrl = $this->oUrlGenerator->generate('p_object_document_display', [ 'sObjectClass' => get_class($oCurrentRow), 'sObjectId' => $oCurrentRow->GetKey(), @@ -723,16 +666,12 @@ class ManageBrickController extends BrickController 'cache' => 86400, 's' => $oOrmDoc->GetSignature(), ]); - } - else - { + } else { $sUrl = $oAttDef->Get('default_image'); } $sValue = ''; $sSortValue = null; - } - elseif ($oAttDef instanceof AttributeTagSet) - { + } elseif ($oAttDef instanceof AttributeTagSet) { /** @var \ormTagSet $oSetValues */ $oSetValues = $oCurrentRow->Get($sItemAttr); $aCodes = $oSetValues->GetTags(); @@ -754,17 +693,15 @@ class ManageBrickController extends BrickController // For simple fields, we get the raw (stored) value as well $bExcludeRawValue = false; - foreach (ApplicationHelper::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) - { - if (is_a($sAttDefClass, $sAttDefClassToExclude, true)) - { + foreach (ApplicationHelper::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) { + if (is_a($sAttDefClass, $sAttDefClassToExclude, true)) { $bExcludeRawValue = true; break; } } $attValueRaw = ($bExcludeRawValue === false) ? $oCurrentRow->Get($sItemAttr) : null; - $aItemAttrs[$sItemAttr] = array( + $aItemAttrs[$sItemAttr] = [ 'object_class' => $sCurrentObjectClass, 'object_id' => $sCurrentObjectId, 'attribute_code' => $sItemAttr, @@ -773,114 +710,105 @@ class ManageBrickController extends BrickController 'value_html' => $sValue, 'sort_value' => $sSortValue, 'actions' => $aActions, - ); + ]; } // ... Checking menu extensions - $aItemButtons = array(); + $aItemButtons = []; /** @var iPopupMenuExtension $oExtensionInstance */ - foreach (MetaModel::EnumPlugins('iPopupMenuExtension') as $oExtensionInstance) - { - foreach ($oExtensionInstance->EnumItems(iPopupMenuExtension::PORTAL_OBJLISTITEM_ACTIONS, array( + foreach (MetaModel::EnumPlugins('iPopupMenuExtension') as $oExtensionInstance) { + foreach ($oExtensionInstance->EnumItems(iPopupMenuExtension::PORTAL_OBJLISTITEM_ACTIONS, [ 'portal_id' => $sPortalId, 'object' => $oCurrentRow, - )) as $oMenuItem) - { - if (is_object($oMenuItem)) - { - if ($oMenuItem instanceof JSButtonItem) - { - $aItemButtons[] = $oMenuItem->GetMenuItem() + array( + ]) as $oMenuItem) { + if (is_object($oMenuItem)) { + if ($oMenuItem instanceof JSButtonItem) { + $aItemButtons[] = $oMenuItem->GetMenuItem() + [ 'js_files' => $oMenuItem->GetLinkedScripts(), 'type' => 'button', - ); - } - elseif ($oMenuItem instanceof URLButtonItem) - { - $aItemButtons[] = $oMenuItem->GetMenuItem() + array('type' => 'link'); + ]; + } elseif ($oMenuItem instanceof URLButtonItem) { + $aItemButtons[] = $oMenuItem->GetMenuItem() + ['type' => 'link']; } } } } // ... And item's properties - $aItems[] = array( + $aItems[] = [ 'id' => $oCurrentRow->GetKey(), 'class' => $sCurrentClass, 'attributes' => $aItemAttrs, 'highlight_class' => $oCurrentRow->GetHilightClass(), 'actions' => $aItemButtons, - ); + ]; - if (!empty($aItemButtons)) - { + if (!empty($aItemButtons)) { $bHasObjectListItemExtension = true; } } // Adding an extra column for object list item extensions - if ($bHasObjectListItemExtension === true) - { - $aColumnsDefinition['_ui_extensions'] = array( + if ($bHasObjectListItemExtension === true) { + $aColumnsDefinition['_ui_extensions'] = [ 'title' => Dict::S('Brick:Portal:Manage:Table:ItemActions'), 'type' => 'html', - ); + ]; } - $aGroupingAreasData[$sKey] = array( + $aGroupingAreasData[$sKey] = [ 'sId' => $sKey, 'sTitle' => $aGroupingAreasValues[$sKey]['label'], 'aItems' => $aItems, 'iItemsCount' => $oSet->Count(), 'aColumnsDefinition' => $aColumnsDefinition, - ); + ]; - IssueLog::Debug('Portal ManageBrick query', LogChannels::PORTAL, array( + IssueLog::Debug('Portal ManageBrick query', LogChannels::PORTAL, [ 'sPortalId' => $sPortalId, 'sBrickId' => $sBrickId, 'sGroupingTab' => $sGroupingTab, 'oql' => $oSet->GetFilter()->ToOQL(), 'aGroupingTabs' => $aGroupingTabs, - )); + ]); } } else { - $aGroupingAreasData = array(); + $aGroupingAreasData = []; $sGroupingArea = null; } // Preparing response if ($oRequest->isXmlHttpRequest()) { - $aData = $aData + array( + $aData = $aData + [ 'data' => $aGroupingAreasData[$sGroupingArea]['aItems'], - ); + ]; } else { - $aDisplayValues = array(); - $aUrls = array(); - $aColumns = array(); - $aNames = array(); + $aDisplayValues = []; + $aUrls = []; + $aColumns = []; + $aNames = []; if ($bHasScope) { foreach ($aGroupingTabsValues as $aValues) { - $aDisplayValues[] = array( + $aDisplayValues[] = [ 'value' => $aValues['count'], 'label' => $aValues['label'], 'label_html' => $aValues['label_html'], - ); - $aUrls[] = $this->oUrlGenerator->generate('p_manage_brick_display_as', array( + ]; + $aUrls[] = $this->oUrlGenerator->generate('p_manage_brick_display_as', [ 'sBrickId' => $sBrickId, 'sDisplayMode' => 'list', 'sGroupingTab' => $aValues['value'], - )); + ]); } - foreach ($aDisplayValues as $idx => $aValue) - { - $aColumns[] = array('series_'.$idx, (int)$aValue['value']); + foreach ($aDisplayValues as $idx => $aValue) { + $aColumns[] = ['series_'.$idx, (int)$aValue['value']]; $aNames['series_'.$idx] = $aValue['label']; } } // Preparing data to pass to the templating service - $aData = $aData + array( + $aData = $aData + [ 'sFct' => 'count', 'sIconURL' => $sIconURL, 'aColumns' => $aColumns, @@ -896,7 +824,7 @@ class ManageBrickController extends BrickController 'sDateFormat' => AttributeDate::GetFormat()->ToMomentJS(), 'sDateTimeFormat' => AttributeDateTime::GetFormat()->ToMomentJS(), 'iCount' => $iCount, - ); + ]; } return $aData; @@ -911,7 +839,7 @@ class ManageBrickController extends BrickController * @throws \CoreException * @throws \Exception */ - protected function ManageSearchValue(&$aData, DBSearch &$oQuery, $sClass, $aColumnsAttrs = array()) + protected function ManageSearchValue(&$aData, DBSearch &$oQuery, $sClass, $aColumnsAttrs = []) { // Getting search value $sRawSearchValue = trim($this->oRequestManipulatorHelper->ReadParam('sSearchValue', '')); @@ -975,24 +903,22 @@ class ManageBrickController extends BrickController * @throws \OQLException * @throws \Exception */ - protected function GroupByAttribute(DBSearch $oQuery, $sGroupingTabAttCode, ManageBrick $oBrick) { + protected function GroupByAttribute(DBSearch $oQuery, $sGroupingTabAttCode, ManageBrick $oBrick) + { - $aGroupingTabsValues = array(); - $aDistinctResults = array(); + $aGroupingTabsValues = []; + $aDistinctResults = []; $oDistinctQuery = DBSearch::FromOQL($oBrick->GetOql()); $bHasScope = $this->oScopeValidatorHelper->AddScopeToQuery($oDistinctQuery, $oDistinctQuery->GetClass()); - if ($bHasScope) - { + if ($bHasScope) { // - Adding field condition $oFieldExp = new FieldExpression($sGroupingTabAttCode, $oDistinctQuery->GetClassAlias()); - $sDistinctSql = $oDistinctQuery->MakeGroupByQuery(array(), array('grouped_by_1' => $oFieldExp), true); + $sDistinctSql = $oDistinctQuery->MakeGroupByQuery([], ['grouped_by_1' => $oFieldExp], true); $aDistinctResults = CMDBSource::QueryToArray($sDistinctSql); - if (!empty($aDistinctResults)) - { + if (!empty($aDistinctResults)) { $iLimit = $oBrick->GetGroupLimit(); - $aOthers = array(); - if ($iLimit > 0) - { + $aOthers = []; + if ($iLimit > 0) { uasort($aDistinctResults, function ($a, $b) { $v1 = $a['_itop_count_']; $v2 = $b['_itop_count_']; @@ -1000,77 +926,72 @@ class ManageBrickController extends BrickController return ($v1 == $v2) ? 0 : (($v1 > $v2) ? -1 : 1); }); - if (count($aDistinctResults) > $iLimit) - { - if ($oBrick->ShowGroupOthers()) - { + if (count($aDistinctResults) > $iLimit) { + if ($oBrick->ShowGroupOthers()) { $aOthers = array_slice($aDistinctResults, $iLimit); } $aDistinctResults = array_slice($aDistinctResults, 0, $iLimit); } } - foreach ($aDistinctResults as $aDistinctResult) - { + foreach ($aDistinctResults as $aDistinctResult) { $oConditionQuery = DBSearch::CloneWithAlias($oQuery, 'GTAB'); - $oExpression = new BinaryExpression(new FieldExpression($sGroupingTabAttCode, - $oConditionQuery->GetClassAlias()), '=', new UnaryExpression($aDistinctResult['grouped_by_1'])); + $oExpression = new BinaryExpression(new FieldExpression( + $sGroupingTabAttCode, + $oConditionQuery->GetClassAlias() + ), '=', new UnaryExpression($aDistinctResult['grouped_by_1'])); $oConditionQuery->AddConditionExpression($oExpression); $sHtmlLabel = $oFieldExp->MakeValueLabel($oDistinctQuery, $aDistinctResult['grouped_by_1'], ''); - $aGroupingTabsValues[$aDistinctResult['grouped_by_1']] = array( + $aGroupingTabsValues[$aDistinctResult['grouped_by_1']] = [ 'value' => $aDistinctResult['grouped_by_1'], 'label_html' => $sHtmlLabel, 'label' => strip_tags(html_entity_decode($sHtmlLabel, ENT_QUOTES, 'UTF-8')), 'condition' => $oConditionQuery, 'count' => $aDistinctResult['_itop_count_'], - ); + ]; unset($oConditionQuery); } - if (!empty($aOthers)) - { + if (!empty($aOthers)) { // Aggregate others $oConditionQuery = DBSearch::CloneWithAlias($oQuery, 'GTAB'); $oExpression = null; $iOtherCount = 0; - foreach ($aOthers as $aResult) - { + foreach ($aOthers as $aResult) { $iOtherCount += $aResult['_itop_count_']; - $oExpr = new BinaryExpression(new FieldExpression($sGroupingTabAttCode, - $oConditionQuery->GetClassAlias()), '=', new UnaryExpression($aResult['grouped_by_1'])); - if (is_null($oExpression)) - { + $oExpr = new BinaryExpression(new FieldExpression( + $sGroupingTabAttCode, + $oConditionQuery->GetClassAlias() + ), '=', new UnaryExpression($aResult['grouped_by_1'])); + if (is_null($oExpression)) { $oExpression = $oExpr; - } - else - { + } else { $oExpression = new BinaryExpression($oExpression, 'OR', $oExpr); } } $oConditionQuery->AddConditionExpression($oExpression); $sLabel = Dict::S('Brick:Portal:Manage:Others'); - $aGroupingTabsValues['Others'] = array( + $aGroupingTabsValues['Others'] = [ 'value' => 'Others', 'label_html' => $sLabel, 'label' => $sLabel, 'condition' => $oConditionQuery, 'count' => $iOtherCount, - ); + ]; unset($oConditionQuery); } } } - if (empty($aDistinctResults)) - { + if (empty($aDistinctResults)) { $sLabel = Dict::S('Brick:Portal:Manage:All'); - $aGroupingTabsValues['undefined'] = array( + $aGroupingTabsValues['undefined'] = [ 'value' => 'All', 'label_html' => $sLabel, 'label' => $sLabel, 'condition' => null, 'count' => 0, - ); + ]; } return $aGroupingTabsValues; diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php index 4555a863b..7d68ba72a 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php @@ -73,16 +73,17 @@ use VariableExpression; */ class ObjectController extends BrickController { - const DEFAULT_PAGE_NUMBER = 1; - const DEFAULT_LIST_LENGTH = 10; + public const DEFAULT_PAGE_NUMBER = 1; + public const DEFAULT_LIST_LENGTH = 10; /** @inheritdoc */ public static function RegisterTemplates(TemplatesRegister $oTemplatesRegister): void { parent::RegisterTemplates($oTemplatesRegister); - $oTemplatesRegister->RegisterTemplates(self::class, - TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH. 'bricks/object/layout.html.twig'), - TemplateDefinitionDto::Create('modal', static::TEMPLATES_BASE_PATH. 'bricks/object/modal.html.twig'), + $oTemplatesRegister->RegisterTemplates( + self::class, + TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH.'bricks/object/layout.html.twig'), + TemplateDefinitionDto::Create('modal', static::TEMPLATES_BASE_PATH.'bricks/object/modal.html.twig'), TemplateDefinitionDto::Create('mode_create', static::TEMPLATES_BASE_PATH.'bricks/object/mode_create.html.twig', true, 'create'), TemplateDefinitionDto::Create('mode_edit', static::TEMPLATES_BASE_PATH.'bricks/object/mode_edit.html.twig', true, 'edit'), TemplateDefinitionDto::Create('mode_search_hierarchy', static::TEMPLATES_BASE_PATH.'bricks/object/mode_search_hierarchy.html.twig', true, 'search_hierarchy'), @@ -117,9 +118,8 @@ class ObjectController extends BrickController protected ObjectFormHandlerHelper $oObjectFormHandlerHelper, protected NavigationRuleHelper $oNavigationRuleHelper, protected ContextManipulatorHelper $oContextManipulatorHelper, - protected array $aCombodoPortalInstanceConf = [] - ) - { + protected array $aCombodoPortalInstanceConf = [] + ) { } @@ -154,8 +154,12 @@ class ObjectController extends BrickController } // Retrieving object - $oObject = MetaModel::GetObject($sObjectClass, $sObjectId, false /* MustBeFound */, - $this->oScopeValidatorHelper->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass)); + $oObject = MetaModel::GetObject( + $sObjectClass, + $sObjectId, + false /* MustBeFound */, + $this->oScopeValidatorHelper->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass) + ); if ($oObject === null) { // We should never be there as the secuirty helper makes sure that the object exists, but just in case. IssueLog::Info(__METHOD__.' at line '.__LINE__.' : Could not load object '.$sObjectClass.'::'.$sObjectId.'.'); @@ -167,7 +171,7 @@ class ObjectController extends BrickController /** * Displays an cmdbAbstractObject (if the connected user is allowed to) from a specific attribute. If several or none objects are found with the attribute value, an exception is thrown. - * + * * @param \Symfony\Component\HttpFoundation\Request $oRequest * @param string $sObjectClass (Class must be an instance of cmdbAbstractObject) * @param string $sObjectAttCode @@ -192,8 +196,13 @@ class ObjectController extends BrickController throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, Dict::Format('UI:Error:3ParametersMissing', 'class', 'attcode', 'attvalue')); } - $oObject = MetaModel::GetObjectByColumn($sObjectClass, $sObjectAttCode, $sObjectAttValue, false, - $this->oScopeValidatorHelper->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass)); + $oObject = MetaModel::GetObjectByColumn( + $sObjectClass, + $sObjectAttCode, + $sObjectAttValue, + false, + $this->oScopeValidatorHelper->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass) + ); if ($oObject === null) { // null if object not found or multiple matches IssueLog::Info(__METHOD__.' at line '.__LINE__.' : Could not load object '.$sObjectClass.'" and "'.$sObjectAttCode.' / '.$sObjectAttValue.'.'); @@ -235,21 +244,24 @@ class ObjectController extends BrickController $oObject->FireEvent(EVENT_DISPLAY_OBJECT_DETAILS); - $aData = array('sMode' => 'view'); + $aData = ['sMode' => 'view']; $aData['form'] = $this->oObjectFormHandlerHelper->HandleForm($oRequest, $aData['sMode'], $sObjectClass, $sObjectId); - $aData['form']['title'] = Dict::Format('Brick:Portal:Object:Form:View:Title', MetaModel::GetName($sObjectClass), - $oObject->GetName()); + $aData['form']['title'] = Dict::Format( + 'Brick:Portal:Object:Form:View:Title', + MetaModel::GetName($sObjectClass), + $oObject->GetName() + ); // Add an edit button if user is allowed if ($this->oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sObjectClass, $sObjectId)) { - $sModifyUrl = $this->oUrlGenerator->generate('p_object_edit', array('sObjectClass' => $sObjectClass, 'sObjectId' => $sObjectId)); + $sModifyUrl = $this->oUrlGenerator->generate('p_object_edit', ['sObjectClass' => $sObjectClass, 'sObjectId' => $sObjectId]); $oModifyButton = new JSButtonItem( 'modify_object', Dict::S('UI:Menu:Modify'), 'CombodoModal.OpenUrlInModal("'.$sModifyUrl.'", true);' ); // Putting this one first - $aData['form']['buttons']['actions'][] = $oModifyButton->GetMenuItem() + array('js_files' => $oModifyButton->GetLinkedScripts()); + $aData['form']['buttons']['actions'][] = $oModifyButton->GetMenuItem() + ['js_files' => $oModifyButton->GetLinkedScripts()]; } // Preparing response @@ -293,8 +305,7 @@ class ObjectController extends BrickController public function EditAction(Request $oRequest, $sObjectClass, $sObjectId) { // Checking parameters - if ($sObjectClass === '' || $sObjectId === '') - { + if ($sObjectClass === '' || $sObjectId === '') { IssueLog::Info(__METHOD__.' at line '.__LINE__.' : sObjectClass and sObjectId expected, "'.$sObjectClass.'" and "'.$sObjectId.'" given.'); throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, Dict::Format('UI:Error:2ParametersMissing', 'class', 'id')); } @@ -302,17 +313,19 @@ class ObjectController extends BrickController // Checking security layers // Warning : This is a dirty quick fix to allow editing its own contact information $bAllowWrite = ($sObjectClass === 'Person' && $sObjectId == UserRights::GetContactId()); - if (!$this->oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sObjectClass, $sObjectId) && !$bAllowWrite) - { + if (!$this->oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sObjectClass, $sObjectId) && !$bAllowWrite) { IssueLog::Warning(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' not allowed to modify '.$sObjectClass.'::'.$sObjectId.' object.'); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } // Retrieving object - $oObject = MetaModel::GetObject($sObjectClass, $sObjectId, false /* MustBeFound */, - $this->oScopeValidatorHelper->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass)); - if ($oObject === null) - { + $oObject = MetaModel::GetObject( + $sObjectClass, + $sObjectId, + false /* MustBeFound */, + $this->oScopeValidatorHelper->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass) + ); + if ($oObject === null) { // We should never be there as the secuirty helper makes sure that the object exists, but just in case. IssueLog::Info(__METHOD__.' at line '.__LINE__.' : Could not load object '.$sObjectClass.'::'.$sObjectId.'.'); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); @@ -320,33 +333,28 @@ class ObjectController extends BrickController $sOperation = $this->oRequestManipulatorHelper->ReadParam('operation', ''); - $aData = array('sMode' => 'edit'); + $aData = ['sMode' => 'edit']; $aData['form'] = $this->oObjectFormHandlerHelper->HandleForm($oRequest, $aData['sMode'], $sObjectClass, $sObjectId); - $aData['form']['title'] = Dict::Format('Brick:Portal:Object:Form:Edit:Title', MetaModel::GetName($sObjectClass), - $aData['form']['object_name']); + $aData['form']['title'] = Dict::Format( + 'Brick:Portal:Object:Form:Edit:Title', + MetaModel::GetName($sObjectClass), + $aData['form']['object_name'] + ); // Preparing response - if ($oRequest->isXmlHttpRequest()) - { + if ($oRequest->isXmlHttpRequest()) { // We have to check whether the 'operation' parameter is defined or not in order to know if the form is required via ajax (to be displayed as a modal dialog) or if it's a lifecycle call from a existing form. - if (empty($sOperation)) - { + if (empty($sOperation)) { $oResponse = $this->render($this->GetTemplatePath('modal'), $aData); - } - else - { + } else { $oResponse = new JsonResponse($aData); } - } - else - { + } else { // Adding brick if it was passed $sBrickId = $this->oRequestManipulatorHelper->ReadParam('sBrickId', ''); - if (!empty($sBrickId)) - { + if (!empty($sBrickId)) { $oBrick = $this->oBrickCollection->GetBrickById($sBrickId); - if ($oBrick !== null) - { + if ($oBrick !== null) { $aData['oBrick'] = $oBrick; } } @@ -376,13 +384,11 @@ class ObjectController extends BrickController $oResponse = null; // Checking if the target object class is abstract or not // - If is not abstract, we redirect to object creation form - if (!MetaModel::IsAbstract($sObjectClass)) - { + if (!MetaModel::IsAbstract($sObjectClass)) { $oResponse = $this->DisplayCreationForm($oRequest, $sObjectClass); } // - Else, we list the leaf classes as an intermediate step - else - { + else { $oResponse = $this->DisplayLeafClassesForm($sObjectClass); } @@ -408,11 +414,12 @@ class ObjectController extends BrickController $sMethodName = base64_decode($sEncodedMethodName); // Checking that the factory method is valid - if (!is_callable($sMethodName)) - { + if (!is_callable($sMethodName)) { IssueLog::Error(__METHOD__.' at line '.__LINE__.' : Invalid factory method "'.$sMethodName.'" used when creating an object.'); - throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, - 'Invalid factory method "'.$sMethodName.'" used when creating an object'); + throw new HttpException( + Response::HTTP_INTERNAL_SERVER_ERROR, + 'Invalid factory method "'.$sMethodName.'" used when creating an object' + ); } // Retrieving origin object @@ -420,12 +427,9 @@ class ObjectController extends BrickController $oOriginObject = MetaModel::GetObject($sObjectClass, $sObjectId, true, true); // Retrieving target object (We check if the method is a simple function or if it's part of a class in which case only static function are supported) - if (!strpos($sMethodName, '::')) - { + if (!strpos($sMethodName, '::')) { $oTargetObject = $sMethodName($oOriginObject); - } - else - { + } else { $aMethodNameParts = explode('::', $sMethodName); $sMethodClass = $aMethodNameParts[0]; $sMethodName = $aMethodNameParts[1]; @@ -434,9 +438,9 @@ class ObjectController extends BrickController // Preparing redirection // - Route - $aRouteParams = array( + $aRouteParams = [ 'sObjectClass' => get_class($oTargetObject), - ); + ]; return $this->ForwardToRoute('p_object_create', $aRouteParams, $oRequest->query->all()); } @@ -462,28 +466,26 @@ class ObjectController extends BrickController $aCombodoPortalInstanceConf = $this->getParameter('combodo.portal.instance.conf'); // Checking parameters - if ($sObjectClass === '' || $sObjectId === '' || $sStimulusCode === '') - { + if ($sObjectClass === '' || $sObjectId === '' || $sStimulusCode === '') { IssueLog::Info(__METHOD__.' at line '.__LINE__.' : sObjectClass, sObjectId and $sStimulusCode expected, "'.$sObjectClass.'", "'.$sObjectId.'" and "'.$sStimulusCode.'" given.'); - throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, - Dict::Format('UI:Error:3ParametersMissing', 'class', 'id', 'stimulus')); + throw new HttpException( + Response::HTTP_INTERNAL_SERVER_ERROR, + Dict::Format('UI:Error:3ParametersMissing', 'class', 'id', 'stimulus') + ); } // Checking security layers - if (!$this->oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sObjectClass, $sObjectId)) - { + if (!$this->oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sObjectClass, $sObjectId)) { IssueLog::Warning(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' not allowed to modify '.$sObjectClass.'::'.$sObjectId.' object.'); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } - if (!$this->oSecurityHelper->IsStimulusAllowed($sStimulusCode, $sObjectClass)) - { + if (!$this->oSecurityHelper->IsStimulusAllowed($sStimulusCode, $sObjectClass)) { throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } // Retrieving object - $oObject = MetaModel::GetObject($sObjectClass, $sObjectId, false /* MustBeFound */, $this->oScopeValidatorHelper->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass)); - if ($oObject === null) - { + $oObject = MetaModel::GetObject($sObjectClass, $sObjectId, false /* MustBeFound */, $this->oScopeValidatorHelper->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass)); + if ($oObject === null) { // We should never be there as the secuirty helper makes sure that the object exists, but just in case. IssueLog::Info(__METHOD__.' at line '.__LINE__.' : Could not load object '.$sObjectClass.'::'.$sObjectId.'.'); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); @@ -494,38 +496,34 @@ class ObjectController extends BrickController // Retrieving form properties $aStimuliForms = ApplicationHelper::GetLoadedFormFromClass($aCombodoPortalInstanceConf['forms'], $sObjectClass, 'apply_stimulus'); - if (array_key_exists($sStimulusCode, $aStimuliForms)) - { + if (array_key_exists($sStimulusCode, $aStimuliForms)) { $aFormProperties = $aStimuliForms[$sStimulusCode]; } // Or preparing a default form for the stimulus application - else - { + else { // Preparing default form - $aFormProperties = array( + $aFormProperties = [ 'id' => 'apply-stimulus', 'type' => 'custom_list', - 'fields' => array(), + 'fields' => [], 'layout' => null, - ); + ]; } // Adding stimulus code to form $aFormProperties['stimulus_code'] = $sStimulusCode; // Adding target_state to current_values - $oRequest->request->set('apply_stimulus', array('code' => $sStimulusCode)); + $oRequest->request->set('apply_stimulus', ['code' => $sStimulusCode]); - $aData = array('sMode' => 'apply_stimulus'); + $aData = ['sMode' => 'apply_stimulus']; $aData['form'] = $this->oObjectFormHandlerHelper->HandleForm($oRequest, $aData['sMode'], $sObjectClass, $sObjectId, $aFormProperties); $aData['form']['title'] = Dict::Format('Brick:Portal:Object:Form:Stimulus:Title'); // TODO : This is a ugly patch to avoid showing a modal with a readonly form to the user as it would prevent user from finishing the transition. // Instead, we apply the stimulus directly here and then go to the edited object. - if (empty($sOperation)) - { - if (isset($aData['form']['editable_fields_count']) && $aData['form']['editable_fields_count'] === 0) - { + if (empty($sOperation)) { + if (isset($aData['form']['editable_fields_count']) && $aData['form']['editable_fields_count'] === 0) { $sOperation = 'redirect'; $oSubRequest = $oRequest; @@ -534,43 +532,40 @@ class ObjectController extends BrickController $oSubRequest->request->set('formmanager_class', $aData['form']['formmanager_class']); $oSubRequest->request->set('formmanager_data', json_encode($aData['form']['formmanager_data'])); - $aData = array('sMode' => 'apply_stimulus'); - $aData['form'] = $this->oObjectFormHandlerHelper->HandleForm($oSubRequest, $aData['sMode'], $sObjectClass, $sObjectId, - $aFormProperties); + $aData = ['sMode' => 'apply_stimulus']; + $aData['form'] = $this->oObjectFormHandlerHelper->HandleForm( + $oSubRequest, + $aData['sMode'], + $sObjectClass, + $sObjectId, + $aFormProperties + ); // Reload the object to make sure we have it in a clean state $oObject->Reload(true); $aNavigationRules = $this->oNavigationRuleHelper->PrepareRulesForForm($aFormProperties, $oObject, true); // Redefining the array to be as simple as possible : - $aData = array( + $aData = [ 'redirection' => - array( + [ 'url' => $aNavigationRules['submit']['url'], - ), - ); + ], + ]; } } // Preparing response - if ($oRequest->isXmlHttpRequest()) - { + if ($oRequest->isXmlHttpRequest()) { // We have to check whether the 'operation' parameter is defined or not in order to know if the form is required via ajax (to be displayed as a modal dialog) or if it's a lifecycle call from a existing form. - if (empty($sOperation)) - { + if (empty($sOperation)) { $oResponse = $this->render($this->GetTemplatePath('modal'), $aData); - } - elseif ($sOperation === 'redirect') - { + } elseif ($sOperation === 'redirect') { $oResponse = $this->render($this->GetTemplatePath('mode_loader'), $aData); - } - else - { + } else { $oResponse = new JsonResponse($aData); } - } - else - { + } else { $oResponse = $this->render($this->GetTemplatePath('page'), $aData); } @@ -598,19 +593,18 @@ class ObjectController extends BrickController public function SearchAutocompleteAction(Request $oRequest, $sTargetAttCode, $sHostObjectClass, $sHostObjectId = null) { - $aData = array( - 'results' => array( + $aData = [ + 'results' => [ 'count' => 0, - 'items' => array(), - ), - ); + 'items' => [], + ], + ]; // Parsing parameters from request payload parse_str($oRequest->getContent(), $aRequestContent); // Checking parameters - if (!isset($aRequestContent['sQuery'])) - { + if (!isset($aRequestContent['sQuery'])) { IssueLog::Error(__METHOD__.' at line '.__LINE__.' : Parameter sQuery missing.'); throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, Dict::Format('UI:Error:ParameterMissing', 'sQuery')); } @@ -620,27 +614,23 @@ class ObjectController extends BrickController $sFieldId = $aRequestContent['sFieldId']; // Checking security layers - if (!$this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sHostObjectClass, $sHostObjectId)) - { + if (!$this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sHostObjectClass, $sHostObjectId)) { IssueLog::Warning(__METHOD__.' at line '.__LINE__.' : Could not load object '.$sHostObjectClass.'::'.$sHostObjectId.'.'); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } // Retrieving host object for future DBSearch parameters - if ($sHostObjectId !== null) - { + if ($sHostObjectId !== null) { // Note : AllowAllData set to true here instead of checking scope's flag because we are displaying a value that has been set and validated $oHostObject = MetaModel::GetObject($sHostObjectClass, $sHostObjectId, true, true); - } - else - { + } else { $oHostObject = MetaModel::NewObject($sHostObjectClass); // Retrieving action rules // // Note : The action rules must be a base64-encoded JSON object, this is just so users are tempted to changes values. // But it would not be a security issue as it only presets values in the form. $sActionRulesToken = $this->oRequestManipulatorHelper->ReadParam('ar_token', ''); - $aActionRules = (!empty($sActionRulesToken)) ? $this->oContextManipulatorHelper->DecodeRulesToken($sActionRulesToken) : array(); + $aActionRules = (!empty($sActionRulesToken)) ? $this->oContextManipulatorHelper->DecodeRulesToken($sActionRulesToken) : []; // Preparing object $this->oContextManipulatorHelper->PrepareObject($aActionRules, $oHostObject); } @@ -663,78 +653,67 @@ class ObjectController extends BrickController } // Updating host object - $oFormManager->OnUpdate(array('currentValues' => $aRequestContent['current_values'])); + $oFormManager->OnUpdate(['currentValues' => $aRequestContent['current_values']]); $oHostObject = $oFormManager->GetObject(); } // Building search query // - Retrieving target object class from attcode $oTargetAttDef = MetaModel::GetAttributeDef($sHostObjectClass, $sTargetAttCode); - if ($oTargetAttDef->GetEditClass() === 'CustomFields') - { + if ($oTargetAttDef->GetEditClass() === 'CustomFields') { $oRequestTemplate = $oHostObject->Get($sTargetAttCode); /** @var \DBSearch $oTemplateFieldSearch */ $oTemplateFieldSearch = $oRequestTemplate->GetForm()->GetField('user_data')->GetForm()->GetField($sFieldId)->GetSearch(); $sTargetObjectClass = $oTemplateFieldSearch->GetClass(); - } - elseif ($oTargetAttDef->IsLinkSet()) - { + } elseif ($oTargetAttDef->IsLinkSet()) { throw new Exception('Search autocomplete cannot apply on AttributeLinkedSet objects, '.get_class($oTargetAttDef).' ('.$sHostObjectClass.'->'.$sTargetAttCode.') given.'); - } - else - { + } else { $sTargetObjectClass = $oTargetAttDef->GetTargetClass(); } // - Base query from meta model - if ($oTargetAttDef->GetEditClass() === 'CustomFields') - { + if ($oTargetAttDef->GetEditClass() === 'CustomFields') { $oSearch = $oTemplateFieldSearch; - } - else - { + } else { $oSearch = DBSearch::FromOQL($oTargetAttDef->GetValuesDef()->GetFilterExpression()); } // - Adding query condition - $oSearch->AddConditionExpression(new BinaryExpression(new FieldExpression('friendlyname', $oSearch->GetClassAlias()), 'LIKE', - new VariableExpression('ac_query'))); + $oSearch->AddConditionExpression(new BinaryExpression( + new FieldExpression('friendlyname', $oSearch->GetClassAlias()), + 'LIKE', + new VariableExpression('ac_query') + )); // - Intersecting with scope constraints // Note : This do NOT apply to custom fields as the portal administrator is not supposed to know which objects will be put in the templates. // It is the responsibility of the template designer to write the right query so the user see only what he should. - if ($oTargetAttDef->GetEditClass() !== 'CustomFields') - { + if ($oTargetAttDef->GetEditClass() !== 'CustomFields') { $oScopeSearch = $this->oScopeValidatorHelper->GetScopeFilterForProfiles(UserRights::ListProfiles(), $sTargetObjectClass, UR_ACTION_READ); $oSearch = $oSearch->Intersect($oScopeSearch); // - Allowing all data if necessary - if ($oScopeSearch->IsAllDataAllowed()) - { + if ($oScopeSearch->IsAllDataAllowed()) { $oSearch->AllowAllData(); } } // Retrieving results // - Preparing object set - $oSet = new DBObjectSet($oSearch, array(), array('this' => $oHostObject, 'ac_query' => '%'.$sQuery.'%')); - $oSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => array('friendlyname'))); + $oSet = new DBObjectSet($oSearch, [], ['this' => $oHostObject, 'ac_query' => '%'.$sQuery.'%']); + $oSet->OptimizeColumnLoad([$oSearch->GetClassAlias() => ['friendlyname']]); // Note : This limit is also used in the field renderer by typeahead to determine how many suggestions to display $oSet->SetLimit(MetaModel::GetConfig()->Get('max_autocomplete_results')); // - Retrieving objects - while ($oItem = $oSet->Fetch()) - { - $aData['results']['items'][] = array( + while ($oItem = $oSet->Fetch()) { + $aData['results']['items'][] = [ 'id' => $oItem->GetKey(), 'name' => html_entity_decode($oItem->GetName(), ENT_QUOTES, 'UTF-8'), - ); + ]; $aData['results']['count']++; } // Preparing response - if ($oRequest->isXmlHttpRequest()) - { + if ($oRequest->isXmlHttpRequest()) { $oResponse = new JsonResponse($aData); - } - else - { + } else { throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } @@ -767,35 +746,31 @@ class ObjectController extends BrickController /** @var array $aCombodoPortalInstanceConf */ $aCombodoPortalInstanceConf = $this->getParameter('combodo.portal.instance.conf'); - $aData = array( + $aData = [ 'sMode' => 'search_regular', 'sTargetAttCode' => $sTargetAttCode, 'sHostObjectClass' => $sHostObjectClass, 'sHostObjectId' => $sHostObjectId, 'sActionRulesToken' => $this->oRequestManipulatorHelper->ReadParam('ar_token', ''), - ); + ]; // Checking security layers - if (!$this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sHostObjectClass, $sHostObjectId)) - { + if (!$this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sHostObjectClass, $sHostObjectId)) { IssueLog::Warning(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' not allowed to read '.$sHostObjectClass.'::'.$sHostObjectId.' object.'); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } // Retrieving host object for future DBSearch parameters - if ($sHostObjectId !== null) - { + if ($sHostObjectId !== null) { // Note : AllowAllData set to true here instead of checking scope's flag because we are displaying a value that has been set and validated $oHostObject = MetaModel::GetObject($sHostObjectClass, $sHostObjectId, true, true); - } - else - { + } else { $oHostObject = MetaModel::NewObject($sHostObjectClass); // Retrieving action rules // // Note : The action rules must be a base64-encoded JSON object, this is just so users are tempted to changes values. // But it would not be a security issue as it only presets values in the form. - $aActionRules = !empty($aData['sActionRulesToken']) ? ContextManipulatorHelper::DecodeRulesToken($aData['sActionRulesToken']) : array(); + $aActionRules = !empty($aData['sActionRulesToken']) ? ContextManipulatorHelper::DecodeRulesToken($aData['sActionRulesToken']) : []; // Preparing object $this->oContextManipulatorHelper->PrepareObject($aActionRules, $oHostObject); } @@ -818,9 +793,9 @@ class ObjectController extends BrickController } // Updating host object - $oFormManager->OnUpdate(array( - 'currentValues' => $this->oRequestManipulatorHelper->ReadParam('current_values', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), - )); + $oFormManager->OnUpdate([ + 'currentValues' => $this->oRequestManipulatorHelper->ReadParam('current_values', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), + ]); $oHostObject = $oFormManager->GetObject(); } @@ -836,35 +811,25 @@ class ObjectController extends BrickController // Building search query // - Retrieving target object class from attcode $oTargetAttDef = MetaModel::GetAttributeDef($sHostObjectClass, $sTargetAttCode); - if ($oTargetAttDef->IsExternalKey()) - { + if ($oTargetAttDef->IsExternalKey()) { /** @var \AttributeExternalKey $oTargetAttDef */ $sTargetObjectClass = $oTargetAttDef->GetTargetClass(); - } - elseif ($oTargetAttDef->IsLinkSet()) - { + } elseif ($oTargetAttDef->IsLinkSet()) { /** @var \AttributeLinkedSet $oTargetAttDef */ - if (!$oTargetAttDef->IsIndirect()) - { + if (!$oTargetAttDef->IsIndirect()) { $sTargetObjectClass = $oTargetAttDef->GetLinkedClass(); - } - else - { + } else { /** @var \AttributeLinkedSetIndirect $oTargetAttDef */ /** @var \AttributeExternalKey $oRemoteAttDef */ $oRemoteAttDef = MetaModel::GetAttributeDef($oTargetAttDef->GetLinkedClass(), $oTargetAttDef->GetExtKeyToRemote()); $sTargetObjectClass = $oRemoteAttDef->GetTargetClass(); } - } - elseif ($oTargetAttDef->GetEditClass() === 'CustomFields') - { + } elseif ($oTargetAttDef->GetEditClass() === 'CustomFields') { $oRequestTemplate = $oHostObject->Get($sTargetAttCode); /** @var \DBSearch $oTemplateFieldSearch */ $oTemplateFieldSearch = $oRequestTemplate->GetForm()->GetField('user_data')->GetForm()->GetField($sFieldId)->GetSearch(); $sTargetObjectClass = $oTemplateFieldSearch->GetClass(); - } - else - { + } else { throw new Exception('Search from attribute can only apply on AttributeExternalKey or AttributeLinkedSet objects, '.get_class($oTargetAttDef).' given.'); } @@ -872,101 +837,89 @@ class ObjectController extends BrickController $aAttCodes = ApplicationHelper::GetLoadedListFromClass($aCombodoPortalInstanceConf['lists'], $sTargetObjectClass, 'list'); // - Adding friendlyname attribute to the list is not already in it $sTitleAttCode = 'friendlyname'; - if (($sTitleAttCode !== null) && !in_array($sTitleAttCode, $aAttCodes)) - { - $aAttCodes = array_merge(array($sTitleAttCode), $aAttCodes); + if (($sTitleAttCode !== null) && !in_array($sTitleAttCode, $aAttCodes)) { + $aAttCodes = array_merge([$sTitleAttCode], $aAttCodes); } // - Retrieving scope search // Note : This do NOT apply to custom fields as the portal administrator is not supposed to know which objects will be put in the templates. // It is the responsibility of the template designer to write the right query so the user see only what he should. $oScopeSearch = $this->oScopeValidatorHelper->GetScopeFilterForProfiles(UserRights::ListProfiles(), $sTargetObjectClass, UR_ACTION_READ); - $aInternalParams = array(); - if (($oScopeSearch === null) && ($oTargetAttDef->GetEditClass() !== 'CustomFields')) - { + $aInternalParams = []; + if (($oScopeSearch === null) && ($oTargetAttDef->GetEditClass() !== 'CustomFields')) { IssueLog::Info(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' has no scope query for '.$sTargetObjectClass.' class.'); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } // - Base query from meta model /** @var \DBSearch $oSearch */ - if ($oTargetAttDef->IsExternalKey()) - { + if ($oTargetAttDef->IsExternalKey()) { $oSearch = DBSearch::FromOQL($oTargetAttDef->GetValuesDef()->GetFilterExpression()); - } - elseif ($oTargetAttDef->IsLinkSet()) - { + } elseif ($oTargetAttDef->IsLinkSet()) { $oSearch = $oScopeSearch; - } - elseif ($oTargetAttDef->GetEditClass() === 'CustomFields') - { + } elseif ($oTargetAttDef->GetEditClass() === 'CustomFields') { // Note : $oTemplateFieldSearch has been defined in the "Retrieving target object class from attcode" part, it is not available otherwise $oSearch = $oTemplateFieldSearch; } // - Filtering objects to ignore - if (($aObjectIdsToIgnore !== null) && (is_array($aObjectIdsToIgnore))) - { + if (($aObjectIdsToIgnore !== null) && (is_array($aObjectIdsToIgnore))) { //$oSearch->AddConditionExpression('id', $aObjectIdsToIgnore, 'NOT IN'); - $aExpressions = array(); - foreach ($aObjectIdsToIgnore as $sObjectIdToIgnore) - { + $aExpressions = []; + foreach ($aObjectIdsToIgnore as $sObjectIdToIgnore) { $aExpressions[] = new ScalarExpression($sObjectIdToIgnore); } - $oSearch->AddConditionExpression(new BinaryExpression(new FieldExpression('id', $oSearch->GetClassAlias()), 'NOT IN', - new ListExpression($aExpressions))); + $oSearch->AddConditionExpression(new BinaryExpression( + new FieldExpression('id', $oSearch->GetClassAlias()), + 'NOT IN', + new ListExpression($aExpressions) + )); } // - Adding query condition $aInternalParams['this'] = $oHostObject; - if (!empty($sQuery)) - { + if (!empty($sQuery)) { $oFullExpr = null; /** @noinspection SlowArrayOperationsInLoopInspection */ - for ($i = 0; $i < count($aAttCodes); $i++) - { + for ($i = 0; $i < count($aAttCodes); $i++) { // Checking if the current attcode is an external key in order to search on the friendlyname $oAttDef = MetaModel::GetAttributeDef($sTargetObjectClass, $aAttCodes[$i]); $sAttCode = (!$oAttDef->IsExternalKey()) ? $aAttCodes[$i] : $aAttCodes[$i].'_friendlyname'; // Building expression for the current attcode // - For attributes that need conversion from their display value to storage value // Note : This is dirty hack that will need to be refactored in the OQL core in order to be nicer and to be extended to other types such as dates etc... - if (($oAttDef instanceof AttributeEnum) || ($oAttDef instanceof AttributeFinalClass)) - { + if (($oAttDef instanceof AttributeEnum) || ($oAttDef instanceof AttributeFinalClass)) { // Looking up storage value - $aMatchedCodes = array(); - foreach ($oAttDef->GetAllowedValues() as $sValueCode => $sValueLabel) - { - if (stripos($sValueLabel, $sQuery) !== false) - { + $aMatchedCodes = []; + foreach ($oAttDef->GetAllowedValues() as $sValueCode => $sValueLabel) { + if (stripos($sValueLabel, $sQuery) !== false) { $aMatchedCodes[] = $sValueCode; } } // Building expression - if (!empty($aMatchedCodes)) - { + if (!empty($aMatchedCodes)) { $oEnumeratedListExpr = ListExpression::FromScalars($aMatchedCodes); - $oBinExpr = new BinaryExpression(new FieldExpression($sAttCode, $oSearch->GetClassAlias()), 'IN', - $oEnumeratedListExpr); - } - else - { + $oBinExpr = new BinaryExpression( + new FieldExpression($sAttCode, $oSearch->GetClassAlias()), + 'IN', + $oEnumeratedListExpr + ); + } else { $oBinExpr = new FalseExpression(); } } // - For regular attributes - else - { - $oBinExpr = new BinaryExpression(new FieldExpression($sAttCode, $oSearch->GetClassAlias()), 'LIKE', - new VariableExpression('re_query')); + else { + $oBinExpr = new BinaryExpression( + new FieldExpression($sAttCode, $oSearch->GetClassAlias()), + 'LIKE', + new VariableExpression('re_query') + ); } // Adding expression to the full expression (all attcodes) - if ($i === 0) - { + if ($i === 0) { $oFullExpr = $oBinExpr; - } - else - { + } else { $oFullExpr = new BinaryExpression($oFullExpr, 'OR', $oBinExpr); } } @@ -978,79 +931,72 @@ class ObjectController extends BrickController // - Intersecting with scope constraints // Note : This do NOT apply to custom fields as the portal administrator is not supposed to know which objects will be put in the templates. // It is the responsibility of the template designer to write the right query so the user see only what he should. - if (($oScopeSearch !== null) && ($oTargetAttDef->GetEditClass() !== 'CustomFields')) - { + if (($oScopeSearch !== null) && ($oTargetAttDef->GetEditClass() !== 'CustomFields')) { $oSearch = $oSearch->Intersect($oScopeSearch); // - Allowing all data if necessary - if ($oScopeSearch->IsAllDataAllowed()) - { + if ($oScopeSearch->IsAllDataAllowed()) { $oSearch->AllowAllData(); } } // Retrieving results // - Preparing object set - $oSet = new DBObjectSet($oSearch, array(), $aInternalParams); - $oSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => $aAttCodes)); + $oSet = new DBObjectSet($oSearch, [], $aInternalParams); + $oSet->OptimizeColumnLoad([$oSearch->GetClassAlias() => $aAttCodes]); $oSet->SetLimit($iListLength, $iListLength * ($iPageNumber - 1)); // - Retrieving columns properties - $aColumnProperties = array(); - foreach ($aAttCodes as $sAttCode) - { + $aColumnProperties = []; + foreach ($aAttCodes as $sAttCode) { $oAttDef = MetaModel::GetAttributeDef($sTargetObjectClass, $sAttCode); - $aColumnProperties[$sAttCode] = array( + $aColumnProperties[$sAttCode] = [ 'title' => $oAttDef->GetLabel(), - ); + ]; } // - Retrieving objects - $aItems = array(); - while ($oItem = $oSet->Fetch()) - { + $aItems = []; + while ($oItem = $oSet->Fetch()) { $aItems[] = $this->PrepareObjectInformation($oItem, $aAttCodes); } // Preparing response - if ($bInitialPass) - { - $aData = $aData + array( - 'form' => array( + if ($bInitialPass) { + $aData = $aData + [ + 'form' => [ 'id' => 'object_search_form_'.time(), - 'title' => Dict::Format('Brick:Portal:Object:Search:Regular:Title', $oTargetAttDef->GetLabel(), - MetaModel::GetName($sTargetObjectClass)), - ), + 'title' => Dict::Format( + 'Brick:Portal:Object:Search:Regular:Title', + $oTargetAttDef->GetLabel(), + MetaModel::GetName($sTargetObjectClass) + ), + ], 'aColumnProperties' => json_encode($aColumnProperties), - 'aResults' => array( + 'aResults' => [ 'aItems' => json_encode($aItems), 'iCount' => count($aItems), - ), + ], 'bMultipleSelect' => $oTargetAttDef->IsLinkSet(), - 'aSource' => array( + 'aSource' => [ 'sFormPath' => $sFormPath, 'sFieldId' => $sFieldId, 'aObjectIdsToIgnore' => $aObjectIdsToIgnore, 'sFormManagerClass' => $sFormManagerClass, 'sFormManagerData' => $sFormManagerData, - ), - ); + ], + ]; - if ($oRequest->isXmlHttpRequest()) - { + if ($oRequest->isXmlHttpRequest()) { $oResponse = $this->render($this->GetTemplatePath('modal'), $aData); - } - else - { + } else { //throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); $oResponse = $this->render($this->GetTemplatePath('page'), $aData); } - } - else - { - $aData = $aData + array( + } else { + $aData = $aData + [ 'levelsProperties' => $aColumnProperties, 'data' => $aItems, 'recordsTotal' => $oSet->Count(), 'recordsFiltered' => $oSet->Count(), - ); + ]; $oResponse = new JsonResponse($aData); } @@ -1076,8 +1022,7 @@ class ObjectController extends BrickController { // Setting default operation - if ($sOperation === null) - { + if ($sOperation === null) { $sOperation = 'display'; } @@ -1088,37 +1033,33 @@ class ObjectController extends BrickController $bCheckSecurity = true; // When reaching to an Attachment, we have to check security on its host object instead of the Attachment itself - if ($sObjectClass === 'Attachment') - { - + if ($sObjectClass === 'Attachment') { + $oAttachment = MetaModel::GetObject($sObjectClass, $sObjectId, false, true); if ($oAttachment === null) { throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } $sHostClass = $oAttachment->Get('item_class'); $sHostId = $oAttachment->Get('item_id'); - + // Attachments could be linked to host objects without an org_id. Retrieving the attachment would fail if enforced silos are based on org_id - if($oAttachment->Get('item_org_id') === 0 && ($sHostId > 0) && $this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sHostClass, $sHostId)) { + if ($oAttachment->Get('item_org_id') === 0 && ($sHostId > 0) && $this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sHostClass, $sHostId)) { $bCheckSecurity = false; } - - } - else - { + + } else { $sHostClass = $sObjectClass; $sHostId = $sObjectId; // Security bypass for the image attribute of a class - if(MetaModel::GetImageAttributeCode($sObjectClass) === $sObjectField) { + if (MetaModel::GetImageAttributeCode($sObjectClass) === $sObjectField) { $bCheckSecurity = false; } } // Checking security layers // Note: Checking if host object already exists as we can try to download document from an object that is being created - if (($bCheckSecurity === true) && ($sHostId > 0) && !$this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sHostClass, $sHostId)) - { + if (($bCheckSecurity === true) && ($sHostId > 0) && !$this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sHostClass, $sHostId)) { IssueLog::Warning(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' not allowed to retrieve document from attribute '.$sObjectField.' as it not allowed to read '.$sHostClass.'::'.$sHostId.' object.'); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } @@ -1126,27 +1067,22 @@ class ObjectController extends BrickController // Retrieving object $bAllowAllDataFlag = ($bCheckSecurity === false) ? true : $this->oScopeValidatorHelper->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sHostClass); $oObject = MetaModel::GetObject($sObjectClass, $sObjectId, false /* Must not be found */, $bAllowAllDataFlag); - if ($oObject === null) - { + if ($oObject === null) { IssueLog::Info(__METHOD__.' at line '.__LINE__.': Could not load object '.$sObjectClass.'::'.$sObjectId.'.'); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } // Setting cache timeout // Note: Attachment download should be handle through AttachmentAction() - if ($sObjectClass === 'Attachment') - { + if ($sObjectClass === 'Attachment') { // One year ahead: an attachment cannot change $iCacheSec = 31556926; - } - else - { + } else { $iCacheSec = $this->oRequestManipulatorHelper->ReadParam('cache', 0, FILTER_SANITIZE_NUMBER_INT); } - $aHeaders = array(); - if ($iCacheSec > 0) - { + $aHeaders = []; + if ($iCacheSec > 0) { $aHeaders['Expires'] = ''; $aHeaders['Cache-Control'] = 'no-transform, public,max-age='.$iCacheSec.',s-maxage='.$iCacheSec; // Reset the value set previously @@ -1197,32 +1133,26 @@ class ObjectController extends BrickController */ public function AttachmentAction(Request $oRequest, $sOperation = null) { - $aData = array( + $aData = [ 'att_id' => 0, 'preview' => false, 'msg' => '', - ); + ]; // Retrieving sOperation from request only if it wasn't forced (determined by the route) - if ($sOperation === null) - { + if ($sOperation === null) { $sOperation = $this->oRequestManipulatorHelper->ReadParam('operation', null); } - switch ($sOperation) - { + switch ($sOperation) { case 'add': $sFieldName = $this->oRequestManipulatorHelper->ReadParam('field_name', ''); $sObjectClass = $this->oRequestManipulatorHelper->ReadParam('object_class', ''); $sTempId = $this->oRequestManipulatorHelper->ReadParam('temp_id', ''); - if (empty($sObjectClass) || empty($sTempId)) - { + if (empty($sObjectClass) || empty($sTempId)) { $aData['error'] = Dict::Format('UI:Error:2ParametersMissing', 'object_class', 'temp_id'); - } - else - { - try - { + } else { + try { $oDocument = utils::ReadPostedDocument($sFieldName); /** @noinspection PhpUndefinedClassInspection */ /** @var \Attachment $oAttachment */ @@ -1249,25 +1179,23 @@ class ObjectController extends BrickController $aData['creation_date'] = $oAttachment->Get('creation_date'); $aData['user_id_friendlyname'] = $oAttachment->Get('user_id_friendlyname'); $aData['file_type'] = $oDocument->GetMimeType(); - } - catch (FileUploadException $e) - { + } catch (FileUploadException $e) { $aData['error'] = $e->GetMessage(); } } // Note : The Content-Type header is set to 'text/plain' in order to be IE9 compatible. Otherwise ('application/json') IE9 will download the response as a JSON file to the user computer... - $oResponse = new JsonResponse($aData, Response::HTTP_OK, array('Content-Type' => 'text/plain')); + $oResponse = new JsonResponse($aData, Response::HTTP_OK, ['Content-Type' => 'text/plain']); break; case 'download': // Preparing redirection // - Route - $aRouteParams = array( + $aRouteParams = [ 'sObjectClass' => 'Attachment', 'sObjectId' => $this->oRequestManipulatorHelper->ReadParam('sAttachmentId', null), 'sObjectField' => 'contents', - ); + ]; $oResponse = $this->ForwardToRoute('p_object_document_download', $aRouteParams, $oRequest->query->all()); @@ -1276,11 +1204,11 @@ class ObjectController extends BrickController case 'display': // Preparing redirection // - Route - $aRouteParams = array( + $aRouteParams = [ 'sObjectClass' => 'Attachment', 'sObjectId' => $this->oRequestManipulatorHelper->ReadParam('sAttachmentId', null), 'sObjectField' => 'contents', - ); + ]; $oResponse = $this->ForwardToRoute('p_object_document_display', $aRouteParams, $oRequest->query->all()); @@ -1315,21 +1243,23 @@ class ObjectController extends BrickController public function GetInformationAsJsonAction(Request $oRequest) { - $aData = array(); + $aData = []; // Retrieving parameters $sObjectClass = $this->oRequestManipulatorHelper->ReadParam('sObjectClass', ''); - $aObjectIds = $this->oRequestManipulatorHelper->ReadParam('aObjectIds', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); - $aObjectAttCodes = $this->oRequestManipulatorHelper->ReadParam('aObjectAttCodes', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); + $aObjectIds = $this->oRequestManipulatorHelper->ReadParam('aObjectIds', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); + $aObjectAttCodes = $this->oRequestManipulatorHelper->ReadParam('aObjectAttCodes', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); if (empty($sObjectClass) || empty($aObjectIds) || empty($aObjectAttCodes)) { - IssueLog::Info(__METHOD__.' at line '.__LINE__.' : sObjectClass, aObjectIds and aObjectAttCodes expected, "'.$sObjectClass.'", "'.implode('/', - $aObjectIds).'" given.'); + IssueLog::Info(__METHOD__.' at line '.__LINE__.' : sObjectClass, aObjectIds and aObjectAttCodes expected, "'.$sObjectClass.'", "'.implode( + '/', + $aObjectIds + ).'" given.'); throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, 'Invalid request data, some information are missing'); } // Building the search $bIgnoreSilos = $this->oScopeValidatorHelper->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass); - $aParams = array('objects_id' => $aObjectIds); + $aParams = ['objects_id' => $aObjectIds]; $oSearch = DBObjectSearch::FromOQL("SELECT $sObjectClass WHERE id IN (:objects_id)"); if (!$this->oScopeValidatorHelper->AddScopeToQuery($oSearch, $sObjectClass) ) { @@ -1339,13 +1269,13 @@ class ObjectController extends BrickController if ($bIgnoreSilos === true) { $oSearch->AllowAllData(); } - $oSet = new DBObjectSet($oSearch, array(), $aParams); - $oSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => $aObjectAttCodes)); + $oSet = new DBObjectSet($oSearch, [], $aParams); + $oSet->OptimizeColumnLoad([$oSearch->GetClassAlias() => $aObjectAttCodes]); // Checking that id is in the AttCodes // Note: We do that AFTER the array is used in OptimizeColumnLoad() because the function doesn't support this anymore. if (!in_array('id', $aObjectAttCodes)) { - $aObjectAttCodes = array_merge(array('id'), $aObjectAttCodes); + $aObjectAttCodes = array_merge(['id'], $aObjectAttCodes); } // Retrieving objects @@ -1374,47 +1304,48 @@ class ObjectController extends BrickController public function GetInformationForLinkedSetAsJsonAction(Request $oRequest) { // Data array - $aData = array( + $aData = [ 'js_inline' => '', 'css_inline' => '', - ); + ]; // Retrieving parameters $sObjectClass = $this->oRequestManipulatorHelper->ReadParam('sObjectClass', ''); $sLinkClass = $this->oRequestManipulatorHelper->ReadParam('sLinkClass', ''); - $aObjectIds = $this->oRequestManipulatorHelper->ReadParam('aObjectIds', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); - $aObjectAttCodes = $this->oRequestManipulatorHelper->ReadParam('aObjectAttCodes', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); - $aLinkAttCodes = $this->oRequestManipulatorHelper->ReadParam('aLinkAttCodes', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); - $sDateTimePickerWidgetParent = $this->oRequestManipulatorHelper->ReadParam('sDateTimePickerWidgetParent', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); + $aObjectIds = $this->oRequestManipulatorHelper->ReadParam('aObjectIds', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); + $aObjectAttCodes = $this->oRequestManipulatorHelper->ReadParam('aObjectAttCodes', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); + $aLinkAttCodes = $this->oRequestManipulatorHelper->ReadParam('aLinkAttCodes', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); + $sDateTimePickerWidgetParent = $this->oRequestManipulatorHelper->ReadParam('sDateTimePickerWidgetParent', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); if (!MetaModel::IsLinkClass($sLinkClass)) { IssueLog::Warning(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' asked for wrong lnk class '.$sLinkClass); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } if (empty($sObjectClass) || empty($aObjectIds) || empty($aObjectAttCodes)) { - IssueLog::Info(__METHOD__.' at line '.__LINE__.' : sObjectClass, aObjectIds and aObjectAttCodes expected, "'.$sObjectClass.'", "'.implode('/', - $aObjectIds).'" given.'); + IssueLog::Info(__METHOD__.' at line '.__LINE__.' : sObjectClass, aObjectIds and aObjectAttCodes expected, "'.$sObjectClass.'", "'.implode( + '/', + $aObjectIds + ).'" given.'); throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, 'Invalid request data, some information are missing'); } // Building the search $bIgnoreSilos = $this->oScopeValidatorHelper->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass); - $aParams = array('objects_id' => $aObjectIds); + $aParams = ['objects_id' => $aObjectIds]; $oSearch = DBObjectSearch::FromOQL("SELECT $sObjectClass WHERE id IN (:objects_id)"); if (!$this->oScopeValidatorHelper->AddScopeToQuery($oSearch, $sObjectClass)) { IssueLog::Warning(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' not allowed to read '.$sObjectClass.' object.'); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } - if ($bIgnoreSilos === true) - { + if ($bIgnoreSilos === true) { $oSearch->AllowAllData(); } - $oSet = new DBObjectSet($oSearch, array(), $aParams); - $oSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => $aObjectAttCodes)); + $oSet = new DBObjectSet($oSearch, [], $aParams); + $oSet->OptimizeColumnLoad([$oSearch->GetClassAlias() => $aObjectAttCodes]); // Checking that id is in the AttCodes // Note: We do that AFTER the array is used in OptimizeColumnLoad() because the function doesn't support this anymore. if (!in_array('id', $aObjectAttCodes)) { - $aObjectAttCodes = array_merge(array('id'), $aObjectAttCodes); + $aObjectAttCodes = array_merge(['id'], $aObjectAttCodes); } // Retrieving objects @@ -1445,7 +1376,7 @@ class ObjectController extends BrickController if ($oAttDef::GetFormFieldClass() === '\\Combodo\\iTop\\Form\\Field\\SelectObjectField') { $oFieldSearch = $oField->GetSearch(); $sFieldClass = $oFieldSearch->GetClass(); - if ($this->oScopeValidatorHelper->AddScopeToQuery($oFieldSearch, $sFieldClass)){ + if ($this->oScopeValidatorHelper->AddScopeToQuery($oFieldSearch, $sFieldClass)) { $oField->SetSearch($oFieldSearch); } else { $oField->SetSearch(DBObjectSearch::FromOQL("SELECT $sFieldClass WHERE 1=0")); @@ -1487,7 +1418,7 @@ class ObjectController extends BrickController * @throws \CoreException * @throws \Exception */ - protected function PrepareObjectInformation(DBObject $oObject, $aAttCodes = array()) + protected function PrepareObjectInformation(DBObject $oObject, $aAttCodes = []) { $sObjectClass = get_class($oObject); $aObjectData = [ @@ -1498,10 +1429,8 @@ class ObjectController extends BrickController // Retrieving attributes definitions $aAttDefs = []; - foreach ($aAttCodes as $sAttCode) - { - if ($sAttCode === 'id') - { + foreach ($aAttCodes as $sAttCode) { + if ($sAttCode === 'id') { continue; } @@ -1509,8 +1438,7 @@ class ObjectController extends BrickController } // Preparing attribute data - foreach ($aAttDefs as $oAttDef) - { + foreach ($aAttDefs as $oAttDef) { $aAttData = [ 'object_class' => $sObjectClass, 'object_id' => $oObject->GetKey(), @@ -1521,39 +1449,31 @@ class ObjectController extends BrickController // - Value raw // For simple fields, we get the raw (stored) value as well $bExcludeRawValue = false; - foreach (ApplicationHelper::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) - { - if (is_a($oAttDef, $sAttDefClassToExclude, true)) - { + foreach (ApplicationHelper::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) { + if (is_a($oAttDef, $sAttDefClassToExclude, true)) { $bExcludeRawValue = true; break; } } $aAttData['value_raw'] = ($bExcludeRawValue === false) ? $oObject->Get($oAttDef->GetCode()) : null; - - if ($oAttDef->IsExternalKey()) - { + if ($oAttDef->IsExternalKey()) { $aAttData['value_html'] = $oObject->GetAsHTML($oAttDef->GetCode().'_friendlyname'); // Checking if user can access object's external key - if ($this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $oAttDef->GetTargetClass())) - { - $aAttData['url'] = $this->oUrlGenerator->generate('p_object_view', - array('sObjectClass' => $oAttDef->GetTargetClass(), 'sObjectId' => $oObject->Get($oAttDef->GetCode()))); + if ($this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $oAttDef->GetTargetClass())) { + $aAttData['url'] = $this->oUrlGenerator->generate( + 'p_object_view', + ['sObjectClass' => $oAttDef->GetTargetClass(), 'sObjectId' => $oObject->Get($oAttDef->GetCode())] + ); } - } - elseif ($oAttDef->IsLinkSet()) - { + } elseif ($oAttDef->IsLinkSet()) { // We skip it continue; - } - elseif ($oAttDef instanceof AttributeImage) - { + } elseif ($oAttDef instanceof AttributeImage) { /** @var \ormDocument $oOrmDoc */ $oOrmDoc = $oObject->Get($oAttDef->GetCode()); - if (is_object($oOrmDoc) && !$oOrmDoc->IsEmpty()) - { + if (is_object($oOrmDoc) && !$oOrmDoc->IsEmpty()) { $sUrl = $this->oUrlGenerator->generate('p_object_document_display', [ 'sObjectClass' => get_class($oObject), 'sObjectId' => $oObject->GetKey(), @@ -1561,27 +1481,22 @@ class ObjectController extends BrickController 'cache' => 86400, 's' => $oOrmDoc->GetSignature(), ]); - } - else - { + } else { $sUrl = $oAttDef->Get('default_image'); } $aAttData['value_html'] = ''; - } - elseif ($oAttDef instanceof AttributeEnum) { + } elseif ($oAttDef instanceof AttributeEnum) { $aAttData['value_html'] = $oAttDef->GetAsPlainText($oObject->Get($oAttDef->GetCode())); - } - else - { + } else { $aAttData['value_html'] = $oAttDef->GetAsHTML($oObject->Get($oAttDef->GetCode())); - if ($oAttDef instanceof AttributeFriendlyName) - { + if ($oAttDef instanceof AttributeFriendlyName) { // Checking if user can access object - if ($this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sObjectClass)) - { - $aAttData['url'] = $this->oUrlGenerator->generate('p_object_view', - array('sObjectClass' => $sObjectClass, 'sObjectId' => $oObject->GetKey())); + if ($this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sObjectClass)) { + $aAttData['url'] = $this->oUrlGenerator->generate( + 'p_object_view', + ['sObjectClass' => $sObjectClass, 'sObjectId' => $oObject->GetKey()] + ); } } } @@ -1611,40 +1526,31 @@ class ObjectController extends BrickController protected function DisplayCreationForm(Request $oRequest, $sObjectClass) { // Checking security layers - if (!$this->oSecurityHelper->IsActionAllowed(UR_ACTION_CREATE, $sObjectClass)) - { + if (!$this->oSecurityHelper->IsActionAllowed(UR_ACTION_CREATE, $sObjectClass)) { IssueLog::Warning(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' not allowed to create '.$sObjectClass.' object.'); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } $sOperation = $this->oRequestManipulatorHelper->ReadParam('operation', ''); - $aData = array('sMode' => 'create'); + $aData = ['sMode' => 'create']; $aData['form'] = $this->oObjectFormHandlerHelper->HandleForm($oRequest, $aData['sMode'], $sObjectClass); $aData['form']['title'] = Dict::Format('Brick:Portal:Object:Form:Create:Title', MetaModel::GetName($sObjectClass)); // Preparing response - if ($oRequest->isXmlHttpRequest()) - { + if ($oRequest->isXmlHttpRequest()) { // We have to check whether the 'operation' parameter is defined or not in order to know if the form is required via ajax (to be displayed as a modal dialog) or if it's a lifecycle call from a existing form. - if (empty($sOperation)) - { + if (empty($sOperation)) { $oResponse = $this->render($this->GetTemplatePath('modal'), $aData); - } - else - { + } else { $oResponse = new JsonResponse($aData); } - } - else - { + } else { // Adding brick if it was passed $sBrickId = $this->oRequestManipulatorHelper->ReadParam('sBrickId', ''); - if (!empty($sBrickId)) - { + if (!empty($sBrickId)) { $oBrick = $this->oBrickCollection->GetBrickById($sBrickId); - if ($oBrick !== null) - { + if ($oBrick !== null) { $aData['oBrick'] = $oBrick; } } @@ -1671,17 +1577,16 @@ class ObjectController extends BrickController */ protected function DisplayLeafClassesForm($sObjectClass) { - $aData = array( - 'aLeafClasses' => array(), + $aData = [ + 'aLeafClasses' => [], 'sPageTitle' => Dict::Format('Brick:Portal:Object:Form:Create:Title', MetaModel::GetName($sObjectClass)), - 'sLeafClassesListId' => 'leaf_classes_list_' . uniqid(), + 'sLeafClassesListId' => 'leaf_classes_list_'.uniqid(), 'ar_token' => $this->oRequestManipulatorHelper->ReadParam('ar_token', ''), - ); + ]; $sTemplatePath = CreateBrick::DEFAULT_PAGE_TEMPLATE_PATH; $sBrickId = $this->oRequestManipulatorHelper->ReadParam('sBrickId', ''); - if (!empty($sBrickId)) - { + if (!empty($sBrickId)) { $oBrick = $this->oBrickCollection->GetBrickById($sBrickId); $sTemplatePath = $oBrick->GetTemplatePath('page'); @@ -1690,16 +1595,14 @@ class ObjectController extends BrickController $aData['sPageTitle'] = $oBrick->GetTitle(); } - $aLeafClasses = array(); + $aLeafClasses = []; $aChildClasses = MetaModel::EnumChildClasses($sObjectClass); - foreach ($aChildClasses as $sChildClass) - { - if (!MetaModel::IsAbstract($sChildClass) && $this->oSecurityHelper->IsActionAllowed(UR_ACTION_CREATE, $sChildClass)) - { - $aLeafClasses[] = array( + foreach ($aChildClasses as $sChildClass) { + if (!MetaModel::IsAbstract($sChildClass) && $this->oSecurityHelper->IsActionAllowed(UR_ACTION_CREATE, $sChildClass)) { + $aLeafClasses[] = [ 'id' => $sChildClass, 'name' => MetaModel::GetName($sChildClass), - ); + ]; } } $aData['aLeafClasses'] = $aLeafClasses; diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/SessionMessageController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/SessionMessageController.php index f6fb63300..1499898af 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/SessionMessageController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/SessionMessageController.php @@ -36,7 +36,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException; */ class SessionMessageController extends AbstractController { - /** * @param \Combodo\iTop\Portal\Helper\RequestManipulatorHelper $oRequestManipulatorHelper * @param \Combodo\iTop\Portal\Helper\SessionMessageHelper $oSessionMessageHelper @@ -46,8 +45,7 @@ class SessionMessageController extends AbstractController public function __construct( protected RequestManipulatorHelper $oRequestManipulatorHelper, protected SessionMessageHelper $oSessionMessageHelper - ) - { + ) { } /** @@ -57,15 +55,14 @@ class SessionMessageController extends AbstractController */ public function AddMessageAction(Request $oRequest) { - $aData = array(); + $aData = []; // Retrieve parameters $sMessageSeverity = $this->oRequestManipulatorHelper->ReadParam('sSeverity'); $sMessageContent = $this->oRequestManipulatorHelper->ReadParam('sContent'); // Check parameters consistency - if (empty($sMessageSeverity) || empty($sMessageContent)) - { + if (empty($sMessageSeverity) || empty($sMessageContent)) { throw new HttpException(Response::HTTP_BAD_REQUEST, 'Message must have a severity and a content, make sure both sSeverity & sContent parameters are sent.'); } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/UserProfileBrickController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/UserProfileBrickController.php index 32f9c2184..6b53e8908 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/UserProfileBrickController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/UserProfileBrickController.php @@ -45,6 +45,7 @@ use Symfony\Component\HttpKernel\Exception\HttpException; use UserRights; use utils; use Dict; + /** * Class UserProfileBrickController * @@ -60,7 +61,7 @@ class UserProfileBrickController extends BrickController * @param \Combodo\iTop\Portal\Brick\BrickCollection $oBrickCollection * @param \Combodo\iTop\Portal\Routing\UrlGenerator $oUrlGenerator * @param \Combodo\iTop\Portal\Helper\SecurityHelper $oSecurityHelper - + * * @since 3.2.0 N°6933 */ @@ -70,12 +71,11 @@ class UserProfileBrickController extends BrickController protected BrickCollection $oBrickCollection, protected UrlGenerator $oUrlGenerator, protected SecurityHelper $oSecurityHelper - ) - { + ) { } /** @var string ENUM_FORM_TYPE_PICTURE */ - const ENUM_FORM_TYPE_PICTURE = 'picture'; + public const ENUM_FORM_TYPE_PICTURE = 'picture'; /** * @param \Symfony\Component\HttpFoundation\Request $oRequest @@ -92,26 +92,20 @@ class UserProfileBrickController extends BrickController public function DisplayAction(Request $oRequest, $sBrickId) { // If the brick id was not specified, we get the first one registered that is an instance of UserProfileBrick as default - if ($sBrickId === null) - { + if ($sBrickId === null) { /** @var \Combodo\iTop\Portal\Brick\PortalBrick $oTmpBrick */ - foreach ($this->oBrickCollection->GetBricks() as $oTmpBrick) - { - if ($oTmpBrick instanceof UserProfileBrick) - { + foreach ($this->oBrickCollection->GetBricks() as $oTmpBrick) { + if ($oTmpBrick instanceof UserProfileBrick) { $oBrick = $oTmpBrick; } } // We make sure a UserProfileBrick was found - if (!isset($oBrick) || $oBrick === null) - { + if (!isset($oBrick) || $oBrick === null) { $oBrick = new UserProfileBrick(); //throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, 'UserProfileBrick : Brick could not be loaded as there was no UserProfileBrick loaded in the application.'); } - } - else - { + } else { $oBrick = $this->oBrickCollection->GetBrickById($sBrickId); } @@ -124,11 +118,14 @@ class UserProfileBrickController extends BrickController $sTab = $this->oRequestManipulatorHelper->ReadParam('sTab', 'user-info', FILTER_UNSAFE_RAW, FILTER_FLAG_EMPTY_STRING_NULL); // If this is ajax call, we are just submitting preferences or password forms - if ($oRequest->isXmlHttpRequest()) - { + if ($oRequest->isXmlHttpRequest()) { if ($sTab === "user-info") { - $aCurrentValues = $this->oRequestManipulatorHelper->ReadParam('current_values', array(), FILTER_UNSAFE_RAW, - FILTER_REQUIRE_ARRAY); + $aCurrentValues = $this->oRequestManipulatorHelper->ReadParam( + 'current_values', + [], + FILTER_UNSAFE_RAW, + FILTER_REQUIRE_ARRAY + ); $sFormType = $aCurrentValues['form_type']; if ($sFormType === PreferencesFormManager::FORM_TYPE) { $aData['form'] = $this->HandlePreferencesForm($oRequest, $sFormMode); @@ -143,8 +140,7 @@ class UserProfileBrickController extends BrickController $oResponse = new JsonResponse($aData); } // Else, we are displaying page for first time - else - { + else { if ($sTab === "user-info") { // Retrieving current contact /** @var \DBObject $oCurContact */ @@ -175,7 +171,6 @@ class UserProfileBrickController extends BrickController return $oResponse; } - private function ManageUserProfileBrickExtensibility(string $sTab, array &$aData): void { $aData['sTab'] = $sTab; @@ -193,7 +188,7 @@ class UserProfileBrickController extends BrickController // Read the current tab content From iPortalTabSectionExtension $aTabSectionExtensions = ExtensibilityHelper::GetInstance()->GetPortalTabContentExtensions(iUserProfileTabContentExtension::class, $sTab); - if (count($aTabSectionExtensions) !== 0 && count($_POST) !== 0){ + if (count($aTabSectionExtensions) !== 0 && count($_POST) !== 0) { $sTransactionId = utils::ReadPostedParam('transaction_id', null, utils::ENUM_SANITIZATION_FILTER_TRANSACTION_ID); IssueLog::Debug(__FUNCTION__.": transaction [$sTransactionId]"); if (utils::IsNullOrEmptyString($sTransactionId) || !utils::IsTransactionValid($sTransactionId, false)) { @@ -214,30 +209,28 @@ class UserProfileBrickController extends BrickController } } + public function EditPerson(Request $oRequest) + { + $oCurContact = UserRights::GetContactObject(); + $sObjectClass = get_class($oCurContact); + $sObjectId = $oCurContact->GetKey(); - public function EditPerson(Request $oRequest) - { - $oCurContact = UserRights::GetContactObject(); - $sObjectClass = get_class($oCurContact); - $sObjectId = $oCurContact->GetKey(); + // Checking security layers + // Warning : This is a dirty quick fix to allow editing its own contact information + $bAllowWrite = ($sObjectClass === 'Person' && $sObjectId == UserRights::GetContactId()); + if (!$this->oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sObjectClass, $sObjectId) && !$bAllowWrite) { + IssueLog::Warning(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' not allowed to modify '.$sObjectClass.'::'.$sObjectId.' object.'); + throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); + } - // Checking security layers - // Warning : This is a dirty quick fix to allow editing its own contact information - $bAllowWrite = ($sObjectClass === 'Person' && $sObjectId == UserRights::GetContactId()); - if (!$this->oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sObjectClass, $sObjectId) && !$bAllowWrite) { - IssueLog::Warning(__METHOD__ . ' at line ' . __LINE__ . ' : User #' . UserRights::GetUserId() . ' not allowed to modify ' . $sObjectClass . '::' . $sObjectId . ' object.'); - throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); - } + $aForm = $this->GetBrick()->GetForm(); + $aForm['submit_endpoint'] = $this->generateUrl('p_user_profile_brick_edit_person'); - $aForm = $this->GetBrick()->GetForm(); - $aForm['submit_endpoint'] = $this->generateUrl('p_user_profile_brick_edit_person'); - - $aData = ['sMode' => 'edit']; - $aData['form'] = $this->ObjectFormHandlerHelper->HandleForm($oRequest, $aData['sMode'], $sObjectClass, $sObjectId, $aForm); - - return new JsonResponse($aData); - } + $aData = ['sMode' => 'edit']; + $aData['form'] = $this->ObjectFormHandlerHelper->HandleForm($oRequest, $aData['sMode'], $sObjectClass, $sObjectId, $aForm); + return new JsonResponse($aData); + } /** * @param \Symfony\Component\HttpFoundation\Request $oRequest @@ -249,13 +242,12 @@ class UserProfileBrickController extends BrickController */ public function HandlePreferencesForm(Request $oRequest, $sFormMode) { - $aFormData = array(); + $aFormData = []; // Handling form $sOperation = $this->oRequestManipulatorHelper->ReadParam('operation', null); // - Create - if ($sOperation === null) - { + if ($sOperation === null) { // - Creating renderer $oFormRenderer = new BsFormRenderer(); $oFormRenderer->SetEndpoint($this->oUrlGenerator->generate('p_user_profile_brick')); @@ -264,50 +256,47 @@ class UserProfileBrickController extends BrickController $oFormManager->SetRenderer($oFormRenderer) ->Build(); // - Checking if we have to make the form read only - if ($sFormMode === ObjectFormHandlerHelper::ENUM_MODE_VIEW) - { + if ($sFormMode === ObjectFormHandlerHelper::ENUM_MODE_VIEW) { $oFormManager->GetForm()->MakeReadOnly(); } } // - Submit - else - { - if ($sOperation === 'submit') - { + else { + if ($sOperation === 'submit') { $sFormManagerClass = $this->oRequestManipulatorHelper->ReadParam('formmanager_class', null, FILTER_UNSAFE_RAW); $sFormManagerData = $this->oRequestManipulatorHelper->ReadParam('formmanager_data', null, FILTER_UNSAFE_RAW); - if ($sFormManagerClass === null || $sFormManagerData === null) - { + if ($sFormManagerClass === null || $sFormManagerData === null) { IssueLog::Error(__METHOD__.' at line '.__LINE__.' : Parameters formmanager_class and formmanager_data must be defined.'); - throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, - 'Parameters formmanager_class and formmanager_data must be defined.'); + throw new HttpException( + Response::HTTP_INTERNAL_SERVER_ERROR, + 'Parameters formmanager_class and formmanager_data must be defined.' + ); } // Rebuilding manager from json /** @var \Combodo\iTop\Form\FormManager $oFormManager */ $oFormManager = $sFormManagerClass::FromJSON($sFormManagerData); // Applying modification to object - $aFormData['validation'] = $oFormManager->OnSubmit(array( - 'currentValues' => $this->oRequestManipulatorHelper->ReadParam('current_values', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), - )); + $aFormData['validation'] = $oFormManager->OnSubmit([ + 'currentValues' => $this->oRequestManipulatorHelper->ReadParam('current_values', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), + ]); // Reloading page only if preferences were changed - if (($aFormData['validation']['valid'] === true) && !empty($aFormData['validation']['messages']['success'])) - { - $aFormData['validation']['redirection'] = array( + if (($aFormData['validation']['valid'] === true) && !empty($aFormData['validation']['messages']['success'])) { + $aFormData['validation']['redirection'] = [ 'url' => $this->oUrlGenerator->generate('p_user_profile_brick'), 'timeout_duration' => 1000, //since there are several ajax request, we use a longer timeout in hope that they will all be finished in time. A promise would have been more reliable, but since this change is made in a minor version, this approach is less error prone. - ); + ]; } } } // Else, submit from another form // Preparing field_set data - $aFieldSetData = array( + $aFieldSetData = [ 'fields_list' => $oFormManager->GetRenderer()->Render(), 'fields_impacts' => $oFormManager->GetForm()->GetFieldsImpacts(), 'form_path' => $oFormManager->GetForm()->GetId(), - ); + ]; // Preparing form data $aFormData['id'] = $oFormManager->GetForm()->GetId(); @@ -329,14 +318,13 @@ class UserProfileBrickController extends BrickController */ public function HandlePasswordForm(Request $oRequest, $sFormMode) { - $aFormData = array(); + $aFormData = []; // Handling form $sOperation = /** @var \Combodo\iTop\Portal\Helper\RequestManipulatorHelper $oRequestManipulator */ $this->oRequestManipulatorHelper->ReadParam('operation', null); // - Create - if ($sOperation === null) - { + if ($sOperation === null) { // - Creating renderer $oFormRenderer = new BsFormRenderer(); $oFormRenderer->SetEndpoint($this->oUrlGenerator->generate('p_user_profile_brick')); @@ -345,41 +333,40 @@ class UserProfileBrickController extends BrickController $oFormManager->SetRenderer($oFormRenderer) ->Build(); // - Checking if we have to make the form read only - if ($sFormMode === ObjectFormHandlerHelper::ENUM_MODE_VIEW) - { + if ($sFormMode === ObjectFormHandlerHelper::ENUM_MODE_VIEW) { $oFormManager->GetForm()->MakeReadOnly(); } } // - Submit - else - { - if ($sOperation === 'submit') - { + else { + if ($sOperation === 'submit') { $sFormManagerClass = $this->oRequestManipulatorHelper->ReadParam('formmanager_class', null, FILTER_UNSAFE_RAW); $sFormManagerData = $this->oRequestManipulatorHelper->ReadParam('formmanager_data', null, FILTER_UNSAFE_RAW); if ($sFormManagerClass === null || $sFormManagerData === null) { IssueLog::Error(__METHOD__.' at line '.__LINE__.' : Parameters formmanager_class and formmanager_data must be defined.'); - throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, - 'Parameters formmanager_class and formmanager_data must be defined.'); + throw new HttpException( + Response::HTTP_INTERNAL_SERVER_ERROR, + 'Parameters formmanager_class and formmanager_data must be defined.' + ); } // Rebuilding manager from json /** @var \Combodo\iTop\Form\FormManager $oFormManager */ $oFormManager = $sFormManagerClass::FromJSON($sFormManagerData); // Applying modification to object - $aFormData['validation'] = $oFormManager->OnSubmit(array( - 'currentValues' => $this->oRequestManipulatorHelper->ReadParam('current_values', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), - )); + $aFormData['validation'] = $oFormManager->OnSubmit([ + 'currentValues' => $this->oRequestManipulatorHelper->ReadParam('current_values', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), + ]); } } // Else, submit from another form // Preparing field_set data - $aFieldSetData = array( + $aFieldSetData = [ 'fields_list' => $oFormManager->GetRenderer()->Render(), 'fields_impacts' => $oFormManager->GetForm()->GetFieldsImpacts(), 'form_path' => $oFormManager->GetForm()->GetId(), - ); + ]; // Preparing form data $aFormData['id'] = $oFormManager->GetForm()->GetId(); @@ -400,32 +387,27 @@ class UserProfileBrickController extends BrickController */ public function HandlePictureForm(Request $oRequest) { - $aFormData = array(); + $aFormData = []; $sPictureAttCode = 'picture'; // Handling form $sOperation = $this->oRequestManipulatorHelper->ReadParam('operation', null); // - No operation specified - if ($sOperation === null) - { + if ($sOperation === null) { IssueLog::Error(__METHOD__.' at line '.__LINE__.' : Operation parameter must be specified.'); throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, 'Operation parameter must be specified.'); } // - Submit - else - { - if ($sOperation === 'submit') - { + else { + if ($sOperation === 'submit') { $oRequestFiles = $oRequest->files; $oPictureFile = $oRequestFiles->get($sPictureAttCode); - if ($oPictureFile === null) - { + if ($oPictureFile === null) { IssueLog::Error(__METHOD__.' at line '.__LINE__.' : Parameter picture must be defined.'); throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, 'Parameter picture must be defined.'); } - try - { + try { // Retrieving image as an ORMDocument $oImage = utils::ReadPostedDocument($sPictureAttCode); // Retrieving current contact @@ -434,16 +416,19 @@ class UserProfileBrickController extends BrickController // Resizing image $oAttDef = MetaModel::GetAttributeDef(get_class($oCurContact), $sPictureAttCode); $aSize = utils::GetImageSize($oImage->GetData()); - $oImage = utils::ResizeImageToFit($oImage, $aSize[0], $aSize[1], $oAttDef->Get('storage_max_width'), - $oAttDef->Get('storage_max_height')); + $oImage = utils::ResizeImageToFit( + $oImage, + $aSize[0], + $aSize[1], + $oAttDef->Get('storage_max_width'), + $oAttDef->Get('storage_max_height') + ); // Setting it to the contact $oCurContact->Set($sPictureAttCode, $oImage); // Forcing allowed writing on the object if necessary. $oCurContact->AllowWrite(true); $oCurContact->DBUpdate(); - } - catch (FileUploadException $e) - { + } catch (FileUploadException $e) { $aFormData['error'] = $e->GetMessage(); } @@ -456,10 +441,10 @@ class UserProfileBrickController extends BrickController 'cache' => 86400, 's' => $oOrmDoc->GetSignature(), ]); - $aFormData['validation'] = array( + $aFormData['validation'] = [ 'valid' => true, - 'messages' => array(), - ); + 'messages' => [], + ]; } } @@ -468,30 +453,30 @@ class UserProfileBrickController extends BrickController return $aFormData; } - /** - * @param $sBrickId - * @return \Combodo\iTop\Portal\Brick\PortalBrick|UserProfileBrick - * @throws \Combodo\iTop\Portal\Brick\BrickNotFoundException - */ - public function GetBrick($sBrickId = null) - { - // If the brick id was not specified, we get the first one registered that is an instance of UserProfileBrick as default - if ($sBrickId === null) { - /** @var \Combodo\iTop\Portal\Brick\PortalBrick $oTmpBrick */ - foreach ($this->oBrickCollection->GetBricks() as $oTmpBrick) { - if ($oTmpBrick instanceof UserProfileBrick) { - $oBrick = $oTmpBrick; - } - } + /** + * @param $sBrickId + * @return \Combodo\iTop\Portal\Brick\PortalBrick|UserProfileBrick + * @throws \Combodo\iTop\Portal\Brick\BrickNotFoundException + */ + public function GetBrick($sBrickId = null) + { + // If the brick id was not specified, we get the first one registered that is an instance of UserProfileBrick as default + if ($sBrickId === null) { + /** @var \Combodo\iTop\Portal\Brick\PortalBrick $oTmpBrick */ + foreach ($this->oBrickCollection->GetBricks() as $oTmpBrick) { + if ($oTmpBrick instanceof UserProfileBrick) { + $oBrick = $oTmpBrick; + } + } - // We make sure a UserProfileBrick was found - if (!isset($oBrick) || $oBrick === null) { - $oBrick = new UserProfileBrick(); - //throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, 'UserProfileBrick : Brick could not be loaded as there was no UserProfileBrick loaded in the application.'); - } - } else { - $oBrick = $this->oBrickCollection->GetBrickById($sBrickId); - } - return $oBrick; - } + // We make sure a UserProfileBrick was found + if (!isset($oBrick) || $oBrick === null) { + $oBrick = new UserProfileBrick(); + //throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, 'UserProfileBrick : Brick could not be loaded as there was no UserProfileBrick loaded in the application.'); + } + } else { + $oBrick = $this->oBrickCollection->GetBrickById($sBrickId); + } + return $oBrick; + } } diff --git a/datamodels/2.x/itop-portal-base/portal/src/DataCollector/PortalCollector.php b/datamodels/2.x/itop-portal-base/portal/src/DataCollector/PortalCollector.php index 57df0697e..c57d0490a 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/DataCollector/PortalCollector.php +++ b/datamodels/2.x/itop-portal-base/portal/src/DataCollector/PortalCollector.php @@ -16,7 +16,6 @@ use Throwable; */ class PortalCollector extends AbstractDataCollector { - /** * Constructor. * @@ -90,13 +89,13 @@ class PortalCollector extends AbstractDataCollector $iOverridesCount = 0; $aExtensions = []; - foreach($aTemplatesDefinitions as $templates){ + foreach ($aTemplatesDefinitions as $templates) { foreach ($templates as $template) { $aMatches = []; preg_match('#([\w-]+)/#', $template->GetPath(), $aMatches); - if(!in_array($aMatches[1], $aExtensions)){ + if (!in_array($aMatches[1], $aExtensions)) { $aExtensions[] = $aMatches[1]; } @@ -124,4 +123,4 @@ class PortalCollector extends AbstractDataCollector return 'portal'; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/AbstractConfiguration.php b/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/AbstractConfiguration.php index 2a3324a0f..578ad79ab 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/AbstractConfiguration.php +++ b/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/AbstractConfiguration.php @@ -52,4 +52,4 @@ class AbstractConfiguration return $this->oModuleDesign; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Basic.php b/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Basic.php index 2c8f40a78..135ef7076 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Basic.php +++ b/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Basic.php @@ -1,4 +1,5 @@ GetInitialPortalConf(); @@ -55,9 +55,7 @@ class Basic extends AbstractConfiguration $aPortalConf = $this->AppendLogoUri($aPortalConf); // - Rectifying portal favicon url $aPortalConf = $this->AppendFavIconUri($aPortalConf); - } - catch (Exception $oException) - { + } catch (Exception $oException) { throw new Exception('Error while parsing portal configuration file : '.$oException->getMessage()); } @@ -72,35 +70,35 @@ class Basic extends AbstractConfiguration */ private function GetInitialPortalConf() { - $aPortalConf = array( - 'properties' => array( + $aPortalConf = [ + 'properties' => [ 'id' => $_ENV['PORTAL_ID'], 'ui_version' => '2017', 'name' => 'Page:DefaultTitle', 'logo' => Branding::GetPortalLogoAbsoluteUrl(), 'favicon' => Branding::GetPortalFavIconAbsoluteUrl(), - 'themes' => array( + 'themes' => [ 'bootstrap' => 'itop-portal-base/portal/public/css/bootstrap-theme-combodo.scss', 'portal' => 'itop-portal-base/portal/public/css/portal.scss', - 'others' => array(), - ), - 'templates' => array( + 'others' => [], + ], + 'templates' => [ 'layout' => 'itop-portal-base/portal/templates/layout.html.twig', 'home' => 'itop-portal-base/portal/templates/home/layout.html.twig', - ), + ], 'urlmaker_class' => null, 'triggers_query' => null, - 'attachments' => array( + 'attachments' => [ 'allow_delete' => true, - ), - 'allowed_portals' => array( + ], + 'allowed_portals' => [ 'opening_mode' => null, - ), - ), - 'forms' => array(), - 'bricks' => array(), + ], + ], + 'forms' => [], + 'bricks' => [], 'bricks_total_width' => 0, - ); + ]; return $aPortalConf; } @@ -114,10 +112,8 @@ class Basic extends AbstractConfiguration private function ParseGlobalProperties(array $aPortalConf) { /** @var \MFElement $oPropertyNode */ - foreach ($this->GetModuleDesign()->GetNodes('/module_design/properties/*') as $oPropertyNode) - { - switch ($oPropertyNode->nodeName) - { + foreach ($this->GetModuleDesign()->GetNodes('/module_design/properties/*') as $oPropertyNode) { + switch ($oPropertyNode->nodeName) { case 'ui_version': case 'name': case 'urlmaker_class': @@ -154,22 +150,20 @@ class Basic extends AbstractConfiguration private function ParseTemplateAndTheme(array $aPortalConf, DesignElement $oPropertyNode) { /** @var \MFElement $oSubNode */ - foreach ($oPropertyNode->GetNodes('template|theme') as $oSubNode) - { - if (!$oSubNode->hasAttribute('id') || $oSubNode->GetText(null) === null) - { + foreach ($oPropertyNode->GetNodes('template|theme') as $oSubNode) { + if (!$oSubNode->hasAttribute('id') || $oSubNode->GetText(null) === null) { throw new DOMFormatException( 'Tag '.$oSubNode->nodeName.' must have a "id" attribute as well as a value', - null, null, $oSubNode + null, + null, + $oSubNode ); } $sNodeId = $oSubNode->getAttribute('id'); - switch ($oSubNode->nodeName) - { + switch ($oSubNode->nodeName) { case 'theme': - switch ($sNodeId) - { + switch ($sNodeId) { case 'bootstrap': case 'portal': case 'custom': @@ -181,8 +175,7 @@ class Basic extends AbstractConfiguration } break; case 'template': - switch ($sNodeId) - { + switch ($sNodeId) { case 'layout': case 'home': $aPortalConf['properties']['templates'][$sNodeId] = $oSubNode->GetText(null); @@ -190,19 +183,21 @@ class Basic extends AbstractConfiguration default: $aMatches = []; // allowed format is: : - if(preg_match('#([\w\\\d_]+):(\w+)#', $sNodeId, $aMatches)){ - try{ + if (preg_match('#([\w\\\d_]+):(\w+)#', $sNodeId, $aMatches)) { + try { $oClass = new ReflectionClass($aMatches[1]); - if($oClass->implementsInterface(TemplatesProviderInterface::class)){ + if ($oClass->implementsInterface(TemplatesProviderInterface::class)) { $aPortalConf['properties']['templates'][$aMatches[1]][$aMatches[2]] = $oSubNode->GetText(null); break; } + } catch (Exception) { } - catch(Exception){} } throw new DOMFormatException( 'Template ID "'.$sNodeId.'" is not handled in module design templates property', - null, null, $oSubNode + null, + null, + $oSubNode ); } break; @@ -221,16 +216,13 @@ class Basic extends AbstractConfiguration private function ParseAttachments(array $aPortalConf, DesignElement $oPropertyNode) { /** @var \MFElement $oSubNode */ - foreach ($oPropertyNode->GetNodes('*') as $oSubNode) - { - switch ($oSubNode->nodeName) - { + foreach ($oPropertyNode->GetNodes('*') as $oSubNode) { + switch ($oSubNode->nodeName) { case 'allow_delete': $sValue = $oSubNode->GetText(); // If the text is null, we keep the default value // Else we set it - if ($sValue !== null) - { + if ($sValue !== null) { $aPortalConf['properties']['attachments'][$oSubNode->nodeName] = ($sValue === 'true') ? true : false; } break; @@ -249,16 +241,13 @@ class Basic extends AbstractConfiguration private function ParseAllowedPortalsOptions(array $aPortalConf, DesignElement $oPropertyNode) { /** @var \MFElement $oSubNode */ - foreach ($oPropertyNode->GetNodes('*') as $oSubNode) - { - switch ($oSubNode->nodeName) - { + foreach ($oPropertyNode->GetNodes('*') as $oSubNode) { + switch ($oSubNode->nodeName) { case 'opening_mode': $sValue = $oSubNode->GetText(); // If the text is null, we keep the default value // Else we set it - if ($sValue !== null) - { + if ($sValue !== null) { $aPortalConf['properties']['allowed_portals'][$oSubNode->nodeName] = ($sValue === 'self') ? 'self' : 'tab'; } break; @@ -304,4 +293,4 @@ class Basic extends AbstractConfiguration return $aPortalConf; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Forms.php b/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Forms.php index 650cec201..be054ef86 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Forms.php +++ b/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Forms.php @@ -1,4 +1,5 @@ GetModuleDesign()->GetNodes('/module_design/forms/form') as $oFormNode) - { - try - { + foreach ($this->GetModuleDesign()->GetNodes('/module_design/forms/form') as $oFormNode) { + try { // Parsing form id $sFormId = $oFormNode->getAttribute('id'); - if ($oFormNode->getAttribute('id') === '') - { + if ($oFormNode->getAttribute('id') === '') { throw new DOMFormatException('form tag must have an id attribute', 0, null, $oFormNode); } // Parsing form object class - if ($oFormNode->GetUniqueElement('class')->GetText() === null) - { + if ($oFormNode->GetUniqueElement('class')->GetText() === null) { throw new DOMFormatException('Class tag must be defined', 0, null, $oFormNode); } @@ -66,29 +63,26 @@ class Forms extends AbstractConfiguration $sFormClass = $oFormNode->GetUniqueElement('class')->GetText(); // Parsing properties - $aFormProperties = array( + $aFormProperties = [ 'display_mode' => ApplicationHelper::FORM_DEFAULT_DISPLAY_MODE, 'always_show_submit' => ApplicationHelper::FORM_DEFAULT_ALWAYS_SHOW_SUBMIT, - 'navigation_rules' => array( - 'submit' => array( + 'navigation_rules' => [ + 'submit' => [ NavigationRuleHelper::ENUM_ORIGIN_PAGE => null, NavigationRuleHelper::ENUM_ORIGIN_MODAL => null, - ), - 'cancel' => array( + ], + 'cancel' => [ NavigationRuleHelper::ENUM_ORIGIN_PAGE => null, NavigationRuleHelper::ENUM_ORIGIN_MODAL => null, - ), - ), - ); + ], + ], + ]; $aAllowedNavRulesButtonCodes = array_keys($aFormProperties['navigation_rules']); - if ($oFormNode->GetOptionalElement('properties') !== null) - { + if ($oFormNode->GetOptionalElement('properties') !== null) { /** @var \MFElement $oPropertyNode */ - foreach ($oFormNode->GetOptionalElement('properties')->GetNodes('*') as $oPropertyNode) - { - switch ($oPropertyNode->nodeName) - { + foreach ($oFormNode->GetOptionalElement('properties')->GetNodes('*') as $oPropertyNode) { + switch ($oPropertyNode->nodeName) { case 'display_mode': $aFormProperties['display_mode'] = $oPropertyNode->GetText(ApplicationHelper::FORM_DEFAULT_DISPLAY_MODE); break; @@ -99,28 +93,23 @@ class Forms extends AbstractConfiguration case 'navigation_rules': /** @var \MFElement $oNavRuleButtonNode */ - foreach($oPropertyNode->GetNodes('*') as $oNavRuleButtonNode) - { + foreach ($oPropertyNode->GetNodes('*') as $oNavRuleButtonNode) { $sNavRuleButtonCode = $oNavRuleButtonNode->nodeName; - if(!in_array($sNavRuleButtonCode, $aAllowedNavRulesButtonCodes)) - { + if (!in_array($sNavRuleButtonCode, $aAllowedNavRulesButtonCodes)) { throw new DOMFormatException('navigation_rules tag must only contain '.implode('|', $aAllowedNavRulesButtonCodes).' tags, "'.$sNavRuleButtonCode.'" given.', null, null, $oPropertyNode); } /** @var \MFElement $oNavRuleOriginNode */ - foreach($oNavRuleButtonNode->GetNodes('*') as $oNavRuleOriginNode) - { + foreach ($oNavRuleButtonNode->GetNodes('*') as $oNavRuleOriginNode) { $sNavRuleOrigin = $oNavRuleOriginNode->nodeName; - if(!in_array($sNavRuleOrigin, NavigationRuleHelper::GetAllowedOrigins())) - { - throw new DOMFormatException($sNavRuleButtonCode. ' tag must only contain '.implode('|', NavigationRuleHelper::GetAllowedOrigins()).' tags, "'.$sNavRuleOrigin.'" given.', null, null, $oPropertyNode); + if (!in_array($sNavRuleOrigin, NavigationRuleHelper::GetAllowedOrigins())) { + throw new DOMFormatException($sNavRuleButtonCode.' tag must only contain '.implode('|', NavigationRuleHelper::GetAllowedOrigins()).' tags, "'.$sNavRuleOrigin.'" given.', null, null, $oPropertyNode); } $sNavRuleId = $oNavRuleOriginNode->GetText(); // Note: We don't check is rule exists as it would introduce a dependency to the NavigationRuleHelper service. // Maybe we will consider it later. - if(empty($sNavRuleId)) - { + if (empty($sNavRuleId)) { throw new DOMFormatException($sNavRuleButtonCode.' tag cannot be empty.', null, null, $oPropertyNode); } @@ -129,8 +118,7 @@ class Forms extends AbstractConfiguration // Set modal rule as the same as default is not present. // We preset it so we don't have to make checks elsewhere in the code when using it. - if(empty($aFormProperties['navigation_rules'][$sNavRuleButtonCode][NavigationRuleHelper::ENUM_ORIGIN_MODAL])) - { + if (empty($aFormProperties['navigation_rules'][$sNavRuleButtonCode][NavigationRuleHelper::ENUM_ORIGIN_MODAL])) { $aFormProperties['navigation_rules'][$sNavRuleButtonCode][NavigationRuleHelper::ENUM_ORIGIN_MODAL] = $aFormProperties['navigation_rules'][$sNavRuleButtonCode][NavigationRuleHelper::ENUM_ORIGIN_PAGE]; } } @@ -139,36 +127,33 @@ class Forms extends AbstractConfiguration } // Parsing available modes for that form (view, edit, create, apply_stimulus) - $aFormStimuli = array(); - if (($oFormNode->GetOptionalElement('modes') !== null) && ($oFormNode->GetOptionalElement('modes')->GetNodes('mode')->length > 0)) - { - $aModes = array(); + $aFormStimuli = []; + if (($oFormNode->GetOptionalElement('modes') !== null) && ($oFormNode->GetOptionalElement('modes')->GetNodes('mode')->length > 0)) { + $aModes = []; /** @var \MFElement $oModeNode */ - foreach ($oFormNode->GetOptionalElement('modes')->GetNodes('mode') as $oModeNode) - { + foreach ($oFormNode->GetOptionalElement('modes')->GetNodes('mode') as $oModeNode) { $sModeId = $oModeNode->getAttribute('id'); - if ($sModeId === '') - { - throw new DOMFormatException('mode tag must have an id attribute', 0, null, - $oFormNode); + if ($sModeId === '') { + throw new DOMFormatException( + 'mode tag must have an id attribute', + 0, + null, + $oFormNode + ); } $aModes[] = $sModeId; // If apply_stimulus mode, checking if stimuli are defined - if ($sModeId === 'apply_stimulus') - { + if ($sModeId === 'apply_stimulus') { $oStimuliNode = $oModeNode->GetOptionalElement('stimuli'); // If stimuli are defined, we overwrite the form that could have been set by the generic form - if ($oStimuliNode !== null) - { + if ($oStimuliNode !== null) { /** @var \MFElement $oStimulusNode */ - foreach ($oStimuliNode->GetNodes('stimulus') as $oStimulusNode) - { + foreach ($oStimuliNode->GetNodes('stimulus') as $oStimulusNode) { $sStimulusCode = $oStimulusNode->getAttribute('id'); // Removing default form if present (in case the default forms were parsed before the current one (from current or parent class)) - if (isset($aForms[$sFormClass]['apply_stimulus'][$sStimulusCode])) - { + if (isset($aForms[$sFormClass]['apply_stimulus'][$sStimulusCode])) { unset($aForms[$sFormClass]['apply_stimulus'][$sStimulusCode]); } @@ -177,111 +162,95 @@ class Forms extends AbstractConfiguration } } } - } - else - { + } else { // If no mode was specified, we set it all but stimuli as it would have no sense that every transition forms // have as many fields displayed as a regular edit form for example. - $aModes = array('view', 'edit', 'create'); + $aModes = ['view', 'edit', 'create']; } // Parsing fields - $aFields = array( + $aFields = [ '_brought_by' => $sFormClass, 'id' => $sFormId, 'type' => null, 'properties' => $aFormProperties, 'fields' => null, 'layout' => null, - ); + ]; // ... either enumerated fields ... - if ($oFormNode->GetOptionalElement('fields') !== null) - { + if ($oFormNode->GetOptionalElement('fields') !== null) { $aFields['type'] = 'custom_list'; - $aFields['fields'] = array(); + $aFields['fields'] = []; /** @var \MFElement $oFieldNode */ - foreach ($oFormNode->GetOptionalElement('fields')->GetNodes('field') as $oFieldNode) - { + foreach ($oFormNode->GetOptionalElement('fields')->GetNodes('field') as $oFieldNode) { $sFieldId = $oFieldNode->getAttribute('id'); - if ($sFieldId !== '') - { - $aField = array(); + if ($sFieldId !== '') { + $aField = []; // Parsing field options like read_only, hidden and mandatory - if ($oFieldNode->GetOptionalElement('read_only')) - { + if ($oFieldNode->GetOptionalElement('read_only')) { $aField['readonly'] = ($oFieldNode->GetOptionalElement('read_only')->GetText('true') === 'true') ? true : false; } - if ($oFieldNode->GetOptionalElement('mandatory')) - { + if ($oFieldNode->GetOptionalElement('mandatory')) { $aField['mandatory'] = ($oFieldNode->GetOptionalElement('mandatory')->GetText('true') === 'true') ? true : false; } - if ($oFieldNode->GetOptionalElement('hidden')) - { + if ($oFieldNode->GetOptionalElement('hidden')) { $aField['hidden'] = ($oFieldNode->GetOptionalElement('hidden')->GetText('true') === 'true') ? true : false; } $aFields['fields'][$sFieldId] = $aField; - } - else - { - throw new DOMFormatException('Field tag must have an id attribute', 0, null, - $oFormNode); + } else { + throw new DOMFormatException( + 'Field tag must have an id attribute', + 0, + null, + $oFormNode + ); } } } // ... or the default zlist - else - { + else { $aFields['type'] = 'zlist'; $aFields['fields'] = 'details'; } // Parsing presentation - if ($oFormNode->GetOptionalElement('twig') !== null) - { + if ($oFormNode->GetOptionalElement('twig') !== null) { // Extracting the twig template and removing the first and last lines (twig tags) $sXml = $this->GetModuleDesign()->saveXML($oFormNode->GetOptionalElement('twig')); $sXml = preg_replace('/^.+\n/', '', $sXml); $sXml = preg_replace('/\n.+$/', '', $sXml); - $aFields['layout'] = array( + $aFields['layout'] = [ 'type' => (preg_match('/{{|{#|{%/', $sXml) === 1) ? 'twig' : 'xhtml', 'content' => $sXml, - ); + ]; } // Adding form for each class / mode - foreach ($aModes as $sMode) - { + foreach ($aModes as $sMode) { // Initializing current class if necessary - if (!isset($aForms[$sFormClass])) - { - $aForms[$sFormClass] = array(); + if (!isset($aForms[$sFormClass])) { + $aForms[$sFormClass] = []; } // For stimuli we need to fill the matrix as only some stimuli might have been given - if ($sMode === 'apply_stimulus') - { + if ($sMode === 'apply_stimulus') { // Iterating over current class and child classes - foreach (MetaModel::EnumChildClasses($sFormClass, ENUM_CHILD_CLASSES_ALL) as $sChildClass) - { + foreach (MetaModel::EnumChildClasses($sFormClass, ENUM_CHILD_CLASSES_ALL) as $sChildClass) { // Initializing child class if necessary - if (!isset($aForms[$sChildClass][$sMode])) - { - $aForms[$sChildClass][$sMode] = array(); + if (!isset($aForms[$sChildClass][$sMode])) { + $aForms[$sChildClass][$sMode] = []; } // If no explicit stimulus defined in this form, than it's the generic stimulus form // we need to find which stimulus are missing - if(empty($aFormStimuli)) - { - $aExistingStimuli = array(); + if (empty($aFormStimuli)) { + $aExistingStimuli = []; // Keep only stimuli brought by the class itself - foreach($aForms[$sChildClass][$sMode] as $sExistingStimulus => $aExistingForm) - { - if(!in_array($aExistingForm['_brought_by'], MetaModel::EnumParentClasses($sFormClass, ENUM_PARENT_CLASSES_EXCLUDELEAF))) - { + foreach ($aForms[$sChildClass][$sMode] as $sExistingStimulus => $aExistingForm) { + if (!in_array($aExistingForm['_brought_by'], MetaModel::EnumParentClasses($sFormClass, ENUM_PARENT_CLASSES_EXCLUDELEAF))) { //continue; $aExistingStimuli[] = $sExistingStimulus; } @@ -290,51 +259,43 @@ class Forms extends AbstractConfiguration $aMissingStimulusForms = array_diff($aDatamodelStimuli, $aExistingStimuli); } // Otherwise, we process only the ones for this form - else - { + else { $aMissingStimulusForms = $aFormStimuli; } // Retrieve missing stimuli of the child class to fill the matrix - foreach ($aMissingStimulusForms as $sDatamodelStimulus) - { + foreach ($aMissingStimulusForms as $sDatamodelStimulus) { // Check some facts about the target form $bFormExists = isset($aForms[$sChildClass][$sMode][$sDatamodelStimulus]); $bWasFormBroughtByParent = $bFormExists && in_array($aForms[$sChildClass][$sMode][$sDatamodelStimulus]['_brought_by'], MetaModel::EnumParentClasses($sFormClass, ENUM_PARENT_CLASSES_EXCLUDELEAF)); // Check if we need to overwrite (form created by parent) $bOverwriteNecessary = false; - if($bWasFormBroughtByParent || in_array($sDatamodelStimulus, $aFormStimuli)) - { + if ($bWasFormBroughtByParent || in_array($sDatamodelStimulus, $aFormStimuli)) { $bOverwriteNecessary = true; } // Setting form if not defined OR if it was defined by a parent (abstract) class - if (!$bFormExists || $bOverwriteNecessary) - { + if (!$bFormExists || $bOverwriteNecessary) { $aForms[$sChildClass][$sMode][$sDatamodelStimulus] = $aFields; $aForms[$sChildClass][$sMode][$sDatamodelStimulus]['id'] = 'apply_stimulus-'.$sChildClass.'-'.$sDatamodelStimulus; } } } - } - elseif (!isset($aForms[$sFormClass][$sMode])) - { + } elseif (!isset($aForms[$sFormClass][$sMode])) { $aForms[$sFormClass][$sMode] = $aFields; - } - else - { - throw new DOMFormatException('There is already a form for the class "'.$sFormClass.'" in "'.$sMode.'"', - null, null, $oFormNode); + } else { + throw new DOMFormatException( + 'There is already a form for the class "'.$sFormClass.'" in "'.$sMode.'"', + null, + null, + $oFormNode + ); } } - } - catch (DOMFormatException $e) - { + } catch (DOMFormatException $e) { throw new Exception('Could not create from [id="'.$oFormNode->getAttribute('id').'"] from XML because of a DOM problem : '.$e->getMessage()); - } - catch (Exception $e) - { + } catch (Exception $e) { throw new Exception('Could not create from from XML : '.$oFormNode->Dump().' '.$e->getMessage()); } } @@ -343,4 +304,4 @@ class Forms extends AbstractConfiguration $aPortalConf['forms'] = $aForms; $oContainer->setParameter('combodo.portal.instance.conf', $aPortalConf); } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Lists.php b/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Lists.php index fbef50334..c0e51f4e0 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Lists.php +++ b/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Lists.php @@ -1,4 +1,5 @@ GetModuleDesign()->GetNodes('/module_design/classes/class') as $oClassNode) - { - $aClassLists = array(); + foreach ($this->GetModuleDesign()->GetNodes('/module_design/classes/class') as $oClassNode) { + $aClassLists = []; $sClassId = $oClassNode->getAttribute('id'); - if ($sClassId === null) - { + if ($sClassId === null) { throw new DOMFormatException('Class tag must have an id attribute', 0, null, $oClassNode); } // - Each lists /** @var \MFElement $oListNode */ - foreach ($oClassNode->GetNodes('./lists/list') as $oListNode) - { - $aListItems = array(); + foreach ($oClassNode->GetNodes('./lists/list') as $oListNode) { + $aListItems = []; $sListId = $oListNode->getAttribute('id'); - if ($sListId === null) - { - throw new DOMFormatException('List tag of "'.$sClassId.'" class must have an id attribute', null, - null, $oListNode); + if ($sListId === null) { + throw new DOMFormatException( + 'List tag of "'.$sClassId.'" class must have an id attribute', + null, + null, + $oListNode + ); } // - Each items /** @var \MFElement $oItemNode */ - foreach ($oListNode->GetNodes('./items/item') as $oItemNode) - { + foreach ($oListNode->GetNodes('./items/item') as $oItemNode) { $sItemId = $oItemNode->getAttribute('id'); - if ($sItemId === null) - { - throw new DOMFormatException('Item tag of "'.$sItemId.'" list must have an id attribute', null, - null, $oItemNode); + if ($sItemId === null) { + throw new DOMFormatException( + 'Item tag of "'.$sItemId.'" list must have an id attribute', + null, + null, + $oItemNode + ); } - $aItem = array( + $aItem = [ 'att_code' => $sItemId, 'rank' => $iDefaultItemRank, - ); + ]; $oRankNode = $oItemNode->GetOptionalElement('rank'); - if ($oRankNode !== null) - { + if ($oRankNode !== null) { $aItem['rank'] = $oRankNode->GetText($iDefaultItemRank); } @@ -100,8 +102,7 @@ class Lists extends AbstractConfiguration } // - Adding class only if it has at least one list - if (!empty($aClassLists)) - { + if (!empty($aClassLists)) { $aClassesLists[$sClassId] = $aClassLists; } } @@ -110,4 +111,4 @@ class Lists extends AbstractConfiguration $oContainer->setParameter('combodo.portal.instance.conf', $aPortalConf); } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/EventListener/ApplicationContextSetPluginPropertyClass.php b/datamodels/2.x/itop-portal-base/portal/src/EventListener/ApplicationContextSetPluginPropertyClass.php index d6271ed0e..a00ee3f27 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/EventListener/ApplicationContextSetPluginPropertyClass.php +++ b/datamodels/2.x/itop-portal-base/portal/src/EventListener/ApplicationContextSetPluginPropertyClass.php @@ -1,4 +1,5 @@ aCombodoPortalInstanceConf = $aCombodoPortalInstanceConf; - } + /** + * @param array $aCombodoPortalInstanceConf + */ + public function __construct($aCombodoPortalInstanceConf) + { + $this->aCombodoPortalInstanceConf = $aCombodoPortalInstanceConf; + } /** * @param RequestEvent $oRequestEvent @@ -51,4 +52,4 @@ class ApplicationContextSetUrlMakerClass ApplicationContext::SetUrlMakerClass($this->aCombodoPortalInstanceConf['properties']['urlmaker_class']); } } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/EventListener/CssFromSassCompiler.php b/datamodels/2.x/itop-portal-base/portal/src/EventListener/CssFromSassCompiler.php index 89ea7563b..b26d09410 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/EventListener/CssFromSassCompiler.php +++ b/datamodels/2.x/itop-portal-base/portal/src/EventListener/CssFromSassCompiler.php @@ -1,4 +1,5 @@ aCombodoPortalInstanceConf['properties']['themes'] as $sKey => $value) { - if (!is_array($value)) - { + if (!is_array($value)) { utils::GetCSSFromSASS('env-'.utils::GetCurrentEnvironment().'/'.$value, $aImportPaths); - } - else - { - foreach ($value as $sSubValue) - { + } else { + foreach ($value as $sSubValue) { utils::GetCSSFromSASS('env-'.utils::GetCurrentEnvironment().'/'.$sSubValue, $aImportPaths); } } } } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/EventListener/ExceptionListener.php b/datamodels/2.x/itop-portal-base/portal/src/EventListener/ExceptionListener.php index 12acb2707..a2b2f398f 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/EventListener/ExceptionListener.php +++ b/datamodels/2.x/itop-portal-base/portal/src/EventListener/ExceptionListener.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU Affero General Public License */ - namespace Combodo\iTop\Portal\EventListener; - use Dict; use ExceptionLog; use Symfony\Component\ErrorHandler\Exception\FlattenException; @@ -40,7 +38,6 @@ use Twig\Environment; */ class ExceptionListener { - /** * Constructor. * @@ -48,8 +45,7 @@ class ExceptionListener */ public function __construct( protected Environment $oTwig - ) - { + ) { } /** @@ -59,7 +55,7 @@ class ExceptionListener * @throws \Twig\Error\RuntimeError * @throws \Twig\Error\SyntaxError */ - public function onKernelException(ExceptionEvent $oEvent) : void + public function onKernelException(ExceptionEvent $oEvent): void { // Get the exception object from the received event $oException = $oEvent->getThrowable(); @@ -87,13 +83,11 @@ class ExceptionListener // Prepare flatten exception $oFlattenException = ($_SERVER['APP_DEBUG'] == 1) ? FlattenException::createFromThrowable($oException) : null; // Remove APPROOT from file paths if in production (SF context) - if (!is_null($oFlattenException) && ($_SERVER['APP_ENV'] === 'prod')) - { + if (!is_null($oFlattenException) && ($_SERVER['APP_ENV'] === 'prod')) { $oFlattenException->setFile($this->removeAppRootFromPath($oFlattenException->getFile())); $aTrace = $oFlattenException->getTrace(); - foreach ($aTrace as $iIdx => $aEntry) - { + foreach ($aTrace as $iIdx => $aEntry) { $aTrace[$iIdx]['file'] = $this->removeAppRootFromPath($aEntry['file']); } $oFlattenException->setTrace($aTrace, $oFlattenException->getFile(), $oFlattenException->getLine()); @@ -105,20 +99,17 @@ class ExceptionListener ]); // Prepare data for template - $aData = array( + $aData = [ 'exception' => $oFlattenException, 'code' => $iStatusCode, 'error_title' => $sErrorTitle, 'error_message' => $sErrorMessage, - ); + ]; // Generate the response - if ($oEvent->getRequest()->isXmlHttpRequest()) - { + if ($oEvent->getRequest()->isXmlHttpRequest()) { $oResponse = new JsonResponse($aData); - } - else - { + } else { $oResponse = new Response(); $oResponse->setContent($this->oTwig->render('itop-portal-base/portal/templates/errors/layout.html.twig', $aData)); } @@ -164,5 +155,4 @@ class ExceptionListener return str_replace($sNormalizedAppRoot, '', $sNormalizedInputPath); } - -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/EventListener/UserProvider.php b/datamodels/2.x/itop-portal-base/portal/src/EventListener/UserProvider.php index e362fa27b..5bc542bce 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/EventListener/UserProvider.php +++ b/datamodels/2.x/itop-portal-base/portal/src/EventListener/UserProvider.php @@ -1,4 +1,5 @@ getRequest()->isXmlHttpRequest()) ? LoginWebPage::EXIT_RETURN : LoginWebPage::EXIT_PROMPT; $iLogonRes = LoginWebPage::DoLoginEx($this->sPortalId, false, $iExitMethod); - if( ($iExitMethod === LoginWebPage::EXIT_RETURN) && ($iLogonRes != 0) ) { + if (($iExitMethod === LoginWebPage::EXIT_RETURN) && ($iLogonRes != 0)) { die(Dict::S('Portal:ErrorUserLoggedOut')); } // - User must be associated with a Contact @@ -92,8 +93,8 @@ class UserProvider throw new Exception('Could not load connected user.'); } - // User allowed to log off or not - $this->bUserCanLogOff = utils::CanLogOff(); + // User allowed to log off or not + $this->bUserCanLogOff = utils::CanLogOff(); // Allowed portals $aAllowedPortals = UserRights::GetAllowedPortals(); @@ -146,5 +147,4 @@ class UserProvider return $this->aAllowedPortals; } - -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php b/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php index c284c36b2..8d0bfb46d 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php @@ -51,6 +51,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; use UserRights; use utils; + use const UR_ACTION_READ; /** @@ -62,13 +63,13 @@ use const UR_ACTION_READ; class ObjectFormManager extends FormManager { /** @var string ENUM_MODE_VIEW */ - const ENUM_MODE_VIEW = 'view'; + public const ENUM_MODE_VIEW = 'view'; /** @var string ENUM_MODE_EDIT */ - const ENUM_MODE_EDIT = 'edit'; + public const ENUM_MODE_EDIT = 'edit'; /** @var string ENUM_MODE_CREATE */ - const ENUM_MODE_CREATE = 'create'; + public const ENUM_MODE_CREATE = 'create'; /** @var string ENUM_MODE_APPLY_STIMULUS */ - const ENUM_MODE_APPLY_STIMULUS = 'apply_stimulus'; + public const ENUM_MODE_APPLY_STIMULUS = 'apply_stimulus'; /** @var \cmdbAbstractObject $oObject */ protected $oObject; @@ -79,14 +80,14 @@ class ObjectFormManager extends FormManager /** @var array $aFormProperties */ protected $aFormProperties; /** @var array $aCallbackUrls */ - protected $aCallbackUrls = array(); + protected $aCallbackUrls = []; /** * List of hidden fields, used for form update (eg. remove them from the form regarding they dependencies) * * @var array $aHiddenFieldsId * @since 2.7.5 */ - protected $aHiddenFieldsId = array(); + protected $aHiddenFieldsId = []; /** * @var ObjectFormHandlerHelper $oFormHandlerHelper @@ -95,7 +96,7 @@ class ObjectFormManager extends FormManager private $oFormHandlerHelper; /** @var array $aPlugins plugins data */ - private array $aPlugins = array(); + private array $aPlugins = []; private array $aFieldsAtts = []; private array $aExtraData = []; private DOMDocument $oHtmlDocument; @@ -143,27 +144,22 @@ class ObjectFormManager extends FormManager } $sObjectClass = $aJson['formobject_class']; - if (!isset($aJson['formobject_id'])) - { + if (!isset($aJson['formobject_id'])) { $oObject = MetaModel::NewObject($sObjectClass); - } - else - { + } else { // Note : AllowAllData set to true here instead of checking scope's flag because we are displaying a value that has been set and validated $oObject = MetaModel::GetObject($sObjectClass, $aJson['formobject_id'], true, true); } $oFormManager->SetObject($oObject); // Retrieving form mode - if (!isset($aJson['formmode'])) - { + if (!isset($aJson['formmode'])) { throw new Exception('Form mode must be defined in order to generate the form'); } $oFormManager->SetMode($aJson['formmode']); // Retrieving actions rules - if (isset($aJson['formactionrulestoken'])) - { + if (isset($aJson['formactionrulestoken'])) { $oFormManager->SetActionRulesToken($aJson['formactionrulestoken']); } @@ -316,8 +312,7 @@ class ObjectFormManager extends FormManager { $aJson = parent::ToJSON(); $aJson['formobject_class'] = get_class($this->oObject); - if ($this->oObject->GetKey() > 0) - { + if ($this->oObject->GetKey() > 0) { $aJson['formobject_id'] = $this->oObject->GetKey(); } $aJson['formmode'] = $this->sMode; @@ -338,11 +333,9 @@ class ObjectFormManager extends FormManager // Building form from its properties // - Consistency checks for stimulus form - if (isset($this->aFormProperties['stimulus_code'])) - { + if (isset($this->aFormProperties['stimulus_code'])) { $aTransitions = MetaModel::EnumTransitions($sObjectClass, $this->oObject->GetState()); - if (!isset($aTransitions[$this->aFormProperties['stimulus_code']])) - { + if (!isset($aTransitions[$this->aFormProperties['stimulus_code']])) { $aStimuli = Metamodel::EnumStimuli($sObjectClass); $sStimulusLabel = $aStimuli[$this->aFormProperties['stimulus_code']]->GetLabel(); @@ -351,24 +344,22 @@ class ObjectFormManager extends FormManager } } - // Adding rendered template to the form renderer as the base layout $this->oRenderer->SetBaseLayout($this->oHtmlDocument->saveHTML()); // Building the form - foreach ($this->aFieldsAtts as $sAttCode => $iFieldFlags) - { + foreach ($this->aFieldsAtts as $sAttCode => $iFieldFlags) { // handle plugins fields - if($this->sMode !== 'apply_stimulus' + if ($this->sMode !== 'apply_stimulus' && array_key_exists($sAttCode, $this->aExtraData) - && array_key_exists('plugin', $this->aExtraData[$sAttCode])){ + && array_key_exists('plugin', $this->aExtraData[$sAttCode])) { $sPluginName = $this->aExtraData[$sAttCode]['plugin']; - switch($sPluginName){ + switch ($sPluginName) { case AttachmentPlugIn::class: $this->AddAttachmentField($this->oForm, $sAttCode, $this->aExtraData); break; default: - throw new Exception('Unknown plugin ' . $sPluginName); + throw new Exception('Unknown plugin '.$sPluginName); } continue; } @@ -377,57 +368,44 @@ class ObjectFormManager extends FormManager /** @var Field $oField */ $oField = null; - if (is_callable([$oAttDef, 'MakeFormField'])) - { + if (is_callable([$oAttDef, 'MakeFormField'])) { $oField = $oAttDef->MakeFormField($this->oObject); } // Failsafe for AttributeType that would not have MakeFormField and therefore could not be used in a form - if ($oField !== null) - { - if ($this->sMode !== static::ENUM_MODE_VIEW) - { + if ($oField !== null) { + if ($this->sMode !== static::ENUM_MODE_VIEW) { // Field dependencies $aFieldDependencies = $oAttDef->GetPrerequisiteAttributes(); - if (!empty($aFieldDependencies)) - { + if (!empty($aFieldDependencies)) { $this->oForm->AddFieldDependencies($oField->GetId(), $aFieldDependencies); } // Setting the field flags // - If it's locked because slave, we force it as read only - if (($iFieldFlags & OPT_ATT_SLAVE) === OPT_ATT_SLAVE) - { + if (($iFieldFlags & OPT_ATT_SLAVE) === OPT_ATT_SLAVE) { $oField->SetReadOnly(true); } // - Else if it's must change (transition), we force it as mustchange, not readonly and not hidden - elseif (($iFieldFlags & OPT_ATT_MUSTCHANGE) === OPT_ATT_MUSTCHANGE && $this->IsTransitionForm()) - { + elseif (($iFieldFlags & OPT_ATT_MUSTCHANGE) === OPT_ATT_MUSTCHANGE && $this->IsTransitionForm()) { $oField->SetMustChange(true); $oField->SetReadOnly(false); $oField->SetHidden(false); } // - Else if it's must prompt (transition), we force it as not readonly and not hidden - elseif (($iFieldFlags & OPT_ATT_MUSTPROMPT) === OPT_ATT_MUSTPROMPT && $this->IsTransitionForm()) - { + elseif (($iFieldFlags & OPT_ATT_MUSTPROMPT) === OPT_ATT_MUSTPROMPT && $this->IsTransitionForm()) { $oField->SetReadOnly(false); $oField->SetHidden(false); } // - Else if it wasn't mandatory or already had a value, and it's hidden, we force it as hidden - elseif (($iFieldFlags & OPT_ATT_HIDDEN) === OPT_ATT_HIDDEN) - { + elseif (($iFieldFlags & OPT_ATT_HIDDEN) === OPT_ATT_HIDDEN) { $oField->SetHidden(true); - } - elseif (($iFieldFlags & OPT_ATT_READONLY) === OPT_ATT_READONLY) - { + } elseif (($iFieldFlags & OPT_ATT_READONLY) === OPT_ATT_READONLY) { $oField->SetReadOnly(true); - } - else - { + } else { // Normal field, use "flags" set by AttDef::MakeFormField() // Except if we are in a transition be cause $oAttDef doesn't know if the form is for a transition - if ($this->IsTransitionForm()) - { + if ($this->IsTransitionForm()) { $oField->SetReadOnly(false); $oField->SetHidden(false); $oField->SetMandatory(false); @@ -435,114 +413,110 @@ class ObjectFormManager extends FormManager } // Finally, if it's mandatory ... - if (($iFieldFlags & OPT_ATT_MANDATORY) === OPT_ATT_MANDATORY) - { + if (($iFieldFlags & OPT_ATT_MANDATORY) === OPT_ATT_MANDATORY) { // ... and when in a transition, we force it as mandatory - if ($this->IsTransitionForm() && $oAttDef->IsNull($this->oObject->Get($sAttCode))) - { + if ($this->IsTransitionForm() && $oAttDef->IsNull($this->oObject->Get($sAttCode))) { $oField->SetMandatory(true); } // .. and has no value, we force it as mandatory - elseif ($oAttDef->IsNull($this->oObject->Get($sAttCode))) - { + elseif ($oAttDef->IsNull($this->oObject->Get($sAttCode))) { $oField->SetMandatory(true); } } // Specific operation on field // - Field that require a transaction id - if (in_array(get_class($oField), - array('Combodo\\iTop\\Form\\Field\\TextAreaField', 'Combodo\\iTop\\Form\\Field\\CaseLogField'))) - { + if (in_array( + get_class($oField), + ['Combodo\\iTop\\Form\\Field\\TextAreaField', 'Combodo\\iTop\\Form\\Field\\CaseLogField'] + )) { /** @var \Combodo\iTop\Form\Field\TextAreaField|\Combodo\iTop\Form\Field\CaseLogField $oField */ $oField->SetTransactionId($this->oForm->GetTransactionId()); } // - Field that require a search endpoint - if (in_array(get_class($oField), - array('Combodo\\iTop\\Form\\Field\\SelectObjectField', 'Combodo\\iTop\\Form\\Field\\LinkedSetField'))) { + if (in_array( + get_class($oField), + ['Combodo\\iTop\\Form\\Field\\SelectObjectField', 'Combodo\\iTop\\Form\\Field\\LinkedSetField'] + )) { /** @var \Combodo\iTop\Form\Field\SelectObjectField|\Combodo\iTop\Form\Field\LinkedSetField $oField */ if ($this->oFormHandlerHelper !== null) { - $sSearchEndpoint = $this->oFormHandlerHelper->GetUrlGenerator()->generate('p_object_search_generic', array( + $sSearchEndpoint = $this->oFormHandlerHelper->GetUrlGenerator()->generate('p_object_search_generic', [ 'sTargetAttCode' => $oAttDef->GetCode(), 'sHostObjectClass' => get_class($this->oObject), 'sHostObjectId' => ($this->oObject->IsNew()) ? null : $this->oObject->GetKey(), 'ar_token' => $this->GetActionRulesToken(), - )); + ]); $oField->SetSearchEndpoint($sSearchEndpoint); } } // - Field that require an information endpoint - if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\LinkedSetField'))) { + if (in_array(get_class($oField), ['Combodo\\iTop\\Form\\Field\\LinkedSetField'])) { /** @var \Combodo\iTop\Form\Field\LinkedSetField $oField */ if ($this->oFormHandlerHelper !== null) { $oField->SetInformationEndpoint($this->oFormHandlerHelper->GetUrlGenerator()->generate('p_object_get_information_for_linked_set_json')); } } // - Field that require to apply scope on its DM OQL - if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\SelectObjectField'))) - { + if (in_array(get_class($oField), ['Combodo\\iTop\\Form\\Field\\SelectObjectField'])) { /** @var \Combodo\iTop\Form\Field\SelectObjectField $oField */ if ($this->oFormHandlerHelper !== null) { $oScopeOriginal = ($oField->GetSearch() !== null) ? $oField->GetSearch() : DBSearch::FromOQL($oAttDef->GetValuesDef()->GetFilterExpression()); /** @var \DBSearch $oScopeSearch */ - $oScopeSearch = $this->oFormHandlerHelper->GetScopeValidator()->GetScopeFilterForProfiles(UserRights::ListProfiles(), - $oScopeOriginal->GetClass(), UR_ACTION_READ); + $oScopeSearch = $this->oFormHandlerHelper->GetScopeValidator()->GetScopeFilterForProfiles( + UserRights::ListProfiles(), + $oScopeOriginal->GetClass(), + UR_ACTION_READ + ); if ($oScopeSearch === null) { IssueLog::Info(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' has no scope query for '.$oScopeOriginal->GetClass().' class.'); throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); } $oScopeOriginal = $oScopeOriginal->Intersect($oScopeSearch); // Note : This is to skip the silo restriction on the final query - if ($oScopeSearch->IsAllDataAllowed()) - { + if ($oScopeSearch->IsAllDataAllowed()) { $oScopeOriginal->AllowAllData(); } - $oScopeOriginal->SetInternalParams(array('this' => $this->oObject)); + $oScopeOriginal->SetInternalParams(['this' => $this->oObject]); $oField->SetSearch($oScopeOriginal); } } // - Field that require to check if the current value is among allowed ones - if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\SelectObjectField'))) - { + if (in_array(get_class($oField), ['Combodo\\iTop\\Form\\Field\\SelectObjectField'])) { // Note: We can't do this in AttributeExternalKey::MakeFormField() in the Field::SetOnFinalizeCallback() because at this point we have no information about the portal scope and ignore_silos flag, hence it always applies silos. // As a workaround we have to manually check if the field's current value is among the scope $oField->ResetCurrentValueIfNotAmongAllowedValues(); } // - Field that require processing on their subfields - if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\SubFormField'))) - { + if (in_array(get_class($oField), ['Combodo\\iTop\\Form\\Field\\SubFormField'])) { /** @var \Combodo\iTop\Form\Field\SubFormField $oField */ $oSubForm = $oField->GetForm(); - if ($oAttDef->GetEditClass() === 'CustomFields') - { + if ($oAttDef->GetEditClass() === 'CustomFields') { // Retrieving only user data fields (not the metadata fields of the template) - if ($oSubForm->HasField('user_data')) - { + if ($oSubForm->HasField('user_data')) { /** @var \Combodo\iTop\Form\Field\SubFormField $oUserDataField */ $oUserDataField = $oSubForm->GetField('user_data'); $oUserDataForm = $oUserDataField->GetForm(); - foreach ($oUserDataForm->GetFields() as $oCustomField) - { + foreach ($oUserDataForm->GetFields() as $oCustomField) { // - Field that require a search endpoint (OQL based dropdown list fields) - if (in_array(get_class($oCustomField), array('Combodo\\iTop\\Form\\Field\\SelectObjectField'))) - { + if (in_array(get_class($oCustomField), ['Combodo\\iTop\\Form\\Field\\SelectObjectField'])) { /** @var \Combodo\iTop\Form\Field\SelectObjectField $oCustomField */ if ($this->oFormHandlerHelper->GetUrlGenerator() !== null) { - $sSearchEndpoint = $this->oFormHandlerHelper->GetUrlGenerator()->generate('p_object_search_generic', - array( + $sSearchEndpoint = $this->oFormHandlerHelper->GetUrlGenerator()->generate( + 'p_object_search_generic', + [ 'sTargetAttCode' => $oAttDef->GetCode(), 'sHostObjectClass' => get_class($this->oObject), 'sHostObjectId' => ($this->oObject->IsNew()) ? null : $this->oObject->GetKey(), 'ar_token' => $this->GetActionRulesToken(), - )); + ] + ); $oCustomField->SetSearchEndpoint($sSearchEndpoint); } } // - Field that require to check if the current value is among allowed ones - if (in_array(get_class($oCustomField), array('Combodo\\iTop\\Form\\Field\\SelectObjectField'))) - { + if (in_array(get_class($oCustomField), ['Combodo\\iTop\\Form\\Field\\SelectObjectField'])) { /** @var \Combodo\iTop\Form\Field\SelectObjectField $oCustomField */ $oCustomField->ResetCurrentValueIfNotAmongAllowedValues(); } @@ -550,37 +524,34 @@ class ObjectFormManager extends FormManager } } } - } - else - { - if (($iFieldFlags & OPT_ATT_HIDDEN) === OPT_ATT_HIDDEN) - { + } else { + if (($iFieldFlags & OPT_ATT_HIDDEN) === OPT_ATT_HIDDEN) { $oField->SetHidden(true); - } - else - { + } else { $oField->SetReadOnly(true); } } // Specific operation on field // - LinkedSet - if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\LinkedSetField'))) - { + if (in_array(get_class($oField), ['Combodo\\iTop\\Form\\Field\\LinkedSetField'])) { /** @var \Combodo\iTop\Form\Field\LinkedSetField $oField */ /** @var \AttributeLinkedSetIndirect $oAttDef */ // - Overriding attributes to display if ($this->oFormHandlerHelper !== null) { // Note : This snippet is inspired from AttributeLinkedSet::MakeFormField() - $aAttCodesToDisplay = ApplicationHelper::GetLoadedListFromClass($this->oFormHandlerHelper->getCombodoPortalConf()['lists'], - $oField->GetTargetClass(), 'list'); + $aAttCodesToDisplay = ApplicationHelper::GetLoadedListFromClass( + $this->oFormHandlerHelper->getCombodoPortalConf()['lists'], + $oField->GetTargetClass(), + 'list' + ); // - Adding friendlyname attribute to the list is not already in it $sTitleAttCode = 'friendlyname'; if (($sTitleAttCode !== null) && !in_array($sTitleAttCode, $aAttCodesToDisplay)) { - $aAttCodesToDisplay = array_merge(array($sTitleAttCode), $aAttCodesToDisplay); + $aAttCodesToDisplay = array_merge([$sTitleAttCode], $aAttCodesToDisplay); } // - Adding attribute labels - $aAttributesToDisplay = array(); + $aAttributesToDisplay = []; foreach ($aAttCodesToDisplay as $sAttCodeToDisplay) { $oAttDefToDisplay = MetaModel::GetAttributeDef($oField->GetTargetClass(), $sAttCodeToDisplay); $aAttributesToDisplay[$sAttCodeToDisplay] = [ @@ -598,7 +569,7 @@ class ObjectFormManager extends FormManager } // - Filtering links regarding scopes if ($this->oFormHandlerHelper !== null) { - $aLimitedAccessItemIDs = array(); + $aLimitedAccessItemIDs = []; /** @var \ormLinkSet $oFieldOriginalSet */ $oFieldOriginalSet = $oField->GetCurrentValue(); @@ -617,19 +588,16 @@ class ObjectFormManager extends FormManager $oField->SetLimitedAccessItemIDs($aLimitedAccessItemIDs); } // - Displaying as opened - if (array_key_exists($sAttCode, $this->aExtraData) && array_key_exists('opened', $this->aExtraData[$sAttCode])) - { + if (array_key_exists($sAttCode, $this->aExtraData) && array_key_exists('opened', $this->aExtraData[$sAttCode])) { $oField->SetDisplayOpened(true); } // - Displaying out of scopes items - if (array_key_exists($sAttCode, $this->aExtraData) && array_key_exists('ignore_scopes', $this->aExtraData[$sAttCode])) - { + if (array_key_exists($sAttCode, $this->aExtraData) && array_key_exists('ignore_scopes', $this->aExtraData[$sAttCode])) { $oField->SetDisplayLimitedAccessItems(true); } } // - BlobField - if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\BlobField', 'Combodo\\iTop\\Form\\Field\\ImageField'))) - { + if (in_array(get_class($oField), ['Combodo\\iTop\\Form\\Field\\BlobField', 'Combodo\\iTop\\Form\\Field\\ImageField'])) { // - Overriding attributes to display if ($this->oFormHandlerHelper !== null) { // Override hardcoded URLs in ormDocument pointing to back office console @@ -654,9 +622,7 @@ class ObjectFormManager extends FormManager } } - } - else - { + } else { $oField = new LabelField($sAttCode); $oField->SetReadOnly(true) ->SetHidden(false) @@ -665,8 +631,7 @@ class ObjectFormManager extends FormManager } // Setting field display mode - if (array_key_exists($sAttCode, $this->aExtraData) && array_key_exists('display_mode', $this->aExtraData[$sAttCode])) - { + if (array_key_exists($sAttCode, $this->aExtraData) && array_key_exists('display_mode', $this->aExtraData[$sAttCode])) { $oField->SetDisplayMode($this->aExtraData[$sAttCode]['display_mode']); } @@ -678,32 +643,25 @@ class ObjectFormManager extends FormManager // Do not add hidden fields as they are of no use, if one is necessary because another depends on it, it will be automatically added. // Note: We do this at the end because during the process an hidden field could have become writable if mandatory and empty for example. - if($oField->GetHidden() === false) - { + if ($oField->GetHidden() === false) { $this->oForm->AddField($oField); } else { - $this->aHiddenFieldsId[]=$oField->GetId(); + $this->aHiddenFieldsId[] = $oField->GetId(); } } // Checking dependencies to ensure that all needed fields are in the form // (This is kind of a garbage collector for dependencies) - foreach ($this->oForm->GetDependencies() as $sImpactedFieldId => $aDependencies) - { - foreach ($aDependencies as $sDependencyFieldId) - { - if (!$this->oForm->HasField($sDependencyFieldId)) - { - try - { + foreach ($this->oForm->GetDependencies() as $sImpactedFieldId => $aDependencies) { + foreach ($aDependencies as $sDependencyFieldId) { + if (!$this->oForm->HasField($sDependencyFieldId)) { + try { $oAttDef = MetaModel::GetAttributeDef(get_class($this->oObject), $sDependencyFieldId); $oField = $oAttDef->MakeFormField($this->oObject); $oField->SetHidden(true); $this->oForm->AddField($oField); - } - catch (Exception $e) - { + } catch (Exception $e) { // Avoid blocking a form if a RequestTemplate reference a bad attribute (e.g. :this->id) IssueLog::Error('May be a bad OQL (referencing :this->id) in a RequestTemplate causes the following error'); IssueLog::Error($e); @@ -717,7 +675,7 @@ class ObjectFormManager extends FormManager if ($this->sMode !== 'apply_stimulus' && class_exists('Attachment') && class_exists('AttachmentPlugIn') && !$this->IsPluginInitialized(AttachmentPlugIn::class) - && AttachmentPlugIn::IsAttachmentAllowedForObject($this->oObject)){ + && AttachmentPlugIn::IsAttachmentAllowedForObject($this->oObject)) { $this->AddAttachmentField($this->oForm, 'attachments_plugin', $this->aExtraData); } @@ -732,7 +690,7 @@ class ObjectFormManager extends FormManager * * @return bool */ - private function IsPluginInitialized(string $sPluginName) : bool + private function IsPluginInitialized(string $sPluginName): bool { return array_key_exists($sPluginName, $this->aPlugins); } @@ -746,48 +704,54 @@ class ObjectFormManager extends FormManager * * @throws \Exception */ - private function AddAttachmentField($oForm, $sId, $aFieldsExtraData) : void + private function AddAttachmentField($oForm, $sId, $aFieldsExtraData): void { // only one instance allowed - if($this->IsPluginInitialized(AttachmentPlugIn::class)){ - throw new Exception("Unable to process field `$sId`, AttachmentPlugIn has already been initialized with field `" . $this->aPlugins[AttachmentPlugIn::class]['field']->GetId() . '`'); + if ($this->IsPluginInitialized(AttachmentPlugIn::class)) { + throw new Exception("Unable to process field `$sId`, AttachmentPlugIn has already been initialized with field `".$this->aPlugins[AttachmentPlugIn::class]['field']->GetId().'`'); } // not allowed for object class - if(!AttachmentPlugIn::IsAttachmentAllowedForObject($this->oObject)){ - throw new Exception("Unable to process field `$sId`, AttachmentPlugIn is not allowed for class `" . $this->oObject::class . '`'); + if (!AttachmentPlugIn::IsAttachmentAllowedForObject($this->oObject)) { + throw new Exception("Unable to process field `$sId`, AttachmentPlugIn is not allowed for class `".$this->oObject::class.'`'); } // set id to a unique key - avoid collisions with another attribute that could exist with the name 'attachments' $oField = new FileUploadField($sId); $oField->SetLabel(Dict::S('Portal:Attachments')) ->SetUploadEndpoint($this->oFormHandlerHelper->GetUrlGenerator()->generate('p_object_attachment_add')) - ->SetDownloadEndpoint($this->oFormHandlerHelper->GetUrlGenerator()->generate('p_object_attachment_download', - array('sAttachmentId' => '-sAttachmentId-'))) - ->SetDisplayEndpoint($this->oFormHandlerHelper->GetUrlGenerator()->generate('p_object_attachment_display', - array('sAttachmentId' => '-sAttachmentId-'))) + ->SetDownloadEndpoint($this->oFormHandlerHelper->GetUrlGenerator()->generate( + 'p_object_attachment_download', + ['sAttachmentId' => '-sAttachmentId-'] + )) + ->SetDisplayEndpoint($this->oFormHandlerHelper->GetUrlGenerator()->generate( + 'p_object_attachment_display', + ['sAttachmentId' => '-sAttachmentId-'] + )) ->SetTransactionId($oForm->GetTransactionId()) ->SetAllowDelete($this->oFormHandlerHelper->getCombodoPortalConf()['properties']['attachments']['allow_delete']) ->SetObject($this->oObject); // Checking if we can edit attachments in the current state $oObjectFormManager = $this; - $oField->SetOnFinalizeCallback(function() use ($oObjectFormManager, $oForm, $oField){ + $oField->SetOnFinalizeCallback(function () use ($oObjectFormManager, $oForm, $oField) { if (($oObjectFormManager->sMode === static::ENUM_MODE_VIEW) - || AttachmentPlugIn::IsReadonlyState($oObjectFormManager->oObject, $oObjectFormManager->oObject->GetState(), - AttachmentPlugIn::ENUM_GUI_PORTALS) === true - || $oForm->GetEditableFieldCount(true) === 0) - { + || AttachmentPlugIn::IsReadonlyState( + $oObjectFormManager->oObject, + $oObjectFormManager->oObject->GetState(), + AttachmentPlugIn::ENUM_GUI_PORTALS + ) === true + || $oForm->GetEditableFieldCount(true) === 0) { $oField->SetReadOnly(true); } }); - if (array_key_exists($sId, $aFieldsExtraData) && array_key_exists('opened', $aFieldsExtraData[$sId])){ + if (array_key_exists($sId, $aFieldsExtraData) && array_key_exists('opened', $aFieldsExtraData[$sId])) { $oField->SetDisplayOpened(true); } // Adding attachments field in transition only if it is editable - if (!$this->IsTransitionForm() || !$oField->GetReadOnly()){ + if (!$this->IsTransitionForm() || !$oField->GetReadOnly()) { $oForm->AddField($oField); } @@ -810,8 +774,7 @@ class ObjectFormManager extends FormManager { // Ask to each field to clean itself /** @var \Combodo\iTop\Form\Field\Field $oField */ - foreach ($this->oForm->GetFields() as $oField) - { + foreach ($this->oForm->GetFields() as $oField) { $oField->OnCancel(); } // Then clean inline images from rich text editor such as TextareaField @@ -837,7 +800,7 @@ class ObjectFormManager extends FormManager } $aData['messages']['error'] += [ - '_main' => [$sError] + '_main' => [$sError], ]; $aData['valid'] = false; } @@ -875,8 +838,7 @@ class ObjectFormManager extends FormManager $this->OnUpdate($aArgs); // Check if form valid - if (! $this->oForm->Validate()) - { + if (! $this->oForm->Validate()) { // Handle errors $aData['valid'] = false; $aData['messages']['error'] += $this->oForm->GetErrorMessages(); @@ -901,8 +863,7 @@ class ObjectFormManager extends FormManager } // Writing object to DB - try - { + try { $this->oObject->DBWrite(); } catch (CoreCannotSaveObjectException $e) { throw new Exception($e->getTextMessage()); @@ -929,34 +890,29 @@ class ObjectFormManager extends FormManager InlineImage::FinalizeInlineImages($this->oObject); // Finalizing attachments link to object // TODO : This has to be refactored when the function from itop-attachments has been migrated into the core - if (isset($aArgs['attachmentIds'])) - { + if (isset($aArgs['attachmentIds'])) { $this->FinalizeAttachments($aArgs['attachmentIds']); } // Checking if we have to apply a stimulus - if (isset($aArgs['applyStimulus'])) - { + if (isset($aArgs['applyStimulus'])) { $this->oObject->ApplyStimulus($aArgs['applyStimulus']['code']); } // Activating triggers only on update - if ($bActivateTriggers) - { + if ($bActivateTriggers) { $sTriggersQuery = $this->oFormHandlerHelper->getCombodoPortalConf()['properties']['triggers_query']; - if ($sTriggersQuery !== null) - { + if ($sTriggersQuery !== null) { $aParentClasses = MetaModel::EnumParentClasses($sObjectClass, ENUM_PARENT_CLASSES_ALL); - $oTriggerSet = new DBObjectSet(DBObjectSearch::FromOQL($sTriggersQuery), array(), - array('parent_classes' => $aParentClasses)); + $oTriggerSet = new DBObjectSet( + DBObjectSearch::FromOQL($sTriggersQuery), + [], + ['parent_classes' => $aParentClasses] + ); /** @var \Trigger $oTrigger */ - while ($oTrigger = $oTriggerSet->Fetch()) - { - try - { + while ($oTrigger = $oTriggerSet->Fetch()) { + try { $oTrigger->DoActivate($this->oObject->ToArgs('this')); - } - catch(Exception $e) - { + } catch (Exception $e) { utils::EnrichRaisedException($oTrigger, $e); } } @@ -966,30 +922,24 @@ class ObjectFormManager extends FormManager // Resetting caselog fields value, otherwise the value will stay in it after submit. $this->oForm->ResetCaseLogFields(); - if ($bWasModified) - { + if ($bWasModified) { //=if (isNew) because $bActivateTriggers = (!$this->oObject->IsNew() && $this->oObject->IsModified()) - if(!$bActivateTriggers) - { - $aData['messages']['success'] += array( '_main' => array(Dict::Format('UI:Title:Object_Of_Class_Created', $this->oObject->GetName(),MetaModel::GetName(get_class($this->oObject))))); - } - else - { - $aData['messages']['success'] += array('_main' => array(Dict::Format('UI:Class_Object_Updated', MetaModel::GetName(get_class($this->oObject)), $this->oObject->GetName()))); + if (!$bActivateTriggers) { + $aData['messages']['success'] += [ '_main' => [Dict::Format('UI:Title:Object_Of_Class_Created', $this->oObject->GetName(), MetaModel::GetName(get_class($this->oObject)))]]; + } else { + $aData['messages']['success'] += ['_main' => [Dict::Format('UI:Class_Object_Updated', MetaModel::GetName(get_class($this->oObject)), $this->oObject->GetName())]]; } } - } - catch (CoreCannotSaveObjectException $e) { + } catch (CoreCannotSaveObjectException $e) { $aData['valid'] = false; - $aData['messages']['error'] += array('_main' => array($e->getTextMessage())); + $aData['messages']['error'] += ['_main' => [$e->getTextMessage()]]; if (false === $bExceptionLogged) { IssueLog::Error(__METHOD__.' at line '.__LINE__.' : '.$e->getMessage()); } - } - catch (Exception $e) { + } catch (Exception $e) { $aData['valid'] = false; $aData['messages']['error'] += [ - '_main' => [ ($e instanceof CoreCannotSaveObjectException) ? $e->getTextMessage() : $e->getMessage()] + '_main' => [ ($e instanceof CoreCannotSaveObjectException) ? $e->getTextMessage() : $e->getMessage()], ]; if (false === $bExceptionLogged) { IssueLog::Error(__METHOD__.' at line '.__LINE__.' : '.$e->getMessage()); @@ -1016,11 +966,9 @@ class ObjectFormManager extends FormManager { $aFormProperties = []; - if (is_array($aArgs)) - { + if (is_array($aArgs)) { // Then we retrieve properties of the form to build - if (isset($aArgs['formProperties'])) - { + if (isset($aArgs['formProperties'])) { $aFormProperties = $aArgs['formProperties']; } } @@ -1054,20 +1002,17 @@ class ObjectFormManager extends FormManager */ protected function FinalizeAttachments($aAttachmentIds) { - $aRemovedAttachmentsIds = (isset($aAttachmentIds['removed_attachments_ids'])) ? $aAttachmentIds['removed_attachments_ids'] : array(); + $aRemovedAttachmentsIds = (isset($aAttachmentIds['removed_attachments_ids'])) ? $aAttachmentIds['removed_attachments_ids'] : []; // Not used for now. //$aActualAttachmentsIds = (isset($aAttachmentIds['actual_attachments_ids'])) ? $aAttachmentIds['actual_attachments_ids'] : array(); - $aActions = array(); + $aActions = []; // Removing attachments from currents - if (!empty($aRemovedAttachmentsIds)) - { + if (!empty($aRemovedAttachmentsIds)) { $oSearch = DBObjectSearch::FromOQL("SELECT Attachment WHERE item_class = :class AND item_id = :item_id"); - $oSet = new DBObjectSet($oSearch, array(), array('class' => get_class($this->oObject), 'item_id' => $this->oObject->GetKey())); - while ($oAttachment = $oSet->Fetch()) - { + $oSet = new DBObjectSet($oSearch, [], ['class' => get_class($this->oObject), 'item_id' => $this->oObject->GetKey()]); + while ($oAttachment = $oSet->Fetch()) { // Remove attachments that are no longer attached to the current object - if (in_array($oAttachment->GetKey(), $aRemovedAttachmentsIds)) - { + if (in_array($oAttachment->GetKey(), $aRemovedAttachmentsIds)) { $aData = ['attachment' => $oAttachment]; $this->oObject->FireEvent(EVENT_REMOVE_ATTACHMENT_FROM_OBJECT, $aData); $oAttachment->DBDelete(); @@ -1080,16 +1025,12 @@ class ObjectFormManager extends FormManager $sTempId = utils::GetUploadTempId($this->oForm->GetTransactionId()); $sOQL = 'SELECT Attachment WHERE temp_id = :temp_id'; $oSearch = DBObjectSearch::FromOQL($sOQL); - $oSet = new DBObjectSet($oSearch, array(), array('temp_id' => $sTempId)); - while ($oAttachment = $oSet->Fetch()) - { + $oSet = new DBObjectSet($oSearch, [], ['temp_id' => $sTempId]); + while ($oAttachment = $oSet->Fetch()) { // Temp attachment removed - if (in_array($oAttachment->GetKey(), $aRemovedAttachmentsIds)) - { + if (in_array($oAttachment->GetKey(), $aRemovedAttachmentsIds)) { $oAttachment->DBDelete(); - } - else - { + } else { $oAttachment->SetItem($this->oObject); $oAttachment->Set('temp_id', ''); $oAttachment->DBUpdate(); @@ -1101,8 +1042,7 @@ class ObjectFormManager extends FormManager // Save changes to current object history // inspired from itop-attachments/main.attachments.php / RecordHistory - foreach ($aActions as $oChangeOp) - { + foreach ($aActions as $oChangeOp) { $oChangeOp->Set("objclass", get_class($this->oObject)); $oChangeOp->Set("objkey", $this->oObject->GetKey()); $oChangeOp->DBInsertNoReload(); @@ -1125,9 +1065,8 @@ class ObjectFormManager extends FormManager $sTempId = utils::GetUploadTempId($this->oForm->GetTransactionId()); $sOQL = 'SELECT Attachment WHERE temp_id = :temp_id'; $oSearch = DBObjectSearch::FromOQL($sOQL); - $oSet = new DBObjectSet($oSearch, array(), array('temp_id' => $sTempId)); - while ($oAttachment = $oSet->Fetch()) - { + $oSet = new DBObjectSet($oSearch, [], ['temp_id' => $sTempId]); + while ($oAttachment = $oSet->Fetch()) { $oAttachment->DBDelete(); } } @@ -1147,14 +1086,11 @@ class ObjectFormManager extends FormManager { $oBlob = $oAttachment->Get('contents'); $sFileName = $oBlob->GetFileName(); - if ($bCreate) - { + if ($bCreate) { $oChangeOp = new CMDBChangeOpAttachmentAdded(); $oChangeOp->Set('attachment_id', $oAttachment->GetKey()); $oChangeOp->Set('filename', $sFileName); - } - else - { + } else { $oChangeOp = new CMDBChangeOpAttachmentRemoved(); $oChangeOp->Set('filename', $sFileName); } @@ -1238,8 +1174,7 @@ class ObjectFormManager extends FormManager { $sObjectClass = get_class($this->oObject); - foreach ($aCurrentValues as $sAttCode => $value) - { + foreach ($aCurrentValues as $sAttCode => $value) { if (count($this->aFieldsAtts) !== 0) { if (!array_key_exists($sAttCode, $this->aFieldsAtts)) { continue; @@ -1342,8 +1277,7 @@ class ObjectFormManager extends FormManager } $oOrmSet->ApplyDelta(json_decode($value, true)); $this->oObject->Set($sAttCode, $oOrmSet); - } elseif ($oAttDef instanceof AttributeDateTime) // AttributeDate is derived from AttributeDateTime - { + } elseif ($oAttDef instanceof AttributeDateTime) { // AttributeDate is derived from AttributeDateTime if ($value != null) { $value = $oAttDef->GetFormat()->Parse($value); if (is_object($value)) { @@ -1351,11 +1285,9 @@ class ObjectFormManager extends FormManager } } $this->oObject->Set($sAttCode, $value); - } - elseif ($oAttDef->IsScalar() && is_array($value)) { + } elseif ($oAttDef->IsScalar() && is_array($value)) { $this->oObject->Set($sAttCode, current($value)); - } - elseif ($oAttDef->GetEditClass() === 'CustomFields') { + } elseif ($oAttDef->GetEditClass() === 'CustomFields') { // We don't update attribute as ormCustomField comparaison is not working as excepted. // When several templates available, "template_id" is not sent by the portal has it is a read-only select input // therefore, the TemplateFieldsHandler::CompareValues() doesn't work. @@ -1377,8 +1309,7 @@ class ObjectFormManager extends FormManager $this->oObject->Set($sAttCode, $value); } // Else don't update! Otherwise we might loose current value - } - else { + } else { $this->oObject->Set($sAttCode, $value); } } @@ -1400,9 +1331,9 @@ class ObjectFormManager extends FormManager public function PrepareFields(): void { $sObjectClass = get_class($this->oObject); - $this->aFieldsAtts = array(); - $this->aExtraData = array(); - $aFieldsDMOnlyAttCodes = array(); + $this->aFieldsAtts = []; + $this->aExtraData = []; + $aFieldsDMOnlyAttCodes = []; if (array_key_exists('type', $this->aFormProperties)) { switch ($this->aFormProperties['type']) { case 'custom_list': @@ -1518,8 +1449,7 @@ class ObjectFormManager extends FormManager if (array_key_exists('type', $this->aFormProperties) && $this->aFormProperties['type'] !== 'static') { if ($this->IsTransitionForm()) { $aDatamodelAttCodes = $this->oObject->GetTransitionAttributes($this->aFormProperties['stimulus_code']); - } - else { + } else { $aDatamodelAttCodes = MetaModel::ListAttributeDefs($sObjectClass); } @@ -1536,12 +1466,10 @@ class ObjectFormManager extends FormManager // Retrieving only mandatory flag from DM when on a transition $iFieldFlags = $value & OPT_ATT_MANDATORY; $oAttDef = MetaModel::GetAttributeDef(get_class($this->oObject), $sAttCode); - } - elseif ($this->oObject->IsNew()) { + } elseif ($this->oObject->IsNew()) { $iFieldFlags = $this->oObject->GetInitialStateAttributeFlags($sAttCode); $oAttDef = $value; - } - else { + } else { $iFieldFlags = $this->oObject->GetAttributeFlags($sAttCode); $oAttDef = $value; } @@ -1581,11 +1509,9 @@ class ObjectFormManager extends FormManager if ($this->IsTransitionForm()) { $aTransitionAtts = $this->oObject->GetTransitionAttributes($this->aFormProperties['stimulus_code']); $iFieldFlags = $aTransitionAtts[$sAttCode]; - } - elseif ($this->oObject->IsNew()) { + } elseif ($this->oObject->IsNew()) { $iFieldFlags = $this->oObject->GetInitialStateAttributeFlags($sAttCode); - } - else { + } else { $iFieldFlags = $this->oObject->GetAttributeFlags($sAttCode); } @@ -1629,7 +1555,7 @@ class ObjectFormManager extends FormManager $sRendered = $this->oFormHandlerHelper->RenderFormFromTwig( 999, // doesn't matter here $this->aFormProperties['layout']['content'], - array('oRenderer' => $this->oRenderer, 'oObject' => $this->oObject) + ['oRenderer' => $this->oRenderer, 'oObject' => $this->oObject] ); } else { $sRendered = 'Form not rendered because of missing container'; diff --git a/datamodels/2.x/itop-portal-base/portal/src/Form/PasswordFormManager.php b/datamodels/2.x/itop-portal-base/portal/src/Form/PasswordFormManager.php index 469bef628..096b2a767 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Form/PasswordFormManager.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Form/PasswordFormManager.php @@ -39,7 +39,7 @@ use UserRights; class PasswordFormManager extends FormManager { /** @var string FORM_TYPE */ - const FORM_TYPE = 'change_password'; + public const FORM_TYPE = 'change_password'; /** * @throws \Exception @@ -106,87 +106,66 @@ class PasswordFormManager extends FormManager $this->OnUpdate($aArgs); // Check if form valid - if ($this->oForm->Validate()) - { + if ($this->oForm->Validate()) { // The try catch is essentially to start a MySQL transaction - try - { + try { // Updating password $sAuthUser = Session::Get('auth_user'); $sOldPassword = $this->oForm->GetField('old_password')->GetCurrentValue(); $sNewPassword = $this->oForm->GetField('new_password')->GetCurrentValue(); $sConfirmPassword = $this->oForm->GetField('confirm_password')->GetCurrentValue(); - if ($sOldPassword !== '' && $sNewPassword !== '' && $sConfirmPassword !== '') - { - if (!UserRights::CanChangePassword()) - { + if ($sOldPassword !== '' && $sNewPassword !== '' && $sConfirmPassword !== '') { + if (!UserRights::CanChangePassword()) { $aData['valid'] = false; - $aData['messages']['error'] += array( - '_main' => array( + $aData['messages']['error'] += [ + '_main' => [ Dict::Format('Brick:Portal:UserProfile:Password:CantChangeContactAdministrator', ITOP_APPLICATION_SHORT), - ), - ); - } - else - { - if (!UserRights::CheckCredentials($sAuthUser, $sOldPassword)) - { + ], + ]; + } else { + if (!UserRights::CheckCredentials($sAuthUser, $sOldPassword)) { $aData['valid'] = false; - $aData['messages']['error'] += array('old_password' => array(Dict::S('UI:Login:IncorrectOldPassword'))); - } - else - { - if ($sNewPassword !== $sConfirmPassword) - { + $aData['messages']['error'] += ['old_password' => [Dict::S('UI:Login:IncorrectOldPassword')]]; + } else { + if ($sNewPassword !== $sConfirmPassword) { $aData['valid'] = false; - $aData['messages']['error'] += array('confirm_password' => array(Dict::S('UI:Login:RetypePwdDoesNotMatch'))); - } - elseif ($sNewPassword === $sOldPassword) - { + $aData['messages']['error'] += ['confirm_password' => [Dict::S('UI:Login:RetypePwdDoesNotMatch')]]; + } elseif ($sNewPassword === $sOldPassword) { $aData['valid'] = false; - $aData['messages']['error'] += array('new_password' => array(Dict::S('UI:Login:PasswordNotChanged'))); - } - else - { + $aData['messages']['error'] += ['new_password' => [Dict::S('UI:Login:PasswordNotChanged')]]; + } else { try { - if (!UserRights::ChangePassword($sOldPassword, $sNewPassword)) - { + if (!UserRights::ChangePassword($sOldPassword, $sNewPassword)) { $aData['valid'] = false; - $aData['messages']['error'] += array( - 'confirm_password' => array( - Dict::Format('Brick:Portal:UserProfile:Password:CantChangeForUnknownReason', - ITOP_APPLICATION_SHORT), - ), - ); + $aData['messages']['error'] += [ + 'confirm_password' => [ + Dict::Format( + 'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason', + ITOP_APPLICATION_SHORT + ), + ], + ]; + } else { + $aData['messages']['success'] += ['_main' => [Dict::S('Brick:Portal:Object:Form:Message:Saved')]]; } - else - { - $aData['messages']['success'] += array('_main' => array(Dict::S('Brick:Portal:Object:Form:Message:Saved'))); - } - } - catch (\CoreCannotSaveObjectException $e) - { + } catch (\CoreCannotSaveObjectException $e) { $aData['valid'] = false; - $aData['messages']['error'] += array( + $aData['messages']['error'] += [ 'new_password' => $e->getIssues(), - 'confirm_password' => array(), - ); + 'confirm_password' => [], + ]; } } } } } - } - catch (Exception $e) - { + } catch (Exception $e) { $aData['valid'] = false; - $aData['messages']['error'] += array('_main' => array($e->getMessage())); + $aData['messages']['error'] += ['_main' => [$e->getMessage()]]; IssueLog::Error(__METHOD__.' at line '.__LINE__.' : Exception during submit ('.$e->getMessage().')'); } - } - else - { + } else { // Handle errors $aData['valid'] = false; $aData['messages']['error'] += $this->oForm->GetErrorMessages(); @@ -207,12 +186,9 @@ class PasswordFormManager extends FormManager $this->Build(); // Then we update it with new values - if (is_array($aArgs)) - { - if (isset($aArgs['currentValues'])) - { - foreach ($aArgs['currentValues'] as $sPreferenceName => $value) - { + if (is_array($aArgs)) { + if (isset($aArgs['currentValues'])) { + foreach ($aArgs['currentValues'] as $sPreferenceName => $value) { $this->oForm->GetField($sPreferenceName)->SetCurrentValue($value); } } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Form/PreferencesFormManager.php b/datamodels/2.x/itop-portal-base/portal/src/Form/PreferencesFormManager.php index c41f71326..d56ffdd3c 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Form/PreferencesFormManager.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Form/PreferencesFormManager.php @@ -39,7 +39,7 @@ use UserRights; class PreferencesFormManager extends FormManager { /** @var string FORM_TYPE */ - const FORM_TYPE = 'preferences'; + public const FORM_TYPE = 'preferences'; /** * @throws \Exception @@ -63,9 +63,8 @@ class PreferencesFormManager extends FormManager ->SetCurrentValue(Dict::GetUserLanguage()) ->SetStartsWithNullChoice(false); // - Preparing choices - $aChoices = array(); - foreach (Dict::GetLanguages() as $sCode => $aLanguage) - { + $aChoices = []; + foreach (Dict::GetLanguages() as $sCode => $aLanguage) { $aChoices[$sCode] = $aLanguage['description'].' ('.$aLanguage['localized_description'].')'; } asort($aChoices); @@ -109,11 +108,9 @@ class PreferencesFormManager extends FormManager $this->OnUpdate($aArgs); // Check if form valid - if ($this->oForm->Validate()) - { + if ($this->oForm->Validate()) { // The try catch is essentially to start a MySQL transaction - try - { + try { // Starting transaction CMDBSource::Query('START TRANSACTION'); $iFieldChanged = 0; @@ -123,34 +120,28 @@ class PreferencesFormManager extends FormManager $oCurUser = UserRights::GetUserObject(); // - Language $sLanguage = $this->oForm->GetField('language')->GetCurrentValue(); - if (($sLanguage !== null) && ($oCurUser->Get('language') !== $sLanguage)) - { + if (($sLanguage !== null) && ($oCurUser->Get('language') !== $sLanguage)) { $oCurUser->Set('language', $sLanguage); $iFieldChanged++; } // Updating only if preferences changed - if ($iFieldChanged > 0) - { + if ($iFieldChanged > 0) { $oCurUser->AllowWrite(true); $oCurUser->DBUpdate(); - $aData['messages']['success'] += array('_main' => array(Dict::S('Brick:Portal:Object:Form:Message:Saved'))); + $aData['messages']['success'] += ['_main' => [Dict::S('Brick:Portal:Object:Form:Message:Saved')]]; } // Ending transaction with a commit as everything was fine CMDBSource::Query('COMMIT'); - } - catch (Exception $e) - { + } catch (Exception $e) { // End transaction with a rollback as something failed CMDBSource::Query('ROLLBACK'); $aData['valid'] = false; - $aData['messages']['error'] += array('_main' => array($e->getMessage())); + $aData['messages']['error'] += ['_main' => [$e->getMessage()]]; IssueLog::Error(__METHOD__.' at line '.__LINE__.' : Rollback during submit ('.$e->getMessage().')'); } - } - else - { + } else { // Handle errors $aData['valid'] = false; $aData['messages']['error'] += $this->oForm->GetErrorMessages(); @@ -171,12 +162,9 @@ class PreferencesFormManager extends FormManager $this->Build(); // Then we update it with new values - if (is_array($aArgs)) - { - if (isset($aArgs['currentValues'])) - { - foreach ($aArgs['currentValues'] as $sPreferenceName => $value) - { + if (is_array($aArgs)) { + if (isset($aArgs['currentValues'])) { + foreach ($aArgs['currentValues'] as $sPreferenceName => $value) { $this->oForm->GetField($sPreferenceName)->SetCurrentValue($value); } } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/ApplicationHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/ApplicationHelper.php index cbd7c6a4f..c0f551b3a 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/ApplicationHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/ApplicationHelper.php @@ -41,13 +41,13 @@ use utils; class ApplicationHelper { /** @var string FORM_ENUM_DISPLAY_MODE_COSY */ - const FORM_ENUM_DISPLAY_MODE_COSY = 'cosy'; + public const FORM_ENUM_DISPLAY_MODE_COSY = 'cosy'; /** @var string FORM_ENUM_DISPLAY_MODE_COMPACT */ - const FORM_ENUM_DISPLAY_MODE_COMPACT = 'compact'; + public const FORM_ENUM_DISPLAY_MODE_COMPACT = 'compact'; /** @var string FORM_DEFAULT_DISPLAY_MODE */ - const FORM_DEFAULT_DISPLAY_MODE = self::FORM_ENUM_DISPLAY_MODE_COSY; + public const FORM_DEFAULT_DISPLAY_MODE = self::FORM_ENUM_DISPLAY_MODE_COSY; /** @var bool FORM_DEFAULT_ALWAYS_SHOW_SUBMIT */ - const FORM_DEFAULT_ALWAYS_SHOW_SUBMIT = false; + public const FORM_DEFAULT_ALWAYS_SHOW_SUBMIT = false; /** * Loads classes from the base portal @@ -72,16 +72,11 @@ class ApplicationHelper ); // Loading classes from base portal - foreach (scandir($sScannedDir) as $sFile) - { - if (strpos($sFile, $sFilePattern) !== false && file_exists($sFilepath = $sScannedDir.'/'.$sFile)) - { - try - { + foreach (scandir($sScannedDir) as $sFile) { + if (strpos($sFile, $sFilePattern) !== false && file_exists($sFilepath = $sScannedDir.'/'.$sFile)) { + try { require_once $sFilepath; - } - catch (Exception $e) - { + } catch (Exception $e) { throw new Exception('Error while trying to load '.$sType.' '.$sFile); } } @@ -97,32 +92,25 @@ class ApplicationHelper */ public static function LoadBrickSecurity(AbstractBrick $oBrick) { - try - { + try { // Allowed profiles - if (utils::IsNotNullOrEmptyString($oBrick->GetAllowedProfilesOql())) - { + if (utils::IsNotNullOrEmptyString($oBrick->GetAllowedProfilesOql())) { $oSearch = DBObjectSearch::FromOQL_AllData($oBrick->GetAllowedProfilesOql()); $oSet = new DBObjectSet($oSearch); - while ($oProfile = $oSet->Fetch()) - { + while ($oProfile = $oSet->Fetch()) { $oBrick->AddAllowedProfile($oProfile->Get('name')); } } // Denied profiles - if (utils::IsNotNullOrEmptyString($oBrick->GetDeniedProfilesOql())) - { + if (utils::IsNotNullOrEmptyString($oBrick->GetDeniedProfilesOql())) { $oSearch = DBObjectSearch::FromOQL_AllData($oBrick->GetDeniedProfilesOql()); $oSet = new DBObjectSet($oSearch); - while ($oProfile = $oSet->Fetch()) - { + while ($oProfile = $oSet->Fetch()) { $oBrick->AddDeniedProfile($oProfile->Get('name')); } } - } - catch (Exception $e) - { + } catch (Exception $e) { throw new Exception('Error while loading security from '.$oBrick->GetId().' brick'); } } @@ -147,18 +135,14 @@ class ApplicationHelper $aForm = null; // We try to find the form for that class - if (isset($aForms[$sClass]) && isset($aForms[$sClass][$sMode])) - { + if (isset($aForms[$sClass]) && isset($aForms[$sClass][$sMode])) { $aForm = $aForms[$sClass][$sMode]; } // If not found, we try find one from the closest parent class - else - { + else { $bFound = false; - foreach (MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_EXCLUDELEAF, false) as $sParentClass) - { - if (isset($aForms[$sParentClass]) && isset($aForms[$sParentClass][$sMode])) - { + foreach (MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_EXCLUDELEAF, false) as $sParentClass) { + if (isset($aForms[$sParentClass]) && isset($aForms[$sParentClass][$sMode])) { $aForm = $aForms[$sParentClass][$sMode]; $bFound = true; break; @@ -166,8 +150,7 @@ class ApplicationHelper } // If we have still not found one, we return a default form - if (!$bFound) - { + if (!$bFound) { $aForm = static::GenerateDefaultFormForClass($sClass); } } @@ -192,32 +175,26 @@ class ApplicationHelper public static function GetLoadedListFromClass($aLists, $sClass, $sList = 'default') { $aFoundList = null; - $aAttCodes = array(); + $aAttCodes = []; // We try to find the list for that class - if (isset($aLists[$sClass]) && isset($aLists[$sClass][$sList])) - { + if (isset($aLists[$sClass]) && isset($aLists[$sClass][$sList])) { $aFoundList = $aLists[$sClass][$sList]; } // Else we try to found the default list for that class - elseif (isset($aLists[$sClass]) && isset($aLists[$sClass]['default'])) - { + elseif (isset($aLists[$sClass]) && isset($aLists[$sClass]['default'])) { $aFoundList = $aLists[$sClass]['default']; } // If not found, we try find one from the closest parent class - else - { - foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass) - { + else { + foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass) { // Trying to find the right list - if (isset($aLists[$sParentClass]) && isset($aLists[$sParentClass][$sList])) - { + if (isset($aLists[$sParentClass]) && isset($aLists[$sParentClass][$sList])) { $aFoundList = $aLists[$sParentClass][$sList]; break; } // Or the default list - elseif (isset($aLists[$sParentClass]) && isset($aLists[$sParentClass]['default'])) - { + elseif (isset($aLists[$sParentClass]) && isset($aLists[$sParentClass]['default'])) { $aFoundList = $aLists[$sParentClass]['default']; break; } @@ -225,15 +202,11 @@ class ApplicationHelper } // If found, we flatten the list to keep only the attribute codes (not the rank) - if ($aFoundList !== null) - { - foreach ($aFoundList as $aItem) - { + if ($aFoundList !== null) { + foreach ($aFoundList as $aItem) { $aAttCodes[] = $aItem['att_code']; } - } - else - { + } else { $aAttCodes = MetaModel::FlattenZList(MetaModel::GetZListItems($sClass, 'list')); } @@ -252,32 +225,31 @@ class ApplicationHelper */ protected static function GenerateDefaultFormForClass($sClass, $bAddLinksets = false) { - $aForm = array( + $aForm = [ 'id' => strtolower($sClass)."-default-".uniqid(), 'type' => 'custom_list', - 'properties' => array( + 'properties' => [ 'display_mode' => static::FORM_DEFAULT_DISPLAY_MODE, 'always_show_submit' => static::FORM_DEFAULT_ALWAYS_SHOW_SUBMIT, - 'navigation_rules' => array( + 'navigation_rules' => [ 'submit' => null, 'cancel' => null, - ), - ), - 'fields' => array(), - 'layout' => array( + ], + ], + 'fields' => [], + 'layout' => [ 'type' => 'xhtml', 'content' => '', - ), - ); + ], + ]; // Generate layout $sContent = ""; // - Retrieve zlist details $aDetailsList = MetaModel::GetZListItems($sClass, 'details'); - $aDetailsStruct = cmdbAbstractObject::ProcessZlist($aDetailsList, array(), 'UI:PropertiesTab', 'col1', ''); - if(!isset($aDetailsStruct['UI:PropertiesTab'])) - { + $aDetailsStruct = cmdbAbstractObject::ProcessZlist($aDetailsList, [], 'UI:PropertiesTab', 'col1', ''); + if (!isset($aDetailsStruct['UI:PropertiesTab'])) { // For the iTop administrator IssueLog::Error('Could not generate default form for "'.$sClass.'" class. Is the "details" zlist empty?'); // For the end-user @@ -287,14 +259,10 @@ class ApplicationHelper // Count cols (not linksets) $iColCount = 0; - foreach ($aPropertiesStruct as $sColId => $aColFieldsets) - { - if (substr($sColId, 0, 1) !== '_') - { - foreach ($aColFieldsets as $sFieldsetName => $aAttCodes) - { - if (substr($sFieldsetName, 0, 1) !== '_') - { + foreach ($aPropertiesStruct as $sColId => $aColFieldsets) { + if (substr($sColId, 0, 1) !== '_') { + foreach ($aColFieldsets as $sFieldsetName => $aAttCodes) { + if (substr($sFieldsetName, 0, 1) !== '_') { $iColCount++; break; } @@ -302,28 +270,24 @@ class ApplicationHelper } } // If no cols, return a default form with all fields one after another - if ($iColCount === 0) - { - return array( + if ($iColCount === 0) { + return [ 'id' => 'default', 'type' => 'zlist', 'fields' => 'details', 'layout' => null, - ); + ]; } // Warning, this might not be great when 12 modulo $iColCount is greater than 0. $sColCSSClass = 'col-sm-'.floor(12 / $iColCount); $sLinksetsHTML = ""; $sRowHTML = "
          \n"; - foreach ($aPropertiesStruct as $sColId => $aColFieldsets) - { + foreach ($aPropertiesStruct as $sColId => $aColFieldsets) { $sColsHTML = "\t
          \n"; - foreach ($aColFieldsets as $sFieldsetName => $aAttCodes) - { + foreach ($aColFieldsets as $sFieldsetName => $aAttCodes) { // Add fieldset, not linkset - if (substr($sFieldsetName, 0, 1) !== '_') - { + if (substr($sFieldsetName, 0, 1) !== '_') { $sFieldsetHTML = "\t\t
          \n"; $sFieldsetHTML .= "\t\t\t".utils::EscapeHtml(Dict::S($sFieldsetName))."\n"; @@ -335,11 +299,8 @@ class ApplicationHelper // Add to col $sColsHTML .= $sFieldsetHTML; - } - elseif ($bAddLinksets) - { - foreach ($aAttCodes as $sAttCode) - { + } elseif ($bAddLinksets) { + foreach ($aAttCodes as $sAttCode) { $sLinksetsHTML .= "
          \n"; } } @@ -368,8 +329,9 @@ class ApplicationHelper * @return array * @since 2.7.0 */ - public static function GetAttDefClassesToExcludeFromMarkupMetadataRawValue(){ - return array( + public static function GetAttDefClassesToExcludeFromMarkupMetadataRawValue() + { + return [ 'AttributeBlob', 'AttributeCustomFields', 'AttributeDashboard', @@ -377,7 +339,7 @@ class ApplicationHelper 'AttributeStopWatch', 'AttributeSubItem', 'AttributeTable', - 'AttributeText' - ); + 'AttributeText', + ]; } } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/BrickControllerHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/BrickControllerHelper.php index 2bb8725db..c0c1a7dc0 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/BrickControllerHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/BrickControllerHelper.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License */ - namespace Combodo\iTop\Portal\Helper; /** @@ -53,14 +52,13 @@ class BrickControllerHelper public function ExtractSortParams() { // Getting sort params - $aSortParams = $this->oRequestManipulator->ReadParam('aSortParams', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); + $aSortParams = $this->oRequestManipulator->ReadParam('aSortParams', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); // Converting sort direction to proper format for DBObjectSet as it only accept real booleans - foreach ($aSortParams as $sAttributeAlias => $sDirection) - { + foreach ($aSortParams as $sAttributeAlias => $sDirection) { $aSortParams[$sAttributeAlias] = ($sDirection === 'true'); } return $aSortParams; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/BrowseBrickHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/BrowseBrickHelper.php index f9d3006e8..a646469c1 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/BrowseBrickHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/BrowseBrickHelper.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU Affero General Public License */ - namespace Combodo\iTop\Portal\Helper; - use AttributeImage; use AttributeSet; use AttributeTagSet; @@ -44,9 +42,9 @@ use utils; class BrowseBrickHelper { /** @var string LEVEL_SEPARATOR */ - const LEVEL_SEPARATOR = '-'; + public const LEVEL_SEPARATOR = '-'; /** @var array OPTIONAL_ATTRIBUTES */ - const OPTIONAL_ATTRIBUTES = array('tooltip_att', 'description_att', 'image_att'); + public const OPTIONAL_ATTRIBUTES = ['tooltip_att', 'description_att', 'image_att']; /** @var \Combodo\iTop\Portal\Helper\SecurityHelper */ private $oSecurityHelper; @@ -62,7 +60,10 @@ class BrowseBrickHelper * @param \Combodo\iTop\Portal\Helper\ScopeValidatorHelper $oScopeValidator * @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $oUrlGenerator */ - public function __construct(SecurityHelper $oSecurityHelper, ScopeValidatorHelper $oScopeValidator, UrlGeneratorInterface $oUrlGenerator + public function __construct( + SecurityHelper $oSecurityHelper, + ScopeValidatorHelper $oScopeValidator, + UrlGeneratorInterface $oUrlGenerator ) { $this->oSecurityHelper = $oSecurityHelper; $this->oScopeValidator = $oScopeValidator; @@ -89,24 +90,24 @@ class BrowseBrickHelper */ public function TreeToFlatLevelsProperties(array $aLevels, array &$aLevelsProperties, $sLevelAliasPrefix = 'L') { - foreach ($aLevels as $aLevel) - { + foreach ($aLevels as $aLevel) { $sCurrentLevelAlias = $sLevelAliasPrefix.static::LEVEL_SEPARATOR.$aLevel['id']; $oSearch = DBSearch::CloneWithAlias(DBSearch::FromOQL($aLevel['oql']), $sCurrentLevelAlias); // Restricting to the allowed scope - $oScopeSearch = $this->oScopeValidator->GetScopeFilterForProfiles(UserRights::ListProfiles(), $oSearch->GetClass(), - UR_ACTION_READ); + $oScopeSearch = $this->oScopeValidator->GetScopeFilterForProfiles( + UserRights::ListProfiles(), + $oSearch->GetClass(), + UR_ACTION_READ + ); $oSearch = ($oScopeSearch !== null) ? $oSearch->Intersect($oScopeSearch) : null; // - Allowing all data if necessary - if ($oScopeSearch !== null && $oScopeSearch->IsAllDataAllowed()) - { + if ($oScopeSearch !== null && $oScopeSearch->IsAllDataAllowed()) { $oSearch->AllowAllData(); } - if ($oSearch !== null) - { - $aLevelsProperties[$sCurrentLevelAlias] = array( + if ($oSearch !== null) { + $aLevelsProperties[$sCurrentLevelAlias] = [ 'alias' => $sCurrentLevelAlias, 'title' => ($aLevel['title'] !== null) ? Dict::S($aLevel['title']) : MetaModel::GetName($oSearch->GetClass()), 'parent_att' => $aLevel['parent_att'], @@ -115,42 +116,35 @@ class BrowseBrickHelper 'description_att' => $aLevel['description_att'], 'image_att' => $aLevel['image_att'], 'search' => $oSearch, - 'fields' => array(), - 'actions' => array(), - ); + 'fields' => [], + 'actions' => [], + ]; // Adding current level's fields - if (isset($aLevel['fields'])) - { - $aLevelsProperties[$sCurrentLevelAlias]['fields'] = array(); + if (isset($aLevel['fields'])) { + $aLevelsProperties[$sCurrentLevelAlias]['fields'] = []; - foreach ($aLevel['fields'] as $sFieldAttCode => $aFieldProperties) - { - $aLevelsProperties[$sCurrentLevelAlias]['fields'][] = array( + foreach ($aLevel['fields'] as $sFieldAttCode => $aFieldProperties) { + $aLevelsProperties[$sCurrentLevelAlias]['fields'][] = [ 'code' => $sFieldAttCode, 'label' => MetaModel::GetAttributeDef($oSearch->GetClass(), $sFieldAttCode)->GetLabel(), 'hidden' => $aFieldProperties['hidden'], - ); + ]; } } // Flattening and adding sub levels - if (isset($aLevel['levels'])) - { - foreach ($aLevel['levels'] as $aChildLevel) - { + if (isset($aLevel['levels'])) { + foreach ($aLevel['levels'] as $aChildLevel) { // Checking if the sub level if allowed $oChildSearch = DBSearch::FromOQL($aChildLevel['oql']); - if ($this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $oChildSearch->GetClass())) - { + if ($this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $oChildSearch->GetClass())) { // Adding the sub level to this one $aLevelsProperties[$sCurrentLevelAlias]['levels'][] = $sCurrentLevelAlias.static::LEVEL_SEPARATOR.$aChildLevel['id']; // Adding drill down action if necessary - foreach ($aLevel['actions'] as $sId => $aAction) - { - if ($aAction['type'] === BrowseBrick::ENUM_ACTION_DRILLDOWN) - { + foreach ($aLevel['actions'] as $sId => $aAction) { + if ($aAction['type'] === BrowseBrick::ENUM_ACTION_DRILLDOWN) { $aLevelsProperties[$sCurrentLevelAlias]['actions'][$sId] = $aAction; break; } @@ -162,49 +156,43 @@ class BrowseBrickHelper } // Adding actions to the level - foreach ($aLevel['actions'] as $sId => $aAction) - { + foreach ($aLevel['actions'] as $sId => $aAction) { // ... Only if it's not already there (eg. the drilldown added with the sublevels) - if (!array_key_exists($sId, $aLevelsProperties[$sCurrentLevelAlias]['actions'])) - { + if (!array_key_exists($sId, $aLevelsProperties[$sCurrentLevelAlias]['actions'])) { // Adding action only if allowed - if (($aAction['type'] === BrowseBrick::ENUM_ACTION_VIEW) && !$this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, - $oSearch->GetClass())) - { + if (($aAction['type'] === BrowseBrick::ENUM_ACTION_VIEW) && !$this->oSecurityHelper->IsActionAllowed( + UR_ACTION_READ, + $oSearch->GetClass() + )) { continue; - } - elseif (($aAction['type'] === BrowseBrick::ENUM_ACTION_EDIT) && !$this->oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, - $oSearch->GetClass())) - { + } elseif (($aAction['type'] === BrowseBrick::ENUM_ACTION_EDIT) && !$this->oSecurityHelper->IsActionAllowed( + UR_ACTION_MODIFY, + $oSearch->GetClass() + )) { continue; - } - elseif ($aAction['type'] === BrowseBrick::ENUM_ACTION_DRILLDOWN) - { + } elseif ($aAction['type'] === BrowseBrick::ENUM_ACTION_DRILLDOWN) { continue; } // Setting action title - if (isset($aAction['title'])) - { + if (isset($aAction['title'])) { // Note : There could be an enhancement here, by checking if the string code has the '%1' needle and use Dict::S or Dict::Format accordingly. // But it would require to benchmark a potential performance drop as it will be done for all items $aAction['title'] = Dict::S($aAction['title']); - } - else - { - switch ($aAction['type']) - { + } else { + switch ($aAction['type']) { case BrowseBrick::ENUM_ACTION_CREATE_FROM_THIS: // We can only make translate a dictionary entry with a class placeholder when the action has a class tag. if it has a factory method, we don't know yet what class is going to be created - if ($aAction['factory']['type'] === BrowseBrick::ENUM_FACTORY_TYPE_CLASS) - { - $aAction['title'] = Dict::Format('Brick:Portal:Browse:Action:CreateObjectFromThis', - MetaModel::GetName($aAction['factory']['value'])); - $aAction['url'] = $this->oUrlGenerator->generate('p_object_create', - array('sObjectClass' => $aAction['factory']['value'])); - } - else - { + if ($aAction['factory']['type'] === BrowseBrick::ENUM_FACTORY_TYPE_CLASS) { + $aAction['title'] = Dict::Format( + 'Brick:Portal:Browse:Action:CreateObjectFromThis', + MetaModel::GetName($aAction['factory']['value']) + ); + $aAction['url'] = $this->oUrlGenerator->generate( + 'p_object_create', + ['sObjectClass' => $aAction['factory']['value']] + ); + } else { $aAction['title'] = Dict::S('Brick:Portal:Browse:Action:Create'); } break; @@ -221,10 +209,8 @@ class BrowseBrickHelper } // Setting action icon class - if (!isset($aAction['icon_class'])) - { - switch ($aAction['type']) - { + if (!isset($aAction['icon_class'])) { + switch ($aAction['type']) { case BrowseBrick::ENUM_ACTION_CREATE_FROM_THIS: $aAction['icon_class'] = BrowseBrick::ENUM_ACTION_ICON_CLASS_CREATE_FROM_THIS; break; @@ -241,21 +227,19 @@ class BrowseBrickHelper } // Setting action url - switch ($aAction['type']) - { + switch ($aAction['type']) { case BrowseBrick::ENUM_ACTION_CREATE_FROM_THIS: - if ($aAction['factory']['type'] === BrowseBrick::ENUM_FACTORY_TYPE_CLASS) - { - $aAction['url'] = $this->oUrlGenerator->generate('p_object_create', - array('sObjectClass' => $aAction['factory']['value'])); - } - else - { - $aAction['url'] = $this->oUrlGenerator->generate('p_object_create_from_factory', array( + if ($aAction['factory']['type'] === BrowseBrick::ENUM_FACTORY_TYPE_CLASS) { + $aAction['url'] = $this->oUrlGenerator->generate( + 'p_object_create', + ['sObjectClass' => $aAction['factory']['value']] + ); + } else { + $aAction['url'] = $this->oUrlGenerator->generate('p_object_create_from_factory', [ 'sEncodedMethodName' => base64_encode($aAction['factory']['value']), 'sObjectClass' => '-objectClass-', 'sObjectId' => '-objectId-', - )); + ]); } break; } @@ -278,10 +262,9 @@ class BrowseBrickHelper */ public function PrepareActionRulesForItems(array $aItems, $sLevelsAlias, array &$aLevelsProperties) { - $aActionRules = array(); + $aActionRules = []; - foreach ($aLevelsProperties[$sLevelsAlias]['actions'] as $sId => $aAction) - { + foreach ($aLevelsProperties[$sLevelsAlias]['actions'] as $sId => $aAction) { $aActionRules[$sId] = ContextManipulatorHelper::PrepareAndEncodeRulesToken($aAction['rules'], $aItems); } @@ -317,11 +300,10 @@ class BrowseBrickHelper */ public function AddToFlatItems(array $aCurrentRow, array &$aLevelsProperties) { - $aRow = array(); + $aRow = []; /** @var \DBObject $value */ - foreach ($aCurrentRow as $key => $value) - { + foreach ($aCurrentRow as $key => $value) { // Retrieving objects from all levels $aItems = array_values($aCurrentRow); @@ -332,36 +314,31 @@ class BrowseBrickHelper $sNameAttDef = MetaModel::GetAttributeDef($sCurrentObjectClass, $sNameAttCode); $sNameAttDefClass = get_class($sNameAttDef); - $aRow[$key] = array( + $aRow[$key] = [ 'level_alias' => $key, 'id' => $sCurrentObjectId, 'name' => utils::EscapeHtml($value->Get($sNameAttCode)), 'class' => $sCurrentObjectClass, 'action_rules_token' => $this->PrepareActionRulesForItems($aItems, $key, $aLevelsProperties), - 'metadata' => array( + 'metadata' => [ 'object_class' => $sCurrentObjectClass, 'object_id' => $sCurrentObjectId, 'attribute_code' => $sNameAttCode, 'attribute_type' => $sNameAttDefClass, 'value_raw' => $value->Get($sNameAttCode), - ), - ); + ], + ]; // Adding optional attributes if necessary - foreach (static::OPTIONAL_ATTRIBUTES as $sOptionalAttribute) - { - if ($aLevelsProperties[$key][$sOptionalAttribute] !== null) - { + foreach (static::OPTIONAL_ATTRIBUTES as $sOptionalAttribute) { + if ($aLevelsProperties[$key][$sOptionalAttribute] !== null) { $sPropertyName = substr($sOptionalAttribute, 0, -4); $oAttDef = MetaModel::GetAttributeDef($sCurrentObjectClass, $aLevelsProperties[$key][$sOptionalAttribute]); - if ($oAttDef instanceof AttributeImage) - { + if ($oAttDef instanceof AttributeImage) { $tmpAttValue = $value->Get($aLevelsProperties[$key][$sOptionalAttribute]); - if ($sOptionalAttribute === 'image_att') - { - if (is_object($tmpAttValue) && !$tmpAttValue->IsEmpty()) - { + if ($sOptionalAttribute === 'image_att') { + if (is_object($tmpAttValue) && !$tmpAttValue->IsEmpty()) { $oOrmDoc = $tmpAttValue; $tmpAttValue = $this->oUrlGenerator->generate('p_object_document_display', [ 'sObjectClass' => $sCurrentObjectClass, @@ -370,15 +347,11 @@ class BrowseBrickHelper 'cache' => 86400, 's' => $oOrmDoc->GetSignature(), ]); - } - else - { + } else { $tmpAttValue = $oAttDef->Get('default_image'); } } - } - else - { + } else { $tmpAttValue = $value->GetAsHTML($aLevelsProperties[$key][$sOptionalAttribute]); } @@ -386,16 +359,13 @@ class BrowseBrickHelper } } // Adding fields attributes if necessary - if (!empty($aLevelsProperties[$key]['fields'])) - { - $aRow[$key]['fields'] = array(); - foreach ($aLevelsProperties[$key]['fields'] as $aField) - { + if (!empty($aLevelsProperties[$key]['fields'])) { + $aRow[$key]['fields'] = []; + foreach ($aLevelsProperties[$key]['fields'] as $aField) { $oAttDef = MetaModel::GetAttributeDef($sCurrentObjectClass, $aField['code']); $sAttDefClass = get_class($oAttDef); - switch (true) - { + switch (true) { case $oAttDef instanceof AttributeTagSet: /** @var \ormTagSet $oSetValues */ $oSetValues = $value->Get($aField['code']); @@ -412,8 +382,7 @@ class BrowseBrickHelper case $oAttDef instanceof AttributeImage: // Todo: This should be refactored, it has been seen multiple times in the portal $oOrmDoc = $value->Get($aField['code']); - if (is_object($oOrmDoc) && !$oOrmDoc->IsEmpty()) - { + if (is_object($oOrmDoc) && !$oOrmDoc->IsEmpty()) { $sUrl = $this->oUrlGenerator->generate('p_object_document_display', [ 'sObjectClass' => $sCurrentObjectClass, 'sObjectId' => $sCurrentObjectId, @@ -421,9 +390,7 @@ class BrowseBrickHelper 'cache' => 86400, 's' => $oOrmDoc->GetSignature(), ]); - } - else - { + } else { $sUrl = $oAttDef->Get('default_image'); } $sHtmlForFieldValue = ''; @@ -436,24 +403,22 @@ class BrowseBrickHelper // For simple fields, we get the raw (stored) value as well $bExcludeRawValue = false; - foreach (ApplicationHelper::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) - { - if (is_a($sAttDefClass, $sAttDefClassToExclude, true)) - { + foreach (ApplicationHelper::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) { + if (is_a($sAttDefClass, $sAttDefClassToExclude, true)) { $bExcludeRawValue = true; break; } } $attValueRaw = ($bExcludeRawValue === false) ? $value->Get($aField['code']) : null; - $aRow[$key]['fields'][$aField['code']] = array( + $aRow[$key]['fields'][$aField['code']] = [ 'object_class' => $sCurrentObjectClass, 'object_id' => $sCurrentObjectId, 'attribute_code' => $aField['code'], 'attribute_type' => $sAttDefClass, 'value_raw' => $attValueRaw, 'value_html' => $sHtmlForFieldValue, - ); + ]; } } } @@ -503,39 +468,34 @@ class BrowseBrickHelper // We make sure to keep all row objects through levels by copying them when processing the first level. // Otherwise they will be sliced through levels, one by one. - if ($aCurrentRowObjects === null) - { + if ($aCurrentRowObjects === null) { $aCurrentRowObjects = $aCurrentRowValues; } - if (!isset($aItems[$sCurrentIndex])) - { - $aItems[$sCurrentIndex] = array( + if (!isset($aItems[$sCurrentIndex])) { + $aItems[$sCurrentIndex] = [ 'level_alias' => $aCurrentRowKeys[0], 'id' => $aCurrentRowValues[0]->GetKey(), 'name' => utils::EscapeHtml($aCurrentRowValues[0]->Get($aLevelsProperties[$aCurrentRowKeys[0]]['name_att'])), 'class' => get_class($aCurrentRowValues[0]), - 'subitems' => array(), + 'subitems' => [], 'filter_data' => $this->GetFilterData($aLevelsProperties[$aCurrentRowKeys[0]], $aCurrentRowKeys[0], $aCurrentRowValues[0]), 'action_rules_token' => $this->PrepareActionRulesForItems($aCurrentRowObjects, $aCurrentRowKeys[0], $aLevelsProperties), - ); + ]; // Adding optional attributes if necessary - foreach (static::OPTIONAL_ATTRIBUTES as $sOptionalAttribute) - { - if ($aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute] !== null) - { + foreach (static::OPTIONAL_ATTRIBUTES as $sOptionalAttribute) { + if ($aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute] !== null) { $sPropertyName = substr($sOptionalAttribute, 0, -4); - $oAttDef = MetaModel::GetAttributeDef(get_class($aCurrentRowValues[0]), - $aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute]); + $oAttDef = MetaModel::GetAttributeDef( + get_class($aCurrentRowValues[0]), + $aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute] + ); - if ($oAttDef instanceof AttributeImage) - { + if ($oAttDef instanceof AttributeImage) { $tmpAttValue = $aCurrentRowValues[0]->Get($aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute]); - if ($sOptionalAttribute === 'image_att') - { - if (is_object($tmpAttValue) && !$tmpAttValue->IsEmpty()) - { + if ($sOptionalAttribute === 'image_att') { + if (is_object($tmpAttValue) && !$tmpAttValue->IsEmpty()) { $oOrmDoc = $tmpAttValue; $tmpAttValue = $this->oUrlGenerator->generate('p_object_document_display', [ 'sObjectClass' => get_class($aCurrentRowValues[0]), @@ -544,15 +504,11 @@ class BrowseBrickHelper 'cache' => 86400, 's' => $oOrmDoc->GetSignature(), ]); - } - else - { + } else { $tmpAttValue = $oAttDef->Get('default_image'); } } - } - else - { + } else { $tmpAttValue = $aCurrentRowValues[0]->GetAsHTML($aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute]); } @@ -562,8 +518,7 @@ class BrowseBrickHelper } $aCurrentRowSliced = array_slice($aCurrentRow, 1); - if (!empty($aCurrentRowSliced)) - { + if (!empty($aCurrentRowSliced)) { $this->AddToTreeItems($aItems[$sCurrentIndex]['subitems'], $aCurrentRowSliced, $aLevelsProperties, $aCurrentRowObjects); } } @@ -580,7 +535,7 @@ class BrowseBrickHelper * @throws \CoreException * @throws \Exception */ - private function GetFilterData(array $aLevelProperties, string $sRowKey, DBObject $oRowValue) : array + private function GetFilterData(array $aLevelProperties, string $sRowKey, DBObject $oRowValue): array { // result $sValues = ""; @@ -599,17 +554,17 @@ class BrowseBrickHelper $sValue = $oAttDef->GetAsHTML($oRowValue->Get($aField['code'])); // do not print empty fields - if(!utils::IsNullOrEmptyString($sValue)){ + if (!utils::IsNullOrEmptyString($sValue)) { // append to result $sValues .= $sValue; - $sValuesAndCodes .= '' . $aField['label'] . ': ' . $sValue . ''; + $sValuesAndCodes .= ''.$aField['label'].': '.$sValue.''; } } return [ 'values' => $sValues, - 'values_and_codes' => $sValuesAndCodes + 'values_and_codes' => $sValuesAndCodes, ]; } } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/ContextManipulatorHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/ContextManipulatorHelper.php index 3b5a37ad6..ece3c6b92 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/ContextManipulatorHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/ContextManipulatorHelper.php @@ -28,6 +28,7 @@ use SimpleCrypt; use Symfony\Component\Routing\RouterInterface; use TrueExpression; use UserRights; + use const UR_ACTION_READ; /** @@ -40,19 +41,19 @@ use const UR_ACTION_READ; class ContextManipulatorHelper { /** @var string ENUM_RULE_CALLBACK_BACK */ - const ENUM_RULE_CALLBACK_BACK = 'back'; + public const ENUM_RULE_CALLBACK_BACK = 'back'; /** @var string ENUM_RULE_CALLBACK_GOTO */ - const ENUM_RULE_CALLBACK_GOTO = 'goto'; + public const ENUM_RULE_CALLBACK_GOTO = 'goto'; /** @var string ENUM_RULE_CALLBACK_OPEN */ - const ENUM_RULE_CALLBACK_OPEN = 'open'; + public const ENUM_RULE_CALLBACK_OPEN = 'open'; /** @var string ENUM_RULE_CALLBACK_OPEN_VIEW */ - const ENUM_RULE_CALLBACK_OPEN_VIEW = 'view'; + public const ENUM_RULE_CALLBACK_OPEN_VIEW = 'view'; /** @var string ENUM_RULE_CALLBACK_OPEN_EDIT */ - const ENUM_RULE_CALLBACK_OPEN_EDIT = 'edit'; + public const ENUM_RULE_CALLBACK_OPEN_EDIT = 'edit'; /** @var string DEFAULT_RULE_CALLBACK_OPEN */ - const DEFAULT_RULE_CALLBACK_OPEN = self::ENUM_RULE_CALLBACK_OPEN_VIEW; + public const DEFAULT_RULE_CALLBACK_OPEN = self::ENUM_RULE_CALLBACK_OPEN_VIEW; - const PRIVATE_KEY = 'portal-priv-key'; + public const PRIVATE_KEY = 'portal-priv-key'; /** @var array $aRules */ protected $aRules; @@ -76,8 +77,9 @@ class ContextManipulatorHelper * * @throws \DOMFormatException */ - public function __construct(ModuleDesign $oModuleDesign, RouterInterface $oRouter, BrickCollection $oBrickCollection, ScopeValidatorHelper $oScopeValidator) { - $this->aRules = array(); + public function __construct(ModuleDesign $oModuleDesign, RouterInterface $oRouter, BrickCollection $oBrickCollection, ScopeValidatorHelper $oScopeValidator) + { + $this->aRules = []; $this->oRouter = $oRouter; $this->oBrickCollection = $oBrickCollection; @@ -95,38 +97,34 @@ class ContextManipulatorHelper */ public function Init(DOMNodeList $oNodes) { - $this->aRules = array(); + $this->aRules = []; // Iterating over the scope nodes /** @var \Combodo\iTop\DesignElement $oRuleNode */ - foreach ($oNodes as $oRuleNode) - { + foreach ($oNodes as $oRuleNode) { // Retrieving mandatory id attribute $sRuleId = $oRuleNode->getAttribute('id'); - if ($sRuleId === '') - { + if ($sRuleId === '') { throw new DOMFormatException('Rule tag must have an id attribute.', null, null, $oRuleNode); } // Setting if the rule needs a source object $bNeedsSource = false; // Note : preset and retrofit are no longer plurals as it should match as much as possible iTopObjectCopier specs. We use plurals only in the xml for the collection tags - $aRule = array( + $aRule = [ 'source_oql' => null, 'dest_class' => null, - 'preset' => array(), - 'retrofit' => array(), + 'preset' => [], + 'retrofit' => [], 'submit' => null, 'cancel' => null, - ); + ]; // Iterating over the rule's nodes /** @var \Combodo\iTop\DesignElement $oSubNode */ - foreach ($oRuleNode->GetNodes('*') as $oSubNode) - { + foreach ($oRuleNode->GetNodes('*') as $oSubNode) { $sSubNodeName = $oSubNode->nodeName; - switch ($sSubNodeName) - { + switch ($sSubNodeName) { case 'source_class': $aRule['source_oql'] = 'SELECT '.$oSubNode->GetText(); break; @@ -139,17 +137,14 @@ class ContextManipulatorHelper case 'presets': case 'retrofits': /** @var \Combodo\iTop\DesignElement $oActionNode */ - foreach ($oSubNode->GetNodes('*') as $oActionNode) - { + foreach ($oSubNode->GetNodes('*') as $oActionNode) { // Note : Caution, the index of $aRule is now $oActionNode->nodeName instead of $sSubNodeName, as we want to match iTopObjectCopier specs like told previously - if (in_array($oActionNode->nodeName, array('preset', 'retrofit'))) - { + if (in_array($oActionNode->nodeName, ['preset', 'retrofit'])) { $sActionText = $oActionNode->GetText(); $aRule[$oActionNode->nodeName][] = $sActionText; // Checking if the rule needs a source object - if (substr($sActionText, 0, 4) === 'copy') - { + if (substr($sActionText, 0, 4) === 'copy') { $bNeedsSource = true; } } @@ -160,25 +155,21 @@ class ContextManipulatorHelper case 'cancel': // Retrieving callback type and checking that it is allowed $sType = $oSubNode->getAttribute('xsi:type'); - if ($sType === '') - { + if ($sType === '') { throw new DOMFormatException($sSubNodeName.' must have an xsi:type attribute.', null, null, $oSubNode); } - if (($sType === static::ENUM_RULE_CALLBACK_OPEN) && ($sSubNodeName === 'cancel')) - { + if (($sType === static::ENUM_RULE_CALLBACK_OPEN) && ($sSubNodeName === 'cancel')) { throw new DOMFormatException('Cancel tag cannot be of type '.$sType.'.', null, null, $oSubNode); } - $aRule[$sSubNodeName] = array('type' => $sType); - switch ($sType) - { + $aRule[$sSubNodeName] = ['type' => $sType]; + switch ($sType) { case static::ENUM_RULE_CALLBACK_BACK: // Default value $sRefresh = false; // Retrieving value $oRefreshNode = $oSubNode->GetOptionalElement('refresh'); - if (($oRefreshNode !== null) && ($oRefreshNode->GetText() !== null)) - { + if (($oRefreshNode !== null) && ($oRefreshNode->GetText() !== null)) { $sRefresh = $oRefreshNode->GetText(); } @@ -187,8 +178,7 @@ class ContextManipulatorHelper case static::ENUM_RULE_CALLBACK_GOTO: // Retrieving value $sBrickId = $oSubNode->GetUniqueElement('brick')->GetText(); - if ($sBrickId === null) - { + if ($sBrickId === null) { throw new DOMFormatException('Brick tag value must not be empty.', null, null, $oSubNode); } @@ -199,8 +189,7 @@ class ContextManipulatorHelper $sMode = static::ENUM_RULE_CALLBACK_OPEN_VIEW; // Retrieving value $oModeNode = $oSubNode->GetOptionalElement('mode'); - if (($oModeNode !== null) && ($oModeNode->GetText() !== null)) - { + if (($oModeNode !== null) && ($oModeNode->GetText() !== null)) { $sMode = $oModeNode->GetText(); } @@ -212,8 +201,7 @@ class ContextManipulatorHelper } // If there is no source information we check if there is a preset that requires a copy in order to throw an exception - if (($aRule['source_oql'] === null) && ($bNeedsSource === true)) - { + if (($aRule['source_oql'] === null) && ($bNeedsSource === true)) { throw new DOMFormatException('Rule tag must have either a "source_oql" or a "source_class" child node.', null, null, $oRuleNode); } @@ -221,7 +209,6 @@ class ContextManipulatorHelper } } - /** * Returns a hash array of rules * @@ -242,8 +229,7 @@ class ContextManipulatorHelper */ public function GetRule($sId) { - if (!array_key_exists($sId, $this->aRules)) - { + if (!array_key_exists($sId, $this->aRules)) { throw new Exception('Context creator : Could not find "'.$sId.'" in the rules list'); } @@ -276,30 +262,26 @@ class ContextManipulatorHelper */ public function PrepareObject(array $aData, DBObject $oObject) { - if (isset($aData['rules']) && isset($aData['sources'])) - { + if (isset($aData['rules']) && isset($aData['sources'])) { $aRules = $aData['rules']; $aSources = $aData['sources']; - $aActionRulesErrors = array(); - foreach ($aRules as $sRuleId) - { - try - { + $aActionRulesErrors = []; + foreach ($aRules as $sRuleId) { + try { $this->PrepareAndExecActionRule($sRuleId, $aSources, $oObject); - } - catch (CorePortalInvalidActionRuleException $e) - { + } catch (CorePortalInvalidActionRuleException $e) { $aActionRulesErrors[$sRuleId] = $e->getMessage(); } } - if (!empty($aActionRulesErrors)) - { + if (!empty($aActionRulesErrors)) { $sDestinationObjectDesc = ''; $sDestinationObjectDesc .= get_class($oObject); $sDestinationObjectDesc .= '['.$oObject->GetKey().']'; - throw new CorePortalInvalidActionRuleException('Some action rules were not executed', + throw new CorePortalInvalidActionRuleException( + 'Some action rules were not executed', $aActionRulesErrors, - 'destination object: '.$sDestinationObjectDesc); + 'destination object: '.$sDestinationObjectDesc + ); } } } @@ -323,8 +305,7 @@ class ContextManipulatorHelper $aRule = $this->GetRule($sRuleId); // Retrieving source object if needed - if ($aRule['source_oql'] !== null) - { + if ($aRule['source_oql'] !== null) { // Preparing query to retrieve source object(s) /** @var \DBObjectSearch $oSearch */ $oSearch = DBSearch::FromOQL($aRule['source_oql']); @@ -336,45 +317,37 @@ class ContextManipulatorHelper $sSearchClass = $oSearch->GetClass(); $aSearchParams = $oSearch->GetInternalParams(); - if (array_key_exists($sSearchClass, $aSources)) - { + if (array_key_exists($sSearchClass, $aSources)) { $sourceId = $aSources[$sSearchClass]; - if (array_key_exists('id', $oSearch->GetQueryParams())) - { - if (is_array($sourceId)) - { + if (array_key_exists('id', $oSearch->GetQueryParams())) { + if (is_array($sourceId)) { throw new Exception('Context creator : ":id" parameter in rule "'.$sRuleId.'" cannot be an array (This is a limitation of DBSearch)'); } $aSearchParams['id'] = $sourceId; - } - else - { - if (!is_array($sourceId)) - { - $sourceId = array($sourceId); + } else { + if (!is_array($sourceId)) { + $sourceId = [$sourceId]; } $iLoopMax = count($sourceId); $oFullBinExpr = null; - for ($i = 0; $i < $iLoopMax; $i++) - { + for ($i = 0; $i < $iLoopMax; $i++) { // - Building full search expression - $oBinExpr = new BinaryExpression(new FieldExpression('id', $oSearch->GetClassAlias()), '=', - new ScalarExpression($sourceId[$i])); - if ($i === 0) - { + $oBinExpr = new BinaryExpression( + new FieldExpression('id', $oSearch->GetClassAlias()), + '=', + new ScalarExpression($sourceId[$i]) + ); + if ($i === 0) { $oFullBinExpr = $oBinExpr; - } - else - { + } else { $oFullBinExpr = new BinaryExpression($oFullBinExpr, 'OR', $oBinExpr); } // - Adding it to the query when complete - if ($i === ($iLoopMax - 1)) - { + if ($i === ($iLoopMax - 1)) { $oSearch->AddConditionExpression($oFullBinExpr); } } @@ -382,8 +355,7 @@ class ContextManipulatorHelper } $oSearchRootCondition = $oSearch->GetCriteria(); - if (($oSearchRootCondition === null) || ($oSearchRootCondition instanceof TrueExpression)) - { + if (($oSearchRootCondition === null) || ($oSearchRootCondition instanceof TrueExpression)) { // N°2555 : disallow searches without any condition $sErrMsg = "Portal query was stopped: action_rule '$sRuleId' searches for '$sSearchClass' without any condition is forbidden"; IssueLog::Error($sErrMsg); @@ -391,35 +363,31 @@ class ContextManipulatorHelper } // Checking for silos - $oScopeSearch = $this->oScopeValidator->GetScopeFilterForProfiles(UserRights::ListProfiles(), $sSearchClass, - UR_ACTION_READ); - if ($oScopeSearch->IsAllDataAllowed()) - { + $oScopeSearch = $this->oScopeValidator->GetScopeFilterForProfiles( + UserRights::ListProfiles(), + $sSearchClass, + UR_ACTION_READ + ); + if ($oScopeSearch->IsAllDataAllowed()) { $oSearch->AllowAllData(); } // Retrieving source object(s) and applying rules - $oSet = new DBObjectSet($oSearch, array(), $aSearchParams); - while ($oSourceObject = $oSet->Fetch()) // we need a loop for certain preset verbs like add_to_list, see N°2555 - { + $oSet = new DBObjectSet($oSearch, [], $aSearchParams); + while ($oSourceObject = $oSet->Fetch()) { // we need a loop for certain preset verbs like add_to_list, see N°2555 // Presets - if (isset($aRule['preset']) && !empty($aRule['preset'])) - { - $oDestinationObject->ExecActions($aRule['preset'], array('source' => $oSourceObject)); + if (isset($aRule['preset']) && !empty($aRule['preset'])) { + $oDestinationObject->ExecActions($aRule['preset'], ['source' => $oSourceObject]); } // Retrofits - if (isset($aRule['retrofit']) && !empty($aRule['retrofit'])) - { - $oSourceObject->ExecActions($aRule['retrofit'], array('source' => $oDestinationObject)); + if (isset($aRule['retrofit']) && !empty($aRule['retrofit'])) { + $oSourceObject->ExecActions($aRule['retrofit'], ['source' => $oDestinationObject]); } } - } - else - { + } else { // Presets - if (isset($aRule['preset']) && !empty($aRule['preset'])) - { - $oDestinationObject->ExecActions($aRule['preset'], array('source' => $oDestinationObject)); + if (isset($aRule['preset']) && !empty($aRule['preset'])) { + $oDestinationObject->ExecActions($aRule['preset'], ['source' => $oDestinationObject]); } } } @@ -447,10 +415,10 @@ class ContextManipulatorHelper public function GetCallbackUrls(array $aData, DBObject $oObject, $bModal = false) { DeprecatedCallsLog::NotifyDeprecatedPhpMethod('Use navigation rules for form callbacks'); - $aResults = array( + $aResults = [ 'submit' => null, 'cancel' => null, - ); + ]; if (isset($aData['rules'])) { foreach ($aData['rules'] as $sId) { @@ -458,29 +426,27 @@ class ContextManipulatorHelper $aRule = $this->GetRule($sId); // For each type of callbacks, we check if there is a rule to apply - foreach (array('submit', 'cancel') as $sCallbackName) - { - if (is_array($aRule[$sCallbackName])) - { + foreach (['submit', 'cancel'] as $sCallbackName) { + if (is_array($aRule[$sCallbackName])) { // Previously declared rule on a callback is overwritten by the last $sCallbackUrl = null; - switch ($aRule[$sCallbackName]['type']) - { + switch ($aRule[$sCallbackName]['type']) { case static::ENUM_RULE_CALLBACK_BACK: - if (!$bModal) - { + if (!$bModal) { $sCallbackUrl = ($_SERVER['HTTP_REFERER'] !== '') ? $_SERVER['HTTP_REFERER'] : null; } break; case static::ENUM_RULE_CALLBACK_GOTO: $oBrick = $this->oBrickCollection->GetBrickById($aRule[$sCallbackName]['brick_id']); - $sCallbackUrl = $this->oRouter->generate($oBrick->GetRouteName(), array('sBrickId' => $oBrick->GetId())); + $sCallbackUrl = $this->oRouter->generate($oBrick->GetRouteName(), ['sBrickId' => $oBrick->GetId()]); break; case static::ENUM_RULE_CALLBACK_OPEN: - $sCallbackUrl = ($oObject->IsNew()) ? null : $this->oRouter->generate('p_object_'.$aRule[$sCallbackName]['mode'], - array('sObjectClass' => get_class($oObject), 'sObjectId' => $oObject->GetKey())); + $sCallbackUrl = ($oObject->IsNew()) ? null : $this->oRouter->generate( + 'p_object_'.$aRule[$sCallbackName]['mode'], + ['sObjectClass' => get_class($oObject), 'sObjectId' => $oObject->GetKey()] + ); break; } @@ -501,20 +467,19 @@ class ContextManipulatorHelper * * @return array */ - public static function PrepareRulesForToken($aRules, $aObjects = array()) + public static function PrepareRulesForToken($aRules, $aObjects = []) { // Getting necessary information from objects - $aSources = array(); - foreach ($aObjects as $oObject) - { + $aSources = []; + foreach ($aObjects as $oObject) { $aSources[get_class($oObject)] = $oObject->GetKey(); } // Preparing data - $aTokenRules = array( + $aTokenRules = [ 'rules' => $aRules, 'sources' => $aSources, - ); + ]; return $aTokenRules; } @@ -545,7 +510,7 @@ class ContextManipulatorHelper * * @return string */ - public static function PrepareAndEncodeRulesToken($aRules, $aObjects = array()) + public static function PrepareAndEncodeRulesToken($aRules, $aObjects = []) { // Preparing rules before making a token $aTokenRules = static::PrepareRulesForToken($aRules, $aObjects); @@ -572,19 +537,20 @@ class ContextManipulatorHelper $sDecryptedToken = $oCrypt->Decrypt($sPrivateKey, self::base64url_decode($sToken)); $aTokenRules = json_decode($sDecryptedToken, true); - if (!is_array($aTokenRules)) - { + if (!is_array($aTokenRules)) { throw new Exception('DecodeRulesToken not a proper json structure.'); } return $aTokenRules; } - private static function base64url_encode($sData) { + private static function base64url_encode($sData) + { return rtrim(strtr(base64_encode($sData), '+/', '-_'), '='); } - private static function base64url_decode($sData) { + private static function base64url_decode($sData) + { return base64_decode(str_pad(strtr($sData, '-_', '+/'), strlen($sData) % 4, '=', STR_PAD_RIGHT)); } @@ -596,7 +562,7 @@ class ContextManipulatorHelper */ private static function GetPrivateKey() { - if(self::$sPrivateKey === null) { + if (self::$sPrivateKey === null) { self::$sPrivateKey = DBProperty::GetProperty(self::PRIVATE_KEY); if (is_null(self::$sPrivateKey)) { self::$sPrivateKey = bin2hex(random_bytes(32)); diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/ExtensibilityHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/ExtensibilityHelper.php index dc32ad9fc..f21fc108b 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/ExtensibilityHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/ExtensibilityHelper.php @@ -1,4 +1,5 @@ sFilename = "{$sPortalId}.lifecycle.php"; $this->sCachePath = $sPortalCachePath; - $this->sInstancePrefix = "{$sPortalId}-";; + $this->sInstancePrefix = "{$sPortalId}-"; + ; $this->sGeneratedClass = static::DEFAULT_GENERATED_CLASS; - $this->aProfilesMatrix = array(); + $this->aProfilesMatrix = []; $this->Init($moduleDesign->GetNodes('/module_design/classes/class')); } @@ -143,8 +144,7 @@ class LifecycleValidatorHelper public function Init(DOMNodeList $oNodes) { // Checking cache path - if ($this->sCachePath === null) - { + if ($this->sCachePath === null) { $this->sCachePath = utils::GetCachePath(); } // Building full pathname for file @@ -152,61 +152,48 @@ class LifecycleValidatorHelper // Creating file if not existing // Note: This is a temporary cache system, it should soon evolve to a cache provider (fs, apc, memcache, ...) - if (!file_exists($sFilePath)) - { + if (!file_exists($sFilePath)) { // - Build php array from xml - $aProfiles = array(); + $aProfiles = []; // This will be used to know which classes have been set, so we can set the missing ones. - $aProfileClasses = array(); + $aProfileClasses = []; // Iterating over the class nodes /** @var \Combodo\iTop\DesignElement $oClassNode */ - foreach ($oNodes as $oClassNode) - { + foreach ($oNodes as $oClassNode) { // Retrieving mandatory class id attribute $sClass = $oClassNode->getAttribute('id'); - if ($sClass === '') - { + if ($sClass === '') { throw new DOMFormatException('Class tag must have an id attribute.', null, null, $oClassNode); } // Retrieving lifecycle node of the class $oLifecycleNode = $oClassNode->GetOptionalElement('lifecycle'); - if ($oLifecycleNode !== null) - { + if ($oLifecycleNode !== null) { // Iterating over scope nodes of the class $oStimuliNode = $oLifecycleNode->GetOptionalElement('stimuli'); - if ($oStimuliNode !== null) - { + if ($oStimuliNode !== null) { /** @var \Combodo\iTop\DesignElement $oStimulusNode */ - foreach ($oStimuliNode->GetNodes('./stimulus') as $oStimulusNode) - { + foreach ($oStimuliNode->GetNodes('./stimulus') as $oStimulusNode) { // Retrieving mandatory scope id attribute $sStimulusId = $oStimulusNode->getAttribute('id'); - if ($sStimulusId === '') - { + if ($sStimulusId === '') { throw new DOMFormatException('Stimulus tag must have an id attribute.', null, null, $oStimulusNode); } // Retrieving profiles for the stimulus $oProfilesNode = $oStimulusNode->GetOptionalElement('denied_profiles'); - $aProfilesNames = array(); + $aProfilesNames = []; // If no profile is specified, we consider that it's for ALL the profiles - if (($oProfilesNode === null) || ($oProfilesNode->GetNodes('./denied_profile')->length === 0)) - { - foreach (ProfilesConfig::GetProfilesValues() as $iKey => $aValue) - { + if (($oProfilesNode === null) || ($oProfilesNode->GetNodes('./denied_profile')->length === 0)) { + foreach (ProfilesConfig::GetProfilesValues() as $iKey => $aValue) { $aProfilesNames[] = $aValue['name']; } - } - else - { + } else { /** @var \Combodo\iTop\DesignElement $oProfileNode */ - foreach ($oProfilesNode->GetNodes('./denied_profile') as $oProfileNode) - { + foreach ($oProfilesNode->GetNodes('./denied_profile') as $oProfileNode) { // Retrieving mandatory profile id attribute $sProfileId = $oProfileNode->getAttribute('id'); - if ($sProfileId === '') - { + if ($sProfileId === '') { throw new DOMFormatException('Profile tag must have an id attribute.', null, null, $oProfileNode); } $aProfilesNames[] = $sProfileId; @@ -214,21 +201,18 @@ class LifecycleValidatorHelper } // - foreach ($aProfilesNames as $sProfileName) - { + foreach ($aProfilesNames as $sProfileName) { // Stimulus profile id $iProfileId = $this->GetProfileIdFromProfileName($sProfileName); // Now that we have the queries infos, we are going to build the queries for that profile / class $sMatrixPrefix = $iProfileId.'_'.$sClass; // - Creating profile / class entry if not already present - if (!array_key_exists($sMatrixPrefix, $aProfiles)) - { - $aProfiles[$sMatrixPrefix] = array(); + if (!array_key_exists($sMatrixPrefix, $aProfiles)) { + $aProfiles[$sMatrixPrefix] = []; } // - Adding stimulus if not already present - if (!in_array($sStimulusId, $aProfiles[$sMatrixPrefix])) - { + if (!in_array($sStimulusId, $aProfiles[$sMatrixPrefix])) { $aProfiles[$sMatrixPrefix][] = $sStimulusId; } } @@ -244,20 +228,15 @@ class LifecycleValidatorHelper // If not, we add them // // Note: Classes / Stimuli not in the matrix are implicitly ALLOWED. That can happen by omitting the in a - foreach ($aProfileClasses as $sProfileClass) - { - foreach (MetaModel::EnumChildClasses($sProfileClass) as $sChildClass) - { + foreach ($aProfileClasses as $sProfileClass) { + foreach (MetaModel::EnumChildClasses($sProfileClass) as $sChildClass) { // If the child class is not in the scope, we are going to try to add it - if (!in_array($sChildClass, $aProfileClasses)) - { - foreach (ProfilesConfig::GetProfilesValues() as $iKey => $aValue) - { + if (!in_array($sChildClass, $aProfileClasses)) { + foreach (ProfilesConfig::GetProfilesValues() as $iKey => $aValue) { $iProfileId = $iKey; // If the current profile has scope for that class in that mode, we duplicate it - if (isset($aProfiles[$iProfileId.'_'.$sProfileClass])) - { + if (isset($aProfiles[$iProfileId.'_'.$sProfileClass])) { $aProfiles[$iProfileId.'_'.$sChildClass] = $aProfiles[$iProfileId.'_'.$sProfileClass]; } } @@ -270,14 +249,12 @@ class LifecycleValidatorHelper // - Write file on disk // - Creating dir if necessary - if (!is_dir($this->sCachePath)) - { + if (!is_dir($this->sCachePath)) { mkdir($this->sCachePath, 0777, true); } // -- Then creating the file $ret = file_put_contents($sFilePath, $sPHP); - if ($ret === false) - { + if ($ret === false) { $iLen = strlen($sPHP); $fFree = @disk_free_space(dirname($sFilePath)); $aErr = error_get_last(); @@ -285,8 +262,7 @@ class LifecycleValidatorHelper } } - if (!class_exists($this->sGeneratedClass)) - { + if (!class_exists($this->sGeneratedClass)) { require_once $this->sCachePath.$this->sFilename; } } @@ -303,7 +279,7 @@ class LifecycleValidatorHelper */ public function GetStimuliForProfile($sProfile, $sClass) { - return $this->GetStimuliForProfiles(array($sProfile), $sClass); + return $this->GetStimuliForProfiles([$sProfile], $sClass); } /** @@ -319,17 +295,15 @@ class LifecycleValidatorHelper */ public function GetStimuliForProfiles($aProfiles, $sClass) { - $aStimuli = array(); + $aStimuli = []; // Preparing available stimuli - foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $aData) - { + foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $aData) { $aStimuli[$sStimulusCode] = true; } // Iterating on profiles to retrieving the different OQLs parts - foreach ($aProfiles as $sProfile) - { + foreach ($aProfiles as $sProfile) { // Retrieving matrix information $iProfileId = $this->GetProfileIdFromProfileName($sProfile); @@ -337,10 +311,8 @@ class LifecycleValidatorHelper $sLifecycleValuesClass = $this->sGeneratedClass; $aProfileMatrix = $sLifecycleValuesClass::GetProfileStimuli($iProfileId, $sClass); - foreach ($aProfileMatrix as $sStimulusCode) - { - if (array_key_exists($sStimulusCode, $aStimuli)) - { + foreach ($aProfileMatrix as $sStimulusCode) { + if (array_key_exists($sStimulusCode, $aStimuli)) { unset($aStimuli[$sStimulusCode]); } } @@ -364,18 +336,12 @@ class LifecycleValidatorHelper // We try to find the profile from its name in order to retrieve it's id // - If the regular UserRights add-on is installed we check the profiles array - if (class_exists('ProfilesConfig')) - { - if (defined($sProfile) && in_array($sProfile, ProfilesConfig::GetProfilesValues())) - { + if (class_exists('ProfilesConfig')) { + if (defined($sProfile) && in_array($sProfile, ProfilesConfig::GetProfilesValues())) { $iProfileId = constant($sProfile); - } - else - { - foreach (ProfilesConfig::GetProfilesValues() as $iKey => $aValue) - { - if ($aValue['name'] === $sProfile) - { + } else { + foreach (ProfilesConfig::GetProfilesValues() as $iKey => $aValue) { + if ($aValue['name'] === $sProfile) { $iProfileId = $iKey; break; } @@ -383,14 +349,12 @@ class LifecycleValidatorHelper } } // - Else, we can't find the id from the name as we don't know the used UserRights add-on. It has to be a constant - else - { + else { throw new Exception('Lifecycle validator : Unknown UserRights addon, lifecycle\'s profile must be a constant'); } // If profile was not found from its name or from a constant, we throw an exception - if ($iProfileId === null) - { + if ($iProfileId === null) { throw new Exception('Lifecycle validator : Could not find "'.$sProfile.'" in the profiles list'); } @@ -404,7 +368,7 @@ class LifecycleValidatorHelper * * @return string */ - protected function BuildPHPClass($aProfiles = array()) + protected function BuildPHPClass($aProfiles = []) { $sProfiles = var_export($aProfiles, true); $sClassName = $this->sGeneratedClass; @@ -447,4 +411,3 @@ EOF; } } - diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/NavigationRuleHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/NavigationRuleHelper.php index 95e3ce488..7d48cecfb 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/NavigationRuleHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/NavigationRuleHelper.php @@ -44,50 +44,50 @@ use utils; class NavigationRuleHelper { // Available point of origin for the navigation - const ENUM_ORIGIN_PAGE = 'default'; - const ENUM_ORIGIN_MODAL = 'modal'; + public const ENUM_ORIGIN_PAGE = 'default'; + public const ENUM_ORIGIN_MODAL = 'modal'; // Available rule categories (of rule types) /** @var string ENUM_RULE_CAT_CLOSE (eg. close modal/window) */ - const ENUM_RULE_CAT_CLOSE = 'close'; + public const ENUM_RULE_CAT_CLOSE = 'close'; /** @var string ENUM_RULE_CAT_REDIRECT (eg. go-to-homepage, go-to-object, go-to-brick, ...) */ - const ENUM_RULE_CAT_REDIRECT = 'redirect'; + public const ENUM_RULE_CAT_REDIRECT = 'redirect'; // Available rule types /** @var string ENUM_RULE_CLOSE */ - const ENUM_RULE_CLOSE = 'close'; + public const ENUM_RULE_CLOSE = 'close'; /** @var string ENUM_RULE_GO_TO_HOMEPAGE */ - const ENUM_RULE_GO_TO_HOMEPAGE = 'go-to-homepage'; + public const ENUM_RULE_GO_TO_HOMEPAGE = 'go-to-homepage'; /** @var string ENUM_RULE_GO_TO_OBJECT */ - const ENUM_RULE_GO_TO_OBJECT = 'go-to-object'; + public const ENUM_RULE_GO_TO_OBJECT = 'go-to-object'; /** @var string ENUM_RULE_GO_TO_BRICK */ - const ENUM_RULE_GO_TO_BRICK = 'go-to-brick'; + public const ENUM_RULE_GO_TO_BRICK = 'go-to-brick'; /** @var string ENUM_RULE_GO_TO_MANAGE_BRICK */ - const ENUM_RULE_GO_TO_MANAGE_BRICK = 'go-to-manage-brick'; + public const ENUM_RULE_GO_TO_MANAGE_BRICK = 'go-to-manage-brick'; /** @var string ENUM_RULE_GO_TO_BROWSE_BRICK */ - const ENUM_RULE_GO_TO_BROWSE_BRICK = 'go-to-browse-brick'; + public const ENUM_RULE_GO_TO_BROWSE_BRICK = 'go-to-browse-brick'; // - Defaults /** @var string DEFAULT_RULE_SUBMIT_PAGE */ - const DEFAULT_RULE_SUBMIT_PAGE = self::ENUM_RULE_GO_TO_OBJECT; + public const DEFAULT_RULE_SUBMIT_PAGE = self::ENUM_RULE_GO_TO_OBJECT; /** @var string DEFAULT_RULE_SUBMIT_MODAL */ - const DEFAULT_RULE_SUBMIT_MODAL = self::ENUM_RULE_CLOSE; + public const DEFAULT_RULE_SUBMIT_MODAL = self::ENUM_RULE_CLOSE; /** @var string DEFAULT_RULE_CANCEL_PAGE */ - const DEFAULT_RULE_CANCEL_PAGE = self::ENUM_RULE_CLOSE; + public const DEFAULT_RULE_CANCEL_PAGE = self::ENUM_RULE_CLOSE; /** @var string DEFAULT_RULE_CANCEL_MODAL */ - const DEFAULT_RULE_CANCEL_MODAL = self::ENUM_RULE_CLOSE; + public const DEFAULT_RULE_CANCEL_MODAL = self::ENUM_RULE_CLOSE; // Rule go-to-object properties /** @var string DEFAULT_RULE_GO_TO_OBJECT_PROP_MODE */ - const DEFAULT_RULE_GO_TO_OBJECT_PROP_MODE = ObjectFormHandlerHelper::ENUM_MODE_VIEW; + public const DEFAULT_RULE_GO_TO_OBJECT_PROP_MODE = ObjectFormHandlerHelper::ENUM_MODE_VIEW; /** @var string ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_MODAL */ - const ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_MODAL = 'modal'; + public const ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_MODAL = 'modal'; /** @var string ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_PAGE */ - const ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_PAGE = 'page'; + public const ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_PAGE = 'page'; /** @var string ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_CURRENT */ - const ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_CURRENT = 'current'; + public const ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_CURRENT = 'current'; /** @var string DEFAULT_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET */ - const DEFAULT_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET = self::ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_MODAL; + public const DEFAULT_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET = self::ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_MODAL; // Rule go-to-brick properties // TODO @@ -112,9 +112,12 @@ class NavigationRuleHelper * @throws \DOMFormatException */ public function __construct( - ModuleDesign $oModuleDesign, RouterInterface $oRouter, BrickCollection $oBrickCollection, ScopeValidatorHelper $oScopeValidator + ModuleDesign $oModuleDesign, + RouterInterface $oRouter, + BrickCollection $oBrickCollection, + ScopeValidatorHelper $oScopeValidator ) { - $this->aRules = array(); + $this->aRules = []; $this->oRouter = $oRouter; $this->oBrickCollection = $oBrickCollection; @@ -132,31 +135,29 @@ class NavigationRuleHelper */ public function Init(DOMNodeList $oNodes) { - $this->aRules = array(); + $this->aRules = []; // Iterating over the navigation_rule nodes /** @var \Combodo\iTop\DesignElement $oRuleNode */ - foreach ($oNodes as $oRuleNode) - { + foreach ($oNodes as $oRuleNode) { // Checking node name - if ($oRuleNode->nodeName !== 'navigation_rule') - { + if ($oRuleNode->nodeName !== 'navigation_rule') { continue; } // Retrieving mandatory attributes // - ID $sRuleId = $oRuleNode->getAttribute('id'); - if ($sRuleId === '') - { + if ($sRuleId === '') { throw new DOMFormatException('Rule tag must have an id attribute.', null, null, $oRuleNode); } // - Type $sRuleType = $oRuleNode->getAttribute('xsi:type'); - if (($sRuleType === '') || !in_array($sRuleType, static::GetAllowedTypes())) - { - throw new DOMFormatException('Navigation rule tag must have a valid xsi:type, "'.$sRuleType.'" given, expected '.implode('|', - static::GetAllowedTypes()), null, null, $oRuleNode); + if (($sRuleType === '') || !in_array($sRuleType, static::GetAllowedTypes())) { + throw new DOMFormatException('Navigation rule tag must have a valid xsi:type, "'.$sRuleType.'" given, expected '.implode( + '|', + static::GetAllowedTypes() + ), null, null, $oRuleNode); } // Load rule from XML @@ -176,10 +177,10 @@ class NavigationRuleHelper */ public static function GetAllowedOrigins() { - return array( + return [ static::ENUM_ORIGIN_PAGE, static::ENUM_ORIGIN_MODAL, - ); + ]; } /** @@ -189,14 +190,14 @@ class NavigationRuleHelper */ public static function GetAllowedTypes() { - return array( + return [ static::ENUM_RULE_CLOSE, static::ENUM_RULE_GO_TO_HOMEPAGE, static::ENUM_RULE_GO_TO_OBJECT, static::ENUM_RULE_GO_TO_BRICK, static::ENUM_RULE_GO_TO_BROWSE_BRICK, static::ENUM_RULE_GO_TO_MANAGE_BRICK, - ); + ]; } /** @@ -209,8 +210,7 @@ class NavigationRuleHelper */ public function GetRuleDefinition($sId) { - if (!array_key_exists($sId, $this->aRules)) - { + if (!array_key_exists($sId, $this->aRules)) { throw new Exception('NavigationRuleHelper: Could not find "'.$sId.'" in the rules list'); } @@ -251,10 +251,10 @@ class NavigationRuleHelper */ public function GetDefaultCloseRuleDefinition() { - return array( + return [ 'category' => static::ENUM_RULE_CAT_CLOSE, 'type' => static::ENUM_RULE_CLOSE, - ); + ]; } /** @@ -264,10 +264,10 @@ class NavigationRuleHelper */ public function GetDefaultGoToHomepageRuleDefinition() { - return array( + return [ 'category' => static::ENUM_RULE_CAT_REDIRECT, 'type' => static::ENUM_RULE_GO_TO_HOMEPAGE, - ); + ]; } /** @@ -277,15 +277,15 @@ class NavigationRuleHelper */ public function GetDefaultGoToObjectRuleDefinition() { - return array( + return [ 'category' => static::ENUM_RULE_CAT_REDIRECT, 'type' => static::ENUM_RULE_GO_TO_OBJECT, - 'properties' => array( + 'properties' => [ 'mode' => static::DEFAULT_RULE_GO_TO_OBJECT_PROP_MODE, 'opening_target' => static::DEFAULT_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET, 'oql' => null, - ), - ); + ], + ]; } /** @@ -295,16 +295,16 @@ class NavigationRuleHelper */ public function GetDefaultGoToBrickRuleDefinition() { - return array( + return [ 'category' => static::ENUM_RULE_CAT_REDIRECT, 'type' => static::ENUM_RULE_GO_TO_BRICK, - 'properties' => array( - 'route' => array( + 'properties' => [ + 'route' => [ 'id' => null, - 'params' => array(), - ), - ), - ); + 'params' => [], + ], + ], + ]; } //---------------------------- @@ -351,21 +351,18 @@ class NavigationRuleHelper // Default values $aRule = $this->GetDefaultGoToObjectRuleDefinition(); - $aAllowedOpeningTarget = array( + $aAllowedOpeningTarget = [ static::ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_CURRENT, static::ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_MODAL, static::ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_PAGE, - ); + ]; /** @var \Combodo\iTop\DesignElement $oPropNode */ - foreach($oRuleNode->GetNodes('*') as $oPropNode) - { - switch($oPropNode->nodeName) - { + foreach ($oRuleNode->GetNodes('*') as $oPropNode) { + switch ($oPropNode->nodeName) { case 'mode': $sMode = $oPropNode->GetText(); - if(!in_array($sMode, ObjectFormHandlerHelper::GetAllowedModes())) - { + if (!in_array($sMode, ObjectFormHandlerHelper::GetAllowedModes())) { throw new DOMFormatException('mode tag of navigation_rule "'.$sRuleId.'" must be valid. Expected '.implode('|', ObjectFormHandlerHelper::GetAllowedModes()).', "'.$sMode.'" given.', null, null, $oRuleNode); } $aRule['properties']['mode'] = $sMode; @@ -373,8 +370,7 @@ class NavigationRuleHelper case 'opening_target': $sOpeningTarget = $oPropNode->GetText(); - if(!in_array($sOpeningTarget, $aAllowedOpeningTarget)) - { + if (!in_array($sOpeningTarget, $aAllowedOpeningTarget)) { throw new DOMFormatException('opening_target tag of navigation_rule "'.$sRuleId.'" must be valid. Expected '.implode('|', $aAllowedOpeningTarget).', "'.$sOpeningTarget.'" given.', null, null, $oRuleNode); } $aRule['properties']['opening_target'] = $sOpeningTarget; @@ -382,8 +378,7 @@ class NavigationRuleHelper case 'oql': $sOQL = $oPropNode->GetText(); - if(empty($sOQL)) - { + if (empty($sOQL)) { throw new DOMFormatException('oql tag of navigation_rule "'.$sRuleId.'" can not be empty.'); } $aRule['properties']['oql'] = $sOQL; @@ -409,30 +404,24 @@ class NavigationRuleHelper $aRule = $this->GetDefaultGoToBrickRuleDefinition(); /** @var \Combodo\iTop\DesignElement $oPropNode */ - foreach($oRuleNode->GetNodes('*') as $oPropNode) - { - switch($oPropNode->nodeName) - { + foreach ($oRuleNode->GetNodes('*') as $oPropNode) { + switch ($oPropNode->nodeName) { case 'route': /** @var array $aRouteProperties Route ID and parameters */ - $aRouteProperties = array(); + $aRouteProperties = []; /** @var DesignElement $oRoutePropNode */ - foreach($oPropNode->GetNodes('*') as $oRoutePropNode) - { - switch($oRoutePropNode->nodeName) - { + foreach ($oPropNode->GetNodes('*') as $oRoutePropNode) { + switch ($oRoutePropNode->nodeName) { case 'id': $aRouteProperties['id'] = $oRoutePropNode->GetText(); break; case 'params': /** @var DesignElement $oRouteParamNode */ - foreach($oRoutePropNode->GetNodes('*') as $oRouteParamNode) - { + foreach ($oRoutePropNode->GetNodes('*') as $oRouteParamNode) { $sRouteParamId = $oRouteParamNode->getAttribute('id'); $sRouteParamValue = $oRouteParamNode->GetText(); - if(empty($sRouteParamId) || empty($sRouteParamValue)) - { + if (empty($sRouteParamId) || empty($sRouteParamValue)) { throw new DOMFormatException('param tag of navigation_rule "'.$sRuleId.'" must have a valid ID and value.', null, null, $oRuleNode); } @@ -443,8 +432,7 @@ class NavigationRuleHelper } // Consistency check - if(empty($aRouteProperties['id'])) - { + if (empty($aRouteProperties['id'])) { throw new DOMFormatException('navigation_rule "'.$sRuleId.'" must have a valid ID', null, null, $oRuleNode); } @@ -474,16 +462,15 @@ class NavigationRuleHelper $aRule['properties']['route']['params']['sDisplayMode'] = ManageBrick::DEFAULT_DISPLAY_MODE; // Rule parameters to automatically map to the route parameters - $aParamsMapping = array( + $aParamsMapping = [ 'id' => 'sBrickId', 'display_mode' => 'sDisplayMode', 'grouping_tab' => 'sGroupingTab', 'filter' => 'sSearchValue', - ); + ]; /** @var \Combodo\iTop\DesignElement $oPropNode */ - foreach($oRuleNode->GetNodes('*') as $oPropNode) - { + foreach ($oRuleNode->GetNodes('*') as $oPropNode) { $sRouteParamId = (array_key_exists($oPropNode->nodeName, $aParamsMapping)) ? $aParamsMapping[$oPropNode->nodeName] : $oPropNode->nodeName; $aRule['properties']['route']['params'][$sRouteParamId] = $oPropNode->GetText(); } @@ -509,15 +496,14 @@ class NavigationRuleHelper $aRule['properties']['route']['params']['sBrowseMode'] = BrowseBrick::DEFAULT_BROWSE_MODE; // Rule parameters to automatically map to the route parameters - $aParamsMapping = array( + $aParamsMapping = [ 'id' => 'sBrickId', 'browse_mode' => 'sBrowseMode', 'filter' => 'sSearchValue', - ); + ]; /** @var \Combodo\iTop\DesignElement $oPropNode */ - foreach($oRuleNode->GetNodes('*') as $oPropNode) - { + foreach ($oRuleNode->GetNodes('*') as $oPropNode) { $sRouteParamId = (array_key_exists($oPropNode->nodeName, $aParamsMapping)) ? $aParamsMapping[$oPropNode->nodeName] : $oPropNode->nodeName; $aRule['properties']['route']['params'][$sRouteParamId] = $oPropNode->GetText(); } @@ -555,33 +541,30 @@ class NavigationRuleHelper public function PrepareRulesForForm(array $aFormProperties, DBObject $oCurrentObject, $bIsCurrentFormInModal = false) { // Default values - $aResults = array( - 'submit' => array( + $aResults = [ + 'submit' => [ 'category' => static::ENUM_RULE_CAT_REDIRECT, 'url' => null, 'modal' => false, - ), - 'cancel' => array( + ], + 'cancel' => [ 'category' => static::ENUM_RULE_CAT_CLOSE, 'url' => null, 'modal' => false, - ), - ); + ], + ]; // Get form's navigation rules - $aFormNavRules = (isset($aFormProperties['properties']['navigation_rules'])) ? $aFormProperties['properties']['navigation_rules'] : array('submit' => null, 'cancel' => null); + $aFormNavRules = (isset($aFormProperties['properties']['navigation_rules'])) ? $aFormProperties['properties']['navigation_rules'] : ['submit' => null, 'cancel' => null]; // Check from which origin the rule will be called $sRuleCallOrigin = ($bIsCurrentFormInModal) ? 'modal' : 'default'; - foreach(array_keys($aResults) as $sButtonCode) - { + foreach (array_keys($aResults) as $sButtonCode) { // Retrieve rule definition // - Default behavior when no rule specified - if(empty($aFormNavRules[$sButtonCode][$sRuleCallOrigin])) - { - switch($sButtonCode) - { + if (empty($aFormNavRules[$sButtonCode][$sRuleCallOrigin])) { + switch ($sButtonCode) { case 'submit': $sDefaultRuleType = ($bIsCurrentFormInModal) ? static::DEFAULT_RULE_SUBMIT_MODAL : static::DEFAULT_RULE_SUBMIT_PAGE; break; @@ -593,8 +576,7 @@ class NavigationRuleHelper $aRuleDef = $this->GetDefaultRuleDefinitionFromType($sDefaultRuleType); } // - Specified rule - else - { + else { $sRuleId = $aFormNavRules[$sButtonCode][$sRuleCallOrigin]; $aRuleDef = $this->GetRuleDefinition($sRuleId); } @@ -603,36 +585,31 @@ class NavigationRuleHelper $aResults[$sButtonCode]['category'] = $aRuleDef['category']; // Set properties regarding the type - switch($aRuleDef['type']) - { + switch ($aRuleDef['type']) { case static::ENUM_RULE_GO_TO_HOMEPAGE: $aResults[$sButtonCode]['url'] = $this->oRouter->generate('p_home'); break; case static::ENUM_RULE_GO_TO_OBJECT: // Target opening mode to modal if specified or should be as current form - if( ($aRuleDef['properties']['opening_target'] === static::ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_MODAL) + if (($aRuleDef['properties']['opening_target'] === static::ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_MODAL) || (($aRuleDef['properties']['opening_target'] === static::ENUM_RULE_GO_TO_OBJECT_PROP_OPENING_TARGET_CURRENT) && ($bIsCurrentFormInModal === true)) - ) - { + ) { $aResults[$sButtonCode]['modal'] = true; } // Target URL // - Find object - if(empty($aRuleDef['properties']['oql'])) - { + if (empty($aRuleDef['properties']['oql'])) { $oTargetObject = $oCurrentObject; - } - else - { + } else { $oSearch = DBSearch::FromOQL($aRuleDef['properties']['oql']); - $oSet = new DBObjectSet($oSearch, array(), array('this' => $oCurrentObject)); - $oSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => array())); + $oSet = new DBObjectSet($oSearch, [], ['this' => $oCurrentObject]); + $oSet->OptimizeColumnLoad([$oSearch->GetClassAlias() => []]); $oTargetObject = $oSet->Fetch(); } // - Build URL - $aResults[$sButtonCode]['url'] = $this->oRouter->generate('p_object_'.$aRuleDef['properties']['mode'], array('sObjectClass' => get_class($oTargetObject), 'sObjectId' => $oTargetObject->GetKey())); + $aResults[$sButtonCode]['url'] = $this->oRouter->generate('p_object_'.$aRuleDef['properties']['mode'], ['sObjectClass' => get_class($oTargetObject), 'sObjectId' => $oTargetObject->GetKey()]); break; case static::ENUM_RULE_GO_TO_BRICK: diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/ObjectFormHandlerHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/ObjectFormHandlerHelper.php index 15103692d..852ac9be7 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/ObjectFormHandlerHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/ObjectFormHandlerHelper.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public License */ - namespace Combodo\iTop\Portal\Helper; use ApplicationContext; @@ -51,16 +50,16 @@ use UserRights; class ObjectFormHandlerHelper { /** @var string */ - const ENUM_MODE_VIEW = 'view'; + public const ENUM_MODE_VIEW = 'view'; /** @var string */ - const ENUM_MODE_EDIT = 'edit'; + public const ENUM_MODE_EDIT = 'edit'; /** @var string */ - const ENUM_MODE_CREATE = 'create'; + public const ENUM_MODE_CREATE = 'create'; /** * @var string * @since 2.7.7 3.0.1 3.1.0 */ - const ENUM_MODE_APPLY_STIMULUS = 'apply_stimulus'; + public const ENUM_MODE_APPLY_STIMULUS = 'apply_stimulus'; /** @var \Combodo\iTop\Portal\Helper\RequestManipulatorHelper $oRequestManipulator */ private $oRequestManipulator; @@ -95,10 +94,16 @@ class ObjectFormHandlerHelper * @param \Combodo\iTop\Portal\Twig\AppExtension $oAppExtension */ public function __construct( - RequestManipulatorHelper $oRequestManipulator, ContextManipulatorHelper $oContextManipulator, NavigationRuleHelper $oNavigationRuleHelper, ScopeValidatorHelper $oScopeValidator, SecurityHelper $oSecurityHelper, UrlGeneratorInterface $oUrlGenerator, $aCombodoPortalInstanceConf, $sPortalId, + RequestManipulatorHelper $oRequestManipulator, + ContextManipulatorHelper $oContextManipulator, + NavigationRuleHelper $oNavigationRuleHelper, + ScopeValidatorHelper $oScopeValidator, + SecurityHelper $oSecurityHelper, + UrlGeneratorInterface $oUrlGenerator, + $aCombodoPortalInstanceConf, + $sPortalId, AppExtension $oAppExtension - ) - { + ) { $this->oRequestManipulator = $oRequestManipulator; $this->oContextManipulator = $oContextManipulator; $this->oNavigationRuleHelper = $oNavigationRuleHelper; @@ -126,7 +131,7 @@ class ObjectFormHandlerHelper */ public function HandleForm(Request $oRequest, $sMode, $sObjectClass, $sObjectId = null, array $aFormProperties = null) { - $aFormData = array(); + $aFormData = []; $sOperation = $this->oRequestManipulator->ReadParam('operation', ''); $bModal = ($oRequest->isXmlHttpRequest() && empty($sOperation)); @@ -134,71 +139,58 @@ class ObjectFormHandlerHelper $aFormProperties = $aFormProperties ?? ApplicationHelper::GetLoadedFormFromClass($this->aCombodoPortalInstanceConf['forms'], $sObjectClass, $sMode); // - Create and - if (empty($sOperation)) - { + if (empty($sOperation)) { // Retrieving action rules // // Note : The action rules must be a base64-encoded JSON object, this is just so users are tempted to changes values. // But it would not be a security issue as it only presets values in the form. $sActionRulesToken = $this->oRequestManipulator->ReadParam('ar_token', ''); - $aActionRules = (!empty($sActionRulesToken)) ? ContextManipulatorHelper::DecodeRulesToken($sActionRulesToken) : array(); + $aActionRules = (!empty($sActionRulesToken)) ? ContextManipulatorHelper::DecodeRulesToken($sActionRulesToken) : []; // Preparing object - if ($sObjectId === null) - { + if ($sObjectId === null) { // Create new UserRequest $oObject = MetaModel::NewObject($sObjectClass); // Retrieve action rules information to auto-fill the form if available // Preparing object $this->oContextManipulator->PrepareObject($aActionRules, $oObject); - $aPrefillFormParam = array( + $aPrefillFormParam = [ 'user' => UserRights::GetUser(), 'origin' => 'portal', - ); + ]; $oObject->PrefillForm('creation_from_0', $aPrefillFormParam); - } - else - { + } else { $oObject = MetaModel::GetObject($sObjectClass, $sObjectId, true, $this->oScopeValidator->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass)); } // Preparing buttons - $aFormData['buttons'] = array( - 'transitions' => array(), - 'actions' => array(), - 'links' => array(), - 'submit' => array( + $aFormData['buttons'] = [ + 'transitions' => [], + 'actions' => [], + 'links' => [], + 'submit' => [ 'label' => Dict::S('Portal:Button:Submit'), - ), - ); - if ($sMode !== static::ENUM_MODE_APPLY_STIMULUS) - { + ], + ]; + if ($sMode !== static::ENUM_MODE_APPLY_STIMULUS) { // Add transition buttons $oSetToCheckRights = DBObjectSet::FromObject($oObject); $aStimuli = Metamodel::EnumStimuli($sObjectClass); - foreach ($oObject->EnumTransitions() as $sStimulusCode => $aTransitionDef) - { - if ($this->oSecurityHelper->IsStimulusAllowed($sStimulusCode, $sObjectClass, $oSetToCheckRights)) - { + foreach ($oObject->EnumTransitions() as $sStimulusCode => $aTransitionDef) { + if ($this->oSecurityHelper->IsStimulusAllowed($sStimulusCode, $sObjectClass, $oSetToCheckRights)) { $aFormData['buttons']['transitions'][$sStimulusCode] = $aStimuli[$sStimulusCode]->GetLabel(); } } // Add plugin buttons /** @var \iPopupMenuExtension $oExtensionInstance */ - foreach (MetaModel::EnumPlugins('iPopupMenuExtension') as $oExtensionInstance) - { - foreach ($oExtensionInstance->EnumItems(iPopupMenuExtension::PORTAL_OBJDETAILS_ACTIONS, array('portal_id' => $this->sPortalId, 'object' => $oObject, 'mode' => $sMode)) as $oMenuItem) - { - if (is_object($oMenuItem)) - { - if ($oMenuItem instanceof JSButtonItem) - { - $aFormData['buttons']['actions'][] = $oMenuItem->GetMenuItem() + array('js_files' => $oMenuItem->GetLinkedScripts()); - } - elseif ($oMenuItem instanceof URLButtonItem) - { + foreach (MetaModel::EnumPlugins('iPopupMenuExtension') as $oExtensionInstance) { + foreach ($oExtensionInstance->EnumItems(iPopupMenuExtension::PORTAL_OBJDETAILS_ACTIONS, ['portal_id' => $this->sPortalId, 'object' => $oObject, 'mode' => $sMode]) as $oMenuItem) { + if (is_object($oMenuItem)) { + if ($oMenuItem instanceof JSButtonItem) { + $aFormData['buttons']['actions'][] = $oMenuItem->GetMenuItem() + ['js_files' => $oMenuItem->GetLinkedScripts()]; + } elseif ($oMenuItem instanceof URLButtonItem) { $aFormData['buttons']['links'][] = $oMenuItem->GetMenuItem(); } } @@ -206,22 +198,17 @@ class ObjectFormHandlerHelper } // Hiding submit button or changing its label if necessary - if (!empty($aFormData['buttons']['transitions']) && isset($aFormProperties['properties']) && $aFormProperties['properties']['always_show_submit'] === false) - { + if (!empty($aFormData['buttons']['transitions']) && isset($aFormProperties['properties']) && $aFormProperties['properties']['always_show_submit'] === false) { unset($aFormData['buttons']['submit']); - } - elseif ($sMode === static::ENUM_MODE_EDIT) - { + } elseif ($sMode === static::ENUM_MODE_EDIT) { $aFormData['buttons']['submit']['label'] = Dict::S('Portal:Button:Apply'); } - } - else - { - $aPrefillFormParam = array( + } else { + $aPrefillFormParam = [ 'user' => UserRights::GetUser(), 'origin' => 'portal', 'stimulus' => $this->oRequestManipulator->ReadParam('apply_stimulus', null, FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY)['code'], - ); + ]; $oObject->PrefillForm('state_change', $aPrefillFormParam); } @@ -235,32 +222,31 @@ class ObjectFormHandlerHelper // Preparing renderer // Note : We might need to distinguish form & renderer endpoints - switch($sMode) - { + switch ($sMode) { case static::ENUM_MODE_CREATE: case static::ENUM_MODE_EDIT: case static::ENUM_MODE_VIEW: - if(array_key_exists('submit_endpoint', $aFormProperties)) { - $sFormEndpoint = $aFormProperties['submit_endpoint']; - } else { - $sFormEndpoint = $this->oUrlGenerator->generate( - 'p_object_' . $sMode, - array( - 'sObjectClass' => $sObjectClass, - 'sObjectId' => $sObjectId, - ) - ); - } + if (array_key_exists('submit_endpoint', $aFormProperties)) { + $sFormEndpoint = $aFormProperties['submit_endpoint']; + } else { + $sFormEndpoint = $this->oUrlGenerator->generate( + 'p_object_'.$sMode, + [ + 'sObjectClass' => $sObjectClass, + 'sObjectId' => $sObjectId, + ] + ); + } break; case static::ENUM_MODE_APPLY_STIMULUS: $sFormEndpoint = $this->oUrlGenerator->generate( 'p_object_apply_stimulus', - array( + [ 'sObjectClass' => $sObjectClass, 'sObjectId' => $sObjectId, 'sStimulusCode' => $this->oRequestManipulator->ReadParam('sStimulusCode'), - ) + ] ); break; @@ -294,8 +280,7 @@ class ObjectFormHandlerHelper /** @var \Combodo\iTop\Portal\Form\ObjectFormManager $sFormManagerClass */ $sFormManagerClass = $this->oRequestManipulator->ReadParam('formmanager_class', '', FILTER_UNSAFE_RAW); $sFormManagerData = $this->oRequestManipulator->ReadParam('formmanager_data', '', FILTER_UNSAFE_RAW); - if (empty($sFormManagerClass) || empty($sFormManagerData)) - { + if (empty($sFormManagerClass) || empty($sFormManagerData)) { IssueLog::Error(__METHOD__.' at line '.__LINE__.' : Parameters formmanager_class and formmanager_data must be defined.'); throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, 'Parameters formmanager_class and formmanager_data must be defined.'); } @@ -312,48 +297,45 @@ class ObjectFormHandlerHelper $oFormManager->SetObject($oObj); } - switch ($sOperation) - { + switch ($sOperation) { case 'submit': // Applying modification to object $aFormData['validation'] = $oFormManager->OnSubmit( - array( - 'currentValues' => $this->oRequestManipulator->ReadParam('current_values', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), - 'attachmentIds' => $this->oRequestManipulator->ReadParam('attachment_ids', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), + [ + 'currentValues' => $this->oRequestManipulator->ReadParam('current_values', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), + 'attachmentIds' => $this->oRequestManipulator->ReadParam('attachment_ids', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), 'formProperties' => $aFormProperties, 'applyStimulus' => $this->oRequestManipulator->ReadParam('apply_stimulus', null, FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), - ) + ] ); - if ($aFormData['validation']['valid'] === true) - { + if ($aFormData['validation']['valid'] === true) { // Note : We don't use $sObjectId there as it can be null if we are creating a new one. Instead we use the id from the created object once it has been serialized // Check if stimulus has to be applied $sStimulusCode = $this->oRequestManipulator->ReadParam('stimulus_code', ''); - if (!empty($sStimulusCode)) - { - $aFormData['validation']['redirection'] = array( - 'url' => $this->oUrlGenerator->generate('p_object_apply_stimulus', array('sObjectClass' => $sObjectClass, 'sObjectId' => $oFormManager->GetObject()->GetKey(), 'sStimulusCode' => $sStimulusCode)), + if (!empty($sStimulusCode)) { + $aFormData['validation']['redirection'] = [ + 'url' => $this->oUrlGenerator->generate('p_object_apply_stimulus', ['sObjectClass' => $sObjectClass, 'sObjectId' => $oFormManager->GetObject()->GetKey(), 'sStimulusCode' => $sStimulusCode]), 'modal' => true, - ); + ]; } } else { - $sErrorMessages = ''; - foreach ($aFormData['validation']['messages']['error'] as $sFieldId => $aMessages) { - if ($sFieldId == '_main') { - $sErrorMessages .= implode(' - ', $aFormData['validation']['messages']['error']['_main']); - } else { - $oObj = $oFormManager->GetObject(); - $sLabel = $oObj->GetLabel($sFieldId); - $sErrorMessages .= Dict::Format('Portal:Error:CheckToWriteFailed', $sLabel, (is_array($aMessages) ? implode(' - ', $aMessages) : $aMessages)); - } - } + $sErrorMessages = ''; + foreach ($aFormData['validation']['messages']['error'] as $sFieldId => $aMessages) { + if ($sFieldId == '_main') { + $sErrorMessages .= implode(' - ', $aFormData['validation']['messages']['error']['_main']); + } else { + $oObj = $oFormManager->GetObject(); + $sLabel = $oObj->GetLabel($sFieldId); + $sErrorMessages .= Dict::Format('Portal:Error:CheckToWriteFailed', $sLabel, (is_array($aMessages) ? implode(' - ', $aMessages) : $aMessages)); + } + } - throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, $sErrorMessages); + throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, $sErrorMessages); } break; case 'update': - $oFormManager->OnUpdate(array('currentValues' => $this->oRequestManipulator->ReadParam('current_values', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), 'formProperties' => $aFormProperties)); + $oFormManager->OnUpdate(['currentValues' => $this->oRequestManipulator->ReadParam('current_values', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY), 'formProperties' => $aFormProperties]); break; case 'cancel': @@ -363,33 +345,27 @@ class ObjectFormHandlerHelper } // Preparing field_set data - $aFieldSetData = array( + $aFieldSetData = [ //'fields_list' => $oFormManager->GetRenderer()->Render(), // GLA : This should be done just after in the if statement. 'fields_impacts' => $oFormManager->GetForm()->GetFieldsImpacts(), 'form_path' => $oFormManager->GetForm()->GetId(), - ); + ]; // Preparing fields list regarding the operation - if ($sOperation === 'update') - { - $aRequestedFields = $this->oRequestManipulator->ReadParam('requested_fields', array(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); + if ($sOperation === 'update') { + $aRequestedFields = $this->oRequestManipulator->ReadParam('requested_fields', [], FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); $sFormPath = $this->oRequestManipulator->ReadParam('form_path', ''); // Checking if the update was on a subform, if so we need to make the rendering for that part only - if (!empty($sFormPath) && $sFormPath !== $oFormManager->GetForm()->GetId()) - { + if (!empty($sFormPath) && $sFormPath !== $oFormManager->GetForm()->GetId()) { $oSubForm = $oFormManager->GetForm()->FindSubForm($sFormPath); $oSubFormRenderer = new BsFormRenderer($oSubForm); $oSubFormRenderer->SetEndpoint($oFormManager->GetRenderer()->GetEndpoint()); $aFormData['updated_fields'] = $oSubFormRenderer->Render($aRequestedFields); - } - else - { + } else { $aFormData['updated_fields'] = $oFormManager->GetRenderer()->Render($aRequestedFields); } - } - else - { + } else { $aFieldSetData['fields_list'] = $oFormManager->GetRenderer()->Render(); } @@ -407,8 +383,7 @@ class ObjectFormHandlerHelper $aFormData['display_mode'] = (isset($aFormProperties['properties'])) ? $aFormProperties['properties']['display_mode'] : ApplicationHelper::FORM_DEFAULT_DISPLAY_MODE; $aFormData['hidden_fields'] = $oFormManager->GetHiddenFieldsId(); // - Set a text to be copied on title if the object is not in creation - if($sMode !== static::ENUM_MODE_CREATE && !empty($sObjectId)) - { + if ($sMode !== static::ENUM_MODE_CREATE && !empty($sObjectId)) { $aFormData['title_clipboard_text'] = Dict::Format( 'Brick:Portal:Object:Copy:TextToCopy', $aFormData['object_name'], @@ -435,17 +410,15 @@ class ObjectFormHandlerHelper public function RenderFormFromTwig($sId, $sTwigString, $aData) { // Creating sandbox twig env. to load and test the custom form template - $oTwig = new Environment(new ArrayLoader(array($sId => $sTwigString))); + $oTwig = new Environment(new ArrayLoader([$sId => $sTwigString])); // Manually registering filters and functions as we didn't find how to do it automatically $aFilters = $this->oAppExtension->getFilters(); - foreach ($aFilters as $oFilter) - { + foreach ($aFilters as $oFilter) { $oTwig->addFilter($oFilter); } $aFunctions = $this->oAppExtension->getFunctions(); - foreach ($aFunctions as $oFunction) - { + foreach ($aFunctions as $oFunction) { $oTwig->addFunction($oFunction); } @@ -469,9 +442,9 @@ class ObjectFormHandlerHelper public function CheckReadFormDataAllowed($sFormManagerData) { $aJsonFromData = ObjectFormManager::DecodeFormManagerData($sFormManagerData); - if(isset($aJsonFromData['formobject_class']) + if (isset($aJsonFromData['formobject_class']) && isset($aJsonFromData['formobject_id']) - && !$this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $aJsonFromData['formobject_class'], $aJsonFromData['formobject_id'])){ + && !$this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $aJsonFromData['formobject_class'], $aJsonFromData['formobject_id'])) { throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, 'Form data access denied.'); } } @@ -484,11 +457,11 @@ class ObjectFormHandlerHelper */ public static function GetAllowedModes() { - return array( + return [ static::ENUM_MODE_VIEW, static::ENUM_MODE_EDIT, static::ENUM_MODE_CREATE, - ); + ]; } /** @@ -530,4 +503,4 @@ class ObjectFormHandlerHelper { return $this->aCombodoPortalInstanceConf; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/RequestManipulatorHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/RequestManipulatorHelper.php index f46525335..97b890119 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/RequestManipulatorHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/RequestManipulatorHelper.php @@ -63,18 +63,15 @@ class RequestManipulatorHelper */ public function HasParam($sKey) { - if ($this->GetCurrentRequest()->query->has($sKey)) - { + if ($this->GetCurrentRequest()->query->has($sKey)) { return true; } - if ($this->GetCurrentRequest()->attributes->has($sKey)) - { + if ($this->GetCurrentRequest()->attributes->has($sKey)) { return true; } - if ($this->GetCurrentRequest()->request->has($sKey)) - { + if ($this->GetCurrentRequest()->request->has($sKey)) { return true; } @@ -90,7 +87,7 @@ class RequestManipulatorHelper * @param string $sKey * @param mixed $default * @param int $iFilter Default is FILTER_SANITIZE_SPECIAL_CHARS - * @param int $aFilterOptions @since 3.2.0 - N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 + * @param int $aFilterOptions @since 3.2.0 - N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 * * @return mixed|null * @@ -98,18 +95,15 @@ class RequestManipulatorHelper */ public function ReadParam($sKey, $default = null, $iFilter = FILTER_SANITIZE_SPECIAL_CHARS, $aFilterOptions = []) { - if ($this->GetCurrentRequest()->query->has($sKey)) - { + if ($this->GetCurrentRequest()->query->has($sKey)) { return $this->GetCurrentRequest()->query->filter($sKey, $default, $iFilter, $aFilterOptions); } - if ($this->GetCurrentRequest()->attributes->has($sKey)) - { + if ($this->GetCurrentRequest()->attributes->has($sKey)) { return $this->GetCurrentRequest()->attributes->filter($sKey, $default, $iFilter, $aFilterOptions); } - if ($this->GetCurrentRequest()->request->has($sKey)) - { + if ($this->GetCurrentRequest()->request->has($sKey)) { return $this->GetCurrentRequest()->request->filter($sKey, $default, $iFilter, $aFilterOptions); } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/ScopeValidatorHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/ScopeValidatorHelper.php index 6332a56c4..ed885e0ce 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/ScopeValidatorHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/ScopeValidatorHelper.php @@ -41,18 +41,18 @@ use utils; class ScopeValidatorHelper { /** @var string ENUM_MODE_READ */ - const ENUM_MODE_READ = 'r'; + public const ENUM_MODE_READ = 'r'; /** @var string ENUM_MODE_WRITE */ - const ENUM_MODE_WRITE = 'w'; + public const ENUM_MODE_WRITE = 'w'; /** @var string ENUM_TYPE_ALLOW */ - const ENUM_TYPE_ALLOW = 'allow'; + public const ENUM_TYPE_ALLOW = 'allow'; /** @var string ENUM_TYPE_RESTRICT */ - const ENUM_TYPE_RESTRICT = 'restrict'; + public const ENUM_TYPE_RESTRICT = 'restrict'; /** @var string DEFAULT_GENERATED_CLASS */ - const DEFAULT_GENERATED_CLASS = '\\PortalScopesValues'; + public const DEFAULT_GENERATED_CLASS = '\\PortalScopesValues'; /** @var bool DEFAULT_IGNORE_SILOS */ - const DEFAULT_IGNORE_SILOS = false; + public const DEFAULT_IGNORE_SILOS = false; /** @var string|null $sCachePath */ protected $sCachePath; @@ -80,7 +80,7 @@ class ScopeValidatorHelper $this->sCachePath = $sPortalCachePath; $this->sInstancePrefix = "{$sPortalId}-"; $this->sGeneratedClass = static::DEFAULT_GENERATED_CLASS; - $this->aProfilesMatrix = array(); + $this->aProfilesMatrix = []; $this->Init($moduleDesign->GetNodes('/module_design/classes/class')); } @@ -96,8 +96,7 @@ class ScopeValidatorHelper public function Init(DOMNodeList $oNodes) { // Checking cache path - if ($this->sCachePath === null) - { + if ($this->sCachePath === null) { $this->sCachePath = utils::GetCachePath(); } // Building full pathname for file @@ -105,20 +104,18 @@ class ScopeValidatorHelper // Creating file if not existing // Note : This is a temporary cache system, it should soon evolve to a cache provider (fs, apc, memcache, ...) - if (!file_exists($sFilePath)) - { + if (!file_exists($sFilePath)) { $this->InitGenerateAndWriteCache($oNodes, $sFilePath); } - if (!class_exists($this->sGeneratedClass)) - { + if (!class_exists($this->sGeneratedClass)) { require_once $this->sCachePath.$this->sFilename; } } public static function EnumTypeValues() { - return array(static::ENUM_TYPE_ALLOW, static::ENUM_TYPE_RESTRICT); + return [static::ENUM_TYPE_ALLOW, static::ENUM_TYPE_RESTRICT]; } /** @@ -197,7 +194,7 @@ class ScopeValidatorHelper */ public function GetScopeFilterForProfile($sProfile, $sClass, $iAction = null) { - return $this->GetScopeFilterForProfiles(array($sProfile), $sClass, $iAction); + return $this->GetScopeFilterForProfiles([$sProfile], $sClass, $iAction); } /** @@ -217,19 +214,17 @@ class ScopeValidatorHelper public function GetScopeFilterForProfiles($aProfiles, $sClass, $iAction = null) { $oSearch = null; - $aAllowSearches = array(); - $aRestrictSearches = array(); + $aAllowSearches = []; + $aRestrictSearches = []; $bIgnoreSilos = static::DEFAULT_IGNORE_SILOS; // Checking the default mode - if ($iAction === null) - { + if ($iAction === null) { $iAction = UR_ACTION_READ; } // Iterating on profiles to retrieving the different OQLs parts - foreach ($aProfiles as $sProfile) - { + foreach ($aProfiles as $sProfile) { // Retrieving matrix information $iProfileId = $this->GetProfileIdFromProfileName($sProfile); $sMode = ($iAction === UR_ACTION_READ) ? static::ENUM_MODE_READ : static::ENUM_MODE_WRITE; @@ -237,39 +232,31 @@ class ScopeValidatorHelper // Retrieving profile OQLs $sScopeValuesClass = $this->sGeneratedClass; $aProfileMatrix = $sScopeValuesClass::GetProfileScope($iProfileId, $sClass, $sMode); - if ($aProfileMatrix !== null) - { - if (isset($aProfileMatrix['allow']) && $aProfileMatrix['allow'] !== null) - { + if ($aProfileMatrix !== null) { + if (isset($aProfileMatrix['allow']) && $aProfileMatrix['allow'] !== null) { $aAllowSearches[] = DBSearch::FromOQL($aProfileMatrix['allow']); } - if (isset($aProfileMatrix['restrict']) && $aProfileMatrix['restrict'] !== null) - { + if (isset($aProfileMatrix['restrict']) && $aProfileMatrix['restrict'] !== null) { $aRestrictSearches[] = DBSearch::FromOQL($aProfileMatrix['restrict']); } // If a profile should ignore allowed org, we set it for all its queries no matter the profile - if (isset($aProfileMatrix['ignore_silos']) && $aProfileMatrix['ignore_silos'] === true) - { + if (isset($aProfileMatrix['ignore_silos']) && $aProfileMatrix['ignore_silos'] === true) { $bIgnoreSilos = true; } } } // Building the real OQL from all the parts from the different profiles - for ($i = 0; $i < count($aAllowSearches); $i++) - { - foreach ($aRestrictSearches as $oRestrictSearch) - { + for ($i = 0; $i < count($aAllowSearches); $i++) { + foreach ($aRestrictSearches as $oRestrictSearch) { $aAllowSearches[$i] = $aAllowSearches[$i]->Intersect($oRestrictSearch); } } - if (count($aAllowSearches) > 0) - { + if (count($aAllowSearches) > 0) { $oSearch = new DBUnionSearch($aAllowSearches); $oSearch = $oSearch->RemoveDuplicateQueries(); } - if ($bIgnoreSilos === true) - { + if ($bIgnoreSilos === true) { $oSearch->AllowAllData(); } @@ -291,12 +278,10 @@ class ScopeValidatorHelper public function AddScopeToQuery(DBSearch &$oQuery, $sClass, $sAction = UR_ACTION_READ) { $oScopeQuery = $this->GetScopeFilterForProfiles(UserRights::ListProfiles(), $sClass, $sAction); - if ($oScopeQuery !== null) - { + if ($oScopeQuery !== null) { $oQuery = $oQuery->Intersect($oScopeQuery); // - Allowing all data if necessary - if ($oScopeQuery->IsAllDataAllowed()) - { + if ($oScopeQuery->IsAllDataAllowed()) { $oQuery->AllowAllData(); } @@ -321,19 +306,16 @@ class ScopeValidatorHelper $bIgnoreSilos = false; // Iterating on profiles to retrieving the different OQLs parts - foreach ($aProfiles as $sProfile) - { + foreach ($aProfiles as $sProfile) { // Retrieving matrix information $iProfileId = $this->GetProfileIdFromProfileName($sProfile); // Retrieving profile OQLs $sScopeValuesClass = $this->sGeneratedClass; $aProfileMatrix = $sScopeValuesClass::GetProfileScope($iProfileId, $sClass, static::ENUM_MODE_READ); - if ($aProfileMatrix !== null) - { + if ($aProfileMatrix !== null) { // If a profile should ignore allowed org, we set it for all its queries no matter the profile - if (isset($aProfileMatrix['ignore_silos']) && $aProfileMatrix['ignore_silos'] === true) - { + if (isset($aProfileMatrix['ignore_silos']) && $aProfileMatrix['ignore_silos'] === true) { $bIgnoreSilos = true; } } @@ -357,18 +339,12 @@ class ScopeValidatorHelper // We try to find the profile from its name in order to retrieve it's id // - If the regular UserRights add-on is installed we check the profiles array - if (class_exists('ProfilesConfig')) - { - if (defined($sProfile) && in_array($sProfile, ProfilesConfig::GetProfilesValues())) - { + if (class_exists('ProfilesConfig')) { + if (defined($sProfile) && in_array($sProfile, ProfilesConfig::GetProfilesValues())) { $iProfileId = constant($sProfile); - } - else - { - foreach (ProfilesConfig::GetProfilesValues() as $iKey => $aValue) - { - if ($aValue['name'] === $sProfile) - { + } else { + foreach (ProfilesConfig::GetProfilesValues() as $iKey => $aValue) { + if ($aValue['name'] === $sProfile) { $iProfileId = $iKey; break; } @@ -376,14 +352,12 @@ class ScopeValidatorHelper } } // - Else, we can't find the id from the name as we don't know the used UserRights add-on. It has to be a constant - else - { + else { throw new Exception('Scope validator : Unknown UserRights addon, scope\'s profile must be a constant'); } // If profile was not found from its name or from a constant, we throw an exception - if ($iProfileId === null) - { + if ($iProfileId === null) { throw new Exception('Scope validator : Could not find "'.$sProfile.'" in the profiles list'); } @@ -397,7 +371,7 @@ class ScopeValidatorHelper * * @return string */ - protected function BuildPHPClass($aProfiles = array()) + protected function BuildPHPClass($aProfiles = []) { $sProfiles = var_export($aProfiles, true); $sClassName = ltrim($this->sGeneratedClass, '\\'); @@ -450,31 +424,26 @@ EOF; protected function InitGenerateAndWriteCache(DOMNodeList $oNodes, $sFilePath) { // - Build php array from xml - $aProfiles = array(); + $aProfiles = []; // This will be used to know which classes have been set, so we can set the missing ones. - $aProfileClasses = array(); + $aProfileClasses = []; // Iterating over the class nodes /** @var \Combodo\iTop\DesignElement $oClassNode */ - foreach ($oNodes as $oClassNode) - { + foreach ($oNodes as $oClassNode) { // retrieving mandatory class id attribute $sClass = $oClassNode->getAttribute('id'); - if ($sClass === '') - { + if ($sClass === '') { throw new DOMFormatException('Class tag must have an id attribute.', null, null, $oClassNode); } // Iterating over scope nodes of the class $oScopesNode = $oClassNode->GetOptionalElement('scopes'); - if ($oScopesNode !== null) - { + if ($oScopesNode !== null) { /** @var \Combodo\iTop\DesignElement $oScopeNode */ - foreach ($oScopesNode->GetNodes('./scope') as $oScopeNode) - { + foreach ($oScopesNode->GetNodes('./scope') as $oScopeNode) { // Retrieving mandatory scope id attribute $sScopeId = $oScopeNode->getAttribute('id'); - if ($sScopeId === '') - { + if ($sScopeId === '') { throw new DOMFormatException('Scope tag must have an id attribute.', null, null, $oScopeNode); } @@ -486,8 +455,7 @@ EOF; // Retrieving the view query $oOqlViewNode = $oScopeNode->GetUniqueElement('oql_view'); $sOqlView = $oOqlViewNode->GetText(); - if ($sOqlView === null) - { + if ($sOqlView === null) { throw new DOMFormatException( 'Scope tag in class must have a not empty oql_view tag', 0, @@ -504,24 +472,18 @@ EOF; // Retrieving profiles for the scope $oProfilesNode = $oScopeNode->GetOptionalElement('allowed_profiles'); - $aProfilesNames = array(); + $aProfilesNames = []; // If no profile is specified, we consider that it's for ALL the profiles - if (($oProfilesNode === null) || ($oProfilesNode->GetNodes('./allowed_profile')->length === 0)) - { - foreach (ProfilesConfig::GetProfilesValues() as $iKey => $aValue) - { + if (($oProfilesNode === null) || ($oProfilesNode->GetNodes('./allowed_profile')->length === 0)) { + foreach (ProfilesConfig::GetProfilesValues() as $iKey => $aValue) { $aProfilesNames[] = $aValue['name']; } - } - else - { + } else { /** @var \Combodo\iTop\DesignElement $oProfileNode */ - foreach ($oProfilesNode->GetNodes('./allowed_profile') as $oProfileNode) - { + foreach ($oProfilesNode->GetNodes('./allowed_profile') as $oProfileNode) { // Retrieving mandatory profile id attribute $sProfileId = $oProfileNode->getAttribute('id'); - if ($sProfileId === '') - { + if ($sProfileId === '') { throw new DOMFormatException( 'Scope tag must have an id attribute.', null, @@ -534,8 +496,7 @@ EOF; } // - foreach ($aProfilesNames as $sProfileName) - { + foreach ($aProfilesNames as $sProfileName) { // Scope profile id $iProfileId = $this->GetProfileIdFromProfileName($sProfileName); @@ -545,48 +506,37 @@ EOF; $oViewFilter = DBSearch::FromOQL($sOqlView); // ... We have to union the query if this profile has another scope for that class if (array_key_exists($sMatrixPrefix.static::ENUM_MODE_READ, $aProfiles) && array_key_exists( - $sOqlViewType, - $aProfiles[$sMatrixPrefix.static::ENUM_MODE_READ] - )) - { + $sOqlViewType, + $aProfiles[$sMatrixPrefix.static::ENUM_MODE_READ] + )) { $oExistingFilter = DBSearch::FromOQL( $aProfiles[$sMatrixPrefix.static::ENUM_MODE_READ][$sOqlViewType] ); - $aFilters = array($oExistingFilter, $oViewFilter); + $aFilters = [$oExistingFilter, $oViewFilter]; $oResFilter = new DBUnionSearch($aFilters); // Applying ignore_silos flag on result filter if necessary (As the union will remove it if it is not on all sub-queries) - if ($aProfiles[$sMatrixPrefix.static::ENUM_MODE_READ]['ignore_silos'] === true) - { + if ($aProfiles[$sMatrixPrefix.static::ENUM_MODE_READ]['ignore_silos'] === true) { $bIgnoreSilos = true; } - } - else - { + } else { $oResFilter = $oViewFilter; } - $aProfiles[$sMatrixPrefix.static::ENUM_MODE_READ] = array( + $aProfiles[$sMatrixPrefix.static::ENUM_MODE_READ] = [ $sOqlViewType => $oResFilter->ToOQL(), 'ignore_silos' => $bIgnoreSilos, - ); + ]; // - Edit query - if ($sOqlEdit !== null) - { + if ($sOqlEdit !== null) { $oEditFilter = DBSearch::FromOQL($sOqlEdit); // - If the queries are the same, we don't make an intersect, we just reuse the view query - if ($sOqlEdit === $sOqlView) - { + if ($sOqlEdit === $sOqlView) { // Do not intersect, edit query is identical to view query - } - else - { - if (($oEditFilter->GetClass() === $oViewFilter->GetClass()) && $oEditFilter->IsAny()) - { + } else { + if (($oEditFilter->GetClass() === $oViewFilter->GetClass()) && $oEditFilter->IsAny()) { $oEditFilter = $oViewFilter; // Do not intersect, edit query is identical to view query - } - else - { + } else { // Intersect $oEditFilter = $oViewFilter->Intersect($oEditFilter); } @@ -594,27 +544,24 @@ EOF; // ... We have to union the query if this profile has another scope for that class if (array_key_exists( - $sMatrixPrefix.static::ENUM_MODE_WRITE, - $aProfiles - ) && array_key_exists( - $sOqlViewType, - $aProfiles[$sMatrixPrefix.static::ENUM_MODE_WRITE] - )) - { + $sMatrixPrefix.static::ENUM_MODE_WRITE, + $aProfiles + ) && array_key_exists( + $sOqlViewType, + $aProfiles[$sMatrixPrefix.static::ENUM_MODE_WRITE] + )) { $oExistingFilter = DBSearch::FromOQL( $aProfiles[$sMatrixPrefix.static::ENUM_MODE_WRITE][$sOqlViewType] ); - $aFilters = array($oExistingFilter, $oEditFilter); + $aFilters = [$oExistingFilter, $oEditFilter]; $oResFilter = new DBUnionSearch($aFilters); - } - else - { + } else { $oResFilter = $oEditFilter; } - $aProfiles[$sMatrixPrefix.static::ENUM_MODE_WRITE] = array( + $aProfiles[$sMatrixPrefix.static::ENUM_MODE_WRITE] = [ $sOqlViewType => $oResFilter->ToOQL(), 'ignore_silos' => $bIgnoreSilos, - ); + ]; } } } @@ -626,27 +573,19 @@ EOF; // Filling the array with missing classes from MetaModel, so we can have an inheritance principle on the scope // For each class explicitly given in the scopes, we check if its child classes were also in the scope : // If not, we add them with the same OQL - foreach ($aProfileClasses as $sProfileClass) - { - foreach (MetaModel::EnumChildClasses($sProfileClass) as $sChildClass) - { + foreach ($aProfileClasses as $sProfileClass) { + foreach (MetaModel::EnumChildClasses($sProfileClass) as $sChildClass) { // If the child class is not in the scope, we are going to try to add it - if (!in_array($sChildClass, $aProfileClasses)) - { - foreach (ProfilesConfig::GetProfilesValues() as $iKey => $aValue) - { + if (!in_array($sChildClass, $aProfileClasses)) { + foreach (ProfilesConfig::GetProfilesValues() as $iKey => $aValue) { $iProfileId = $iKey; - foreach (array(static::ENUM_MODE_READ, static::ENUM_MODE_WRITE) as $sAction) - { + foreach ([static::ENUM_MODE_READ, static::ENUM_MODE_WRITE] as $sAction) { // If the current profile has scope for that class in that mode, we duplicate it - if (isset($aProfiles[$iProfileId.'_'.$sProfileClass.'_'.$sAction])) - { + if (isset($aProfiles[$iProfileId.'_'.$sProfileClass.'_'.$sAction])) { $aTmpProfile = $aProfiles[$iProfileId.'_'.$sProfileClass.'_'.$sAction]; - foreach ($aTmpProfile as $sType => $sOql) - { + foreach ($aTmpProfile as $sType => $sOql) { // IF condition is just to skip the 'ignore_silos' flag - if (in_array($sType, array(static::ENUM_TYPE_ALLOW, static::ENUM_TYPE_RESTRICT))) - { + if (in_array($sType, [static::ENUM_TYPE_ALLOW, static::ENUM_TYPE_RESTRICT])) { $oTmpFilter = DBSearch::FromOQL($sOql); $oTmpFilter->ChangeClass($sChildClass); @@ -667,14 +606,12 @@ EOF; // - Write file on disk // - Creating dir if necessary - if (!is_dir($this->sCachePath)) - { + if (!is_dir($this->sCachePath)) { mkdir($this->sCachePath, 0777, true); } // -- Then creating the file $ret = file_put_contents($sFilePath, $sPHP); - if ($ret === false) - { + if ($ret === false) { $iLen = strlen($sPHP); $fFree = @disk_free_space(dirname($sFilePath)); $aErr = error_get_last(); @@ -685,4 +622,3 @@ EOF; } } - diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/SecurityHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/SecurityHelper.php index 1b95179d0..eb6796a80 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/SecurityHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/SecurityHelper.php @@ -43,10 +43,10 @@ use BinaryExpression; class SecurityHelper { /** @var array $aAllowedScopeObjectsCache */ - public static $aAllowedScopeObjectsCache = array( - UR_ACTION_READ => array(), - UR_ACTION_MODIFY => array(), - ); + public static $aAllowedScopeObjectsCache = [ + UR_ACTION_READ => [], + UR_ACTION_MODIFY => [], + ]; /** @var \Combodo\iTop\Portal\Helper\ScopeValidatorHelper $oScopeValidator */ private $oScopeValidator; @@ -69,7 +69,6 @@ class SecurityHelper $this->bDebug = $bDebug; } - /** * Returns true if the current user is allowed to do the $sAction on an $sObjectClass object (with optional $sObjectId id) * Checks are: @@ -94,45 +93,37 @@ class SecurityHelper $sDebugTracePrefix = __CLASS__.' / '.__METHOD__.' : Returned false for action '.$sAction.' on '.$sObjectClass.'::'.$sObjectId; // Checking action type - if (!in_array($sAction, array(UR_ACTION_READ, UR_ACTION_MODIFY, UR_ACTION_CREATE))) - { + if (!in_array($sAction, [UR_ACTION_READ, UR_ACTION_MODIFY, UR_ACTION_CREATE])) { IssueLog::Debug($sDebugTracePrefix.' as the action value could not be understood ('.UR_ACTION_READ.'/'.UR_ACTION_MODIFY.'/'.UR_ACTION_CREATE.' expected', LogChannels::PORTAL); return false; } // Forcing allowed writing on the object if necessary. This is used in some particular cases. $bObjectIsCurrentUser = ($sObjectClass === 'Person' && $sObjectId == UserRights::GetContactId()); - if(in_array($sAction , array(UR_ACTION_MODIFY, UR_ACTION_READ)) && $bObjectIsCurrentUser){ + if (in_array($sAction, [UR_ACTION_MODIFY, UR_ACTION_READ]) && $bObjectIsCurrentUser) { return true; - } + } // Checking the scopes layer // - Transforming scope action as there is only 2 values $sScopeAction = ($sAction === UR_ACTION_READ) ? UR_ACTION_READ : UR_ACTION_MODIFY; // - Retrieving the query. If user has no scope, it can't access that kind of objects $oScopeQuery = $this->oScopeValidator->GetScopeFilterForProfiles(UserRights::ListProfiles(), $sObjectClass, $sScopeAction); - if ($oScopeQuery === null) - { + if ($oScopeQuery === null) { IssueLog::Debug($sDebugTracePrefix.' as there was no scope defined for action '.$sScopeAction.' and profiles '.implode('/', UserRights::ListProfiles()), LogChannels::PORTAL); return false; } // - If action != create we do some additionnal checks - if ($sAction !== UR_ACTION_CREATE) - { + if ($sAction !== UR_ACTION_CREATE) { // - Checking specific object if id is specified - if ($sObjectId !== null) - { + if ($sObjectId !== null) { // Checking if object status is in cache (to avoid unnecessary query) - if (isset(static::$aAllowedScopeObjectsCache[$sScopeAction][$sObjectClass][$sObjectId])) - { - if (static::$aAllowedScopeObjectsCache[$sScopeAction][$sObjectClass][$sObjectId] === false) - { + if (isset(static::$aAllowedScopeObjectsCache[$sScopeAction][$sObjectClass][$sObjectId])) { + if (static::$aAllowedScopeObjectsCache[$sScopeAction][$sObjectClass][$sObjectId] === false) { IssueLog::Debug($sDebugTracePrefix.' as it was denied in the scope objects cache', LogChannels::PORTAL); return false; } - } - else - { + } else { // Modifying query to filter on the ID // - Adding expression $sObjectKeyAtt = MetaModel::DBGetKey($sObjectClass); @@ -147,8 +138,7 @@ class SecurityHelper // - Checking if query result is null (which means that the user has no right to view this specific object) $oSet = new DBObjectSet($oScopeQuery); - if ($oSet->Count() === 0) - { + if ($oSet->Count() === 0) { // Updating cache static::$aAllowedScopeObjectsCache[$sScopeAction][$sObjectClass][$sObjectId] = false; @@ -163,8 +153,7 @@ class SecurityHelper } // Checking reading security layer. The object could be listed, check if it is actually allowed to view it - if (UserRights::IsActionAllowed($sObjectClass, $sAction) == UR_ALLOWED_NO) - { + if (UserRights::IsActionAllowed($sObjectClass, $sAction) == UR_ALLOWED_NO) { // For security reasons, we don't want to give the user too many information on why he cannot access the object. //throw new SecurityException('User not allowed to view this object', array('class' => $sObjectClass, 'id' => $sObjectId)); IssueLog::Debug($sDebugTracePrefix.' as the user is not allowed to access this object according to the datamodel security (cf. Console settings)', LogChannels::PORTAL); @@ -187,15 +176,13 @@ class SecurityHelper // Checking DataModel layer $aStimuliFromDatamodel = Metamodel::EnumStimuli($sObjectClass); $iActionAllowed = (get_class($aStimuliFromDatamodel[$sStimulusCode]) == 'StimulusUserAction') ? UserRights::IsStimulusAllowed($sObjectClass, $sStimulusCode, $oInstanceSet) : UR_ALLOWED_NO; - if (($iActionAllowed === false) || ($iActionAllowed === UR_ALLOWED_NO)) - { + if (($iActionAllowed === false) || ($iActionAllowed === UR_ALLOWED_NO)) { return false; } // Checking portal security layer $aStimuliFromPortal = $this->oLifecycleValidator->GetStimuliForProfiles(UserRights::ListProfiles(), $sObjectClass); - if (!in_array($sStimulusCode, $aStimuliFromPortal)) - { + if (!in_array($sStimulusCode, $aStimuliFromPortal)) { return false; } @@ -217,20 +204,17 @@ class SecurityHelper public function PreloadForCache(DBSearch $oSearch, $aExtKeysToPreload = null) { $sObjectClass = $oSearch->GetClass(); - $aObjectIds = array(); - $aExtKeysIds = array(); - $aColumnsToLoad = array(); + $aObjectIds = []; + $aExtKeysIds = []; + $aColumnsToLoad = []; - if ($aExtKeysToPreload !== null) - { - foreach ($aExtKeysToPreload as $sAttCode) - { + if ($aExtKeysToPreload !== null) { + foreach ($aExtKeysToPreload as $sAttCode) { /** @var \AttributeDefinition $oAttDef */ $oAttDef = MetaModel::GetAttributeDef($sObjectClass, $sAttCode); - if ($oAttDef->IsExternalKey()) - { + if ($oAttDef->IsExternalKey()) { /** @var \AttributeExternalKey $oAttDef */ - $aExtKeysIds[$oAttDef->GetTargetClass()] = array(); + $aExtKeysIds[$oAttDef->GetTargetClass()] = []; $aColumnsToLoad[] = $sAttCode; } } @@ -239,69 +223,56 @@ class SecurityHelper // Retrieving IDs of all objects // Note: We have to clone $oSet otherwise the source object will be modified $oSet = new DBObjectSet($oSearch); - $oSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => $aColumnsToLoad)); - while ($oCurrentRow = $oSet->Fetch()) - { + $oSet->OptimizeColumnLoad([$oSearch->GetClassAlias() => $aColumnsToLoad]); + while ($oCurrentRow = $oSet->Fetch()) { // Note: By presetting value to false, it is quicker to find which objects where not returned by the scope query later $aObjectIds[$oCurrentRow->GetKey()] = false; // Preparing ExtKeys to preload - foreach ($aColumnsToLoad as $sAttCode) - { + foreach ($aColumnsToLoad as $sAttCode) { $iExtKey = $oCurrentRow->Get($sAttCode); - if ($iExtKey > 0) - { + if ($iExtKey > 0) { /** @var \AttributeExternalKey $oAttDef */ $oAttDef = MetaModel::GetAttributeDef($sObjectClass, $sAttCode); - if (!in_array($iExtKey, $aExtKeysIds[$oAttDef->GetTargetClass()])) - { + if (!in_array($iExtKey, $aExtKeysIds[$oAttDef->GetTargetClass()])) { $aExtKeysIds[$oAttDef->GetTargetClass()][] = $iExtKey; } } } } - foreach (array(UR_ACTION_READ, UR_ACTION_MODIFY) as $sScopeAction) - { + foreach ([UR_ACTION_READ, UR_ACTION_MODIFY] as $sScopeAction) { // Retrieving scope query /** @var DBSearch $oScopeQuery */ $oScopeQuery = $this->oScopeValidator->GetScopeFilterForProfiles(UserRights::ListProfiles(), $sObjectClass, $sScopeAction); - if ($oScopeQuery !== null) - { + if ($oScopeQuery !== null) { // Restricting scope if specified - if (!empty($aObjectIds)) - { + if (!empty($aObjectIds)) { $oScopeQuery->AddCondition('id', array_keys($aObjectIds), 'IN'); } // Preparing object set $oScopeSet = new DBObjectSet($oScopeQuery); - $oScopeSet->OptimizeColumnLoad(array($oScopeQuery->GetClassAlias() => array())); + $oScopeSet->OptimizeColumnLoad([$oScopeQuery->GetClassAlias() => []]); // Checking objects status $aScopeObjectIds = $aObjectIds; - while ($oCurrentRow = $oScopeSet->Fetch()) - { + while ($oCurrentRow = $oScopeSet->Fetch()) { $aScopeObjectIds[$oCurrentRow->GetKey()] = true; } // Updating cache - if (!isset(static::$aAllowedScopeObjectsCache[$sScopeAction][$sObjectClass])) - { + if (!isset(static::$aAllowedScopeObjectsCache[$sScopeAction][$sObjectClass])) { static::$aAllowedScopeObjectsCache[$sScopeAction][$sObjectClass] = $aScopeObjectIds; - } - else - { + } else { static::$aAllowedScopeObjectsCache[$sScopeAction][$sObjectClass] = array_merge_recursive(static::$aAllowedScopeObjectsCache[$sScopeAction][$sObjectClass], $aScopeObjectIds); } } } // Preloading ExtKeys - foreach ($aExtKeysIds as $sTargetClass => $aTargetIds) - { - if (!empty($aTargetIds)) - { + foreach ($aExtKeysIds as $sTargetClass => $aTargetIds) { + if (!empty($aTargetIds)) { $oTargetSearch = new DBObjectSearch($sTargetClass); $oTargetSearch->AddCondition('id', $aTargetIds, 'IN'); diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/SessionMessageHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/SessionMessageHelper.php index 379096238..583ce8b7e 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/SessionMessageHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/SessionMessageHelper.php @@ -1,4 +1,5 @@ scalar value * @param int $iRank */ - public function AddMessage($sId, $sContent, $sSeverity = self::DEFAULT_SEVERITY, $aMetadata = array(), $iRank = 1) + public function AddMessage($sId, $sContent, $sSeverity = self::DEFAULT_SEVERITY, $aMetadata = [], $iRank = 1) { $sKey = $this->GetMessagesKey(); - if(!Session::IsSet(['obj_messages', $sKey])) - { + if (!Session::IsSet(['obj_messages', $sKey])) { Session::Set(['obj_messages', $sKey], []); } @@ -115,7 +115,7 @@ class SessionMessageHelper implements IteratorAggregate */ private function GetMessagesKey() { - return 'GUI:' . $this->oContainer->getParameter('combodo.portal.instance.id'); + return 'GUI:'.$this->oContainer->getParameter('combodo.portal.instance.id'); } /** @@ -126,23 +126,18 @@ class SessionMessageHelper implements IteratorAggregate */ private function FetchMessages() { - if (!empty($this->aAllMessages)) - { + if (!empty($this->aAllMessages)) { return; } - $this->aAllMessages = array(); - if (is_array(Session::Get('obj_messages'))) - { - foreach (Session::Get('obj_messages') as $sMessageKey => $aMessageObjectData) - { - $aObjectMessages = array(); - $aRanks = array(); - foreach ($aMessageObjectData as $sMessageId => $aMessageData) - { + $this->aAllMessages = []; + if (is_array(Session::Get('obj_messages'))) { + foreach (Session::Get('obj_messages') as $sMessageKey => $aMessageObjectData) { + $aObjectMessages = []; + $aRanks = []; + foreach ($aMessageObjectData as $sMessageId => $aMessageData) { $sMsgClass = 'alert alert-dismissible alert-'; - switch ($aMessageData['severity']) - { + switch ($aMessageData['severity']) { case static::ENUM_SEVERITY_INFO: $sMsgClass .= 'info'; break; @@ -168,17 +163,16 @@ class SessionMessageHelper implements IteratorAggregate $sMsgMetadata .= 'data-'.str_replace('_', '-', $sMetadatumName).'="'.utils::HtmlEntities($sMetadatumValue).'" '; } } - $aObjectMessages[] = array('css_classes' => $sMsgClass, 'message' => $aMessageData['message'], 'metadata' => $sMsgMetadata); + $aObjectMessages[] = ['css_classes' => $sMsgClass, 'message' => $aMessageData['message'], 'metadata' => $sMsgMetadata]; $aRanks[] = $aMessageData['rank']; } Session::Unset(['obj_messages', $sMessageKey]); array_multisort($aRanks, $aObjectMessages); - foreach ($aObjectMessages as $aObjectMessage) - { + foreach ($aObjectMessages as $aObjectMessage) { $this->aAllMessages[] = $aObjectMessage; } } } } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Helper/UIExtensionsHelper.php b/datamodels/2.x/itop-portal-base/portal/src/Helper/UIExtensionsHelper.php index 0b2f6bc01..e18f090d3 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Helper/UIExtensionsHelper.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Helper/UIExtensionsHelper.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU Affero General Public License */ - namespace Combodo\iTop\Portal\Helper; - use InvalidParameterException; use iPortalUIExtension; use MetaModel; @@ -66,13 +64,11 @@ class UIExtensionsHelper */ public function __get($sPropName) { - if ($this->aUIExtensions === null) - { + if ($this->aUIExtensions === null) { $this->InitUIExtensions(); } - if (array_key_exists($sPropName, $this->aUIExtensions)) - { + if (array_key_exists($sPropName, $this->aUIExtensions)) { return $this->aUIExtensions[$sPropName]; } @@ -87,8 +83,7 @@ class UIExtensionsHelper */ public function __isset($sPropName) { - if ($this->aUIExtensions === null) - { + if ($this->aUIExtensions === null) { $this->InitUIExtensions(); } @@ -110,67 +105,63 @@ class UIExtensionsHelper */ protected function InitUIExtensions() { - $aUIExtensions = array( - 'css_files' => array(), + $aUIExtensions = [ + 'css_files' => [], 'css_inline' => null, - 'js_files' => array(), + 'js_files' => [], 'js_inline' => null, - 'html' => array(), - ); + 'html' => [], + ]; - $aUIExtensionHooks = array( + $aUIExtensionHooks = [ iPortalUIExtension::ENUM_PORTAL_EXT_UI_BODY, iPortalUIExtension::ENUM_PORTAL_EXT_UI_NAVIGATION_MENU, iPortalUIExtension::ENUM_PORTAL_EXT_UI_MAIN_CONTENT, - ); + ]; /** @var iPortalUIExtension $oExtensionInstance */ - foreach (MetaModel::EnumPlugins('iPortalUIExtension') as $oExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iPortalUIExtension') as $oExtensionInstance) { // Adding CSS files - $aImportPaths = array($_ENV['COMBODO_PORTAL_BASE_ABSOLUTE_PATH'].'css/'); - foreach ($oExtensionInstance->GetCSSFiles($this->oContainer) as $sCSSFile) - { + $aImportPaths = [$_ENV['COMBODO_PORTAL_BASE_ABSOLUTE_PATH'].'css/']; + foreach ($oExtensionInstance->GetCSSFiles($this->oContainer) as $sCSSFile) { // Removing app root url as we need to pass a path on the file system (relative to app root) $sCSSFilePath = str_replace(utils::GetAbsoluteUrlAppRoot(), '', $sCSSFile); // Compiling SCSS file - $sCSSFileCompiled = utils::GetAbsoluteUrlAppRoot().utils::GetCSSFromSASS($sCSSFilePath, - $aImportPaths); + $sCSSFileCompiled = utils::GetAbsoluteUrlAppRoot().utils::GetCSSFromSASS( + $sCSSFilePath, + $aImportPaths + ); - if (!in_array($sCSSFileCompiled, $aUIExtensions['css_files'])) - { + if (!in_array($sCSSFileCompiled, $aUIExtensions['css_files'])) { $aUIExtensions['css_files'][] = $sCSSFileCompiled; } } // Adding CSS inline $sCSSInline = $oExtensionInstance->GetCSSInline($this->oContainer); - if ($sCSSInline !== null) - { + if ($sCSSInline !== null) { $aUIExtensions['css_inline'] .= "\n\n".$sCSSInline; } // Adding JS files - $aUIExtensions['js_files'] = array_merge($aUIExtensions['js_files'], - $oExtensionInstance->GetJSFiles($this->oContainer)); + $aUIExtensions['js_files'] = array_merge( + $aUIExtensions['js_files'], + $oExtensionInstance->GetJSFiles($this->oContainer) + ); // Adding JS inline $sJSInline = $oExtensionInstance->GetJSInline($this->oContainer); - if ($sJSInline !== null) - { + if ($sJSInline !== null) { // Note: Semi-colon is to prevent previous script that would have omitted it. $aUIExtensions['js_inline'] .= "\n\n;\n".$sJSInline; } // Adding HTML for each hook - foreach ($aUIExtensionHooks as $sUIExtensionHook) - { + foreach ($aUIExtensionHooks as $sUIExtensionHook) { $sFunctionName = 'Get'.$sUIExtensionHook.'HTML'; $sHTML = $oExtensionInstance->$sFunctionName($this->oContainer); - if ($sHTML !== null) - { - if (!array_key_exists($sUIExtensionHook, $aUIExtensions['html'])) - { + if ($sHTML !== null) { + if (!array_key_exists($sUIExtensionHook, $aUIExtensions['html'])) { $aUIExtensions['html'][$sUIExtensionHook] = ''; } $aUIExtensions['html'][$sUIExtensionHook] .= "\n\n".$sHTML; @@ -180,4 +171,4 @@ class UIExtensionsHelper $this->aUIExtensions = $aUIExtensions; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Hook/iAbstractPortalTabContentExtension.php b/datamodels/2.x/itop-portal-base/portal/src/Hook/iAbstractPortalTabContentExtension.php index 8fa7027e1..003abecd0 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Hook/iAbstractPortalTabContentExtension.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Hook/iAbstractPortalTabContentExtension.php @@ -1,4 +1,5 @@ environment; + $logDir = $_ENV['PORTAL_ID'].'-'.$this->environment; - return utils::GetLogPath() . "/portals/$logDir"; - } + return utils::GetLogPath()."/portals/$logDir"; + } /** * @return \Generator|iterable|\Symfony\Component\HttpKernel\Bundle\BundleInterface[] */ public function registerBundles(): iterable { - $contents = require $this->getProjectDir().'/config/bundles.php'; - foreach ($contents as $class => $envs) { - if (isset($envs[$this->environment]) || isset($envs['all'])) { - yield new $class(); - } - } - } + $contents = require $this->getProjectDir().'/config/bundles.php'; + foreach ($contents as $class => $envs) { + if (isset($envs[$this->environment]) || isset($envs['all'])) { + yield new $class(); + } + } + } /** * @param \Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $container @@ -106,7 +107,6 @@ class Kernel extends BaseKernel $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS); } - /** * Checks if a given class name belongs to an active bundle. * diff --git a/datamodels/2.x/itop-portal-base/portal/src/Routing/ItopExtensionsExtraRoutes.php b/datamodels/2.x/itop-portal-base/portal/src/Routing/ItopExtensionsExtraRoutes.php index 9fec3aabc..721ca8445 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Routing/ItopExtensionsExtraRoutes.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Routing/ItopExtensionsExtraRoutes.php @@ -1,4 +1,5 @@ sInitialValue = $sPath; } @@ -89,7 +88,7 @@ class TemplateDefinitionDto */ public function GetPath(bool $bInitialValue = false): string { - if($bInitialValue){ + if ($bInitialValue) { return $this->sInitialValue !== null ? $this->sInitialValue : ''; } @@ -142,4 +141,4 @@ class TemplateDefinitionDto return $this->bIsOverridden; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Service/TemplatesProvider/TemplatesProviderInterface.php b/datamodels/2.x/itop-portal-base/portal/src/Service/TemplatesProvider/TemplatesProviderInterface.php index d0eb9f484..2be6372fc 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Service/TemplatesProvider/TemplatesProviderInterface.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Service/TemplatesProvider/TemplatesProviderInterface.php @@ -36,4 +36,4 @@ interface TemplatesProviderInterface * @return void */ public static function RegisterTemplates(TemplatesRegister $oTemplatesRegister): void; -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Service/TemplatesProvider/TemplatesProviderService.php b/datamodels/2.x/itop-portal-base/portal/src/Service/TemplatesProvider/TemplatesProviderService.php index b89baeac6..1949a8697 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Service/TemplatesProvider/TemplatesProviderService.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Service/TemplatesProvider/TemplatesProviderService.php @@ -275,8 +275,7 @@ class TemplatesProviderService if ($oParent) { $sCurrentClass = $oReflexion->getParentClass()->getName(); } - } - catch (Exception) { + } catch (Exception) { } } while ($oParent); // continue while parent class exists @@ -321,4 +320,4 @@ class TemplatesProviderService && array_key_exists($sTemplateId, $this->aInstancesOverriddenTemplatesPaths[$sObjectId]['templates'])); } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Service/TemplatesProvider/TemplatesRegister.php b/datamodels/2.x/itop-portal-base/portal/src/Service/TemplatesProvider/TemplatesRegister.php index 1f3787acb..7643aba54 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Service/TemplatesProvider/TemplatesRegister.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Service/TemplatesProvider/TemplatesRegister.php @@ -29,11 +29,9 @@ namespace Combodo\iTop\Portal\Service\TemplatesProvider; */ class TemplatesRegister { - /** @var array Templates definitions (possibly altered by portal configuration) */ private array $aTemplatesDefinitions = []; - public function __construct(private string $sTemplateUIVersion = 'unset') { @@ -118,7 +116,7 @@ class TemplatesRegister */ public function GetProviderTemplatesIds(string $sProviderId): array { - return array_map(fn($oTemplateDefinition) => $oTemplateDefinition->GetId(), $this->aTemplatesDefinitions[$sProviderId] ?? ['tile', 'page']); + return array_map(fn ($oTemplateDefinition) => $oTemplateDefinition->GetId(), $this->aTemplatesDefinitions[$sProviderId] ?? ['tile', 'page']); } /** @@ -130,4 +128,4 @@ class TemplatesRegister { return $this->aTemplatesDefinitions; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php b/datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php index 696cf68db..9cbed990c 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php @@ -1,4 +1,5 @@ userProvider->getAllowedPortals(); return $data; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Twig/AppVariable.php b/datamodels/2.x/itop-portal-base/portal/src/Twig/AppVariable.php index de0751e38..b6081d0dc 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Twig/AppVariable.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Twig/AppVariable.php @@ -1,4 +1,5 @@ decorated = $decorated; + $this->container = $container; + } - public function __construct(DecoratedAppVariable $decorated, ContainerInterface $container = null) - { - $this->decorated = $decorated; - $this->container = $container; - } + public function __call($name, $arguments) + { + if ($this->silexApplicationEmulation->offsetExists($name)) { + return $this->silexApplicationEmulation->offsetGet($name); + } - public function __call($name, $arguments) - { - if ($this->silexApplicationEmulation->offsetExists($name)) { - return $this->silexApplicationEmulation->offsetGet($name); - } + return $this->decorated->$name(...$arguments); //WARNING: use of http://php.net/manual/fr/functions.arguments.php#functions.variable-arg-list + } - return $this->decorated->$name(...$arguments); //WARNING: use of http://php.net/manual/fr/functions.arguments.php#functions.variable-arg-list - } + /** + * @inheritDoc + */ + public function offsetExists($offset): bool + { + if ($this->container->hasParameter($offset)) { + return true; + } + if ($this->container->has($offset)) { + return true; + } - /** - * @inheritDoc - */ - public function offsetExists($offset): bool - { - if ($this->container->hasParameter($offset)) { - return true; - } - if ($this->container->has($offset)) { - return true; - } + return false; + } - return false; - } - - /** - * @inheritDoc - */ + /** + * @inheritDoc + */ #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - if ($this->container->hasParameter($offset)) { - return $this->container->getParameter($offset); - } - if ($this->container->has($offset)) { - return $this->container->get($offset); - } + public function offsetGet($offset) + { + if ($this->container->hasParameter($offset)) { + return $this->container->getParameter($offset); + } + if ($this->container->has($offset)) { + return $this->container->get($offset); + } - return null; - } + return null; + } - /** - * @inheritDoc - */ - public function offsetSet($offset, $value): void - { + /** + * @inheritDoc + */ + public function offsetSet($offset, $value): void + { - if ($this->container->hasParameter($offset)) { - $this->container->setParameter($offset, $value); - return; - } + if ($this->container->hasParameter($offset)) { + $this->container->setParameter($offset, $value); + return; + } - if ($this->container->has($offset)) { - $this->container->set($offset, $value); - return; - } + if ($this->container->has($offset)) { + $this->container->set($offset, $value); + return; + } - if (is_object($value)) { - $this->container->set($offset, $value); - return; - } + if (is_object($value)) { + $this->container->set($offset, $value); + return; + } - $this->container->setParameter($offset, $value); - } + $this->container->setParameter($offset, $value); + } - /** - * @inheritDoc - */ - public function offsetUnset($offset): void - { - if ($this->container->hasParameter($offset)) { - $this->container->setParameter($offset, null); - } else if ($this->container->has($offset)) { - $this->container->set($offset, null); - } - } + /** + * @inheritDoc + */ + public function offsetUnset($offset): void + { + if ($this->container->hasParameter($offset)) { + $this->container->setParameter($offset, null); + } elseif ($this->container->has($offset)) { + $this->container->set($offset, null); + } + } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Twig/CKEditorExtension.php b/datamodels/2.x/itop-portal-base/portal/src/Twig/CKEditorExtension.php index f141d3c5d..117e5dbfc 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Twig/CKEditorExtension.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Twig/CKEditorExtension.php @@ -1,4 +1,5 @@ '; + $sScriptTemplate .= ''; } return $sScriptTemplate; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Twig/CurrentUserAccessor.php b/datamodels/2.x/itop-portal-base/portal/src/Twig/CurrentUserAccessor.php index e75c7f919..cea50f474 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Twig/CurrentUserAccessor.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Twig/CurrentUserAccessor.php @@ -1,4 +1,5 @@ userProvider->getCurrentUserCanLogOff(); } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Twig/PortalBlockExtension.php b/datamodels/2.x/itop-portal-base/portal/src/Twig/PortalBlockExtension.php index 1868287e7..b7b62a7bc 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Twig/PortalBlockExtension.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Twig/PortalBlockExtension.php @@ -1,4 +1,5 @@ sTwig = $sTwig; $this->aData = $aData; diff --git a/datamodels/2.x/itop-portal-base/portal/src/Twig/PortalTwigContext.php b/datamodels/2.x/itop-portal-base/portal/src/Twig/PortalTwigContext.php index 978a12166..cc69f5bac 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Twig/PortalTwigContext.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Twig/PortalTwigContext.php @@ -1,4 +1,5 @@ aBlockExtension[$sBlockName] = $oBlockExtension; } @@ -58,4 +58,4 @@ class PortalTwigContext $oBlockExtension = $this->aBlockExtension[$sBlockName] ?? null; return $oBlockExtension; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/Twig/TemplatesTwigExtension.php b/datamodels/2.x/itop-portal-base/portal/src/Twig/TemplatesTwigExtension.php index f7ac030f8..c59f439c3 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Twig/TemplatesTwigExtension.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Twig/TemplatesTwigExtension.php @@ -1,4 +1,5 @@ oTemplatesService->GetTemplatePath($sProviderClass, $sId, true); } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/UrlMaker/AbstractPortalUrlMaker.php b/datamodels/2.x/itop-portal-base/portal/src/UrlMaker/AbstractPortalUrlMaker.php index f0e7cf67c..2ea220f83 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/UrlMaker/AbstractPortalUrlMaker.php +++ b/datamodels/2.x/itop-portal-base/portal/src/UrlMaker/AbstractPortalUrlMaker.php @@ -37,10 +37,10 @@ use utils; abstract class AbstractPortalUrlMaker implements iDBObjectURLMaker { /** @var string PORTAL_ID */ - const PORTAL_ID = ''; + public const PORTAL_ID = ''; /** @var \Combodo\iTop\Portal\Kernel[] $aKernels */ - private static $aKernels = array(); + private static $aKernels = []; /** * Generate an (absolute) URL to an object, either in view or edit mode. @@ -64,8 +64,7 @@ abstract class AbstractPortalUrlMaker implements iDBObjectURLMaker $sUrl = self::DoPrepareObjectURL($sClass, $iId, $sMode); - if (!empty($sPreviousPortalId)) - { + if (!empty($sPreviousPortalId)) { $_ENV['PORTAL_ID'] = $sPreviousPortalId; } @@ -97,48 +96,39 @@ abstract class AbstractPortalUrlMaker implements iDBObjectURLMaker // // Note: Scopes only apply when URL check is triggered from the portal GUI. $sObjectQueryString = null; - switch ($sMode) - { + switch ($sMode) { case 'view': - if (!ContextTag::Check(ContextTag::TAG_PORTAL) || $oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sClass, $iId)) - { - $sObjectQueryString = $oUrlGenerator->generate('p_object_view', array('sObjectClass' => $sClass, 'sObjectId' => $iId)); + if (!ContextTag::Check(ContextTag::TAG_PORTAL) || $oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sClass, $iId)) { + $sObjectQueryString = $oUrlGenerator->generate('p_object_view', ['sObjectClass' => $sClass, 'sObjectId' => $iId]); } break; case 'edit': default: // Checking if user is allowed to edit object, if not we check if it can at least view it. - if (!ContextTag::Check(ContextTag::TAG_PORTAL) || $oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sClass, $iId)) - { - $sObjectQueryString = $oUrlGenerator->generate('p_object_edit', array('sObjectClass' => $sClass, 'sObjectId' => $iId)); - } - elseif (!ContextTag::Check(ContextTag::TAG_PORTAL) || $oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sClass, $iId)) - { - $sObjectQueryString = $oUrlGenerator->generate('p_object_view', array('sObjectClass' => $sClass, 'sObjectId' => $iId)); + if (!ContextTag::Check(ContextTag::TAG_PORTAL) || $oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sClass, $iId)) { + $sObjectQueryString = $oUrlGenerator->generate('p_object_edit', ['sObjectClass' => $sClass, 'sObjectId' => $iId]); + } elseif (!ContextTag::Check(ContextTag::TAG_PORTAL) || $oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sClass, $iId)) { + $sObjectQueryString = $oUrlGenerator->generate('p_object_view', ['sObjectClass' => $sClass, 'sObjectId' => $iId]); } break; } - $sPortalAbsoluteUrl = utils::GetAbsoluteUrlModulePage('itop-portal-base', 'index.php', array('portal_id' => $sPortalId)); - if ($sObjectQueryString === null) - { + $sPortalAbsoluteUrl = utils::GetAbsoluteUrlModulePage('itop-portal-base', 'index.php', ['portal_id' => $sPortalId]); + if ($sObjectQueryString === null) { $sUrl = null; - } - elseif (strpos($sPortalAbsoluteUrl, '?') !== false) - { + } elseif (strpos($sPortalAbsoluteUrl, '?') !== false) { // Removing generated url query parameters so it can be replaced with those from the absolute url // Mostly necessary when iTop instance has multiple portals - if (strpos($sObjectQueryString, '?') !== false) - { + if (strpos($sObjectQueryString, '?') !== false) { $sObjectQueryString = substr($sObjectQueryString, 0, strpos($sObjectQueryString, '?')); } - $sUrl = substr($sPortalAbsoluteUrl, 0, strpos($sPortalAbsoluteUrl, '?')).$sObjectQueryString.substr($sPortalAbsoluteUrl, - strpos($sPortalAbsoluteUrl, '?')); - } - else - { + $sUrl = substr($sPortalAbsoluteUrl, 0, strpos($sPortalAbsoluteUrl, '?')).$sObjectQueryString.substr( + $sPortalAbsoluteUrl, + strpos($sPortalAbsoluteUrl, '?') + ); + } else { $sUrl = $sPortalAbsoluteUrl.$sObjectQueryString; } @@ -153,8 +143,7 @@ abstract class AbstractPortalUrlMaker implements iDBObjectURLMaker */ private static function GetKernelInstance() { - if (!array_key_exists(static::PORTAL_ID, self::$aKernels)) - { + if (!array_key_exists(static::PORTAL_ID, self::$aKernels)) { self::$aKernels[static::PORTAL_ID] = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']); self::$aKernels[static::PORTAL_ID]->boot(); } @@ -175,4 +164,3 @@ abstract class AbstractPortalUrlMaker implements iDBObjectURLMaker return static::PrepareObjectURL($sClass, $iId, 'edit'); } } - diff --git a/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/AbstractStringVariableAccessor.php b/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/AbstractStringVariableAccessor.php index f4435a842..a843f00b0 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/AbstractStringVariableAccessor.php +++ b/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/AbstractStringVariableAccessor.php @@ -1,4 +1,5 @@ getVariable(); } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/AbstractVariableAccessor.php b/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/AbstractVariableAccessor.php index 25033e518..065db068a 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/AbstractVariableAccessor.php +++ b/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/AbstractVariableAccessor.php @@ -1,4 +1,5 @@ storedVariable = $variableToStore; - } + /** + * @param string $variableToStore + */ + public function __construct($variableToStore) + { + $this->storedVariable = $variableToStore; + } /** * @return string */ - public function getVariable() - { - return $this->storedVariable; - } -} \ No newline at end of file + public function getVariable() + { + return $this->storedVariable; + } +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/CombodoCurrentContactPhotoUrl.php b/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/CombodoCurrentContactPhotoUrl.php index a17c10ea3..bda2d113f 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/CombodoCurrentContactPhotoUrl.php +++ b/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/CombodoCurrentContactPhotoUrl.php @@ -1,4 +1,5 @@ oUserProvider->getCurrentUser(); $oAllowedOrgSet = $oUser->Get('allowed_org_list'); if ($oAllowedOrgSet->Count() > 0) { @@ -118,4 +117,4 @@ class CombodoCurrentContactPhotoUrl return $sContactPhotoUrl; } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/CombodoPortalInstanceConf.php b/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/CombodoPortalInstanceConf.php index 98051c9cd..c47290f81 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/CombodoPortalInstanceConf.php +++ b/datamodels/2.x/itop-portal-base/portal/src/VariableAccessor/CombodoPortalInstanceConf.php @@ -1,4 +1,5 @@ * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'portal:itop-portal' => 'Standardní portál', 'Page:DefaultTitle' => '%1$s - Uživatelský portál', 'Brick:Portal:UserProfile:Title' => 'Můj profil', @@ -26,4 +27,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Brick:Portal:ListAllRequests:Tab' => 'Probíhající a uzavřené', 'Brick:Portal:SearchInAllRequests:Title' => 'Vyhledávání ve všech požadavcích', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Bez ohledu na jejich stav.

          ', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/da.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/da.dict.itop-portal.php index 501245a56..256c63184 100644 --- a/datamodels/2.x/itop-portal/dictionaries/da.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/da.dict.itop-portal.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'portal:itop-portal' => 'Standard portal~~', 'Page:DefaultTitle' => '%1$s - User portal~~', 'Brick:Portal:UserProfile:Title' => 'My profile~~', @@ -26,4 +27,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Brick:Portal:ListAllRequests:Tab' => 'On-going and closed~~', 'Brick:Portal:SearchInAllRequests:Title' => 'Search in all requests~~', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Regardless of their status.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/de.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/de.dict.itop-portal.php index d724506e4..698c57945 100644 --- a/datamodels/2.x/itop-portal/dictionaries/de.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/de.dict.itop-portal.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'portal:itop-portal' => 'Standard Portal', 'Page:DefaultTitle' => '%1$s - Benutzer Portal', 'Brick:Portal:UserProfile:Title' => 'Mein Profile', @@ -26,4 +27,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Brick:Portal:ListAllRequests:Tab' => 'Laufend und abgeschlossen', 'Brick:Portal:SearchInAllRequests:Title' => 'In allen Anfragen suchen', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Unabhängig von ihrem Status.

          ', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/en.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/en.dict.itop-portal.php index 2807892c5..2397a146a 100644 --- a/datamodels/2.x/itop-portal/dictionaries/en.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/en.dict.itop-portal.php @@ -1,4 +1,5 @@ 'Standard portal', // This is the portal name that will be displayed in portal dispatcher (eg. URL in menus) 'Page:DefaultTitle' => '%1$s - User portal', 'Brick:Portal:UserProfile:Title' => 'My profile', @@ -45,4 +46,4 @@ Dict::Add('EN US', 'English', 'English', array( 'Brick:Portal:ListAllRequests:Tab' => 'On-going and closed', 'Brick:Portal:SearchInAllRequests:Title' => 'Search in all requests', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Regardless of their status.

          ', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/en_gb.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/en_gb.dict.itop-portal.php index 283338f2b..79f8d9b6a 100644 --- a/datamodels/2.x/itop-portal/dictionaries/en_gb.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/en_gb.dict.itop-portal.php @@ -1,4 +1,5 @@ 'Standard portal', 'Page:DefaultTitle' => '%1$s - User portal', 'Brick:Portal:UserProfile:Title' => 'My profile', @@ -45,4 +46,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Brick:Portal:ListAllRequests:Tab' => 'On-going and closed', 'Brick:Portal:SearchInAllRequests:Title' => 'Search in all requests', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Regardless of their status.

          ', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/es_cr.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/es_cr.dict.itop-portal.php index 0b45ec818..b992276ea 100644 --- a/datamodels/2.x/itop-portal/dictionaries/es_cr.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/es_cr.dict.itop-portal.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'portal:itop-portal' => 'Portal de Usuario', 'Page:DefaultTitle' => 'ITop - Portal de Usuario', 'Brick:Portal:UserProfile:Title' => 'Mi perfil', @@ -23,4 +24,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Brick:Portal:ListAllRequests:Tab' => 'En proceso y cerrados', 'Brick:Portal:SearchInAllRequests:Title' => 'Buscar en todos los requerimientos', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Sin importar su estatus.

          ', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/fr.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/fr.dict.itop-portal.php index 2d1693809..848b8dca1 100644 --- a/datamodels/2.x/itop-portal/dictionaries/fr.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/fr.dict.itop-portal.php @@ -1,16 +1,17 @@ * */ -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'portal:itop-portal' => 'Portail standard', 'Page:DefaultTitle' => '%1$s - Portail utilisateur', 'Brick:Portal:UserProfile:Title' => 'Mon profil', @@ -26,4 +27,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Brick:Portal:ListAllRequests:Tab' => 'En cours et fermées', 'Brick:Portal:SearchInAllRequests:Title' => 'Rechercher une demande', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Quelque soit son état

          ', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/hu.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/hu.dict.itop-portal.php index af29c95db..e2833fb14 100644 --- a/datamodels/2.x/itop-portal/dictionaries/hu.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/hu.dict.itop-portal.php @@ -1,16 +1,17 @@ * */ -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'portal:itop-portal' => 'Standard portál', 'Page:DefaultTitle' => '%1$s - Felhasználói portál', 'Brick:Portal:UserProfile:Title' => 'Saját profil', @@ -26,4 +27,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Brick:Portal:ListAllRequests:Tab' => 'On-going and closed~~', 'Brick:Portal:SearchInAllRequests:Title' => 'Search in all requests~~', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Regardless of their status.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/it.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/it.dict.itop-portal.php index 1c1e9a80e..b29d207bb 100644 --- a/datamodels/2.x/itop-portal/dictionaries/it.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/it.dict.itop-portal.php @@ -1,16 +1,17 @@ * */ -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'portal:itop-portal' => 'Portale Standard', 'Page:DefaultTitle' => '%1$s - Portale Utente', 'Brick:Portal:UserProfile:Title' => 'Il Mio Profilo', @@ -26,4 +27,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Brick:Portal:ListAllRequests:Tab' => 'On-going and closed~~', 'Brick:Portal:SearchInAllRequests:Title' => 'Search in all requests~~', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Regardless of their status.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/ja.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/ja.dict.itop-portal.php index 85a649656..fba1aa724 100644 --- a/datamodels/2.x/itop-portal/dictionaries/ja.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/ja.dict.itop-portal.php @@ -1,16 +1,17 @@ * */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'portal:itop-portal' => 'Standard portal~~', 'Page:DefaultTitle' => '%1$s - User portal~~', 'Brick:Portal:UserProfile:Title' => 'My profile~~', @@ -26,4 +27,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Brick:Portal:ListAllRequests:Tab' => 'On-going and closed~~', 'Brick:Portal:SearchInAllRequests:Title' => 'Search in all requests~~', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Regardless of their status.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/nl.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/nl.dict.itop-portal.php index 9503706fe..513f4e877 100644 --- a/datamodels/2.x/itop-portal/dictionaries/nl.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/nl.dict.itop-portal.php @@ -1,16 +1,17 @@ * @author Thomas Casteleyn */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'portal:itop-portal' => 'Standaard portaal', 'Page:DefaultTitle' => '%1$s - Gebruikersportaal', 'Brick:Portal:UserProfile:Title' => 'Mijn profiel', @@ -26,4 +27,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Brick:Portal:ListAllRequests:Tab' => 'Openstaand en gesloten', 'Brick:Portal:SearchInAllRequests:Title' => 'Zoek in alle verzoeken', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Ongeacht hun status.

          ', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/pl.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/pl.dict.itop-portal.php index b48eb098e..c3ff2500f 100644 --- a/datamodels/2.x/itop-portal/dictionaries/pl.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/pl.dict.itop-portal.php @@ -1,16 +1,17 @@ * */ -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'portal:itop-portal' => 'Portal standardowy', 'Page:DefaultTitle' => '%1$s portal użytkownika', 'Brick:Portal:UserProfile:Title' => 'Mój profil', @@ -26,4 +27,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Brick:Portal:ListAllRequests:Tab' => 'Otwarte i zamknięte', 'Brick:Portal:SearchInAllRequests:Title' => 'Szukaj we wszystkich wnioskach', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Niezależnie od ich statusu.

          ', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/pt_br.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/pt_br.dict.itop-portal.php index f211b3a74..d80b0c2f6 100644 --- a/datamodels/2.x/itop-portal/dictionaries/pt_br.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/pt_br.dict.itop-portal.php @@ -1,16 +1,17 @@ * */ -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'portal:itop-portal' => 'Portal do Usuário', 'Page:DefaultTitle' => ITOP_APPLICATION_SHORT.' - Portal do Usuário', 'Brick:Portal:UserProfile:Title' => 'Meu perfil', @@ -26,4 +27,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Brick:Portal:ListAllRequests:Tab' => 'On-going and closed~~', 'Brick:Portal:SearchInAllRequests:Title' => 'Search in all requests~~', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Regardless of their status.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/ru.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/ru.dict.itop-portal.php index b2795e34d..cd3a33af2 100644 --- a/datamodels/2.x/itop-portal/dictionaries/ru.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/ru.dict.itop-portal.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'portal:itop-portal' => 'Пользовательский портал', 'Page:DefaultTitle' => '%1$s - Пользовательский портал', 'Brick:Portal:UserProfile:Title' => 'Мой профиль', @@ -26,4 +27,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Brick:Portal:ListAllRequests:Tab' => 'On-going and closed~~', 'Brick:Portal:SearchInAllRequests:Title' => 'Search in all requests~~', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Regardless of their status.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/sk.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/sk.dict.itop-portal.php index 2e0c7079c..826feccd0 100644 --- a/datamodels/2.x/itop-portal/dictionaries/sk.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/sk.dict.itop-portal.php @@ -1,16 +1,17 @@ * */ -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'portal:itop-portal' => 'Standard portal~~', 'Page:DefaultTitle' => '%1$s - User portal~~', 'Brick:Portal:UserProfile:Title' => 'My profile~~', @@ -26,4 +27,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Brick:Portal:ListAllRequests:Tab' => 'On-going and closed~~', 'Brick:Portal:SearchInAllRequests:Title' => 'Search in all requests~~', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Regardless of their status.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/tr.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/tr.dict.itop-portal.php index ffd723728..7fcf39408 100644 --- a/datamodels/2.x/itop-portal/dictionaries/tr.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/tr.dict.itop-portal.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'portal:itop-portal' => 'Standard portal~~', 'Page:DefaultTitle' => '%1$s - User portal~~', 'Brick:Portal:UserProfile:Title' => 'My profile~~', @@ -26,4 +27,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Brick:Portal:ListAllRequests:Tab' => 'On-going and closed~~', 'Brick:Portal:SearchInAllRequests:Title' => 'Search in all requests~~', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Regardless of their status.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-portal/dictionaries/zh_cn.dict.itop-portal.php b/datamodels/2.x/itop-portal/dictionaries/zh_cn.dict.itop-portal.php index 56bc72e04..dd0993287 100644 --- a/datamodels/2.x/itop-portal/dictionaries/zh_cn.dict.itop-portal.php +++ b/datamodels/2.x/itop-portal/dictionaries/zh_cn.dict.itop-portal.php @@ -1,4 +1,5 @@ '标准门户', // This is the portal name that will be displayed in portal dispatcher (eg. URL in menus) 'Page:DefaultTitle' => '%1$s - 用户门户', 'Brick:Portal:UserProfile:Title' => '我的设置', @@ -43,4 +44,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Brick:Portal:ListAllRequests:Tab' => 'On-going and closed~~', 'Brick:Portal:SearchInAllRequests:Title' => 'Search in all requests~~', 'Brick:Portal:SearchInAllRequests:Title+' => '

          Regardless of their status.

          ~~', -)); +]); diff --git a/datamodels/2.x/itop-portal/index.php b/datamodels/2.x/itop-portal/index.php index 6595a0a61..5a62e455a 100644 --- a/datamodels/2.x/itop-portal/index.php +++ b/datamodels/2.x/itop-portal/index.php @@ -38,19 +38,15 @@ ); // Load current environment -if (file_exists(__DIR__.'/../../approot.inc.php')) -{ +if (file_exists(__DIR__.'/../../approot.inc.php')) { require_once __DIR__.'/../../approot.inc.php'; // When in env-xxxx folder -} -else -{ +} else { require_once __DIR__.'/../../../approot.inc.php'; // When in datamodels/x.x folder } require_once APPROOT.'application/startup.inc.php'; // Protection against setup in the following configuration : ITIL Ticket with Enhanced Portal selected but neither UserRequest or Incident. Which would crash the portal. -if (!class_exists('UserRequest') && !class_exists('Incident')) -{ +if (!class_exists('UserRequest') && !class_exists('Incident')) { die('iTop has neither been installed with User Request nor Incident tickets. Please contact your administrator.'); } diff --git a/datamodels/2.x/itop-portal/main.itop-portal.php b/datamodels/2.x/itop-portal/main.itop-portal.php index 5af0633b5..bff3f70b4 100644 --- a/datamodels/2.x/itop-portal/main.itop-portal.php +++ b/datamodels/2.x/itop-portal/main.itop-portal.php @@ -1,4 +1,5 @@ 'Enhanced Customer Portal', 'category' => 'Portal', // Setup - 'dependencies' => array( - 'itop-portal-base/2.7.0' - ), + 'dependencies' => [ + 'itop-portal-base/2.7.0', + ], 'mandatory' => false, 'visible' => true, // Components - 'datamodel' => array( + 'datamodel' => [ 'main.itop-portal.php', - ), - 'webservice' => array( + ], + 'webservice' => [ //'webservices.itop-portal.php', - ), + ], - 'data.struct' => array( + 'data.struct' => [ //'data.struct.itop-portal.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.itop-portal.xml', - ), + ], // Documentation 'doc.manual_setup' => '', 'doc.more_information' => '', // Default settings - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/cs.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/cs.dict.itop-problem-mgmt.php index 84b51a46b..c762bcf3f 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/cs.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/cs.dict.itop-problem-mgmt.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:ProblemManagement' => 'Správa problémů', 'Menu:ProblemManagement+' => 'Správa problémů', 'Menu:Problem:Overview' => 'Přehled', @@ -34,12 +35,12 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Dashboard pro správu problémů (Problem management)', 'UI:ProblemMgmtMenuOverview:Title+' => 'Dashboard pro správu problémů (Problem management)', -)); +]); // // Class: Problem // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Problem' => 'Problém', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Stav', @@ -112,4 +113,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Uzavřít', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/da.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/da.dict.itop-problem-mgmt.php index 8ac4f3a52..271e3dcdd 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/da.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/da.dict.itop-problem-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:ProblemManagement' => 'Problem Management', 'Menu:ProblemManagement+' => 'Problem Management', 'Menu:Problem:Overview' => 'Oversigt', @@ -33,12 +34,12 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Dashboard for problem Management', 'UI:ProblemMgmtMenuOverview:Title+' => 'Dashboard for problem Management', -)); +]); // // Class: Problem // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Problem' => 'Problem', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Status', @@ -111,4 +112,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Luk', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/de.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/de.dict.itop-problem-mgmt.php index dd20d68e6..5138bd64b 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/de.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/de.dict.itop-problem-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:ProblemManagement' => 'Problem Management', 'Menu:ProblemManagement+' => '', 'Menu:Problem:Overview' => 'Übersicht', @@ -33,12 +34,12 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Dashboard für das Problem Management', 'UI:ProblemMgmtMenuOverview:Title+' => 'Dashboard für das Problem Management', -)); +]); // // Class: Problem // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Problem' => 'Problem', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Status', @@ -111,4 +112,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Schließen', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/en.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/en.dict.itop-problem-mgmt.php index 8a902de2f..ddc242392 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/en.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/en.dict.itop-problem-mgmt.php @@ -1,4 +1,5 @@ /Stimulus: // Class:/Stimulus:+ - -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Menu:ProblemManagement' => 'Problem management', 'Menu:ProblemManagement+' => 'Problem management', 'Menu:Problem:Overview' => 'Overview', @@ -70,12 +70,12 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Dashboard for Problem Management', 'UI:ProblemMgmtMenuOverview:Title+' => 'Dashboard for Problem Management', -)); +]); // // Class: Problem // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Problem' => 'Problem', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Status', @@ -148,4 +148,4 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Close', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/en_gb.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/en_gb.dict.itop-problem-mgmt.php index 0e8c5069c..fb3a7b9cf 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/en_gb.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/en_gb.dict.itop-problem-mgmt.php @@ -1,4 +1,5 @@ /Stimulus: // Class:/Stimulus:+ - -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Menu:ProblemManagement' => 'Problem management', 'Menu:ProblemManagement+' => 'Problem management', 'Menu:Problem:Overview' => 'Overview', @@ -70,12 +70,12 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Dashboard for Problem Management', 'UI:ProblemMgmtMenuOverview:Title+' => 'Dashboard for Problem Management', -)); +]); // // Class: Problem // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Problem' => 'Problem', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Status', @@ -148,4 +148,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Close', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/es_cr.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/es_cr.dict.itop-problem-mgmt.php index 5b4317da7..a8f27c2a5 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/es_cr.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/es_cr.dict.itop-problem-mgmt.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:ProblemManagement' => 'Administración de Problemas', 'Menu:ProblemManagement+' => 'Administración de Problemas', 'Menu:Problem:Overview' => 'Resumen de problemas', @@ -30,12 +31,12 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Panel de Control de Administración de Problemas', 'UI:ProblemMgmtMenuOverview:Title+' => 'Panel de Control de Administración de Problemas', -)); +]); // // Class: Problem // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Problem' => 'Problema', 'Class:Problem+' => 'Problema', 'Class:Problem/Attribute:status' => 'Estatus', @@ -108,4 +109,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Problem/Stimulus:ev_resolve+' => 'Solucionar', 'Class:Problem/Stimulus:ev_close' => 'Cerrar', 'Class:Problem/Stimulus:ev_close+' => 'Cerrar', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/fr.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/fr.dict.itop-problem-mgmt.php index 4344e51f6..e8b8e041f 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/fr.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/fr.dict.itop-problem-mgmt.php @@ -1,15 +1,16 @@ 'Gestion des problèmes', 'Menu:ProblemManagement+' => '', 'Menu:Problem:Overview' => 'Vue d\'ensemble', @@ -32,12 +33,12 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Tableau de bord de la Gestion des Problèmes', 'UI:ProblemMgmtMenuOverview:Title+' => 'Tableau de bord de la Gestion des Problèmes', -)); +]); // // Class: Problem // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Problem' => 'Problème', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Etat', @@ -127,5 +128,5 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Problem/Stimulus:ev_resolve' => 'Résoudre', 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Fermer', - 'Class:Problem/Stimulus:ev_close+' => '' -)); + 'Class:Problem/Stimulus:ev_close+' => '', +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/hu.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/hu.dict.itop-problem-mgmt.php index 0d8f17c2e..977c4e975 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/hu.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/hu.dict.itop-problem-mgmt.php @@ -1,15 +1,16 @@ 'Problémakezelés', 'Menu:ProblemManagement+' => '', 'Menu:Problem:Overview' => 'Áttekintő', @@ -32,12 +33,12 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Problémakezelés műszerfal', 'UI:ProblemMgmtMenuOverview:Title+' => '', -)); +]); // // Class: Problem // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Problem' => 'Probléma', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Állapot', @@ -110,4 +111,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Lezárás', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/it.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/it.dict.itop-problem-mgmt.php index 74568193a..bb63ae029 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/it.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/it.dict.itop-problem-mgmt.php @@ -1,15 +1,16 @@ 'Gestione dei Problemi', 'Menu:ProblemManagement+' => 'Gestione dei Problemi', 'Menu:Problem:Overview' => 'Panoramica', @@ -32,12 +33,12 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Dashboard per la gestione dei problemi', 'UI:ProblemMgmtMenuOverview:Title+' => 'Dashboard per la gestione dei problemi', -)); +]); // // Class: Problem // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Problem' => 'Problema', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Stato', @@ -110,4 +111,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Chiudere', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/ja.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/ja.dict.itop-problem-mgmt.php index 77b6ddd36..d5b51fd54 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/ja.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/ja.dict.itop-problem-mgmt.php @@ -1,15 +1,16 @@ '問題管理', 'Menu:ProblemManagement+' => '問題管理', 'Menu:Problem:Overview' => '概要', @@ -32,12 +33,12 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI:ProblemMgmtMenuOverview:Title' => '問題管理ダッシュボード', 'UI:ProblemMgmtMenuOverview:Title+' => '問題管理ダッシュボード', -)); +]); // // Class: Problem // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Problem' => '問題', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => '状態', @@ -110,4 +111,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'クローズ', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/nl.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/nl.dict.itop-problem-mgmt.php index 3f00f2be6..3c4e19d7e 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/nl.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/nl.dict.itop-problem-mgmt.php @@ -1,10 +1,11 @@ @@ -12,7 +13,7 @@ * @author Jeffrey Bostoen (2018 - 2022) * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:ProblemManagement' => 'Probleem Management', 'Menu:ProblemManagement+' => 'Probleem Management', 'Menu:Problem:Overview' => 'Overzicht', @@ -35,12 +36,12 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Dashboard voor Probleem Management', 'UI:ProblemMgmtMenuOverview:Title+' => 'Dashboard voor Probleem Management', -)); +]); // // Class: Problem // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Problem' => 'Probleem', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Status', @@ -113,4 +114,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Sluit', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/pl.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/pl.dict.itop-problem-mgmt.php index 377e79353..da1756563 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/pl.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/pl.dict.itop-problem-mgmt.php @@ -1,15 +1,16 @@ 'Zarządzanie problemami', 'Menu:ProblemManagement+' => 'Zarządzanie problemami', 'Menu:Problem:Overview' => 'Przegląd', @@ -32,12 +33,12 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Pulpit do zarządzania problemami', 'UI:ProblemMgmtMenuOverview:Title+' => 'Pulpit do zarządzania problemami', -)); +]); // // Class: Problem // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Problem' => 'Problem', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Status', @@ -110,4 +111,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Zamknij', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/pt_br.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/pt_br.dict.itop-problem-mgmt.php index 801348cd4..f7b469bd8 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/pt_br.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/pt_br.dict.itop-problem-mgmt.php @@ -1,15 +1,16 @@ 'Gerenciamento de problemas', 'Menu:ProblemManagement+' => 'Lista de gerenciamento de problemas', 'Menu:Problem:Overview' => 'Visão geral', @@ -32,12 +33,12 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Painel de gerenciamento de problemas', 'UI:ProblemMgmtMenuOverview:Title+' => '', -)); +]); // // Class: Problem // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Problem' => 'Problema', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Status', @@ -110,4 +111,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Fechar', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/ru.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/ru.dict.itop-problem-mgmt.php index 5b95b1130..7e4f7a764 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/ru.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/ru.dict.itop-problem-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:ProblemManagement' => 'Управление проблемами', 'Menu:ProblemManagement+' => 'Управление проблемами', 'Menu:Problem:Overview' => 'Обзор', @@ -33,12 +34,12 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Панель управления проблемами', 'UI:ProblemMgmtMenuOverview:Title+' => 'Панель управления проблемами', -)); +]); // // Class: Problem // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Problem' => 'Проблема', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Статус', @@ -111,4 +112,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Закрыть', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/sk.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/sk.dict.itop-problem-mgmt.php index 6e635dc8d..fe7c5cf73 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/sk.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/sk.dict.itop-problem-mgmt.php @@ -1,15 +1,16 @@ 'Problem management~~', 'Menu:ProblemManagement+' => 'Problem management~~', 'Menu:Problem:Overview' => 'Overview~~', @@ -32,12 +33,12 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Dashboard for Problem Management~~', 'UI:ProblemMgmtMenuOverview:Title+' => 'Dashboard for Problem Management~~', -)); +]); // // Class: Problem // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Problem' => 'Problem~~', 'Class:Problem+' => '~~', 'Class:Problem/Attribute:status' => 'Status~~', @@ -110,4 +111,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Problem/Stimulus:ev_resolve+' => '~~', 'Class:Problem/Stimulus:ev_close' => 'Close~~', 'Class:Problem/Stimulus:ev_close+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/tr.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/tr.dict.itop-problem-mgmt.php index b969b410b..d8bacb5f6 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/tr.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/tr.dict.itop-problem-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Menu:ProblemManagement' => 'Problem yönetimi', 'Menu:ProblemManagement+' => 'Problem yönetimi', 'Menu:Problem:Overview' => 'Özet', @@ -33,12 +34,12 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI:ProblemMgmtMenuOverview:Title' => 'Problem Yönetimi Gösterge Tablosu', 'UI:ProblemMgmtMenuOverview:Title+' => 'Problem Yönetimi Gösterge Tablosu', -)); +]); // // Class: Problem // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Problem' => 'Problem', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => 'Durum', @@ -111,4 +112,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => 'Kapat', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/dictionaries/zh_cn.dict.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/dictionaries/zh_cn.dict.itop-problem-mgmt.php index 90d2a09bf..1cf347a8b 100644 --- a/datamodels/2.x/itop-problem-mgmt/dictionaries/zh_cn.dict.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/dictionaries/zh_cn.dict.itop-problem-mgmt.php @@ -1,4 +1,5 @@ /Attribute:/Value:+ // Class:/Stimulus: // Class:/Stimulus:+ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Menu:ProblemManagement' => '问题管理', 'Menu:ProblemManagement+' => '问题管理', 'Menu:Problem:Overview' => '概况', @@ -65,12 +66,12 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI:ProblemMgmtMenuOverview:Title' => '问题管理仪表盘', 'UI:ProblemMgmtMenuOverview:Title+' => '问题管理仪表盘', -)); +]); // // Class: Problem // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Problem' => '问题', 'Class:Problem+' => '', 'Class:Problem/Attribute:status' => '状态', @@ -143,4 +144,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Problem/Stimulus:ev_resolve+' => '', 'Class:Problem/Stimulus:ev_close' => '关闭', 'Class:Problem/Stimulus:ev_close+' => '', -)); +]); diff --git a/datamodels/2.x/itop-problem-mgmt/module.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/module.itop-problem-mgmt.php index 6cd43e60f..0228372bc 100755 --- a/datamodels/2.x/itop-problem-mgmt/module.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/module.itop-problem-mgmt.php @@ -1,10 +1,9 @@ 'Problem Management', @@ -12,23 +11,23 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-tickets/2.0.0', - ), + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array( - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'data.struct' => [ //'data.struct.itop-problem-mgmt.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.itop-problem-mgmt.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -36,7 +35,7 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); diff --git a/datamodels/2.x/itop-profiles-itil/module.itop-profiles-itil.php b/datamodels/2.x/itop-profiles-itil/module.itop-profiles-itil.php index 8ffa71124..21923828f 100755 --- a/datamodels/2.x/itop-profiles-itil/module.itop-profiles-itil.php +++ b/datamodels/2.x/itop-profiles-itil/module.itop-profiles-itil.php @@ -1,9 +1,10 @@ - SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file 'itop-profiles-itil/3.2.1', - array( + [ // Identification // 'label' => 'Create standard ITIL profiles', @@ -28,25 +28,25 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - ), + 'dependencies' => [ + ], 'mandatory' => true, 'visible' => false, // Components // - 'datamodel' => array( - ), - 'webservice' => array( + 'datamodel' => [ + ], + 'webservice' => [ //'webservices.itop-profiles-itil.php', - ), - 'data.struct' => array( + ], + 'data.struct' => [ //'data.struct.itop-profiles-itil.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.itop-profiles-itil.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -54,8 +54,8 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( + 'settings' => [ //'some_setting' => 'some value', - ), - ) + ], + ] ); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/cs.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/cs.dict.itop-request-mgmt-itil.php index a5e7b5b5e..89a9fe0e0 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/cs.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/cs.dict.itop-request-mgmt-itil.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:RequestManagement' => 'Helpdesk', 'Menu:RequestManagement+' => 'Helpdesk', 'Menu:RequestManagementProvider' => 'Poskytovatel helpdesku', @@ -43,7 +44,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Otevřené požadavky podle zákazníka', 'Class:UserRequest:KnownErrorList' => 'Známé chyby', 'Class:UserRequest:KnownErrorList+' => 'Známé chyby související s funkční konfigurační položkou spojenou s daným tiketem', -)); +]); // Dictionnay conventions // Class: @@ -59,7 +60,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( // Class: UserRequest // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:UserRequest' => 'Uživatelský požadavek', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Stav', @@ -257,11 +258,10 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Požadavek nemůže být nadřazený sám sobě', 'Class:UserRequest/Method:ResolveChildTickets' => 'Vyřešit podřízené tikety', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Kaskádovat vyřešení do podřízeného požadavku (ev_autoresolve) a sjednotit následující vlastnosti: služba, tým, řešitel, informace o vyřešení', -)); +]); - -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Organization:Overview:UserRequests' => 'Uživatelské požadavky z této organizace', 'Organization:Overview:MyUserRequests' => 'Moje uživatelské požadavky pro tuto organizaci', 'Organization:Overview:Tickets' => 'Tikety pro tuto organizaci', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/da.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/da.dict.itop-request-mgmt-itil.php index b3c45c098..51c2a62c5 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/da.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/da.dict.itop-request-mgmt-itil.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:RequestManagement' => 'Helpdesk', 'Menu:RequestManagement+' => '', 'Menu:RequestManagementProvider' => 'Helpdesk Leverandør', @@ -42,7 +43,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Åbne brugerhenvendelser efter bruger', 'Class:UserRequest:KnownErrorList' => 'Known Errors', 'Class:UserRequest:KnownErrorList+' => 'Known Errors related to Functional CI linked to the current ticket~~', -)); +]); // Dictionnay conventions // Class: @@ -58,7 +59,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( // Class: UserRequest // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:UserRequest' => 'Brugerhenvendelse', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -256,11 +257,10 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Cannot assign the Parent request to the request itself~~', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascade the resolution to child requests (ev_autoresolve), and align the following characteristics of the request: service, team, agent, resolution info~~', -)); +]); - -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Organization:Overview:UserRequests' => 'User Requests from this organization~~', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organization~~', 'Organization:Overview:Tickets' => 'Tickets for this organization~~', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/de.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/de.dict.itop-request-mgmt-itil.php index 740cbdb07..58eb04b7d 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/de.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/de.dict.itop-request-mgmt-itil.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:RequestManagement' => 'Helpdesk', 'Menu:RequestManagement+' => 'Verwaltung von Benutzeranfragen', 'Menu:RequestManagementProvider' => 'Helpdesk-Provider', @@ -42,7 +43,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Offene Benutzeranfragen nach Kunde', 'Class:UserRequest:KnownErrorList' => 'Known Errors', 'Class:UserRequest:KnownErrorList+' => 'Dokumentiere Fehler im Zusammenhang mit CIs, die mit dem aktuellen Ticket verknüpft sind', -)); +]); // Dictionnay conventions // Class: @@ -58,7 +59,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( // Class: UserRequest // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:UserRequest' => 'Benutzeranfrage', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -256,11 +257,10 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Kann Ticket nicht als eigenes Parent-Ticket verwenden', 'Class:UserRequest/Method:ResolveChildTickets' => 'Kind-Tickets lösen', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Lösung auf Kind-Tickets übertragen (ev_autoresolve), und folgende Ticket-Eigenschaften angleichen: Service, Team, Agent, Lösungsinformationen', -)); +]); - -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Organization:Overview:UserRequests' => 'Benutzeranfragen dieser Organisation', 'Organization:Overview:MyUserRequests' => 'Mir zugewiesene Benutzeranfragen dieser Organisation', 'Organization:Overview:Tickets' => 'Alle Tickets dieser Organisation', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/en.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/en.dict.itop-request-mgmt-itil.php index 533c1a46b..8d97ac7fd 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/en.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/en.dict.itop-request-mgmt-itil.php @@ -1,10 +1,11 @@ 'Helpdesk', 'Menu:RequestManagement+' => '', 'Menu:RequestManagementProvider' => 'Helpdesk provider', @@ -36,7 +37,7 @@ Dict::Add('EN US', 'English', 'English', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Open requests by customer', 'Class:UserRequest:KnownErrorList' => 'Known Errors', 'Class:UserRequest:KnownErrorList+' => 'Known Errors related to Functional CI linked to the current ticket', -)); +]); // Dictionnay conventions // Class: @@ -52,7 +53,7 @@ Dict::Add('EN US', 'English', 'English', array( // Class: UserRequest // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:UserRequest' => 'User Request', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -251,11 +252,10 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascade the resolution to child requests (ev_autoresolve), and align the following characteristics of the request: service, team, agent, resolution info', -)); +]); - -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Organization:Overview:UserRequests' => 'User Requests from this organization', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organization', 'Organization:Overview:Tickets' => 'Tickets for this organization', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/en_gb.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/en_gb.dict.itop-request-mgmt-itil.php index caebaab9c..a42dd5534 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/en_gb.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/en_gb.dict.itop-request-mgmt-itil.php @@ -1,10 +1,11 @@ 'Helpdesk', 'Menu:RequestManagement+' => '', 'Menu:RequestManagementProvider' => 'Helpdesk provider', @@ -36,7 +37,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Open requests by customer', 'Class:UserRequest:KnownErrorList' => 'Known Errors', 'Class:UserRequest:KnownErrorList+' => 'Known Errors related to Functional CI linked to the current ticket', -)); +]); // Dictionnay conventions // Class: @@ -52,7 +53,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( // Class: UserRequest // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:UserRequest' => 'User Request', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -251,11 +252,10 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascade the resolution to child requests (ev_autoresolve), and align the following characteristics of the request: service, team, agent, resolution info.', -)); +]); - -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Organization:Overview:UserRequests' => 'User Requests from this organisation', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organisation', 'Organization:Overview:Tickets' => 'Tickets for this organisation', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/es_cr.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/es_cr.dict.itop-request-mgmt-itil.php index 5be49f0db..74b22fcf1 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/es_cr.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/es_cr.dict.itop-request-mgmt-itil.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:RequestManagement' => 'Administración de Requerimientos', 'Menu:RequestManagement+' => 'Administración de Requerimientos', 'Menu:RequestManagementProvider' => 'Proveedor de Mesa de Ayuda', @@ -39,7 +40,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Requerimientos Abiertos por Cliente', 'Class:UserRequest:KnownErrorList' => 'Errores Conocidos', 'Class:UserRequest:KnownErrorList+' => 'Errores conocidos relacionados con el EC funcional vinculado al ticket actual', -)); +]); // Dictionnay conventions // Class: @@ -55,7 +56,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( // Class: UserRequest // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:UserRequest' => 'Requerimiento', 'Class:UserRequest+' => 'Requerimiento', 'Class:UserRequest/Attribute:status' => 'Estatus', @@ -253,11 +254,10 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'No puede asignarse el requerimiento Padre a si mismo', 'Class:UserRequest/Method:ResolveChildTickets' => 'Resolver tickets hijos', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascadear la solución a los tickets hijos (ev_autoresolve), y alinear las siguientes características: servicio, equipo, agente, información de solución', -)); +]); - -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Organization:Overview:UserRequests' => 'Requerimientos para esta Organización', 'Organization:Overview:MyUserRequests' => 'Mis Requerimientos para esta Organización', 'Organization:Overview:Tickets' => 'Tickets para esta Organización', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/fr.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/fr.dict.itop-request-mgmt-itil.php index 0fcf17fbd..8f3e0b446 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/fr.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/fr.dict.itop-request-mgmt-itil.php @@ -1,15 +1,16 @@ 'Gestion des demandes', 'Menu:RequestManagement+' => 'Gestion des demandes utilisateurs', 'Menu:RequestManagementProvider' => 'Gestion des demandes fournisseurs', @@ -41,7 +42,7 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Requêtes ouvertes par client', 'Class:UserRequest:KnownErrorList' => 'Erreurs connues', 'Class:UserRequest:KnownErrorList+' => 'Erreurs connues liées à des éléments de configuration impactés par ce ticket', -)); +]); // Dictionnay conventions // Class: @@ -57,7 +58,7 @@ Dict::Add('FR FR', 'French', 'Français', array( // Class: UserRequest // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:UserRequest' => 'Demande Utilisateur', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Etat', @@ -260,12 +261,11 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'La demande parente ne peut pas être assignée à elle même', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets (résoudre les tickets fils)', - 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascader l\'action de résolution de la demande (ev_autoresolve), et aligner les caractéristiques suivantes : service, équipe, agent, information de résolution' -)); + 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascader l\'action de résolution de la demande (ev_autoresolve), et aligner les caractéristiques suivantes : service, équipe, agent, information de résolution', +]); - -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Organization:Overview:UserRequests' => 'Demandes Utilisateurs pour cette organisation', 'Organization:Overview:MyUserRequests' => 'Mes Demandes Utilisateurs pour cette organisation', 'Organization:Overview:Tickets' => 'Les Tickets de cette organisation', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/hu.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/hu.dict.itop-request-mgmt-itil.php index f33c471d6..53d38d66b 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/hu.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/hu.dict.itop-request-mgmt-itil.php @@ -1,15 +1,16 @@ 'Helpdesk', 'Menu:RequestManagement+' => 'Felhasználói kérések kezelése', 'Menu:RequestManagementProvider' => 'Helpdesk szolgáltató', @@ -41,7 +42,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Nyitott kérelmek ügyfelenként', 'Class:UserRequest:KnownErrorList' => 'Ismert hibák', 'Class:UserRequest:KnownErrorList+' => 'Known Errors related to Functional CI linked to the current ticket~~', -)); +]); // Dictionnay conventions // Class: @@ -57,7 +58,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( // Class: UserRequest // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:UserRequest' => 'Felhasználói kérelem', 'Class:UserRequest+' => '~~', 'Class:UserRequest/Attribute:status' => 'Állapot', @@ -255,11 +256,10 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Nem lehet hozzárendelni a Fölérendelt kérelmet magához a kérelemhez', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:UserRequest/Method:ResolveChildTickets+' => 'A megoldás kaszkádosítása a kapcsolódó kérésekhez (ev_autoresolve), és a kérés következő jellemzőinek összehangolása: szolgáltatás, csapat, ügyintéző, megoldási információ.', -)); +]); - -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Organization:Overview:UserRequests' => 'Felhasználói kérelmek ebből a szervezeti egységből', 'Organization:Overview:MyUserRequests' => 'Hozzám rendelt kérelmek ebből a szervezeti egységből', 'Organization:Overview:Tickets' => 'Hibajegyek ebből a szervezeti egységből', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/it.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/it.dict.itop-request-mgmt-itil.php index 4689f40c2..9e3da29e6 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/it.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/it.dict.itop-request-mgmt-itil.php @@ -1,15 +1,16 @@ 'Service Request', 'Menu:RequestManagement+' => 'Service Request', 'Menu:RequestManagementProvider' => 'Service Request Fornitore', @@ -41,7 +42,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Richieste aperte dal cliente', 'Class:UserRequest:KnownErrorList' => 'Errori Conosiuti', 'Class:UserRequest:KnownErrorList+' => 'Errori noti relativi al CI Funzionale collegato al ticket corrente', -)); +]); // Dictionnay conventions // Class: @@ -57,7 +58,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( // Class: UserRequest // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:UserRequest' => 'Richiesta utente', 'Class:UserRequest+' => '~~', 'Class:UserRequest/Attribute:status' => 'Stati', @@ -255,11 +256,10 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Non si può assegnare una richiesta padre a se stesso', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Risoluzione a cascata delle richieste figlie (ev_autoresolve), e allineare le seguenti caratteristiche: servizio, team, agente e risoluzione', -)); +]); - -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Organization:Overview:UserRequests' => 'Richieste utente per questa organizzazione', 'Organization:Overview:MyUserRequests' => 'Le mie richieste per questa organizzazione', 'Organization:Overview:Tickets' => 'Ticket per questa organizzazione', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/ja.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/ja.dict.itop-request-mgmt-itil.php index 395402c00..12c106936 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/ja.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/ja.dict.itop-request-mgmt-itil.php @@ -1,15 +1,16 @@ 'ヘルプデスク', 'Menu:RequestManagement+' => 'ヘルプデスクk', 'Menu:RequestManagementProvider' => 'ヘルプデスクプロバイダー', @@ -41,7 +42,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => '顧客別のオープンなリクエスト', 'Class:UserRequest:KnownErrorList' => '既知のエラー', 'Class:UserRequest:KnownErrorList+' => 'Known Errors related to Functional CI linked to the current ticket~~', -)); +]); // Dictionnay conventions // Class: @@ -57,7 +58,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( // Class: UserRequest // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:UserRequest' => 'ユーザ要求', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => '状態', @@ -255,11 +256,10 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Cannot assign the Parent request to the request itself~~', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascade the resolution to child requests (ev_autoresolve), and align the following characteristics of the request: service, team, agent, resolution info~~', -)); +]); - -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Organization:Overview:UserRequests' => 'User Requests from this organization~~', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organization~~', 'Organization:Overview:Tickets' => 'Tickets for this organization~~', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/nl.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/nl.dict.itop-request-mgmt-itil.php index 37c21d668..b72474c7f 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/nl.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/nl.dict.itop-request-mgmt-itil.php @@ -1,16 +1,17 @@ * @author Jeffrey Bostoen (2018 - 2022) */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:RequestManagement' => 'Helpdesk', 'Menu:RequestManagement+' => 'Helpdesk', 'Menu:RequestManagementProvider' => 'Helpdesk leverancier', @@ -42,7 +43,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Open verzoeken per organisatie', 'Class:UserRequest:KnownErrorList' => 'Gekende fouten', 'Class:UserRequest:KnownErrorList+' => 'Gekende fouten gerelateerd aan configuratie-items gekoppeld aan het huidige verzoek', -)); +]); // Dictionnay conventions // Class: @@ -58,7 +59,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( // Class: UserRequest // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:UserRequest' => 'Gebruikersverzoek', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -256,11 +257,10 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Kan het verzoek niet aan zichzelf toewijzen als hoofdincident', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets (los subverzoeken op)', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Pas de oplossing ook toe op subverzoeken (ev_autoresolve) en neem deze kenmerken over: service, team, agent, oplossing', -)); +]); - -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Organization:Overview:UserRequests' => 'Gebruikersverzoeken van deze organisatie', 'Organization:Overview:MyUserRequests' => 'Mijn gebruikersverzoeken voor deze organisatie', 'Organization:Overview:Tickets' => 'Tickets voor deze organisatie', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/pl.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/pl.dict.itop-request-mgmt-itil.php index f697feb93..f1a3a8921 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/pl.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/pl.dict.itop-request-mgmt-itil.php @@ -1,15 +1,16 @@ 'Pomoc techniczna', 'Menu:RequestManagement+' => 'Pomoc techniczna', 'Menu:RequestManagementProvider' => 'Dostawca pomocy technicznej', @@ -41,7 +42,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Otwarte zgłoszenia według klientów', 'Class:UserRequest:KnownErrorList' => 'Znane błędy', 'Class:UserRequest:KnownErrorList+' => 'Znane błędy związane z konfiguracją CI powiązaną z bieżącym zgłoszeniem', -)); +]); // Dictionnay conventions // Class: @@ -57,7 +58,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( // Class: UserRequest // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:UserRequest' => 'Zgłoszenie użytkownika', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -255,11 +256,10 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Nie można przypisać zgłoszenia nadrzędnego do samego siebie', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Połącz rozwiązanie kaskadowo do żądań podrzędnych (ev_autoresolve) i dopasuj następujące cechy zgłoszenia: usługa, zespół, agent, informacje o rozwiązaniu', -)); +]); - -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Organization:Overview:UserRequests' => 'Zgłoszenia użytkowników z tej organizacji', 'Organization:Overview:MyUserRequests' => 'Moje zgłoszenia użytkowników dla tej organizacji', 'Organization:Overview:Tickets' => 'Zgłoszenia tej organizacji', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/pt_br.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/pt_br.dict.itop-request-mgmt-itil.php index 5ce3a07fe..661e04339 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/pt_br.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/pt_br.dict.itop-request-mgmt-itil.php @@ -1,15 +1,16 @@ 'Gerenciamento de Solicitações', 'Menu:RequestManagement+' => 'Gerenciamento de Solicitações', 'Menu:RequestManagementProvider' => 'Solicitações a provedores', @@ -41,7 +42,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Solicitações abertas por cliente', 'Class:UserRequest:KnownErrorList' => 'Erros conhecidos', 'Class:UserRequest:KnownErrorList+' => 'Known Errors related to Functional CI linked to the current ticket~~', -)); +]); // Dictionnay conventions // Class: @@ -57,7 +58,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( // Class: UserRequest // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:UserRequest' => 'Solicitação de Usuário', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -255,11 +256,10 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Não é possível atribuir a solicitação pai a própria solicitação', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Conecte a solução a pedidos filhos (ev_autoresolve) e alinhe as seguintes características da requisição: serviço, equipe, agente, info de solução', -)); +]); - -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Organization:Overview:UserRequests' => 'Solicitações de usuários desta organização', 'Organization:Overview:MyUserRequests' => 'Minhas solicitações de usuário para esta organização', 'Organization:Overview:Tickets' => 'Solicitações desta organização', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/ru.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/ru.dict.itop-request-mgmt-itil.php index 0793f4865..bd84fc5f6 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/ru.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/ru.dict.itop-request-mgmt-itil.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:RequestManagement' => 'Управление запросами', 'Menu:RequestManagement+' => 'Управление запросами', 'Menu:RequestManagementProvider' => 'Поставщик техподдержки', @@ -42,7 +43,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Открытые запросы по заказчику', 'Class:UserRequest:KnownErrorList' => 'Известные ошибки', 'Class:UserRequest:KnownErrorList+' => 'Known Errors related to Functional CI linked to the current ticket~~', -)); +]); // Dictionnay conventions // Class: @@ -58,7 +59,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( // Class: UserRequest // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:UserRequest' => 'Запрос', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Статус', @@ -256,11 +257,10 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Невозможно назначить этот же запрос в качестве родительского', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Каскадное решение дочерних запросов (ev_autoresolve) с установкой следующих параметров: услуга, команда, агент, информация о решении.', -)); +]); - -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Organization:Overview:UserRequests' => 'Запросы пользователей этой организации', 'Organization:Overview:MyUserRequests' => 'Мои запросы пользователей этой организации', 'Organization:Overview:Tickets' => 'Тикеты этой организации', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/sk.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/sk.dict.itop-request-mgmt-itil.php index a0a8e6bb1..494a91552 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/sk.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/sk.dict.itop-request-mgmt-itil.php @@ -1,15 +1,16 @@ 'Helpdesk', 'Menu:RequestManagement+' => '~~', 'Menu:RequestManagementProvider' => 'Poskytovateľ Helpdesku', @@ -41,7 +42,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Otvorené požiadavky podľa organizácie', 'Class:UserRequest:KnownErrorList' => 'Známe chyby', 'Class:UserRequest:KnownErrorList+' => 'Known Errors related to Functional CI linked to the current ticket~~', -)); +]); // Dictionnay conventions // Class: @@ -57,7 +58,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( // Class: UserRequest // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:UserRequest' => 'Požiadavka užívateľa', 'Class:UserRequest+' => '~~', 'Class:UserRequest/Attribute:status' => 'Stav', @@ -255,11 +256,10 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Cannot assign the Parent request to the request itself~~', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascade the resolution to child requests (ev_autoresolve), and align the following characteristics of the request: service, team, agent, resolution info~~', -)); +]); - -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Organization:Overview:UserRequests' => 'User Requests from this organization~~', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organization~~', 'Organization:Overview:Tickets' => 'Tickets for this organization~~', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/tr.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/tr.dict.itop-request-mgmt-itil.php index 0631ca91b..2fc111f20 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/tr.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/tr.dict.itop-request-mgmt-itil.php @@ -1,15 +1,16 @@ 'Helpdesk~~', 'Menu:RequestManagement+' => '', 'Menu:RequestManagementProvider' => 'Helpdesk provider~~', @@ -41,7 +42,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => 'Open requests by customer~~', 'Class:UserRequest:KnownErrorList' => 'Known Errors~~', 'Class:UserRequest:KnownErrorList+' => 'Known Errors related to Functional CI linked to the current ticket~~', -)); +]); // Dictionnay conventions // Class: @@ -57,7 +58,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( // Class: UserRequest // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:UserRequest' => 'User Request~~', 'Class:UserRequest+' => '~~', 'Class:UserRequest/Attribute:status' => 'Status~~', @@ -255,11 +256,10 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Cannot assign the Parent request to the request itself~~', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascade the resolution to child requests (ev_autoresolve), and align the following characteristics of the request: service, team, agent, resolution info~~', -)); +]); - -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Organization:Overview:UserRequests' => 'User Requests from this organization~~', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organization~~', 'Organization:Overview:Tickets' => 'Tickets for this organization~~', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/zh_cn.dict.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/zh_cn.dict.itop-request-mgmt-itil.php index 55dbe081f..2ac97877e 100644 --- a/datamodels/2.x/itop-request-mgmt-itil/dictionaries/zh_cn.dict.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/dictionaries/zh_cn.dict.itop-request-mgmt-itil.php @@ -1,9 +1,10 @@ '服务台', 'Menu:RequestManagement+' => '', 'Menu:RequestManagementProvider' => '服务台提供者', @@ -35,7 +36,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI-RequestManagementOverview-OpenRequestByCustomer' => '打开的需求 (按客户)', 'Class:UserRequest:KnownErrorList' => '已知错误', 'Class:UserRequest:KnownErrorList+' => '和当前工单关联的功能配置项相关的已知错误', -)); +]); // Dictionnay conventions // Class: @@ -51,7 +52,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( // Class: UserRequest // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:UserRequest' => '用户需求', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => '状态', @@ -249,11 +250,10 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => '无法分配父级需求给自己', 'Class:UserRequest/Method:ResolveChildTickets' => '解决子工单', 'Class:UserRequest/Method:ResolveChildTickets+' => '递归解决子工单 (自动解决), 并调整相关字段与父级工单保持一致: 服务, 团队, 办理人, 解决方案信息', -)); +]); - -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Organization:Overview:UserRequests' => '此组织的所有用户需求', 'Organization:Overview:MyUserRequests' => '我在此组织发起的需求', 'Organization:Overview:Tickets' => '此组织内的所有工单', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt-itil/module.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/module.itop-request-mgmt-itil.php index afa002dd0..378a8bb23 100755 --- a/datamodels/2.x/itop-request-mgmt-itil/module.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/module.itop-request-mgmt-itil.php @@ -1,10 +1,9 @@ 'User request Management ITIL', @@ -12,24 +11,24 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-tickets/2.4.0', - ), + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array( + 'datamodel' => [ 'main.itop-request-mgmt-itil.php', - ), - 'data.struct' => array( + ], + 'data.struct' => [ - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.itop-request-mgmt.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -37,7 +36,7 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/cs.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/cs.dict.itop-request-mgmt.php index b3e0da582..ec9f68a43 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/cs.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/cs.dict.itop-request-mgmt.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:RequestManagement' => 'Helpdesk', 'Menu:RequestManagement+' => 'Helpdesk', 'Menu:RequestManagementProvider' => 'Poskytovatel helpdesku', @@ -47,7 +48,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Menu:UserRequest:MyWorkOrders+' => 'Všechny pracovní příkazy přidělené mně', 'Class:Problem:KnownProblemList' => 'Známé problémy', 'Tickets:Related:OpenIncidents' => 'Otevřené incidenty', -)); +]); // Dictionnay conventions // Class: @@ -63,7 +64,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( // Class: UserRequest // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:UserRequest' => 'Uživatelský požadavek', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Stav', @@ -257,10 +258,9 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Čeká na schválení', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Požadavek nemůže být nadřazený sám sobě', -)); +]); - -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Portal:TitleDetailsFor_Request' => 'Detaily požadavku', 'Portal:ButtonUpdate' => 'Aktualizovat', 'Portal:ButtonClose' => 'Uzavřít', @@ -285,11 +285,10 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Portal:ChooseYourFavoriteLanguage' => 'Vyberte svůj jazyk', 'Class:UserRequest/Method:ResolveChildTickets' => 'Vyřešit podřízené tikety', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Kaskádovat vyřešení do podřízeného požadavku (ev_autoresolve) a sjednotit následující vlastnosti: služba, tým, řešitel, informace o vyřešení', -)); +]); - -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Organization:Overview:UserRequests' => 'Uživatelské požadavky z této organizace', 'Organization:Overview:MyUserRequests' => 'Moje uživatelské požadavky pro tuto organizaci', 'Organization:Overview:Tickets' => 'Tikety pro tuto organizaci', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/da.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/da.dict.itop-request-mgmt.php index 50c56ff99..b19fc3d49 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/da.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/da.dict.itop-request-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:RequestManagement' => 'Helpdesk', 'Menu:RequestManagement+' => '', 'Menu:RequestManagementProvider' => 'Helpdesk Leverandør', @@ -46,7 +47,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Menu:UserRequest:MyWorkOrders+' => '', 'Class:Problem:KnownProblemList' => 'Kendte problemer', 'Tickets:Related:OpenIncidents' => 'Open incidents~~', -)); +]); // Dictionnay conventions // Class: @@ -62,7 +63,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( // Class: UserRequest // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:UserRequest' => 'Brugerhenvendelse', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -256,10 +257,9 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Afventer godkendelse', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Cannot assign the Parent request to the request itself~~', -)); +]); - -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Portal:TitleDetailsFor_Request' => 'Dealjer for Brugerhenvendelser', 'Portal:ButtonUpdate' => 'Opdater', 'Portal:ButtonClose' => 'Luk', @@ -284,11 +284,10 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Portal:ChooseYourFavoriteLanguage' => 'Vælg dit foretrukne sprog', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascade the resolution to child requests (ev_autoresolve), and align the following characteristics of the request: service, team, agent, resolution info~~', -)); +]); - -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Organization:Overview:UserRequests' => 'User Requests from this organization~~', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organization~~', 'Organization:Overview:Tickets' => 'Tickets for this organization~~', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/de.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/de.dict.itop-request-mgmt.php index 730a9c730..10f13dcd9 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/de.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/de.dict.itop-request-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:RequestManagement' => 'Helpdesk', 'Menu:RequestManagement+' => 'Verwaltung von Nutzeranfragen und Störungsmeldungen', 'Menu:RequestManagementProvider' => 'Helpdesk-Provider', @@ -46,7 +47,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Menu:UserRequest:MyWorkOrders+' => '', 'Class:Problem:KnownProblemList' => 'Bekannte Problems', 'Tickets:Related:OpenIncidents' => 'Offene Incidents', -)); +]); // Dictionnay conventions // Class: @@ -62,7 +63,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( // Class: UserRequest // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:UserRequest' => 'Benutzeranfrage', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -256,10 +257,9 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Auf Genehmigung warten', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Kann Ticket nicht als eigenes Parent-Ticket verwenden', -)); +]); - -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Portal:TitleDetailsFor_Request' => 'Details für Benutzeranfrage', 'Portal:ButtonUpdate' => 'Update', 'Portal:ButtonClose' => 'Schließen', @@ -284,11 +284,10 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Portal:ChooseYourFavoriteLanguage' => 'Wählen Sie Ihre bevorzugte Sprache', 'Class:UserRequest/Method:ResolveChildTickets' => 'Kind-Tickets lösen', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Lösung auf Kind-Tickets übertragen (ev_autoresolve), und folgende Ticket-Eigenschaften angleichen: Service, Team, Agent, Lösungsinformationen', -)); +]); - -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Organization:Overview:UserRequests' => 'Benutzeranfragen dieser Organisation', 'Organization:Overview:MyUserRequests' => 'Mir zugewiesene Benutzeranfragen dieser Organisation', 'Organization:Overview:Tickets' => 'Alle Tickets dieser Organisation', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/en.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/en.dict.itop-request-mgmt.php index 70206051e..4d6370df4 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/en.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/en.dict.itop-request-mgmt.php @@ -1,10 +1,11 @@ 'Helpdesk', 'Menu:RequestManagement+' => '', 'Menu:RequestManagementProvider' => 'Helpdesk provider', @@ -40,7 +41,7 @@ Dict::Add('EN US', 'English', 'English', array( 'Menu:UserRequest:MyWorkOrders+' => 'All work orders assigned to me', 'Class:Problem:KnownProblemList' => 'Known problems', 'Tickets:Related:OpenIncidents' => 'Open incidents', -)); +]); // Dictionnay conventions // Class: @@ -56,7 +57,7 @@ Dict::Add('EN US', 'English', 'English', array( // Class: UserRequest // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:UserRequest' => 'User Request', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -250,10 +251,9 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Wait for approval', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Cannot assign the Parent request to the request itself', -)); +]); - -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Portal:TitleDetailsFor_Request' => 'Details for request', 'Portal:ButtonUpdate' => 'Update', 'Portal:ButtonClose' => 'Close', @@ -279,11 +279,10 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascade the resolution to child requests (ev_autoresolve), and align the following characteristics of the request: service, team, agent, resolution info', -)); +]); - -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Organization:Overview:UserRequests' => 'User Requests from this organization', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organization', 'Organization:Overview:Tickets' => 'Tickets for this organization', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/en_gb.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/en_gb.dict.itop-request-mgmt.php index adb72919a..41a359e88 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/en_gb.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/en_gb.dict.itop-request-mgmt.php @@ -1,10 +1,11 @@ 'Helpdesk', 'Menu:RequestManagement+' => '', 'Menu:RequestManagementProvider' => 'Helpdesk provider', @@ -40,7 +41,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Menu:UserRequest:MyWorkOrders+' => 'All work orders assigned to me', 'Class:Problem:KnownProblemList' => 'Known problems', 'Tickets:Related:OpenIncidents' => 'Open incidents', -)); +]); // Dictionnay conventions // Class: @@ -56,7 +57,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( // Class: UserRequest // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:UserRequest' => 'User Request', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -250,10 +251,9 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Wait for approval', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Cannot assign the Parent request to the request itself', -)); +]); - -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Portal:TitleDetailsFor_Request' => 'Details for request', 'Portal:ButtonUpdate' => 'Update', 'Portal:ButtonClose' => 'Close', @@ -279,11 +279,10 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascade the resolution to child requests (ev_autoresolve), and align the following characteristics of the request: service, team, agent, resolution info.', -)); +]); - -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Organization:Overview:UserRequests' => 'User Requests from this organisation', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organisation', 'Organization:Overview:Tickets' => 'Tickets for this organisation', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/es_cr.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/es_cr.dict.itop-request-mgmt.php index a693873b7..d051b0ad8 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/es_cr.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/es_cr.dict.itop-request-mgmt.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:RequestManagement' => 'Administración de Requerimientos', 'Menu:RequestManagement+' => 'Administración de Requerimientos', 'Menu:RequestManagementProvider' => 'Proveedor de Mesa de Ayuda', @@ -43,7 +44,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Menu:UserRequest:MyWorkOrders+' => 'Ordenes de Trabajo asignadas a Mí', 'Class:Problem:KnownProblemList' => 'Problemas Conocidos', 'Tickets:Related:OpenIncidents' => 'Incidentes Abiertos', -)); +]); // Dictionnay conventions // Class: @@ -59,7 +60,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( // Class: UserRequest // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:UserRequest' => 'Requerimiento', 'Class:UserRequest+' => 'Requerimiento', 'Class:UserRequest/Attribute:status' => 'Estatus', @@ -253,10 +254,9 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Esperando Aprobación', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => 'Esperando Aprobación', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'No puede asignarse el requerimiento Padre a si mismo', -)); +]); - -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Portal:TitleDetailsFor_Request' => 'Detalles del Requerimiento', 'Portal:ButtonUpdate' => 'Actualizar', 'Portal:ButtonClose' => 'Cerrar', @@ -281,11 +281,10 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Portal:ChooseYourFavoriteLanguage' => 'Seleccione su Idioma Favorito', 'Class:UserRequest/Method:ResolveChildTickets' => 'Resolver tickets hijos', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascadear la solución a los tickets hijos (ev_autoresolve), y alinear las siguientes características: servicio, equipo, agente, información de solución', -)); +]); - -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Organization:Overview:UserRequests' => 'Requerimientos para esta Organización', 'Organization:Overview:MyUserRequests' => 'Mis Requerimientos para esta Organización', 'Organization:Overview:Tickets' => 'Tickets para esta Organización', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/fr.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/fr.dict.itop-request-mgmt.php index c1ec3bc3e..2e7a21a2c 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/fr.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/fr.dict.itop-request-mgmt.php @@ -1,15 +1,16 @@ 'Gestion des demandes', 'Menu:RequestManagement+' => 'Gestion des demandes utilisateurs', 'Menu:RequestManagementProvider' => 'Gestion des demandes fournisseurs', @@ -45,7 +46,7 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Menu:UserRequest:MyWorkOrders+' => '', 'Class:Problem:KnownProblemList' => 'Problèmes connus', 'Tickets:Related:OpenIncidents' => 'Incidents en cours', -)); +]); // Dictionnay conventions // Class: @@ -61,7 +62,7 @@ Dict::Add('FR FR', 'French', 'Français', array( // Class: UserRequest // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:UserRequest' => 'Demande Utilisateur', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Etat', @@ -260,11 +261,10 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:UserRequest/Stimulus:ev_reopen+' => '', 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Attendre une approbation', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', - 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'La demande parente ne peut pas être assignée à elle même' -)); + 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'La demande parente ne peut pas être assignée à elle même', +]); - -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Portal:TitleDetailsFor_Request' => 'Détail de la demande', 'Portal:ButtonUpdate' => 'Mettre à jour', 'Portal:ButtonClose' => 'Fermer', @@ -289,11 +289,10 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Portal:ChooseYourFavoriteLanguage' => 'Choisissez votre langue', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets (résoudre les tickets fils)', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascader l\'action de résolution de la demande (ev_autoresolve), et aligner les caractéristiques suivantes : service, équipe, agent, information de résolution', -)); +]); - -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Organization:Overview:UserRequests' => 'Demandes Utilisateurs pour cette organisation', 'Organization:Overview:MyUserRequests' => 'Mes Demandes Utilisateurs pour cette organisation', 'Organization:Overview:Tickets' => 'Les Tickets de cette organisation', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/hu.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/hu.dict.itop-request-mgmt.php index fe86ff71c..2ffd0c376 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/hu.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/hu.dict.itop-request-mgmt.php @@ -1,15 +1,16 @@ 'Helpdesk', 'Menu:RequestManagement+' => 'Kérelmek kezelése', 'Menu:RequestManagementProvider' => 'Helpdesk szolgáltató', @@ -45,7 +46,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Menu:UserRequest:MyWorkOrders+' => 'All work orders assigned to me~~', 'Class:Problem:KnownProblemList' => 'Ismert problémák', 'Tickets:Related:OpenIncidents' => 'Nyitott incidensek', -)); +]); // Dictionnay conventions // Class: @@ -61,7 +62,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( // Class: UserRequest // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:UserRequest' => 'Felhasználói kérelem', 'Class:UserRequest+' => '~~', 'Class:UserRequest/Attribute:status' => 'Állapot', @@ -255,10 +256,9 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Jóváhagyásra vár', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '~~', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Nem lehet hozzárendelni a fölérendelt kérelmet magához a kérelemhez', -)); +]); - -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Portal:TitleDetailsFor_Request' => 'Kérelem részletei', 'Portal:ButtonUpdate' => 'Frissítés', 'Portal:ButtonClose' => 'Lezárás', @@ -283,11 +283,10 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Portal:ChooseYourFavoriteLanguage' => 'Válassza ki a kívánt nyelvet', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:UserRequest/Method:ResolveChildTickets+' => 'A megoldás kaszkádosítása a kapcsolódó kérésekhez (ev_autoresolve), és a kérés következő jellemzőinek összehangolása: szolgáltatás, csapat, ügyintéző, megoldási információ.', -)); +]); - -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Organization:Overview:UserRequests' => 'Felhasználói kérelmek ebből a szervezeti egységből', 'Organization:Overview:MyUserRequests' => 'Hozzám rendelt kérelmek ebből a szervezeti egységből', 'Organization:Overview:Tickets' => 'Hibajegyek ebből a szervezeti egységből', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/it.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/it.dict.itop-request-mgmt.php index 8e3bf513c..86e92455e 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/it.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/it.dict.itop-request-mgmt.php @@ -1,15 +1,16 @@ 'Service Request', 'Menu:RequestManagement+' => 'Service Request', 'Menu:RequestManagementProvider' => 'Service Request Fornitore', @@ -45,7 +46,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Menu:UserRequest:MyWorkOrders+' => 'Tutti i work order assegnati a me', 'Class:Problem:KnownProblemList' => 'Problemi conosciuti', 'Tickets:Related:OpenIncidents' => 'Incidenti aperti', -)); +]); // Dictionnay conventions // Class: @@ -61,7 +62,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( // Class: UserRequest // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:UserRequest' => 'Richeista utente', 'Class:UserRequest+' => '~~', 'Class:UserRequest/Attribute:status' => 'Stato', @@ -255,10 +256,9 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'In attesa di essere approvata', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '~~', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Non si può assegnare una richiesta padre a se stesso', -)); +]); - -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Portal:TitleDetailsFor_Request' => 'Dettagi della richiesta', 'Portal:ButtonUpdate' => 'Aggiornameno', 'Portal:ButtonClose' => 'Chiuso', @@ -283,11 +283,10 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Portal:ChooseYourFavoriteLanguage' => 'Selezionate la vostra lingua preferita', 'Class:UserRequest/Method:ResolveChildTickets' => 'Risolve ticket figli', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Inoltra la risolzuione ai ticket collegati ev_autosolve), e allinea le caratteriche della richiesta: Servizio, team , agente e informazioni della risoluzione', -)); +]); - -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Organization:Overview:UserRequests' => 'Richieste utente per questa organizzazione', 'Organization:Overview:MyUserRequests' => 'Le Mie richieste utente per questa organizzazione', 'Organization:Overview:Tickets' => 'Ticket per questa organizzazione', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/ja.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/ja.dict.itop-request-mgmt.php index 31509e13b..5d52c2674 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/ja.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/ja.dict.itop-request-mgmt.php @@ -1,15 +1,16 @@ 'ヘルプデスク', 'Menu:RequestManagement+' => '', 'Menu:RequestManagementProvider' => 'ヘルプデスクプロバイダー', @@ -45,7 +46,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Menu:UserRequest:MyWorkOrders+' => '', 'Class:Problem:KnownProblemList' => '既知の問題', 'Tickets:Related:OpenIncidents' => 'Open incidents~~', -)); +]); // Dictionnay conventions // Class: @@ -61,7 +62,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( // Class: UserRequest // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:UserRequest' => 'ユーザ要求', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => '状態', @@ -255,10 +256,9 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => '承認待ち', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Cannot assign the Parent request to the request itself~~', -)); +]); - -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Portal:TitleDetailsFor_Request' => '要求の詳細', 'Portal:ButtonUpdate' => '更新', 'Portal:ButtonClose' => 'クローズ', @@ -283,11 +283,10 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Portal:ChooseYourFavoriteLanguage' => 'お好みの言語を選択ください', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascade the resolution to child requests (ev_autoresolve), and align the following characteristics of the request: service, team, agent, resolution info~~', -)); +]); - -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Organization:Overview:UserRequests' => 'User Requests from this organization~~', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organization~~', 'Organization:Overview:Tickets' => 'Tickets for this organization~~', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/nl.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/nl.dict.itop-request-mgmt.php index 728794b78..a90eb57b5 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/nl.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/nl.dict.itop-request-mgmt.php @@ -1,17 +1,18 @@ * @author Jeffrey Bostoen (2018 - 2022) * @author Thomas Casteleyn */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:RequestManagement' => 'Helpdesk', 'Menu:RequestManagement+' => 'Helpdesk', 'Menu:RequestManagementProvider' => 'Helpdesk leverancier', @@ -47,7 +48,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Menu:UserRequest:MyWorkOrders+' => 'Alle werkopdrachten toegewezen aan mij', 'Class:Problem:KnownProblemList' => 'Gekende fouten', 'Tickets:Related:OpenIncidents' => 'Open incidenten', -)); +]); // Dictionnay conventions // Class: @@ -63,7 +64,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( // Class: UserRequest // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:UserRequest' => 'Gebruikersverzoek', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -257,10 +258,9 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Wacht op goedkeuring', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Kan het verzoek niet als hoofdverzoek toewijzen aan zichzelf', -)); +]); - -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Portal:TitleDetailsFor_Request' => 'Details van het verzoek', 'Portal:ButtonUpdate' => 'Wijzig', 'Portal:ButtonClose' => 'Sluit', @@ -285,11 +285,10 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Portal:ChooseYourFavoriteLanguage' => 'Kies je voorkeurstaal', 'Class:UserRequest/Method:ResolveChildTickets' => 'Los subverzoeken op', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Pas de oplossing ook toe op subverzoeken (ev_autoresolve) en neem de kenmerken over wat betreft service, team, agent, oplossing', -)); +]); - -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Organization:Overview:UserRequests' => 'Gebruikersverzoeken van deze organisatie', 'Organization:Overview:MyUserRequests' => 'Mijn gebruikersverzoeken voor deze organisatie', 'Organization:Overview:Tickets' => 'Tickets voor deze organisatie', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/pl.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/pl.dict.itop-request-mgmt.php index 429605876..e4ce13985 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/pl.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/pl.dict.itop-request-mgmt.php @@ -1,15 +1,16 @@ 'Pomoc techniczna', 'Menu:RequestManagement+' => 'Pomoc techniczna', 'Menu:RequestManagementProvider' => 'Dostawca pomocy technicznej', @@ -45,7 +46,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Menu:UserRequest:MyWorkOrders+' => 'Wszystkie zlecenia pracy przydzielone do mnie', 'Class:Problem:KnownProblemList' => 'Znane problemy', 'Tickets:Related:OpenIncidents' => 'Otwarte incydenty', -)); +]); // Dictionnay conventions // Class: @@ -61,7 +62,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( // Class: UserRequest // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:UserRequest' => 'Zgłoszenie użytkownika', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -255,10 +256,9 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Do zatwierdzenia', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Nie można przypisać zgłoszenia nadrzędnego do samego siebie', -)); +]); - -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Portal:TitleDetailsFor_Request' => 'Szczegóły zgłoszenia', 'Portal:ButtonUpdate' => 'Aktualizuj', 'Portal:ButtonClose' => 'Zamknij', @@ -283,11 +283,10 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Portal:ChooseYourFavoriteLanguage' => 'Wybierz swój ulubiony język', 'Class:UserRequest/Method:ResolveChildTickets' => 'Rozpatrz zgłoszenia podrzędne', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Połącz rozwiązanie kaskadowo do żądań podrzędnych (ev_autoresolve) i dopasuj następujące cechy zgłoszenia: usługa, zespół, agent, informacje o rozwiązaniu', -)); +]); - -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Organization:Overview:UserRequests' => 'User Requests from this organization', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organization', 'Organization:Overview:Tickets' => 'Tickets for this organization', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/pt_br.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/pt_br.dict.itop-request-mgmt.php index 6fc9345f6..e90952fe3 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/pt_br.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/pt_br.dict.itop-request-mgmt.php @@ -1,15 +1,16 @@ 'Gerenciamento de Solicitações', 'Menu:RequestManagement+' => 'Gerenciamento de Solicitações', 'Menu:RequestManagementProvider' => 'Solicitações a provedores', @@ -45,7 +46,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Menu:UserRequest:MyWorkOrders+' => 'Todas as ordens de serviço atribuídas a mim', 'Class:Problem:KnownProblemList' => 'Problemas conhecidos', 'Tickets:Related:OpenIncidents' => 'Incidentes abertos', -)); +]); // Dictionnay conventions // Class: @@ -61,7 +62,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( // Class: UserRequest // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:UserRequest' => 'Solicitação de Usuário', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Status', @@ -255,10 +256,9 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Aguardar por aprovação', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Não é possível atribuir a solicitação pai a própria solicitação', -)); +]); - -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Portal:TitleDetailsFor_Request' => 'Detalhes da solicitação', 'Portal:ButtonUpdate' => 'Atualizado', 'Portal:ButtonClose' => 'Fechado', @@ -283,11 +283,10 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Portal:ChooseYourFavoriteLanguage' => 'Escolha seu idioma favorito', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Conecte a solução a pedidos filhos (ev_autoresolve) e alinhe as seguintes características da requisição: serviço, equipe, agente, info de solução', -)); +]); - -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Organization:Overview:UserRequests' => 'Solicitações de usuários desta organização', 'Organization:Overview:MyUserRequests' => 'Minhas solicitações de usuário para esta organização', 'Organization:Overview:Tickets' => 'Solicitações desta organização', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/ru.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/ru.dict.itop-request-mgmt.php index 3a5f43114..331726504 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/ru.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/ru.dict.itop-request-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:RequestManagement' => 'Helpdesk', 'Menu:RequestManagement+' => 'Helpdesk', 'Menu:RequestManagementProvider' => 'Поставщик техподдержки', @@ -46,7 +47,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Menu:UserRequest:MyWorkOrders+' => 'Назначенные мне наряды на работу', 'Class:Problem:KnownProblemList' => 'Известные проблемы', 'Tickets:Related:OpenIncidents' => 'Открытые инциденты', -)); +]); // Dictionnay conventions // Class: @@ -62,7 +63,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( // Class: UserRequest // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:UserRequest' => 'Запрос', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => 'Статус', @@ -256,10 +257,9 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Ждать утверждения', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Невозможно назначить этот же запрос в качестве родительского', -)); +]); - -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Portal:TitleDetailsFor_Request' => 'Детали запроса', 'Portal:ButtonUpdate' => 'Обновить', 'Portal:ButtonClose' => 'Закрыть', @@ -284,11 +284,10 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Portal:ChooseYourFavoriteLanguage' => 'Выберите язык', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Каскадное решение дочерних запросов (ev_autoresolve) с установкой следующих параметров: услуга, команда, агент, информация о решении.', -)); +]); - -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Organization:Overview:UserRequests' => 'Запросы пользователей этой организации', 'Organization:Overview:MyUserRequests' => 'Мои запросы пользователей этой организации', 'Organization:Overview:Tickets' => 'Тикеты этой организации', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/sk.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/sk.dict.itop-request-mgmt.php index 041e57e0d..776bfdaf8 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/sk.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/sk.dict.itop-request-mgmt.php @@ -1,15 +1,16 @@ 'Helpdesk', 'Menu:RequestManagement+' => '~~', 'Menu:RequestManagementProvider' => 'Poskytovateľ Helpdesku', @@ -45,7 +46,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Menu:UserRequest:MyWorkOrders+' => 'All work orders assigned to me~~', 'Class:Problem:KnownProblemList' => 'Známe problémy', 'Tickets:Related:OpenIncidents' => 'Open incidents~~', -)); +]); // Dictionnay conventions // Class: @@ -61,7 +62,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( // Class: UserRequest // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:UserRequest' => 'Požiadavka užívateľa', 'Class:UserRequest+' => '~~', 'Class:UserRequest/Attribute:status' => 'Stav', @@ -255,10 +256,9 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Počkať na schválenie', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '~~', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Cannot assign the Parent request to the request itself~~', -)); +]); - -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Portal:TitleDetailsFor_Request' => 'Detaily pre požiadavky', 'Portal:ButtonUpdate' => 'Aktualizácia', 'Portal:ButtonClose' => 'Zatvoriť', @@ -283,11 +283,10 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Portal:ChooseYourFavoriteLanguage' => 'Vyberte si svoj obľúbený jazyk', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascade the resolution to child requests (ev_autoresolve), and align the following characteristics of the request: service, team, agent, resolution info~~', -)); +]); - -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Organization:Overview:UserRequests' => 'User Requests from this organization~~', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organization~~', 'Organization:Overview:Tickets' => 'Tickets for this organization~~', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/tr.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/tr.dict.itop-request-mgmt.php index 2a1c8a3b9..4fe7a21fa 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/tr.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/tr.dict.itop-request-mgmt.php @@ -1,15 +1,16 @@ 'Helpdesk~~', 'Menu:RequestManagement+' => '', 'Menu:RequestManagementProvider' => 'Helpdesk provider~~', @@ -45,7 +46,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Menu:UserRequest:MyWorkOrders+' => 'All work orders assigned to me~~', 'Class:Problem:KnownProblemList' => 'Known problems~~', 'Tickets:Related:OpenIncidents' => 'Open incidents~~', -)); +]); // Dictionnay conventions // Class: @@ -61,7 +62,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( // Class: UserRequest // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:UserRequest' => 'User Request~~', 'Class:UserRequest+' => '~~', 'Class:UserRequest/Attribute:status' => 'Status~~', @@ -255,10 +256,9 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => 'Wait for approval~~', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '~~', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => 'Cannot assign the Parent request to the request itself~~', -)); +]); - -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Portal:TitleDetailsFor_Request' => 'Details for request~~', 'Portal:ButtonUpdate' => 'Update~~', 'Portal:ButtonClose' => 'Close~~', @@ -283,11 +283,10 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Portal:ChooseYourFavoriteLanguage' => 'Choose your favorite language~~', 'Class:UserRequest/Method:ResolveChildTickets' => 'ResolveChildTickets~~', 'Class:UserRequest/Method:ResolveChildTickets+' => 'Cascade the resolution to child requests (ev_autoresolve), and align the following characteristics of the request: service, team, agent, resolution info~~', -)); +]); - -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Organization:Overview:UserRequests' => 'User Requests from this organization~~', 'Organization:Overview:MyUserRequests' => 'My User Requests for this organization~~', 'Organization:Overview:Tickets' => 'Tickets for this organization~~', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/dictionaries/zh_cn.dict.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/dictionaries/zh_cn.dict.itop-request-mgmt.php index 6e02316b3..a60f406f6 100644 --- a/datamodels/2.x/itop-request-mgmt/dictionaries/zh_cn.dict.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/dictionaries/zh_cn.dict.itop-request-mgmt.php @@ -1,9 +1,10 @@ '服务台', 'Menu:RequestManagement+' => '', 'Menu:RequestManagementProvider' => '服务台供应商', @@ -39,7 +40,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Menu:UserRequest:MyWorkOrders+' => '分配给我的所有工单', 'Class:Problem:KnownProblemList' => '已知问题', 'Tickets:Related:OpenIncidents' => '打开的事件', -)); +]); // Dictionnay conventions // Class: @@ -55,7 +56,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( // Class: UserRequest // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:UserRequest' => '用户需求', 'Class:UserRequest+' => '', 'Class:UserRequest/Attribute:status' => '状态', @@ -249,10 +250,9 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:UserRequest/Stimulus:ev_wait_for_approval' => '等待审核', 'Class:UserRequest/Stimulus:ev_wait_for_approval+' => '', 'Class:UserRequest/Error:CannotAssignParentRequestIdToSelf' => '不能分配父级需求给自己', -)); +]); - -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Portal:TitleDetailsFor_Request' => '需求详情', 'Portal:ButtonUpdate' => '更新', 'Portal:ButtonClose' => '关闭', @@ -277,11 +277,10 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Portal:ChooseYourFavoriteLanguage' => '选择您喜欢的语言', 'Class:UserRequest/Method:ResolveChildTickets' => '解决子工单', 'Class:UserRequest/Method:ResolveChildTickets+' => '递归解决子工单 (自动解决), 并调整相关字段与父级工单保持一致: 服务, 团队, 办理人, 解决方案', -)); +]); - -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Organization:Overview:UserRequests' => '来自此组织的用户需求', 'Organization:Overview:MyUserRequests' => '我在此组织的用户需求', 'Organization:Overview:Tickets' => '来自此组织的工单', -)); +]); diff --git a/datamodels/2.x/itop-request-mgmt/module.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/module.itop-request-mgmt.php index f2bbbefc7..0db19fb9a 100755 --- a/datamodels/2.x/itop-request-mgmt/module.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/module.itop-request-mgmt.php @@ -1,10 +1,9 @@ 'Simple Ticket Management', @@ -12,24 +11,24 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-tickets/2.4.0', - ), + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array( + 'datamodel' => [ 'main.itop-request-mgmt.php', - ), - 'data.struct' => array( + ], + 'data.struct' => [ - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.itop-request-mgmt.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -37,7 +36,7 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/cs.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/cs.dict.itop-service-mgmt-provider.php index d08735476..91f33927a 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/cs.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/cs.dict.itop-service-mgmt-provider.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:ServiceManagement' => 'Správa služeb', 'Menu:ServiceManagement+' => 'Přehled správy služeb', 'Menu:Service:Overview' => 'Přehled', @@ -40,7 +41,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Contract:baseinfo' => 'Obecné informace', 'Contract:moreinfo' => 'Smluvní informace', 'Contract:cost' => 'Informace o nákladech', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -55,30 +56,27 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( // Class: Organization // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Model poskytování služeb', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => 'Název modelu poskytování služeb', 'Class:Organization/Attribute:deliverymodel_name+' => '', -)); - - +]); // // Class: ContractType // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ContractType' => 'Typ smlouvy', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Contract' => 'Smlouva', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Název', @@ -127,13 +125,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Contract/Attribute:status/Value:production+' => '', 'Class:Contract/Attribute:finalclass' => 'Typ', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:CustomerContract' => 'Smlouva se zákazníkem', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Služby', @@ -142,13 +140,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'Všechny konfigurační položky pokryté touto smlouvou', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Smlouvy s poskytovateli', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'Všechny smlouvy s poskytovatelem na dodávky služeb pro tuto smlouvu (podpůrná smlouva - UC)', -)); +]); // // Class: ProviderContract // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ProviderContract' => 'Smlouva s poskytovatelem', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'Konfigurační položky', @@ -157,13 +155,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:ProviderContract/Attribute:sla+' => 'Dohoda o úrovni služeb', 'Class:ProviderContract/Attribute:coverage' => 'Servisní hodiny', 'Class:ProviderContract/Attribute:coverage+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkContactToContract' => 'Spojení (Kontakt / Smlouva)', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -175,13 +173,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Název kontaktu', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkContractToDocument' => 'Spojení (Smlouva / Dokument)', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -193,13 +191,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Název dokumentu', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkFunctionalCIToProviderContract' => 'Spojení (Funkční konfigurační položka / Smlouva s poskytovatelem)', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -211,13 +209,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Název konfigurační položky', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ServiceFamily' => 'Balíček služeb', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Název', @@ -226,13 +224,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Služby', 'Class:ServiceFamily/Attribute:services_list+' => 'Všechny služby v této kategorii', -)); +]); // // Class: Service // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Service' => 'Služba', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -266,13 +264,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Service/Attribute:customercontracts_list+' => 'Všechny smlouvy se zákazníky, kteří zakoupili tuto službu', 'Class:Service/Attribute:servicesubcategories_list' => 'Podkategorie služeb', 'Class:Service/Attribute:servicesubcategories_list+' => 'Všechny podkategorie služeb pro tuto službu', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkDocumentToService' => 'Spojení (Dokument / Služba)', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -284,13 +282,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Název dokumentu', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkContactToService' => 'Spojení (Kontakt / Služba)', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -302,13 +300,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Název kontaktu', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ServiceSubcategory' => 'Podkategorie služeb', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -336,13 +334,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => '', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Název poskytovatele', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Poskytovatel', -)); +]); // // Class: SLA // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => 'Dohoda o úrovni služeb', 'Class:SLA/Attribute:name' => 'Název', @@ -358,13 +356,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:SLA/Attribute:customercontracts_list' => 'Smlouvy se zákazníky', 'Class:SLA/Attribute:customercontracts_list+' => 'Všechny smlouvy se zákazníky využívající tuto dohodu o úrovni služeb', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Nepodařilo se uložit spojení smlouvy se zákazníkem %1$s a služby %2$s : SLA již existují', -)); +]); // // Class: SLT // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => 'Cíl úrovně služeb', 'Class:SLT/Attribute:name' => 'Název', @@ -399,13 +397,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:SLT/Attribute:unit/Value:hours+' => '', 'Class:SLT/Attribute:unit/Value:minutes' => 'minuty', 'Class:SLT/Attribute:unit/Value:minutes+' => '', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkSLAToSLT' => 'Spojení (SLA / SLT)', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -427,13 +425,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Jednotka hodnoty SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkCustomerContractToService' => 'Spojení (Smlouva se zákazníkem / Služba)', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -449,13 +447,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'Název SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkCustomerContractToProviderContract' => 'Spojení (Smlouva se zákazníkem / Smlouva s poskytovatelem)', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s~~', @@ -467,13 +465,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Název smlouvy s poskytovatelem', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Spojení (Smlouva se zákazníkem / Funkční konfigurační položka)', 'Class:lnkCustomerContractToFunctionalCI+' => '', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -485,13 +483,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'Název konfigurační položky', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:DeliveryModel' => 'Model poskytování služeb', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Název', @@ -506,13 +504,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Všechny kontakty (Týmy a Osoby) pro tento model poskytování služeb', 'Class:DeliveryModel/Attribute:customers_list' => 'Zákazníci', 'Class:DeliveryModel/Attribute:customers_list+' => 'Všichni zákazníci využívající tento model poskytování služeb', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkDeliveryModelToContact' => 'Spojení (Model poskytování služeb / Kontakt)', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -528,35 +526,35 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Název role', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/da.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/da.dict.itop-service-mgmt-provider.php index fe184c255..6c11393de 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/da.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/da.dict.itop-service-mgmt-provider.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:ServiceManagement' => 'Service-Management', 'Menu:ServiceManagement+' => '', 'Menu:Service:Overview' => 'Oversigt', @@ -39,7 +40,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -54,30 +55,27 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( // Class: Organization // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Leverings model', 'Class:Organization/Attribute:deliverymodel_id+' => '~~', 'Class:Organization/Attribute:deliverymodel_name' => 'Leverings model navn', 'Class:Organization/Attribute:deliverymodel_name+' => '~~', -)); - - +]); // // Class: ContractType // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ContractType' => 'Kontrakt-Type', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Contract' => 'Kontrakt', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Navn', @@ -126,13 +124,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Contract/Attribute:status/Value:production+' => '', 'Class:Contract/Attribute:finalclass' => 'Kontrakttype', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:CustomerContract' => 'Kundekontrakt', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Ydelser', @@ -141,13 +139,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'All the configuration items covered by this contract~~', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Leverandørkontrakter', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'All the provider contracts to deliver the services for this contract (underpinning contract)~~', -)); +]); // // Class: ProviderContract // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ProviderContract' => 'Leverandørkontrakt', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CIs', @@ -156,13 +154,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:ProviderContract/Attribute:sla+' => '', 'Class:ProviderContract/Attribute:coverage' => 'Servicetider', 'Class:ProviderContract/Attribute:coverage+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkContactToContract' => 'Sammenhæng Kontakt/Kontrakt', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -174,13 +172,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Kontakt navn', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkContractToDocument' => 'Sammenhæng Kontrakt/Dokument', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -192,13 +190,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Dokument navn', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkFunctionalCIToProviderContract' => 'Sammenhæng FunctionalCI/Leverandørkontrakt', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -210,13 +208,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI navn', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ServiceFamily' => 'Ydelsesfamilie', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Navn', @@ -225,13 +223,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Ydelser', 'Class:ServiceFamily/Attribute:services_list+' => 'All the services in this category~~', -)); +]); // // Class: Service // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Service' => 'Ydelse', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -265,13 +263,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Service/Attribute:customercontracts_list+' => 'All the customer contracts that have purchased this service~~', 'Class:Service/Attribute:servicesubcategories_list' => 'Ydelses underkategorier', 'Class:Service/Attribute:servicesubcategories_list+' => 'All the sub categories for this service~~', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkDocumentToService' => 'Sammenhæng Dokument/Ydelse', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -283,13 +281,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Dokument navn', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkContactToService' => 'Sammenhæng Kontakt/Ydelse', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -301,13 +299,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Kontakt navn', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ServiceSubcategory' => 'Ydelses underkategori', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -335,13 +333,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => '', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Provider Name~~', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Provider~~', -)); +]); // // Class: SLA // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Navn', @@ -357,13 +355,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:SLA/Attribute:customercontracts_list' => 'Kundekontrakt', 'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracts using this SLA~~', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists~~', -)); +]); // // Class: SLT // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Navn', @@ -398,13 +396,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:SLT/Attribute:unit/Value:hours+' => '', 'Class:SLT/Attribute:unit/Value:minutes' => 'Minutter', 'Class:SLT/Attribute:unit/Value:minutes+' => '', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkSLAToSLT' => 'Sammenhæng SLA/SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -426,13 +424,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'SLT value unit~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkCustomerContractToService' => 'Sammenhæng Kundekontrakt/Ydelse', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -448,13 +446,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA-Navn', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkCustomerContractToProviderContract' => 'Sammenhæng Kundekontrakt/Leverandørkontrakt', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s~~', @@ -466,13 +464,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Leverandørkontrakt navn', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Sammenhæng Kundekontrakt/FunctionalCI', 'Class:lnkCustomerContractToFunctionalCI+' => '', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -484,13 +482,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'CI navn', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:DeliveryModel' => 'Leverings model', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Navn', @@ -505,13 +503,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'All the contacts (Teams and Persons) for this delivery model~~', 'Class:DeliveryModel/Attribute:customers_list' => 'Kunde', 'Class:DeliveryModel/Attribute:customers_list+' => 'All the customers having this delivering model~~', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkDeliveryModelToContact' => 'Sammenhæng Leveringsmodel/Kontakt', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -527,35 +525,35 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Rolle navn', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/de.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/de.dict.itop-service-mgmt-provider.php index 4019875c1..8cf90d427 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/de.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/de.dict.itop-service-mgmt-provider.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:ServiceManagement' => 'Service Management', 'Menu:ServiceManagement+' => 'Service-Management-Übersicht', 'Menu:Service:Overview' => 'Übersicht', @@ -39,7 +40,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Contract:baseinfo' => 'Allgemeine Informationen', 'Contract:moreinfo' => 'Vertragliche Informationen', 'Contract:cost' => 'Kosteninformation', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -54,30 +55,27 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( // Class: Organization // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Delivery-Modell', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => 'Delivery-Modell-Name', 'Class:Organization/Attribute:deliverymodel_name+' => '', -)); - - +]); // // Class: ContractType // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ContractType' => 'Vertrags-Typ', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Contract' => 'Vertrag', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Name', @@ -126,13 +124,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Contract/Attribute:status/Value:production+' => '', 'Class:Contract/Attribute:finalclass' => 'Vertragstyp', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:CustomerContract' => 'Kundenvertrag', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Services', @@ -141,13 +139,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'Alle unter diesen Vertrag fallenden CIs', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Provider-Verträge', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'Alle Provider-Verträge zur Erbringung der Dienstleistungen für diesen Vertrag (Underpinning Contracts)', -)); +]); // // Class: ProviderContract // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ProviderContract' => 'Provider-Vertrag', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CIs', @@ -156,13 +154,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ProviderContract/Attribute:sla+' => '', 'Class:ProviderContract/Attribute:coverage' => 'Servicezeiten', 'Class:ProviderContract/Attribute:coverage+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkContactToContract' => 'Verknüpfung Kontakt/Vertrag', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -174,13 +172,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Kontakt-Name', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkContractToDocument' => 'Verknüpfung Vertrag/Dokument', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -192,13 +190,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Dokument-Name', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkFunctionalCIToProviderContract' => 'Verknüpfung FunctionalCI/Provider-Vertrag', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -210,13 +208,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI-Name', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ServiceFamily' => 'Service-Familie', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Name', @@ -225,13 +223,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Services', 'Class:ServiceFamily/Attribute:services_list+' => 'Alle Services dieser Kategorie', -)); +]); // // Class: Service // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Service' => 'Service', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -265,13 +263,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Service/Attribute:customercontracts_list+' => 'Alle Kundenverträge, die diesen Service erworben haben', 'Class:Service/Attribute:servicesubcategories_list' => 'Service-Unterkategorien', 'Class:Service/Attribute:servicesubcategories_list+' => 'Alle Service-Unterkategorien für diesen Service', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkDocumentToService' => 'Verknüpfung Dokument/Service', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -283,13 +281,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Dokument-Name', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkContactToService' => 'Verknüpfung Kontakt/Service', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -301,13 +299,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Kontakt-Name', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ServiceSubcategory' => 'Service-Unterkategorie', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -335,13 +333,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => '', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Provider-Name', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Provider', -)); +]); // // Class: SLA // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Name', @@ -357,13 +355,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:SLA/Attribute:customercontracts_list' => 'Kundenverträge', 'Class:SLA/Attribute:customercontracts_list+' => 'Alle Kundenverträge, die diese SLA verwenden', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Die Verknüpfung zwischen Kundenvertrag %1$s und Service %2$s konnte nicht gespeichert werden: SLA existiert bereits', -)); +]); // // Class: SLT // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Name', @@ -398,13 +396,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:SLT/Attribute:unit/Value:hours+' => '', 'Class:SLT/Attribute:unit/Value:minutes' => 'Minuten', 'Class:SLT/Attribute:unit/Value:minutes+' => '', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkSLAToSLT' => 'Verknüpfung SLA/SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -426,13 +424,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => 'Zeit, nach der das SLT abläuft.', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'SLT Einheit', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkCustomerContractToService' => 'Verknüpfung Kundenvertrag/Service', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -448,13 +446,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA-Name', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkCustomerContractToProviderContract' => 'Verknüpfung Kunden-Vertrag/Provider-Vertrag', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s', @@ -466,13 +464,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Providervertrags-Name', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Verknüpfung Kunden-Vertrag/FunctionalCI', 'Class:lnkCustomerContractToFunctionalCI+' => '', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s', @@ -484,13 +482,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'CI-Name', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:DeliveryModel' => 'Delivery-Modell', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Name', @@ -505,13 +503,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Alle Kontakte (Teams and Person) für dieses Delivery-Modell', 'Class:DeliveryModel/Attribute:customers_list' => 'Kunden', 'Class:DeliveryModel/Attribute:customers_list+' => 'Alle Kunden mit diesem Delivery-Modell', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkDeliveryModelToContact' => 'Verknüpfung Delivery-Modell/Kontakt', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -527,35 +525,35 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Rollenname', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/en.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/en.dict.itop-service-mgmt-provider.php index 2910cfd1a..bf46e5200 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/en.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/en.dict.itop-service-mgmt-provider.php @@ -1,4 +1,5 @@ 'Service Management', 'Menu:ServiceManagement+' => 'Service Management Overview', 'Menu:Service:Overview' => 'Overview', @@ -65,7 +66,7 @@ Dict::Add('EN US', 'English', 'English', array( 'Contract:baseinfo' => 'General information', 'Contract:moreinfo' => 'Contractual information', 'Contract:cost' => 'Cost information', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -80,30 +81,27 @@ Dict::Add('EN US', 'English', 'English', array( // Class: Organization // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Delivery model', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => 'Delivery model name', 'Class:Organization/Attribute:deliverymodel_name+' => '', -)); - - +]); // // Class: ContractType // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ContractType' => 'Contract Type', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Contract' => 'Contract', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Name', @@ -152,13 +150,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Contract/Attribute:status/Value:production+' => 'production', 'Class:Contract/Attribute:finalclass' => 'Contract sub-class', 'Class:Contract/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: CustomerContract // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:CustomerContract' => 'Customer Contract', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Services', @@ -167,13 +165,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'All the configuration items covered by this contract', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Provider contracts', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'All the provider contracts to deliver the services for this contract (underpinning contract)', -)); +]); // // Class: ProviderContract // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ProviderContract' => 'Provider Contract', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CIs', @@ -182,13 +180,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:ProviderContract/Attribute:sla+' => 'Service Level Agreement', 'Class:ProviderContract/Attribute:coverage' => 'Service hours', 'Class:ProviderContract/Attribute:coverage+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkContactToContract' => 'Link Contact / Contract', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -200,13 +198,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Contact Name', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkContractToDocument' => 'Link Contract / Document', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -218,13 +216,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Document Name', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkFunctionalCIToProviderContract' => 'Link FunctionalCI / ProviderContract', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -236,13 +234,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI Name', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ServiceFamily' => 'Service Family', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Name', @@ -251,13 +249,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Services', 'Class:ServiceFamily/Attribute:services_list+' => 'All the services in this category', -)); +]); // // Class: Service // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Service' => 'Service', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -291,13 +289,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Service/Attribute:customercontracts_list+' => 'All the customer contracts that have purchased this service', 'Class:Service/Attribute:servicesubcategories_list' => 'Service sub categories', 'Class:Service/Attribute:servicesubcategories_list+' => 'All the sub categories for this service', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkDocumentToService' => 'Link Document / Service', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -309,13 +307,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Document Name', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkContactToService' => 'Link Contact / Service', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -327,13 +325,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Contact Name', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ServiceSubcategory' => 'Service Subcategory', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -361,13 +359,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => 'service request', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Provider Name', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Provider', -)); +]); // // Class: SLA // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Name', @@ -383,13 +381,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:SLA/Attribute:customercontracts_list' => 'Customer contracts', 'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracts using this SLA', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists', -)); +]); // // Class: SLT // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Name', @@ -424,13 +422,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:SLT/Attribute:unit/Value:hours+' => 'hours', 'Class:SLT/Attribute:unit/Value:minutes' => 'minutes', 'Class:SLT/Attribute:unit/Value:minutes+' => 'minutes', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkSLAToSLT' => 'Link SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -452,13 +450,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'SLT value unit', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkCustomerContractToService' => 'Link Customer Contract / Service', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -474,13 +472,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA Name', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkCustomerContractToProviderContract' => 'Link Customer Contract / Provider Contract', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s', @@ -492,13 +490,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Provider contract Name', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Link Customer Contract / FunctionalCI', 'Class:lnkCustomerContractToFunctionalCI+' => '', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s', @@ -510,13 +508,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'CI Name', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:DeliveryModel' => 'Delivery Model', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Name', @@ -531,13 +529,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'All the contacts (Teams and Persons) for this delivery model', 'Class:DeliveryModel/Attribute:customers_list' => 'Customers', 'Class:DeliveryModel/Attribute:customers_list+' => 'All the customers having this delivering model', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkDeliveryModelToContact' => 'Link DeliveryModel / Contact', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -553,35 +551,35 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Role name', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id', 'Class:lnkContactToContract/Attribute:customer_id+' => '', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id', 'Class:lnkContactToContract/Attribute:provider_id+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id', 'Class:lnkContractToDocument/Attribute:customer_id+' => '', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id', 'Class:lnkContractToDocument/Attribute:provider_id+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/en_gb.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/en_gb.dict.itop-service-mgmt-provider.php index e1266f8f3..03bf0e8b7 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/en_gb.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/en_gb.dict.itop-service-mgmt-provider.php @@ -1,4 +1,5 @@ 'Service Management', 'Menu:ServiceManagement+' => 'Service Management Overview', 'Menu:Service:Overview' => 'Overview', @@ -65,7 +66,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Contract:baseinfo' => 'General information', 'Contract:moreinfo' => 'Contractual information', 'Contract:cost' => 'Cost information', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -80,30 +81,27 @@ Dict::Add('EN GB', 'British English', 'British English', array( // Class: Organization // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Delivery model', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => 'Delivery model name', 'Class:Organization/Attribute:deliverymodel_name+' => '', -)); - - +]); // // Class: ContractType // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ContractType' => 'Contract Type', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Contract' => 'Contract', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Name', @@ -152,13 +150,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Contract/Attribute:status/Value:production+' => 'production', 'Class:Contract/Attribute:finalclass' => 'Contract sub-class', 'Class:Contract/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: CustomerContract // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:CustomerContract' => 'Customer Contract', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Services', @@ -167,13 +165,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'All the configuration items covered by this contract', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Provider contracts', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'All the provider contracts to deliver the services for this contract (underpinning contract)', -)); +]); // // Class: ProviderContract // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ProviderContract' => 'Provider Contract', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CIs', @@ -182,13 +180,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:ProviderContract/Attribute:sla+' => 'Service Level Agreement', 'Class:ProviderContract/Attribute:coverage' => 'Service hours', 'Class:ProviderContract/Attribute:coverage+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkContactToContract' => 'Link Contact / Contract', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -200,13 +198,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Contact Name', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkContractToDocument' => 'Link Contract / Document', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -218,13 +216,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Document Name', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkFunctionalCIToProviderContract' => 'Link FunctionalCI / ProviderContract', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -236,13 +234,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI Name', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ServiceFamily' => 'Service Family', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Name', @@ -251,13 +249,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Services', 'Class:ServiceFamily/Attribute:services_list+' => 'All the services in this category', -)); +]); // // Class: Service // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Service' => 'Service', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -291,13 +289,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Service/Attribute:customercontracts_list+' => 'All the customer contracts that have purchased this service', 'Class:Service/Attribute:servicesubcategories_list' => 'Service sub categories', 'Class:Service/Attribute:servicesubcategories_list+' => 'All the sub categories for this service', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkDocumentToService' => 'Link Document / Service', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -309,13 +307,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Document Name', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkContactToService' => 'Link Contact / Service', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -327,13 +325,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Contact Name', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ServiceSubcategory' => 'Service Subcategory', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -361,13 +359,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => 'service request', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Provider Name', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Provider', -)); +]); // // Class: SLA // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Name', @@ -383,13 +381,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:SLA/Attribute:customercontracts_list' => 'Customer contracts', 'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracts using this SLA', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists', -)); +]); // // Class: SLT // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Name', @@ -424,13 +422,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:SLT/Attribute:unit/Value:hours+' => 'hours', 'Class:SLT/Attribute:unit/Value:minutes' => 'minutes', 'Class:SLT/Attribute:unit/Value:minutes+' => 'minutes', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkSLAToSLT' => 'Link SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -452,13 +450,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'SLT value unit', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkCustomerContractToService' => 'Link Customer Contract / Service', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -474,13 +472,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA Name', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkCustomerContractToProviderContract' => 'Link Customer Contract / Provider Contract', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s', @@ -492,13 +490,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Provider contract Name', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Link Customer Contract / FunctionalCI', 'Class:lnkCustomerContractToFunctionalCI+' => '', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s', @@ -510,13 +508,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'CI Name', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:DeliveryModel' => 'Delivery Model', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Name', @@ -531,13 +529,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'All the contacts (Teams and Persons) for this delivery model', 'Class:DeliveryModel/Attribute:customers_list' => 'Customers', 'Class:DeliveryModel/Attribute:customers_list+' => 'All the customers having this delivering model', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkDeliveryModelToContact' => 'Link DeliveryModel / Contact', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -553,4 +551,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Role name', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/es_cr.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/es_cr.dict.itop-service-mgmt-provider.php index 046e39336..e20a38e0d 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/es_cr.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/es_cr.dict.itop-service-mgmt-provider.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:ServiceManagement' => 'Administración de Servicios', 'Menu:ServiceManagement+' => 'Administración de Servicios', 'Menu:Service:Overview' => 'Resumen de Servicios', @@ -36,7 +37,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Contract:baseinfo' => 'Información General', 'Contract:moreinfo' => 'Información Contractual', 'Contract:cost' => 'Información de Costos', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -51,30 +52,27 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( // Class: Organization // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Modelo de Entrega', 'Class:Organization/Attribute:deliverymodel_id+' => 'Modelo de Entrega', 'Class:Organization/Attribute:deliverymodel_name' => 'Nombre del Modelo de Entrega', 'Class:Organization/Attribute:deliverymodel_name+' => 'Nombre del Modelo de Entrega', -)); - - +]); // // Class: ContractType // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ContractType' => 'Tipo de Contrato', 'Class:ContractType+' => 'Tipo de Contrato', -)); - +]); // // Class: Contract // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Contract' => 'Contrato', 'Class:Contract+' => 'Contrato', 'Class:Contract/Attribute:name' => 'Nombre', @@ -123,13 +121,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Contract/Attribute:status/Value:production+' => 'Productivo', 'Class:Contract/Attribute:finalclass' => 'Clase', 'Class:Contract/Attribute:finalclass+' => 'Clase', -)); +]); // // Class: CustomerContract // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:CustomerContract' => 'Acuerdo con Cliente', 'Class:CustomerContract+' => 'Acuerdo con Cliente', 'Class:CustomerContract/Attribute:services_list' => 'Servicios', @@ -138,13 +136,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'Elementos de Configuración', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Contratos con Proveedores', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'Contratos con Proveedores', -)); +]); // // Class: ProviderContract // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ProviderContract' => 'Contrato con Proveedor', 'Class:ProviderContract+' => 'Contrato con Proveedor', 'Class:ProviderContract/Attribute:functionalcis_list' => 'ECs', @@ -153,13 +151,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:ProviderContract/Attribute:sla+' => 'Acuerdo de Nivel de Servicio', 'Class:ProviderContract/Attribute:coverage' => 'Horario de Servicio', 'Class:ProviderContract/Attribute:coverage+' => 'Horario de Servicio', -)); +]); // // Class: lnkContactToContract // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkContactToContract' => 'Relación Contacto y Contrato', 'Class:lnkContactToContract+' => 'Relación Contacto y Contrato', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -171,13 +169,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkContactToContract/Attribute:contact_id+' => 'Contacto', 'Class:lnkContactToContract/Attribute:contact_name' => 'Contacto', 'Class:lnkContactToContract/Attribute:contact_name+' => 'Contacto', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkContractToDocument' => 'Relación Contrato y Documento', 'Class:lnkContractToDocument+' => 'Relación Contrato y Documento', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -189,13 +187,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkContractToDocument/Attribute:document_id+' => 'Documento', 'Class:lnkContractToDocument/Attribute:document_name' => 'Documento', 'Class:lnkContractToDocument/Attribute:document_name+' => 'Documento', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkFunctionalCIToProviderContract' => 'Relación EC Funcional y Contrato con Proveedor', 'Class:lnkFunctionalCIToProviderContract+' => 'Relación EC Funcional y Contrato con Proveedor', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -207,13 +205,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => 'Elemento de Configuración', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Elemento de Configuración', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => 'Elemento de Configuración', -)); +]); // // Class: ServiceFamily // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ServiceFamily' => 'Familia de Servicios', 'Class:ServiceFamily+' => 'Familia de Servicios', 'Class:ServiceFamily/Attribute:name' => 'Nombre', @@ -222,13 +220,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Servicios', 'Class:ServiceFamily/Attribute:services_list+' => 'Servicios', -)); +]); // // Class: Service // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Service' => 'Servicio', 'Class:Service+' => 'Servicio', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -262,13 +260,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Service/Attribute:customercontracts_list+' => 'Acuerdos con Clientes', 'Class:Service/Attribute:servicesubcategories_list' => 'Subcategorias de Servicio', 'Class:Service/Attribute:servicesubcategories_list+' => 'Subcategorias de Servicio', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkDocumentToService' => 'Relación Documento y Servicio', 'Class:lnkDocumentToService+' => 'Relación Documento y Servicio', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -280,13 +278,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkDocumentToService/Attribute:document_id+' => 'Documento', 'Class:lnkDocumentToService/Attribute:document_name' => 'Documento', 'Class:lnkDocumentToService/Attribute:document_name+' => 'Documento', -)); +]); // // Class: lnkContactToService // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkContactToService' => 'Relación Contacto y Servicio', 'Class:lnkContactToService+' => 'Relación Contacto y Servicio', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -298,13 +296,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkContactToService/Attribute:contact_id+' => 'Contacto', 'Class:lnkContactToService/Attribute:contact_name' => 'Contacto', 'Class:lnkContactToService/Attribute:contact_name+' => 'Contacto', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ServiceSubcategory' => 'Subcategoría', 'Class:ServiceSubcategory+' => 'Subcategoría', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -332,13 +330,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => 'Requerimiento de Servicio', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Nombre de Proveedor', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Proveedor', -)); +]); // // Class: SLA // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:SLA' => 'SLA - Acuerdo de Nivel de Servicio', 'Class:SLA+' => 'SLA - Acuerdo de Nivel de Servicio', 'Class:SLA/Attribute:name' => 'Nombre', @@ -354,13 +352,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:SLA/Attribute:customercontracts_list' => 'Acuerdos con Clientes', 'Class:SLA/Attribute:customercontracts_list+' => 'Acuerdos con Clientes', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'No se puede guardar la relación entre Acuerdo con Cliente %1$s y Servicio %2$s : El SLA ya existe', -)); +]); // // Class: SLT // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:SLT' => 'SLT - Objetivos de Nivel de Servicio', 'Class:SLT+' => 'SLT - Objetivos de Nivel de Servicio', 'Class:SLT/Attribute:name' => 'Nombre', @@ -395,13 +393,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:SLT/Attribute:unit/Value:hours+' => 'Horas', 'Class:SLT/Attribute:unit/Value:minutes' => 'Minutos', 'Class:SLT/Attribute:unit/Value:minutes+' => 'Minutos', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkSLAToSLT' => 'Relación SLA y SLT', 'Class:lnkSLAToSLT+' => 'Relación SLA y SLT', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -423,13 +421,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => 'Valor de SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Unidad de valor de SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => 'Unidad de valor de SLT', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkCustomerContractToService' => 'Relación Acuerdo con Cliente y Servicio', 'Class:lnkCustomerContractToService+' => 'Relación Acuerdo con Cliente y Servicio', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -445,13 +443,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => 'SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => 'SLA', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkCustomerContractToProviderContract' => 'Relación Acuerdo con Cliente y Contrato con Proveedor', 'Class:lnkCustomerContractToProviderContract+' => 'Relación Acuerdo con Cliente y Contrato con Proveedor', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s', @@ -463,13 +461,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => 'Contrato con Proveedor', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Contrato con Proveedor', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => 'Contrato con Proveedor', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Relación Acuerdo con Cliente y EC Funcional', 'Class:lnkCustomerContractToFunctionalCI+' => 'Relación Acuerdo con Cliente y EC Funcional', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s', @@ -481,13 +479,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => 'Elemento de Configuración', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'Elemento de Configuración', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => 'Elemento de Configuración', -)); +]); // // Class: DeliveryModel // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:DeliveryModel' => 'Modelo de Entrega', 'Class:DeliveryModel+' => 'Modelo de Entrega', 'Class:DeliveryModel/Attribute:name' => 'Nombre', @@ -502,13 +500,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Contactos', 'Class:DeliveryModel/Attribute:customers_list' => 'Clientes', 'Class:DeliveryModel/Attribute:customers_list+' => 'Clientes', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkDeliveryModelToContact' => 'Relación Modelo de Entrega y Contacto', 'Class:lnkDeliveryModelToContact+' => 'Relación Modelo de Entrega y Contacto', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -524,35 +522,35 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => 'Rol', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Rol', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => 'Rol', -)); +]); // // Class: lnkContactToContract // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/fr.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/fr.dict.itop-service-mgmt-provider.php index c54cbe1d7..2b79959a3 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/fr.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/fr.dict.itop-service-mgmt-provider.php @@ -1,15 +1,16 @@ 'Gestion des services', 'Menu:ServiceManagement+' => '', 'Menu:Service:Overview' => 'Vue d\'ensemble', @@ -38,7 +39,7 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Contract:baseinfo' => 'Information générale', 'Contract:moreinfo' => 'Aspects contractuels', 'Contract:cost' => 'Coûts', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -53,30 +54,27 @@ Dict::Add('FR FR', 'French', 'Français', array( // Class: Organization // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Modèle de support', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => 'Nom modèle de support', 'Class:Organization/Attribute:deliverymodel_name+' => '', -)); - - +]); // // Class: ContractType // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ContractType' => 'Type de contrat', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Contract' => 'Contrat', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Nom', @@ -125,13 +123,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Contract/Attribute:status/Value:production+' => '', 'Class:Contract/Attribute:finalclass' => 'Sous-classe de Contrat', 'Class:Contract/Attribute:finalclass+' => 'Nom de la classe instanciable', -)); +]); // // Class: CustomerContract // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:CustomerContract' => 'Contrat client', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Services', @@ -140,13 +138,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'Tous les éléments de configuration couverts par ce contrat', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Contrats fournisseur', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'Tous les contrats fournisseurs permettant de délivrer ces services pour ce contrat (contrats sous-jacents)', -)); +]); // // Class: ProviderContract // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ProviderContract' => 'Contrat fournisseur', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CIs', @@ -155,13 +153,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:ProviderContract/Attribute:sla+' => 'Accord de niveau de service (SLA)', 'Class:ProviderContract/Attribute:coverage' => 'Couverture', 'Class:ProviderContract/Attribute:coverage+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkContactToContract' => 'Lien Contact / Contrat', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -173,13 +171,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Nom contact', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkContractToDocument' => 'Lien Contract / Document', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -191,13 +189,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Nom document', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkFunctionalCIToProviderContract' => 'Lien CI / Contrat fournisseur', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -209,13 +207,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Nom CI', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ServiceFamily' => 'Famille de service', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Nom', @@ -229,14 +227,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:ServiceFamily/Attribute:services_list/UI:Links:Delete:Button+' => 'Supprimer ce %4$s', 'Class:ServiceFamily/Attribute:services_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:ServiceFamily/Attribute:services_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', - 'Class:ServiceFamily/Attribute:services_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de sa %1$s' -)); + 'Class:ServiceFamily/Attribute:services_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de sa %1$s', +]); // // Class: Service // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Service' => 'Service', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -275,14 +273,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Service/Attribute:servicesubcategories_list/UI:Links:Delete:Button+' => 'Supprimer ce %4$s', 'Class:Service/Attribute:servicesubcategories_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:Service/Attribute:servicesubcategories_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', - 'Class:Service/Attribute:servicesubcategories_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s' -)); + 'Class:Service/Attribute:servicesubcategories_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s', +]); // // Class: lnkDocumentToService // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkDocumentToService' => 'Lien Document / Service', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -294,13 +292,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Nom document', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkContactToService' => 'Lien Contact / Service', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -312,13 +310,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Nom contact', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ServiceSubcategory' => 'Sous catégorie de service', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -346,13 +344,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => '', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Nom du fournisseur', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Fournisseur', -)); +]); // // Class: SLA // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:SLA' => 'Niveau de service', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Nom', @@ -368,13 +366,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:SLA/Attribute:customercontracts_list' => 'Contrats clients', 'Class:SLA/Attribute:customercontracts_list+' => 'Tous les contrats clients utilisant ce niveau de service', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Impossible de sauvegarder le lien avec le contrat client %1$s et le service %2$s : un SLA existe déjà.', -)); +]); // // Class: SLT // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => 'Objectif de niveau de service (SLT)', 'Class:SLT/Attribute:name' => 'Nom', @@ -409,13 +407,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:SLT/Attribute:unit/Value:hours+' => 'heures', 'Class:SLT/Attribute:unit/Value:minutes' => 'minutes', 'Class:SLT/Attribute:unit/Value:minutes+' => 'minutes', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkSLAToSLT' => 'Lien SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -437,13 +435,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Unité SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkCustomerContractToService' => 'Lien Contrat client / Service', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -459,13 +457,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'Nom SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkCustomerContractToProviderContract' => 'Lien Contrat client / Contrat fournisseur', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s', @@ -477,13 +475,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Nom Contrat fournisseur', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Lien Contrat client / CI', 'Class:lnkCustomerContractToFunctionalCI+' => '', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s', @@ -495,13 +493,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'Nom CI', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:DeliveryModel' => 'Modèle de support', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Nom Modèle de support', @@ -521,14 +519,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:DeliveryModel/Attribute:customers_list/UI:Links:Delete:Button+' => 'Supprimer ce %4$s', 'Class:DeliveryModel/Attribute:customers_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:DeliveryModel/Attribute:customers_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', - 'Class:DeliveryModel/Attribute:customers_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s' -)); + 'Class:DeliveryModel/Attribute:customers_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s', +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkDeliveryModelToContact' => 'Lien Modèle de support / Contact', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -544,35 +542,35 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Nom Rôle', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/hu.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/hu.dict.itop-service-mgmt-provider.php index 1e0466c65..4fd01f405 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/hu.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/hu.dict.itop-service-mgmt-provider.php @@ -1,15 +1,16 @@ 'Szolgáltatáskezelés', 'Menu:ServiceManagement+' => 'Service Management Overview~~', 'Menu:Service:Overview' => 'Áttekintő', @@ -38,7 +39,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -53,30 +54,27 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( // Class: Organization // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Teljesítési modell', 'Class:Organization/Attribute:deliverymodel_id+' => 'Ki kinek szolgáltat', 'Class:Organization/Attribute:deliverymodel_name' => 'Teljesítési modell név', 'Class:Organization/Attribute:deliverymodel_name+' => '~~', -)); - - +]); // // Class: ContractType // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ContractType' => 'Szerződés típus', 'Class:ContractType+' => '~~', -)); - +]); // // Class: Contract // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Contract' => 'Szerződés', 'Class:Contract+' => '~~', 'Class:Contract/Attribute:name' => 'Szerződés név', @@ -125,13 +123,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Contract/Attribute:status/Value:production+' => 'production~~', 'Class:Contract/Attribute:finalclass' => 'Szerződés típus', 'Class:Contract/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: CustomerContract // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:CustomerContract' => 'Ügyfélszerződés', 'Class:CustomerContract+' => '~~', 'Class:CustomerContract/Attribute:services_list' => 'Szolgáltatások', @@ -140,13 +138,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'Konfigurációs elemek amelyeket lefed ez a szerződés', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Szolgáltatói szerződések', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'Az összes szolgáltatói szerződés az e szerződéshez kapcsolódó szolgáltatások nyújtására (alapszerződés).', -)); +]); // // Class: ProviderContract // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ProviderContract' => 'Szolgáltatói szerződés', 'Class:ProviderContract+' => '~~', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CI-k', @@ -155,13 +153,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:ProviderContract/Attribute:sla+' => 'Szolgáltatásszint megállapodás', 'Class:ProviderContract/Attribute:coverage' => 'Szolgáltatás lefedettség', 'Class:ProviderContract/Attribute:coverage+' => '~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkContactToContract' => 'Kapcsolattartó / Szerződés', 'Class:lnkContactToContract+' => '~~', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -173,13 +171,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '~~', 'Class:lnkContactToContract/Attribute:contact_name' => 'Kapcsolattartó név', 'Class:lnkContactToContract/Attribute:contact_name+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkContractToDocument' => 'Szerződés / Dokumentum', 'Class:lnkContractToDocument+' => '~~', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -191,13 +189,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '~~', 'Class:lnkContractToDocument/Attribute:document_name' => 'Dokumentum név', 'Class:lnkContractToDocument/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkFunctionalCIToProviderContract' => 'Funkcionális CI / Szolgáltatói szerződés', 'Class:lnkFunctionalCIToProviderContract+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -209,13 +207,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => 'Konfigurációs elem, eszköz', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI név', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: ServiceFamily // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ServiceFamily' => 'Szolgáltatáscsalád', 'Class:ServiceFamily+' => '~~', 'Class:ServiceFamily/Attribute:name' => 'Név', @@ -224,13 +222,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:ServiceFamily/Attribute:icon+' => '~~', 'Class:ServiceFamily/Attribute:services_list' => 'Szolgáltatások', 'Class:ServiceFamily/Attribute:services_list+' => 'Szolgáltatások ebben a kategóriában', -)); +]); // // Class: Service // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Service' => 'Szolgáltatás', 'Class:Service+' => '~~', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -264,13 +262,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Service/Attribute:customercontracts_list+' => 'Ügyfélszerződések amelyeknek beszerezték ezt a szolgáltatást', 'Class:Service/Attribute:servicesubcategories_list' => 'Szolgáltatás alkategóriák', 'Class:Service/Attribute:servicesubcategories_list+' => 'A szolgáltatás alkategóriái', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkDocumentToService' => 'Dokumentum / Szolgáltatás', 'Class:lnkDocumentToService+' => '~~', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -282,13 +280,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '~~', 'Class:lnkDocumentToService/Attribute:document_name' => 'Dokumentum név', 'Class:lnkDocumentToService/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkContactToService // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkContactToService' => 'Kapcsolattartó / Szolgáltatás', 'Class:lnkContactToService+' => '~~', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -300,13 +298,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkContactToService/Attribute:contact_id+' => '~~', 'Class:lnkContactToService/Attribute:contact_name' => 'Kapcsolattartó név', 'Class:lnkContactToService/Attribute:contact_name+' => '~~', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ServiceSubcategory' => 'Szolgáltatás alkategória', 'Class:ServiceSubcategory+' => '~~', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -334,13 +332,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => '', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Szolgáltató név', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Szolgáltató', -)); +]); // // Class: SLA // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'SLA név', @@ -356,13 +354,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:SLA/Attribute:customercontracts_list' => 'Ügyfélszerződések', 'Class:SLA/Attribute:customercontracts_list+' => 'Ügyfélszerződések amelyek ezt az SLA-t használják', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Nem sikerült elmenteni a linket az Ügyfél szerződés %1$s és szolgáltatás %2$s : SLA már létezik', -)); +]); // // Class: SLT // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'SLT név', @@ -397,13 +395,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:SLT/Attribute:unit/Value:hours+' => '', 'Class:SLT/Attribute:unit/Value:minutes' => 'perc', 'Class:SLT/Attribute:unit/Value:minutes+' => '', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkSLAToSLT' => 'SLA / SLT', 'Class:lnkSLAToSLT+' => '~~', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -425,13 +423,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'SLT érték egység', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkCustomerContractToService' => 'Ügyfélszerződés / Szolgáltatás', 'Class:lnkCustomerContractToService+' => '~~', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -447,13 +445,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '~~', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA név', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '~~', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkCustomerContractToProviderContract' => 'Ügyfélszerződés / Szolgáltatói szerződés', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s~~', @@ -465,13 +463,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Szolgáltatói szerződés név', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Ügyfélszerződés / Funkcionális CI', 'Class:lnkCustomerContractToFunctionalCI+' => '~~', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -483,13 +481,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => 'Konfigurációs elem', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'CI név', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: DeliveryModel // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:DeliveryModel' => 'Teljesítési modell', 'Class:DeliveryModel+' => '~~', 'Class:DeliveryModel/Attribute:name' => 'Teljesítési modell név', @@ -504,13 +502,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'A teljesítési modell kapcsolattartói (személy, csapat)', 'Class:DeliveryModel/Attribute:customers_list' => 'Ügyfelek', 'Class:DeliveryModel/Attribute:customers_list+' => 'Ügyfelek, akik ezt a teljesítési modellt használják', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkDeliveryModelToContact' => 'Teljesítési modell / Kapcsolattartó', 'Class:lnkDeliveryModelToContact+' => '~~', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -526,35 +524,35 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '~~', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Szerepkör név', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/it.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/it.dict.itop-service-mgmt-provider.php index 222f528ed..e412016f2 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/it.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/it.dict.itop-service-mgmt-provider.php @@ -1,15 +1,16 @@ 'Gestione del Servizio', 'Menu:ServiceManagement+' => 'Panoramica della Gestione del Servizio', 'Menu:Service:Overview' => 'Panoramica', @@ -38,7 +39,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Contract:baseinfo' => 'Informazioni Generali', 'Contract:moreinfo' => 'Informazioni Contrattuali', 'Contract:cost' => 'Informazioni sui Costi', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -53,30 +54,27 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( // Class: Organization // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Modello di Consegna', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => 'Nome del Modello di Consegna', 'Class:Organization/Attribute:deliverymodel_name+' => '', -)); - - +]); // // Class: ContractType // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ContractType' => 'Tipo di Contratto', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Contract' => 'Contratto', 'Class:Contract+' => '~~', 'Class:Contract/Attribute:name' => 'Nome', @@ -125,13 +123,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Contract/Attribute:status/Value:production+' => 'Produzione', 'Class:Contract/Attribute:finalclass' => 'Tipo', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:CustomerContract' => 'Contratto con Cliente', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Servizi', @@ -140,13 +138,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'Tutti gli elementi di configurazione coperti da questo contratto', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Contratti con Provider', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'Tutti i contratti con i provider per la fornitura dei servizi di questo contratto (contratto sottostante)', -)); +]); // // Class: ProviderContract // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ProviderContract' => 'Contratto con Fornitore', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'Elementi di Configurazione', @@ -155,13 +153,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:ProviderContract/Attribute:sla+' => 'Accordo di Livello di Servizio', 'Class:ProviderContract/Attribute:coverage' => 'Copertura Oraria', 'Class:ProviderContract/Attribute:coverage+' => 'Ore di Servizio', -)); +]); // // Class: lnkContactToContract // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkContactToContract' => 'Collegamento Contatto / Contratto', 'Class:lnkContactToContract+' => '~~', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -173,13 +171,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '~~', 'Class:lnkContactToContract/Attribute:contact_name' => 'Nome Contatto', 'Class:lnkContactToContract/Attribute:contact_name+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkContractToDocument' => 'Collegamento Contratto / Documento', 'Class:lnkContractToDocument+' => '~~', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -191,13 +189,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '~~', 'Class:lnkContractToDocument/Attribute:document_name' => 'Nome Documento', 'Class:lnkContractToDocument/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkFunctionalCIToProviderContract' => 'Collegamento FunctionalCI / Contratto Fornitore', 'Class:lnkFunctionalCIToProviderContract+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -209,13 +207,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Nome CI', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: ServiceFamily // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ServiceFamily' => 'Famiglia di Servizi', 'Class:ServiceFamily+' => '~~', 'Class:ServiceFamily/Attribute:name' => 'Nome', @@ -224,13 +222,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:ServiceFamily/Attribute:icon+' => '~~', 'Class:ServiceFamily/Attribute:services_list' => 'Servizi', 'Class:ServiceFamily/Attribute:services_list+' => 'Tutti i servizi in questa categoria', -)); +]); // // Class: Service // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Service' => 'Servizio', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -264,13 +262,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Service/Attribute:customercontracts_list+' => 'Tutti i contratti con il cliente che hanno acquistato questo servizio', 'Class:Service/Attribute:servicesubcategories_list' => 'Sottocategorie di servizio', 'Class:Service/Attribute:servicesubcategories_list+' => 'Tutte le sottocategorie per questo servizio', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkDocumentToService' => 'Collegamento Documento / Servizio', 'Class:lnkDocumentToService+' => '~~', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -282,13 +280,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '~~', 'Class:lnkDocumentToService/Attribute:document_name' => 'Nome del Documento', 'Class:lnkDocumentToService/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkContactToService // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkContactToService' => 'Collegamento Contatto / Servizio', 'Class:lnkContactToService+' => '~~', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -300,13 +298,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkContactToService/Attribute:contact_id+' => '~~', 'Class:lnkContactToService/Attribute:contact_name' => 'Nome del Contatto', 'Class:lnkContactToService/Attribute:contact_name+' => '~~', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ServiceSubcategory' => 'Sottocategoria del Servizio', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -334,13 +332,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => 'service request~~', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Provider del Servizio', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Provider', -)); +]); // // Class: SLA // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '~~', 'Class:SLA/Attribute:name' => 'Nome', @@ -356,13 +354,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:SLA/Attribute:customercontracts_list' => 'Contratti con i clienti', 'Class:SLA/Attribute:customercontracts_list+' => 'Tutti i contratti con i clienti che utilizzano questa SLA', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Impossibile salvare il collegamento con il contratto del cliente %1$s e il servizio %2$s: SLA già esistente', -)); +]); // // Class: SLT // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '~~', 'Class:SLT/Attribute:name' => 'Nome', @@ -397,13 +395,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:SLT/Attribute:unit/Value:hours+' => 'ore', 'Class:SLT/Attribute:unit/Value:minutes' => 'minuti', 'Class:SLT/Attribute:unit/Value:minutes+' => 'minuti', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkSLAToSLT' => 'Link SLA / SLT', 'Class:lnkSLAToSLT+' => '~~', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -425,13 +423,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Unità di misura del valore SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkCustomerContractToService' => 'Collegamento Contratto Cliente / Servizio', 'Class:lnkCustomerContractToService+' => '~~', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -447,13 +445,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '~~', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'Nome SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '~~', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkCustomerContractToProviderContract' => 'Collegamento Contratto Cliente / Contratto Provider', 'Class:lnkCustomerContractToProviderContract+' => '~~', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s', @@ -465,13 +463,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '~~', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Nome Contratto Provider', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '~~', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Collegamento Contratto Cliente / CI Funzionale', 'Class:lnkCustomerContractToFunctionalCI+' => '~~', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s', @@ -483,13 +481,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '~~', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'Nome CI', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: DeliveryModel // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:DeliveryModel' => 'Modello di Delivery', 'Class:DeliveryModel+' => '~~', 'Class:DeliveryModel/Attribute:name' => 'Nome', @@ -504,13 +502,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Tutti i contatti (team e persone) per questo modello di Consegna', 'Class:DeliveryModel/Attribute:customers_list' => 'Clienti', 'Class:DeliveryModel/Attribute:customers_list+' => 'Tutti i clienti che hanno questo modello di Consegna', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkDeliveryModelToContact' => 'Collegamento Modello di Delivery / Contatto', 'Class:lnkDeliveryModelToContact+' => '~~', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -526,35 +524,35 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '~~', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Nome del Ruolo', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/ja.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/ja.dict.itop-service-mgmt-provider.php index cef1cd3b6..00bf202f7 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/ja.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/ja.dict.itop-service-mgmt-provider.php @@ -1,15 +1,16 @@ 'サービス管理', 'Menu:ServiceManagement+' => '', 'Menu:Service:Overview' => '概要', @@ -38,7 +39,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -53,30 +54,27 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( // Class: Organization // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Organization/Attribute:deliverymodel_id' => '提供モデル', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => '提供モデル名', 'Class:Organization/Attribute:deliverymodel_name+' => '', -)); - - +]); // // Class: ContractType // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ContractType' => '契約タイプ', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Contract' => '契約', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => '名前', @@ -125,13 +123,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Contract/Attribute:status/Value:production+' => '', 'Class:Contract/Attribute:finalclass' => '契約タイプ', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:CustomerContract' => '顧客契約', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'サービス', @@ -140,13 +138,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'All the configuration items covered by this contract~~', 'Class:CustomerContract/Attribute:providercontracts_list' => 'プロバイダー契約', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'All the provider contracts to deliver the services for this contract (underpinning contract)~~', -)); +]); // // Class: ProviderContract // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ProviderContract' => 'プロバイダー契約', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CI', @@ -155,13 +153,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:ProviderContract/Attribute:sla+' => '', 'Class:ProviderContract/Attribute:coverage' => 'サービス時間帯', 'Class:ProviderContract/Attribute:coverage+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkContactToContract' => 'リンク 連絡先/契約', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -173,13 +171,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => '連絡先名', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkContractToDocument' => 'リンク 契約/文書', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -191,13 +189,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => '文書名', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkFunctionalCIToProviderContract' => 'リンク 機能的CI/プロバイダー契約', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -209,13 +207,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI名', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ServiceFamily' => 'サービスファミリ', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => '名前', @@ -224,13 +222,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'サービス', 'Class:ServiceFamily/Attribute:services_list+' => 'All the services in this category~~', -)); +]); // // Class: Service // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Service' => 'サービス', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -264,13 +262,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Service/Attribute:customercontracts_list+' => 'All the customer contracts that have purchased this service~~', 'Class:Service/Attribute:servicesubcategories_list' => 'サービスサブカテゴリ', 'Class:Service/Attribute:servicesubcategories_list+' => 'All the sub categories for this service~~', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkDocumentToService' => 'リンク 文書/サービス', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -282,13 +280,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => '文書名', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkContactToService' => 'リンク 連絡先/サービス', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -300,13 +298,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => '連絡先名', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ServiceSubcategory' => 'サービスサブカテゴリ', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -334,13 +332,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => '', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Provider Name~~', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Provider~~', -)); +]); // // Class: SLA // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => '名前', @@ -356,13 +354,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:SLA/Attribute:customercontracts_list' => '顧客契約', 'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracts using this SLA~~', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists~~', -)); +]); // // Class: SLT // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => '名前', @@ -397,13 +395,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:SLT/Attribute:unit/Value:hours+' => '', 'Class:SLT/Attribute:unit/Value:minutes' => '分', 'Class:SLT/Attribute:unit/Value:minutes+' => '', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkSLAToSLT' => 'リンク SLA/SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -425,13 +423,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'SLT value unit~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkCustomerContractToService' => 'リンク 顧客契約/サービス', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -447,13 +445,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA名', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkCustomerContractToProviderContract' => 'リンク 顧客契約/プロバイダー契約', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s~~', @@ -465,13 +463,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'プロバイダー契約名', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkCustomerContractToFunctionalCI' => 'リンク 顧客契約/機能的CI', 'Class:lnkCustomerContractToFunctionalCI+' => '', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -483,13 +481,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'CI名', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:DeliveryModel' => '提供モデル', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => '名前', @@ -504,13 +502,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'All the contacts (Teams and Persons) for this delivery model~~', 'Class:DeliveryModel/Attribute:customers_list' => '顧客', 'Class:DeliveryModel/Attribute:customers_list+' => 'All the customers having this delivering model~~', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkDeliveryModelToContact' => 'リンク 提供モデル/契約', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -526,35 +524,35 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => '役割名', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/nl.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/nl.dict.itop-service-mgmt-provider.php index 76f9b29ec..1f45e8bc8 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/nl.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/nl.dict.itop-service-mgmt-provider.php @@ -1,17 +1,18 @@ * @author Jeffrey Bostoen (2018 - 2022) * @author Thomas Casteleyn */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:ServiceManagement' => 'Service Management', 'Menu:ServiceManagement+' => 'Overzicht van Service Management', 'Menu:Service:Overview' => 'Overzicht', @@ -40,7 +41,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Contract:baseinfo' => 'Algemene informatie', 'Contract:moreinfo' => 'Contractuele informatie', 'Contract:cost' => 'Financiële informatie', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -55,30 +56,27 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( // Class: Organization // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Leveringsmodel', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => 'Naam leveringsmodel', 'Class:Organization/Attribute:deliverymodel_name+' => '', -)); - - +]); // // Class: ContractType // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ContractType' => 'Soort contract', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Contract' => 'Contract', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Naam', @@ -127,13 +125,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Contract/Attribute:status/Value:production+' => 'Productie', 'Class:Contract/Attribute:finalclass' => 'Subklasse Contract', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:CustomerContract' => 'Klantencontract', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Services', @@ -142,13 +140,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'Alle configuratie-items die onder dit contract vallen', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Leverancierscontracten', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'Alle leverancierscontracten die services leveren voor dit contract (onderliggend)', -)); +]); // // Class: ProviderContract // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ProviderContract' => 'Leverancierscontract', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CI\'s', @@ -157,13 +155,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:ProviderContract/Attribute:sla+' => 'Service Level Agreement', 'Class:ProviderContract/Attribute:coverage' => 'Werkuren', 'Class:ProviderContract/Attribute:coverage+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkContactToContract' => 'Link Contact / Contract', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -175,13 +173,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Naam contact', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkContractToDocument' => 'Link Contract / Document', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -193,13 +191,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Naam document', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkFunctionalCIToProviderContract' => 'Link Functioneel CI / Leverancierscontract', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -211,13 +209,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Naam CI', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ServiceFamily' => 'Servicecategorie', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Naam', @@ -226,13 +224,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Services', 'Class:ServiceFamily/Attribute:services_list+' => 'Alle services in deze categorie', -)); +]); // // Class: Service // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Service' => 'Service', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -266,13 +264,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Service/Attribute:customercontracts_list+' => 'Alle klantencontracten die deze service hebben aangeschaft', 'Class:Service/Attribute:servicesubcategories_list' => 'Subcategorieën service', 'Class:Service/Attribute:servicesubcategories_list+' => 'Alle subcategorieën van deze service', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkDocumentToService' => 'Link Document / Service', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -284,13 +282,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Naam document', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkContactToService' => 'Link Contact / Service', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -302,13 +300,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Naam contact', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ServiceSubcategory' => 'Subcategorie service', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -336,13 +334,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => 'Serviceverzoek', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Naam service-rovider', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Service-provider', -)); +]); // // Class: SLA // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Naam', @@ -358,13 +356,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:SLA/Attribute:customercontracts_list' => 'Klantencontracten', 'Class:SLA/Attribute:customercontracts_list+' => 'Alle klantencontracten die gebruik maken van deze SLA', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Kan de link tussen klantencontract %1$s en service %2$s niet opslaan: SLA bestaat al.', -)); +]); // // Class: SLT // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Naam', @@ -399,13 +397,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:SLT/Attribute:unit/Value:hours+' => 'uren', 'Class:SLT/Attribute:unit/Value:minutes' => 'minuten', 'Class:SLT/Attribute:unit/Value:minutes+' => 'minuten', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkSLAToSLT' => 'Link SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -427,13 +425,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Eenheid SLT-waarde', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkCustomerContractToService' => 'Link Klantencontract / Service', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -449,13 +447,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'Naam SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkCustomerContractToProviderContract' => 'Link Klantencontract / Leverancierscontract', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s', @@ -467,13 +465,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Naam Leverancierscontract', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Link Klantencontract / Functioneel CI', 'Class:lnkCustomerContractToFunctionalCI+' => '', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s', @@ -485,13 +483,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'Naam CI', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:DeliveryModel' => 'Leveringsmodel', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Naam', @@ -506,13 +504,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Alle contacten (teams en personen) voor dit leveringsmodel', 'Class:DeliveryModel/Attribute:customers_list' => 'Klanten', 'Class:DeliveryModel/Attribute:customers_list+' => 'Alle klanten die gebruik maken van dit leveringsmodel', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkDeliveryModelToContact' => 'Link Leveringsmodel / Contact', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -528,35 +526,35 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Naam rol', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/pl.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/pl.dict.itop-service-mgmt-provider.php index d29c6928a..f98905217 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/pl.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/pl.dict.itop-service-mgmt-provider.php @@ -1,15 +1,16 @@ 'Zarządzanie usługami', 'Menu:ServiceManagement+' => 'Omówienie zarządzania usługami', 'Menu:Service:Overview' => 'Przegląd', @@ -38,7 +39,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Contract:baseinfo' => 'Informacje ogólne', 'Contract:moreinfo' => 'Informacje o umowach', 'Contract:cost' => 'Informacje o kosztach', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -53,30 +54,27 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( // Class: Organization // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Model obsługi', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => 'Nazwa modelu obsługi', 'Class:Organization/Attribute:deliverymodel_name+' => '', -)); - - +]); // // Class: ContractType // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ContractType' => 'Typ umowy', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Contract' => 'Umowa', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Nazwa', @@ -125,13 +123,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Contract/Attribute:status/Value:production+' => 'użytkowane', 'Class:Contract/Attribute:finalclass' => 'Podklasa umowy', 'Class:Contract/Attribute:finalclass+' => 'Nazwa ostatniej klasy', -)); +]); // // Class: CustomerContract // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:CustomerContract' => 'Umowa z klientem', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Usługi', @@ -140,13 +138,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'Wszystkie elementy konfiguracji objęte niniejszą umową', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Umowy z dostawcami', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'Wszystkie umowy z dostawcami na świadczenie usług w ramach tej umowy (umowa stanowiąca podstawę)', -)); +]); // // Class: ProviderContract // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ProviderContract' => 'Umowa z dostawcą', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'Konfiguracje', @@ -155,13 +153,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:ProviderContract/Attribute:sla+' => 'Umowa dotycząca poziomu usług', 'Class:ProviderContract/Attribute:coverage' => 'Godziny usługi', 'Class:ProviderContract/Attribute:coverage+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkContactToContract' => 'Połączenie Kontakt / Umowa', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -173,13 +171,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Nazwa kontaktu', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkContractToDocument' => 'Połączenie Umowa / Dokument', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -191,13 +189,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Nazwa dokumentu', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkFunctionalCIToProviderContract' => 'Połączenie Konfiguracja / Umowa z dostawcą', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -209,13 +207,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Nazwa konfiguracji', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ServiceFamily' => 'Rodzina usług', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Nazwa', @@ -224,13 +222,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Usługi', 'Class:ServiceFamily/Attribute:services_list+' => 'Wszystkie usługi w tej kategorii', -)); +]); // // Class: Service // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Service' => 'Usługa', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -264,13 +262,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Service/Attribute:customercontracts_list+' => 'Wszystkie umowy z klientami, którzy kupili tę usługę', 'Class:Service/Attribute:servicesubcategories_list' => 'Podkategorie usług', 'Class:Service/Attribute:servicesubcategories_list+' => 'Wszystkie podkategorie tej usługi', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkDocumentToService' => 'Połączenie Dokument / Usługa', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -282,13 +280,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Nazwa dokumentu', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkContactToService' => 'Połączenie Kontakt / Usługa', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -300,13 +298,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Nazwa kontaktu', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ServiceSubcategory' => 'Podkategoria usługi', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -334,13 +332,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => 'zgłoszenie serwisowe', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Nazwa dostawcy', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Dostawca', -)); +]); // // Class: SLA // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:SLA' => 'Umowa SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Nazwa', @@ -356,13 +354,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:SLA/Attribute:customercontracts_list' => 'Umowy z klientami', 'Class:SLA/Attribute:customercontracts_list+' => 'Wszystkie umowy z klientami korzystające z tej umowy SLA', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Nie udało się zapisać połączenia z umową klienta %1$s i usługą %2$s : Umowa SLA już istnieje', -)); +]); // // Class: SLT // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:SLT' => 'Poziom usług SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Nazwa', @@ -397,13 +395,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:SLT/Attribute:unit/Value:hours+' => 'godzin', 'Class:SLT/Attribute:unit/Value:minutes' => 'minut', 'Class:SLT/Attribute:unit/Value:minutes+' => 'minut', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkSLAToSLT' => 'Połączenie SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -425,13 +423,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Jednostka wartości SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkCustomerContractToService' => 'Połączenie Umowa z klientem / Usługa', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -447,13 +445,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'Nazwa umowy SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkCustomerContractToProviderContract' => 'Połączenie Umowa z klientem / Umowa z dostawcą', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s', @@ -465,13 +463,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Nazwa umowy z dostawcą', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Połączenie Umowa z klientem / Konfiguracja', 'Class:lnkCustomerContractToFunctionalCI+' => '', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s', @@ -483,13 +481,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'Nazwa konfiguracji', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:DeliveryModel' => 'Model obsługi', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Nazwa', @@ -504,13 +502,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Wszystkie kontakty (zespoły i osoby) dla tego modelu obsługi', 'Class:DeliveryModel/Attribute:customers_list' => 'Klienci', 'Class:DeliveryModel/Attribute:customers_list+' => 'Wszyscy klienci posiadający ten model obsługi', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkDeliveryModelToContact' => 'Połączenie Model obsługi / Kontakt', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -526,35 +524,35 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Nazwa roli', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/pt_br.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/pt_br.dict.itop-service-mgmt-provider.php index 5d38312c0..2c4135ee6 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/pt_br.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/pt_br.dict.itop-service-mgmt-provider.php @@ -1,15 +1,16 @@ 'Gerenciamento de serviços', 'Menu:ServiceManagement+' => 'Gerenciamento de serviços', 'Menu:Service:Overview' => 'Visão geral', @@ -38,7 +39,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -53,30 +54,27 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( // Class: Organization // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Modelo de entrega', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => 'Nome do modelo de entrega', 'Class:Organization/Attribute:deliverymodel_name+' => '', -)); - - +]); // // Class: ContractType // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ContractType' => 'Tipo de contrato', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Contract' => 'Contrato', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Nome', @@ -125,13 +123,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Contract/Attribute:status/Value:production+' => '', 'Class:Contract/Attribute:finalclass' => 'Tipo de contrato', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:CustomerContract' => 'Contrato de cliente', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Serviços', @@ -140,13 +138,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'Todos os itens de configuração que são utilizados para a prestação deste contrato', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Contratos de provedores', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'Todos os contratos de provedores para suportar este contrato de cliente', -)); +]); // // Class: ProviderContract // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ProviderContract' => 'Contrato de Provedor', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'ICs', @@ -155,13 +153,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:ProviderContract/Attribute:sla+' => 'Acordo de Nível de Serviço (ANS)', 'Class:ProviderContract/Attribute:coverage' => 'Horário de serviço', 'Class:ProviderContract/Attribute:coverage+' => 'Horário de cobertura do serviço', -)); +]); // // Class: lnkContactToContract // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkContactToContract' => 'Link Contato / Contrato', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -173,13 +171,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Nome do contato', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkContractToDocument' => 'Link Contrato / Documento', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -191,13 +189,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Nome do documento', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkFunctionalCIToProviderContract' => 'Link IC / Contrato de provedor', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -209,13 +207,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Nome do IC', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ServiceFamily' => 'Família de serviços', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Nome', @@ -224,13 +222,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Serviços', 'Class:ServiceFamily/Attribute:services_list+' => 'Todos os serviços para essa categoria', -)); +]); // // Class: Service // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Service' => 'Serviço', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -264,13 +262,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Service/Attribute:customercontracts_list+' => 'Todos os contratos de clientes que contrataram esse serviço', 'Class:Service/Attribute:servicesubcategories_list' => 'Subcategorias de serviço', 'Class:Service/Attribute:servicesubcategories_list+' => 'Todas as subcategorias associadas a esse serviço', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkDocumentToService' => 'Link Documento / Serviço', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -282,13 +280,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Nome do documento', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkContactToService' => 'Link Contato / Serviço', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -300,13 +298,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Nome do contato', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ServiceSubcategory' => 'Subcategorias de serviço', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -334,13 +332,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => '', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Nome do provedor', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Provedor', -)); +]); // // Class: SLA // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Nome', @@ -356,13 +354,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:SLA/Attribute:customercontracts_list' => 'Contratos de clientes', 'Class:SLA/Attribute:customercontracts_list+' => 'Todos os contratos de clientes utilizando esse Acordo de Nível de Serviço (SLA)', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Não foi possível salvar o vínculo entre o Contrato do Cliente %1$s e Serviço %2$s : SLA já existe', -)); +]); // // Class: SLT // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Nome', @@ -397,13 +395,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:SLT/Attribute:unit/Value:hours+' => '', 'Class:SLT/Attribute:unit/Value:minutes' => 'Minutos', 'Class:SLT/Attribute:unit/Value:minutes+' => '', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkSLAToSLT' => 'Link SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -425,13 +423,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Unidade de valor do SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkCustomerContractToService' => 'Link Contrato de cliente / Serviço', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -447,13 +445,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'Nome do SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkCustomerContractToProviderContract' => 'Link Contrato de cliente / Contrato de provedor', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s~~', @@ -465,13 +463,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Nome do contrato de provedor', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Link Contrato de cliente / IC', 'Class:lnkCustomerContractToFunctionalCI+' => '', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -483,13 +481,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'Nome do CI', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:DeliveryModel' => 'Modelo de entrega', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Nome', @@ -504,13 +502,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Todos os contatos (Equipe e Pessoa) para esse Modelo de entrega', 'Class:DeliveryModel/Attribute:customers_list' => 'Clientes', 'Class:DeliveryModel/Attribute:customers_list+' => 'Todos os clientes com esse Modelo de entrega', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkDeliveryModelToContact' => 'Link Modelo de entrega / Contato', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -526,35 +524,35 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Nome da função', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/ru.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/ru.dict.itop-service-mgmt-provider.php index b0f680bf2..238164cac 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/ru.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/ru.dict.itop-service-mgmt-provider.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:ServiceManagement' => 'Управление услугами', 'Menu:ServiceManagement+' => 'Управление услугами', 'Menu:Service:Overview' => 'Обзор', @@ -39,7 +40,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -54,30 +55,27 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( // Class: Organization // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Модель предоставления услуг', 'Class:Organization/Attribute:deliverymodel_id+' => 'Модель предоставления услуг (Delivery Model)', 'Class:Organization/Attribute:deliverymodel_name' => 'Модель предоставления услуг', 'Class:Organization/Attribute:deliverymodel_name+' => '', -)); - - +]); // // Class: ContractType // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ContractType' => 'Тип договора', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Contract' => 'Договор', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Название', @@ -126,13 +124,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Contract/Attribute:status/Value:production+' => 'Эксплуатация', 'Class:Contract/Attribute:finalclass' => 'Тип', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:CustomerContract' => 'Договор с заказчиком', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Услуги', @@ -141,13 +139,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'Конфигурационные единицы, охватываемые договором', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Договоры с поставщиками', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'Договоры с поставщиками, используемые для поддержки услуг данного договора (Underpinning Contracts)', -)); +]); // // Class: ProviderContract // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ProviderContract' => 'Договор с поставщиком', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'КЕ', @@ -156,13 +154,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:ProviderContract/Attribute:sla+' => 'Соглашение об уровне услуги (Service Level Agreement)', 'Class:ProviderContract/Attribute:coverage' => 'Время обслуживания', 'Class:ProviderContract/Attribute:coverage+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkContactToContract' => 'Связь Контакт/Договор', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -174,13 +172,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Контакт', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkContractToDocument' => 'Связь Договор/Документ', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -192,13 +190,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Документ', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkFunctionalCIToProviderContract' => 'Связь Функциональная КЕ/Договор с поставщиком', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -210,13 +208,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'КЕ', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ServiceFamily' => 'Пакет услуг', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Название', @@ -225,13 +223,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Услуги', 'Class:ServiceFamily/Attribute:services_list+' => 'Связанные услуги', -)); +]); // // Class: Service // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Service' => 'Услуга', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -265,13 +263,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Service/Attribute:customercontracts_list+' => 'Договоры с заказчиками, по которым предоставляется услуга', 'Class:Service/Attribute:servicesubcategories_list' => 'Подкатегории услуги', 'Class:Service/Attribute:servicesubcategories_list+' => 'Подкатегории услуги', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkDocumentToService' => 'Связь Документ/Услуга', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -283,13 +281,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Документ', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkContactToService' => 'Связь Контакт/Услуга', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -301,13 +299,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Контакт', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ServiceSubcategory' => 'Подкатегория услуги', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -335,13 +333,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => 'Запрос на обслуживание', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Поставщик', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Поставщик', -)); +]); // // Class: SLA // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Название', @@ -357,13 +355,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:SLA/Attribute:customercontracts_list' => 'Договоры с заказчиками', 'Class:SLA/Attribute:customercontracts_list+' => 'Договоры с заказчиками, в которых используется SLA', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists~~', -)); +]); // // Class: SLT // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Название', @@ -398,13 +396,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:SLT/Attribute:unit/Value:hours+' => 'Часы', 'Class:SLT/Attribute:unit/Value:minutes' => 'Минуты', 'Class:SLT/Attribute:unit/Value:minutes+' => 'Минуты', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkSLAToSLT' => 'Связь SLA/SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -426,13 +424,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Единицы SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkCustomerContractToService' => 'Связь Договор с заказчиком/Услуга', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -448,13 +446,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkCustomerContractToProviderContract' => 'Связь Договор с заказчиком/Договор с поставщиком', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s~~', @@ -466,13 +464,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Договор с поставщиком', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Связь Договор с заказчиком/Функциональная КЕ', 'Class:lnkCustomerContractToFunctionalCI+' => '', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -484,13 +482,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'КЕ', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:DeliveryModel' => 'Модель предоставления услуг', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Название', @@ -505,13 +503,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Контакты (команды и персоны), которые участвуют в предоставлении услуг по этой модели', 'Class:DeliveryModel/Attribute:customers_list' => 'Заказчики', 'Class:DeliveryModel/Attribute:customers_list+' => 'Заказчики, которым предоставляются услуги по этой модели', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkDeliveryModelToContact' => 'Связь Модель предоставления услуг/Контакт', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -527,35 +525,35 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Роль', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/sk.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/sk.dict.itop-service-mgmt-provider.php index 57135699f..d6aa02b65 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/sk.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/sk.dict.itop-service-mgmt-provider.php @@ -1,15 +1,16 @@ 'Manažment služieb', 'Menu:ServiceManagement+' => 'Service Management Overview~~', 'Menu:Service:Overview' => 'Prehľad', @@ -38,7 +39,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -53,30 +54,27 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( // Class: Organization // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Model dodávky', 'Class:Organization/Attribute:deliverymodel_id+' => '~~', 'Class:Organization/Attribute:deliverymodel_name' => 'Názov modelu dodávky', 'Class:Organization/Attribute:deliverymodel_name+' => '~~', -)); - - +]); // // Class: ContractType // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ContractType' => 'Typ zmluvy', 'Class:ContractType+' => '~~', -)); - +]); // // Class: Contract // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Contract' => 'zmluva', 'Class:Contract+' => '~~', 'Class:Contract/Attribute:name' => 'Názov', @@ -125,13 +123,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Contract/Attribute:status/Value:production+' => 'production~~', 'Class:Contract/Attribute:finalclass' => 'Typ', 'Class:Contract/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: CustomerContract // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:CustomerContract' => 'Zákaznícka zmluva', 'Class:CustomerContract+' => '~~', 'Class:CustomerContract/Attribute:services_list' => 'Služby', @@ -140,13 +138,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'All the configuration items covered by this contract~~', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Provider contracts~~', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'All the provider contracts to deliver the services for this contract (underpinning contract)~~', -)); +]); // // Class: ProviderContract // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ProviderContract' => 'Poskytovateľská zmluva', 'Class:ProviderContract+' => '~~', 'Class:ProviderContract/Attribute:functionalcis_list' => 'Zariadenia', @@ -155,13 +153,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:ProviderContract/Attribute:sla+' => 'Service Level Agreement~~', 'Class:ProviderContract/Attribute:coverage' => 'Časy pokrytia', 'Class:ProviderContract/Attribute:coverage+' => '~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkContactToContract' => 'väzba - Kontakt / zmluva', 'Class:lnkContactToContract+' => '~~', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -173,13 +171,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '~~', 'Class:lnkContactToContract/Attribute:contact_name' => 'Názov kontaktu', 'Class:lnkContactToContract/Attribute:contact_name+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkContractToDocument' => 'väzba - zmluva / Dokument', 'Class:lnkContractToDocument+' => '~~', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -191,13 +189,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '~~', 'Class:lnkContractToDocument/Attribute:document_name' => 'Názov dokumentu', 'Class:lnkContractToDocument/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkFunctionalCIToProviderContract' => 'väzba - Komponent / Poskytovateľská zmluva', 'Class:lnkFunctionalCIToProviderContract+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -209,13 +207,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'Názov CI', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: ServiceFamily // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ServiceFamily' => 'Kategória služieb', 'Class:ServiceFamily+' => '~~', 'Class:ServiceFamily/Attribute:name' => 'Názov', @@ -224,13 +222,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:ServiceFamily/Attribute:icon+' => '~~', 'Class:ServiceFamily/Attribute:services_list' => 'Služby', 'Class:ServiceFamily/Attribute:services_list+' => 'All the services in this category~~', -)); +]); // // Class: Service // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Service' => 'Služby', 'Class:Service+' => '~~', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -264,13 +262,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Service/Attribute:customercontracts_list+' => 'All the customer contracts that have purchased this service~~', 'Class:Service/Attribute:servicesubcategories_list' => 'Podkategórie služieb', 'Class:Service/Attribute:servicesubcategories_list+' => 'All the sub categories for this service~~', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkDocumentToService' => 'väzba - Dokument / Služba', 'Class:lnkDocumentToService+' => '~~', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -282,13 +280,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '~~', 'Class:lnkDocumentToService/Attribute:document_name' => 'Názov dokumentu', 'Class:lnkDocumentToService/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkContactToService // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkContactToService' => 'väzba - Kontakt / Služba', 'Class:lnkContactToService+' => '~~', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -300,13 +298,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkContactToService/Attribute:contact_id+' => '~~', 'Class:lnkContactToService/Attribute:contact_name' => 'Názov kontaktu', 'Class:lnkContactToService/Attribute:contact_name+' => '~~', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ServiceSubcategory' => 'Podkategória služieb', 'Class:ServiceSubcategory+' => '~~', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -334,13 +332,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => 'service request~~', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Provider Name~~', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Provider~~', -)); +]); // // Class: SLA // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '~~', 'Class:SLA/Attribute:name' => 'Názov', @@ -356,13 +354,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:SLA/Attribute:customercontracts_list' => 'Zákaznícke zmluvy', 'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracts using this SLA~~', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists~~', -)); +]); // // Class: SLT // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '~~', 'Class:SLT/Attribute:name' => 'Názov', @@ -397,13 +395,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:SLT/Attribute:unit/Value:hours+' => 'hours~~', 'Class:SLT/Attribute:unit/Value:minutes' => 'Minúty', 'Class:SLT/Attribute:unit/Value:minutes+' => 'minutes~~', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkSLAToSLT' => 'väzba - SLA / SLT', 'Class:lnkSLAToSLT+' => '~~', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -425,13 +423,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'SLT value unit~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkCustomerContractToService' => 'väzba - Zákaznícka zmluva / Služba', 'Class:lnkCustomerContractToService+' => '~~', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -447,13 +445,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '~~', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA Názov', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '~~', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkCustomerContractToProviderContract' => 'Link Customer Contract / Provider Contract~~', 'Class:lnkCustomerContractToProviderContract+' => '~~', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s~~', @@ -465,13 +463,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '~~', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Provider contract Name~~', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '~~', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Link Customer Contract / FunctionalCI~~', 'Class:lnkCustomerContractToFunctionalCI+' => '~~', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -483,13 +481,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '~~', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'CI Name~~', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: DeliveryModel // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:DeliveryModel' => 'Model dodávky', 'Class:DeliveryModel+' => '~~', 'Class:DeliveryModel/Attribute:name' => 'Názov', @@ -504,13 +502,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'All the contacts (Teams and Persons) for this delivery model~~', 'Class:DeliveryModel/Attribute:customers_list' => 'Zákazníci', 'Class:DeliveryModel/Attribute:customers_list+' => 'All the customers having this delivering model~~', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkDeliveryModelToContact' => 'väzba - Model dodávky / Kontakt', 'Class:lnkDeliveryModelToContact+' => '~~', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -526,35 +524,35 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '~~', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Názov role', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/tr.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/tr.dict.itop-service-mgmt-provider.php index 42bb99b22..77427c876 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/tr.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/tr.dict.itop-service-mgmt-provider.php @@ -1,15 +1,16 @@ 'Hizmet yönetimi', 'Menu:ServiceManagement+' => 'Hizmet yönetimi', 'Menu:Service:Overview' => 'Özet', @@ -38,7 +39,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -53,30 +54,27 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( // Class: Organization // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Teslimat Modeli', 'Class:Organization/Attribute:deliverymodel_id+' => '~~', 'Class:Organization/Attribute:deliverymodel_name' => 'Teslimat Modeli Adı', 'Class:Organization/Attribute:deliverymodel_name+' => '~~', -)); - - +]); // // Class: ContractType // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ContractType' => 'Contract Type~~', 'Class:ContractType+' => '~~', -)); - +]); // // Class: Contract // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Contract' => 'Sözleşme', 'Class:Contract+' => '~~', 'Class:Contract/Attribute:name' => 'Adı', @@ -125,13 +123,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Contract/Attribute:status/Value:production+' => 'production~~', 'Class:Contract/Attribute:finalclass' => 'Tip', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:CustomerContract' => 'Müşteri Sözleşmesi', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Services~~', @@ -140,13 +138,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => 'All the configuration items covered by this contract~~', 'Class:CustomerContract/Attribute:providercontracts_list' => 'Provider contracts~~', 'Class:CustomerContract/Attribute:providercontracts_list+' => 'All the provider contracts to deliver the services for this contract (underpinning contract)~~', -)); +]); // // Class: ProviderContract // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ProviderContract' => 'Tedarikçi Sözleşmesi', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CIs~~', @@ -155,13 +153,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:ProviderContract/Attribute:sla+' => 'Service Level Agreement~~', 'Class:ProviderContract/Attribute:coverage' => 'Service hours~~', 'Class:ProviderContract/Attribute:coverage+' => '~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkContactToContract' => 'Link Contact / Contract~~', 'Class:lnkContactToContract+' => '~~', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -173,13 +171,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '~~', 'Class:lnkContactToContract/Attribute:contact_name' => 'Contact Name~~', 'Class:lnkContactToContract/Attribute:contact_name+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkContractToDocument' => 'Link Contract / Document~~', 'Class:lnkContractToDocument+' => '~~', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -191,13 +189,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '~~', 'Class:lnkContractToDocument/Attribute:document_name' => 'Document Name~~', 'Class:lnkContractToDocument/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkFunctionalCIToProviderContract' => 'Link FunctionalCI / ProviderContract~~', 'Class:lnkFunctionalCIToProviderContract+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s~~', @@ -209,13 +207,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '~~', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => 'CI Name~~', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: ServiceFamily // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ServiceFamily' => 'Service Family~~', 'Class:ServiceFamily+' => '~~', 'Class:ServiceFamily/Attribute:name' => 'Name~~', @@ -224,13 +222,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:ServiceFamily/Attribute:icon+' => '~~', 'Class:ServiceFamily/Attribute:services_list' => 'Services~~', 'Class:ServiceFamily/Attribute:services_list+' => 'All the services in this category~~', -)); +]); // // Class: Service // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Service' => 'Hizmet', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -264,13 +262,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Service/Attribute:customercontracts_list+' => 'All the customer contracts that have purchased this service~~', 'Class:Service/Attribute:servicesubcategories_list' => 'Service sub categories~~', 'Class:Service/Attribute:servicesubcategories_list+' => 'All the sub categories for this service~~', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkDocumentToService' => 'Link Document / Service~~', 'Class:lnkDocumentToService+' => '~~', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -282,13 +280,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '~~', 'Class:lnkDocumentToService/Attribute:document_name' => 'Document Name~~', 'Class:lnkDocumentToService/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkContactToService // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkContactToService' => 'Link Contact / Service~~', 'Class:lnkContactToService+' => '~~', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -300,13 +298,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkContactToService/Attribute:contact_id+' => '~~', 'Class:lnkContactToService/Attribute:contact_name' => 'Contact Name~~', 'Class:lnkContactToService/Attribute:contact_name+' => '~~', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ServiceSubcategory' => 'Hizmet alt kategorisi', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -334,13 +332,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => 'service request~~', 'Class:ServiceSubcategory/Attribute:service_provider' => 'Provider Name~~', 'Class:ServiceSubcategory/Attribute:service_org_id' => 'Provider~~', -)); +]); // // Class: SLA // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => 'Hizmet Seviyesi Anlaşması', 'Class:SLA/Attribute:name' => 'Adı', @@ -356,13 +354,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:SLA/Attribute:customercontracts_list' => 'Customer contracts~~', 'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracts using this SLA~~', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists~~', -)); +]); // // Class: SLT // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => 'Hizmet Seviyesi Taahütler', 'Class:SLT/Attribute:name' => 'Adı', @@ -397,13 +395,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:SLT/Attribute:unit/Value:hours+' => 'hours~~', 'Class:SLT/Attribute:unit/Value:minutes' => 'minutes~~', 'Class:SLT/Attribute:unit/Value:minutes+' => 'minutes~~', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkSLAToSLT' => 'Link SLA / SLT~~', 'Class:lnkSLAToSLT+' => '~~', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -425,13 +423,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'SLT value unit~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkCustomerContractToService' => 'Link Customer Contract / Service~~', 'Class:lnkCustomerContractToService+' => '~~', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -447,13 +445,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '~~', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA Name~~', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '~~', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkCustomerContractToProviderContract' => 'Müşteri ve Tedarikçi Sözleşmesi ilişkilendirmesi', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s~~', @@ -465,13 +463,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '~~', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => 'Provider contract Name~~', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '~~', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkCustomerContractToFunctionalCI' => 'Link Customer Contract / FunctionalCI~~', 'Class:lnkCustomerContractToFunctionalCI+' => '~~', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s~~', @@ -483,13 +481,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '~~', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => 'CI Name~~', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '~~', -)); +]); // // Class: DeliveryModel // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:DeliveryModel' => 'Delivery Model~~', 'Class:DeliveryModel+' => '~~', 'Class:DeliveryModel/Attribute:name' => 'Name~~', @@ -504,13 +502,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'All the contacts (Teams and Persons) for this delivery model~~', 'Class:DeliveryModel/Attribute:customers_list' => 'Customers~~', 'Class:DeliveryModel/Attribute:customers_list+' => 'All the customers having this delivering model~~', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkDeliveryModelToContact' => 'Link DeliveryModel / Contact~~', 'Class:lnkDeliveryModelToContact+' => '~~', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -526,35 +524,35 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '~~', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Role name~~', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/zh_cn.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/zh_cn.dict.itop-service-mgmt-provider.php index 71c4b059e..5f2c25f45 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/dictionaries/zh_cn.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/dictionaries/zh_cn.dict.itop-service-mgmt-provider.php @@ -1,4 +1,5 @@ '服务管理', 'Menu:ServiceManagement+' => '服务管理概况', 'Menu:Service:Overview' => '概况', @@ -61,7 +62,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Contract:baseinfo' => '常规信息', 'Contract:moreinfo' => '合同信息', 'Contract:cost' => '费用信息', -)); +]); /* 'UI:ServiceManagementMenu' => 'Gestion des Services', @@ -76,30 +77,27 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( // Class: Organization // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Organization/Attribute:deliverymodel_id' => '交付模式', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => '交付模式名称', 'Class:Organization/Attribute:deliverymodel_name+' => '', -)); - - +]); // // Class: ContractType // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ContractType' => '合同类型', 'Class:ContractType+' => '', -)); - +]); // // Class: Contract // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Contract' => '合同', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => '名称', @@ -148,13 +146,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Contract/Attribute:status/Value:production+' => '正式', 'Class:Contract/Attribute:finalclass' => '合同类型', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:CustomerContract' => '客户合同', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => '服务', @@ -163,13 +161,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:CustomerContract/Attribute:functionalcis_list+' => '此合同包含的所有配置项', 'Class:CustomerContract/Attribute:providercontracts_list' => '供应商合同', 'Class:CustomerContract/Attribute:providercontracts_list+' => '所有提供服务的供应商合同 (支持合同)', -)); +]); // // Class: ProviderContract // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ProviderContract' => '供应商合同', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => '配置项', @@ -178,13 +176,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:ProviderContract/Attribute:sla+' => '服务等级协议', 'Class:ProviderContract/Attribute:coverage' => '服务时间', 'Class:ProviderContract/Attribute:coverage+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkContactToContract' => '关联联系人/合同', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -196,13 +194,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => '联系人名称', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkContractToDocument' => '关联合同/文档', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -214,13 +212,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => '文档名称', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: lnkFunctionalCIToProviderContract // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkFunctionalCIToProviderContract' => '关联功能配置项/供应商合同', 'Class:lnkFunctionalCIToProviderContract+' => '', 'Class:lnkFunctionalCIToProviderContract/Name' => '%1$s / %2$s', @@ -232,13 +230,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_id+' => '', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name' => '配置项名称', 'Class:lnkFunctionalCIToProviderContract/Attribute:functionalci_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ServiceFamily' => '服务系列', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => '名称', @@ -247,13 +245,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => '服务', 'Class:ServiceFamily/Attribute:services_list+' => '列表中包含的所有服务', -)); +]); // // Class: Service // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Service' => '服务', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -287,13 +285,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Service/Attribute:customercontracts_list+' => '购买此服务的所有客户合同', 'Class:Service/Attribute:servicesubcategories_list' => '子服务', 'Class:Service/Attribute:servicesubcategories_list+' => '此服务的所有子服务', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkDocumentToService' => '关联文档/服务', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -305,13 +303,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => '文档名称', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkContactToService' => '关联联系人/服务', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -323,13 +321,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => '联系人名称', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ServiceSubcategory' => '子服务', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -357,13 +355,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:ServiceSubcategory/Attribute:request_type/Value:service_request+' => '服务需求', 'Class:ServiceSubcategory/Attribute:service_provider' => '供应商名称', 'Class:ServiceSubcategory/Attribute:service_org_id' => '供应商', -)); +]); // // Class: SLA // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => '名称', @@ -379,13 +377,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:SLA/Attribute:customercontracts_list' => '客户合同', 'Class:SLA/Attribute:customercontracts_list+' => '使用此 SLA 的所有客户合同', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => '不能保存客户合同 %1$s 于服务 %2$s 的关联: SLA 已存在', -)); +]); // // Class: SLT // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => '名称', @@ -420,13 +418,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:SLT/Attribute:unit/Value:hours+' => '小时', 'Class:SLT/Attribute:unit/Value:minutes' => '分钟', 'Class:SLT/Attribute:unit/Value:minutes+' => '分钟', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkSLAToSLT' => '关联 SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -448,13 +446,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'SLT 单位', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkCustomerContractToService' => '关联客户合同/服务', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -470,13 +468,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA名称', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkCustomerContractToProviderContract // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkCustomerContractToProviderContract' => '关联 客户合同/供应商合同', 'Class:lnkCustomerContractToProviderContract+' => '', 'Class:lnkCustomerContractToProviderContract/Name' => '%1$s / %2$s', @@ -488,13 +486,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_id+' => '', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name' => '供应商合同名称', 'Class:lnkCustomerContractToProviderContract/Attribute:providercontract_name+' => '', -)); +]); // // Class: lnkCustomerContractToFunctionalCI // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkCustomerContractToFunctionalCI' => '关联客户合同/功能配置项', 'Class:lnkCustomerContractToFunctionalCI+' => '', 'Class:lnkCustomerContractToFunctionalCI/Name' => '%1$s / %2$s', @@ -506,13 +504,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_id+' => '', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name' => '配置项名称', 'Class:lnkCustomerContractToFunctionalCI/Attribute:functionalci_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:DeliveryModel' => '交付模式', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => '名称', @@ -527,13 +525,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:DeliveryModel/Attribute:contacts_list+' => '此交付模式的所有联系人 (包括团队和人员)', 'Class:DeliveryModel/Attribute:customers_list' => '客户', 'Class:DeliveryModel/Attribute:customers_list+' => '使用此交付模式的所有客户', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkDeliveryModelToContact' => '关联 交付模式/联系人', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -549,35 +547,35 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => '角色名称', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt-provider/main.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/main.itop-service-mgmt-provider.php index 2baed1313..ec6c4c958 100755 --- a/datamodels/2.x/itop-service-mgmt-provider/main.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/main.itop-service-mgmt-provider.php @@ -1,9 +1,10 @@ - - -?> diff --git a/datamodels/2.x/itop-service-mgmt-provider/module.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/module.itop-service-mgmt-provider.php index d0d8ee4d9..bfcb53e9a 100755 --- a/datamodels/2.x/itop-service-mgmt-provider/module.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/module.itop-service-mgmt-provider.php @@ -1,10 +1,9 @@ 'Service Management for Service Providers', @@ -12,21 +11,21 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - 'itop-tickets/2.0.0', - ), + 'dependencies' => [ + 'itop-tickets/2.0.0', + ], 'mandatory' => false, 'visible' => true, 'installer' => 'ServiceMgmtProviderInstaller', // Components // - 'datamodel' => array( - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'data.struct' => [ //'data.struct.itop-service-mgmt.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ 'data.sample.organizations.xml', 'data.sample.contracts.xml', 'data.sample.servicefamilies.xml', @@ -39,8 +38,8 @@ SetupWebPage::AddModule( 'data.sample.contractservice.xml', // 'data.sample.deliverymodel.xml', 'data.sample.deliverymodelcontact.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -48,13 +47,12 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); -if (!class_exists('ServiceMgmtProviderInstaller')) -{ +if (!class_exists('ServiceMgmtProviderInstaller')) { // Module installation handler // class ServiceMgmtProviderInstaller extends ModuleInstallerAPI @@ -73,15 +71,14 @@ if (!class_exists('ServiceMgmtProviderInstaller')) */ public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) { - if (strlen($sPreviousVersion) > 0) - { + if (strlen($sPreviousVersion) > 0) { // If you want to migrate data from one format to another, do it here self::RenameClassInDB('ServiceFamilly', 'ServiceFamily'); self::RenameEnumValueInDB('SLT', 'request_type', 'servicerequest', 'service_request'); } } - + /** * Handler called after the creation/update of the database schema * @param $oConfiguration Config The new configuration of the application diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/cs.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/cs.dict.itop-service-mgmt.php index d4c48c04c..a50426446 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/cs.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/cs.dict.itop-service-mgmt.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:ServiceManagement' => 'Správa služeb', 'Menu:ServiceManagement+' => 'Přehled správy služeb', 'Menu:Service:Overview' => 'Přehled', @@ -42,35 +43,34 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Contract:baseinfo' => 'Obecné informace', 'Contract:moreinfo' => 'Smluvní informace', 'Contract:cost' => 'Informace o nákladech', -)); +]); // // Class: Organization // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Model poskytování služeb', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => 'Název modelu poskytování služeb', 'Class:Organization/Attribute:deliverymodel_name+' => 'This is required for Tickets handling. -The delivery model specifies the teams to which tickets can be assigned.~~' -)); - +The delivery model specifies the teams to which tickets can be assigned.~~', +]); // // Class: ContractType // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ContractType' => 'Typ smlouvy', 'Class:ContractType+' => '', -)); +]); // // Class: Contract // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Contract' => 'Smlouva', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Název', @@ -119,23 +119,23 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Contract/Attribute:status/Value:production+' => '', 'Class:Contract/Attribute:finalclass' => 'Typ', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:CustomerContract' => 'Smlouva se zákazníkem', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Služby', 'Class:CustomerContract/Attribute:services_list+' => 'Všechny služby pod touto smlouvou', -)); +]); // // Class: ProviderContract // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ProviderContract' => 'Smlouva s poskytovatelem', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'Konfigurační položky', @@ -150,13 +150,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => 'Služby', 'Class:ProviderContract/Attribute:services_list+' => 'Všechny služby zakoupené v rámci této smlouvy', -)); +]); // // Class: lnkContactToContract // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkContactToContract' => 'Spojení (Kontakt / Smlouva)', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -168,13 +168,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Název kontaktu', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkContractToDocument' => 'Spojení (Smlouva / Dokument)', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -186,13 +186,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Název dokumentu', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ServiceFamily' => 'Balíček služeb', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Název', @@ -201,13 +201,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Služby', 'Class:ServiceFamily/Attribute:services_list+' => 'Všechny služby v této kategorii', -)); +]); // // Class: Service // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Service' => 'Služba', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -245,13 +245,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Service/Attribute:functionalcis_list+' => 'Všechny konfigurační položky využívané pro poskytování této služby', 'Class:Service/Attribute:servicesubcategories_list' => 'Podkategorie služeb', 'Class:Service/Attribute:servicesubcategories_list+' => 'Všechny podkategorie služeb pro tuto službu', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkDocumentToService' => 'Spojení (Dokument / Služba)', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -263,13 +263,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Název dokumentu', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkContactToService' => 'Spojení (Kontakt / Služba)', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -281,13 +281,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Název kontaktu', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ServiceSubcategory' => 'Podkategorie služeb', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -313,13 +313,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => '', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'v produkci', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => '', -)); +]); // // Class: SLA // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => 'Dohoda o úrovni služeb', 'Class:SLA/Attribute:name' => 'Název', @@ -335,13 +335,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:SLA/Attribute:customercontracts_list' => 'Smlouvy se zákazníky', 'Class:SLA/Attribute:customercontracts_list+' => 'Všechny smlouvy se zákazníky využívající tuto dohodu o úrovni služeb', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Nepodařilo se uložit spojení smlouvy se zákazníkem %1$s a služby %2$s : SLA již existují', -)); +]); // // Class: SLT // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => 'Cíl úrovně služeb', 'Class:SLT/Attribute:name' => 'Název', @@ -378,13 +378,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:SLT/Attribute:unit/Value:minutes+' => '', 'Class:SLT/Attribute:slas_list' => 'SLA', 'Class:SLT/Attribute:slas_list+' => 'Všechny dohody o úrovni služeb (SLA) využívající toto SLT', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkSLAToSLT' => 'Spojení (SLA / SLT)', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -406,13 +406,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Jednotka hodnoty SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkCustomerContractToService' => 'Spojení (Smlouva se zákazníkem / Služba)', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -428,13 +428,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'Název SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkProviderContractToService' => 'Spojení (Smlouva s poskytovatelem / Služba)', 'Class:lnkProviderContractToService+' => '', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s~~', @@ -446,13 +446,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Název smlouvy s poskytovatelem', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:DeliveryModel' => 'Model poskytování služeb', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Název', @@ -467,13 +467,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Všechny kontakty (Týmy a Osoby) pro tento model poskytování služeb', 'Class:DeliveryModel/Attribute:customers_list' => 'Zákazníci', 'Class:DeliveryModel/Attribute:customers_list+' => 'Všichni zákazníci využívající tento model poskytování služeb', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkDeliveryModelToContact' => 'Spojení (Model poskytování služeb / Kontakt)', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -489,44 +489,44 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Název role', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/da.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/da.dict.itop-service-mgmt.php index efdfa9e2e..d9398ecc3 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/da.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/da.dict.itop-service-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:ServiceManagement' => 'Ydelses Management', 'Menu:ServiceManagement+' => 'Ydelses Management oversigt', 'Menu:Service:Overview' => 'Oversigt', @@ -41,35 +42,34 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); // // Class: Organization // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Leverings model', 'Class:Organization/Attribute:deliverymodel_id+' => '~~', 'Class:Organization/Attribute:deliverymodel_name' => 'Leverings model navn', 'Class:Organization/Attribute:deliverymodel_name+' => 'This is required for Tickets handling. -The delivery model specifies the teams to which tickets can be assigned.~~' -)); - +The delivery model specifies the teams to which tickets can be assigned.~~', +]); // // Class: ContractType // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ContractType' => 'Kontrakt type', 'Class:ContractType+' => '', -)); +]); // // Class: Contract // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Contract' => 'Kontrakt', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Navn', @@ -118,23 +118,23 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Contract/Attribute:status/Value:production+' => '', 'Class:Contract/Attribute:finalclass' => 'Type', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:CustomerContract' => 'Kunde kontrakt', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Ydelser', 'Class:CustomerContract/Attribute:services_list+' => 'All the services purchased for this contract~~', -)); +]); // // Class: ProviderContract // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ProviderContract' => 'Leverandør kontrakt', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CIs', @@ -149,13 +149,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => 'Services~~', 'Class:ProviderContract/Attribute:services_list+' => 'All the services purchased with this contract~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkContactToContract' => 'Sammenhæng Kontakt/Kontrakt', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -167,13 +167,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Kontakt navn', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkContractToDocument' => 'Sammenhæng Kontrakt/Dokument', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -185,13 +185,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Dokument navn', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ServiceFamily' => 'Ydelses-familie', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Navn', @@ -200,13 +200,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Ydelser', 'Class:ServiceFamily/Attribute:services_list+' => 'All the services in this category~~', -)); +]); // // Class: Service // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Service' => 'Ydelse', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -244,13 +244,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Service/Attribute:functionalcis_list+' => 'All the configuration items that are used to provide this service~~', 'Class:Service/Attribute:servicesubcategories_list' => 'Ydelses subkategorier', 'Class:Service/Attribute:servicesubcategories_list+' => 'All the sub categories for this service~~', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkDocumentToService' => 'Sammenhæng Dokument/Ydelse', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -262,13 +262,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Dokument navn', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkContactToService' => 'Sammenhæng Kontakt/Ydelse', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -280,13 +280,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Kontakt navn', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ServiceSubcategory' => 'Ydelse underkategorier', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -312,13 +312,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => '', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'Produktion', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => '', -)); +]); // // Class: SLA // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Navn', @@ -334,13 +334,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:SLA/Attribute:customercontracts_list' => 'Kunde kontrakter', 'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracted services using this SLA~~', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists~~', -)); +]); // // Class: SLT // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => 'Service Level Threshholds', 'Class:SLT/Attribute:name' => 'Navn', @@ -377,13 +377,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:SLT/Attribute:unit/Value:minutes+' => '', 'Class:SLT/Attribute:slas_list' => 'SLAs~~', 'Class:SLT/Attribute:slas_list+' => 'All the service level agreements using this SLT~~', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkSLAToSLT' => 'Sammenhæng SLA/SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -405,13 +405,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Slt value unit~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkCustomerContractToService' => 'Sammenhæng Kunde kontrakt/Ydelse', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -427,13 +427,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA navn', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkProviderContractToService' => 'Sammenhæng Leverandør kontrakt/Ydelse', 'Class:lnkProviderContractToService+' => '', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s~~', @@ -445,13 +445,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Leverandør kontrakt navn', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:DeliveryModel' => 'Leverings model', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Navn', @@ -466,13 +466,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'All the contacts (Teams and Persons) for this delivery model~~', 'Class:DeliveryModel/Attribute:customers_list' => 'Kunde', 'Class:DeliveryModel/Attribute:customers_list+' => 'All the customers having this delivering model~~', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkDeliveryModelToContact' => 'Sammenhæng Leverings model/Kontakt', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -488,44 +488,44 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Rolle navn', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/de.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/de.dict.itop-service-mgmt.php index 92df977ce..bec45becc 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/de.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/de.dict.itop-service-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:ServiceManagement' => 'Service Management', 'Menu:ServiceManagement+' => 'Service-Management-Übersicht', 'Menu:Service:Overview' => 'Übersicht', @@ -41,35 +42,34 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Contract:baseinfo' => 'Allgemeine Informationen', 'Contract:moreinfo' => 'Vertragliche Informationen', 'Contract:cost' => 'Kosteninformation', -)); +]); // // Class: Organization // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Delivery-Modell', 'Class:Organization/Attribute:deliverymodel_id+' => '', 'Class:Organization/Attribute:deliverymodel_name' => 'Delivery-Modell-Name', 'Class:Organization/Attribute:deliverymodel_name+' => 'This is required for Tickets handling. -The delivery model specifies the teams to which tickets can be assigned.~~' -)); - +The delivery model specifies the teams to which tickets can be assigned.~~', +]); // // Class: ContractType // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ContractType' => 'Vertrags-Typ', 'Class:ContractType+' => '', -)); +]); // // Class: Contract // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Contract' => 'Vertrag', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Name', @@ -118,23 +118,23 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Contract/Attribute:status/Value:production+' => '', 'Class:Contract/Attribute:finalclass' => 'Typ', 'Class:Contract/Attribute:finalclass+' => 'Name der instanziierbaren Klasse', -)); +]); // // Class: CustomerContract // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:CustomerContract' => 'Kundenvertrag', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Services', 'Class:CustomerContract/Attribute:services_list+' => 'Alle für diesen Vertrag erworbenen Services', -)); +]); // // Class: ProviderContract // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ProviderContract' => 'Provider-Vertrag', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CIs', @@ -149,13 +149,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => 'Services', 'Class:ProviderContract/Attribute:services_list+' => 'Alle für diesen Vertrag erworbenen Services', -)); +]); // // Class: lnkContactToContract // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkContactToContract' => 'Verknüpfung Kontakt/Vertrag', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -167,13 +167,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Kontakt-Name', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkContractToDocument' => 'Verknüpfung Vertrag/Dokument', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -185,13 +185,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Dokument-Name', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ServiceFamily' => 'Service-Familie', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Name', @@ -200,13 +200,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Services', 'Class:ServiceFamily/Attribute:services_list+' => 'Alle Services dieser Kategorie', -)); +]); // // Class: Service // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Service' => 'Service', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -244,13 +244,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Service/Attribute:functionalcis_list+' => 'Alle CIs, die zur Bereitstellung dieses Services verwendet werden', 'Class:Service/Attribute:servicesubcategories_list' => 'Service-Subkategorien', 'Class:Service/Attribute:servicesubcategories_list+' => 'Alle Service-Unterkategorien für diesen Service', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkDocumentToService' => 'Verknüpfung Dokument/Service', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -262,13 +262,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Dokument-Name', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkContactToService' => 'Verknüpfung Kontakt/Service', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -280,13 +280,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Kontakt-name', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ServiceSubcategory' => 'Service-Unterkategorien', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -312,13 +312,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => '', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'Produktion', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => '', -)); +]); // // Class: SLA // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Name', @@ -334,13 +334,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:SLA/Attribute:customercontracts_list' => 'Kundenverträge', 'Class:SLA/Attribute:customercontracts_list+' => 'Alle Kundenverträge, die diese SLA verwenden', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Die Verknüpfung zwischen Kundenvertrag %1$s und Service %2$s konnte nicht gespeichert werden: SLA existiert bereits', -)); +]); // // Class: SLT // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => 'Service-Level-Target (SLT)', 'Class:SLT/Attribute:name' => 'Name', @@ -377,13 +377,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:SLT/Attribute:unit/Value:minutes+' => 'Minuten', 'Class:SLT/Attribute:slas_list' => 'SLAs', 'Class:SLT/Attribute:slas_list+' => 'Alle Service Level Agreements, die diese SLT verwenden', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkSLAToSLT' => 'Verknüpfung SLA/SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -405,13 +405,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => 'Zeit, nach der das SLT abläuft.', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'SLT Einheit', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkCustomerContractToService' => 'Verknüpfung Kunden-Vertrag/Service', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -427,13 +427,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA-Name', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkProviderContractToService' => 'Verknüpfung Provider-Vertrag/Service', 'Class:lnkProviderContractToService+' => '', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s', @@ -445,13 +445,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Providervertrags-Name', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:DeliveryModel' => 'Delivery-Modell', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Name', @@ -466,13 +466,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Alle Kontakte (Teams and Person) für dieses Delivery-Modell', 'Class:DeliveryModel/Attribute:customers_list' => 'Kunden', 'Class:DeliveryModel/Attribute:customers_list+' => 'Alle Kunden mit diesem Delivery-Modell', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkDeliveryModelToContact' => 'Verknüpfung Delivery-Modell/Kontakt', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -488,44 +488,44 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Rollen-Name', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/en.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/en.dict.itop-service-mgmt.php index 20a6cfe45..61b330403 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/en.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/en.dict.itop-service-mgmt.php @@ -1,4 +1,5 @@ 'Service management', 'Menu:ServiceManagement+' => 'Service management overview', 'Menu:Service:Overview' => 'Overview', @@ -65,34 +66,33 @@ Dict::Add('EN US', 'English', 'English', array( 'Contract:baseinfo' => 'General information', 'Contract:moreinfo' => 'Contractual information', 'Contract:cost' => 'Cost information', -)); +]); // // Class: Organization // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Delivery model', 'Class:Organization/Attribute:deliverymodel_id+' => 'This is required for Tickets handling. The delivery model specifies the teams to which tickets can be assigned.', 'Class:Organization/Attribute:deliverymodel_name' => 'Delivery model name', -)); - +]); // // Class: ContractType // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ContractType' => 'Contract Type', 'Class:ContractType+' => '', -)); +]); // // Class: Contract // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Contract' => 'Contract', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Name', @@ -141,23 +141,23 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Contract/Attribute:status/Value:production+' => 'production', 'Class:Contract/Attribute:finalclass' => 'Contract sub-class', 'Class:Contract/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: CustomerContract // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:CustomerContract' => 'Customer Contract', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Services', 'Class:CustomerContract/Attribute:services_list+' => 'All the services purchased for this contract', -)); +]); // // Class: ProviderContract // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ProviderContract' => 'Provider Contract', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CIs', @@ -172,13 +172,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => 'Services', 'Class:ProviderContract/Attribute:services_list+' => 'All the services purchased with this contract', -)); +]); // // Class: lnkContactToContract // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkContactToContract' => 'Link Contact / Contract', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -190,13 +190,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Contact Name', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkContractToDocument' => 'Link Contract / Document', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -208,13 +208,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Document Name', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ServiceFamily' => 'Service Family', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Name', @@ -223,13 +223,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Services', 'Class:ServiceFamily/Attribute:services_list+' => 'All the services in this category', -)); +]); // // Class: Service // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Service' => 'Service', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -267,13 +267,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Service/Attribute:functionalcis_list+' => 'All the configuration items that are used to provide this service', 'Class:Service/Attribute:servicesubcategories_list' => 'Service sub categories', 'Class:Service/Attribute:servicesubcategories_list+' => 'All the sub categories for this service', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkDocumentToService' => 'Link Document / Service', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -285,13 +285,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Document Name', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkContactToService' => 'Link Contact / Service', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -303,13 +303,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Contact Name', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ServiceSubcategory' => 'Service Subcategory', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -335,13 +335,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => 'obsolete', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'production', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => 'production', -)); +]); // // Class: SLA // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Name', @@ -357,13 +357,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:SLA/Attribute:customercontracts_list' => 'Customer contracts', 'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracted services using this SLA', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists', -)); +]); // // Class: SLT // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Name', @@ -400,13 +400,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:SLT/Attribute:unit/Value:minutes+' => 'minutes', 'Class:SLT/Attribute:slas_list' => 'SLAs', 'Class:SLT/Attribute:slas_list+' => 'All the service level agreements using this SLT', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkSLAToSLT' => 'Link SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -428,13 +428,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Slt value unit', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkCustomerContractToService' => 'Link Customer Contract / Service', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -450,13 +450,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA Name', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkProviderContractToService' => 'Link Provider Contract / Service', 'Class:lnkProviderContractToService+' => '', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s', @@ -468,13 +468,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Provider contract Name', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:DeliveryModel' => 'Delivery Model', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Name', @@ -489,13 +489,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'All the contacts (Teams and Persons) for this delivery model', 'Class:DeliveryModel/Attribute:customers_list' => 'Customers', 'Class:DeliveryModel/Attribute:customers_list+' => 'All the customers having this delivering model', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkDeliveryModelToContact' => 'Link Delivery Model / Contact', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -511,44 +511,44 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Role name', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id', 'Class:lnkContactToContract/Attribute:customer_id+' => '', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id', 'Class:lnkContactToContract/Attribute:provider_id+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id', 'Class:lnkContractToDocument/Attribute:customer_id+' => '', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id', 'Class:lnkContractToDocument/Attribute:provider_id+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/en_gb.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/en_gb.dict.itop-service-mgmt.php index 766464ceb..1ad2a2dc3 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/en_gb.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/en_gb.dict.itop-service-mgmt.php @@ -1,4 +1,5 @@ 'Service management', 'Menu:ServiceManagement+' => 'Service management overview', 'Menu:Service:Overview' => 'Overview', @@ -65,34 +66,33 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Contract:baseinfo' => 'General information', 'Contract:moreinfo' => 'Contractual information', 'Contract:cost' => 'Cost information', -)); +]); // // Class: Organization // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Delivery model', 'Class:Organization/Attribute:deliverymodel_id+' => 'This is required for Tickets handling. The delivery model specifies the teams to which tickets can be assigned.', 'Class:Organization/Attribute:deliverymodel_name' => 'Delivery model name', -)); - +]); // // Class: ContractType // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ContractType' => 'Contract Type', 'Class:ContractType+' => '', -)); +]); // // Class: Contract // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Contract' => 'Contract', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Name', @@ -141,23 +141,23 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Contract/Attribute:status/Value:production+' => 'production', 'Class:Contract/Attribute:finalclass' => 'Contract sub-class', 'Class:Contract/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: CustomerContract // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:CustomerContract' => 'Customer Contract', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Services', 'Class:CustomerContract/Attribute:services_list+' => 'All the services purchased for this contract', -)); +]); // // Class: ProviderContract // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ProviderContract' => 'Provider Contract', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CIs', @@ -172,13 +172,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => 'Services', 'Class:ProviderContract/Attribute:services_list+' => 'All the services purchased with this contract', -)); +]); // // Class: lnkContactToContract // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkContactToContract' => 'Link Contact / Contract', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -190,13 +190,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Contact Name', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkContractToDocument' => 'Link Contract / Document', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -208,13 +208,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Document Name', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ServiceFamily' => 'Service Family', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Name', @@ -223,13 +223,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Services', 'Class:ServiceFamily/Attribute:services_list+' => 'All the services in this category', -)); +]); // // Class: Service // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Service' => 'Service', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -267,13 +267,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Service/Attribute:functionalcis_list+' => 'All the configuration items that are used to provide this service', 'Class:Service/Attribute:servicesubcategories_list' => 'Service sub categories', 'Class:Service/Attribute:servicesubcategories_list+' => 'All the sub categories for this service', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkDocumentToService' => 'Link Document / Service', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -285,13 +285,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Document Name', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkContactToService' => 'Link Contact / Service', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -303,13 +303,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Contact Name', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ServiceSubcategory' => 'Service Subcategory', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -335,13 +335,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => 'obsolete', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'production', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => 'production', -)); +]); // // Class: SLA // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Name', @@ -357,13 +357,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:SLA/Attribute:customercontracts_list' => 'Customer contracts', 'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracted services using this SLA', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists', -)); +]); // // Class: SLT // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Name', @@ -400,13 +400,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:SLT/Attribute:unit/Value:minutes+' => 'minutes', 'Class:SLT/Attribute:slas_list' => 'SLAs', 'Class:SLT/Attribute:slas_list+' => 'All the service level agreements using this SLT', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkSLAToSLT' => 'Link SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -428,13 +428,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Slt value unit', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkCustomerContractToService' => 'Link Customer Contract / Service', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -450,13 +450,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA Name', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkProviderContractToService' => 'Link Provider Contract / Service', 'Class:lnkProviderContractToService+' => '', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s', @@ -468,13 +468,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Provider contract Name', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:DeliveryModel' => 'Delivery Model', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Name', @@ -489,13 +489,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'All the contacts (Teams and Person) for this delivery model', 'Class:DeliveryModel/Attribute:customers_list' => 'Customers', 'Class:DeliveryModel/Attribute:customers_list+' => 'All the customers having this delivering model', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkDeliveryModelToContact' => 'Link Delivery Model / Contact', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -511,4 +511,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Role name', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/es_cr.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/es_cr.dict.itop-service-mgmt.php index 33e142ebf..b2bd7b5e6 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/es_cr.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/es_cr.dict.itop-service-mgmt.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:ServiceManagement' => 'Administración de Servicios', 'Menu:ServiceManagement+' => 'Administración de Servicios', 'Menu:Service:Overview' => 'Resumen de servicios', @@ -38,35 +39,34 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Contract:baseinfo' => 'Información General', 'Contract:moreinfo' => 'Información Contractual', 'Contract:cost' => 'Información de Costos', -)); +]); // // Class: Organization // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Modelo de Entrega', 'Class:Organization/Attribute:deliverymodel_id+' => 'Modelo de Entrega', 'Class:Organization/Attribute:deliverymodel_name' => 'Nombre del Modelo de Entrega', 'Class:Organization/Attribute:deliverymodel_name+' => 'This is required for Tickets handling. -The delivery model specifies the teams to which tickets can be assigned.~~' -)); - +The delivery model specifies the teams to which tickets can be assigned.~~', +]); // // Class: ContractType // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ContractType' => 'Tipo de Contrato', 'Class:ContractType+' => 'Tipo de Contrato', -)); +]); // // Class: Contract // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Contract' => 'Contrato', 'Class:Contract+' => 'Contrato', 'Class:Contract/Attribute:name' => 'Nombre', @@ -115,23 +115,23 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Contract/Attribute:status/Value:production+' => 'Productivo', 'Class:Contract/Attribute:finalclass' => 'Clase', 'Class:Contract/Attribute:finalclass+' => 'Clase', -)); +]); // // Class: CustomerContract // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:CustomerContract' => 'Acuerdo con Cliente', 'Class:CustomerContract+' => 'Acuerdo con Cliente', 'Class:CustomerContract/Attribute:services_list' => 'Servicios', 'Class:CustomerContract/Attribute:services_list+' => 'Servicios', -)); +]); // // Class: ProviderContract // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ProviderContract' => 'Contrato con Proveedor', 'Class:ProviderContract+' => 'Contrato con Proveedor', 'Class:ProviderContract/Attribute:functionalcis_list' => 'ECs', @@ -146,13 +146,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:ProviderContract/Attribute:contracttype_name+' => 'Tipo de Contrato', 'Class:ProviderContract/Attribute:services_list' => 'Servicios', 'Class:ProviderContract/Attribute:services_list+' => 'Todos los servicios adquiridos con este contrato', -)); +]); // // Class: lnkContactToContract // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkContactToContract' => 'Relación Contacto y Contrato', 'Class:lnkContactToContract+' => 'Relación Contacto y Contrato', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -164,13 +164,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkContactToContract/Attribute:contact_id+' => 'Contacto', 'Class:lnkContactToContract/Attribute:contact_name' => 'Contacto', 'Class:lnkContactToContract/Attribute:contact_name+' => 'Contacto', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkContractToDocument' => 'Relación Contrato y Documento', 'Class:lnkContractToDocument+' => 'Relación Contrato y Documento', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -182,13 +182,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkContractToDocument/Attribute:document_id+' => 'Documento', 'Class:lnkContractToDocument/Attribute:document_name' => 'Documento', 'Class:lnkContractToDocument/Attribute:document_name+' => 'Documento', -)); +]); // // Class: ServiceFamily // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ServiceFamily' => 'Familia de Servicios', 'Class:ServiceFamily+' => 'Familia de Servicios', 'Class:ServiceFamily/Attribute:name' => 'Nombre', @@ -197,13 +197,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Servicios', 'Class:ServiceFamily/Attribute:services_list+' => 'Servicios', -)); +]); // // Class: Service // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Service' => 'Servicio', 'Class:Service+' => 'Servicio', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -241,13 +241,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Service/Attribute:functionalcis_list+' => 'Depende de ECs', 'Class:Service/Attribute:servicesubcategories_list' => 'Subcategorias de Servicio', 'Class:Service/Attribute:servicesubcategories_list+' => 'Subcategorias de Servicio', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkDocumentToService' => 'Relación Documento y Servicio', 'Class:lnkDocumentToService+' => 'Relación Documento y Servicio', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -259,13 +259,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkDocumentToService/Attribute:document_id+' => 'Documento', 'Class:lnkDocumentToService/Attribute:document_name' => 'Documento', 'Class:lnkDocumentToService/Attribute:document_name+' => 'Documento', -)); +]); // // Class: lnkContactToService // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkContactToService' => 'Relación Contacto y Servicio', 'Class:lnkContactToService+' => 'Relación Contacto y Servicio', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -277,13 +277,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkContactToService/Attribute:contact_id+' => 'Contacto', 'Class:lnkContactToService/Attribute:contact_name' => 'Contacto', 'Class:lnkContactToService/Attribute:contact_name+' => 'Contacto', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ServiceSubcategory' => 'Subcategoría', 'Class:ServiceSubcategory+' => 'Subcategoría', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -309,13 +309,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => 'Obsoleto', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'Productivo', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => 'Productivo', -)); +]); // // Class: SLA // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:SLA' => 'SLA - Acuerdo de Nivel de Servicio', 'Class:SLA+' => 'SLA - Acuerdo de Nivel de Servicio', 'Class:SLA/Attribute:name' => 'Nombre', @@ -331,13 +331,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:SLA/Attribute:customercontracts_list' => 'Acuerdos con Clientes', 'Class:SLA/Attribute:customercontracts_list+' => 'Acuerdos con Clientes', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'No se puede guardar relación de Acuerco con Cliente %1$s con Servicio %2$s : El SLA ya existe', -)); +]); // // Class: SLT // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:SLT' => 'SLT - Objetivos de Nivel de Servicio', 'Class:SLT+' => 'SLT - Objetivos de Nivel de Servicio', 'Class:SLT/Attribute:name' => 'Nombre', @@ -374,13 +374,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:SLT/Attribute:unit/Value:minutes+' => 'Minutos', 'Class:SLT/Attribute:slas_list' => 'SLAs', 'Class:SLT/Attribute:slas_list+' => 'Todos los acuerdos de nivel de servicio que utilizan este SLT', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkSLAToSLT' => 'Relación SLA y SLT', 'Class:lnkSLAToSLT+' => 'Relación SLA y SLT', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -402,13 +402,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Unidad', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkCustomerContractToService' => 'Relación Acuerdo con Cliente y Servicio', 'Class:lnkCustomerContractToService+' => 'Relación Acuerdo con Cliente y Servicio', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -424,13 +424,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => 'SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => 'SLA', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkProviderContractToService' => 'Relación Contrato con Proveedor y Servicio', 'Class:lnkProviderContractToService+' => 'Relación Contrato con Proveedor y Servicio', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s', @@ -442,13 +442,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => 'Contrato con Proveedor', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Contrato con Proveedor', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => 'Contrato con Proveedor', -)); +]); // // Class: DeliveryModel // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:DeliveryModel' => 'Modelo de Entrega', 'Class:DeliveryModel+' => 'Modelo de Entrega', 'Class:DeliveryModel/Attribute:name' => 'Nombre', @@ -463,13 +463,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Contactos', 'Class:DeliveryModel/Attribute:customers_list' => 'Clientes', 'Class:DeliveryModel/Attribute:customers_list+' => 'Clientes', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkDeliveryModelToContact' => 'Relación Modelo de Entrega y Contacto', 'Class:lnkDeliveryModelToContact+' => 'Relación Modelo de Entrega y Contacto', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -485,44 +485,44 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => 'Rol', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Rol', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => 'Rol', -)); +]); // // Class: lnkContactToContract // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/fr.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/fr.dict.itop-service-mgmt.php index 8edfeca80..ce497cfb0 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/fr.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/fr.dict.itop-service-mgmt.php @@ -1,15 +1,16 @@ 'Gestion des services', 'Menu:ServiceManagement+' => '', 'Menu:Service:Overview' => 'Vue d\'ensemble', @@ -40,33 +41,32 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Contract:baseinfo' => 'Information générale', 'Contract:moreinfo' => 'Aspects contractuels', 'Contract:cost' => 'Coûts', -)); +]); // // Class: Organization // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Modèle de support', 'Class:Organization/Attribute:deliverymodel_id+' => 'C\'est indispensable pour définir les équipes auxquelles les tickets pourront être assignés', 'Class:Organization/Attribute:deliverymodel_name' => 'Nom modèle de support', -)); - +]); // // Class: ContractType // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ContractType' => 'Type de contrat', 'Class:ContractType+' => '', -)); +]); // // Class: Contract // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Contract' => 'Contrat', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Nom', @@ -115,23 +115,23 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Contract/Attribute:status/Value:production+' => '', 'Class:Contract/Attribute:finalclass' => 'Sous-classe de Contrat', 'Class:Contract/Attribute:finalclass+' => 'Nom de la classe instanciable', -)); +]); // // Class: CustomerContract // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:CustomerContract' => 'Contrat client', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Services', 'Class:CustomerContract/Attribute:services_list+' => 'Tous les services achetés pour ce contrat', -)); +]); // // Class: ProviderContract // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ProviderContract' => 'Contrat fournisseur', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CIs', @@ -146,13 +146,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => 'Services', 'Class:ProviderContract/Attribute:services_list+' => 'Tous les services achetés par ce contrat', -)); +]); // // Class: lnkContactToContract // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkContactToContract' => 'Lien Contact / Contrat', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -164,13 +164,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Nom contact', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkContractToDocument' => 'Lien Contrat / Document', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -182,13 +182,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Nom document', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ServiceFamily' => 'Famille de service', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Nom', @@ -197,13 +197,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Services', 'Class:ServiceFamily/Attribute:services_list+' => 'Tous les services de cette catégorie', -)); +]); // // Class: Service // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Service' => 'Service', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -252,14 +252,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Service/Attribute:servicesubcategories_list/UI:Links:Delete:Button+' => 'Supprimer cette %4$s', 'Class:Service/Attribute:servicesubcategories_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:Service/Attribute:servicesubcategories_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:Service/Attribute:servicesubcategories_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s' -)); + 'Class:Service/Attribute:servicesubcategories_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s', +]); // // Class: lnkDocumentToService // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkDocumentToService' => 'Lien Document / Service', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -271,13 +271,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Nom document', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkContactToService' => 'Lien Contact / Service', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -289,13 +289,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Nom contact', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ServiceSubcategory' => 'Sous catégorie de service', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -321,13 +321,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => '', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'Production', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => '', -)); +]); // // Class: SLA // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:SLA' => 'Niveau de service', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Nom', @@ -348,14 +348,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:SLA/Attribute:customercontracts_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:SLA/Attribute:customercontracts_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', 'Class:SLA/Attribute:customercontracts_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s', - 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Impossible de sauvegarder le lien avec le contrat client %1$s et le service %2$s : un SLA existe déjà.' -)); + 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Impossible de sauvegarder le lien avec le contrat client %1$s et le service %2$s : un SLA existe déjà.', +]); // // Class: SLT // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => 'Objectif de niveau de service (SLT)', 'Class:SLT/Attribute:name' => 'Nom', @@ -392,13 +392,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:SLT/Attribute:unit/Value:minutes+' => 'minutes', 'Class:SLT/Attribute:slas_list' => 'SLAs', 'Class:SLT/Attribute:slas_list+' => 'Tous les niveaux de service utilisant cet objectif', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkSLAToSLT' => 'Lien SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -420,13 +420,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Unité SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkCustomerContractToService' => 'Lien Contrat client / Service', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -442,13 +442,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'Nom SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkProviderContractToService' => 'Lien Contrat fournisseur / Service', 'Class:lnkProviderContractToService+' => '', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s', @@ -460,13 +460,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Nom contrat fournisseur', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:DeliveryModel' => 'Modèle de support', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Nom du modèle de support', @@ -486,14 +486,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:DeliveryModel/Attribute:customers_list/UI:Links:Delete:Button+' => 'Supprimer ce %4$s', 'Class:DeliveryModel/Attribute:customers_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:DeliveryModel/Attribute:customers_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', - 'Class:DeliveryModel/Attribute:customers_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s' -)); + 'Class:DeliveryModel/Attribute:customers_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s', +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkDeliveryModelToContact' => 'Lien Modèle de support / Contact', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -509,44 +509,44 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Nom Rôle', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/hu.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/hu.dict.itop-service-mgmt.php index 12ef83efd..a47486571 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/hu.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/hu.dict.itop-service-mgmt.php @@ -1,15 +1,16 @@ 'Szolgáltatáskezelés', 'Menu:ServiceManagement+' => '', 'Menu:Service:Overview' => 'Áttekintő', @@ -40,35 +41,34 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); // // Class: Organization // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Teljesítési modell', 'Class:Organization/Attribute:deliverymodel_id+' => 'Ki kinek szolgáltat', 'Class:Organization/Attribute:deliverymodel_name' => 'Teljesítési modell név', 'Class:Organization/Attribute:deliverymodel_name+' => 'This is required for Tickets handling. -The delivery model specifies the teams to which tickets can be assigned.~~' -)); - +The delivery model specifies the teams to which tickets can be assigned.~~', +]); // // Class: ContractType // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ContractType' => 'Szerződés típus', 'Class:ContractType+' => '~~', -)); +]); // // Class: Contract // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Contract' => 'Szerződés', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Szerződés név', @@ -117,23 +117,23 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Contract/Attribute:status/Value:production+' => 'használatban', 'Class:Contract/Attribute:finalclass' => 'Szerződés típus', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:CustomerContract' => 'Ügyfélszerződés', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Szolgáltatások', 'Class:CustomerContract/Attribute:services_list+' => 'Szolgáltatások melyek be lettek szerezve ennek a kapcsolattartónak', -)); +]); // // Class: ProviderContract // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ProviderContract' => 'Szolgáltatói szerződés', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CI-k', @@ -148,13 +148,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => 'Services~~', 'Class:ProviderContract/Attribute:services_list+' => 'All the services purchased with this contract~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkContactToContract' => 'Kapcsolattartó / Szerződés', 'Class:lnkContactToContract+' => '~~', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -166,13 +166,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '~~', 'Class:lnkContactToContract/Attribute:contact_name' => 'Kapcsolattartó név', 'Class:lnkContactToContract/Attribute:contact_name+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkContractToDocument' => 'Szerződés / Dokumentum', 'Class:lnkContractToDocument+' => '~~', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -184,13 +184,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '~~', 'Class:lnkContractToDocument/Attribute:document_name' => 'Dokumentum név', 'Class:lnkContractToDocument/Attribute:document_name+' => '~~', -)); +]); // // Class: ServiceFamily // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ServiceFamily' => 'Szolgáltatáscsalád', 'Class:ServiceFamily+' => '~~', 'Class:ServiceFamily/Attribute:name' => 'Név', @@ -199,13 +199,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:ServiceFamily/Attribute:icon+' => '~~', 'Class:ServiceFamily/Attribute:services_list' => 'Szolgáltatások', 'Class:ServiceFamily/Attribute:services_list+' => 'Szolgáltatások ebben a kategóriában', -)); +]); // // Class: Service // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Service' => 'Szolgáltatás', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -243,13 +243,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Service/Attribute:functionalcis_list+' => 'Konfigurációs elemek, melyek ehhez a szolgáltatáshoz kellenek', 'Class:Service/Attribute:servicesubcategories_list' => 'Szolgáltatás alkategóriák', 'Class:Service/Attribute:servicesubcategories_list+' => 'A szolgáltatás alkategóriái', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkDocumentToService' => 'Dokumentum / Szolgáltatás', 'Class:lnkDocumentToService+' => '~~', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -261,13 +261,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '~~', 'Class:lnkDocumentToService/Attribute:document_name' => 'Dokumentum név', 'Class:lnkDocumentToService/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkContactToService // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkContactToService' => 'Kapcsolattartó / Szolgáltatás', 'Class:lnkContactToService+' => '~~', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -279,13 +279,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkContactToService/Attribute:contact_id+' => '~~', 'Class:lnkContactToService/Attribute:contact_name' => 'Kapcsolattartó név', 'Class:lnkContactToService/Attribute:contact_name+' => '~~', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ServiceSubcategory' => 'Szolgáltatás alkategória', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -311,13 +311,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => 'obsolete~~', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'Bevezetve', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => 'production~~', -)); +]); // // Class: SLA // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => 'Szolgáltatásszint megállapodás', 'Class:SLA/Attribute:name' => 'SLA Név', @@ -333,13 +333,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:SLA/Attribute:customercontracts_list' => 'Ügyfélszerződések', 'Class:SLA/Attribute:customercontracts_list+' => 'Ügyfélszerződések, melyek ehhez az SLA-hoz kapcsolódnak', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Nem sikerült elmenteni a linket az Ügyfél szerződés %1$s és szolgáltatás %2$s között: SLA már létezik', -)); +]); // // Class: SLT // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'SLT név', @@ -376,13 +376,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:SLT/Attribute:unit/Value:minutes+' => '', 'Class:SLT/Attribute:slas_list' => 'SLAs~~', 'Class:SLT/Attribute:slas_list+' => 'All the service level agreements using this SLT~~', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkSLAToSLT' => 'SLA / SLT', 'Class:lnkSLAToSLT+' => '~~', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -404,13 +404,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'SLT érték egység', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkCustomerContractToService' => 'Ügyfélszerződés / Szolgáltatás', 'Class:lnkCustomerContractToService+' => '~~', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -426,13 +426,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '~~', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA név', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkProviderContractToService' => 'Szolgáltatói szerződés / Szolgáltatás', 'Class:lnkProviderContractToService+' => '~~', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s~~', @@ -444,13 +444,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '~~', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Szolgáltatói szerződés név', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '~~', -)); +]); // // Class: DeliveryModel // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:DeliveryModel' => 'Teljesítési modell', 'Class:DeliveryModel+' => 'Ki kinek szolgáltat', 'Class:DeliveryModel/Attribute:name' => 'Teljesítési modell név', @@ -465,13 +465,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Kapcsolattartók (csapat és személy) ehhez a teljesítési modellhez', 'Class:DeliveryModel/Attribute:customers_list' => 'Ügyfelek', 'Class:DeliveryModel/Attribute:customers_list+' => 'Ügyfelek, melyek rendelkeznek ezzel a teljesítési modellel', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkDeliveryModelToContact' => 'Teljesítési modell / Kapcsolattartó', 'Class:lnkDeliveryModelToContact+' => '~~', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -487,44 +487,44 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '~~', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Szerepkör név', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/it.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/it.dict.itop-service-mgmt.php index 916da818b..9c2d005a4 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/it.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/it.dict.itop-service-mgmt.php @@ -1,15 +1,16 @@ 'Gestione del servizio', 'Menu:ServiceManagement+' => 'Panoramica della gestione del servizio', 'Menu:Service:Overview' => 'Panoramica', @@ -40,34 +41,33 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Contract:baseinfo' => 'Informazioni Generali', 'Contract:moreinfo' => 'Informazioni Contrattuali', 'Contract:cost' => 'Informazioni sui Costi', -)); +]); // // Class: Organization // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Modello di Consegna', 'Class:Organization/Attribute:deliverymodel_id+' => 'This is required for Tickets handling. The delivery model specifies the teams to which tickets can be assigned.~~', 'Class:Organization/Attribute:deliverymodel_name' => 'Nome del Modello di Consegna', -)); - +]); // // Class: ContractType // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ContractType' => 'Tipo di Contratto', 'Class:ContractType+' => '~~', -)); +]); // // Class: Contract // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Contract' => 'Contratto', 'Class:Contract+' => '~~', 'Class:Contract/Attribute:name' => 'Nome', @@ -116,23 +116,23 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Contract/Attribute:status/Value:production+' => 'production~~', 'Class:Contract/Attribute:finalclass' => 'Tipo', 'Class:Contract/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: CustomerContract // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:CustomerContract' => 'Contratto con cliente', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Servizi', 'Class:CustomerContract/Attribute:services_list+' => 'Tutti i servizi acquistati per questo contratto', -)); +]); // // Class: ProviderContract // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ProviderContract' => 'Contratto con Provider', 'Class:ProviderContract+' => '~~', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CI', @@ -147,13 +147,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '~~', 'Class:ProviderContract/Attribute:services_list' => 'Services~~', 'Class:ProviderContract/Attribute:services_list+' => 'All the services purchased with this contract~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkContactToContract' => 'Link Contact / Contract', 'Class:lnkContactToContract+' => '~~', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -165,13 +165,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '~~', 'Class:lnkContactToContract/Attribute:contact_name' => 'Nome del Contatto', 'Class:lnkContactToContract/Attribute:contact_name+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkContractToDocument' => 'Link Contract / Document', 'Class:lnkContractToDocument+' => '~~', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -183,13 +183,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '~~', 'Class:lnkContractToDocument/Attribute:document_name' => 'Nome del Documento', 'Class:lnkContractToDocument/Attribute:document_name+' => '~~', -)); +]); // // Class: ServiceFamily // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ServiceFamily' => 'Famiglia di Servizi', 'Class:ServiceFamily+' => '~~', 'Class:ServiceFamily/Attribute:name' => 'Nome', @@ -198,13 +198,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:ServiceFamily/Attribute:icon+' => '~~', 'Class:ServiceFamily/Attribute:services_list' => 'Servizi', 'Class:ServiceFamily/Attribute:services_list+' => 'Tutti i servizi in questa categoria', -)); +]); // // Class: Service // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Service' => 'Servizio', 'Class:Service+' => '~~', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -242,13 +242,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Service/Attribute:functionalcis_list+' => 'Tutti gli elementi di configurazione utilizzati per fornire questo servizio', 'Class:Service/Attribute:servicesubcategories_list' => 'Sotto-categorie di Servizio', 'Class:Service/Attribute:servicesubcategories_list+' => 'Tutte le sotto-categorie per questo servizio', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkDocumentToService' => 'Link Document / Service', 'Class:lnkDocumentToService+' => '~~', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -260,13 +260,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '~~', 'Class:lnkDocumentToService/Attribute:document_name' => 'Nome del Documento', 'Class:lnkDocumentToService/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkContactToService // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkContactToService' => 'Link Contact / Service', 'Class:lnkContactToService+' => '~~', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -278,13 +278,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkContactToService/Attribute:contact_id+' => '~~', 'Class:lnkContactToService/Attribute:contact_name' => 'Nome del Contatto', 'Class:lnkContactToService/Attribute:contact_name+' => '~~', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ServiceSubcategory' => 'Sottocategorie del servizio', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -310,13 +310,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => 'obsolete~~', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'produzione', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => 'production~~', -)); +]); // // Class: SLA // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Nome', @@ -332,13 +332,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:SLA/Attribute:customercontracts_list' => 'Contratti Cliente', 'Class:SLA/Attribute:customercontracts_list+' => 'Tutti i contratti cliente che utilizzano questo SLA', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Impossibile salvare il collegamento con il contratto cliente %1$s e il servizio %2$s: SLA già esistente', -)); +]); // // Class: SLT // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '~~', 'Class:SLT/Attribute:name' => 'Nome', @@ -375,13 +375,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:SLT/Attribute:unit/Value:minutes+' => 'minutes~~', 'Class:SLT/Attribute:slas_list' => 'SLA', 'Class:SLT/Attribute:slas_list+' => 'Tutti gli accordi di livello di servizio che utilizzano questo SLT', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkSLAToSLT' => 'Link SLA / SLT', 'Class:lnkSLAToSLT+' => '~~', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -403,13 +403,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Unità di valore SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkCustomerContractToService' => 'Link Customer Contract / Service', 'Class:lnkCustomerContractToService+' => '~~', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -425,13 +425,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA Name~~', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkProviderContractToService' => 'Link Provider Contract / Service', 'Class:lnkProviderContractToService+' => '~~', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s', @@ -443,13 +443,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '~~', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Nome del Contratto con Fornitore', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '~~', -)); +]); // // Class: DeliveryModel // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:DeliveryModel' => 'Modello di Consegna', 'Class:DeliveryModel+' => '~~', 'Class:DeliveryModel/Attribute:name' => 'Nome', @@ -464,13 +464,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Tutti i contatti (Team e Persone) per questo modello di consegna', 'Class:DeliveryModel/Attribute:customers_list' => 'Clienti', 'Class:DeliveryModel/Attribute:customers_list+' => 'Tutti i clienti che utilizzano questo modello di consegna', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkDeliveryModelToContact' => 'Link Delivery Model / Contact', 'Class:lnkDeliveryModelToContact+' => '~~', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -486,44 +486,44 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '~~', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Nome del Ruolo', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/ja.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/ja.dict.itop-service-mgmt.php index 4e94c8460..22ed5dd17 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/ja.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/ja.dict.itop-service-mgmt.php @@ -1,15 +1,16 @@ 'サービス管理', 'Menu:ServiceManagement+' => 'サービス管理概要', 'Menu:Service:Overview' => '概要', @@ -40,34 +41,33 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); // // Class: Organization // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Organization/Attribute:deliverymodel_id' => '提供モデル', 'Class:Organization/Attribute:deliverymodel_id+' => 'This is required for Tickets handling. The delivery model specifies the teams to which tickets can be assigned.~~', 'Class:Organization/Attribute:deliverymodel_name' => '提供モデル名', -)); - +]); // // Class: ContractType // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ContractType' => '契約タイプ', 'Class:ContractType+' => '', -)); +]); // // Class: Contract // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Contract' => '契約', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => '名前', @@ -116,23 +116,23 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Contract/Attribute:status/Value:production+' => '稼働', 'Class:Contract/Attribute:finalclass' => 'タイプ', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:CustomerContract' => '顧客契約', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'サービス', 'Class:CustomerContract/Attribute:services_list+' => 'All the services purchased for this contract~~', -)); +]); // // Class: ProviderContract // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ProviderContract' => 'プロバイダー契約', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CI', @@ -147,13 +147,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => 'Services~~', 'Class:ProviderContract/Attribute:services_list+' => 'All the services purchased with this contract~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkContactToContract' => 'リンク 連絡先/契約', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -165,13 +165,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => '連絡先名', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkContractToDocument' => 'リンク 契約/文書', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -183,13 +183,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => '文書名', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ServiceFamily' => 'サービスファミリ', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => '名前', @@ -198,13 +198,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'サービス', 'Class:ServiceFamily/Attribute:services_list+' => 'All the services in this category~~', -)); +]); // // Class: Service // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Service' => 'サービス', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -242,13 +242,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Service/Attribute:functionalcis_list+' => 'All the configuration items that are used to provide this service~~', 'Class:Service/Attribute:servicesubcategories_list' => 'サービスサブカテゴリ', 'Class:Service/Attribute:servicesubcategories_list+' => 'All the sub categories for this service~~', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkDocumentToService' => 'リンク 文書/サービス', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -260,13 +260,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => '文書名', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkContactToService' => 'リンク 連絡先/サービス', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -278,13 +278,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => '連絡先名', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ServiceSubcategory' => 'サービスサブカテゴリ', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -310,13 +310,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => '廃止済み', 'Class:ServiceSubcategory/Attribute:status/Value:production' => '稼働中', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => '稼働中', -)); +]); // // Class: SLA // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => '名前', @@ -332,13 +332,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:SLA/Attribute:customercontracts_list' => '顧客連絡先', 'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracted services using this SLA~~', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists~~', -)); +]); // // Class: SLT // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => '名前', @@ -375,13 +375,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:SLT/Attribute:unit/Value:minutes+' => '分', 'Class:SLT/Attribute:slas_list' => 'SLAs~~', 'Class:SLT/Attribute:slas_list+' => 'All the service level agreements using this SLT~~', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkSLAToSLT' => 'リンク SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -403,13 +403,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Slt value unit~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkCustomerContractToService' => 'リンク 顧客契約/サービス', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -425,13 +425,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA名', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkProviderContractToService' => 'リンク プロバイダ契約/サービス', 'Class:lnkProviderContractToService+' => '', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s~~', @@ -443,13 +443,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'プロバイダ契約名', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:DeliveryModel' => '提供モデル', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => '名前', @@ -464,13 +464,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'All the contacts (Teams and Persons) for this delivery model~~', 'Class:DeliveryModel/Attribute:customers_list' => '顧客', 'Class:DeliveryModel/Attribute:customers_list+' => 'All the customers having this delivering model~~', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkDeliveryModelToContact' => 'Link 提供モデル/連絡先', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -486,44 +486,44 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => '役割名', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/nl.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/nl.dict.itop-service-mgmt.php index ebdc96778..3009ff9ed 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/nl.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/nl.dict.itop-service-mgmt.php @@ -1,17 +1,18 @@ * @author Jeffrey Bostoen (2018 - 2022) * @author Thomas Casteleyn */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:ServiceManagement' => 'Service Management', 'Menu:ServiceManagement+' => 'Overzicht van Service Management', 'Menu:Service:Overview' => 'Overzicht', @@ -42,34 +43,33 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Contract:baseinfo' => 'Algemene informatie', 'Contract:moreinfo' => 'Contractuele informatie', 'Contract:cost' => 'Financiële informatie', -)); +]); // // Class: Organization // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Leveringsmodel', 'Class:Organization/Attribute:deliverymodel_id+' => 'This is required for Tickets handling. The delivery model specifies the teams to which tickets can be assigned.~~', 'Class:Organization/Attribute:deliverymodel_name' => 'Naam leveringsmodel', -)); - +]); // // Class: ContractType // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ContractType' => 'Soort contract', 'Class:ContractType+' => '', -)); +]); // // Class: Contract // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Contract' => 'Contract', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Naam', @@ -118,23 +118,23 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Contract/Attribute:status/Value:production+' => 'Productie', 'Class:Contract/Attribute:finalclass' => 'Subklasse contract', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:CustomerContract' => 'Klantencontract', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Services', 'Class:CustomerContract/Attribute:services_list+' => 'Alle services die aangeschaft zijn voor dit contract', -)); +]); // // Class: ProviderContract // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ProviderContract' => 'Leverancierscontract', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CI\'s', @@ -149,13 +149,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => 'Services', 'Class:ProviderContract/Attribute:services_list+' => 'Alle services die aangeschaft zijn voor dit contract', -)); +]); // // Class: lnkContactToContract // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkContactToContract' => 'Link Contact / Contract', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -167,13 +167,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Naam contact', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkContractToDocument' => 'Link Contract / Document', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -185,13 +185,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Naam document', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ServiceFamily' => 'Servicecategorie', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Naam', @@ -200,13 +200,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Services', 'Class:ServiceFamily/Attribute:services_list+' => 'Alle services in deze categorie', -)); +]); // // Class: Service // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Service' => 'Service', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -244,13 +244,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Service/Attribute:functionalcis_list+' => 'Alle configuratie-items die gebruikt worden voor het beschikbaarheid van deze service', 'Class:Service/Attribute:servicesubcategories_list' => 'Subcategorieën service', 'Class:Service/Attribute:servicesubcategories_list+' => 'Alle subcategorieën van deze service', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkDocumentToService' => 'Link Document / Service', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -262,13 +262,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Naam document', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkContactToService' => 'Link Contact / Service', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -280,13 +280,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Naam contact', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ServiceSubcategory' => 'Subcategorie service', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -312,13 +312,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => 'Buiten gebruik', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'Productie', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => 'Productie', -)); +]); // // Class: SLA // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Naam', @@ -334,13 +334,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:SLA/Attribute:customercontracts_list' => 'Klantencontracten', 'Class:SLA/Attribute:customercontracts_list+' => 'Alle klantencontracten die gebruik maken van deze SLA', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Kan de link tussen klantencontract %1$s en service %2$s niet opslaan: SLA bestaat al.', -)); +]); // // Class: SLT // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Naam', @@ -377,13 +377,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:SLT/Attribute:unit/Value:minutes+' => 'minuten', 'Class:SLT/Attribute:slas_list' => 'SLAs', 'Class:SLT/Attribute:slas_list+' => 'Alle Service Level Agreements die deze SLT gebruiken', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkSLAToSLT' => 'Link SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -405,13 +405,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Eenheid SLT-waarde', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkCustomerContractToService' => 'Link Klantencontract / Service', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -427,13 +427,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'Naam SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkProviderContractToService' => 'Link Leverancierscontract / Service', 'Class:lnkProviderContractToService+' => '', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s', @@ -445,13 +445,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Naam leverancierscontract', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:DeliveryModel' => 'Delivery Model', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Naam', @@ -466,13 +466,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Alle contacten (teams en personen) voor dit leveringsmodel', 'Class:DeliveryModel/Attribute:customers_list' => 'Klanten', 'Class:DeliveryModel/Attribute:customers_list+' => 'Alle klanten die gebruik maken van dit leveringsmodel', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkDeliveryModelToContact' => 'Link Leveringsmodel / Contact', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -488,44 +488,44 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Naam rol', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/pl.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/pl.dict.itop-service-mgmt.php index 094ca6b42..fb3b06161 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/pl.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/pl.dict.itop-service-mgmt.php @@ -1,15 +1,16 @@ 'Zarządzanie usługami', 'Menu:ServiceManagement+' => 'Omówienie zarządzania usługami', 'Menu:Service:Overview' => 'Przegląd', @@ -40,34 +41,33 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Contract:baseinfo' => 'Informacje ogólne', 'Contract:moreinfo' => 'Informacje o umowach', 'Contract:cost' => 'Informacje o kosztach', -)); +]); // // Class: Organization // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Model obsługi', 'Class:Organization/Attribute:deliverymodel_id+' => 'This is required for Tickets handling. The delivery model specifies the teams to which tickets can be assigned.~~', 'Class:Organization/Attribute:deliverymodel_name' => 'Nazwa modelu obsługi', -)); - +]); // // Class: ContractType // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ContractType' => 'Typ umowy', 'Class:ContractType+' => '', -)); +]); // // Class: Contract // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Contract' => 'Umowa', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Nazwa', @@ -116,23 +116,23 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Contract/Attribute:status/Value:production+' => 'użytkowane', 'Class:Contract/Attribute:finalclass' => 'Podklasa umowy', 'Class:Contract/Attribute:finalclass+' => 'Nazwa ostatniej klasy', -)); +]); // // Class: CustomerContract // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:CustomerContract' => 'Umowa z klientem', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Usługi', 'Class:CustomerContract/Attribute:services_list+' => 'Wszystkie usługi zakupione w ramach tej umowy', -)); +]); // // Class: ProviderContract // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ProviderContract' => 'Umowa z dostawcą', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'Konfiguracje', @@ -147,13 +147,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => 'Usługi', 'Class:ProviderContract/Attribute:services_list+' => 'Wszystkie usługi zakupione w ramach niniejszej umowy', -)); +]); // // Class: lnkContactToContract // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkContactToContract' => 'Połączenie Kontakt / Umowa', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -165,13 +165,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Nazwa kontaktu', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkContractToDocument' => 'Połączenie Umowa / Dokument', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -183,13 +183,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Nazwa dokumentu', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ServiceFamily' => 'Rodzina usług', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Nazwa', @@ -198,13 +198,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Usługi', 'Class:ServiceFamily/Attribute:services_list+' => 'Wszystkie usługi w tej kategorii', -)); +]); // // Class: Service // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Service' => 'Usługa', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -242,13 +242,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Service/Attribute:functionalcis_list+' => 'Wszystkie elementy konfiguracji, które są używane do świadczenia tej usługi', 'Class:Service/Attribute:servicesubcategories_list' => 'Podkategorie usług', 'Class:Service/Attribute:servicesubcategories_list+' => 'Wszystkie podkategorie tej usługi', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkDocumentToService' => 'Połączenie Dokument / Usługa', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -260,13 +260,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Nazwa dokumentu', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkContactToService' => 'Połączenie Kontakt / Usługa', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -278,13 +278,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Nazwa kontaktu', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ServiceSubcategory' => 'Podkategoria usługi', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -310,13 +310,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => 'wycofane', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'użytkowane', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => 'użytkowane', -)); +]); // // Class: SLA // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:SLA' => 'Umowa SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Nazwa', @@ -332,13 +332,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:SLA/Attribute:customercontracts_list' => 'Umowy z klientami', 'Class:SLA/Attribute:customercontracts_list+' => 'Wszystkie umowy z klientami korzystające z tej umowy SLA', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Nie udało się zapisać połączenia z umową klienta %1$s i usługą %2$s : Umowa SLA już istnieje', -)); +]); // // Class: SLT // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:SLT' => 'Poziom usług SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Nazwa', @@ -375,13 +375,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:SLT/Attribute:unit/Value:minutes+' => 'minut', 'Class:SLT/Attribute:slas_list' => 'SLA', 'Class:SLT/Attribute:slas_list+' => 'Wszystkie umowy dotyczące poziomu usług korzystające z tego SLT', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkSLAToSLT' => 'Połączenie SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -403,13 +403,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Jednostka wartości SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkCustomerContractToService' => 'Połączenie Umowa z klientem / Usługa', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -425,13 +425,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'Nazwa umowy SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkProviderContractToService' => 'Połączenie Umowa z dostawcą / Usługa', 'Class:lnkProviderContractToService+' => '', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s', @@ -443,13 +443,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Nazwa umowy z dostawcą', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:DeliveryModel' => 'Model obsługi', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Nazwa', @@ -464,13 +464,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Wszystkie kontakty (zespoły i osoby) dla tego modelu obsługi', 'Class:DeliveryModel/Attribute:customers_list' => 'Klienci', 'Class:DeliveryModel/Attribute:customers_list+' => 'Wszyscy klienci posiadający ten model obsługi', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkDeliveryModelToContact' => 'Połączenie Model obsługi / Kontakt', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -486,44 +486,44 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Nazwa roli', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/pt_br.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/pt_br.dict.itop-service-mgmt.php index c9fd7107d..e61954efb 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/pt_br.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/pt_br.dict.itop-service-mgmt.php @@ -1,15 +1,16 @@ 'Gerenciamento de serviços', 'Menu:ServiceManagement+' => '', 'Menu:Service:Overview' => 'Visão geral', @@ -40,34 +41,33 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); // // Class: Organization // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Modelo de entrega', 'Class:Organization/Attribute:deliverymodel_id+' => 'This is required for Tickets handling. The delivery model specifies the teams to which tickets can be assigned.~~', 'Class:Organization/Attribute:deliverymodel_name' => 'Nome do modelo de entrega', -)); - +]); // // Class: ContractType // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ContractType' => 'Tipo de contrato', 'Class:ContractType+' => '', -)); +]); // // Class: Contract // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Contract' => 'Contrato', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Nome', @@ -116,23 +116,23 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Contract/Attribute:status/Value:production+' => '', 'Class:Contract/Attribute:finalclass' => 'Tipo', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:CustomerContract' => 'Contrato de Cliente', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Serviços', 'Class:CustomerContract/Attribute:services_list+' => 'Todos os serviços contratados para o presente contrato', -)); +]); // // Class: ProviderContract // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ProviderContract' => 'Contrato de provedor', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'ICs', @@ -147,13 +147,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => 'Services~~', 'Class:ProviderContract/Attribute:services_list+' => 'All the services purchased with this contract~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkContactToContract' => 'Link Contato / Contrato', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -165,13 +165,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Nome do contato', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkContractToDocument' => 'Link Contrato / Documento', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -183,13 +183,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Nome do documento', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ServiceFamily' => 'Família de Serviços', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Nome', @@ -198,13 +198,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => 'Serviços', 'Class:ServiceFamily/Attribute:services_list+' => 'Todos os serviços para essa categoria', -)); +]); // // Class: Service // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Service' => 'Serviço', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -242,13 +242,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Service/Attribute:functionalcis_list+' => 'Todos os itens de configuração que são utilizados para a prestação deste serviço', 'Class:Service/Attribute:servicesubcategories_list' => 'Subcategorias de serviço', 'Class:Service/Attribute:servicesubcategories_list+' => 'Todas as subcategorias para esse serviço', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkDocumentToService' => 'Link Documento / Serviço', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -260,13 +260,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Nome documento', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkContactToService' => 'Link Contato / Serviço', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -278,13 +278,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Nome do contato', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ServiceSubcategory' => 'Subcategorias de serviço', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -310,13 +310,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => '', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'Em produção', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => '', -)); +]); // // Class: SLA // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Nome', @@ -332,13 +332,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:SLA/Attribute:customercontracts_list' => 'Contratos de clientes', 'Class:SLA/Attribute:customercontracts_list+' => 'Todos os contratos de clientes utilizando esse Acordo de Nível de Serviço (SLA)', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Não foi possível salvar o vínculo entre o Contrato do Cliente "%1$s" e Serviço "%2$s": SLA já existe', -)); +]); // // Class: SLT // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Nome', @@ -375,13 +375,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:SLT/Attribute:unit/Value:minutes+' => '', 'Class:SLT/Attribute:slas_list' => 'SLAs~~', 'Class:SLT/Attribute:slas_list+' => 'All the service level agreements using this SLT~~', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkSLAToSLT' => 'Link SLA / SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -403,13 +403,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Unidade de valor do SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkCustomerContractToService' => 'Link Contrato de cliente / Serviço', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -425,13 +425,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'Nome do SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkProviderContractToService' => 'Link Contrato de provedor / Serviço', 'Class:lnkProviderContractToService+' => '', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s~~', @@ -443,13 +443,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Nome do contrato de provedor', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:DeliveryModel' => 'Modelo de Entrega', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Nome', @@ -464,13 +464,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Todos os Contatos (Equipe e Pessoa) para esse Modelo de entrega', 'Class:DeliveryModel/Attribute:customers_list' => 'Clientes', 'Class:DeliveryModel/Attribute:customers_list+' => 'Todos os Clientes com esse Modelo de entrega', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkDeliveryModelToContact' => 'Link Modelo de entrega / Contato', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -486,44 +486,44 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Nome da função', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/ru.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/ru.dict.itop-service-mgmt.php index 9baba0d47..d8d7c5776 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/ru.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/ru.dict.itop-service-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:ServiceManagement' => 'Управление услугами', 'Menu:ServiceManagement+' => 'Управление услугами', 'Menu:Service:Overview' => 'Обзор', @@ -41,34 +42,33 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); // // Class: Organization // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Модель предоставления услуг', 'Class:Organization/Attribute:deliverymodel_id+' => 'This is required for Tickets handling. The delivery model specifies the teams to which tickets can be assigned.~~', 'Class:Organization/Attribute:deliverymodel_name' => 'Модель предоставления услуг', -)); - +]); // // Class: ContractType // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ContractType' => 'Тип договора', 'Class:ContractType+' => '', -)); +]); // // Class: Contract // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Contract' => 'Договор', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Название', @@ -117,23 +117,23 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Contract/Attribute:status/Value:production+' => 'Эксплуатация', 'Class:Contract/Attribute:finalclass' => 'Тип', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:CustomerContract' => 'Договор с заказчиком', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Услуги', 'Class:CustomerContract/Attribute:services_list+' => 'Все услуги, предоставляемые по договору', -)); +]); // // Class: ProviderContract // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ProviderContract' => 'Договор с поставщиком', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'КЕ', @@ -148,13 +148,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => 'Services~~', 'Class:ProviderContract/Attribute:services_list+' => 'All the services purchased with this contract~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkContactToContract' => 'Связь Контакт/Договор', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -166,13 +166,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => 'Контакт', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkContractToDocument' => 'Связь Договор/Документ', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -184,13 +184,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => 'Документ', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ServiceFamily' => 'Пакет услуг', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => 'Название', @@ -199,13 +199,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:ServiceFamily/Attribute:icon+' => 'Используется на клиентском портале', 'Class:ServiceFamily/Attribute:services_list' => 'Услуги', 'Class:ServiceFamily/Attribute:services_list+' => 'Связанные услуги', -)); +]); // // Class: Service // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Service' => 'Услуга', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -243,13 +243,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Service/Attribute:functionalcis_list+' => 'Конфигурационные единицы, которые используются для предоставления услуги', 'Class:Service/Attribute:servicesubcategories_list' => 'Подкатегории услуги', 'Class:Service/Attribute:servicesubcategories_list+' => 'Подкатегории услуги', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkDocumentToService' => 'Связь Документ/Услуга', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -261,13 +261,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => 'Документ', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkContactToService' => 'Связь Контакт/Услуга', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -279,13 +279,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => 'Контакт', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ServiceSubcategory' => 'Подкатегория услуги', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -311,13 +311,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => 'Устаревший', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'Эксплуатация', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => 'Эксплуатация', -)); +]); // // Class: SLA // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => 'Название', @@ -333,13 +333,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:SLA/Attribute:customercontracts_list' => 'Договоры с заказчиками', 'Class:SLA/Attribute:customercontracts_list+' => 'Договоры с заказчиками, в которых используется SLA', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists~~', -)); +]); // // Class: SLT // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => 'Название', @@ -376,13 +376,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:SLT/Attribute:unit/Value:minutes+' => 'Минуты', 'Class:SLT/Attribute:slas_list' => 'SLAs~~', 'Class:SLT/Attribute:slas_list+' => 'All the service level agreements using this SLT~~', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkSLAToSLT' => 'Связь SLA/SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -404,13 +404,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Единицы SLT', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkCustomerContractToService' => 'Связь Договор с заказчиком/Услуга', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -426,13 +426,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkProviderContractToService' => 'Связь Договор с поставщиком/Услуга', 'Class:lnkProviderContractToService+' => '', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s~~', @@ -444,13 +444,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Договор с поставщиком', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:DeliveryModel' => 'Модель предоставления услуг', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => 'Название', @@ -465,13 +465,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Контакты (команды и персоны), которые участвуют в предоставлении услуг по этой модели', 'Class:DeliveryModel/Attribute:customers_list' => 'Заказчики', 'Class:DeliveryModel/Attribute:customers_list+' => 'Заказчики, которым предоставляются услуги по этой модели', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkDeliveryModelToContact' => 'Связь Модель предоставления услуг/Контакт', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -487,44 +487,44 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Роль', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/sk.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/sk.dict.itop-service-mgmt.php index 47f5175b5..3b8fd19d3 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/sk.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/sk.dict.itop-service-mgmt.php @@ -1,15 +1,16 @@ 'Manažment služieb', 'Menu:ServiceManagement+' => 'Service management overview~~', 'Menu:Service:Overview' => 'Prehľad', @@ -40,34 +41,33 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); // // Class: Organization // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Model dodávky', 'Class:Organization/Attribute:deliverymodel_id+' => 'This is required for Tickets handling. The delivery model specifies the teams to which tickets can be assigned.~~', 'Class:Organization/Attribute:deliverymodel_name' => 'Názov modelu dodávky', -)); - +]); // // Class: ContractType // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ContractType' => 'Typ zmluvy', 'Class:ContractType+' => '~~', -)); +]); // // Class: Contract // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Contract' => 'zmluva', 'Class:Contract+' => '~~', 'Class:Contract/Attribute:name' => 'Názov', @@ -116,23 +116,23 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Contract/Attribute:status/Value:production+' => 'production~~', 'Class:Contract/Attribute:finalclass' => 'Typ', 'Class:Contract/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: CustomerContract // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:CustomerContract' => 'Zákaznícka zmluva', 'Class:CustomerContract+' => '~~', 'Class:CustomerContract/Attribute:services_list' => 'Služby', 'Class:CustomerContract/Attribute:services_list+' => 'All the services purchased for this contract~~', -)); +]); // // Class: ProviderContract // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ProviderContract' => 'Poskytovateľská zmluva', 'Class:ProviderContract+' => '~~', 'Class:ProviderContract/Attribute:functionalcis_list' => 'Zariadenia', @@ -147,13 +147,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '~~', 'Class:ProviderContract/Attribute:services_list' => 'Services~~', 'Class:ProviderContract/Attribute:services_list+' => 'All the services purchased with this contract~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkContactToContract' => 'väzba - Kontakt / zmluva', 'Class:lnkContactToContract+' => '~~', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -165,13 +165,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '~~', 'Class:lnkContactToContract/Attribute:contact_name' => 'Názov kontaktu', 'Class:lnkContactToContract/Attribute:contact_name+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkContractToDocument' => 'väzba - zmluva / Dokument', 'Class:lnkContractToDocument+' => '~~', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -183,13 +183,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '~~', 'Class:lnkContractToDocument/Attribute:document_name' => 'Názov dokumentu', 'Class:lnkContractToDocument/Attribute:document_name+' => '~~', -)); +]); // // Class: ServiceFamily // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ServiceFamily' => 'Kategória služieb', 'Class:ServiceFamily+' => '~~', 'Class:ServiceFamily/Attribute:name' => 'Názov', @@ -198,13 +198,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:ServiceFamily/Attribute:icon+' => '~~', 'Class:ServiceFamily/Attribute:services_list' => 'Služby', 'Class:ServiceFamily/Attribute:services_list+' => 'All the services in this category~~', -)); +]); // // Class: Service // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Service' => 'Služby', 'Class:Service+' => '~~', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -242,13 +242,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Service/Attribute:functionalcis_list+' => 'All the configuration items that are used to provide this service~~', 'Class:Service/Attribute:servicesubcategories_list' => 'Podkategórie služieb', 'Class:Service/Attribute:servicesubcategories_list+' => 'All the sub categories for this service~~', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkDocumentToService' => 'väzba - Dokument / Služba', 'Class:lnkDocumentToService+' => '~~', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -260,13 +260,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '~~', 'Class:lnkDocumentToService/Attribute:document_name' => 'Názov dokumentu', 'Class:lnkDocumentToService/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkContactToService // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkContactToService' => 'väzba - Kontakt / Služba', 'Class:lnkContactToService+' => '~~', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -278,13 +278,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkContactToService/Attribute:contact_id+' => '~~', 'Class:lnkContactToService/Attribute:contact_name' => 'Názov kontaktu', 'Class:lnkContactToService/Attribute:contact_name+' => '~~', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ServiceSubcategory' => 'Podkategória služieb', 'Class:ServiceSubcategory+' => '~~', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -310,13 +310,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => 'obsolete~~', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'Produkcia', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => 'production~~', -)); +]); // // Class: SLA // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '~~', 'Class:SLA/Attribute:name' => 'Názov', @@ -332,13 +332,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:SLA/Attribute:customercontracts_list' => 'Zákaznícke zmluvy', 'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracted services using this SLA~~', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists~~', -)); +]); // // Class: SLT // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '~~', 'Class:SLT/Attribute:name' => 'Názov', @@ -375,13 +375,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:SLT/Attribute:unit/Value:minutes+' => 'minutes~~', 'Class:SLT/Attribute:slas_list' => 'SLAs~~', 'Class:SLT/Attribute:slas_list+' => 'All the service level agreements using this SLT~~', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkSLAToSLT' => 'väzba - SLA / SLT', 'Class:lnkSLAToSLT+' => '~~', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -403,13 +403,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Slt value unit~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkCustomerContractToService' => 'väzba - Zákaznícka zmluva / Služba', 'Class:lnkCustomerContractToService+' => '~~', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -425,13 +425,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '~~', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA Názov', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkProviderContractToService' => 'väzba - Poskytovateľská zmluva / Služba', 'Class:lnkProviderContractToService+' => '~~', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s~~', @@ -443,13 +443,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '~~', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Názov poskytovateľského zmluvy', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '~~', -)); +]); // // Class: DeliveryModel // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:DeliveryModel' => 'Model dodávky', 'Class:DeliveryModel+' => '~~', 'Class:DeliveryModel/Attribute:name' => 'Názov', @@ -464,13 +464,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'All the contacts (Teams and Persons) for this delivery model~~', 'Class:DeliveryModel/Attribute:customers_list' => 'Zákazníci', 'Class:DeliveryModel/Attribute:customers_list+' => 'All the customers having this delivering model~~', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkDeliveryModelToContact' => 'väzba - Model dodávky / Kontakt', 'Class:lnkDeliveryModelToContact+' => '~~', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -486,44 +486,44 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '~~', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Názov role', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/tr.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/tr.dict.itop-service-mgmt.php index 99f783380..8208036e0 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/tr.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/tr.dict.itop-service-mgmt.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Menu:ServiceManagement' => 'Hizmet yönetimi', 'Menu:ServiceManagement+' => 'Hizmet yönetimi', 'Menu:Service:Overview' => 'Özet', @@ -41,34 +42,33 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Contract:baseinfo' => 'General information~~', 'Contract:moreinfo' => 'Contractual information~~', 'Contract:cost' => 'Cost information~~', -)); +]); // // Class: Organization // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Organization/Attribute:deliverymodel_id' => 'Teslimat Modeli', 'Class:Organization/Attribute:deliverymodel_id+' => 'This is required for Tickets handling. The delivery model specifies the teams to which tickets can be assigned.~~', 'Class:Organization/Attribute:deliverymodel_name' => 'Teslimat Modeli Adı', -)); - +]); // // Class: ContractType // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ContractType' => 'Sözleşme Tipi', 'Class:ContractType+' => '~~', -)); +]); // // Class: Contract // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Contract' => 'Sözleşme', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => 'Adı', @@ -117,23 +117,23 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Contract/Attribute:status/Value:production+' => 'Kullanımda', 'Class:Contract/Attribute:finalclass' => 'Tip', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:CustomerContract' => 'Müşteri Sözleşmesi', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => 'Hizmetler', 'Class:CustomerContract/Attribute:services_list+' => 'Bu sözleşme için satın alınan tüm hizmetler', -)); +]); // // Class: ProviderContract // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ProviderContract' => 'Tedarikçi Sözleşmesi', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => 'CI\'lar', @@ -148,13 +148,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '~~', 'Class:ProviderContract/Attribute:services_list' => 'Services~~', 'Class:ProviderContract/Attribute:services_list+' => 'All the services purchased with this contract~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkContactToContract' => 'İletişim / Sözleşme bağla', 'Class:lnkContactToContract+' => '~~', 'Class:lnkContactToContract/Name' => '%1$s / %2$s~~', @@ -166,13 +166,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '~~', 'Class:lnkContactToContract/Attribute:contact_name' => 'Kişi Adı', 'Class:lnkContactToContract/Attribute:contact_name+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkContractToDocument' => 'Sözleşmesi / Belge bağla', 'Class:lnkContractToDocument+' => '~~', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s~~', @@ -184,13 +184,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '~~', 'Class:lnkContractToDocument/Attribute:document_name' => 'Belge Adı', 'Class:lnkContractToDocument/Attribute:document_name+' => '~~', -)); +]); // // Class: ServiceFamily // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ServiceFamily' => 'Servis Ailesi', 'Class:ServiceFamily+' => '~~', 'Class:ServiceFamily/Attribute:name' => 'İsim', @@ -199,13 +199,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:ServiceFamily/Attribute:icon+' => '~~', 'Class:ServiceFamily/Attribute:services_list' => 'Hizmetler', 'Class:ServiceFamily/Attribute:services_list+' => 'Bu kategorideki tüm hizmetler', -)); +]); // // Class: Service // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Service' => 'Hizmet', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s~~', @@ -243,13 +243,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Service/Attribute:functionalcis_list+' => 'Bu hizmeti sağlamak için kullanılan tüm yapılandırma öğeleri', 'Class:Service/Attribute:servicesubcategories_list' => 'Servis alt kategorileri', 'Class:Service/Attribute:servicesubcategories_list+' => 'Bu hizmet için tüm alt kategoriler', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkDocumentToService' => 'Belge / servis bağla', 'Class:lnkDocumentToService+' => '~~', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s~~', @@ -261,13 +261,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '~~', 'Class:lnkDocumentToService/Attribute:document_name' => 'Belge Adı', 'Class:lnkDocumentToService/Attribute:document_name+' => '~~', -)); +]); // // Class: lnkContactToService // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkContactToService' => 'Kişi / Servis bağla', 'Class:lnkContactToService+' => '~~', 'Class:lnkContactToService/Name' => '%1$s / %2$s~~', @@ -279,13 +279,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkContactToService/Attribute:contact_id+' => '~~', 'Class:lnkContactToService/Attribute:contact_name' => 'Kişi Adı', 'Class:lnkContactToService/Attribute:contact_name+' => '~~', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ServiceSubcategory' => 'Hizmet alt kategorisi', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s~~', @@ -311,13 +311,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => 'Kullanım dışı', 'Class:ServiceSubcategory/Attribute:status/Value:production' => 'Kullanımda', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => 'Kullanımda', -)); +]); // // Class: SLA // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => 'Hizmet Seviyesi Anlaşması', 'Class:SLA/Attribute:name' => 'Adı', @@ -333,13 +333,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:SLA/Attribute:customercontracts_list' => 'Müşteri Sözleşmeleri', 'Class:SLA/Attribute:customercontracts_list+' => 'Bu SLA\'yı kullanan tüm müşterilerin sözleşmeleri', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : SLA already exists~~', -)); +]); // // Class: SLT // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => 'Hizmet Seviyesi Taahütler', 'Class:SLT/Attribute:name' => 'Adı', @@ -376,13 +376,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:SLT/Attribute:unit/Value:minutes+' => 'dakikalar', 'Class:SLT/Attribute:slas_list' => 'SLAs~~', 'Class:SLT/Attribute:slas_list+' => 'All the service level agreements using this SLT~~', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkSLAToSLT' => 'SLA / SLT bağla', 'Class:lnkSLAToSLT+' => '~~', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s~~', @@ -404,13 +404,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'Slt value unit~~', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkCustomerContractToService' => 'Müşteri Sözleşmesi / Servis bağla', 'Class:lnkCustomerContractToService+' => '~~', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s~~', @@ -426,13 +426,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '~~', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA Adı', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkProviderContractToService' => 'Sağlayıcı Sözleşmesi / Servis bağla', 'Class:lnkProviderContractToService+' => '~~', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s~~', @@ -444,13 +444,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '~~', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => 'Sağlayıcı Sözleşme Adı', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '~~', -)); +]); // // Class: DeliveryModel // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:DeliveryModel' => 'Teslimat Modeli', 'Class:DeliveryModel+' => '~~', 'Class:DeliveryModel/Attribute:name' => 'İsim', @@ -465,13 +465,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:DeliveryModel/Attribute:contacts_list+' => 'Bu teslimat modeli için tüm temaslar (birimler ve kişi)', 'Class:DeliveryModel/Attribute:customers_list' => 'Müşteriler', 'Class:DeliveryModel/Attribute:customers_list+' => 'Bu teslimat modeline sahip tüm müşteriler', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkDeliveryModelToContact' => 'Teslimatı Modeli / Kişi bağla', 'Class:lnkDeliveryModelToContact+' => '~~', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s~~', @@ -487,44 +487,44 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '~~', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => 'Rol Adı', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/dictionaries/zh_cn.dict.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/dictionaries/zh_cn.dict.itop-service-mgmt.php index ab42ad136..e86711002 100644 --- a/datamodels/2.x/itop-service-mgmt/dictionaries/zh_cn.dict.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/dictionaries/zh_cn.dict.itop-service-mgmt.php @@ -1,4 +1,5 @@ /Stimulus: // Class:/Stimulus:+ // Menu, fieldsets, UI, messages translations -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Menu:ServiceManagement' => '服务管理', 'Menu:ServiceManagement+' => '服务管理概况', 'Menu:Service:Overview' => '概况', @@ -61,34 +62,33 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Contract:baseinfo' => '常规信息', 'Contract:moreinfo' => '合同信息', 'Contract:cost' => '费用信息', -)); +]); // // Class: Organization // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Organization/Attribute:deliverymodel_id' => '交付模式', 'Class:Organization/Attribute:deliverymodel_id+' => 'This is required for Tickets handling. The delivery model specifies the teams to which tickets can be assigned.~~', 'Class:Organization/Attribute:deliverymodel_name' => '交付模式名称', -)); - +]); // // Class: ContractType // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ContractType' => '合同类型', 'Class:ContractType+' => '', -)); +]); // // Class: Contract // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Contract' => '合同', 'Class:Contract+' => '', 'Class:Contract/Attribute:name' => '名称', @@ -137,23 +137,23 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Contract/Attribute:status/Value:production+' => '生产', 'Class:Contract/Attribute:finalclass' => '类型', 'Class:Contract/Attribute:finalclass+' => '', -)); +]); // // Class: CustomerContract // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:CustomerContract' => '客户合同', 'Class:CustomerContract+' => '', 'Class:CustomerContract/Attribute:services_list' => '服务', 'Class:CustomerContract/Attribute:services_list+' => '此合同包含的所有服务', -)); +]); // // Class: ProviderContract // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ProviderContract' => '供应商合同', 'Class:ProviderContract+' => '', 'Class:ProviderContract/Attribute:functionalcis_list' => '配置项', @@ -168,13 +168,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:ProviderContract/Attribute:contracttype_name+' => '', 'Class:ProviderContract/Attribute:services_list' => '服务', 'Class:ProviderContract/Attribute:services_list+' => 'All the services purchased with this contract~~', -)); +]); // // Class: lnkContactToContract // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkContactToContract' => '关联 联系人/合同', 'Class:lnkContactToContract+' => '', 'Class:lnkContactToContract/Name' => '%1$s / %2$s', @@ -186,13 +186,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkContactToContract/Attribute:contact_id+' => '', 'Class:lnkContactToContract/Attribute:contact_name' => '联系人名称', 'Class:lnkContactToContract/Attribute:contact_name+' => '', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkContractToDocument' => '关联合同/文档', 'Class:lnkContractToDocument+' => '', 'Class:lnkContractToDocument/Name' => '%1$s / %2$s', @@ -204,13 +204,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkContractToDocument/Attribute:document_id+' => '', 'Class:lnkContractToDocument/Attribute:document_name' => '文档名称', 'Class:lnkContractToDocument/Attribute:document_name+' => '', -)); +]); // // Class: ServiceFamily // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ServiceFamily' => '服务系列', 'Class:ServiceFamily+' => '', 'Class:ServiceFamily/Attribute:name' => '名称', @@ -219,13 +219,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:ServiceFamily/Attribute:icon+' => '', 'Class:ServiceFamily/Attribute:services_list' => '服务', 'Class:ServiceFamily/Attribute:services_list+' => '所有的服务', -)); +]); // // Class: Service // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Service' => '服务', 'Class:Service+' => '', 'Class:Service/ComplementaryName' => '%1$s - %2$s', @@ -263,13 +263,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Service/Attribute:functionalcis_list+' => '提供此服务所需的所有配置项', 'Class:Service/Attribute:servicesubcategories_list' => '子服务', 'Class:Service/Attribute:servicesubcategories_list+' => '此服务的所有子服务', -)); +]); // // Class: lnkDocumentToService // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkDocumentToService' => '关联文档/服务', 'Class:lnkDocumentToService+' => '', 'Class:lnkDocumentToService/Name' => '%1$s / %2$s', @@ -281,13 +281,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkDocumentToService/Attribute:document_id+' => '', 'Class:lnkDocumentToService/Attribute:document_name' => '文档名称', 'Class:lnkDocumentToService/Attribute:document_name+' => '', -)); +]); // // Class: lnkContactToService // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkContactToService' => '关联联系人/服务', 'Class:lnkContactToService+' => '', 'Class:lnkContactToService/Name' => '%1$s / %2$s', @@ -299,13 +299,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkContactToService/Attribute:contact_id+' => '', 'Class:lnkContactToService/Attribute:contact_name' => '联系人名称', 'Class:lnkContactToService/Attribute:contact_name+' => '', -)); +]); // // Class: ServiceSubcategory // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ServiceSubcategory' => '子服务', 'Class:ServiceSubcategory+' => '', 'Class:ServiceSubcategory/ComplementaryName' => '%1$s - %2$s', @@ -331,13 +331,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:ServiceSubcategory/Attribute:status/Value:obsolete+' => '废弃', 'Class:ServiceSubcategory/Attribute:status/Value:production' => '生产', 'Class:ServiceSubcategory/Attribute:status/Value:production+' => '生产', -)); +]); // // Class: SLA // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:SLA' => 'SLA', 'Class:SLA+' => '', 'Class:SLA/Attribute:name' => '名称', @@ -353,13 +353,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:SLA/Attribute:customercontracts_list' => '客户合同', 'Class:SLA/Attribute:customercontracts_list+' => '使用此SLA的所有客户合同', 'Class:SLA/Error:UniqueLnkCustomerContractToService' => '不能保存客户合同%1$s与服务%2$s的关联: SLA已存在', -)); +]); // // Class: SLT // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:SLT' => 'SLT', 'Class:SLT+' => '', 'Class:SLT/Attribute:name' => '名称', @@ -396,13 +396,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:SLT/Attribute:unit/Value:minutes+' => '分钟', 'Class:SLT/Attribute:slas_list' => 'SLA', 'Class:SLT/Attribute:slas_list+' => '所有使用此 SLT 的 SLA', -)); +]); // // Class: lnkSLAToSLT // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkSLAToSLT' => '关联SLA/SLT', 'Class:lnkSLAToSLT+' => '', 'Class:lnkSLAToSLT/Name' => '%1$s / %2$s', @@ -424,13 +424,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkSLAToSLT/Attribute:slt_value+' => '', 'Class:lnkSLAToSLT/Attribute:slt_value_unit' => 'SLT 单位', 'Class:lnkSLAToSLT/Attribute:slt_value_unit+' => '', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkCustomerContractToService' => '关联客户合同/服务', 'Class:lnkCustomerContractToService+' => '', 'Class:lnkCustomerContractToService/Name' => '%1$s / %2$s', @@ -446,13 +446,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkCustomerContractToService/Attribute:sla_id+' => '', 'Class:lnkCustomerContractToService/Attribute:sla_name' => 'SLA名称', 'Class:lnkCustomerContractToService/Attribute:sla_name+' => '', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkProviderContractToService' => '关联供应商合同/服务', 'Class:lnkProviderContractToService+' => '', 'Class:lnkProviderContractToService/Name' => '%1$s / %2$s', @@ -464,13 +464,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkProviderContractToService/Attribute:providercontract_id+' => '', 'Class:lnkProviderContractToService/Attribute:providercontract_name' => '供应商合同名称', 'Class:lnkProviderContractToService/Attribute:providercontract_name+' => '', -)); +]); // // Class: DeliveryModel // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:DeliveryModel' => '交付模式', 'Class:DeliveryModel+' => '', 'Class:DeliveryModel/Attribute:name' => '名称', @@ -485,13 +485,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:DeliveryModel/Attribute:contacts_list+' => '此交付模式相关的所有联系人 (包括团队和人员)', 'Class:DeliveryModel/Attribute:customers_list' => '客户', 'Class:DeliveryModel/Attribute:customers_list+' => '所有使用此交付模式的客户', -)); +]); // // Class: lnkDeliveryModelToContact // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkDeliveryModelToContact' => '关联交付模式/联系人', 'Class:lnkDeliveryModelToContact+' => '', 'Class:lnkDeliveryModelToContact/Name' => '%1$s / %2$s', @@ -507,44 +507,44 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkDeliveryModelToContact/Attribute:role_id+' => '', 'Class:lnkDeliveryModelToContact/Attribute:role_name' => '角色名称', 'Class:lnkDeliveryModelToContact/Attribute:role_name+' => '', -)); +]); // // Class: lnkContactToContract // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkContactToContract/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContactToContract/Attribute:customer_id+' => '~~', 'Class:lnkContactToContract/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContactToContract/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkContractToDocument // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkContractToDocument/Attribute:customer_id' => 'Customer id~~', 'Class:lnkContractToDocument/Attribute:customer_id+' => '~~', 'Class:lnkContractToDocument/Attribute:provider_id' => 'Provider id~~', 'Class:lnkContractToDocument/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkCustomerContractToService // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkCustomerContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkCustomerContractToService/Attribute:provider_id+' => '~~', -)); +]); // // Class: lnkProviderContractToService // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkProviderContractToService/Attribute:provider_id' => 'Provider id~~', 'Class:lnkProviderContractToService/Attribute:provider_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-service-mgmt/main.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/main.itop-service-mgmt.php index 2baed1313..ec6c4c958 100755 --- a/datamodels/2.x/itop-service-mgmt/main.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/main.itop-service-mgmt.php @@ -1,9 +1,10 @@ - - -?> diff --git a/datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php index dcc42c4ca..18920fdef 100755 --- a/datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php @@ -1,10 +1,9 @@ 'Service Management', @@ -12,21 +11,21 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-tickets/2.0.0', - ), + ], 'mandatory' => false, 'visible' => true, 'installer' => 'ServiceMgmtInstaller', // Components // - 'datamodel' => array( - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'data.struct' => [ //'data.struct.itop-service-mgmt.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ 'data.sample.organizations.xml', 'data.sample.contracts.xml', 'data.sample.servicefamilies.xml', @@ -39,8 +38,8 @@ SetupWebPage::AddModule( 'data.sample.contractservice.xml', // 'data.sample.deliverymodel.xml', 'data.sample.deliverymodelcontact.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -48,13 +47,12 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); -if (!class_exists('ServiceMgmtInstaller')) -{ +if (!class_exists('ServiceMgmtInstaller')) { // Module installation handler // class ServiceMgmtInstaller extends ModuleInstallerAPI @@ -73,12 +71,11 @@ if (!class_exists('ServiceMgmtInstaller')) */ public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) { - if (strlen($sPreviousVersion) > 0) - { + if (strlen($sPreviousVersion) > 0) { self::RenameEnumValueInDB('SLT', 'request_type', 'servicerequest', 'service_request'); } } - + /** * Handler called after the creation/update of the database schema * @param $oConfiguration Config The new configuration of the application diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/cs.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/cs.dict.itop-sla-computation.php index ef8abdc01..55bb8e390 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/cs.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/cs.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/da.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/da.dict.itop-sla-computation.php index c334a1b47..2ab69e587 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/da.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/da.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/de.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/de.dict.itop-sla-computation.php index 8cf9a4957..f42435a94 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/de.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/de.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/en.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/en.dict.itop-sla-computation.php index 555c82307..9a265de96 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/en.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/en.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/en_gb.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/en_gb.dict.itop-sla-computation.php index 8308d6eea..1b018e263 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/en_gb.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/en_gb.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/es_cr.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/es_cr.dict.itop-sla-computation.php index a22194dd0..a14e3f8a2 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/es_cr.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/es_cr.dict.itop-sla-computation.php @@ -1,12 +1,13 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/fr.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/fr.dict.itop-sla-computation.php index 6aee58321..d9310acb4 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/fr.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/fr.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/hu.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/hu.dict.itop-sla-computation.php index 488d1cc4a..1ce4019db 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/hu.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/hu.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/it.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/it.dict.itop-sla-computation.php index 80e7164e8..0e7f36b06 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/it.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/it.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/ja.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/ja.dict.itop-sla-computation.php index 14d7ec5b6..1090e8f27 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/ja.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/ja.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/nl.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/nl.dict.itop-sla-computation.php index 397cb5aa2..c096fc613 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/nl.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/nl.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/pl.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/pl.dict.itop-sla-computation.php index ada3bd825..31ffd29f6 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/pl.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/pl.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/pt_br.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/pt_br.dict.itop-sla-computation.php index 260282dd4..f9a517ce2 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/pt_br.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/pt_br.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/ru.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/ru.dict.itop-sla-computation.php index 8390045f5..b37587fc4 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/ru.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/ru.dict.itop-sla-computation.php @@ -1,15 +1,16 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/sk.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/sk.dict.itop-sla-computation.php index 5fa616311..66d6409fb 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/sk.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/sk.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/tr.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/tr.dict.itop-sla-computation.php index 4f74143f6..9fcd8912e 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/tr.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/tr.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/dictionaries/zh_cn.dict.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/dictionaries/zh_cn.dict.itop-sla-computation.php index fafe9e9fe..018caee25 100644 --- a/datamodels/2.x/itop-sla-computation/dictionaries/zh_cn.dict.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/dictionaries/zh_cn.dict.itop-sla-computation.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-sla-computation/main.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/main.itop-sla-computation.php index ef02c08d2..53f3eacb9 100755 --- a/datamodels/2.x/itop-sla-computation/main.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/main.itop-sla-computation.php @@ -1,9 +1,10 @@ - /** * Module itop-sla-computation: implements an extensible mechanism * @@ -55,7 +55,7 @@ class SLAComputation implements iWorkingTimeComputer if (($sClassName != 'SLAComputationAddOnAPI') && !is_subclass_of($sClassName, 'SLAComputationAddOnAPI')) { throw new CoreException("Could not select this module, the class '$sClassName' is not derived from SLAComputationAddOnAPI (parent class:".get_parent_class($sClassName)." )"); } - self::$m_oAddOn = new $sClassName; + self::$m_oAddOn = new $sClassName(); self::$m_oAddOn->Init(); } @@ -87,13 +87,11 @@ class SLAComputation implements iWorkingTimeComputer */ public function GetDeadline($oObject, $iDuration, DateTime $oStartDate) { - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::Trace(WorkingTimeRecorder::TRACE_DEBUG, __class__.'::'.__function__); } $oEndDate = self::$m_oAddOn->GetDeadline($oObject, $iDuration, $oStartDate); - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::SetValues($oStartDate->format('U'), $oEndDate->format('U'), $iDuration, WorkingTimeRecorder::COMPUTED_END); } @@ -112,15 +110,17 @@ class SLAComputation implements iWorkingTimeComputer */ public function GetOpenDuration($oObject, DateTime $oStartDate, DateTime $oEndDate) { - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::Trace(WorkingTimeRecorder::TRACE_DEBUG, __class__.'::'.__function__); } $iDuration = self::$m_oAddOn->GetOpenDuration($oObject, $oStartDate, $oEndDate); - if (class_exists('WorkingTimeRecorder')) - { - WorkingTimeRecorder::SetValues($oStartDate->format('U'), $oEndDate->format('U'), $iDuration, - WorkingTimeRecorder::COMPUTED_DURATION); + if (class_exists('WorkingTimeRecorder')) { + WorkingTimeRecorder::SetValues( + $oStartDate->format('U'), + $oEndDate->format('U'), + $iDuration, + WorkingTimeRecorder::COMPUTED_DURATION + ); } return $iDuration; @@ -159,8 +159,7 @@ class SLAComputationAddOnAPI */ public static function GetDeadline($oTicket, $iDuration, DateTime $oStartDate) { - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::Trace(WorkingTimeRecorder::TRACE_DEBUG, __class__.'::'.__function__); } // Default implementation: 24x7, no holidays: to compute the deadline, just add @@ -182,8 +181,7 @@ class SLAComputationAddOnAPI */ public static function GetOpenDuration($oTicket, DateTime $oStartDate, DateTime $oEndDate) { - if (class_exists('WorkingTimeRecorder')) - { + if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::Trace(WorkingTimeRecorder::TRACE_DEBUG, __class__.'::'.__function__); } diff --git a/datamodels/2.x/itop-sla-computation/module.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/module.itop-sla-computation.php index 3ba4a1b07..a2c074447 100755 --- a/datamodels/2.x/itop-sla-computation/module.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/module.itop-sla-computation.php @@ -1,9 +1,10 @@ 'SLA Computation', @@ -27,36 +28,36 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - - ), + 'dependencies' => [ + + ], 'mandatory' => true, 'visible' => false, // Components // - 'datamodel' => array( + 'datamodel' => [ 'main.itop-sla-computation.php', - ), - 'webservice' => array( - - ), - 'data.struct' => array( + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/cs.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/cs.dict.itop-storage-mgmt.php index 4b7b1dfe9..0b7a61814 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/cs.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/cs.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/da.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/da.dict.itop-storage-mgmt.php index 35a4149a1..ef7815d5f 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/da.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/da.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/de.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/de.dict.itop-storage-mgmt.php index 1eadac564..f038f0eb5 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/de.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/de.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/en.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/en.dict.itop-storage-mgmt.php index 0cf62ec91..0ed04c5b2 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/en.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/en.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id', 'Class:NASFileSystem/Attribute:org_id+' => '', 'Class:NASFileSystem/Attribute:location_id' => 'Location id', 'Class:NASFileSystem/Attribute:location_id+' => '', 'Class:NASFileSystem/Attribute:location_name' => 'Location name', 'Class:NASFileSystem/Attribute:location_name+' => '', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id', 'Class:FiberChannelInterface/Attribute:org_id+' => '', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id', 'Class:FiberChannelInterface/Attribute:location_id+' => '', -)); +]); // // Class: LogicalVolume // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id', 'Class:LogicalVolume/Attribute:org_id+' => '', 'Class:LogicalVolume/Attribute:location_id' => 'Location id', 'Class:LogicalVolume/Attribute:location_id+' => '', 'Class:LogicalVolume/Attribute:location_name' => 'Location name', 'Class:LogicalVolume/Attribute:location_name+' => '', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/en_gb.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/en_gb.dict.itop-storage-mgmt.php index 8308d6eea..1b018e263 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/en_gb.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/en_gb.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/es_cr.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/es_cr.dict.itop-storage-mgmt.php index 2fd702e31..b79aafef0 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/es_cr.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/es_cr.dict.itop-storage-mgmt.php @@ -1,49 +1,50 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/fr.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/fr.dict.itop-storage-mgmt.php index 6cc497d31..23f057e05 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/fr.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/fr.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/hu.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/hu.dict.itop-storage-mgmt.php index 5275905bb..90d9af2a2 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/hu.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/hu.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/it.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/it.dict.itop-storage-mgmt.php index 5f954f003..0e28ac602 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/it.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/it.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/ja.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/ja.dict.itop-storage-mgmt.php index e4ff8a089..620058802 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/ja.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/ja.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/nl.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/nl.dict.itop-storage-mgmt.php index 40a1dfa01..a408a0aba 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/nl.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/nl.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/pl.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/pl.dict.itop-storage-mgmt.php index 13695f6c4..a11d35e7b 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/pl.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/pl.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/pt_br.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/pt_br.dict.itop-storage-mgmt.php index 1f0695b7a..33dbe76b9 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/pt_br.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/pt_br.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/ru.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/ru.dict.itop-storage-mgmt.php index aaab135db..0b55b4d59 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/ru.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/ru.dict.itop-storage-mgmt.php @@ -1,52 +1,53 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/sk.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/sk.dict.itop-storage-mgmt.php index 81d39cff8..8f4ee0a22 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/sk.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/sk.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/tr.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/tr.dict.itop-storage-mgmt.php index 3790d32b0..8b3b4c991 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/tr.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/tr.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/dictionaries/zh_cn.dict.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/dictionaries/zh_cn.dict.itop-storage-mgmt.php index 440f90f01..6f33c7457 100644 --- a/datamodels/2.x/itop-storage-mgmt/dictionaries/zh_cn.dict.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/dictionaries/zh_cn.dict.itop-storage-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ // Dictionary entries go here -)); +]); // // Class: NASFileSystem // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:NASFileSystem/Attribute:org_id' => 'Org id~~', 'Class:NASFileSystem/Attribute:org_id+' => '~~', 'Class:NASFileSystem/Attribute:location_id' => 'Location id~~', 'Class:NASFileSystem/Attribute:location_id+' => '~~', 'Class:NASFileSystem/Attribute:location_name' => 'Location name~~', 'Class:NASFileSystem/Attribute:location_name+' => '~~', -)); +]); // // Class: FiberChannelInterface // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:FiberChannelInterface/Attribute:org_id' => 'Org id~~', 'Class:FiberChannelInterface/Attribute:org_id+' => '~~', 'Class:FiberChannelInterface/Attribute:location_id' => 'Location id~~', 'Class:FiberChannelInterface/Attribute:location_id+' => '~~', -)); +]); // // Class: LogicalVolume // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:LogicalVolume/Attribute:org_id' => 'Org id~~', 'Class:LogicalVolume/Attribute:org_id+' => '~~', 'Class:LogicalVolume/Attribute:location_id' => 'Location id~~', 'Class:LogicalVolume/Attribute:location_id+' => '~~', 'Class:LogicalVolume/Attribute:location_name' => 'Location name~~', 'Class:LogicalVolume/Attribute:location_name+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-storage-mgmt/module.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/module.itop-storage-mgmt.php index d5063177d..0e18e0c5e 100644 --- a/datamodels/2.x/itop-storage-mgmt/module.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/module.itop-storage-mgmt.php @@ -1,4 +1,5 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - - SetupWebPage::AddModule( + +SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-storage-mgmt/3.2.1', - array( + 'itop-storage-mgmt/3.2.1', + [ // Identification // 'label' => 'Advanced Storage Management', @@ -34,42 +35,41 @@ // Setup // - 'dependencies' => array( - 'itop-config-mgmt/2.4.0' - ), + 'dependencies' => [ + 'itop-config-mgmt/2.4.0', + ], 'mandatory' => false, 'visible' => true, 'installer' => 'StorageMgmtInstaller', // Components // - 'datamodel' => array( - ), - 'webservice' => array( - - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); -if (!class_exists('StorageMgmtInstaller')) -{ +if (!class_exists('StorageMgmtInstaller')) { // Module installation handler // class StorageMgmtInstaller extends ModuleInstallerAPI @@ -88,13 +88,12 @@ if (!class_exists('StorageMgmtInstaller')) */ public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) { - if (strlen($sPreviousVersion) > 0) - { + if (strlen($sPreviousVersion) > 0) { // If you want to migrate data from one format to another, do it here self::RenameClassInDB('NasFileSystem', 'NASFileSystem'); } } - + /** * Handler called after the creation/update of the database schema * @param $oConfiguration Config The new configuration of the application diff --git a/datamodels/2.x/itop-structure/dictionaries/cs.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/cs.dict.itop-structure.php index 8e459be45..a2a44d984 100644 --- a/datamodels/2.x/itop-structure/dictionaries/cs.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/cs.dict.itop-structure.php @@ -1,10 +1,11 @@ @@ -12,7 +13,7 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Organization' => 'Organizace', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => 'Název', @@ -39,13 +40,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Organization:Overview:FunctionalCIs' => 'Konfigurační položky této organizace', 'Organization:Overview:FunctionalCIs:subtitle' => 'podle typu', 'Organization:Overview:Users' => ITOP_APPLICATION_SHORT.' Uživatelé v rámci této organizace', -)); +]); // // Class: Location // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Location' => 'Umístění', 'Class:Location+' => 'Jakékoli umístění: země, okres, město, čtvrť, budova, patro, místnost, rack,...', 'Class:Location/Attribute:name' => 'Název', @@ -72,13 +73,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Location/Attribute:physicaldevice_list+' => 'Všechna zařízení v tomto umístění', 'Class:Location/Attribute:person_list' => 'Kontakty', 'Class:Location/Attribute:person_list+' => 'Všechny kontakty v tomto umístění', -)); +]); // // Class: Contact // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Contact' => 'Kontakt', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s~~', @@ -110,13 +111,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Contact/Attribute:cis_list+' => 'Všechny konfigurační položky spojené s tímto kontaktem', 'Class:Contact/Attribute:finalclass' => 'Typ kontaktu', 'Class:Contact/Attribute:finalclass+' => '', -)); +]); // // Class: Person // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Person' => 'Osoba', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s~~', @@ -151,13 +152,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Person/UniquenessRule:name+' => 'Jméno zaměstnance by mělo být v rámci organizace jedinečné', 'Class:Person/UniquenessRule:name' => 'V organizaci \'$this->org_name$\' již existuje osoba se stejným jménem', 'Class:Person/Error:ChangingOrgDenied' => 'Tuto osobu nelze přesunout do organizace \'%1$s\' protože její přiřazený uživatel nemá oprávnění k této organizaci a přerušil by se tím přístup osoby k standardnímu portálu', -)); +]); // // Class: Team // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Team' => 'Tým', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s~~', @@ -165,13 +166,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Team/Attribute:persons_list+' => 'Všichni členové týmu', 'Class:Team/Attribute:tickets_list' => 'Tikety', 'Class:Team/Attribute:tickets_list+' => 'Všechny tikety přidělené tomuto týmu', -)); +]); // // Class: Document // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Document' => 'Dokument', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -201,77 +202,77 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Document/Attribute:cis_list+' => 'Všechny konfigurační položky spojené s tímto dokumentem', 'Class:Document/Attribute:finalclass' => 'Typ dokumentu', 'Class:Document/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentFile // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:DocumentFile' => 'Dokument (soubor)', 'Class:DocumentFile+' => '', 'Class:DocumentFile/Attribute:file' => 'Soubor', 'Class:DocumentFile/Attribute:file+' => '', -)); +]); // // Class: DocumentNote // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:DocumentNote' => 'Dokument (poznámka)', 'Class:DocumentNote+' => '', 'Class:DocumentNote/Attribute:text' => 'Poznámka', 'Class:DocumentNote/Attribute:text+' => '', -)); +]); // // Class: DocumentWeb // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:DocumentWeb' => 'Dokument (web)', 'Class:DocumentWeb+' => '', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Typology' => 'Typologie', 'Class:Typology+' => '', 'Class:Typology/Attribute:name' => 'Název', 'Class:Typology/Attribute:name+' => '', 'Class:Typology/Attribute:finalclass' => 'Typ', 'Class:Typology/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentType // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:DocumentType' => 'Typ dokumentu', 'Class:DocumentType+' => '', -)); +]); // // Class: ContactType // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ContactType' => 'Typ kontaktu', 'Class:ContactType+' => '', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkPersonToTeam' => 'Spojení (Osoba / Tým)', 'Class:lnkPersonToTeam+' => '', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s~~', @@ -288,13 +289,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => '', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Název role', 'Class:lnkPersonToTeam/Attribute:role_name+' => '', -)); +]); // // Application Menu // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:DataAdministration' => 'Správa dat', 'Menu:DataAdministration+' => 'Správa dat', 'Menu:Catalogs' => 'Katalogy', @@ -332,20 +333,20 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Menu:Typology+' => 'Konfigurace typologie', 'UI_WelcomeMenu_AllConfigItems' => 'Souhrn', 'Menu:ConfigManagement:Typology' => 'Konfigurace typologie', -)); +]); // Add translation for Fieldsets -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Person:info' => 'Obecné informace', 'User:info' => 'Obecné informace', 'User:profiles' => 'Profily (minimálně jeden)', 'Person:personal_info' => 'Osobní informace', 'Person:notifiy' => 'Upozornění', -)); +]); // Themes -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'theme:fullmoon' => 'Úplněk', 'theme:test-red' => 'Testovací instance (červená)', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/da.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/da.dict.itop-structure.php index f4c92da42..e82b5d11a 100644 --- a/datamodels/2.x/itop-structure/dictionaries/da.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/da.dict.itop-structure.php @@ -1,17 +1,18 @@ * @author Erik Bøg * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Organization' => 'Organisation', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => 'Navn', @@ -38,13 +39,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Organization:Overview:FunctionalCIs' => 'Configuration items of this organization~~', 'Organization:Overview:FunctionalCIs:subtitle' => 'by type~~', 'Organization:Overview:Users' => ITOP_APPLICATION_SHORT.' Users within this organization~~', -)); +]); // // Class: Location // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Location' => 'Placering', 'Class:Location+' => 'Enhver type af placering: Region, land, by, bygning, rum rack, ...', 'Class:Location/Attribute:name' => 'Navn', @@ -71,13 +72,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Location/Attribute:physicaldevice_list+' => 'All the devices in this location~~', 'Class:Location/Attribute:person_list' => 'List Kontakter', 'Class:Location/Attribute:person_list+' => 'All the contacts located on this location~~', -)); +]); // // Class: Contact // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Contact' => 'Kontakt', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s~~', @@ -109,13 +110,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Contact/Attribute:cis_list+' => 'All the configuration items linked to this contact~~', 'Class:Contact/Attribute:finalclass' => 'Type', 'Class:Contact/Attribute:finalclass+' => '', -)); +]); // // Class: Person // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Person' => 'Person', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s~~', @@ -150,13 +151,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Person/UniquenessRule:name+' => 'The employee name should be unique inside its organization~~', 'Class:Person/UniquenessRule:name' => 'There is already a person in \'$this->org_name$\' organization with the same name~~', 'Class:Person/Error:ChangingOrgDenied' => 'Impossible to move this person under organization \'%1$s\' as it would break his access to the User Portal, his associated user not being allowed on this organization~~', -)); +]); // // Class: Team // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Team' => 'Team', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s~~', @@ -164,13 +165,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Team/Attribute:persons_list+' => 'All the people belonging to this team~~', 'Class:Team/Attribute:tickets_list' => 'List Tickets', 'Class:Team/Attribute:tickets_list+' => 'All the tickets assigned to this team~~', -)); +]); // // Class: Document // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Document' => 'Dokument', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -200,77 +201,77 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Document/Attribute:cis_list+' => 'All the configuration items linked to this document~~', 'Class:Document/Attribute:finalclass' => 'Dokumenttype', 'Class:Document/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentFile // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:DocumentFile' => 'Dokument (Data)', 'Class:DocumentFile+' => '', 'Class:DocumentFile/Attribute:file' => 'Data', 'Class:DocumentFile/Attribute:file+' => '', -)); +]); // // Class: DocumentNote // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:DocumentNote' => 'Dokument (Noter)', 'Class:DocumentNote+' => '', 'Class:DocumentNote/Attribute:text' => 'Tekst', 'Class:DocumentNote/Attribute:text+' => '', -)); +]); // // Class: DocumentWeb // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:DocumentWeb' => 'Dokument (Web)', 'Class:DocumentWeb+' => '', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Typology' => 'Typologi', 'Class:Typology+' => '', 'Class:Typology/Attribute:name' => 'Navn', 'Class:Typology/Attribute:name+' => '', 'Class:Typology/Attribute:finalclass' => 'Type', 'Class:Typology/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentType // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:DocumentType' => 'Dokumentype', 'Class:DocumentType+' => '', -)); +]); // // Class: ContactType // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ContactType' => 'Kontakttype', 'Class:ContactType+' => '', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkPersonToTeam' => 'Sammenhæng Person/Team', 'Class:lnkPersonToTeam+' => '', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s~~', @@ -287,13 +288,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => '', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Rollen navn', 'Class:lnkPersonToTeam/Attribute:role_name+' => '', -)); +]); // // Application Menu // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:DataAdministration' => 'Data administration', 'Menu:DataAdministration+' => '', 'Menu:Catalogs' => 'Katalog', @@ -331,20 +332,20 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Menu:Typology+' => '', 'UI_WelcomeMenu_AllConfigItems' => 'Sammenfatning', 'Menu:ConfigManagement:Typology' => 'Typologi Konfiguration', -)); +]); // Add translation for Fieldsets -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Person:info' => 'Almindelig Information', 'User:info' => 'Almindelig Information', 'User:profiles' => 'Profiles (minimum one)~~', 'Person:personal_info' => 'Personal information~~', 'Person:notifiy' => 'Underretning', -)); +]); // Themes -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'theme:fullmoon' => 'Full moon~~', 'theme:test-red' => 'Test instance (Red)~~', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/de.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/de.dict.itop-structure.php index 806d32817..47c47373c 100644 --- a/datamodels/2.x/itop-structure/dictionaries/de.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/de.dict.itop-structure.php @@ -1,17 +1,18 @@ * @author ITOMIG GmbH * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Organization' => 'Organisation', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => 'Name', @@ -38,13 +39,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Organization:Overview:FunctionalCIs' => 'CIs dieser Organisation', 'Organization:Overview:FunctionalCIs:subtitle' => 'nach Typ', 'Organization:Overview:Users' => ITOP_APPLICATION_SHORT.' Benutzer innerhalb dieser Organisation', -)); +]); // // Class: Location // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Location' => 'Standort', 'Class:Location+' => 'Jeder Typ von Standort: Region, Land, Stadt, Seite, Gebäude, Flur, Raum, Rack,...', 'Class:Location/Attribute:name' => 'Name', @@ -71,13 +72,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Location/Attribute:physicaldevice_list+' => 'Alle Geräte an diesem Standort', 'Class:Location/Attribute:person_list' => 'Kontakte', 'Class:Location/Attribute:person_list+' => 'Alle Kontakte, die sich an diesem Standort befinden', -)); +]); // // Class: Contact // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Contact' => 'Kontakt', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s', @@ -109,13 +110,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Contact/Attribute:cis_list+' => 'Alle mit diesem Kontakt verknüpften CIs', 'Class:Contact/Attribute:finalclass' => 'Typ', 'Class:Contact/Attribute:finalclass+' => 'Name der instanziierbaren Klasse', -)); +]); // // Class: Person // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Person' => 'Person', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s', @@ -150,13 +151,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Person/UniquenessRule:name+' => 'Innerhalb einer Organisation muss der Name einer Person eindeutig sein', 'Class:Person/UniquenessRule:name' => 'In der Organisation \'$this->org_name$\' existiert bereits eine Person mit dem gleichen Namen', 'Class:Person/Error:ChangingOrgDenied' => 'Es ist nicht möglich, dieser Person der Organisation \'%1$s\' zuzuordnen, da dies seinen Zugang zum Benutzerportal unterbinden würde, da sein zugehöriger Benutzer nicht für diese Organisation zugelassen ist.', -)); +]); // // Class: Team // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Team' => 'Team', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s', @@ -164,13 +165,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Team/Attribute:persons_list+' => 'Alle Personen, die zu diesem Team gehören', 'Class:Team/Attribute:tickets_list' => 'Tickets', 'Class:Team/Attribute:tickets_list+' => 'Alle diesem Team zugewiesenen Tickets', -)); +]); // // Class: Document // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Document' => 'Dokument', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -200,77 +201,77 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Document/Attribute:cis_list+' => 'Alle mit diesem Dokument verknüpften CIs', 'Class:Document/Attribute:finalclass' => 'Unterklasse von Dokument', 'Class:Document/Attribute:finalclass+' => 'Name der instanziierbaren Klasse', -)); +]); // // Class: DocumentFile // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:DocumentFile' => 'Dokument (Datei)', 'Class:DocumentFile+' => '', 'Class:DocumentFile/Attribute:file' => 'Datei', 'Class:DocumentFile/Attribute:file+' => '', -)); +]); // // Class: DocumentNote // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:DocumentNote' => 'Dokument (Notiz)', 'Class:DocumentNote+' => '', 'Class:DocumentNote/Attribute:text' => 'Text', 'Class:DocumentNote/Attribute:text+' => '', -)); +]); // // Class: DocumentWeb // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:DocumentWeb' => 'Dokument (Web)', 'Class:DocumentWeb+' => '', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Typology' => 'Typologie', 'Class:Typology+' => '', 'Class:Typology/Attribute:name' => 'Name', 'Class:Typology/Attribute:name+' => '', 'Class:Typology/Attribute:finalclass' => 'Typ', 'Class:Typology/Attribute:finalclass+' => 'Name der instanziierbaren Klasse', -)); +]); // // Class: DocumentType // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:DocumentType' => 'Dokumenttyp', 'Class:DocumentType+' => '', -)); +]); // // Class: ContactType // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ContactType' => 'Kontakttyp', 'Class:ContactType+' => '', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkPersonToTeam' => 'Verknüpfung Person/Team', 'Class:lnkPersonToTeam+' => '', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s', @@ -287,13 +288,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => 'Eine Rolle aus einer Typologie möglicher Rollen', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Rollenname', 'Class:lnkPersonToTeam/Attribute:role_name+' => '', -)); +]); // // Application Menu // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:DataAdministration' => 'Data Management', 'Menu:DataAdministration+' => 'Data Management', 'Menu:Catalogs' => 'Kataloge', @@ -331,20 +332,20 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Menu:Typology+' => 'Typologie-Konfiguration', 'UI_WelcomeMenu_AllConfigItems' => 'Zusammenfassung', 'Menu:ConfigManagement:Typology' => 'Typologie-Konfiguration', -)); +]); // Add translation for Fieldsets -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Person:info' => 'Allgemeine Informationen', 'User:info' => 'Allgemeine Informationen', 'User:profiles' => 'Profile (mindestens eines)', 'Person:personal_info' => 'Persönliche Informationen', 'Person:notifiy' => 'Benachrichtigungen', -)); +]); // Themes -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'theme:fullmoon' => 'Full Moon', 'theme:test-red' => 'Test Red (Testinstanz)', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/en.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/en.dict.itop-structure.php index 8f2ccbf77..cd0bfb5e5 100644 --- a/datamodels/2.x/itop-structure/dictionaries/en.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/en.dict.itop-structure.php @@ -1,4 +1,5 @@ */ - - - // Dictionnary conventions // Class: // Class:+ @@ -36,7 +34,6 @@ // Class:/UniquenessRule: // Class:/UniquenessRule:+ - ////////////////////////////////////////////////////////////////////// // Note: The classes have been grouped by categories: bizmodel ////////////////////////////////////////////////////////////////////// @@ -45,12 +42,11 @@ ////////////////////////////////////////////////////////////////////// // - // // Class: Organization // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Organization' => 'Organization', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => 'Name', @@ -77,13 +73,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Organization:Overview:FunctionalCIs' => 'Configuration items of this organization', 'Organization:Overview:FunctionalCIs:subtitle' => 'by type', 'Organization:Overview:Users' => ITOP_APPLICATION_SHORT.' Users within this organization', -)); +]); // // Class: Location // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Location' => 'Location', 'Class:Location+' => 'Any type of location: Region, Country, City, Site, Building, Floor, Room, Rack,...', 'Class:Location/Attribute:name' => 'Name', @@ -110,13 +106,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Location/Attribute:physicaldevice_list+' => 'All the devices in this location', 'Class:Location/Attribute:person_list' => 'Contacts', 'Class:Location/Attribute:person_list+' => 'All the contacts located on this location', -)); +]); // // Class: Contact // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Contact' => 'Contact', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s', @@ -148,13 +144,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Contact/Attribute:cis_list+' => 'All the configuration items linked to this contact', 'Class:Contact/Attribute:finalclass' => 'Contact sub-class', 'Class:Contact/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: Person // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Person' => 'Person', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s', @@ -189,13 +185,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Person/UniquenessRule:name+' => 'The employee name should be unique inside its organization', 'Class:Person/UniquenessRule:name' => 'There is already a person in \'$this->org_name$\' organization with the same name', 'Class:Person/Error:ChangingOrgDenied' => 'Impossible to move this person under organization \'%1$s\' as it would break his access to the User Portal, his associated user not being allowed on this organization', -)); +]); // // Class: Team // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Team' => 'Team', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s', @@ -203,13 +199,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Team/Attribute:persons_list+' => 'All the people belonging to this team', 'Class:Team/Attribute:tickets_list' => 'Tickets', 'Class:Team/Attribute:tickets_list+' => 'All the tickets assigned to this team', -)); +]); // // Class: Document // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Document' => 'Document', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -239,77 +235,77 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Document/Attribute:cis_list+' => 'All the configuration items linked to this document', 'Class:Document/Attribute:finalclass' => 'Document sub-class', 'Class:Document/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: DocumentFile // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:DocumentFile' => 'Document File', 'Class:DocumentFile+' => '', 'Class:DocumentFile/Attribute:file' => 'File', 'Class:DocumentFile/Attribute:file+' => '', -)); +]); // // Class: DocumentNote // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:DocumentNote' => 'Document Note', 'Class:DocumentNote+' => '', 'Class:DocumentNote/Attribute:text' => 'Text', 'Class:DocumentNote/Attribute:text+' => '', -)); +]); // // Class: DocumentWeb // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:DocumentWeb' => 'Document Web', 'Class:DocumentWeb+' => '', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Typology' => 'Typology', 'Class:Typology+' => '', 'Class:Typology/Attribute:name' => 'Name', 'Class:Typology/Attribute:name+' => '', 'Class:Typology/Attribute:finalclass' => 'Typology sub-class', 'Class:Typology/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: DocumentType // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:DocumentType' => 'Document Type', 'Class:DocumentType+' => '', -)); +]); // // Class: ContactType // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ContactType' => 'Contact Type', 'Class:ContactType+' => '', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkPersonToTeam' => 'Link Person / Team', 'Class:lnkPersonToTeam+' => '', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s', @@ -326,13 +322,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => 'To select within a typology of possible roles', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Role name', 'Class:lnkPersonToTeam/Attribute:role_name+' => '', -)); +]); // // Application Menu // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Menu:DataAdministration' => 'Data administration', 'Menu:DataAdministration+' => 'Data administration', 'Menu:Catalogs' => 'Catalogs', @@ -370,20 +366,20 @@ Dict::Add('EN US', 'English', 'English', array( 'Menu:Typology+' => 'Typology configuration', 'UI_WelcomeMenu_AllConfigItems' => 'Summary', 'Menu:ConfigManagement:Typology' => 'Typology configuration', -)); +]); // Add translation for Fieldsets -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Person:info' => 'General information', 'User:info' => 'General information', 'User:profiles' => 'Profiles (minimum one)', 'Person:personal_info' => 'Personal information', 'Person:notifiy' => 'Notification', -)); +]); // Themes -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'theme:fullmoon' => 'Full moon', 'theme:test-red' => 'Test instance (Red)', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/en_gb.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/en_gb.dict.itop-structure.php index 1659b578d..2fbcb1d33 100644 --- a/datamodels/2.x/itop-structure/dictionaries/en_gb.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/en_gb.dict.itop-structure.php @@ -1,4 +1,5 @@ */ - - - // Dictionnary conventions // Class: // Class:+ @@ -36,7 +34,6 @@ // Class:/UniquenessRule: // Class:/UniquenessRule:+ - ////////////////////////////////////////////////////////////////////// // Note: The classes have been grouped by categories: bizmodel ////////////////////////////////////////////////////////////////////// @@ -45,12 +42,11 @@ ////////////////////////////////////////////////////////////////////// // - // // Class: Organization // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Organization' => 'Organisation', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => 'Name', @@ -77,13 +73,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Organization:Overview:FunctionalCIs' => 'Configuration items of this organisation', 'Organization:Overview:FunctionalCIs:subtitle' => 'by type', 'Organization:Overview:Users' => ITOP_APPLICATION_SHORT.' Users within this organization', -)); +]); // // Class: Location // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Location' => 'Location', 'Class:Location+' => 'Any type of location: Region, Country, City, Site, Building, Floor, Room, Rack,...', 'Class:Location/Attribute:name' => 'Name', @@ -110,13 +106,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Location/Attribute:physicaldevice_list+' => 'All the devices in this location', 'Class:Location/Attribute:person_list' => 'Contacts', 'Class:Location/Attribute:person_list+' => 'All the contacts located at this location', -)); +]); // // Class: Contact // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Contact' => 'Contact', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s', @@ -148,13 +144,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Contact/Attribute:cis_list+' => 'All the configuration items linked to this contact', 'Class:Contact/Attribute:finalclass' => 'Contact sub-class', 'Class:Contact/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: Person // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Person' => 'Person', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s', @@ -189,13 +185,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Person/UniquenessRule:name+' => 'The employee name should be unique inside its organisation', 'Class:Person/UniquenessRule:name' => 'There is already a person in \'$this->org_name$\' organisation with the same name', 'Class:Person/Error:ChangingOrgDenied' => 'Impossible to move this person under organisation \'%1$s\' as it would break his access to the User Portal, his associated user not being allowed on this organisation', -)); +]); // // Class: Team // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Team' => 'Team', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s', @@ -203,13 +199,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Team/Attribute:persons_list+' => 'All the people belonging to this team', 'Class:Team/Attribute:tickets_list' => 'Tickets', 'Class:Team/Attribute:tickets_list+' => 'All the tickets assigned to this team', -)); +]); // // Class: Document // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Document' => 'Document', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -239,77 +235,77 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Document/Attribute:cis_list+' => 'All the configuration items linked to this document', 'Class:Document/Attribute:finalclass' => 'Document sub-class', 'Class:Document/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: DocumentFile // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:DocumentFile' => 'Document File', 'Class:DocumentFile+' => '', 'Class:DocumentFile/Attribute:file' => 'File', 'Class:DocumentFile/Attribute:file+' => '', -)); +]); // // Class: DocumentNote // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:DocumentNote' => 'Document Note', 'Class:DocumentNote+' => '', 'Class:DocumentNote/Attribute:text' => 'Text', 'Class:DocumentNote/Attribute:text+' => '', -)); +]); // // Class: DocumentWeb // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:DocumentWeb' => 'Document Web', 'Class:DocumentWeb+' => '', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Typology' => 'Typology', 'Class:Typology+' => '', 'Class:Typology/Attribute:name' => 'Name', 'Class:Typology/Attribute:name+' => '', 'Class:Typology/Attribute:finalclass' => 'Typology sub-class', 'Class:Typology/Attribute:finalclass+' => 'Name of the final class', -)); +]); // // Class: DocumentType // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:DocumentType' => 'Document Type', 'Class:DocumentType+' => '', -)); +]); // // Class: ContactType // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ContactType' => 'Contact Type', 'Class:ContactType+' => '', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkPersonToTeam' => 'Link Person / Team', 'Class:lnkPersonToTeam+' => '', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s', @@ -326,13 +322,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => 'To select within a typology of possible roles', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Role name', 'Class:lnkPersonToTeam/Attribute:role_name+' => '', -)); +]); // // Application Menu // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Menu:DataAdministration' => 'Data administration', 'Menu:DataAdministration+' => 'Data administration', 'Menu:Catalogs' => 'Catalogues', @@ -370,20 +366,20 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Menu:Typology+' => 'Typology configuration', 'UI_WelcomeMenu_AllConfigItems' => 'Summary', 'Menu:ConfigManagement:Typology' => 'Typology configuration', -)); +]); // Add translation for Fieldsets -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Person:info' => 'General information', 'User:info' => 'General information', 'User:profiles' => 'Profiles (minimum one)', 'Person:personal_info' => 'Personal information', 'Person:notifiy' => 'Notification', -)); +]); // Themes -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'theme:fullmoon' => 'Full moon', 'theme:test-red' => 'Test instance (Red)', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/es_cr.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/es_cr.dict.itop-structure.php index 5a1edad01..e66a88228 100644 --- a/datamodels/2.x/itop-structure/dictionaries/es_cr.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/es_cr.dict.itop-structure.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Organization' => 'Organización', 'Class:Organization+' => 'Organización', 'Class:Organization/Attribute:name' => 'Nombre', @@ -34,13 +35,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Organization:Overview:FunctionalCIs' => 'Elementos de configuración en esta Organización', 'Organization:Overview:FunctionalCIs:subtitle' => 'por tipo', 'Organization:Overview:Users' => 'Usuarios de iTop en la Organización', -)); +]); // // Class: Location // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Location' => 'Localidad', 'Class:Location+' => 'Cualquier Tipo de Localidad: Región, País, Ciudad, Sitio, Edificio, Piso, Cuarto, Rack,...', 'Class:Location/Attribute:name' => 'Nombre', @@ -67,13 +68,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Location/Attribute:physicaldevice_list+' => 'Dispositivos', 'Class:Location/Attribute:person_list' => 'Contactos', 'Class:Location/Attribute:person_list+' => 'Contactos', -)); +]); // // Class: Contact // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Contact' => 'Contacto', 'Class:Contact+' => 'Contacto', 'Class:Contact/ComplementaryName' => '%1$s - %2$s', @@ -105,13 +106,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Contact/Attribute:cis_list+' => 'Elementos de Configuración relacionados con el contacto', 'Class:Contact/Attribute:finalclass' => 'Clase', 'Class:Contact/Attribute:finalclass+' => 'Clase', -)); +]); // // Class: Person // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Person' => 'Persona', 'Class:Person+' => 'Persona', 'Class:Person/ComplementaryName' => '%1$s - %2$s', @@ -146,13 +147,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Person/UniquenessRule:name+' => 'El nombre del empleado debe ser único dentro de su Organización', 'Class:Person/UniquenessRule:name' => 'Ya existe una persona en la organiación \'$this->org_name$\', con el mismo nombre', 'Class:Person/Error:ChangingOrgDenied' => 'Es imposible mover a esta persona a la organización \'%1$s\' ya que interrumpiría su acceso al Portal de usuario y su usuario asociado no estaría permitido en esta organización.', -)); +]); // // Class: Team // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Team' => 'Grupo de Trabajo', 'Class:Team+' => 'Grupo de Trabajo', 'Class:Team/ComplementaryName' => '%1$s - %2$s', @@ -160,13 +161,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Team/Attribute:persons_list+' => 'Miembros', 'Class:Team/Attribute:tickets_list' => 'Tickets', 'Class:Team/Attribute:tickets_list+' => 'Tickets', -)); +]); // // Class: Document // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Document' => 'Documento', 'Class:Document+' => 'Documento', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -196,77 +197,77 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Document/Attribute:cis_list+' => 'Elementos de Configuración referenciados en este documento', 'Class:Document/Attribute:finalclass' => 'Tipo de Documento', 'Class:Document/Attribute:finalclass+' => 'Tipo de Documento', -)); +]); // // Class: DocumentFile // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:DocumentFile' => 'Documento de Archivo', 'Class:DocumentFile+' => 'Documento de Archivo', 'Class:DocumentFile/Attribute:file' => 'Archivo', 'Class:DocumentFile/Attribute:file+' => 'Archivo', -)); +]); // // Class: DocumentNote // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:DocumentNote' => 'Nota', 'Class:DocumentNote+' => 'Nota', 'Class:DocumentNote/Attribute:text' => 'Texto', 'Class:DocumentNote/Attribute:text+' => 'Texto', -)); +]); // // Class: DocumentWeb // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:DocumentWeb' => 'Documento Web', 'Class:DocumentWeb+' => 'Documento disponible en otro servidor Web', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => 'URL de Internet', -)); +]); // // Class: Typology // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Typology' => 'Tipología', 'Class:Typology+' => 'Tipología', 'Class:Typology/Attribute:name' => 'Nombre', 'Class:Typology/Attribute:name+' => 'Nombre del Tipo', 'Class:Typology/Attribute:finalclass' => 'Clase', 'Class:Typology/Attribute:finalclass+' => 'Clase', -)); +]); // // Class: DocumentType // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:DocumentType' => 'Tipo de Documento', 'Class:DocumentType+' => 'Tipo de Documento', -)); +]); // // Class: ContactType // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ContactType' => 'Tipo de Contacto', 'Class:ContactType+' => 'Tipo de Contacto', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkPersonToTeam' => 'Relación Persona y Grupo', 'Class:lnkPersonToTeam+' => 'Relación Persona y Grupo', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s', @@ -283,13 +284,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => 'Rol', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Rol', 'Class:lnkPersonToTeam/Attribute:role_name+' => 'Rol', -)); +]); // // Application Menu // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:DataAdministration' => 'Administración de Datos', 'Menu:DataAdministration+' => 'Administración de Datos', 'Menu:Catalogs' => 'Catálogos', @@ -327,20 +328,20 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Menu:Typology+' => 'Configuración de Tipos', 'UI_WelcomeMenu_AllConfigItems' => 'Resumen', 'Menu:ConfigManagement:Typology' => 'Configuración de Tipos', -)); +]); // Add translation for Fieldsets -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Person:info' => 'Información General', 'User:info' => 'Información General', 'User:profiles' => 'Perfiles (mínimo uno)', 'Person:personal_info' => 'Información Personal', 'Person:notifiy' => 'Notificación', -)); +]); // Themes -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'theme:fullmoon' => 'Luna Llena', 'theme:test-red' => 'Instancia de Prueba (Red)', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/fr.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/fr.dict.itop-structure.php index 5cd7e11c1..8b39466c4 100644 --- a/datamodels/2.x/itop-structure/dictionaries/fr.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/fr.dict.itop-structure.php @@ -1,16 +1,17 @@ * */ -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Organization' => 'Organisation', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => 'Nom organisation', @@ -37,13 +38,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Organization:Overview:FunctionalCIs' => 'Infrastructure de cette organisation', 'Organization:Overview:FunctionalCIs:subtitle' => 'par type', 'Organization:Overview:Users' => 'Utilisateurs '.ITOP_APPLICATION_SHORT.' dans cette organisation', -)); +]); // // Class: Location // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Location' => 'Lieu', 'Class:Location+' => 'Tout type de lieu: Région, Pays, Ville, Site, batiment, Bureau,...', 'Class:Location/Attribute:name' => 'Nom', @@ -75,14 +76,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Location/Attribute:person_list/UI:Links:Delete:Button+' => 'Supprimer cette %4$s', 'Class:Location/Attribute:person_list/UI:Links:Delete:Modal:Title' => 'Supprimer une %4$s', 'Class:Location/Attribute:person_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', - 'Class:Location/Attribute:person_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s' -)); + 'Class:Location/Attribute:person_list/UI:Links:Remove:Modal:Title' => 'Retirer cette %4$s de son %1$s', +]); // // Class: Contact // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Contact' => 'Contact', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s', @@ -114,13 +115,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Contact/Attribute:cis_list+' => 'Tous les éléments de configuration liés à ce contact', 'Class:Contact/Attribute:finalclass' => 'Sous-classe de Contact', 'Class:Contact/Attribute:finalclass+' => 'Nom de la classe instanciable', -)); +]); // // Class: Person // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Person' => 'Personne', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s', @@ -165,14 +166,14 @@ Dict::Add('FR FR', 'French', 'Français', array( \'$this->org_name$\'', 'Class:Person/UniquenessRule:name+' => 'Le nom de l\'employé devrait être unique dans l\'organisation', 'Class:Person/UniquenessRule:name' => 'Il y a déjà une personne avec ce nom dans l\'organisation \'$this->org_name$\'', - 'Class:Person/Error:ChangingOrgDenied' => 'Impossible de déplacer cette personne sous l\'organisation \'%1$s\', cela casserait son accès au portail utilisateur, car il n\'a pas le droit de voir cette organisation' -)); + 'Class:Person/Error:ChangingOrgDenied' => 'Impossible de déplacer cette personne sous l\'organisation \'%1$s\', cela casserait son accès au portail utilisateur, car il n\'a pas le droit de voir cette organisation', +]); // // Class: Team // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Team' => 'Equipe', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s', @@ -183,14 +184,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Team/Attribute:persons_list/UI:Links:Remove:Button+' => 'Retirer cette %4$s', 'Class:Team/Attribute:persons_list/UI:Links:Remove:Modal:Title' => 'Retirer une %4$s', 'Class:Team/Attribute:tickets_list' => 'Tickets', - 'Class:Team/Attribute:tickets_list+' => 'Tous les tickets assignés à cette équipe' -)); + 'Class:Team/Attribute:tickets_list+' => 'Tous les tickets assignés à cette équipe', +]); // // Class: Document // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Document' => 'Document', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -220,77 +221,77 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Document/Attribute:cis_list+' => 'Tous les éléments de configuration liés à ce document', 'Class:Document/Attribute:finalclass' => 'Sous-classe de Document', 'Class:Document/Attribute:finalclass+' => 'Nom de la classe instanciable', -)); +]); // // Class: DocumentFile // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:DocumentFile' => 'Document Fichier', 'Class:DocumentFile+' => '', 'Class:DocumentFile/Attribute:file' => 'Fichier', 'Class:DocumentFile/Attribute:file+' => '', -)); +]); // // Class: DocumentNote // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:DocumentNote' => 'Document Note', 'Class:DocumentNote+' => '', 'Class:DocumentNote/Attribute:text' => 'Texte', 'Class:DocumentNote/Attribute:text+' => '', -)); +]); // // Class: DocumentWeb // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:DocumentWeb' => 'Document Web', 'Class:DocumentWeb+' => '', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Typology' => 'Typologie', 'Class:Typology+' => '', 'Class:Typology/Attribute:name' => 'Nom', 'Class:Typology/Attribute:name+' => '', 'Class:Typology/Attribute:finalclass' => 'Sous-classe de Typologie', 'Class:Typology/Attribute:finalclass+' => 'Nom de la classe instanciable', -)); +]); // // Class: DocumentType // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:DocumentType' => 'Type de document', 'Class:DocumentType+' => '', -)); +]); // // Class: ContactType // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ContactType' => 'Type de contact', 'Class:ContactType+' => '', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkPersonToTeam' => 'Lien Personne / Equipe', 'Class:lnkPersonToTeam+' => '', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s', @@ -307,13 +308,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => 'Un rôle parmi une typologie de rôles possibles', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Nom Role', 'Class:lnkPersonToTeam/Attribute:role_name+' => '', -)); +]); // // Application Menu // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Menu:DataAdministration' => 'Administration des données', 'Menu:DataAdministration+' => 'Administration des données', 'Menu:Catalogs' => 'Catalogues', @@ -351,20 +352,20 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Menu:Typology+' => 'Typologie configuration', 'UI_WelcomeMenu_AllConfigItems' => 'Résumé', 'Menu:ConfigManagement:Typology' => 'Configuration des typologies', -)); +]); // Add translation for Fieldsets -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Person:info' => 'Informations générales', 'User:info' => 'Informations générales', 'User:profiles' => 'Profils (minimum un)', 'Person:personal_info' => 'Informations personnelles', 'Person:notifiy' => 'Notification', -)); +]); // Themes -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'theme:fullmoon' => 'Full moon', 'theme:test-red' => 'Instance de test (Rouge)', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/hu.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/hu.dict.itop-structure.php index 3df4ef21c..1de088135 100644 --- a/datamodels/2.x/itop-structure/dictionaries/hu.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/hu.dict.itop-structure.php @@ -1,16 +1,17 @@ * */ -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Organization' => 'Szevezeti egység', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => 'Név', @@ -37,13 +38,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Organization:Overview:FunctionalCIs' => 'A szervezet konfigurációs elemei', 'Organization:Overview:FunctionalCIs:subtitle' => 'típus szerint', 'Organization:Overview:Users' => ITOP_APPLICATION_SHORT.' szervezeten belüli felhasználók', -)); +]); // // Class: Location // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Location' => 'Helyszín', 'Class:Location+' => '', 'Class:Location/Attribute:name' => 'Név', @@ -70,13 +71,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Location/Attribute:physicaldevice_list+' => 'A helyszín összes eszköze', 'Class:Location/Attribute:person_list' => 'Kapcsolattartók', 'Class:Location/Attribute:person_list+' => 'A helyszín összes kapcsolattartója', -)); +]); // // Class: Contact // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Contact' => 'Kapcsolattartó', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s~~', @@ -108,13 +109,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Contact/Attribute:cis_list+' => 'A kapcsolattartóhoz tartozó összes konfigurációs elem', 'Class:Contact/Attribute:finalclass' => 'Kapcsolattartó típus', 'Class:Contact/Attribute:finalclass+' => '', -)); +]); // // Class: Person // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Person' => 'Kapcsolattartó', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s~~', @@ -149,13 +150,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Person/UniquenessRule:name+' => 'Az alkalmazott nevének egyedinek kell lennie a szervezeten belül', 'Class:Person/UniquenessRule:name' => 'A \'$this->org_name$\' szervezetben már van egy ugyanilyen nevű személy.', 'Class:Person/Error:ChangingOrgDenied' => 'Impossible to move this person under organization \'%1$s\' as it would break his access to the User Portal, his associated user not being allowed on this organization~~', -)); +]); // // Class: Team // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Team' => 'Csapat', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s~~', @@ -163,13 +164,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Team/Attribute:persons_list+' => '', 'Class:Team/Attribute:tickets_list' => 'Hibajegyek', 'Class:Team/Attribute:tickets_list+' => '', -)); +]); // // Class: Document // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Document' => 'Dokumentum', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -199,77 +200,77 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Document/Attribute:cis_list+' => '', 'Class:Document/Attribute:finalclass' => 'Dokumentum típus', 'Class:Document/Attribute:finalclass+' => 'A végső osztály neve', -)); +]); // // Class: DocumentFile // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:DocumentFile' => 'Dokumentum fájl', 'Class:DocumentFile+' => '~~', 'Class:DocumentFile/Attribute:file' => 'Fájl', 'Class:DocumentFile/Attribute:file+' => '~~', -)); +]); // // Class: DocumentNote // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:DocumentNote' => 'Dokumentum jegyzet', 'Class:DocumentNote+' => '~~', 'Class:DocumentNote/Attribute:text' => 'Szöveg', 'Class:DocumentNote/Attribute:text+' => '~~', -)); +]); // // Class: DocumentWeb // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:DocumentWeb' => 'Webdokumentum', 'Class:DocumentWeb+' => '~~', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Typology' => 'Tipológia', 'Class:Typology+' => '~~', 'Class:Typology/Attribute:name' => 'Név', 'Class:Typology/Attribute:name+' => '~~', 'Class:Typology/Attribute:finalclass' => 'Tipológia típus', 'Class:Typology/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentType // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:DocumentType' => 'Dokumentum típus', 'Class:DocumentType+' => '~~', -)); +]); // // Class: ContactType // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ContactType' => 'Kapcsolattartó típus', 'Class:ContactType+' => '~~', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkPersonToTeam' => 'Kapcsolattartó / Csapat', 'Class:lnkPersonToTeam+' => '~~', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s~~', @@ -286,13 +287,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => 'To select within a typology of possible roles~~', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Szerepkör név', 'Class:lnkPersonToTeam/Attribute:role_name+' => '~~', -)); +]); // // Application Menu // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Menu:DataAdministration' => 'Adat adminisztráció', 'Menu:DataAdministration+' => '', 'Menu:Catalogs' => 'Katalógusok', @@ -330,20 +331,20 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Menu:Typology+' => '', 'UI_WelcomeMenu_AllConfigItems' => 'Összegzés', 'Menu:ConfigManagement:Typology' => 'Tipológia konfiguráció', -)); +]); // Add translation for Fieldsets -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Person:info' => 'Általános információk', 'User:info' => 'Általános információk', 'User:profiles' => 'Profiles (minimum one)~~', 'Person:personal_info' => 'Személyes információk', 'Person:notifiy' => 'Értesítés', -)); +]); // Themes -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'theme:fullmoon' => 'Full moon', 'theme:test-red' => 'Tesztpéldány (Red)', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/it.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/it.dict.itop-structure.php index 39408d243..ad6b584e5 100644 --- a/datamodels/2.x/itop-structure/dictionaries/it.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/it.dict.itop-structure.php @@ -1,16 +1,17 @@ * */ -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Organization' => 'Organizzazione', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => 'Cognome', @@ -37,13 +38,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Organization:Overview:FunctionalCIs' => 'Configuration items of this organization~~', 'Organization:Overview:FunctionalCIs:subtitle' => 'by type~~', 'Organization:Overview:Users' => ITOP_APPLICATION_SHORT.' Users within this organization~~', -)); +]); // // Class: Location // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Location' => 'Localizzazione', 'Class:Location+' => 'Qualsiasi tipo di localizzazione: Regione, Paese, Città, Sito, Edificio, Piano, Stanza, Rack,,...', 'Class:Location/Attribute:name' => 'Nome', @@ -70,13 +71,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Location/Attribute:physicaldevice_list+' => 'All the devices in this location~~', 'Class:Location/Attribute:person_list' => 'Contacts~~', 'Class:Location/Attribute:person_list+' => 'All the contacts located on this location~~', -)); +]); // // Class: Contact // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Contact' => 'Contatto', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s~~', @@ -108,13 +109,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Contact/Attribute:cis_list+' => 'All the configuration items linked to this contact~~', 'Class:Contact/Attribute:finalclass' => 'Tipo', 'Class:Contact/Attribute:finalclass+' => '', -)); +]); // // Class: Person // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Person' => 'Persona', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s~~', @@ -149,13 +150,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Person/UniquenessRule:name+' => 'The employee name should be unique inside its organization~~', 'Class:Person/UniquenessRule:name' => 'There is already a person in \'$this->org_name$\' organization with the same name~~', 'Class:Person/Error:ChangingOrgDenied' => 'Impossible to move this person under organization \'%1$s\' as it would break his access to the User Portal, his associated user not being allowed on this organization~~', -)); +]); // // Class: Team // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Team' => 'Squadra', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s~~', @@ -163,13 +164,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Team/Attribute:persons_list+' => 'All the people belonging to this team~~', 'Class:Team/Attribute:tickets_list' => 'Tickets~~', 'Class:Team/Attribute:tickets_list+' => 'All the tickets assigned to this team~~', -)); +]); // // Class: Document // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Document' => 'Documento', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -199,77 +200,77 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Document/Attribute:cis_list+' => 'All the configuration items linked to this document~~', 'Class:Document/Attribute:finalclass' => 'Document sub-class~~', 'Class:Document/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: DocumentFile // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:DocumentFile' => 'Document File~~', 'Class:DocumentFile+' => '~~', 'Class:DocumentFile/Attribute:file' => 'File~~', 'Class:DocumentFile/Attribute:file+' => '~~', -)); +]); // // Class: DocumentNote // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:DocumentNote' => 'Document Note~~', 'Class:DocumentNote+' => '~~', 'Class:DocumentNote/Attribute:text' => 'Text~~', 'Class:DocumentNote/Attribute:text+' => '~~', -)); +]); // // Class: DocumentWeb // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:DocumentWeb' => 'Document Web~~', 'Class:DocumentWeb+' => '~~', 'Class:DocumentWeb/Attribute:url' => 'URL~~', 'Class:DocumentWeb/Attribute:url+' => '~~', -)); +]); // // Class: Typology // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Typology' => 'Typology~~', 'Class:Typology+' => '~~', 'Class:Typology/Attribute:name' => 'Name~~', 'Class:Typology/Attribute:name+' => '~~', 'Class:Typology/Attribute:finalclass' => 'Typology sub-class~~', 'Class:Typology/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: DocumentType // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:DocumentType' => 'Document Type~~', 'Class:DocumentType+' => '~~', -)); +]); // // Class: ContactType // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ContactType' => 'Contact Type~~', 'Class:ContactType+' => '~~', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkPersonToTeam' => 'Link Person / Team~~', 'Class:lnkPersonToTeam+' => '~~', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s~~', @@ -286,13 +287,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => 'To select within a typology of possible roles~~', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Role name~~', 'Class:lnkPersonToTeam/Attribute:role_name+' => '~~', -)); +]); // // Application Menu // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Menu:DataAdministration' => 'Dati di amministrazione', 'Menu:DataAdministration+' => '', 'Menu:Catalogs' => 'Cataloghi', @@ -330,20 +331,20 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Menu:Typology+' => 'Typology configuration~~', 'UI_WelcomeMenu_AllConfigItems' => 'Summary~~', 'Menu:ConfigManagement:Typology' => 'Typology configuration~~', -)); +]); // Add translation for Fieldsets -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Person:info' => 'General information~~', 'User:info' => 'General information~~', 'User:profiles' => 'Profiles (minimum one)~~', 'Person:personal_info' => 'Personal information~~', 'Person:notifiy' => 'Notification~~', -)); +]); // Themes -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'theme:fullmoon' => 'Full moon~~', 'theme:test-red' => 'Test instance (Red)~~', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/ja.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/ja.dict.itop-structure.php index 6c069b83c..121cc8229 100644 --- a/datamodels/2.x/itop-structure/dictionaries/ja.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/ja.dict.itop-structure.php @@ -1,16 +1,17 @@ * */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Organization' => '組織', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => '名前', @@ -37,13 +38,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Organization:Overview:FunctionalCIs' => 'Configuration items of this organization~~', 'Organization:Overview:FunctionalCIs:subtitle' => 'by type~~', 'Organization:Overview:Users' => ITOP_APPLICATION_SHORT.' Users within this organization~~', -)); +]); // // Class: Location // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Location' => '場所', 'Class:Location+' => '任意の場所のタイプ: リージョン、国、都市、サイト、ビル、フロア、部屋、ラック、...', 'Class:Location/Attribute:name' => '名前', @@ -70,13 +71,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Location/Attribute:physicaldevice_list+' => 'All the devices in this location~~', 'Class:Location/Attribute:person_list' => '連絡先', 'Class:Location/Attribute:person_list+' => 'All the contacts located on this location~~', -)); +]); // // Class: Contact // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Contact' => '連絡先', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s~~', @@ -108,13 +109,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Contact/Attribute:cis_list+' => 'All the configuration items linked to this contact~~', 'Class:Contact/Attribute:finalclass' => '連絡先タイプ', 'Class:Contact/Attribute:finalclass+' => '', -)); +]); // // Class: Person // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Person' => '人物', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s~~', @@ -149,13 +150,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Person/UniquenessRule:name+' => 'The employee name should be unique inside its organization~~', 'Class:Person/UniquenessRule:name' => 'There is already a person in \'$this->org_name$\' organization with the same name~~', 'Class:Person/Error:ChangingOrgDenied' => 'Impossible to move this person under organization \'%1$s\' as it would break his access to the User Portal, his associated user not being allowed on this organization~~', -)); +]); // // Class: Team // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Team' => 'チーム', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s~~', @@ -163,13 +164,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Team/Attribute:persons_list+' => 'All the people belonging to this team~~', 'Class:Team/Attribute:tickets_list' => 'チケット', 'Class:Team/Attribute:tickets_list+' => 'All the tickets assigned to this team~~', -)); +]); // // Class: Document // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Document' => '文書', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -199,77 +200,77 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Document/Attribute:cis_list+' => 'All the configuration items linked to this document~~', 'Class:Document/Attribute:finalclass' => '文書タイプ', 'Class:Document/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentFile // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:DocumentFile' => '文書ファイル', 'Class:DocumentFile+' => '', 'Class:DocumentFile/Attribute:file' => 'ファイル', 'Class:DocumentFile/Attribute:file+' => '', -)); +]); // // Class: DocumentNote // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:DocumentNote' => '文書ノート', 'Class:DocumentNote+' => '', 'Class:DocumentNote/Attribute:text' => 'テキスト', 'Class:DocumentNote/Attribute:text+' => '', -)); +]); // // Class: DocumentWeb // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:DocumentWeb' => '文書Web', 'Class:DocumentWeb+' => '', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Typology' => '分類', 'Class:Typology+' => '', 'Class:Typology/Attribute:name' => '名前', 'Class:Typology/Attribute:name+' => '', 'Class:Typology/Attribute:finalclass' => 'タイプ', 'Class:Typology/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentType // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:DocumentType' => '文書タイプ', 'Class:DocumentType+' => '', -)); +]); // // Class: ContactType // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ContactType' => '問い合せ先タイプ', 'Class:ContactType+' => '', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkPersonToTeam' => 'リンク 人物/チーム', 'Class:lnkPersonToTeam+' => '', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s~~', @@ -286,13 +287,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => '', 'Class:lnkPersonToTeam/Attribute:role_name' => '役割名', 'Class:lnkPersonToTeam/Attribute:role_name+' => '', -)); +]); // // Application Menu // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Menu:DataAdministration' => 'データ管理', 'Menu:DataAdministration+' => 'データ管理', 'Menu:Catalogs' => 'カタログ', @@ -330,20 +331,20 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Menu:Typology+' => 'トポロジー構成', 'UI_WelcomeMenu_AllConfigItems' => 'サマリー', 'Menu:ConfigManagement:Typology' => '分類構成', -)); +]); // Add translation for Fieldsets -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Person:info' => '情報', 'User:info' => '情報', 'User:profiles' => 'Profiles (minimum one)~~', 'Person:personal_info' => 'Personal information~~', 'Person:notifiy' => '通知', -)); +]); // Themes -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'theme:fullmoon' => 'Full moon~~', 'theme:test-red' => 'Test instance (Red)~~', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/nl.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/nl.dict.itop-structure.php index 43da686da..f64feda71 100644 --- a/datamodels/2.x/itop-structure/dictionaries/nl.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/nl.dict.itop-structure.php @@ -1,10 +1,11 @@ @@ -12,7 +13,7 @@ * @author Thomas Casteleyn * @author Jeffrey Bostoen (2018 - 2022) */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Organization' => 'Organisatie', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => 'Naam', @@ -39,13 +40,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Organization:Overview:FunctionalCIs' => 'Configuratie-items van deze organisatie', 'Organization:Overview:FunctionalCIs:subtitle' => 'per type', 'Organization:Overview:Users' => ITOP_APPLICATION_SHORT.'-gebruikers in deze organisatie', -)); +]); // // Class: Location // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Location' => 'Locatie', 'Class:Location+' => 'Een locatie zoals: land, regio, gemeente/stad, gebouw, verdieping, kamer, ...', 'Class:Location/Attribute:name' => 'Naam', @@ -72,13 +73,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Location/Attribute:physicaldevice_list+' => 'Alle apparaten die zich op deze locatie bevinden', 'Class:Location/Attribute:person_list' => 'Contacten', 'Class:Location/Attribute:person_list+' => 'Alle contacten die zich op deze locatie bevinden', -)); +]); // // Class: Contact // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Contact' => 'Contact', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s', @@ -110,13 +111,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Contact/Attribute:cis_list+' => 'Alle configuratie-items die gerelateerd zijn aan dit team', 'Class:Contact/Attribute:finalclass' => 'Subklasse contact', 'Class:Contact/Attribute:finalclass+' => '', -)); +]); // // Class: Person // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Person' => 'Persoon', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s', @@ -151,13 +152,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Person/UniquenessRule:name+' => 'De naam moet uniek zijn binnen een organisatie', 'Class:Person/UniquenessRule:name' => 'Er is al een persoon in de organisatie \'$this->org_name$\' met dezelfde naam', 'Class:Person/Error:ChangingOrgDenied' => 'Impossible to move this person under organization \'%1$s\' as it would break his access to the User Portal, his associated user not being allowed on this organization~~', -)); +]); // // Class: Team // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Team' => 'Team', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s', @@ -165,13 +166,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Team/Attribute:persons_list+' => 'Alle personen die lid zijn van dit team', 'Class:Team/Attribute:tickets_list' => 'Tickets', 'Class:Team/Attribute:tickets_list+' => 'Alle tickets die toegewezen zijn aan dit team', -)); +]); // // Class: Document // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Document' => 'Document', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -201,77 +202,77 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Document/Attribute:cis_list+' => 'Alle configuratie-items gerelateerd aan dit document', 'Class:Document/Attribute:finalclass' => 'Subklasse document', 'Class:Document/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentFile // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:DocumentFile' => 'Document: Bestand', 'Class:DocumentFile+' => '', 'Class:DocumentFile/Attribute:file' => 'Bestand', 'Class:DocumentFile/Attribute:file+' => '', -)); +]); // // Class: DocumentNote // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:DocumentNote' => 'Document: Notitie', 'Class:DocumentNote+' => '', 'Class:DocumentNote/Attribute:text' => 'Tekst', 'Class:DocumentNote/Attribute:text+' => '', -)); +]); // // Class: DocumentWeb // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:DocumentWeb' => 'Document: Web', 'Class:DocumentWeb+' => '', 'Class:DocumentWeb/Attribute:url' => 'Link (URL)', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Typology' => 'Typologie', 'Class:Typology+' => '', 'Class:Typology/Attribute:name' => 'Naam', 'Class:Typology/Attribute:name+' => '', 'Class:Typology/Attribute:finalclass' => 'Subklasse typologie', 'Class:Typology/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentType // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:DocumentType' => 'Soort Document', 'Class:DocumentType+' => '', -)); +]); // // Class: ContactType // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ContactType' => 'Soort Contact', 'Class:ContactType+' => '', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkPersonToTeam' => 'Link Persoon / Team', 'Class:lnkPersonToTeam+' => '', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s', @@ -288,13 +289,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => '', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Naam rol', 'Class:lnkPersonToTeam/Attribute:role_name+' => '', -)); +]); // // Application Menu // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:DataAdministration' => 'Databeheer', 'Menu:DataAdministration+' => 'Databeheer', 'Menu:Catalogs' => 'Catalogus', @@ -332,20 +333,20 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Menu:Typology+' => 'Configuratie van de typologie', 'UI_WelcomeMenu_AllConfigItems' => 'Samenvatting', 'Menu:ConfigManagement:Typology' => 'Configuratie typologie', -)); +]); // Add translation for Fieldsets -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Person:info' => 'Globale informatie', 'User:info' => 'Globale informatie', 'User:profiles' => 'Profielen (minimaal één)', 'Person:personal_info' => 'Persoonlijke informatie', 'Person:notifiy' => 'Notificeer', -)); +]); // Themes -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'theme:fullmoon' => 'Full moon', 'theme:test-red' => 'Test instance (Rood)', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/pl.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/pl.dict.itop-structure.php index 22a21a32f..7d26b828a 100644 --- a/datamodels/2.x/itop-structure/dictionaries/pl.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/pl.dict.itop-structure.php @@ -1,15 +1,16 @@ 'Organizacja', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => 'Nazwa', @@ -36,13 +37,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Organization:Overview:FunctionalCIs' => 'Pozycje konfiguracji tej organizacji', 'Organization:Overview:FunctionalCIs:subtitle' => 'według rodzaju', 'Organization:Overview:Users' => '', -)); +]); // // Class: Location // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Location' => 'Lokalizacja', 'Class:Location+' => 'Dowolny typ lokalizacji: region, kraj, miasto, teren, budynek, piętro, pokój, stojak,...', 'Class:Location/Attribute:name' => 'Nazwa', @@ -69,13 +70,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Location/Attribute:physicaldevice_list+' => 'Wszystkie urządzenia w tej lokalizacji', 'Class:Location/Attribute:person_list' => 'Kontakty', 'Class:Location/Attribute:person_list+' => 'Wszystkie kontakty znajdujące się w tej lokalizacji', -)); +]); // // Class: Contact // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Contact' => 'Kontakt', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s', @@ -107,13 +108,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Contact/Attribute:cis_list+' => 'Wszystkie elementy konfiguracji powiązane z tym kontaktem', 'Class:Contact/Attribute:finalclass' => 'podklasa kontaktu', 'Class:Contact/Attribute:finalclass+' => 'Nazwa klasy głównej', -)); +]); // // Class: Person // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Person' => 'Osoba', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s', @@ -148,13 +149,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Person/UniquenessRule:name+' => 'Imię i nazwisko pracownika powinno być unikalne w jego organizacji', 'Class:Person/UniquenessRule:name' => 'W organizacji \'$this->org_name$\' istnieje już osoba o takiej samej nazwie', 'Class:Person/Error:ChangingOrgDenied' => 'Nie można przenieść tej osoby do organizacji \'%1$s\', ponieważ uniemożliwiłoby to jej dostęp do Portalu użytkowników, a powiązany z nią użytkownik nie byłby dozwolony w tej organizacji', -)); +]); // // Class: Team // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Team' => 'Zespół', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s', @@ -162,13 +163,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Team/Attribute:persons_list+' => 'Wszystkie osoby należące do tego zespołu', 'Class:Team/Attribute:tickets_list' => 'Zgłoszenia', 'Class:Team/Attribute:tickets_list+' => 'Wszystkie zgłoszenia przypisane do tego zespołu', -)); +]); // // Class: Document // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Document' => 'Dokument', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -198,77 +199,77 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Document/Attribute:cis_list+' => 'Wszystkie elementy konfiguracji powiązane z tym dokumentem', 'Class:Document/Attribute:finalclass' => 'Podklasa dokumentu', 'Class:Document/Attribute:finalclass+' => 'Klasa główna dokumentu', -)); +]); // // Class: DocumentFile // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:DocumentFile' => 'Plik dokumentu', 'Class:DocumentFile+' => '', 'Class:DocumentFile/Attribute:file' => 'Plik', 'Class:DocumentFile/Attribute:file+' => '', -)); +]); // // Class: DocumentNote // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:DocumentNote' => 'Notatka do dokumentu', 'Class:DocumentNote+' => '', 'Class:DocumentNote/Attribute:text' => 'Tekst', 'Class:DocumentNote/Attribute:text+' => '', -)); +]); // // Class: DocumentWeb // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:DocumentWeb' => 'Dokument www', 'Class:DocumentWeb+' => '', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Typology' => 'Typologia', 'Class:Typology+' => '', 'Class:Typology/Attribute:name' => 'Nazwa', 'Class:Typology/Attribute:name+' => '', 'Class:Typology/Attribute:finalclass' => 'Podklasa typologii', 'Class:Typology/Attribute:finalclass+' => 'Klasa główna typologii', -)); +]); // // Class: DocumentType // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:DocumentType' => 'Typ dokumentu', 'Class:DocumentType+' => '', -)); +]); // // Class: ContactType // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ContactType' => 'Typ kontaktu', 'Class:ContactType+' => '', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkPersonToTeam' => 'Połączenie osoba / zespół', 'Class:lnkPersonToTeam+' => '', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s', @@ -285,13 +286,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => '', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Nazwa roli', 'Class:lnkPersonToTeam/Attribute:role_name+' => '', -)); +]); // // Application Menu // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Menu:DataAdministration' => 'Administracja danymi', 'Menu:DataAdministration+' => 'Administracja danymi', 'Menu:Catalogs' => 'Katalogi', @@ -329,20 +330,20 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Menu:Typology+' => 'Konfiguracja typologii', 'UI_WelcomeMenu_AllConfigItems' => 'Podsumowanie', 'Menu:ConfigManagement:Typology' => 'Konfiguracja typologii', -)); +]); // Add translation for Fieldsets -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Person:info' => 'Informacje ogólne', 'User:info' => 'Informacje ogólne', 'User:profiles' => 'Profile (minimum jeden)', 'Person:personal_info' => 'Informacje osobiste', 'Person:notifiy' => 'Powiadomienie', -)); +]); // Themes -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'theme:fullmoon' => 'Pełnia księżyca', 'theme:test-red' => 'Instancja testowa (czerwona)', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/pt_br.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/pt_br.dict.itop-structure.php index f92c55c7a..437361c41 100644 --- a/datamodels/2.x/itop-structure/dictionaries/pt_br.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/pt_br.dict.itop-structure.php @@ -1,16 +1,17 @@ * */ -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Organization' => 'Organização', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => 'Nome', @@ -37,13 +38,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Organization:Overview:FunctionalCIs' => 'Itens de configuração associadas à esta organização', 'Organization:Overview:FunctionalCIs:subtitle' => 'por tipo', 'Organization:Overview:Users' => 'Usuários do '.ITOP_APPLICATION_SHORT.' associados à esta organização', -)); +]); // // Class: Location // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Location' => 'Localização', 'Class:Location+' => 'Qualquer tipo de localização: Região, País, Cidade, Lugar, Edifício, Andar, Sala, Rack, etc.', 'Class:Location/Attribute:name' => 'Nome', @@ -70,13 +71,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Location/Attribute:physicaldevice_list+' => 'Todos os dispositivos associados à esta localização', 'Class:Location/Attribute:person_list' => 'Contatos', 'Class:Location/Attribute:person_list+' => 'Todos os contatos associados à esta localização', -)); +]); // // Class: Contact // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Contact' => 'Contato', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s~~', @@ -108,13 +109,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Contact/Attribute:cis_list+' => 'Todos os itens de configuração associados a este contato', 'Class:Contact/Attribute:finalclass' => 'Tipo de contato', 'Class:Contact/Attribute:finalclass+' => '', -)); +]); // // Class: Person // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Person' => 'Pessoa', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s~~', @@ -149,13 +150,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Person/UniquenessRule:name+' => 'O nome do colaborador deve ser único dentro de sua organização', 'Class:Person/UniquenessRule:name' => 'Já existe uma pessoa na organização \'$this->org_name$\' com o mesmo nome', 'Class:Person/Error:ChangingOrgDenied' => 'Impossible to move this person under organization \'%1$s\' as it would break his access to the User Portal, his associated user not being allowed on this organization~~', -)); +]); // // Class: Team // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Team' => 'Equipe', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s~~', @@ -163,13 +164,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Team/Attribute:persons_list+' => 'Todas as pessoas que pertencem a essa equipe', 'Class:Team/Attribute:tickets_list' => 'Solicitações', 'Class:Team/Attribute:tickets_list+' => 'Todas as solicitações atribuídas a essa equipe', -)); +]); // // Class: Document // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Document' => 'Documento', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -199,77 +200,77 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Document/Attribute:cis_list+' => 'Todos os itens de configuração associados a este documento', 'Class:Document/Attribute:finalclass' => 'Tipo documento', 'Class:Document/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentFile // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:DocumentFile' => 'Arquivo', 'Class:DocumentFile+' => '', 'Class:DocumentFile/Attribute:file' => 'Arquivo', 'Class:DocumentFile/Attribute:file+' => '', -)); +]); // // Class: DocumentNote // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:DocumentNote' => 'Texto', 'Class:DocumentNote+' => '', 'Class:DocumentNote/Attribute:text' => 'Texto', 'Class:DocumentNote/Attribute:text+' => '', -)); +]); // // Class: DocumentWeb // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:DocumentWeb' => 'Web', 'Class:DocumentWeb+' => '', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Typology' => 'Tipologia', 'Class:Typology+' => '', 'Class:Typology/Attribute:name' => 'Nome', 'Class:Typology/Attribute:name+' => '', 'Class:Typology/Attribute:finalclass' => 'Tipo', 'Class:Typology/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentType // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:DocumentType' => 'Tipo de documento', 'Class:DocumentType+' => '', -)); +]); // // Class: ContactType // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ContactType' => 'Tipo de contato', 'Class:ContactType+' => '', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkPersonToTeam' => 'Link Pessoa / Equipe', 'Class:lnkPersonToTeam+' => '', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s~~', @@ -286,13 +287,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => 'Define a função da Pessoa na Equipe (Líder de Equipe, Gerente...).', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Nome da função', 'Class:lnkPersonToTeam/Attribute:role_name+' => '', -)); +]); // // Application Menu // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Menu:DataAdministration' => 'Administração de dados', 'Menu:DataAdministration+' => '', 'Menu:Catalogs' => 'Catálogos', @@ -330,20 +331,20 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Menu:Typology+' => 'Lista de tipologias', 'UI_WelcomeMenu_AllConfigItems' => 'Índice', 'Menu:ConfigManagement:Typology' => 'Configuração de tipologias', -)); +]); // Add translation for Fieldsets -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Person:info' => 'Informações gerais', 'User:info' => 'Informações gerais', 'User:profiles' => 'Profiles (minimum one)~~', 'Person:personal_info' => 'Informações pessoais', 'Person:notifiy' => 'Notificações', -)); +]); // Themes -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'theme:fullmoon' => 'Full moon', 'theme:test-red' => 'Test instance (Red)', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/ru.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/ru.dict.itop-structure.php index 9f65ae6e2..a58c2babf 100644 --- a/datamodels/2.x/itop-structure/dictionaries/ru.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/ru.dict.itop-structure.php @@ -1,17 +1,18 @@ * @author Vladimir Kunin * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Organization' => 'Организация', 'Class:Organization+' => 'Организация', 'Class:Organization/Attribute:name' => 'Название', @@ -38,13 +39,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Organization:Overview:FunctionalCIs' => 'Конфигурационные единицы этой организации', 'Organization:Overview:FunctionalCIs:subtitle' => 'по типу', 'Organization:Overview:Users' => 'Пользователи '.ITOP_APPLICATION_SHORT.' этой организации', -)); +]); // // Class: Location // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Location' => 'Расположение', 'Class:Location+' => 'Типы расположения: Регион, Страна, Город, Сайт, Здание, Этаж, Комната, Стойка и т.п.', 'Class:Location/Attribute:name' => 'Название', @@ -71,13 +72,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Location/Attribute:physicaldevice_list+' => 'Устройства в этом расположении', 'Class:Location/Attribute:person_list' => 'Контакты', 'Class:Location/Attribute:person_list+' => 'Контакты в этом расположении', -)); +]); // // Class: Contact // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Contact' => 'Контакт', 'Class:Contact+' => 'Контакт', 'Class:Contact/ComplementaryName' => '%1$s - %2$s~~', @@ -109,13 +110,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Contact/Attribute:cis_list+' => 'Связанные конфигурационные единицы', 'Class:Contact/Attribute:finalclass' => 'Тип контакта', 'Class:Contact/Attribute:finalclass+' => '', -)); +]); // // Class: Person // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Person' => 'Персона', 'Class:Person+' => 'Персона', 'Class:Person/ComplementaryName' => '%1$s - %2$s~~', @@ -150,13 +151,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Person/UniquenessRule:name+' => 'Имя сотрудника должно быть уникальным внутри организации', 'Class:Person/UniquenessRule:name' => 'В организации \'$this->org_name$\' уже есть персона с таким именем', 'Class:Person/Error:ChangingOrgDenied' => 'Impossible to move this person under organization \'%1$s\' as it would break his access to the User Portal, his associated user not being allowed on this organization~~', -)); +]); // // Class: Team // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Team' => 'Команда', 'Class:Team+' => 'Команда', 'Class:Team/ComplementaryName' => '%1$s - %2$s~~', @@ -164,13 +165,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Team/Attribute:persons_list+' => 'Участники команды', 'Class:Team/Attribute:tickets_list' => 'Тикеты', 'Class:Team/Attribute:tickets_list+' => 'Все тикеты, назначенные на команду', -)); +]); // // Class: Document // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Document' => 'Документ', 'Class:Document+' => 'Документ', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -200,77 +201,77 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Document/Attribute:cis_list+' => 'Связанные конфигурационные единицы', 'Class:Document/Attribute:finalclass' => 'Тип', 'Class:Document/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentFile // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:DocumentFile' => 'Файл', 'Class:DocumentFile+' => 'Файл', 'Class:DocumentFile/Attribute:file' => 'Файл', 'Class:DocumentFile/Attribute:file+' => '', -)); +]); // // Class: DocumentNote // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:DocumentNote' => 'Заметка', 'Class:DocumentNote+' => 'Заметка', 'Class:DocumentNote/Attribute:text' => 'Заметка', 'Class:DocumentNote/Attribute:text+' => '', -)); +]); // // Class: DocumentWeb // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:DocumentWeb' => 'Веб-документ', 'Class:DocumentWeb+' => 'Веб-документ', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Typology' => 'Типология', 'Class:Typology+' => 'Типология', 'Class:Typology/Attribute:name' => 'Название', 'Class:Typology/Attribute:name+' => '', 'Class:Typology/Attribute:finalclass' => 'Тип', 'Class:Typology/Attribute:finalclass+' => '', -)); +]); // // Class: DocumentType // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:DocumentType' => 'Тип документа', 'Class:DocumentType+' => '', -)); +]); // // Class: ContactType // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ContactType' => 'Тип контакта', 'Class:ContactType+' => '', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkPersonToTeam' => 'Связь Персона/Команда', 'Class:lnkPersonToTeam+' => '', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s~~', @@ -287,13 +288,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => '', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Роль', 'Class:lnkPersonToTeam/Attribute:role_name+' => '', -)); +]); // // Application Menu // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:DataAdministration' => 'Администрирование данных', 'Menu:DataAdministration+' => 'Администрирование данных', 'Menu:Catalogs' => 'Каталоги', @@ -331,20 +332,20 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Menu:Typology+' => 'Типология', 'UI_WelcomeMenu_AllConfigItems' => 'Все конфигурационные единицы', 'Menu:ConfigManagement:Typology' => 'Настройка типологии', -)); +]); // Add translation for Fieldsets -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Person:info' => 'Основная информация', 'User:info' => 'Основная информация', 'User:profiles' => 'Profiles (minimum one)~~', 'Person:personal_info' => 'Личная информация', 'Person:notifiy' => 'Уведомления', -)); +]); // Themes -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'theme:fullmoon' => 'Full moon~~', 'theme:test-red' => 'Test instance (Red)~~', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/sk.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/sk.dict.itop-structure.php index 559c41aef..f612ee3a7 100644 --- a/datamodels/2.x/itop-structure/dictionaries/sk.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/sk.dict.itop-structure.php @@ -1,16 +1,17 @@ * */ -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Organization' => 'Organizácia', 'Class:Organization+' => '~~', 'Class:Organization/Attribute:name' => 'Názov', @@ -37,13 +38,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Organization:Overview:FunctionalCIs' => 'Configuration items of this organization~~', 'Organization:Overview:FunctionalCIs:subtitle' => 'by type~~', 'Organization:Overview:Users' => ITOP_APPLICATION_SHORT.' Users within this organization~~', -)); +]); // // Class: Location // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Location' => 'Poloha', 'Class:Location+' => 'Any type of location: Region, Country, City, Site, Building, Floor, Room, Rack,...~~', 'Class:Location/Attribute:name' => 'Názov', @@ -70,13 +71,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Location/Attribute:physicaldevice_list+' => 'All the devices in this location~~', 'Class:Location/Attribute:person_list' => 'Kontakty', 'Class:Location/Attribute:person_list+' => 'All the contacts located on this location~~', -)); +]); // // Class: Contact // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Contact' => 'Kontakt', 'Class:Contact+' => '~~', 'Class:Contact/ComplementaryName' => '%1$s - %2$s~~', @@ -108,13 +109,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Contact/Attribute:cis_list+' => 'All the configuration items linked to this contact~~', 'Class:Contact/Attribute:finalclass' => 'Typ kontaktu', 'Class:Contact/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: Person // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Person' => 'Osoba', 'Class:Person+' => '~~', 'Class:Person/ComplementaryName' => '%1$s - %2$s~~', @@ -149,13 +150,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Person/UniquenessRule:name+' => 'The employee name should be unique inside its organization~~', 'Class:Person/UniquenessRule:name' => 'There is already a person in \'$this->org_name$\' organization with the same name~~', 'Class:Person/Error:ChangingOrgDenied' => 'Impossible to move this person under organization \'%1$s\' as it would break his access to the User Portal, his associated user not being allowed on this organization~~', -)); +]); // // Class: Team // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Team' => 'Tím', 'Class:Team+' => '~~', 'Class:Team/ComplementaryName' => '%1$s - %2$s~~', @@ -163,13 +164,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Team/Attribute:persons_list+' => 'All the people belonging to this team~~', 'Class:Team/Attribute:tickets_list' => 'Tickety', 'Class:Team/Attribute:tickets_list+' => 'All the tickets assigned to this team~~', -)); +]); // // Class: Document // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Document' => 'Dokument', 'Class:Document+' => '~~', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -199,77 +200,77 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Document/Attribute:cis_list+' => 'All the configuration items linked to this document~~', 'Class:Document/Attribute:finalclass' => 'Typ dokumentu', 'Class:Document/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: DocumentFile // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:DocumentFile' => 'Dokumentový súbor', 'Class:DocumentFile+' => '~~', 'Class:DocumentFile/Attribute:file' => 'Súbor', 'Class:DocumentFile/Attribute:file+' => '~~', -)); +]); // // Class: DocumentNote // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:DocumentNote' => 'Poznámka dokumentu', 'Class:DocumentNote+' => '~~', 'Class:DocumentNote/Attribute:text' => 'Text', 'Class:DocumentNote/Attribute:text+' => '~~', -)); +]); // // Class: DocumentWeb // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:DocumentWeb' => 'Web stránka dokumentu', 'Class:DocumentWeb+' => '~~', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '~~', -)); +]); // // Class: Typology // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Typology' => 'Typológia', 'Class:Typology+' => '~~', 'Class:Typology/Attribute:name' => 'Názov', 'Class:Typology/Attribute:name+' => '~~', 'Class:Typology/Attribute:finalclass' => 'Typ', 'Class:Typology/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: DocumentType // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:DocumentType' => 'Typ dokumentu', 'Class:DocumentType+' => '~~', -)); +]); // // Class: ContactType // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ContactType' => 'Typ kontaktu', 'Class:ContactType+' => '~~', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkPersonToTeam' => 'väzba - Osoba / Tím', 'Class:lnkPersonToTeam+' => '~~', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s~~', @@ -286,13 +287,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => 'To select within a typology of possible roles~~', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Názov role', 'Class:lnkPersonToTeam/Attribute:role_name+' => '~~', -)); +]); // // Application Menu // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Menu:DataAdministration' => 'Dátová administrácia', 'Menu:DataAdministration+' => 'Data administration~~', 'Menu:Catalogs' => 'Katalógy', @@ -330,20 +331,20 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Menu:Typology+' => 'Typology configuration~~', 'UI_WelcomeMenu_AllConfigItems' => 'Zhrnutie', 'Menu:ConfigManagement:Typology' => 'Konfiguračná typológia', -)); +]); // Add translation for Fieldsets -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Person:info' => 'Všeobecné informácie', 'User:info' => 'Všeobecné informácie', 'User:profiles' => 'Profiles (minimum one)~~', 'Person:personal_info' => 'Personal information~~', 'Person:notifiy' => 'Upozornenie', -)); +]); // Themes -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'theme:fullmoon' => 'Full moon~~', 'theme:test-red' => 'Test instance (Red)~~', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/tr.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/tr.dict.itop-structure.php index 317a64275..bd6ec25fc 100644 --- a/datamodels/2.x/itop-structure/dictionaries/tr.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/tr.dict.itop-structure.php @@ -1,17 +1,18 @@ * @author Izzet Sirin * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Organization' => 'Kurum', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => 'Adı', @@ -38,13 +39,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Organization:Overview:FunctionalCIs' => 'Configuration items of this organization~~', 'Organization:Overview:FunctionalCIs:subtitle' => 'by type~~', 'Organization:Overview:Users' => ITOP_APPLICATION_SHORT.' Users within this organization~~', -)); +]); // // Class: Location // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Location' => 'Yerleşke', 'Class:Location+' => 'Yerleşke : Bölge, Ülke, Şehir, Yerleşke, Bina, Kat, Oda, kabin,...', 'Class:Location/Attribute:name' => 'Adı', @@ -71,13 +72,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Location/Attribute:physicaldevice_list+' => 'Bu konumdaki tüm cihazlar', 'Class:Location/Attribute:person_list' => 'Kişiler', 'Class:Location/Attribute:person_list+' => 'Bu konumda bulunan tüm kişiler', -)); +]); // // Class: Contact // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Contact' => 'İrtibat', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s~~', @@ -109,13 +110,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Contact/Attribute:cis_list+' => 'Bu kişiyle bağlantılı tüm yapılandırma öğeleri', 'Class:Contact/Attribute:finalclass' => 'Tip', 'Class:Contact/Attribute:finalclass+' => '', -)); +]); // // Class: Person // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Person' => 'Kişi', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s~~', @@ -150,13 +151,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Person/UniquenessRule:name+' => 'The employee name should be unique inside its organization~~', 'Class:Person/UniquenessRule:name' => 'There is already a person in \'$this->org_name$\' organization with the same name~~', 'Class:Person/Error:ChangingOrgDenied' => 'Impossible to move this person under organization \'%1$s\' as it would break his access to the User Portal, his associated user not being allowed on this organization~~', -)); +]); // // Class: Team // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Team' => 'Ekip', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s~~', @@ -164,13 +165,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Team/Attribute:persons_list+' => 'Bu ekibe ait tüm kişiler', 'Class:Team/Attribute:tickets_list' => 'Çağrı Kayıtları', 'Class:Team/Attribute:tickets_list+' => 'Bu ekibe atanan tüm çağrı kayıtları', -)); +]); // // Class: Document // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Document' => 'Doküman', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s~~', @@ -200,77 +201,77 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Document/Attribute:cis_list+' => 'Bu belgeye bağlı tüm yapılandırma öğeleri', 'Class:Document/Attribute:finalclass' => 'Belge Türü', 'Class:Document/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: DocumentFile // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:DocumentFile' => 'Belge dosyası', 'Class:DocumentFile+' => '~~', 'Class:DocumentFile/Attribute:file' => 'Dosya', 'Class:DocumentFile/Attribute:file+' => '~~', -)); +]); // // Class: DocumentNote // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:DocumentNote' => 'Belge Notu', 'Class:DocumentNote+' => '~~', 'Class:DocumentNote/Attribute:text' => 'Metin', 'Class:DocumentNote/Attribute:text+' => '~~', -)); +]); // // Class: DocumentWeb // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:DocumentWeb' => 'Belge Web', 'Class:DocumentWeb+' => '~~', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '~~', -)); +]); // // Class: Typology // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Typology' => 'Tipoloji', 'Class:Typology+' => '~~', 'Class:Typology/Attribute:name' => 'İsim', 'Class:Typology/Attribute:name+' => '~~', 'Class:Typology/Attribute:finalclass' => 'Tip', 'Class:Typology/Attribute:finalclass+' => 'Name of the final class~~', -)); +]); // // Class: DocumentType // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:DocumentType' => 'Belge Türü', 'Class:DocumentType+' => '~~', -)); +]); // // Class: ContactType // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ContactType' => 'İletişim Tipi', 'Class:ContactType+' => '~~', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkPersonToTeam' => 'Bağlantılı Kişi / Ekip', 'Class:lnkPersonToTeam+' => '~~', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s~~', @@ -287,13 +288,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => 'To select within a typology of possible roles~~', 'Class:lnkPersonToTeam/Attribute:role_name' => 'Rol Adı', 'Class:lnkPersonToTeam/Attribute:role_name+' => '~~', -)); +]); // // Application Menu // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Menu:DataAdministration' => 'Veri yönetimi', 'Menu:DataAdministration+' => 'Veri yönetimi', 'Menu:Catalogs' => 'Kataloglar', @@ -331,20 +332,20 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Menu:Typology+' => 'Tipoloji Yapılandırması', 'UI_WelcomeMenu_AllConfigItems' => 'Özet', 'Menu:ConfigManagement:Typology' => 'Tipoloji Yapılandırması', -)); +]); // Add translation for Fieldsets -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Person:info' => 'Genel Bilgi', 'User:info' => 'Genel Bilgi', 'User:profiles' => 'Profiles (minimum one)~~', 'Person:personal_info' => 'Personal information~~', 'Person:notifiy' => 'Bildirim', -)); +]); // Themes -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'theme:fullmoon' => 'Full moon~~', 'theme:test-red' => 'Test instance (Red)~~', -)); +]); diff --git a/datamodels/2.x/itop-structure/dictionaries/zh_cn.dict.itop-structure.php b/datamodels/2.x/itop-structure/dictionaries/zh_cn.dict.itop-structure.php index 329c235e7..fb2a5a1cd 100644 --- a/datamodels/2.x/itop-structure/dictionaries/zh_cn.dict.itop-structure.php +++ b/datamodels/2.x/itop-structure/dictionaries/zh_cn.dict.itop-structure.php @@ -1,4 +1,5 @@ '组织', 'Class:Organization+' => '', 'Class:Organization/Attribute:name' => '名称', @@ -68,13 +69,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Organization:Overview:FunctionalCIs' => '此组织的所有配置项', 'Organization:Overview:FunctionalCIs:subtitle' => '按类型', 'Organization:Overview:Users' => '此组织里所有的'.ITOP_APPLICATION_SHORT.'用户', -)); +]); // // Class: Location // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Location' => '地点', 'Class:Location+' => '任何类型的地点: 区域, 国家, 城市, 位置, 建筑, 楼层, 房间, 机架,...', 'Class:Location/Attribute:name' => '名称', @@ -101,13 +102,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Location/Attribute:physicaldevice_list+' => '此位置的所有设备', 'Class:Location/Attribute:person_list' => '联系人', 'Class:Location/Attribute:person_list+' => '此位置的所有联系人', -)); +]); // // Class: Contact // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Contact' => '联系人', 'Class:Contact+' => '', 'Class:Contact/ComplementaryName' => '%1$s - %2$s', @@ -139,13 +140,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Contact/Attribute:cis_list+' => '此联系人关联的所有配置项', 'Class:Contact/Attribute:finalclass' => '联系人类型', 'Class:Contact/Attribute:finalclass+' => '根本属性的名称', -)); +]); // // Class: Person // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Person' => '人员', 'Class:Person+' => '', 'Class:Person/ComplementaryName' => '%1$s - %2$s~~', @@ -180,13 +181,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Person/UniquenessRule:name+' => '同一组织内的员工姓名必须唯一', 'Class:Person/UniquenessRule:name' => '\'$this->org_name$\' 内已经有人叫这个名字', 'Class:Person/Error:ChangingOrgDenied' => '无法移动此人员到组织 \'%1$s\' 因为这将终端其用户门户的访问, 其关联的用户没有被授权访问此组织', -)); +]); // // Class: Team // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Team' => '团队', 'Class:Team+' => '', 'Class:Team/ComplementaryName' => '%1$s - %2$s', @@ -194,13 +195,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Team/Attribute:persons_list+' => '此团队包含的所有成员', 'Class:Team/Attribute:tickets_list' => '工单', 'Class:Team/Attribute:tickets_list+' => '此团队的所有工单', -)); +]); // // Class: Document // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Document' => '文档', 'Class:Document+' => '', 'Class:Document/ComplementaryName' => '%1$s - %2$s - %3$s', @@ -230,77 +231,77 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Document/Attribute:cis_list+' => '此文档关联的所有配置项', 'Class:Document/Attribute:finalclass' => '文档类型', 'Class:Document/Attribute:finalclass+' => '根本属性的名称', -)); +]); // // Class: DocumentFile // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:DocumentFile' => '文档文件', 'Class:DocumentFile+' => '', 'Class:DocumentFile/Attribute:file' => '文件', 'Class:DocumentFile/Attribute:file+' => '', -)); +]); // // Class: DocumentNote // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:DocumentNote' => '文档笔记', 'Class:DocumentNote+' => '', 'Class:DocumentNote/Attribute:text' => '正文', 'Class:DocumentNote/Attribute:text+' => '', -)); +]); // // Class: DocumentWeb // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:DocumentWeb' => '文档网页', 'Class:DocumentWeb+' => '', 'Class:DocumentWeb/Attribute:url' => 'URL', 'Class:DocumentWeb/Attribute:url+' => '', -)); +]); // // Class: Typology // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Typology' => '拓扑', 'Class:Typology+' => '', 'Class:Typology/Attribute:name' => '名称', 'Class:Typology/Attribute:name+' => '', 'Class:Typology/Attribute:finalclass' => '拓扑类型', 'Class:Typology/Attribute:finalclass+' => '根本属性的名称', -)); +]); // // Class: DocumentType // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:DocumentType' => '文档类型', 'Class:DocumentType+' => '', -)); +]); // // Class: ContactType // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ContactType' => '联系人类型', 'Class:ContactType+' => '', -)); +]); // // Class: lnkPersonToTeam // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkPersonToTeam' => '关联 人员/团队', 'Class:lnkPersonToTeam+' => '', 'Class:lnkPersonToTeam/Name' => '%1$s / %2$s', @@ -317,13 +318,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkPersonToTeam/Attribute:role_id+' => '', 'Class:lnkPersonToTeam/Attribute:role_name' => '角色名称', 'Class:lnkPersonToTeam/Attribute:role_name+' => '', -)); +]); // // Application Menu // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Menu:DataAdministration' => '数据管理', 'Menu:DataAdministration+' => '数据管理', 'Menu:Catalogs' => '类别', @@ -361,20 +362,20 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Menu:Typology+' => '类型配置', 'UI_WelcomeMenu_AllConfigItems' => '摘要', 'Menu:ConfigManagement:Typology' => '类型配置', -)); +]); // Add translation for Fieldsets -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Person:info' => '基本信息', 'User:info' => '基本信息', 'User:profiles' => '角色 (至少一个)', 'Person:personal_info' => '个人信息', 'Person:notifiy' => '通知', -)); +]); // Themes -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'theme:fullmoon' => '满月', 'theme:test-red' => '测试 (红色)', -)); +]); diff --git a/datamodels/2.x/itop-structure/main.itop-structure.php b/datamodels/2.x/itop-structure/main.itop-structure.php index 88c16a25a..faf7e17b2 100644 --- a/datamodels/2.x/itop-structure/main.itop-structure.php +++ b/datamodels/2.x/itop-structure/main.itop-structure.php @@ -1,9 +1,10 @@ - // Starting with iTop 1.2 you can restrict the list of organizations displayed in the drop-down list // by specifying a query as shown below. Note that this is NOT a security settings, since the // choice 'All Organizations' will always be available in the menu ApplicationMenu::SetFavoriteSiloQuery('SELECT Organization'); - -?> diff --git a/datamodels/2.x/itop-structure/module.itop-structure.php b/datamodels/2.x/itop-structure/module.itop-structure.php index b59803471..d1049941d 100644 --- a/datamodels/2.x/itop-structure/module.itop-structure.php +++ b/datamodels/2.x/itop-structure/module.itop-structure.php @@ -1,10 +1,9 @@ 'Core iTop Structure', @@ -12,28 +11,28 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - ), + 'dependencies' => [ + ], 'mandatory' => true, 'visible' => false, 'installer' => 'StructureInstaller', // Components // - 'datamodel' => array( + 'datamodel' => [ 'main.itop-structure.php', - ), - 'data.struct' => array( - ), - 'data.sample' => array( + ], + 'data.struct' => [ + ], + 'data.sample' => [ 'data.sample.organizations.xml', 'data.sample.locations.xml', 'data.sample.persons.xml', 'data.sample.teams.xml', 'data.sample.contactteam.xml', 'data.sample.contacttype.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -41,13 +40,12 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); -if (!class_exists('StructureInstaller')) -{ +if (!class_exists('StructureInstaller')) { // Module installation handler // class StructureInstaller extends ModuleInstallerAPI @@ -66,14 +64,13 @@ if (!class_exists('StructureInstaller')) */ public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) { - if (strlen($sPreviousVersion) > 0) - { + if (strlen($sPreviousVersion) > 0) { // Search for existing ActionEmail where the language attribute was defined on its child if (version_compare($sPreviousVersion, '3.2.0', '<')) { SetupLog::Info("| Migrate ActionEmail language attribute values to its parent."); $sTableToRead = MetaModel::DBGetTable('ActionEmail'); $sTableToSet = MetaModel::DBGetTable('ActionNotification'); - self::MoveColumnInDB($sTableToRead, 'language', $sTableToSet, 'language', true); + self::MoveColumnInDB($sTableToRead, 'language', $sTableToSet, 'language', true); SetupLog::Info("| ActionEmail migration done."); } // If you want to migrate data from one format to another, do it here @@ -93,7 +90,7 @@ if (!class_exists('StructureInstaller')) self::RenameClassInDB('IPinterface', 'IPInterface'); } } - + /** * Handler called after the creation/update of the database schema * @param $oConfiguration Config The new configuration of the application @@ -225,7 +222,7 @@ if (!class_exists('StructureInstaller')) 'subject' => 'Vous avez été mentionné dans "$this->friendlyname$"', 'body' => '

          Bonjour $mentioned->first_name$,

          Vous avez été mentionné par $current_contact->friendlyname$ dans $this->hyperlink()$

          ', - ] + ], ]; // Create action in app. default language and link it to the triggers @@ -275,7 +272,7 @@ if (!class_exists('StructureInstaller')) 'FR FR' => [ 'name' => 'Notification aux personnes mentionnées dans les journaux', 'message' => 'Vous avez été mentionné par $current_contact->friendlyname$', - ] + ], ]; // Start by creating the default action no matter what (even if there is no relevant trigger, it will be there for future use) @@ -293,7 +290,7 @@ if (!class_exists('StructureInstaller')) SetupLog::Info("|- Created newsroom action \"{$oAction->Get('name')}\"."); // Retrieve all triggers and find those with a mentioned_filter on the Person class - $oTriggersSearch = DBObjectSearch::FromOQL("SELECT " . TriggerOnObjectMention::class); + $oTriggersSearch = DBObjectSearch::FromOQL("SELECT ".TriggerOnObjectMention::class); $oTriggersSearch->AllowAllData(); $oTriggersSet = new DBObjectSet($oTriggersSearch); @@ -330,7 +327,7 @@ if (!class_exists('StructureInstaller')) if (version_compare($sPreviousVersion, '3.2.0', '<')) { SetupLog::Info("Forcing subscription policy to ForceAtLeastOneChannel for all existing TriggerOnObjectMention..."); - $oTriggersSearch = DBObjectSearch::FromOQL("SELECT " . TriggerOnObjectMention::class); + $oTriggersSearch = DBObjectSearch::FromOQL("SELECT ".TriggerOnObjectMention::class); $oTriggersSearch->AllowAllData(); $oTriggersSet = new DBObjectSet($oTriggersSearch); @@ -358,7 +355,7 @@ if (!class_exists('StructureInstaller')) 'FR FR' => [ 'name' => 'Notification sur MAJ du journal public via le portail', 'message' => 'Nouveau message de $current_contact->friendlyname$', - ] + ], ]; // - Create action in app. default language and link it to the triggers @@ -385,7 +382,7 @@ if (!class_exists('StructureInstaller')) 'FR FR' => [ 'name' => 'Notification à l\'agent à l\'assignation du ticket', 'message' => 'Le ticket vous a été assigné', - ] + ], ]; // Create action in app. default language and link it to the triggers diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/cs.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/cs.dict.itop-themes-compat.php index 93f9a13fe..99884af6a 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/cs.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/cs.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Světle šedá (zastaralé)', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/da.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/da.dict.itop-themes-compat.php index 210f2c335..be98d4378 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/da.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/da.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Light Grey (deprecated)~~', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/de.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/de.dict.itop-themes-compat.php index 4701a4809..6336d00ad 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/de.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/de.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Light Grey (veraltet)', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/en.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/en.dict.itop-themes-compat.php index 49f12deeb..f9090d46b 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/en.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/en.dict.itop-themes-compat.php @@ -1,4 +1,5 @@ 'Light Grey (deprecated)', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/en_gb.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/en_gb.dict.itop-themes-compat.php index 75a7ac1f7..653e0c3ed 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/en_gb.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/en_gb.dict.itop-themes-compat.php @@ -1,4 +1,5 @@ 'Light Grey (deprecated)', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/es_cr.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/es_cr.dict.itop-themes-compat.php index efacf63c6..cf7cd426b 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/es_cr.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/es_cr.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Gris claro (obsoleto)', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/fr.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/fr.dict.itop-themes-compat.php index a6f549eaf..3be488efc 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/fr.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/fr.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Light Grey (obsolète)', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/hu.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/hu.dict.itop-themes-compat.php index 2dccf37e2..fd54e4071 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/hu.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/hu.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Világosszürke (elavult)', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/it.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/it.dict.itop-themes-compat.php index 7171c0d9e..c298420c7 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/it.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/it.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Light Grey (deprecated)~~', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/ja.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/ja.dict.itop-themes-compat.php index 12f33e000..f9d6bb5c5 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/ja.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/ja.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Light Grey (deprecated)~~', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/nl.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/nl.dict.itop-themes-compat.php index 12826bde2..2ab2548c8 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/nl.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/nl.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'theme:light-grey' => 'Lichtgrijs (verouderd)', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/pl.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/pl.dict.itop-themes-compat.php index 8ba1b258b..a920ba810 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/pl.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/pl.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Jasnoszary (przestarzałe)', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/pt_br.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/pt_br.dict.itop-themes-compat.php index 3039ee99d..422267fd0 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/pt_br.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/pt_br.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Light Grey (deprecated)~~', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/ru.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/ru.dict.itop-themes-compat.php index a1ce58ce4..b5206be5f 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/ru.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/ru.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Light Grey (deprecated)~~', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/sk.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/sk.dict.itop-themes-compat.php index d4974eaab..3101070fd 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/sk.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/sk.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Light Grey (deprecated)~~', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/tr.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/tr.dict.itop-themes-compat.php index b4e4873bf..c0e46dbe1 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/tr.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/tr.dict.itop-themes-compat.php @@ -1,14 +1,15 @@ 'Light Grey (deprecated)~~', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/dictionaries/zh_cn.dict.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/dictionaries/zh_cn.dict.itop-themes-compat.php index bccc1f0ad..29768e7f8 100644 --- a/datamodels/2.x/itop-themes-compat/dictionaries/zh_cn.dict.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/dictionaries/zh_cn.dict.itop-themes-compat.php @@ -1,10 +1,11 @@ '淡灰 (废弃)', -)); +]); diff --git a/datamodels/2.x/itop-themes-compat/module.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/module.itop-themes-compat.php index 41d649711..2a44a4ee5 100644 --- a/datamodels/2.x/itop-themes-compat/module.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/module.itop-themes-compat.php @@ -1,4 +1,5 @@ 'Light grey and Test red themes compatibility', @@ -14,35 +15,35 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-structure/3.1.0', - ), + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array( - ), - 'webservice' => array( - - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); diff --git a/datamodels/2.x/itop-tickets/dictionaries/cs.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/cs.dict.itop-tickets.php index f3b7a6e09..c0fe267c9 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/cs.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/cs.dict.itop-tickets.php @@ -1,17 +1,18 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Ticket' => 'Tiket', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => 'ID', @@ -63,14 +64,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Uzavřený', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '', 'Ticket:ImpactAnalysis' => 'Analýza dopadů', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkContactToTicket' => 'Spojení (Kontakt / Tiket)', 'Class:lnkContactToTicket+' => '', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s~~', @@ -90,13 +90,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Přidán manuálně', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Automaticky', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Neupozorňovat', -)); +]); // // Class: WorkOrder // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:WorkOrder' => 'Pracovní příkaz', 'Class:WorkOrder+' => '', 'Class:WorkOrder/Attribute:name' => 'Název', @@ -129,11 +129,10 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:WorkOrder/Attribute:log+' => '', 'Class:WorkOrder/Stimulus:ev_close' => 'Uzavřít', 'Class:WorkOrder/Stimulus:ev_close+' => '', -)); - +]); // Fieldset translation -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Ticket:baseinfo' => 'Obecné informace', 'Ticket:date' => 'Data', 'Ticket:contact' => 'Kontakty', @@ -223,14 +222,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Cíl úrovně služeb typu TTO', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Čas pro vyřešení (TTR)', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Cíl úrovně služeb typu TTR', -)); - +]); // // Class: Ticket // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/da.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/da.dict.itop-tickets.php index 0531d1852..3189bab63 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/da.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/da.dict.itop-tickets.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Ticket' => 'Ticket', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => 'Reference', @@ -62,14 +63,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Closed~~', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '~~', 'Ticket:ImpactAnalysis' => 'Impact Analysis~~', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkContactToTicket' => 'Sammenhæng Kontakt/Ticket', 'Class:lnkContactToTicket+' => '', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s~~', @@ -89,13 +89,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Added manually~~', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Computed~~', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Do not notify~~', -)); +]); // // Class: WorkOrder // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:WorkOrder' => 'Arbejdsordre', 'Class:WorkOrder+' => '', 'Class:WorkOrder/Attribute:name' => 'Navn', @@ -128,11 +128,10 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:WorkOrder/Attribute:log+' => '', 'Class:WorkOrder/Stimulus:ev_close' => 'Luk', 'Class:WorkOrder/Stimulus:ev_close+' => '', -)); - +]); // Fieldset translation -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Ticket:baseinfo' => 'Almindelig information', 'Ticket:date' => 'Dato', 'Ticket:contact' => 'Kontakt', @@ -222,14 +221,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTO~~', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Time To Resolve~~', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTR~~', -)); - +]); // // Class: Ticket // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/de.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/de.dict.itop-tickets.php index 88e67c71a..a9e802f2b 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/de.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/de.dict.itop-tickets.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Ticket' => 'Ticket', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => 'Referenz', @@ -62,14 +63,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Geschlossen', 'Class:Ticket/Attribute:operational_status/Value:closed+' => 'Geschlossen', 'Ticket:ImpactAnalysis' => 'Auswirkungsanalyse', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkContactToTicket' => 'Verknüpfung Kontakt/Ticket', 'Class:lnkContactToTicket+' => '', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s', @@ -89,13 +89,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Manuell hinzugefügt', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Berechnet', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Nicht ändern', -)); +]); // // Class: WorkOrder // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:WorkOrder' => 'Arbeitsauftrag', 'Class:WorkOrder+' => '', 'Class:WorkOrder/Attribute:name' => 'Name', @@ -128,11 +128,10 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:WorkOrder/Attribute:log+' => '', 'Class:WorkOrder/Stimulus:ev_close' => 'Schließen', 'Class:WorkOrder/Stimulus:ev_close+' => '', -)); - +]); // Fieldset translation -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Ticket:baseinfo' => 'Allgemeine Informationen', 'Ticket:date' => 'Daten', 'Ticket:contact' => 'Kontakte', @@ -222,14 +221,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Zielvorgabe (SLT) vom Typ TTO', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Time To Resolve (Erstlösungszeit)', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Zielvorgabe (SLT) vom Typ TTR', -)); - +]); // // Class: Ticket // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/en.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/en.dict.itop-tickets.php index c6ca6ded2..b084b14df 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/en.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/en.dict.itop-tickets.php @@ -1,4 +1,5 @@ /Stimulus: // Class:/Stimulus:+ - // // Class: Ticket // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Ticket' => 'Ticket', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => 'Ref', @@ -88,14 +88,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Closed', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '', 'Ticket:ImpactAnalysis' => 'Impact Analysis', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkContactToTicket' => 'Link Contact / Ticket', 'Class:lnkContactToTicket+' => '', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s', @@ -115,13 +114,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Added manually', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Computed', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Do not notify', -)); +]); // // Class: WorkOrder // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:WorkOrder' => 'Work Order', 'Class:WorkOrder+' => '', 'Class:WorkOrder/Attribute:name' => 'Name', @@ -154,11 +153,10 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:WorkOrder/Attribute:log+' => '', 'Class:WorkOrder/Stimulus:ev_close' => 'Close', 'Class:WorkOrder/Stimulus:ev_close+' => '', -)); - +]); // Fieldset translation -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Ticket:baseinfo' => 'General Information', 'Ticket:date' => 'Dates', 'Ticket:contact' => 'Contacts', @@ -248,14 +246,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTO', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Time To Resolve', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTR', -)); - +]); // // Class: Ticket // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Ticket/Attribute:team_email' => 'Team email', 'Class:Ticket/Attribute:team_email+' => '', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/en_gb.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/en_gb.dict.itop-tickets.php index dcb269966..58e022e88 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/en_gb.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/en_gb.dict.itop-tickets.php @@ -1,4 +1,5 @@ /Stimulus: // Class:/Stimulus:+ - // // Class: Ticket // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Ticket' => 'Ticket', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => 'Ref', @@ -88,14 +88,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Closed', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '', 'Ticket:ImpactAnalysis' => 'Impact Analysis', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkContactToTicket' => 'Link Contact / Ticket', 'Class:lnkContactToTicket+' => '', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s', @@ -115,13 +114,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Added manually', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Computed', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Do not notify', -)); +]); // // Class: WorkOrder // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:WorkOrder' => 'Work Order', 'Class:WorkOrder+' => '', 'Class:WorkOrder/Attribute:name' => 'Name', @@ -154,11 +153,10 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:WorkOrder/Attribute:log+' => '', 'Class:WorkOrder/Stimulus:ev_close' => 'Close', 'Class:WorkOrder/Stimulus:ev_close+' => '', -)); - +]); // Fieldset translation -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Ticket:baseinfo' => 'General Information', 'Ticket:date' => 'Dates', 'Ticket:contact' => 'Contacts', @@ -248,5 +246,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTO', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Time To Resolve', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTR', -)); - +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/es_cr.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/es_cr.dict.itop-tickets.php index 017c2cb42..80cb5ba73 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/es_cr.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/es_cr.dict.itop-tickets.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Ticket' => 'Ticket', 'Class:Ticket+' => 'Ticket', 'Class:Ticket/Attribute:ref' => 'Ref', @@ -59,14 +60,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Cerrado', 'Class:Ticket/Attribute:operational_status/Value:closed+' => 'Cerrado', 'Ticket:ImpactAnalysis' => 'Análisis de Impacto', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkContactToTicket' => 'Relación Contacto y Ticket', 'Class:lnkContactToTicket+' => 'Relación Contacto y Ticket', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s', @@ -86,13 +86,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Agregado Manualmente', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Calculado', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'No notificar', -)); +]); // // Class: WorkOrder // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:WorkOrder' => 'Orden de Trabajo', 'Class:WorkOrder+' => 'Orden de Trabajo', 'Class:WorkOrder/Attribute:name' => 'Nombre', @@ -125,11 +125,10 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:WorkOrder/Attribute:log+' => 'Bitácora', 'Class:WorkOrder/Stimulus:ev_close' => 'Cerrar', 'Class:WorkOrder/Stimulus:ev_close+' => 'Cerrar', -)); - +]); // Fieldset translation -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Ticket:baseinfo' => 'Información General', 'Ticket:date' => 'Fechas', 'Ticket:contact' => 'Contactos', @@ -219,14 +218,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Objetivo basado en SLT de tipo TTO', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Tiempo a Resolución', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Objetivo basado en SLT de tipo TTR', -)); - +]); // // Class: Ticket // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/fr.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/fr.dict.itop-tickets.php index d711fb556..4c21fa188 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/fr.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/fr.dict.itop-tickets.php @@ -1,15 +1,16 @@ 'Ticket', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => 'Référence', @@ -66,15 +67,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Ticket/Attribute:operational_status/Value:resolved+' => '', 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Clos', 'Class:Ticket/Attribute:operational_status/Value:closed+' => 'Fermé', - 'Ticket:ImpactAnalysis' => 'Analyse d\'Impact' -)); - + 'Ticket:ImpactAnalysis' => 'Analyse d\'Impact', +]); // // Class: lnkContactToTicket // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkContactToTicket' => 'Lien Contact / Ticket', 'Class:lnkContactToTicket+' => '', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s', @@ -94,13 +94,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Ajouté manuellement', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Calculé', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Ne pas notifier', -)); +]); // // Class: WorkOrder // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:WorkOrder' => 'Tâche', 'Class:WorkOrder+' => '', 'Class:WorkOrder/Attribute:name' => 'Nom', @@ -133,11 +133,10 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:WorkOrder/Attribute:log+' => '', 'Class:WorkOrder/Stimulus:ev_close' => 'Fermer', 'Class:WorkOrder/Stimulus:ev_close+' => '', -)); - +]); // Fieldset translation -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Ticket:baseinfo' => 'Informations générales', 'Ticket:date' => 'Dates', 'Ticket:contact' => 'Contacts', @@ -238,15 +237,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Team/Attribute:tickets_list/UI:Links:Delete:Button+' => 'Supprimer ce %4$s', 'Class:Team/Attribute:tickets_list/UI:Links:Delete:Modal:Title' => 'Supprimer un %4$s', 'Class:Team/Attribute:tickets_list/UI:Links:Remove:Button+' => 'Retirer ce %4$s', - 'Class:Team/Attribute:tickets_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s' -)); - + 'Class:Team/Attribute:tickets_list/UI:Links:Remove:Modal:Title' => 'Retirer ce %4$s de son %1$s', +]); // // Class: Ticket // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/hu.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/hu.dict.itop-tickets.php index 88e3ff221..89fa992ae 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/hu.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/hu.dict.itop-tickets.php @@ -1,15 +1,16 @@ 'Hibajegy', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => 'Referenciaszám', @@ -61,14 +62,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Lezárva', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '', 'Ticket:ImpactAnalysis' => 'Hatáselemzés', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkContactToTicket' => 'Kapcsolattartó / Hibajegy', 'Class:lnkContactToTicket+' => '~~', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s~~', @@ -88,13 +88,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Kézzel hozzáadva', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Számított', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Ne értesítsen', -)); +]); // // Class: WorkOrder // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:WorkOrder' => 'Munkaelrendelő', 'Class:WorkOrder+' => '~~', 'Class:WorkOrder/Attribute:name' => 'Név', @@ -127,11 +127,10 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:WorkOrder/Attribute:log+' => '~~', 'Class:WorkOrder/Stimulus:ev_close' => 'Bezárás', 'Class:WorkOrder/Stimulus:ev_close+' => '~~', -)); - +]); // Fieldset translation -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Ticket:baseinfo' => 'Általános információk', 'Ticket:date' => 'Dátum', 'Ticket:contact' => 'Kapcsolattartók', @@ -221,14 +220,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTO~~', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Megoldási idő', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTR~~', -)); - +]); // // Class: Ticket // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/it.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/it.dict.itop-tickets.php index cf331fcba..a323f807c 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/it.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/it.dict.itop-tickets.php @@ -1,15 +1,16 @@ 'Ticket', 'Class:Ticket+' => '~~', 'Class:Ticket/Attribute:ref' => 'Rif', @@ -61,14 +62,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Chiuso', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '~~', 'Ticket:ImpactAnalysis' => 'Analisi dell\'impatto', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkContactToTicket' => 'Link Contact / Ticket', 'Class:lnkContactToTicket+' => '~~', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s', @@ -88,13 +88,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Aggiunto manualmente', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Calcolato', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Non notificare', -)); +]); // // Class: WorkOrder // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:WorkOrder' => 'Work Order~~', 'Class:WorkOrder+' => '~~', 'Class:WorkOrder/Attribute:name' => 'Nome', @@ -127,11 +127,10 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:WorkOrder/Attribute:log+' => '~~', 'Class:WorkOrder/Stimulus:ev_close' => 'Chiudi', 'Class:WorkOrder/Stimulus:ev_close+' => '~~', -)); - +]); // Fieldset translation -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Ticket:baseinfo' => 'Infomazioni Generali', 'Ticket:date' => 'Data', 'Ticket:contact' => 'Contatti', @@ -221,14 +220,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTO~~', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Tempo Per Risolvere', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTR~~', -)); - +]); // // Class: Ticket // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/ja.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/ja.dict.itop-tickets.php index e55eb5f51..4aeee2e73 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/ja.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/ja.dict.itop-tickets.php @@ -1,15 +1,16 @@ 'チケット', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => '参照', @@ -61,14 +62,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Closed~~', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '~~', 'Ticket:ImpactAnalysis' => 'Impact Analysis~~', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkContactToTicket' => 'リンク 連絡先/チケット', 'Class:lnkContactToTicket+' => '', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s~~', @@ -88,13 +88,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Added manually~~', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Computed~~', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Do not notify~~', -)); +]); // // Class: WorkOrder // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:WorkOrder' => '作業指示', 'Class:WorkOrder+' => '', 'Class:WorkOrder/Attribute:name' => '名前', @@ -127,11 +127,10 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:WorkOrder/Attribute:log+' => '', 'Class:WorkOrder/Stimulus:ev_close' => 'クローズ', 'Class:WorkOrder/Stimulus:ev_close+' => '', -)); - +]); // Fieldset translation -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Ticket:baseinfo' => '基本情報', 'Ticket:date' => '日付', 'Ticket:contact' => '連絡先', @@ -221,14 +220,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTO~~', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Time To Resolve~~', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTR~~', -)); - +]); // // Class: Ticket // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/nl.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/nl.dict.itop-tickets.php index df0c75266..e774ba376 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/nl.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/nl.dict.itop-tickets.php @@ -1,17 +1,18 @@ * @author Jeffrey Bostoen (2018 - 2022) * @author Thomas Casteleyn */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Ticket' => 'Ticket', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => 'Nummer', @@ -63,14 +64,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Afgesloten', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '', 'Ticket:ImpactAnalysis' => 'Impactanalyse', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkContactToTicket' => 'Link Contact / Ticket', 'Class:lnkContactToTicket+' => '', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s', @@ -90,13 +90,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Manueel toegevoegd', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Automatisch afgeleid', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Niet verwittigen', -)); +]); // // Class: WorkOrder // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:WorkOrder' => 'Werkopdracht', 'Class:WorkOrder+' => '', 'Class:WorkOrder/Attribute:name' => 'Naam', @@ -129,11 +129,10 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:WorkOrder/Attribute:log+' => '', 'Class:WorkOrder/Stimulus:ev_close' => 'Sluiten', 'Class:WorkOrder/Stimulus:ev_close+' => '', -)); - +]); // Fieldset translation -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Ticket:baseinfo' => 'Globale informatie', 'Ticket:date' => 'Data', 'Ticket:contact' => 'Contacten', @@ -223,14 +222,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Doel gebaseerd op een SLT (TTO)', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Time To Resolve', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Doel gebaseerd op een SLT (TTR)', -)); - +]); // // Class: Ticket // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/pl.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/pl.dict.itop-tickets.php index 0b3423e58..27f8e0b28 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/pl.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/pl.dict.itop-tickets.php @@ -1,15 +1,16 @@ 'Zgłoszenie', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => 'Powiązanie', @@ -61,14 +62,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Zamknięty', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '', 'Ticket:ImpactAnalysis' => 'Analiza wpływu', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkContactToTicket' => 'Połączenie Kontakt / Zgłoszenie', 'Class:lnkContactToTicket+' => '', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s', @@ -88,13 +88,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Dodane ręcznie', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Obliczone', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Nie powiadamiaj', -)); +]); // // Class: WorkOrder // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:WorkOrder' => 'Porządek pracy', 'Class:WorkOrder+' => '', 'Class:WorkOrder/Attribute:name' => 'Nazwa', @@ -127,11 +127,10 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:WorkOrder/Attribute:log+' => '', 'Class:WorkOrder/Stimulus:ev_close' => 'Zamknij', 'Class:WorkOrder/Stimulus:ev_close+' => '', -)); - +]); // Fieldset translation -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Ticket:baseinfo' => 'Informacje ogólne', 'Ticket:date' => 'Daty', 'Ticket:contact' => 'Kontakty', @@ -221,14 +220,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Cel oparty na SLT typu TTO', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Czas na rozwiązanie TTR', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Cel oparty na SLT typu TTR', -)); - +]); // // Class: Ticket // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/pt_br.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/pt_br.dict.itop-tickets.php index d2a3ef1fd..e819bbfb9 100755 --- a/datamodels/2.x/itop-tickets/dictionaries/pt_br.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/pt_br.dict.itop-tickets.php @@ -1,15 +1,16 @@ 'Solicitação', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => 'Ref.', @@ -61,14 +62,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Fechado', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '', 'Ticket:ImpactAnalysis' => 'Análise de impacto', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkContactToTicket' => 'Link Contato / Solicitação', 'Class:lnkContactToTicket+' => '', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s~~', @@ -88,13 +88,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Adicionado manualmente', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Computado', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Não notificar', -)); +]); // // Class: WorkOrder // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:WorkOrder' => 'Ordem de serviço', 'Class:WorkOrder+' => '', 'Class:WorkOrder/Attribute:name' => 'Nome', @@ -127,11 +127,10 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:WorkOrder/Attribute:log+' => '', 'Class:WorkOrder/Stimulus:ev_close' => 'Fechar', 'Class:WorkOrder/Stimulus:ev_close+' => '', -)); - +]); // Fieldset translation -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Ticket:baseinfo' => 'Informações gerais', 'Ticket:date' => 'Datas', 'Ticket:contact' => 'Contatos', @@ -221,14 +220,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Objetivo baseado em um SLT do tipo TTO', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Time To Resolve', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Objetivo baseado em um SLT do tipo TTR', -)); - +]); // // Class: Ticket // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/ru.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/ru.dict.itop-tickets.php index 995d607bd..5634adfcb 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/ru.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/ru.dict.itop-tickets.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Ticket' => 'Тикет', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => 'Номер', @@ -62,14 +63,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Закрыт', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '', 'Ticket:ImpactAnalysis' => 'Анализ влияния', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkContactToTicket' => 'Связь Контакт/Тикет', 'Class:lnkContactToTicket+' => '', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s~~', @@ -89,13 +89,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Добавлено вручную', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Вычислено', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Не уведомлять', -)); +]); // // Class: WorkOrder // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:WorkOrder' => 'Наряд на работу', 'Class:WorkOrder+' => '', 'Class:WorkOrder/Attribute:name' => 'Название', @@ -128,11 +128,10 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:WorkOrder/Attribute:log+' => '', 'Class:WorkOrder/Stimulus:ev_close' => 'Закрыть', 'Class:WorkOrder/Stimulus:ev_close+' => '', -)); - +]); // Fieldset translation -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Ticket:baseinfo' => 'Общая информация', 'Ticket:date' => 'Даты', 'Ticket:contact' => 'Контакты', @@ -222,14 +221,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTO~~', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Time To Resolve~~', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTR~~', -)); - +]); // // Class: Ticket // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/sk.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/sk.dict.itop-tickets.php index 522e7255d..154e96740 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/sk.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/sk.dict.itop-tickets.php @@ -1,15 +1,16 @@ 'Ticket', 'Class:Ticket+' => '~~', 'Class:Ticket/Attribute:ref' => 'Referencia', @@ -61,14 +62,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Closed~~', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '~~', 'Ticket:ImpactAnalysis' => 'Impact Analysis~~', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkContactToTicket' => 'väzba - Kontakt / Ticket', 'Class:lnkContactToTicket+' => '~~', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s~~', @@ -88,13 +88,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Added manually~~', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Computed~~', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Do not notify~~', -)); +]); // // Class: WorkOrder // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:WorkOrder' => 'Pracovný príkaz', 'Class:WorkOrder+' => '~~', 'Class:WorkOrder/Attribute:name' => 'Názov', @@ -127,11 +127,10 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:WorkOrder/Attribute:log+' => '~~', 'Class:WorkOrder/Stimulus:ev_close' => 'Zatvoriť', 'Class:WorkOrder/Stimulus:ev_close+' => '~~', -)); - +]); // Fieldset translation -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Ticket:baseinfo' => 'Všeobecné informácia', 'Ticket:date' => 'Dátumy', 'Ticket:contact' => 'Kontakt', @@ -221,14 +220,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTO~~', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Time To Resolve~~', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'Goal based on a SLT of type TTR~~', -)); - +]); // // Class: Ticket // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/tr.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/tr.dict.itop-tickets.php index 545ec377d..36493b273 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/tr.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/tr.dict.itop-tickets.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Ticket' => 'Kayıt', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => 'Referans', @@ -62,14 +63,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => 'Closed~~', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '~~', 'Ticket:ImpactAnalysis' => 'Etki Analizi', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkContactToTicket' => 'Kişi / Çağrı kaydı bağla', 'Class:lnkContactToTicket+' => '~~', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s~~', @@ -89,13 +89,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => 'Elle eklendi', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => 'Hesaplandı', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => 'Bildirme', -)); +]); // // Class: WorkOrder // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:WorkOrder' => 'İş emri', 'Class:WorkOrder+' => '~~', 'Class:WorkOrder/Attribute:name' => 'İsim', @@ -128,11 +128,10 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:WorkOrder/Attribute:log+' => '~~', 'Class:WorkOrder/Stimulus:ev_close' => 'Kapat', 'Class:WorkOrder/Stimulus:ev_close+' => '~~', -)); - +]); // Fieldset translation -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Ticket:baseinfo' => 'Genel Bilgi', 'Ticket:date' => 'Tarihler', 'Ticket:contact' => 'Kişiler', @@ -222,14 +221,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => 'TTO tipi bir SLT\'ye dayalı hedef', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'Çözme zamanı', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => 'TTR tipi bir SLT\'ye dayalı hedef', -)); - +]); // // Class: Ticket // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/dictionaries/zh_cn.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/dictionaries/zh_cn.dict.itop-tickets.php index 77fe9dd31..1a6d64b8e 100644 --- a/datamodels/2.x/itop-tickets/dictionaries/zh_cn.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/dictionaries/zh_cn.dict.itop-tickets.php @@ -1,4 +1,5 @@ '工单', 'Class:Ticket+' => '', 'Class:Ticket/Attribute:ref' => '编号', @@ -84,14 +85,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Ticket/Attribute:operational_status/Value:closed' => '已关闭', 'Class:Ticket/Attribute:operational_status/Value:closed+' => '', 'Ticket:ImpactAnalysis' => '影响分析', -)); - +]); // // Class: lnkContactToTicket // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkContactToTicket' => '关联联系人/工单', 'Class:lnkContactToTicket+' => '', 'Class:lnkContactToTicket/Name' => '%1$s / %2$s', @@ -111,13 +111,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkContactToTicket/Attribute:role_code/Value:manual' => '手动添加', 'Class:lnkContactToTicket/Attribute:role_code/Value:computed' => '自动添加', 'Class:lnkContactToTicket/Attribute:role_code/Value:do_not_notify' => '不通知', -)); +]); // // Class: WorkOrder // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:WorkOrder' => '工作任务', 'Class:WorkOrder+' => '', 'Class:WorkOrder/Attribute:name' => '名称', @@ -150,11 +150,10 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:WorkOrder/Attribute:log+' => '', 'Class:WorkOrder/Stimulus:ev_close' => '关闭', 'Class:WorkOrder/Stimulus:ev_close+' => '', -)); - +]); // Fieldset translation -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Ticket:baseinfo' => '基本信息', 'Ticket:date' => '日期信息', 'Ticket:contact' => '联系人', @@ -244,14 +243,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:ResponseTicketTTO/Interface:iMetricComputer+' => '响应时限', 'Class:ResponseTicketTTR/Interface:iMetricComputer' => 'TTR', 'Class:ResponseTicketTTR/Interface:iMetricComputer+' => '解决时限', -)); - +]); // // Class: Ticket // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Ticket/Attribute:team_email' => 'Team email~~', 'Class:Ticket/Attribute:team_email+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-tickets/main.itop-tickets.php b/datamodels/2.x/itop-tickets/main.itop-tickets.php index 90ade80ac..77ee8614d 100755 --- a/datamodels/2.x/itop-tickets/main.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/main.itop-tickets.php @@ -1,4 +1,5 @@ Get('request_type'); } @@ -49,43 +45,40 @@ class ResponseTicketSLT $aArgs['request_type'] = $sRequestType; //echo "

          Managing:".$sMetric."-".$this->Get('request_type')."-".$this->Get('importance')."

          \n"; - $oSLTSet = new DBObjectSet(DBObjectSearch::FromOQL(RESPONSE_TICKET_SLT_QUERY), - array(), - $aArgs - ); + $oSLTSet = new DBObjectSet( + DBObjectSearch::FromOQL(RESPONSE_TICKET_SLT_QUERY), + [], + $aArgs + ); $iMinDuration = PHP_INT_MAX; $sSLTName = ''; - while($oSLT = $oSLTSet->Fetch()) - { + while ($oSLT = $oSLTSet->Fetch()) { $iDuration = (int)$oSLT->Get('value'); $sUnit = $oSLT->Get('unit'); - switch($sUnit) - { + switch ($sUnit) { case 'days': - $iDuration = $iDuration * 24; // 24 hours in 1 days - // Fall though + $iDuration = $iDuration * 24; // 24 hours in 1 days + // Fall though + // no break case 'hours': - $iDuration = $iDuration * 60; // 60 minutes in 1 hour - // Fall though + $iDuration = $iDuration * 60; // 60 minutes in 1 hour + // Fall though + // no break case 'minutes': - $iDuration = $iDuration * 60; + $iDuration = $iDuration * 60; } - if ($iDuration < $iMinDuration) - { + if ($iDuration < $iMinDuration) { $iMinDuration = $iDuration; $sSLTName = $oSLT->GetName(); } } - if ($iMinDuration == PHP_INT_MAX) - { + if ($iMinDuration == PHP_INT_MAX) { $iDeadline = null; - } - else - { + } else { // Store $sSLTName to keep track of which SLT has been used $iDeadline = $iMinDuration; } @@ -129,33 +122,26 @@ class ResponseTicketTTR extends ResponseTicketSLT implements iMetricComputer } } - class _Ticket extends cmdbAbstractObject { - public function UpdateImpactedItems() { require_once(APPROOT.'core/displayablegraph.class.inc.php'); /** @var ormLinkSet $oContactsSet */ $oContactsSet = $this->Get('contacts_list'); - $aCIsToImpactCode = array(); - $aSources = array(); - $aExcluded = array(); - if (MetaModel::IsValidClass('FunctionalCI')) - { + $aCIsToImpactCode = []; + $aSources = []; + $aExcluded = []; + if (MetaModel::IsValidClass('FunctionalCI')) { /** @var ormLinkSet $oCIsSet */ $oCIsSet = $this->Get('functionalcis_list'); - foreach ($oCIsSet as $oLink) - { + foreach ($oCIsSet as $oLink) { $iKey = $oLink->Get('functionalci_id'); - $aCIsToImpactCode[$iKey] = array('link' => $oLink->GetKey(), 'code' => $oLink->Get('impact_code')); - if ($oLink->Get('impact_code') == 'manual') - { + $aCIsToImpactCode[$iKey] = ['link' => $oLink->GetKey(), 'code' => $oLink->Get('impact_code')]; + if ($oLink->Get('impact_code') == 'manual') { $oObj = MetaModel::GetObject('FunctionalCI', $iKey); $aSources[$iKey] = $oObj; - } - else if ($oLink->Get('impact_code') == 'not_impacted') - { + } elseif ($oLink->Get('impact_code') == 'not_impacted') { $oObj = MetaModel::GetObject('FunctionalCI', $iKey); $aExcluded[] = $oObj; } @@ -163,128 +149,111 @@ class _Ticket extends cmdbAbstractObject } - $aContactsToRoleCode = array(); - foreach ($oContactsSet as $oLink) - { + $aContactsToRoleCode = []; + foreach ($oContactsSet as $oLink) { $iKey = $oLink->Get('contact_id'); - $aContactsToRoleCode[$iKey] = array('link' => $oLink->GetKey(), 'code' => $oLink->Get('role_code')); - if ($oLink->Get('role_code') == 'do_not_notify') - { + $aContactsToRoleCode[$iKey] = ['link' => $oLink->GetKey(), 'code' => $oLink->Get('role_code')]; + if ($oLink->Get('role_code') == 'do_not_notify') { $oObj = MetaModel::GetObject('Contact', $iKey); $aExcluded[] = $oObj; } } - + $sContextKey = 'itop-tickets/relation_context/'.get_class($this).'/impacts/down'; - $aContextDefs = DisplayableGraph::GetContextDefinitions($sContextKey, true, array('this' => $this)); - $aDefaultContexts = array(); - foreach($aContextDefs as $sKey => $aDefinition) - { + $aContextDefs = DisplayableGraph::GetContextDefinitions($sContextKey, true, ['this' => $this]); + $aDefaultContexts = []; + foreach ($aContextDefs as $sKey => $aDefinition) { // Add the default context queries to the computation - if (array_key_exists('default', $aDefinition) && ($aDefinition['default'] == 'yes')) - { + if (array_key_exists('default', $aDefinition) && ($aDefinition['default'] == 'yes')) { $aDefaultContexts[] = $aDefinition['oql']; } } // Merge the directly impacted items with the "new" ones added by the "context" queries - $aGraphObjects = array(); - $oRawGraph = MetaModel::GetRelatedObjectsDown('impacts', $aSources, 10, true /* bEnableRedundancy */, $aExcluded); - $oIterator = new RelationTypeIterator($oRawGraph, 'Node'); - foreach ($oIterator as $oNode) - { - // Any object node reached AND different from a source will do - if ( ($oNode instanceof RelationObjectNode) && ($oNode->GetProperty('is_reached')) && (!$oNode->GetProperty('source')) ) - { - $this->StoreComputedObject($aGraphObjects, $oNode->GetProperty('object')); - } - } - if (count($aDefaultContexts) > 0) - { + $aGraphObjects = []; + $oRawGraph = MetaModel::GetRelatedObjectsDown('impacts', $aSources, 10, true /* bEnableRedundancy */, $aExcluded); + $oIterator = new RelationTypeIterator($oRawGraph, 'Node'); + foreach ($oIterator as $oNode) { + // Any object node reached AND different from a source will do + if (($oNode instanceof RelationObjectNode) && ($oNode->GetProperty('is_reached')) && (!$oNode->GetProperty('source'))) { + $this->StoreComputedObject($aGraphObjects, $oNode->GetProperty('object')); + } + } + if (count($aDefaultContexts) > 0) { $oAnnotatedGraph = MetaModel::GetRelatedObjectsDown('impacts', $aSources, 10, true /* bEnableRedundancy */, $aExcluded, $aDefaultContexts); $oIterator = new RelationTypeIterator($oAnnotatedGraph, 'Node'); - foreach ($oIterator as $oNode) - { - // Only pick the nodes which are NOT impacted by a context root cause, and merge them in the list - if (($oNode instanceof RelationObjectNode) && ($oNode->GetProperty('is_reached')) && (!$oNode->GetProperty('source')) && ($oNode->GetProperty('context_root_causes', null) == null)) - { - $this->StoreComputedObject($aGraphObjects, $oNode->GetProperty('object')); - } + foreach ($oIterator as $oNode) { + // Only pick the nodes which are NOT impacted by a context root cause, and merge them in the list + if (($oNode instanceof RelationObjectNode) && ($oNode->GetProperty('is_reached')) && (!$oNode->GetProperty('source')) && ($oNode->GetProperty('context_root_causes', null) == null)) { + $this->StoreComputedObject($aGraphObjects, $oNode->GetProperty('object')); + } } } // Remove unnecessary "computed" CIs and Contacts - foreach($aCIsToImpactCode as $iKey => $aCode) - { - if (($aCode['code'] == 'computed') && (!isset($aGraphObjects['FunctionalCI']) || (!array_key_exists($iKey, $aGraphObjects['FunctionalCI'])))) - { - $oCIsSet->RemoveItem($aCode['link']); - } - } - foreach($aContactsToRoleCode as $iKey => $aCode) - { - if (($aCode['code'] == 'computed') && (!isset($aGraphObjects['Contact']) || (!array_key_exists($iKey, $aGraphObjects['Contact'])))) - { - $oContactsSet->RemoveItem($aCode['link']); - } - } - - // Add new nodes - foreach ($aGraphObjects as $sRootClass => $aObjects) - { - switch ($sRootClass) - { - case 'FunctionalCI': - // Only FunctionalCIs which are not already linked to the ticket - foreach($aObjects as $iKey => $oObj) - { - if (!array_key_exists($iKey, $aCIsToImpactCode)) - { - $oNewLink = new lnkFunctionalCIToTicket(); - $oNewLink->Set('functionalci_id', $iKey); - $oNewLink->Set('impact_code', 'computed'); - $oCIsSet->AddItem($oNewLink); - } - } - break; - - case 'Contact': - // Only link Contacts which are not already linked to the ticket - foreach($aObjects as $iKey => $oObj) - { - if (!array_key_exists($iKey, $aContactsToRoleCode)) - { - $oNewLink = new lnkContactToTicket(); - $oNewLink->Set('contact_id', $iKey); - $oNewLink->Set('role_code', 'computed'); - $oContactsSet->AddItem($oNewLink); - } - } - break; + foreach ($aCIsToImpactCode as $iKey => $aCode) { + if (($aCode['code'] == 'computed') && (!isset($aGraphObjects['FunctionalCI']) || (!array_key_exists($iKey, $aGraphObjects['FunctionalCI'])))) { + $oCIsSet->RemoveItem($aCode['link']); } } - if (MetaModel::IsValidClass('FunctionalCI')) - { + foreach ($aContactsToRoleCode as $iKey => $aCode) { + if (($aCode['code'] == 'computed') && (!isset($aGraphObjects['Contact']) || (!array_key_exists($iKey, $aGraphObjects['Contact'])))) { + $oContactsSet->RemoveItem($aCode['link']); + } + } + + // Add new nodes + foreach ($aGraphObjects as $sRootClass => $aObjects) { + switch ($sRootClass) { + case 'FunctionalCI': + // Only FunctionalCIs which are not already linked to the ticket + foreach ($aObjects as $iKey => $oObj) { + if (!array_key_exists($iKey, $aCIsToImpactCode)) { + $oNewLink = new lnkFunctionalCIToTicket(); + $oNewLink->Set('functionalci_id', $iKey); + $oNewLink->Set('impact_code', 'computed'); + $oCIsSet->AddItem($oNewLink); + } + } + break; + + case 'Contact': + // Only link Contacts which are not already linked to the ticket + foreach ($aObjects as $iKey => $oObj) { + if (!array_key_exists($iKey, $aContactsToRoleCode)) { + $oNewLink = new lnkContactToTicket(); + $oNewLink->Set('contact_id', $iKey); + $oNewLink->Set('role_code', 'computed'); + $oContactsSet->AddItem($oNewLink); + } + } + break; + } + } + if (MetaModel::IsValidClass('FunctionalCI')) { $this->Set('functionalcis_list', $oCIsSet); } $this->Set('contacts_list', $oContactsSet); } private function StoreComputedObject(&$aGraphObjects, $oObj) - { - $iKey = $oObj->GetKey(); - $sRootClass = MetaModel::GetRootClass(get_class($oObj)); - $aGraphObjects[$sRootClass][$iKey] = $oObj; - } + { + $iKey = $oObj->GetKey(); + $sRootClass = MetaModel::GetRootClass(get_class($oObj)); + $aGraphObjects[$sRootClass][$iKey] = $oObj; + } public function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); // Display the impact analysis for tickets not in 'closed' or 'resolved' status... and not in edition - if ((!$bEditMode) && (!in_array($this->Get('status'), array('resolved', 'closed')))) - { - $oPage->AddAjaxTab('Ticket:ImpactAnalysis', + if ((!$bEditMode) && (!in_array($this->Get('status'), ['resolved', 'closed']))) { + $oPage->AddAjaxTab( + 'Ticket:ImpactAnalysis', utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?operation=ticket_impact&class='.get_class($this).'&id='.$this->GetKey(), - true, null, AjaxTab::ENUM_TAB_PLACEHOLDER_MISC); + true, + null, + AjaxTab::ENUM_TAB_PLACEHOLDER_MISC + ); } } } diff --git a/datamodels/2.x/itop-tickets/module.itop-tickets.php b/datamodels/2.x/itop-tickets/module.itop-tickets.php index 8a9eaede0..a26176448 100755 --- a/datamodels/2.x/itop-tickets/module.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/module.itop-tickets.php @@ -1,10 +1,9 @@ 'Tickets Management', @@ -12,24 +11,24 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( + 'dependencies' => [ 'itop-structure/2.7.1', - ), + ], 'mandatory' => false, 'visible' => true, 'installer' => 'TicketsInstaller', // Components // - 'datamodel' => array( + 'datamodel' => [ 'main.itop-tickets.php', - ), - 'data.struct' => array( + ], + 'data.struct' => [ // 'data.struct.ta-actions.xml', - ), - 'data.sample' => array( - ), - + ], + 'data.sample' => [ + ], + // Documentation // 'doc.manual_setup' => '', @@ -37,9 +36,9 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( - ), - ) + 'settings' => [ + ], + ] ); // Module installation handler @@ -52,17 +51,12 @@ class TicketsInstaller extends ModuleInstallerAPI CMDBObject::SetTrackInfo('Uninstallation'); $oSearch = new DBObjectSearch('TriggerOnObject'); $oSet = new DBObjectSet($oSearch); - while($oTrigger = $oSet->Fetch()) - { - try - { - if (!MetaModel::IsValidClass($oTrigger->Get('target_class'))) - { + while ($oTrigger = $oSet->Fetch()) { + try { + if (!MetaModel::IsValidClass($oTrigger->Get('target_class'))) { $oTrigger->DBDelete(); } - } - catch(Exception $e) - { + } catch (Exception $e) { utils::EnrichRaisedException($oTrigger, $e); } } diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/cs.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/cs.dict.itop-virtualization-mgmt.php index 515b8b970..25a07d18c 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/cs.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/cs.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/da.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/da.dict.itop-virtualization-mgmt.php index 366a22654..b3cfafbe2 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/da.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/da.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/de.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/de.dict.itop-virtualization-mgmt.php index acb3b3f9e..e0b95fb36 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/de.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/de.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/en.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/en.dict.itop-virtualization-mgmt.php index 7d8861785..998d9e6ff 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/en.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/en.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id', 'Class:LogicalInterface/Attribute:org_id+' => '', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/en_gb.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/en_gb.dict.itop-virtualization-mgmt.php index 8308d6eea..1b018e263 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/en_gb.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/en_gb.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ // Dictionary entries go here -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/es_cr.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/es_cr.dict.itop-virtualization-mgmt.php index ae4a64c21..f24a6a180 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/es_cr.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/es_cr.dict.itop-virtualization-mgmt.php @@ -1,21 +1,22 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/fr.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/fr.dict.itop-virtualization-mgmt.php index f238f8034..8b4785d1a 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/fr.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/fr.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/hu.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/hu.dict.itop-virtualization-mgmt.php index 72abf03c2..70e4f032e 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/hu.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/hu.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/it.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/it.dict.itop-virtualization-mgmt.php index 73e7dc66c..2bbaf8d63 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/it.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/it.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/ja.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/ja.dict.itop-virtualization-mgmt.php index 87ad925c4..68dde8878 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/ja.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/ja.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/nl.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/nl.dict.itop-virtualization-mgmt.php index ad33a0cdc..a0b055d9d 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/nl.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/nl.dict.itop-virtualization-mgmt.php @@ -1,10 +1,11 @@ @@ -12,15 +13,15 @@ * @author Denis Flaven * */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/pl.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/pl.dict.itop-virtualization-mgmt.php index 3ffc30af4..f9e492abb 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/pl.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/pl.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/pt_br.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/pt_br.dict.itop-virtualization-mgmt.php index 6836e56c3..4a4b93590 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/pt_br.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/pt_br.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/ru.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/ru.dict.itop-virtualization-mgmt.php index 2de2d0ec9..114c864da 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/ru.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/ru.dict.itop-virtualization-mgmt.php @@ -1,24 +1,25 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/sk.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/sk.dict.itop-virtualization-mgmt.php index 4ea661268..0339714fb 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/sk.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/sk.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/tr.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/tr.dict.itop-virtualization-mgmt.php index 89d3ee447..683e35aba 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/tr.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/tr.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/zh_cn.dict.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/zh_cn.dict.itop-virtualization-mgmt.php index ea69191e2..45c4d2bb0 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/dictionaries/zh_cn.dict.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/dictionaries/zh_cn.dict.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ */ -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ // Dictionary entries go here -)); +]); // // Class: LogicalInterface // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:LogicalInterface/Attribute:org_id' => 'Org id~~', 'Class:LogicalInterface/Attribute:org_id+' => '~~', -)); +]); diff --git a/datamodels/2.x/itop-virtualization-mgmt/module.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/module.itop-virtualization-mgmt.php index abd907441..eca8c0918 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/module.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/module.itop-virtualization-mgmt.php @@ -1,4 +1,5 @@ 'Virtualization Management', @@ -25,23 +26,23 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - 'itop-config-mgmt/2.4.0' - ), + 'dependencies' => [ + 'itop-config-mgmt/2.4.0', + ], 'mandatory' => false, 'visible' => true, // Components // - 'datamodel' => array( - ), - 'webservice' => array( - - ), - 'data.struct' => array( + 'datamodel' => [ + ], + 'webservice' => [ + + ], + 'data.struct' => [ // add your 'structure' definition XML files here, - ), - 'data.sample' => array( + ], + 'data.sample' => [ // add your sample data XML files here, 'data.sample.farm.xml', 'data.sample.hypervisor.xml', @@ -51,17 +52,17 @@ SetupWebPage::AddModule( 'data.sample.webserver.xml', 'data.sample.webapp.xml', 'data.sample.applicationsolutionci.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any - 'doc.more_information' => '', // hyperlink to more information, if any + 'doc.more_information' => '', // hyperlink to more information, if any // Default settings // - 'settings' => array( + 'settings' => [ // Module specific settings go here, if any - ), - ) + ], + ] ); diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/cs.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/cs.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/cs.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/cs.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/da.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/da.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/da.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/da.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/de.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/de.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/de.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/de.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/en.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/en.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/en.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/en.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/en_gb.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/en_gb.dict.itop-welcome-itil.php index 821faf3b6..a2089c33f 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/en_gb.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/en_gb.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/es_cr.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/es_cr.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/es_cr.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/es_cr.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/fr.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/fr.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/fr.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/fr.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/hu.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/hu.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/hu.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/hu.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/it.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/it.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/it.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/it.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/ja.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/ja.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/ja.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/ja.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/nl.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/nl.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/nl.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/nl.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/pl.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/pl.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/pl.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/pl.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/pt_br.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/pt_br.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/pt_br.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/pt_br.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/ru.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/ru.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/ru.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/ru.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/sk.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/sk.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/sk.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/sk.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/tr.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/tr.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/tr.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/tr.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/dictionaries/zh_cn.dict.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/dictionaries/zh_cn.dict.itop-welcome-itil.php index 8bbf3562a..71bd52f7c 100644 --- a/datamodels/2.x/itop-welcome-itil/dictionaries/zh_cn.dict.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/dictionaries/zh_cn.dict.itop-welcome-itil.php @@ -1,4 +1,5 @@ */ - diff --git a/datamodels/2.x/itop-welcome-itil/module.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/module.itop-welcome-itil.php index 02acac46b..51bf99810 100755 --- a/datamodels/2.x/itop-welcome-itil/module.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/module.itop-welcome-itil.php @@ -1,10 +1,9 @@ 'ITIL skin', @@ -12,26 +11,26 @@ SetupWebPage::AddModule( // Setup // - 'dependencies' => array( - ), + 'dependencies' => [ + ], 'mandatory' => true, 'visible' => false, //'installer' => 'MyInstaller', // Components // - 'datamodel' => array( - ), - 'webservice' => array( + 'datamodel' => [ + ], + 'webservice' => [ //'webservices.itop-welcome-itil.php', - ), - 'data.struct' => array( + ], + 'data.struct' => [ //'data.struct.itop-welcome-itil.xml', - ), - 'data.sample' => array( + ], + 'data.sample' => [ //'data.sample.itop-welcome-itil.xml', - ), - + ], + // Documentation // 'doc.manual_setup' => '', @@ -39,8 +38,8 @@ SetupWebPage::AddModule( // Default settings // - 'settings' => array( + 'settings' => [ //'some_setting' => 'some value', - ), - ) + ], + ] ); diff --git a/dictionaries/core/orm-value/orm-document/cs.dictionary.itop.orm-document.php b/dictionaries/core/orm-value/orm-document/cs.dictionary.itop.orm-document.php index 95b47c769..384a825a7 100644 --- a/dictionaries/core/orm-value/orm-document/cs.dictionary.itop.orm-document.php +++ b/dictionaries/core/orm-value/orm-document/cs.dictionary.itop.orm-document.php @@ -1,10 +1,11 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Core:ormValue:ormDocument:DownloadsCount' => '%1s', diff --git a/dictionaries/core/orm-value/orm-document/fr.dictionary.itop.orm-document.php b/dictionaries/core/orm-value/orm-document/fr.dictionary.itop.orm-document.php index 39e2b0515..cd86f5a9a 100644 --- a/dictionaries/core/orm-value/orm-document/fr.dictionary.itop.orm-document.php +++ b/dictionaries/core/orm-value/orm-document/fr.dictionary.itop.orm-document.php @@ -1,10 +1,11 @@ diff --git a/dictionaries/core/orm-value/orm-document/pl.dictionary.itop.orm-document.php b/dictionaries/core/orm-value/orm-document/pl.dictionary.itop.orm-document.php index d62001e2f..3c5fcacc1 100644 --- a/dictionaries/core/orm-value/orm-document/pl.dictionary.itop.orm-document.php +++ b/dictionaries/core/orm-value/orm-document/pl.dictionary.itop.orm-document.php @@ -1,10 +1,11 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:cmdbAbstractObject/UniquenessRule:no_duplicate' => '%1$s: %2$s ya está vinculado a %3$s: %4$s, no se permiten duplicados en esta relación.', diff --git a/dictionaries/core/uniqueness-rule/fr.dictionary.itop.uniqueness-rule.php b/dictionaries/core/uniqueness-rule/fr.dictionary.itop.uniqueness-rule.php index 77c3cc9ea..090382b82 100644 --- a/dictionaries/core/uniqueness-rule/fr.dictionary.itop.uniqueness-rule.php +++ b/dictionaries/core/uniqueness-rule/fr.dictionary.itop.uniqueness-rule.php @@ -1,10 +1,11 @@ diff --git a/dictionaries/core/uniqueness-rule/pl.dictionary.itop.uniqueness-rule.php b/dictionaries/core/uniqueness-rule/pl.dictionary.itop.uniqueness-rule.php index 97c26630e..b1a5b6775 100644 --- a/dictionaries/core/uniqueness-rule/pl.dictionary.itop.uniqueness-rule.php +++ b/dictionaries/core/uniqueness-rule/pl.dictionary.itop.uniqueness-rule.php @@ -1,10 +1,11 @@ * @author Daniel Rokos * */ -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Core:DeletedObjectLabel' => '%1s (odstraněn)', 'Core:DeletedObjectTip' => 'Objekt byl odstraněn %1$s (%2$s)', 'Core:UnknownObjectLabel' => 'Objekt nenalezen (třída: %1$s, id: %2$d)', @@ -159,8 +160,7 @@ Operátory:
          'Core:Context=GUI:Console' => 'Konzole', 'Core:Context=CRON' => 'cron', 'Core:Context=GUI:Portal' => 'Portal', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -171,7 +171,7 @@ Operátory:
          // Class: CMDBChange // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:CMDBChange' => 'Změna', 'Class:CMDBChange+' => 'Trasování změn', 'Class:CMDBChange/Attribute:date' => 'datum', @@ -186,13 +186,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'Webové služby REST/JSON', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'Wbové služby SOAP', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'Rozšíření', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:CMDBChangeOp' => 'Změna operace', 'Class:CMDBChangeOp+' => 'Tracking provozu změn', 'Class:CMDBChangeOp/Attribute:change' => 'změna', @@ -207,51 +207,51 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:CMDBChangeOp/Attribute:objkey+' => '', 'Class:CMDBChangeOp/Attribute:finalclass' => 'typ', 'Class:CMDBChangeOp/Attribute:finalclass+' => '', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:CMDBChangeOpCreate' => 'vytvoření objektu', 'Class:CMDBChangeOpCreate+' => 'Tracking vytvoření objektu', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:CMDBChangeOpDelete' => 'odstranění objektu', 'Class:CMDBChangeOpDelete+' => 'Tracking odstranění objektu', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:CMDBChangeOpSetAttribute' => 'změna objektu', 'Class:CMDBChangeOpSetAttribute+' => 'Tracking úprav objektu', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Atribut', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'kód upravené vlastnosti', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'změna vlastnosti objektu', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Záznam změny objektu', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Předchozí hodnota', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => '', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Nová hodnota', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => '', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Change:ObjectCreated' => 'Objekt vytvořen', 'Change:ObjectDeleted' => 'Objekt odstraněn', 'Change:ObjectModified' => 'Objekt upraven', @@ -268,35 +268,35 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Change:LinkSet:Added' => 'přidán %1$s', 'Change:LinkSet:Removed' => 'odstraněn %1$s', 'Change:LinkSet:Modified' => 'upraven %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'změna dat', 'Class:CMDBChangeOpSetAttributeBlob+' => 'Tracking změny dat', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Předchozí data', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => '', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:CMDBChangeOpSetAttributeText' => 'změna textu', 'Class:CMDBChangeOpSetAttributeText+' => 'Tracking změny textu', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Předchozí data', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => '', -)); +]); // // Class: Event // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Event' => 'Událost', 'Class:Event+' => '', 'Class:Event/Attribute:message' => 'Zpráva', @@ -307,13 +307,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Event/Attribute:userinfo+' => 'identifikace uživatele, který spustil tuto událost', 'Class:Event/Attribute:finalclass' => 'Typ', 'Class:Event/Attribute:finalclass+' => '', -)); +]); // // Class: EventNotification // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:EventNotification' => 'Upozornění', 'Class:EventNotification+' => '', 'Class:EventNotification/Attribute:trigger_id' => 'Triger', @@ -322,13 +322,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:EventNotification/Attribute:action_id+' => '', 'Class:EventNotification/Attribute:object_id' => 'Objekt', 'Class:EventNotification/Attribute:object_id+' => '', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:EventNotificationEmail' => 'Odeslání emailu', 'Class:EventNotificationEmail+' => '', 'Class:EventNotificationEmail/Attribute:to' => 'Pro', @@ -345,13 +345,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:EventNotificationEmail/Attribute:body+' => '', 'Class:EventNotificationEmail/Attribute:attachments' => 'Přílohy', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:EventIssue' => 'Chyba', 'Class:EventIssue+' => '', 'Class:EventIssue/Attribute:issue' => 'Chyba', @@ -368,13 +368,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:EventIssue/Attribute:callstack+' => '', 'Class:EventIssue/Attribute:data' => 'Data', 'Class:EventIssue/Attribute:data+' => '', -)); +]); // // Class: EventWebService // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:EventWebService' => 'Volání webové služby', 'Class:EventWebService+' => '', 'Class:EventWebService/Attribute:verb' => 'Název operace', @@ -389,9 +389,9 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:EventWebService/Attribute:log_error+' => '', 'Class:EventWebService/Attribute:data' => 'Data', 'Class:EventWebService/Attribute:data+' => '', -)); +]); -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:EventRestService' => 'Volání REST/JSON', 'Class:EventRestService+' => 'Stopa REST/JSON volání', 'Class:EventRestService/Attribute:operation' => 'Operace', @@ -406,13 +406,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:EventRestService/Attribute:json_output+' => 'HTTP response (json)', 'Class:EventRestService/Attribute:provider' => 'Poskytovatel', 'Class:EventRestService/Attribute:provider+' => 'Třída PHP implementující očekávanou operaci', -)); +]); // // Class: EventLoginUsage // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:EventLoginUsage' => 'Použití aplikace', 'Class:EventLoginUsage+' => '', 'Class:EventLoginUsage/Attribute:user_id' => 'Login', @@ -421,13 +421,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:EventLoginUsage/Attribute:contact_name+' => 'Kontaktní informace uživatele', 'Class:EventLoginUsage/Attribute:contact_email' => 'Emailová adresa uživatele', 'Class:EventLoginUsage/Attribute:contact_email+' => '', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:EventNotificationNewsroom' => 'Zaslané novinky', 'Class:EventNotificationNewsroom+' => '~~', 'Class:EventNotificationNewsroom/Attribute:title' => 'Titulek', @@ -456,13 +456,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '~~', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Kontakt', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '~~', -)); +]); // // Class: Action // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Action' => 'Vlastní akce', 'Class:Action+' => '', 'Class:Action/ComplementaryName' => '%1$s: %2$s', @@ -492,24 +492,24 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Action:last_executions_tab_panel_title' => 'Provedení této akce (%1$s)', 'Action:last_executions_tab_limit_days' => 'posledních %1$s dní', 'Action:last_executions_tab_limit_none' => 'bez omezení', -)); +]); // // Class: ActionNotification // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ActionNotification' => 'Upozornění', 'Class:ActionNotification+' => 'Upozornění (abstraktní)', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ActionEmail' => 'Emailové upozornění', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'Tento stav určuje, kdo bude upozorněn: @@ -564,14 +564,13 @@ If omitted the From (label) is used.', 'ActionEmail:preview_warning' => 'Finální podoba emailu může vypadat v emailovém klientu jinak, než tento aktuální náhled v prohlížeci', 'ActionEmail:preview_more_info' => 'Další informace ohledně podpory CSS v emailových klientech, se dozvíte zde %1$s', 'ActionEmail:content_placeholder_missing' => 'Odkaz "%1$s" nebyl v HMTL šabloně nalezen. Obsah pole "%2$s" nebude součástí generovaného emailu', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'ActionNewsroom:trigger' => 'Triger', 'ActionNewsroom:content' => 'Zpráva', 'ActionNewsroom:settings' => 'Nastavení', @@ -606,13 +605,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'Dotaz OQL vracející objekty Kontaktu', 'Class:ActionNewsroom/Attribute:url' => 'URL', 'Class:ActionNewsroom/Attribute:url+' => 'Pokud je URL prázdná, bude odkazovat na objekt, který upozornění spustil. Můžete však zadat vlastní URL adresu.', -)); +]); // // Class: Trigger // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Trigger' => 'Triger', 'Class:Trigger+' => '', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~', @@ -631,13 +630,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Povolit úplné odhlášení odběru', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Vynucení alespoň jednoho kanálu (Novinka nebo Email)', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Zakázat odmítnutí odběru', -)); +]); // // Class: TriggerOnObject // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TriggerOnObject' => 'Triger \'závislý na třídě objektů\'', 'Class:TriggerOnObject+' => '', 'Class:TriggerOnObject/Attribute:target_class' => 'Cílová třída', @@ -646,115 +645,115 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Omezit seznam objektů (cílové třídy), které aktivují triger', 'TriggerOnObject:WrongFilterQuery' => 'Špatný filtrační dotaz: %1$s', 'TriggerOnObject:WrongFilterClass' => 'Filtrační dotaz musí vrátit objekty třídy "%1$s"', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TriggerOnPortalUpdate' => 'Triger \'aktualizace přes portál\'', 'Class:TriggerOnPortalUpdate+' => 'Triger při aktualizaci koncovým uživatelem přes portál', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TriggerOnStateChange' => 'Triger \'změna stavu\'', 'Class:TriggerOnStateChange+' => '', 'Class:TriggerOnStateChange/Attribute:state' => 'Stav', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TriggerOnStateEnter' => 'Triger \'změna stavu na\'', 'Class:TriggerOnStateEnter+' => '', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TriggerOnStateLeave' => 'Triger \'změna stavu z\'', 'Class:TriggerOnStateLeave+' => '', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TriggerOnObjectCreate' => 'Triger \'vytvoření objektu\'', 'Class:TriggerOnObjectCreate+' => '', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TriggerOnObjectDelete' => 'Triger \'smazání objektu\'', 'Class:TriggerOnObjectDelete+' => 'Spustit při smazání objektu [podřízené třídy] dané třídy', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TriggerOnObjectUpdate' => 'Triger \'aktualizace objektu\'', 'Class:TriggerOnObjectUpdate+' => 'Spustit při aktualizaci objektu [podřízené třídy] dané třídy', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Cílová pole', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TriggerOnObjectMention' => 'Triger (při zmíňce objektu)', 'Class:TriggerOnObjectMention+' => 'Spustit při zmínce (@xxx) o objektu [podřízené třídy] dané třídy v logu atributu', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Filtr zmínek', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Omezit seznam zmíněných objektů, které aktivují triger. Pokud je prázdný, aktivuje jej libovolný zmíněný objekt (libovolné třídy).', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TriggerOnAttributeBlobDownload' => 'Triger (při stažení pole dokumentu objektu)', 'Class:TriggerOnAttributeBlobDownload+' => 'Spustit při stažení pole dokumentu objektu [podřízené třídy] dané třídy', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Cílová pole', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TriggerOnThresholdReached' => 'Triger \'prahová hodnota\'', 'Class:TriggerOnThresholdReached+' => '', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Stopky', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Prahová hodnota', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkTriggerAction' => 'Spojení (Akce / Triger)', 'Class:lnkTriggerAction+' => '', 'Class:lnkTriggerAction/Attribute:action_id' => 'Akce', @@ -767,12 +766,12 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Pořadí', 'Class:lnkTriggerAction/Attribute:order+' => 'Pořadí, v jakém jsou akce vykonány', -)); +]); // // Synchro Data Source // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:SynchroDataSource' => 'Zdroje dat pro synchronizaci', 'Class:SynchroDataSource/Attribute:name' => 'Název', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1060,13 +1059,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Core:Validator:MustBeInteger' => 'Musí být celé číslo', 'Core:Validator:MustSelectOne' => 'Zvolte prosím jednu hodnotu', 'Menu:DataSources' => 'Zdroje dat pro synchronizaci', - 'Menu:DataSources+' => 'Všechny zdroje dat pro synchronizaci' -)); + 'Menu:DataSources+' => 'Všechny zdroje dat pro synchronizaci', +]); // // Class: TagSetFieldData // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:TagSetFieldData' => '%2$s pro třídu %1$s', 'Class:TagSetFieldData+' => '', 'Class:TagSetFieldData/Attribute:code' => 'Kód', @@ -1088,12 +1087,12 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Atribut kód u Tagu nemůže být změněn', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Použití Tagu (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => 'Pro Tag nebyl nalezen žádný vstup', -)); +]); // // Class: DBProperty // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:DBProperty' => 'Nastavení DB', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Jméno', @@ -1106,12 +1105,12 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Změna komentáře', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:BackgroundTask' => 'Úkoly běžící na pozadí', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Jméno třídy', @@ -1136,12 +1135,12 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'Status', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:AsyncTask' => 'Asynchronní úkoly', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Vytvořeno', @@ -1166,43 +1165,40 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:AsyncTask/Attribute:last_attempt+' => '', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Špatný formát pro nastavení "async_task_retries[%1$s]". Je očekáváno pole obsahující následující klíče: %2$s', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Špatný formát pro nastavení "async_task_retries[%1$s]": neočekávaný klíč "%2$s". Je očekáván jeden z následujících klíčů: %3$s', -)); +]); // // Class: AbstractResource // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:AbstractResource' => 'Abstraktní zdroj', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ResourceAdminMenu' => 'Resource Admin Menu~~', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ResourceRunQueriesMenu' => 'Resource Run Queries Menu~~', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:ResourceSystemMenu' => 'Resource System Menu~~', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/cs.dictionary.itop.ui.php b/dictionaries/cs.dictionary.itop.ui.php index eb6a5c04a..3377a58c6 100755 --- a/dictionaries/cs.dictionary.itop.ui.php +++ b/dictionaries/cs.dictionary.itop.ui.php @@ -1,15 +1,16 @@ 'Kategorie auditu', 'Class:AuditCategory+' => 'Část celkového auditu', 'Class:AuditCategory/Attribute:name' => 'Název kategorie', @@ -26,13 +27,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Hranice špatných objektů, při kterých je výsledek označen chybou (červená), v procentech', 'Class:AuditCategory/Attribute:domains_list' => 'Domény', 'Class:AuditCategory/Attribute:domains_list+' => 'Domény obsahující tyto kategorie', -)); +]); // // Class: AuditRule // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:AuditRule' => 'Pravidlo Auditu', 'Class:AuditRule+' => 'Pravidlo pro kontrolu v dané kategorii auditu', 'Class:AuditRule/Attribute:name' => 'Název pravidla', @@ -51,13 +52,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:AuditRule/Attribute:category_id+' => 'Kategorie pro toto pravidlo', 'Class:AuditRule/Attribute:category_name' => 'Kategorie', 'Class:AuditRule/Attribute:category_name+' => 'Název kategorie pro toto pravidlo', -)); +]); // // Class: AuditDomain // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:AuditDomain' => 'Domény Auditu', 'Class:AuditDomain+' => 'Domény Auditu umožňují slučovat audity podle kategorií. Domény nejčastěji odpovídají skupinám řešitelů, které následně opravují chyby nalezené auditem', @@ -69,13 +70,13 @@ Domény nejčastěji odpovídají skupinám řešitelů, které následně oprav 'Class:AuditDomain/Attribute:icon+' => '', 'Class:AuditDomain/Attribute:categories_list' => 'Kategorie', 'Class:AuditDomain/Attribute:categories_list+' => 'Související kategorie auditu. Při spuštění auditu v doméně se kontrolují všechny související kategorie auditu a pouze ty.', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Okdaz na Kategorii Auditu / Doménu Auditu', 'Class:lnkAuditCategoryToAuditDomain+' => '', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Kategorie', @@ -86,13 +87,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Doména Auditu', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Jméno domény', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Jméno domény Auditu', -)); +]); // // Class: QueryOQL // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:Query' => 'Dotaz', 'Class:Query+' => '', 'Class:Query/Attribute:name' => 'Název', @@ -119,7 +120,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:QueryOQL+' => '', 'Class:QueryOQL/Attribute:oql' => 'Výraz', 'Class:QueryOQL/Attribute:oql+' => 'OQL výraz', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -130,7 +131,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( // Class: User // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:User' => 'Uživatel', 'Class:User+' => 'Uživatelské jméno', 'Class:User/Attribute:finalclass' => 'Typ účtu', @@ -176,13 +177,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:User/Warning:NoContactHasImpact' => 'Upozornění: tento uživatel nemá definovanou žádnou osobu, což znemožňuje přístup k portálu, novým upozorněním a má další vedlejší důsledky v Back-Office', 'Class:UserInternal' => 'Interní uživatel', 'Class:UserInternal+' => 'Uživatel definovaný v '.ITOP_APPLICATION_SHORT, -)); +]); // // Class: URP_Profiles // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:URP_Profiles' => 'Profil (role)', 'Class:URP_Profiles+' => 'Uživatelský profil (role)', 'Class:URP_Profiles/Attribute:name' => 'Název', @@ -191,13 +192,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:URP_Profiles/Attribute:description+' => 'Krátký popis', 'Class:URP_Profiles/Attribute:user_list' => 'Uživatelé', 'Class:URP_Profiles/Attribute:user_list+' => 'Uživatelé mající tento profil (roli)', -)); +]); // // Class: URP_Dimensions // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:URP_Dimensions' => 'Rozměry', 'Class:URP_Dimensions+' => 'Rozměry aplikace (defining silos)', 'Class:URP_Dimensions/Attribute:name' => 'Jméno', @@ -206,13 +207,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:URP_Dimensions/Attribute:description+' => '', 'Class:URP_Dimensions/Attribute:type' => 'Typ', 'Class:URP_Dimensions/Attribute:type+' => 'Název třídy nebo typu dat (projekční jednotka)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:URP_UserProfile' => 'Uživatel/Profil', 'Class:URP_UserProfile+' => '', 'Class:URP_UserProfile/Name' => 'Spojení mezi uživatelem %1$s a profilem %2$s', @@ -226,14 +227,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:URP_UserProfile/Attribute:profile+' => '', 'Class:URP_UserProfile/Attribute:reason' => 'Důvod', 'Class:URP_UserProfile/Attribute:reason+' => 'proč má uživatel tento profil', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:URP_UserOrg' => 'Přístupné organizace', 'Class:URP_UserOrg+' => '', 'Class:URP_UserOrg/Name' => 'Spojení mezi uživatelem %1$s a organizací %2$s', @@ -247,13 +247,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => 'Přístupná organizace', 'Class:URP_UserOrg/Attribute:reason' => 'Důvod', 'Class:URP_UserOrg/Attribute:reason+' => 'proč má uživatel oprávnění přistupovat k údajům této organizace', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:URP_ProfileProjection' => 'profile_projection', 'Class:URP_ProfileProjection+' => 'profile projections', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Rozměr ID', @@ -268,13 +268,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'OQL výraz (pomocí $user) | konstanta | | +kód atributu', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Atribut', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Kód atributu cíle (nepovinné)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:URP_ClassProjection' => 'class_projection', 'Class:URP_ClassProjection+' => 'class projections', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Rozměr ID', @@ -287,13 +287,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:URP_ClassProjection/Attribute:value+' => 'OQL výraz (pomocí $this) | konstanta | | +kód atributu', 'Class:URP_ClassProjection/Attribute:attribute' => 'Atribut', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Kód atributu cíle (nepovinné)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:URP_ActionGrant' => 'Oprávnění k akci', 'Class:URP_ActionGrant+' => 'Oprávnění pro třídy', 'Class:URP_ActionGrant/Attribute:profileid' => 'Profil', @@ -310,13 +310,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'ne', 'Class:URP_ActionGrant/Attribute:action' => 'Akce', 'Class:URP_ActionGrant/Attribute:action+' => 'operace, které se mají v dané třídě provést', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:URP_StimulusGrant' => 'Oprávnění', 'Class:URP_StimulusGrant+' => 'oprávnění k podnětu v životním cyklu objektu', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Profil', @@ -333,25 +333,25 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'ne', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Pondět', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'Kód podnětu', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:URP_AttributeGrant' => 'Oprávnění k akci', 'Class:URP_AttributeGrant+' => 'Oprávnění na úrovni atributů', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Action grant', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => '', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Atribut', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'kód atributu', -)); +]); // // Class: UserDashboard // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Class:UserDashboard' => 'Nástěnka uživatele', 'Class:UserDashboard+' => '~~', 'Class:UserDashboard/Attribute:user_id' => 'Uživatel', @@ -360,12 +360,12 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Class:UserDashboard/Attribute:menu_code+' => '~~', 'Class:UserDashboard/Attribute:contents' => 'Obsah', 'Class:UserDashboard/Attribute:contents+' => '~~', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:WelcomeMenu' => 'Vítejte', 'Menu:WelcomeMenu+' => 'Vítejte v '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage' => 'Vítejte', 'Menu:WelcomeMenuPage+' => 'Vítejte v '.ITOP_APPLICATION_SHORT, 'Menu:AdminTools' => 'Administrace', @@ -382,14 +382,14 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Menu:MyShortcuts' => 'Mé odkazy', 'Menu:Notifications:Title' => 'Konfigurace Auditu', 'Menu:DataAdministration' => 'Správa dat', - 'Menu:DataAdministration+' => 'Správa dat' -)); + 'Menu:DataAdministration+' => 'Správa dat', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'BooleanLabel:yes' => 'ano', 'BooleanLabel:no' => 'ne', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.' login~~', @@ -1531,13 +1531,13 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Včetně děděných objektů', 'UI:Search:Criteria:Raw:Filtered' => 'Filtrováno', 'UI:Search:Criteria:Raw:FilteredOn' => 'Filtrováno na %1$s', - 'UI:StateChanged' => 'Stav změněn' -)); + 'UI:StateChanged' => 'Stav změněn', +]); // // Expression to Natural language // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Expression:Operator:AND' => ' A ', 'Expression:Operator:OR' => ' NEBO ', 'Expression:Operator:=' => ': ', @@ -1550,12 +1550,12 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Expression:Unit:Long:MINUTE' => 'minut(y)', 'Expression:Verb:NOW' => 'nyní', 'Expression:Verb:ISNULL' => ': nedefinováno', -)); +]); // // iTop Newsroom menu // -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'UI:Newsroom:NoNewMessage' => 'Žádné nové zprávy', 'UI:Newsroom:XNewMessage' => '%1$s nových zpráv', 'UI:Newsroom:MarkAllAsRead' => 'Označ všechny zprávy jako přečtené', @@ -1570,10 +1570,9 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgentní', 'UI:Newsroom:Priority:3:Tooltip' => 'Důležitá', 'UI:Newsroom:Priority:4:Tooltip' => 'Normalní', -)); +]); - -Dict::Add('CS CZ', 'Czech', 'Čeština', array( +Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'Menu:DataSources' => 'Zdroje dat pro synchronizaci', 'Menu:DataSources+' => 'Všechny zdroje dat pro synchronizaci', 'Menu:AuditCategories' => 'Konfigurace Auditu', @@ -1601,4 +1600,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Menu:Integrations' => 'Integrace', 'Menu:Integrations+' => '~~', -)); +]); diff --git a/dictionaries/da.dictionary.itop.core.php b/dictionaries/da.dictionary.itop.core.php index 10b293046..2f2f8afae 100644 --- a/dictionaries/da.dictionary.itop.core.php +++ b/dictionaries/da.dictionary.itop.core.php @@ -1,16 +1,17 @@ * */ -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Core:DeletedObjectLabel' => '%1s (slettet)', 'Core:DeletedObjectTip' => 'Objektet er slettet på %1$s (%2$s)', 'Core:UnknownObjectLabel' => 'Objektet ikke fundet (klasse: %1$s, id: %2$d)', @@ -158,8 +159,7 @@ Operators:
          'Core:Context=GUI:Console' => 'Console~~', 'Core:Context=CRON' => 'cron~~', 'Core:Context=GUI:Portal' => 'Portal~~', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -170,7 +170,7 @@ Operators:
          // Class: CMDBChange // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:CMDBChange' => 'Change', 'Class:CMDBChange+' => '', 'Class:CMDBChange/Attribute:date' => 'Dato', @@ -185,13 +185,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON webservices~~', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP webservices~~', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'By an extension~~', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:CMDBChangeOp' => 'Change Operation', 'Class:CMDBChangeOp+' => '', 'Class:CMDBChangeOp/Attribute:change' => 'Change', @@ -206,51 +206,51 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:CMDBChangeOp/Attribute:objkey+' => '', 'Class:CMDBChangeOp/Attribute:finalclass' => 'Type', 'Class:CMDBChangeOp/Attribute:finalclass+' => '', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:CMDBChangeOpCreate' => 'Object oprettelse', 'Class:CMDBChangeOpCreate+' => '', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:CMDBChangeOpDelete' => 'Object sletning', 'Class:CMDBChangeOpDelete+' => '', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:CMDBChangeOpSetAttribute' => 'Object ændring', 'Class:CMDBChangeOpSetAttribute+' => '', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Attribut', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => '', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'Property ændring', 'Class:CMDBChangeOpSetAttributeScalar+' => '', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Tidligere værdi', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => '', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Ny værdi', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => '', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Change:ObjectCreated' => 'Objekt oprettet', 'Change:ObjectDeleted' => 'Objekt slettet', 'Change:ObjectModified' => 'Objekt ændret', @@ -267,35 +267,35 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Change:LinkSet:Added' => 'tilføjet %1$s', 'Change:LinkSet:Removed' => 'fjernet %1$s', 'Change:LinkSet:Modified' => 'ændret %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'Data ændring', 'Class:CMDBChangeOpSetAttributeBlob+' => '', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Tidligere data', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => '', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:CMDBChangeOpSetAttributeText' => 'Tekst ændring', 'Class:CMDBChangeOpSetAttributeText+' => '', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Tidligere data', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => '', -)); +]); // // Class: Event // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Event' => 'Log Hændelse', 'Class:Event+' => '', 'Class:Event/Attribute:message' => 'Besked', @@ -306,13 +306,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Event/Attribute:userinfo+' => '', 'Class:Event/Attribute:finalclass' => 'Type', 'Class:Event/Attribute:finalclass+' => '', -)); +]); // // Class: EventNotification // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:EventNotification' => 'Notifikation hændelse', 'Class:EventNotification+' => '', 'Class:EventNotification/Attribute:trigger_id' => 'Trigger', @@ -321,13 +321,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:EventNotification/Attribute:action_id+' => '', 'Class:EventNotification/Attribute:object_id' => 'Object id', 'Class:EventNotification/Attribute:object_id+' => '', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:EventNotificationEmail' => 'Email emission hændelse', 'Class:EventNotificationEmail+' => '', 'Class:EventNotificationEmail/Attribute:to' => 'Til', @@ -344,13 +344,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:EventNotificationEmail/Attribute:body+' => '', 'Class:EventNotificationEmail/Attribute:attachments' => 'Vedhæftning(er)', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:EventIssue' => 'Hændelses emne', 'Class:EventIssue+' => '', 'Class:EventIssue/Attribute:issue' => 'Emne', @@ -367,13 +367,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:EventIssue/Attribute:callstack+' => '', 'Class:EventIssue/Attribute:data' => 'Data', 'Class:EventIssue/Attribute:data+' => '', -)); +]); // // Class: EventWebService // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:EventWebService' => 'Web service hændelse', 'Class:EventWebService+' => '', 'Class:EventWebService/Attribute:verb' => 'Verb', @@ -388,9 +388,9 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:EventWebService/Attribute:log_error+' => '', 'Class:EventWebService/Attribute:data' => 'Data', 'Class:EventWebService/Attribute:data+' => '', -)); +]); -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:EventRestService' => 'REST/JSON call~~', 'Class:EventRestService+' => 'Trace of a REST/JSON service call~~', 'Class:EventRestService/Attribute:operation' => 'Operation~~', @@ -405,13 +405,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:EventRestService/Attribute:json_output+' => 'HTTP response (json)~~', 'Class:EventRestService/Attribute:provider' => 'Provider~~', 'Class:EventRestService/Attribute:provider+' => 'PHP class implementing the expected operation~~', -)); +]); // // Class: EventLoginUsage // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:EventLoginUsage' => 'Login Usage', 'Class:EventLoginUsage+' => '', 'Class:EventLoginUsage/Attribute:user_id' => 'Login', @@ -420,13 +420,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '', 'Class:EventLoginUsage/Attribute:contact_email' => 'Bruger Email', 'Class:EventLoginUsage/Attribute:contact_email+' => '', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:EventNotificationNewsroom' => 'News sent~~', 'Class:EventNotificationNewsroom+' => '~~', 'Class:EventNotificationNewsroom/Attribute:title' => 'Title~~', @@ -455,13 +455,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '~~', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact~~', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '~~', -)); +]); // // Class: Action // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Action' => 'Brugerdefineret handling', 'Class:Action+' => '', 'Class:Action/ComplementaryName' => '%1$s: %2$s~~', @@ -491,24 +491,24 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Action:last_executions_tab_panel_title' => 'Executions of this action (%1$s)~~', 'Action:last_executions_tab_limit_days' => 'past %1$s days~~', 'Action:last_executions_tab_limit_none' => 'no limit~~', -)); +]); // // Class: ActionNotification // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ActionNotification' => 'Notifikation', 'Class:ActionNotification+' => '', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ActionEmail' => 'Email besked', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'This status drives who will be notified: @@ -563,14 +563,13 @@ If omitted the From (label) is used.~~', 'ActionEmail:preview_warning' => 'The actual eMail may look different in the eMail client than this preview in your browser.~~', 'ActionEmail:preview_more_info' => 'For more information about the CSS features supported by the different eMail clients, refer to %1$s~~', 'ActionEmail:content_placeholder_missing' => 'The placeholder "%1$s" was not found in the HTML template. The content of the field "%2$s" will not be included in the generated emails.~~', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'ActionNewsroom:trigger' => 'Trigger~~', 'ActionNewsroom:content' => 'Message~~', 'ActionNewsroom:settings' => 'Settings~~', @@ -605,13 +604,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'An OQL query returning Contact objects~~', 'Class:ActionNewsroom/Attribute:url' => 'URL~~', 'Class:ActionNewsroom/Attribute:url+' => 'By default, it points to the object triggering the notification. But you can also specify a custom URL.~~', -)); +]); // // Class: Trigger // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Trigger' => 'Triggere', 'Class:Trigger+' => '', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~', @@ -630,13 +629,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Allow complete unsubscription~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Force at least one channel (News or Email)~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Deny unsubscription~~', -)); +]); // // Class: TriggerOnObject // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TriggerOnObject' => 'Trigger (klasse afhængig)', 'Class:TriggerOnObject+' => '', 'Class:TriggerOnObject/Attribute:target_class' => 'Target klasse', @@ -645,115 +644,115 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Limit the object list (of the target class) which will activate the trigger~~', 'TriggerOnObject:WrongFilterQuery' => 'Wrong filter query: %1$s~~', 'TriggerOnObject:WrongFilterClass' => 'The filter query must return objects of class "%1$s"~~', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TriggerOnPortalUpdate' => 'Trigger (Når opdateret fra portalen)', 'Class:TriggerOnPortalUpdate+' => '', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TriggerOnStateChange' => 'Trigger (i tilstand ændring)', 'Class:TriggerOnStateChange+' => '', 'Class:TriggerOnStateChange/Attribute:state' => 'Tilstand', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TriggerOnStateEnter' => 'Trigger (ved indtræden i en tilstand)', 'Class:TriggerOnStateEnter+' => '', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TriggerOnStateLeave' => 'Trigger (når en tilstand forlades)', 'Class:TriggerOnStateLeave+' => '', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TriggerOnObjectCreate' => 'Trigger (ved oprettelse af objekt)', 'Class:TriggerOnObjectCreate+' => '', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TriggerOnObjectDelete' => 'Trigger (on object deletion)~~', 'Class:TriggerOnObjectDelete+' => 'Trigger on object deletion of [a child class of] the given class~~', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TriggerOnObjectUpdate' => 'Trigger (on object update)~~', 'Class:TriggerOnObjectUpdate+' => 'Trigger on object update of [a child class of] the given class~~', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Target fields~~', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TriggerOnObjectMention' => 'Trigger (on object mention)~~', 'Class:TriggerOnObjectMention+' => 'Trigger on mention (@xxx) of an object of [a child class of] the given class in a log attribute~~', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Mentioned filter~~', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Limit the list of mentioned objects which will activate the trigger. If empty, any mentioned object (of any class) will activate it.~~', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TriggerOnAttributeBlobDownload' => 'Trigger (on object\'s document download)~~', 'Class:TriggerOnAttributeBlobDownload+' => 'Trigger on object\'s document field download of [a child class of] the given class~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Target fields~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '~~', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TriggerOnThresholdReached' => 'Trigger (grænseværdi)', 'Class:TriggerOnThresholdReached+' => '', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Stopur', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Grænse', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkTriggerAction' => 'Handling/Trigger', 'Class:lnkTriggerAction+' => '', 'Class:lnkTriggerAction/Attribute:action_id' => 'Handling', @@ -766,12 +765,12 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Rækkefølge', 'Class:lnkTriggerAction/Attribute:order+' => '', -)); +]); // // Synchro Data Source // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:SynchroDataSource' => 'Synchro Data Kilde', 'Class:SynchroDataSource/Attribute:name' => 'Navn', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1059,13 +1058,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Core:Validator:MustBeInteger' => 'Must be an integer~~', 'Core:Validator:MustSelectOne' => 'Please, select one~~', 'Menu:DataSources' => 'Synkroniserings Data Kilder', - 'Menu:DataSources+' => '' -)); + 'Menu:DataSources+' => '', +]); // // Class: TagSetFieldData // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:TagSetFieldData' => '%2$s for class %1$s~~', 'Class:TagSetFieldData+' => '', 'Class:TagSetFieldData/Attribute:code' => 'Code~~', @@ -1087,12 +1086,12 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Tags "Attribute Code" cannot be changed~~', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Tag usage (%1$d)~~', 'Core:TagSetFieldData:NoEntryFound' => 'No entry found for this tag~~', -)); +]); // // Class: DBProperty // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:DBProperty' => 'DB property~~', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Name~~', @@ -1105,12 +1104,12 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Change comment~~', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:BackgroundTask' => 'Background task~~', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Class name~~', @@ -1135,12 +1134,12 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'Status~~', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:AsyncTask' => 'Async. task~~', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Created~~', @@ -1165,43 +1164,40 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:AsyncTask/Attribute:last_attempt+' => '', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]". Expecting an array with the following keys: %2$s~~', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]": unexpected key "%2$s". Expecting only the following keys: %3$s~~', -)); +]); // // Class: AbstractResource // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:AbstractResource' => 'Abstract Resource~~', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ResourceAdminMenu' => 'Resource Admin Menu~~', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ResourceRunQueriesMenu' => 'Resource Run Queries Menu~~', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:ResourceSystemMenu' => 'Resource System Menu~~', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/da.dictionary.itop.ui.php b/dictionaries/da.dictionary.itop.ui.php index 9b7bdcc75..206801c7f 100644 --- a/dictionaries/da.dictionary.itop.ui.php +++ b/dictionaries/da.dictionary.itop.ui.php @@ -1,15 +1,16 @@ 'Audit-kategori', 'Class:AuditCategory+' => 'Udsnit af alle Audits', 'Class:AuditCategory/Attribute:name' => 'Kategori navn', @@ -26,13 +27,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Percentage of invalid objects below which the result is in error (red)~~', 'Class:AuditCategory/Attribute:domains_list' => 'Domains~~', 'Class:AuditCategory/Attribute:domains_list+' => 'Domains which include this category~~', -)); +]); // // Class: AuditRule // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:AuditRule' => 'Audit-regel', 'Class:AuditRule+' => 'En regel til at efterprøve den angivne Audit-kategori med', 'Class:AuditRule/Attribute:name' => 'Regel Navn', @@ -51,13 +52,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:AuditRule/Attribute:category_id+' => 'Kategori for denne regel', 'Class:AuditRule/Attribute:category_name' => 'Kategori', 'Class:AuditRule/Attribute:category_name+' => 'Kategorinavn for denne regel', -)); +]); // // Class: AuditDomain // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:AuditDomain' => 'Audit Domain~~', 'Class:AuditDomain+' => 'Audit domains allow to group the audit categories. Domain usually correspond to who is responsible for checking and fixing errors~~', @@ -69,13 +70,13 @@ Domain usually correspond to who is responsible for checking and fixing errors~~ 'Class:AuditDomain/Attribute:icon+' => '~~', 'Class:AuditDomain/Attribute:categories_list' => 'Categories~~', 'Class:AuditDomain/Attribute:categories_list+' => 'Related audit categories. When running the audit on a domain, all related audit categories are checked and only those.~~', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Link AuditCategory / AuditDomain~~', 'Class:lnkAuditCategoryToAuditDomain+' => '~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Category~~', @@ -86,13 +87,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Audit domain~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Domain name~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Audit domain name~~', -)); +]); // // Class: QueryOQL // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:Query' => 'Forespørgsel', 'Class:Query+' => '', 'Class:Query/Attribute:name' => 'Navn', @@ -119,7 +120,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:QueryOQL+' => '', 'Class:QueryOQL/Attribute:oql' => 'Udtryk', 'Class:QueryOQL/Attribute:oql+' => '', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -130,7 +131,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( // Class: User // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:User' => 'Bruger', 'Class:User+' => 'Bruger log in', 'Class:User/Attribute:finalclass' => 'Type af brugerkonto', @@ -176,13 +177,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:User/Warning:NoContactHasImpact' => 'Cautious: there is no Person defined on this User, this prevents access to portals, news notifications and other side effects in back-office~~', 'Class:UserInternal' => 'User Internal~~', 'Class:UserInternal+' => 'User defined within '.ITOP_APPLICATION_SHORT.'~~', -)); +]); // // Class: URP_Profiles // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:URP_Profiles' => 'Profil', 'Class:URP_Profiles+' => 'Brugerprofil', 'Class:URP_Profiles/Attribute:name' => 'Navn', @@ -191,13 +192,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:URP_Profiles/Attribute:description+' => 'Kort beskrivelse', 'Class:URP_Profiles/Attribute:user_list' => 'Brugere', 'Class:URP_Profiles/Attribute:user_list+' => 'Personer, der har denne Rolle', -)); +]); // // Class: URP_Dimensions // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:URP_Dimensions' => 'Dimension', 'Class:URP_Dimensions+' => 'Anvendelsesdimension (Fastlæggelse af siloer)', 'Class:URP_Dimensions/Attribute:name' => 'Navn', @@ -206,13 +207,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:URP_Dimensions/Attribute:description+' => 'Kort beskrivelse', 'Class:URP_Dimensions/Attribute:type' => 'Type', 'Class:URP_Dimensions/Attribute:type+' => 'Klassenavn eller datatype', -)); +]); // // Class: URP_UserProfile // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:URP_UserProfile' => 'Brugerprofil', 'Class:URP_UserProfile+' => 'Brugerprofil', 'Class:URP_UserProfile/Name' => 'Link mellem %1$s and %2$s', @@ -226,14 +227,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:URP_UserProfile/Attribute:profile+' => 'Profilnavn', 'Class:URP_UserProfile/Attribute:reason' => 'Begrundelse', 'Class:URP_UserProfile/Attribute:reason+' => 'Begrundelse, hvorfor denne bruger skal have denne profil', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:URP_UserOrg' => 'Bruger organisation(er)', 'Class:URP_UserOrg+' => 'Tilladte organisation(er)', 'Class:URP_UserOrg/Name' => 'Link mellem %1$s og %2$s', @@ -247,13 +247,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => '', 'Class:URP_UserOrg/Attribute:reason' => 'Begrundelse', 'Class:URP_UserOrg/Attribute:reason+' => '', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:URP_ProfileProjection' => 'Profil_projection', 'Class:URP_ProfileProjection+' => 'Profilbillede', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Dimension', @@ -268,13 +268,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'OQL-udtryk (Benyttes af $user) | konstant | | + Attribut-Code', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Attribut', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Mål for Attribut-kode (valgfri)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:URP_ClassProjection' => 'Klasse_projection', 'Class:URP_ClassProjection+' => 'Klassebillede', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Dimension', @@ -287,13 +287,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:URP_ClassProjection/Attribute:value+' => 'OQL-udtryk (Benyttes af $this) | konstant | | + Attribut-Code', 'Class:URP_ClassProjection/Attribute:attribute' => 'Attribut', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Mål for Attribut-kode (valgfri)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:URP_ActionGrant' => 'Handlings godkendelser', 'Class:URP_ActionGrant+' => 'Tilladelser på klasser', 'Class:URP_ActionGrant/Attribute:profileid' => 'Profil', @@ -310,13 +310,13 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'Nej', 'Class:URP_ActionGrant/Attribute:action' => 'Handling', 'Class:URP_ActionGrant/Attribute:action+' => 'Handling som skal udføres på den valgte klasse', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:URP_StimulusGrant' => 'Tilladels til påvirkning', 'Class:URP_StimulusGrant+' => 'Tilladelserne til påvirkning af livscyklus af objektet', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Profil', @@ -333,25 +333,25 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'Nej', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Påvirkning', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'Påvirknings-kode', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:URP_AttributeGrant' => 'Godkendelse af Attributter', 'Class:URP_AttributeGrant+' => 'Godkendelse af Attributter', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Tillad handling', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'Tillad handling', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Attribut', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'Attribut-kode', -)); +]); // // Class: UserDashboard // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Class:UserDashboard' => 'User dashboard~~', 'Class:UserDashboard+' => '~~', 'Class:UserDashboard/Attribute:user_id' => 'User~~', @@ -360,12 +360,12 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Class:UserDashboard/Attribute:menu_code+' => '~~', 'Class:UserDashboard/Attribute:contents' => 'Contents~~', 'Class:UserDashboard/Attribute:contents+' => '~~', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:WelcomeMenu' => 'Velkomen', 'Menu:WelcomeMenu+' => 'Velkommen til '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage' => 'Velkomen', 'Menu:WelcomeMenuPage+' => 'Velkommen til '.ITOP_APPLICATION_SHORT, 'Menu:AdminTools' => 'Admin værktøjer', @@ -382,14 +382,14 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Menu:MyShortcuts' => 'Mine Genveje', 'Menu:Notifications:Title' => 'Audit Kategorier', 'Menu:DataAdministration' => 'Data administration~~', - 'Menu:DataAdministration+' => '~~' -)); + 'Menu:DataAdministration+' => '~~', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'BooleanLabel:yes' => 'yes~~', 'BooleanLabel:no' => 'no~~', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.' login~~', @@ -1534,13 +1534,13 @@ Ved tilknytningen til en trigger, bliver hver handling tildelt et "rækkefølge" 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Children of the selected objects will be included.~~', 'UI:Search:Criteria:Raw:Filtered' => 'Filtered~~', 'UI:Search:Criteria:Raw:FilteredOn' => 'Filtered on %1$s~~', - 'UI:StateChanged' => 'State changed~~' -)); + 'UI:StateChanged' => 'State changed~~', +]); // // Expression to Natural language // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Expression:Operator:AND' => ' AND ~~', 'Expression:Operator:OR' => ' OR ~~', 'Expression:Operator:=' => ': ~~', @@ -1553,12 +1553,12 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Expression:Unit:Long:MINUTE' => 'minute(s)~~', 'Expression:Verb:NOW' => 'now~~', 'Expression:Verb:ISNULL' => ': undefined~~', -)); +]); // // iTop Newsroom menu // -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'UI:Newsroom:NoNewMessage' => 'No new message~~', 'UI:Newsroom:XNewMessage' => '%1$s new message(s)~~', 'UI:Newsroom:MarkAllAsRead' => 'Mark all messages as read~~', @@ -1573,10 +1573,9 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgent~~', 'UI:Newsroom:Priority:3:Tooltip' => 'Important~~', 'UI:Newsroom:Priority:4:Tooltip' => 'Normal~~', -)); +]); - -Dict::Add('DA DA', 'Danish', 'Dansk', array( +Dict::Add('DA DA', 'Danish', 'Dansk', [ 'Menu:DataSources' => 'Synkroniserings Data Kilder', 'Menu:DataSources+' => 'Data synchro used for batch import of external data~~', 'Menu:AuditCategories' => 'Audit Kategorier', @@ -1604,4 +1603,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Menu:Integrations' => 'Integrations~~', 'Menu:Integrations+' => '~~', -)); +]); diff --git a/dictionaries/de.dictionary.itop.core.php b/dictionaries/de.dictionary.itop.core.php index 1ceffc113..a5c1cf6e3 100644 --- a/dictionaries/de.dictionary.itop.core.php +++ b/dictionaries/de.dictionary.itop.core.php @@ -1,4 +1,5 @@ * @author Martin Raenker * @author Attila Baroti - * + * */ -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Core:DeletedObjectLabel' => '%1s (gelöscht)', 'Core:DeletedObjectTip' => 'Das Objekt wurde gelöscht am %1$s (%2$s)', 'Core:UnknownObjectLabel' => 'Objekt nicht gefunden (Klasse: %1$s, id: %2$d)', @@ -157,8 +158,7 @@ Operatoren:
          'Core:Context=GUI:Console' => 'Konsole', 'Core:Context=CRON' => 'cron', 'Core:Context=GUI:Portal' => 'Portal', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -169,7 +169,7 @@ Operatoren:
          // Class: CMDBChange // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:CMDBChange' => 'Change', 'Class:CMDBChange+' => 'Protokollierung der Änderungen', 'Class:CMDBChange/Attribute:date' => 'Datum', @@ -184,13 +184,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON Webservices', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP Webservices', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'Durch eine Extension', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:CMDBChangeOp' => 'Change-Operation', 'Class:CMDBChangeOp+' => 'Protokoll einer Änderung', 'Class:CMDBChangeOp/Attribute:change' => 'Change', @@ -205,51 +205,51 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:CMDBChangeOp/Attribute:objkey+' => '', 'Class:CMDBChangeOp/Attribute:finalclass' => 'Typ', 'Class:CMDBChangeOp/Attribute:finalclass+' => '', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:CMDBChangeOpCreate' => 'Objekterstellung', 'Class:CMDBChangeOpCreate+' => 'Protokoll der Objekterstellung', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:CMDBChangeOpDelete' => 'Objektlöschung', 'Class:CMDBChangeOpDelete+' => 'Protokoll der Objektlöschung', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:CMDBChangeOpSetAttribute' => 'Objektänderung', 'Class:CMDBChangeOpSetAttribute+' => 'Protokoll der Objektänderungen', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Attribut', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'Code der geänderten Eigenschaft', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'Eigenschaften ändern', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Aufzeichnen der Änderungen am Objekt', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Vorheriger Wert', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => 'Vorheriger Wert des Attributes', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Neuer Wert', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => 'Neuer Wert des Attributes', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Change:ObjectCreated' => 'Objekt erstellt', 'Change:ObjectDeleted' => 'Objekt gelöscht', 'Change:ObjectModified' => 'Objekt geändert', @@ -266,35 +266,35 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Change:LinkSet:Added' => 'hinzugefügt: %1$s', 'Change:LinkSet:Removed' => 'entfernt: %1$s', 'Change:LinkSet:Modified' => 'modifizert: %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'Daten ändern', 'Class:CMDBChangeOpSetAttributeBlob+' => 'Aufzeichnen der Datenänderung', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Vorherige Daten', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => 'Vorherige Inhalte des Attributes', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:CMDBChangeOpSetAttributeText' => 'Text ändern', 'Class:CMDBChangeOpSetAttributeText+' => 'Aufzeichnen der Textänderung', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Vorherige Daten', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'Vorherige Inhalte des Attributes', -)); +]); // // Class: Event // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Event' => 'Log Event', 'Class:Event+' => 'Ein anwendungsinternes Event', 'Class:Event/Attribute:message' => 'Nachricht', @@ -305,13 +305,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Event/Attribute:userinfo+' => 'Identifikation des Benutzers, der die Aktion ausführte, die dieses Event ausgelöst hat', 'Class:Event/Attribute:finalclass' => 'Typ', 'Class:Event/Attribute:finalclass+' => '', -)); +]); // // Class: EventNotification // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:EventNotification' => 'Gesendete Benachrichtigung', 'Class:EventNotification+' => 'Protokollierung der gesendeten Benachrichtigungen', 'Class:EventNotification/Attribute:trigger_id' => 'Trigger', @@ -320,13 +320,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:EventNotification/Attribute:action_id+' => '', 'Class:EventNotification/Attribute:object_id' => 'Objekt-ID', 'Class:EventNotification/Attribute:object_id+' => '', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:EventNotificationEmail' => 'Gesendete E-Mail-Benachrichtigung', 'Class:EventNotificationEmail+' => 'Protokollierung einer E-Mail, die gesendet wurde', 'Class:EventNotificationEmail/Attribute:to' => 'An', @@ -343,13 +343,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:EventNotificationEmail/Attribute:body+' => '', 'Class:EventNotificationEmail/Attribute:attachments' => 'Anhänge', 'Class:EventNotificationEmail/Attribute:attachments+' => 'Anhänge in der Nachricht', -)); +]); // // Class: EventIssue // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:EventIssue' => 'Issue Event', 'Class:EventIssue+' => 'Protokollierung eines Issues (Warnungen, Fehler, etc.)', 'Class:EventIssue/Attribute:issue' => 'Issue', @@ -366,13 +366,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:EventIssue/Attribute:callstack+' => 'Call stack', 'Class:EventIssue/Attribute:data' => 'Daten', 'Class:EventIssue/Attribute:data+' => 'Mehr Informationen', -)); +]); // // Class: EventWebService // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:EventWebService' => 'Web Service Event', 'Class:EventWebService+' => 'Protokollierung eines Web Service Calls', 'Class:EventWebService/Attribute:verb' => 'Verb', @@ -387,9 +387,9 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:EventWebService/Attribute:log_error+' => 'Ergebnis der Fehlerprotokollierung', 'Class:EventWebService/Attribute:data' => 'Daten', 'Class:EventWebService/Attribute:data+' => 'Ergebnisdaten', -)); +]); -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:EventRestService' => 'REST/JSON Call', 'Class:EventRestService+' => 'Trace eines REST/JSON-Calls', 'Class:EventRestService/Attribute:operation' => 'Operation', @@ -404,13 +404,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:EventRestService/Attribute:json_output+' => 'HTTP Antwort (JSON)', 'Class:EventRestService/Attribute:provider' => 'Provider', 'Class:EventRestService/Attribute:provider+' => 'PHP-Klasse, die die erwartete Operation implementiert', -)); +]); // // Class: EventLoginUsage // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:EventLoginUsage' => 'Login Verwendung', 'Class:EventLoginUsage+' => '', 'Class:EventLoginUsage/Attribute:user_id' => 'Login', @@ -419,13 +419,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '', 'Class:EventLoginUsage/Attribute:contact_email' => 'Benutzer-Mailadresse', 'Class:EventLoginUsage/Attribute:contact_email+' => '', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:EventNotificationNewsroom' => 'Gesendete Newsroom-Benachrichtigung', 'Class:EventNotificationNewsroom+' => '', 'Class:EventNotificationNewsroom/Attribute:title' => 'Titel', @@ -454,13 +454,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Kontakt', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '', -)); +]); // // Class: Action // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Action' => 'Benutzerdefinierte Aktion', 'Class:Action+' => 'Benutzerdefinierte Aktionen', 'Class:Action/ComplementaryName' => '%1$s: %2$s', @@ -490,24 +490,24 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Action:last_executions_tab_panel_title' => 'Ausführungen dieser Aktion (%1$s)', 'Action:last_executions_tab_limit_days' => 'die letzten %1$s Tage', 'Action:last_executions_tab_limit_none' => 'keine Einschränkung', -)); +]); // // Class: ActionNotification // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ActionNotification' => 'Benachrichtigung', 'Class:ActionNotification+' => 'Benachrichtigung (Kurzbeschreibung)', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ActionEmail' => 'Benachrichtigung via E-mail', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'Dieser Zustand entscheidet, wer benachrichtigt werden soll: nur der Testempfänger, alle (To, cc und Bcc) oder niemand', @@ -558,14 +558,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'ActionEmail:preview_warning' => 'Die tatsächliche E-Mail kann im E-Mail-Client anders aussehen als diese Vorschau in Ihrem Browser.', 'ActionEmail:preview_more_info' => 'Weitere Informationen zu den CSS-Funktionen, die von den verschiedenen E-Mail-Clients unterstützt werden, finden Sie unter %1$s', 'ActionEmail:content_placeholder_missing' => 'Der Platzhalter "%1$s" wurde in der HTML-Vorlage nicht gefunden. Der Inhalt des Feldes "%2$s" wird nicht in den generierten E-Mails enthalten sein.', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'ActionNewsroom:trigger' => 'Trigger', 'ActionNewsroom:content' => 'Nachricht', 'ActionNewsroom:settings' => 'Einstellungen', @@ -602,13 +601,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'Eine OQL-Abfrage, die Kontakt-Objekte zurückgibt', 'Class:ActionNewsroom/Attribute:url' => 'URL', 'Class:ActionNewsroom/Attribute:url+' => 'Wenn leer, verweist die URL auf das Objekt, das die Benachrichtigung ausgelöst hat. Sie können jedoch auch eine benutzerdefinierte URL angeben.', -)); +]); // // Class: Trigger // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Trigger' => 'Trigger', 'Class:Trigger+' => 'Custom event handler', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s', @@ -627,13 +626,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Vollständige Abmeldung erlauben', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Mindestens einen Kanal erzwingen (Nachricht oder E-Mail)', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Abmeldung verweigern', -)); +]); // // Class: TriggerOnObject // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TriggerOnObject' => 'Trigger (klassenunabhängig)', 'Class:TriggerOnObject+' => 'Trigger einer gegebenen Klasse an Objekten', 'Class:TriggerOnObject/Attribute:target_class' => 'Zielklasse', @@ -642,115 +641,115 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Einschränkung der Objekte (der Zielklasse) welche den Trigger aktivieren.', 'TriggerOnObject:WrongFilterQuery' => 'Fehlerhafter Filter-Query: %1$s', 'TriggerOnObject:WrongFilterClass' => 'Der Filter muss Objekte vom Typ \\"%1$s\\" zurückgeben.', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TriggerOnPortalUpdate' => 'Trigger (bei Update aus dem Portal)', 'Class:TriggerOnPortalUpdate+' => '', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TriggerOnStateChange' => 'Trigger (bei Statusänderung)', 'Class:TriggerOnStateChange+' => 'Trigger bei Änderung des Objektstatus', 'Class:TriggerOnStateChange/Attribute:state' => 'Status', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TriggerOnStateEnter' => 'Trigger (beim Eintritt eines Status)', 'Class:TriggerOnStateEnter+' => 'Trigger bei Eintritt einer Objektstatusänderung', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TriggerOnStateLeave' => 'Trigger (beim Verlassen eines Status)', 'Class:TriggerOnStateLeave+' => 'Trigger beim Verlassen einer Objektstatusänderung', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TriggerOnObjectCreate' => 'Trigger (bei Objekterstellung)', 'Class:TriggerOnObjectCreate+' => 'Trigger bei Objekterstellung (einer Kindklasse) einer gegebenen Klasse', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TriggerOnObjectDelete' => 'Trigger (bei Objektlöschung)', 'Class:TriggerOnObjectDelete+' => 'Trigger bei Objektlöschung einer gegebenen Klasse oder Kindklasse', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TriggerOnObjectUpdate' => 'Trigger (bei Objektanpassung)', 'Class:TriggerOnObjectUpdate+' => 'Trigger bei Objektanpassung einer gegebenen Klasse oder Kindklasse', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Ziel-Felder', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TriggerOnObjectMention' => 'Trigger (bei Objekterwähnung)', 'Class:TriggerOnObjectMention+' => 'Trigger bei Objekterwähnung (@xxx) einer Objekt mit [eine Kinderklasse von] eine gegebene Klasse in ein Log-Attribut', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Filter für Objekterwähnung', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Einschränkung der Objekte welche diesen Trigger aktivieren. Wenn leer, wird er von jedem Objekt (beliebige Klasse) aktiviert.', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TriggerOnAttributeBlobDownload' => 'Trigger (beim Herunterladen einer Datei eines Objekts)', 'Class:TriggerOnAttributeBlobDownload+' => 'Trigger für das Herunterladen einer Datei (Blob) der angegebenen Klasse oder einer Unterklasse', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Ziel-Felder', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TriggerOnThresholdReached' => 'Trigger (bei Schwellenwert)', 'Class:TriggerOnThresholdReached+' => '', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Uhr stoppen', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Schwellenwert', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkTriggerAction' => 'Aktion/Trigger', 'Class:lnkTriggerAction+' => 'Verknüpfung zwischen einem Trigger und einer Aktion', 'Class:lnkTriggerAction/Attribute:action_id' => 'Aktion', @@ -763,12 +762,12 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Reihenfolge', 'Class:lnkTriggerAction/Attribute:order+' => 'Reihenfolge der Aktionsausführungen', -)); +]); // // Synchro Data Source // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:SynchroDataSource' => 'Synchronisations-Datenquelle', 'Class:SynchroDataSource/Attribute:name' => 'Name', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1056,13 +1055,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Core:Validator:MustBeInteger' => 'Muss ein Integer sein', 'Core:Validator:MustSelectOne' => 'Min. ein Eintrag muss ausgewählt sein', 'Menu:DataSources' => 'Datenquellen für die Synchronisation', - 'Menu:DataSources+' => 'Alle Datenquellen für die Synchronisation' -)); + 'Menu:DataSources+' => 'Alle Datenquellen für die Synchronisation', +]); // // Class: TagSetFieldData // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:TagSetFieldData' => '%2$s für die Klasse %1$s', 'Class:TagSetFieldData+' => '', 'Class:TagSetFieldData/Attribute:code' => 'Code', @@ -1084,12 +1083,12 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Tag "Attribute Code" kann nicht geändert werden', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Tag Verwendung (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => 'Kein Eintrag für dieses Tag gefunden', -)); +]); // // Class: DBProperty // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:DBProperty' => 'DB Eigenschaft', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Name', @@ -1102,12 +1101,12 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Änderungskommentar', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:BackgroundTask' => 'Hintergrund-Task', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Klassenname', @@ -1132,12 +1131,12 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'Status', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:AsyncTask' => 'Async. Task', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Erstellt', @@ -1162,43 +1161,40 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:AsyncTask/Attribute:last_attempt+' => '', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Ungültiges Format der Konfiguration für "async_task_retries[%1$s]". Erwartet wird ein Array mit den Schlüsseln: %2$s', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Ungültiges Format der Konfiguration für "async_task_retries[%1$s]": unerwarteter Schlüssel "%2$s". Erwartet werden nur die Schlüssel: %3$s', -)); +]); // // Class: AbstractResource // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:AbstractResource' => 'Abstrakte Ressource', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ResourceAdminMenu' => 'Ressource "Admin Menü"', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ResourceRunQueriesMenu' => 'Ressource "Abfrage Ausführen Menü"', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:ResourceSystemMenu' => 'Ressource "System Menü"', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/de.dictionary.itop.ui.php b/dictionaries/de.dictionary.itop.ui.php index cd671c36e..30dba8f5b 100644 --- a/dictionaries/de.dictionary.itop.ui.php +++ b/dictionaries/de.dictionary.itop.ui.php @@ -1,15 +1,16 @@ 'Audit-Kategorie', 'Class:AuditCategory+' => 'Definition einer Objektgruppe, die durch Regeln überprüft werden soll.', 'Class:AuditCategory/Attribute:name' => 'Kategoriename', @@ -26,13 +27,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Erlaubter prozentualer Anteil ungültiger Objekte, bei dem das Ergebnis noch als Warnung (orange) dargestellt wird.', 'Class:AuditCategory/Attribute:domains_list' => 'Domänen', 'Class:AuditCategory/Attribute:domains_list+' => 'Domänen, die dieser Kategorie zugeordnet sind', -)); +]); // // Class: AuditRule // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:AuditRule' => 'Audit-Regel', 'Class:AuditRule+' => 'Eine Regel um eine gegebene Audit-Kategorie zu überprüfen', 'Class:AuditRule/Attribute:name' => 'Regelname', @@ -51,13 +52,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:AuditRule/Attribute:category_id+' => 'Kategorie für diese Regel', 'Class:AuditRule/Attribute:category_name' => 'Kategorie', 'Class:AuditRule/Attribute:category_name+' => 'Kategoriename für diese Regel', -)); +]); // // Class: AuditDomain // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:AuditDomain' => 'Audit-Domäne', 'Class:AuditDomain+' => '', 'Class:AuditDomain/Attribute:name' => 'Name', @@ -68,13 +69,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:AuditDomain/Attribute:icon+' => '', 'Class:AuditDomain/Attribute:categories_list' => 'Audit-Kategorien', 'Class:AuditDomain/Attribute:categories_list+' => 'Verknüpfte Audit-Kategorien', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Verknüpfung Audit-Kategorie / Audit-Domäne', 'Class:lnkAuditCategoryToAuditDomain+' => '', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Audit-Kategorie', @@ -85,13 +86,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => '', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Audit-Domänenname', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => '', -)); +]); // // Class: QueryOQL // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:Query' => 'Query', 'Class:Query+' => '', 'Class:Query/Attribute:name' => 'Name', @@ -118,7 +119,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:QueryOQL+' => 'Eine in der "Object Query Language" geschriebene Abfrage', 'Class:QueryOQL/Attribute:oql' => 'Ausdruck', 'Class:QueryOQL/Attribute:oql+' => 'OQL-Abfrage', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -129,7 +130,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( // Class: User // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:User' => 'Benutzer', 'Class:User+' => 'Benutzer-Login', 'Class:User/Attribute:finalclass' => 'Typ des Benutzerkontos', @@ -175,13 +176,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:User/Warning:NoContactHasImpact' => 'Vorsicht: Für diesen Benutzer ist keine Person definiert. Dadurch wird der Zugriff auf Portale, Benachrichtigungen und andere Auswirkungen im Back-Office verhindert', 'Class:UserInternal' => 'Interner Benutzer', 'Class:UserInternal+' => 'Benutzer, der innerhalb von '.ITOP_APPLICATION_SHORT.' definiert wird', -)); +]); // // Class: URP_Profiles // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:URP_Profiles' => 'Profile', 'Class:URP_Profiles+' => 'Benutzerprofile', 'Class:URP_Profiles/Attribute:name' => 'Name', @@ -190,13 +191,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:URP_Profiles/Attribute:description+' => 'Kurze Beschreibung', 'Class:URP_Profiles/Attribute:user_list' => 'Benutzer', 'Class:URP_Profiles/Attribute:user_list+' => 'Personen, die diese Rolle haben', -)); +]); // // Class: URP_Dimensions // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:URP_Dimensions' => 'Dimension', 'Class:URP_Dimensions+' => 'Anwendungsdimension (Festlegen von Silos)', 'Class:URP_Dimensions/Attribute:name' => 'Name', @@ -205,13 +206,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:URP_Dimensions/Attribute:description+' => 'Kurzbeschreibung', 'Class:URP_Dimensions/Attribute:type' => 'Typ', 'Class:URP_Dimensions/Attribute:type+' => 'Klassenname oder Datentyp (Abbildungseinheit)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:URP_UserProfile' => 'Benutzerprofil', 'Class:URP_UserProfile+' => 'Benutzerprofil', 'Class:URP_UserProfile/Name' => 'Verbindung zwischen %1$s und %2$s', @@ -225,14 +226,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:URP_UserProfile/Attribute:profile+' => 'Profil-Name', 'Class:URP_UserProfile/Attribute:reason' => 'Begründung', 'Class:URP_UserProfile/Attribute:reason+' => 'Erklären Sie, warum diese Person diese Rolle haben soll', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:URP_UserOrg' => 'Benutzerorganisationen', 'Class:URP_UserOrg+' => 'Zulässige Organisationen', 'Class:URP_UserOrg/Name' => 'Verbindung zwischen %1$s und %2$s', @@ -246,13 +246,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => '', 'Class:URP_UserOrg/Attribute:reason' => 'Begründung', 'Class:URP_UserOrg/Attribute:reason+' => 'Begründet die Berechtigung, die Daten dieser Organisation zu sehen', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:URP_ProfileProjection' => 'Profilabbildung', 'Class:URP_ProfileProjection+' => 'Profilabbildungen', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Dimension', @@ -267,13 +267,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'OQL-Ausdruck (Benutzung von $user) | konstant | | + Attribut-Code', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Attribute', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Ziel des Attribut-Codes (optional)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:URP_ClassProjection' => 'Klassenabbildung', 'Class:URP_ClassProjection+' => 'Klassenabbildungen', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Dimension', @@ -286,13 +286,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:URP_ClassProjection/Attribute:value+' => 'OQL-Audsdruck (Benutzung von $this) | konstant | | + Attribut-Code', 'Class:URP_ClassProjection/Attribute:attribute' => 'Attribute', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Ziel des Attribut-Codes (optional)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:URP_ActionGrant' => 'Autorisierungen von Aktionen', 'Class:URP_ActionGrant+' => 'Autorisierungen auf Klassen', 'Class:URP_ActionGrant/Attribute:profileid' => 'Profil', @@ -309,13 +309,13 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'Nein', 'Class:URP_ActionGrant/Attribute:action' => 'Aktion', 'Class:URP_ActionGrant/Attribute:action+' => 'Operationen, die auf die gegebene Klasse ausgeführt werden sollen', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:URP_StimulusGrant' => 'Autorisierung des Stimulus', 'Class:URP_StimulusGrant+' => 'Autorisierungen auf den Stimulus des Lebenszyklus des Objektes', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Profil', @@ -332,25 +332,25 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'Nein', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Stimulus', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'Stimulus-Code', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:URP_AttributeGrant' => 'Autorisierung des Attribute', 'Class:URP_AttributeGrant+' => 'Autorisierungen auf Attributebene', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Aktion gewähren', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'Aktion gewähren', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Attribut', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'Attribut-Code', -)); +]); // // Class: UserDashboard // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Class:UserDashboard' => 'Benutzer Dashboard', 'Class:UserDashboard+' => '', 'Class:UserDashboard/Attribute:user_id' => 'Benutzer', @@ -359,12 +359,12 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:UserDashboard/Attribute:menu_code+' => '', 'Class:UserDashboard/Attribute:contents' => 'Inhalt', 'Class:UserDashboard/Attribute:contents+' => '', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:WelcomeMenu' => 'Willkommen', 'Menu:WelcomeMenu+' => 'Willkommen bei '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage' => 'Willkommen', 'Menu:WelcomeMenuPage+' => 'Willkommen bei '.ITOP_APPLICATION_SHORT, 'Menu:AdminTools' => 'Admin-Tools', @@ -381,14 +381,14 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Menu:MyShortcuts' => 'Meine Shortcuts', 'Menu:Notifications:Title' => 'Audit-Kategorien', 'Menu:DataAdministration' => 'Data Management', - 'Menu:DataAdministration+' => 'Data Management' -)); + 'Menu:DataAdministration+' => 'Data Management', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'BooleanLabel:yes' => 'Ja', 'BooleanLabel:no' => 'Nein', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.' Login', @@ -1533,13 +1533,13 @@ Wenn Aktionen mit Trigger verknüpft sind, bekommt jede Aktion eine Auftragsnumm 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Kinderelemente ausgewählter Objekte werden berücksichtigt.', 'UI:Search:Criteria:Raw:Filtered' => 'Gefiltert', 'UI:Search:Criteria:Raw:FilteredOn' => 'Gefiltert über %1$s', - 'UI:StateChanged' => 'Status geändert' -)); + 'UI:StateChanged' => 'Status geändert', +]); // // Expression to Natural language // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Expression:Operator:AND' => ' UND ', 'Expression:Operator:OR' => ' ODER ', 'Expression:Operator:=' => ': ', @@ -1552,12 +1552,12 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Expression:Unit:Long:MINUTE' => 'Minute(n)', 'Expression:Verb:NOW' => 'jetzt', 'Expression:Verb:ISNULL' => ': nicht definiert', -)); +]); // // iTop Newsroom menu // -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'UI:Newsroom:NoNewMessage' => 'Keine neue Nachricht', 'UI:Newsroom:XNewMessage' => '%1$s neue Nachrichten', 'UI:Newsroom:MarkAllAsRead' => 'Alle Nachrichten als gelesen markieren', @@ -1572,10 +1572,9 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Dringend', 'UI:Newsroom:Priority:3:Tooltip' => 'Wichtig', 'UI:Newsroom:Priority:4:Tooltip' => 'Normal', -)); +]); - -Dict::Add('DE DE', 'German', 'Deutsch', array( +Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:DataSources' => 'Datenquellen für die Synchronisation', 'Menu:DataSources+' => 'Alle Datenquellen für die Synchronisation', 'Menu:AuditCategories' => 'Audit-Kategorien', @@ -1603,4 +1602,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Menu:Integrations' => 'Integrationen', 'Menu:Integrations+' => '', -)); +]); diff --git a/dictionaries/en.dictionary.itop.core.php b/dictionaries/en.dictionary.itop.core.php index de4e7731a..8c805c81b 100644 --- a/dictionaries/en.dictionary.itop.core.php +++ b/dictionaries/en.dictionary.itop.core.php @@ -1,4 +1,5 @@ */ -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Core:DeletedObjectLabel' => '%1s (deleted)', 'Core:DeletedObjectTip' => 'The object has been deleted on %1$s (%2$s)', @@ -215,8 +216,7 @@ Operators:
          'Core:Context=GUI:Console' => 'Console', 'Core:Context=CRON' => 'cron', 'Core:Context=GUI:Portal' => 'Portal', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -227,7 +227,7 @@ Operators:
          // Class: CMDBChange // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:CMDBChange' => 'Change', 'Class:CMDBChange+' => 'Changes tracking', 'Class:CMDBChange/Attribute:date' => 'date', @@ -242,13 +242,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON webservices', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP webservices', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'By an extension', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:CMDBChangeOp' => 'Change Operation', 'Class:CMDBChangeOp+' => 'Change made by one person, at a single time, on a single object', 'Class:CMDBChangeOp/Attribute:change' => 'change', @@ -263,51 +263,51 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:CMDBChangeOp/Attribute:objkey+' => 'id of the object on which the change was made', 'Class:CMDBChangeOp/Attribute:finalclass' => 'CMDBChangeOp sub-class', 'Class:CMDBChangeOp/Attribute:finalclass+' => 'type of change which was performed', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:CMDBChangeOpCreate' => 'object creation', 'Class:CMDBChangeOpCreate+' => 'Object creation tracking', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:CMDBChangeOpDelete' => 'object deletion', 'Class:CMDBChangeOpDelete+' => 'Object deletion tracking', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:CMDBChangeOpSetAttribute' => 'object change', 'Class:CMDBChangeOpSetAttribute+' => 'Object properties change tracking', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Attribute', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'code of the modified property', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'property change', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Object scalar properties change tracking', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Previous value', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => 'previous value of the attribute', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'New value', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => 'new value of the attribute', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Change:ObjectCreated' => 'Object created', 'Change:ObjectDeleted' => 'Object deleted', 'Change:ObjectModified' => 'Object modified', @@ -324,35 +324,35 @@ Dict::Add('EN US', 'English', 'English', array( 'Change:LinkSet:Added' => 'added %1$s', 'Change:LinkSet:Removed' => 'removed %1$s', 'Change:LinkSet:Modified' => 'modified %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'data change', 'Class:CMDBChangeOpSetAttributeBlob+' => 'data change tracking', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Previous data', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => 'previous contents of the attribute', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:CMDBChangeOpSetAttributeText' => 'text change', 'Class:CMDBChangeOpSetAttributeText+' => 'text change tracking', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Previous data', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'previous contents of the attribute', -)); +]); // // Class: Event // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Event' => 'Log Event', 'Class:Event+' => 'An application internal event', 'Class:Event/Attribute:message' => 'Message', @@ -363,13 +363,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Event/Attribute:userinfo+' => 'identification of the user that was doing the action that triggered this event', 'Class:Event/Attribute:finalclass' => 'Event sub-class', 'Class:Event/Attribute:finalclass+' => 'Name of the final class: specifies the sort of event which occurred', -)); +]); // // Class: EventNotification // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:EventNotification' => 'Notification sent', 'Class:EventNotification+' => 'Trace of a notification that has been sent', 'Class:EventNotification/Attribute:trigger_id' => 'Trigger', @@ -378,13 +378,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:EventNotification/Attribute:action_id+' => '', 'Class:EventNotification/Attribute:object_id' => 'Object id', 'Class:EventNotification/Attribute:object_id+' => 'object id (class defined by the trigger ?)', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:EventNotificationEmail' => 'Email sent', 'Class:EventNotificationEmail+' => 'Trace of an email that has been sent', 'Class:EventNotificationEmail/Attribute:to' => 'TO', @@ -401,13 +401,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:EventNotificationEmail/Attribute:body+' => '', 'Class:EventNotificationEmail/Attribute:attachments' => 'Attachments', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:EventIssue' => 'Issue event', 'Class:EventIssue+' => 'Trace of an issue (warning, error, etc.)', 'Class:EventIssue/Attribute:issue' => 'Issue', @@ -424,13 +424,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:EventIssue/Attribute:callstack+' => '', 'Class:EventIssue/Attribute:data' => 'Data', 'Class:EventIssue/Attribute:data+' => 'More information', -)); +]); // // Class: EventWebService // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:EventWebService' => 'Web service event', 'Class:EventWebService+' => 'Trace of a web service call', 'Class:EventWebService/Attribute:verb' => 'Verb', @@ -445,9 +445,9 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:EventWebService/Attribute:log_error+' => 'Result error log', 'Class:EventWebService/Attribute:data' => 'Data', 'Class:EventWebService/Attribute:data+' => 'Result data', -)); +]); -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:EventRestService' => 'REST/JSON call', 'Class:EventRestService+' => 'Trace of a REST/JSON service call', 'Class:EventRestService/Attribute:operation' => 'Operation', @@ -462,13 +462,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:EventRestService/Attribute:json_output+' => 'HTTP response (json)', 'Class:EventRestService/Attribute:provider' => 'Provider', 'Class:EventRestService/Attribute:provider+' => 'PHP class implementing the expected operation', -)); +]); // // Class: EventLoginUsage // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:EventLoginUsage' => 'Login Usage', 'Class:EventLoginUsage+' => 'Connection to the application', 'Class:EventLoginUsage/Attribute:user_id' => 'Login', @@ -477,13 +477,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '', 'Class:EventLoginUsage/Attribute:contact_email' => 'User Email', 'Class:EventLoginUsage/Attribute:contact_email+' => 'Email Address of the User', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:EventNotificationNewsroom' => 'News sent', 'Class:EventNotificationNewsroom+' => '', 'Class:EventNotificationNewsroom/Attribute:title' => 'Title', @@ -512,13 +512,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '', -)); +]); // // Class: Action // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Action' => 'Action', 'Class:Action+' => 'User defined action', 'Class:Action/ComplementaryName' => '%1$s: %2$s', @@ -548,24 +548,24 @@ Dict::Add('EN US', 'English', 'English', array( 'Action:last_executions_tab_panel_title' => 'Executions of this action (%1$s)', 'Action:last_executions_tab_limit_days' => 'past %1$s days', 'Action:last_executions_tab_limit_none' => 'no limit', -)); +]); // // Class: ActionNotification // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ActionNotification' => 'Notification Action', 'Class:ActionNotification+' => 'Notification Action (abstract)', 'Class:ActionNotification/Attribute:language' => 'Language', 'Class:ActionNotification/Attribute:language+' => '', -)); +]); // // Class: ActionEmail // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ActionEmail' => 'Notification by Email', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'This status drives who will be notified: @@ -634,14 +634,13 @@ While editing, click on the magnifier to get pertinent examples', 'ActionEmail:preview_warning' => 'The actual eMail may look different in the eMail client than this preview in your browser.', 'ActionEmail:preview_more_info' => 'For more information about the CSS features supported by the different eMail clients, refer to %1$s', 'ActionEmail:content_placeholder_missing' => 'The placeholder "%1$s" was not found in the HTML template. The content of the field "%2$s" will not be included in the generated emails.', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'ActionNewsroom:trigger' => 'Trigger', 'ActionNewsroom:content' => 'Message', 'ActionNewsroom:settings' => 'Settings', @@ -676,13 +675,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'An OQL query returning Contact objects', 'Class:ActionNewsroom/Attribute:url' => 'URL', 'Class:ActionNewsroom/Attribute:url+' => 'By default, it points to the object triggering the notification. But you can also specify a custom URL.', -)); +]); // // Class: Trigger // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Trigger' => 'Trigger', 'Class:Trigger+' => 'Custom event handler', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s', @@ -701,13 +700,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Allow complete unsubscription', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Force at least one channel (News or Email)', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Deny unsubscription', -)); +]); // // Class: TriggerOnObject // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TriggerOnObject' => 'Trigger (class dependent)', 'Class:TriggerOnObject+' => 'Trigger on a given class of objects', 'Class:TriggerOnObject/Attribute:target_class' => 'Target class', @@ -716,115 +715,115 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Limit the object list (of the target class) which will activate the trigger', 'TriggerOnObject:WrongFilterQuery' => 'Wrong filter query: %1$s', 'TriggerOnObject:WrongFilterClass' => 'The filter query must return objects of class "%1$s"', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TriggerOnPortalUpdate' => 'Trigger (when updated from the portal)', 'Class:TriggerOnPortalUpdate+' => 'Trigger on an end-user\'s update from the portal', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TriggerOnStateChange' => 'Trigger (on state change)', 'Class:TriggerOnStateChange+' => 'Trigger on object state change', 'Class:TriggerOnStateChange/Attribute:state' => 'State', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TriggerOnStateEnter' => 'Trigger (on entering a state)', 'Class:TriggerOnStateEnter+' => 'Trigger on object state change - entering', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TriggerOnStateLeave' => 'Trigger (on leaving a state)', 'Class:TriggerOnStateLeave+' => 'Trigger on object state change - leaving', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TriggerOnObjectCreate' => 'Trigger (on object creation)', 'Class:TriggerOnObjectCreate+' => 'Trigger on object creation of [a child class of] the given class', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TriggerOnObjectDelete' => 'Trigger (on object deletion)', 'Class:TriggerOnObjectDelete+' => 'Trigger on object deletion of [a child class of] the given class', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TriggerOnObjectUpdate' => 'Trigger (on object update)', 'Class:TriggerOnObjectUpdate+' => 'Trigger on object update of [a child class of] the given class', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Target fields', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TriggerOnObjectMention' => 'Trigger (on object mention)', 'Class:TriggerOnObjectMention+' => 'Trigger on mention (@xxx) of an object of [a child class of] the given class in a log attribute', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Mentioned filter', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Limit the list of mentioned objects which will activate the trigger. If empty, any mentioned object (of any class) will activate it.', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TriggerOnAttributeBlobDownload' => 'Trigger (on object\'s document download)', 'Class:TriggerOnAttributeBlobDownload+' => 'Trigger on object\'s document field download of [a child class of] the given class', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Target fields', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TriggerOnThresholdReached' => 'Trigger (on threshold)', 'Class:TriggerOnThresholdReached+' => 'Trigger on Stop-Watch threshold reached', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Stop watch', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Threshold', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkTriggerAction' => 'Action/Trigger', 'Class:lnkTriggerAction+' => 'Link between a trigger and an action', 'Class:lnkTriggerAction/Attribute:action_id' => 'Action', @@ -837,12 +836,12 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Order', 'Class:lnkTriggerAction/Attribute:order+' => 'Actions execution order', -)); +]); // // Synchro Data Source // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:SynchroDataSource' => 'Synchro Data Source', 'Class:SynchroDataSource/Attribute:name' => 'Name', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1141,12 +1140,12 @@ The hyperlink is displayed in the tooltip appearing on the “Lock” symbol of 'Core:Validator:Mandatory' => 'Please, fill this field', 'Core:Validator:MustBeInteger' => 'Must be an integer', 'Core:Validator:MustSelectOne' => 'Please, select one', -)); +]); // // Class: TagSetFieldData // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:TagSetFieldData' => '%2$s for class %1$s', 'Class:TagSetFieldData+' => '', @@ -1170,12 +1169,12 @@ Dict::Add('EN US', 'English', 'English', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Tags "Attribute Code" cannot be changed', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Tag usage (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => 'No entry found for this tag', -)); +]); // // Class: DBProperty // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:DBProperty' => 'DB property', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Name', @@ -1188,12 +1187,12 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Change comment', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:BackgroundTask' => 'Background task', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Class name', @@ -1218,12 +1217,12 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'Status', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:AsyncTask' => 'Async. task', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Created', @@ -1246,45 +1245,42 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:AsyncTask/Attribute:last_error+' => '', 'Class:AsyncTask/Attribute:last_attempt' => 'Last attempt', 'Class:AsyncTask/Attribute:last_attempt+' => '', - 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]". Expecting an array with the following keys: %2$s', - 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]": unexpected key "%2$s". Expecting only the following keys: %3$s', -)); + 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]". Expecting an array with the following keys: %2$s', + 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]": unexpected key "%2$s". Expecting only the following keys: %3$s', +]); // // Class: AbstractResource // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:AbstractResource' => 'Abstract Resource', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ResourceAdminMenu' => 'Resource Admin Menu', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ResourceRunQueriesMenu' => 'Resource Run Queries Menu', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:ResourceSystemMenu' => 'Resource System Menu', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/en.dictionary.itop.ui.php b/dictionaries/en.dictionary.itop.ui.php index 584b572f9..f40702032 100644 --- a/dictionaries/en.dictionary.itop.ui.php +++ b/dictionaries/en.dictionary.itop.ui.php @@ -1,10 +1,10 @@ 'Audit Category', 'Class:AuditCategory+' => 'Audit category defines a scope of objects which needs to be audited. It groups all audit rules applying to that object scope', @@ -37,13 +37,13 @@ It groups all audit rules applying to that object scope', 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Percentage of invalid objects below which the result is in error (red)', 'Class:AuditCategory/Attribute:domains_list' => 'Domains', 'Class:AuditCategory/Attribute:domains_list+' => 'Domains which include this category', -)); +]); // // Class: AuditRule // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:AuditRule' => 'Audit Rule', 'Class:AuditRule+' => 'An audit rule corresponds a single check within an audit category. It is applied on the scope of objects defined by the audit category', @@ -65,13 +65,13 @@ It is applied on the scope of objects defined by the audit category', 'Class:AuditRule/Attribute:category_id+' => 'The category of this rule', 'Class:AuditRule/Attribute:category_name' => 'Category name', 'Class:AuditRule/Attribute:category_name+' => 'Name of the category of this rule', -)); +]); // // Class: AuditDomain // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:AuditDomain' => 'Audit Domain', 'Class:AuditDomain+' => 'Audit domains allow to group the audit categories. Domain usually correspond to who is responsible for checking and fixing errors', @@ -83,13 +83,13 @@ Domain usually correspond to who is responsible for checking and fixing errors', 'Class:AuditDomain/Attribute:icon+' => '', 'Class:AuditDomain/Attribute:categories_list' => 'Categories', 'Class:AuditDomain/Attribute:categories_list+' => 'Related audit categories. When running the audit on a domain, all related audit categories are checked and only those.', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Link AuditCategory / AuditDomain', 'Class:lnkAuditCategoryToAuditDomain+' => '', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Category', @@ -100,13 +100,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Audit domain', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Domain name', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Audit domain name', -)); +]); // // Class: QueryOQL // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:Query' => 'Query', 'Class:Query+' => 'A query is a data set defined in a dynamic way', 'Class:Query/Attribute:name' => 'Name', @@ -133,7 +133,7 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:QueryOQL+' => 'A query based on the Object Query Language', 'Class:QueryOQL/Attribute:oql' => 'Expression', 'Class:QueryOQL/Attribute:oql+' => 'OQL Expression', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -144,7 +144,7 @@ Dict::Add('EN US', 'English', 'English', array( // Class: User // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:User' => 'User', 'Class:User+' => 'User login', 'Class:User/Attribute:finalclass' => 'Type of account', @@ -191,13 +191,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:User/Warning:NoContactHasImpact' => 'Cautious: there is no Person defined on this User, this prevents access to portals, news notifications and other side effects in back-office', 'Class:UserInternal' => 'User Internal', 'Class:UserInternal+' => 'User defined within '.ITOP_APPLICATION_SHORT, -)); +]); // // Class: URP_Profiles // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:URP_Profiles' => 'Profile', 'Class:URP_Profiles+' => 'User profile', 'Class:URP_Profiles/Attribute:name' => 'Name', @@ -206,13 +206,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:URP_Profiles/Attribute:description+' => 'one line description', 'Class:URP_Profiles/Attribute:user_list' => 'Users', 'Class:URP_Profiles/Attribute:user_list+' => 'persons having this role', -)); +]); // // Class: URP_Dimensions // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:URP_Dimensions' => 'dimension', 'Class:URP_Dimensions+' => 'application dimension (defining silos)', 'Class:URP_Dimensions/Attribute:name' => 'Name', @@ -221,13 +221,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:URP_Dimensions/Attribute:description+' => 'one line description', 'Class:URP_Dimensions/Attribute:type' => 'Type', 'Class:URP_Dimensions/Attribute:type+' => 'class name or data type (projection unit)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:URP_UserProfile' => 'User to profile', 'Class:URP_UserProfile+' => 'user profiles', 'Class:URP_UserProfile/Name' => 'Link between %1$s and %2$s', @@ -241,14 +241,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:URP_UserProfile/Attribute:profile+' => 'Profile name', 'Class:URP_UserProfile/Attribute:reason' => 'Reason', 'Class:URP_UserProfile/Attribute:reason+' => 'explain why this person may have this role', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:URP_UserOrg' => 'User organizations', 'Class:URP_UserOrg+' => 'Allowed organizations', 'Class:URP_UserOrg/Name' => 'Link between %1$s and %2$s', @@ -262,13 +261,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => 'Allowed organization', 'Class:URP_UserOrg/Attribute:reason' => 'Reason', 'Class:URP_UserOrg/Attribute:reason+' => 'explain why this person is allowed to see the data belonging to this organization', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:URP_ProfileProjection' => 'profile_projection', 'Class:URP_ProfileProjection+' => 'profile projections', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Dimension', @@ -283,13 +282,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'OQL expression (using $user) | constant | | +attribute code', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Attribute', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Target attribute code (optional)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:URP_ClassProjection' => 'class_projection', 'Class:URP_ClassProjection+' => 'class projections', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Dimension', @@ -302,13 +301,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:URP_ClassProjection/Attribute:value+' => 'OQL expression (using $this) | constant | | +attribute code', 'Class:URP_ClassProjection/Attribute:attribute' => 'Attribute', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Target attribute code (optional)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:URP_ActionGrant' => 'action_permission', 'Class:URP_ActionGrant+' => 'permissions on classes', 'Class:URP_ActionGrant/Attribute:profileid' => 'Profile', @@ -325,13 +324,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'no', 'Class:URP_ActionGrant/Attribute:action' => 'Action', 'Class:URP_ActionGrant/Attribute:action+' => 'operations to perform on the given class', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:URP_StimulusGrant' => 'stimulus_permission', 'Class:URP_StimulusGrant+' => 'permissions on stimulus in the life cycle of the object', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Profile', @@ -348,25 +347,25 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'no', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Stimulus', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'stimulus code', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:URP_AttributeGrant' => 'attribute_permission', 'Class:URP_AttributeGrant+' => 'permissions at the attributes level', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Action grant', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'action grant', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Attribute', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'attribute code', -)); +]); // // Class: UserDashboard // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Class:UserDashboard' => 'User dashboard', 'Class:UserDashboard+' => '', 'Class:UserDashboard/Attribute:user_id' => 'User', @@ -375,12 +374,12 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:UserDashboard/Attribute:menu_code+' => '', 'Class:UserDashboard/Attribute:contents' => 'Contents', 'Class:UserDashboard/Attribute:contents+' => '', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Menu:WelcomeMenu' => 'Welcome', 'Menu:WelcomeMenu+' => 'Welcome to '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage' => 'Welcome', @@ -399,13 +398,13 @@ Dict::Add('EN US', 'English', 'English', array( 'Menu:MyShortcuts' => 'My Shortcuts', 'Menu:DataAdministration' => 'Data administration', 'Menu:DataAdministration+' => '', -)); +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'BooleanLabel:yes' => 'yes', 'BooleanLabel:no' => 'no', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.' login', @@ -780,7 +779,6 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:Audit:Dashboard:ObjectsValidated' => 'Objects validated', 'UI:Audit:AuditCategory:Subtitle' => '%1$s errors ouf of %2$s - %3$s%% of the object are valid', - 'UI:RunQuery:Title' => ITOP_APPLICATION_SHORT.' - OQL Query Evaluation', 'UI:RunQuery:QueryExamples' => 'Query Examples', 'UI:RunQuery:QueryResults' => 'Query Results', @@ -1272,7 +1270,6 @@ When associated with a trigger, each action is given an "order" number, specifyi 'UI:Dashboard:Actions' => 'Dashboard actions', 'UI:Dashboard:NotUpToDateUntilContainerSaved' => 'This dashboard displays information that does not include the on-going changes.', - 'UI:DashletCreation:Title' => 'Create a new Dashlet', 'UI:DashletCreation:Dashboard' => 'Dashboard', 'UI:DashletCreation:DashletType' => 'Dashlet Type', @@ -1646,12 +1643,12 @@ When associated with a trigger, each action is given an "order" number, specifyi 'UI:Search:Criteria:Raw:FilteredOn' => 'Filtered on %1$s', 'UI:StateChanged' => 'State changed', -)); +]); // // Expression to Natural language // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Expression:Operator:AND' => ' AND ', 'Expression:Operator:OR' => ' OR ', 'Expression:Operator:=' => ': ', @@ -1667,12 +1664,12 @@ Dict::Add('EN US', 'English', 'English', array( 'Expression:Verb:NOW' => 'now', 'Expression:Verb:ISNULL' => ': undefined', -)); +]); // // iTop Newsroom menu // -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'UI:Newsroom:NoNewMessage' => 'No new message', 'UI:Newsroom:XNewMessage' => '%1$s new message(s)', 'UI:Newsroom:MarkAllAsRead' => 'Mark all messages as read', @@ -1687,10 +1684,9 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgent', 'UI:Newsroom:Priority:3:Tooltip' => 'Important', 'UI:Newsroom:Priority:4:Tooltip' => 'Normal', -)); +]); - -Dict::Add('EN US', 'English', 'English', array( +Dict::Add('EN US', 'English', 'English', [ 'Menu:DataSources' => 'Synchronization Data Sources', 'Menu:DataSources+' => 'Data synchro used for batch import of external data', 'Menu:AuditCategories' => 'Audit configuration', @@ -1718,4 +1714,4 @@ Dict::Add('EN US', 'English', 'English', array( 'Menu:Integrations' => 'Integrations', 'Menu:Integrations+' => '', -)); +]); diff --git a/dictionaries/en_gb.dictionary.itop.core.php b/dictionaries/en_gb.dictionary.itop.core.php index 15d0873bb..e02fa6352 100644 --- a/dictionaries/en_gb.dictionary.itop.core.php +++ b/dictionaries/en_gb.dictionary.itop.core.php @@ -1,4 +1,5 @@ '%1s (deleted)', 'Core:DeletedObjectTip' => 'The object has been deleted on %1$s (%2$s)', @@ -200,8 +201,7 @@ Operators:
          'Core:Context=GUI:Console' => 'Console', 'Core:Context=CRON' => 'cron', 'Core:Context=GUI:Portal' => 'Portal', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -212,7 +212,7 @@ Operators:
          // Class: CMDBChange // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:CMDBChange' => 'Change', 'Class:CMDBChange+' => 'Changes tracking', 'Class:CMDBChange/Attribute:date' => 'date', @@ -227,13 +227,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON web services', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP web services', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'By an extension', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:CMDBChangeOp' => 'Change Operation', 'Class:CMDBChangeOp+' => 'Change made by one person, at a single time, on a single object', 'Class:CMDBChangeOp/Attribute:change' => 'change', @@ -248,51 +248,51 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:CMDBChangeOp/Attribute:objkey+' => 'id of the object on which the change was made', 'Class:CMDBChangeOp/Attribute:finalclass' => 'CMDBChangeOp sub-class', 'Class:CMDBChangeOp/Attribute:finalclass+' => 'type of change which was performed', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:CMDBChangeOpCreate' => 'object creation', 'Class:CMDBChangeOpCreate+' => 'Object creation tracking', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:CMDBChangeOpDelete' => 'object deletion', 'Class:CMDBChangeOpDelete+' => 'Object deletion tracking', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:CMDBChangeOpSetAttribute' => 'object change', 'Class:CMDBChangeOpSetAttribute+' => 'Object properties change tracking', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Attribute', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'code of the modified property', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'property change', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Object scalar properties change tracking', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Previous value', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => 'previous value of the attribute', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'New value', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => 'new value of the attribute', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Change:ObjectCreated' => 'Object created', 'Change:ObjectDeleted' => 'Object deleted', 'Change:ObjectModified' => 'Object modified', @@ -309,35 +309,35 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Change:LinkSet:Added' => 'added %1$s', 'Change:LinkSet:Removed' => 'removed %1$s', 'Change:LinkSet:Modified' => 'modified %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'data change', 'Class:CMDBChangeOpSetAttributeBlob+' => 'data change tracking', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Previous data', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => 'previous contents of the attribute', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:CMDBChangeOpSetAttributeText' => 'text change', 'Class:CMDBChangeOpSetAttributeText+' => 'text change tracking', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Previous data', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'previous contents of the attribute', -)); +]); // // Class: Event // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Event' => 'Log Event', 'Class:Event+' => 'An application internal event', 'Class:Event/Attribute:message' => 'Message', @@ -348,13 +348,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Event/Attribute:userinfo+' => 'identification of the user that was doing the action that triggered this event', 'Class:Event/Attribute:finalclass' => 'Event sub-class', 'Class:Event/Attribute:finalclass+' => 'Name of the final class: specifies the sort of event which occurred', -)); +]); // // Class: EventNotification // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:EventNotification' => 'Notification sent', 'Class:EventNotification+' => 'Trace of a notification that has been sent', 'Class:EventNotification/Attribute:trigger_id' => 'Trigger', @@ -365,13 +365,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:EventNotification/Attribute:object_id+' => '', 'Class:EventNotification/Attribute:object_class' => 'Object class', 'Class:EventNotification/Attribute:object_class+' => 'Object class (Same as trigger)', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:EventNotificationEmail' => 'Email sent', 'Class:EventNotificationEmail+' => 'Trace of an email that has been sent', 'Class:EventNotificationEmail/Attribute:to' => 'TO', @@ -388,13 +388,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:EventNotificationEmail/Attribute:body+' => '', 'Class:EventNotificationEmail/Attribute:attachments' => 'Attachments', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:EventIssue' => 'Issue event', 'Class:EventIssue+' => 'Trace of an issue (warning, error, etc.)', 'Class:EventIssue/Attribute:issue' => 'Issue', @@ -411,13 +411,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:EventIssue/Attribute:callstack+' => '', 'Class:EventIssue/Attribute:data' => 'Data', 'Class:EventIssue/Attribute:data+' => 'More information', -)); +]); // // Class: EventWebService // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:EventWebService' => 'Web service event', 'Class:EventWebService+' => 'Trace of a web service call', 'Class:EventWebService/Attribute:verb' => 'Verb', @@ -432,9 +432,9 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:EventWebService/Attribute:log_error+' => 'Result error log', 'Class:EventWebService/Attribute:data' => 'Data', 'Class:EventWebService/Attribute:data+' => 'Result data', -)); +]); -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:EventRestService' => 'REST/JSON call', 'Class:EventRestService+' => 'Trace of a REST/JSON service call', 'Class:EventRestService/Attribute:operation' => 'Operation', @@ -449,13 +449,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:EventRestService/Attribute:json_output+' => 'HTTP response (json)', 'Class:EventRestService/Attribute:provider' => 'Provider', 'Class:EventRestService/Attribute:provider+' => 'PHP class implementing the expected operation', -)); +]); // // Class: EventLoginUsage // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:EventLoginUsage' => 'Login Usage', 'Class:EventLoginUsage+' => 'Connection to the application', 'Class:EventLoginUsage/Attribute:user_id' => 'Login', @@ -464,13 +464,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '', 'Class:EventLoginUsage/Attribute:contact_email' => 'User Email', 'Class:EventLoginUsage/Attribute:contact_email+' => 'Email Address of the User', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:EventNotificationNewsroom' => 'News sent', 'Class:EventNotificationNewsroom+' => '', 'Class:EventNotificationNewsroom/Attribute:title' => 'Title', @@ -499,13 +499,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '', -)); +]); // // Class: Action // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Action' => 'Action', 'Class:Action+' => 'User defined action', 'Class:Action/ComplementaryName' => '%1$s: %2$s', @@ -535,24 +535,24 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Action:last_executions_tab_panel_title' => 'Executions of this action (%1$s)', 'Action:last_executions_tab_limit_days' => 'past %1$s days', 'Action:last_executions_tab_limit_none' => 'no limit', -)); +]); // // Class: ActionNotification // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ActionNotification' => 'Notification Action', 'Class:ActionNotification+' => 'Notification Action (abstract)', 'Class:ActionNotification/Attribute:language' => 'Language', 'Class:ActionNotification/Attribute:language+' => '', -)); +]); // // Class: ActionEmail // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ActionEmail' => 'Notification by Email', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'This status drives who will be notified: @@ -621,14 +621,13 @@ While editing, click on the magnifier to get pertinent examples', 'ActionEmail:preview_warning' => 'The actual eMail may look different in the eMail client than this preview in your browser.', 'ActionEmail:preview_more_info' => 'For more information about the CSS features supported by the different eMail clients, refer to %1$s', 'ActionEmail:content_placeholder_missing' => 'The placeholder "%1$s" was not found in the HTML template. The content of the field "%2$s" will not be included in the generated emails.', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'ActionNewsroom:trigger' => 'Trigger', 'ActionNewsroom:content' => 'Message', 'ActionNewsroom:settings' => 'Settings', @@ -663,13 +662,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'An OQL query returning Contact objects', 'Class:ActionNewsroom/Attribute:url' => 'URL', 'Class:ActionNewsroom/Attribute:url+' => 'By default, it points to the object triggering the notification. But you can also specify a custom URL.', -)); +]); // // Class: Trigger // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Trigger' => 'Trigger', 'Class:Trigger+' => 'Custom event handler', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s', @@ -688,13 +687,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Allow complete unsubscribing', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Force at least one channel (News or Email)', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Deny unsubscription', -)); +]); // // Class: TriggerOnObject // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TriggerOnObject' => 'Trigger (class dependent)', 'Class:TriggerOnObject+' => 'Trigger on a given class of objects', 'Class:TriggerOnObject/Attribute:target_class' => 'Target class', @@ -703,115 +702,115 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Limit the object list (of the target class) which will activate the trigger', 'TriggerOnObject:WrongFilterQuery' => 'Wrong filter query: %1$s', 'TriggerOnObject:WrongFilterClass' => 'The filter query must return objects of class "%1$s"', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TriggerOnPortalUpdate' => 'Trigger (when updated from the portal)', 'Class:TriggerOnPortalUpdate+' => 'Trigger on an end-user\'s update from the portal', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TriggerOnStateChange' => 'Trigger (on state change)', 'Class:TriggerOnStateChange+' => 'Trigger on object state change', 'Class:TriggerOnStateChange/Attribute:state' => 'State', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TriggerOnStateEnter' => 'Trigger (on entering a state)', 'Class:TriggerOnStateEnter+' => 'Trigger on object state change - entering', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TriggerOnStateLeave' => 'Trigger (on leaving a state)', 'Class:TriggerOnStateLeave+' => 'Trigger on object state change - leaving', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TriggerOnObjectCreate' => 'Trigger (on object creation)', 'Class:TriggerOnObjectCreate+' => 'Trigger on object creation of [a child class of] the given class', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TriggerOnObjectDelete' => 'Trigger (on object deletion)', 'Class:TriggerOnObjectDelete+' => 'Trigger on object deletion of [a child class of] the given class', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TriggerOnObjectUpdate' => 'Trigger (on object update)', 'Class:TriggerOnObjectUpdate+' => 'Trigger on object update of [a child class of] the given class', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Target fields', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TriggerOnObjectMention' => 'Trigger (on object mention)', 'Class:TriggerOnObjectMention+' => 'Trigger on mention (@xxx) of an object of [a child class of] the given class in a log attribute', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Mentioned filter', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Limit the list of mentioned objects which will activate the trigger. If empty, any mentioned object (of any class) will activate it.', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TriggerOnAttributeBlobDownload' => 'Trigger (on object\'s document download)', 'Class:TriggerOnAttributeBlobDownload+' => 'Trigger on object\'s document field download of [a child class of] the given class', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Target fields', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TriggerOnThresholdReached' => 'Trigger (on threshold)', 'Class:TriggerOnThresholdReached+' => 'Trigger on Stop-Watch threshold reached', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Stopwatch', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Threshold', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkTriggerAction' => 'Action/Trigger', 'Class:lnkTriggerAction+' => 'Link between a trigger and an action', 'Class:lnkTriggerAction/Attribute:action_id' => 'Action', @@ -824,12 +823,12 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Order', 'Class:lnkTriggerAction/Attribute:order+' => 'Actions execution order', -)); +]); // // Synchro Data Source // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:SynchroDataSource' => 'Synchro Data Source', 'Class:SynchroDataSource/Attribute:name' => 'Name', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1128,12 +1127,12 @@ The hyperlink is displayed in the tooltip appearing on the “Lock” symbol of 'Core:Validator:Mandatory' => 'Please, fill this field', 'Core:Validator:MustBeInteger' => 'Must be an integer', 'Core:Validator:MustSelectOne' => 'Please, select one', -)); +]); // // Class: TagSetFieldData // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:TagSetFieldData' => '%2$s for class %1$s', 'Class:TagSetFieldData+' => '', @@ -1157,12 +1156,12 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Tags "Attribute Code" cannot be changed', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Tag usage (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => 'No entry found for this tag', -)); +]); // // Class: DBProperty // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:DBProperty' => 'DB property', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Name', @@ -1175,12 +1174,12 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Change comment', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:BackgroundTask' => 'Background task', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Class name', @@ -1205,12 +1204,12 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'Status', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:AsyncTask' => 'Async. task', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Created', @@ -1235,43 +1234,40 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:AsyncTask/Attribute:last_attempt+' => '', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]". Expecting an array with the following keys: %2$s', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]": unexpected key "%2$s". Expecting only the following keys: %3$s', -)); +]); // // Class: AbstractResource // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:AbstractResource' => 'Abstract Resource', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ResourceAdminMenu' => 'Resource Admin Menu', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ResourceRunQueriesMenu' => 'Resource Run Queries Menu', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:ResourceSystemMenu' => 'Resource System Menu', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/en_gb.dictionary.itop.ui.php b/dictionaries/en_gb.dictionary.itop.ui.php index 4238e6087..b9e9201b0 100644 --- a/dictionaries/en_gb.dictionary.itop.ui.php +++ b/dictionaries/en_gb.dictionary.itop.ui.php @@ -1,10 +1,10 @@ 'Audit Category', 'Class:AuditCategory+' => 'Audit category defines a scope of objects which needs to be audited. It groups all audit rules applying to that object scope', @@ -37,13 +37,13 @@ It groups all audit rules applying to that object scope', 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Percentage of invalid objects below which the result is in error (red)', 'Class:AuditCategory/Attribute:domains_list' => 'Domains', 'Class:AuditCategory/Attribute:domains_list+' => 'Domains which include this category', -)); +]); // // Class: AuditRule // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:AuditRule' => 'Audit Rule', 'Class:AuditRule+' => 'An audit rule corresponds a single check within an audit category. It is applied on the scope of objects defined by the audit category', @@ -65,13 +65,13 @@ It is applied on the scope of objects defined by the audit category', 'Class:AuditRule/Attribute:category_id+' => 'The category of this rule', 'Class:AuditRule/Attribute:category_name' => 'Category name', 'Class:AuditRule/Attribute:category_name+' => 'Name of the category of this rule', -)); +]); // // Class: AuditDomain // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:AuditDomain' => 'Audit Domain', 'Class:AuditDomain+' => 'Audit domains allow to group the audit categories. Domain usually correspond to who is responsible for checking and fixing errors', @@ -83,13 +83,13 @@ Domain usually correspond to who is responsible for checking and fixing errors', 'Class:AuditDomain/Attribute:icon+' => '', 'Class:AuditDomain/Attribute:categories_list' => 'Categories', 'Class:AuditDomain/Attribute:categories_list+' => 'Related audit categories. When running the audit on a domain, all related audit categories are checked and only those.', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Link AuditCategory / AuditDomain', 'Class:lnkAuditCategoryToAuditDomain+' => '', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Category', @@ -100,13 +100,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Audit domain', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Domain name', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Audit domain name', -)); +]); // // Class: QueryOQL // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:Query' => 'Query', 'Class:Query+' => 'A query is a data set defined in a dynamic way', 'Class:Query/Attribute:name' => 'Name', @@ -133,7 +133,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:QueryOQL+' => 'A query based on the Object Query Language', 'Class:QueryOQL/Attribute:oql' => 'Expression', 'Class:QueryOQL/Attribute:oql+' => 'OQL Expression', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -144,7 +144,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( // Class: User // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:User' => 'User', 'Class:User+' => 'User login', 'Class:User/Attribute:finalclass' => 'Type of account', @@ -191,13 +191,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:User/Warning:NoContactHasImpact' => 'Cautious: there is no Person defined on this User, this prevents access to portals, news notifications and other side effects in back-office', 'Class:UserInternal' => 'User Internal', 'Class:UserInternal+' => 'User defined within '.ITOP_APPLICATION_SHORT, -)); +]); // // Class: URP_Profiles // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:URP_Profiles' => 'Profile', 'Class:URP_Profiles+' => 'User profile', 'Class:URP_Profiles/Attribute:name' => 'Name', @@ -206,13 +206,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:URP_Profiles/Attribute:description+' => 'one line description', 'Class:URP_Profiles/Attribute:user_list' => 'Users', 'Class:URP_Profiles/Attribute:user_list+' => 'persons having this role', -)); +]); // // Class: URP_Dimensions // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:URP_Dimensions' => 'dimension', 'Class:URP_Dimensions+' => 'application dimension (defining silos)', 'Class:URP_Dimensions/Attribute:name' => 'Name', @@ -221,13 +221,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:URP_Dimensions/Attribute:description+' => 'one line description', 'Class:URP_Dimensions/Attribute:type' => 'Type', 'Class:URP_Dimensions/Attribute:type+' => 'class name or data type (projection unit)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:URP_UserProfile' => 'User to profile', 'Class:URP_UserProfile+' => 'user profiles', 'Class:URP_UserProfile/Name' => 'Link between %1$s and %2$s', @@ -241,14 +241,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:URP_UserProfile/Attribute:profile+' => 'Profile name', 'Class:URP_UserProfile/Attribute:reason' => 'Reason', 'Class:URP_UserProfile/Attribute:reason+' => 'explain why this person may have this role', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:URP_UserOrg' => 'User organisations', 'Class:URP_UserOrg+' => 'Allowed organisations', 'Class:URP_UserOrg/Name' => 'Link between %1$s and %2$s', @@ -262,13 +261,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => 'Allowed organisation', 'Class:URP_UserOrg/Attribute:reason' => 'Reason', 'Class:URP_UserOrg/Attribute:reason+' => 'explain why this person is allowed to see the data belonging to this organisation', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:URP_ProfileProjection' => 'profile_projection', 'Class:URP_ProfileProjection+' => 'profile projections', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Dimension', @@ -283,13 +282,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'OQL expression (using $user) | constant | | +attribute code', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Attribute', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Target attribute code (optional)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:URP_ClassProjection' => 'class_projection', 'Class:URP_ClassProjection+' => 'class projections', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Dimension', @@ -302,13 +301,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:URP_ClassProjection/Attribute:value+' => 'OQL expression (using $this) | constant | | +attribute code', 'Class:URP_ClassProjection/Attribute:attribute' => 'Attribute', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Target attribute code (optional)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:URP_ActionGrant' => 'action_permission', 'Class:URP_ActionGrant+' => 'permissions on classes', 'Class:URP_ActionGrant/Attribute:profileid' => 'Profile', @@ -325,13 +324,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'no', 'Class:URP_ActionGrant/Attribute:action' => 'Action', 'Class:URP_ActionGrant/Attribute:action+' => 'operations to perform on the given class', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:URP_StimulusGrant' => 'stimulus_permission', 'Class:URP_StimulusGrant+' => 'permissions on stimulus in the life cycle of the object', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Profile', @@ -348,25 +347,25 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'no', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Stimulus', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'stimulus code', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:URP_AttributeGrant' => 'attribute_permission', 'Class:URP_AttributeGrant+' => 'permissions at the attributes level', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Action grant', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'action grant', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Attribute', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'attribute code', -)); +]); // // Class: UserDashboard // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Class:UserDashboard' => 'User dashboard', 'Class:UserDashboard+' => '', 'Class:UserDashboard/Attribute:user_id' => 'User', @@ -375,12 +374,12 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Class:UserDashboard/Attribute:menu_code+' => '', 'Class:UserDashboard/Attribute:contents' => 'Contents', 'Class:UserDashboard/Attribute:contents+' => '', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Menu:WelcomeMenu' => 'Welcome', 'Menu:WelcomeMenu+' => 'Welcome to '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage' => 'Welcome', @@ -399,13 +398,13 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Menu:MyShortcuts' => 'My Shortcuts', 'Menu:DataAdministration' => 'Data administration', 'Menu:DataAdministration+' => '', -)); +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'BooleanLabel:yes' => 'yes', 'BooleanLabel:no' => 'no', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.' login', @@ -780,7 +779,6 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI:Audit:Dashboard:ObjectsValidated' => 'Objects validated', 'UI:Audit:AuditCategory:Subtitle' => '%1$s errors out of %2$s - %3$s%% of the object are valid', - 'UI:RunQuery:Title' => ITOP_APPLICATION_SHORT.' - OQL Query Evaluation', 'UI:RunQuery:QueryExamples' => 'Query Examples', 'UI:RunQuery:QueryResults' => 'Query Results', @@ -1272,7 +1270,6 @@ When associated with a trigger, each action is given an "order" number, specifyi 'UI:Dashboard:Actions' => 'Dashboard actions', 'UI:Dashboard:NotUpToDateUntilContainerSaved' => 'This dashboard displays information that does not include the ongoing changes.', - 'UI:DashletCreation:Title' => 'Create a new Dashlet', 'UI:DashletCreation:Dashboard' => 'Dashboard', 'UI:DashletCreation:DashletType' => 'Dashlet Type', @@ -1646,12 +1643,12 @@ When associated with a trigger, each action is given an "order" number, specifyi 'UI:Search:Criteria:Raw:FilteredOn' => 'Filtered on %1$s', 'UI:StateChanged' => 'State changed', -)); +]); // // Expression to Natural language // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Expression:Operator:AND' => ' AND ', 'Expression:Operator:OR' => ' OR ', 'Expression:Operator:=' => ': ', @@ -1667,12 +1664,12 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Expression:Verb:NOW' => 'now', 'Expression:Verb:ISNULL' => ': undefined', -)); +]); // // iTop Newsroom menu // -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'UI:Newsroom:NoNewMessage' => 'No new message', 'UI:Newsroom:XNewMessage' => '%1$s new message(s)', 'UI:Newsroom:MarkAllAsRead' => 'Mark all messages as read', @@ -1687,10 +1684,9 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgent', 'UI:Newsroom:Priority:3:Tooltip' => 'Important', 'UI:Newsroom:Priority:4:Tooltip' => 'Normal', -)); +]); - -Dict::Add('EN GB', 'British English', 'British English', array( +Dict::Add('EN GB', 'British English', 'British English', [ 'Menu:DataSources' => 'Synchronisation Data Sources', 'Menu:DataSources+' => 'Data synchronisation used for batch import of external data', 'Menu:AuditCategories' => 'Audit configuration', @@ -1718,4 +1714,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'Menu:Integrations' => 'Integrations', 'Menu:Integrations+' => '', -)); +]); diff --git a/dictionaries/es_cr.dictionary.itop.core.php b/dictionaries/es_cr.dictionary.itop.core.php index 1e4338c66..eb78a57bb 100644 --- a/dictionaries/es_cr.dictionary.itop.core.php +++ b/dictionaries/es_cr.dictionary.itop.core.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Core:DeletedObjectLabel' => '%1s (eliminado)', 'Core:DeletedObjectTip' => 'Elemento ha sido Eliminado en %1$s (%2$s)', 'Core:UnknownObjectLabel' => 'Elemento No Encontrado (Clase: %1$s, Identificador: %2$d)', @@ -155,8 +156,7 @@ Operadores:
          'Core:Context=GUI:Console' => 'Consola', 'Core:Context=CRON' => 'cron', 'Core:Context=GUI:Portal' => 'Portal', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -167,7 +167,7 @@ Operadores:
          // Class: CMDBChange // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:CMDBChange' => 'Cambio', 'Class:CMDBChange+' => 'Cambios', 'Class:CMDBChange/Attribute:date' => 'Fecha', @@ -182,13 +182,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON webservices', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP webservices', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'Por una extensión', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:CMDBChangeOp' => 'Operación de Cambios', 'Class:CMDBChangeOp+' => 'Operación de Cambios', 'Class:CMDBChangeOp/Attribute:change' => 'Cambio', @@ -203,51 +203,51 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:CMDBChangeOp/Attribute:objkey+' => 'Id de Objeto', 'Class:CMDBChangeOp/Attribute:finalclass' => 'Clase', 'Class:CMDBChangeOp/Attribute:finalclass+' => 'Clase', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:CMDBChangeOpCreate' => 'Creación de Objeto', 'Class:CMDBChangeOpCreate+' => 'Creación de Objeto', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:CMDBChangeOpDelete' => 'Borrado de Objeto', 'Class:CMDBChangeOpDelete+' => 'Borrado de Objeto', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:CMDBChangeOpSetAttribute' => 'Cambio en Objeto', 'Class:CMDBChangeOpSetAttribute+' => 'Cambio en Objeto', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Atributo', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'Código de la propiedad modificada', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'Cambio de Propiedad', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Cambio de Propiedades escalares del Objeto', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Valor Anterior', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => 'valor Anterior del Atributo', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Nuevo Valor', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => 'Nuevo Valor del Atributo', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Change:ObjectCreated' => 'Objeto Creado', 'Change:ObjectDeleted' => 'Objeto Eliminado', 'Change:ObjectModified' => 'Objeto Modificado', @@ -264,35 +264,35 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Change:LinkSet:Added' => 'Agregado %1$s', 'Change:LinkSet:Removed' => 'Removido %1$s', 'Change:LinkSet:Modified' => 'Modificado %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'Cambio de Datos', 'Class:CMDBChangeOpSetAttributeBlob+' => 'Cambio de Datos', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Valor Anterior', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => 'Valor Anterior del Atributo', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:CMDBChangeOpSetAttributeText' => 'Cambio de Texto', 'Class:CMDBChangeOpSetAttributeText+' => 'Cambio de Texto', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Valor Anterior', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'Valor Anterior del Atributo', -)); +]); // // Class: Event // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Event' => 'Bitácora de Eventos', 'Class:Event+' => 'Evento interno de aplicación', 'Class:Event/Attribute:message' => 'Mensaje', @@ -303,13 +303,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Event/Attribute:userinfo+' => 'Indentificación de la actividad que realizaba el usuario durante la cual se disparó este evento', 'Class:Event/Attribute:finalclass' => 'Clase', 'Class:Event/Attribute:finalclass+' => 'Clase', -)); +]); // // Class: EventNotification // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:EventNotification' => 'Notificación de Evento', 'Class:EventNotification+' => 'Notificación de Evento', 'Class:EventNotification/Attribute:trigger_id' => 'Disparador', @@ -318,13 +318,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:EventNotification/Attribute:action_id+' => 'Cuenta de usuario', 'Class:EventNotification/Attribute:object_id' => 'Id de Objeto', 'Class:EventNotification/Attribute:object_id+' => 'Id de objeto (¿clase definida por el disparador?)', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:EventNotificationEmail' => 'Correo Electrónico de Notificación de Evento', 'Class:EventNotificationEmail+' => 'Correo Electrónico de Notificación de Evento', 'Class:EventNotificationEmail/Attribute:to' => 'Para', @@ -341,13 +341,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:EventNotificationEmail/Attribute:body+' => 'Cuerpo del mensaje', 'Class:EventNotificationEmail/Attribute:attachments' => 'Anexos', 'Class:EventNotificationEmail/Attribute:attachments+' => 'Anexos', -)); +]); // // Class: EventIssue // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:EventIssue' => 'Registro de Evento', 'Class:EventIssue+' => 'Evidencia de un evento (warning, error, etc.)', 'Class:EventIssue/Attribute:issue' => 'Evento', @@ -364,13 +364,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:EventIssue/Attribute:callstack+' => 'Pila de llamadas', 'Class:EventIssue/Attribute:data' => 'Datos', 'Class:EventIssue/Attribute:data+' => 'Más información', -)); +]); // // Class: EventWebService // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:EventWebService' => 'Evento de WebService', 'Class:EventWebService+' => 'Evidencia de una llamada de servicio Web', 'Class:EventWebService/Attribute:verb' => 'Verbo', @@ -385,9 +385,9 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:EventWebService/Attribute:log_error+' => 'Bitácora de Error de Resultado', 'Class:EventWebService/Attribute:data' => 'Datos', 'Class:EventWebService/Attribute:data+' => 'Datos de Resultado', -)); +]); -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:EventRestService' => 'Llamada REST/JSON', 'Class:EventRestService+' => 'Traza de llamada a servicio REST/JSON', 'Class:EventRestService/Attribute:operation' => 'Operación', @@ -402,13 +402,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:EventRestService/Attribute:json_output+' => 'respuesta HTTP (json)', 'Class:EventRestService/Attribute:provider' => 'Proveedor', 'Class:EventRestService/Attribute:provider+' => 'Clase PHP implementando la operación esperada', -)); +]); // // Class: EventLoginUsage // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:EventLoginUsage' => 'Uso de la Cuenta', 'Class:EventLoginUsage+' => 'Uso de la Cuenta', 'Class:EventLoginUsage/Attribute:user_id' => 'Usuario', @@ -417,13 +417,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:EventLoginUsage/Attribute:contact_name+' => 'Nombre', 'Class:EventLoginUsage/Attribute:contact_email' => 'Correo Electrónico', 'Class:EventLoginUsage/Attribute:contact_email+' => 'Correo Electrónico del usuario', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:EventNotificationNewsroom' => 'Noticias enviadas', 'Class:EventNotificationNewsroom+' => 'Noticias enviadas', 'Class:EventNotificationNewsroom/Attribute:title' => 'Título', @@ -452,13 +452,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => 'Fecha lectura', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contacto', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => 'Contacto', -)); +]); // // Class: Action // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Action' => 'Acción Personalizada', 'Class:Action+' => 'Acción definida por el usuario', 'Class:Action/ComplementaryName' => '%1$s: %2$s', @@ -488,24 +488,24 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Action:last_executions_tab_panel_title' => 'Ejecuciones de esta acción (%1$s)', 'Action:last_executions_tab_limit_days' => 'últimos %1$s días', 'Action:last_executions_tab_limit_none' => 'Sin límite', -)); +]); // // Class: ActionNotification // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ActionNotification' => 'Notificación', 'Class:ActionNotification+' => 'Notificación (resúmen)', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ActionEmail' => 'Notificación por Correo Electrónico', 'Class:ActionEmail+' => 'Notificación por Correo Electrónico', 'Class:ActionEmail/Attribute:status+' => 'Este estatus determina quién será notificado: Sólo el destinatario de la prueba, todos (Para, CC y CCO) o nadie', @@ -556,14 +556,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'ActionEmail:preview_warning' => 'El correo electrónico real puede verse diferente en el cliente de correo electrónico que esta vista previa en su navegador.', 'ActionEmail:preview_more_info' => 'Para obtener más información sobre las funciones CSS admitidas por los diferentes clientes de correo electrónico, consulte %1$s', 'ActionEmail:content_placeholder_missing' => 'El marcador de posición "%1$s" no se encontró en la plantilla HTML. El contenido del campo "%2$s" no se incluirá en los correos electrónicos generados.', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'ActionNewsroom:trigger' => 'Disparador', 'ActionNewsroom:content' => 'Mensaje', 'ActionNewsroom:settings' => 'Configuración', @@ -592,14 +591,14 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:ActionNewsroom/Attribute:recipients' => 'Destinatarios', 'Class:ActionNewsroom/Attribute:recipients+' => 'Destinatarios', 'Class:ActionNewsroom/Attribute:url' => 'URL', - 'Class:ActionNewsroom/Attribute:url+' => 'URL' -)); + 'Class:ActionNewsroom/Attribute:url+' => 'URL', +]); // // Class: Trigger // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Trigger' => 'Disparador', 'Class:Trigger+' => 'Disparador', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s', @@ -618,13 +617,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Permitir baja completa', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Forzar al menos un canal (Noticias o Correo electrónico)', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Denegar baja de suscripción', -)); +]); // // Class: TriggerOnObject // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TriggerOnObject' => 'Disparador (Depende de la clase)', 'Class:TriggerOnObject+' => 'Disparador en una clase de objeto dada', 'Class:TriggerOnObject/Attribute:target_class' => 'Clase destino', @@ -633,115 +632,115 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:TriggerOnObject/Attribute:filter+' => '', 'TriggerOnObject:WrongFilterQuery' => 'Filtro de consulta incorrecto: %1$s', 'TriggerOnObject:WrongFilterClass' => 'El filtro de consulta debe regresar un objeto de la clase \\"%1$s\\"', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TriggerOnPortalUpdate' => 'Disparador (cuando se actualiza desde el portal)', 'Class:TriggerOnPortalUpdate+' => 'Disparador cuando un usuario actualiza desde el portal', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TriggerOnStateChange' => 'Disparador (en cambio de estado)', 'Class:TriggerOnStateChange+' => 'Disparador en cambio de estado de objeto', 'Class:TriggerOnStateChange/Attribute:state' => 'Estado', 'Class:TriggerOnStateChange/Attribute:state+' => 'Estado', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TriggerOnStateEnter' => 'Disparador (entrando a un estado)', 'Class:TriggerOnStateEnter+' => 'Disparador en cambio de estado de objeto - entrando', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TriggerOnStateLeave' => 'Disparador (saliendo de un estado)', 'Class:TriggerOnStateLeave+' => 'Disparador en cambio de estado de objeto - saliendo', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TriggerOnObjectCreate' => 'Disparador (creación de objeto)', 'Class:TriggerOnObjectCreate+' => 'Disparador en la creación de objeto (hija de clase) de una clase dada', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TriggerOnObjectDelete' => 'Disparador (eliminando un objecto)', 'Class:TriggerOnObjectDelete+' => 'Disparador al eliminar un objecto de la clase dada [o una clase hija] ', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TriggerOnObjectUpdate' => 'Disparador (actualizando un objecto)', 'Class:TriggerOnObjectUpdate+' => 'Disparador al actualizar un objeto de la clase dada [o una clase hija]', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Campos objetivo', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => 'Campos que serán monitorizados', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TriggerOnObjectMention' => 'Disparador (en mención de objeto)', 'Class:TriggerOnObjectMention+' => 'Disparador en mención (@xxx) de un objeto de [clase hijo de] clase dada en un registro de atributo', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Filtro mencionado', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Limite la lista de objetos mencionados que activarán el disparador. Si está vacío, cualquier objeto mencionado (de cualquier clase) lo activará.', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TriggerOnAttributeBlobDownload' => 'Disparador (al descargar el documento del objeto)', 'Class:TriggerOnAttributeBlobDownload+' => 'Disparador en la descarga del campo de documento del objeto de [una clase secundaria de] la clase dada', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Campos de destino', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => 'Campos de destino', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TriggerOnThresholdReached' => 'Disparador (en umbral)', 'Class:TriggerOnThresholdReached+' => 'Disparador en umbral Stop-Watch alcanzado', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Detener watch', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => 'Detener watch', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Umbral', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => 'Umbral', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkTriggerAction' => 'Relación Acción y Disparador', 'Class:lnkTriggerAction+' => 'Relación Acción y Disparador', 'Class:lnkTriggerAction/Attribute:action_id' => 'Acción', @@ -754,12 +753,12 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => 'Disparador', 'Class:lnkTriggerAction/Attribute:order' => 'Orden', 'Class:lnkTriggerAction/Attribute:order+' => 'Orden de realización de acciones', -)); +]); // // Synchro Data Source // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:SynchroDataSource' => 'Fuente de Datos Sincronizable', 'Class:SynchroDataSource/Attribute:name' => 'Nombre', 'Class:SynchroDataSource/Attribute:name+' => 'Nombre de la Fuente de Datos', @@ -1047,13 +1046,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Core:Validator:MustBeInteger' => 'Debe ser un entero', 'Core:Validator:MustSelectOne' => 'Por favor, seleccione uno', 'Menu:DataSources' => 'Fuentes de Datos Sincronizables', - 'Menu:DataSources+' => 'Fuentes de Datos Sincronizables' -)); + 'Menu:DataSources+' => 'Fuentes de Datos Sincronizables', +]); // // Class: TagSetFieldData // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:TagSetFieldData' => '%2$s para la clase %1$s', 'Class:TagSetFieldData+' => 'Datos de campo', 'Class:TagSetFieldData/Attribute:code' => 'Código', @@ -1075,12 +1074,12 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Etiquetas "Attribute Code" no pueden ser cambiadas', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Uso de la etiqueta (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => 'No hay entradas para esta etiqueta', -)); +]); // // Class: DBProperty // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:DBProperty' => 'Propiedad BD', 'Class:DBProperty+' => 'Propiedad de Base de Datos', 'Class:DBProperty/Attribute:name' => 'Nombre', @@ -1093,12 +1092,12 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:DBProperty/Attribute:change_date+' => 'Fecha de Cambio', 'Class:DBProperty/Attribute:change_comment' => 'Comentario Cambio', 'Class:DBProperty/Attribute:change_comment+' => 'Comentario del Cambio', -)); +]); // // Class: BackgroundTask // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:BackgroundTask' => 'Tarea en Segundo Plano', 'Class:BackgroundTask+' => 'Tarea en Segundo Plano', 'Class:BackgroundTask/Attribute:class_name' => 'Nombre de Clase', @@ -1123,12 +1122,12 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:BackgroundTask/Attribute:running+' => 'Indicador de proceso en Ejecución', 'Class:BackgroundTask/Attribute:status' => 'Estatus', 'Class:BackgroundTask/Attribute:status+' => 'Estatus', -)); +]); // // Class: AsyncTask // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:AsyncTask' => 'Tarea Asíncrona', 'Class:AsyncTask+' => 'Tarea Asíncrona', 'Class:AsyncTask/Attribute:created' => 'Creado', @@ -1153,43 +1152,40 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:AsyncTask/Attribute:last_attempt+' => 'Último intento', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Formato no válido para la configuración de "async_taks_retries[%1$s]". Esperando una matriz con las siguientes claves: %2$s', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Formato no válido para la configuración de "async_taks_retries[%1$s]": llave inesperada "%2$s". Esperando solo las siguientes llaves: %3$s', -)); +]); // // Class: AbstractResource // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:AbstractResource' => 'Recurso abstracto', 'Class:AbstractResource+' => 'Recurso abstracto', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ResourceAdminMenu' => 'Recursos de Menú de Administración', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ResourceRunQueriesMenu' => 'Recurso Libreta de Consultas', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:ResourceSystemMenu' => 'Recurso Menú de Sistema', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/es_cr.dictionary.itop.ui.php b/dictionaries/es_cr.dictionary.itop.ui.php index 743efc41e..039b25d23 100644 --- a/dictionaries/es_cr.dictionary.itop.ui.php +++ b/dictionaries/es_cr.dictionary.itop.ui.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:AuditCategory' => 'Auditoría de Categorías', 'Class:AuditCategory+' => 'Auditoría de Categorías', 'Class:AuditCategory/Attribute:name' => 'Nombre de Categoría', @@ -24,13 +25,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Porcentaje de objetos no válidos por debajo del cual el resultado es erróneo (rojo)', 'Class:AuditCategory/Attribute:domains_list' => 'Dominios', 'Class:AuditCategory/Attribute:domains_list+' => 'Dominios que incluyen esta categoría', -)); +]); // // Class: AuditRule // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:AuditRule' => 'Regla de Auditoría', 'Class:AuditRule+' => 'Regla a revisar para una categoría de auditoría específica', 'Class:AuditRule/Attribute:name' => 'Nombre de la Regla', @@ -49,13 +50,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:AuditRule/Attribute:category_id+' => 'La categoría para esta regla', 'Class:AuditRule/Attribute:category_name' => 'Categoría', 'Class:AuditRule/Attribute:category_name+' => 'Nombre de la categoría para esta regla', -)); +]); // // Class: AuditDomain // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:AuditDomain' => 'Auditar Dominio', 'Class:AuditDomain+' => 'La auditoría de dominios permiten agrupar las categorías de auditoría. El dominio suele corresponder a quién se encarga de comprobar y corregir errores.', @@ -67,13 +68,13 @@ El dominio suele corresponder a quién se encarga de comprobar y corregir errore 'Class:AuditDomain/Attribute:icon+' => 'Icono', 'Class:AuditDomain/Attribute:categories_list' => 'Categorías', 'Class:AuditDomain/Attribute:categories_list+' => 'Categorías de auditoría relacionadas. Al ejecutar la auditoría en un dominio, se verifican todas las categorías de auditoría relacionadas y solo esas.', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Relación Categoría de auditoría / Dominio de auditoría', 'Class:lnkAuditCategoryToAuditDomain+' => 'Relación Categoría de auditoría / Dominio de auditoría', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Categoría', @@ -84,13 +85,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Dominio de auditoría', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Nombre de dominio', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Nombre de auditoria de dominio', -)); +]); // // Class: QueryOQL // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:Query' => 'Consulta', 'Class:Query+' => 'Un query es un set de datos definidos de manera dinámica', 'Class:Query/Attribute:name' => 'Nombre', @@ -117,7 +118,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:QueryOQL+' => 'Una consulta basada en Object Query Language', 'Class:QueryOQL/Attribute:oql' => 'Expresión', 'Class:QueryOQL/Attribute:oql+' => 'Expresión OQL', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -128,7 +129,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( // Class: User // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:User' => 'Usuario', 'Class:User+' => 'Credencial de usuario', 'Class:User/Attribute:finalclass' => 'Tipo de Cuenta', @@ -174,13 +175,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:User/Warning:NoContactHasImpact' => 'Cuidado: no hay ninguna Persona definida sobre este Usuario, esto impide el acceso a portales, notificaciones de noticias y otros efectos secundarios en el back-office', 'Class:UserInternal' => 'Usuario Interno', 'Class:UserInternal+' => 'Usuario definido en '.ITOP_APPLICATION_SHORT, -)); +]); // // Class: URP_Profiles // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:URP_Profiles' => 'Perfil', 'Class:URP_Profiles+' => 'Perfil de usuario', 'Class:URP_Profiles/Attribute:name' => 'Nombre', @@ -189,13 +190,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:URP_Profiles/Attribute:description+' => 'descripción en una línea', 'Class:URP_Profiles/Attribute:user_list' => 'Usuarios', 'Class:URP_Profiles/Attribute:user_list+' => 'Personas que tienen este Rol.', -)); +]); // // Class: URP_Dimensions // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:URP_Dimensions' => 'Dimensión', 'Class:URP_Dimensions+' => 'Dimensión de Aplicación (definiendo silos)', 'Class:URP_Dimensions/Attribute:name' => 'Nombre', @@ -204,13 +205,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:URP_Dimensions/Attribute:description+' => 'Descripción en una línea', 'Class:URP_Dimensions/Attribute:type' => 'Tipo', 'Class:URP_Dimensions/Attribute:type+' => 'Nombre de Clase o Tipo de Datos (Unidad de Proyección)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:URP_UserProfile' => 'Asignación de Perfiles', 'Class:URP_UserProfile+' => 'Perfiles de Usuarios', 'Class:URP_UserProfile/Name' => 'Vinculo entre %1$s y %2$s', @@ -224,14 +225,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:URP_UserProfile/Attribute:profile+' => 'Nombre del perfil', 'Class:URP_UserProfile/Attribute:reason' => 'Motivo', 'Class:URP_UserProfile/Attribute:reason+' => 'Justificación de por qué esta persona tiene este rol', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:URP_UserOrg' => 'Organizaciones de Usuario', 'Class:URP_UserOrg+' => 'Organizaciones Permitidas', 'Class:URP_UserOrg/Name' => 'Vínculo entre %1$s y %2$s', @@ -245,13 +245,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => 'Organización Permitida', 'Class:URP_UserOrg/Attribute:reason' => 'Motivo', 'Class:URP_UserOrg/Attribute:reason+' => 'Explicar porqué esta persona tiene permitido ver la información de esta Organización', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:URP_ProfileProjection' => 'Proyecciones de Perfil', 'Class:URP_ProfileProjection+' => 'Proyecciones de Perfil', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Dimensión', @@ -266,13 +266,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'Expresión OQL (usando $user) | constante | | +código de atributo', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Atributo', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Código de Atributo Destino (opcional)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:URP_ClassProjection' => 'Proyecciones de Clase', 'Class:URP_ClassProjection+' => 'Proyecciones de Clase', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Dimensión', @@ -285,13 +285,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:URP_ClassProjection/Attribute:value+' => 'Expresión OQL (usando $this) | constante | | +código de atributo', 'Class:URP_ClassProjection/Attribute:attribute' => 'Atributo', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Código de Atributo Destino (opcional)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:URP_ActionGrant' => 'Permisos sobre Acciones', 'Class:URP_ActionGrant+' => 'Permisos sobre Acciones', 'Class:URP_ActionGrant/Attribute:profileid' => 'Perfil', @@ -308,13 +308,13 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'no', 'Class:URP_ActionGrant/Attribute:action' => 'Acción', 'Class:URP_ActionGrant/Attribute:action+' => 'Operaciones a realizar en la clase especificada', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:URP_StimulusGrant' => 'Permisos de Cambio de Estado', 'Class:URP_StimulusGrant+' => 'Permisos de Cambio de Estado en el Ciclo de Vida del Objeto', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Perfil', @@ -331,25 +331,25 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => '', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Cambio de Estado', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'Código de Cambio de Estado', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:URP_AttributeGrant' => 'Permisos en Atributos', 'Class:URP_AttributeGrant+' => 'Permisos en Atributos', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Concesión de Acción', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'concesión de Acción', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Atributo', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'Código de Atributo', -)); +]); // // Class: UserDashboard // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Class:UserDashboard' => 'Tablero de Usuario', 'Class:UserDashboard+' => 'Tablero de Usuario', 'Class:UserDashboard/Attribute:user_id' => 'Usuario', @@ -358,12 +358,12 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Class:UserDashboard/Attribute:menu_code+' => 'Código de Menú', 'Class:UserDashboard/Attribute:contents' => 'Contenidos', 'Class:UserDashboard/Attribute:contents+' => 'Contenidos', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:WelcomeMenu' => 'Bienvenido', 'Menu:WelcomeMenu+' => 'Bienvenido a '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage' => 'Bienvenido', 'Menu:WelcomeMenuPage+' => 'Bienvenido a '.ITOP_APPLICATION_SHORT, 'Menu:AdminTools' => 'Herramientas Administrativas', @@ -380,14 +380,14 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Menu:MyShortcuts' => 'Mis Accesos Rápidos', 'Menu:Notifications:Title' => 'Auditar categorías', 'Menu:DataAdministration' => 'Administración de Datos', - 'Menu:DataAdministration+' => 'Administración de Datos' -)); + 'Menu:DataAdministration+' => 'Administración de Datos', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'BooleanLabel:yes' => 'Si', 'BooleanLabel:no' => 'No', 'UI:Login:Title' => 'Inicio de Sesión', @@ -1533,13 +1533,13 @@ Cuando se asocien con un disparador, cada acción recibe un número de "orden", 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Hijos de los objetos seleccionados serán incluídos.', 'UI:Search:Criteria:Raw:Filtered' => 'Filtrado', 'UI:Search:Criteria:Raw:FilteredOn' => 'Filtrado en %1$s', - 'UI:StateChanged' => 'Estado cambiado' -)); + 'UI:StateChanged' => 'Estado cambiado', +]); // // Expression to Natural language // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Expression:Operator:AND' => ' Y ', 'Expression:Operator:OR' => ' O ', 'Expression:Operator:=' => ': ', @@ -1552,12 +1552,12 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Expression:Unit:Long:MINUTE' => 'minuto(s)', 'Expression:Verb:NOW' => 'Ahora', 'Expression:Verb:ISNULL' => ': Nulo', -)); +]); // // iTop Newsroom menu // -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Newsroom:NoNewMessage' => 'Sin Mensajes', 'UI:Newsroom:XNewMessage' => '%1$s nuevo(s) mensaje(s)', 'UI:Newsroom:MarkAllAsRead' => 'Marcar todos los mensajes como leídos', @@ -1572,10 +1572,9 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgente', 'UI:Newsroom:Priority:3:Tooltip' => 'Importante', 'UI:Newsroom:Priority:4:Tooltip' => 'Normal', -)); +]); - -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'Menu:DataSources' => 'Fuentes de Datos Sincronizables', 'Menu:DataSources+' => 'Fuentes de Datos Sincronizables', 'Menu:AuditCategories' => 'Auditar categorías', @@ -1603,4 +1602,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Menu:Integrations' => 'Integraciones', 'Menu:Integrations+' => '~~', -)); +]); diff --git a/dictionaries/fr.dictionary.itop.core.php b/dictionaries/fr.dictionary.itop.core.php index 30b4eb3f7..951c18888 100644 --- a/dictionaries/fr.dictionary.itop.core.php +++ b/dictionaries/fr.dictionary.itop.core.php @@ -1,15 +1,16 @@ '%1s (effacé)', 'Core:DeletedObjectTip' => 'L\'objet a été effacé le %1$s (%2$s)', 'Core:UnknownObjectLabel' => 'Classe: %1$s, Identifiant: %2$d', @@ -159,9 +160,8 @@ Opérateurs :
          'Core:Context=CRON' => 'cron', 'Core:Context=CRON+' => 'cron', 'Core:Context=GUI:Portal' => 'Portal', - 'Core:Context=GUI:Portal+' => 'GUI:Portal' -)); - + 'Core:Context=GUI:Portal+' => 'GUI:Portal', +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -172,7 +172,7 @@ Opérateurs :
          // Class: CMDBChange // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:CMDBChange' => 'Modification', 'Class:CMDBChange+' => '', 'Class:CMDBChange/Attribute:date' => 'Date', @@ -187,13 +187,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'Webservices REST/JSON', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'Webservices SOAP', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'Par une extension', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:CMDBChangeOp' => 'Operation de changement', 'Class:CMDBChangeOp+' => '', 'Class:CMDBChangeOp/Attribute:change' => 'Modification', @@ -208,51 +208,51 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:CMDBChangeOp/Attribute:objkey+' => '', 'Class:CMDBChangeOp/Attribute:finalclass' => 'Type', 'Class:CMDBChangeOp/Attribute:finalclass+' => 'Nom de la classe instanciable', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:CMDBChangeOpCreate' => 'Création de l\'objet', 'Class:CMDBChangeOpCreate+' => '', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:CMDBChangeOpDelete' => 'Effacement de l\'objet', 'Class:CMDBChangeOpDelete+' => '', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:CMDBChangeOpSetAttribute' => 'Modification de l\'objet', 'Class:CMDBChangeOpSetAttribute+' => '', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Champ', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => '', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'Modification de valeur', 'Class:CMDBChangeOpSetAttributeScalar+' => '', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Ancienne valeur', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => '', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Nouvelle valeur', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => '', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Change:ObjectCreated' => 'Elément créé', 'Change:ObjectDeleted' => 'Elément effacé', 'Change:ObjectModified' => 'Elément modifié', @@ -269,35 +269,35 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Change:LinkSet:Added' => 'ajout de %1$s', 'Change:LinkSet:Removed' => 'suppression de %1$s', 'Change:LinkSet:Modified' => 'modification de %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'Modification de données', 'Class:CMDBChangeOpSetAttributeBlob+' => '', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Ancienne valeur', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => '', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:CMDBChangeOpSetAttributeText' => 'Modification de texte', 'Class:CMDBChangeOpSetAttributeText+' => '', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Ancienne valeur', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => '', -)); +]); // // Class: Event // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Event' => 'Evènement', 'Class:Event+' => '', 'Class:Event/Attribute:message' => 'Message', @@ -308,13 +308,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Event/Attribute:userinfo+' => '', 'Class:Event/Attribute:finalclass' => 'Sous-classe d\'évènement', 'Class:Event/Attribute:finalclass+' => 'Nom de la classe instanciable', -)); +]); // // Class: EventNotification // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:EventNotification' => 'Notification envoyée', 'Class:EventNotification+' => '', 'Class:EventNotification/Attribute:trigger_id' => 'Déclencheur', @@ -323,13 +323,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:EventNotification/Attribute:action_id+' => '', 'Class:EventNotification/Attribute:object_id' => 'Objet', 'Class:EventNotification/Attribute:object_id+' => '', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:EventNotificationEmail' => 'Mél envoyé', 'Class:EventNotificationEmail+' => '', 'Class:EventNotificationEmail/Attribute:to' => 'A', @@ -346,13 +346,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:EventNotificationEmail/Attribute:body+' => '', 'Class:EventNotificationEmail/Attribute:attachments' => 'Pièces jointes', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:EventIssue' => 'Erreur', 'Class:EventIssue+' => '', 'Class:EventIssue/Attribute:issue' => 'Erreur', @@ -369,13 +369,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:EventIssue/Attribute:callstack+' => '', 'Class:EventIssue/Attribute:data' => 'Données', 'Class:EventIssue/Attribute:data+' => '', -)); +]); // // Class: EventWebService // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:EventWebService' => 'Appel de webservice', 'Class:EventWebService+' => '', 'Class:EventWebService/Attribute:verb' => 'Verbe', @@ -390,9 +390,9 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:EventWebService/Attribute:log_error+' => '', 'Class:EventWebService/Attribute:data' => 'Données', 'Class:EventWebService/Attribute:data+' => '', -)); +]); -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:EventRestService' => 'Appel REST/JSON', 'Class:EventRestService+' => 'Trace de l\'appel au service REST/JSON (rest.php)', 'Class:EventRestService/Attribute:operation' => 'Opération', @@ -407,13 +407,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:EventRestService/Attribute:json_output+' => 'Réponse HTTP (structure json)', 'Class:EventRestService/Attribute:provider' => 'Fournisseur', 'Class:EventRestService/Attribute:provider+' => 'Classe PHP qui a pris en charge l\'opération demandée', -)); +]); // // Class: EventLoginUsage // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:EventLoginUsage' => 'Utilisation de l\'application', 'Class:EventLoginUsage+' => '', 'Class:EventLoginUsage/Attribute:user_id' => 'Login', @@ -422,13 +422,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '', 'Class:EventLoginUsage/Attribute:contact_email' => 'Email', 'Class:EventLoginUsage/Attribute:contact_email+' => '', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:EventNotificationNewsroom' => 'News envoyée', 'Class:EventNotificationNewsroom+' => '', 'Class:EventNotificationNewsroom/Attribute:title' => 'Titre', @@ -457,13 +457,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '', -)); +]); // // Class: Action // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Action' => 'Action', 'Class:Action+' => 'Action spécifique', 'Class:Action/ComplementaryName' => '%1$s: %2$s', @@ -493,24 +493,24 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Action:last_executions_tab_panel_title' => 'Exécutions de cette action (%1$s)', 'Action:last_executions_tab_limit_days' => '%1$s derniers jours', 'Action:last_executions_tab_limit_none' => 'depuis sa création', -)); +]); // // Class: ActionNotification // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ActionNotification' => 'Action de notification', 'Class:ActionNotification+' => '', 'Class:ActionNotification/Attribute:language' => 'Langue', 'Class:ActionNotification/Attribute:language+' => '', -)); +]); // // Class: ActionEmail // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ActionEmail' => 'Notification par mél', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'Cet état définit qui va être notifié: @@ -583,14 +583,13 @@ En édition, cliquez sur la loupe pour obtenir des exemples pertinents.', 'ActionEmail:preview_warning' => 'Le mèl peut s\'afficher différement dans les clients mèl par rapport à cet aperçu dans votre navigateur.', 'ActionEmail:preview_more_info' => 'Pour plus d\'informations sur les fonctionnalités CSS supportées par les différents client mèl, consultez %1$s.', 'ActionEmail:content_placeholder_missing' => 'The mot-clé "%1$s" ne figure pas dans le modèle HTML. Le contenu du champ "%2$s" ne sera pas intégré dans les mèls générés.', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'ActionNewsroom:trigger' => 'Conditions de déclenchement', 'ActionNewsroom:content' => 'Message', 'ActionNewsroom:settings' => 'Paramètres', @@ -625,13 +624,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'Une requête OQL retournant les des objets de type Contact', 'Class:ActionNewsroom/Attribute:url' => 'URL', 'Class:ActionNewsroom/Attribute:url+' => 'Par défaut, l\'URL pointe vers l\'objet ayant déclenché la notification. Mais vous pouvez également spécifier une URL personnalisée.', -)); +]); // // Class: Trigger // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Trigger' => 'Déclencheur', 'Class:Trigger+' => '', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s', @@ -650,13 +649,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Autoriser la désinscription de tous les canaux', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Forcer la conservation d\'un canal (News ou Email)', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Interdire la désinscription', -)); +]); // // Class: TriggerOnObject // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TriggerOnObject' => 'Déclencheur sur modification de données', 'Class:TriggerOnObject+' => '', 'Class:TriggerOnObject/Attribute:target_class' => 'Classe cible', @@ -665,115 +664,115 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Permet de limiter la liste des objets (de la classe cible) activant le déclencheur', 'TriggerOnObject:WrongFilterQuery' => 'Requête de filtrage incorrecte: %1$s', 'TriggerOnObject:WrongFilterClass' => 'La requête de filtrage doit retourner des objets de la classe "%1$s"', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TriggerOnPortalUpdate' => 'Déclencheur sur mise à jour depuis le portail', 'Class:TriggerOnPortalUpdate+' => '', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TriggerOnStateChange' => 'Déclencheur sur changement d\'état', 'Class:TriggerOnStateChange+' => '', 'Class:TriggerOnStateChange/Attribute:state' => 'Etat', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TriggerOnStateEnter' => 'Déclencheur sur un objet entrant dans un état', 'Class:TriggerOnStateEnter+' => '', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TriggerOnStateLeave' => 'Déclencheur sur un objet quittant un état', 'Class:TriggerOnStateLeave+' => '', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TriggerOnObjectCreate' => 'Déclencheur sur la création d\'un objet', 'Class:TriggerOnObjectCreate+' => '', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TriggerOnObjectDelete' => 'Déclencheur sur la suppression d\'un objet', 'Class:TriggerOnObjectDelete+' => '', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TriggerOnObjectUpdate' => 'Déclencheur sur la modification d\'un objet', 'Class:TriggerOnObjectUpdate+' => '', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Attributs cible', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TriggerOnObjectMention' => 'Déclencheur sur mention d\'objet', 'Class:TriggerOnObjectMention+' => 'Déclencheur sur un objet mentionné (@xxx) de la classe choisie (ou de ses filles) dans un attribut de type journal', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Objets mentionnés', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Permet de limiter la liste des objets mentionnés pour lesquels le déclencheur s\'activera. Si vide, n\'importe quel objet mentionné (de n\'importe quelle classe) l\'activera.', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TriggerOnAttributeBlobDownload' => 'Déclencheur sur le téléchargement d\'un document d\'un objet', 'Class:TriggerOnAttributeBlobDownload+' => '', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Attributs cible', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TriggerOnThresholdReached' => 'Déclencheur sur dépassement de seuil', 'Class:TriggerOnThresholdReached+' => 'Déclencheur sur franchissement de seuil d\'un chronomètre', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Chronomètre', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Seuil', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkTriggerAction' => 'Actions-Déclencheur', 'Class:lnkTriggerAction+' => '', 'Class:lnkTriggerAction/Attribute:action_id' => 'Action', @@ -786,12 +785,12 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Ordre', 'Class:lnkTriggerAction/Attribute:order+' => '', -)); +]); // // Synchro Data Source // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:SynchroDataSource' => 'Source de données', 'Class:SynchroDataSource/Attribute:name' => 'Nom', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1085,12 +1084,12 @@ Plusieurs champs peuvent ainsi être modifiés lors d\'une "mise à jour" en app 'Core:Validator:Mandatory' => 'Veuillez remplir ce champ', 'Core:Validator:MustBeInteger' => 'Ce champ ne peut contenir qu\'un nombre entier', 'Core:Validator:MustSelectOne' => 'Veuillez choisir une valeur', -)); +]); // // Class: TagSetFieldData // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:TagSetFieldData' => '%2$s pour la classe %1$s', 'Class:TagSetFieldData+' => '', 'Class:TagSetFieldData/Attribute:code' => 'Code', @@ -1112,12 +1111,12 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'L\'attribut de l\'étiquette ne peut pas être changé', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Utilisation (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => 'Pas d\'utilisation de cette étiquette', -)); +]); // // Class: DBProperty // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:DBProperty' => 'Propriété de la base de données', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Nom', @@ -1130,12 +1129,12 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Commentaire', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:BackgroundTask' => 'Tâche de fond', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Nom de la classe', @@ -1160,12 +1159,12 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'État', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:AsyncTask' => 'Tâche asynchrone', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Date de création', @@ -1190,43 +1189,40 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:AsyncTask/Attribute:last_attempt+' => '', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Format incorrect pour la configuration de "async_task_retries[%1$s]". La bonne syntaxe est un tableau avec comme clés: %2$s', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Format incorrect pour la configuration de "async_task_retries[%1$s]": clé "%2$s" invalide. Les clés attendues sont: %3$s', -)); +]); // // Class: AbstractResource // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:AbstractResource' => 'Ressource', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ResourceAdminMenu' => 'Menu Administration', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ResourceRunQueriesMenu' => 'Menu Requête OQL', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:ResourceSystemMenu' => 'Menu System', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/fr.dictionary.itop.ui.php b/dictionaries/fr.dictionary.itop.ui.php index eecc4f4d9..c7a65bc0e 100644 --- a/dictionaries/fr.dictionary.itop.ui.php +++ b/dictionaries/fr.dictionary.itop.ui.php @@ -1,15 +1,16 @@ 'Catégorie d\'audit', 'Class:AuditCategory+' => 'La catégorie d\'audit définit un ensemble d\'objets qui doivent être audité. Elle regroupe toutes les régles qui s\'appliquent au même périmètre d\'objets', @@ -27,13 +28,13 @@ Elle regroupe toutes les régles qui s\'appliquent au même périmètre d\'objet 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Pourcentage d\'objets en erreur au dela duquel le résultat est en erreur (rouge)', 'Class:AuditCategory/Attribute:domains_list' => 'Domaines', 'Class:AuditCategory/Attribute:domains_list+' => 'Domaines incluant cette catégorie d\'audit', -)); +]); // // Class: AuditRule // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:AuditRule' => 'Règle d\'audit', 'Class:AuditRule+' => 'Une règle d\'audit correspond à une vérification particulière. Elle s\'applique à tous les objets dans le périmètre de sa catégorie d\'audit', @@ -55,13 +56,13 @@ Elle s\'applique à tous les objets dans le périmètre de sa catégorie d\'audi 'Class:AuditRule/Attribute:category_id+' => '', 'Class:AuditRule/Attribute:category_name' => 'Nom de la catégorie', 'Class:AuditRule/Attribute:category_name+' => '', -)); +]); // // Class: AuditDomain // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:AuditDomain' => 'Domaine d\'audit', 'Class:AuditDomain+' => 'Un domaine permet de regrouper ensemble des catégories d\'audit. Cela recouvre en général, un domaine d\'intérêt ou de responsabilité', @@ -74,13 +75,13 @@ Cela recouvre en général, un domaine d\'intérêt ou de responsabilité', 'Class:AuditDomain/Attribute:categories_list' => 'Catégories', 'Class:AuditDomain/Attribute:categories_list+' => 'Catégories d\'audit incluses dans ce domaine. Cette inclusion n\'est pas exclusive. Lorsqu\'on execute l\'audit sur un domaine, toutes les catégories d\'audit incluses sont vérifiées en même temps et seulement celles là', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Link AuditCategory / AuditDomain', 'Class:lnkAuditCategoryToAuditDomain+' => '', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Catégorie', @@ -91,13 +92,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Domaine d\'audit', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Nom du domain', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Nom du domain d\'audit', -)); +]); // // Class: QueryOQL // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:Query' => 'Requête', 'Class:Query+' => 'Une requête définit un ensemble d\'information de manière dynamique', 'Class:Query/Attribute:name' => 'Nom', @@ -124,7 +125,7 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:QueryOQL+' => 'Une requête écrite dans le langage "Object Query Language"', 'Class:QueryOQL/Attribute:oql' => 'Expression', 'Class:QueryOQL/Attribute:oql+' => 'Expression OQL', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -135,7 +136,7 @@ Dict::Add('FR FR', 'French', 'Français', array( // Class: User // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:User' => 'Utilisateur', 'Class:User+' => 'Compte utilisateur', 'Class:User/Attribute:finalclass' => 'Type de compte', @@ -181,13 +182,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:User/Warning:NoContactHasImpact' => 'Attention: il n\'y a pas de Personne liée à cet utilisateur, il ne pourra pas se connecter à un portail, ni recevoir de News, ni changer sa langue.', 'Class:UserInternal' => 'Utilisateur interne', 'Class:UserInternal+' => 'Utilisateur défini dans '.ITOP_APPLICATION_SHORT, -)); +]); // // Class: URP_Profiles // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:URP_Profiles' => 'Profil', 'Class:URP_Profiles+' => 'Profil utilisateur', 'Class:URP_Profiles/Attribute:name' => 'Nom', @@ -196,13 +197,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:URP_Profiles/Attribute:description+' => '', 'Class:URP_Profiles/Attribute:user_list' => 'Utilisateurs', 'Class:URP_Profiles/Attribute:user_list+' => 'Comptes utilisateur (logins) ayant ce profil', -)); +]); // // Class: URP_Dimensions // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:URP_Dimensions' => 'Dimension', 'Class:URP_Dimensions+' => 'Dimension applicative (défini des silos)', 'Class:URP_Dimensions/Attribute:name' => 'Nom', @@ -211,13 +212,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:URP_Dimensions/Attribute:description+' => '', 'Class:URP_Dimensions/Attribute:type' => 'Type', 'Class:URP_Dimensions/Attribute:type+' => 'Nom de classe ou type de données (unité de projection)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:URP_UserProfile' => 'Utilisateur/Profil', 'Class:URP_UserProfile+' => '', 'Class:URP_UserProfile/Name' => 'Lien entre %1$s et %2$s', @@ -231,14 +232,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:URP_UserProfile/Attribute:profile+' => '', 'Class:URP_UserProfile/Attribute:reason' => 'Raison', 'Class:URP_UserProfile/Attribute:reason+' => 'Justifie le rôle affecté à cet utilisateur', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:URP_UserOrg' => 'Utilisateur/Organisation', 'Class:URP_UserOrg+' => 'Organisations permises pour l\'utilisateur', 'Class:URP_UserOrg/Name' => 'Lien entre %1$s et %2$s', @@ -252,13 +252,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => '', 'Class:URP_UserOrg/Attribute:reason' => 'Raison', 'Class:URP_UserOrg/Attribute:reason+' => 'Justifie la permission de voir les données de cette organisation', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:URP_ProfileProjection' => 'profile_projection', 'Class:URP_ProfileProjection+' => 'profile projections', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Dimension', @@ -273,13 +273,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'OQL expression (using $user) | constant | | +attribute code', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Attribute', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Target attribute code (optional)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:URP_ClassProjection' => 'class_projection', 'Class:URP_ClassProjection+' => 'class projections', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Dimension', @@ -292,13 +292,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:URP_ClassProjection/Attribute:value+' => 'OQL expression (using $this) | constant | | +attribute code', 'Class:URP_ClassProjection/Attribute:attribute' => 'Attribute', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Target attribute code (optional)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:URP_ActionGrant' => 'action_permission', 'Class:URP_ActionGrant+' => 'permissions on classes', 'Class:URP_ActionGrant/Attribute:profileid' => 'Profile', @@ -315,13 +315,13 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'non', 'Class:URP_ActionGrant/Attribute:action' => 'Action', 'Class:URP_ActionGrant/Attribute:action+' => 'operations to perform on the given class', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:URP_StimulusGrant' => 'stimulus_permission', 'Class:URP_StimulusGrant+' => 'permissions on stimulus in the life cycle of the object', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Profile', @@ -338,25 +338,25 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'no', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Stimulus', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'stimulus code', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:URP_AttributeGrant' => 'attribute_permission', 'Class:URP_AttributeGrant+' => 'permissions at the attributes level', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Action grant', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'action grant', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Attribute', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'attribute code', -)); +]); // // Class: UserDashboard // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Class:UserDashboard' => 'Tableau de bord utilisateur', 'Class:UserDashboard+' => '', 'Class:UserDashboard/Attribute:user_id' => 'Utilisateur', @@ -365,12 +365,12 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:UserDashboard/Attribute:menu_code+' => '', 'Class:UserDashboard/Attribute:contents' => 'Contenu', 'Class:UserDashboard/Attribute:contents+' => '', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Menu:WelcomeMenu' => 'Bienvenue', 'Menu:WelcomeMenu+' => 'Bienvenue dans '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage' => 'Bienvenue', 'Menu:WelcomeMenuPage+' => 'Bienvenue dans '.ITOP_APPLICATION_SHORT, 'Menu:AdminTools' => 'Administration', @@ -387,14 +387,14 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Menu:MyShortcuts' => 'Mes raccourcis', 'Menu:Notifications:Title' => 'Catégories d\'audit', 'Menu:DataAdministration' => 'Administration des données', - 'Menu:DataAdministration+' => 'Administration des données' -)); + 'Menu:DataAdministration+' => 'Administration des données', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'BooleanLabel:yes' => 'oui', 'BooleanLabel:no' => 'non', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.' login', @@ -1534,13 +1534,13 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Children of the selected objects will be included.~~', 'UI:Search:Criteria:Raw:Filtered' => 'Filtré', 'UI:Search:Criteria:Raw:FilteredOn' => 'Filtré sur %1$s', - 'UI:StateChanged' => 'Etat modifié' -)); + 'UI:StateChanged' => 'Etat modifié', +]); // // Expression to Natural language // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Expression:Operator:AND' => ' ET ', 'Expression:Operator:OR' => ' OU ', 'Expression:Operator:=' => ' : ', @@ -1553,12 +1553,12 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Expression:Unit:Long:MINUTE' => 'minute(s)', 'Expression:Verb:NOW' => 'maintenant', 'Expression:Verb:ISNULL' => ' : non défini', -)); +]); // // iTop Newsroom menu // -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'UI:Newsroom:NoNewMessage' => 'Aucun nouveau message', 'UI:Newsroom:XNewMessage' => '%1$s nouveau(x) message(s)', 'UI:Newsroom:MarkAllAsRead' => 'Marquer tous les messages comme lus', @@ -1573,10 +1573,9 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgent', 'UI:Newsroom:Priority:3:Tooltip' => 'Important', 'UI:Newsroom:Priority:4:Tooltip' => 'Standard', -)); +]); - -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'Menu:DataSources' => 'Synchronisation', 'Menu:DataSources+' => 'Configurations d\'import de données issues de sources externes', 'Menu:AuditCategories' => 'Configurer l\'audit', @@ -1604,4 +1603,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Menu:Integrations' => 'Intégrations', 'Menu:Integrations+' => '', -)); +]); diff --git a/dictionaries/hu.dictionary.itop.core.php b/dictionaries/hu.dictionary.itop.core.php index 538f15540..60712e4a1 100755 --- a/dictionaries/hu.dictionary.itop.core.php +++ b/dictionaries/hu.dictionary.itop.core.php @@ -1,15 +1,16 @@ '%1$s (törölve)', 'Core:DeletedObjectTip' => 'A %1$s objektum törölve (%2$s)', 'Core:UnknownObjectLabel' => 'Objektum nem található (osztály: %1$s, id: %2$d)', @@ -157,8 +158,7 @@ Operátorok:
          'Core:Context=GUI:Console' => 'Console', 'Core:Context=CRON' => 'cron', 'Core:Context=GUI:Portal' => 'Portál', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -169,7 +169,7 @@ Operátorok:
          // Class: CMDBChange // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:CMDBChange' => 'Változás', 'Class:CMDBChange+' => 'Változások nyomonkövetése', 'Class:CMDBChange/Attribute:date' => 'Dátum', @@ -184,13 +184,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON webszolgáltatás', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP webszolgáltatás', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'Bővítmény által', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:CMDBChangeOp' => 'Változás művelet', 'Class:CMDBChangeOp+' => 'Egyetlen személy által, egyetlen időpontban, egyetlen tárgyon végrehajtott változtatás.', 'Class:CMDBChangeOp/Attribute:change' => 'Változás', @@ -205,51 +205,51 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:CMDBChangeOp/Attribute:objkey+' => 'Azon objektum azonosítója amelyen a változtatás történt', 'Class:CMDBChangeOp/Attribute:finalclass' => 'CMDBChangeOp típus', 'Class:CMDBChangeOp/Attribute:finalclass+' => 'A végrehajtott változtatás típusa', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:CMDBChangeOpCreate' => 'Objektum létrehozás ', 'Class:CMDBChangeOpCreate+' => 'Objektum létrehozás nyomonkövetése', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:CMDBChangeOpDelete' => 'Objektum törlés', 'Class:CMDBChangeOpDelete+' => 'Objektum törlés nyomonkövetése', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:CMDBChangeOpSetAttribute' => 'Objektum változás', 'Class:CMDBChangeOpSetAttribute+' => 'Objektumtulajdonságok változáskövetése', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Attribútum', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'A módosított tulajdonság kódja', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'Tulajdonságváltozás', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Objektum skalár tulajdonságok változáskövetése', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Előző érték', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => 'Az attribútum korábbi értéke', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Új érték', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => 'Az attribútum új értéke', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Change:ObjectCreated' => 'Objektum létrehozva', 'Change:ObjectDeleted' => 'Objektum törölve', 'Change:ObjectModified' => 'Objektum módosítva', @@ -266,35 +266,35 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Change:LinkSet:Added' => '%1$s hozzáadva', 'Change:LinkSet:Removed' => '%1$s eltávolítva', 'Change:LinkSet:Modified' => '%1$s módosítva', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'Adatváltozás', 'Class:CMDBChangeOpSetAttributeBlob+' => 'Adatváltozás nyomonkövetése', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Előző adat', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => 'Az attribútum korábbi tartalma', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:CMDBChangeOpSetAttributeText' => 'Szövegváltozás', 'Class:CMDBChangeOpSetAttributeText+' => 'Szövegváltozás nyomonkövetése', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Előző adat', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'Az attribútum korábbi tartalma', -)); +]); // // Class: Event // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Event' => 'Naplóesemény', 'Class:Event+' => 'Egy alkalmazás belső esemény', 'Class:Event/Attribute:message' => 'Üzenet', @@ -305,13 +305,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Event/Attribute:userinfo+' => 'Annak a felhasználónak az azonosítása, aki az eseményt kiváltó műveletet végrehajtotta.', 'Class:Event/Attribute:finalclass' => 'Esemény típus', 'Class:Event/Attribute:finalclass+' => 'A végleges osztály neve: a bekövetkezett esemény fajtáját határozza meg.', -)); +]); // // Class: EventNotification // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:EventNotification' => 'Értesítési esemény', 'Class:EventNotification+' => 'Az elküldött értesítések nyomonkövetése', 'Class:EventNotification/Attribute:trigger_id' => 'Eseményindító', @@ -320,13 +320,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:EventNotification/Attribute:action_id+' => '', 'Class:EventNotification/Attribute:object_id' => 'Objektum azonosító', 'Class:EventNotification/Attribute:object_id+' => 'Objektum azonosítója (eseményindító határozza meg az osztályt ?)', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:EventNotificationEmail' => 'Email küldés esemény', 'Class:EventNotificationEmail+' => 'A kiküldött email-ek nyomonkövetése', 'Class:EventNotificationEmail/Attribute:to' => 'Címzett', @@ -343,13 +343,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:EventNotificationEmail/Attribute:body+' => '', 'Class:EventNotificationEmail/Attribute:attachments' => 'Mellékletek', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:EventIssue' => 'Probléma esemény', 'Class:EventIssue+' => 'Egy probléma (figyelmeztetés, hiba, stb. nyomonkövetése)', 'Class:EventIssue/Attribute:issue' => 'Probléma', @@ -366,13 +366,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:EventIssue/Attribute:callstack+' => '', 'Class:EventIssue/Attribute:data' => 'Adat', 'Class:EventIssue/Attribute:data+' => 'További információ', -)); +]); // // Class: EventWebService // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:EventWebService' => 'Webszolgáltatás esemény', 'Class:EventWebService+' => 'Webszolgáltatás hívás nyomonkövetése', 'Class:EventWebService/Attribute:verb' => 'Művelet', @@ -387,9 +387,9 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:EventWebService/Attribute:log_error+' => 'A kapott hibák naplója ', 'Class:EventWebService/Attribute:data' => 'Adat', 'Class:EventWebService/Attribute:data+' => 'A kapott adatok', -)); +]); -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:EventRestService' => 'REST/JSON hívás', 'Class:EventRestService+' => 'REST/JSON szolgáltatáshívás nyomonkövetése', 'Class:EventRestService/Attribute:operation' => 'Művelet', @@ -404,13 +404,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:EventRestService/Attribute:json_output+' => 'HTTP válasz (json)', 'Class:EventRestService/Attribute:provider' => 'Szolgáltató', 'Class:EventRestService/Attribute:provider+' => 'A várt műveletet végrehajtó PHP osztály', -)); +]); // // Class: EventLoginUsage // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:EventLoginUsage' => 'Belépések', 'Class:EventLoginUsage+' => 'Kapcsolódások az alkalmazáshoz', 'Class:EventLoginUsage/Attribute:user_id' => 'Felhasználónév', @@ -419,13 +419,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '', 'Class:EventLoginUsage/Attribute:contact_email' => 'Kapcsolattartó email cím', 'Class:EventLoginUsage/Attribute:contact_email+' => 'A felhasználó email címe', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:EventNotificationNewsroom' => 'News sent~~', 'Class:EventNotificationNewsroom+' => '~~', 'Class:EventNotificationNewsroom/Attribute:title' => 'Title~~', @@ -454,13 +454,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '~~', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact~~', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '~~', -)); +]); // // Class: Action // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Action' => 'Egyéni művelet', 'Class:Action+' => 'A felhasználó által meghatározott művelet', 'Class:Action/ComplementaryName' => '%1$s: %2$s~~', @@ -490,24 +490,24 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Action:last_executions_tab_panel_title' => 'Executions of this action (%1$s)~~', 'Action:last_executions_tab_limit_days' => 'past %1$s days~~', 'Action:last_executions_tab_limit_none' => 'no limit~~', -)); +]); // // Class: ActionNotification // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ActionNotification' => 'Értesítés', 'Class:ActionNotification+' => 'Értesítés (absztrakt)', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ActionEmail' => 'Email értesítés', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'Ez az állapot határozza meg, hogy ki kapjon értesítést: csak a teszt címzettje, mindenki (Címzett, cc és Bcc) vagy senki.', @@ -558,14 +558,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'ActionEmail:preview_warning' => 'The actual eMail may look different in the eMail client than this preview in your browser.~~', 'ActionEmail:preview_more_info' => 'For more information about the CSS features supported by the different eMail clients, refer to %1$s~~', 'ActionEmail:content_placeholder_missing' => 'The placeholder "%1$s" was not found in the HTML template. The content of the field "%2$s" will not be included in the generated emails.~~', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'ActionNewsroom:trigger' => 'Trigger~~', 'ActionNewsroom:content' => 'Message~~', 'ActionNewsroom:settings' => 'Settings~~', @@ -600,13 +599,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'An OQL query returning Contact objects~~', 'Class:ActionNewsroom/Attribute:url' => 'URL~~', 'Class:ActionNewsroom/Attribute:url+' => 'By default, it points to the object triggering the notification. But you can also specify a custom URL.~~', -)); +]); // // Class: Trigger // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Trigger' => 'Eseményindító', 'Class:Trigger+' => 'Egyéni eseménykezelés', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~', @@ -625,13 +624,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Allow complete unsubscription~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Force at least one channel (News or Email)~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Deny unsubscription~~', -)); +]); // // Class: TriggerOnObject // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TriggerOnObject' => 'Eseményindító (osztályfüggő)', 'Class:TriggerOnObject+' => 'Az objektumok egy adott osztályára történő eseményindítás', 'Class:TriggerOnObject/Attribute:target_class' => 'Cél osztály', @@ -640,115 +639,115 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Korlátozza az objektumlistát (a célosztályból), amely aktiválja az eseményindítót.', 'TriggerOnObject:WrongFilterQuery' => 'Helytelen szűrőkérdés: %1$s', 'TriggerOnObject:WrongFilterClass' => 'A szűrő lekérdezésnek %1$s osztályú objektumokat kell visszaadnia.', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TriggerOnPortalUpdate' => 'Eseményindító (amikor a portálról frissül)', 'Class:TriggerOnPortalUpdate+' => 'Eseményindító egy végfelhasználó által a portálon történő frissítéskor', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TriggerOnStateChange' => 'Eseményindító (állapotváltozásnál)', 'Class:TriggerOnStateChange+' => 'Eseményindító egy objektum állapotának változásakor', 'Class:TriggerOnStateChange/Attribute:state' => 'Állapot', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TriggerOnStateEnter' => 'Eseményindító (állapot felvételekor)', 'Class:TriggerOnStateEnter+' => 'Az objektum állapotváltozásba lépéskor elinduló eseményindító', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TriggerOnStateLeave' => 'Eseményindító (állapot elhagyáskor)', 'Class:TriggerOnStateLeave+' => 'Az objektum állapotváltozás elhagyásakor elinduló eseményindító', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TriggerOnObjectCreate' => 'Eseményindító (objektum létrehozáskor)', 'Class:TriggerOnObjectCreate+' => 'Az adott osztály [egy gyermekosztálya] objektumának létrehozásakor elinduló eseményindító.', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TriggerOnObjectDelete' => 'Eseményindító (objektum törléskor)', 'Class:TriggerOnObjectDelete+' => 'Az adott osztály [egy gyermekosztálya] objektumának törlésekor elinduló eseményindító.', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TriggerOnObjectUpdate' => 'Eseményindító (objektum frissítéskor)', 'Class:TriggerOnObjectUpdate+' => 'Az adott osztály [egy gyermekosztálya] objektumának frissítésekor elinduló eseményindító', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Célmezők', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TriggerOnObjectMention' => 'Eseményindító (objektumra hivatkozáskor)', 'Class:TriggerOnObjectMention+' => 'Az adott osztály [egy gyermekosztálya] objektumára (@xxx) hivatkozáskor egy naplóattribútumban', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Hivatkozás szűrő', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'A hivatkozott objektumok listájának korlátozása, amelyek aktiválják az eseményindítót. Ha üres, akkor bármelyik említett objektum (bármely osztályból) aktiválja azt.', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TriggerOnAttributeBlobDownload' => 'Trigger (on object\'s document download)~~', 'Class:TriggerOnAttributeBlobDownload+' => 'Trigger on object\'s document field download of [a child class of] the given class~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Target fields~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '~~', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TriggerOnThresholdReached' => 'Eseményindító (küszöbértéknél)', 'Class:TriggerOnThresholdReached+' => 'Eseményindító egy időzítő küszöbértékének elérésekor', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Időzítő', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Küszöbérték', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkTriggerAction' => 'Művelet/Eseményindító', 'Class:lnkTriggerAction+' => 'Kapcsolat egy eseményindító és egy művelet között', 'Class:lnkTriggerAction/Attribute:action_id' => 'Művelet', @@ -761,12 +760,12 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Sorrend', 'Class:lnkTriggerAction/Attribute:order+' => 'A műveletek végrehajtási sorrendje', -)); +]); // // Synchro Data Source // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:SynchroDataSource' => 'Szinkron adatforrás', 'Class:SynchroDataSource/Attribute:name' => 'Név', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1054,13 +1053,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Core:Validator:MustBeInteger' => 'Egész számnak kell lennie', 'Core:Validator:MustSelectOne' => 'Egyet válasszon', 'Menu:DataSources' => 'Szinkronizációs adatforrások', - 'Menu:DataSources+' => 'Minden szinkronizációs adatforrás' -)); + 'Menu:DataSources+' => 'Minden szinkronizációs adatforrás', +]); // // Class: TagSetFieldData // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:TagSetFieldData' => '%2$s a %1$s osztályhoz', 'Class:TagSetFieldData+' => '', 'Class:TagSetFieldData/Attribute:code' => 'Kód', @@ -1082,12 +1081,12 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Az "Attribútumkód" címkék nem módosíthatók', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Címkehasználat (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => 'Nincs bejegyzés ehhez a címkéhez', -)); +]); // // Class: DBProperty // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:DBProperty' => 'DB tulajdonságok', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Név', @@ -1100,12 +1099,12 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Megjegyzés', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:BackgroundTask' => 'Háttérfeladat', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Osztálynév', @@ -1130,12 +1129,12 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'Állapot', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:AsyncTask' => 'Aszinkron feladat', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Létrehozva', @@ -1160,43 +1159,40 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:AsyncTask/Attribute:last_attempt+' => '', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Érvénytelen formátum az async_task_retries[%1$s] konfigurációhoz. A következő kulcsokkal rendelkező tömböt vár: %2$s', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Az async_task_retries[%1$s] konfigurációjának érvénytelen formátuma: %2$s váratlan kulcs. Csak a következő kulcsokat várja: %3$s', -)); +]); // // Class: AbstractResource // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:AbstractResource' => 'Absztrakt erőforrás', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ResourceAdminMenu' => 'Erőforrás admin menü', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ResourceRunQueriesMenu' => 'Erőforrás lekérdezések futtatása menü', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:ResourceSystemMenu' => 'Erőforrás rendszer menü', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/hu.dictionary.itop.ui.php b/dictionaries/hu.dictionary.itop.ui.php index 5c2b5d799..e072923c6 100755 --- a/dictionaries/hu.dictionary.itop.ui.php +++ b/dictionaries/hu.dictionary.itop.ui.php @@ -1,15 +1,16 @@ 'Audit kategória', 'Class:AuditCategory+' => '', 'Class:AuditCategory/Attribute:name' => 'Kategórianév', @@ -26,13 +27,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Percentage of invalid objects below which the result is in error (red)~~', 'Class:AuditCategory/Attribute:domains_list' => 'Domains~~', 'Class:AuditCategory/Attribute:domains_list+' => 'Domains which include this category~~', -)); +]); // // Class: AuditRule // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:AuditRule' => 'Auditszabály', 'Class:AuditRule+' => '', 'Class:AuditRule/Attribute:name' => 'Szabály név', @@ -51,13 +52,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:AuditRule/Attribute:category_id+' => '', 'Class:AuditRule/Attribute:category_name' => 'Kategórianév', 'Class:AuditRule/Attribute:category_name+' => '', -)); +]); // // Class: AuditDomain // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:AuditDomain' => 'Audit Domain~~', 'Class:AuditDomain+' => 'Audit domains allow to group the audit categories. Domain usually correspond to who is responsible for checking and fixing errors~~', @@ -69,13 +70,13 @@ Domain usually correspond to who is responsible for checking and fixing errors~~ 'Class:AuditDomain/Attribute:icon+' => '~~', 'Class:AuditDomain/Attribute:categories_list' => 'Categories~~', 'Class:AuditDomain/Attribute:categories_list+' => 'Related audit categories. When running the audit on a domain, all related audit categories are checked and only those.~~', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Link AuditCategory / AuditDomain~~', 'Class:lnkAuditCategoryToAuditDomain+' => '~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Category~~', @@ -86,13 +87,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Audit domain~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Domain name~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Audit domain name~~', -)); +]); // // Class: QueryOQL // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:Query' => 'Lekérdezés', 'Class:Query+' => 'A query is a data set defined in a dynamic way~~', 'Class:Query/Attribute:name' => 'Név', @@ -119,7 +120,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:QueryOQL+' => 'A query based on the Object Query Language~~', 'Class:QueryOQL/Attribute:oql' => 'Kifejezés', 'Class:QueryOQL/Attribute:oql+' => 'OQL kifejezés', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -130,7 +131,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( // Class: User // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:User' => 'Felhasználó', 'Class:User+' => '', 'Class:User/Attribute:finalclass' => 'Felhasználó típus', @@ -176,13 +177,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:User/Warning:NoContactHasImpact' => 'Cautious: there is no Person defined on this User, this prevents access to portals, news notifications and other side effects in back-office~~', 'Class:UserInternal' => 'Belső felhasználó', 'Class:UserInternal+' => ITOP_APPLICATION_SHORT.'-n belül létrehozott felhasználó', -)); +]); // // Class: URP_Profiles // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:URP_Profiles' => 'Profil', 'Class:URP_Profiles+' => '', 'Class:URP_Profiles/Attribute:name' => 'Profilnév', @@ -191,13 +192,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:URP_Profiles/Attribute:description+' => '', 'Class:URP_Profiles/Attribute:user_list' => 'Felhasználók', 'Class:URP_Profiles/Attribute:user_list+' => '', -)); +]); // // Class: URP_Dimensions // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:URP_Dimensions' => 'Dimenzió', 'Class:URP_Dimensions+' => '', 'Class:URP_Dimensions/Attribute:name' => 'Dimenziónév', @@ -206,13 +207,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:URP_Dimensions/Attribute:description+' => '', 'Class:URP_Dimensions/Attribute:type' => 'Típus', 'Class:URP_Dimensions/Attribute:type+' => '', -)); +]); // // Class: URP_UserProfile // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:URP_UserProfile' => 'Profilhoz rendelt felhasználók', 'Class:URP_UserProfile+' => '', 'Class:URP_UserProfile/Name' => 'Kapcsolat %1$s és %2$s között', @@ -226,14 +227,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:URP_UserProfile/Attribute:profile+' => '', 'Class:URP_UserProfile/Attribute:reason' => 'Indoklás', 'Class:URP_UserProfile/Attribute:reason+' => '', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:URP_UserOrg' => 'Felhasználó szervezeti tagsága', 'Class:URP_UserOrg+' => '', 'Class:URP_UserOrg/Name' => 'Kapcsolat %1$s és %2$s között', @@ -247,13 +247,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => '', 'Class:URP_UserOrg/Attribute:reason' => 'Indoklás', 'Class:URP_UserOrg/Attribute:reason+' => '', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:URP_ProfileProjection' => 'profile_projection', 'Class:URP_ProfileProjection+' => '', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Dimenzió', @@ -268,13 +268,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:URP_ProfileProjection/Attribute:value+' => '', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Attribútum', 'Class:URP_ProfileProjection/Attribute:attribute+' => '', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:URP_ClassProjection' => 'class_projection', 'Class:URP_ClassProjection+' => '', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Dimenzió', @@ -287,13 +287,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:URP_ClassProjection/Attribute:value+' => '', 'Class:URP_ClassProjection/Attribute:attribute' => 'Attribútum', 'Class:URP_ClassProjection/Attribute:attribute+' => '', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:URP_ActionGrant' => 'action_permission', 'Class:URP_ActionGrant+' => '', 'Class:URP_ActionGrant/Attribute:profileid' => 'Profil', @@ -310,13 +310,13 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => '', 'Class:URP_ActionGrant/Attribute:action' => 'Művelet', 'Class:URP_ActionGrant/Attribute:action+' => '', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:URP_StimulusGrant' => 'stimulus_permission', 'Class:URP_StimulusGrant+' => '', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Profil', @@ -333,25 +333,25 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => '', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Stimulus', 'Class:URP_StimulusGrant/Attribute:stimulus+' => '', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:URP_AttributeGrant' => 'attribute_permission', 'Class:URP_AttributeGrant+' => '', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Művelet engedély', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => '', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Attribútum', 'Class:URP_AttributeGrant/Attribute:attcode+' => '', -)); +]); // // Class: UserDashboard // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Class:UserDashboard' => 'Felhasználói műszerfal', 'Class:UserDashboard+' => '~~', 'Class:UserDashboard/Attribute:user_id' => 'Felhasználó', @@ -360,12 +360,12 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Class:UserDashboard/Attribute:menu_code+' => '~~', 'Class:UserDashboard/Attribute:contents' => 'Tartalom', 'Class:UserDashboard/Attribute:contents+' => '~~', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Menu:WelcomeMenu' => 'Kezdőoldal', 'Menu:WelcomeMenu+' => '', 'Menu:WelcomeMenuPage' => 'Áttekintő', @@ -384,14 +384,14 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Menu:MyShortcuts' => 'Saját gyorsgombok', 'Menu:Notifications:Title' => 'Audit kategóriák', 'Menu:DataAdministration' => 'Adat adminisztráció', - 'Menu:DataAdministration+' => '' -)); + 'Menu:DataAdministration+' => '', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'BooleanLabel:yes' => 'Igen', 'BooleanLabel:no' => 'Nem', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.' bejelentkezés', @@ -1539,13 +1539,13 @@ A művelet eseményindítóhoz rendelésekor kap egy sorszámot , amely meghatá 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'A kijelölt objektumok gyermekei is szerepelnek.', 'UI:Search:Criteria:Raw:Filtered' => 'Szűrt', 'UI:Search:Criteria:Raw:FilteredOn' => '%1$s által szűrve', - 'UI:StateChanged' => 'Megváltozott állapot' -)); + 'UI:StateChanged' => 'Megváltozott állapot', +]); // // Expression to Natural language // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Expression:Operator:AND' => ' ÉS ', 'Expression:Operator:OR' => ' VAGY ', 'Expression:Operator:=' => ': ', @@ -1558,12 +1558,12 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Expression:Unit:Long:MINUTE' => 'perc', 'Expression:Verb:NOW' => 'most', 'Expression:Verb:ISNULL' => ': meghatározatlan', -)); +]); // // iTop Newsroom menu // -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'UI:Newsroom:NoNewMessage' => 'Nincs új üzenet', 'UI:Newsroom:XNewMessage' => '%1$s új üzenet', 'UI:Newsroom:MarkAllAsRead' => 'Üzenetek jelölése olvasottként', @@ -1578,10 +1578,9 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgent~~', 'UI:Newsroom:Priority:3:Tooltip' => 'Important~~', 'UI:Newsroom:Priority:4:Tooltip' => 'Normal~~', -)); +]); - -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'Menu:DataSources' => 'Szinkronizációs adatforrások', 'Menu:DataSources+' => '', 'Menu:AuditCategories' => 'Audit kategóriák', @@ -1609,4 +1608,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Menu:Integrations' => 'Integrációk', 'Menu:Integrations+' => '~~', -)); +]); diff --git a/dictionaries/it.dictionary.itop.core.php b/dictionaries/it.dictionary.itop.core.php index 2815ea6e6..ff3aba81e 100644 --- a/dictionaries/it.dictionary.itop.core.php +++ b/dictionaries/it.dictionary.itop.core.php @@ -1,15 +1,16 @@ '%1s (cancellato)', 'Core:DeletedObjectTip' => 'L\'oggetto è stato cancellato il %1$s (%2$s)', 'Core:UnknownObjectLabel' => 'Oggetto non trovato (classe: %1$s, id: %2$d)', @@ -157,8 +158,7 @@ Operatori:
          'Core:Context=GUI:Console' => 'Console', 'Core:Context=CRON' => 'cron', 'Core:Context=GUI:Portal' => 'Portale', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -169,7 +169,7 @@ Operatori:
          // Class: CMDBChange // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:CMDBChange' => 'Cambio', 'Class:CMDBChange+' => 'Rilevamento delle modifiche', 'Class:CMDBChange/Attribute:date' => 'data', @@ -184,13 +184,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'Servizi web REST/JSON', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'Servizi web SOAP', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'Da un\'estensione', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:CMDBChangeOp' => 'Operazione di cambio', 'Class:CMDBChangeOp+' => 'Rilevamento delle operazioni di cambio', 'Class:CMDBChangeOp/Attribute:change' => 'cambio', @@ -205,51 +205,51 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:CMDBChangeOp/Attribute:objkey+' => '', 'Class:CMDBChangeOp/Attribute:finalclass' => 'tipo', 'Class:CMDBChangeOp/Attribute:finalclass+' => '', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:CMDBChangeOpCreate' => 'creazione oggetto', 'Class:CMDBChangeOpCreate+' => 'Rilevamento creazione oggetto', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:CMDBChangeOpDelete' => 'cancellazione oggetto', 'Class:CMDBChangeOpDelete+' => 'Rilevamento cancellazione oggetto', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:CMDBChangeOpSetAttribute' => 'cambio oggetto', 'Class:CMDBChangeOpSetAttribute+' => 'Rilevamento modifiche delle proprietà dell\'oggetto', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Attributo', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'ccodice della proprietà modificata', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'proprietà cambio', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Rilevamento delle modifiche delle proprietà scalari dell\'oggetto', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Valore precedente', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => 'valore precedente dell\'attributo', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Nuovo valore', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => 'nuovo valore dell\'attributo', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Change:ObjectCreated' => 'Oggetto creato', 'Change:ObjectDeleted' => 'Oggetto cancellato', 'Change:ObjectModified' => 'Oggetto modificato', @@ -266,35 +266,35 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Change:LinkSet:Added' => 'aggiunto %1$s', 'Change:LinkSet:Removed' => 'rimosso %1$s', 'Change:LinkSet:Modified' => 'modificato %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'dati del cambio', 'Class:CMDBChangeOpSetAttributeBlob+' => 'rilevamento dati del cambio', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Dati precedente', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => 'contenuto precedente dell\'attributo', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:CMDBChangeOpSetAttributeText' => 'cambio testo', 'Class:CMDBChangeOpSetAttributeText+' => 'rilevamento cambio testo', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Dati precendenti', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'contenuto precedente dell\'attributo', -)); +]); // // Class: Event // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Event' => 'Log Evento', 'Class:Event+' => 'Un\'applicazione evento interno', 'Class:Event/Attribute:message' => 'Messagio', @@ -305,13 +305,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Event/Attribute:userinfo+' => 'l\'identificazione dell\'utente che stava facendo l\'azione che ha attivato questo evento', 'Class:Event/Attribute:finalclass' => 'Tipo', 'Class:Event/Attribute:finalclass+' => '', -)); +]); // // Class: EventNotification // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:EventNotification' => 'Notifica dell\'evento', 'Class:EventNotification+' => 'Traccia di una notifica che è stato inviato', 'Class:EventNotification/Attribute:trigger_id' => 'Trigger', @@ -320,13 +320,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:EventNotification/Attribute:action_id+' => 'account utente', 'Class:EventNotification/Attribute:object_id' => 'Id oggetto', 'Class:EventNotification/Attribute:object_id+' => 'Id oggetto (classe definita dal trigger ?)', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:EventNotificationEmail' => 'Emissione evento Email', 'Class:EventNotificationEmail+' => 'Traccia di una e-mail che è stato inviata', 'Class:EventNotificationEmail/Attribute:to' => 'A', @@ -343,13 +343,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:EventNotificationEmail/Attribute:body+' => '', 'Class:EventNotificationEmail/Attribute:attachments' => 'Allegati', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:EventIssue' => 'Evento Problematico', 'Class:EventIssue+' => 'Traccia di un problema (avviso, errore, etc)', 'Class:EventIssue/Attribute:issue' => 'Problema', @@ -366,13 +366,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:EventIssue/Attribute:callstack+' => '', 'Class:EventIssue/Attribute:data' => 'Dati', 'Class:EventIssue/Attribute:data+' => 'Informazioni aggiuntive', -)); +]); // // Class: EventWebService // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:EventWebService' => 'Evento di servizio web', 'Class:EventWebService+' => 'Traccia di una chiamata di servizio web', 'Class:EventWebService/Attribute:verb' => 'Verbo', @@ -387,9 +387,9 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:EventWebService/Attribute:log_error+' => 'Risultati error log', 'Class:EventWebService/Attribute:data' => 'Dati', 'Class:EventWebService/Attribute:data+' => 'Risultati dei dati', -)); +]); -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:EventRestService' => 'Chiamata REST/JSON', 'Class:EventRestService+' => 'Traccia di una chiamata del servizio REST/JSON', 'Class:EventRestService/Attribute:operation' => 'Operazione', @@ -404,13 +404,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:EventRestService/Attribute:json_output+' => 'Risposta HTTP (json)', 'Class:EventRestService/Attribute:provider' => 'Provider', 'Class:EventRestService/Attribute:provider+' => 'Classe PHP che implementa l\'operazione prevista', -)); +]); // // Class: EventLoginUsage // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:EventLoginUsage' => 'Uso Login', 'Class:EventLoginUsage+' => 'Connessione all\'applicazione', 'Class:EventLoginUsage/Attribute:user_id' => 'Login', @@ -419,13 +419,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '', 'Class:EventLoginUsage/Attribute:contact_email' => 'User Email', 'Class:EventLoginUsage/Attribute:contact_email+' => 'Indirizzo email dell\'utente', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:EventNotificationNewsroom' => 'Notizia inviata', 'Class:EventNotificationNewsroom+' => '~~', 'Class:EventNotificationNewsroom/Attribute:title' => 'Titolo', @@ -454,13 +454,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '~~', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contatto', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '', -)); +]); // // Class: Action // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Action' => 'Azione personalizzata', 'Class:Action+' => 'Azione definita dall\'utente', 'Class:Action/ComplementaryName' => '%1$s: %2$s~~', @@ -490,24 +490,24 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Action:last_executions_tab_panel_title' => 'Esecuzioni di questa azione (%1$s)', 'Action:last_executions_tab_limit_days' => 'ultimi %1$s giorni', 'Action:last_executions_tab_limit_none' => 'nessun limite', -)); +]); // // Class: ActionNotification // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ActionNotification' => 'Notifica', 'Class:ActionNotification+' => 'Notifica (sommario)', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ActionEmail' => 'Email di notifica', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'Questo stato determina chi verrà notificato: solo il destinatario di prova, tutti (To, Cc e Bcc) o nessuno', @@ -558,14 +558,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'ActionEmail:preview_warning' => 'L\'e-mail effettiva potrebbe apparire diversa nel client di posta elettronica rispetto a questa anteprima nel tuo browser.', 'ActionEmail:preview_more_info' => 'Per ulteriori informazioni sulle funzionalità CSS supportate dai diversi client di posta elettronica, consulta %1$s', 'ActionEmail:content_placeholder_missing' => 'Il segnaposto "%1$s" non è stato trovato nel template HTML. Il contenuto del campo "%2$s" non verrà incluso nelle email generate.', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'ActionNewsroom:trigger' => 'Trigger', 'ActionNewsroom:content' => 'Messaggio', 'ActionNewsroom:settings' => 'Impostazioni', @@ -600,13 +599,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'Una query OQL che restituisce oggetti Contatto', 'Class:ActionNewsroom/Attribute:url' => 'URL', 'Class:ActionNewsroom/Attribute:url+' => 'L\'URL punterà all\'oggetto che attiva la notifica. Ma puoi anche specificare un URL personalizzato.', -)); +]); // // Class: Trigger // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Trigger' => 'Trigger', 'Class:Trigger+' => 'Gestore di eventi personalizzati', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s', @@ -625,13 +624,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Consenti annullamento completo dell\'iscrizione', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Obbliga almeno un canale (News o Email)', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Nega l\'annullamento dell\'iscrizione', -)); +]); // // Class: TriggerOnObject // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TriggerOnObject' => 'Trigger (classe dipendente)', 'Class:TriggerOnObject+' => 'Trigger su una determinata classe di oggetti', 'Class:TriggerOnObject/Attribute:target_class' => 'Classe Bersaglio', @@ -640,115 +639,115 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Limita l\'elenco degli oggetti (della classe bersaglio) che attiveranno il trigger', 'TriggerOnObject:WrongFilterQuery' => 'Query di filtro errata: %1$s', 'TriggerOnObject:WrongFilterClass' => 'La query di filtro deve restituire oggetti della classe \\"%1$s\\"', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TriggerOnPortalUpdate' => 'Trigger (dopo l\'aggiornamento dal portale )', 'Class:TriggerOnPortalUpdate+' => 'Trigger sull\'aggiornamento dell\'utente dal portale', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TriggerOnStateChange' => 'Trigger (su cambio stato)', 'Class:TriggerOnStateChange+' => 'Trigger su cambio stato di un oggetto', 'Class:TriggerOnStateChange/Attribute:state' => 'Stato', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TriggerOnStateEnter' => 'Trigger (all\'entrata di uno stato)', 'Class:TriggerOnStateEnter+' => 'Trigger su cambio stato di un oggetto - entrata', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TriggerOnStateLeave' => 'Trigger (all\'uscita di uno stato)', 'Class:TriggerOnStateLeave+' => 'Trigger su cambio stato di un oggetto - uscita', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TriggerOnObjectCreate' => 'Trigger (sulla creazione)', 'Class:TriggerOnObjectCreate+' => 'Trigger sulla creazione di un oggetto [una classe figlia di] di una data classe', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TriggerOnObjectDelete' => 'Trigger (alla cancellazione dell\'oggetto)', 'Class:TriggerOnObjectDelete+' => 'Trigger alla cancellazione dell\'oggetto di [una classe figlia della] classe specificata', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TriggerOnObjectUpdate' => 'Trigger (alla modifica dell\'oggetto)', 'Class:TriggerOnObjectUpdate+' => 'Trigger alla modifica dell\'oggetto di [una classe figlia della] classe specificata', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Campi di destinazione', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TriggerOnObjectMention' => 'Trigger (alla menzione dell\'oggetto)', 'Class:TriggerOnObjectMention+' => 'Trigger alla menzione (@xxx) di un oggetto di [una classe figlia della] classe specificata in un attributo di log', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Filtro menzionato', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Limita l\'elenco degli oggetti menzionati che attiveranno il trigger. Se vuoto, qualsiasi oggetto menzionato (di qualsiasi classe) lo attiverà.', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TriggerOnAttributeBlobDownload' => 'Trigger (al download del documento dell\'oggetto)', 'Class:TriggerOnAttributeBlobDownload+' => 'Trigger al download del campo documento dell\'oggetto di [una classe figlia della] classe specificata', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Campi di destinazione', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TriggerOnThresholdReached' => 'Trigger (sulla soglia raggiunta)', 'Class:TriggerOnThresholdReached+' => 'Trigger sulla soglia del cronometro raggiunta', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Cronometro', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Soglia', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkTriggerAction' => 'Azione/Trigger', 'Class:lnkTriggerAction+' => 'Collegamento tra trigger e azione', 'Class:lnkTriggerAction/Attribute:action_id' => 'Azione', @@ -761,12 +760,12 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Ordine', 'Class:lnkTriggerAction/Attribute:order+' => 'Ordine di esecuzione delle azioni', -)); +]); // // Synchro Data Source // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:SynchroDataSource' => 'Sorgente sincronizzazione dati', 'Class:SynchroDataSource/Attribute:name' => 'Nome', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1051,13 +1050,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Core:Validator:MustBeInteger' => 'Deve essere un numero intero', 'Core:Validator:MustSelectOne' => 'Per favore, seleziona uno', 'Menu:DataSources' => 'Sorgente di sincronizzazione dei dati', - 'Menu:DataSources+' => '' -)); + 'Menu:DataSources+' => '', +]); // // Class: TagSetFieldData // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:TagSetFieldData' => '%2$s per la classe %1$s', 'Class:TagSetFieldData+' => '', 'Class:TagSetFieldData/Attribute:code' => 'Codice', @@ -1079,12 +1078,12 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Il "Codice attributo" dei tag non può essere cambiato', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Utilizzo tag (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => 'Nessuna voce trovata per questo tag', -)); +]); // // Class: DBProperty // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:DBProperty' => 'Proprietà DB', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Nome', @@ -1097,12 +1096,12 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Commento modifica', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:BackgroundTask' => 'Task in background', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Nome della classe', @@ -1127,12 +1126,12 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'Stato', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:AsyncTask' => 'Attività asincrona', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Creata', @@ -1157,43 +1156,40 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:AsyncTask/Attribute:last_attempt+' => '', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Formato non valido per la configurazione di "async_task_retries[%1$s]". Ci si aspetta un array con le seguenti chiavi: %2$s', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Formato non valido per la configurazione di "async_task_retries[%1$s]": chiave "%2$s" inaspettata. Ci si aspetta solo le seguenti chiavi: %3$s', -)); +]); // // Class: AbstractResource // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:AbstractResource' => 'Risorsa Astratta', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ResourceAdminMenu' => 'Menu di Amministrazione delle Risorse', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ResourceRunQueriesMenu' => 'Menu Esegui Query Risorse', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:ResourceSystemMenu' => 'Menu di Sistema delle Risorse', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/it.dictionary.itop.ui.php b/dictionaries/it.dictionary.itop.ui.php index a209f63ef..f75a4d802 100644 --- a/dictionaries/it.dictionary.itop.ui.php +++ b/dictionaries/it.dictionary.itop.ui.php @@ -1,15 +1,16 @@ 'Categoria di Audit', 'Class:AuditCategory+' => 'Una sezione all\'interno del controllo globale', 'Class:AuditCategory/Attribute:name' => 'Nome della categoria', @@ -26,13 +27,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Percentuale di oggetti non validi al di sotto della quale il risultato è un errore (rosso)', 'Class:AuditCategory/Attribute:domains_list' => 'Domini', 'Class:AuditCategory/Attribute:domains_list+' => 'Domini che includono questa categoria', -)); +]); // // Class: AuditRule // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:AuditRule' => 'Regola di Audit', 'Class:AuditRule+' => '', 'Class:AuditRule/Attribute:name' => 'Nome della regola', @@ -51,13 +52,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:AuditRule/Attribute:category_id+' => 'Categoria per questa regola', 'Class:AuditRule/Attribute:category_name' => 'Categoria', 'Class:AuditRule/Attribute:category_name+' => 'Nome della categoria per questa regola', -)); +]); // // Class: AuditDomain // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:AuditDomain' => 'Dominio di Audit', 'Class:AuditDomain+' => 'I domini di audit permettono di raggruppare le categorie di audit. Il dominio di solito corrisponde a chi è responsabile del controllo e della correzione degli errori o semplicemente interessato.', @@ -69,13 +70,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:AuditDomain/Attribute:icon+' => '~~', 'Class:AuditDomain/Attribute:categories_list' => 'Categorie', 'Class:AuditDomain/Attribute:categories_list+' => 'Categorie di audit correlate. Quando si esegue l\'audit su un dominio, vengono controllate solo le categorie di audit correlate.', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Collegamento Categoria Audit / Dominio Audit', 'Class:lnkAuditCategoryToAuditDomain+' => '~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Categoria', @@ -86,13 +87,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Dominio di Audit', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Nome dominio', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Nome dominio di Audit', -)); +]); // // Class: QueryOQL // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:Query' => 'Query', 'Class:Query+' => 'Una query è un insieme di dati definito in modo dinamico', 'Class:Query/Attribute:name' => 'Nome', @@ -119,7 +120,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:QueryOQL+' => 'Una query basata su Object Query Language', 'Class:QueryOQL/Attribute:oql' => 'Espressione', 'Class:QueryOQL/Attribute:oql+' => 'Espressione OQL', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -130,7 +131,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( // Class: User // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:User' => 'Utente', 'Class:User+' => 'Login Utente', 'Class:User/Attribute:finalclass' => 'Tipo di account', @@ -176,13 +177,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:User/Warning:NoContactHasImpact' => 'Attenzione: non è definita alcuna Persona per questo Utente, ciò impedisce l\'accesso ai portali, le notifiche di notizie e altri effetti collaterali nel back-office', 'Class:UserInternal' => 'Utente Interno', 'Class:UserInternal+' => 'Utente definito all\'interno di '.ITOP_APPLICATION_SHORT, -)); +]); // // Class: URP_Profiles // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:URP_Profiles' => 'Profilo', 'Class:URP_Profiles+' => '', 'Class:URP_Profiles/Attribute:name' => 'Nome', @@ -191,13 +192,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:URP_Profiles/Attribute:description+' => 'una linea di descrizione', 'Class:URP_Profiles/Attribute:user_list' => 'Utenti', 'Class:URP_Profiles/Attribute:user_list+' => 'Persone che hanno questo ruuolo', -)); +]); // // Class: URP_Dimensions // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:URP_Dimensions' => 'dimensione', 'Class:URP_Dimensions+' => 'dimensione dell\'applicazione (definizione di silos))', 'Class:URP_Dimensions/Attribute:name' => 'Nome', @@ -206,13 +207,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:URP_Dimensions/Attribute:description+' => 'una linea di descrizione', 'Class:URP_Dimensions/Attribute:type' => 'Tipo', 'Class:URP_Dimensions/Attribute:type+' => 'nome della classe o tipo di dato (proiezione dell\'unità)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:URP_UserProfile' => 'Utente da Profilare', 'Class:URP_UserProfile+' => '', 'Class:URP_UserProfile/Name' => 'Collegamento tra %1$s e %2$s', @@ -226,14 +227,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:URP_UserProfile/Attribute:profile+' => 'Nome del profilo', 'Class:URP_UserProfile/Attribute:reason' => 'Motivo', 'Class:URP_UserProfile/Attribute:reason+' => 'spiega perchè questo utente dovrebbe avere questo ruolo', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:URP_UserOrg' => 'Organizzazione dell\'utente', 'Class:URP_UserOrg+' => '', 'Class:URP_UserOrg/Name' => 'Collegamento tra %1$s e %2$s', @@ -247,13 +247,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => 'Organizzazione permesse', 'Class:URP_UserOrg/Attribute:reason' => 'Motivo', 'Class:URP_UserOrg/Attribute:reason+' => '', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:URP_ProfileProjection' => 'profile_projection', 'Class:URP_ProfileProjection+' => 'proiezioni di profilo', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Dimensione', @@ -268,13 +268,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'Espressione OQL (uso $user) | constante| | +codice attributo', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Attributo', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Codice attributo bersaglio (opzionale)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:URP_ClassProjection' => 'class_projection', 'Class:URP_ClassProjection+' => 'proiezioni di classe', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Dimensione', @@ -287,13 +287,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:URP_ClassProjection/Attribute:value+' => 'Espressione OQL (uso $this) | constante| | +codice attributo', 'Class:URP_ClassProjection/Attribute:attribute' => 'Attributo', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Codice attributo bersaglio (opzionale)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:URP_ActionGrant' => 'azione_autorizzazione', 'Class:URP_ActionGrant+' => 'permesso su classi', 'Class:URP_ActionGrant/Attribute:profileid' => 'Profilo', @@ -310,13 +310,13 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'no', 'Class:URP_ActionGrant/Attribute:action' => 'Azione', 'Class:URP_ActionGrant/Attribute:action+' => '', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:URP_StimulusGrant' => 'stimulus_autorizzazione', 'Class:URP_StimulusGrant+' => '', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Profilo', @@ -333,25 +333,25 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'no', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Stimulus', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'Codice per lo Stimolus', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:URP_AttributeGrant' => 'attributo_autorizzazione', 'Class:URP_AttributeGrant+' => 'autorizzazioni a livello di attributi', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Azione di sovvenzione', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'azione di sovvenzione', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Attributo', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'codice attributo', -)); +]); // // Class: UserDashboard // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Class:UserDashboard' => 'Dashboard Utente', 'Class:UserDashboard+' => '~~', 'Class:UserDashboard/Attribute:user_id' => 'Utente', @@ -360,12 +360,12 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Class:UserDashboard/Attribute:menu_code+' => '~~', 'Class:UserDashboard/Attribute:contents' => 'Contenuti', 'Class:UserDashboard/Attribute:contents+' => '~~', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Menu:WelcomeMenu' => 'Benveuto', 'Menu:WelcomeMenu+' => '', 'Menu:WelcomeMenuPage' => 'Benvenuto', @@ -384,14 +384,14 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Menu:MyShortcuts' => 'Le mie scorciatoie', 'Menu:Notifications:Title' => 'Categorie di Audit', 'Menu:DataAdministration' => 'Dati di amministrazione', - 'Menu:DataAdministration+' => '' -)); + 'Menu:DataAdministration+' => '', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'BooleanLabel:yes' => 'si', 'BooleanLabel:no' => 'no', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.' login', @@ -1535,13 +1535,13 @@ Quando è associata a un trigger, a ogni azione è assegnato un numero "ordine", 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Verranno inclusi i figli degli oggetti selezionati.', 'UI:Search:Criteria:Raw:Filtered' => 'Filtrato', 'UI:Search:Criteria:Raw:FilteredOn' => 'Filtrato su %1$s', - 'UI:StateChanged' => 'Stato cambiato' -)); + 'UI:StateChanged' => 'Stato cambiato', +]); // // Expression to Natural language // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Expression:Operator:AND' => ' E ', 'Expression:Operator:OR' => ' O ', 'Expression:Operator:=' => ': ', @@ -1554,12 +1554,12 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Expression:Unit:Long:MINUTE' => 'minuto(i)', 'Expression:Verb:NOW' => 'ora', 'Expression:Verb:ISNULL' => ': non definito', -)); +]); // // iTop Newsroom menu // -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'UI:Newsroom:NoNewMessage' => 'Nessun nuovo messaggio', 'UI:Newsroom:XNewMessage' => '%1$s nuovo/i messaggio/i', 'UI:Newsroom:MarkAllAsRead' => 'Segna tutti come letti', @@ -1574,10 +1574,9 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgente', 'UI:Newsroom:Priority:3:Tooltip' => 'Importante', 'UI:Newsroom:Priority:4:Tooltip' => 'Normale', -)); +]); - -Dict::Add('IT IT', 'Italian', 'Italiano', array( +Dict::Add('IT IT', 'Italian', 'Italiano', [ 'Menu:DataSources' => 'Sorgente di sincronizzazione dei dati', 'Menu:DataSources+' => '', 'Menu:AuditCategories' => 'Categorie di Audit', @@ -1605,4 +1604,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Menu:Integrations' => 'Integrations~~', 'Menu:Integrations+' => '~~', -)); +]); diff --git a/dictionaries/ja.dictionary.itop.core.php b/dictionaries/ja.dictionary.itop.core.php index 5796bb05a..eb7f4780c 100644 --- a/dictionaries/ja.dictionary.itop.core.php +++ b/dictionaries/ja.dictionary.itop.core.php @@ -1,15 +1,16 @@ '%1$s (削除されました)', 'Core:DeletedObjectTip' => 'オブジェクトは削除されました %1$s (%2$s)', 'Core:UnknownObjectLabel' => 'オブジェクトは見つかりません (クラス: %1$s, id: %2$d)', @@ -157,8 +158,7 @@ Operators:
          'Core:Context=GUI:Console' => 'Console~~', 'Core:Context=CRON' => 'cron~~', 'Core:Context=GUI:Portal' => 'Portal~~', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -169,7 +169,7 @@ Operators:
          // Class: CMDBChange // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:CMDBChange' => '変更', 'Class:CMDBChange+' => '変更履歴', 'Class:CMDBChange/Attribute:date' => '日付', @@ -184,13 +184,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON webservices~~', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP webservices~~', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'By an extension~~', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:CMDBChangeOp' => '変更操作', 'Class:CMDBChangeOp+' => '変更操作履歴', 'Class:CMDBChangeOp/Attribute:change' => '変更', @@ -205,51 +205,51 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:CMDBChangeOp/Attribute:objkey+' => 'オブジェクトID', 'Class:CMDBChangeOp/Attribute:finalclass' => 'タイプ', 'Class:CMDBChangeOp/Attribute:finalclass+' => '', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:CMDBChangeOpCreate' => 'オブジェクト作成', 'Class:CMDBChangeOpCreate+' => 'オブジェクト作成履歴', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:CMDBChangeOpDelete' => 'オブジェクト削除', 'Class:CMDBChangeOpDelete+' => 'オブジェクト削除履歴', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:CMDBChangeOpSetAttribute' => 'オブジェクト更新', 'Class:CMDBChangeOpSetAttribute+' => 'オブジェクトプロパティの更新履歴', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => '属性', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => '更新プロパティのコード', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'プロパティ更新', 'Class:CMDBChangeOpSetAttributeScalar+' => 'オブジェクトのスカラープロパティの更新履歴', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => '変更前の値', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => '属性の変更前の値', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => '新規の値', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => '属性の新規の値', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Change:ObjectCreated' => 'オブジェクトを生成しました', 'Change:ObjectDeleted' => 'オブジェクトを削除しました', 'Change:ObjectModified' => 'オブジェクトを修正しました', @@ -266,35 +266,35 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Change:LinkSet:Added' => '追加されました %1$s', 'Change:LinkSet:Removed' => '削除されました %1$s', 'Change:LinkSet:Modified' => '修正されました %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'データ変更', 'Class:CMDBChangeOpSetAttributeBlob+' => 'データ変更履歴', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => '以前のデータ', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => 'この属性の以前の内容', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:CMDBChangeOpSetAttributeText' => 'テキストの変更', 'Class:CMDBChangeOpSetAttributeText+' => 'テキストの変更履歴', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => '以前の内容', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'この属性の以前の内容', -)); +]); // // Class: Event // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Event' => 'ログイベント', 'Class:Event+' => 'アプリケーション内部イベント', 'Class:Event/Attribute:message' => 'メッセージ', @@ -305,13 +305,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Event/Attribute:userinfo+' => 'このイベントをトリガーしたアクションを行ったユーザ', 'Class:Event/Attribute:finalclass' => 'タイプ', 'Class:Event/Attribute:finalclass+' => '', -)); +]); // // Class: EventNotification // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:EventNotification' => '通知イベント', 'Class:EventNotification+' => '送信された通知のトレース', 'Class:EventNotification/Attribute:trigger_id' => 'トリガー', @@ -320,13 +320,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:EventNotification/Attribute:action_id+' => 'ユーザアカウント', 'Class:EventNotification/Attribute:object_id' => 'オブジェクトID', 'Class:EventNotification/Attribute:object_id+' => 'オブジェクトID(トリガーでクラスが定義済み?)', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:EventNotificationEmail' => 'メール送出イベント', 'Class:EventNotificationEmail+' => '送出されたメールのトレース', 'Class:EventNotificationEmail/Attribute:to' => 'TO', @@ -343,13 +343,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:EventNotificationEmail/Attribute:body+' => '本文', 'Class:EventNotificationEmail/Attribute:attachments' => '添付', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:EventIssue' => '課題', 'Class:EventIssue+' => '課題(警告、エラー、etc)のトレース', 'Class:EventIssue/Attribute:issue' => '課題', @@ -366,13 +366,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:EventIssue/Attribute:callstack+' => 'スタックをコールする', 'Class:EventIssue/Attribute:data' => 'データ', 'Class:EventIssue/Attribute:data+' => '追加情報', -)); +]); // // Class: EventWebService // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:EventWebService' => 'ウェブサービスイベント', 'Class:EventWebService+' => 'ウェブサービス呼出のトレース', 'Class:EventWebService/Attribute:verb' => '動作', @@ -387,9 +387,9 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:EventWebService/Attribute:log_error+' => 'エラーログ結果', 'Class:EventWebService/Attribute:data' => 'データ', 'Class:EventWebService/Attribute:data+' => '結果データ', -)); +]); -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:EventRestService' => 'REST/JSON call~~', 'Class:EventRestService+' => 'Trace of a REST/JSON service call~~', 'Class:EventRestService/Attribute:operation' => 'Operation~~', @@ -404,13 +404,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:EventRestService/Attribute:json_output+' => 'HTTP response (json)~~', 'Class:EventRestService/Attribute:provider' => 'Provider~~', 'Class:EventRestService/Attribute:provider+' => 'PHP class implementing the expected operation~~', -)); +]); // // Class: EventLoginUsage // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:EventLoginUsage' => 'ログイン方法', 'Class:EventLoginUsage+' => 'アプリケーションへ接続します。', 'Class:EventLoginUsage/Attribute:user_id' => 'ログイン', @@ -419,13 +419,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:EventLoginUsage/Attribute:contact_name+' => 'ユーザ名', 'Class:EventLoginUsage/Attribute:contact_email' => 'ユーザのEmail', 'Class:EventLoginUsage/Attribute:contact_email+' => 'ユーザの電子メールアドレス', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:EventNotificationNewsroom' => 'News sent~~', 'Class:EventNotificationNewsroom+' => '~~', 'Class:EventNotificationNewsroom/Attribute:title' => 'Title~~', @@ -454,13 +454,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '~~', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact~~', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '~~', -)); +]); // // Class: Action // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Action' => 'カスタムアクション', 'Class:Action+' => 'ユーザ定義アクション', 'Class:Action/ComplementaryName' => '%1$s: %2$s~~', @@ -490,24 +490,24 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Action:last_executions_tab_panel_title' => 'Executions of this action (%1$s)~~', 'Action:last_executions_tab_limit_days' => 'past %1$s days~~', 'Action:last_executions_tab_limit_none' => 'no limit~~', -)); +]); // // Class: ActionNotification // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ActionNotification' => '通知', 'Class:ActionNotification+' => '通知(要約)', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ActionEmail' => 'メール通知', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'This status drives who will be notified: @@ -562,14 +562,13 @@ If omitted the From (label) is used.~~', 'ActionEmail:preview_warning' => 'The actual eMail may look different in the eMail client than this preview in your browser.~~', 'ActionEmail:preview_more_info' => 'For more information about the CSS features supported by the different eMail clients, refer to %1$s~~', 'ActionEmail:content_placeholder_missing' => 'The placeholder "%1$s" was not found in the HTML template. The content of the field "%2$s" will not be included in the generated emails.~~', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'ActionNewsroom:trigger' => 'Trigger~~', 'ActionNewsroom:content' => 'Message~~', 'ActionNewsroom:settings' => 'Settings~~', @@ -604,13 +603,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'An OQL query returning Contact objects~~', 'Class:ActionNewsroom/Attribute:url' => 'URL~~', 'Class:ActionNewsroom/Attribute:url+' => 'By default, it points to the object triggering the notification. But you can also specify a custom URL.~~', -)); +]); // // Class: Trigger // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Trigger' => 'トリガー', 'Class:Trigger+' => 'カスタムイベントハンドラー', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~', @@ -629,13 +628,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Allow complete unsubscription~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Force at least one channel (News or Email)~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Deny unsubscription~~', -)); +]); // // Class: TriggerOnObject // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TriggerOnObject' => 'トリガー(クラス依存)', 'Class:TriggerOnObject+' => 'オブジェクトの指定されたクラスのトリガー', 'Class:TriggerOnObject/Attribute:target_class' => 'ターゲットクラス', @@ -644,115 +643,115 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Limit the object list (of the target class) which will activate the trigger~~', 'TriggerOnObject:WrongFilterQuery' => 'Wrong filter query: %1$s~~', 'TriggerOnObject:WrongFilterClass' => 'The filter query must return objects of class "%1$s"~~', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TriggerOnPortalUpdate' => 'トリガー(ポータルから更新された時)', 'Class:TriggerOnPortalUpdate+' => 'エンドユーザがポータルから更新した場合のトリガー', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TriggerOnStateChange' => '(状態変化の)トリガー', 'Class:TriggerOnStateChange+' => 'オブジェクトの状態変化のトリガー', 'Class:TriggerOnStateChange/Attribute:state' => '状態', 'Class:TriggerOnStateChange/Attribute:state+' => '状態', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TriggerOnStateEnter' => '入状態トリガー', 'Class:TriggerOnStateEnter+' => 'オブジェクトの状態へ入る変化(エンター,on entering a state)時のトリガー', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TriggerOnStateLeave' => '出状態トリガー', 'Class:TriggerOnStateLeave+' => 'オブジェクトの状態から出る変化(リーブ,on leaving a state)時のトリガー', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TriggerOnObjectCreate' => 'オブジェクト作成トリガー', 'Class:TriggerOnObjectCreate+' => '指定されたクラスの(子クラスの)オブジェクト作成時のトリガ', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TriggerOnObjectDelete' => 'Trigger (on object deletion)~~', 'Class:TriggerOnObjectDelete+' => 'Trigger on object deletion of [a child class of] the given class~~', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TriggerOnObjectUpdate' => 'Trigger (on object update)~~', 'Class:TriggerOnObjectUpdate+' => 'Trigger on object update of [a child class of] the given class~~', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Target fields~~', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '~~', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TriggerOnObjectMention' => 'Trigger (on object mention)~~', 'Class:TriggerOnObjectMention+' => 'Trigger on mention (@xxx) of an object of [a child class of] the given class in a log attribute~~', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Mentioned filter~~', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Limit the list of mentioned objects which will activate the trigger. If empty, any mentioned object (of any class) will activate it.~~', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TriggerOnAttributeBlobDownload' => 'Trigger (on object\'s document download)~~', 'Class:TriggerOnAttributeBlobDownload+' => 'Trigger on object\'s document field download of [a child class of] the given class~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Target fields~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '~~', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TriggerOnThresholdReached' => 'トリガー (on threshold)', 'Class:TriggerOnThresholdReached+' => 'トリガー (on Stop-Watch threshold reached)', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'ストップウオッチ', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'しきい値', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkTriggerAction' => 'トリガ/アクション', 'Class:lnkTriggerAction+' => 'トリガとアクション間のリンク', 'Class:lnkTriggerAction/Attribute:action_id' => 'アクション', @@ -765,12 +764,12 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => '順序', 'Class:lnkTriggerAction/Attribute:order+' => 'アクション実行順序', -)); +]); // // Synchro Data Source // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:SynchroDataSource' => '同期データソース', 'Class:SynchroDataSource/Attribute:name' => '名前', 'Class:SynchroDataSource/Attribute:name+' => '名前', @@ -1058,13 +1057,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Core:Validator:MustBeInteger' => 'Must be an integer~~', 'Core:Validator:MustSelectOne' => 'Please, select one~~', 'Menu:DataSources' => '同期データソース', - 'Menu:DataSources+' => '全ての同期データソース' -)); + 'Menu:DataSources+' => '全ての同期データソース', +]); // // Class: TagSetFieldData // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:TagSetFieldData' => '%2$s for class %1$s~~', 'Class:TagSetFieldData+' => '~~', 'Class:TagSetFieldData/Attribute:code' => 'Code~~', @@ -1086,12 +1085,12 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Tags "Attribute Code" cannot be changed~~', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Tag usage (%1$d)~~', 'Core:TagSetFieldData:NoEntryFound' => 'No entry found for this tag~~', -)); +]); // // Class: DBProperty // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:DBProperty' => 'DB property~~', 'Class:DBProperty+' => '~~', 'Class:DBProperty/Attribute:name' => 'Name~~', @@ -1104,12 +1103,12 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:DBProperty/Attribute:change_date+' => '~~', 'Class:DBProperty/Attribute:change_comment' => 'Change comment~~', 'Class:DBProperty/Attribute:change_comment+' => '~~', -)); +]); // // Class: BackgroundTask // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:BackgroundTask' => 'Background task~~', 'Class:BackgroundTask+' => '~~', 'Class:BackgroundTask/Attribute:class_name' => 'Class name~~', @@ -1134,12 +1133,12 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:BackgroundTask/Attribute:running+' => '~~', 'Class:BackgroundTask/Attribute:status' => 'Status~~', 'Class:BackgroundTask/Attribute:status+' => '~~', -)); +]); // // Class: AsyncTask // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:AsyncTask' => 'Async. task~~', 'Class:AsyncTask+' => '~~', 'Class:AsyncTask/Attribute:created' => 'Created~~', @@ -1164,43 +1163,40 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:AsyncTask/Attribute:last_attempt+' => '~~', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]". Expecting an array with the following keys: %2$s~~', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]": unexpected key "%2$s". Expecting only the following keys: %3$s~~', -)); +]); // // Class: AbstractResource // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:AbstractResource' => 'Abstract Resource~~', 'Class:AbstractResource+' => '~~', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ResourceAdminMenu' => 'Resource Admin Menu~~', 'Class:ResourceAdminMenu+' => '~~', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ResourceRunQueriesMenu' => 'Resource Run Queries Menu~~', 'Class:ResourceRunQueriesMenu+' => '~~', -)); +]); // // Class: Action // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:ResourceSystemMenu' => 'Resource System Menu~~', 'Class:ResourceSystemMenu+' => '~~', -)); - - - +]); diff --git a/dictionaries/ja.dictionary.itop.ui.php b/dictionaries/ja.dictionary.itop.ui.php index c97e6c4cd..74551f4be 100644 --- a/dictionaries/ja.dictionary.itop.ui.php +++ b/dictionaries/ja.dictionary.itop.ui.php @@ -1,15 +1,16 @@ '監査カテゴリ', 'Class:AuditCategory+' => '監査全体の内部セクション', 'Class:AuditCategory/Attribute:name' => 'カテゴリ名', @@ -26,13 +27,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Percentage of invalid objects below which the result is in error (red)~~', 'Class:AuditCategory/Attribute:domains_list' => 'Domains~~', 'Class:AuditCategory/Attribute:domains_list+' => 'Domains which include this category~~', -)); +]); // // Class: AuditRule // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:AuditRule' => '監査ルール', 'Class:AuditRule+' => '指定された監査カテゴリをチェックするためのルール', 'Class:AuditRule/Attribute:name' => 'ルール名', @@ -51,13 +52,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:AuditRule/Attribute:category_id+' => 'このルールのカテゴリ', 'Class:AuditRule/Attribute:category_name' => 'カテゴリ', 'Class:AuditRule/Attribute:category_name+' => 'このルールのカテゴリ名', -)); +]); // // Class: AuditDomain // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:AuditDomain' => 'Audit Domain~~', 'Class:AuditDomain+' => 'Audit domains allow to group the audit categories. Domain usually correspond to who is responsible for checking and fixing errors~~', @@ -69,13 +70,13 @@ Domain usually correspond to who is responsible for checking and fixing errors~~ 'Class:AuditDomain/Attribute:icon+' => '~~', 'Class:AuditDomain/Attribute:categories_list' => 'Categories~~', 'Class:AuditDomain/Attribute:categories_list+' => 'Related audit categories. When running the audit on a domain, all related audit categories are checked and only those.~~', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Link AuditCategory / AuditDomain~~', 'Class:lnkAuditCategoryToAuditDomain+' => '~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Category~~', @@ -86,13 +87,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Audit domain~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Domain name~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Audit domain name~~', -)); +]); // // Class: QueryOQL // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:Query' => 'クエリ', 'Class:Query+' => 'クエリは動的な方法で定義されるデータセットです。', 'Class:Query/Attribute:name' => '名前', @@ -119,7 +120,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:QueryOQL+' => ' Object Query Language に基づいたクエリ', 'Class:QueryOQL/Attribute:oql' => '式', 'Class:QueryOQL/Attribute:oql+' => 'OQL 式', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -130,7 +131,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( // Class: User // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:User' => 'ユーザー', 'Class:User+' => 'ユーザーログイン', 'Class:User/Attribute:finalclass' => 'アカウントタイプ', @@ -176,13 +177,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:User/Warning:NoContactHasImpact' => 'Cautious: there is no Person defined on this User, this prevents access to portals, news notifications and other side effects in back-office~~', 'Class:UserInternal' => 'User Internal~~', 'Class:UserInternal+' => 'User defined within '.ITOP_APPLICATION_SHORT.'~~', -)); +]); // // Class: URP_Profiles // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:URP_Profiles' => 'プロフィール', 'Class:URP_Profiles+' => 'ユーザプロフィール', 'Class:URP_Profiles/Attribute:name' => '名前', @@ -191,13 +192,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:URP_Profiles/Attribute:description+' => '1行の説明', 'Class:URP_Profiles/Attribute:user_list' => 'ユーザー', 'Class:URP_Profiles/Attribute:user_list+' => 'この役割をもつ人', -)); +]); // // Class: URP_Dimensions // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:URP_Dimensions' => 'ディメンション', 'Class:URP_Dimensions+' => 'アプリケーションディメンション(defining silos)', 'Class:URP_Dimensions/Attribute:name' => '名前', @@ -206,13 +207,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:URP_Dimensions/Attribute:description+' => '1行の説明', 'Class:URP_Dimensions/Attribute:type' => 'タイプ', 'Class:URP_Dimensions/Attribute:type+' => 'クラス名、もしくはデータ型(projection unit)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:URP_UserProfile' => 'ユーザープロフィール', 'Class:URP_UserProfile+' => 'ユーザープロフィール', 'Class:URP_UserProfile/Name' => '%1$s と %2$s間のリンク', @@ -226,14 +227,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:URP_UserProfile/Attribute:profile+' => 'プロフィール名', 'Class:URP_UserProfile/Attribute:reason' => '理由', 'Class:URP_UserProfile/Attribute:reason+' => 'なぜ、この人物がこの役割を持つかを説明する', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:URP_UserOrg' => 'ユーザー組織', 'Class:URP_UserOrg+' => '許可された組織', 'Class:URP_UserOrg/Name' => '%1$s と %2$s 間のリンク', @@ -247,13 +247,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => '許可された組織', 'Class:URP_UserOrg/Attribute:reason' => '理由', 'Class:URP_UserOrg/Attribute:reason+' => 'なぜこの人物がこの組織に属するデータを参照できるのかを説明する', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:URP_ProfileProjection' => 'プロフィールプロジェクション', 'Class:URP_ProfileProjection+' => 'プロフィールプロジェクション', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'ディメンション', @@ -268,13 +268,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:URP_ProfileProjection/Attribute:value+' => '($userを使う)OQL式 | 定数 | | +属性コード', 'Class:URP_ProfileProjection/Attribute:attribute' => '属性', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'ターゲット属性コード (オプション)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:URP_ClassProjection' => 'クラスプロジェクション', 'Class:URP_ClassProjection+' => 'クラスのプロジェクション', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'ディメンション', @@ -287,13 +287,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:URP_ClassProjection/Attribute:value+' => '($this を使った)OQL式 | 定数 | | +属性コード', 'Class:URP_ClassProjection/Attribute:attribute' => '属性', 'Class:URP_ClassProjection/Attribute:attribute+' => 'ターゲット属性コード(オプション)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:URP_ActionGrant' => 'アクション権限', 'Class:URP_ActionGrant+' => 'クラスに対する権限', 'Class:URP_ActionGrant/Attribute:profileid' => 'プロフィール', @@ -310,13 +310,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'いいえ', 'Class:URP_ActionGrant/Attribute:action' => 'アクション', 'Class:URP_ActionGrant/Attribute:action+' => '指定されたクラスに実行する操作', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:URP_StimulusGrant' => 'シティミュラス権限', 'Class:URP_StimulusGrant+' => 'オブジェクトのライフサイクル中のシティミュラスにおける権限', 'Class:URP_StimulusGrant/Attribute:profileid' => 'プロフィール', @@ -333,25 +333,25 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'いいえ', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'シティミュラス', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'シティミュラスコード', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:URP_AttributeGrant' => '属性権限', 'Class:URP_AttributeGrant+' => '属性レベルでの権限', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => '実行権限', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => '実行権限', 'Class:URP_AttributeGrant/Attribute:attcode' => '属性', 'Class:URP_AttributeGrant/Attribute:attcode+' => '属性コード', -)); +]); // // Class: UserDashboard // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Class:UserDashboard' => 'User dashboard~~', 'Class:UserDashboard+' => '~~', 'Class:UserDashboard/Attribute:user_id' => 'User~~', @@ -360,12 +360,12 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Class:UserDashboard/Attribute:menu_code+' => '~~', 'Class:UserDashboard/Attribute:contents' => 'Contents~~', 'Class:UserDashboard/Attribute:contents+' => '~~', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Menu:WelcomeMenu' => 'ようこそ', 'Menu:WelcomeMenu+' => 'ようこそ、'.ITOP_APPLICATION_SHORT.'へ', 'Menu:WelcomeMenuPage' => 'ようこそ', @@ -384,14 +384,14 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Menu:MyShortcuts' => '私のショートカット', 'Menu:Notifications:Title' => '監査カテゴリ', 'Menu:DataAdministration' => 'データ管理', - 'Menu:DataAdministration+' => 'データ管理' -)); + 'Menu:DataAdministration+' => 'データ管理', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'BooleanLabel:yes' => 'はい', 'BooleanLabel:no' => 'いいえ', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.' login~~', @@ -1540,13 +1540,13 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Children of the selected objects will be included.~~', 'UI:Search:Criteria:Raw:Filtered' => 'Filtered~~', 'UI:Search:Criteria:Raw:FilteredOn' => 'Filtered on %1$s~~', - 'UI:StateChanged' => 'State changed~~' -)); + 'UI:StateChanged' => 'State changed~~', +]); // // Expression to Natural language // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Expression:Operator:AND' => ' AND ~~', 'Expression:Operator:OR' => ' OR ~~', 'Expression:Operator:=' => ': ~~', @@ -1559,12 +1559,12 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Expression:Unit:Long:MINUTE' => 'minute(s)~~', 'Expression:Verb:NOW' => 'now~~', 'Expression:Verb:ISNULL' => ': undefined~~', -)); +]); // // iTop Newsroom menu // -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'UI:Newsroom:NoNewMessage' => 'No new message~~', 'UI:Newsroom:XNewMessage' => '%1$s new message(s)~~', 'UI:Newsroom:MarkAllAsRead' => 'Mark all messages as read~~', @@ -1579,10 +1579,9 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgent~~', 'UI:Newsroom:Priority:3:Tooltip' => 'Important~~', 'UI:Newsroom:Priority:4:Tooltip' => 'Normal~~', -)); +]); - -Dict::Add('JA JP', 'Japanese', '日本語', array( +Dict::Add('JA JP', 'Japanese', '日本語', [ 'Menu:DataSources' => '同期データソース', 'Menu:DataSources+' => '全ての同期データソース', 'Menu:AuditCategories' => '監査カテゴリ', @@ -1610,4 +1609,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Menu:Integrations' => 'Integrations~~', 'Menu:Integrations+' => '~~', -)); +]); diff --git a/dictionaries/nl.dictionary.itop.core.php b/dictionaries/nl.dictionary.itop.core.php index 1b527f9fd..e95bd1e7a 100644 --- a/dictionaries/nl.dictionary.itop.core.php +++ b/dictionaries/nl.dictionary.itop.core.php @@ -1,17 +1,18 @@ * @author Thomas Casteleyn * @author Jeffrey Bostoen (2019 - 2022) */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Core:DeletedObjectLabel' => '%1s (verwijderd)', 'Core:DeletedObjectTip' => 'Het object is verwijderd op %1$s (%2$s)', 'Core:UnknownObjectLabel' => 'Object niet gevonden (klasse: %1$s, id: %2$d)', @@ -159,8 +160,7 @@ Operators:
          'Core:Context=GUI:Console' => 'Console', 'Core:Context=CRON' => 'cron', 'Core:Context=GUI:Portal' => 'Portaal', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -171,7 +171,7 @@ Operators:
          // Class: CMDBChange // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:CMDBChange' => 'Aanpassing', 'Class:CMDBChange+' => 'Opvolging van aanpassingen', 'Class:CMDBChange/Attribute:date' => 'datum', @@ -186,13 +186,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON webservices', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP webservices', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'Via een extensie', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:CMDBChangeOp' => 'Aanpassingsactie', 'Class:CMDBChangeOp+' => 'Opvolging van uitgevoerde aanpassingen', 'Class:CMDBChangeOp/Attribute:change' => 'Aanpassing', @@ -207,51 +207,51 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:CMDBChangeOp/Attribute:objkey+' => '', 'Class:CMDBChangeOp/Attribute:finalclass' => 'Soort', 'Class:CMDBChangeOp/Attribute:finalclass+' => '', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:CMDBChangeOpCreate' => 'Aanmaken object', 'Class:CMDBChangeOpCreate+' => 'Historiek van aanmaken van het object', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:CMDBChangeOpDelete' => 'Verwijderen object', 'Class:CMDBChangeOpDelete+' => 'Historiek van verwijderen van het object', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:CMDBChangeOpSetAttribute' => 'Aanpassen object', 'Class:CMDBChangeOpSetAttribute+' => 'Historiek van het aanpassen van de objecteigenschappen', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Attribuut', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'Code van de aangepaste eigenschap', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'Aanpassen objecteigenschap', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Historiek van gewijzigde eigenschappen', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Vorige waarde', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => 'Vorige waarde van de eigenschap', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Nieuwe waarde', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => 'Nieuwe waarde van de eigenschap', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Change:ObjectCreated' => 'Object aangemaakt', 'Change:ObjectDeleted' => 'Object verwijderd', 'Change:ObjectModified' => 'Object aangepast', @@ -268,35 +268,35 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Change:LinkSet:Added' => 'toegevoegd %1$s', 'Change:LinkSet:Removed' => 'verwijderd %1$s', 'Change:LinkSet:Modified' => 'aangepast %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'Aanpassen data', 'Class:CMDBChangeOpSetAttributeBlob+' => 'Historiek van data-aanpassingen', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Vorige data', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => 'Vorige inhoud van de eigenschap', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:CMDBChangeOpSetAttributeText' => 'Aanpassen tekst', 'Class:CMDBChangeOpSetAttributeText+' => 'Historiek van tekstaanpassingen', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Vorige data', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'Vorige inhoud van de eigenschap', -)); +]); // // Class: Event // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Event' => 'Gebeurtenis', 'Class:Event+' => 'Een interne gebeurtenis binnen de applicatie', 'Class:Event/Attribute:message' => 'Inhoud', @@ -307,13 +307,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Event/Attribute:userinfo+' => 'Info over wie/wat (bv. welke service) de aanpassing heeft doorgevoerd', 'Class:Event/Attribute:finalclass' => 'Type', 'Class:Event/Attribute:finalclass+' => '', -)); +]); // // Class: EventNotification // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:EventNotification' => 'Gebeurtenis - melding', 'Class:EventNotification+' => 'Historiek van de melding die getriggerd werd', 'Class:EventNotification/Attribute:trigger_id' => 'Trigger', @@ -322,13 +322,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:EventNotification/Attribute:action_id+' => 'De gebruiker die de melding veroorzaakte', 'Class:EventNotification/Attribute:object_id' => 'ID object', 'Class:EventNotification/Attribute:object_id+' => 'ID object (klasse gedefineerd door de trigger)', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:EventNotificationEmail' => 'Gebeurtenis - versturen van e-mail', 'Class:EventNotificationEmail+' => 'Historiek van de e-mail die verstuurd is', 'Class:EventNotificationEmail/Attribute:to' => 'Aan', @@ -345,13 +345,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:EventNotificationEmail/Attribute:body+' => '', 'Class:EventNotificationEmail/Attribute:attachments' => 'Bijlagen', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:EventIssue' => 'Gebeurtenis - probleem', 'Class:EventIssue+' => 'Log van een probleem (waarschuwing, fout, ...)', 'Class:EventIssue/Attribute:issue' => 'Probleem', @@ -368,13 +368,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:EventIssue/Attribute:callstack+' => '', 'Class:EventIssue/Attribute:data' => 'Data', 'Class:EventIssue/Attribute:data+' => 'Meer informatie', -)); +]); // // Class: EventWebService // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:EventWebService' => 'Gebeurtenis - web service', 'Class:EventWebService+' => 'Log van een webservice-aanroep', 'Class:EventWebService/Attribute:verb' => 'Werkwoord', @@ -389,9 +389,9 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:EventWebService/Attribute:log_error+' => 'Resultaat foutenlog', 'Class:EventWebService/Attribute:data' => 'Data', 'Class:EventWebService/Attribute:data+' => 'Resulterende data', -)); +]); -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:EventRestService' => 'Gebeurtenis - REST/JSON API-aanroep', 'Class:EventRestService+' => 'Log van een aangeroepen REST/JSON-service', 'Class:EventRestService/Attribute:operation' => 'Handeling', @@ -406,13 +406,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:EventRestService/Attribute:json_output+' => 'HTTP-antwoord (JSON)', 'Class:EventRestService/Attribute:provider' => 'Provider', 'Class:EventRestService/Attribute:provider+' => 'PHP-klasse die de verwachte handeling gebruikt', -)); +]); // // Class: EventLoginUsage // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:EventLoginUsage' => 'Gebeurtenis - gebruik van login', 'Class:EventLoginUsage+' => 'Verbinding met de applicatie', 'Class:EventLoginUsage/Attribute:user_id' => 'Login', @@ -421,13 +421,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '', 'Class:EventLoginUsage/Attribute:contact_email' => 'E-mailadres van de gebruiker', 'Class:EventLoginUsage/Attribute:contact_email+' => '', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:EventNotificationNewsroom' => 'News sent~~', 'Class:EventNotificationNewsroom+' => '', 'Class:EventNotificationNewsroom/Attribute:title' => 'Titel', @@ -456,13 +456,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '', -)); +]); // // Class: Action // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Action' => 'Actie', 'Class:Action+' => 'Door gebruiker gedefinieerde actie', 'Class:Action/ComplementaryName' => '%1$s: %2$s', @@ -492,24 +492,24 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Action:last_executions_tab_panel_title' => 'Uitvoeringen van deze actie (%1$s)', 'Action:last_executions_tab_limit_days' => 'laatste %1$s dagen', 'Action:last_executions_tab_limit_none' => 'geen limiet', -)); +]); // // Class: ActionNotification // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ActionNotification' => 'Melding', 'Class:ActionNotification+' => 'Melding (abstract)', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ActionEmail' => 'E-mailmelding', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'Status bepaalt wie op de hoogte zal gesteld worden: enkel de testontvanger, iedereen (Aan, CC en BCC) of niemand', @@ -560,14 +560,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'ActionEmail:preview_warning' => 'The actual eMail may look different in the eMail client than this preview in your browser.~~', 'ActionEmail:preview_more_info' => 'For more information about the CSS features supported by the different eMail clients, refer to %1$s~~', 'ActionEmail:content_placeholder_missing' => 'The placeholder "%1$s" was not found in the HTML template. The content of the field "%2$s" will not be included in the generated emails.~~', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'ActionNewsroom:trigger' => 'Triggers', 'ActionNewsroom:content' => 'Bericht', 'ActionNewsroom:settings' => 'Instellingen', @@ -602,13 +601,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'OQL die de lijst van Contacten definiëert', 'Class:ActionNewsroom/Attribute:url' => 'URL', 'Class:ActionNewsroom/Attribute:url+' => 'By default, it points to the object triggering the notification. But you can also specify a custom URL.~~', -)); +]); // // Class: Trigger // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Trigger' => 'Trigger', 'Class:Trigger+' => 'Aanleiding tot het uitvoeren van een actie', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s', @@ -627,13 +626,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Volledige uitschrijving toestaan', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Forceer minimaal één kanaal (nieuws of e-mail)', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Afmelding weigeren', -)); +]); // // Class: TriggerOnObject // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TriggerOnObject' => 'Trigger (afhankelijk van klasse)', 'Class:TriggerOnObject+' => 'Trigger op een bepaalde klasse van objecten', 'Class:TriggerOnObject/Attribute:target_class' => 'Toegepast op klasse', @@ -642,115 +641,115 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Beperk de objecten (van de opgegeven klasse) die de trigger zullen activeren.', 'TriggerOnObject:WrongFilterQuery' => 'Verkeerde filter-query: %1$s', 'TriggerOnObject:WrongFilterClass' => 'De filter-query moet verwijzen naar objecten van klasse "%1$s"', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TriggerOnPortalUpdate' => 'Trigger (als er vanuit het portaal geüpdatet wordt)', 'Class:TriggerOnPortalUpdate+' => 'Trigger op de update van de eindgebruiker van het portaal', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TriggerOnStateChange' => 'Trigger (als de status verandert)', 'Class:TriggerOnStateChange+' => 'Trigger als de status van het object verandert', 'Class:TriggerOnStateChange/Attribute:state' => 'Status', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TriggerOnStateEnter' => 'Trigger (als een status van toepassing wordt)', 'Class:TriggerOnStateEnter+' => 'Trigger als de status van het object naar deze status verandert', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TriggerOnStateLeave' => 'Trigger (als een status niet meer van toepassing is)', 'Class:TriggerOnStateLeave+' => 'Trigger als de status van het object niet meer deze status heeft', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TriggerOnObjectCreate' => 'Trigger (bij het aanmaken van een object)', 'Class:TriggerOnObjectCreate+' => 'Trigger bij het aanmaken van een object van de opgegeven klasse (of subklasse ervan)', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TriggerOnObjectDelete' => 'Trigger (bij het verwijderen van een object)', 'Class:TriggerOnObjectDelete+' => 'Trigger bij het verwijderen van een object van de opgegeven klasse (of subklasse ervan)', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TriggerOnObjectUpdate' => 'Trigger (bij het aanpassen van een object)', 'Class:TriggerOnObjectUpdate+' => 'Trigger bij het aanpassen van een object van de opgegeven klasse (of subklasse ervan)', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Doelvelden', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TriggerOnObjectMention' => 'Trigger (bij vermelden van object)', 'Class:TriggerOnObjectMention+' => 'Trigger bij vermelden (@xxx) van een object van de opgegeven klasse (of subklasse ervan) in een log', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Filter', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Beperk de lijst van vermelde objecten die de trigger zullen activeren. Indien leeg, zullen alle objecten (van eender welke klasse) de trigger activeren.', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TriggerOnAttributeBlobDownload' => 'Trigger (on object\'s document download)~~', 'Class:TriggerOnAttributeBlobDownload+' => 'Trigger on object\'s document field download of [a child class of] the given class~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Doelvelden', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TriggerOnThresholdReached' => 'Trigger (op drempelwaarde)', 'Class:TriggerOnThresholdReached+' => 'Trigger op Stopwatch drempelwaarde bereikt', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Stopwatch', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Drempelwaarde', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkTriggerAction' => 'Link Actie / Trigger', 'Class:lnkTriggerAction+' => 'Link tussen een trigger en een actie', 'Class:lnkTriggerAction/Attribute:action_id' => 'Actie', @@ -763,12 +762,12 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Volgorde', 'Class:lnkTriggerAction/Attribute:order+' => 'De volgorde in het uitvoeren van de actie', -)); +]); // // Synchro Data Source // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:SynchroDataSource' => 'Synchronisatie-databron', 'Class:SynchroDataSource/Attribute:name' => 'Naam', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1056,13 +1055,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Core:Validator:MustBeInteger' => 'Dit moet een integer (geheel getal) zijn', 'Core:Validator:MustSelectOne' => 'Gelieve één optie te kiezen', 'Menu:DataSources' => 'Synchronisatie Databronnen', - 'Menu:DataSources+' => 'Alle gesynchroniseerde Databronnen' -)); + 'Menu:DataSources+' => 'Alle gesynchroniseerde Databronnen', +]); // // Class: TagSetFieldData // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:TagSetFieldData' => '%2$s voor klasse %1$s', 'Class:TagSetFieldData+' => '', 'Class:TagSetFieldData/Attribute:code' => 'Code', @@ -1084,12 +1083,12 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Tags "Attribuutcode" kunnen niet aangepast worden', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Gebruik tags (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => 'Geen invoer gevorden voor deze tag', -)); +]); // // Class: DBProperty // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:DBProperty' => 'Database-eigenschap', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Naam', @@ -1102,12 +1101,12 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Commentaar wijziging', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:BackgroundTask' => 'Achtergrondtaak', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Naam klasse', @@ -1132,12 +1131,12 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'Status', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:AsyncTask' => 'Asynchrone taak', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Gemaakt', @@ -1162,43 +1161,40 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:AsyncTask/Attribute:last_attempt+' => '', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Ongeldig formaat bij de configuratie van "async_tasks_retries[%1$s]". Er wordt een Array verwacht met de volgende sleutels: %2$s', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Ongeldig formaat bij de configuratie van "async_tasks_retries[%1$s]": onverwachte sleutel "%2$s". Enkel deze sleutels worden verwacht: %3$s', -)); +]); // // Class: AbstractResource // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:AbstractResource' => 'Abstracte Tool', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ResourceAdminMenu' => 'Tool "Admin Menu"', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ResourceRunQueriesMenu' => 'Tool "Voer query\'s uit" Menu', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:ResourceSystemMenu' => 'Tool "System Menu"', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/nl.dictionary.itop.ui.php b/dictionaries/nl.dictionary.itop.ui.php index 703cd22ed..58bbc36ea 100644 --- a/dictionaries/nl.dictionary.itop.ui.php +++ b/dictionaries/nl.dictionary.itop.ui.php @@ -1,15 +1,16 @@ */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:AuditCategory' => 'Auditcategorie', 'Class:AuditCategory+' => 'Een onderdeel van de gehele audit', 'Class:AuditCategory/Attribute:name' => 'Naam categorie', @@ -26,13 +27,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Percentage of invalid objects below which the result is in error (red)~~', 'Class:AuditCategory/Attribute:domains_list' => 'Domeinen', 'Class:AuditCategory/Attribute:domains_list+' => 'Domains which include this category~~', -)); +]); // // Class: AuditRule // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:AuditRule' => 'Auditregel', 'Class:AuditRule+' => 'Een regel voor het controleren van een bepaalde Auditcategorie', 'Class:AuditRule/Attribute:name' => 'Naam regel', @@ -51,13 +52,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:AuditRule/Attribute:category_id+' => 'De categorie voor deze regel', 'Class:AuditRule/Attribute:category_name' => 'Categorie', 'Class:AuditRule/Attribute:category_name+' => 'Naam van de categorie voor deze regel', -)); +]); // // Class: AuditDomain // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:AuditDomain' => 'Audit Domein', 'Class:AuditDomain+' => 'Audit domeinen groeperen de audit categorieën. Het domein komt meestal overeen met wie er verantwoordelijk is om de fouten te controleren en oplossen', @@ -69,13 +70,13 @@ Het domein komt meestal overeen met wie er verantwoordelijk is om de fouten te c 'Class:AuditDomain/Attribute:icon+' => '', 'Class:AuditDomain/Attribute:categories_list' => 'Categorieën', 'Class:AuditDomain/Attribute:categories_list+' => 'Related audit categories. When running the audit on a domain, all related audit categories are checked and only those.~~', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Link AuditCategory / AuditDomain~~', 'Class:lnkAuditCategoryToAuditDomain+' => '', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Categorie', @@ -86,13 +87,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Audit domein', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Domein naam', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Audit domein naam', -)); +]); // // Class: QueryOQL // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:Query' => 'Query', 'Class:Query+' => 'Een query is een definie voor een dataset die op een dynamische manier wordt samengesteld', 'Class:Query/Attribute:name' => 'Naam', @@ -119,7 +120,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:QueryOQL+' => 'Een query gebaseerd op de Object Query Language', 'Class:QueryOQL/Attribute:oql' => 'Expressie', 'Class:QueryOQL/Attribute:oql+' => 'OQL-expressie', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -130,7 +131,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( // Class: User // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:User' => 'Gebruiker', 'Class:User+' => 'Login voor gebruiker', 'Class:User/Attribute:finalclass' => 'Accounttype', @@ -176,13 +177,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:User/Warning:NoContactHasImpact' => 'Cautious: there is no Person defined on this User, this prevents access to portals, news notifications and other side effects in back-office~~', 'Class:UserInternal' => 'Interne gebruiker', 'Class:UserInternal+' => 'Gebruiker gedefinieerd in '.ITOP_APPLICATION_SHORT, -)); +]); // // Class: URP_Profiles // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:URP_Profiles' => 'Profiel', 'Class:URP_Profiles+' => 'Gebruikersprofiel', 'Class:URP_Profiles/Attribute:name' => 'Naam', @@ -191,13 +192,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:URP_Profiles/Attribute:description+' => 'Beschrijving van dit profiel', 'Class:URP_Profiles/Attribute:user_list' => 'Gebruikers', 'Class:URP_Profiles/Attribute:user_list+' => 'Gebruikers met deze rol', -)); +]); // // Class: URP_Dimensions // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:URP_Dimensions' => 'Dimensie', 'Class:URP_Dimensions+' => 'Dimensie van de applicatie (definieert silo\'s)', 'Class:URP_Dimensions/Attribute:name' => 'Naam', @@ -206,13 +207,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:URP_Dimensions/Attribute:description+' => 'Beschrijving van deze dimensie', 'Class:URP_Dimensions/Attribute:type' => 'Type', 'Class:URP_Dimensions/Attribute:type+' => 'Klassenaam of data type (projection unit)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:URP_UserProfile' => 'Gebruiker / Profiel', 'Class:URP_UserProfile+' => 'Koppeling tussen gebruikers en profielen', 'Class:URP_UserProfile/Name' => 'Link tussen %1$s en %2$s', @@ -226,14 +227,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:URP_UserProfile/Attribute:profile+' => 'Naam van het profiel', 'Class:URP_UserProfile/Attribute:reason' => 'Reden', 'Class:URP_UserProfile/Attribute:reason+' => 'Leg uit waarom deze persoon deze rol heeft', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:URP_UserOrg' => 'Gebruiker / Organisatie', 'Class:URP_UserOrg+' => 'Koppeling tussen gebruikers en organisaties', 'Class:URP_UserOrg/Name' => 'Link tussen %1$s en %2$s', @@ -247,13 +247,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => 'Mijn organisatie', 'Class:URP_UserOrg/Attribute:reason' => 'Reden', 'Class:URP_UserOrg/Attribute:reason+' => 'Leg uit waarom deze persoon de data van deze organisatie mag inzien', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:URP_ProfileProjection' => 'profile_projection', 'Class:URP_ProfileProjection+' => 'profile projections', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Dimensie', @@ -268,13 +268,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'OQL-expressie (gebruikt $user) | constant | | +attribute code', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Attribuut', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Code van doelattribuut (optioneel)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:URP_ClassProjection' => 'class_projection', 'Class:URP_ClassProjection+' => 'class projections', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Dimensie', @@ -287,13 +287,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:URP_ClassProjection/Attribute:value+' => 'OQL-expressie (gebruikt $this) | constant | | +attribute code', 'Class:URP_ClassProjection/Attribute:attribute' => 'Attribuut', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Code van doelattribuut (optioneel)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:URP_ActionGrant' => 'action_permission', 'Class:URP_ActionGrant+' => 'Toestemming aan klasses', 'Class:URP_ActionGrant/Attribute:profileid' => 'Profiel', @@ -310,13 +310,13 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'Nee', 'Class:URP_ActionGrant/Attribute:action' => 'Actie', 'Class:URP_ActionGrant/Attribute:action+' => 'Actie om uit te voeren op een bepaalde klasse', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:URP_StimulusGrant' => 'stimulus_permission', 'Class:URP_StimulusGrant+' => 'Toegestane stimulus in de levenscyclus van het object', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Profiel', @@ -333,25 +333,25 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'Nee', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Stimulus', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'Code van stimulus', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:URP_AttributeGrant' => 'attribute_permission', 'Class:URP_AttributeGrant+' => 'Toestemming op het niveau van de attributen', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Actie verleen', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'Actie verleen', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Attribuut', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'Code van attribuut', -)); +]); // // Class: UserDashboard // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Class:UserDashboard' => 'Gebruikerdashboard', 'Class:UserDashboard+' => '', 'Class:UserDashboard/Attribute:user_id' => 'Gebruiker', @@ -360,12 +360,12 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Class:UserDashboard/Attribute:menu_code+' => '', 'Class:UserDashboard/Attribute:contents' => 'Inhoud', 'Class:UserDashboard/Attribute:contents+' => '', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:WelcomeMenu' => 'Welkom', 'Menu:WelcomeMenu+' => 'Welkom in '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage' => 'Welkom', 'Menu:WelcomeMenuPage+' => 'Welkom in '.ITOP_APPLICATION_SHORT, 'Menu:AdminTools' => 'Admintools', @@ -382,14 +382,14 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Menu:MyShortcuts' => 'Mijn snelkoppelingen', 'Menu:Notifications:Title' => 'Auditcategorieën', 'Menu:DataAdministration' => 'Databeheer', - 'Menu:DataAdministration+' => 'Databeheer' -)); + 'Menu:DataAdministration+' => 'Databeheer', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'BooleanLabel:yes' => 'Ja', 'BooleanLabel:no' => 'Nee', 'UI:Login:Title' => 'Aanmelden in '.ITOP_APPLICATION_SHORT, 'UI:WelcomeMenu:Title' => 'Welkom in '.ITOP_APPLICATION_SHORT, 'UI:WelcomeMenu:AllOpenRequests' => 'Open aanvragen: %1$d', @@ -1534,13 +1534,13 @@ Bij die koppeling wordt aan elke actie een volgorde-nummer gegeven. Dit bepaalt 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Sub-objecten van geselecteerde objecten zullen mee opgenomen worden.', 'UI:Search:Criteria:Raw:Filtered' => 'Gefilterd', 'UI:Search:Criteria:Raw:FilteredOn' => 'Gefiltered op %1$s', - 'UI:StateChanged' => 'Status veranderd' -)); + 'UI:StateChanged' => 'Status veranderd', +]); // // Expression to Natural language // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Expression:Operator:AND' => ' EN ', 'Expression:Operator:OR' => ' OF ', 'Expression:Operator:=' => ': ', @@ -1553,12 +1553,12 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Expression:Unit:Long:MINUTE' => 'minute(n)', 'Expression:Verb:NOW' => 'nu', 'Expression:Verb:ISNULL' => ': ongedefinieerd (NULL)', -)); +]); // // iTop Newsroom menu // -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'UI:Newsroom:NoNewMessage' => 'Geen nieuw bericht', 'UI:Newsroom:XNewMessage' => '%1$s nieuw(e) bericht(en)', 'UI:Newsroom:MarkAllAsRead' => 'Markeer alle berichten als gelezen', @@ -1573,10 +1573,9 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgent~~', 'UI:Newsroom:Priority:3:Tooltip' => 'Important~~', 'UI:Newsroom:Priority:4:Tooltip' => 'Normal~~', -)); +]); - -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'Menu:DataSources' => 'Synchronisatie-databronnen', 'Menu:DataSources+' => 'Alle Synchronisatie-databronnen', 'Menu:AuditCategories' => 'Auditcategorieën', @@ -1604,4 +1603,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Menu:Integrations' => 'Integraties', 'Menu:Integrations+' => '', -)); +]); diff --git a/dictionaries/pl.dictionary.itop.core.php b/dictionaries/pl.dictionary.itop.core.php index 0623e5bf3..f1f3c9ecf 100644 --- a/dictionaries/pl.dictionary.itop.core.php +++ b/dictionaries/pl.dictionary.itop.core.php @@ -1,15 +1,16 @@ '%1s (usunięto)', 'Core:DeletedObjectTip' => 'Obiekt został usunięty w dniu %1$s (%2$s)', 'Core:UnknownObjectLabel' => 'Nie znaleziono obiektu (klasa: %1$s, id: %2$d)', @@ -157,8 +158,7 @@ Operatory:
          'Core:Context=GUI:Console' => 'Konsola', 'Core:Context=CRON' => 'cron', 'Core:Context=GUI:Portal' => 'Portal', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -169,7 +169,7 @@ Operatory:
          // Class: CMDBChange // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:CMDBChange' => 'Zmiana', 'Class:CMDBChange+' => 'Śledzenie zmian', 'Class:CMDBChange/Attribute:date' => 'data', @@ -184,13 +184,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'Usługi sieciowe REST/JSON', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'Usługi internetowe SOAP', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'Przez rozszerzenie', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:CMDBChangeOp' => 'Operacje zmian', 'Class:CMDBChangeOp+' => 'Zmiana dokonana przez osobę na jednym obiekcie w jednostce czasu', 'Class:CMDBChangeOp/Attribute:change' => 'zmiana', @@ -205,51 +205,51 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:CMDBChangeOp/Attribute:objkey+' => 'identyfikator obiektu, którego dotyczy zmiana', 'Class:CMDBChangeOp/Attribute:finalclass' => 'Podklasa CMDBChangeOp', 'Class:CMDBChangeOp/Attribute:finalclass+' => 'Nazwa finalna klasy gdzie dokonano zmiany', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:CMDBChangeOpCreate' => 'tworzenie obiektu', 'Class:CMDBChangeOpCreate+' => 'Śledzenie tworzenia obiektów', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:CMDBChangeOpDelete' => 'usunięcie obiektu', 'Class:CMDBChangeOpDelete+' => 'Śledzenie usuwania obiektów', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:CMDBChangeOpSetAttribute' => 'zmiana obiektu', 'Class:CMDBChangeOpSetAttribute+' => 'Śledzenie zmian właściwości obiektu', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Atrybut', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'kod zmodyfikowanej właściwości', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'zmiana właściwości', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Śledzenie zmian właściwości skalarnych obiektu', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Poprzednia wartość', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => 'poprzednia wartość atrybutu', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Nowa wartość', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => 'nowa wartość atrybutu', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Change:ObjectCreated' => 'Utworzono obiekt', 'Change:ObjectDeleted' => 'Obiekt usunięty', 'Change:ObjectModified' => 'Obiekt zmodyfikowany', @@ -266,35 +266,35 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Change:LinkSet:Added' => 'dodano %1$s', 'Change:LinkSet:Removed' => 'usunięto %1$s', 'Change:LinkSet:Modified' => 'zmodyfikowano %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'zmiana danych', 'Class:CMDBChangeOpSetAttributeBlob+' => 'śledzenie zmian danych', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Poprzednie dane', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => 'poprzednia zawartość atrybutu', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:CMDBChangeOpSetAttributeText' => 'zmiana tekstu', 'Class:CMDBChangeOpSetAttributeText+' => 'śledzenie zmian tekstu', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Poprzednie dane', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'poprzednia zawartość atrybutu', -)); +]); // // Class: Event // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Event' => 'Dziennik zdarzeń', 'Class:Event+' => 'Zdarzenie wewnętrzne aplikacji', 'Class:Event/Attribute:message' => 'Wiadomość', @@ -305,13 +305,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Event/Attribute:userinfo+' => 'identyfikacja użytkownika wykonującego czynność, która wywołała to zdarzenie', 'Class:Event/Attribute:finalclass' => 'Podklasa zdarzenia', 'Class:Event/Attribute:finalclass+' => 'Nazwa finalnej klasy: określa rodzaj zdarzenia, które miało miejsce', -)); +]); // // Class: EventNotification // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:EventNotification' => 'Powiadomienie o zdarzeniu', 'Class:EventNotification+' => 'Ślad powiadomienia, które zostało wysłane', 'Class:EventNotification/Attribute:trigger_id' => 'Wyzwalacz', @@ -320,13 +320,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:EventNotification/Attribute:action_id+' => 'konto użytkownika', 'Class:EventNotification/Attribute:object_id' => 'Id obiektu', 'Class:EventNotification/Attribute:object_id+' => 'id obiektu (klasa zdefiniowana przez wyzwalacz?)', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:EventNotificationEmail' => 'Zdarzenie wysyłki wiadomości e-mail', 'Class:EventNotificationEmail+' => 'Ślad e-maila, który został wysłany', 'Class:EventNotificationEmail/Attribute:to' => 'TO', @@ -343,13 +343,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:EventNotificationEmail/Attribute:body+' => '', 'Class:EventNotificationEmail/Attribute:attachments' => 'Załączniki', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:EventIssue' => 'Zdarzenie związane z problemem', 'Class:EventIssue+' => 'Ślad problemu (ostrzeżenie, błąd itp.)', 'Class:EventIssue/Attribute:issue' => 'Problem', @@ -366,13 +366,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:EventIssue/Attribute:callstack+' => '', 'Class:EventIssue/Attribute:data' => 'Dane', 'Class:EventIssue/Attribute:data+' => 'Więcej informacji', -)); +]); // // Class: EventWebService // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:EventWebService' => 'Usługa internetowa', 'Class:EventWebService+' => 'Ślad połączenia z usługą internetową', 'Class:EventWebService/Attribute:verb' => 'Operacja', @@ -387,9 +387,9 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:EventWebService/Attribute:log_error+' => 'Wyniki dziennika błędów', 'Class:EventWebService/Attribute:data' => 'Dane', 'Class:EventWebService/Attribute:data+' => 'Dane wynikowe', -)); +]); -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:EventRestService' => 'Połączenie REST / JSON', 'Class:EventRestService+' => 'Śledzenie wywołania usługi REST / JSON', 'Class:EventRestService/Attribute:operation' => 'Operacja', @@ -404,13 +404,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:EventRestService/Attribute:json_output+' => 'Odpowiedź HTTP (json)', 'Class:EventRestService/Attribute:provider' => 'Dostawca', 'Class:EventRestService/Attribute:provider+' => 'Klasa PHP implementująca oczekiwaną operację', -)); +]); // // Class: EventLoginUsage // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:EventLoginUsage' => 'Korzystanie z logowania', 'Class:EventLoginUsage+' => 'Połączenie z aplikacją', 'Class:EventLoginUsage/Attribute:user_id' => 'Login', @@ -419,13 +419,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '', 'Class:EventLoginUsage/Attribute:contact_email' => 'E-mail użytkownika', 'Class:EventLoginUsage/Attribute:contact_email+' => 'Adres e-mail użytkownika', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:EventNotificationNewsroom' => 'Wiadomości wysłane', 'Class:EventNotificationNewsroom+' => '', 'Class:EventNotificationNewsroom/Attribute:title' => 'Tytuł', @@ -454,13 +454,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Kontakt', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '', -)); +]); // // Class: Action // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Action' => 'Działanie własne', 'Class:Action+' => 'Działanie zdefiniowane przez użytkownika', 'Class:Action/ComplementaryName' => '%1$s: %2$s', @@ -490,24 +490,24 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Action:last_executions_tab_panel_title' => 'Wykonania tej akcji (%1$s)', 'Action:last_executions_tab_limit_days' => 'ostatnie %1$s dni', 'Action:last_executions_tab_limit_none' => 'bez limitu', -)); +]); // // Class: ActionNotification // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ActionNotification' => 'Powiadomienie', 'Class:ActionNotification+' => 'Powiadomienie (abstrakcja)', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ActionEmail' => 'Powiadomienie e-mail', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'Ten status decyduje o tym, kto zostanie powiadomiony: tylko odbiorca testowy, wszyscy (Do, DW i UDW) lub nikt', @@ -558,14 +558,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'ActionEmail:preview_warning' => 'Rzeczywista wiadomość e-mail może wyglądać inaczej w kliencie poczty e-mail niż podgląd w przeglądarce.', 'ActionEmail:preview_more_info' => 'Aby uzyskać więcej informacji na temat funkcji CSS obsługiwanych przez różnych klientów poczty e-mail, zobacz %1$s', 'ActionEmail:content_placeholder_missing' => 'W szablonie HTML nie znaleziono symbolu zastępczego „%1$s”. Zawartość pola „%2$s” nie będzie uwzględniana w generowanych wiadomościach e-mail.', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'ActionNewsroom:trigger' => 'Wyzwalacz', 'ActionNewsroom:content' => 'Wiadomość', 'ActionNewsroom:settings' => 'Ustawienia', @@ -602,13 +601,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'Zapytanie OQL zwracające obiekty Kontakt', 'Class:ActionNewsroom/Attribute:url' => 'URL', 'Class:ActionNewsroom/Attribute:url+' => 'Jeśli jest pusty, adres URL będzie wskazywał obiekt wywołujący powiadomienie. Możesz także określić niestandardowy adres URL.', -)); +]); // // Class: Trigger // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Trigger' => 'Wyzwalacz', 'Class:Trigger+' => 'Niestandardowa obsługa zdarzeń', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s', @@ -627,13 +626,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Zezwalaj na całkowite anulowanie subskrypcji', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Wymuś co najmniej jeden kanał (Wiadomości lub E-mail)', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Odmów anulowania subskrypcji', -)); +]); // // Class: TriggerOnObject // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TriggerOnObject' => 'Wyzwalacz (zależny od klasy)', 'Class:TriggerOnObject+' => 'Wyzwalanie na danej klasie obiektów', 'Class:TriggerOnObject/Attribute:target_class' => 'Klasa docelowa', @@ -642,115 +641,115 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Ogranicz listę obiektów (klasy docelowej), które aktywują wyzwalacz', 'TriggerOnObject:WrongFilterQuery' => 'Błędne zapytanie filtru: %1$s', 'TriggerOnObject:WrongFilterClass' => 'Zapytanie filtru musi zwracać obiekty klasy "%1$s"', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TriggerOnPortalUpdate' => 'Wyzwalacz (po aktualizacji z portalu)', 'Class:TriggerOnPortalUpdate+' => 'Wyzwalanie po aktualizacji użytkownika z portalu', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TriggerOnStateChange' => 'Wyzwalacz (przy zmianie stanu)', 'Class:TriggerOnStateChange+' => 'Wyzwalanie przy zmianie stanu obiektu', 'Class:TriggerOnStateChange/Attribute:state' => 'Stan', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TriggerOnStateEnter' => 'Wyzwalacz (przy wejściu w stan)', 'Class:TriggerOnStateEnter+' => 'Wyzwalanie przy zmianie stanu obiektu - wejście', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TriggerOnStateLeave' => 'Wyzwalacz (przy opuszczaniu stanu)', 'Class:TriggerOnStateLeave+' => 'Wyzwalanie przy zmianie stanu obiektu - wyjście', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TriggerOnObjectCreate' => 'Wyzwalacz (przy tworzeniu obiektu)', 'Class:TriggerOnObjectCreate+' => 'Wyzwalacz przy tworzeniu obiektu [klasy potomnej] danej klasy', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TriggerOnObjectDelete' => 'Wyzwalacz (przy usunięciu obiektu)', 'Class:TriggerOnObjectDelete+' => 'Wyzwalanie w przypadku usunięcia obiektu [klasy potomnej] danej klasy', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TriggerOnObjectUpdate' => 'Wyzwalacz (przy aktualizacji obiektu)', 'Class:TriggerOnObjectUpdate+' => 'Wyzwalanie przy aktualizacji obiektu [klasy potomnej] danej klasy', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Pola docelowe', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TriggerOnObjectMention' => 'Wyzwalacz (przy wzmiance o obiekcie)', 'Class:TriggerOnObjectMention+' => 'Wyzwalanie przy wzmiance (@xxx) o obiekcie [klasy potomnej] danej klasy w atrybucie dziennika', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Wspomniany filtr', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Ogranicz listę wymienionych obiektów, które aktywują wyzwalacz. Jeśli jest pusty, dowolny wspomniany obiekt (dowolnej klasy) aktywuje go.', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TriggerOnAttributeBlobDownload' => 'Wyzwalacz (po pobraniu dokumentu obiektu)', 'Class:TriggerOnAttributeBlobDownload+' => 'Wyzwalaj pobranie z pola dokumentu obiektu [klasy potomnej] danej klasy', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Pola docelowe', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TriggerOnThresholdReached' => 'Wyzwalacz (na progu)', 'Class:TriggerOnThresholdReached+' => 'Osiągnięto próg wyzwalania przy stoperze', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Stoper', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Próg', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkTriggerAction' => 'Działanie / wyzwalacz', 'Class:lnkTriggerAction+' => 'Powiązanie między wyzwalaczem a działaniem', 'Class:lnkTriggerAction/Attribute:action_id' => 'Działanie', @@ -763,12 +762,12 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Order', 'Class:lnkTriggerAction/Attribute:order+' => 'Kolejność wykonywania działań', -)); +]); // // Synchro Data Source // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:SynchroDataSource' => 'Źródło danych synchronizacji', 'Class:SynchroDataSource/Attribute:name' => 'Nazwa', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1053,13 +1052,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Core:Validator:MustBeInteger' => 'Musi być liczbą całkowitą', 'Core:Validator:MustSelectOne' => 'Proszę wybrać jeden', 'Menu:DataSources' => 'Źródła danych synchronizacji', - 'Menu:DataSources+' => 'Wszystkie źródła danych synchronizacji' -)); + 'Menu:DataSources+' => 'Wszystkie źródła danych synchronizacji', +]); // // Class: TagSetFieldData // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:TagSetFieldData' => '%2$s dla klasy %1$s', 'Class:TagSetFieldData+' => '', 'Class:TagSetFieldData/Attribute:code' => 'Kod', @@ -1081,12 +1080,12 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Tagów "Kod atrybutu" nie można zmieniać', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Użycie tagu (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => 'Nie znaleziono wpisu dla tego tagu', -)); +]); // // Class: DBProperty // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:DBProperty' => 'Właściwości DB', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Nazwa', @@ -1099,12 +1098,12 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Komentarz zmiany', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:BackgroundTask' => 'Zadanie w tle', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Nazwa klasy', @@ -1129,12 +1128,12 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'Status', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:AsyncTask' => 'Zadanie asynchroniczne', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Utworzono', @@ -1159,43 +1158,40 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:AsyncTask/Attribute:last_attempt+' => '', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Nieprawidłowy format konfiguracji "async_task_retries[%1$s]". Oczekuje się tablicy z następującymi kluczami: %2$s', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Nieprawidłowy format konfiguracji "async_task_retries[%1$s]": nieoczekiwany klucz "%2$s". Oczekuje się tylko następujących kluczy: %3$s', -)); +]); // // Class: AbstractResource // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:AbstractResource' => 'Zasób abstrakcyjny', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ResourceAdminMenu' => 'Zasób Menu administratora', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ResourceRunQueriesMenu' => 'Zasób Menu zapytań uruchamiania', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:ResourceSystemMenu' => 'Zasób Menu systemowe', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/pl.dictionary.itop.ui.php b/dictionaries/pl.dictionary.itop.ui.php index f81edf187..10b68cdc3 100644 --- a/dictionaries/pl.dictionary.itop.ui.php +++ b/dictionaries/pl.dictionary.itop.ui.php @@ -1,15 +1,16 @@ 'Kategoria audytu', 'Class:AuditCategory+' => 'Sekcja w ramach ogólnego audytu', 'Class:AuditCategory/Attribute:name' => 'Nazwa kategorii', @@ -26,13 +27,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Procent nieprawidłowych obiektów, poniżej którego wynik jest błędny (czerwony)', 'Class:AuditCategory/Attribute:domains_list' => 'Domeny', 'Class:AuditCategory/Attribute:domains_list+' => 'Domeny, które obejmują tę kategorię', -)); +]); // // Class: AuditRule // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:AuditRule' => 'Reguła audytu', 'Class:AuditRule+' => 'Reguła sprawdzania dla danej kategorii audytu', 'Class:AuditRule/Attribute:name' => 'Nazwa reguły', @@ -51,13 +52,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:AuditRule/Attribute:category_id+' => 'Kategoria dla reguły', 'Class:AuditRule/Attribute:category_name' => 'Kategoria', 'Class:AuditRule/Attribute:category_name+' => 'Nazwa kategorii dla reguły', -)); +]); // // Class: AuditDomain // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:AuditDomain' => 'Domena audytu', 'Class:AuditDomain+' => 'Domeny audytu umożliwiają grupowanie kategorii audytu. Domena zazwyczaj odpowiada temu, kto jest odpowiedzialny za sprawdzanie i naprawianie błędów', @@ -69,13 +70,13 @@ Domena zazwyczaj odpowiada temu, kto jest odpowiedzialny za sprawdzanie i napraw 'Class:AuditDomain/Attribute:icon+' => '', 'Class:AuditDomain/Attribute:categories_list' => 'Kategorie', 'Class:AuditDomain/Attribute:categories_list+' => 'Powiązane kategorie audytu. Podczas przeprowadzania audytu domeny sprawdzane są wszystkie powiązane kategorie audytu i tylko te.', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Link AuditCategory / AuditDomain', 'Class:lnkAuditCategoryToAuditDomain+' => '', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Kategoria', @@ -86,13 +87,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Domena audytu', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Nazwa domeny', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'nazwa domeny audytu', -)); +]); // // Class: QueryOQL // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:Query' => 'Zapytanie', 'Class:Query+' => 'Zapytanie to zbiór danych zdefiniowany w sposób dynamiczny', 'Class:Query/Attribute:name' => 'Nazwa', @@ -119,7 +120,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:QueryOQL+' => 'Zapytanie oparte na języku zapytań obiektowych (OQL)', 'Class:QueryOQL/Attribute:oql' => 'Wyrażenie', 'Class:QueryOQL/Attribute:oql+' => 'Wyrażenie OQL', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -130,7 +131,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( // Class: User // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:User' => 'Użytkownik', 'Class:User+' => 'Login użytkownika', 'Class:User/Attribute:finalclass' => 'Typ konta', @@ -176,13 +177,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:User/Warning:NoContactHasImpact' => 'Uwaga: dla tego Użytkownika nie zdefiniowano żadnej Osoby, uniemożliwia to dostęp do portali, powiadomień o nowościach i innych skutków ubocznych w zapleczu', 'Class:UserInternal' => 'Użytkownik wewnętrzny', 'Class:UserInternal+' => 'Użytkownik zdefiniowany w ramach '.ITOP_APPLICATION_SHORT, -)); +]); // // Class: URP_Profiles // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:URP_Profiles' => 'Profil', 'Class:URP_Profiles+' => 'Profil użytkownika', 'Class:URP_Profiles/Attribute:name' => 'Nazwa', @@ -191,13 +192,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:URP_Profiles/Attribute:description+' => 'jeden wiersz opisu', 'Class:URP_Profiles/Attribute:user_list' => 'Użytkownicy', 'Class:URP_Profiles/Attribute:user_list+' => 'osoby pełniące tę rolę', -)); +]); // // Class: URP_Dimensions // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:URP_Dimensions' => 'wymiar', 'Class:URP_Dimensions+' => 'wymiar aplikacji (definiowanie silosów)', 'Class:URP_Dimensions/Attribute:name' => 'Nazwa', @@ -206,13 +207,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:URP_Dimensions/Attribute:description+' => 'jeden wiersz opisu', 'Class:URP_Dimensions/Attribute:type' => 'Typ', 'Class:URP_Dimensions/Attribute:type+' => 'nazwa klasy lub typ danych (jednostka projekcji)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:URP_UserProfile' => 'Profil użytkownika', 'Class:URP_UserProfile+' => 'profile użytkowników', 'Class:URP_UserProfile/Name' => 'Link między %1$s i %2$s', @@ -226,14 +227,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:URP_UserProfile/Attribute:profile+' => 'Nazwa profilu', 'Class:URP_UserProfile/Attribute:reason' => 'Powód', 'Class:URP_UserProfile/Attribute:reason+' => 'wyjaśnij, dlaczego ta osoba może pełnić tę rolę', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:URP_UserOrg' => 'Organizacje użytkowników', 'Class:URP_UserOrg+' => 'Dozwolone organizacje', 'Class:URP_UserOrg/Name' => 'Link między %1$s i %2$s', @@ -247,13 +247,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => 'Dozwolona organizacja', 'Class:URP_UserOrg/Attribute:reason' => 'Powód', 'Class:URP_UserOrg/Attribute:reason+' => 'wyjaśnij, dlaczego ta osoba może zobaczyć dane należące do tej organizacji', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:URP_ProfileProjection' => 'profile_projection', 'Class:URP_ProfileProjection+' => 'projekcje profili', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Wymiar', @@ -268,13 +268,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'Wyrażenie OQL (używając $user) | stała | | + kod atrybutu', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Atrybut', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Kod atrybutu docelowego (opcjonalnie)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:URP_ClassProjection' => 'class_projection', 'Class:URP_ClassProjection+' => 'projekcje klas', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Wymiar', @@ -287,13 +287,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:URP_ClassProjection/Attribute:value+' => 'Wyrażenie OQL (używając $this) | stała | | + kod atrybutu', 'Class:URP_ClassProjection/Attribute:attribute' => 'Atrybut', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Kod atrybutu docelowego (opcjonalnie)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:URP_ActionGrant' => 'action_permission', 'Class:URP_ActionGrant+' => 'uprawnienia do klas', 'Class:URP_ActionGrant/Attribute:profileid' => 'Profil', @@ -310,13 +310,13 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'nie', 'Class:URP_ActionGrant/Attribute:action' => 'Działanie', 'Class:URP_ActionGrant/Attribute:action+' => 'operacje do wykonania na danej klasie', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:URP_StimulusGrant' => 'stimulus_permission', 'Class:URP_StimulusGrant+' => 'uprawnienia do bodźca w cyklu życia obiektu', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Profil', @@ -333,25 +333,25 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'nie', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Bodziec', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'kod bodźca', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:URP_AttributeGrant' => 'attribute_permission', 'Class:URP_AttributeGrant+' => 'uprawnienia na poziomie atrybutów', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Nadane działanie', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'nadane działanie', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Atrybut', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'kod atrybutu', -)); +]); // // Class: UserDashboard // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Class:UserDashboard' => 'Panel użytkownika', 'Class:UserDashboard+' => '', 'Class:UserDashboard/Attribute:user_id' => 'Użytkownik', @@ -360,12 +360,12 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Class:UserDashboard/Attribute:menu_code+' => '', 'Class:UserDashboard/Attribute:contents' => 'Zawartość', 'Class:UserDashboard/Attribute:contents+' => '', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Menu:WelcomeMenu' => 'Witaj', 'Menu:WelcomeMenu+' => 'Witaj w '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage' => 'Witaj', 'Menu:WelcomeMenuPage+' => 'Witaj w '.ITOP_APPLICATION_SHORT, 'Menu:AdminTools' => 'Administracja', @@ -383,14 +383,14 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Menu:MyShortcuts' => 'Moje skróty', 'Menu:Notifications:Title' => 'Kategorie audytu', 'Menu:DataAdministration' => 'Administracja danymi', - 'Menu:DataAdministration+' => 'Administracja danymi' -)); + 'Menu:DataAdministration+' => 'Administracja danymi', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'BooleanLabel:yes' => 'tak', 'BooleanLabel:no' => 'nie', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.' login', @@ -1544,13 +1544,13 @@ W przypadku powiązania z wyzwalaczem, każde działanie otrzymuje numer "porzą 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Uwzględnione zostaną zależności wybranych obiektów.', 'UI:Search:Criteria:Raw:Filtered' => 'Wyfiltrowane', 'UI:Search:Criteria:Raw:FilteredOn' => 'Filtr według %1$s', - 'UI:StateChanged' => 'Stan zmieniony' -)); + 'UI:StateChanged' => 'Stan zmieniony', +]); // // Expression to Natural language // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Expression:Operator:AND' => ' AND ', 'Expression:Operator:OR' => ' OR ', 'Expression:Operator:=' => ': ', @@ -1563,12 +1563,12 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Expression:Unit:Long:MINUTE' => 'minuta(y)', 'Expression:Verb:NOW' => 'teraz', 'Expression:Verb:ISNULL' => ': nieokreślony', -)); +]); // // iTop Newsroom menu // -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'UI:Newsroom:NoNewMessage' => 'Brak nowej wiadomości', 'UI:Newsroom:XNewMessage' => '%1$s nowa(e) wiadomość(ci)', 'UI:Newsroom:MarkAllAsRead' => 'Oznacz wszystkie wiadomości jako przeczytane', @@ -1583,10 +1583,9 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Pilny', 'UI:Newsroom:Priority:3:Tooltip' => 'Ważny', 'UI:Newsroom:Priority:4:Tooltip' => 'Normalny', -)); +]); - -Dict::Add('PL PL', 'Polish', 'Polski', array( +Dict::Add('PL PL', 'Polish', 'Polski', [ 'Menu:DataSources' => 'Źródła danych synchronizacji', 'Menu:DataSources+' => 'Wszystkie źródła danych synchronizacji', 'Menu:AuditCategories' => 'Kategorie audytu', @@ -1614,4 +1613,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'Menu:Integrations' => 'Integracje', 'Menu:Integrations+' => '', -)); +]); diff --git a/dictionaries/pt_br.dictionary.itop.core.php b/dictionaries/pt_br.dictionary.itop.core.php index 0aea42357..25c918bc7 100644 --- a/dictionaries/pt_br.dictionary.itop.core.php +++ b/dictionaries/pt_br.dictionary.itop.core.php @@ -1,15 +1,16 @@ '%1s (excluído)', 'Core:DeletedObjectTip' => 'O objeto foi excluído em %1$s (%2$s)', 'Core:UnknownObjectLabel' => 'Objeto não encontrado (classe: %1$s, id: %2$d)', @@ -157,8 +158,7 @@ Operadores:
          'Core:Context=GUI:Console' => 'Console', 'Core:Context=CRON' => 'cron', 'Core:Context=GUI:Portal' => 'Portal do usuário', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -169,7 +169,7 @@ Operadores:
          // Class: CMDBChange // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:CMDBChange' => 'Alterações no CMDB', 'Class:CMDBChange+' => 'Controle de mudanças no CMDB', 'Class:CMDBChange/Attribute:date' => 'Data', @@ -184,13 +184,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON webservices', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP WebServices', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'Por uma extensão', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:CMDBChangeOp' => 'Operações de alteração', 'Class:CMDBChangeOp+' => 'Operações de controle de alteração', 'Class:CMDBChangeOp/Attribute:change' => 'Alteração', @@ -205,51 +205,51 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:CMDBChangeOp/Attribute:objkey+' => '', 'Class:CMDBChangeOp/Attribute:finalclass' => 'Tipo', 'Class:CMDBChangeOp/Attribute:finalclass+' => '', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:CMDBChangeOpCreate' => 'Criação de objeto', 'Class:CMDBChangeOpCreate+' => 'Controle de criação do objeto', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:CMDBChangeOpDelete' => 'Exclusão de objeto', 'Class:CMDBChangeOpDelete+' => 'Controle de exclusão do objeto', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:CMDBChangeOpSetAttribute' => 'Alteração de propriedades', 'Class:CMDBChangeOpSetAttribute+' => 'Controle de alteração de propriedades do objeto', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Atributo', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'Código da propriedade modificada', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'Alteração de propriedades escalares', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Controle de alterações de propriedades escalares do objeto', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Valor anterior', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => 'Valor anterior do atributo', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Novo valor', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => 'Novo valor do atributo', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Change:ObjectCreated' => 'Objeto criado', 'Change:ObjectDeleted' => 'Objeto excluído', 'Change:ObjectModified' => 'Objeto modificado', @@ -266,35 +266,35 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Change:LinkSet:Added' => 'adicionado %1$s', 'Change:LinkSet:Removed' => 'excluído %1$s', 'Change:LinkSet:Modified' => 'modificado %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'Alteração de conteúdo (Blob)', 'Class:CMDBChangeOpSetAttributeBlob+' => 'Controle de alterações de conteúdo de dados (Blob)', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Valor anterior', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => 'Conteúdo anterior do atributo', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:CMDBChangeOpSetAttributeText' => 'Alteração de texto', 'Class:CMDBChangeOpSetAttributeText+' => 'Controle de alterações de texto do objeto', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Valor anterior', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'Conteúdo anterior do atributo', -)); +]); // // Class: Event // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Event' => 'Registro de evento', 'Class:Event+' => 'Um evento interno do aplicativo', 'Class:Event/Attribute:message' => 'Mensagem', @@ -305,13 +305,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Event/Attribute:userinfo+' => 'Identificação do usuário que estava executando a ação que desencadeou este evento', 'Class:Event/Attribute:finalclass' => 'Tipo', 'Class:Event/Attribute:finalclass+' => '', -)); +]); // // Class: EventNotification // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:EventNotification' => 'Notificação de evento', 'Class:EventNotification+' => 'Controle de notificações que foram enviadas', 'Class:EventNotification/Attribute:trigger_id' => 'Gatilho', @@ -320,13 +320,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:EventNotification/Attribute:action_id+' => 'Conta de usuário', 'Class:EventNotification/Attribute:object_id' => 'ID do objeto', 'Class:EventNotification/Attribute:object_id+' => 'ID do objeto (classe definida pelo gatilho?)', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:EventNotificationEmail' => 'Evento de envio de e-mail', 'Class:EventNotificationEmail+' => 'Controle de e-mails que foram enviados', 'Class:EventNotificationEmail/Attribute:to' => 'Para', @@ -343,13 +343,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:EventNotificationEmail/Attribute:body+' => 'Conteúdo do e-mail', 'Class:EventNotificationEmail/Attribute:attachments' => 'Anexos', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:EventIssue' => 'Evento de entrega', 'Class:EventIssue+' => 'Controle de entrega (aviso, erro, etc.)', 'Class:EventIssue/Attribute:issue' => 'Entrega', @@ -366,13 +366,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:EventIssue/Attribute:callstack+' => '', 'Class:EventIssue/Attribute:data' => 'Dados', 'Class:EventIssue/Attribute:data+' => 'Mais informações', -)); +]); // // Class: EventWebService // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:EventWebService' => 'Evento Web service', 'Class:EventWebService+' => 'Controle de uma solicitação de WebService', 'Class:EventWebService/Attribute:verb' => 'Verb', @@ -387,9 +387,9 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:EventWebService/Attribute:log_error+' => '', 'Class:EventWebService/Attribute:data' => 'Dados', 'Class:EventWebService/Attribute:data+' => 'Mais informações', -)); +]); -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:EventRestService' => 'Chamada REST/JSON', 'Class:EventRestService+' => 'Controle de uma chamada de serviço REST/JSON', 'Class:EventRestService/Attribute:operation' => 'Operação', @@ -404,13 +404,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:EventRestService/Attribute:json_output+' => 'Resposta HTTP (JSON)', 'Class:EventRestService/Attribute:provider' => 'Provedor', 'Class:EventRestService/Attribute:provider+' => 'Classe PHP implementando a operação esperada', -)); +]); // // Class: EventLoginUsage // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:EventLoginUsage' => 'Logins', 'Class:EventLoginUsage+' => 'Conexões com a aplicação', 'Class:EventLoginUsage/Attribute:user_id' => 'Login', @@ -419,13 +419,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '', 'Class:EventLoginUsage/Attribute:contact_email' => 'E-mail do usuário', 'Class:EventLoginUsage/Attribute:contact_email+' => 'Endereço de e-mail deste usuário', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:EventNotificationNewsroom' => 'News sent~~', 'Class:EventNotificationNewsroom+' => '~~', 'Class:EventNotificationNewsroom/Attribute:title' => 'Title~~', @@ -454,13 +454,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '~~', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact~~', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '~~', -)); +]); // // Class: Action // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Action' => 'Ação personalizada', 'Class:Action+' => 'Ações definidas pelo usuário', 'Class:Action/ComplementaryName' => '%1$s: %2$s~~', @@ -490,24 +490,24 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Action:last_executions_tab_panel_title' => 'Executions of this action (%1$s)~~', 'Action:last_executions_tab_limit_days' => 'past %1$s days~~', 'Action:last_executions_tab_limit_none' => 'no limit~~', -)); +]); // // Class: ActionNotification // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ActionNotification' => 'Notificação', 'Class:ActionNotification+' => 'Notificação (resumo)', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ActionEmail' => 'Notificação via E-mail', 'Class:ActionEmail+' => 'Lista de Notificações via E-mail', 'Class:ActionEmail/Attribute:status+' => 'Esse status especifica quem será notificado: apenas o destinatário do Teste, todos (Para, CC e CCO) ou ninguém', @@ -558,14 +558,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'ActionEmail:preview_warning' => 'The actual eMail may look different in the eMail client than this preview in your browser.~~', 'ActionEmail:preview_more_info' => 'For more information about the CSS features supported by the different eMail clients, refer to %1$s~~', 'ActionEmail:content_placeholder_missing' => 'The placeholder "%1$s" was not found in the HTML template. The content of the field "%2$s" will not be included in the generated emails.~~', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'ActionNewsroom:trigger' => 'Trigger~~', 'ActionNewsroom:content' => 'Message~~', 'ActionNewsroom:settings' => 'Settings~~', @@ -600,13 +599,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'An OQL query returning Contact objects~~', 'Class:ActionNewsroom/Attribute:url' => 'URL~~', 'Class:ActionNewsroom/Attribute:url+' => 'By default, it points to the object triggering the notification. But you can also specify a custom URL.~~', -)); +]); // // Class: Trigger // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Trigger' => 'Gatilho', 'Class:Trigger+' => 'Manipulador de eventos personalizado', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~', @@ -625,13 +624,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Allow complete unsubscription~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Force at least one channel (News or Email)~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Deny unsubscription~~', -)); +]); // // Class: TriggerOnObject // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TriggerOnObject' => 'Gatilho (classe dependente)', 'Class:TriggerOnObject+' => 'Gatilho em uma determinada classe de objetos', 'Class:TriggerOnObject/Attribute:target_class' => 'Classe alvo', @@ -640,115 +639,115 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Limita a lista de objetos (da classe de destino) que irá ativar o gatilho', 'TriggerOnObject:WrongFilterQuery' => 'Consulta de filtro incorreta: %1$s', 'TriggerOnObject:WrongFilterClass' => 'A consulta de filtro deve retornar objetos da classe \\"%1$s\\"', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TriggerOnPortalUpdate' => 'Gatilho (quando atualizado a partir do portal do usuário)', 'Class:TriggerOnPortalUpdate+' => 'Gatilho acionado a partir de uma atualização do usuário final através do portal do usuário', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TriggerOnStateChange' => 'Gatilho (na mudança de status)', 'Class:TriggerOnStateChange+' => 'Gatilho de mudança de status do objeto', 'Class:TriggerOnStateChange/Attribute:state' => 'Status', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TriggerOnStateEnter' => 'Gatilho (ao entrar em um status)', 'Class:TriggerOnStateEnter+' => 'Gatilho de mudança de status do objeto - entrada', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TriggerOnStateLeave' => 'Gatilho (ao sair de um status)', 'Class:TriggerOnStateLeave+' => 'Gatilho de mudança de status do objeto - saída', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TriggerOnObjectCreate' => 'Gatilho (na criação do objeto)', 'Class:TriggerOnObjectCreate+' => 'Gatilho de criação de objeto de [uma classe filha] de determinada classe', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TriggerOnObjectDelete' => 'Gatilho (na exclusão de objetos)', 'Class:TriggerOnObjectDelete+' => 'Gatilho na exclusão de objeto de [uma classe filha] de determinada classe', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TriggerOnObjectUpdate' => 'Gatilho (na atualização do objeto)', 'Class:TriggerOnObjectUpdate+' => 'Gatilho na atualização de objeto de [uma classe filha] de uma determinada classe', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Campos de destino', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TriggerOnObjectMention' => 'Gatilho (na menção do objeto)', 'Class:TriggerOnObjectMention+' => 'Gatilho em menção (@xxx) de um objeto de [uma classe filha] de uma determinada classe em um atributo de log', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Filtro de menções', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Limita a lista de objetos mencionados que ativarão o gatilho. Se vazio, qualquer objeto mencionado (de qualquer classe) irá ativá-lo', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TriggerOnAttributeBlobDownload' => 'Trigger (on object\'s document download)~~', 'Class:TriggerOnAttributeBlobDownload+' => 'Trigger on object\'s document field download of [a child class of] the given class~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Target fields~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '~~', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TriggerOnThresholdReached' => 'Gatilho (no alcance do limite)', 'Class:TriggerOnThresholdReached+' => 'Gatilho no alcance do limite do cronômetro', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Cronômetro', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Limite', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkTriggerAction' => 'Ação/Gatilho', 'Class:lnkTriggerAction+' => 'Link Gatilho / Ação', 'Class:lnkTriggerAction/Attribute:action_id' => 'Ação', @@ -761,12 +760,12 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Ordem', 'Class:lnkTriggerAction/Attribute:order+' => 'Ordem de execução das ações', -)); +]); // // Synchro Data Source // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:SynchroDataSource' => 'Fonte de Sincronização de Dados', 'Class:SynchroDataSource/Attribute:name' => 'Nome', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1055,13 +1054,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Core:Validator:MustSelectOne' => 'Por favor, selecione um', 'INTERNAL:JQuery-DatePicker:LangCode' => 'pt-BR', 'Menu:DataSources' => 'Fontes de Sincronização de Dados', - 'Menu:DataSources+' => 'Lista de Fontes de Sincronização de Dados' -)); + 'Menu:DataSources+' => 'Lista de Fontes de Sincronização de Dados', +]); // // Class: TagSetFieldData // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:TagSetFieldData' => '%2$s para classe %1$s', 'Class:TagSetFieldData+' => '', 'Class:TagSetFieldData/Attribute:code' => 'Código', @@ -1083,12 +1082,12 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Tags de "Código do atributo" não podem ser alteradas', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Uso de tags (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => 'Nenhuma entrada encontrada para esta tag', -)); +]); // // Class: DBProperty // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:DBProperty' => 'Propriedades do DB', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Nome', @@ -1101,12 +1100,12 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Editar comentário', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:BackgroundTask' => 'Tarefas de fundo', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Nome da classe', @@ -1131,12 +1130,12 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'Status', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:AsyncTask' => 'Tarefa assíncrona', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Criada', @@ -1161,43 +1160,40 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:AsyncTask/Attribute:last_attempt+' => '', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Formato inválido para a configuração de "async_task_retries[%1$s]". Esperando um array com as seguintes chaves: %2$s', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Formato inválido para a configuração de "async_task_retries[%1$s]": chave inesperada "%2$s". Esperando somente as seguintes chaves: %3$s', -)); +]); // // Class: AbstractResource // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:AbstractResource' => 'Recurso Abstrato', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ResourceAdminMenu' => 'Recurso Menu de Administração', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ResourceRunQueriesMenu' => 'Recurso Livro de Consultas', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:ResourceSystemMenu' => 'Menu de Recursos do Sistema', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/pt_br.dictionary.itop.ui.php b/dictionaries/pt_br.dictionary.itop.ui.php index 4083b7fb2..a4f6b0e75 100644 --- a/dictionaries/pt_br.dictionary.itop.ui.php +++ b/dictionaries/pt_br.dictionary.itop.ui.php @@ -1,15 +1,16 @@ 'Categoria de Auditoria', 'Class:AuditCategory+' => 'Uma seção dentro da auditoria', 'Class:AuditCategory/Attribute:name' => 'Nome', @@ -26,13 +27,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Percentage of invalid objects below which the result is in error (red)~~', 'Class:AuditCategory/Attribute:domains_list' => 'Domains~~', 'Class:AuditCategory/Attribute:domains_list+' => 'Domains which include this category~~', -)); +]); // // Class: AuditRule // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:AuditRule' => 'Regra de Auditoria', 'Class:AuditRule+' => 'Uma regra para verificar se uma determinada categoria de Auditoria', 'Class:AuditRule/Attribute:name' => 'Nome', @@ -51,13 +52,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:AuditRule/Attribute:category_id+' => 'A categoria para esta regra', 'Class:AuditRule/Attribute:category_name' => 'Categoria', 'Class:AuditRule/Attribute:category_name+' => 'Nome da categoria para essa regra', -)); +]); // // Class: AuditDomain // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:AuditDomain' => 'Audit Domain~~', 'Class:AuditDomain+' => 'Audit domains allow to group the audit categories. Domain usually correspond to who is responsible for checking and fixing errors~~', @@ -69,13 +70,13 @@ Domain usually correspond to who is responsible for checking and fixing errors~~ 'Class:AuditDomain/Attribute:icon+' => '~~', 'Class:AuditDomain/Attribute:categories_list' => 'Categories~~', 'Class:AuditDomain/Attribute:categories_list+' => 'Related audit categories. When running the audit on a domain, all related audit categories are checked and only those.~~', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Link AuditCategory / AuditDomain~~', 'Class:lnkAuditCategoryToAuditDomain+' => '~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Category~~', @@ -86,13 +87,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Audit domain~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Domain name~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Audit domain name~~', -)); +]); // // Class: QueryOQL // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:Query' => 'Consulta', 'Class:Query+' => 'Uma consulta é um conjunto de dados definido de uma forma dinâmica', 'Class:Query/Attribute:name' => 'Nome', @@ -119,7 +120,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:QueryOQL+' => 'Uma consulta baseada no Object Query Language (OQL)', 'Class:QueryOQL/Attribute:oql' => 'Expressão', 'Class:QueryOQL/Attribute:oql+' => 'Expressão Object Query Language (OQL)', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -130,7 +131,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( // Class: User // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:User' => 'Usuário', 'Class:User+' => '', 'Class:User/Attribute:finalclass' => 'Tipo de conta', @@ -176,13 +177,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:User/Warning:NoContactHasImpact' => 'Cautious: there is no Person defined on this User, this prevents access to portals, news notifications and other side effects in back-office~~', 'Class:UserInternal' => 'Usuário Interno', 'Class:UserInternal+' => 'Usuário definido dentro do '.ITOP_APPLICATION_SHORT, -)); +]); // // Class: URP_Profiles // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:URP_Profiles' => 'Perfil', 'Class:URP_Profiles+' => 'Perfil do Usuário', 'Class:URP_Profiles/Attribute:name' => 'Nome', @@ -191,13 +192,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:URP_Profiles/Attribute:description+' => 'Uma descrição curta', 'Class:URP_Profiles/Attribute:user_list' => 'Usuários', 'Class:URP_Profiles/Attribute:user_list+' => 'Pessoas que possuem esse perfil', -)); +]); // // Class: URP_Dimensions // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:URP_Dimensions' => 'Dimensão', 'Class:URP_Dimensions+' => 'Dimensão de aplicação (definição de silos)', 'Class:URP_Dimensions/Attribute:name' => 'Nome', @@ -206,13 +207,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:URP_Dimensions/Attribute:description+' => 'Uma descrição curta', 'Class:URP_Dimensions/Attribute:type' => 'Tipo', 'Class:URP_Dimensions/Attribute:type+' => 'Nome da classe ou tipo de dado (unidade de mapeamento)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:URP_UserProfile' => 'Perfil de Usuário', 'Class:URP_UserProfile+' => 'Perfil de Usuário', 'Class:URP_UserProfile/Name' => 'Link entre %1$s e %2$s', @@ -226,14 +227,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:URP_UserProfile/Attribute:profile+' => 'Nome do perfil', 'Class:URP_UserProfile/Attribute:reason' => 'Função', 'Class:URP_UserProfile/Attribute:reason+' => 'Explicação por que esta pessoa deve ter essa função', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:URP_UserOrg' => 'Organização do usuário', 'Class:URP_UserOrg+' => 'Organizações permitidas', 'Class:URP_UserOrg/Name' => 'Link entre %1$s e %2$s', @@ -247,13 +247,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => 'Organização permitida', 'Class:URP_UserOrg/Attribute:reason' => 'Função', 'Class:URP_UserOrg/Attribute:reason+' => 'Explicação por que essa pessoa tem permissão para ver os dados pertencentes com essa organização', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:URP_ProfileProjection' => 'Mapeamentos de Perfil', 'Class:URP_ProfileProjection+' => '', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Dimensão', @@ -268,13 +268,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'Expressão OQL (usando $user) | constante | | +código de atributo', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Atributo', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Código de atributo alvo (opcional)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:URP_ClassProjection' => 'class_projection', 'Class:URP_ClassProjection+' => 'class projections', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Dimensão', @@ -287,13 +287,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:URP_ClassProjection/Attribute:value+' => 'Expressão OQL (usando $ user) | constante | | + código de atributo', 'Class:URP_ClassProjection/Attribute:attribute' => 'Atributo', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Código de atributo alvo (opcional)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:URP_ActionGrant' => 'action_permission', 'Class:URP_ActionGrant+' => 'Permissões de classes', 'Class:URP_ActionGrant/Attribute:profileid' => 'Perfil', @@ -310,13 +310,13 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => '', 'Class:URP_ActionGrant/Attribute:action' => 'Ação', 'Class:URP_ActionGrant/Attribute:action+' => 'Operações a realizar em determinada classe', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:URP_StimulusGrant' => 'stimulus_permission', 'Class:URP_StimulusGrant+' => 'Permissões de estímulo do ciclo de vida do objeto', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Perfil', @@ -333,25 +333,25 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => '', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Estímulo', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'Código do estímulo', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:URP_AttributeGrant' => 'attribute_permission', 'Class:URP_AttributeGrant+' => 'Permissões a nível de atributos', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Concessão de permissão', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'Concessão de permissão', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Atributo', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'Código do atributo', -)); +]); // // Class: UserDashboard // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Class:UserDashboard' => 'Painel do usuário', 'Class:UserDashboard+' => '', 'Class:UserDashboard/Attribute:user_id' => 'Usuário', @@ -360,12 +360,12 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Class:UserDashboard/Attribute:menu_code+' => '', 'Class:UserDashboard/Attribute:contents' => 'Conteúdo', 'Class:UserDashboard/Attribute:contents+' => '', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Menu:WelcomeMenu' => 'Página inicial do '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenu+' => 'Bem-vindo ao '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage' => 'Página inicial do '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage+' => 'Bem-vindo ao '.ITOP_APPLICATION_SHORT, 'Menu:AdminTools' => 'Ferramentas Administrativas', 'Menu:AdminTools+' => 'Ferramentas Administrativas', 'Menu:AdminTools?' => 'Ferramentas acessíveis apenas para usuários com perfil de administrador', @@ -380,14 +380,14 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Menu:MyShortcuts' => 'Meus atalhos', 'Menu:Notifications:Title' => 'Categorias de Auditoria', 'Menu:DataAdministration' => 'Administração de Dados', - 'Menu:DataAdministration+' => 'Administração de Dados' -)); + 'Menu:DataAdministration+' => 'Administração de Dados', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'BooleanLabel:yes' => 'Sim', 'BooleanLabel:no' => 'Não', 'UI:Login:Title' => 'Login no '.ITOP_APPLICATION_SHORT, 'UI:WelcomeMenu:Title' => 'Bem-vindo ao '.ITOP_APPLICATION_SHORT, 'UI:WelcomeMenu:AllOpenRequests' => 'Solicitações abertas: %1$d', @@ -1530,13 +1530,13 @@ Quando associada a um gatilho, cada ação recebe um número de "ordem", especif 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Os objetos filhos dos objetos selecionados serão incluídos', 'UI:Search:Criteria:Raw:Filtered' => 'Filtrado', 'UI:Search:Criteria:Raw:FilteredOn' => 'Filtrado em %1$s', - 'UI:StateChanged' => 'Status alterado' -)); + 'UI:StateChanged' => 'Status alterado', +]); // // Expression to Natural language // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Expression:Operator:AND' => ' E ', 'Expression:Operator:OR' => ' OU ', 'Expression:Operator:=' => ': ', @@ -1549,12 +1549,12 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Expression:Unit:Long:MINUTE' => 'minuto(s)', 'Expression:Verb:NOW' => 'agora', 'Expression:Verb:ISNULL' => ': indefinido', -)); +]); // // iTop Newsroom menu // -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'UI:Newsroom:NoNewMessage' => 'Nenhuma mensagem nova', 'UI:Newsroom:XNewMessage' => '%1$s nova(s) mensagem(ns)', 'UI:Newsroom:MarkAllAsRead' => 'Marcar todas as mensagens como lidas', @@ -1569,10 +1569,9 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgent~~', 'UI:Newsroom:Priority:3:Tooltip' => 'Important~~', 'UI:Newsroom:Priority:4:Tooltip' => 'Normal~~', -)); +]); - -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'Menu:DataSources' => 'Fontes de Sincronização de Dados', 'Menu:DataSources+' => 'Lista de Fontes de Sincronização de Dados', 'Menu:AuditCategories' => 'Categorias de Auditoria', @@ -1600,4 +1599,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Menu:Integrations' => 'Integrations~~', 'Menu:Integrations+' => '~~', -)); +]); diff --git a/dictionaries/ru.dictionary.itop.core.php b/dictionaries/ru.dictionary.itop.core.php index 0ca1692d8..27026b3d5 100644 --- a/dictionaries/ru.dictionary.itop.core.php +++ b/dictionaries/ru.dictionary.itop.core.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Core:DeletedObjectLabel' => '%1$sы (удален)', 'Core:DeletedObjectTip' => 'Объект был удален %1$s (%2$s)', 'Core:UnknownObjectLabel' => 'Объект не найден (class: %1$s, id: %2$d)', @@ -158,8 +159,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Core:Context=GUI:Console' => 'Console', 'Core:Context=CRON' => 'cron', 'Core:Context=GUI:Portal' => 'Portal', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -170,7 +170,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( // Class: CMDBChange // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:CMDBChange' => 'Изменение CMDB', 'Class:CMDBChange+' => 'Отслеживание изменений CMDB', 'Class:CMDBChange/Attribute:date' => 'Дата', @@ -185,13 +185,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON webservices~~', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP webservices~~', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'By an extension~~', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:CMDBChangeOp' => 'Операция изменения CMDB', 'Class:CMDBChangeOp+' => 'Отслеживание операции изменения CMDB', 'Class:CMDBChangeOp/Attribute:change' => 'Изменение CMDB', @@ -206,51 +206,51 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:CMDBChangeOp/Attribute:objkey+' => '', 'Class:CMDBChangeOp/Attribute:finalclass' => 'Итоговый класс', 'Class:CMDBChangeOp/Attribute:finalclass+' => '', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:CMDBChangeOpCreate' => 'Операция создания объекта', 'Class:CMDBChangeOpCreate+' => 'Отслеживание создания объекта', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:CMDBChangeOpDelete' => 'Операция удаления объекта', 'Class:CMDBChangeOpDelete+' => 'Отслеживание удаления объекта', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:CMDBChangeOpSetAttribute' => 'Изменение объекта', 'Class:CMDBChangeOpSetAttribute+' => 'Отслеживание изменения объекта', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Свойство', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'Код изменённого свойства', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'Изменение свойства', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Отслеживание изменения скалярного свойства объекта', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Предыдущее значение', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => 'Предыдущее значение атрибута', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Новое значение', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => 'Новое значение атрибута', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Change:ObjectCreated' => 'Объект создан.', 'Change:ObjectDeleted' => 'Объект удалён.', 'Change:ObjectModified' => 'Объект изменён.', @@ -267,35 +267,35 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Change:LinkSet:Added' => 'добавлен объект %1$s.', 'Change:LinkSet:Removed' => 'удалён объект %1$s.', 'Change:LinkSet:Modified' => 'изменён объект %1$s.', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'Изменение данных', 'Class:CMDBChangeOpSetAttributeBlob+' => 'Отслеживание изменения данных', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Предыдущие данные', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => 'Предыдущее содержимое атрибута', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:CMDBChangeOpSetAttributeText' => 'Изменение текста', 'Class:CMDBChangeOpSetAttributeText+' => 'Отслеживание изменения текста', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Предыдущие данные', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'Предыдущее содержимое атрибута', -)); +]); // // Class: Event // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Event' => 'Событие', 'Class:Event+' => 'Внутренние событие приложения', 'Class:Event/Attribute:message' => 'Сообщение', @@ -306,13 +306,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Event/Attribute:userinfo+' => 'Пользователь, действия которого вызвали это событие', 'Class:Event/Attribute:finalclass' => 'Тип', 'Class:Event/Attribute:finalclass+' => '', -)); +]); // // Class: EventNotification // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:EventNotification' => 'Уведомление', 'Class:EventNotification+' => 'Отслеживание отправленных уведомлений', 'Class:EventNotification/Attribute:trigger_id' => 'Триггер', @@ -321,13 +321,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:EventNotification/Attribute:action_id+' => 'Выполненное действие', 'Class:EventNotification/Attribute:object_id' => 'ID объекта', 'Class:EventNotification/Attribute:object_id+' => 'Идентификатор объекта целевого класса триггера', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:EventNotificationEmail' => 'Уведомление по email', 'Class:EventNotificationEmail+' => 'Отслеживание уведомлений по email', 'Class:EventNotificationEmail/Attribute:to' => 'Кому', @@ -344,13 +344,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:EventNotificationEmail/Attribute:body+' => '', 'Class:EventNotificationEmail/Attribute:attachments' => 'Вложения', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:EventIssue' => 'Ошибка', 'Class:EventIssue+' => 'Отслеживание ошибок (warning, error, др.)', 'Class:EventIssue/Attribute:issue' => 'Ошибка', @@ -367,13 +367,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:EventIssue/Attribute:callstack+' => '', 'Class:EventIssue/Attribute:data' => 'Данные', 'Class:EventIssue/Attribute:data+' => 'Подробнее', -)); +]); // // Class: EventWebService // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:EventWebService' => 'События Web-сервиса', 'Class:EventWebService+' => 'Trace of a web service call~~', 'Class:EventWebService/Attribute:verb' => 'Verb~~', @@ -388,9 +388,9 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:EventWebService/Attribute:log_error+' => 'Результаты логов ошибок', 'Class:EventWebService/Attribute:data' => 'Данные', 'Class:EventWebService/Attribute:data+' => 'Результаты данных', -)); +]); -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:EventRestService' => 'REST/JSON call', 'Class:EventRestService+' => 'Trace of a REST/JSON service call', 'Class:EventRestService/Attribute:operation' => 'Operation', @@ -405,13 +405,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:EventRestService/Attribute:json_output+' => 'HTTP response (json)', 'Class:EventRestService/Attribute:provider' => 'Provider', 'Class:EventRestService/Attribute:provider+' => 'PHP class implementing the expected operation', -)); +]); // // Class: EventLoginUsage // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:EventLoginUsage' => 'Статистика авторизаций', 'Class:EventLoginUsage+' => 'Connection to the application', 'Class:EventLoginUsage/Attribute:user_id' => 'Логин', @@ -420,13 +420,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:EventLoginUsage/Attribute:contact_name+' => 'Имя пользователя', 'Class:EventLoginUsage/Attribute:contact_email' => 'Email пользователя', 'Class:EventLoginUsage/Attribute:contact_email+' => 'Email Address of the User', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:EventNotificationNewsroom' => 'News sent~~', 'Class:EventNotificationNewsroom+' => '~~', 'Class:EventNotificationNewsroom/Attribute:title' => 'Title~~', @@ -455,13 +455,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '~~', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact~~', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '~~', -)); +]); // // Class: Action // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Action' => 'Действие', 'Class:Action+' => 'Действие, определённое пользователем', 'Class:Action/ComplementaryName' => '%1$s: %2$s~~', @@ -491,24 +491,24 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Action:last_executions_tab_panel_title' => 'Executions of this action (%1$s)~~', 'Action:last_executions_tab_limit_days' => 'past %1$s days~~', 'Action:last_executions_tab_limit_none' => 'no limit~~', -)); +]); // // Class: ActionNotification // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ActionNotification' => 'Уведомление', 'Class:ActionNotification+' => '', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ActionEmail' => 'Уведомление по email', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'This status drives who will be notified: @@ -563,14 +563,13 @@ If omitted the From (label) is used.~~', 'ActionEmail:preview_warning' => 'The actual eMail may look different in the eMail client than this preview in your browser.~~', 'ActionEmail:preview_more_info' => 'For more information about the CSS features supported by the different eMail clients, refer to %1$s~~', 'ActionEmail:content_placeholder_missing' => 'The placeholder "%1$s" was not found in the HTML template. The content of the field "%2$s" will not be included in the generated emails.~~', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'ActionNewsroom:trigger' => 'Trigger~~', 'ActionNewsroom:content' => 'Message~~', 'ActionNewsroom:settings' => 'Settings~~', @@ -605,13 +604,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'An OQL query returning Contact objects~~', 'Class:ActionNewsroom/Attribute:url' => 'URL~~', 'Class:ActionNewsroom/Attribute:url+' => 'By default, it points to the object triggering the notification. But you can also specify a custom URL.~~', -)); +]); // // Class: Trigger // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Trigger' => 'Триггер', 'Class:Trigger+' => 'Пользовательский обработчик событий', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~', @@ -630,13 +629,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Allow complete unsubscription~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Force at least one channel (News or Email)~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Deny unsubscription~~', -)); +]); // // Class: TriggerOnObject // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TriggerOnObject' => 'Триггер на класс объекта', 'Class:TriggerOnObject+' => 'Триггер на события объектов данного класса', 'Class:TriggerOnObject/Attribute:target_class' => 'Целевой класс', @@ -645,115 +644,115 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Позволяет ограничить список объектов, для которых будет срабатывать триггер', 'TriggerOnObject:WrongFilterQuery' => 'Направильный запрос фильтра: %1$s', 'TriggerOnObject:WrongFilterClass' => 'Запрос фильтра должен возвращать объекты класса "%1$s"', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TriggerOnPortalUpdate' => 'Триггер на обновление из портала', 'Class:TriggerOnPortalUpdate+' => 'Триггер на обновление объекта пользователем портала', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TriggerOnStateChange' => 'Триггер на изменение статуса', 'Class:TriggerOnStateChange+' => 'Триггер на изменение статуса объекта', 'Class:TriggerOnStateChange/Attribute:state' => 'Статус', 'Class:TriggerOnStateChange/Attribute:state+' => 'Код статуса объекта, например \'resolved\'', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TriggerOnStateEnter' => 'Триггер на вход в статус', 'Class:TriggerOnStateEnter+' => 'Триггер на вход объекта в статус', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TriggerOnStateLeave' => 'Триггер на выход из статуса', 'Class:TriggerOnStateLeave+' => 'Триггер на выход объекта из статуса', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TriggerOnObjectCreate' => 'Триггер на создание объекта', 'Class:TriggerOnObjectCreate+' => 'Триггер на создание объекта данного или дочернего класса', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TriggerOnObjectDelete' => 'Триггер на удаление объекта', 'Class:TriggerOnObjectDelete+' => 'Триггер на удаление объекта данного или дочернего класса', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TriggerOnObjectUpdate' => 'Триггер на обновление объекта', 'Class:TriggerOnObjectUpdate+' => 'Триггер на обновление объекта данного или дочернего класса', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Отслеживаемые поля', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => 'Поля объекта, при обновлении которых сработает триггер', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TriggerOnObjectMention' => 'Trigger (on object mention)~~', 'Class:TriggerOnObjectMention+' => 'Trigger on mention (@xxx) of an object of [a child class of] the given class in a log attribute~~', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Mentioned filter~~', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Limit the list of mentioned objects which will activate the trigger. If empty, any mentioned object (of any class) will activate it.~~', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TriggerOnAttributeBlobDownload' => 'Trigger (on object\'s document download)~~', 'Class:TriggerOnAttributeBlobDownload+' => 'Trigger on object\'s document field download of [a child class of] the given class~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Target fields~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '~~', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TriggerOnThresholdReached' => 'Триггер на пороговое значение', 'Class:TriggerOnThresholdReached+' => 'Триггер на достижение секундомером порогового значения (TTO, TTR)', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Секундомер', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => 'По умолчанию для Инцидентов и Запросов доступны \'ttr\' и \'tto\'', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Порог', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => 'Пороговое значние секундомера в %, по умолчанию \'75\' и \'100\'', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkTriggerAction' => 'Связь Триггер/Действие', 'Class:lnkTriggerAction+' => 'Связь между триггером и действиями', 'Class:lnkTriggerAction/Attribute:action_id' => 'Действие', @@ -766,12 +765,12 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Порядок', 'Class:lnkTriggerAction/Attribute:order+' => 'Порядок выполнения действий', -)); +]); // // Synchro Data Source // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:SynchroDataSource' => 'Источник синхронизации данных', 'Class:SynchroDataSource/Attribute:name' => 'Название', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1059,13 +1058,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Core:Validator:MustBeInteger' => 'Должно быть целым числом', 'Core:Validator:MustSelectOne' => 'Пожалуйста, выберите значение', 'Menu:DataSources' => 'Синхронизация данных', - 'Menu:DataSources+' => '' -)); + 'Menu:DataSources+' => '', +]); // // Class: TagSetFieldData // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:TagSetFieldData' => '%2$s для класса %1$s', 'Class:TagSetFieldData+' => '', 'Class:TagSetFieldData/Attribute:code' => 'Код', @@ -1087,12 +1086,12 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Нельзя изменить "Attribute Code" тега', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Использование тега (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => 'Не найдено записей с этим тегом', -)); +]); // // Class: DBProperty // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:DBProperty' => 'DB property~~', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Name~~', @@ -1105,12 +1104,12 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Change comment~~', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:BackgroundTask' => 'Background task~~', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Class name~~', @@ -1135,12 +1134,12 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'Status~~', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:AsyncTask' => 'Async. task~~', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Created~~', @@ -1165,43 +1164,40 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:AsyncTask/Attribute:last_attempt+' => '', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]". Expecting an array with the following keys: %2$s~~', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]": unexpected key "%2$s". Expecting only the following keys: %3$s~~', -)); +]); // // Class: AbstractResource // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:AbstractResource' => 'Ресурс', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ResourceAdminMenu' => 'Меню Инструменты администратора', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ResourceRunQueriesMenu' => 'Меню Выполнение запросов', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:ResourceSystemMenu' => 'Меню Система', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/ru.dictionary.itop.ui.php b/dictionaries/ru.dictionary.itop.ui.php index b15cf579c..059827d65 100644 --- a/dictionaries/ru.dictionary.itop.ui.php +++ b/dictionaries/ru.dictionary.itop.ui.php @@ -1,16 +1,17 @@ * */ -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:AuditCategory' => 'Категория аудита', 'Class:AuditCategory+' => 'Раздел внутри общего аудита', 'Class:AuditCategory/Attribute:name' => 'Название категории', @@ -27,13 +28,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Percentage of invalid objects below which the result is in error (red)~~', 'Class:AuditCategory/Attribute:domains_list' => 'Domains~~', 'Class:AuditCategory/Attribute:domains_list+' => 'Domains which include this category~~', -)); +]); // // Class: AuditRule // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:AuditRule' => 'Правило аудита', 'Class:AuditRule+' => 'Правило для проверки данной категории аудита', 'Class:AuditRule/Attribute:name' => 'Название правила', @@ -52,13 +53,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:AuditRule/Attribute:category_id+' => 'Категория для этого правила', 'Class:AuditRule/Attribute:category_name' => 'Категория', 'Class:AuditRule/Attribute:category_name+' => 'Категория для этого правила', -)); +]); // // Class: AuditDomain // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:AuditDomain' => 'Audit Domain~~', 'Class:AuditDomain+' => 'Audit domains allow to group the audit categories. Domain usually correspond to who is responsible for checking and fixing errors~~', @@ -70,13 +71,13 @@ Domain usually correspond to who is responsible for checking and fixing errors~~ 'Class:AuditDomain/Attribute:icon+' => '~~', 'Class:AuditDomain/Attribute:categories_list' => 'Categories~~', 'Class:AuditDomain/Attribute:categories_list+' => 'Related audit categories. When running the audit on a domain, all related audit categories are checked and only those.~~', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Link AuditCategory / AuditDomain~~', 'Class:lnkAuditCategoryToAuditDomain+' => '~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Category~~', @@ -87,13 +88,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Audit domain~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Domain name~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Audit domain name~~', -)); +]); // // Class: QueryOQL // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:Query' => 'Запрос', 'Class:Query+' => 'Запрос - это набор данных, определенных динамическим путем', 'Class:Query/Attribute:name' => 'Название', @@ -120,7 +121,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:QueryOQL+' => 'Запрос, основанный на OQL (Object Query Language)', 'Class:QueryOQL/Attribute:oql' => 'Выражение', 'Class:QueryOQL/Attribute:oql+' => 'OQL Выражение', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -131,7 +132,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( // Class: User // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:User' => 'Пользователь', 'Class:User+' => 'Пользователь', 'Class:User/Attribute:finalclass' => 'Тип аккаунта', @@ -177,13 +178,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:User/Warning:NoContactHasImpact' => 'Cautious: there is no Person defined on this User, this prevents access to portals, news notifications and other side effects in back-office~~', 'Class:UserInternal' => 'Внутренний пользователь', 'Class:UserInternal+' => 'Учетная запись создана внутри '.ITOP_APPLICATION_SHORT, -)); +]); // // Class: URP_Profiles // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:URP_Profiles' => 'Профиль', 'Class:URP_Profiles+' => 'Пользовательский профиль', 'Class:URP_Profiles/Attribute:name' => 'Название', @@ -192,13 +193,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:URP_Profiles/Attribute:description+' => 'Описание', 'Class:URP_Profiles/Attribute:user_list' => 'Пользователи', 'Class:URP_Profiles/Attribute:user_list+' => 'Пользователи, имеющие эту роль', -)); +]); // // Class: URP_Dimensions // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:URP_Dimensions' => 'размерность', 'Class:URP_Dimensions+' => 'применение размерности (определение силосов)', 'Class:URP_Dimensions/Attribute:name' => 'Название', @@ -207,13 +208,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:URP_Dimensions/Attribute:description+' => 'краткое описание', 'Class:URP_Dimensions/Attribute:type' => 'Тип', 'Class:URP_Dimensions/Attribute:type+' => 'имя класса или типа данных (проекционный блок)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:URP_UserProfile' => 'Профиль пользователя', 'Class:URP_UserProfile+' => 'Профиль пользователя', 'Class:URP_UserProfile/Name' => 'Связь между %1$s и %2$s', @@ -227,14 +228,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:URP_UserProfile/Attribute:profile+' => 'Название профиля', 'Class:URP_UserProfile/Attribute:reason' => 'Причина', 'Class:URP_UserProfile/Attribute:reason+' => 'Пояснение причины назначения этой роли', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:URP_UserOrg' => 'Организации пользователя', 'Class:URP_UserOrg+' => 'Разрешённые организации', 'Class:URP_UserOrg/Name' => 'Связь между %1$s и %2$s', @@ -248,13 +248,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => 'Разрешённая организация', 'Class:URP_UserOrg/Attribute:reason' => 'Причина', 'Class:URP_UserOrg/Attribute:reason+' => 'Пояснение причины разрешения доступа к данным этой организации', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:URP_ProfileProjection' => 'Проекция профиля', 'Class:URP_ProfileProjection+' => 'Проекция профиля', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Размерность', @@ -269,13 +269,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'OQL выражение (используя $user) | константа | | +атрибут кода', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Атрибут', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Целевой атрибут кода (необязательный)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:URP_ClassProjection' => 'Проекция классов', 'Class:URP_ClassProjection+' => 'Проекция классов', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Размерность', @@ -288,13 +288,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:URP_ClassProjection/Attribute:value+' => 'OQL выражение (используя $this) | константа | | +атрибут кода', 'Class:URP_ClassProjection/Attribute:attribute' => 'Атрибут', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Целевой атрибут кода (необязательный)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:URP_ActionGrant' => 'действие разрешений', 'Class:URP_ActionGrant+' => 'разрешения на классы', 'Class:URP_ActionGrant/Attribute:profileid' => 'Профиль', @@ -311,13 +311,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'нет', 'Class:URP_ActionGrant/Attribute:action' => 'Действие', 'Class:URP_ActionGrant/Attribute:action+' => 'действие выполняемое на данном классе', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:URP_StimulusGrant' => 'разрешения стимулов', 'Class:URP_StimulusGrant+' => 'разрешения на стимулы в жизненном цикле объекта', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Профиль', @@ -334,25 +334,25 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'нет', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Стимулы', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'код стимулов', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:URP_AttributeGrant' => 'разрешения атрибутов', 'Class:URP_AttributeGrant+' => 'разрешения на уровне атрибутов', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Действие предоставления', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'действие предоставления', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Атрибут', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'Код атрибута', -)); +]); // // Class: UserDashboard // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Class:UserDashboard' => 'Дашборд пользователя', 'Class:UserDashboard+' => '~~', 'Class:UserDashboard/Attribute:user_id' => 'Пользователь', @@ -361,12 +361,12 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Class:UserDashboard/Attribute:menu_code+' => '', 'Class:UserDashboard/Attribute:contents' => 'Содержимое', 'Class:UserDashboard/Attribute:contents+' => '', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:WelcomeMenu' => 'Добро пожаловать', 'Menu:WelcomeMenu+' => 'Добро пожаловать в '.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage' => 'Добро пожаловать', 'Menu:WelcomeMenuPage+' => 'Добро пожаловать в '.ITOP_APPLICATION_SHORT, 'Menu:AdminTools' => 'Инструменты администратора', @@ -383,14 +383,14 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Menu:MyShortcuts' => 'Избранное', 'Menu:Notifications:Title' => 'Категории аудита', 'Menu:DataAdministration' => 'Администрирование данных', - 'Menu:DataAdministration+' => 'Администрирование данных' -)); + 'Menu:DataAdministration+' => 'Администрирование данных', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'BooleanLabel:yes' => 'да', 'BooleanLabel:no' => 'нет', 'UI:Login:Title' => 'Вход в '.ITOP_APPLICATION_SHORT, 'UI:WelcomeMenu:Title' => 'Добро пожаловать в '.ITOP_APPLICATION_SHORT, 'UI:WelcomeMenu:AllOpenRequests' => 'Открытые запросы: %1$d', @@ -1533,13 +1533,13 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Включаются все нижестоящие объекты.', 'UI:Search:Criteria:Raw:Filtered' => 'Отфильтровано', 'UI:Search:Criteria:Raw:FilteredOn' => 'Отфильтровано по %1$s', - 'UI:StateChanged' => 'State changed~~' -)); + 'UI:StateChanged' => 'State changed~~', +]); // // Expression to Natural language // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Expression:Operator:AND' => ' AND ', 'Expression:Operator:OR' => ' OR ', 'Expression:Operator:=' => ': ~~', @@ -1552,12 +1552,12 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Expression:Unit:Long:MINUTE' => 'minute(s)', 'Expression:Verb:NOW' => 'now', 'Expression:Verb:ISNULL' => ': undefined~~', -)); +]); // // iTop Newsroom menu // -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'UI:Newsroom:NoNewMessage' => 'Нет новых сообщений', 'UI:Newsroom:XNewMessage' => 'Новые сообщения (%1$s)', 'UI:Newsroom:MarkAllAsRead' => 'Отметить все как прочитанные', @@ -1572,10 +1572,9 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgent~~', 'UI:Newsroom:Priority:3:Tooltip' => 'Important~~', 'UI:Newsroom:Priority:4:Tooltip' => 'Normal~~', -)); +]); - -Dict::Add('RU RU', 'Russian', 'Русский', array( +Dict::Add('RU RU', 'Russian', 'Русский', [ 'Menu:DataSources' => 'Синхронизация данных', 'Menu:DataSources+' => 'Синхронизация данных', 'Menu:AuditCategories' => 'Категории аудита', @@ -1603,4 +1602,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Menu:Integrations' => 'Integrations~~', 'Menu:Integrations+' => '~~', -)); +]); diff --git a/dictionaries/sk.dictionary.itop.core.php b/dictionaries/sk.dictionary.itop.core.php index 753722240..d1cbfdef0 100644 --- a/dictionaries/sk.dictionary.itop.core.php +++ b/dictionaries/sk.dictionary.itop.core.php @@ -1,15 +1,16 @@ '%1s (odstránené)', 'Core:DeletedObjectTip' => 'Objekt bol odstránený o %1$s (%2$s)', 'Core:UnknownObjectLabel' => 'Objekt nebol nájdený (trieda: %1$s, id: %2$d)', @@ -157,8 +158,7 @@ Operatori:
          'Core:Context=GUI:Console' => 'Console~~', 'Core:Context=CRON' => 'cron~~', 'Core:Context=GUI:Portal' => 'Portal~~', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -169,7 +169,7 @@ Operatori:
          // Class: CMDBChange // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:CMDBChange' => 'Zmena', 'Class:CMDBChange+' => 'Changes tracking~~', 'Class:CMDBChange/Attribute:date' => 'Dátum', @@ -184,13 +184,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON webservices~~', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP webservices~~', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'By an extension~~', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:CMDBChangeOp' => 'Vykonanie Zmeny', 'Class:CMDBChangeOp+' => 'Change made by one person, at a single time, on a single object~~', 'Class:CMDBChangeOp/Attribute:change' => 'Zmena', @@ -205,51 +205,51 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:CMDBChangeOp/Attribute:objkey+' => 'id of the object on which the change was made~~', 'Class:CMDBChangeOp/Attribute:finalclass' => 'Typ', 'Class:CMDBChangeOp/Attribute:finalclass+' => 'type of change which was performed~~', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:CMDBChangeOpCreate' => 'Vytvorenie objektu', 'Class:CMDBChangeOpCreate+' => 'Object creation tracking~~', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:CMDBChangeOpDelete' => 'Vymazanie objektu', 'Class:CMDBChangeOpDelete+' => 'Object deletion tracking~~', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:CMDBChangeOpSetAttribute' => 'Zmena objektu', 'Class:CMDBChangeOpSetAttribute+' => 'Object properties change tracking~~', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Atribút', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'code of the modified property~~', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'Zmena vlastnosti', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Object scalar properties change tracking~~', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Predchádzajúca hodnota', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => 'previous value of the attribute~~', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Nová hodnota', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => 'new value of the attribute~~', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Change:ObjectCreated' => 'Objekt vytvorený', 'Change:ObjectDeleted' => 'Objekt odstránený', 'Change:ObjectModified' => 'Objekt upravený', @@ -266,35 +266,35 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Change:LinkSet:Added' => 'Pridané %1$s', 'Change:LinkSet:Removed' => 'Odstránené %1$s', 'Change:LinkSet:Modified' => 'Upravené %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'Zmena údajov', 'Class:CMDBChangeOpSetAttributeBlob+' => 'data change tracking~~', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Predchádzajúce údaje', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => 'previous contents of the attribute~~', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:CMDBChangeOpSetAttributeText' => 'Zmena textu', 'Class:CMDBChangeOpSetAttributeText+' => 'text change tracking~~', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Predchádzajúce dáta', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'previous contents of the attribute~~', -)); +]); // // Class: Event // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Event' => 'Logovacia Udalosť', 'Class:Event+' => 'An application internal event~~', 'Class:Event/Attribute:message' => 'Správa', @@ -305,13 +305,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Event/Attribute:userinfo+' => 'identification of the user that was doing the action that triggered this event~~', 'Class:Event/Attribute:finalclass' => 'Typ', 'Class:Event/Attribute:finalclass+' => 'Name of the final class: specifies the sort of event which occurred~~', -)); +]); // // Class: EventNotification // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:EventNotification' => 'Notifikačná Udalosť', 'Class:EventNotification+' => 'Trace of a notification that has been sent~~', 'Class:EventNotification/Attribute:trigger_id' => 'Spúštač', @@ -320,13 +320,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:EventNotification/Attribute:action_id+' => '~~', 'Class:EventNotification/Attribute:object_id' => 'ID objektu', 'Class:EventNotification/Attribute:object_id+' => 'object id (class defined by the trigger ?)~~', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:EventNotificationEmail' => 'Udalosť emitovania emailu', 'Class:EventNotificationEmail+' => 'Trace of an email that has been sent~~', 'Class:EventNotificationEmail/Attribute:to' => 'Komu', @@ -343,13 +343,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:EventNotificationEmail/Attribute:body+' => '~~', 'Class:EventNotificationEmail/Attribute:attachments' => 'Prílohy', 'Class:EventNotificationEmail/Attribute:attachments+' => '~~', -)); +]); // // Class: EventIssue // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:EventIssue' => 'Issue event', 'Class:EventIssue+' => 'Trace of an issue (warning, error, etc.)~~', 'Class:EventIssue/Attribute:issue' => 'Issue', @@ -366,13 +366,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:EventIssue/Attribute:callstack+' => '~~', 'Class:EventIssue/Attribute:data' => 'Dáta', 'Class:EventIssue/Attribute:data+' => 'More information~~', -)); +]); // // Class: EventWebService // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:EventWebService' => 'Udalosť Webovej služby', 'Class:EventWebService+' => 'Trace of a web service call~~', 'Class:EventWebService/Attribute:verb' => 'Slovný', @@ -387,9 +387,9 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:EventWebService/Attribute:log_error+' => 'Result error log~~', 'Class:EventWebService/Attribute:data' => 'Dáta', 'Class:EventWebService/Attribute:data+' => 'Result data~~', -)); +]); -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:EventRestService' => 'REST/JSON call~~', 'Class:EventRestService+' => 'Trace of a REST/JSON service call~~', 'Class:EventRestService/Attribute:operation' => 'Operation~~', @@ -404,13 +404,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:EventRestService/Attribute:json_output+' => 'HTTP response (json)~~', 'Class:EventRestService/Attribute:provider' => 'Provider~~', 'Class:EventRestService/Attribute:provider+' => 'PHP class implementing the expected operation~~', -)); +]); // // Class: EventLoginUsage // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:EventLoginUsage' => 'Využívanosť prihlasovacieho mena', 'Class:EventLoginUsage+' => 'Connection to the application~~', 'Class:EventLoginUsage/Attribute:user_id' => 'Prihlasovacie meno', @@ -419,13 +419,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '~~', 'Class:EventLoginUsage/Attribute:contact_email' => 'Užívateľský email', 'Class:EventLoginUsage/Attribute:contact_email+' => 'Email Address of the User~~', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:EventNotificationNewsroom' => 'News sent~~', 'Class:EventNotificationNewsroom+' => '~~', 'Class:EventNotificationNewsroom/Attribute:title' => 'Title~~', @@ -454,13 +454,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '~~', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact~~', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '~~', -)); +]); // // Class: Action // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Action' => 'Vlastná akcia', 'Class:Action+' => 'User defined action~~', 'Class:Action/ComplementaryName' => '%1$s: %2$s~~', @@ -490,24 +490,24 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Action:last_executions_tab_panel_title' => 'Executions of this action (%1$s)~~', 'Action:last_executions_tab_limit_days' => 'past %1$s days~~', 'Action:last_executions_tab_limit_none' => 'no limit~~', -)); +]); // // Class: ActionNotification // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ActionNotification' => 'Upozornenie', 'Class:ActionNotification+' => 'Notification Action (abstract)~~', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ActionEmail' => 'Emailová notifikácia', 'Class:ActionEmail+' => '~~', 'Class:ActionEmail/Attribute:status+' => 'This status drives who will be notified: @@ -576,14 +576,13 @@ While editing, click on the magnifier to get pertinent examples~~', 'ActionEmail:preview_warning' => 'The actual eMail may look different in the eMail client than this preview in your browser.~~', 'ActionEmail:preview_more_info' => 'For more information about the CSS features supported by the different eMail clients, refer to %1$s~~', 'ActionEmail:content_placeholder_missing' => 'The placeholder "%1$s" was not found in the HTML template. The content of the field "%2$s" will not be included in the generated emails.~~', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'ActionNewsroom:trigger' => 'Trigger~~', 'ActionNewsroom:content' => 'Message~~', 'ActionNewsroom:settings' => 'Settings~~', @@ -618,13 +617,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'An OQL query returning Contact objects~~', 'Class:ActionNewsroom/Attribute:url' => 'URL~~', 'Class:ActionNewsroom/Attribute:url+' => 'By default, it points to the object triggering the notification. But you can also specify a custom URL.~~', -)); +]); // // Class: Trigger // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Trigger' => 'Spúštač', 'Class:Trigger+' => 'Custom event handler~~', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~', @@ -643,13 +642,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Allow complete unsubscription~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Force at least one channel (News or Email)~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Deny unsubscription~~', -)); +]); // // Class: TriggerOnObject // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TriggerOnObject' => 'Spúštač (pre danú triedu)', 'Class:TriggerOnObject+' => 'Trigger on a given class of objects~~', 'Class:TriggerOnObject/Attribute:target_class' => 'Cieľová trieda', @@ -658,115 +657,115 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:TriggerOnObject/Attribute:filter+' => 'Limit the object list (of the target class) which will activate the trigger~~', 'TriggerOnObject:WrongFilterQuery' => 'Wrong filter query: %1$s~~', 'TriggerOnObject:WrongFilterClass' => 'The filter query must return objects of class "%1$s"~~', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TriggerOnPortalUpdate' => 'Spúštač (pri aktualizácií z portálu)', 'Class:TriggerOnPortalUpdate+' => 'Trigger on an end-user\'s update from the portal~', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TriggerOnStateChange' => 'Spúšťač (pri zmene stavu)', 'Class:TriggerOnStateChange+' => 'Trigger on object state change~~', 'Class:TriggerOnStateChange/Attribute:state' => 'Stav', 'Class:TriggerOnStateChange/Attribute:state+' => '~~', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TriggerOnStateEnter' => 'Spúštač (pri vstupe do stavu)', 'Class:TriggerOnStateEnter+' => 'Trigger on object state change - entering~~', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TriggerOnStateLeave' => 'Spúštač (pri opustení stavu)', 'Class:TriggerOnStateLeave+' => 'Trigger on object state change - leaving~~', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TriggerOnObjectCreate' => 'Spúštač (pri vytvoreni objektu)', 'Class:TriggerOnObjectCreate+' => 'Trigger on object creation of [a child class of] the given class~~', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TriggerOnObjectDelete' => 'Trigger (on object deletion)~~', 'Class:TriggerOnObjectDelete+' => 'Trigger on object deletion of [a child class of] the given class~~', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TriggerOnObjectUpdate' => 'Trigger (on object update)~~', 'Class:TriggerOnObjectUpdate+' => 'Trigger on object update of [a child class of] the given class~~', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Target fields~~', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '~~', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TriggerOnObjectMention' => 'Trigger (on object mention)~~', 'Class:TriggerOnObjectMention+' => 'Trigger on mention (@xxx) of an object of [a child class of] the given class in a log attribute~~', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Mentioned filter~~', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Limit the list of mentioned objects which will activate the trigger. If empty, any mentioned object (of any class) will activate it.~~', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TriggerOnAttributeBlobDownload' => 'Trigger (on object\'s document download)~~', 'Class:TriggerOnAttributeBlobDownload+' => 'Trigger on object\'s document field download of [a child class of] the given class~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Target fields~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '~~', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TriggerOnThresholdReached' => 'Spúštač (pri prekročení hranice)', 'Class:TriggerOnThresholdReached+' => 'Trigger on Stop-Watch threshold reached~~', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'Stopky', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '~~', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Hranica', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '~~', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkTriggerAction' => 'Akcia/Spúštač', 'Class:lnkTriggerAction+' => 'Link between a trigger and an action~~', 'Class:lnkTriggerAction/Attribute:action_id' => 'Akcia', @@ -779,12 +778,12 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '~~', 'Class:lnkTriggerAction/Attribute:order' => 'Príkaz', 'Class:lnkTriggerAction/Attribute:order+' => 'Actions execution order~~', -)); +]); // // Synchro Data Source // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:SynchroDataSource' => 'Synchronizovaný zdroj dát', 'Class:SynchroDataSource/Attribute:name' => 'Názov', 'Class:SynchroDataSource/Attribute:name+' => '~~', @@ -1076,12 +1075,12 @@ The hyperlink is displayed in the tooltip appearing on the “Lock” symbol of 'Core:Validator:Mandatory' => 'Please, fill this field~~', 'Core:Validator:MustBeInteger' => 'Must be an integer~~', 'Core:Validator:MustSelectOne' => 'Please, select one~~', -)); +]); // // Class: TagSetFieldData // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:TagSetFieldData' => '%2$s for class %1$s~~', 'Class:TagSetFieldData+' => '~~', 'Class:TagSetFieldData/Attribute:code' => 'Code~~', @@ -1103,12 +1102,12 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Tags "Attribute Code" cannot be changed~~', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Tag usage (%1$d)~~', 'Core:TagSetFieldData:NoEntryFound' => 'No entry found for this tag~~', -)); +]); // // Class: DBProperty // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:DBProperty' => 'DB property~~', 'Class:DBProperty+' => '~~', 'Class:DBProperty/Attribute:name' => 'Name~~', @@ -1121,12 +1120,12 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:DBProperty/Attribute:change_date+' => '~~', 'Class:DBProperty/Attribute:change_comment' => 'Change comment~~', 'Class:DBProperty/Attribute:change_comment+' => '~~', -)); +]); // // Class: BackgroundTask // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:BackgroundTask' => 'Background task~~', 'Class:BackgroundTask+' => '~~', 'Class:BackgroundTask/Attribute:class_name' => 'Class name~~', @@ -1151,12 +1150,12 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:BackgroundTask/Attribute:running+' => '~~', 'Class:BackgroundTask/Attribute:status' => 'Status~~', 'Class:BackgroundTask/Attribute:status+' => '~~', -)); +]); // // Class: AsyncTask // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:AsyncTask' => 'Async. task~~', 'Class:AsyncTask+' => '~~', 'Class:AsyncTask/Attribute:created' => 'Created~~', @@ -1181,43 +1180,40 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:AsyncTask/Attribute:last_attempt+' => '~~', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]". Expecting an array with the following keys: %2$s~~', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]": unexpected key "%2$s". Expecting only the following keys: %3$s~~', -)); +]); // // Class: AbstractResource // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:AbstractResource' => 'Abstract Resource~~', 'Class:AbstractResource+' => '~~', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ResourceAdminMenu' => 'Resource Admin Menu~~', 'Class:ResourceAdminMenu+' => '~~', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ResourceRunQueriesMenu' => 'Resource Run Queries Menu~~', 'Class:ResourceRunQueriesMenu+' => '~~', -)); +]); // // Class: Action // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:ResourceSystemMenu' => 'Resource System Menu~~', 'Class:ResourceSystemMenu+' => '~~', -)); - - - +]); diff --git a/dictionaries/sk.dictionary.itop.ui.php b/dictionaries/sk.dictionary.itop.ui.php index 81b4d3534..e242fd376 100644 --- a/dictionaries/sk.dictionary.itop.ui.php +++ b/dictionaries/sk.dictionary.itop.ui.php @@ -1,15 +1,16 @@ 'Kategória auditu', 'Class:AuditCategory+' => 'Audit category defines a scope of objects which needs to be audited. It groups all audit rules applying to that object scope~~', @@ -27,13 +28,13 @@ It groups all audit rules applying to that object scope~~', 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Percentage of invalid objects below which the result is in error (red)~~', 'Class:AuditCategory/Attribute:domains_list' => 'Domains~~', 'Class:AuditCategory/Attribute:domains_list+' => 'Domains which include this category~~', -)); +]); // // Class: AuditRule // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:AuditRule' => 'Pravidlo auditu', 'Class:AuditRule+' => 'An audit rule corresponds a single check within an audit category. It is applied on the scope of objects defined by the audit category~~', @@ -55,13 +56,13 @@ It is applied on the scope of objects defined by the audit category~~', 'Class:AuditRule/Attribute:category_id+' => 'The category of this rule~~', 'Class:AuditRule/Attribute:category_name' => 'Kategória', 'Class:AuditRule/Attribute:category_name+' => 'Name of the category of this rule~~', -)); +]); // // Class: AuditDomain // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:AuditDomain' => 'Audit Domain~~', 'Class:AuditDomain+' => 'Audit domains allow to group the audit categories. Domain usually correspond to who is responsible for checking and fixing errors~~', @@ -73,13 +74,13 @@ Domain usually correspond to who is responsible for checking and fixing errors~~ 'Class:AuditDomain/Attribute:icon+' => '~~', 'Class:AuditDomain/Attribute:categories_list' => 'Categories~~', 'Class:AuditDomain/Attribute:categories_list+' => 'Related audit categories. When running the audit on a domain, all related audit categories are checked and only those.~~', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Link AuditCategory / AuditDomain~~', 'Class:lnkAuditCategoryToAuditDomain+' => '~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Category~~', @@ -90,13 +91,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Audit domain~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Domain name~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Audit domain name~~', -)); +]); // // Class: QueryOQL // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:Query' => 'Dopyt', 'Class:Query+' => 'A query is a data set defined in a dynamic way~~', 'Class:Query/Attribute:name' => 'Názov', @@ -123,7 +124,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:QueryOQL+' => 'A query based on the Object Query Language~~', 'Class:QueryOQL/Attribute:oql' => 'Výraz', 'Class:QueryOQL/Attribute:oql+' => 'OQL Expression~~', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -134,7 +135,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( // Class: User // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:User' => 'Užívateľ', 'Class:User+' => 'User login~~', 'Class:User/Attribute:finalclass' => 'Typ účtu', @@ -180,13 +181,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:User/Warning:NoContactHasImpact' => 'Cautious: there is no Person defined on this User, this prevents access to portals, news notifications and other side effects in back-office~~', 'Class:UserInternal' => 'User Internal~~', 'Class:UserInternal+' => 'User defined within '.ITOP_APPLICATION_SHORT.'~~', -)); +]); // // Class: URP_Profiles // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:URP_Profiles' => 'Profily', 'Class:URP_Profiles+' => 'User profile~~', 'Class:URP_Profiles/Attribute:name' => 'Názov', @@ -195,13 +196,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:URP_Profiles/Attribute:description+' => 'one line description~~', 'Class:URP_Profiles/Attribute:user_list' => 'Užívatelia', 'Class:URP_Profiles/Attribute:user_list+' => 'persons having this role~~', -)); +]); // // Class: URP_Dimensions // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:URP_Dimensions' => 'Rozmery', 'Class:URP_Dimensions+' => 'application dimension (defining silos)~~', 'Class:URP_Dimensions/Attribute:name' => 'Názov rozmeru', @@ -210,13 +211,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:URP_Dimensions/Attribute:description+' => 'one line description~~', 'Class:URP_Dimensions/Attribute:type' => 'Typ rozmeru', 'Class:URP_Dimensions/Attribute:type+' => 'class name or data type (projection unit)~~', -)); +]); // // Class: URP_UserProfile // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:URP_UserProfile' => 'Z užívateľa na profil', 'Class:URP_UserProfile+' => 'user profiles~~', 'Class:URP_UserProfile/Name' => 'Spojenie medzi %1$s a %2$s', @@ -230,14 +231,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:URP_UserProfile/Attribute:profile+' => 'Profile name~~', 'Class:URP_UserProfile/Attribute:reason' => 'Dôvod', 'Class:URP_UserProfile/Attribute:reason+' => 'explain why this person may have this role~~', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:URP_UserOrg' => 'Užívateľské organizácie', 'Class:URP_UserOrg+' => 'Allowed organizations~~', 'Class:URP_UserOrg/Name' => 'Spojenie medzi %1$s a %2$s', @@ -251,13 +251,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => 'Allowed organization~~', 'Class:URP_UserOrg/Attribute:reason' => 'Dôvod', 'Class:URP_UserOrg/Attribute:reason+' => 'explain why this person is allowed to see the data belonging to this organization~~', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:URP_ProfileProjection' => 'Projekcia profilu', 'Class:URP_ProfileProjection+' => 'profile projections~~', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'ID rozmeru', @@ -272,13 +272,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'OQL expression (using $user) | constant | | +attribute code~~', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Atribút', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Target attribute code (optional)~~', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:URP_ClassProjection' => 'Projekcia triedy', 'Class:URP_ClassProjection+' => 'class projections~~', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'ID rozmeru', @@ -291,13 +291,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:URP_ClassProjection/Attribute:value+' => 'OQL expression (using $this) | constant | | +attribute code~~', 'Class:URP_ClassProjection/Attribute:attribute' => 'Atribút', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Target attribute code (optional)~~', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:URP_ActionGrant' => 'Povolenia akcie', 'Class:URP_ActionGrant+' => 'permissions on classes~~', 'Class:URP_ActionGrant/Attribute:profileid' => 'Profil', @@ -314,13 +314,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'no~~', 'Class:URP_ActionGrant/Attribute:action' => 'Akcia', 'Class:URP_ActionGrant/Attribute:action+' => 'operations to perform on the given class~~', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:URP_StimulusGrant' => 'Povolenia stimulu', 'Class:URP_StimulusGrant+' => 'permissions on stimulus in the life cycle of the object~~', 'Class:URP_StimulusGrant/Attribute:profileid' => 'ID Profilu', @@ -337,25 +337,25 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'no~~', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Podnet', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'stimulus code~~', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:URP_AttributeGrant' => 'Udelenie atribútu', 'Class:URP_AttributeGrant+' => 'permissions at the attributes level~~', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'Udelenie akcie', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'action grant~~', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Kód atribútu', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'attribute code~~', -)); +]); // // Class: UserDashboard // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Class:UserDashboard' => 'User dashboard~~', 'Class:UserDashboard+' => '~~', 'Class:UserDashboard/Attribute:user_id' => 'User~~', @@ -364,12 +364,12 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Class:UserDashboard/Attribute:menu_code+' => '~~', 'Class:UserDashboard/Attribute:contents' => 'Contents~~', 'Class:UserDashboard/Attribute:contents+' => '~~', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Menu:WelcomeMenu' => 'Vitajte', 'Menu:WelcomeMenu+' => 'Welcome to '.ITOP_APPLICATION_SHORT.'~~', 'Menu:WelcomeMenuPage' => 'Vitajte', @@ -388,13 +388,13 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Menu:MyShortcuts' => 'Moje skratky', 'Menu:DataAdministration' => 'Dátová administrácia', 'Menu:DataAdministration+' => '~~', -)); +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'BooleanLabel:yes' => 'yes~~', 'BooleanLabel:no' => 'no~~', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.' login~~', @@ -1532,12 +1532,12 @@ Keď sú priradené spúštačom, každej akcii je dané číslo "príkazu", šp 'UI:Search:Criteria:Raw:Filtered' => 'Filtered~~', 'UI:Search:Criteria:Raw:FilteredOn' => 'Filtered on %1$s~~', 'UI:StateChanged' => 'State changed~~', -)); +]); // // Expression to Natural language // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Expression:Operator:AND' => ' AND ~~', 'Expression:Operator:OR' => ' OR ~~', 'Expression:Operator:=' => ': ~~', @@ -1550,12 +1550,12 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Expression:Unit:Long:MINUTE' => 'minute(s)~~', 'Expression:Verb:NOW' => 'now~~', 'Expression:Verb:ISNULL' => ': undefined~~', -)); +]); // // iTop Newsroom menu // -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'UI:Newsroom:NoNewMessage' => 'No new message~~', 'UI:Newsroom:XNewMessage' => '%1$s new message(s)~~', 'UI:Newsroom:MarkAllAsRead' => 'Mark all messages as read~~', @@ -1570,10 +1570,9 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgent~~', 'UI:Newsroom:Priority:3:Tooltip' => 'Important~~', 'UI:Newsroom:Priority:4:Tooltip' => 'Normal~~', -)); +]); - -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'Menu:DataSources' => 'Synchronizované zdroje dát', 'Menu:DataSources+' => 'Data synchro used for batch import of external data~~', 'Menu:AuditCategories' => 'Kategórie auditu', @@ -1601,4 +1600,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Menu:Integrations' => 'Integrations~~', 'Menu:Integrations+' => '~~', -)); +]); diff --git a/dictionaries/tr.dictionary.itop.core.php b/dictionaries/tr.dictionary.itop.core.php index 4b10659a5..660228736 100644 --- a/dictionaries/tr.dictionary.itop.core.php +++ b/dictionaries/tr.dictionary.itop.core.php @@ -1,16 +1,17 @@ * */ -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Core:DeletedObjectLabel' => '%1s (Silinmiş)', 'Core:DeletedObjectTip' => 'Nesne%1$s (%2$s) \'de silinmiştir', 'Core:UnknownObjectLabel' => 'Nesne bulunamadı (sınıf: %1$s, id: %2$d)', @@ -158,8 +159,7 @@ Operators:
          'Core:Context=GUI:Console' => 'Console~~', 'Core:Context=CRON' => 'cron~~', 'Core:Context=GUI:Portal' => 'Portal~~', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -170,7 +170,7 @@ Operators:
          // Class: CMDBChange // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:CMDBChange' => 'Değişiklik', 'Class:CMDBChange+' => 'Değişiklik izleme', 'Class:CMDBChange/Attribute:date' => 'tarih', @@ -185,13 +185,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON webservices~~', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP webservices~~', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => 'By an extension~~', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:CMDBChangeOp' => 'Değişiklik işlemi', 'Class:CMDBChangeOp+' => '', 'Class:CMDBChangeOp/Attribute:change' => 'değişiklik', @@ -206,51 +206,51 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:CMDBChangeOp/Attribute:objkey+' => '', 'Class:CMDBChangeOp/Attribute:finalclass' => 'tip', 'Class:CMDBChangeOp/Attribute:finalclass+' => '', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:CMDBChangeOpCreate' => 'nesne yaratımı', 'Class:CMDBChangeOpCreate+' => 'Nesne Yaratım izleme', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:CMDBChangeOpDelete' => 'nesne silimi', 'Class:CMDBChangeOpDelete+' => 'Nesne silme izleme', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:CMDBChangeOpSetAttribute' => 'nesne değişikliği', 'Class:CMDBChangeOpSetAttribute+' => 'Nesne değişiminin izlemesi', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => 'Özellik', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => 'Değişen özelliğin kodu', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:CMDBChangeOpSetAttributeScalar' => 'özellik değişimi', 'Class:CMDBChangeOpSetAttributeScalar+' => 'Nesne özellik değişimi izleme', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => 'Önceki değer', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => '', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => 'Yeni değer', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => '', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Change:ObjectCreated' => 'Nesne yaratıldı', 'Change:ObjectDeleted' => 'Nesne silindi', 'Change:ObjectModified' => 'Nesne değiştirildi', @@ -267,35 +267,35 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Change:LinkSet:Added' => '%1$s \'eklendi', 'Change:LinkSet:Removed' => 'Kaldırıldı %1$s', 'Change:LinkSet:Modified' => 'Değiştirilmiş %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:CMDBChangeOpSetAttributeBlob' => 'tarih değişimi', 'Class:CMDBChangeOpSetAttributeBlob+' => 'tarih değişim izleme', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => 'Önceki veri', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => '', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:CMDBChangeOpSetAttributeText' => 'metin değişikliği', 'Class:CMDBChangeOpSetAttributeText+' => 'metin değişikliği izleme', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => 'Önceki veri', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => 'önceki değer', -)); +]); // // Class: Event // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Event' => 'Olay kaydı', 'Class:Event+' => 'Uygulama olayı', 'Class:Event/Attribute:message' => 'mesaj', @@ -306,13 +306,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Event/Attribute:userinfo+' => 'olay anındaki kullanıcı', 'Class:Event/Attribute:finalclass' => 'tip', 'Class:Event/Attribute:finalclass+' => '', -)); +]); // // Class: EventNotification // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:EventNotification' => 'Olay uyarımı', 'Class:EventNotification+' => 'Uyarının tarihçesi', 'Class:EventNotification/Attribute:trigger_id' => 'Uyarı tetikçisi', @@ -321,13 +321,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:EventNotification/Attribute:action_id+' => 'kullanıcı hesabı', 'Class:EventNotification/Attribute:object_id' => 'Nesne belirleyicisi', 'Class:EventNotification/Attribute:object_id+' => 'nesne belirleyicisi (olayı tetikleyen nesne ?)', -)); +]); // // Class: EventNotificationEmail // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:EventNotificationEmail' => 'E-posta gönderim işlemi', 'Class:EventNotificationEmail+' => 'Gönderilen E-posta tarihçesi', 'Class:EventNotificationEmail/Attribute:to' => 'Kime', @@ -344,13 +344,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:EventNotificationEmail/Attribute:body+' => '', 'Class:EventNotificationEmail/Attribute:attachments' => 'Eklentiler', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:EventIssue' => 'Olay ekle', 'Class:EventIssue+' => 'Olay tipi (uyarı, hata, vb.)', 'Class:EventIssue/Attribute:issue' => 'Konu', @@ -367,13 +367,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:EventIssue/Attribute:callstack+' => '', 'Class:EventIssue/Attribute:data' => 'Veri', 'Class:EventIssue/Attribute:data+' => 'Diğer bilgiler', -)); +]); // // Class: EventWebService // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:EventWebService' => 'Web service olayı', 'Class:EventWebService+' => 'web service çağrım sırası', 'Class:EventWebService/Attribute:verb' => 'Fiil', @@ -388,9 +388,9 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:EventWebService/Attribute:log_error+' => 'Sonuç hata kaydı', 'Class:EventWebService/Attribute:data' => 'Veri', 'Class:EventWebService/Attribute:data+' => 'Sonuç veri', -)); +]); -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:EventRestService' => 'REST/JSON çağrısı', 'Class:EventRestService+' => 'REST/JSON izleme hizmet çağrısı', 'Class:EventRestService/Attribute:operation' => 'Operasyon', @@ -405,13 +405,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:EventRestService/Attribute:json_output+' => 'HTTP Yanıt (JSON)', 'Class:EventRestService/Attribute:provider' => 'Sağlayıcı', 'Class:EventRestService/Attribute:provider+' => 'PHP Sınıfı Beklenen Operasyonun Uygulanması', -)); +]); // // Class: EventLoginUsage // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:EventLoginUsage' => 'Giriş Kullanımı', 'Class:EventLoginUsage+' => 'Uygulamaya bağlantı', 'Class:EventLoginUsage/Attribute:user_id' => 'Giriş', @@ -420,13 +420,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '', 'Class:EventLoginUsage/Attribute:contact_email' => 'Kullanıcı e-postası', 'Class:EventLoginUsage/Attribute:contact_email+' => 'Kullanıcının e-posta adresi', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:EventNotificationNewsroom' => 'News sent~~', 'Class:EventNotificationNewsroom+' => '~~', 'Class:EventNotificationNewsroom/Attribute:title' => 'Title~~', @@ -455,13 +455,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '~~', 'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact~~', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '~~', -)); +]); // // Class: Action // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Action' => 'Özel işlem', 'Class:Action+' => 'Kullanıcının tanımladığı işlemler', 'Class:Action/ComplementaryName' => '%1$s: %2$s~~', @@ -491,24 +491,24 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Action:last_executions_tab_panel_title' => 'Executions of this action (%1$s)~~', 'Action:last_executions_tab_limit_days' => 'past %1$s days~~', 'Action:last_executions_tab_limit_none' => 'no limit~~', -)); +]); // // Class: ActionNotification // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ActionNotification' => 'Bildirim', 'Class:ActionNotification+' => 'Bildirim (soyut)', 'Class:ActionNotification/Attribute:language' => 'Language~~', 'Class:ActionNotification/Attribute:language+' => '~~', -)); +]); // // Class: ActionEmail // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ActionEmail' => 'E-posta bildirimi', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => 'This status drives who will be notified: @@ -563,14 +563,13 @@ If omitted the From (label) is used.~~', 'ActionEmail:preview_warning' => 'The actual eMail may look different in the eMail client than this preview in your browser.~~', 'ActionEmail:preview_more_info' => 'For more information about the CSS features supported by the different eMail clients, refer to %1$s~~', 'ActionEmail:content_placeholder_missing' => 'The placeholder "%1$s" was not found in the HTML template. The content of the field "%2$s" will not be included in the generated emails.~~', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'ActionNewsroom:trigger' => 'Trigger~~', 'ActionNewsroom:content' => 'Message~~', 'ActionNewsroom:settings' => 'Settings~~', @@ -605,13 +604,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'An OQL query returning Contact objects~~', 'Class:ActionNewsroom/Attribute:url' => 'URL~~', 'Class:ActionNewsroom/Attribute:url+' => 'By default, it points to the object triggering the notification. But you can also specify a custom URL.~~', -)); +]); // // Class: Trigger // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Trigger' => 'Tetikleyici', 'Class:Trigger+' => 'Özel olay yürütücü', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~', @@ -630,13 +629,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Allow complete unsubscription~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Force at least one channel (News or Email)~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Deny unsubscription~~', -)); +]); // // Class: TriggerOnObject // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TriggerOnObject' => 'Tetiklenen (sınıf bağımlılığı)', 'Class:TriggerOnObject+' => 'Verilen sınıflar üzerinde işlemleri gerçekleştir', 'Class:TriggerOnObject/Attribute:target_class' => 'Hedef sınıf', @@ -645,115 +644,115 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:TriggerOnObject/Attribute:filter+' => '', 'TriggerOnObject:WrongFilterQuery' => 'Yanlış filtre sorgusu: %1$s', 'TriggerOnObject:WrongFilterClass' => 'Filtre sorgusu, \\"%1$s\\" \'sınıfının nesnelerini dönmelidir.', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TriggerOnPortalUpdate' => 'Tetikle (portaldan güncellendiğinde)', 'Class:TriggerOnPortalUpdate+' => 'Son kullanıcının portalından gelen güncellemelerinde tetikle', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TriggerOnStateChange' => 'Tetiklenen (durum değişikliğinde)', 'Class:TriggerOnStateChange+' => 'Durum değişikliğinde tetiklenen işlemler', 'Class:TriggerOnStateChange/Attribute:state' => 'Durum', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TriggerOnStateEnter' => 'Tetiklenen (duruma girişte)', 'Class:TriggerOnStateEnter+' => 'Durum değişikliğinde tetiklenen işlemler (duruma giriş)', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TriggerOnStateLeave' => 'Tetiklenen (durum çıkışında)', 'Class:TriggerOnStateLeave+' => 'Durum değişikliğinde tetiklenen işlemler (duruma çıkış)', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TriggerOnObjectCreate' => 'Tetiklenen (nesne yaratımında)', 'Class:TriggerOnObjectCreate+' => 'Verilen sınıf tipi nesne yaratımında tetiklenen işlemler', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TriggerOnObjectDelete' => 'Trigger (on object deletion)~~', 'Class:TriggerOnObjectDelete+' => 'Trigger on object deletion of [a child class of] the given class~~', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TriggerOnObjectUpdate' => 'Trigger (on object update)~~', 'Class:TriggerOnObjectUpdate+' => 'Trigger on object update of [a child class of] the given class~~', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => 'Target fields~~', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TriggerOnObjectMention' => 'Trigger (on object mention)~~', 'Class:TriggerOnObjectMention+' => 'Trigger on mention (@xxx) of an object of [a child class of] the given class in a log attribute~~', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => 'Mentioned filter~~', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => 'Limit the list of mentioned objects which will activate the trigger. If empty, any mentioned object (of any class) will activate it.~~', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TriggerOnAttributeBlobDownload' => 'Trigger (on object\'s document download)~~', 'Class:TriggerOnAttributeBlobDownload+' => 'Trigger on object\'s document field download of [a child class of] the given class~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => 'Target fields~~', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '~~', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TriggerOnThresholdReached' => 'Tetikle (eşik üzerinde)', 'Class:TriggerOnThresholdReached+' => 'Dur-izle eşiğinde tetikle', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => 'İzlemeyi bırak', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => 'Eşik', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkTriggerAction' => 'İşlem/Tetikleme', 'Class:lnkTriggerAction+' => 'Tetikleme ve işlem arasındaki ilişki', 'Class:lnkTriggerAction/Attribute:action_id' => 'İşlem', @@ -766,12 +765,12 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => 'Order', 'Class:lnkTriggerAction/Attribute:order+' => 'İşlem uygulama sırası', -)); +]); // // Synchro Data Source // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:SynchroDataSource' => 'Synchro Veri Kaynağı', 'Class:SynchroDataSource/Attribute:name' => 'İsim', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1059,13 +1058,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Core:Validator:MustBeInteger' => 'Bir tamsayı olmalı', 'Core:Validator:MustSelectOne' => 'Lütfen bir tane seçin', 'Menu:DataSources' => 'Senkronizasyon Veri Kaynakları', - 'Menu:DataSources+' => 'Tüm Senkronizasyon Veri Kaynakları' -)); + 'Menu:DataSources+' => 'Tüm Senkronizasyon Veri Kaynakları', +]); // // Class: TagSetFieldData // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:TagSetFieldData' => '%2$s for class %1$s~~', 'Class:TagSetFieldData+' => '', 'Class:TagSetFieldData/Attribute:code' => 'Code~~', @@ -1087,12 +1086,12 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Tags "Attribute Code" cannot be changed~~', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Tag usage (%1$d)~~', 'Core:TagSetFieldData:NoEntryFound' => 'No entry found for this tag~~', -)); +]); // // Class: DBProperty // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:DBProperty' => 'DB property~~', 'Class:DBProperty+' => '', 'Class:DBProperty/Attribute:name' => 'Name~~', @@ -1105,12 +1104,12 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => 'Change comment~~', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:BackgroundTask' => 'Background task~~', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => 'Class name~~', @@ -1135,12 +1134,12 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => 'Status~~', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:AsyncTask' => 'Async. task~~', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => 'Created~~', @@ -1165,43 +1164,40 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:AsyncTask/Attribute:last_attempt+' => '', 'Class:AsyncTask:InvalidConfig_Class_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]". Expecting an array with the following keys: %2$s~~', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => 'Invalid format for the configuration of "async_task_retries[%1$s]": unexpected key "%2$s". Expecting only the following keys: %3$s~~', -)); +]); // // Class: AbstractResource // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:AbstractResource' => 'Abstract Resource~~', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ResourceAdminMenu' => 'Resource Admin Menu~~', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ResourceRunQueriesMenu' => 'Resource Run Queries Menu~~', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:ResourceSystemMenu' => 'Resource System Menu~~', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/tr.dictionary.itop.ui.php b/dictionaries/tr.dictionary.itop.ui.php index a7f8bc8c5..5c6ba1242 100644 --- a/dictionaries/tr.dictionary.itop.ui.php +++ b/dictionaries/tr.dictionary.itop.ui.php @@ -1,15 +1,16 @@ 'Denetleme Kategorisi', 'Class:AuditCategory+' => 'Denetlemedeki kategori', 'Class:AuditCategory/Attribute:name' => 'Kategori Adı', @@ -26,13 +27,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => 'Percentage of invalid objects below which the result is in error (red)~~', 'Class:AuditCategory/Attribute:domains_list' => 'Domains~~', 'Class:AuditCategory/Attribute:domains_list+' => 'Domains which include this category~~', -)); +]); // // Class: AuditRule // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:AuditRule' => 'Denetleme Kuralı', 'Class:AuditRule+' => 'Denetleme Kategorisi kuralı', 'Class:AuditRule/Attribute:name' => 'Kural Adı', @@ -51,13 +52,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:AuditRule/Attribute:category_id+' => 'Kuralın kategorisi', 'Class:AuditRule/Attribute:category_name' => 'Kategori', 'Class:AuditRule/Attribute:category_name+' => 'Kural için kategori adı', -)); +]); // // Class: AuditDomain // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:AuditDomain' => 'Audit Domain~~', 'Class:AuditDomain+' => 'Audit domains allow to group the audit categories. Domain usually correspond to who is responsible for checking and fixing errors~~', @@ -69,13 +70,13 @@ Domain usually correspond to who is responsible for checking and fixing errors~~ 'Class:AuditDomain/Attribute:icon+' => '~~', 'Class:AuditDomain/Attribute:categories_list' => 'Categories~~', 'Class:AuditDomain/Attribute:categories_list+' => 'Related audit categories. When running the audit on a domain, all related audit categories are checked and only those.~~', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:lnkAuditCategoryToAuditDomain' => 'Link AuditCategory / AuditDomain~~', 'Class:lnkAuditCategoryToAuditDomain+' => '~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => 'Category~~', @@ -86,13 +87,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => 'Audit domain~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => 'Domain name~~', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => 'Audit domain name~~', -)); +]); // // Class: QueryOQL // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:Query' => 'Sorgu', 'Class:Query+' => 'Bir sorgu, dinamik bir şekilde tanımlanan bir veri setidir', 'Class:Query/Attribute:name' => 'İsim', @@ -119,7 +120,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:QueryOQL+' => 'Nesne sorgusu diline dayanan bir sorgu', 'Class:QueryOQL/Attribute:oql' => 'İfade', 'Class:QueryOQL/Attribute:oql+' => 'OQL ifadesi', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -130,7 +131,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( // Class: User // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:User' => 'Kullanıcı', 'Class:User+' => 'Kullanıcı', 'Class:User/Attribute:finalclass' => 'Hesap tipi', @@ -176,13 +177,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:User/Warning:NoContactHasImpact' => 'Cautious: there is no Person defined on this User, this prevents access to portals, news notifications and other side effects in back-office~~', 'Class:UserInternal' => 'Dahili kullanıcı', 'Class:UserInternal+' => ITOP_APPLICATION_SHORT.'\'ta tanımlanan kullanıcı', -)); +]); // // Class: URP_Profiles // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:URP_Profiles' => 'Profil', 'Class:URP_Profiles+' => 'Kullanıcı profili', 'Class:URP_Profiles/Attribute:name' => 'Adı', @@ -191,13 +192,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:URP_Profiles/Attribute:description+' => 'Profil tanımlama', 'Class:URP_Profiles/Attribute:user_list' => 'Kullanıcılar', 'Class:URP_Profiles/Attribute:user_list+' => 'bu rolü kullanan kullanıcılar', -)); +]); // // Class: URP_Dimensions // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:URP_Dimensions' => 'boyut', 'Class:URP_Dimensions+' => 'uygulama boyutları (silo kullanımları)', 'Class:URP_Dimensions/Attribute:name' => 'Adı', @@ -206,13 +207,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:URP_Dimensions/Attribute:description+' => 'Tanımlama', 'Class:URP_Dimensions/Attribute:type' => 'Tip', 'Class:URP_Dimensions/Attribute:type+' => 'sınıf adı veya veri tipi (projection unit)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:URP_UserProfile' => 'Kullanıcı Profili', 'Class:URP_UserProfile+' => 'Kullanıcı Profili', 'Class:URP_UserProfile/Name' => '%1$s ve %2$s arasındaki ilişki', @@ -226,14 +227,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:URP_UserProfile/Attribute:profile+' => 'Profil adı', 'Class:URP_UserProfile/Attribute:reason' => 'Sebep', 'Class:URP_UserProfile/Attribute:reason+' => 'Kullanıcının bu rolü alma sebebini açıklayınız', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:URP_UserOrg' => 'Kullanıcı Kurumu', 'Class:URP_UserOrg+' => 'İzin verilen kurumlar', 'Class:URP_UserOrg/Name' => '%1$s ve %2$s arasındaki ilişki', @@ -247,13 +247,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => 'Erişim yetkisi verilen kurumlar', 'Class:URP_UserOrg/Attribute:reason' => 'Sebep', 'Class:URP_UserOrg/Attribute:reason+' => 'Kullanıcının bu rolü alma sebebini açıklayınız', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:URP_ProfileProjection' => 'profile_projection', 'Class:URP_ProfileProjection+' => 'profile projections', 'Class:URP_ProfileProjection/Attribute:dimensionid' => 'Boyut', @@ -268,13 +268,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'OQL ifadesi (kullanıcı $user) | sabit | | +özellik kodu', 'Class:URP_ProfileProjection/Attribute:attribute' => 'Attribute', 'Class:URP_ProfileProjection/Attribute:attribute+' => 'Hedef özellik kodu (opsiyonel)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:URP_ClassProjection' => 'sınıf projeksiyonu', 'Class:URP_ClassProjection+' => 'sınıf projeksiyonu', 'Class:URP_ClassProjection/Attribute:dimensionid' => 'Boyut', @@ -287,13 +287,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:URP_ClassProjection/Attribute:value+' => 'OQL ifadesi (kullanıcı $user) | sabit | | +özellik kodu', 'Class:URP_ClassProjection/Attribute:attribute' => 'Özellik', 'Class:URP_ClassProjection/Attribute:attribute+' => 'Hedef özellik kodu (opsiyonel)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:URP_ActionGrant' => 'işlem yetkileri', 'Class:URP_ActionGrant+' => 'sınıf üzerindeki yetkiler', 'Class:URP_ActionGrant/Attribute:profileid' => 'Profil', @@ -310,13 +310,13 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => 'hayır', 'Class:URP_ActionGrant/Attribute:action' => 'İşlem', 'Class:URP_ActionGrant/Attribute:action+' => 'verilen sınıf üzerinde uygulanacak işlemler', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:URP_StimulusGrant' => 'uyarı yetkileri', 'Class:URP_StimulusGrant+' => 'nesnenin yaşam döngüsündeki uyarı yetkileri', 'Class:URP_StimulusGrant/Attribute:profileid' => 'Profil', @@ -333,25 +333,25 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => 'hayır', 'Class:URP_StimulusGrant/Attribute:stimulus' => 'Uyarı', 'Class:URP_StimulusGrant/Attribute:stimulus+' => 'uyarı kodu', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:URP_AttributeGrant' => 'özellik yetkisi', 'Class:URP_AttributeGrant+' => 'özellik seviyesinde yetki', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => 'İzin verilen işlem', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => 'İşlem izni', 'Class:URP_AttributeGrant/Attribute:attcode' => 'Özellik', 'Class:URP_AttributeGrant/Attribute:attcode+' => 'Özellik kodu', -)); +]); // // Class: UserDashboard // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Class:UserDashboard' => 'User dashboard~~', 'Class:UserDashboard+' => '~~', 'Class:UserDashboard/Attribute:user_id' => 'User~~', @@ -360,12 +360,12 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Class:UserDashboard/Attribute:menu_code+' => '~~', 'Class:UserDashboard/Attribute:contents' => 'Contents~~', 'Class:UserDashboard/Attribute:contents+' => '~~', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Menu:WelcomeMenu' => 'Hoşgeldiniz', 'Menu:WelcomeMenu+' => ITOP_APPLICATION_SHORT.'\'a Hoşgeldiniz', 'Menu:WelcomeMenuPage' => 'Hoşgeldiniz', @@ -384,14 +384,14 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Menu:MyShortcuts' => 'My Shortcuts~~', 'Menu:Notifications:Title' => 'Denetleme Kategorileri', 'Menu:DataAdministration' => 'Veri Yönetimi', - 'Menu:DataAdministration+' => 'Veri Yönetimi' -)); + 'Menu:DataAdministration+' => 'Veri Yönetimi', +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'BooleanLabel:yes' => 'evet', 'BooleanLabel:no' => 'hayır', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.' login~~', @@ -1540,13 +1540,13 @@ Tetikleme gerçekleştiriğinde işlemler tanımlanan sıra numarası ile gerçe 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => 'Children of the selected objects will be included.~~', 'UI:Search:Criteria:Raw:Filtered' => 'Filtered~~', 'UI:Search:Criteria:Raw:FilteredOn' => 'Filtered on %1$s~~', - 'UI:StateChanged' => 'State changed~~' -)); + 'UI:StateChanged' => 'State changed~~', +]); // // Expression to Natural language // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Expression:Operator:AND' => ' AND ~~', 'Expression:Operator:OR' => ' OR ~~', 'Expression:Operator:=' => ': ~~', @@ -1559,12 +1559,12 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Expression:Unit:Long:MINUTE' => 'minute(s)~~', 'Expression:Verb:NOW' => 'now~~', 'Expression:Verb:ISNULL' => ': undefined~~', -)); +]); // // iTop Newsroom menu // -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'UI:Newsroom:NoNewMessage' => 'No new message~~', 'UI:Newsroom:XNewMessage' => '%1$s new message(s)~~', 'UI:Newsroom:MarkAllAsRead' => 'Mark all messages as read~~', @@ -1579,10 +1579,9 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI:Newsroom:Priority:2:Tooltip' => 'Urgent~~', 'UI:Newsroom:Priority:3:Tooltip' => 'Important~~', 'UI:Newsroom:Priority:4:Tooltip' => 'Normal~~', -)); +]); - -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'Menu:DataSources' => 'Synchronization Data Sources~~', 'Menu:DataSources+' => 'Data synchro used for batch import of external data~~', 'Menu:AuditCategories' => 'Denetleme Kategorileri', @@ -1610,4 +1609,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Menu:Integrations' => 'Integrations~~', 'Menu:Integrations+' => '~~', -)); +]); diff --git a/dictionaries/ui/application/bulk/cs.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/cs.dictionary.itop.bulk.php index 142939b64..4ec8fba4b 100644 --- a/dictionaries/ui/application/bulk/cs.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/cs.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'This attribute can\'t be edited in bulk context~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel security warning~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Opening a file with untrusted data in Microsoft Excel may lead to formula injection. Ensure that your Excel settings are configured to handle files safely. Learn more in our documentation.~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/da.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/da.dictionary.itop.bulk.php index 746f2dcef..19f984f7d 100644 --- a/dictionaries/ui/application/bulk/da.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/da.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'This attribute can\'t be edited in bulk context~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel security warning~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Opening a file with untrusted data in Microsoft Excel may lead to formula injection. Ensure that your Excel settings are configured to handle files safely. Learn more in our documentation.~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/de.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/de.dictionary.itop.bulk.php index 455d3fcf0..2aa593d27 100644 --- a/dictionaries/ui/application/bulk/de.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/de.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'Dieses Attribut kann in einer Massenänderung nicht bearbeitet werden.', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel-Sicherheitswarnung', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Das Öffnen einer Datei mit nicht vertrauenswürdigen Daten in Microsoft Excel kann zu einer Formel-Injektion führen. Stellen Sie sicher, dass Ihre Excel-Einstellungen so konfiguriert sind, dass Dateien sicher verarbeitet werden. Erfahren Sie mehr in unserer Dokumentation.', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/en.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/en.dictionary.itop.bulk.php index 43c2a8b1f..a2d8e73f4 100644 --- a/dictionaries/ui/application/bulk/en.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/en.dictionary.itop.bulk.php @@ -1,4 +1,5 @@ 'This attribute can\'t be edited in bulk context', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel security warning', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Opening a file with untrusted data in Microsoft Excel may lead to formula injection. Ensure that your Excel settings are configured to handle files safely. Learn more in our documentation.', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/en_gb.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/en_gb.dictionary.itop.bulk.php index e360f4274..442855c19 100644 --- a/dictionaries/ui/application/bulk/en_gb.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/en_gb.dictionary.itop.bulk.php @@ -1,13 +1,14 @@ 'This attribute can\'t be edited in bulk context', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel security warning', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Opening a file with untrusted data in Microsoft Excel may lead to formula injection. Ensure that your Excel settings are configured to handle files safely. Learn more in our documentation.', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/es_cr.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/es_cr.dictionary.itop.bulk.php index 87a419c19..732fca221 100644 --- a/dictionaries/ui/application/bulk/es_cr.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/es_cr.dictionary.itop.bulk.php @@ -1,14 +1,15 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Bulk:modify:IncompatibleAttribute' => 'Este atributo no se puede editar en contexto masivo', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Advertencia de seguridad de Excel', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Abrir un archivo con datos que no son de confianza en Microsoft Excel puede provocar la inyección de fórmulas. Asegúrese de que la configuración de Excel esté configurada para manejar archivos de forma segura. Obtenga más información en nuestra documentación.', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/fr.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/fr.dictionary.itop.bulk.php index 53a410284..fe822187d 100644 --- a/dictionaries/ui/application/bulk/fr.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/fr.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'Cet attribut ne peut être édité dans une modification en masse', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Avertissement sur la sécurité d\'Excel', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'L\'ouverture d\'un fichier contenant des données non fiables dans Microsoft Excel peut entraîner l\'injection de formules. Assurez-vous que vos paramètres Excel sont configurés pour traiter les fichiers en toute sécurité. Pour en savoir plus, consultez notre documentation.', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/hu.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/hu.dictionary.itop.bulk.php index 5e215ec0e..ca88b25d9 100644 --- a/dictionaries/ui/application/bulk/hu.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/hu.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'This attribute can\'t be edited in bulk context~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel security warning~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Opening a file with untrusted data in Microsoft Excel may lead to formula injection. Ensure that your Excel settings are configured to handle files safely. Learn more in our documentation.~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/it.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/it.dictionary.itop.bulk.php index 089cc9a94..9a2aaf3a6 100644 --- a/dictionaries/ui/application/bulk/it.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/it.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'Questo attributo non può essere modificato nel contesto di modifica bulk', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Avviso di sicurezza di Excel', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'L\'apertura di un file con dati non fidati in Microsoft Excel potrebbe comportare l\'iniezione di formule. Assicurati che le impostazioni di Excel siano configurate per gestire i file in modo sicuro. Ulteriori informazioni nella nostra documentazione.', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/ja.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/ja.dictionary.itop.bulk.php index 9ab26929e..2c6029cd0 100644 --- a/dictionaries/ui/application/bulk/ja.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/ja.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'This attribute can\'t be edited in bulk context~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel security warning~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Opening a file with untrusted data in Microsoft Excel may lead to formula injection. Ensure that your Excel settings are configured to handle files safely. Learn more in our documentation.~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/nl.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/nl.dictionary.itop.bulk.php index 47c7cb37b..34caf4cf9 100644 --- a/dictionaries/ui/application/bulk/nl.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/nl.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'This attribute can\'t be edited in bulk context~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel security warning~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Opening a file with untrusted data in Microsoft Excel may lead to formula injection. Ensure that your Excel settings are configured to handle files safely. Learn more in our documentation.~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/pl.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/pl.dictionary.itop.bulk.php index 4a08cfb2e..ae71e7ee1 100644 --- a/dictionaries/ui/application/bulk/pl.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/pl.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'Tego atrybutu nie można edytować zbiorczo', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Ostrzeżenie dotyczące bezpieczeństwa programu Excel', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Otwarcie pliku z niezaufanymi danymi w programie Microsoft Excel może spowodować wstrzyknięcie formuły. Upewnij się, że ustawienia programu Excel są skonfigurowane tak, aby bezpiecznie obsługiwać pliki. Dowiedz się więcej w naszej dokumentacji.', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/pt_br.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/pt_br.dictionary.itop.bulk.php index b1db2af8a..b7347bd71 100644 --- a/dictionaries/ui/application/bulk/pt_br.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/pt_br.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'This attribute can\'t be edited in bulk context~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel security warning~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Opening a file with untrusted data in Microsoft Excel may lead to formula injection. Ensure that your Excel settings are configured to handle files safely. Learn more in our documentation.~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/ru.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/ru.dictionary.itop.bulk.php index 6473ad184..11e539a25 100644 --- a/dictionaries/ui/application/bulk/ru.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/ru.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'This attribute can\'t be edited in bulk context~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel security warning~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Opening a file with untrusted data in Microsoft Excel may lead to formula injection. Ensure that your Excel settings are configured to handle files safely. Learn more in our documentation.~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/sk.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/sk.dictionary.itop.bulk.php index 39374416d..e3f6792d9 100644 --- a/dictionaries/ui/application/bulk/sk.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/sk.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'This attribute can\'t be edited in bulk context~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel security warning~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Opening a file with untrusted data in Microsoft Excel may lead to formula injection. Ensure that your Excel settings are configured to handle files safely. Learn more in our documentation.~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/tr.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/tr.dictionary.itop.bulk.php index c26ec8321..9c93546d0 100644 --- a/dictionaries/ui/application/bulk/tr.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/tr.dictionary.itop.bulk.php @@ -1,16 +1,17 @@ 'This attribute can\'t be edited in bulk context~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel security warning~~', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => 'Opening a file with untrusted data in Microsoft Excel may lead to formula injection. Ensure that your Excel settings are configured to handle files safely. Learn more in our documentation.~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/bulk/zh_cn.dictionary.itop.bulk.php b/dictionaries/ui/application/bulk/zh_cn.dictionary.itop.bulk.php index 476d1f694..08a354d54 100644 --- a/dictionaries/ui/application/bulk/zh_cn.dictionary.itop.bulk.php +++ b/dictionaries/ui/application/bulk/zh_cn.dictionary.itop.bulk.php @@ -1,4 +1,5 @@ '此属性无法在批量操作中编辑', 'UI:Bulk:Export:MaliciousInjection:Alert:Title' => 'Excel 安全警告', 'UI:Bulk:Export:MaliciousInjection:Alert:Message' => '在 Microsoft Excel 中打开不信任的文件可能导致公式注入. 请确保 Excel 设置能够安全的处理该文件. 进入我们的文档了解更多.', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/cs.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/cs.dictionary.itop.display-block.php index a7cc444de..73dcbcf75 100644 --- a/dictionaries/ui/application/display-block/cs.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/cs.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Add an entry in the list~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/da.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/da.dictionary.itop.display-block.php index be859b4de..60c3b45eb 100644 --- a/dictionaries/ui/application/display-block/da.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/da.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Add an entry in the list~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/de.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/de.dictionary.itop.display-block.php index 317707ecc..5a8e699c5 100644 --- a/dictionaries/ui/application/display-block/de.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/de.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Einen Eintrag zur Liste hinzufügen', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/en.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/en.dictionary.itop.display-block.php index 294b05d0c..ef5346559 100644 --- a/dictionaries/ui/application/display-block/en.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/en.dictionary.itop.display-block.php @@ -1,4 +1,5 @@ 'Add an entry in the list', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/en_gb.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/en_gb.dictionary.itop.display-block.php index c000b989c..58c5901c7 100644 --- a/dictionaries/ui/application/display-block/en_gb.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/en_gb.dictionary.itop.display-block.php @@ -1,9 +1,10 @@ 'Add an entry in the list', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/es_cr.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/es_cr.dictionary.itop.display-block.php index 2c3bd7597..b9bfb2422 100644 --- a/dictionaries/ui/application/display-block/es_cr.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/es_cr.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Agregar una entrada en la lista', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/fr.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/fr.dictionary.itop.display-block.php index f5d1b75e3..0d0331c7c 100644 --- a/dictionaries/ui/application/display-block/fr.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/fr.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Ajouter une entrée dans la liste', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/hu.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/hu.dictionary.itop.display-block.php index 9044d4d4b..38137bb49 100644 --- a/dictionaries/ui/application/display-block/hu.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/hu.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Add an entry in the list~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/it.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/it.dictionary.itop.display-block.php index b423b50f6..49442844f 100644 --- a/dictionaries/ui/application/display-block/it.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/it.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Aggiungi una voce nella lista', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/ja.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/ja.dictionary.itop.display-block.php index 3c6ccae5f..58db28dbf 100644 --- a/dictionaries/ui/application/display-block/ja.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/ja.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Add an entry in the list~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/nl.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/nl.dictionary.itop.display-block.php index 686f50e3d..5c1b50c0b 100644 --- a/dictionaries/ui/application/display-block/nl.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/nl.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Add an entry in the list~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/pl.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/pl.dictionary.itop.display-block.php index ea35c5b2e..2172f3208 100644 --- a/dictionaries/ui/application/display-block/pl.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/pl.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Dodaj wpis do listy', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/pt_br.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/pt_br.dictionary.itop.display-block.php index 5c8c06a0c..5b1126775 100644 --- a/dictionaries/ui/application/display-block/pt_br.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/pt_br.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Add an entry in the list~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/ru.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/ru.dictionary.itop.display-block.php index 313238765..befa5ee05 100644 --- a/dictionaries/ui/application/display-block/ru.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/ru.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Add an entry in the list~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/sk.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/sk.dictionary.itop.display-block.php index 14729a59b..b02efc614 100644 --- a/dictionaries/ui/application/display-block/sk.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/sk.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Add an entry in the list~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/tr.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/tr.dictionary.itop.display-block.php index c0fd91295..d05af4e08 100644 --- a/dictionaries/ui/application/display-block/tr.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/tr.dictionary.itop.display-block.php @@ -1,14 +1,15 @@ 'Add an entry in the list~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/display-block/zh_cn.dictionary.itop.display-block.php b/dictionaries/ui/application/display-block/zh_cn.dictionary.itop.display-block.php index 9a2afbd53..c69434e0e 100644 --- a/dictionaries/ui/application/display-block/zh_cn.dictionary.itop.display-block.php +++ b/dictionaries/ui/application/display-block/zh_cn.dictionary.itop.display-block.php @@ -1,4 +1,5 @@ '向列表添加条目', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/cs.dictionary.itop.links.php b/dictionaries/ui/application/links/cs.dictionary.itop.links.php index e40ce6d6b..1986b05cd 100644 --- a/dictionaries/ui/application/links/cs.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/cs.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Create an object~~', 'UI:Links:Create:Button' => 'Create~~', 'UI:Links:Create:Button+' => 'Create a %4$s~~', @@ -41,4 +42,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'One object is linked~~', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} objects are linked~~', 'UI:Links:NewItem' => 'New item~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/da.dictionary.itop.links.php b/dictionaries/ui/application/links/da.dictionary.itop.links.php index 12b6c9cb3..3163511c8 100644 --- a/dictionaries/ui/application/links/da.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/da.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Create an object~~', 'UI:Links:Create:Button' => 'Create~~', 'UI:Links:Create:Button+' => 'Create a %4$s~~', @@ -41,4 +42,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'One object is linked~~', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} objects are linked~~', 'UI:Links:NewItem' => 'New item~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/de.dictionary.itop.links.php b/dictionaries/ui/application/links/de.dictionary.itop.links.php index faec293f2..53cd3f425 100644 --- a/dictionaries/ui/application/links/de.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/de.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Ein Objekt erstellen', 'UI:Links:Create:Button' => 'Erstellen', 'UI:Links:Create:Button+' => '%4$s erstellen', @@ -41,4 +42,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'Ein Objekt ist verknüpft', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} Objekte sind verknüpft', 'UI:Links:NewItem' => 'Neues Element', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/en.dictionary.itop.links.php b/dictionaries/ui/application/links/en.dictionary.itop.links.php index 9e4d2add3..aa13ce341 100644 --- a/dictionaries/ui/application/links/en.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/en.dictionary.itop.links.php @@ -1,4 +1,5 @@ 'New item', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/en_gb.dictionary.itop.links.php b/dictionaries/ui/application/links/en_gb.dictionary.itop.links.php index 7bf65f71f..f904b4232 100644 --- a/dictionaries/ui/application/links/en_gb.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/en_gb.dictionary.itop.links.php @@ -1,10 +1,11 @@ 'New item', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/es_cr.dictionary.itop.links.php b/dictionaries/ui/application/links/es_cr.dictionary.itop.links.php index 14312987a..65b04b5ae 100644 --- a/dictionaries/ui/application/links/es_cr.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/es_cr.dictionary.itop.links.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Links:Object:New:Modal:Title' => 'Crear un objeto', 'UI:Links:Create:Button' => 'Crear', 'UI:Links:Create:Button+' => 'Crear un %4$s', @@ -39,4 +40,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'Un objeto está vinculado', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} objetos están vinculados', 'UI:Links:NewItem' => 'Nuevo elemento', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/fr.dictionary.itop.links.php b/dictionaries/ui/application/links/fr.dictionary.itop.links.php index 590c1fdcb..db9e937c4 100644 --- a/dictionaries/ui/application/links/fr.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/fr.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Créer un objet', 'UI:Links:Create:Button' => 'Créer', 'UI:Links:Create:Button+' => 'Créer un(e) %4$s', @@ -41,4 +42,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'Un objet est lié', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} objets sont liés', 'UI:Links:NewItem' => 'Nouvel element', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/hu.dictionary.itop.links.php b/dictionaries/ui/application/links/hu.dictionary.itop.links.php index dd2583512..d4f802ced 100644 --- a/dictionaries/ui/application/links/hu.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/hu.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Create an object~~', 'UI:Links:Create:Button' => 'Create~~', 'UI:Links:Create:Button+' => 'Create a %4$s~~', @@ -41,4 +42,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'One object is linked~~', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} objects are linked~~', 'UI:Links:NewItem' => 'New item~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/it.dictionary.itop.links.php b/dictionaries/ui/application/links/it.dictionary.itop.links.php index 083cfe895..e84155833 100644 --- a/dictionaries/ui/application/links/it.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/it.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Crea un oggetto', 'UI:Links:Create:Button' => 'Crea', 'UI:Links:Create:Button+' => 'Crea un %4$s', @@ -41,4 +42,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'Un oggetto è collegato', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} oggetti sono collegati', 'UI:Links:NewItem' => 'Nuovo elemento', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/ja.dictionary.itop.links.php b/dictionaries/ui/application/links/ja.dictionary.itop.links.php index 4f0cfee14..835b40f4d 100644 --- a/dictionaries/ui/application/links/ja.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/ja.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Create an object~~', 'UI:Links:Create:Button' => 'Create~~', 'UI:Links:Create:Button+' => 'Create a %4$s~~', @@ -41,4 +42,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'One object is linked~~', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} objects are linked~~', 'UI:Links:NewItem' => 'New item~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/nl.dictionary.itop.links.php b/dictionaries/ui/application/links/nl.dictionary.itop.links.php index 4dbfa16e1..f5356ae6a 100644 --- a/dictionaries/ui/application/links/nl.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/nl.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Create an object~~', 'UI:Links:Create:Button' => 'Create~~', 'UI:Links:Create:Button+' => 'Create a %4$s~~', @@ -41,4 +42,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'One object is linked~~', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} objects are linked~~', 'UI:Links:NewItem' => 'New item~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/pl.dictionary.itop.links.php b/dictionaries/ui/application/links/pl.dictionary.itop.links.php index 73ebd38f4..1dde715a6 100644 --- a/dictionaries/ui/application/links/pl.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/pl.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Tworzy obiekt', 'UI:Links:Create:Button' => 'Utwórz', 'UI:Links:Create:Button+' => 'Tworzy %4$s', @@ -41,4 +42,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'Jeden obiekt jest połączony', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} obiekty są połączone', 'UI:Links:NewItem' => 'Nowy obiekt', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/pt_br.dictionary.itop.links.php b/dictionaries/ui/application/links/pt_br.dictionary.itop.links.php index 768a84425..1c17731bd 100644 --- a/dictionaries/ui/application/links/pt_br.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/pt_br.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Create an object~~', 'UI:Links:Create:Button' => 'Create~~', 'UI:Links:Create:Button+' => 'Create a %4$s~~', @@ -41,4 +42,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'One object is linked~~', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} objects are linked~~', 'UI:Links:NewItem' => 'New item~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/ru.dictionary.itop.links.php b/dictionaries/ui/application/links/ru.dictionary.itop.links.php index 614869fab..4347712ab 100644 --- a/dictionaries/ui/application/links/ru.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/ru.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Create an object~~', 'UI:Links:Create:Button' => 'Create~~', 'UI:Links:Create:Button+' => 'Create a %4$s~~', @@ -41,4 +42,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'One object is linked~~', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} objects are linked~~', 'UI:Links:NewItem' => 'New item~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/sk.dictionary.itop.links.php b/dictionaries/ui/application/links/sk.dictionary.itop.links.php index e169ea2e7..c7a2194ab 100644 --- a/dictionaries/ui/application/links/sk.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/sk.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Create an object~~', 'UI:Links:Create:Button' => 'Create~~', 'UI:Links:Create:Button+' => 'Create a %4$s~~', @@ -41,4 +42,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'One object is linked~~', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} objects are linked~~', 'UI:Links:NewItem' => 'New item~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/tr.dictionary.itop.links.php b/dictionaries/ui/application/links/tr.dictionary.itop.links.php index e4b8fe37f..03bc9a28e 100644 --- a/dictionaries/ui/application/links/tr.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/tr.dictionary.itop.links.php @@ -1,15 +1,16 @@ 'Create an object~~', 'UI:Links:Create:Button' => 'Create~~', 'UI:Links:Create:Button+' => 'Create a %4$s~~', @@ -41,4 +42,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI:Links:Bulk:LinkExistForOneObject' => 'One object is linked~~', 'UI:Links:Bulk:LinkExistForXObjects' => '{count} objects are linked~~', 'UI:Links:NewItem' => 'New item~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/links/zh_cn.dictionary.itop.links.php b/dictionaries/ui/application/links/zh_cn.dictionary.itop.links.php index 55cd94ad5..78a630409 100644 --- a/dictionaries/ui/application/links/zh_cn.dictionary.itop.links.php +++ b/dictionaries/ui/application/links/zh_cn.dictionary.itop.links.php @@ -1,4 +1,5 @@ '新建条目', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/cs.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/cs.dictionary.itop.newsroom.php index e9545677a..c261ccf71 100644 --- a/dictionaries/ui/application/newsroom/cs.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/cs.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Vaše '.ITOP_APPLICATION_SHORT.' novinky', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Spravujte oznámení, označujte je jako přečtené, smažte je, atd.', @@ -58,4 +59,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'Žádné novinky nelze smazat', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'Novinky byly smazány', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s novinek bylo smazáno', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/da.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/da.dictionary.itop.newsroom.php index e3ac64c48..a4cf5d9a0 100644 --- a/dictionaries/ui/application/newsroom/da.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/da.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news~~', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.~~', @@ -59,4 +60,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/de.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/de.dictionary.itop.newsroom.php index 622e786fb..1d504e6b6 100644 --- a/dictionaries/ui/application/newsroom/de.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/de.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news~~', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.~~', @@ -59,4 +60,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/en.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/en.dictionary.itop.newsroom.php index 4a263f24f..23bd3b9de 100644 --- a/dictionaries/ui/application/newsroom/en.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/en.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, - 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your ' . ITOP_APPLICATION_SHORT.' news', + 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.', 'UI:Newsroom:iTopNotification:ViewAllPage:Read:Label' => 'Read', 'UI:Newsroom:iTopNotification:ViewAllPage:Unread:Label' => 'Unread', @@ -30,7 +31,7 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Success:Message' => 'All %1$s news have been deleted', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Confirmation:Title' => 'Delete all news', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Confirmation:Message' => 'Are you sure you want to delete all news?', - + 'UI:Newsroom:iTopNotification:ViewAllPage:Empty:Title' => 'No news, you are up to date!', // Actions @@ -60,4 +61,4 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/en_gb.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/en_gb.dictionary.itop.newsroom.php index 127501532..edc6f85c0 100644 --- a/dictionaries/ui/application/newsroom/en_gb.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/en_gb.dictionary.itop.newsroom.php @@ -1,12 +1,13 @@ ITOP_APPLICATION_SHORT, - 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your ' . ITOP_APPLICATION_SHORT.' news', + 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.', 'UI:Newsroom:iTopNotification:ViewAllPage:Read:Label' => 'Read', 'UI:Newsroom:iTopNotification:ViewAllPage:Unread:Label' => 'Unread', @@ -17,7 +18,7 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Success:Message' => 'All %1$s news have been deleted', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Confirmation:Title' => 'Delete all news', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteAll:Confirmation:Message' => 'Are you sure you want to delete all news?', - + 'UI:Newsroom:iTopNotification:ViewAllPage:Empty:Title' => 'No news, you are up to date!', // Actions @@ -47,4 +48,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/es_cr.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/es_cr.dictionary.itop.newsroom.php index 130f5c1db..3460928a1 100644 --- a/dictionaries/ui/application/newsroom/es_cr.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/es_cr.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Newsroom:iTopNotification:Label' => ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Sus noticias de '.ITOP_APPLICATION_SHORT.'', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Gestione sus noticias, márquelas como leídas o no leídas, elimínadas, etc.', @@ -49,4 +50,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No hay noticias para eliminar', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'La noticia ha sido eliminada.', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s noticias han sido eliminadas', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/fr.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/fr.dictionary.itop.newsroom.php index 1667a185e..067ba8b34 100644 --- a/dictionaries/ui/application/newsroom/fr.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/fr.dictionary.itop.newsroom.php @@ -1,15 +1,16 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Vos news '.ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Gérer vos news, les marquer comme lues ou non lues, les supprimer, etc.', @@ -42,4 +43,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'Aucune news à supprimer', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'La news a été supprimée', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news ont été supprimées', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/hu.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/hu.dictionary.itop.newsroom.php index e0bfa39f2..a8c0ae2fe 100644 --- a/dictionaries/ui/application/newsroom/hu.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/hu.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news~~', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.~~', @@ -59,4 +60,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/it.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/it.dictionary.itop.newsroom.php index 7b9b3cb42..196ae5c69 100644 --- a/dictionaries/ui/application/newsroom/it.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/it.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news~~', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.~~', @@ -59,4 +60,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/ja.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/ja.dictionary.itop.newsroom.php index 9c6d2e7a2..00b35499b 100644 --- a/dictionaries/ui/application/newsroom/ja.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/ja.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news~~', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.~~', @@ -59,4 +60,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/nl.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/nl.dictionary.itop.newsroom.php index bbbe08a41..c8d092773 100644 --- a/dictionaries/ui/application/newsroom/nl.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/nl.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news~~', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.~~', @@ -59,4 +60,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/pl.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/pl.dictionary.itop.newsroom.php index 15c7e346c..dabea281f 100644 --- a/dictionaries/ui/application/newsroom/pl.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/pl.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Twoje wiadomości '.ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Zarządzaj swoimi wiadomościami, oznaczaj je jako przeczytane lub nieprzeczytane, usuwaj je itp.', @@ -58,4 +59,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'Brak wiadomości do usunięcia', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'Wiadomość została usunięta', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s wiadomości zostało usuniętych', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/pt_br.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/pt_br.dictionary.itop.newsroom.php index 3990bf9fa..bebc1e88c 100644 --- a/dictionaries/ui/application/newsroom/pt_br.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/pt_br.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news~~', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.~~', @@ -59,4 +60,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/ru.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/ru.dictionary.itop.newsroom.php index f4415c410..bc4aee562 100644 --- a/dictionaries/ui/application/newsroom/ru.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/ru.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news~~', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.~~', @@ -59,4 +60,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/sk.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/sk.dictionary.itop.newsroom.php index 8b7257e2c..bfaeeaf20 100644 --- a/dictionaries/ui/application/newsroom/sk.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/sk.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news~~', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.~~', @@ -59,4 +60,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/tr.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/tr.dictionary.itop.newsroom.php index 4b2b5b645..f1b19910f 100644 --- a/dictionaries/ui/application/newsroom/tr.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/tr.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news~~', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.~~', @@ -59,4 +60,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => 'No news to delete~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => 'The news has been deleted~~', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '%1$s news have been deleted~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/newsroom/zh_cn.dictionary.itop.newsroom.php b/dictionaries/ui/application/newsroom/zh_cn.dictionary.itop.newsroom.php index 9f271798e..98777e7c3 100644 --- a/dictionaries/ui/application/newsroom/zh_cn.dictionary.itop.newsroom.php +++ b/dictionaries/ui/application/newsroom/zh_cn.dictionary.itop.newsroom.php @@ -1,4 +1,5 @@ ITOP_APPLICATION_SHORT, 'UI:Newsroom:iTopNotification:ViewAllPage:Title' => 'Your '.ITOP_APPLICATION_SHORT.' news~~', 'UI:Newsroom:iTopNotification:ViewAllPage:SubTitle' => 'Manage your news, flag them as read or unread, delete them, etc.~~', @@ -58,4 +59,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:NoEvent:Message' => '没有可删除的消息', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Success:Message' => '消息已删除', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:DeleteMultiple:Success:Message' => '已删除 %1$s 条消息', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/application/object/cs.dictionary.itop.object.php b/dictionaries/ui/application/object/cs.dictionary.itop.object.php index 8585cfc55..d3ea7d0a8 100644 --- a/dictionaries/ui/application/object/cs.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/cs.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Create an object~~', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', -)); +]); diff --git a/dictionaries/ui/application/object/da.dictionary.itop.object.php b/dictionaries/ui/application/object/da.dictionary.itop.object.php index 1ef2acf05..e1a0c6c31 100644 --- a/dictionaries/ui/application/object/da.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/da.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Create an object~~', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', -)); +]); diff --git a/dictionaries/ui/application/object/de.dictionary.itop.object.php b/dictionaries/ui/application/object/de.dictionary.itop.object.php index e4175661f..68f17a56a 100644 --- a/dictionaries/ui/application/object/de.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/de.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Ein Objekt erstellen', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'Dieses Formular enthält ein Pflichtdateiattribut, das im Modalmodus nicht festgelegt werden kann. Die Erstellung dieses Objekts ist unvollständig; bearbeiten Sie es in einem Vollbildformular, um es abzuschließen.', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'Dieses Formular enthält ein Pflichtdateiattribut, das im Modalmodus nicht festgelegt werden kann. Dieses Objekt ist unvollständig; bearbeiten Sie es in einem Vollbildformular, um es abzuschließen.', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'Dieses Formular enthält ein Pflichtdateiattribut, das im Modalmodus nicht geändert werden kann.', -)); +]); diff --git a/dictionaries/ui/application/object/en.dictionary.itop.object.php b/dictionaries/ui/application/object/en.dictionary.itop.object.php index ec54c8097..55ec10b2a 100644 --- a/dictionaries/ui/application/object/en.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/en.dictionary.itop.object.php @@ -1,4 +1,5 @@ 'Create an object', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.', -)); +]); diff --git a/dictionaries/ui/application/object/en_gb.dictionary.itop.object.php b/dictionaries/ui/application/object/en_gb.dictionary.itop.object.php index 6522929b5..d707cab6b 100644 --- a/dictionaries/ui/application/object/en_gb.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/en_gb.dictionary.itop.object.php @@ -1,12 +1,13 @@ 'Create an object', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.', -)); +]); diff --git a/dictionaries/ui/application/object/es_cr.dictionary.itop.object.php b/dictionaries/ui/application/object/es_cr.dictionary.itop.object.php index 48e66464d..eb4138a29 100644 --- a/dictionaries/ui/application/object/es_cr.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/es_cr.dictionary.itop.object.php @@ -1,15 +1,16 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Object:Modal:Title' => 'Crear un objeto', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'Este formulario contiene un atributo de archivo obligatorio que no se puede configurar en modo modal. La creación de este objeto estará incompleta, edítela en un formulario de página completa para completarla.', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'Este formulario contiene un atributo de archivo obligatorio que no se puede configurar en modo modal. Este objeto está incompleto, edítelo en un formulario de página completa para completarlo.', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'Este formulario contiene un atributo de archivo obligatorio que no se puede modificar en modo modal.', -)); +]); diff --git a/dictionaries/ui/application/object/fr.dictionary.itop.object.php b/dictionaries/ui/application/object/fr.dictionary.itop.object.php index 2cfab51e5..9e0a5dbf6 100644 --- a/dictionaries/ui/application/object/fr.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/fr.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Créer un objet', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'Ce formulaire contient un attribut fichier obligatoire qui ne peut pas être renseigné en mode pop-up. La création de cet objet sera incomplète et pourra être complétée dans un formulaire en pleine page.', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'Ce formulaire contient un attribut fichier obligatoire qui ne peut pas être renseigné en mode pop-up. Cet objet est incomplet, il peut être complété dans un formulaire en pleine page.', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'Ce formulaire contient un attribut fichier obligatoire qui ne peut pas être modifié en mode pop-up.', -)); +]); diff --git a/dictionaries/ui/application/object/hu.dictionary.itop.object.php b/dictionaries/ui/application/object/hu.dictionary.itop.object.php index 4c4926858..3366a39b7 100644 --- a/dictionaries/ui/application/object/hu.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/hu.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Create an object~~', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', -)); +]); diff --git a/dictionaries/ui/application/object/it.dictionary.itop.object.php b/dictionaries/ui/application/object/it.dictionary.itop.object.php index 619fb4dd8..4571541b2 100644 --- a/dictionaries/ui/application/object/it.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/it.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Crea un oggetto', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'Questo modulo contiene un attributo di file obbligatorio che non può essere impostato in modalità modale. La creazione di questo oggetto sarà incompleta; modificalo in una pagina completa per completarlo.', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'Questo modulo contiene un attributo di file obbligatorio che non può essere impostato in modalità modale. Questo oggetto è incompleto; modificalo in una pagina completa per completarlo.', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'Questo modulo contiene attributi di file obbligatori che non possono essere modificati in modalità modale.', -)); +]); diff --git a/dictionaries/ui/application/object/ja.dictionary.itop.object.php b/dictionaries/ui/application/object/ja.dictionary.itop.object.php index 0b16ca8a6..2504628b3 100644 --- a/dictionaries/ui/application/object/ja.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/ja.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Create an object~~', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', -)); +]); diff --git a/dictionaries/ui/application/object/nl.dictionary.itop.object.php b/dictionaries/ui/application/object/nl.dictionary.itop.object.php index 1f1d34760..39e46ae65 100644 --- a/dictionaries/ui/application/object/nl.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/nl.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Create an object~~', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', -)); +]); diff --git a/dictionaries/ui/application/object/pl.dictionary.itop.object.php b/dictionaries/ui/application/object/pl.dictionary.itop.object.php index 1915f4ee5..371700efa 100644 --- a/dictionaries/ui/application/object/pl.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/pl.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Utwórz obiekt', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'Formularz ten zawiera obowiązkowy atrybut pliku, którego nie można ustawić w trybie modalnym. Utworzenie tego obiektu będzie niekompletne, edytuj go w formie całostronicowej, aby go ukończyć.', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'Formularz ten zawiera obowiązkowy atrybut pliku, którego nie można ustawić w trybie modalnym. Obiekt ten jest niekompletny. Aby go uzupełnić, edytuj go w formie całostronicowej.', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'Formularz ten zawiera obowiązkowy atrybut pliku, którego nie można modyfikować w trybie modalnym.', -)); +]); diff --git a/dictionaries/ui/application/object/pt_br.dictionary.itop.object.php b/dictionaries/ui/application/object/pt_br.dictionary.itop.object.php index cf0789690..bbbfc6932 100644 --- a/dictionaries/ui/application/object/pt_br.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/pt_br.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Create an object~~', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', -)); +]); diff --git a/dictionaries/ui/application/object/ru.dictionary.itop.object.php b/dictionaries/ui/application/object/ru.dictionary.itop.object.php index e2a18124f..0d5ca1746 100644 --- a/dictionaries/ui/application/object/ru.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/ru.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Create an object~~', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', -)); +]); diff --git a/dictionaries/ui/application/object/sk.dictionary.itop.object.php b/dictionaries/ui/application/object/sk.dictionary.itop.object.php index 670ad6551..aebb0534c 100644 --- a/dictionaries/ui/application/object/sk.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/sk.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Create an object~~', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', -)); +]); diff --git a/dictionaries/ui/application/object/tr.dictionary.itop.object.php b/dictionaries/ui/application/object/tr.dictionary.itop.object.php index fdfebabd7..d10c5441d 100644 --- a/dictionaries/ui/application/object/tr.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/tr.dictionary.itop.object.php @@ -1,17 +1,18 @@ 'Create an object~~', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', -)); +]); diff --git a/dictionaries/ui/application/object/zh_cn.dictionary.itop.object.php b/dictionaries/ui/application/object/zh_cn.dictionary.itop.object.php index ef62bd482..9ba984763 100644 --- a/dictionaries/ui/application/object/zh_cn.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/zh_cn.dictionary.itop.object.php @@ -1,4 +1,5 @@ '创建对象', 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => '当前表单包含一个模态模式下不支持的必填文件属性. 创建/修改此对象可能无法进行, 其需要在页表单中完成.', 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => '当前表单包含一个模态模式下不支持的必填文件属性. 此对象信息不完整, 请在页表单中完成编辑.', 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => '当前表单包含一个模态模式下不支持的必填文件属性.', -)); +]); diff --git a/dictionaries/ui/application/welcome-popup/cs.dictionary.itop.welcome-popup.php b/dictionaries/ui/application/welcome-popup/cs.dictionary.itop.welcome-popup.php index 055756753..19fb7f7de 100644 --- a/dictionaries/ui/application/welcome-popup/cs.dictionary.itop.welcome-popup.php +++ b/dictionaries/ui/application/welcome-popup/cs.dictionary.itop.welcome-popup.php @@ -1,4 +1,5 @@ 'Welcome to ' . ITOP_APPLICATION_SHORT . ' 3.2', + 'UI:WelcomePopup:Message:320_01_Welcome:Title' => 'Welcome to '.ITOP_APPLICATION_SHORT.' 3.2', 'UI:WelcomePopup:Message:320_01_Welcome:Description' => '
          Congratulations, you landed on '.ITOP_APPLICATION.' '.ITOP_VERSION_NAME.'!

          We\'re excited to announce this new release.
          -
          In addition to introducing new features such as Newsroom, ' . ITOP_APPLICATION_SHORT . ' 3.2 includes critical security patches, enhanced accessibility and other significant improvements focused on providing you with stability and security.
          +
          In addition to introducing new features such as Newsroom, '.ITOP_APPLICATION_SHORT.' 3.2 includes critical security patches, enhanced accessibility and other significant improvements focused on providing you with stability and security.

          Discover all of '.ITOP_APPLICATION_SHORT.'\'s exciting new features and stay up-to-date with important notifications with our new welcome pop-up!
          We hope you\'ll enjoy this version as much as we enjoyed imagining and creating it.
          @@ -27,14 +28,14 @@ Dict::Add('EN US', 'English', 'English', [ 'UI:WelcomePopup:Message:320_02_Newsroom:Description' => '
          Say goodbye to cluttered inboxes and hello to personalized alerts with '.ITOP_APPLICATION_SHORT.'\'s Newsroom!
          Newsroom allows you to easily manage notifications within the platform, so you can stay on top of important updates without constantly checking your email. With the ability to mark messages as read or unread, and automatically delete old notifications, you have complete control over your notifications.

          -
          Try it out today and streamline your ' . ITOP_APPLICATION_SHORT . '\'s communication experience!
          ', +
          Try it out today and streamline your '.ITOP_APPLICATION_SHORT.'\'s communication experience!
          ', 'UI:WelcomePopup:Message:320_03_NotificationsCenter:Title' => 'Notifications center', 'UI:WelcomePopup:Message:320_03_NotificationsCenter:Description' => '
          As we know your information intake is already at its max, you can now easily choose how you receive your notifications - via email, chat, or even the Newsroom feature
          You don\'t want to receive a certain type of alerts? Nothing easier with these advanced customization capabilities giving you the flexibility to tailor your experience to your needs.

          Access your notifications center through the newsroom or through your preferences and avoid information overload on all your communication channels!
          ', - 'UI:WelcomePopup:Message:320_05_A11yThemes:Title' => 'Accessibility for ' . ITOP_APPLICATION_SHORT . '\'s UI', - 'UI:WelcomePopup:Message:320_05_A11yThemes:Description' => '
          To ensure ' . ITOP_APPLICATION_SHORT . '\'s accessibility, our team has been working on new back-office themes. WCAG compliants, those UI focus on making it easier for users with visual impairments to use the solution: + 'UI:WelcomePopup:Message:320_05_A11yThemes:Title' => 'Accessibility for '.ITOP_APPLICATION_SHORT.'\'s UI', + 'UI:WelcomePopup:Message:320_05_A11yThemes:Description' => '
          To ensure '.ITOP_APPLICATION_SHORT.'\'s accessibility, our team has been working on new back-office themes. WCAG compliants, those UI focus on making it easier for users with visual impairments to use the solution:
          • Color-blind theme: Designed to help users with colorblindness, this theme actually breaks down in two sub-themes to adapt to specific cases:
            • diff --git a/dictionaries/ui/application/welcome-popup/en_gb.dictionary.itop.welcome-popup.php b/dictionaries/ui/application/welcome-popup/en_gb.dictionary.itop.welcome-popup.php index 6790d1318..2b765665b 100644 --- a/dictionaries/ui/application/welcome-popup/en_gb.dictionary.itop.welcome-popup.php +++ b/dictionaries/ui/application/welcome-popup/en_gb.dictionary.itop.welcome-popup.php @@ -1,4 +1,5 @@ 'Welcome to ' . ITOP_APPLICATION_SHORT . ' 3.2', + 'UI:WelcomePopup:Message:320_01_Welcome:Title' => 'Welcome to '.ITOP_APPLICATION_SHORT.' 3.2', 'UI:WelcomePopup:Message:320_01_Welcome:Description' => '
              Congratulations, you landed on '.ITOP_APPLICATION.' '.ITOP_VERSION_NAME.'!

              We\'re excited to announce this new release.
              -
              In addition to introducing new features such as Newsroom, ' . ITOP_APPLICATION_SHORT . ' 3.2 includes critical security patches, enhanced accessibility and other significant improvements focused on providing you with stability and security.
              +
              In addition to introducing new features such as Newsroom, '.ITOP_APPLICATION_SHORT.' 3.2 includes critical security patches, enhanced accessibility and other significant improvements focused on providing you with stability and security.

              Discover all of '.ITOP_APPLICATION_SHORT.'\'s exciting new features and stay up-to-date with important notifications with our new welcome pop-up!
              We hope you\'ll enjoy this version as much as we enjoyed imagining and creating it.
              @@ -27,14 +28,14 @@ Dict::Add('EN GB', 'British English', 'British English', [ 'UI:WelcomePopup:Message:320_02_Newsroom:Description' => '
              Say goodbye to cluttered inboxes and hello to personalized alerts with '.ITOP_APPLICATION_SHORT.'\'s Newsroom!
              Newsroom allows you to easily manage notifications within the platform, so you can stay on top of important updates without constantly checking your email. With the ability to mark messages as read or unread, and automatically delete old notifications, you have complete control over your notifications.

              -
              Try it out today and streamline your ' . ITOP_APPLICATION_SHORT . '\'s communication experience!
              ', +
              Try it out today and streamline your '.ITOP_APPLICATION_SHORT.'\'s communication experience!
              ', 'UI:WelcomePopup:Message:320_03_NotificationsCenter:Title' => 'Notifications centre', 'UI:WelcomePopup:Message:320_03_NotificationsCenter:Description' => '
              As we know your information intake is already at its max, you can now easily choose how you receive your notifications - via email, chat, or even the Newsroom feature
              You don\'t want to receive a certain type of alerts? Nothing easier with these advanced customization capabilities giving you the flexibility to tailor your experience to your needs.

              Access your notifications center through the newsroom or through your preferences and avoid information overload on all your communication channels!
              ', - 'UI:WelcomePopup:Message:320_05_A11yThemes:Title' => 'Accessibility for ' . ITOP_APPLICATION_SHORT . '\'s UI', - 'UI:WelcomePopup:Message:320_05_A11yThemes:Description' => '
              To ensure ' . ITOP_APPLICATION_SHORT . '\'s accessibility, our team has been working on new back-office themes. WCAG compliants, those UI focus on making it easier for users with visual impairments to use the solution: + 'UI:WelcomePopup:Message:320_05_A11yThemes:Title' => 'Accessibility for '.ITOP_APPLICATION_SHORT.'\'s UI', + 'UI:WelcomePopup:Message:320_05_A11yThemes:Description' => '
              To ensure '.ITOP_APPLICATION_SHORT.'\'s accessibility, our team has been working on new back-office themes. WCAG compliants, those UI focus on making it easier for users with visual impairments to use the solution:
              • Color-blind theme: Designed to help users with colorblindness, this theme actually breaks down in two sub-themes to adapt to specific cases:
                • diff --git a/dictionaries/ui/application/welcome-popup/es_cr.dictionary.itop.welcome-popup.php b/dictionaries/ui/application/welcome-popup/es_cr.dictionary.itop.welcome-popup.php index 624ec38ec..49b61bdf6 100644 --- a/dictionaries/ui/application/welcome-popup/es_cr.dictionary.itop.welcome-popup.php +++ b/dictionaries/ui/application/welcome-popup/es_cr.dictionary.itop.welcome-popup.php @@ -1,11 +1,12 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:WelcomePopup:Button:RemindLater' => 'Recordarme despues', diff --git a/dictionaries/ui/application/welcome-popup/fr.dictionary.itop.welcome-popup.php b/dictionaries/ui/application/welcome-popup/fr.dictionary.itop.welcome-popup.php index a1e1a24dd..a2309a7b4 100644 --- a/dictionaries/ui/application/welcome-popup/fr.dictionary.itop.welcome-popup.php +++ b/dictionaries/ui/application/welcome-popup/fr.dictionary.itop.welcome-popup.php @@ -1,10 +1,11 @@ 'Předchozí stránky', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/da.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/da.dictionary.itop.breadcrumbs.php index b57005619..3b5aa59f7 100644 --- a/dictionaries/ui/components/breadcrumbs/da.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/da.dictionary.itop.breadcrumbs.php @@ -1,14 +1,15 @@ 'Previous pages~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/de.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/de.dictionary.itop.breadcrumbs.php index f187c2700..6cc5d1bdb 100644 --- a/dictionaries/ui/components/breadcrumbs/de.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/de.dictionary.itop.breadcrumbs.php @@ -1,14 +1,15 @@ 'Vorherige Seiten', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/en.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/en.dictionary.itop.breadcrumbs.php index ae27a5c73..2b3694063 100644 --- a/dictionaries/ui/components/breadcrumbs/en.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/en.dictionary.itop.breadcrumbs.php @@ -1,4 +1,5 @@ 'Previous pages', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/en_gb.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/en_gb.dictionary.itop.breadcrumbs.php index 13eed656a..8de074eb9 100644 --- a/dictionaries/ui/components/breadcrumbs/en_gb.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/en_gb.dictionary.itop.breadcrumbs.php @@ -1,10 +1,11 @@ 'Previous pages', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/es_cr.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/es_cr.dictionary.itop.breadcrumbs.php index 3c3508b4d..3feef1d5a 100644 --- a/dictionaries/ui/components/breadcrumbs/es_cr.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/es_cr.dictionary.itop.breadcrumbs.php @@ -1,12 +1,13 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Component:Breadcrumbs:PreviousItemsListToggler:Label' => 'Páginas anteriores', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/fr.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/fr.dictionary.itop.breadcrumbs.php index 1509b9d7b..cd1f3bc86 100644 --- a/dictionaries/ui/components/breadcrumbs/fr.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/fr.dictionary.itop.breadcrumbs.php @@ -1,14 +1,15 @@ 'Pages précédentes', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/hu.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/hu.dictionary.itop.breadcrumbs.php index 0e92abc4e..35b56d5f9 100644 --- a/dictionaries/ui/components/breadcrumbs/hu.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/hu.dictionary.itop.breadcrumbs.php @@ -1,14 +1,15 @@ 'Előző oldalak', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/it.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/it.dictionary.itop.breadcrumbs.php index 84da7c5cd..2fb8bd743 100644 --- a/dictionaries/ui/components/breadcrumbs/it.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/it.dictionary.itop.breadcrumbs.php @@ -1,14 +1,15 @@ 'Pagine precedenti', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/ja.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/ja.dictionary.itop.breadcrumbs.php index 3de55fb2d..32ff94adb 100644 --- a/dictionaries/ui/components/breadcrumbs/ja.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/ja.dictionary.itop.breadcrumbs.php @@ -1,14 +1,15 @@ 'Previous pages~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/nl.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/nl.dictionary.itop.breadcrumbs.php index 79df25249..4903c6dc7 100644 --- a/dictionaries/ui/components/breadcrumbs/nl.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/nl.dictionary.itop.breadcrumbs.php @@ -1,14 +1,15 @@ 'Vorige pagina\'s', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/pl.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/pl.dictionary.itop.breadcrumbs.php index eece60ac9..507ee8f2c 100644 --- a/dictionaries/ui/components/breadcrumbs/pl.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/pl.dictionary.itop.breadcrumbs.php @@ -1,14 +1,15 @@ 'Poprzednie strony', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/pt_br.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/pt_br.dictionary.itop.breadcrumbs.php index 908d5a154..8cb5586df 100644 --- a/dictionaries/ui/components/breadcrumbs/pt_br.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/pt_br.dictionary.itop.breadcrumbs.php @@ -1,14 +1,15 @@ 'Páginas anteriores', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/ru.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/ru.dictionary.itop.breadcrumbs.php index 17e787f6c..e82afdfe5 100644 --- a/dictionaries/ui/components/breadcrumbs/ru.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/ru.dictionary.itop.breadcrumbs.php @@ -1,14 +1,15 @@ 'Previous pages~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/sk.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/sk.dictionary.itop.breadcrumbs.php index ab7a40250..c138065e1 100644 --- a/dictionaries/ui/components/breadcrumbs/sk.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/sk.dictionary.itop.breadcrumbs.php @@ -1,14 +1,15 @@ 'Previous pages~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/tr.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/tr.dictionary.itop.breadcrumbs.php index dfed35ed2..e342916f5 100644 --- a/dictionaries/ui/components/breadcrumbs/tr.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/tr.dictionary.itop.breadcrumbs.php @@ -1,14 +1,15 @@ 'Previous pages~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/breadcrumbs/zh_cn.dictionary.itop.breadcrumbs.php b/dictionaries/ui/components/breadcrumbs/zh_cn.dictionary.itop.breadcrumbs.php index ce77eb4d6..914f3745c 100644 --- a/dictionaries/ui/components/breadcrumbs/zh_cn.dictionary.itop.breadcrumbs.php +++ b/dictionaries/ui/components/breadcrumbs/zh_cn.dictionary.itop.breadcrumbs.php @@ -1,4 +1,5 @@ '上一页', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/cs.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/cs.dictionary.itop.datatable.php index 6d2df0827..53d57fe56 100644 --- a/dictionaries/ui/components/datatable/cs.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/cs.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Please wait...~~', 'UI:Datatables:Language:LengthMenu' => '_MENU_ per page~~', 'UI:Datatables:Language:ZeroRecords' => 'No result~~', @@ -24,4 +25,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI:Datatables:Column:RowActions:Description' => '~~', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Action Confirmation~~', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Do you confirm action ?~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/da.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/da.dictionary.itop.datatable.php index 82c720d5e..725bd82ee 100644 --- a/dictionaries/ui/components/datatable/da.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/da.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Please wait...~~', 'UI:Datatables:Language:LengthMenu' => '_MENU_ per page~~', 'UI:Datatables:Language:ZeroRecords' => 'No result~~', @@ -24,4 +25,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI:Datatables:Column:RowActions:Description' => '~~', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Action Confirmation~~', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Do you confirm action ?~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/de.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/de.dictionary.itop.datatable.php index 240e0a80b..22cf3f9d5 100644 --- a/dictionaries/ui/components/datatable/de.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/de.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Bitte warten...', 'UI:Datatables:Language:LengthMenu' => '_MENU_ pro Seite', 'UI:Datatables:Language:ZeroRecords' => 'Kein Ergebnis', @@ -24,4 +25,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI:Datatables:Column:RowActions:Description' => '', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Aktion bestätigen', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Möchten Sie diese Aktion ausführen?', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/en.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/en.dictionary.itop.datatable.php index c5a383181..c389e8720 100644 --- a/dictionaries/ui/components/datatable/en.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/en.dictionary.itop.datatable.php @@ -1,4 +1,5 @@ 'Please wait...', 'UI:Datatables:Language:LengthMenu' => '_MENU_ per page', 'UI:Datatables:Language:ZeroRecords' => 'No result', @@ -33,4 +34,4 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:Datatables:Column:RowActions:Description' => '', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Action Confirmation', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Do you confirm action ?', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/en_gb.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/en_gb.dictionary.itop.datatable.php index 372fcb5ba..2f731362e 100644 --- a/dictionaries/ui/components/datatable/en_gb.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/en_gb.dictionary.itop.datatable.php @@ -1,11 +1,12 @@ 'Please wait...', 'UI:Datatables:Language:LengthMenu' => '_MENU_ per page', 'UI:Datatables:Language:ZeroRecords' => 'No result', @@ -20,4 +21,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI:Datatables:Column:RowActions:Description' => '', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Action Confirmation', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Do you confirm action?', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/es_cr.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/es_cr.dictionary.itop.datatable.php index a5bb2d444..c331c11e4 100644 --- a/dictionaries/ui/components/datatable/es_cr.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/es_cr.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Por favor espere...', 'UI:Datatables:Language:LengthMenu' => '_MENU_ por página', 'UI:Datatables:Language:ZeroRecords' => 'Sin Resultados', @@ -24,4 +25,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI:Datatables:Column:RowActions:Description' => 'Descripción', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Confirmación de acción', 'UI:Datatables:RowActions:ConfirmationMessage' => '¿Confirma la acción?', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/fr.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/fr.dictionary.itop.datatable.php index 6f9c3332e..7b339fa6c 100644 --- a/dictionaries/ui/components/datatable/fr.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/fr.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Patientez ...', 'UI:Datatables:Language:LengthMenu' => '_MENU_ par page', 'UI:Datatables:Language:ZeroRecords' => 'Pas de résultat', @@ -24,4 +25,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI:Datatables:Column:RowActions:Description' => '', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Confirmation', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Confirmez-vous cette action ?', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/hu.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/hu.dictionary.itop.datatable.php index 99d0213d3..1067c0c09 100644 --- a/dictionaries/ui/components/datatable/hu.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/hu.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Kérem várjon...', 'UI:Datatables:Language:LengthMenu' => '_MENU_ oldalanként', 'UI:Datatables:Language:ZeroRecords' => 'Nincs eredmény', @@ -24,4 +25,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI:Datatables:Column:RowActions:Description' => '~~', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Action Confirmation~~', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Do you confirm action ?~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/it.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/it.dictionary.itop.datatable.php index 7db5e7689..8ba7ff533 100644 --- a/dictionaries/ui/components/datatable/it.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/it.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Attendere prego...', 'UI:Datatables:Language:LengthMenu' => '_MENU_ per pagina', 'UI:Datatables:Language:ZeroRecords' => 'Nessun risultato', @@ -24,4 +25,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI:Datatables:Column:RowActions:Description' => '~~', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Conferma azione', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Confermi l\'azione?', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/ja.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/ja.dictionary.itop.datatable.php index 3a7099f6c..ea92900c6 100644 --- a/dictionaries/ui/components/datatable/ja.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/ja.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Please wait...~~', 'UI:Datatables:Language:LengthMenu' => '_MENU_ per page~~', 'UI:Datatables:Language:ZeroRecords' => 'No result~~', @@ -24,4 +25,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI:Datatables:Column:RowActions:Description' => '~~', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Action Confirmation~~', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Do you confirm action ?~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/nl.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/nl.dictionary.itop.datatable.php index 7a42b0151..127ad627f 100644 --- a/dictionaries/ui/components/datatable/nl.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/nl.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'UI:Datatables:Language:Processing' => 'Even geduld…', 'UI:Datatables:Language:LengthMenu' => '_MENU_ per pagina', 'UI:Datatables:Language:ZeroRecords' => 'Geen resultaten', @@ -24,4 +25,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI:Datatables:Column:RowActions:Description' => '', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Bevestiging actie', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Bevestig je deze actie?', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/pl.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/pl.dictionary.itop.datatable.php index c2cb75e86..bb795ae8e 100644 --- a/dictionaries/ui/components/datatable/pl.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/pl.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Proszę czekać...', 'UI:Datatables:Language:LengthMenu' => '_MENU_ na stronę', 'UI:Datatables:Language:ZeroRecords' => 'Brak wyników', @@ -24,4 +25,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI:Datatables:Column:RowActions:Description' => '', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Potwierdzenie działania', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Czy potwierdzasz działanie?', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/pt_br.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/pt_br.dictionary.itop.datatable.php index 2980af20a..a7f2e5a84 100644 --- a/dictionaries/ui/components/datatable/pt_br.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/pt_br.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Aguarde...', 'UI:Datatables:Language:LengthMenu' => '_MENU_ por página', 'UI:Datatables:Language:ZeroRecords' => 'Nenhum resultado', @@ -24,4 +25,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI:Datatables:Column:RowActions:Description' => '~~', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Action Confirmation~~', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Do you confirm action ?~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/ru.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/ru.dictionary.itop.datatable.php index e33f9fe95..c56169b64 100755 --- a/dictionaries/ui/components/datatable/ru.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/ru.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Пожалуйста, подождите...', 'UI:Datatables:Language:LengthMenu' => '_MENU_ объектов на страницу', 'UI:Datatables:Language:ZeroRecords' => 'Нет объектов для отображения', @@ -24,4 +25,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI:Datatables:Column:RowActions:Description' => '~~', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Action Confirmation~~', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Do you confirm action ?~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/sk.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/sk.dictionary.itop.datatable.php index d769b8422..ee2d6c822 100644 --- a/dictionaries/ui/components/datatable/sk.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/sk.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Please wait...~~', 'UI:Datatables:Language:LengthMenu' => '_MENU_ per page~~', 'UI:Datatables:Language:ZeroRecords' => 'No result~~', @@ -24,4 +25,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI:Datatables:Column:RowActions:Description' => '~~', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Action Confirmation~~', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Do you confirm action ?~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/tr.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/tr.dictionary.itop.datatable.php index d694a6ed1..64a5f481d 100644 --- a/dictionaries/ui/components/datatable/tr.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/tr.dictionary.itop.datatable.php @@ -1,15 +1,16 @@ 'Please wait...~~', 'UI:Datatables:Language:LengthMenu' => '_MENU_ per page~~', 'UI:Datatables:Language:ZeroRecords' => 'No result~~', @@ -24,4 +25,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI:Datatables:Column:RowActions:Description' => '~~', 'UI:Datatables:RowActions:ConfirmationDialog' => 'Action Confirmation~~', 'UI:Datatables:RowActions:ConfirmationMessage' => 'Do you confirm action ?~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/datatable/zh_cn.dictionary.itop.datatable.php b/dictionaries/ui/components/datatable/zh_cn.dictionary.itop.datatable.php index 702ab49d3..4984574c1 100644 --- a/dictionaries/ui/components/datatable/zh_cn.dictionary.itop.datatable.php +++ b/dictionaries/ui/components/datatable/zh_cn.dictionary.itop.datatable.php @@ -1,4 +1,5 @@ '请稍候...', 'UI:Datatables:Language:LengthMenu' => '每页 _MENU_ 项', 'UI:Datatables:Language:ZeroRecords' => '未找到相关结果', @@ -32,4 +33,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI:Datatables:Column:RowActions:Description' => '备注', 'UI:Datatables:RowActions:ConfirmationDialog' => '操作确认', 'UI:Datatables:RowActions:ConfirmationMessage' => '确认操作?', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/cs.dictionary.itop.field.php b/dictionaries/ui/components/field/cs.dictionary.itop.field.php index 8b1182e6c..9e17850a2 100644 --- a/dictionaries/ui/components/field/cs.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/cs.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Neznámé hodnoty', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/da.dictionary.itop.field.php b/dictionaries/ui/components/field/da.dictionary.itop.field.php index 660c78122..7d007854e 100644 --- a/dictionaries/ui/components/field/da.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/da.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Unknown values~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/de.dictionary.itop.field.php b/dictionaries/ui/components/field/de.dictionary.itop.field.php index 5562d2861..cd6602fd4 100644 --- a/dictionaries/ui/components/field/de.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/de.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Unbekannte Werte', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/en.dictionary.itop.field.php b/dictionaries/ui/components/field/en.dictionary.itop.field.php index 128a9be3d..ca6c19db0 100644 --- a/dictionaries/ui/components/field/en.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/en.dictionary.itop.field.php @@ -1,4 +1,5 @@ 'Unknown values', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/en_gb.dictionary.itop.field.php b/dictionaries/ui/components/field/en_gb.dictionary.itop.field.php index 09cef4289..dba2faa92 100644 --- a/dictionaries/ui/components/field/en_gb.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/en_gb.dictionary.itop.field.php @@ -1,10 +1,11 @@ 'Unknown values', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/es_cr.dictionary.itop.field.php b/dictionaries/ui/components/field/es_cr.dictionary.itop.field.php index 6642dd230..0137741c1 100644 --- a/dictionaries/ui/components/field/es_cr.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/es_cr.dictionary.itop.field.php @@ -1,12 +1,13 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Component:Field:BulkModify:UnknownValues:Tooltip' => 'Valores desconocidos', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/fr.dictionary.itop.field.php b/dictionaries/ui/components/field/fr.dictionary.itop.field.php index f6d57c75d..ca72f4fa0 100644 --- a/dictionaries/ui/components/field/fr.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/fr.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Valeurs inconnues', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/hu.dictionary.itop.field.php b/dictionaries/ui/components/field/hu.dictionary.itop.field.php index ca6cbc246..a55a0618d 100644 --- a/dictionaries/ui/components/field/hu.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/hu.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Ismeretlen értékek', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/it.dictionary.itop.field.php b/dictionaries/ui/components/field/it.dictionary.itop.field.php index 6c4c0975b..da6160b72 100644 --- a/dictionaries/ui/components/field/it.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/it.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Valori sconosciuti', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/ja.dictionary.itop.field.php b/dictionaries/ui/components/field/ja.dictionary.itop.field.php index a5ded9f19..4770049bb 100644 --- a/dictionaries/ui/components/field/ja.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/ja.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Unknown values~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/nl.dictionary.itop.field.php b/dictionaries/ui/components/field/nl.dictionary.itop.field.php index 2f22d3fc0..2814ef8a6 100644 --- a/dictionaries/ui/components/field/nl.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/nl.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Onbekende waardes', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/pl.dictionary.itop.field.php b/dictionaries/ui/components/field/pl.dictionary.itop.field.php index 3d6d679da..b1c72557a 100644 --- a/dictionaries/ui/components/field/pl.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/pl.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Nieznane wartości', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/pt_br.dictionary.itop.field.php b/dictionaries/ui/components/field/pt_br.dictionary.itop.field.php index a249c2e7e..614c22a78 100644 --- a/dictionaries/ui/components/field/pt_br.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/pt_br.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Valores desconhecidos', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/ru.dictionary.itop.field.php b/dictionaries/ui/components/field/ru.dictionary.itop.field.php index 81317ae29..8ffcb4c18 100755 --- a/dictionaries/ui/components/field/ru.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/ru.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Неизвестные значения', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/sk.dictionary.itop.field.php b/dictionaries/ui/components/field/sk.dictionary.itop.field.php index 487a22052..da42fde3e 100644 --- a/dictionaries/ui/components/field/sk.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/sk.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Unknown values~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/tr.dictionary.itop.field.php b/dictionaries/ui/components/field/tr.dictionary.itop.field.php index 0ec064175..3feaf3145 100644 --- a/dictionaries/ui/components/field/tr.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/tr.dictionary.itop.field.php @@ -1,14 +1,15 @@ 'Unknown values~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/field/zh_cn.dictionary.itop.field.php b/dictionaries/ui/components/field/zh_cn.dictionary.itop.field.php index c6e34a0cd..3174cda94 100644 --- a/dictionaries/ui/components/field/zh_cn.dictionary.itop.field.php +++ b/dictionaries/ui/components/field/zh_cn.dictionary.itop.field.php @@ -1,4 +1,5 @@ '未知值', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/cs.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/cs.dictionary.itop.global-search.php index 43bdd1644..6a050488c 100644 --- a/dictionaries/ui/components/global-search/cs.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/cs.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Vyhledávání v celé aplikaci', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Vyhledávání...', 'UI:Component:GlobalSearch:Recents:Title' => 'Nedávné', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'Ještě jste nespustili žádné vyhledávání', 'UI:Component:GlobalSearch:HistoryDisabled' => 'Historie ja zakázána', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Otevřít globální vyhledávání', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/da.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/da.dictionary.itop.global-search.php index 7f6e69d12..8d95e9108 100644 --- a/dictionaries/ui/components/global-search/da.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/da.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Search throughout the whole application~~', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Search...~~', 'UI:Component:GlobalSearch:Recents:Title' => 'Recents~~', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'You haven\'t run any search yet~~', 'UI:Component:GlobalSearch:HistoryDisabled' => 'History is disabled~~', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Open global search~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/de.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/de.dictionary.itop.global-search.php index 6cadea31b..2d75d776a 100644 --- a/dictionaries/ui/components/global-search/de.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/de.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Durchsuche die gesamte Datenbank', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Suche...', 'UI:Component:GlobalSearch:Recents:Title' => 'Letzte', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'Sie haben bisher noch keine Suchanfragen gestellt', 'UI:Component:GlobalSearch:HistoryDisabled' => 'Suchhistorie ist deaktiviert', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Öffne die globale Suche', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/en.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/en.dictionary.itop.global-search.php index 453c9a814..fab17bfc7 100644 --- a/dictionaries/ui/components/global-search/en.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/en.dictionary.itop.global-search.php @@ -1,4 +1,5 @@ 'Search throughout the whole application', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Search...', 'UI:Component:GlobalSearch:Recents:Title' => 'Recents', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'You haven\'t run any search yet', 'UI:Component:GlobalSearch:HistoryDisabled' => 'History is disabled', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Open global search', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/en_gb.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/en_gb.dictionary.itop.global-search.php index cfb415de3..b1a9ced05 100644 --- a/dictionaries/ui/components/global-search/en_gb.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/en_gb.dictionary.itop.global-search.php @@ -1,15 +1,16 @@ 'Search throughout the whole application', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Search...', 'UI:Component:GlobalSearch:Recents:Title' => 'Recents', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'You haven\'t run any search yet', 'UI:Component:GlobalSearch:HistoryDisabled' => 'History is disabled', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Open global search', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/es_cr.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/es_cr.dictionary.itop.global-search.php index b6e3cc82e..96044e102 100644 --- a/dictionaries/ui/components/global-search/es_cr.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/es_cr.dictionary.itop.global-search.php @@ -1,17 +1,18 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Component:GlobalSearch:Tooltip' => 'Buscar en toda la aplicación', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Búsqueda...', 'UI:Component:GlobalSearch:Recents:Title' => 'Recientes', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'Aún no ha realizado ninguna búsqueda', 'UI:Component:GlobalSearch:HistoryDisabled' => 'El historial está deshabilitado', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Abrir búsqueda global', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/fr.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/fr.dictionary.itop.global-search.php index facc12fa0..9fdf43f83 100644 --- a/dictionaries/ui/components/global-search/fr.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/fr.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Rechercher dans toute l\'application', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Rechercher...', 'UI:Component:GlobalSearch:Recents:Title' => 'Dernières recherches', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'Vous n\'avez pas encore effectué de recherche', 'UI:Component:GlobalSearch:HistoryDisabled' => 'L\'historique est désactivé', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Ouvrir la recherche globale', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/hu.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/hu.dictionary.itop.global-search.php index 1780bc80e..2945b0df2 100644 --- a/dictionaries/ui/components/global-search/hu.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/hu.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Keresés a teljes alkalmazásban', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Keresés...', 'UI:Component:GlobalSearch:Recents:Title' => 'Legutóbbiak', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'Még nem futtatott semmilyen keresést', 'UI:Component:GlobalSearch:HistoryDisabled' => 'Az előzmények le lettek tiltva', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Globális keresés megnyitása', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/it.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/it.dictionary.itop.global-search.php index 18f3c73d2..1478e0d21 100644 --- a/dictionaries/ui/components/global-search/it.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/it.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Cerca in tutta l\'applicazione', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Cerca...', 'UI:Component:GlobalSearch:Recents:Title' => 'Recenti', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'Non hai ancora eseguito alcuna ricerca', 'UI:Component:GlobalSearch:HistoryDisabled' => 'La cronologia è disabilitata', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Apri la ricerca globale', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/ja.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/ja.dictionary.itop.global-search.php index cedc2f013..b279708f0 100644 --- a/dictionaries/ui/components/global-search/ja.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/ja.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Search throughout the whole application~~', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Search...~~', 'UI:Component:GlobalSearch:Recents:Title' => 'Recents~~', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'You haven\'t run any search yet~~', 'UI:Component:GlobalSearch:HistoryDisabled' => 'History is disabled~~', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Open global search~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/nl.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/nl.dictionary.itop.global-search.php index 1ce6af656..7d73aad54 100644 --- a/dictionaries/ui/components/global-search/nl.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/nl.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Doorzoek de volledige applicatie', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Zoek…', 'UI:Component:GlobalSearch:Recents:Title' => 'Recente', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'Je hebt nog geen enkele zoekopdracht gemaakt', 'UI:Component:GlobalSearch:HistoryDisabled' => 'Zoekgeschiedenis staat uit', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Open globale zoekopdracht', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/pl.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/pl.dictionary.itop.global-search.php index 71660a05c..c00bd2871 100644 --- a/dictionaries/ui/components/global-search/pl.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/pl.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Szukaj w całej aplikacji', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Szukaj...', 'UI:Component:GlobalSearch:Recents:Title' => 'Ostatnie', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'Nie przeprowadziłeś jeszcze żadnego wyszukiwania', 'UI:Component:GlobalSearch:HistoryDisabled' => 'Historia jest wyłączona', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Otwórz wyszukiwanie globalne', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/pt_br.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/pt_br.dictionary.itop.global-search.php index 437da63fd..3e223beeb 100644 --- a/dictionaries/ui/components/global-search/pt_br.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/pt_br.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Pesquisar em todo o '.ITOP_APPLICATION_SHORT, 'UI:Component:GlobalSearch:Input:Placeholder' => 'Pesquisar...', 'UI:Component:GlobalSearch:Recents:Title' => 'Recentes', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'Você ainda não realizou nenhuma pesquisa', 'UI:Component:GlobalSearch:HistoryDisabled' => 'O histórico está desativado', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Abrir pesquisa universal', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/ru.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/ru.dictionary.itop.global-search.php index e9e5fe549..f8bc75504 100755 --- a/dictionaries/ui/components/global-search/ru.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/ru.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Глобальный поиск', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Поиск...', 'UI:Component:GlobalSearch:Recents:Title' => 'Недавние', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'Поиск ещё не выполнялся', 'UI:Component:GlobalSearch:HistoryDisabled' => 'История отключена', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Открыть глобальный поиск', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/sk.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/sk.dictionary.itop.global-search.php index 5e90187c7..6b5519ebc 100644 --- a/dictionaries/ui/components/global-search/sk.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/sk.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Search throughout the whole application~~', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Search...~~', 'UI:Component:GlobalSearch:Recents:Title' => 'Recents~~', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'You haven\'t run any search yet~~', 'UI:Component:GlobalSearch:HistoryDisabled' => 'History is disabled~~', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Open global search~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/tr.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/tr.dictionary.itop.global-search.php index ec0b674a0..fd3f923cd 100644 --- a/dictionaries/ui/components/global-search/tr.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/tr.dictionary.itop.global-search.php @@ -1,19 +1,20 @@ 'Search throughout the whole application~~', 'UI:Component:GlobalSearch:Input:Placeholder' => 'Search...~~', 'UI:Component:GlobalSearch:Recents:Title' => 'Recents~~', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => 'You haven\'t run any search yet~~', 'UI:Component:GlobalSearch:HistoryDisabled' => 'History is disabled~~', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => 'Open global search~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/global-search/zh_cn.dictionary.itop.global-search.php b/dictionaries/ui/components/global-search/zh_cn.dictionary.itop.global-search.php index 9e9cb72c3..3e865a8e8 100644 --- a/dictionaries/ui/components/global-search/zh_cn.dictionary.itop.global-search.php +++ b/dictionaries/ui/components/global-search/zh_cn.dictionary.itop.global-search.php @@ -1,4 +1,5 @@ '全局搜索', 'UI:Component:GlobalSearch:Input:Placeholder' => '搜索...', 'UI:Component:GlobalSearch:Recents:Title' => '最近', 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder' => '您尚未运行任何搜索', 'UI:Component:GlobalSearch:HistoryDisabled' => '历史记录已禁用', 'UI:Component:GlobalSearch:KeyboardShortcut:OpenDrawer' => '打开全局搜索', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/cs.dictionary.itop.input.php b/dictionaries/ui/components/input/cs.dictionary.itop.input.php index 06068c8f7..ed66e38b4 100644 --- a/dictionaries/ui/components/input/cs.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/cs.dictionary.itop.input.php @@ -1,16 +1,17 @@ 'Tato změna není povolena', 'UI:Component:Input:Password:DoesNotMatch' => 'Hesla se neshodují', 'UI:Component:Input:Set:MinimumItems' => 'Vyžaduje minimálně %1$s položku (položky)', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/da.dictionary.itop.input.php b/dictionaries/ui/components/input/da.dictionary.itop.input.php index e1a0275e0..879929685 100644 --- a/dictionaries/ui/components/input/da.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/da.dictionary.itop.input.php @@ -1,16 +1,17 @@ 'This change is not allowed~~', 'UI:Component:Input:Password:DoesNotMatch' => 'Passwords do not match~~', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s item(s) required~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/de.dictionary.itop.input.php b/dictionaries/ui/components/input/de.dictionary.itop.input.php index e25210800..2b3ba7a30 100644 --- a/dictionaries/ui/components/input/de.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/de.dictionary.itop.input.php @@ -1,16 +1,17 @@ 'Diese Änderung ist nicht erlaubt', 'UI:Component:Input:Password:DoesNotMatch' => 'Passwörter stimmen nicht überein', 'UI:Component:Input:Set:MinimumItems' => 'Mindestens %1$s Element(e) benötigt', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/en.dictionary.itop.input.php b/dictionaries/ui/components/input/en.dictionary.itop.input.php index f1c5b4278..7cc0e228d 100644 --- a/dictionaries/ui/components/input/en.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/en.dictionary.itop.input.php @@ -1,4 +1,5 @@ 'This change is not allowed', 'UI:Component:Input:Password:DoesNotMatch' => 'Passwords do not match', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s item(s) required', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/en_gb.dictionary.itop.input.php b/dictionaries/ui/components/input/en_gb.dictionary.itop.input.php index d70999cc2..c108a8f21 100644 --- a/dictionaries/ui/components/input/en_gb.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/en_gb.dictionary.itop.input.php @@ -1,12 +1,13 @@ 'This change is not allowed', 'UI:Component:Input:Password:DoesNotMatch' => 'Passwords do not match', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s item(s) required', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/es_cr.dictionary.itop.input.php b/dictionaries/ui/components/input/es_cr.dictionary.itop.input.php index 85481767b..c92710516 100644 --- a/dictionaries/ui/components/input/es_cr.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/es_cr.dictionary.itop.input.php @@ -1,14 +1,15 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Component:Input:ChangeNotAllowed' => 'Este cmabio no es permitido', 'UI:Component:Input:Password:DoesNotMatch' => 'No coincide la contraseña', 'UI:Component:Input:Set:MinimumItems' => 'Se requieren %1$s elemento(s) mínimo(s)', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/fr.dictionary.itop.input.php b/dictionaries/ui/components/input/fr.dictionary.itop.input.php index 6d87abb4d..c17c79112 100644 --- a/dictionaries/ui/components/input/fr.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/fr.dictionary.itop.input.php @@ -1,16 +1,17 @@ 'Cette modification n\'est pas autorisée', 'UI:Component:Input:Password:DoesNotMatch' => 'Les mots de passe ne correspondent pas', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s élément(s) requis', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/hu.dictionary.itop.input.php b/dictionaries/ui/components/input/hu.dictionary.itop.input.php index 7a2ec8676..0babe78b1 100644 --- a/dictionaries/ui/components/input/hu.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/hu.dictionary.itop.input.php @@ -1,16 +1,17 @@ 'This change is not allowed~~', 'UI:Component:Input:Password:DoesNotMatch' => 'A jelszavak nem egyeznek', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s item(s) required~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/it.dictionary.itop.input.php b/dictionaries/ui/components/input/it.dictionary.itop.input.php index aa7e70e92..4665bcc0d 100644 --- a/dictionaries/ui/components/input/it.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/it.dictionary.itop.input.php @@ -1,16 +1,17 @@ 'This change is not allowed~~', 'UI:Component:Input:Password:DoesNotMatch' => 'Le password non corrispondono', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s item(s) required~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/ja.dictionary.itop.input.php b/dictionaries/ui/components/input/ja.dictionary.itop.input.php index 5263150f0..516e8ad53 100644 --- a/dictionaries/ui/components/input/ja.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/ja.dictionary.itop.input.php @@ -1,16 +1,17 @@ 'This change is not allowed~~', 'UI:Component:Input:Password:DoesNotMatch' => 'Passwords do not match~~', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s item(s) required~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/nl.dictionary.itop.input.php b/dictionaries/ui/components/input/nl.dictionary.itop.input.php index 8c16c3b20..d1e0b4dee 100644 --- a/dictionaries/ui/components/input/nl.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/nl.dictionary.itop.input.php @@ -1,16 +1,17 @@ */ -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'UI:Component:Input:ChangeNotAllowed' => 'Deze aanpassing is niet toegestaan', 'UI:Component:Input:Password:DoesNotMatch' => 'Wachtwoorden komen niet overeen', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s item(s) verplicht', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/pl.dictionary.itop.input.php b/dictionaries/ui/components/input/pl.dictionary.itop.input.php index f4cefe6e3..891aba1d1 100644 --- a/dictionaries/ui/components/input/pl.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/pl.dictionary.itop.input.php @@ -1,16 +1,17 @@ 'Ta zmiana jest niedozwolona', 'UI:Component:Input:Password:DoesNotMatch' => 'Hasła nie pasują', 'UI:Component:Input:Set:MinimumItems' => 'Wymagane są co najmniej %1$s elementy', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/pt_br.dictionary.itop.input.php b/dictionaries/ui/components/input/pt_br.dictionary.itop.input.php index 84ce08bdb..dfa518287 100644 --- a/dictionaries/ui/components/input/pt_br.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/pt_br.dictionary.itop.input.php @@ -1,16 +1,17 @@ 'This change is not allowed~~', 'UI:Component:Input:Password:DoesNotMatch' => 'Senhas não correspondem', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s item(s) required~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/ru.dictionary.itop.input.php b/dictionaries/ui/components/input/ru.dictionary.itop.input.php index 7e5beffd5..5e9fe3f37 100644 --- a/dictionaries/ui/components/input/ru.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/ru.dictionary.itop.input.php @@ -1,16 +1,17 @@ 'This change is not allowed~~', 'UI:Component:Input:Password:DoesNotMatch' => 'Passwords do not match~~', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s item(s) required~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/sk.dictionary.itop.input.php b/dictionaries/ui/components/input/sk.dictionary.itop.input.php index 17974451a..3d9cbabf3 100644 --- a/dictionaries/ui/components/input/sk.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/sk.dictionary.itop.input.php @@ -1,16 +1,17 @@ 'This change is not allowed~~', 'UI:Component:Input:Password:DoesNotMatch' => 'Passwords do not match~~', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s item(s) required~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/tr.dictionary.itop.input.php b/dictionaries/ui/components/input/tr.dictionary.itop.input.php index 1ef26f444..a46e89f73 100644 --- a/dictionaries/ui/components/input/tr.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/tr.dictionary.itop.input.php @@ -1,16 +1,17 @@ 'This change is not allowed~~', 'UI:Component:Input:Password:DoesNotMatch' => 'Passwords do not match~~', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s item(s) required~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/input/zh_cn.dictionary.itop.input.php b/dictionaries/ui/components/input/zh_cn.dictionary.itop.input.php index 5887bc49a..e7392d096 100644 --- a/dictionaries/ui/components/input/zh_cn.dictionary.itop.input.php +++ b/dictionaries/ui/components/input/zh_cn.dictionary.itop.input.php @@ -1,4 +1,5 @@ 'This change is not allowed~~', 'UI:Component:Input:Password:DoesNotMatch' => '密码不匹配', 'UI:Component:Input:Set:MinimumItems' => 'Minimum %1$s item(s) required~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/cs.dictionary.itop.modal.php b/dictionaries/ui/components/modal/cs.dictionary.itop.modal.php index f617202b6..f355c5d67 100644 --- a/dictionaries/ui/components/modal/cs.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/cs.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Potvrzení', 'UI:Modal:Informative:Title' => 'Informativní modální dialog', 'UI:Modal:InformativeError:Title' => 'Chyba', 'UI:Modal:InformativeWarning:Title' => 'Varování', 'UI:Modal:InformativeInformation:Title' => 'Informace', 'UI:Modal:InformativeSuccess:Title' => 'Úspěch', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/da.dictionary.itop.modal.php b/dictionaries/ui/components/modal/da.dictionary.itop.modal.php index 952c7c327..d7cd4c355 100644 --- a/dictionaries/ui/components/modal/da.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/da.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Confirmation~~', 'UI:Modal:Informative:Title' => 'Informative Modal~~', 'UI:Modal:InformativeError:Title' => 'Error~~', 'UI:Modal:InformativeWarning:Title' => 'Warning~~', 'UI:Modal:InformativeInformation:Title' => 'Information~~', 'UI:Modal:InformativeSuccess:Title' => 'Success~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/de.dictionary.itop.modal.php b/dictionaries/ui/components/modal/de.dictionary.itop.modal.php index 3cad3ee0f..c33d2f9b8 100644 --- a/dictionaries/ui/components/modal/de.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/de.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Bestätigung', 'UI:Modal:Informative:Title' => 'Informations-Modal', 'UI:Modal:InformativeError:Title' => 'Fehler', 'UI:Modal:InformativeWarning:Title' => 'Warnung', 'UI:Modal:InformativeInformation:Title' => 'Information', 'UI:Modal:InformativeSuccess:Title' => 'Erfolgreich', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/en.dictionary.itop.modal.php b/dictionaries/ui/components/modal/en.dictionary.itop.modal.php index 393ed120d..d9df86abe 100644 --- a/dictionaries/ui/components/modal/en.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/en.dictionary.itop.modal.php @@ -1,4 +1,5 @@ 'Confirmation', 'UI:Modal:Informative:Title' => 'Informative Modal', 'UI:Modal:InformativeError:Title' => 'Error', 'UI:Modal:InformativeWarning:Title' => 'Warning', 'UI:Modal:InformativeInformation:Title' => 'Information', 'UI:Modal:InformativeSuccess:Title' => 'Success', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/en_gb.dictionary.itop.modal.php b/dictionaries/ui/components/modal/en_gb.dictionary.itop.modal.php index e554e706d..cffa10ec2 100644 --- a/dictionaries/ui/components/modal/en_gb.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/en_gb.dictionary.itop.modal.php @@ -1,14 +1,15 @@ 'Confirmation', 'UI:Modal:Informative:Title' => 'Informative Modal', 'UI:Modal:InformativeError:Title' => 'Error', 'UI:Modal:InformativeWarning:Title' => 'Warning', 'UI:Modal:InformativeInformation:Title' => 'Information', 'UI:Modal:InformativeSuccess:Title' => 'Success', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/es_cr.dictionary.itop.modal.php b/dictionaries/ui/components/modal/es_cr.dictionary.itop.modal.php index 66b099532..274c2f002 100644 --- a/dictionaries/ui/components/modal/es_cr.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/es_cr.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Confirmación', 'UI:Modal:Informative:Title' => 'Modalidad Informativa', 'UI:Modal:InformativeError:Title' => 'Error', 'UI:Modal:InformativeWarning:Title' => 'Advertencia', 'UI:Modal:InformativeInformation:Title' => 'Información', 'UI:Modal:InformativeSuccess:Title' => 'Éxito', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/fr.dictionary.itop.modal.php b/dictionaries/ui/components/modal/fr.dictionary.itop.modal.php index 71e5e0f62..ee9a7613c 100644 --- a/dictionaries/ui/components/modal/fr.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/fr.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Confirmation', 'UI:Modal:Informative:Title' => 'Modale d\'information', 'UI:Modal:InformativeError:Title' => 'Erreur', 'UI:Modal:InformativeWarning:Title' => 'Avertissement', 'UI:Modal:InformativeInformation:Title' => 'Information', 'UI:Modal:InformativeSuccess:Title' => 'Succès', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/hu.dictionary.itop.modal.php b/dictionaries/ui/components/modal/hu.dictionary.itop.modal.php index 004df1a10..b8f37a8ef 100644 --- a/dictionaries/ui/components/modal/hu.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/hu.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Confirmation~~', 'UI:Modal:Informative:Title' => 'Informative Modal~~', 'UI:Modal:InformativeError:Title' => 'Error~~', 'UI:Modal:InformativeWarning:Title' => 'Warning~~', 'UI:Modal:InformativeInformation:Title' => 'Information~~', 'UI:Modal:InformativeSuccess:Title' => 'Success~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/it.dictionary.itop.modal.php b/dictionaries/ui/components/modal/it.dictionary.itop.modal.php index 9e04a4ee0..3f7ea1acf 100644 --- a/dictionaries/ui/components/modal/it.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/it.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Conferma', 'UI:Modal:Informative:Title' => 'Modale Informativa', 'UI:Modal:InformativeError:Title' => 'Errore', 'UI:Modal:InformativeWarning:Title' => 'Avviso', 'UI:Modal:InformativeInformation:Title' => 'Informazione', 'UI:Modal:InformativeSuccess:Title' => 'Successo', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/ja.dictionary.itop.modal.php b/dictionaries/ui/components/modal/ja.dictionary.itop.modal.php index 96df7e1b7..b7c079d93 100644 --- a/dictionaries/ui/components/modal/ja.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/ja.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Confirmation~~', 'UI:Modal:Informative:Title' => 'Informative Modal~~', 'UI:Modal:InformativeError:Title' => 'Error~~', 'UI:Modal:InformativeWarning:Title' => 'Warning~~', 'UI:Modal:InformativeInformation:Title' => 'Information~~', 'UI:Modal:InformativeSuccess:Title' => 'Success~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/nl.dictionary.itop.modal.php b/dictionaries/ui/components/modal/nl.dictionary.itop.modal.php index 13ea78f97..ebc251109 100644 --- a/dictionaries/ui/components/modal/nl.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/nl.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Confirmation~~', 'UI:Modal:Informative:Title' => 'Informative Modal~~', 'UI:Modal:InformativeError:Title' => 'Error~~', 'UI:Modal:InformativeWarning:Title' => 'Warning~~', 'UI:Modal:InformativeInformation:Title' => 'Information~~', 'UI:Modal:InformativeSuccess:Title' => 'Success~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/pl.dictionary.itop.modal.php b/dictionaries/ui/components/modal/pl.dictionary.itop.modal.php index 4f607995b..39b863e28 100644 --- a/dictionaries/ui/components/modal/pl.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/pl.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Potwierdzenie', 'UI:Modal:Informative:Title' => 'Modal informacyjny', 'UI:Modal:InformativeError:Title' => 'Błąd', 'UI:Modal:InformativeWarning:Title' => 'Uwaga', 'UI:Modal:InformativeInformation:Title' => 'Informacja', 'UI:Modal:InformativeSuccess:Title' => 'Sukces', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/pt_br.dictionary.itop.modal.php b/dictionaries/ui/components/modal/pt_br.dictionary.itop.modal.php index fa313d99e..273224e37 100644 --- a/dictionaries/ui/components/modal/pt_br.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/pt_br.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Confirmation~~', 'UI:Modal:Informative:Title' => 'Informative Modal~~', 'UI:Modal:InformativeError:Title' => 'Error~~', 'UI:Modal:InformativeWarning:Title' => 'Warning~~', 'UI:Modal:InformativeInformation:Title' => 'Information~~', 'UI:Modal:InformativeSuccess:Title' => 'Success~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/ru.dictionary.itop.modal.php b/dictionaries/ui/components/modal/ru.dictionary.itop.modal.php index 1ec2e1ec5..78cb6e5f6 100644 --- a/dictionaries/ui/components/modal/ru.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/ru.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Confirmation~~', 'UI:Modal:Informative:Title' => 'Informative Modal~~', 'UI:Modal:InformativeError:Title' => 'Error~~', 'UI:Modal:InformativeWarning:Title' => 'Warning~~', 'UI:Modal:InformativeInformation:Title' => 'Information~~', 'UI:Modal:InformativeSuccess:Title' => 'Success~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/sk.dictionary.itop.modal.php b/dictionaries/ui/components/modal/sk.dictionary.itop.modal.php index 716288fb3..76302b9f8 100644 --- a/dictionaries/ui/components/modal/sk.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/sk.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Confirmation~~', 'UI:Modal:Informative:Title' => 'Informative Modal~~', 'UI:Modal:InformativeError:Title' => 'Error~~', 'UI:Modal:InformativeWarning:Title' => 'Warning~~', 'UI:Modal:InformativeInformation:Title' => 'Information~~', 'UI:Modal:InformativeSuccess:Title' => 'Success~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/tr.dictionary.itop.modal.php b/dictionaries/ui/components/modal/tr.dictionary.itop.modal.php index 9e7fa84d9..8895283a8 100644 --- a/dictionaries/ui/components/modal/tr.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/tr.dictionary.itop.modal.php @@ -1,19 +1,20 @@ 'Confirmation~~', 'UI:Modal:Informative:Title' => 'Informative Modal~~', 'UI:Modal:InformativeError:Title' => 'Error~~', 'UI:Modal:InformativeWarning:Title' => 'Warning~~', 'UI:Modal:InformativeInformation:Title' => 'Information~~', 'UI:Modal:InformativeSuccess:Title' => 'Success~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/modal/zh_cn.dictionary.itop.modal.php b/dictionaries/ui/components/modal/zh_cn.dictionary.itop.modal.php index 84b01e8ac..819676cf3 100644 --- a/dictionaries/ui/components/modal/zh_cn.dictionary.itop.modal.php +++ b/dictionaries/ui/components/modal/zh_cn.dictionary.itop.modal.php @@ -1,4 +1,5 @@ '确认', 'UI:Modal:Informative:Title' => '信息提示模态窗口', 'UI:Modal:InformativeError:Title' => '错误', 'UI:Modal:InformativeWarning:Title' => '警告', 'UI:Modal:InformativeInformation:Title' => '提示', 'UI:Modal:InformativeSuccess:Title' => '成功', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/cs.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/cs.dictionary.itop.quick-create.php index ad1f746f2..880ba6dc9 100644 --- a/dictionaries/ui/components/quick-create/cs.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/cs.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Quickly create any type of object~~', 'UI:Component:QuickCreate:Input:Placeholder' => 'Select object type...~~', 'UI:Component:QuickCreate:Recents:Title' => 'Recents~~', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'You haven\'t create any object yet~~', 'UI:Component:QuickCreate:HistoryDisabled' => 'History is disabled~~', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Open quick create~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/da.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/da.dictionary.itop.quick-create.php index e9238fa8f..b14a0c684 100644 --- a/dictionaries/ui/components/quick-create/da.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/da.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Quickly create any type of object~~', 'UI:Component:QuickCreate:Input:Placeholder' => 'Select object type...~~', 'UI:Component:QuickCreate:Recents:Title' => 'Recents~~', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'You haven\'t create any object yet~~', 'UI:Component:QuickCreate:HistoryDisabled' => 'History is disabled~~', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Open quick create~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/de.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/de.dictionary.itop.quick-create.php index f0ae56b1f..d0337aa76 100644 --- a/dictionaries/ui/components/quick-create/de.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/de.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Erstellen Sie schnell jeden Typ von Objekt', 'UI:Component:QuickCreate:Input:Placeholder' => 'Wählen Sie einen Objekttyp aus...', 'UI:Component:QuickCreate:Recents:Title' => 'Letzte', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'Sie haben noch keine Objekte erstellt', 'UI:Component:QuickCreate:HistoryDisabled' => 'Quick-Create-Historie ist deaktiviert', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Quick-Create-Menu öffnen', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/en.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/en.dictionary.itop.quick-create.php index 58f9d2a9a..c82226759 100644 --- a/dictionaries/ui/components/quick-create/en.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/en.dictionary.itop.quick-create.php @@ -1,4 +1,5 @@ 'Quickly create any type of object', 'UI:Component:QuickCreate:Input:Placeholder' => 'Select object type...', 'UI:Component:QuickCreate:Recents:Title' => 'Recents', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'You haven\'t create any object yet', 'UI:Component:QuickCreate:HistoryDisabled' => 'History is disabled', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Open quick create', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/en_gb.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/en_gb.dictionary.itop.quick-create.php index 331e8337e..1ef44a4cd 100644 --- a/dictionaries/ui/components/quick-create/en_gb.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/en_gb.dictionary.itop.quick-create.php @@ -1,15 +1,16 @@ 'Quickly create any type of object', 'UI:Component:QuickCreate:Input:Placeholder' => 'Select object type...', 'UI:Component:QuickCreate:Recents:Title' => 'Recents', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'You haven\'t create any object yet', 'UI:Component:QuickCreate:HistoryDisabled' => 'History is disabled', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Open quick create', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/es_cr.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/es_cr.dictionary.itop.quick-create.php index 558bbfc2b..4d59beaaa 100644 --- a/dictionaries/ui/components/quick-create/es_cr.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/es_cr.dictionary.itop.quick-create.php @@ -1,17 +1,18 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Component:QuickCreate:Tooltip' => 'Crear rápidamente cualquier tipo de objeto', 'UI:Component:QuickCreate:Input:Placeholder' => 'Seleccionar tipo de objeto...', 'UI:Component:QuickCreate:Recents:Title' => 'Recientes', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'Aún no has creado ningún objeto.', 'UI:Component:QuickCreate:HistoryDisabled' => 'El historial está deshabilitado', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Abrir creación rápida', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/fr.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/fr.dictionary.itop.quick-create.php index 588762788..291a17a14 100644 --- a/dictionaries/ui/components/quick-create/fr.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/fr.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Création rapide de n\'importe quel objet', 'UI:Component:QuickCreate:Input:Placeholder' => 'Type d\'objet...', 'UI:Component:QuickCreate:Recents:Title' => 'Types récents', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'Vous n\'avez pas encore créé d\'objet', 'UI:Component:QuickCreate:HistoryDisabled' => 'L\'historique est désactivé', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Ouvrir la création rapide', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/hu.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/hu.dictionary.itop.quick-create.php index 5ed3c6be8..1f065cb61 100644 --- a/dictionaries/ui/components/quick-create/hu.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/hu.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Bármilyen típusú objektum gyors létrehozása', 'UI:Component:QuickCreate:Input:Placeholder' => 'Objektumtípus kiválasztása...', 'UI:Component:QuickCreate:Recents:Title' => 'Legutóbbiak', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'Még nem hozott létre objektumot', 'UI:Component:QuickCreate:HistoryDisabled' => 'Az előzmények le lettek tiltva', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Gyors létrehozás megnyitása', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/it.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/it.dictionary.itop.quick-create.php index 698243be5..6a872d02e 100644 --- a/dictionaries/ui/components/quick-create/it.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/it.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Crea rapidamente qualsiasi tipo di oggetto', 'UI:Component:QuickCreate:Input:Placeholder' => 'Seleziona il tipo di oggetto...', 'UI:Component:QuickCreate:Recents:Title' => 'Recenti', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'Non hai ancora creato alcun oggetto', 'UI:Component:QuickCreate:HistoryDisabled' => 'La cronologia è disabilitata', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Apri la creazione rapida', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/ja.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/ja.dictionary.itop.quick-create.php index e9e7070a6..38ab9f570 100644 --- a/dictionaries/ui/components/quick-create/ja.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/ja.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Quickly create any type of object~~', 'UI:Component:QuickCreate:Input:Placeholder' => 'Select object type...~~', 'UI:Component:QuickCreate:Recents:Title' => 'Recents~~', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'You haven\'t create any object yet~~', 'UI:Component:QuickCreate:HistoryDisabled' => 'History is disabled~~', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Open quick create~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/nl.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/nl.dictionary.itop.quick-create.php index 84b258411..929340918 100644 --- a/dictionaries/ui/components/quick-create/nl.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/nl.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Snel een object aanmaken', 'UI:Component:QuickCreate:Input:Placeholder' => 'Selecteer een objectsoort…', 'UI:Component:QuickCreate:Recents:Title' => 'Recente', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'Je hebt nog geen objecten gemaakt', 'UI:Component:QuickCreate:HistoryDisabled' => 'Geschiedenis staat uit', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Open snel object aanmaken', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/pl.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/pl.dictionary.itop.quick-create.php index f176fff7d..7df35ed7e 100644 --- a/dictionaries/ui/components/quick-create/pl.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/pl.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Szybko utwórz dowolny rodzaj obiektu', 'UI:Component:QuickCreate:Input:Placeholder' => 'Wybierz typ obiektu...', 'UI:Component:QuickCreate:Recents:Title' => 'Ostatnie', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'Nie utworzyłeś jeszcze żadnego obiektu', 'UI:Component:QuickCreate:HistoryDisabled' => 'Historia jest wyłączona', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Otwórz szybkie tworzenie', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/pt_br.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/pt_br.dictionary.itop.quick-create.php index ebb9c8b8d..2925ffffa 100644 --- a/dictionaries/ui/components/quick-create/pt_br.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/pt_br.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Crie rapidamente qualquer tipo de objeto', 'UI:Component:QuickCreate:Input:Placeholder' => 'Selecione o tipo de objeto...', 'UI:Component:QuickCreate:Recents:Title' => 'Recentes', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'Você ainda não criou nenhum objeto', 'UI:Component:QuickCreate:HistoryDisabled' => 'O histórico está desativado', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Abrir criação rápida', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/ru.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/ru.dictionary.itop.quick-create.php index 0dc3d3f71..887938d08 100755 --- a/dictionaries/ui/components/quick-create/ru.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/ru.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Быстрое создание объекта любого типа', 'UI:Component:QuickCreate:Input:Placeholder' => 'Выбрать тип объекта...', 'UI:Component:QuickCreate:Recents:Title' => 'Недавние', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'Вы ещё не создавали объекты', 'UI:Component:QuickCreate:HistoryDisabled' => 'История отключена', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Открыть быстрое создание объекта', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/sk.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/sk.dictionary.itop.quick-create.php index e9ee8c695..84d81197d 100644 --- a/dictionaries/ui/components/quick-create/sk.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/sk.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Quickly create any type of object~~', 'UI:Component:QuickCreate:Input:Placeholder' => 'Select object type...~~', 'UI:Component:QuickCreate:Recents:Title' => 'Recents~~', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'You haven\'t create any object yet~~', 'UI:Component:QuickCreate:HistoryDisabled' => 'History is disabled~~', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Open quick create~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/tr.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/tr.dictionary.itop.quick-create.php index 01d8a8cfc..6551fac45 100644 --- a/dictionaries/ui/components/quick-create/tr.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/tr.dictionary.itop.quick-create.php @@ -1,19 +1,20 @@ 'Quickly create any type of object~~', 'UI:Component:QuickCreate:Input:Placeholder' => 'Select object type...~~', 'UI:Component:QuickCreate:Recents:Title' => 'Recents~~', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => 'You haven\'t create any object yet~~', 'UI:Component:QuickCreate:HistoryDisabled' => 'History is disabled~~', 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => 'Open quick create~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/components/quick-create/zh_cn.dictionary.itop.quick-create.php b/dictionaries/ui/components/quick-create/zh_cn.dictionary.itop.quick-create.php index 1916e05c0..4eaf2fc31 100644 --- a/dictionaries/ui/components/quick-create/zh_cn.dictionary.itop.quick-create.php +++ b/dictionaries/ui/components/quick-create/zh_cn.dictionary.itop.quick-create.php @@ -1,4 +1,5 @@ '快速创建任意类型的对象', 'UI:Component:QuickCreate:Input:Placeholder' => '请选择对象类型...', 'UI:Component:QuickCreate:Recents:Title' => '最近', 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder' => '您尚未创建任何对象', 'UI:Component:QuickCreate:MostPopular:Title' => '最常用', 'UI:Component:QuickCreate:HistoryDisabled' => '历史记录已禁用', - 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => '打开快速创建' -)); \ No newline at end of file + 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer' => '打开快速创建', +]); diff --git a/dictionaries/ui/layouts/activity-panel/cs.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/cs.dictionary.itop.activity-panel.php index 3d356bf79..6efba4761 100644 --- a/dictionaries/ui/layouts/activity-panel/cs.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/cs.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Rozšířit', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Zúžit', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Zavřít', @@ -35,4 +36,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'Je tu klid, zatím žádná aktivita.', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Panel aktivit', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Kliknutím otevřete panel aktivit', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/da.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/da.dictionary.itop.activity-panel.php index a87ad6994..135cb6f23 100644 --- a/dictionaries/ui/layouts/activity-panel/da.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/da.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Expand~~', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Reduce~~', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Close~~', @@ -35,4 +36,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'It\'s calm up here, no activity yet~~', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Activity panel~~', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Click to open the activity panel~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/de.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/de.dictionary.itop.activity-panel.php index a0ac09488..c0eeb2059 100644 --- a/dictionaries/ui/layouts/activity-panel/de.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/de.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Erweitern', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Reduzieren', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Schließen', @@ -35,4 +36,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'Hier ist\'s ruhig. Bisher keine Aktivitäten.', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Aktivitäten', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Hier klicken, um die Aktivitätenleiste anzuzeigen', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/en.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/en.dictionary.itop.activity-panel.php index ea325a45e..039b79722 100644 --- a/dictionaries/ui/layouts/activity-panel/en.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/en.dictionary.itop.activity-panel.php @@ -1,4 +1,5 @@ 'Expand', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Reduce', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Close', @@ -56,4 +57,4 @@ Dict::Add('EN US', 'English', 'English', array( // Closed cover 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Activity panel', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Click to open the activity panel', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/en_gb.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/en_gb.dictionary.itop.activity-panel.php index 3a525f77c..19638a0f4 100644 --- a/dictionaries/ui/layouts/activity-panel/en_gb.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/en_gb.dictionary.itop.activity-panel.php @@ -1,11 +1,12 @@ 'Expand', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Reduce', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Close', @@ -43,4 +44,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( // Closed cover 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Activity panel', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Click to open the activity panel', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/es_cr.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/es_cr.dictionary.itop.activity-panel.php index dbdc6440c..0ddcd9a67 100644 --- a/dictionaries/ui/layouts/activity-panel/es_cr.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/es_cr.dictionary.itop.activity-panel.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Layout:ActivityPanel:SizeToggler:Expand:Tooltip' => 'Expandir', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Reducir', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Cerrar', @@ -33,4 +34,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'Está tranquilo aquí, aún no hay actividad.', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Panel de actividad', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Dar click para abrir el panel de actividades.', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/fr.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/fr.dictionary.itop.activity-panel.php index 4ee1ff00e..6480c05a9 100644 --- a/dictionaries/ui/layouts/activity-panel/fr.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/fr.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Déplier', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Replier', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Fermer', @@ -35,4 +36,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'Temps calme, il n\'y a pas encore d\'activité', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Panneau d\'activité', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Cliquer pour ouvrir le panneau d\'activité', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/hu.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/hu.dictionary.itop.activity-panel.php index 36fac8ec6..1809a7714 100644 --- a/dictionaries/ui/layouts/activity-panel/hu.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/hu.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Kiterjesztés', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Összecsukás', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Bezárás', @@ -35,4 +36,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'Itt nyugalom van, még nincs aktivitás.', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Tevékenység panel', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Kattintson a gombra a tevékenység panel megnyitásához', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/it.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/it.dictionary.itop.activity-panel.php index 525d08d1e..b9cf5da8a 100644 --- a/dictionaries/ui/layouts/activity-panel/it.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/it.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Espandi', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Riduci', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Chiudi', @@ -35,4 +36,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'È tranquillo qui, nessuna attività ancora', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Pannello di attività', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Clicca per aprire il pannello di attività', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/ja.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/ja.dictionary.itop.activity-panel.php index 4329a9643..dc84ba3f5 100644 --- a/dictionaries/ui/layouts/activity-panel/ja.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/ja.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Expand~~', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Reduce~~', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Close~~', @@ -35,4 +36,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'It\'s calm up here, no activity yet~~', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Activity panel~~', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Click to open the activity panel~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/nl.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/nl.dictionary.itop.activity-panel.php index fa3a20307..cdd94c307 100644 --- a/dictionaries/ui/layouts/activity-panel/nl.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/nl.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Vergroot', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Reduceer', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Sluit', @@ -35,4 +36,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'Nog geen activiteit.', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Activiteitenpaneel', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Klik om het activiteitenpaneel te openen', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/pl.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/pl.dictionary.itop.activity-panel.php index ee3495865..ca9b4dc70 100644 --- a/dictionaries/ui/layouts/activity-panel/pl.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/pl.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Rozwiń', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Zwiń', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Zamknij', @@ -35,4 +36,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'Tu jest spokojnie, jeszcze nie ma aktywności', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Panel aktywności', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Kliknij, aby otworzyć panel aktywności', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/pt_br.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/pt_br.dictionary.itop.activity-panel.php index cab4c6a29..98d2e171c 100644 --- a/dictionaries/ui/layouts/activity-panel/pt_br.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/pt_br.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Expandir', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Recolher', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Fechar', @@ -35,4 +36,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'Está calmo aqui, nenhuma atividade ainda', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Painel de Atividades', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Clique para abrir o Painel de Atividades', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/ru.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/ru.dictionary.itop.activity-panel.php index 75105f3ea..d9a38778d 100755 --- a/dictionaries/ui/layouts/activity-panel/ru.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/ru.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Расширить', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Уменьшить', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Закрыть', @@ -35,4 +36,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'Здесь пока пусто...', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Активность', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Открыть панель активности', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/sk.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/sk.dictionary.itop.activity-panel.php index 80f2115df..27f727bdd 100644 --- a/dictionaries/ui/layouts/activity-panel/sk.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/sk.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Expand~~', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Reduce~~', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Close~~', @@ -35,4 +36,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'It\'s calm up here, no activity yet~~', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Activity panel~~', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Click to open the activity panel~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/tr.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/tr.dictionary.itop.activity-panel.php index c1dbb980d..612d529f6 100644 --- a/dictionaries/ui/layouts/activity-panel/tr.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/tr.dictionary.itop.activity-panel.php @@ -1,15 +1,16 @@ 'Expand~~', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => 'Reduce~~', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => 'Close~~', @@ -35,4 +36,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI:Layout:ActivityPanel:NoEntry:Placeholder:Hint' => 'It\'s calm up here, no activity yet~~', 'UI:Layout:ActivityPanel:ClosedCover:Title' => 'Activity panel~~', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => 'Click to open the activity panel~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/activity-panel/zh_cn.dictionary.itop.activity-panel.php b/dictionaries/ui/layouts/activity-panel/zh_cn.dictionary.itop.activity-panel.php index 4e210dd1c..c4a1ce344 100644 --- a/dictionaries/ui/layouts/activity-panel/zh_cn.dictionary.itop.activity-panel.php +++ b/dictionaries/ui/layouts/activity-panel/zh_cn.dictionary.itop.activity-panel.php @@ -1,4 +1,5 @@ '展开', 'UI:Layout:ActivityPanel:SizeToggler:Reduce:Tooltip' => '减少', 'UI:Layout:ActivityPanel:DisplayToggler:Close:Tooltip' => '关闭', @@ -55,4 +56,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( // Closed cover 'UI:Layout:ActivityPanel:ClosedCover:Title' => '活动面板', 'UI:Layout:ActivityPanel:ClosedCover:Tooltip' => '点击打开活动面板', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/cs.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/cs.dictionary.itop.navigation-menu.php index b59b01cbc..3fb6ff6cb 100644 --- a/dictionaries/ui/layouts/navigation-menu/cs.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/cs.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Logo společnosti', 'UI:Layout:NavigationMenu:Silo:Label' => 'Vyberte organizaci, podle které chcete filtrovat', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Rozbalit / Sbalit', @@ -23,4 +24,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Otevřít uživatelské menu', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filtrování položek menu', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/da.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/da.dictionary.itop.navigation-menu.php index b6dd0f5ed..d385cc785 100644 --- a/dictionaries/ui/layouts/navigation-menu/da.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/da.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Company logo~~', 'UI:Layout:NavigationMenu:Silo:Label' => 'Select organization to filter on~~', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Expand / Collapse~~', @@ -23,4 +24,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Open user menu~~', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filter menu entries~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/de.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/de.dictionary.itop.navigation-menu.php index a92f2442f..4e11a7e37 100644 --- a/dictionaries/ui/layouts/navigation-menu/de.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/de.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Unternehmenslogo', 'UI:Layout:NavigationMenu:Silo:Label' => 'Organisation zum filtern auswählen', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Ausklappen/Einklappen', @@ -23,4 +24,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Benutzermenü öffnen', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filtere Menüeinträge', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/en.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/en.dictionary.itop.navigation-menu.php index 8cddec3e9..84f1e6632 100644 --- a/dictionaries/ui/layouts/navigation-menu/en.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/en.dictionary.itop.navigation-menu.php @@ -1,4 +1,5 @@ 'Company logo', 'UI:Layout:NavigationMenu:Silo:Label' => 'Select organization to filter on', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Expand / Collapse', @@ -32,4 +33,4 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Open user menu', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filter menu entries', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/en_gb.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/en_gb.dictionary.itop.navigation-menu.php index f91ed4daa..9e4f92d03 100644 --- a/dictionaries/ui/layouts/navigation-menu/en_gb.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/en_gb.dictionary.itop.navigation-menu.php @@ -1,11 +1,12 @@ 'Company logo', 'UI:Layout:NavigationMenu:Silo:Label' => 'Select organisation to filter on', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Expand / Collapse', @@ -19,4 +20,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Open user menu', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filter menu entries', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/es_cr.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/es_cr.dictionary.itop.navigation-menu.php index 9d6ed35ce..2efffd961 100644 --- a/dictionaries/ui/layouts/navigation-menu/es_cr.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/es_cr.dictionary.itop.navigation-menu.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Layout:NavigationMenu:CompanyLogo:AltText' => 'Logotipo de la Compañia', 'UI:Layout:NavigationMenu:Silo:Label' => 'Seleccione la organización para filtrar', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Expandir / Contraer', @@ -21,4 +22,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Abrir menú de usuario', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filtrar entradas del menú', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/fr.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/fr.dictionary.itop.navigation-menu.php index cc2b3f5e7..b57ab61d6 100644 --- a/dictionaries/ui/layouts/navigation-menu/fr.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/fr.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Logo entreprise', 'UI:Layout:NavigationMenu:Silo:Label' => 'Selectionnez l\'organisation sur laquelle filtrer', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Déplier / Replier', @@ -23,4 +24,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Ouvre le menu utilisateur', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filtrer les entrées de menu', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/hu.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/hu.dictionary.itop.navigation-menu.php index 175c89b68..3a2bbd57c 100644 --- a/dictionaries/ui/layouts/navigation-menu/hu.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/hu.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Cég logo', 'UI:Layout:NavigationMenu:Silo:Label' => 'Válassza ki a szűrni kívánt szervezetet', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Kiterjesztés / Össszecsukás', @@ -23,4 +24,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Felhasználói menü megnyitása', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Menüpontok szűrése', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/it.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/it.dictionary.itop.navigation-menu.php index 70e866b9d..44225802f 100644 --- a/dictionaries/ui/layouts/navigation-menu/it.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/it.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Logo dell\'azienda', 'UI:Layout:NavigationMenu:Silo:Label' => 'Seleziona l\'organizzazione per filtrare', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Espandi / Comprimi', @@ -23,4 +24,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Apri menu utente', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filtra le voci del menu', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/ja.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/ja.dictionary.itop.navigation-menu.php index e046401d9..2e4a07e50 100644 --- a/dictionaries/ui/layouts/navigation-menu/ja.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/ja.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Company logo~~', 'UI:Layout:NavigationMenu:Silo:Label' => 'Select organization to filter on~~', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Expand / Collapse~~', @@ -23,4 +24,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Open user menu~~', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filter menu entries~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/nl.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/nl.dictionary.itop.navigation-menu.php index 7b40ec5ad..a211671fa 100644 --- a/dictionaries/ui/layouts/navigation-menu/nl.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/nl.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Bedrijfslogo', 'UI:Layout:NavigationMenu:Silo:Label' => 'Selecteer de organisatie waarop gefilterd moet worden', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Vergroot / Verberg', @@ -23,4 +24,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Open gebruikersmenu', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filter menu\'s', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/pl.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/pl.dictionary.itop.navigation-menu.php index e18a2fbf7..fb2343d9d 100644 --- a/dictionaries/ui/layouts/navigation-menu/pl.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/pl.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Logo firmy', 'UI:Layout:NavigationMenu:Silo:Label' => 'Wybierz organizację do filtrowania', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Rozwiń / Zwiń', @@ -23,4 +24,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Otwórz menu użytkownika', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filtruj wpisy w menu', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/pt_br.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/pt_br.dictionary.itop.navigation-menu.php index 0ee5765f7..fc2d0bee5 100644 --- a/dictionaries/ui/layouts/navigation-menu/pt_br.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/pt_br.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Logo da organização', 'UI:Layout:NavigationMenu:Silo:Label' => 'Selecione a organização para filtrar', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Expandir / Recolher', @@ -23,4 +24,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Abrir menu do usuário', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filtrar entradas de menu', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/ru.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/ru.dictionary.itop.navigation-menu.php index b86603d87..019800da3 100755 --- a/dictionaries/ui/layouts/navigation-menu/ru.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/ru.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Логотип компании', 'UI:Layout:NavigationMenu:Silo:Label' => 'Select organization to filter on~~', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Развернуть / Свернуть', @@ -23,4 +24,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Open user menu~~', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Фильтр пунктов меню', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/sk.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/sk.dictionary.itop.navigation-menu.php index c96a6f8d5..04ddde240 100644 --- a/dictionaries/ui/layouts/navigation-menu/sk.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/sk.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Company logo~~', 'UI:Layout:NavigationMenu:Silo:Label' => 'Select organization to filter on~~', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Expand / Collapse~~', @@ -23,4 +24,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Open user menu~~', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filter menu entries~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/tr.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/tr.dictionary.itop.navigation-menu.php index 0eb835ea9..98d4c47fe 100644 --- a/dictionaries/ui/layouts/navigation-menu/tr.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/tr.dictionary.itop.navigation-menu.php @@ -1,15 +1,16 @@ 'Company logo~~', 'UI:Layout:NavigationMenu:Silo:Label' => 'Select organization to filter on~~', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => 'Expand / Collapse~~', @@ -23,4 +24,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => 'Open user menu~~', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => 'Filter menu entries~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/navigation-menu/zh_cn.dictionary.itop.navigation-menu.php b/dictionaries/ui/layouts/navigation-menu/zh_cn.dictionary.itop.navigation-menu.php index 1692dfb0c..d59ef87db 100644 --- a/dictionaries/ui/layouts/navigation-menu/zh_cn.dictionary.itop.navigation-menu.php +++ b/dictionaries/ui/layouts/navigation-menu/zh_cn.dictionary.itop.navigation-menu.php @@ -1,4 +1,5 @@ '公司标志', 'UI:Layout:NavigationMenu:Silo:Label' => '请选择要筛选的组织', 'UI:Layout:NavigationMenu:Toggler:Tooltip' => '展开/折叠', @@ -31,4 +32,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI:Layout:NavigationMenu:UserMenu:Toggler:Label' => '打开用户菜单', 'UI:Layout:NavigationMenu:KeyboardShortcut:FocusFilter' => '筛选菜单', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/layouts/object-details/cs.dictionary.itop.object-details.php b/dictionaries/ui/layouts/object-details/cs.dictionary.itop.object-details.php index 843f6c07a..cf236ecc4 100644 --- a/dictionaries/ui/layouts/object-details/cs.dictionary.itop.object-details.php +++ b/dictionaries/ui/layouts/object-details/cs.dictionary.itop.object-details.php @@ -1,10 +1,11 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Layout:ObjectDetails:KeyboardShortcut:EditObject' => 'Editar objeto mostrado', diff --git a/dictionaries/ui/layouts/object-details/fr.dictionary.itop.object-details.php b/dictionaries/ui/layouts/object-details/fr.dictionary.itop.object-details.php index 756786426..6da9ac47b 100644 --- a/dictionaries/ui/layouts/object-details/fr.dictionary.itop.object-details.php +++ b/dictionaries/ui/layouts/object-details/fr.dictionary.itop.object-details.php @@ -1,10 +1,11 @@ diff --git a/dictionaries/ui/layouts/object-details/pl.dictionary.itop.object-details.php b/dictionaries/ui/layouts/object-details/pl.dictionary.itop.object-details.php index 93f91b698..d9b020d5f 100644 --- a/dictionaries/ui/layouts/object-details/pl.dictionary.itop.object-details.php +++ b/dictionaries/ui/layouts/object-details/pl.dictionary.itop.object-details.php @@ -1,10 +1,11 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UIBlock:Error:CannotGetBlocks' => 'No se pudieron recuperar bloques del área de contenido "%1$s", ya que parece existir para el contenido de la página "%2$s"', diff --git a/dictionaries/ui/layouts/page-content/fr.dictionary.itop.page-content.php b/dictionaries/ui/layouts/page-content/fr.dictionary.itop.page-content.php index c3af90b1e..813687872 100644 --- a/dictionaries/ui/layouts/page-content/fr.dictionary.itop.page-content.php +++ b/dictionaries/ui/layouts/page-content/fr.dictionary.itop.page-content.php @@ -1,10 +1,11 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Layout:TabContainer:ExtraTabsListToggler:Label' => 'Otras pestañas', diff --git a/dictionaries/ui/layouts/tab-container/fr.dictionary.itop.tab-container.php b/dictionaries/ui/layouts/tab-container/fr.dictionary.itop.tab-container.php index 6c6514763..9555e908c 100644 --- a/dictionaries/ui/layouts/tab-container/fr.dictionary.itop.tab-container.php +++ b/dictionaries/ui/layouts/tab-container/fr.dictionary.itop.tab-container.php @@ -1,10 +1,11 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UIBlock:Error:AddBlockForbidden' => 'No se puede agregar bloque a %1$s', diff --git a/dictionaries/ui/layouts/ui-content-block/fr.dictionary.itop.ui-content-block.php b/dictionaries/ui/layouts/ui-content-block/fr.dictionary.itop.ui-content-block.php index f7e39786c..57a3b529d 100644 --- a/dictionaries/ui/layouts/ui-content-block/fr.dictionary.itop.ui-content-block.php +++ b/dictionaries/ui/layouts/ui-content-block/fr.dictionary.itop.ui-content-block.php @@ -1,10 +1,11 @@ 'Používáte nestabilní verzi, která může obsahovat chyby. Pokud si myslíte, že k chybě došlo z tohoto důvodu, pošlete nám prosím zpětnou vazbu!', 'UI:ErrorPage:KittyDisclaimer' => 'Při tvorbě tohoto GIFu a vydání nebyla zraněna žádná kočička. - The R&D Team', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/da.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/da.dictionary.itop.errorpage.php index e8b7932fe..58bef2a84 100644 --- a/dictionaries/ui/pages/errorpage/da.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/da.dictionary.itop.errorpage.php @@ -1,17 +1,18 @@ 'You are using an unstable version that may include bugs. If you think this error occurred because of this please send us your feedback!~~', 'UI:ErrorPage:KittyDisclaimer' => 'No kitty were injured during the making of this GIF and release. - The R&D Team~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/de.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/de.dictionary.itop.errorpage.php index 649240696..c78af7dcb 100644 --- a/dictionaries/ui/pages/errorpage/de.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/de.dictionary.itop.errorpage.php @@ -1,17 +1,18 @@ 'Sie nutzeng gerade eine Unstable-Version, die eventuell Bugs enthält. Wenn Sie glauben, dieser Fehler liegt an einem solchen Bug, bitte senden Sie uns Ihr Feedback!', 'UI:ErrorPage:KittyDisclaimer' => 'Keine klitzekleinen Kätzchen wurden während des Erstellens dieses GIFs und Releases verletzt! - Das Entwicklungsteam', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/en.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/en.dictionary.itop.errorpage.php index fe4606148..400fbd322 100644 --- a/dictionaries/ui/pages/errorpage/en.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/en.dictionary.itop.errorpage.php @@ -1,4 +1,5 @@ 'You are using an unstable version that may include bugs. If you think this error occurred because of this please send us your feedback!', 'UI:ErrorPage:KittyDisclaimer' => 'No kitty were injured during the making of this GIF and release. - The R&D Team', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/en_gb.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/en_gb.dictionary.itop.errorpage.php index 634af1160..2ac7fa5f4 100644 --- a/dictionaries/ui/pages/errorpage/en_gb.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/en_gb.dictionary.itop.errorpage.php @@ -1,13 +1,14 @@ 'You are using an unstable version that may include bugs. If you think this error occurred because of this please send us your feedback!', 'UI:ErrorPage:KittyDisclaimer' => 'No kitty were injured during the making of this GIF and release. - The R&D Team', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/es_cr.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/es_cr.dictionary.itop.errorpage.php index 5686e5367..09103934f 100644 --- a/dictionaries/ui/pages/errorpage/es_cr.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/es_cr.dictionary.itop.errorpage.php @@ -1,15 +1,16 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:ErrorPage:UnstableVersion' => 'Está utilizando una versión inestable que puede incluir errores. Si cree que este error ocurrió debido a esto, ¡envíenos sus comentarios!', 'UI:ErrorPage:KittyDisclaimer' => 'Ningún gatito resultó herido durante la realización de este GIF y lanzamiento. - El Equipo de I&D', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/fr.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/fr.dictionary.itop.errorpage.php index 05a2b1fde..5b49534b3 100644 --- a/dictionaries/ui/pages/errorpage/fr.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/fr.dictionary.itop.errorpage.php @@ -1,17 +1,18 @@ 'Vous utilisez une version instable qui peut contenir des bugs. Si vous pensez que cette erreur est liée merci de nous contacter !', 'UI:ErrorPage:KittyDisclaimer' => 'Aucun chatton n\'a été maltraité durant la réalisation de ce GIF et de cette version. - L\'équipe R&D', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/hu.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/hu.dictionary.itop.errorpage.php index 15f17f8be..28e6f0c25 100644 --- a/dictionaries/ui/pages/errorpage/hu.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/hu.dictionary.itop.errorpage.php @@ -1,17 +1,18 @@ 'Ön egy instabil verziót használ, amely hibákat tartalmazhat. Ha úgy gondolja, hogy ez a hiba emiatt lépett fel, kérjük, küldje el visszajelzését!', 'UI:ErrorPage:KittyDisclaimer' => 'Egyetlen cica sem sérült meg ennek a GIF-nek a készítése és kiadása során. - The R&D Team', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/it.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/it.dictionary.itop.errorpage.php index 3cbbb3708..eb4d0c7da 100644 --- a/dictionaries/ui/pages/errorpage/it.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/it.dictionary.itop.errorpage.php @@ -1,17 +1,18 @@ 'Stai utilizzando una versione instabile che potrebbe contenere errori. Se pensi che questo errore sia dovuto a questo, ti preghiamo di inviarci il tuo feedback!', 'UI:ErrorPage:KittyDisclaimer' => 'Nessun gattino è stato ferito durante la creazione di questo GIF e rilascio. - Il Team R&D', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/ja.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/ja.dictionary.itop.errorpage.php index 9f3be50f3..f9b3359fc 100644 --- a/dictionaries/ui/pages/errorpage/ja.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/ja.dictionary.itop.errorpage.php @@ -1,17 +1,18 @@ 'You are using an unstable version that may include bugs. If you think this error occurred because of this please send us your feedback!~~', 'UI:ErrorPage:KittyDisclaimer' => 'No kitty were injured during the making of this GIF and release. - The R&D Team~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/nl.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/nl.dictionary.itop.errorpage.php index c7aa6b49b..629722a2c 100644 --- a/dictionaries/ui/pages/errorpage/nl.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/nl.dictionary.itop.errorpage.php @@ -1,17 +1,18 @@ 'Je gebruikt een instabiele versie die mogelijks fouten bevat. Als je denkt dat deze fout hierdoor komt, gelieve ons hierover te contacteren!', 'UI:ErrorPage:KittyDisclaimer' => 'Er werden geen katjes misbruikt tijdens het maken van deze GIF en software. - Het R&D team', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/pl.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/pl.dictionary.itop.errorpage.php index 2aca9b750..9ccf54af6 100644 --- a/dictionaries/ui/pages/errorpage/pl.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/pl.dictionary.itop.errorpage.php @@ -1,17 +1,18 @@ 'Używasz niestabilnej wersji, która może zawierać błędy. Jeśli uważasz, że ten błąd wystąpił z tego powodu, prześlij nam swoją opinię!', 'UI:ErrorPage:KittyDisclaimer' => 'Żaden kotek nie został ranny podczas tworzenia tego GIF-a i wydania. - Zespół R&D', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/pt_br.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/pt_br.dictionary.itop.errorpage.php index 39e4e5046..d5aaa1665 100644 --- a/dictionaries/ui/pages/errorpage/pt_br.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/pt_br.dictionary.itop.errorpage.php @@ -1,17 +1,18 @@ 'Você está usando uma versão instável que pode incluir bugs. Se você acha que esse erro ocorreu por causa disso, envie-nos o seu feedback!', 'UI:ErrorPage:KittyDisclaimer' => 'Nenhum gatinho foi ferido durante a confecção deste GIF e lançamento de versão do '.ITOP_APPLICATION_SHORT.'. - The R&D Team', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/ru.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/ru.dictionary.itop.errorpage.php index b425b78d4..56c4ccafc 100755 --- a/dictionaries/ui/pages/errorpage/ru.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/ru.dictionary.itop.errorpage.php @@ -1,17 +1,18 @@ 'Вы используете нестабильную версию, которая может содержать ошибки. Если вы считаете, что ошибка возникла из-за этого, отправьте нам свой отзыв.', 'UI:ErrorPage:KittyDisclaimer' => 'Ни один котёнок не пострадал во время создания этого GIF и этого релиза. - The R&D Team', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/sk.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/sk.dictionary.itop.errorpage.php index d4ce5f6f7..35cecba53 100644 --- a/dictionaries/ui/pages/errorpage/sk.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/sk.dictionary.itop.errorpage.php @@ -1,17 +1,18 @@ 'You are using an unstable version that may include bugs. If you think this error occurred because of this please send us your feedback!~~', 'UI:ErrorPage:KittyDisclaimer' => 'No kitty were injured during the making of this GIF and release. - The R&D Team~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/tr.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/tr.dictionary.itop.errorpage.php index f25cad8a7..64cf1f2d6 100644 --- a/dictionaries/ui/pages/errorpage/tr.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/tr.dictionary.itop.errorpage.php @@ -1,17 +1,18 @@ 'You are using an unstable version that may include bugs. If you think this error occurred because of this please send us your feedback!~~', 'UI:ErrorPage:KittyDisclaimer' => 'No kitty were injured during the making of this GIF and release. - The R&D Team~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/errorpage/zh_cn.dictionary.itop.errorpage.php b/dictionaries/ui/pages/errorpage/zh_cn.dictionary.itop.errorpage.php index 0aa3753d2..63d1e7982 100644 --- a/dictionaries/ui/pages/errorpage/zh_cn.dictionary.itop.errorpage.php +++ b/dictionaries/ui/pages/errorpage/zh_cn.dictionary.itop.errorpage.php @@ -1,4 +1,5 @@ '当前正在使用可能包含缺陷的不稳定版本. 如果确信错误是因为缺陷导致请反馈给我们!', 'UI:ErrorPage:KittyDisclaimer' => '请放心, 制作此动画和发行版的时候没有任何猫咪受到伤害. - 研发团队', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/cs.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/cs.dictionary.itop.notifications-center.php index df87d7d80..d6be0afda 100644 --- a/dictionaries/ui/pages/notifications-center/cs.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/cs.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center~~', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center~~', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel~~', @@ -29,4 +30,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.~~', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s~~', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/da.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/da.dictionary.itop.notifications-center.php index 5bfcbea02..a48674753 100644 --- a/dictionaries/ui/pages/notifications-center/da.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/da.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center~~', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center~~', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel~~', @@ -29,4 +30,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.~~', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s~~', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/de.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/de.dictionary.itop.notifications-center.php index c8eb098da..490d94ecd 100644 --- a/dictionaries/ui/pages/notifications-center/de.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/de.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center~~', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center~~', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel~~', @@ -29,4 +30,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.~~', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s~~', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/en.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/en.dictionary.itop.notifications-center.php index 22d4e844a..f73b22e07 100644 --- a/dictionaries/ui/pages/notifications-center/en.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/en.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel', @@ -29,4 +30,4 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/en_gb.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/en_gb.dictionary.itop.notifications-center.php index 8489ff10b..ef6f0ab4b 100644 --- a/dictionaries/ui/pages/notifications-center/en_gb.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/en_gb.dictionary.itop.notifications-center.php @@ -1,10 +1,11 @@ 'Notifications centre', 'UI:NotificationsCenter:Panel:Title' => 'Notifications centre', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel', @@ -16,4 +17,4 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/es_cr.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/es_cr.dictionary.itop.notifications-center.php index 0d9e9d304..d266c3285 100644 --- a/dictionaries/ui/pages/notifications-center/es_cr.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/es_cr.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:NotificationsCenter:Page:Title' => 'Centro de notificaciones', 'UI:NotificationsCenter:Panel:Title' => 'Centro de notificaciones', 'UI:NotificationsCenter:Panel:SubTitle' => 'Gestionar las notificaciones que ha recibido: cancelar la suscripción o limitarlas a un solo canal', @@ -19,4 +20,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI:NotificationsCenter:Subscribe:Error' => 'Se produjo un error al suscribirse a las notificaciones seleccionadas.', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s de %2$s', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/fr.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/fr.dictionary.itop.notifications-center.php index f2bf91acc..09154ac10 100644 --- a/dictionaries/ui/pages/notifications-center/fr.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/fr.dictionary.itop.notifications-center.php @@ -1,15 +1,16 @@ 'Notifications', 'UI:NotificationsCenter:Panel:Title' => 'Notifications', 'UI:NotificationsCenter:Panel:SubTitle' => 'Gérer les Notifications dont vous êtes destinataire : désabonnez-vous des news, des méls ou des deux', @@ -21,4 +22,4 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI:NotificationsCenter:Subscribe:Error' => 'Une erreur c\'est produite, lors de votre ré-inscription.', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s sur %2$s', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/hu.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/hu.dictionary.itop.notifications-center.php index 7fb5b85fa..d34c99fb2 100644 --- a/dictionaries/ui/pages/notifications-center/hu.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/hu.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center~~', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center~~', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel~~', @@ -29,4 +30,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.~~', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s~~', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/it.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/it.dictionary.itop.notifications-center.php index f33fde143..87d83775f 100644 --- a/dictionaries/ui/pages/notifications-center/it.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/it.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center~~', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center~~', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel~~', @@ -29,4 +30,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.~~', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s~~', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/ja.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/ja.dictionary.itop.notifications-center.php index 8b838ad34..f681e7c6a 100644 --- a/dictionaries/ui/pages/notifications-center/ja.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/ja.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center~~', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center~~', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel~~', @@ -29,4 +30,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.~~', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s~~', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/nl.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/nl.dictionary.itop.notifications-center.php index 0a91211f5..01aeb288e 100644 --- a/dictionaries/ui/pages/notifications-center/nl.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/nl.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center~~', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center~~', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel~~', @@ -29,4 +30,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.~~', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s~~', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/pl.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/pl.dictionary.itop.notifications-center.php index 0cb184673..1c46759e5 100644 --- a/dictionaries/ui/pages/notifications-center/pl.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/pl.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Centrum powiadomień', 'UI:NotificationsCenter:Panel:Title' => 'Centrum powiadomień', 'UI:NotificationsCenter:Panel:SubTitle' => 'Zarządzaj otrzymanymi powiadomieniami: zrezygnuj z subskrypcji lub ogranicz je do jednego kanału', @@ -28,4 +29,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI:NotificationsCenter:Subscribe:Error' => 'Wystąpił błąd podczas subskrybowania wybranych powiadomień.', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s poza %2$s', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/pt_br.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/pt_br.dictionary.itop.notifications-center.php index bde4825b3..a81df6bb7 100644 --- a/dictionaries/ui/pages/notifications-center/pt_br.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/pt_br.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center~~', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center~~', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel~~', @@ -29,4 +30,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.~~', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s~~', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/ru.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/ru.dictionary.itop.notifications-center.php index d06757ffc..7acd57eba 100644 --- a/dictionaries/ui/pages/notifications-center/ru.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/ru.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center~~', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center~~', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel~~', @@ -29,4 +30,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.~~', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s~~', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/sk.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/sk.dictionary.itop.notifications-center.php index ecb56e4cd..dc20b746d 100644 --- a/dictionaries/ui/pages/notifications-center/sk.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/sk.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center~~', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center~~', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel~~', @@ -29,4 +30,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.~~', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s~~', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/tr.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/tr.dictionary.itop.notifications-center.php index 59be7b132..8b395c089 100644 --- a/dictionaries/ui/pages/notifications-center/tr.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/tr.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center~~', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center~~', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel~~', @@ -29,4 +30,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.~~', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s~~', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/notifications-center/zh_cn.dictionary.itop.notifications-center.php b/dictionaries/ui/pages/notifications-center/zh_cn.dictionary.itop.notifications-center.php index 8b3aeeb46..de58611b6 100644 --- a/dictionaries/ui/pages/notifications-center/zh_cn.dictionary.itop.notifications-center.php +++ b/dictionaries/ui/pages/notifications-center/zh_cn.dictionary.itop.notifications-center.php @@ -1,4 +1,5 @@ 'Notifications center~~', 'UI:NotificationsCenter:Panel:Title' => 'Notifications center~~', 'UI:NotificationsCenter:Panel:SubTitle' => 'Manage Notifications that you have received : unsubscribe or limit them to a single channel~~', @@ -29,4 +30,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI:NotificationsCenter:Subscribe:Error' => 'An error occurred while subscribing to the selected notifications.~~', 'UI:NotificationsCenter:Channel:OutOf:Text' => '%1$s out of %2$s~~', 'UI:NotificationsCenter:Advanced:Input:Label' => '%1$s: %2$s~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/cs.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/cs.dictionary.itop.oauth.landing.php index 64888d360..b4dce9086 100644 --- a/dictionaries/ui/pages/oauth.landing/cs.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/cs.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth token creation~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/da.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/da.dictionary.itop.oauth.landing.php index 6c478e544..1005d5e32 100644 --- a/dictionaries/ui/pages/oauth.landing/da.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/da.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth token creation~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/de.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/de.dictionary.itop.oauth.landing.php index 6aaaabbbf..09b0b2d67 100644 --- a/dictionaries/ui/pages/oauth.landing/de.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/de.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth token creation~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/en.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/en.dictionary.itop.oauth.landing.php index 2bd5d45bf..564383f04 100644 --- a/dictionaries/ui/pages/oauth.landing/en.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/en.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth token creation', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/en_gb.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/en_gb.dictionary.itop.oauth.landing.php index 82fed5d8b..c5d69628a 100644 --- a/dictionaries/ui/pages/oauth.landing/en_gb.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/en_gb.dictionary.itop.oauth.landing.php @@ -1,10 +1,11 @@ 'OAuth token creation', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/es_cr.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/es_cr.dictionary.itop.oauth.landing.php index d4fb84590..b3dd16658 100644 --- a/dictionaries/ui/pages/oauth.landing/es_cr.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/es_cr.dictionary.itop.oauth.landing.php @@ -1,12 +1,13 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'core/Operation:Landing/Title' => 'Creación de tokens OAuth', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/fr.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/fr.dictionary.itop.oauth.landing.php index d0d990255..e162ac8c6 100644 --- a/dictionaries/ui/pages/oauth.landing/fr.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/fr.dictionary.itop.oauth.landing.php @@ -1,14 +1,15 @@ 'Création d\'un jeton OAuth', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/hu.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/hu.dictionary.itop.oauth.landing.php index fafd2958d..824c105d9 100644 --- a/dictionaries/ui/pages/oauth.landing/hu.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/hu.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth token creation~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/it.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/it.dictionary.itop.oauth.landing.php index 23309efc6..cbcec1257 100644 --- a/dictionaries/ui/pages/oauth.landing/it.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/it.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth token creation~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/ja.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/ja.dictionary.itop.oauth.landing.php index 593abb2a7..cd112298b 100644 --- a/dictionaries/ui/pages/oauth.landing/ja.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/ja.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth token creation~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/nl.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/nl.dictionary.itop.oauth.landing.php index 56e4e99a1..034a7e64f 100644 --- a/dictionaries/ui/pages/oauth.landing/nl.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/nl.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth token creation~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/pl.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/pl.dictionary.itop.oauth.landing.php index 246b2792f..84140b4d9 100644 --- a/dictionaries/ui/pages/oauth.landing/pl.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/pl.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'Tworzenie tokena OAuth', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/pt_br.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/pt_br.dictionary.itop.oauth.landing.php index 8b3883330..d479742e8 100644 --- a/dictionaries/ui/pages/oauth.landing/pt_br.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/pt_br.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth token creation~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/ru.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/ru.dictionary.itop.oauth.landing.php index 693702820..f909f2e5f 100644 --- a/dictionaries/ui/pages/oauth.landing/ru.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/ru.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth token creation~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/sk.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/sk.dictionary.itop.oauth.landing.php index 60c73cfcc..441bfe410 100644 --- a/dictionaries/ui/pages/oauth.landing/sk.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/sk.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth token creation~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/tr.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/tr.dictionary.itop.oauth.landing.php index d5ae9275b..77a932dc9 100644 --- a/dictionaries/ui/pages/oauth.landing/tr.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/tr.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth token creation~~', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/oauth.landing/zh_cn.dictionary.itop.oauth.landing.php b/dictionaries/ui/pages/oauth.landing/zh_cn.dictionary.itop.oauth.landing.php index aa05ce793..9fa69a797 100644 --- a/dictionaries/ui/pages/oauth.landing/zh_cn.dictionary.itop.oauth.landing.php +++ b/dictionaries/ui/pages/oauth.landing/zh_cn.dictionary.itop.oauth.landing.php @@ -1,4 +1,5 @@ 'OAuth令牌创建', -)); \ No newline at end of file +]); diff --git a/dictionaries/ui/pages/preferences/cs.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/cs.dictionary.itop.preferences.php index 89530d02d..64feaf523 100644 --- a/dictionaries/ui/pages/preferences/cs.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/cs.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Předvolby', 'UI:Preferences:UserInterface:Title' => 'Uživatelské rozhraní', 'UI:Preferences:General:Title' => 'Obecné', @@ -45,5 +46,5 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Váš zástupný obrázek byl úspěšně aktualizován', 'UI:Preferences:Notifications' => 'Upozornění', 'UI:Preferences:Notifications+' => 'Nastavení upozornění, která chcete dostávat na této stránce.', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/da.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/da.dictionary.itop.preferences.php index fbe14c99f..6f63553d4 100644 --- a/dictionaries/ui/pages/preferences/da.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/da.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Preferences~~', 'UI:Preferences:UserInterface:Title' => 'User interface~~', 'UI:Preferences:General:Title' => 'General~~', @@ -45,5 +46,5 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~', 'UI:Preferences:Notifications' => 'Notifications~~', 'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive on this page.~~', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/de.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/de.dictionary.itop.preferences.php index b3d8b13da..f2b285c36 100644 --- a/dictionaries/ui/pages/preferences/de.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/de.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Einstellungen', 'UI:Preferences:UserInterface:Title' => 'Benutzerinterface', 'UI:Preferences:General:Title' => 'Generell', @@ -45,5 +46,5 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Ihr Platzhalterbild wurde erfolgreich aktualisiert.', 'UI:Preferences:Notifications' => 'Benachrichtigungen', 'UI:Preferences:Notifications+' => 'Konfigurieren Sie die Benachrichtigungen, die Sie erhalten möchten. auf dieser Seite.', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/en.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/en.dictionary.itop.preferences.php index 184ae1a2e..0347d0b11 100644 --- a/dictionaries/ui/pages/preferences/en.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/en.dictionary.itop.preferences.php @@ -1,4 +1,5 @@ 'Preferences', 'UI:Preferences:UserInterface:Title' => 'User interface', 'UI:Preferences:General:Title' => 'General', @@ -54,5 +55,5 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated', 'UI:Preferences:Notifications' => 'Notifications', 'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive on this page.', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/en_gb.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/en_gb.dictionary.itop.preferences.php index 9015c2d55..658f40961 100644 --- a/dictionaries/ui/pages/preferences/en_gb.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/en_gb.dictionary.itop.preferences.php @@ -1,11 +1,12 @@ 'Preferences', 'UI:Preferences:UserInterface:Title' => 'User interface', 'UI:Preferences:General:Title' => 'General', @@ -41,5 +42,5 @@ Dict::Add('EN GB', 'British English', 'British English', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated', 'UI:Preferences:Notifications' => 'Notifications', 'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive on this page.', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/es_cr.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/es_cr.dictionary.itop.preferences.php index d32d5da85..1722bc09a 100644 --- a/dictionaries/ui/pages/preferences/es_cr.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/es_cr.dictionary.itop.preferences.php @@ -1,13 +1,14 @@ - * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales + * @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales */ -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( +Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [ 'UI:Preferences:Title' => 'Preferencias', 'UI:Preferences:UserInterface:Title' => 'Interfaz de Usuario', 'UI:Preferences:General:Title' => 'General', @@ -43,5 +44,5 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Imagen de marcador de posición se ha actualizado correctamente.', 'UI:Preferences:Notifications' => 'Notificaciones', 'UI:Preferences:Notifications+' => 'Configure las notificaciones que desea recibir en esta página.', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/fr.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/fr.dictionary.itop.preferences.php index bd2dd9b11..db1561b55 100644 --- a/dictionaries/ui/pages/preferences/fr.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/fr.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Préférences', 'UI:Preferences:UserInterface:Title' => 'Interface utilisateur', 'UI:Preferences:General:Title' => 'Général', @@ -45,5 +46,5 @@ Dict::Add('FR FR', 'French', 'Français', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Votre avatar a été mis à jour avec succès', 'UI:Preferences:Notifications' => 'Notifications', 'UI:Preferences:Notifications+' => 'Désabonnez-vous des notifications qui vous importunent (emails et news) en suivant ce lien.', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/hu.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/hu.dictionary.itop.preferences.php index 64a5668a1..e56da661b 100644 --- a/dictionaries/ui/pages/preferences/hu.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/hu.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Beállítások', 'UI:Preferences:UserInterface:Title' => 'Felhasználói felület', 'UI:Preferences:General:Title' => 'Általános beállítások', @@ -45,5 +46,5 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~', 'UI:Preferences:Notifications' => 'Notifications~~', 'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive on this page.~~', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/it.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/it.dictionary.itop.preferences.php index 95ba358a7..0265ae66a 100644 --- a/dictionaries/ui/pages/preferences/it.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/it.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Preferenze', 'UI:Preferences:UserInterface:Title' => 'Interfaccia utente', 'UI:Preferences:General:Title' => 'Generale', @@ -45,5 +46,5 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~', 'UI:Preferences:Notifications' => 'Notifications~~', 'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive on this page.~~', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/ja.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/ja.dictionary.itop.preferences.php index f29871ae3..f3fae6131 100644 --- a/dictionaries/ui/pages/preferences/ja.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/ja.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Preferences~~', 'UI:Preferences:UserInterface:Title' => 'User interface~~', 'UI:Preferences:General:Title' => 'General~~', @@ -45,5 +46,5 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~', 'UI:Preferences:Notifications' => 'Notifications~~', 'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive on this page.~~', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/nl.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/nl.dictionary.itop.preferences.php index d7416dbff..7f33f25f8 100644 --- a/dictionaries/ui/pages/preferences/nl.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/nl.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Voorkeuren', 'UI:Preferences:UserInterface:Title' => 'Gebruikersinterface', 'UI:Preferences:General:Title' => 'Algemeen', @@ -45,5 +46,5 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~', 'UI:Preferences:Notifications' => 'Notifications~~', 'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive on this page.~~', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/pl.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/pl.dictionary.itop.preferences.php index 0395b33c9..a499f25f5 100644 --- a/dictionaries/ui/pages/preferences/pl.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/pl.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Preferencje', 'UI:Preferences:UserInterface:Title' => 'Interfejs użytkownika', 'UI:Preferences:General:Title' => 'Ogólne', @@ -45,5 +46,5 @@ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Twój obraz zastępczy został pomyślnie zaktualizowany', 'UI:Preferences:Notifications' => 'Powiadomienia', 'UI:Preferences:Notifications+' => 'Skonfiguruj powiadomienia, które chcesz otrzymywać na tej stronie.', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/pt_br.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/pt_br.dictionary.itop.preferences.php index 34535b57f..159bd5815 100644 --- a/dictionaries/ui/pages/preferences/pt_br.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/pt_br.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Preferências', 'UI:Preferences:UserInterface:Title' => 'Interface de usuário', 'UI:Preferences:General:Title' => 'Geral', @@ -45,5 +46,5 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~', 'UI:Preferences:Notifications' => 'Notifications~~', 'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive on this page.~~', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/ru.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/ru.dictionary.itop.preferences.php index 82790bbf0..94a739748 100755 --- a/dictionaries/ui/pages/preferences/ru.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/ru.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Предпочтения', 'UI:Preferences:UserInterface:Title' => 'Пользовательский интерфейс', 'UI:Preferences:General:Title' => 'Основные', @@ -45,5 +46,5 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~', 'UI:Preferences:Notifications' => 'Notifications~~', 'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive on this page.~~', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/sk.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/sk.dictionary.itop.preferences.php index cbe7e48f7..bc054f9f6 100644 --- a/dictionaries/ui/pages/preferences/sk.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/sk.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Preferences~~', 'UI:Preferences:UserInterface:Title' => 'User interface~~', 'UI:Preferences:General:Title' => 'General~~', @@ -45,5 +46,5 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~', 'UI:Preferences:Notifications' => 'Notifications~~', 'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive on this page.~~', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/tr.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/tr.dictionary.itop.preferences.php index 9470e915f..37dfcd193 100644 --- a/dictionaries/ui/pages/preferences/tr.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/tr.dictionary.itop.preferences.php @@ -1,15 +1,16 @@ 'Preferences~~', 'UI:Preferences:UserInterface:Title' => 'User interface~~', 'UI:Preferences:General:Title' => 'General~~', @@ -45,5 +46,5 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~', 'UI:Preferences:Notifications' => 'Notifications~~', 'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive on this page.~~', - -)); + +]); diff --git a/dictionaries/ui/pages/preferences/zh_cn.dictionary.itop.preferences.php b/dictionaries/ui/pages/preferences/zh_cn.dictionary.itop.preferences.php index 6ff85293f..2ec082a1d 100644 --- a/dictionaries/ui/pages/preferences/zh_cn.dictionary.itop.preferences.php +++ b/dictionaries/ui/pages/preferences/zh_cn.dictionary.itop.preferences.php @@ -1,4 +1,5 @@ '首选项', 'UI:Preferences:UserInterface:Title' => '用户界面', 'UI:Preferences:General:Title' => '概况', @@ -53,5 +54,5 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~', 'UI:Preferences:Notifications' => 'Notifications~~', 'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive on this page.~~', - -)); + +]); diff --git a/dictionaries/zh_cn.dictionary.itop.core.php b/dictionaries/zh_cn.dictionary.itop.core.php index 2cf511679..142948e14 100644 --- a/dictionaries/zh_cn.dictionary.itop.core.php +++ b/dictionaries/zh_cn.dictionary.itop.core.php @@ -1,4 +1,5 @@ '%1s (已删除)', 'Core:DeletedObjectTip' => '对象已被删除于 %1$s (%2$s)', 'Core:UnknownObjectLabel' => '找不到对象 (类型: %1$s, 编号: %2$d)', @@ -157,8 +158,7 @@ Operators:
                  'Core:Context=GUI:Console' => '命令行', 'Core:Context=CRON' => '定时任务', 'Core:Context=GUI:Portal' => '门户', -)); - +]); ////////////////////////////////////////////////////////////////////// // Classes in 'core/cmdb' @@ -169,7 +169,7 @@ Operators:
                  // Class: CMDBChange // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:CMDBChange' => '变更', 'Class:CMDBChange+' => '变更跟踪', 'Class:CMDBChange/Attribute:date' => '日期', @@ -184,13 +184,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:CMDBChange/Attribute:origin/Value:webservice-rest' => 'REST/JSON服务', 'Class:CMDBChange/Attribute:origin/Value:webservice-soap' => 'SOAP服务', 'Class:CMDBChange/Attribute:origin/Value:custom-extension' => '插件', -)); +]); // // Class: CMDBChangeOp // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:CMDBChangeOp' => '变更操作', 'Class:CMDBChangeOp+' => '变更操作跟踪', 'Class:CMDBChangeOp/Attribute:change' => '变更', @@ -205,51 +205,51 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:CMDBChangeOp/Attribute:objkey+' => '对象id', 'Class:CMDBChangeOp/Attribute:finalclass' => 'CMDB 操作类型', 'Class:CMDBChangeOp/Attribute:finalclass+' => '根本属性的名称', -)); +]); // // Class: CMDBChangeOpCreate // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:CMDBChangeOpCreate' => '对象创建', 'Class:CMDBChangeOpCreate+' => '对象创建跟踪', -)); +]); // // Class: CMDBChangeOpDelete // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:CMDBChangeOpDelete' => '对象删除', 'Class:CMDBChangeOpDelete+' => '对象删除跟踪', -)); +]); // // Class: CMDBChangeOpSetAttribute // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:CMDBChangeOpSetAttribute' => '对象变化', 'Class:CMDBChangeOpSetAttribute+' => '对象属性变化跟踪', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode' => '属性', 'Class:CMDBChangeOpSetAttribute/Attribute:attcode+' => '更改的属性编码', -)); +]); // // Class: CMDBChangeOpSetAttributeScalar // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:CMDBChangeOpSetAttributeScalar' => '属性更改跟踪', 'Class:CMDBChangeOpSetAttributeScalar+' => '对象属性更改跟踪', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue' => '旧值', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:oldvalue+' => '以前该属性的值', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue' => '新值', 'Class:CMDBChangeOpSetAttributeScalar/Attribute:newvalue+' => '属性的新值', -)); +]); // Used by CMDBChangeOp... & derived classes -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Change:ObjectCreated' => '对象已创建', 'Change:ObjectDeleted' => '对象已删除', 'Change:ObjectModified' => '对象已修改', @@ -266,35 +266,35 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Change:LinkSet:Added' => '已添加 %1$s', 'Change:LinkSet:Removed' => '已移除 %1$s', 'Change:LinkSet:Modified' => '已修改 %1$s', -)); +]); // // Class: CMDBChangeOpSetAttributeBlob // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:CMDBChangeOpSetAttributeBlob' => '数据变更跟踪', 'Class:CMDBChangeOpSetAttributeBlob+' => '数据变更跟踪', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata' => '之前的值', 'Class:CMDBChangeOpSetAttributeBlob/Attribute:prevdata+' => '该数据之前的内容', -)); +]); // // Class: CMDBChangeOpSetAttributeText // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:CMDBChangeOpSetAttributeText' => '文本变更跟踪', 'Class:CMDBChangeOpSetAttributeText+' => '文本变更跟踪', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata' => '旧值', 'Class:CMDBChangeOpSetAttributeText/Attribute:prevdata+' => '该文本之前的内容', -)); +]); // // Class: Event // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Event' => '日志事件', 'Class:Event+' => '应用程序的内部事件', 'Class:Event/Attribute:message' => '消息', @@ -305,13 +305,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Event/Attribute:userinfo+' => '触发此事件的动作执行用户的身份', 'Class:Event/Attribute:finalclass' => '事件类型', 'Class:Event/Attribute:finalclass+' => '根本属性的名称', -)); +]); // // Class: EventNotification // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:EventNotification' => '通知事件', 'Class:EventNotification+' => '已发送通知的追踪', 'Class:EventNotification/Attribute:trigger_id' => '触发器', @@ -321,14 +321,14 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:EventNotification/Attribute:action_id' => '用户', 'Class:EventNotification/Attribute:action_id+' => '用户账号', 'Class:EventNotification/Attribute:object_id' => '对象编号', - 'Class:EventNotification/Attribute:object_id+' => '对象编号 (类型由触发器定义?)' -)); + 'Class:EventNotification/Attribute:object_id+' => '对象编号 (类型由触发器定义?)', +]); // // Class: EventNotificationEmail // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:EventNotificationEmail' => '邮件发送', 'Class:EventNotificationEmail+' => '跟踪每封已发送的邮件', 'Class:EventNotificationEmail/Attribute:to' => '收件人', @@ -345,13 +345,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:EventNotificationEmail/Attribute:body+' => '内容', 'Class:EventNotificationEmail/Attribute:attachments' => '附件', 'Class:EventNotificationEmail/Attribute:attachments+' => '', -)); +]); // // Class: EventIssue // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:EventIssue' => '问题事件', 'Class:EventIssue+' => '跟踪问题 (告警, 错误, 等)', 'Class:EventIssue/Attribute:issue' => '事件', @@ -368,13 +368,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:EventIssue/Attribute:callstack+' => '调用栈', 'Class:EventIssue/Attribute:data' => '数据', 'Class:EventIssue/Attribute:data+' => '更多信息', -)); +]); // // Class: EventWebService // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:EventWebService' => 'WebService调用', 'Class:EventWebService+' => '跟踪WebService调用', 'Class:EventWebService/Attribute:verb' => '命令', @@ -389,9 +389,9 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:EventWebService/Attribute:log_error+' => '结果错误记录', 'Class:EventWebService/Attribute:data' => '数据', 'Class:EventWebService/Attribute:data+' => '结果数据', -)); +]); -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:EventRestService' => 'REST/JSON 调用', 'Class:EventRestService+' => '跟踪REST/JSON服务调用', 'Class:EventRestService/Attribute:operation' => '操作', @@ -406,13 +406,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:EventRestService/Attribute:json_output+' => 'HTTP 响应 (json)', 'Class:EventRestService/Attribute:provider' => '提供者', 'Class:EventRestService/Attribute:provider+' => '实现该功能的PHP类', -)); +]); // // Class: EventLoginUsage // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:EventLoginUsage' => '登录频率', 'Class:EventLoginUsage+' => '连接至应用', 'Class:EventLoginUsage/Attribute:user_id' => '登录', @@ -421,13 +421,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:EventLoginUsage/Attribute:contact_name+' => '用户名', 'Class:EventLoginUsage/Attribute:contact_email' => '用户邮箱', 'Class:EventLoginUsage/Attribute:contact_email+' => '用户的邮箱地址', -)); +]); // // Class: EventNotificationNewsroom // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:EventNotificationNewsroom' => 'News sent~~', 'Class:EventNotificationNewsroom+' => '', 'Class:EventNotificationNewsroom/Attribute:title' => '标题', @@ -456,13 +456,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:EventNotificationNewsroom/Attribute:read_date+' => '', 'Class:EventNotificationNewsroom/Attribute:contact_id' => '联系人', 'Class:EventNotificationNewsroom/Attribute:contact_id+' => '', -)); +]); // // Class: Action // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Action' => '自定义操作', 'Class:Action+' => '用户定义的操作', 'Class:Action/ComplementaryName' => '%1$s: %2$s', @@ -492,24 +492,24 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Action:last_executions_tab_panel_title' => 'Executions of this action (%1$s)~~', 'Action:last_executions_tab_limit_days' => '过去 %1$s 天', 'Action:last_executions_tab_limit_none' => '无限制', -)); +]); // // Class: ActionNotification // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ActionNotification' => '通知', 'Class:ActionNotification+' => '通知 (抽象)', 'Class:ActionNotification/Attribute:language' => '语言', 'Class:ActionNotification/Attribute:language+' => '', -)); +]); // // Class: ActionEmail // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ActionEmail' => '邮件通知', 'Class:ActionEmail+' => '', 'Class:ActionEmail/Attribute:status+' => '此状态将决定提醒谁: @@ -576,14 +576,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'ActionEmail:preview_warning' => '实际收到的邮件在客户端中可能与当前在浏览器中的预览有所不同.', 'ActionEmail:preview_more_info' => '若需更多不同邮件客户端支持的CSS特性信息, 请参阅%1$s', 'ActionEmail:content_placeholder_missing' => '标识符 "%1$s" 在HTML中不存在. 字段 "%2$s" 的内容将不会包含在生成的邮件中.', -)); - +]); // // Class: ActionNewsroom // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'ActionNewsroom:trigger' => '触发器', 'ActionNewsroom:content' => '消息', 'ActionNewsroom:settings' => '设置', @@ -618,13 +617,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:ActionNewsroom/Attribute:recipients+' => 'An OQL query returning Contact objects~~', 'Class:ActionNewsroom/Attribute:url' => 'URL', 'Class:ActionNewsroom/Attribute:url+' => 'By default, it points to the object triggering the notification. But you can also specify a custom URL.~~', -)); +]); // // Class: Trigger // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Trigger' => '触发器', 'Class:Trigger+' => '自定义事件处理', 'Class:Trigger/ComplementaryName' => '%1$s, %2$s', @@ -643,13 +642,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:Trigger/Attribute:subscription_policy/Value:allow_no_channel' => 'Allow complete unsubscription~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_at_least_one_channel' => 'Force at least one channel (News or Email)~~', 'Class:Trigger/Attribute:subscription_policy/Value:force_all_channels' => 'Deny unsubscription~~', -)); +]); // // Class: TriggerOnObject // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TriggerOnObject' => '触发器 (类型依赖的)', 'Class:TriggerOnObject+' => '在指定类型对象上的触发器', 'Class:TriggerOnObject/Attribute:target_class' => '目标类型', @@ -658,115 +657,115 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:TriggerOnObject/Attribute:filter+' => '限定将激活触发器的对象 (目标类型的)', 'TriggerOnObject:WrongFilterQuery' => '错误的筛选查询: %1$s', 'TriggerOnObject:WrongFilterClass' => '筛选查询返回的对象必须是类型 "%1$s"', -)); +]); // // Class: TriggerOnPortalUpdate // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TriggerOnPortalUpdate' => '触发器 (工单更新时)', 'Class:TriggerOnPortalUpdate+' => '终端用户更新工单时触发', -)); +]); // // Class: TriggerOnStateChange // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TriggerOnStateChange' => '触发器 (当状态变化时)', 'Class:TriggerOnStateChange+' => '当对象状态变化时触发', 'Class:TriggerOnStateChange/Attribute:state' => '状态', 'Class:TriggerOnStateChange/Attribute:state+' => '', -)); +]); // // Class: TriggerOnStateEnter // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TriggerOnStateEnter' => '触发器 (进入指定状态)', 'Class:TriggerOnStateEnter+' => '对象进入指定状态时触发', -)); +]); // // Class: TriggerOnStateLeave // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TriggerOnStateLeave' => '触发器 (离开指定状态时)', 'Class:TriggerOnStateLeave+' => '对象离开指定状态时触发', -)); +]); // // Class: TriggerOnObjectCreate // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TriggerOnObjectCreate' => '触发器 (对象创建时)', 'Class:TriggerOnObjectCreate+' => '对象创建时触发', -)); +]); // // Class: TriggerOnObjectDelete // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TriggerOnObjectDelete' => '触发器 (对象删除时)', 'Class:TriggerOnObjectDelete+' => '指定类型或子类型对象删除时的触发器', -)); +]); // // Class: TriggerOnObjectUpdate // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TriggerOnObjectUpdate' => '触发器 (对象更新时)', 'Class:TriggerOnObjectUpdate+' => '指定类型或子类型对象更新时的触发器', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes' => '目标字段', 'Class:TriggerOnObjectUpdate/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnObjectMention // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TriggerOnObjectMention' => '触发器 (对象提及时)', 'Class:TriggerOnObjectMention+' => '指定类型或子类型对象在属性日志中提及 (@xxx) 时的触发器', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter' => '提及筛选', 'Class:TriggerOnObjectMention/Attribute:mentioned_filter+' => '限丁将激活此触发器的提及对象. 如果为空则任何类的提及对象将激活此触发器.', -)); +]); // // Class: TriggerOnAttributeBlobDownload // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TriggerOnAttributeBlobDownload' => '触发器 (对象文档下载时)', 'Class:TriggerOnAttributeBlobDownload+' => '指定类型或子类型对象的文档下载时的触发器', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes' => '目标字段', 'Class:TriggerOnAttributeBlobDownload/Attribute:target_attcodes+' => '', -)); +]); // // Class: TriggerOnThresholdReached // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TriggerOnThresholdReached' => '触发器 (基于阈值)', 'Class:TriggerOnThresholdReached+' => '当达到某个阈值时触发', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code' => '秒表', 'Class:TriggerOnThresholdReached/Attribute:stop_watch_code+' => '', 'Class:TriggerOnThresholdReached/Attribute:threshold_index' => '阈值', 'Class:TriggerOnThresholdReached/Attribute:threshold_index+' => '', -)); +]); // // Class: lnkTriggerAction // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkTriggerAction' => '操作/触发器', 'Class:lnkTriggerAction+' => '关联触发器和操作', 'Class:lnkTriggerAction/Attribute:action_id' => '操作', @@ -779,12 +778,12 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkTriggerAction/Attribute:trigger_name+' => '', 'Class:lnkTriggerAction/Attribute:order' => '顺序', 'Class:lnkTriggerAction/Attribute:order+' => '操作的执行顺序', -)); +]); // // Synchro Data Source // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:SynchroDataSource' => '数据源同步', 'Class:SynchroDataSource/Attribute:name' => '名称', 'Class:SynchroDataSource/Attribute:name+' => '', @@ -1078,13 +1077,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Core:Validator:Mandatory' => '这里必填', 'Core:Validator:MustBeInteger' => '必须是整数', 'Core:Validator:MustSelectOne' => '请选择', - 'INTERNAL:JQuery-DatePicker:LangCode' => 'zh-CN' -)); + 'INTERNAL:JQuery-DatePicker:LangCode' => 'zh-CN', +]); // // Class: TagSetFieldData // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:TagSetFieldData' => '类型%1$s的%2$s', 'Class:TagSetFieldData+' => '~~', 'Class:TagSetFieldData/Attribute:code' => '代码', @@ -1106,12 +1105,12 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => '标签 "属性编码" 不能更改', 'Core:TagSetFieldData:WhereIsThisTagTab' => '标签使用率 (%1$d)', 'Core:TagSetFieldData:NoEntryFound' => '此标签没有条目', -)); +]); // // Class: DBProperty // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:DBProperty' => '数据库属性', 'Class:DBProperty+' => '~~', 'Class:DBProperty/Attribute:name' => '名称', @@ -1124,12 +1123,12 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:DBProperty/Attribute:change_date+' => '', 'Class:DBProperty/Attribute:change_comment' => '备注', 'Class:DBProperty/Attribute:change_comment+' => '', -)); +]); // // Class: BackgroundTask // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:BackgroundTask' => '后台任务', 'Class:BackgroundTask+' => '', 'Class:BackgroundTask/Attribute:class_name' => '类型名称', @@ -1154,12 +1153,12 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:BackgroundTask/Attribute:running+' => '', 'Class:BackgroundTask/Attribute:status' => '状态', 'Class:BackgroundTask/Attribute:status+' => '', -)); +]); // // Class: AsyncTask // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:AsyncTask' => '异步任务', 'Class:AsyncTask+' => '', 'Class:AsyncTask/Attribute:created' => '已创建', @@ -1184,43 +1183,40 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:AsyncTask/Attribute:last_attempt+' => '~~', 'Class:AsyncTask:InvalidConfig_Class_Keys' => '配置 "async_task_retries[%1$s]" 的格式无效. 应该为包含以下值的数组: %2$s', 'Class:AsyncTask:InvalidConfig_Class_InvalidKey_Keys' => '配置 "async_task_retries[%1$s]" 的格式无效: 未知的值 "%2$s". 应该只包含以下值: %3$s', -)); +]); // // Class: AbstractResource // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:AbstractResource' => '抽象资源', 'Class:AbstractResource+' => '', -)); +]); // // Class: ResourceAdminMenu // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ResourceAdminMenu' => '资源管理菜单', 'Class:ResourceAdminMenu+' => '', -)); +]); // // Class: ResourceRunQueriesMenu // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ResourceRunQueriesMenu' => '资源运行查询菜单', 'Class:ResourceRunQueriesMenu+' => '', -)); +]); // // Class: Action // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:ResourceSystemMenu' => '资源系统菜单', 'Class:ResourceSystemMenu+' => '', -)); - - - +]); diff --git a/dictionaries/zh_cn.dictionary.itop.ui.php b/dictionaries/zh_cn.dictionary.itop.ui.php index 2e94c29d6..e92279caa 100644 --- a/dictionaries/zh_cn.dictionary.itop.ui.php +++ b/dictionaries/zh_cn.dictionary.itop.ui.php @@ -1,15 +1,16 @@ '审计类别', 'Class:AuditCategory+' => '审计类别规定了需要被审计的对象的范围. 其组合了用于此范围内对象的所有审计规则', @@ -27,13 +28,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:AuditCategory/Attribute:warning_error_tolerance+' => '结果仍然显示为警告 (橙色) 的可允许的最大无效对象比例', 'Class:AuditCategory/Attribute:domains_list' => '审计域', 'Class:AuditCategory/Attribute:domains_list+' => '关联此类别的审计域列表', -)); +]); // // Class: AuditRule // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:AuditRule' => '审计规则', 'Class:AuditRule+' => '一条审计规则对应审计类别中的一项检查. 其应用于审计规则定义的对象范围', @@ -53,13 +54,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:AuditRule/Attribute:category_id+' => '该规则对应的类别', 'Class:AuditRule/Attribute:category_name' => '类别', 'Class:AuditRule/Attribute:category_name+' => '该规则对应的类名称', -)); +]); // // Class: AuditDomain // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:AuditDomain' => '审计域', 'Class:AuditDomain+' => '审计域用于分组审计规则. 审计域通常对应负责检查和修复错误的人', @@ -71,13 +72,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:AuditDomain/Attribute:icon+' => '', 'Class:AuditDomain/Attribute:categories_list' => '类别', 'Class:AuditDomain/Attribute:categories_list+' => '关联的审计类别', -)); +]); // // Class: lnkAuditCategoryToAuditDomain // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:lnkAuditCategoryToAuditDomain' => '关联审计类别/审计域', 'Class:lnkAuditCategoryToAuditDomain+' => '', 'Class:lnkAuditCategoryToAuditDomain/Attribute:category_id' => '类别', @@ -88,13 +89,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_id+' => '审计域', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name' => '名称', 'Class:lnkAuditCategoryToAuditDomain/Attribute:domain_name+' => '审计域名称', -)); +]); // // Class: QueryOQL // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:Query' => '查询', 'Class:Query+' => '查询是一种动态的数据集', 'Class:Query/Attribute:name' => '名称', @@ -121,7 +122,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:QueryOQL+' => '一种基于对象查询的语言', 'Class:QueryOQL/Attribute:oql' => '表达式', 'Class:QueryOQL/Attribute:oql+' => 'OQL表达式', -)); +]); ////////////////////////////////////////////////////////////////////// // Classes in 'addon/userrights' @@ -132,7 +133,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( // Class: User // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:User' => '用户', 'Class:User+' => '用户登录名', 'Class:User/Attribute:finalclass' => '账号类型', @@ -178,13 +179,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:User/Warning:NoContactHasImpact' => 'Cautious: there is no Person defined on this User, this prevents access to portals, news notifications and other side effects in back-office~~', 'Class:UserInternal' => '内部用户', 'Class:UserInternal+' => ITOP_APPLICATION_SHORT.'内部定义的用户', -)); +]); // // Class: URP_Profiles // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:URP_Profiles' => '角色', 'Class:URP_Profiles+' => '用户角色', 'Class:URP_Profiles/Attribute:name' => '名称', @@ -193,13 +194,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:URP_Profiles/Attribute:description+' => '单行描述', 'Class:URP_Profiles/Attribute:user_list' => '用户', 'Class:URP_Profiles/Attribute:user_list+' => '拥有此角色的用户', -)); +]); // // Class: URP_Dimensions // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:URP_Dimensions' => '维度', 'Class:URP_Dimensions+' => '应用维度 (定义纵深)', 'Class:URP_Dimensions/Attribute:name' => '名称', @@ -208,13 +209,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:URP_Dimensions/Attribute:description+' => '单行描述', 'Class:URP_Dimensions/Attribute:type' => '类型', 'Class:URP_Dimensions/Attribute:type+' => '类型名称或数据类型 (投影单位)', -)); +]); // // Class: URP_UserProfile // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:URP_UserProfile' => '角色目标用户', 'Class:URP_UserProfile+' => '用户的角色', 'Class:URP_UserProfile/Name' => '关联 %1$s 和 %2$s', @@ -228,14 +229,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:URP_UserProfile/Attribute:profile+' => '角色名称', 'Class:URP_UserProfile/Attribute:reason' => '原因', 'Class:URP_UserProfile/Attribute:reason+' => '解释为什么此用户需要拥有此角色', -)); +]); // // Class: URP_UserOrg // - -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:URP_UserOrg' => '用户组织', 'Class:URP_UserOrg+' => '可以访问的组织', 'Class:URP_UserOrg/Name' => '关联 %1$s 和 %2$s', @@ -249,13 +249,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:URP_UserOrg/Attribute:allowed_org_name+' => '可以访问的组织', 'Class:URP_UserOrg/Attribute:reason' => '原因', 'Class:URP_UserOrg/Attribute:reason+' => '解释为什么此用户可以访问此组织的数据', -)); +]); // // Class: URP_ProfileProjection // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:URP_ProfileProjection' => '角色映射', 'Class:URP_ProfileProjection+' => '角色映射', 'Class:URP_ProfileProjection/Attribute:dimensionid' => '维度', @@ -270,13 +270,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:URP_ProfileProjection/Attribute:value+' => 'OQL 表达式 (使用$user) | constant | | +attribute code', 'Class:URP_ProfileProjection/Attribute:attribute' => '属性', 'Class:URP_ProfileProjection/Attribute:attribute+' => '目标属性编码 (可选)', -)); +]); // // Class: URP_ClassProjection // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:URP_ClassProjection' => '类型映射', 'Class:URP_ClassProjection+' => '类型映射', 'Class:URP_ClassProjection/Attribute:dimensionid' => '维度', @@ -289,13 +289,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:URP_ClassProjection/Attribute:value+' => 'OQL表达式 (使用$this) | constant | | +attribute code', 'Class:URP_ClassProjection/Attribute:attribute' => '属性', 'Class:URP_ClassProjection/Attribute:attribute+' => '目标属性编码 (可选)', -)); +]); // // Class: URP_ActionGrant // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:URP_ActionGrant' => '操作权限', 'Class:URP_ActionGrant+' => '类型权限', 'Class:URP_ActionGrant/Attribute:profileid' => '角色', @@ -312,13 +312,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:URP_ActionGrant/Attribute:permission/Value:no+' => '否', 'Class:URP_ActionGrant/Attribute:action' => '操作', 'Class:URP_ActionGrant/Attribute:action+' => '可用于指定类型上的操作权限', -)); +]); // // Class: URP_StimulusGrant // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:URP_StimulusGrant' => '权限调整', 'Class:URP_StimulusGrant+' => '对象生命周期中权限的调整', 'Class:URP_StimulusGrant/Attribute:profileid' => '角色', @@ -335,25 +335,25 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:URP_StimulusGrant/Attribute:permission/Value:no+' => '否', 'Class:URP_StimulusGrant/Attribute:stimulus' => '调整', 'Class:URP_StimulusGrant/Attribute:stimulus+' => '调整编码', -)); +]); // // Class: URP_AttributeGrant // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:URP_AttributeGrant' => '属性权限', 'Class:URP_AttributeGrant+' => '属性的权限', 'Class:URP_AttributeGrant/Attribute:actiongrantid' => '操作权限', 'Class:URP_AttributeGrant/Attribute:actiongrantid+' => '操作权限', 'Class:URP_AttributeGrant/Attribute:attcode' => '属性', 'Class:URP_AttributeGrant/Attribute:attcode+' => '属性编码', -)); +]); // // Class: UserDashboard // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Class:UserDashboard' => '用户仪表盘', 'Class:UserDashboard+' => '', 'Class:UserDashboard/Attribute:user_id' => '用户', @@ -362,12 +362,12 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Class:UserDashboard/Attribute:menu_code+' => '', 'Class:UserDashboard/Attribute:contents' => '内容', 'Class:UserDashboard/Attribute:contents+' => '', -)); +]); // // Duplicated into itop-welcome-itil ( will be removed from here...) // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Menu:WelcomeMenu' => '欢迎', 'Menu:WelcomeMenu+' => '欢迎使用'.ITOP_APPLICATION_SHORT, 'Menu:WelcomeMenuPage' => '欢迎', @@ -386,13 +386,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Menu:MyShortcuts' => '我的快捷方式', 'Menu:DataAdministration' => '数据管理', 'Menu:DataAdministration+' => '数据管理', -)); +]); // // String from the User Interface: menu, messages, buttons, etc... // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'BooleanLabel:yes' => '是', 'BooleanLabel:no' => '否', 'UI:Login:Title' => ITOP_APPLICATION_SHORT.'登录', @@ -1535,13 +1535,13 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI:Search:Criteria:HierarchicalKey:ChildrenIncluded:Hint' => '将会包含选中对象的子集.', 'UI:Search:Criteria:Raw:Filtered' => '已筛选', 'UI:Search:Criteria:Raw:FilteredOn' => '基于%1$s筛选', - 'UI:StateChanged' => '状态已改变' -)); + 'UI:StateChanged' => '状态已改变', +]); // // Expression to Natural language // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Expression:Operator:AND' => ' 与 ', 'Expression:Operator:OR' => ' 或 ', 'Expression:Operator:=' => ': ', @@ -1554,12 +1554,12 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Expression:Unit:Long:MINUTE' => '分钟', 'Expression:Verb:NOW' => '现在', 'Expression:Verb:ISNULL' => ': 未定义', -)); +]); // // iTop Newsroom menu // -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'UI:Newsroom:NoNewMessage' => '没有新消息', 'UI:Newsroom:XNewMessage' => '%1$s 条新消息', 'UI:Newsroom:MarkAllAsRead' => '标记所有消息为已读', @@ -1574,10 +1574,9 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI:Newsroom:Priority:2:Tooltip' => '紧急', 'UI:Newsroom:Priority:3:Tooltip' => '重要', 'UI:Newsroom:Priority:4:Tooltip' => '普通', -)); +]); - -Dict::Add('ZH CN', 'Chinese', '简体中文', array( +Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'Menu:DataSources' => '同步数据源', 'Menu:DataSources+' => '所有同步数据源', 'Menu:AuditCategories' => '审计类别', @@ -1605,4 +1604,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Menu:Integrations' => '集成', 'Menu:Integrations+' => '~~', -)); +]); diff --git a/index.php b/index.php index 1b66a7dad..f96f6a1a2 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,5 @@ Error: Unable to read the configuration file: '$sConfigFile'. Please check the access rights on this file.

                  "; - } - else if (is_writable($sConfigFile)) - { - require_once (APPROOT.'setup/setuputils.class.inc.php'); - if (SetupUtils::IsInReadOnlyMode()) - { + } elseif (is_writable($sConfigFile)) { + require_once(APPROOT.'setup/setuputils.class.inc.php'); + if (SetupUtils::IsInReadOnlyMode()) { echo "

                  Warning: the application is currently in maintenance, please wait.

                  "; echo "

                  Click here to ignore this warning and continue to run iTop in read-only mode.

                  "; - } - else - { + } else { echo <<Security Warning: the configuration file '{$sConfigFile}' should be read-only.

                  Please modify the access rights to this file.

                  Click here to ignore this warning and continue to run iTop.

                  HTML; } - } - else - { + } else { header("Location: $sStartPage"); } -} -else -{ +} else { // Config file does not exist, need to run the setup wizard to create it header("Location: $sSetupPage"); } diff --git a/log/index.php b/log/index.php index 112807643..fcb6f20af 100644 --- a/log/index.php +++ b/log/index.php @@ -1,2 +1,3 @@ 0) { TwigHelper::RenderIntoPage($oP, APPROOT."/", "templates/application/welcome-popup/layout", [ "aProvidersMessagesData" => $aProvidersMessagesData, - "sEndpointAbsURIForAcknowledgeMessage" => Router::GetInstance()->GenerateUrl(WelcomePopupController::ROUTE_NAMESPACE . ".acknowledge_message"), + "sEndpointAbsURIForAcknowledgeMessage" => Router::GetInstance()->GenerateUrl(WelcomePopupController::ROUTE_NAMESPACE.".acknowledge_message"), ]); } Session::Set("welcome", "ok"); // Try just once per session @@ -63,33 +64,26 @@ function ApplyNextAction(Webpage $oP, CMDBObject $oObj, $sNextAction) { // Here handle the apply stimulus $aTransitions = $oObj->EnumTransitions(); - if (!isset($aTransitions[$sNextAction])) - { + if (!isset($aTransitions[$sNextAction])) { // Invalid stimulus throw new ApplicationException(Dict::Format('UI:Error:Invalid_Stimulus_On_Object_In_State', $sNextAction, $oObj->GetName(), $oObj->GetStateLabel())); } // Get the list of missing mandatory fields for the target state, considering only the changes from the previous form (i.e don't prompt twice) $aExpectedAttributes = $oObj->GetTransitionAttributes($sNextAction); - - if (count($aExpectedAttributes) == 0) - { + + if (count($aExpectedAttributes) == 0) { // If all the mandatory fields are already present, just apply the transition silently... - if ($oObj->ApplyStimulus($sNextAction)) - { + if ($oObj->ApplyStimulus($sNextAction)) { $oObj->DBUpdate(); - } - else - { + } else { throw new ApplicationException(Dict::S('UI:FailedToApplyStimuli')); } ReloadAndDisplay($oP, $oObj); - } - else - { + } else { // redirect to the 'stimulus' action $oAppContext = new ApplicationContext(); -//echo "

                  Missing Attributes

                  ".print_r($aExpectedAttributes, true)."

                  \n"; - + //echo "

                  Missing Attributes

                  ".print_r($aExpectedAttributes, true)."

                  \n"; + $oP->add_header('Location: '.utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=stimulus&class='.get_class($oObj).'&stimulus='.$sNextAction.'&id='.$oObj->getKey().$oAppContext->GetForLink(true)); } } @@ -97,8 +91,7 @@ function ApplyNextAction(Webpage $oP, CMDBObject $oObj, $sNextAction) function ReloadAndDisplay($oPage, $oObj, $sMessageId = '', $sMessage = '', $sSeverity = null) { $oAppContext = new ApplicationContext(); - if ($sMessageId != '') - { + if ($sMessageId != '') { cmdbAbstractObject::SetSessionMessage(get_class($oObj), $oObj->GetKey(), $sMessageId, $sMessage, $sSeverity, 0, true /* must not exist */); } $oPage->add_header('Location: '.utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=details&class='.get_class($oObj).'&id='.$oObj->getKey().$oAppContext->GetForLink(true)); @@ -126,8 +119,7 @@ function SetObjectBreadCrumbEntry(DBObject $oObj, WebPage $oPage) $sClass = get_class($oObj); // get the leaf class $sIcon = MetaModel::GetClassIcon($sClass, false); $sIconType = iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_IMAGE; - if ($sIcon == '') - { + if ($sIcon == '') { $sIcon = 'fas fa-cube'; $sIconType = iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES; } @@ -221,7 +213,7 @@ function DisplayMultipleSelectionForm(WebPage $oP, DBSearch $oFilter, string $sN { $oAppContext = new ApplicationContext(); $iBulkActionAllowed = $oChecker->IsAllowed(); - $aExtraParams = array('selection_type' => 'multiple', 'selection_mode' => true, 'display_limit' => false, 'menu' => false); + $aExtraParams = ['selection_type' => 'multiple', 'selection_mode' => true, 'display_limit' => false, 'menu' => false]; if ($iBulkActionAllowed == UR_ALLOWED_DEPENDS) { $aExtraParams['selection_enabled'] = $oChecker->GetAllowedIDs(); } else { @@ -243,12 +235,12 @@ function DisplayMultipleSelectionForm(WebPage $oP, DBSearch $oFilter, string $sN $oDisplayBlock = new DisplayBlock($oFilter, 'list', false); //by default all the elements are selected $aExtraParams['selectionMode'] = 'negative'; - if(array_key_exists('icon', $aDisplayParams) || array_key_exists('title', $aDisplayParams)){ + if (array_key_exists('icon', $aDisplayParams) || array_key_exists('title', $aDisplayParams)) { $aExtraParams['surround_with_panel'] = true; - if(array_key_exists('icon', $aDisplayParams)){ + if (array_key_exists('icon', $aDisplayParams)) { $aExtraParams['panel_icon'] = $aDisplayParams['icon']; - } - if(array_key_exists('title', $aDisplayParams)){ + } + if (array_key_exists('title', $aDisplayParams)) { $aExtraParams['panel_title'] = $aDisplayParams['title']; } } @@ -295,7 +287,7 @@ function DisplayNavigatorGroupTab($oP) } /*********************************************************************************** - * + * * Main user interface page starts here * ***********************************************************************************/ @@ -305,8 +297,7 @@ require_once(APPROOT.'/application/wizardhelper.class.inc.php'); require_once(APPROOT.'/application/startup.inc.php'); IssueLog::Trace('----- Request: '.utils::GetRequestUri(), LogChannels::WEB_REQUEST); -try -{ +try { $oKPI = new ExecutionKPI(); $oKPI->ComputeAndReport('Data model loaded'); @@ -342,8 +333,7 @@ try $oP->SetMessage($sLoginMessage); // All the following actions use advanced forms that require more javascript to be loaded - switch($operation) - { + switch ($operation) { case 'new': // Form to create a new object case 'form_for_modify_all': // Form to modify multiple objects (bulk modify) case 'bulk_stimulus': // For to apply a stimulus to multiple objects @@ -355,8 +345,7 @@ try break; } - switch($operation) - { + switch ($operation) { /////////////////////////////////////////////////////////////////////////////////////////// case 'details': // Details of an object @@ -394,30 +383,20 @@ try utils::PushArchiveMode(true); if (is_numeric($id)) { $oObj = MetaModel::GetObject($sClass, $id, false /* MustBeFound */); - } - else - { + } else { $oObj = MetaModel::GetObjectByName($sClass, $id, false /* MustBeFound */); } utils::PopArchiveMode(); - if (is_null($oObj)) - { + if (is_null($oObj)) { $oP->P(Dict::S('UI:ObjectDoesNotExist')); - } - else - { + } else { SetObjectBreadCrumbEntry($oObj, $oP); $oP->P(Dict::S('UI:ObjectArchived')); } - } - else - { - try - { + } else { + try { $oObj->Reload(); - } - catch(Exception $e) - { + } catch (Exception $e) { // Probably not allowed to see this instance of a derived class // Check anyhow if there is a message for this object (like you've just created it) @@ -428,14 +407,13 @@ try $oP->set_title(Dict::S('UI:ErrorPageTitle')); $oP->P(Dict::S('UI:ObjectDoesNotExist')); } - if (!is_null($oObj)) - { + if (!is_null($oObj)) { SetObjectBreadCrumbEntry($oObj, $oP); // The object could be listed, check if it is actually allowed to view it $oSet = CMDBObjectSet::FromObject($oObj); if (UserRights::IsActionAllowed($sClass, UR_ACTION_READ, $oSet) == UR_ALLOWED_NO) { - throw new SecurityException('User not allowed to view this object', array('class' => $sClass, 'id' => $id)); + throw new SecurityException('User not allowed to view this object', ['class' => $sClass, 'id' => $id]); } $sClassLabel = MetaModel::GetName($sClass); @@ -444,28 +422,27 @@ try $oObj->DisplayDetails($oP); } } - break; + break; case 'release_lock_and_details': - $oP->DisableBreadCrumb(); + $oP->DisableBreadCrumb(); - // Retrieve object - $sClass = utils::ReadParam('class', '', false, 'class'); - $id = utils::ReadParam('id', ''); - $oObj = MetaModel::GetObject($sClass, $id); + // Retrieve object + $sClass = utils::ReadParam('class', '', false, 'class'); + $id = utils::ReadParam('id', ''); + $oObj = MetaModel::GetObject($sClass, $id); - // Retrieve ownership token - $sToken = utils::ReadParam('token', ''); - if ($sToken != '') - { - iTopOwnershipLock::ReleaseLock($sClass, $id, $sToken); - } + // Retrieve ownership token + $sToken = utils::ReadParam('token', ''); + if ($sToken != '') { + iTopOwnershipLock::ReleaseLock($sClass, $id, $sToken); + } - $oP->SetContentLayout(PageContentFactory::MakeForObjectDetails($oObj, cmdbAbstractObject::ENUM_DISPLAY_MODE_VIEW)); - cmdbAbstractObject::ReloadAndDisplay($oP, $oObj, array('operation' => 'details')); - break; + $oP->SetContentLayout(PageContentFactory::MakeForObjectDetails($oObj, cmdbAbstractObject::ENUM_DISPLAY_MODE_VIEW)); + cmdbAbstractObject::ReloadAndDisplay($oP, $oObj, ['operation' => 'details']); + break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'search_oql': // OQL query $oSearchContext = new ContextTag(ContextTag::TAG_OBJECT_SEARCH); @@ -484,22 +461,20 @@ try try { $oFilter = DBObjectSearch::FromOQL($sOQL); DisplaySearchSet($oP, $oFilter, $bSearchForm, $sBaseClass, $sFormat); - } - catch(CoreException $e) { + } catch (CoreException $e) { $oFilter = new DBObjectSearch($sOQLClass); $oSet = new DBObjectSet($oFilter); if ($bSearchForm) { $oBlock = new DisplayBlock($oFilter, 'search', false); - $oBlock->Display($oP, 0, array('table_id' => 'search-widget-result-outer')); + $oBlock->Display($oP, 0, ['table_id' => 'search-widget-result-outer']); } $oP->add('

                  '.Dict::Format('UI:Error:IncorrectOQLQuery_Message', $e->getHtmlDesc()).'

                  '); - } - catch(Exception $e) { + } catch (Exception $e) { $oP->P(''.Dict::Format('UI:Error:AnErrorOccuredWhileRunningTheQuery_Message', $e->getMessage()).''); } break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'search_form': // Search form $oSearchContext = new ContextTag(ContextTag::TAG_OBJECT_SEARCH); @@ -515,15 +490,14 @@ try DisplaySearchSet($oP, $oFilter, $bSearchForm, '' /* sBaseClass */, $sFormat, $bDoSearch, true /* Search Form Expanded */); break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'search': // Serialized DBSearch $oSearchContext = new ContextTag(ContextTag::TAG_OBJECT_SEARCH); $sFilter = utils::ReadParam('filter', '', false, 'raw_data'); $sFormat = utils::ReadParam('format', ''); $bSearchForm = utils::ReadParam('search_form', true); - if (empty($sFilter)) - { + if (empty($sFilter)) { throw new ApplicationException(Dict::Format('UI:Error:1ParametersMissing', 'filter')); } $oP->set_title(Dict::S('UI:SearchResultsPageTitle')); @@ -532,48 +506,38 @@ try //FIXME Params won't work as expected :( // During the ajax call fetching the datatable data, the URL is rewritten and the info are lost, and we are getting a worse result :( -// $sParams = utils::ReadParam('aParams', '{}', false, \utils::ENUM_SANITIZATION_FILTER_RAW_DATA); -// $aParams = json_decode($sParams, true); + // $sParams = utils::ReadParam('aParams', '{}', false, \utils::ENUM_SANITIZATION_FILTER_RAW_DATA); + // $aParams = json_decode($sParams, true); DisplaySearchSet($oP, $oFilter, $bSearchForm, '' /* sBaseClass */, $sFormat); //, true, true, $aParams break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'full_text': // Global "google-like" search $oP->DisableBreadCrumb(); $sQuery = trim(utils::ReadParam('text', '', false, 'raw_data')); $iTune = utils::ReadParam('tune', 0); - if (empty($sQuery)) - { + if (empty($sQuery)) { $oP->p(Dict::S('UI:Search:NoSearch')); - } - else - { + } else { $iErrors = 0; $sFullText = $sQuery; // Check if a class name/label is supplied to limit the search $sClassName = ''; - if (preg_match('/^([^\"]+):(.+)$/', $sFullText, $aMatches)) - { + if (preg_match('/^([^\"]+):(.+)$/', $sFullText, $aMatches)) { $sClassName = $aMatches[1]; - if (MetaModel::IsValidClass($sClassName)) - { + if (MetaModel::IsValidClass($sClassName)) { $sFullText = trim($aMatches[2]); - } - elseif ($sClassName = MetaModel::GetClassFromLabel($sClassName, false /* => not case sensitive */)) - { + } elseif ($sClassName = MetaModel::GetClassFromLabel($sClassName, false /* => not case sensitive */)) { $sFullText = trim($aMatches[2]); } } - if (preg_match('/^"(.*)"$/', $sFullText, $aMatches)) - { + if (preg_match('/^"(.*)"$/', $sFullText, $aMatches)) { // The text is surrounded by double-quotes, remove the quotes and treat it as one single expression - $aFullTextNeedles = array($aMatches[1]); - } - else - { + $aFullTextNeedles = [$aMatches[1]]; + } else { // Split the text on the blanks and treat this as a search for AND AND $aExplodedFullTextNeedles = explode(' ', $sFullText); $aFullTextNeedles = []; @@ -587,7 +551,7 @@ try // Save search to history // - Prepare icon $sQueryIconUrl = null; - if(!empty($sClassName)) { + if (!empty($sClassName)) { $sQueryIconUrl = MetaModel::GetClassIcon($sClassName, false); } // - Prepare label @@ -604,14 +568,12 @@ try if (strlen($sNeedle) < $iMinLenth) { $oP->p(Dict::Format('UI:Search:NeedleTooShort', $sNeedle, $iMinLenth)); $key = array_search($sNeedle, $aFullTextNeedles); - if ($key !== false) - { + if ($key !== false) { unset($aFullTextNeedles[$key]); } } } - if(empty($aFullTextNeedles)) - { + if (empty($aFullTextNeedles)) { $oP->p(Dict::S('UI:Search:NoSearch')); break; } @@ -620,30 +582,23 @@ try // Sanity check of the accelerators /** @var array $aAccelerators */ $aAccelerators = MetaModel::GetConfig()->Get('full_text_accelerators'); - foreach ($aAccelerators as $sClass => $aAccelerator) - { - try - { + foreach ($aAccelerators as $sClass => $aAccelerator) { + try { $bSkip = array_key_exists('skip', $aAccelerator) ? $aAccelerator['skip'] : false; - if (!$bSkip) - { + if (!$bSkip) { $oSearch = DBObjectSearch::FromOQL($aAccelerator['query']); - if ($sClass != $oSearch->GetClass()) - { + if ($sClass != $oSearch->GetClass()) { $oP->p("Full text accelerator for class '$sClass': searched class mismatch (".$oSearch->GetClass().")"); $iErrors++; } } - } - catch (OqlException $e) - { + } catch (OqlException $e) { $oP->p("Full text accelerator for class '$sClass': ".$e->getHtmlDesc()); $iErrors++; } } - if ($iErrors == 0) - { + if ($iErrors == 0) { $oP->set_title(Dict::S('UI:SearchResultsPageTitle')); $sPageId = "ui-global-search"; $sLabel = Dict::S('UI:SearchResultsTitle'); @@ -651,7 +606,7 @@ try $oP->SetBreadCrumbEntry($sPageId, $sLabel, $sDescription, '', 'fas fa-search', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); $oP->add("
                  \n"); $oP->add("
                  \n"); - $oP->add(' '.Dict::Format('UI:Search:Ongoing', utils::EscapeHtml($sFullText)).''); + $oP->add(' '.Dict::Format('UI:Search:Ongoing', utils::EscapeHtml($sFullText)).''); $oP->add("
                  \n"); $oP->add("
                  \n"); $oP->add("
                   
                  \n"); @@ -668,63 +623,61 @@ try }); EOF ); - if ($iTune > 0) - { + if ($iTune > 0) { $oP->add_script("var oTimeStatistics = {};"); } } } - break; + break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// - /** @deprecated 3.1.0 Use the "object.modify" route instead */ - // Kept for backward compatibility with notification URLs, don't remove + /** @deprecated 3.1.0 Use the "object.modify" route instead */ + // Kept for backward compatibility with notification URLs, don't remove case 'modify': // Legacy operation $oController = new ObjectController(); $oP = $oController->OperationModify(); break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'select_for_modify_all': // Select the list of objects to be modified (bulk modify) UI::OperationSelectForModifyAll($oP); break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'form_for_modify_all': // Form to modify multiple objects (bulk modify) UI::OperationFormForModifyAll($oP, $oAppContext); break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'preview_or_modify_all': // Preview or apply bulk modify UI::OperationPreviewOrModifyAll($oP, $oAppContext); break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// - /** @deprecated 3.1.0 Use the "object.new" route instead */ - // Kept for backward compatibility + /** @deprecated 3.1.0 Use the "object.new" route instead */ + // Kept for backward compatibility case 'new': // Form to create a new object $oController = new ObjectController(); $oP = $oController->OperationNew(); - break; + break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'apply_modify': // Applying the modifications to an existing object $oController = new ObjectController(); $oP = $oController->OperationApplyModify(); - break; + break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'select_for_deletion': // Select multiple objects for deletion $oP->DisableBreadCrumb(); $sFilter = utils::ReadParam('filter', '', false, 'raw_data'); - if (empty($sFilter)) - { + if (empty($sFilter)) { throw new ApplicationException(Dict::Format('UI:Error:1ParametersMissing', 'filter')); } $oP->set_title(Dict::S('UI:BulkDeletePageTitle')); @@ -740,68 +693,57 @@ try ]; $oChecker = new ActionChecker($oFilter, UR_ACTION_BULK_DELETE); DisplayMultipleSelectionForm($oP, $oFilter, 'bulk_delete', $oChecker, [], $aDisplayParams); - break; + break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'bulk_delete_confirmed': // Confirm bulk deletion of objects $oP->DisableBreadCrumb(); $sTransactionId = utils::ReadPostedParam('transaction_id', '', 'transaction_id'); - if (!utils::IsTransactionValid($sTransactionId)) - { + if (!utils::IsTransactionValid($sTransactionId)) { $sUser = UserRights::GetUser(); $sClass = utils::ReadParam('class', '', false, 'class'); IssueLog::Error("UI.php '$operation' : invalid transaction_id ! data: user='$sUser', class='$sClass'"); throw new ApplicationException(Dict::S('UI:Error:ObjectsAlreadyDeleted')); } - // Fall through + // Fall through - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// + // no break case 'delete': case 'bulk_delete': // Actual bulk deletion (if confirmed) $oP->DisableBreadCrumb(); $sClass = utils::ReadParam('class', '', false, 'class'); $sClassLabel = MetaModel::GetName($sClass); - $aObjects = array(); - if ($operation == 'delete') - { + $aObjects = []; + if ($operation == 'delete') { // Single object $id = utils::ReadParam('id', ''); $oObj = MetaModel::GetObject($sClass, $id); $aObjects[] = $oObj; - if (!UserRights::IsActionAllowed($sClass, UR_ACTION_DELETE, DBObjectSet::FromObject($oObj))) - { + if (!UserRights::IsActionAllowed($sClass, UR_ACTION_DELETE, DBObjectSet::FromObject($oObj))) { throw new SecurityException(Dict::Format('UI:Error:DeleteNotAllowedOn_Class', $sClassLabel)); } - } - else - { + } else { // Several objects $sFilter = utils::ReadPostedParam('filter', '', 'raw_data'); $oFullSetFilter = DBObjectSearch::unserialize($sFilter); // Add user filter $oFullSetFilter->UpdateContextFromUser(); $aSelectObject = utils::ReadMultipleSelection($oFullSetFilter); - if ( empty($sClass) || empty($aSelectObject)) // TO DO: check that the class name is valid ! - { + if (empty($sClass) || empty($aSelectObject)) { // TO DO: check that the class name is valid ! throw new ApplicationException(Dict::Format('UI:Error:2ParametersMissing', 'class', 'selectObject[]')); } - foreach($aSelectObject as $iId) - { + foreach ($aSelectObject as $iId) { $aObjects[] = MetaModel::GetObject($sClass, $iId); } - if (count($aObjects) == 1) - { - if (!UserRights::IsActionAllowed($sClass, UR_ACTION_DELETE, DBObjectSet::FromArray($sClass, $aObjects))) - { + if (count($aObjects) == 1) { + if (!UserRights::IsActionAllowed($sClass, UR_ACTION_DELETE, DBObjectSet::FromArray($sClass, $aObjects))) { throw new SecurityException(Dict::Format('UI:Error:BulkDeleteNotAllowedOn_Class', $sClassLabel)); } - } - else - { - if (!UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_DELETE, DBObjectSet::FromArray($sClass, $aObjects))) - { + } else { + if (!UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_DELETE, DBObjectSet::FromArray($sClass, $aObjects))) { throw new SecurityException(Dict::Format('UI:Error:BulkDeleteNotAllowedOn_Class', $sClassLabel)); } $oP->set_title(Dict::S('UI:BulkDeletePageTitle')); @@ -811,7 +753,7 @@ try cmdbAbstractObject::DeleteObjects($oP, $sClass, $aObjects, ($operation != 'bulk_delete_confirmed'), 'bulk_delete_confirmed'); break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'apply_new': // Creation of a new object @@ -819,700 +761,615 @@ try $oP = $oController->OperationApplyNew(); break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'select_bulk_stimulus': // Form displayed when applying a stimulus to many objects - $oP->DisableBreadCrumb(); - $sFilter = utils::ReadParam('filter', '', false, 'raw_data'); - $sStimulus = utils::ReadParam('stimulus', ''); - $sState = utils::ReadParam('state', ''); - if (empty($sFilter) || empty($sStimulus) || empty($sState)) - { - throw new ApplicationException(Dict::Format('UI:Error:3ParametersMissing', 'filter', 'stimulus', 'state')); - } - $oFilter = DBObjectSearch::unserialize($sFilter); - $oFilter->UpdateContextFromUser(); - $sClass = $oFilter->GetClass(); - $aStimuli = MetaModel::EnumStimuli($sClass); - $sActionLabel = $aStimuli[$sStimulus]->GetLabel(); - $sActionDetails = $aStimuli[$sStimulus]->GetDescription(); - $oP->set_title($sActionLabel); - $sClass = $oFilter->GetClass(); - - $aDisplayParams = [ - 'icon' => MetaModel::GetClassIcon($sClass, false), - 'title' => $sActionLabel, - ]; - $oChecker = new StimulusChecker($oFilter, $sState, $sStimulus); - $aExtraFormParams = array('stimulus' => $sStimulus, 'state' => $sState); - DisplayMultipleSelectionForm($oP, $oFilter, 'bulk_stimulus', $oChecker, $aExtraFormParams, $aDisplayParams); - break; - - case 'bulk_stimulus': - $oP->DisableBreadCrumb(); - $sFilter = utils::ReadParam('filter', '', false, 'raw_data'); - $sStimulus = utils::ReadParam('stimulus', ''); - $sState = utils::ReadParam('state', ''); - if (empty($sFilter) || empty($sStimulus) || empty($sState)) - { - throw new ApplicationException(Dict::Format('UI:Error:3ParametersMissing', 'filter', 'stimulus', 'state')); - } - $oFilter = DBObjectSearch::unserialize($sFilter); - // Add user filter - $oFilter->UpdateContextFromUser(); - $sClass = $oFilter->GetClass(); - $aSelectObject = utils::ReadMultipleSelection($oFilter); - if (count($aSelectObject) == 0) - { - // Nothing to do, no object was selected ! - throw new ApplicationException(Dict::S('UI:BulkAction:NoObjectSelected')); - } - else - { - $aTransitions = MetaModel::EnumTransitions($sClass, $sState); + $oP->DisableBreadCrumb(); + $sFilter = utils::ReadParam('filter', '', false, 'raw_data'); + $sStimulus = utils::ReadParam('stimulus', ''); + $sState = utils::ReadParam('state', ''); + if (empty($sFilter) || empty($sStimulus) || empty($sState)) { + throw new ApplicationException(Dict::Format('UI:Error:3ParametersMissing', 'filter', 'stimulus', 'state')); + } + $oFilter = DBObjectSearch::unserialize($sFilter); + $oFilter->UpdateContextFromUser(); + $sClass = $oFilter->GetClass(); $aStimuli = MetaModel::EnumStimuli($sClass); - $sActionLabel = $aStimuli[$sStimulus]->GetLabel(); $sActionDetails = $aStimuli[$sStimulus]->GetDescription(); - $sTargetState = $aTransitions[$sStimulus]['target_state']; - $aStates = MetaModel::EnumStates($sClass); - $aTargetStateDef = $aStates[$sTargetState]; + $oP->set_title($sActionLabel); + $sClass = $oFilter->GetClass(); - $oP->set_title(Dict::Format('UI:StimulusModify_N_ObjectsOf_Class', $sActionLabel, count($aSelectObject), $sClass)); - $oP->add(<< MetaModel::GetClassIcon($sClass, false), + 'title' => $sActionLabel, + ]; + $oChecker = new StimulusChecker($oFilter, $sState, $sStimulus); + $aExtraFormParams = ['stimulus' => $sStimulus, 'state' => $sState]; + DisplayMultipleSelectionForm($oP, $oFilter, 'bulk_stimulus', $oChecker, $aExtraFormParams, $aDisplayParams); + break; + + case 'bulk_stimulus': + $oP->DisableBreadCrumb(); + $sFilter = utils::ReadParam('filter', '', false, 'raw_data'); + $sStimulus = utils::ReadParam('stimulus', ''); + $sState = utils::ReadParam('state', ''); + if (empty($sFilter) || empty($sStimulus) || empty($sState)) { + throw new ApplicationException(Dict::Format('UI:Error:3ParametersMissing', 'filter', 'stimulus', 'state')); + } + $oFilter = DBObjectSearch::unserialize($sFilter); + // Add user filter + $oFilter->UpdateContextFromUser(); + $sClass = $oFilter->GetClass(); + $aSelectObject = utils::ReadMultipleSelection($oFilter); + if (count($aSelectObject) == 0) { + // Nothing to do, no object was selected ! + throw new ApplicationException(Dict::S('UI:BulkAction:NoObjectSelected')); + } else { + $aTransitions = MetaModel::EnumTransitions($sClass, $sState); + $aStimuli = MetaModel::EnumStimuli($sClass); + + $sActionLabel = $aStimuli[$sStimulus]->GetLabel(); + $sActionDetails = $aStimuli[$sStimulus]->GetDescription(); + $sTargetState = $aTransitions[$sStimulus]['target_state']; + $aStates = MetaModel::EnumStates($sClass); + $aTargetStateDef = $aStates[$sTargetState]; + + $oP->set_title(Dict::Format('UI:StimulusModify_N_ObjectsOf_Class', $sActionLabel, count($aSelectObject), $sClass)); + $oP->add( + <<
                  HTML - ); - $oP->AddUiBlock(TitleUIBlockFactory::MakeForPage(Dict::Format('UI:StimulusModify_N_ObjectsOf_Class', $sActionLabel, count($aSelectObject), $sClass))); - if (!empty($sActionDetails)) { - $oP->AddUiBlock(TitleUIBlockFactory::MakeForPage($sActionDetails)); - } - - - - $aExpectedAttributes = MetaModel::GetTransitionAttributes($sClass, $sStimulus, $sState); - $aDetails = array(); - $sFormId = 'apply_stimulus'; - $sFormPrefix = $sFormId.'_'; - $iFieldIndex = 0; - $aFieldsMap = array(); - $aValues = array(); - $aObjects = array(); - foreach($aSelectObject as $iId) - { - $aObjects[] = MetaModel::GetObject($sClass, $iId); - } - $oSet = DBObjectSet::FromArray($sClass, $aObjects); - $oObj = $oSet->ComputeCommonObject($aValues); - $sStateAttCode = MetaModel::GetStateAttributeCode($sClass); - $oObj->Set($sStateAttCode,$sTargetState); - $sReadyScript = ''; - foreach($aExpectedAttributes as $sAttCode => $iExpectCode) - { - $sFieldInputId = $sFormPrefix.$sAttCode; - // Prompt for an attribute if - // - the attribute must be changed or must be displayed to the user for confirmation - // - or the field is mandatory and currently empty - if ( ($iExpectCode & (OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) || - (($iExpectCode & OPT_ATT_MANDATORY) && ($oObj->Get($sAttCode) == '')) ) - { - $aAttributesDef = MetaModel::ListAttributeDefs($sClass); - $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - $aPrerequisites = MetaModel::GetPrerequisiteAttributes($sClass, $sAttCode); // List of attributes that are needed for the current one - if (count($aPrerequisites) > 0) - { - // When 'enabling' a field, all its prerequisites must be enabled too - $sFieldList = "['{$sFormPrefix}".implode("','{$sFormPrefix}", $aPrerequisites)."']"; - $oP->add_ready_script("$('#enable_{$sFieldInputId}').on('change', function(evt, sFormId) { return PropagateCheckBox( this.checked, $sFieldList, true); } );\n"); - } - $aDependents = MetaModel::GetDependentAttributes($sClass, $sAttCode); // List of attributes that are needed for the current one - if (count($aDependents) > 0) - { - // When 'disabling' a field, all its dependent fields must be disabled too - $sFieldList = "['{$sFormPrefix}".implode("','{$sFormPrefix}", $aDependents)."']"; - $oP->add_ready_script("$('#enable_{$sFieldInputId}').on('change', function(evt, sFormId) { return PropagateCheckBox( this.checked, $sFieldList, false); } );\n"); - } - $aArgs = array('this' => $oObj); - $sHTMLValue = cmdbAbstractObject::GetFormElementForField($oP, $sClass, $sAttCode, $oAttDef, $oObj->Get($sAttCode), $oObj->GetEditValue($sAttCode), $sFieldInputId, '', $iExpectCode, $aArgs); - $sComments = ''; - if (!isset($aValues[$sAttCode])) - { - $aValues[$sAttCode] = array(); - } - if (count($aValues[$sAttCode]) == 1) - { - $sComments = '
                  1'.$sComments.'
                  '; - } - else - { - // Non-homogenous value - $iMaxCount = 5; - $sTip = "

                  ".Dict::Format('UI:BulkModify_Count_DistinctValues', count($aValues[$sAttCode]))."

                    "; - $index = 0; - foreach($aValues[$sAttCode] as $sCurrValue => $aVal) - { - $sDisplayValue = empty($aVal['display']) ? ''.Dict::S('Enum:Undefined').'' : str_replace(array("\n", "\r"), " ", $aVal['display']); - $sTip .= "
                  • ".Dict::Format('UI:BulkModify:Value_Exists_N_Times', $sDisplayValue, $aVal['count'])."
                  • "; - $index++; - if ($iMaxCount == $index) - { - $sTip .= "
                  • ".Dict::Format('UI:BulkModify:N_MoreValues', count($aValues[$sAttCode]) - $iMaxCount)."
                  • "; - break; - } - } - $sTip .= "

                  "; - $sTip = utils::HtmlEntities($sTip); - $sComments = '
                  '.count($aValues[$sAttCode]).$sComments.'
                  '; - } - $aDetails[] = array('label' => ''.$oAttDef->GetLabel().'', 'value' => "$sHTMLValue", 'comments' => $sComments); - $aFieldsMap[$sAttCode] = $sFieldInputId; - $iFieldIndex++; + ); + $oP->AddUiBlock(TitleUIBlockFactory::MakeForPage(Dict::Format('UI:StimulusModify_N_ObjectsOf_Class', $sActionLabel, count($aSelectObject), $sClass))); + if (!empty($sActionDetails)) { + $oP->AddUiBlock(TitleUIBlockFactory::MakeForPage($sActionDetails)); } - } - $oFormContainer = new UIContentBlock(null, ['ibo-wizard-container']); - $oP->AddUiBlock($oFormContainer); - $oForm = new Combodo\iTop\Application\UI\Base\Component\Form\Form($sFormId); - $oFormContainer->AddSubBlock($oForm); - $oForm->SetOnSubmitJsCode("return OnSubmit('{$sFormId}');") - ->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $sClass)) - ->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', 'bulk_apply_stimulus')) - ->AddSubBlock(InputUIBlockFactory::MakeForHidden('stimulus', $sStimulus)) - ->AddSubBlock(InputUIBlockFactory::MakeForHidden('preview_mode', 1)) - ->AddSubBlock(InputUIBlockFactory::MakeForHidden('filter', utils::HtmlEntities($sFilter))) - ->AddSubBlock(InputUIBlockFactory::MakeForHidden('state', $sState)) - ->AddSubBlock(InputUIBlockFactory::MakeForHidden('selectObject', implode(',',$aSelectObject))) - ->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', utils::GetNewTransactionId())); - $aContextInputBlocks = $oAppContext->GetForUIForm(); - foreach ($aContextInputBlocks as $oContextInputBlock){ - $oForm->AddSubBlock($oContextInputBlock); - } - // Note: Remove the table if we want fields to occupy the whole width of the container - $oForm->AddHtml('
        ".$sLabel."
        $sField$sDate$sTime$sDate$sField$sField$sField$sField
        '); - $oForm->AddHtml($oP->GetDetails($aDetails)); - $oForm->AddHtml('
        '); + $aExpectedAttributes = MetaModel::GetTransitionAttributes($sClass, $sStimulus, $sState); + $aDetails = []; + $sFormId = 'apply_stimulus'; + $sFormPrefix = $sFormId.'_'; + $iFieldIndex = 0; + $aFieldsMap = []; + $aValues = []; + $aObjects = []; + foreach ($aSelectObject as $iId) { + $aObjects[] = MetaModel::GetObject($sClass, $iId); + } + $oSet = DBObjectSet::FromArray($sClass, $aObjects); + $oObj = $oSet->ComputeCommonObject($aValues); + $sStateAttCode = MetaModel::GetStateAttributeCode($sClass); + $oObj->Set($sStateAttCode, $sTargetState); + $sReadyScript = ''; + foreach ($aExpectedAttributes as $sAttCode => $iExpectCode) { + $sFieldInputId = $sFormPrefix.$sAttCode; + // Prompt for an attribute if + // - the attribute must be changed or must be displayed to the user for confirmation + // - or the field is mandatory and currently empty + if (($iExpectCode & (OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) || + (($iExpectCode & OPT_ATT_MANDATORY) && ($oObj->Get($sAttCode) == ''))) { + $aAttributesDef = MetaModel::ListAttributeDefs($sClass); + $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); + $aPrerequisites = MetaModel::GetPrerequisiteAttributes($sClass, $sAttCode); // List of attributes that are needed for the current one + if (count($aPrerequisites) > 0) { + // When 'enabling' a field, all its prerequisites must be enabled too + $sFieldList = "['{$sFormPrefix}".implode("','{$sFormPrefix}", $aPrerequisites)."']"; + $oP->add_ready_script("$('#enable_{$sFieldInputId}').on('change', function(evt, sFormId) { return PropagateCheckBox( this.checked, $sFieldList, true); } );\n"); + } + $aDependents = MetaModel::GetDependentAttributes($sClass, $sAttCode); // List of attributes that are needed for the current one + if (count($aDependents) > 0) { + // When 'disabling' a field, all its dependent fields must be disabled too + $sFieldList = "['{$sFormPrefix}".implode("','{$sFormPrefix}", $aDependents)."']"; + $oP->add_ready_script("$('#enable_{$sFieldInputId}').on('change', function(evt, sFormId) { return PropagateCheckBox( this.checked, $sFieldList, false); } );\n"); + } + $aArgs = ['this' => $oObj]; + $sHTMLValue = cmdbAbstractObject::GetFormElementForField($oP, $sClass, $sAttCode, $oAttDef, $oObj->Get($sAttCode), $oObj->GetEditValue($sAttCode), $sFieldInputId, '', $iExpectCode, $aArgs); + $sComments = ''; + if (!isset($aValues[$sAttCode])) { + $aValues[$sAttCode] = []; + } + if (count($aValues[$sAttCode]) == 1) { + $sComments = '
        1'.$sComments.'
        '; + } else { + // Non-homogenous value + $iMaxCount = 5; + $sTip = "

        ".Dict::Format('UI:BulkModify_Count_DistinctValues', count($aValues[$sAttCode]))."

          "; + $index = 0; + foreach ($aValues[$sAttCode] as $sCurrValue => $aVal) { + $sDisplayValue = empty($aVal['display']) ? ''.Dict::S('Enum:Undefined').'' : str_replace(["\n", "\r"], " ", $aVal['display']); + $sTip .= "
        • ".Dict::Format('UI:BulkModify:Value_Exists_N_Times', $sDisplayValue, $aVal['count'])."
        • "; + $index++; + if ($iMaxCount == $index) { + $sTip .= "
        • ".Dict::Format('UI:BulkModify:N_MoreValues', count($aValues[$sAttCode]) - $iMaxCount)."
        • "; + break; + } + } + $sTip .= "

        "; + $sTip = utils::HtmlEntities($sTip); + $sComments = '
        '.count($aValues[$sAttCode]).$sComments.'
        '; + } + $aDetails[] = ['label' => ''.$oAttDef->GetLabel().'', 'value' => "$sHTMLValue", 'comments' => $sComments]; + $aFieldsMap[$sAttCode] = $sFieldInputId; + $iFieldIndex++; + } + } + $oFormContainer = new UIContentBlock(null, ['ibo-wizard-container']); + $oP->AddUiBlock($oFormContainer); + $oForm = new Combodo\iTop\Application\UI\Base\Component\Form\Form($sFormId); + $oFormContainer->AddSubBlock($oForm); + $oForm->SetOnSubmitJsCode("return OnSubmit('{$sFormId}');") + ->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $sClass)) + ->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', 'bulk_apply_stimulus')) + ->AddSubBlock(InputUIBlockFactory::MakeForHidden('stimulus', $sStimulus)) + ->AddSubBlock(InputUIBlockFactory::MakeForHidden('preview_mode', 1)) + ->AddSubBlock(InputUIBlockFactory::MakeForHidden('filter', utils::HtmlEntities($sFilter))) + ->AddSubBlock(InputUIBlockFactory::MakeForHidden('state', $sState)) + ->AddSubBlock(InputUIBlockFactory::MakeForHidden('selectObject', implode(',', $aSelectObject))) + ->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', utils::GetNewTransactionId())); - $sURL = "./UI.php?operation=search&filter=".urlencode($sFilter).$oAppContext->GetForLink(true); - $oCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'), 'cancel', 'cancel'); - $oCancelButton->SetOnClickJsCode("window.location.href='$sURL'"); - $oForm->AddSubBlock($oCancelButton); + $aContextInputBlocks = $oAppContext->GetForUIForm(); + foreach ($aContextInputBlocks as $oContextInputBlock) { + $oForm->AddSubBlock($oContextInputBlock); + } + // Note: Remove the table if we want fields to occupy the whole width of the container + $oForm->AddHtml('
        '); + $oForm->AddHtml($oP->GetDetails($aDetails)); + $oForm->AddHtml('
        '); - $oSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction($sActionLabel, 'submit', 'submit', true); - $oForm->AddSubBlock($oSubmitButton); + $sURL = "./UI.php?operation=search&filter=".urlencode($sFilter).$oAppContext->GetForLink(true); + $oCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'), 'cancel', 'cancel'); + $oCancelButton->SetOnClickJsCode("window.location.href='$sURL'"); + $oForm->AddSubBlock($oCancelButton); - $oP->add(<<AddSubBlock($oSubmitButton); + + $oP->add( + <<
      HTML - ); + ); - $iFieldsCount = count($aFieldsMap); - $sJsonFieldsMap = json_encode($aFieldsMap); + $iFieldsCount = count($aFieldsMap); + $sJsonFieldsMap = json_encode($aFieldsMap); - $oP->add_script( - <<add_script( + <<add_ready_script( - <<add_ready_script( + <<DisableBreadCrumb(); - $bPreviewMode = utils::ReadPostedParam('preview_mode', false); - $sFilter = utils::ReadPostedParam('filter', '', 'raw_data'); - $sStimulus = utils::ReadPostedParam('stimulus', ''); - $sState = utils::ReadPostedParam('state', ''); - $sSelectObject = utils::ReadPostedParam('selectObject', '', 'raw_data'); - $aSelectObject = explode(',', $sSelectObject); - - if (empty($sFilter) || empty($sStimulus) || empty($sState)) - { - throw new ApplicationException(Dict::Format('UI:Error:3ParametersMissing', 'filter', 'stimulus', 'state')); - } - $sTransactionId = utils::ReadPostedParam('transaction_id', '', 'transaction_id'); - if (!utils::IsTransactionValid($sTransactionId)) - { - $sUser = UserRights::GetUser(); - IssueLog::Error("UI.php '$operation' : invalid transaction_id ! data: user='$sUser'"); - $oP->p(Dict::S('UI:Error:ObjectAlreadyUpdated')); - } - else - { - // For archiving the modification - $oFilter = DBObjectSearch::unserialize($sFilter); - // Add user filter - $oFilter->UpdateContextFromUser(); - $sClass = $oFilter->GetClass(); - $aObjects = array(); - foreach($aSelectObject as $iId) - { - $aObjects[] = MetaModel::GetObject($sClass, $iId); - } - - $aTransitions = MetaModel::EnumTransitions($sClass, $sState); - $aStimuli = MetaModel::EnumStimuli($sClass); - - $sActionLabel = $aStimuli[$sStimulus]->GetLabel(); - $sActionDetails = $aStimuli[$sStimulus]->GetDescription(); - - $oP->set_title(Dict::Format('UI:StimulusModify_N_ObjectsOf_Class', $sActionLabel, count($aObjects), $sClass)); - - $oSet = DBObjectSet::FromArray($sClass, $aObjects); - - // For reporting - $aHeaders = array( - 'object' => array('label' => MetaModel::GetName($sClass), 'description' => Dict::S('UI:ModifiedObject')), - 'status' => array('label' => Dict::S('UI:BulkModifyStatus'), 'description' => Dict::S('UI:BulkModifyStatus+')), - 'errors' => array('label' => Dict::S('UI:BulkModifyErrors'), 'description' => Dict::S('UI:BulkModifyErrors+')), - ); - $aRows = array(); - while ($oObj = $oSet->Fetch()) - { - $sError = Dict::S('UI:BulkModifyStatusOk'); - try - { - $aTransitions = $oObj->EnumTransitions(); - $aStimuli = MetaModel::EnumStimuli($sClass); - if (!isset($aTransitions[$sStimulus])) - { - throw new ApplicationException(Dict::Format('UI:Error:Invalid_Stimulus_On_Object_In_State', $sStimulus, $oObj->GetName(), $oObj->GetStateLabel())); - } - else - { - $sActionLabel = $aStimuli[$sStimulus]->GetLabel(); - $sActionDetails = $aStimuli[$sStimulus]->GetDescription(); - $sTargetState = $aTransitions[$sStimulus]['target_state']; - $aExpectedAttributes = $oObj->GetTransitionAttributes($sStimulus /* cureent state */); - $aDetails = array(); - $aErrors = array(); - foreach($aExpectedAttributes as $sAttCode => $iExpectCode) - { - $iFlags = $oObj->GetTransitionFlags($sAttCode, $sStimulus); - if (($iExpectCode & (OPT_ATT_MUSTCHANGE|OPT_ATT_MUSTPROMPT)) || ($oObj->Get($sAttCode) == '') ) - { - $paramValue = utils::ReadPostedParam("attr_$sAttCode", '', 'raw_data'); - if ( ($iFlags & OPT_ATT_SLAVE) && ($paramValue != $oObj->Get($sAttCode)) ) - { - $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - $aErrors[] = Dict::Format('UI:AttemptingToSetASlaveAttribute_Name', $oAttDef->GetLabel(), $sAttCode); - unset($aExpectedAttributes[$sAttCode]); - } - } - } - - $oObj->UpdateObjectFromPostedForm('', array_keys($aExpectedAttributes), $aExpectedAttributes); - - if (count($aErrors) == 0) - { - if ($oObj->ApplyStimulus($sStimulus)) - { - list($bResult, $aErrors) = $oObj->CheckToWrite(); - $sStatus = $bResult ? Dict::S('UI:BulkModifyStatusModified') : Dict::S('UI:BulkModifyStatusSkipped'); - if ($bResult) - { - $oObj->DBUpdate(); - } - else - { - $aErrorsToDisplay = array_map(function($sError) { - return utils::HtmlEntities($sError); - }, $aErrors); - $sError = '

      '.implode('

      ',$aErrorsToDisplay)."

      \n"; - } - } - else - { - $sStatus = Dict::S('UI:BulkModifyStatusSkipped'); - $sError = '

      '.Dict::S('UI:FailedToApplyStimuli')."

      \n"; - } - } - else - { - $sStatus = Dict::S('UI:BulkModifyStatusSkipped'); - $sError = '

      '.implode('

      ',$aErrors)."

      \n"; - } - } - } - catch(Exception $e) - { - $sError = $e->getMessage(); - $sStatus = Dict::S('UI:BulkModifyStatusSkipped'); - } - $aRows[] = array( - 'object' => $oObj->GetHyperlink(), - 'status' => $sStatus, - 'errors' => $sError, ); } - $oBlock = PanelUIBlockFactory::MakeForClass($sClass, Dict::Format('UI:StimulusModify_N_ObjectsOf_Class', $sActionLabel, count($aObjects), $sClass)); - $oBlock->SetIcon(MetaModel::GetClassIcon($sClass, false)); + break; + case 'bulk_apply_stimulus': + $oP->DisableBreadCrumb(); + $bPreviewMode = utils::ReadPostedParam('preview_mode', false); + $sFilter = utils::ReadPostedParam('filter', '', 'raw_data'); + $sStimulus = utils::ReadPostedParam('stimulus', ''); + $sState = utils::ReadPostedParam('state', ''); + $sSelectObject = utils::ReadPostedParam('selectObject', '', 'raw_data'); + $aSelectObject = explode(',', $sSelectObject); - $oDataTable = DataTableUIBlockFactory::MakeForStaticData('', $aHeaders,$aRows); - $oBlock->AddSubBlock($oDataTable); - $oP->AddUiBlock($oBlock); - - // Back to the list - $sURL = "./UI.php?operation=search&filter=".urlencode($sFilter).$oAppContext->GetForLink(true); - $oSubmitButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Done'), 'submit', 'submit', true); - $oSubmitButton->SetOnClickJsCode("window.location.href='$sURL'"); - $oToolbarButtons = ToolbarUIBlockFactory::MakeStandard(null); - $oToolbarButtons->AddCSSClass('ibo-toolbar--button'); - $oToolbarButtons->AddSubBlock($oSubmitButton); - $oP->AddSubBlock($oToolbarButtons); - } - break; - - case 'stimulus': // Form displayed when applying a stimulus (state change) - $oP->DisableBreadCrumb(); - $sClass = utils::ReadParam('class', '', false, 'class'); - $id = utils::ReadParam('id', ''); - $sStimulus = utils::ReadParam('stimulus', ''); - if ( empty($sClass) || empty($id) || empty($sStimulus) ) // TO DO: check that the class name is valid ! - { - throw new ApplicationException(Dict::Format('UI:Error:3ParametersMissing', 'class', 'id', 'stimulus')); - } - $aStimuli = MetaModel::EnumStimuli($sClass); - if ((get_class($aStimuli[$sStimulus]) !== 'StimulusUserAction') || (UserRights::IsStimulusAllowed($sClass, $sStimulus) === UR_ALLOWED_NO)) - { - $sUser = UserRights::GetUser(); - IssueLog::Error("UI.php '$operation' : Stimulus '$sStimulus' not allowed ! data: user='$sUser', class='$sClass'"); - throw new ApplicationException(Dict::S('UI:Error:ActionNotAllowed')); - } - - /** @var \cmdbAbstractObject $oObj */ - $oObj = MetaModel::GetObject($sClass, $id, false); - if ($oObj != null) - { - $aPrefillFormParam = [ - 'user' => Session::Get('auth_user'), - 'context' => $oAppContext->GetAsHash(), - 'stimulus' => $sStimulus, - 'origin' => 'console', - ]; - try { - $bApplyTransition = $oObj->DisplayStimulusForm($oP, $sStimulus, $aPrefillFormParam); + if (empty($sFilter) || empty($sStimulus) || empty($sState)) { + throw new ApplicationException(Dict::Format('UI:Error:3ParametersMissing', 'filter', 'stimulus', 'state')); } - catch (ApplicationException $e) { - $bApplyTransition = false; - $sMessage = $e->getMessage(); - $sSeverity = 'warning'; - ReloadAndDisplay($oP, $oObj, 'stimulus', $sMessage, $sSeverity); - } - catch (CoreCannotSaveObjectException $e) { - $bApplyTransition = false; - $aIssues = $e->getIssues(); - $sMessage = $e->getHtmlMessage(); - $sSeverity = 'warning'; - ReloadAndDisplay($oP, $oObj, 'stimulus', $sMessage, $sSeverity); - } - if ($bApplyTransition) { - $sMessage = Dict::Format('UI:Class_Object_Updated', MetaModel::GetName(get_class($oObj)), $oObj->GetName()); - $sSeverity = 'ok'; - //transition is ok, whe can display object with transition message - ReloadAndDisplay($oP, $oObj, 'apply_stimulus', $sMessage, $sSeverity); - } - } - else - { - $oP->set_title(Dict::S('UI:ErrorPageTitle')); - $oP->P(Dict::S('UI:ObjectDoesNotExist')); - } - break; - - /////////////////////////////////////////////////////////////////////////////////////////// - - case 'apply_stimulus': // Actual state change - $oP->DisableBreadCrumb(); - $sClass = utils::ReadPostedParam('class', '', 'class'); - $id = utils::ReadPostedParam('id', ''); $sTransactionId = utils::ReadPostedParam('transaction_id', '', 'transaction_id'); - $sStimulus = utils::ReadPostedParam('stimulus', ''); - if ( empty($sClass) || empty($id) || empty($sStimulus) ) // TO DO: check that the class name is valid ! - { - throw new ApplicationException(Dict::Format('UI:Error:3ParametersMissing', 'class', 'id', 'stimulus')); - } - /** @var \cmdbAbstractObject $oObj */ - $oObj = MetaModel::GetObject($sClass, $id, false); - if ($oObj != null) - { - $aTransitions = $oObj->EnumTransitions(); - $aStimuli = MetaModel::EnumStimuli($sClass); - $sMessage = ''; - $sSeverity = 'ok'; - $bDisplayDetails = true; - if (!isset($aTransitions[$sStimulus])) - { - throw new ApplicationException(Dict::Format('UI:Error:Invalid_Stimulus_On_Object_In_State', $sStimulus, $oObj->GetName(), $oObj->GetStateLabel())); - } - if (!utils::IsTransactionValid($sTransactionId)) - { + if (!utils::IsTransactionValid($sTransactionId)) { $sUser = UserRights::GetUser(); - IssueLog::Error("UI.php '$operation' : invalid transaction_id ! data: user='$sUser', class='$sClass'"); - $sMessage = Dict::S('UI:Error:ObjectAlreadyUpdated'); - $sSeverity = 'info'; - } - elseif ((get_class($aStimuli[$sStimulus]) !== 'StimulusUserAction') || (UserRights::IsStimulusAllowed($sClass, $sStimulus) === UR_ALLOWED_NO)) - { - $sUser = UserRights::GetUser(); - IssueLog::Error("UI.php '$operation' : Stimulus '$sStimulus' not allowed ! data: user='$sUser', class='$sClass'"); - $sMessage = Dict::S('UI:Error:ActionNotAllowed'); - $sSeverity = 'error'; - } - else - { - $sActionLabel = $aStimuli[$sStimulus]->GetLabel(); - $sActionDetails = $aStimuli[$sStimulus]->GetDescription(); - $sTargetState = $aTransitions[$sStimulus]['target_state']; - $aExpectedAttributes = $oObj->GetTransitionAttributes($sStimulus /*, current state*/); - $aDetails = array(); - $aErrors = array(); - foreach($aExpectedAttributes as $sAttCode => $iExpectCode) - { - $iFlags = $oObj->GetTransitionFlags($sAttCode, $sStimulus); - if (($iExpectCode & (OPT_ATT_MUSTCHANGE|OPT_ATT_MUSTPROMPT)) || ($oObj->Get($sAttCode) == '') ) - { - $paramValue = utils::ReadPostedParam("attr_$sAttCode", '', 'raw_data'); - if ( ($iFlags & OPT_ATT_SLAVE) && ($paramValue != $oObj->Get($sAttCode))) - { - $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - $aErrors[] = Dict::Format('UI:AttemptingToChangeASlaveAttribute_Name', $oAttDef->GetLabel()); - unset($aExpectedAttributes[$sAttCode]); - } - } + IssueLog::Error("UI.php '$operation' : invalid transaction_id ! data: user='$sUser'"); + $oP->p(Dict::S('UI:Error:ObjectAlreadyUpdated')); + } else { + // For archiving the modification + $oFilter = DBObjectSearch::unserialize($sFilter); + // Add user filter + $oFilter->UpdateContextFromUser(); + $sClass = $oFilter->GetClass(); + $aObjects = []; + foreach ($aSelectObject as $iId) { + $aObjects[] = MetaModel::GetObject($sClass, $iId); } - $oObj->UpdateObjectFromPostedForm('', array_keys($aExpectedAttributes), $aExpectedAttributes); + $aTransitions = MetaModel::EnumTransitions($sClass, $sState); + $aStimuli = MetaModel::EnumStimuli($sClass); + + $sActionLabel = $aStimuli[$sStimulus]->GetLabel(); + $sActionDetails = $aStimuli[$sStimulus]->GetDescription(); + + $oP->set_title(Dict::Format('UI:StimulusModify_N_ObjectsOf_Class', $sActionLabel, count($aObjects), $sClass)); + + $oSet = DBObjectSet::FromArray($sClass, $aObjects); + + // For reporting + $aHeaders = [ + 'object' => ['label' => MetaModel::GetName($sClass), 'description' => Dict::S('UI:ModifiedObject')], + 'status' => ['label' => Dict::S('UI:BulkModifyStatus'), 'description' => Dict::S('UI:BulkModifyStatus+')], + 'errors' => ['label' => Dict::S('UI:BulkModifyErrors'), 'description' => Dict::S('UI:BulkModifyErrors+')], + ]; + $aRows = []; + while ($oObj = $oSet->Fetch()) { + $sError = Dict::S('UI:BulkModifyStatusOk'); + try { + $aTransitions = $oObj->EnumTransitions(); + $aStimuli = MetaModel::EnumStimuli($sClass); + if (!isset($aTransitions[$sStimulus])) { + throw new ApplicationException(Dict::Format('UI:Error:Invalid_Stimulus_On_Object_In_State', $sStimulus, $oObj->GetName(), $oObj->GetStateLabel())); + } else { + $sActionLabel = $aStimuli[$sStimulus]->GetLabel(); + $sActionDetails = $aStimuli[$sStimulus]->GetDescription(); + $sTargetState = $aTransitions[$sStimulus]['target_state']; + $aExpectedAttributes = $oObj->GetTransitionAttributes($sStimulus /* cureent state */); + $aDetails = []; + $aErrors = []; + foreach ($aExpectedAttributes as $sAttCode => $iExpectCode) { + $iFlags = $oObj->GetTransitionFlags($sAttCode, $sStimulus); + if (($iExpectCode & (OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) || ($oObj->Get($sAttCode) == '')) { + $paramValue = utils::ReadPostedParam("attr_$sAttCode", '', 'raw_data'); + if (($iFlags & OPT_ATT_SLAVE) && ($paramValue != $oObj->Get($sAttCode))) { + $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); + $aErrors[] = Dict::Format('UI:AttemptingToSetASlaveAttribute_Name', $oAttDef->GetLabel(), $sAttCode); + unset($aExpectedAttributes[$sAttCode]); + } + } + } - if (count($aErrors) == 0) - { - $sIssues = ''; - $bApplyStimulus = true; - list($bRes, $aIssues) = $oObj->CheckToWrite(); // Check before trying to write the object - if ($bRes) - { - try - { - $bApplyStimulus = $oObj->ApplyStimulus($sStimulus); // will write the object in the DB - } - catch(CoreException $e) - { - // Rollback to the previous state... by reloading the object from the database and applying the modifications again - $oObj = MetaModel::GetObject(get_class($oObj), $oObj->GetKey()); $oObj->UpdateObjectFromPostedForm('', array_keys($aExpectedAttributes), $aExpectedAttributes); - $sIssues = $e->getMessage(); - } - } - else - { - $sIssues = implode(' ', $aIssues); - } - if (!$bApplyStimulus) - { - $sMessage = Dict::S('UI:FailedToApplyStimuli'); - $sSeverity = 'error'; - - $sOwnershipToken = utils::ReadPostedParam('ownership_token', null, 'raw_data'); - if ($sOwnershipToken !== null) - { - // Release the concurrent lock, if any - iTopOwnershipLock::ReleaseLock(get_class($oObj), $oObj->GetKey(), $sOwnershipToken); + if (count($aErrors) == 0) { + if ($oObj->ApplyStimulus($sStimulus)) { + list($bResult, $aErrors) = $oObj->CheckToWrite(); + $sStatus = $bResult ? Dict::S('UI:BulkModifyStatusModified') : Dict::S('UI:BulkModifyStatusSkipped'); + if ($bResult) { + $oObj->DBUpdate(); + } else { + $aErrorsToDisplay = array_map(function ($sError) { + return utils::HtmlEntities($sError); + }, $aErrors); + $sError = '

      '.implode('

      ', $aErrorsToDisplay)."

      \n"; + } + } else { + $sStatus = Dict::S('UI:BulkModifyStatusSkipped'); + $sError = '

      '.Dict::S('UI:FailedToApplyStimuli')."

      \n"; + } + } else { + $sStatus = Dict::S('UI:BulkModifyStatusSkipped'); + $sError = '

      '.implode('

      ', $aErrors)."

      \n"; + } } + } catch (Exception $e) { + $sError = $e->getMessage(); + $sStatus = Dict::S('UI:BulkModifyStatusSkipped'); } - else if ($sIssues != '') - { - $sOwnershipToken = utils::ReadPostedParam('ownership_token', null, 'raw_data'); - if ($sOwnershipToken !== null) - { - // Release the concurrent lock, if any, a new lock will be re-acquired by DisplayStimulusForm below - iTopOwnershipLock::ReleaseLock(get_class($oObj), $oObj->GetKey(), $sOwnershipToken); - } + $aRows[] = [ + 'object' => $oObj->GetHyperlink(), + 'status' => $sStatus, + 'errors' => $sError, + ]; + } + $oBlock = PanelUIBlockFactory::MakeForClass($sClass, Dict::Format('UI:StimulusModify_N_ObjectsOf_Class', $sActionLabel, count($aObjects), $sClass)); + $oBlock->SetIcon(MetaModel::GetClassIcon($sClass, false)); - $bDisplayDetails = false; - // Found issues, explain and give the user a second chance - // - try - { - $oObj->DisplayStimulusForm($oP, $sStimulus); - } - catch(ApplicationException $e) - { - $sMessage = $e->getMessage(); - $sSeverity = 'info'; - } - $sIssueDesc = Dict::Format('UI:ObjectCouldNotBeWritten',$sIssues); - $oP->add_ready_script("CombodoModal.OpenErrorModal('".addslashes($sIssueDesc)."');"); - } - else - { - $sMessage = Dict::Format('UI:Class_Object_Updated', MetaModel::GetName(get_class($oObj)), $oObj->GetName()); - $sSeverity = 'ok'; - utils::RemoveTransaction($sTransactionId); - $bLockEnabled = MetaModel::GetConfig()->Get('concurrent_lock_enabled'); - if ($bLockEnabled) - { - // Release the concurrent lock, if any - $sOwnershipToken = utils::ReadPostedParam('ownership_token', null, 'raw_data'); - if ($sOwnershipToken !== null) - { - // We're done, let's release the lock - iTopOwnershipLock::ReleaseLock(get_class($oObj), $oObj->GetKey(), $sOwnershipToken); + $oDataTable = DataTableUIBlockFactory::MakeForStaticData('', $aHeaders, $aRows); + $oBlock->AddSubBlock($oDataTable); + $oP->AddUiBlock($oBlock); + + // Back to the list + $sURL = "./UI.php?operation=search&filter=".urlencode($sFilter).$oAppContext->GetForLink(true); + $oSubmitButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Done'), 'submit', 'submit', true); + $oSubmitButton->SetOnClickJsCode("window.location.href='$sURL'"); + $oToolbarButtons = ToolbarUIBlockFactory::MakeStandard(null); + $oToolbarButtons->AddCSSClass('ibo-toolbar--button'); + $oToolbarButtons->AddSubBlock($oSubmitButton); + $oP->AddSubBlock($oToolbarButtons); + } + break; + + case 'stimulus': // Form displayed when applying a stimulus (state change) + $oP->DisableBreadCrumb(); + $sClass = utils::ReadParam('class', '', false, 'class'); + $id = utils::ReadParam('id', ''); + $sStimulus = utils::ReadParam('stimulus', ''); + if (empty($sClass) || empty($id) || empty($sStimulus)) { // TO DO: check that the class name is valid ! + throw new ApplicationException(Dict::Format('UI:Error:3ParametersMissing', 'class', 'id', 'stimulus')); + } + $aStimuli = MetaModel::EnumStimuli($sClass); + if ((get_class($aStimuli[$sStimulus]) !== 'StimulusUserAction') || (UserRights::IsStimulusAllowed($sClass, $sStimulus) === UR_ALLOWED_NO)) { + $sUser = UserRights::GetUser(); + IssueLog::Error("UI.php '$operation' : Stimulus '$sStimulus' not allowed ! data: user='$sUser', class='$sClass'"); + throw new ApplicationException(Dict::S('UI:Error:ActionNotAllowed')); + } + + /** @var \cmdbAbstractObject $oObj */ + $oObj = MetaModel::GetObject($sClass, $id, false); + if ($oObj != null) { + $aPrefillFormParam = [ + 'user' => Session::Get('auth_user'), + 'context' => $oAppContext->GetAsHash(), + 'stimulus' => $sStimulus, + 'origin' => 'console', + ]; + try { + $bApplyTransition = $oObj->DisplayStimulusForm($oP, $sStimulus, $aPrefillFormParam); + } catch (ApplicationException $e) { + $bApplyTransition = false; + $sMessage = $e->getMessage(); + $sSeverity = 'warning'; + ReloadAndDisplay($oP, $oObj, 'stimulus', $sMessage, $sSeverity); + } catch (CoreCannotSaveObjectException $e) { + $bApplyTransition = false; + $aIssues = $e->getIssues(); + $sMessage = $e->getHtmlMessage(); + $sSeverity = 'warning'; + ReloadAndDisplay($oP, $oObj, 'stimulus', $sMessage, $sSeverity); + } + if ($bApplyTransition) { + $sMessage = Dict::Format('UI:Class_Object_Updated', MetaModel::GetName(get_class($oObj)), $oObj->GetName()); + $sSeverity = 'ok'; + //transition is ok, whe can display object with transition message + ReloadAndDisplay($oP, $oObj, 'apply_stimulus', $sMessage, $sSeverity); + } + } else { + $oP->set_title(Dict::S('UI:ErrorPageTitle')); + $oP->P(Dict::S('UI:ObjectDoesNotExist')); + } + break; + + /////////////////////////////////////////////////////////////////////////////////////////// + + case 'apply_stimulus': // Actual state change + $oP->DisableBreadCrumb(); + $sClass = utils::ReadPostedParam('class', '', 'class'); + $id = utils::ReadPostedParam('id', ''); + $sTransactionId = utils::ReadPostedParam('transaction_id', '', 'transaction_id'); + $sStimulus = utils::ReadPostedParam('stimulus', ''); + if (empty($sClass) || empty($id) || empty($sStimulus)) { // TO DO: check that the class name is valid ! + throw new ApplicationException(Dict::Format('UI:Error:3ParametersMissing', 'class', 'id', 'stimulus')); + } + /** @var \cmdbAbstractObject $oObj */ + $oObj = MetaModel::GetObject($sClass, $id, false); + if ($oObj != null) { + $aTransitions = $oObj->EnumTransitions(); + $aStimuli = MetaModel::EnumStimuli($sClass); + $sMessage = ''; + $sSeverity = 'ok'; + $bDisplayDetails = true; + if (!isset($aTransitions[$sStimulus])) { + throw new ApplicationException(Dict::Format('UI:Error:Invalid_Stimulus_On_Object_In_State', $sStimulus, $oObj->GetName(), $oObj->GetStateLabel())); + } + if (!utils::IsTransactionValid($sTransactionId)) { + $sUser = UserRights::GetUser(); + IssueLog::Error("UI.php '$operation' : invalid transaction_id ! data: user='$sUser', class='$sClass'"); + $sMessage = Dict::S('UI:Error:ObjectAlreadyUpdated'); + $sSeverity = 'info'; + } elseif ((get_class($aStimuli[$sStimulus]) !== 'StimulusUserAction') || (UserRights::IsStimulusAllowed($sClass, $sStimulus) === UR_ALLOWED_NO)) { + $sUser = UserRights::GetUser(); + IssueLog::Error("UI.php '$operation' : Stimulus '$sStimulus' not allowed ! data: user='$sUser', class='$sClass'"); + $sMessage = Dict::S('UI:Error:ActionNotAllowed'); + $sSeverity = 'error'; + } else { + $sActionLabel = $aStimuli[$sStimulus]->GetLabel(); + $sActionDetails = $aStimuli[$sStimulus]->GetDescription(); + $sTargetState = $aTransitions[$sStimulus]['target_state']; + $aExpectedAttributes = $oObj->GetTransitionAttributes($sStimulus /*, current state*/); + $aDetails = []; + $aErrors = []; + foreach ($aExpectedAttributes as $sAttCode => $iExpectCode) { + $iFlags = $oObj->GetTransitionFlags($sAttCode, $sStimulus); + if (($iExpectCode & (OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) || ($oObj->Get($sAttCode) == '')) { + $paramValue = utils::ReadPostedParam("attr_$sAttCode", '', 'raw_data'); + if (($iFlags & OPT_ATT_SLAVE) && ($paramValue != $oObj->Get($sAttCode))) { + $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); + $aErrors[] = Dict::Format('UI:AttemptingToChangeASlaveAttribute_Name', $oAttDef->GetLabel()); + unset($aExpectedAttributes[$sAttCode]); } } } - } - else - { - $sMessage = implode('

      ', $aErrors); - $sSeverity = 'error'; - } - } - if ($bDisplayDetails) - { - ReloadAndDisplay($oP, $oObj, 'apply_stimulus', $sMessage, $sSeverity); - } - } - else - { - $oP->set_title(Dict::S('UI:ErrorPageTitle')); - $oP->P(Dict::S('UI:ObjectDoesNotExist')); - } - break; - /////////////////////////////////////////////////////////////////////////////////////////// + $oObj->UpdateObjectFromPostedForm('', array_keys($aExpectedAttributes), $aExpectedAttributes); + + if (count($aErrors) == 0) { + $sIssues = ''; + $bApplyStimulus = true; + list($bRes, $aIssues) = $oObj->CheckToWrite(); // Check before trying to write the object + if ($bRes) { + try { + $bApplyStimulus = $oObj->ApplyStimulus($sStimulus); // will write the object in the DB + } catch (CoreException $e) { + // Rollback to the previous state... by reloading the object from the database and applying the modifications again + $oObj = MetaModel::GetObject(get_class($oObj), $oObj->GetKey()); + $oObj->UpdateObjectFromPostedForm('', array_keys($aExpectedAttributes), $aExpectedAttributes); + $sIssues = $e->getMessage(); + } + } else { + $sIssues = implode(' ', $aIssues); + } + + if (!$bApplyStimulus) { + $sMessage = Dict::S('UI:FailedToApplyStimuli'); + $sSeverity = 'error'; + + $sOwnershipToken = utils::ReadPostedParam('ownership_token', null, 'raw_data'); + if ($sOwnershipToken !== null) { + // Release the concurrent lock, if any + iTopOwnershipLock::ReleaseLock(get_class($oObj), $oObj->GetKey(), $sOwnershipToken); + } + } elseif ($sIssues != '') { + $sOwnershipToken = utils::ReadPostedParam('ownership_token', null, 'raw_data'); + if ($sOwnershipToken !== null) { + // Release the concurrent lock, if any, a new lock will be re-acquired by DisplayStimulusForm below + iTopOwnershipLock::ReleaseLock(get_class($oObj), $oObj->GetKey(), $sOwnershipToken); + } + + $bDisplayDetails = false; + // Found issues, explain and give the user a second chance + // + try { + $oObj->DisplayStimulusForm($oP, $sStimulus); + } catch (ApplicationException $e) { + $sMessage = $e->getMessage(); + $sSeverity = 'info'; + } + $sIssueDesc = Dict::Format('UI:ObjectCouldNotBeWritten', $sIssues); + $oP->add_ready_script("CombodoModal.OpenErrorModal('".addslashes($sIssueDesc)."');"); + } else { + $sMessage = Dict::Format('UI:Class_Object_Updated', MetaModel::GetName(get_class($oObj)), $oObj->GetName()); + $sSeverity = 'ok'; + utils::RemoveTransaction($sTransactionId); + $bLockEnabled = MetaModel::GetConfig()->Get('concurrent_lock_enabled'); + if ($bLockEnabled) { + // Release the concurrent lock, if any + $sOwnershipToken = utils::ReadPostedParam('ownership_token', null, 'raw_data'); + if ($sOwnershipToken !== null) { + // We're done, let's release the lock + iTopOwnershipLock::ReleaseLock(get_class($oObj), $oObj->GetKey(), $sOwnershipToken); + } + } + } + } else { + $sMessage = implode('

      ', $aErrors); + $sSeverity = 'error'; + } + } + if ($bDisplayDetails) { + ReloadAndDisplay($oP, $oObj, 'apply_stimulus', $sMessage, $sSeverity); + } + } else { + $oP->set_title(Dict::S('UI:ErrorPageTitle')); + $oP->P(Dict::S('UI:ObjectDoesNotExist')); + } + break; + + /////////////////////////////////////////////////////////////////////////////////////////// case 'swf_navigator': /** @deprecated SWF was removed in iTop */ + // no break case 'view_relations': // Graphical display of the relations "impact" / "depends on" - require_once(APPROOT.'core/simplegraph.class.inc.php'); - require_once(APPROOT.'core/relationgraph.class.inc.php'); - require_once(APPROOT.'core/displayablegraph.class.inc.php'); - $sClass = utils::ReadParam('class', '', false, 'class'); - $id = utils::ReadParam('id', 0); - $sRelation = utils::ReadParam('relation', 'impact'); - $sDirection = utils::ReadParam('direction', 'down'); - $iGroupingThreshold = utils::ReadParam('g', 5); + require_once(APPROOT.'core/simplegraph.class.inc.php'); + require_once(APPROOT.'core/relationgraph.class.inc.php'); + require_once(APPROOT.'core/displayablegraph.class.inc.php'); + $sClass = utils::ReadParam('class', '', false, 'class'); + $id = utils::ReadParam('id', 0); + $sRelation = utils::ReadParam('relation', 'impact'); + $sDirection = utils::ReadParam('direction', 'down'); + $iGroupingThreshold = utils::ReadParam('g', 5); - $bDirDown = ($sDirection === 'down'); - $oObj = MetaModel::GetObject($sClass, $id); - $iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth'); - $aSourceObjects = array($oObj); + $bDirDown = ($sDirection === 'down'); + $oObj = MetaModel::GetObject($sClass, $id); + $iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth'); + $aSourceObjects = [$oObj]; - $oP->set_title(MetaModel::GetRelationDescription($sRelation, $bDirDown).' '.$oObj->GetName()); + $oP->set_title(MetaModel::GetRelationDescription($sRelation, $bDirDown).' '.$oObj->GetName()); - $sPageId = "ui-relation-graph-".$sClass.'::'.$id; - $sLabel = $oObj->GetName().' '.MetaModel::GetRelationLabel($sRelation, $bDirDown); - $sDescription = MetaModel::GetRelationDescription($sRelation, $bDirDown).' '.$oObj->GetName(); - $oP->SetBreadCrumbEntry($sPageId, $sLabel, $sDescription); + $sPageId = "ui-relation-graph-".$sClass.'::'.$id; + $sLabel = $oObj->GetName().' '.MetaModel::GetRelationLabel($sRelation, $bDirDown); + $sDescription = MetaModel::GetRelationDescription($sRelation, $bDirDown).' '.$oObj->GetName(); + $oP->SetBreadCrumbEntry($sPageId, $sLabel, $sDescription); - if ($sRelation == 'depends on') { - $sRelation = 'impacts'; - $sDirection = 'up'; - } - if ($sDirection == 'up') { - $oRelGraph = MetaModel::GetRelatedObjectsUp($sRelation, $aSourceObjects, $iMaxRecursionDepth); - } else { - $oRelGraph = MetaModel::GetRelatedObjectsDown($sRelation, $aSourceObjects, $iMaxRecursionDepth); - } + if ($sRelation == 'depends on') { + $sRelation = 'impacts'; + $sDirection = 'up'; + } + if ($sDirection == 'up') { + $oRelGraph = MetaModel::GetRelatedObjectsUp($sRelation, $aSourceObjects, $iMaxRecursionDepth); + } else { + $oRelGraph = MetaModel::GetRelatedObjectsDown($sRelation, $aSourceObjects, $iMaxRecursionDepth); + } + $aResults = $oRelGraph->GetObjectsByClass(); + $oDisplayGraph = DisplayableGraph::FromRelationGraph($oRelGraph, $iGroupingThreshold, ($sDirection == 'down')); + $sTitle = MetaModel::GetRelationDescription($sRelation, $bDirDown).' '.$oObj->GetName(); + $sClassIcon = MetaModel::GetClassIcon($sClass, false); - $aResults = $oRelGraph->GetObjectsByClass(); - $oDisplayGraph = DisplayableGraph::FromRelationGraph($oRelGraph, $iGroupingThreshold, ($sDirection == 'down')); - $sTitle = MetaModel::GetRelationDescription($sRelation, $bDirDown).' '.$oObj->GetName(); - $sClassIcon = MetaModel::GetClassIcon($sClass, false); + $sFirstTab = MetaModel::GetConfig()->Get('impact_analysis_first_tab'); + $bLazyLoading = MetaModel::GetConfig()->Get('impact_analysis_lazy_loading'); + $sContextKey = "itop-config-mgmt/relation_context/$sClass/$sRelation/$sDirection"; - $sFirstTab = MetaModel::GetConfig()->Get('impact_analysis_first_tab'); - $bLazyLoading = MetaModel::GetConfig()->Get('impact_analysis_lazy_loading'); - $sContextKey = "itop-config-mgmt/relation_context/$sClass/$sRelation/$sDirection"; - - // Check if the current object supports Attachments, similar to AttachmentPlugin::IsTargetObject - $sClassForAttachment = null; - $iIdForAttachment = null; - if (class_exists('Attachment')) { - $aAllowedClasses = MetaModel::GetModuleSetting('itop-attachments', 'allowed_classes', array('Ticket')); - foreach ($aAllowedClasses as $sAllowedClass) { - if ($oObj instanceof $sAllowedClass) { - $iIdForAttachment = $id; - $sClassForAttachment = $sClass; + // Check if the current object supports Attachments, similar to AttachmentPlugin::IsTargetObject + $sClassForAttachment = null; + $iIdForAttachment = null; + if (class_exists('Attachment')) { + $aAllowedClasses = MetaModel::GetModuleSetting('itop-attachments', 'allowed_classes', ['Ticket']); + foreach ($aAllowedClasses as $sAllowedClass) { + if ($oObj instanceof $sAllowedClass) { + $iIdForAttachment = $id; + $sClassForAttachment = $sClass; + } } } - } - $oP->AddSubBlock($oDisplayGraph->DisplayFilterBox($oP, $aResults, $bLazyLoading)); - $oPanel = PanelUIBlockFactory::MakeForClass($sClass, $sTitle); - $oPanel->SetIcon($sClassIcon); + $oP->AddSubBlock($oDisplayGraph->DisplayFilterBox($oP, $aResults, $bLazyLoading)); + $oPanel = PanelUIBlockFactory::MakeForClass($sClass, $sTitle); + $oPanel->SetIcon($sClassIcon); - $oP->AddSubBlock($oPanel); - $oP->AddTabContainer('Navigator', '', $oPanel); - $oP->SetCurrentTabContainer('Navigator'); + $oP->AddSubBlock($oPanel); + $oP->AddTabContainer('Navigator', '', $oPanel); + $oP->SetCurrentTabContainer('Navigator'); - // Display the tabs - if ($sFirstTab == 'list') { - DisplayNavigatorListTab($oP, $aResults, $sRelation, $sDirection, $oObj); - $oP->SetCurrentTab('UI:RelationshipGraph'); - $oDisplayGraph->DisplayGraph($oP, $sRelation, $oAppContext, [], $sClassForAttachment, $iIdForAttachment, $sContextKey, array('this' => $oObj), $bLazyLoading); - DisplayNavigatorGroupTab($oP); - } else { - $oP->SetCurrentTab('UI:RelationshipGraph'); - $oDisplayGraph->DisplayGraph($oP, $sRelation, $oAppContext, array(), $sClassForAttachment, $iIdForAttachment, $sContextKey, array('this' => $oObj), $bLazyLoading); - DisplayNavigatorListTab($oP, $aResults, $sRelation, $sDirection, $oObj); - DisplayNavigatorGroupTab($oP); - } + // Display the tabs + if ($sFirstTab == 'list') { + DisplayNavigatorListTab($oP, $aResults, $sRelation, $sDirection, $oObj); + $oP->SetCurrentTab('UI:RelationshipGraph'); + $oDisplayGraph->DisplayGraph($oP, $sRelation, $oAppContext, [], $sClassForAttachment, $iIdForAttachment, $sContextKey, ['this' => $oObj], $bLazyLoading); + DisplayNavigatorGroupTab($oP); + } else { + $oP->SetCurrentTab('UI:RelationshipGraph'); + $oDisplayGraph->DisplayGraph($oP, $sRelation, $oAppContext, [], $sClassForAttachment, $iIdForAttachment, $sContextKey, ['this' => $oObj], $bLazyLoading); + DisplayNavigatorListTab($oP, $aResults, $sRelation, $sDirection, $oObj); + DisplayNavigatorGroupTab($oP); + } - $oP->SetCurrentTab(''); - break; + $oP->SetCurrentTab(''); + break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'kill_lock': - $oP->DisableBreadCrumb(); - $sClass = utils::ReadParam('class', '', false, 'class'); - $id = utils::ReadParam('id', ''); - iTopOwnershipLock::KillLock($sClass, $id); - $oObj = MetaModel::GetObject($sClass, $id); - ReloadAndDisplay($oP, $oObj, 'concurrent_lock_killed', Dict::S('UI:ConcurrentLockKilled'), 'info'); - break; + $oP->DisableBreadCrumb(); + $sClass = utils::ReadParam('class', '', false, 'class'); + $id = utils::ReadParam('id', ''); + iTopOwnershipLock::KillLock($sClass, $id); + $oObj = MetaModel::GetObject($sClass, $id); + ReloadAndDisplay($oP, $oObj, 'concurrent_lock_killed', Dict::S('UI:ConcurrentLockKilled'), 'info'); + break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// case 'cancel': // An action was cancelled - $oP->DisableBreadCrumb(); - $oP->set_title(Dict::S('UI:OperationCancelled')); - $oP->add('

      '.Dict::S('UI:OperationCancelled').'

      '); - break; + $oP->DisableBreadCrumb(); + $oP->set_title(Dict::S('UI:OperationCancelled')); + $oP->add('

      '.Dict::S('UI:OperationCancelled').'

      '); + break; - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// default: // Menu node rendering (templates) - ApplicationMenu::LoadAdditionalMenus(); - $oMenuNode = ApplicationMenu::GetMenuNode(ApplicationMenu::GetMenuIndexById(ApplicationMenu::GetActiveNodeId())); - if (is_object($oMenuNode)) - { - $oMenuNode->RenderContent($oP, $oAppContext->GetAsHash()); - $oP->set_title($oMenuNode->GetLabel()); - } + ApplicationMenu::LoadAdditionalMenus(); + $oMenuNode = ApplicationMenu::GetMenuNode(ApplicationMenu::GetMenuIndexById(ApplicationMenu::GetActiveNodeId())); + if (is_object($oMenuNode)) { + $oMenuNode->RenderContent($oP, $oAppContext->GetAsHash()); + $oP->set_title($oMenuNode->GetLabel()); + } - /////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// } } DisplayWelcomePopup($oP); $oKPI->ComputeAndReport('Compute page'); $oP->output(); -} -catch (Exception $e) { +} catch (Exception $e) { $oErrorPage = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); if ($e instanceof SecurityException) { $oErrorPage->add("

      ".Dict::S('UI:SystemIntrusion')."

      \n"); @@ -1538,8 +1395,7 @@ catch (Exception $e) { $aData = ($e instanceof CoreException) ? $e->getContextData() : []; $oLog->Set('data', $aData); $oLog->DBInsertNoReload(); - } - catch (Exception $e) { + } catch (Exception $e) { IssueLog::Error("Failed to log issue into the DB"); } } @@ -1549,10 +1405,8 @@ catch (Exception $e) { IssueLog::Debug('UI.php operation='.$sOperationToLog.', error='.$e->getMessage()."\n".$sErrorStackTrace, LogChannels::CONSOLE); } - class UI { - /** * Operation select_for_modify_all * @@ -1607,8 +1461,8 @@ class UI $oFullSetFilter->UpdateContextFromUser(); $aSelectedObj = utils::ReadMultipleSelection($oFullSetFilter); $sCancelUrl = "./UI.php?operation=search&filter=".urlencode($sFilter).$oAppContext->GetForLink(true); - $aContext = array('filter' => utils::EscapeHtml($sFilter)); - cmdbAbstractObject::DisplayBulkModifyForm($oP, $sClass, $aSelectedObj, 'preview_or_modify_all', $sCancelUrl, array(), $aContext); + $aContext = ['filter' => utils::EscapeHtml($sFilter)]; + cmdbAbstractObject::DisplayBulkModifyForm($oP, $sClass, $aSelectedObj, 'preview_or_modify_all', $sCancelUrl, [], $aContext); } /** @@ -1635,16 +1489,15 @@ class UI $sClass = utils::ReadParam('class', '', false, 'class'); $bPreview = utils::ReadParam('preview_mode', ''); $sSelectedObj = utils::ReadParam('selectObj', '', false, 'raw_data'); - if (empty($sClass) || empty($sSelectedObj)) // TO DO: check that the class name is valid ! - { + if (empty($sClass) || empty($sSelectedObj)) { // TO DO: check that the class name is valid ! throw new ApplicationException(Dict::Format('UI:Error:2ParametersMissing', 'class', 'selectObj')); } $aSelectedObj = explode(',', $sSelectedObj); $sCancelUrl = "./UI.php?operation=search&filter=".urlencode($sFilter).$oAppContext->GetForLink(true); - $aContext = array( + $aContext = [ 'filter' => utils::EscapeHtml($sFilter), 'selectObj' => $sSelectedObj, - ); + ]; cmdbAbstractObject::DoBulkModify($oP, $sClass, $aSelectedObj, 'preview_or_modify_all', $bPreview, $sCancelUrl, $aContext); } -} \ No newline at end of file +} diff --git a/pages/UniversalSearch.php b/pages/UniversalSearch.php index 5c63b785a..7b1092983 100644 --- a/pages/UniversalSearch.php +++ b/pages/UniversalSearch.php @@ -1,4 +1,5 @@ LinkScriptFromAppRoot("js/wizardhelper.js"); $oP->LinkScriptFromAppRoot("js/wizard.utils.js"); $oP->LinkScriptFromAppRoot("js/extkeywidget.js"); $oP->LinkScriptFromAppRoot("js/jquery.blockUI.js"); - + // From now on the context is limited to the the selected organization ?? // Now render the content of the page @@ -50,11 +51,9 @@ $sOperation = utils::ReadParam('operation', ''); $oP->SetBreadCrumbEntry('ui-tool-universalsearch', Dict::S('Menu:UniversalSearchMenu'), Dict::S('Menu:UniversalSearchMenu+'), '', 'fas fa-search', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); - - //$sSearchHeaderForceDropdown $sSearchHeaderForceDropdown = '\n"; //end of $sSearchHeaderForceDropdown - -try -{ - if ($sOperation == 'search_form') - { - $sOQL = "SELECT $sClass $sOQLClause"; - $oFilter = DBObjectSearch::FromOQL($sOQL); - } - else - { +try { + if ($sOperation == 'search_form') { + $sOQL = "SELECT $sClass $sOQLClause"; + $oFilter = DBObjectSearch::FromOQL($sOQL); + } else { // Second part: advanced search form: - if (!empty($sFilter)) - { + if (!empty($sFilter)) { $oFilter = DBSearch::unserialize($sFilter); - } - else if (!empty($sClass)) - { + } elseif (!empty($sClass)) { $oFilter = new DBObjectSearch($sClass); } } -} -catch (CoreException $e) -{ +} catch (CoreException $e) { $oFilter = new DBObjectSearch($sClass); $oP->P("".Dict::Format('UI:UniversalSearch:Error', $e->getHtmlDesc()).""); } -if ($oFilter != null) -{ +if ($oFilter != null) { $oSet = new CMDBObjectSet($oFilter); $oBlock = new DisplayBlock($oFilter, 'search', false); $aExtraParams = $oAppContext->GetAsHash(); @@ -111,7 +98,7 @@ if ($oFilter != null) $aExtraParams['submit_on_load'] = false; $oBlock->Display($oP, 0, $aExtraParams); - // Search results + // Search results $oResultBlock = new DisplayBlock($oFilter, 'list', false); $oResultBlock->Display($oP, 1); diff --git a/pages/ajax.csvimport.php b/pages/ajax.csvimport.php index f8f23bde0..2622652e0 100644 --- a/pages/ajax.csvimport.php +++ b/pages/ajax.csvimport.php @@ -1,4 +1,5 @@ ') === false) - { + } elseif (strpos($sFieldCode, '->') === false) { $oAttDef = MetaModel::GetAttributeDef($sClassName, $sFieldCode); $bResult = $oAttDef->IsExternalKey(); } @@ -61,26 +58,22 @@ function IsIdField($sClassName, $sFieldCode) */ function GetMappingsForExtKey($sAttCode, AttributeDefinition $oExtKeyAttDef, $bAdvanced) { - $aResult = array(); + $aResult = []; $sTargetClass = $oExtKeyAttDef->GetTargetClass(); - foreach(MetaModel::ListAttributeDefs($sTargetClass) as $sTargetAttCode => $oTargetAttDef) - { - if (MetaModel::IsReconcKey($sTargetClass, $sTargetAttCode)) - { + foreach (MetaModel::ListAttributeDefs($sTargetClass) as $sTargetAttCode => $oTargetAttDef) { + if (MetaModel::IsReconcKey($sTargetClass, $sTargetAttCode)) { $bExtKey = $oTargetAttDef->IsExternalKey(); $sSuffix = ''; - if ($bExtKey) - { + if ($bExtKey) { $sSuffix = '->id'; } - if ($bAdvanced || !$bExtKey) - { + if ($bAdvanced || !$bExtKey) { // When not in advanced mode do not allow to use reconciliation keys (on external keys) if they are themselves external keys ! $aResult[$sAttCode.'->'.$sTargetAttCode] = $oExtKeyAttDef->GetLabel().'->'.$oTargetAttDef->GetLabel().$sSuffix; } } } - return $aResult; + return $aResult; } /** @@ -102,15 +95,15 @@ function GetMappingsForExtKey($sAttCode, AttributeDefinition $oExtKeyAttDef, $bA */ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMode, $sDefaultChoice) { - $aChoices = array('' => Dict::S('UI:CSVImport:MappingSelectOne')); + $aChoices = ['' => Dict::S('UI:CSVImport:MappingSelectOne')]; $aChoices[':none:'] = Dict::S('UI:CSVImport:MappingNotApplicable'); $sFieldCode = ''; // Code of the attribute, if there is a match - $aMatches = array(); + $aMatches = []; if (preg_match('/^(.+)\*$/', $sFieldName, $aMatches)) { // Remove any trailing "star" character. // A star character at the end can be used to indicate a mandatory field $sFieldName = $aMatches[1]; - } else if (preg_match('/^(.+)\*->(.+)$/', $sFieldName, $aMatches)) { + } elseif (preg_match('/^(.+)\*->(.+)$/', $sFieldName, $aMatches)) { // Remove any trailing "star" character before the arrow (->) // A star character at the end can be used to indicate a mandatory field $sFieldName = $aMatches[1].'->'.$aMatches[2]; @@ -135,7 +128,7 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo // Note: Could not use "MetaModel::GetFriendlyNameAttributeCode($sTargetClass) === $sTargetAttCode" as it would return empty because the friendlyname is composite. if (MetaModel::IsReconcKey($sTargetClass, $sTargetAttCode) || ($oTargetAttDef instanceof AttributeFriendlyName)) { $bExtKey = $oTargetAttDef->IsExternalKey(); - $aSignatures = array(); + $aSignatures = []; $aSignatures[] = $oAttDef->GetLabel().'->'.$oTargetAttDef->GetLabel(); $aSignatures[] = $sAttCode.'->'.$sTargetAttCode; if ($bExtKey) { @@ -154,8 +147,7 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo } } } - } - else if ( + } elseif ( ($oAttDef->IsWritable() && (!$oAttDef->IsLinkset() || ($bAdvancedMode && $oAttDef->IsIndirect()))) || ($oAttDef instanceof AttributeFriendlyName) ) { @@ -171,18 +163,17 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo $bIsIdField = IsIdField($sClassName, $sFieldCode); foreach ($aChoices as $sAttCode => $sLabel) { $bSelected = false; - if ($bIsIdField && (!$bAdvancedMode)) // When not in advanced mode, ID are mapped to n/a - { + if ($bIsIdField && (!$bAdvancedMode)) { // When not in advanced mode, ID are mapped to n/a if ($sAttCode == ':none:') { $bSelected = true; } - } else if (empty($sFieldCode) && (strpos($sFieldName, '->') !== false)) { + } elseif (empty($sFieldCode) && (strpos($sFieldName, '->') !== false)) { if ($sAttCode == ':none:') { $bSelected = true; } - } else if (is_null($sDefaultChoice) && ($sFieldCode == $sAttCode)) { + } elseif (is_null($sDefaultChoice) && ($sFieldCode == $sAttCode)) { $bSelected = true; - } else if (!is_null($sDefaultChoice) && ($sDefaultChoice == $sAttCode)) { + } elseif (!is_null($sDefaultChoice) && ($sDefaultChoice == $sAttCode)) { $bSelected = true; } $oOption = SelectOptionUIBlockFactory::MakeForSelectOption($sAttCode, $sLabel, $bSelected); @@ -192,19 +183,16 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo return $oSelect; } -try -{ +try { require_once(APPROOT.'/application/startup.inc.php'); require_once(APPROOT.'/application/loginwebpage.class.inc.php'); IssueLog::Trace('----- Request: '.utils::GetRequestUri(), LogChannels::WEB_REQUEST); LoginWebPage::DoLogin(); // Check user rights and prompt if needed - $sOperation = utils::ReadParam('operation', ''); - switch($sOperation) - { + switch ($sOperation) { case 'parser_preview': $oPage = new AjaxPage(""); $oPage->SetContentType('text/html'); @@ -245,7 +233,7 @@ try $aColumns[] = ''; // first line as header - if($bFirstLineAsHeader){ + if ($bFirstLineAsHeader) { foreach ($aRow as $sCell) { $aColumns[] = ["label" => utils::EscapeHtml($sCell)]; } @@ -254,7 +242,7 @@ try // default headers for ($iDataColumnNumber = 0 ; $iDataColumnNumber < count($aRow) ; $iDataColumnNumber++) { - $aColumns[] = ["label" => Dict::Format('UI:CSVImport:Column', $iDataColumnNumber+1)]; + $aColumns[] = ["label" => Dict::Format('UI:CSVImport:Column', $iDataColumnNumber + 1)]; } } @@ -289,8 +277,8 @@ try $sInitFieldMapping = utils::ReadParam('init_field_mapping', '', false, 'raw_data'); $sInitSearchField = utils::ReadParam('init_search_field', '', false, 'raw_data'); - $aInitFieldMapping = empty($sInitFieldMapping) ? array() : json_decode($sInitFieldMapping, true); - $aInitSearchField = empty($sInitSearchField) ? array() : json_decode($sInitSearchField, true); + $aInitFieldMapping = empty($sInitFieldMapping) ? [] : json_decode($sInitFieldMapping, true); + $aInitSearchField = empty($sInitSearchField) ? [] : json_decode($sInitSearchField, true); $oCSVParser = new CSVParser($sData, $sSeparator, $sTextQualifier, MetaModel::GetConfig()->Get('max_execution_time_per_loop')); $aData = $oCSVParser->ToArray($iLinesToSkip, null, 3 /* Max: 1 header line + 2 lines of sample data */); @@ -349,7 +337,7 @@ try // Propose a reconciliation scheme // $aReconciliationKeys = MetaModel::GetReconcKeys($sClassName); - $aMoreReconciliationKeys = array(); // Store: key => void to automatically remove duplicates + $aMoreReconciliationKeys = []; // Store: key => void to automatically remove duplicates foreach ($aReconciliationKeys as $sAttCode) { if (!MetaModel::IsValidAttCode($sClassName, $sAttCode)) { continue; @@ -371,7 +359,7 @@ try } else { // The reconciliation scheme is given (navigating back in the wizard) // - $aDefaultKeys = array(); + $aDefaultKeys = []; foreach ($aInitSearchField as $iSearchField => $void) { $sAttCodeEx = $aInitFieldMapping[$iSearchField]; $aDefaultKeys[] = $sAttCodeEx; @@ -380,7 +368,7 @@ try } // Read only attributes (will be forced to "search") - $aReadOnlyKeys = array(); + $aReadOnlyKeys = []; foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) { if (!$oAttDef->IsWritable()) { $aReadOnlyKeys[] = $sAttCode; @@ -397,7 +385,7 @@ try EOF ); } - break; + break; case 'get_csv_template': $sClassName = utils::ReadParam('class_name'); @@ -406,7 +394,7 @@ EOF $oSearch = new DBObjectSearch($sClassName); $oSearch->AddCondition('id', 0, '='); // Make sure we create an empty set $oSet = new CMDBObjectSet($oSearch); - $sResult = cmdbAbstractObject::GetSetAsCSV($oSet, array('showMandatoryFields' => true)); + $sResult = cmdbAbstractObject::GetSetAsCSV($oSet, ['showMandatoryFields' => true]); $sClassDisplayName = MetaModel::GetName($sClassName); $sDisposition = utils::ReadParam('disposition', 'inline'); @@ -419,8 +407,8 @@ EOF require_once(APPROOT.'/application/excelexporter.class.inc.php'); $writer = new XLSXWriter(); $writer->setAuthor(UserRights::GetUserFriendlyName()); - $aHeaders = array(0 => explode(',', $sResult)); // comma is the default separator - $writer->writeSheet($aHeaders, $sClassDisplayName, array()); + $aHeaders = [0 => explode(',', $sResult)]; // comma is the default separator + $writer->writeSheet($aHeaders, $sClassDisplayName, []); $oPage->add($writer->writeToString()); break; @@ -446,9 +434,6 @@ EOF break; } $oPage->output(); -} -catch (Exception $e) -{ +} catch (Exception $e) { IssueLog::Error($e->getMessage()); } - diff --git a/pages/ajax.document.php b/pages/ajax.document.php index 19b321e7a..3320c298f 100644 --- a/pages/ajax.document.php +++ b/pages/ajax.document.php @@ -1,4 +1,5 @@ 0)) -{ +if (array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER) && (strlen($_SERVER['HTTP_IF_MODIFIED_SINCE']) > 0)) { // The content is garanteed to be unmodified since the URL includes a signature based on the contents of the document header('Last-Modified: Mon, 1 January 2018 00:00:00 GMT', true, 304); // Any date in the past exit; } -try -{ +try { require_once(APPROOT.'/application/application.inc.php'); require_once(APPROOT.'/application/startup.inc.php'); @@ -48,19 +46,14 @@ try LoginWebPage::DoLoginEx('backoffice', false); $id = utils::ReadParam('id', ''); $sField = utils::ReadParam('field', ''); - if ($sClass == 'Attachment') - { + if ($sClass == 'Attachment') { $iCacheSec = 31556926; // One year ahead: an attachment cannot change - } - else - { + } else { $iCacheSec = (int)utils::ReadParam('cache', 0); } - if (!empty($sClass) && ($sClass != 'InlineImage') && !empty($id) && !empty($sField)) - { + if (!empty($sClass) && ($sClass != 'InlineImage') && !empty($id) && !empty($sField)) { ormDocument::DownloadDocument($oPage, $sClass, $id, $sField, 'attachment'); - if ($iCacheSec > 0) - { + if ($iCacheSec > 0) { $oPage->set_cache($iCacheSec); // X-Frame http header : set in page constructor, but we need to allow frame integration for this specific page // so we're resetting its value ! (see N°3416) @@ -88,7 +81,7 @@ try $oPage->add_header("Last-Modified: Wed, 15 Jun 2016 13:21:15 GMT"); // An arbitrary date in the past is ok } break; - + case 'dict': $sSignature = Utils::ReadParam('s', ''); // Sanitization prevents / and .. $oPage->SetContentType('text/javascript'); @@ -100,17 +93,14 @@ try $oPage->add(file_get_contents(Utils::GetCachePath().$sSignature.'.js')); break; - + default: - $oPage->p("Invalid query."); + $oPage->p("Invalid query."); } $oPage->output(); -} -catch (Exception $e) -{ +} catch (Exception $e) { // note: transform to cope with XSS attacks echo utils::EscapeHtml($e->GetMessage()); IssueLog::Error($e->getMessage()."\nDebug trace:\n".$e->getTraceAsString()); } - diff --git a/pages/ajax.render.php b/pages/ajax.render.php index ea5b95410..085e41272 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -1,4 +1,5 @@ add($bRet ? 'Ok' : 'KO'); break; - // ui.searchformforeignkeys + // ui.searchformforeignkeys case 'ShowModalSearchForeignKeys': $oPage->SetContentType('text/html'); $iInputId = utils::ReadParam('iInputId', ''); @@ -180,7 +179,7 @@ try $oWidget->ShowModalSearchForeignKeys($oPage, $sTitle); break; - // ui.searchformforeignkeys + // ui.searchformforeignkeys case 'GetFullListForeignKeysFromSelection': $oPage->SetContentType('application/json'); $oWidget = new UISearchFormForeignKeys($sClass); @@ -188,7 +187,7 @@ try $oWidget->GetFullListForeignKeysFromSelection($oPage, $oFullSetFilter); break; - // ui.searchformforeignkeys + // ui.searchformforeignkeys case 'ListResultsSearchForeignKeys': $oPage->SetContentType('text/html'); $sTargetClass = utils::ReadParam('sTargetClass', '', false, 'class'); @@ -198,7 +197,7 @@ try $oWidget->ListResultsSearchForeignKeys($oPage, $sRemoteClass); break; - // ui.linkswidget + // ui.linkswidget case 'addObjects': $oPage->SetContentType('text/html'); $sAttCode = utils::ReadParam('sAttCode', ''); @@ -215,19 +214,19 @@ try } $oWidget = new UILinksWidget($sClass, $sAttCode, $iInputId, $sSuffix, $bDuplicates); $oAppContext = new ApplicationContext(); - $aPrefillFormParam = array( + $aPrefillFormParam = [ 'user' => Session::Get("auth_user"), 'context' => $oAppContext->GetAsHash(), 'att_code' => $sAttCode, 'origin' => 'console', - 'source_obj' => $oObj - ); - $aAlreadyLinked = utils::ReadParam('aAlreadyLinked', array()); + 'source_obj' => $oObj, + ]; + $aAlreadyLinked = utils::ReadParam('aAlreadyLinked', []); /** @var \DBObject $oObj */ $oWidget->GetObjectPickerDialog($oPage, $oObj, $sJson, $aAlreadyLinked, $aPrefillFormParam); break; - // ui.linkswidget + // ui.linkswidget case 'searchObjectsToAdd': $oPage->SetContentType('text/html'); $sRemoteClass = utils::ReadParam('sRemoteClass', '', false, 'class'); @@ -235,12 +234,12 @@ try $iInputId = utils::ReadParam('iInputId', ''); $sSuffix = utils::ReadParam('sSuffix', ''); $bDuplicates = (utils::ReadParam('bDuplicates', 'false') == 'false') ? false : true; - $aAlreadyLinked = utils::ReadParam('aAlreadyLinked', array()); + $aAlreadyLinked = utils::ReadParam('aAlreadyLinked', []); $oWidget = new UILinksWidget($sClass, $sAttCode, $iInputId, $sSuffix, $bDuplicates); $oWidget->SearchObjectsToAdd($oPage, $sRemoteClass, $aAlreadyLinked); break; - //ui.linksdirectwidget + //ui.linksdirectwidget case 'createObject': $oPage->SetContentType('text/html'); $sClass = utils::ReadParam('class', '', false, 'class'); @@ -258,7 +257,7 @@ try $oWidget->GetObjectCreationDlg($oPage, $sRealClass, $oObj); break; - // ui.linksdirectwidget + // ui.linksdirectwidget case 'getLinksetRow': $oPage = new JsonPage(); $oPage->SetOutputDataOnly(true); @@ -267,16 +266,16 @@ try $sAttCode = utils::ReadParam('att_code', ''); $iInputId = utils::ReadParam('iInputId', ''); $iTempId = utils::ReadParam('tempId', ''); - $aValues = utils::ReadParam('values', array(), false, 'raw_data'); + $aValues = utils::ReadParam('values', [], false, 'raw_data'); $oWidget = new UILinksWidgetDirect($sClass, $sAttCode, $iInputId); $oPage->SetData($oWidget->GetFormRow($oPage, $sRealClass, $aValues, -$iTempId)); break; - // ui.linksdirectwidget + // ui.linksdirectwidget case 'selectObjectsToAdd': $oPage->SetContentType('text/html'); $sClass = utils::ReadParam('class', '', false, 'class'); - $aAlreadyLinked = utils::ReadParam('aAlreadyLinked', array()); + $aAlreadyLinked = utils::ReadParam('aAlreadyLinked', []); $sJson = utils::ReadParam('json', '', false, 'raw_data'); /** @var \DBObject $oObj */ $oObj = null; @@ -290,26 +289,26 @@ try $iCurrObjectId = utils::ReadParam('iObjId', 0); $oPage->SetContentType('text/html'); $oAppContext = new ApplicationContext(); - $aPrefillFormParam = array( + $aPrefillFormParam = [ 'user' => Session::Get('auth_user'), 'context' => $oAppContext->GetAsHash(), 'att_code' => $sAttCode, 'origin' => 'console', 'source_obj' => $oObj, - ); + ]; $aPrefillFormParam['dest_class'] = ($oObj === null ? '' : $oObj->Get($sAttCode)->GetClass()); $oWidget = new UILinksWidgetDirect($sClass, $sAttCode, $iInputId); $oWidget->GetObjectsSelectionDlg($oPage, $oObj, $aAlreadyLinked, $aPrefillFormParam); break; - // ui.linksdirectwidget + // ui.linksdirectwidget case 'searchObjectsToAdd2': $oPage->SetContentType('text/html'); $sClass = utils::ReadParam('class', '', false, 'class'); $sRealClass = utils::ReadParam('real_class', '', false, 'class'); $sAttCode = utils::ReadParam('att_code', ''); $iInputId = utils::ReadParam('iInputId', ''); - $aAlreadyLinked = utils::ReadParam('aAlreadyLinked', array()); + $aAlreadyLinked = utils::ReadParam('aAlreadyLinked', []); $sJson = utils::ReadParam('json', '', false, 'raw_data'); $oObj = null; if ($sJson != '') { @@ -317,19 +316,19 @@ try $oObj = $oWizardHelper->GetTargetObject(); } $oAppContext = new ApplicationContext(); - $aPrefillFormParam = array( + $aPrefillFormParam = [ 'user' => Session::Get('auth_user'), 'context' => $oAppContext->GetAsHash(), 'att_code' => $sAttCode, 'origin' => 'console', 'source_obj' => $oObj, - ); + ]; $aPrefillFormParam['dest_class'] = ($oObj === null ? '' : $oObj->Get($sAttCode)->GetClass()); $oWidget = new UILinksWidgetDirect($sClass, $sAttCode, $iInputId); $oWidget->SearchObjectsToAdd($oPage, $sRealClass, $aAlreadyLinked, $oObj, $aPrefillFormParam); break; - // ui.linksdirectwidget + // ui.linksdirectwidget case 'doAddObjects2': $oPage->SetContentType('text/html'); $oPage->SetContentType('text/html'); @@ -358,9 +357,9 @@ try $oWidget->DoAddObjects($oPage, $oFullSetFilter); break; - //////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////// - // ui.extkeywidget + // ui.extkeywidget case 'searchObjectsToSelect': $oPage->SetContentType('text/html'); $sTargetClass = utils::ReadParam('sTargetClass', '', false, 'class'); @@ -381,7 +380,7 @@ try $oWidget->SearchObjectsToSelect($oPage, $sFilter, $sRemoteClass, $oObj); break; - // ui.extkeywidget: autocomplete + // ui.extkeywidget: autocomplete case 'ac_extkey': $oPage->SetContentType('text/plain'); $sTargetClass = utils::ReadParam('sTargetClass', '', false, 'class'); @@ -404,7 +403,7 @@ try } break; - // ui.extkeywidget + // ui.extkeywidget case 'objectSearchForm': $oPage->SetContentType('text/html'); $sTargetClass = utils::ReadParam('sTargetClass', '', false, 'class'); @@ -425,7 +424,7 @@ try $oWidget->GetSearchDialog($oPage, $sTitle, $oObj); break; - // ui.extkeywidget + // ui.extkeywidget case 'objectCreationForm': $oPage->SetContentType('text/html'); // Retrieving parameters @@ -433,24 +432,24 @@ try $iInputId = utils::ReadParam('iInputId', ''); $sAttCode = utils::ReadParam('sAttCode', ''); $sJson = utils::ReadParam('json', '', false, 'raw_data'); - $bTargetClassSelected = utils::ReadParam('bTargetClassSelected', '', false, 'raw_data'); - // Building form, if target class has child classes we ask the user for the desired leaf class, unless we've already done just that + $bTargetClassSelected = utils::ReadParam('bTargetClassSelected', '', false, 'raw_data'); + // Building form, if target class has child classes we ask the user for the desired leaf class, unless we've already done just that $oWidget = new UIExtKeyWidget($sTargetClass, $iInputId, $sAttCode, false); - if(!$bTargetClassSelected && MetaModel::HasChildrenClasses($sTargetClass)){ + if (!$bTargetClassSelected && MetaModel::HasChildrenClasses($sTargetClass)) { $oWidget->GetClassSelectionForm($oPage); } else { - $aPrefillFormParam = array(); + $aPrefillFormParam = []; if (!empty($sJson)) { $oWizardHelper = WizardHelper::FromJSON($sJson); $oObj = $oWizardHelper->GetTargetObject(); $oAppContext = new ApplicationContext(); - $aPrefillFormParam = array( + $aPrefillFormParam = [ 'user' => Session::Get('auth_user'), 'context' => $oAppContext->GetAsHash(), 'att_code' => $sAttCode, 'source_obj' => $oObj, - 'origin' => 'console' - ); + 'origin' => 'console', + ]; } else { // Search form: no current object $oObj = null; @@ -459,7 +458,7 @@ try } break; - // ui.extkeywidget + // ui.extkeywidget case 'doCreateObject': $oPage->SetContentType('application/json'); $sTargetClass = utils::ReadParam('sTargetClass', '', false, 'class'); @@ -471,7 +470,7 @@ try echo json_encode($aResult); break; - // ui.extkeywidget + // ui.extkeywidget case 'getObjectName': $oPage->SetContentType('application/json'); $sTargetClass = utils::ReadParam('sTargetClass', '', false, 'class'); @@ -481,10 +480,10 @@ try $sFormAttCode = utils::ReadParam('sFormAttCode', null); $oWidget = new UIExtKeyWidget($sTargetClass, $iInputId, '', $bSearchMode); $sName = $oWidget->GetObjectName($iObjectId, $sFormAttCode); - echo json_encode(array('name' => $sName)); + echo json_encode(['name' => $sName]); break; - // ui.extkeywidget + // ui.extkeywidget case 'displayHierarchy': $oPage->SetContentType('text/html'); $sTargetClass = utils::ReadParam('sTargetClass', '', false, 'class'); @@ -504,21 +503,21 @@ try $oWidget->DisplayHierarchy($oPage, $sFilter, $currValue, $oObj); break; - //////////////////////////////////////////////////// + //////////////////////////////////////////////////// - // ui.linkswidget + // ui.linkswidget case 'doAddObjects': $oPage->SetContentType('text/html'); AjaxRenderController::DoAddObjects($oPage, $sClass, $sFilter); break; - // ui.linkswidget + // ui.linkswidget case 'doAddIndirectLinks': $oPage = new JsonPage(); AjaxRenderController::DoAddIndirectLinks($oPage, $sClass, $sFilter); break; - //////////////////////////////////////////////////////////// - /// WizardHelper : see the corresponding PHP class, and JS class + //////////////////////////////////////////////////////////// + /// WizardHelper : see the corresponding PHP class, and JS class case 'wizard_helper_preview': $oPage->SetContentType('text/html'); @@ -542,7 +541,7 @@ try $oObj->Set($sAttCode, $defaultValue); } $sFormPrefix = $oWizardHelper->GetFormPrefix(); - $aExpectedAttributes = ($oWizardHelper->GetStimulus() === null) ? array() : $oObj->GetTransitionAttributes($oWizardHelper->GetStimulus(), $oWizardHelper->GetInitialState()); + $aExpectedAttributes = ($oWizardHelper->GetStimulus() === null) ? [] : $oObj->GetTransitionAttributes($oWizardHelper->GetStimulus(), $oWizardHelper->GetInitialState()); foreach ($oWizardHelper->GetFieldsForAllowedValues() as $sAttCode) { $sId = $oWizardHelper->GetIdForField($sAttCode); if ($sId != '') { @@ -567,8 +566,19 @@ try // Even non-writable fields (like AttributeExternal) can be refreshed $sHTMLValue = "
      ".$oObj->GetAsHTML($sAttCode)."
      "; } else { - $sHTMLValue = cmdbAbstractObject::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $value, - $displayValue, $sId, '', $iFlags, array('this' => $oObj, 'formPrefix' => $sFormPrefix), false); + $sHTMLValue = cmdbAbstractObject::GetFormElementForField( + $oPage, + $sClass, + $sAttCode, + $oAttDef, + $value, + $displayValue, + $sId, + '', + $iFlags, + ['this' => $oObj, 'formPrefix' => $sFormPrefix], + false + ); // Make sure that we immediately validate the field when we reload it $oPage->add_ready_script("$('#$sId').trigger('validate');"); } @@ -576,7 +586,7 @@ try } } } - $oWizardHelper->AddJsForUpdateFields($oPage); + $oWizardHelper->AddJsForUpdateFields($oPage); break; case 'obj_creation_form': @@ -588,21 +598,21 @@ try $sTargetState = utils::ReadParam('target_state', ''); $iTransactionId = utils::ReadParam('transaction_id', '', false, 'transaction_id'); $oObj->Set(MetaModel::GetStateAttributeCode($sClass), $sTargetState); - cmdbAbstractObject::DisplayCreationForm($oPage, $sClass, $oObj, array(), array('action' => utils::GetAbsoluteUrlAppRoot().'pages/UI.php', 'transaction_id' => $iTransactionId)); + cmdbAbstractObject::DisplayCreationForm($oPage, $sClass, $oObj, [], ['action' => utils::GetAbsoluteUrlAppRoot().'pages/UI.php', 'transaction_id' => $iTransactionId]); break; - // DisplayBlock + // DisplayBlock case 'ajax': $oPage->SetContentType('text/html'); if ($sFilter != "") { $sExtraParams = stripslashes(utils::ReadParam('extra_params', '', false, 'raw_data')); - $aExtraParams = array(); + $aExtraParams = []; if (!empty($sExtraParams)) { $aExtraParams = json_decode(str_replace("'", '"', $sExtraParams), true /* associative array */); } // Restore the app context from the ExtraParams $oAppContext = new ApplicationContext(false); // false => don't read the context yet ! - $aContext = array(); + $aContext = []; foreach ($oAppContext->GetNames() as $sName) { $sParamName = 'c['.$sName.']'; if (isset($aExtraParams[$sParamName])) { @@ -615,8 +625,7 @@ try } else { try { $oFilter = DBSearch::unserialize($sFilter); - } - catch (CoreException $e) { + } catch (CoreException $e) { $sFilter = utils::HtmlEntities($sFilter); $oPage->p("Invalid query (invalid filter) : $sFilter"); IssueLog::Error("ajax.render operation='ajax', invalid DBSearch filter param : $sFilter"); @@ -656,7 +665,7 @@ try $oFilter = DBSearch::unserialize($sFilter); } $oDisplayBlock = new DisplayBlock($oFilter, 'pie_chart_ajax', false); - $oDisplayBlock->RenderContent($oPage, array('group_by' => $sGroupBy)); + $oDisplayBlock->RenderContent($oPage, ['group_by' => $sGroupBy]); } else { $oPage->add("\n3d pie\n."); @@ -667,7 +676,7 @@ try $iRefresh = utils::ReadParam('refresh', '-1', false, 'int'); if ($iRefresh != -1) { $oPage->SetContentType('application/json'); - $aParams = utils::ReadParam('params', array(), false, 'raw_data'); + $aParams = utils::ReadParam('params', [], false, 'raw_data'); if ($sFilter != '') { $oFilter = DBObjectSearch::FromOQL($sFilter); $oDisplayBlock = new DisplayBlock($oFilter, 'chart_ajax', false); @@ -707,7 +716,7 @@ try $oPage->add_header("Pragma: public"); $oPage->add_header("Expires: Fri, 17 Jul 1970 05:00:00 GMT"); - $aParams = utils::ReadParam('params', array(), false, 'raw_data'); + $aParams = utils::ReadParam('params', [], false, 'raw_data'); if ($sFilter != '') { $oFilter = DBSearch::unserialize($sFilter); $oDisplayBlock = new DisplayBlock($oFilter, 'chart_ajax', false); @@ -741,7 +750,7 @@ try $oFilter = new DBObjectSearch($sClass); $oFilter->AddCondition($sAttCode, $sName, 'Begins with'); //$oFilter->AddCondition('org_id', $sOrg, '='); - $oSet = new CMDBObjectSet($oFilter, array($sAttCode => true)); + $oSet = new CMDBObjectSet($oFilter, [$sAttCode => true]); while (($iCount < $iMaxCount) && ($oObj = $oSet->fetch())) { $oPage->add($oObj->GetAsHTML($sAttCode)."|".$oObj->GetKey()."\n"); $iCount++; @@ -785,13 +794,13 @@ try $sTableId = utils::ReadParam('_table_id_', null, false, utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER); $sAction = utils::ReadParam('action', ''); $sSelectionMode = utils::ReadParam('selection_mode'); - $sResultListOuterSelector = utils::ReadParam('result_list_outer_selector', null,false, utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER); // actually an Id not a selector - $scssCount = utils::ReadParam('css_count', null,false,utils::ENUM_SANITIZATION_FILTER_ELEMENT_SELECTOR); - $sTableInnerId = utils::ReadParam('table_inner_id', null,false, utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER); + $sResultListOuterSelector = utils::ReadParam('result_list_outer_selector', null, false, utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER); // actually an Id not a selector + $scssCount = utils::ReadParam('css_count', null, false, utils::ENUM_SANITIZATION_FILTER_ELEMENT_SELECTOR); + $sTableInnerId = utils::ReadParam('table_inner_id', null, false, utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER); $oFilter = new DBObjectSearch($sClass); $oSet = new CMDBObjectSet($oFilter); - $sHtml = cmdbAbstractObject::GetSearchForm($oPage, $oSet, array( + $sHtml = cmdbAbstractObject::GetSearchForm($oPage, $oSet, [ 'currentId' => $currentId, 'baseClass' => $sRootClass, 'action' => $sAction, @@ -799,8 +808,8 @@ try 'selection_mode' => $sSelectionMode, 'result_list_outer_selector' => $sResultListOuterSelector, 'cssCount' => $scssCount, - 'table_inner_id' => $sTableInnerId - )); + 'table_inner_id' => $sTableInnerId, + ]); $oPage->add($sHtml); break; @@ -835,7 +844,7 @@ try // Invalidate temporary objects TemporaryObjectManager::GetInstance()->CancelAllTemporaryObjects($iTransactionId); - IssueLog::Trace('on_form_cancel', $sObjClass, array( + IssueLog::Trace('on_form_cancel', $sObjClass, [ '$iObjKey' => $iObjKey, '$sTransactionId' => $iTransactionId, '$sTempId' => $sTempId, @@ -843,7 +852,7 @@ try '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); + ]); break; @@ -888,18 +897,16 @@ try $sDashboardFile = RuntimeDashboard::GetDashboardFileFromRelativePath($sDashboardFileRelative); $oDashboard = RuntimeDashboard::GetDashboard($sDashboardFile, $sDashboardId); - $aResult = array('error' => ''); + $aResult = ['error' => '']; if (!is_null($oDashboard)) { try { $oDoc = utils::ReadPostedDocument('dashboard_upload_file'); $oDashboard->FromXml($oDoc->GetData()); $oDashboard->Save(); - } - catch (DOMException $e) { - $aResult = array('error' => Dict::S('UI:Error:InvalidDashboardFile')); - } - catch (Exception $e) { - $aResult = array('error' => $e->getMessage()); + } catch (DOMException $e) { + $aResult = ['error' => Dict::S('UI:Error:InvalidDashboardFile')]; + } catch (Exception $e) { + $aResult = ['error' => $e->getMessage()]; } } else { $aResult['error'] = 'Dashboard id="'.$sDashboardId.'" not found.'; @@ -915,11 +922,11 @@ try appUserPreferences::UnsetPref('display_original_dashboard_'.$sDashboardId); appUserPreferences::SetPref('display_original_dashboard_'.$sDashboardId, !$bStandardSelected); - $aExtraParams = utils::ReadParam('extra_params', array(), false, 'raw_data'); + $aExtraParams = utils::ReadParam('extra_params', [], false, 'raw_data'); $sDashboardFile = utils::ReadParam('file', '', false, 'raw_data'); $sReloadURL = utils::ReadParam('reload_url', '', false, utils::ENUM_SANITIZATION_FILTER_URL); $oDashboard = RuntimeDashboard::GetDashboard($sDashboardFile, $sDashboardId); - $aResult = array('error' => ''); + $aResult = ['error' => '']; if (!is_null($oDashboard)) { if (!empty($sReloadURL)) { $oDashboard->SetReloadURL($sReloadURL); @@ -931,11 +938,11 @@ try case 'reload_dashboard': $oPage->SetContentType('text/html'); $sDashboardId = utils::ReadParam('dashboard_id', '', false, 'raw_data'); - $aExtraParams = utils::ReadParam('extra_params', array(), false, 'raw_data'); + $aExtraParams = utils::ReadParam('extra_params', [], false, 'raw_data'); $sDashboardFile = utils::ReadParam('file', '', false, 'raw_data'); $sReloadURL = utils::ReadParam('reload_url', '', false, utils::ENUM_SANITIZATION_FILTER_URL); $oDashboard = RuntimeDashboard::GetDashboard($sDashboardFile, $sDashboardId); - $aResult = array('error' => ''); + $aResult = ['error' => '']; if (!is_null($oDashboard)) { if (!empty($sReloadURL)) { $oDashboard->SetReloadURL($sReloadURL); @@ -947,16 +954,16 @@ try case 'save_dashboard': $sDashboardId = utils::ReadParam('dashboard_id', '', false, 'context_param'); - $aExtraParams = utils::ReadParam('extra_params', array(), false, 'raw_data'); + $aExtraParams = utils::ReadParam('extra_params', [], false, 'raw_data'); $sReloadURL = utils::ReadParam('reload_url', '', false, utils::ENUM_SANITIZATION_FILTER_URL); appUserPreferences::SetPref('display_original_dashboard_'.$sDashboardId, false); $sJSExtraParams = json_encode($aExtraParams); - $aParams = array(); + $aParams = []; $aParams['layout_class'] = utils::ReadParam('layout_class', ''); $aParams['title'] = utils::ReadParam('title', '', false, 'raw_data'); $aParams['auto_reload'] = utils::ReadParam('auto_reload', false); $aParams['auto_reload_sec'] = utils::ReadParam('auto_reload_sec', 300); - $aParams['cells'] = utils::ReadParam('cells', array(), false, 'raw_data'); + $aParams['cells'] = utils::ReadParam('cells', [], false, 'raw_data'); $oDashboard = new RuntimeDashboard($sDashboardId); $oDashboard->FromParams($aParams); @@ -1013,11 +1020,11 @@ EOF case 'render_dashboard': $sDashboardId = utils::ReadParam('dashboard_id', '', false, 'raw_data'); - $aExtraParams = utils::ReadParam('extra_params', array(), false, 'raw_data'); - $aParams = array(); + $aExtraParams = utils::ReadParam('extra_params', [], false, 'raw_data'); + $aParams = []; $aParams['layout_class'] = utils::ReadParam('layout_class', ''); $aParams['title'] = utils::ReadParam('title', '', false, 'raw_data'); - $aParams['cells'] = utils::ReadParam('cells', array(), false, 'raw_data'); + $aParams['cells'] = utils::ReadParam('cells', [], false, 'raw_data'); $aParams['auto_reload'] = utils::ReadParam('auto_reload', false); $aParams['auto_reload_sec'] = utils::ReadParam('auto_reload_sec', 300); $sReloadURL = utils::ReadParam('reload_url', '', false, utils::ENUM_SANITIZATION_FILTER_URL); @@ -1029,7 +1036,7 @@ EOF case 'dashboard_editor': $sId = utils::ReadParam('id', '', false, 'context_param'); - $aExtraParams = utils::ReadParam('extra_params', array(), false, 'raw_data'); + $aExtraParams = utils::ReadParam('extra_params', [], false, 'raw_data'); $aExtraParams['dashboard_div_id'] = utils::Sanitize($sId, '', 'element_identifier'); $sDashboardFile = utils::ReadParam('file', '', false, 'string'); $sReloadURL = utils::ReadParam('reload_url', '', false, utils::ENUM_SANITIZATION_FILTER_URL); @@ -1069,7 +1076,7 @@ EOF $oPage->add_script("$('#dashlet_$sDashletId').html('$sHtml');"); // in ajax web page add_script has the same effect as add_ready_script // but is executed BEFORE all 'ready_scripts' $oForm = $oDashlet->GetForm(); // Rebuild the form since the values/content changed - $oForm->SetSubmitParams(utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php', array('operation' => 'update_dashlet_property')); + $oForm->SetSubmitParams(utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php', ['operation' => 'update_dashlet_property']); $sHtml = addslashes($oForm->RenderAsPropertySheet($oPage, true /* bReturnHtml */, '.itop-dashboard')); $sHtml = str_replace("\n", '', $sHtml); $sHtml = str_replace("\r", '', $sHtml); @@ -1080,7 +1087,7 @@ EOF case 'update_dashlet_property': require_once(APPROOT.'application/forms.class.inc.php'); require_once(APPROOT.'application/dashlet.class.inc.php'); - $aExtraParams = utils::ReadParam('extra_params', array(), false, utils::ENUM_SANITIZATION_FILTER_RAW_DATA); + $aExtraParams = utils::ReadParam('extra_params', [], false, utils::ENUM_SANITIZATION_FILTER_RAW_DATA); $aParams = utils::ReadParam('params', [], false, utils::ENUM_SANITIZATION_FILTER_RAW_DATA); // raw_data because we need different filter depending on the options $sDashletClass = utils::Sanitize($aParams['attr_dashlet_class'], DashletUnknown::class, utils::ENUM_SANITIZATION_FILTER_PHP_CLASS); // Dashlet PHP class or DashletUnknown if impl isn't present in the installed extensions $sDashletType = utils::Sanitize($aParams['attr_dashlet_type'], '', utils::ENUM_SANITIZATION_FILTER_PHP_CLASS); // original Dashlet PHP class, could be non-existing on the iTop instance (XML definition loading) @@ -1096,7 +1103,7 @@ EOF $aValues = $oForm->ReadParams(); // hash array: 'xxx' => 'new_value' $aCurrentValues = $aValues; - $aUpdatedDecoded = array(); + $aUpdatedDecoded = []; foreach ($aUpdatedProperties as $sProp) { $sDecodedProp = str_replace('attr_', '', $sProp); // Remove the attr_ prefix // Set the previous value @@ -1112,28 +1119,28 @@ EOF $aUpdatedDecoded[] = $sDecodedProp; } - $oDashlet->FromParams($aCurrentValues); - $sPrevClass = get_class($oDashlet); - $oDashlet = $oDashlet->Update($aValues, $aUpdatedDecoded); - $sNewClass = get_class($oDashlet); - if ($sNewClass != $sPrevClass) { - $oPage->add_ready_script("$('#dashlet_$sDashletId').dashlet('option', {dashlet_class: '$sNewClass'});"); + $oDashlet->FromParams($aCurrentValues); + $sPrevClass = get_class($oDashlet); + $oDashlet = $oDashlet->Update($aValues, $aUpdatedDecoded); + $sNewClass = get_class($oDashlet); + if ($sNewClass != $sPrevClass) { + $oPage->add_ready_script("$('#dashlet_$sDashletId').dashlet('option', {dashlet_class: '$sNewClass'});"); + } + if ($oDashlet->IsRedrawNeeded()) { + $oBlock = $oDashlet->DoRender($oPage, true, false, $aExtraParams); + $sHtml = ConsoleBlockRenderer::RenderBlockTemplateInPage($oPage, $oBlock); + $sHtml = json_encode($sHtml); + $oPage->add_script("$('#dashlet_$sDashletId').html({$sHtml});"); + } + if ($oDashlet->IsFormRedrawNeeded()) { + $oForm = $oDashlet->GetForm(); // Rebuild the form since the values/content changed + $oForm->SetSubmitParams(utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php', ['operation' => 'update_dashlet_property', 'extra_params' => $aExtraParams]); + $sHtml = $oForm->RenderAsPropertySheet($oPage, true, '.itop-dashboard'); + $sHtml = json_encode($sHtml); + $oPage->add_script("$('#dashlet_properties_$sDashletId').html({$sHtml});"); + } } - if ($oDashlet->IsRedrawNeeded()) { - $oBlock = $oDashlet->DoRender($oPage, true, false, $aExtraParams); - $sHtml = ConsoleBlockRenderer::RenderBlockTemplateInPage($oPage, $oBlock); - $sHtml= json_encode($sHtml); - $oPage->add_script("$('#dashlet_$sDashletId').html({$sHtml});"); - } - if ($oDashlet->IsFormRedrawNeeded()) { - $oForm = $oDashlet->GetForm(); // Rebuild the form since the values/content changed - $oForm->SetSubmitParams(utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php', array('operation' => 'update_dashlet_property', 'extra_params' => $aExtraParams)); - $sHtml = $oForm->RenderAsPropertySheet($oPage, true, '.itop-dashboard'); - $sHtml= json_encode($sHtml); - $oPage->add_script("$('#dashlet_properties_$sDashletId').html({$sHtml});"); - } - } - break; + break; case 'dashlet_creation_dlg': $sOQL = utils::ReadParam('oql', '', false, 'raw_data'); @@ -1221,9 +1228,10 @@ EOF 'base/layouts/navigation-menu/menu-node' ); - $MenuNameEscaped = utils::HtmlEntities($aValues['name']); - // Important: Mind the back ticks to avoid line breaks to break the JS - $oPage->add_script(<<add_script( + <<GetClass(); $sNeedleFormat = isset($aAccelerators[$sClassName]['needle']) ? $aAccelerators[$sClassName]['needle'] : '%$needle$%'; $sNeedle = str_replace('$needle$', $sFullText, $sNeedleFormat); - $aParams = array('needle' => $sNeedle); + $aParams = ['needle' => $sNeedle]; } else { $sClassName = $sClassSpec; $oFilter = new DBObjectSearch($sClassName); - $aParams = array(); + $aParams = []; foreach ($aFullTextNeedles as $sSearchText) { $oFilter->AddCondition_FullText($sSearchText); @@ -1367,9 +1375,9 @@ JS if ($iTune > 0) { $fStartedClass = microtime(true); } - $oSet = new DBObjectSet($oFilter, array(), $aParams); + $oSet = new DBObjectSet($oFilter, [], $aParams); if (array_key_exists($sClassName, $aAccelerators) && array_key_exists('attributes', $aAccelerators[$sClassName])) { - $oSet->OptimizeColumnLoad(array($oFilter->GetClassAlias() => $aAccelerators[$sClassName]['attributes'])); + $oSet->OptimizeColumnLoad([$oFilter->GetClassAlias() => $aAccelerators[$sClassName]['attributes']]); } $sFullTextJS = addslashes($sFullText); @@ -1388,13 +1396,12 @@ JS }); EOF; - $sEnlargeButton = ''; if ($bEnableEnlarge) { $sEnlargeButton = " "; } if ($oSet->Count() > 0) { - $aLeafs = array(); + $aLeafs = []; while ($oObj = $oSet->Fetch()) { if (get_class($oObj) == $sClassName) { $aLeafs[] = $oObj->GetKey(); @@ -1416,7 +1423,7 @@ EOF; $oBlock = new DisplayBlock($oLeafsFilter, 'list', false); $sBlockId = 'global_search_'.$sClassName; $oPage->add('
      '); - $oBlock->RenderContent($oPage, array('table_id' => $sBlockId, 'currentId' => $sBlockId)); + $oBlock->RenderContent($oPage, ['table_id' => $sBlockId, 'currentId' => $sBlockId]); $oPage->add("
      \n"); $oPage->add("
      \n"); $oPage->p(' '); // Some space ? @@ -1492,7 +1499,7 @@ EOF if (preg_match('/^"(.*)"$/', $sFullText, $aMatches)) { // The text is surrounded by double-quotes, remove the quotes and treat it as one single expression - $aFullTextNeedles = array($aMatches[1]); + $aFullTextNeedles = [$aMatches[1]]; } else { // Split the text on the blanks and treat this as a search for AND AND $aFullTextNeedles = explode(' ', $sFullText); @@ -1508,7 +1515,7 @@ EOF $oPage->add("

      ".MetaModel::GetClassIcon($sClass)." ".Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', $oSet->Count(), Metamodel::GetName($sClass))."

      \n"); $oPage->add("
      \n"); if ($oSet->Count() > 0) { - $aLeafs = array(); + $aLeafs = []; while ($oObj = $oSet->Fetch()) { if (get_class($oObj) == $sClass) { $aLeafs[] = $oObj->GetKey(); @@ -1520,7 +1527,7 @@ EOF $oBlock = new DisplayBlock($oLeafsFilter, 'list', false); $sBlockId = 'global_search_'.$sClass; $oPage->add('
      '); - $oBlock->RenderContent($oPage, array('table_id' => $sBlockId, 'currentId' => $sBlockId)); + $oBlock->RenderContent($oPage, ['table_id' => $sBlockId, 'currentId' => $sBlockId]); $oPage->add('
      '); $oPage->P(' '); // Some space ? // Hide "no object found" @@ -1593,12 +1600,12 @@ EOF $oPage->add('

      '.Dict::S('ExcelExport:PreparingExport').'

      '); $oPage->add('
      '.Dict::S('ExcelExport:Statistics').'
      '); $oPage->add('
      '); - $aLabels = array( + $aLabels = [ 'dialog_title' => Dict::S('ExcelExporter:ExportDialogTitle'), 'cancel_button' => Dict::S('UI:Button:Cancel'), 'export_button' => Dict::S('ExcelExporter:ExportButton'), 'download_button' => Dict::Format('ExcelExporter:DownloadButton', 'export.xlsx'), //TODO: better name for the file (based on the class of the filter??) - ); + ]; $sJSLabels = json_encode($aLabels); $sFilter = addslashes($sFilter); $sJSPageUrl = addslashes($sAppRootUrl.'pages/ajax.render.php'); @@ -1615,7 +1622,7 @@ EOF //$oExcelExporter->SetChunkSize(10); //Only for testing $oExcelExporter->SetAdvancedMode($bAdvanced); $sToken = $oExcelExporter->SaveState(); - $oPage->add(json_encode(array('status' => 'ok', 'token' => $sToken))); + $oPage->add(json_encode(['status' => 'ok', 'token' => $sToken])); break; case 'xlsx_run': @@ -1629,7 +1636,7 @@ EOF $sToken = utils::ReadParam('token', '', false, 'raw_data'); $oExcelExporter = new ExcelExporter($sToken); $aStatus = $oExcelExporter->Run(); - $aResults = array('status' => $aStatus['code'], 'percentage' => $aStatus['percentage'], 'message' => $aStatus['message']); + $aResults = ['status' => $aStatus['code'], 'percentage' => $aStatus['percentage'], 'message' => $aStatus['message']]; if ($aStatus['code'] == 'done') { $aResults['statistics'] = $oExcelExporter->GetStatistics('html'); } @@ -1667,10 +1674,10 @@ EOF $sPageOrientation = utils::ReadParam('o', 'L'); $sTitle = utils::ReadParam('title', '', false, 'raw_data'); $sPositions = utils::ReadParam('positions', null, false, 'raw_data'); - $aExcludedClasses = utils::ReadParam('excluded_classes', array(), false, 'raw_data'); + $aExcludedClasses = utils::ReadParam('excluded_classes', [], false, 'raw_data'); $bIncludeList = (bool)utils::ReadParam('include_list', false); $sComments = utils::ReadParam('comments', '', false, 'raw_data'); - $aContexts = utils::ReadParam('contexts', array(), false, 'raw_data'); + $aContexts = utils::ReadParam('contexts', [], false, 'raw_data'); $sContextKey = utils::ReadParam('context_key', '', false, 'raw_data'); $aPositions = null; if ($sPositions != null) { @@ -1678,8 +1685,8 @@ EOF } // Get the list of source objects - $aSources = utils::ReadParam('sources', array(), false, 'raw_data'); - $aSourceObjects = array(); + $aSources = utils::ReadParam('sources', [], false, 'raw_data'); + $aSourceObjects = []; foreach ($aSources as $sClass => $aIDs) { $oSearch = new DBObjectSearch($sClass); $oSearch->AddCondition('id', $aIDs, 'IN'); @@ -1694,8 +1701,8 @@ EOF } // Get the list of excluded objects - $aExcluded = utils::ReadParam('excluded', array(), false, 'raw_data'); - $aExcludedObjects = array(); + $aExcluded = utils::ReadParam('excluded', [], false, 'raw_data'); + $aExcludedObjects = []; foreach ($aExcluded as $sClass => $aIDs) { $oSearch = new DBObjectSearch($sClass); $oSearch->AddCondition('id', $aIDs, 'IN'); @@ -1732,7 +1739,7 @@ EOF $oGraph->UpdatePositions($aPositions); } - $aGroups = array(); + $aGroups = []; $oIterator = new RelationTypeIterator($oGraph, 'Node'); foreach ($oIterator as $oNode) { if ($oNode instanceof DisplayableGroupNode) { @@ -1744,14 +1751,14 @@ EOF if ($bIncludeList) { // Then the lists of objects (one table per finalclass) - $aResults = array(); + $aResults = []; $oIterator = new RelationTypeIterator($oRelGraph, 'Node'); foreach ($oIterator as $oNode) { $oObj = $oNode->GetProperty('object'); // Some nodes (Redundancy Nodes and Group) do not contain an object if ($oObj) { $sObjClass = get_class($oObj); if (!array_key_exists($sObjClass, $aResults)) { - $aResults[$sObjClass] = array(); + $aResults[$sObjClass] = []; } $aResults[$sObjClass][] = $oObj; } @@ -1771,7 +1778,7 @@ EOF $oTitle = new Html(" ".Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', $oSet->Count(), Metamodel::GetName($sListClass)));*/ $oTitle = new Html(Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', $oSet->Count(), Metamodel::GetName($sListClass))); $oPage->AddSubBlock(TitleUIBlockFactory::MakeStandard($oTitle, 2)); - $oPage->AddSubBlock(cmdbAbstractObject::GetDataTableFromDBObjectSet($oSet, array('table_id' => $sSourceClass.'_'.$sRelation.'_'.$sDirection.'_'.$sListClass))); + $oPage->AddSubBlock(cmdbAbstractObject::GetDataTableFromDBObjectSet($oSet, ['table_id' => $sSourceClass.'_'.$sRelation.'_'.$sDirection.'_'.$sListClass])); } // Then the content of the groups (one table per group) @@ -1805,10 +1812,10 @@ EOF $oDoc = new ormDocument($sPDF, 'application/pdf', $sTitle.'.pdf'); $oAttachment->Set('contents', $oDoc); $iAttachmentId = $oAttachment->DBInsert(); - $aRet = array( + $aRet = [ 'status' => 'ok', 'att_id' => $iAttachmentId, - ); + ]; $oPage->SetData($aRet); } break; @@ -1821,17 +1828,17 @@ EOF $sDirection = utils::ReadParam('direction', 'down'); $iGroupingThreshold = utils::ReadParam('g', 5); $sPositions = utils::ReadParam('positions', null, false, 'raw_data'); - $aExcludedClasses = utils::ReadParam('excluded_classes', array(), false, 'raw_data'); - $aContexts = utils::ReadParam('contexts', array(), false, 'raw_data'); - $sContextKey = utils::ReadParam('context_key', array(), false, 'raw_data'); + $aExcludedClasses = utils::ReadParam('excluded_classes', [], false, 'raw_data'); + $aContexts = utils::ReadParam('contexts', [], false, 'raw_data'); + $sContextKey = utils::ReadParam('context_key', [], false, 'raw_data'); $aPositions = null; if ($sPositions != null) { $aPositions = json_decode($sPositions, true); } // Get the list of source objects - $aSources = utils::ReadParam('sources', array(), false, 'raw_data'); - $aSourceObjects = array(); + $aSources = utils::ReadParam('sources', [], false, 'raw_data'); + $aSourceObjects = []; foreach ($aSources as $sClass => $aIDs) { $oSearch = new DBObjectSearch($sClass); $oSearch->AddCondition('id', $aIDs, 'IN'); @@ -1842,8 +1849,8 @@ EOF } // Get the list of excluded objects - $aExcluded = utils::ReadParam('excluded', array(), false, 'raw_data'); - $aExcludedObjects = array(); + $aExcluded = utils::ReadParam('excluded', [], false, 'raw_data'); + $aExcludedObjects = []; foreach ($aExcluded as $sClass => $aIDs) { $oSearch = new DBObjectSearch($sClass); $oSearch->AddCondition('id', $aIDs, 'IN'); @@ -1891,12 +1898,12 @@ EOF $oSearch->SetShowObsoleteData(utils::ShowObsoleteData()); $oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral(Dict::Format('UI:RelationGroupNumber_N', (1 + $idx)), 1, "relation_group_$idx")); $oBlock = new DisplayBlock($oSearch, 'list'); - $oBlock->Display($oPage, 'group_'.$iBlock++, array( + $oBlock->Display($oPage, 'group_'.$iBlock++, [ 'surround_with_panel' => true, 'panel_class' => $sListClass, 'panel_title' => Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', count($aDefinition['keys']), Metamodel::GetName($sListClass)), 'panel_icon' => MetaModel::GetClassIcon($sListClass, false), - )); + ]); } break; @@ -1908,13 +1915,13 @@ EOF $oSearch->AddCondition('id', $aKeys, 'IN'); $oSearch->SetShowObsoleteData(utils::ShowObsoleteData()); $oBlock = new DisplayBlock($oSearch, 'list'); - $oBlock->Display($oPage, 'list_'.$iBlock++, array( + $oBlock->Display($oPage, 'list_'.$iBlock++, [ 'table_id' => 'ImpactAnalysis_'.$sListClass, 'surround_with_panel' => true, 'panel_class' => $sListClass, 'panel_title' => Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', count($aKeys), Metamodel::GetName($sListClass)), 'panel_icon' => MetaModel::GetClassIcon($sListClass, false), - )); + ]); } break; @@ -1941,8 +1948,8 @@ EOF $oExtKeyToRemote = MetaModel::GetAttributeDef($oAttDef->GetLinkedClass(), $sExtKeyToRemote); $sRemoteClass = $oExtKeyToRemote->GetTargetClass(); $oSet = $oTicket->Get($sAttCode); - $aSourceObjects = array(); - $aExcludedObjects = array(); + $aSourceObjects = []; + $aExcludedObjects = []; while ($oLnk = $oSet->Fetch()) { if ($oLnk->Get($sImpactAttCode) == 'manual') { $aSourceObjects[] = MetaModel::GetObject($sRemoteClass, $oLnk->Get($sExtKeyToRemote)); @@ -1966,7 +1973,7 @@ EOF $sContextKey = 'itop-tickets/relation_context/'.$sClass.'/'.$sRelation.'/'.$sDirection; $oAppContext = new ApplicationContext(); $oPage->AddSubBlock($oGraph->DisplayFilterBox($oPage, $aResults)); - $oGraph->DisplayGraph($oPage, $sRelation, $oAppContext, $aExcludedObjects, $sClass, $iId, $sContextKey, array('this' => $oTicket)); + $oGraph->DisplayGraph($oPage, $sRelation, $oAppContext, $aExcludedObjects, $sClass, $iId, $sContextKey, ['this' => $oTicket]); break; case 'export_build': @@ -2006,7 +2013,7 @@ EOF $oExporter->Cleanup(); } } - $aResult = array('code' => 'error', 'percentage' => 100, 'message' => Dict::S('Core:BulkExport:ExportCancelledByUser')); + $aResult = ['code' => 'error', 'percentage' => 100, 'message' => Dict::S('Core:BulkExport:ExportCancelledByUser')]; $oPage->add(json_encode($aResult)); break; @@ -2031,7 +2038,7 @@ EOF $oPage->add(json_encode($aResult)); break; - // Important: Only from the backoffice AND logged in + // Important: Only from the backoffice AND logged in case 'acquire_lock': $sObjClass = utils::ReadParam('obj_class', '', false, 'class'); $iObjKey = (int)utils::ReadParam('obj_key', 0, false, 'integer'); @@ -2100,7 +2107,7 @@ EOF $oPage->SetOutputDataOnly(true); // Image uploaded via CKEditor - $aResult = array( + $aResult = [ 'uploaded' => 0, 'fileName' => '', 'url' => '', @@ -2108,7 +2115,7 @@ EOF 'msg' => '', 'att_id' => 0, 'preview' => 'false', - ); + ]; $sObjClass = stripslashes(utils::ReadParam('obj_class', '', false, 'class')); $sTempId = utils::ReadParam('temp_id', '', false, 'transaction_id'); @@ -2141,7 +2148,7 @@ EOF $aResult['height'] = $aDimensions['height']; } - IssueLog::Trace('InlineImage created', LogChannels::INLINE_IMAGE, array( + IssueLog::Trace('InlineImage created', LogChannels::INLINE_IMAGE, [ '$operation' => $operation, '$aResult' => $aResult, 'secret' => $oAttachment->Get('secret'), @@ -2150,19 +2157,18 @@ EOF 'user' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); + ]); } else { $aResult['error'] = $oDoc->GetFileName().' is not a valid image format.'; } - } - catch (FileUploadException $e) { + } catch (FileUploadException $e) { $aResult['error'] = $e->GetMessage(); } } $oPage->SetData($aResult); break; - /** @noinspection PhpMissingBreakStatementInspection cke_upload_and_browse and cke_browse are chained */ + /** @noinspection PhpMissingBreakStatementInspection cke_upload_and_browse and cke_browse are chained */ case 'cke_upload_and_browse': $sTempId = utils::ReadParam('temp_id', '', false, 'transaction_id'); $sObjClass = utils::ReadParam('obj_class', '', false, 'class'); @@ -2170,12 +2176,14 @@ EOF $oDoc = utils::ReadPostedDocument('upload'); $sDocMimeType = $oDoc->GetMimeType(); if (!InlineImage::IsImage($sDocMimeType)) { - LogErrorMessage('CKE : error when uploading image in ajax.render.php, not an image', - array( + LogErrorMessage( + 'CKE : error when uploading image in ajax.render.php, not an image', + [ 'operation' => 'cke_upload_and_browse', 'class' => $sObjClass, 'ImgMimeType' => $sDocMimeType, - )); + ] + ); } else { $aDimensions = null; $oDoc = InlineImage::ResizeImageToFit($oDoc, $aDimensions); @@ -2189,7 +2197,7 @@ EOF $oAttachment->Set('secret', sprintf('%06x', mt_rand(0, 0xFFFFFF))); // something not easy to guess $iAttId = $oAttachment->DBInsert(); - IssueLog::Trace('InlineImage created', LogChannels::INLINE_IMAGE, array( + IssueLog::Trace('InlineImage created', LogChannels::INLINE_IMAGE, [ '$operation' => $operation, 'secret' => $oAttachment->Get('secret'), 'temp_id' => $sTempId, @@ -2197,19 +2205,20 @@ EOF 'user' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); + ]); } - } - catch (FileUploadException $e) { - LogErrorMessage('CKE : error when uploading image in ajax.render.php, exception occured', - array( + } catch (FileUploadException $e) { + LogErrorMessage( + 'CKE : error when uploading image in ajax.render.php, exception occured', + [ 'operation' => 'cke_upload_and_browse', 'class' => $sObjClass, 'exceptionMsg' => $e, - )); + ] + ); } - // Fall though !! => browse + // Fall though !! => browse case 'cke_browse': $oPage = new NiceWebPage(Dict::S('UI:BrowseInlineImages')); @@ -2320,7 +2329,7 @@ $('.img-picker').magnificPopup({type: 'image', closeOnContentClick: true }); EOF ); $sOQL = "SELECT InlineImage WHERE ((temp_id = :temp_id) OR (item_class = :obj_class AND item_id = :obj_id))"; - $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('temp_id' => $sTempId, 'obj_class' => $sClass, 'obj_id' => $iObjectId)); + $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), [], ['temp_id' => $sTempId, 'obj_class' => $sClass, 'obj_id' => $iObjectId]); $oPage->add("
      $sAvailableImagesLegend"); if ($oSet->Count() == 0) { @@ -2339,10 +2348,10 @@ EOF $oPage->add("
      "); break; - /** - * @internal - * @deprecated 3.2.0 N°7552 Use object.search_for_mentions route instead - */ + /** + * @internal + * @deprecated 3.2.0 N°7552 Use object.search_for_mentions route instead + */ case 'cke_mentions': $oController = new ObjectController(); $oPage = $oController->OperationSearchForMentions(); @@ -2351,11 +2360,11 @@ EOF case 'custom_fields_update': $oPage = new JsonPage(); $sAttCode = utils::ReadParam('attcode', ''); - $aRequestedFields = utils::ReadParam('requested_fields', array()); + $aRequestedFields = utils::ReadParam('requested_fields', []); $sRequestedFieldsFormPath = utils::ReadParam('form_path', ''); $sJson = utils::ReadParam('json_obj', '', false, 'raw_data'); - $aResult = array(); + $aResult = []; try { $oWizardHelper = WizardHelper::FromJSON($sJson); @@ -2369,26 +2378,24 @@ EOF $aRenderRes = $oRenderer->Render($aRequestedFields); $aResult['form']['updated_fields'] = $aRenderRes; - } - catch (Exception $e) { + } catch (Exception $e) { $aResult['error'] = $e->getMessage(); } $oPage->SetData($aResult); $oPage->SetOutputDataOnly(true); break; - //-------------------------------- - // Preferences - //-------------------------------- - /** @internal */ + //-------------------------------- + // Preferences + //-------------------------------- + /** @internal */ case 'preferences.set_user_picture': $oPage = new JsonPage(); try { $oController = new PreferencesController(); $aResult = $oController->SetUserPicture(); $aResult['success'] = true; - } - catch (Exception $oException) { + } catch (Exception $oException) { $aResult = [ 'success' => false, 'error_message' => $oException->getMessage(), @@ -2397,10 +2404,10 @@ EOF $oPage->SetData($aResult); break; - //-------------------------------- - // Activity panel - //-------------------------------- - /** @internal */ + //-------------------------------- + // Activity panel + //-------------------------------- + /** @internal */ case 'activity_panel.save_state': $oPage = new JsonPage(); try { @@ -2409,8 +2416,7 @@ EOF $aResult = [ 'success' => true, ]; - } - catch (Exception $oException) { + } catch (Exception $oException) { $aResult = [ 'success' => false, 'error_message' => $oException->getMessage(), @@ -2419,14 +2425,13 @@ EOF $oPage->SetData($aResult); break; - /** @internal */ + /** @internal */ case 'activity_panel.add_caselog_entries': $oPage = new JsonPage(); try { $oController = new ActivityPanelController(); $aResult = $oController->AddCaseLogsEntries(); - } - catch (Exception $oException) { + } catch (Exception $oException) { $aResult = [ 'success' => false, 'error_message' => $oException->getMessage(), @@ -2435,14 +2440,13 @@ EOF $oPage->SetData($aResult); break; - /** @internal */ + /** @internal */ case 'activity_panel.load_more_entries': $oPage = new JsonPage(); try { $oController = new ActivityPanelController(); $aResult = $oController->LoadMoreEntries(); - } - catch (Exception $oException) { + } catch (Exception $oException) { $aResult = [ 'success' => false, 'error_message' => $oException->getMessage(), @@ -2451,35 +2455,34 @@ EOF $oPage->SetData($aResult); break; - //-------------------------------- - // Navigation menu - //-------------------------------- + //-------------------------------- + // Navigation menu + //-------------------------------- case 'get_menus_count': $oPage = new JsonPage(); $oPage->SetOutputDataOnly(true); $oAjaxRenderController->GetMenusCount($oPage); break; - //-------------------------------- - // Object - //-------------------------------- - /** @internal */ + //-------------------------------- + // Object + //-------------------------------- + /** @internal */ case 'object.modify': $oController = new ObjectController(); $oPage = $oController->OperationModify(); break; - //-------------------------------- - // WelcomePopupMenu - //-------------------------------- + //-------------------------------- + // WelcomePopupMenu + //-------------------------------- case 'welcome_popup.acknowledge_message': $oPage = new JsonPage(); try { $oController = new WelcomePopupController(); $oController->AcknowledgeMessage(); $aResult = ['success' => true]; - } - catch (Exception $oException) { + } catch (Exception $oException) { $aResult = [ 'success' => false, 'error_message' => $oException->getMessage(), @@ -2500,10 +2503,10 @@ EOF IssueLog::Error($e->getMessage()."\nDebug trace:\n".$e->getTraceAsString()); } -function LogErrorMessage($sMsgPrefix, $aContextInfo) { +function LogErrorMessage($sMsgPrefix, $aContextInfo) +{ $sCurrentUserLogin = UserRights::GetUser(); $sContextInfo = urldecode(http_build_query($aContextInfo, '', ', ')); $sErrorMessage = "$sMsgPrefix - User='$sCurrentUserLogin', $sContextInfo"; IssueLog::Error($sErrorMessage); } - diff --git a/pages/ajax.searchform.php b/pages/ajax.searchform.php index e50d5edfd..3b4f3451a 100644 --- a/pages/ajax.searchform.php +++ b/pages/ajax.searchform.php @@ -1,4 +1,5 @@ ComputeAndReport('Data model loaded'); $oKPI = new ExecutionKPI(); @@ -23,8 +23,7 @@ try LoginWebPage::DoLogin(); $sParams = utils::ReadParam('params', '', false, 'raw_data'); - if (!$sParams) - { + if (!$sParams) { throw new AjaxSearchException("Invalid query (empty filter)", 400); } @@ -36,61 +35,47 @@ try $aListParams = (array)json_decode($sListParams, true); $aParams = json_decode($sParams, true); - if (array_key_exists('hidden_criteria', $aListParams)) - { + if (array_key_exists('hidden_criteria', $aListParams)) { $sHiddenCriteria = $aListParams['hidden_criteria']; - } - else - { + } else { $sHiddenCriteria = ''; } $oFilter = CriterionParser::Parse($aParams['base_oql'], $aParams['criterion'], $sHiddenCriteria); $oDisplayBlock = new DisplayBlock($oFilter, 'list_search', false); - foreach($aListParams as $key => $value) - { - $aExtraParams[$key] = $value; - } + foreach ($aListParams as $key => $value) { + $aExtraParams[$key] = $value; + } - if (array_key_exists('table_inner_id', $aListParams)) - { - $sListId = utils::Sanitize($aListParams['table_inner_id'], '', utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER); - } + if (array_key_exists('table_inner_id', $aListParams)) { + $sListId = utils::Sanitize($aListParams['table_inner_id'], '', utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER); + } - if (array_key_exists('json', $aListParams)) - { + if (array_key_exists('json', $aListParams)) { $aJson = $aListParams['json']; $sJson = json_encode($aJson); $oWizardHelper = WizardHelper::FromJSON($sJson); $oObj = $oWizardHelper->GetTargetObject(); - if (array_key_exists('query_params', $aExtraParams)) - { + if (array_key_exists('query_params', $aExtraParams)) { $aExtraParams['query_params']['this->object()'] = $oObj; - } - else - { - $aExtraParams['query_params'] = array('this->object()' => $oObj); + } else { + $aExtraParams['query_params'] = ['this->object()' => $oObj]; } } - if (!isset($aExtraParams['update_history'])) - { + if (!isset($aExtraParams['update_history'])) { $aExtraParams['update_history'] = true; } $aExtraParams['display_limit'] = true; - if (isset($sListId)) - { + if (isset($sListId)) { $oPage->AddUiBlock($oDisplayBlock->GetDisplay($oPage, $sListId, $aExtraParams)); - } - else - { + } else { $oDisplayBlock->RenderContent($oPage, $aExtraParams); } - if (isset($aListParams['debug']) || UserRights::IsAdministrator()) - { + if (isset($aListParams['debug']) || UserRights::IsAdministrator()) { $oCollapsible = CollapsibleSectionUIBlockFactory::MakeStandard(Dict::S('UI:RunQuery:MoreInfo')); $oPage->AddSubBlock($oCollapsible); @@ -123,4 +108,4 @@ try // note: transform to cope with XSS attacks echo '
      '.utils::EscapeHtml($e->GetMessage()).'
      '; IssueLog::Error($e->getMessage()."\nDebug trace:\n".$e->getTraceAsString()); -} \ No newline at end of file +} diff --git a/pages/audit.php b/pages/audit.php index f4c705d31..3e9a3051a 100644 --- a/pages/audit.php +++ b/pages/audit.php @@ -1,4 +1,5 @@ GetClass(); + $sObjClass = $oFilter->GetClass(); $aContextParams = $oAppContext->GetNames(); - $aCallSpec = array($sObjClass, 'MapContextParam'); - if (is_callable($aCallSpec)) - { - foreach($aContextParams as $sParamName) - { + $aCallSpec = [$sObjClass, 'MapContextParam']; + if (is_callable($aCallSpec)) { + foreach ($aContextParams as $sParamName) { $sValue = $oAppContext->GetCurrentValue($sParamName, null); - if ($sValue != null) - { + if ($sValue != null) { $sAttCode = call_user_func($aCallSpec, $sParamName); // Returns null when there is no mapping for this parameter - if ( ($sAttCode != null) && MetaModel::IsValidAttCode($sObjClass, $sAttCode)) - { + if (($sAttCode != null) && MetaModel::IsValidAttCode($sObjClass, $sAttCode)) { // Check if the condition points to a hierarchical key - $bConditionAdded = false; - if ($sAttCode == 'id') - { + $bConditionAdded = false; + if ($sAttCode == 'id') { // Filtering on the objects themselves $sHierarchicalKeyCode = MetaModel::IsHierarchicalClass($sObjClass); - - if ($sHierarchicalKeyCode !== false) - { + + if ($sHierarchicalKeyCode !== false) { $oRootFilter = new DBObjectSearch($sObjClass); $oRootFilter->AddCondition($sAttCode, $sValue); $oFilter->AddCondition_PointingTo($oRootFilter, $sHierarchicalKeyCode, TREE_OPERATOR_BELOW); // Use the 'below' operator by default $bConditionAdded = true; } - } - else - { + } else { $oAttDef = MetaModel::GetAttributeDef($sObjClass, $sAttCode); $bConditionAdded = false; - if ($oAttDef->IsExternalKey()) - { + if ($oAttDef->IsExternalKey()) { $sHierarchicalKeyCode = MetaModel::IsHierarchicalClass($oAttDef->GetTargetClass()); - - if ($sHierarchicalKeyCode !== false) - { + + if ($sHierarchicalKeyCode !== false) { $oRootFilter = new DBObjectSearch($oAttDef->GetTargetClass()); $oRootFilter->AddCondition('id', $sValue); $oHKFilter = new DBObjectSearch($oAttDef->GetTargetClass()); @@ -77,8 +68,7 @@ function FilterByContext(DBSearch &$oFilter, ApplicationContext $oAppContext) } } } - if (!$bConditionAdded) - { + if (!$bConditionAdded) { $oFilter->AddCondition($sAttCode, $sValue); } } @@ -105,37 +95,28 @@ function GetRuleResultFilter($iRuleId, $oDefinitionFilter, $oAppContext) $oRuleFilter->UpdateContextFromUser(); FilterByContext($oRuleFilter, $oAppContext); // Not needed since this filter is a subset of the definition filter, but may speedup things - if ($oRule->Get('valid_flag') == 'false') - { + if ($oRule->Get('valid_flag') == 'false') { // The query returns directly the invalid elements $oFilter = $oRuleFilter->Intersect($oDefinitionFilter); - } - else - { + } else { // The query returns only the valid elements, all the others are invalid // Warning : we're generating a `WHERE ID IN`... query, and this could be very slow if there are lots of id ! - $aValidRows = $oRuleFilter->ToDataArray(array('id')); - $aValidIds = array(); - foreach($aValidRows as $aRow) - { + $aValidRows = $oRuleFilter->ToDataArray(['id']); + $aValidIds = []; + foreach ($aValidRows as $aRow) { $aValidIds[] = $aRow['id']; } /** @var \DBObjectSearch $oFilter */ $oFilter = $oDefinitionFilter->DeepClone(); - if (count($aValidIds) > 0) - { - $aInDefSet = array(); - foreach($oDefinitionFilter->ToDataArray(array('id')) as $aRow) - { + if (count($aValidIds) > 0) { + $aInDefSet = []; + foreach ($oDefinitionFilter->ToDataArray(['id']) as $aRow) { $aInDefSet[] = $aRow['id']; } $aInvalids = array_diff($aInDefSet, $aValidIds); - if (count($aInvalids) > 0) - { + if (count($aInvalids) > 0) { $oFilter->AddConditionForInOperatorUsingParam('id', $aInvalids, true); - } - else - { + } else { $oFilter->AddCondition('id', 0, '='); } } @@ -143,8 +124,7 @@ function GetRuleResultFilter($iRuleId, $oDefinitionFilter, $oAppContext) return $oFilter; } -try -{ +try { require_once('../approot.inc.php'); require_once(APPROOT.'/application/application.inc.php'); require_once(APPROOT.'/application/startup.inc.php'); @@ -153,85 +133,77 @@ try $bSelectionAuditRulesByDefault = utils::GetConfig()->Get('audit.enable_selection_landing_page'); $operation = utils::ReadParam('operation', $bSelectionAuditRulesByDefault ? 'selection' : 'audit'); $oAppContext = new ApplicationContext(); - + require_once(APPROOT.'/application/loginwebpage.class.inc.php'); LoginWebPage::DoLogin(); // Check user rights and prompt if needed - + $oP = new iTopWebPage(Dict::S('UI:Audit:Title')); - switch($operation) - { + switch ($operation) { case 'csv': - $oP->DisableBreadCrumb(); - // Big result sets cause long OQL that cannot be passed (serialized) as a GET parameter - // Therefore we don't use the standard "search_oql" operation of UI.php to display the CSV - $iCategory = utils::ReadParam('category', ''); - $iRuleIndex = utils::ReadParam('rule', 0); - - $oAuditCategory = MetaModel::GetObject('AuditCategory', $iCategory); - $oDefinitionFilter = DBObjectSearch::FromOQL($oAuditCategory->Get('definition_set')); - $oDefinitionFilter->UpdateContextFromUser(); - FilterByContext($oDefinitionFilter, $oAppContext); - $oDefinitionSet = new CMDBObjectSet($oDefinitionFilter); - $oFilter = GetRuleResultFilter($iRuleIndex, $oDefinitionFilter, $oAppContext); - $oErrorObjectSet = new CMDBObjectSet($oFilter); - $oAuditRule = MetaModel::GetObject('AuditRule', $iRuleIndex); - $sFileName = utils::ReadParam('filename', null, true, 'string'); - $bAdvanced = utils::ReadParam('advanced', false); - $sAdvanced = $bAdvanced ? '&advanced=1' : ''; - - if ($sFileName != null) - { - $oP = new CSVPage("iTop - Export"); - $sCharset = MetaModel::GetConfig()->Get('csv_file_default_charset'); - $sCSVData = cmdbAbstractObject::GetSetAsCSV($oErrorObjectSet, array('localize_values' => true, 'fields_advanced' => $bAdvanced), $sCharset); - if ($sCharset == 'UTF-8') - { - $sOutputData = UTF8_BOM.$sCSVData; - } - else - { - $sOutputData = $sCSVData; - } - if ($sFileName == '') - { - // Plain text => Firefox will NOT propose to download the file - $oP->add_header("Content-type: text/plain; charset=$sCharset"); - } - else - { - $sCSVName = basename($sFileName); // pseudo sanitization, just in case - // Force the name of the downloaded file, since windows gives precedence to the extension over of the mime type - $oP->add_header("Content-disposition: attachment; filename=\"$sCSVName\""); - $oP->add_header("Content-type: text/csv; charset=$sCharset"); - } - $oP->add($sOutputData); - $oP->TrashUnexpectedOutput(); - $oP->output(); - exit; - } else { - $sTitle = Dict::S('UI:Audit:AuditErrors'); - $oP->SetBreadCrumbEntry('ui-tool-auditerrors', $sTitle, '', '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); + $oP->DisableBreadCrumb(); + // Big result sets cause long OQL that cannot be passed (serialized) as a GET parameter + // Therefore we don't use the standard "search_oql" operation of UI.php to display the CSV + $iCategory = utils::ReadParam('category', ''); + $iRuleIndex = utils::ReadParam('rule', 0); - $oBackButton = ButtonUIBlockFactory::MakeIconLink('fas fa-chevron-left', Dict::S('UI:Audit:InteractiveAudit:Back'), "./audit.php?".$oAppContext->GetForLink()); - $oP->AddUiBlock($oBackButton); - $oP->AddUiBlock(TitleUIBlockFactory::MakeForPage($sTitle.$oAuditRule->Get('description'))); + $oAuditCategory = MetaModel::GetObject('AuditCategory', $iCategory); + $oDefinitionFilter = DBObjectSearch::FromOQL($oAuditCategory->Get('definition_set')); + $oDefinitionFilter->UpdateContextFromUser(); + FilterByContext($oDefinitionFilter, $oAppContext); + $oDefinitionSet = new CMDBObjectSet($oDefinitionFilter); + $oFilter = GetRuleResultFilter($iRuleIndex, $oDefinitionFilter, $oAppContext); + $oErrorObjectSet = new CMDBObjectSet($oFilter); + $oAuditRule = MetaModel::GetObject('AuditRule', $iRuleIndex); + $sFileName = utils::ReadParam('filename', null, true, 'string'); + $bAdvanced = utils::ReadParam('advanced', false); + $sAdvanced = $bAdvanced ? '&advanced=1' : ''; - $sBlockId = 'audit_errors'; - $oP->p("
      "); - $oBlock = DisplayBlock::FromObjectSet($oErrorObjectSet, 'csv', array('show_obsolete_data' => true)); - $oBlock->Display($oP, 1); - $oP->p("
      "); - // Adjust the size of the Textarea containing the CSV to fit almost all the remaining space - $oP->add_ready_script(" $('#1>textarea').height(400);"); // adjust the size of the block - $sExportUrl = utils::GetAbsoluteUrlAppRoot()."pages/audit.php?operation=csv&category=".$oAuditCategory->GetKey()."&rule=".$oAuditRule->GetKey(); - $oDownloadButton = ButtonUIBlockFactory::MakeForAlternativePrimaryAction('fas fa-chevron-left', Dict::S('UI:Audit:InteractiveAudit:Back'), "./audit.php?".$oAppContext->GetForLink()); + if ($sFileName != null) { + $oP = new CSVPage("iTop - Export"); + $sCharset = MetaModel::GetConfig()->Get('csv_file_default_charset'); + $sCSVData = cmdbAbstractObject::GetSetAsCSV($oErrorObjectSet, ['localize_values' => true, 'fields_advanced' => $bAdvanced], $sCharset); + if ($sCharset == 'UTF-8') { + $sOutputData = UTF8_BOM.$sCSVData; + } else { + $sOutputData = $sCSVData; + } + if ($sFileName == '') { + // Plain text => Firefox will NOT propose to download the file + $oP->add_header("Content-type: text/plain; charset=$sCharset"); + } else { + $sCSVName = basename($sFileName); // pseudo sanitization, just in case + // Force the name of the downloaded file, since windows gives precedence to the extension over of the mime type + $oP->add_header("Content-disposition: attachment; filename=\"$sCSVName\""); + $oP->add_header("Content-type: text/csv; charset=$sCharset"); + } + $oP->add($sOutputData); + $oP->TrashUnexpectedOutput(); + $oP->output(); + exit; + } else { + $sTitle = Dict::S('UI:Audit:AuditErrors'); + $oP->SetBreadCrumbEntry('ui-tool-auditerrors', $sTitle, '', '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); + + $oBackButton = ButtonUIBlockFactory::MakeIconLink('fas fa-chevron-left', Dict::S('UI:Audit:InteractiveAudit:Back'), "./audit.php?".$oAppContext->GetForLink()); + $oP->AddUiBlock($oBackButton); + $oP->AddUiBlock(TitleUIBlockFactory::MakeForPage($sTitle.$oAuditRule->Get('description'))); + + $sBlockId = 'audit_errors'; + $oP->p("
      "); + $oBlock = DisplayBlock::FromObjectSet($oErrorObjectSet, 'csv', ['show_obsolete_data' => true]); + $oBlock->Display($oP, 1); + $oP->p("
      "); + // Adjust the size of the Textarea containing the CSV to fit almost all the remaining space + $oP->add_ready_script(" $('#1>textarea').height(400);"); // adjust the size of the block + $sExportUrl = utils::GetAbsoluteUrlAppRoot()."pages/audit.php?operation=csv&category=".$oAuditCategory->GetKey()."&rule=".$oAuditRule->GetKey(); + $oDownloadButton = ButtonUIBlockFactory::MakeForAlternativePrimaryAction('fas fa-chevron-left', Dict::S('UI:Audit:InteractiveAudit:Back'), "./audit.php?".$oAppContext->GetForLink()); + + $oP->add_ready_script("$('a[href*=\"webservices/export.php?expression=\"]').attr('href', '".$sExportUrl."&filename=audit.csv".$sAdvanced."');"); + $oP->add_ready_script("$('#1 :checkbox').removeAttr('onclick').on('click', function() { var sAdvanced = ''; if (this.checked) sAdvanced = '&advanced=1'; window.location.href='$sExportUrl'+sAdvanced; } );"); + } + break; - $oP->add_ready_script("$('a[href*=\"webservices/export.php?expression=\"]').attr('href', '".$sExportUrl."&filename=audit.csv".$sAdvanced."');"); - $oP->add_ready_script("$('#1 :checkbox').removeAttr('onclick').on('click', function() { var sAdvanced = ''; if (this.checked) sAdvanced = '&advanced=1'; window.location.href='$sExportUrl'+sAdvanced; } );"); - } - break; - case 'errors': $sTitle = Dict::S('UI:Audit:AuditErrors'); $iCategory = utils::ReadParam('category', ''); @@ -253,7 +225,7 @@ try $oP->AddUiBlock(TitleUIBlockFactory::MakeForPage($sTitle.$oAuditRule->Get('description'))); $sBlockId = 'audit_errors'; $oP->p("
      "); - $oBlock = DisplayBlock::FromObjectSet($oErrorObjectSet, 'list', array('show_obsolete_data' => true)); + $oBlock = DisplayBlock::FromObjectSet($oErrorObjectSet, 'list', ['show_obsolete_data' => true]); $oBlock->Display($oP, 1); $oP->p("
      "); $sExportUrl = utils::GetAbsoluteUrlAppRoot()."pages/audit.php?operation=csv&category=".$oAuditCategory->GetKey()."&rule=".$oAuditRule->GetKey(); @@ -299,13 +271,13 @@ try // Fetch all audit domains with at least on linked category $oDomainSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT AuditDomain AS domain JOIN lnkAuditCategoryToAuditDomain AS lnk ON lnk.domain_id = domain.id")); - $oDomainSet->SetOrderBy(array('name' => true)); + $oDomainSet->SetOrderBy(['name' => true]); $iDomainCnt = 0; /** @var AuditDomain $oAuditDomain */ - while($oAuditDomain = $oDomainSet->Fetch()) { + while ($oAuditDomain = $oDomainSet->Fetch()) { $sDomainUrl = utils::GetAbsoluteUrlAppRoot()."pages/audit.php?operation=audit&domain=".$oAuditDomain->GetKey(); $sIconUrl = utils::GetAbsoluteUrlAppRoot().'images/icons/icons8-puzzle.svg'; - /** @var \ormDocument $oImage */ + /** @var \ormDocument $oImage */ $oImage = $oAuditDomain->Get('icon'); if (!$oImage->IsEmpty()) { $sIconUrl = $oImage->GetDisplayURL(get_class($oAuditDomain), $oAuditDomain->GetKey(), 'icon'); @@ -333,7 +305,7 @@ try $sBreadCrumbTooltip = Dict::S('UI:Audit:Interactive:All:BreadCrumb+'); if (!empty($sCategories)) { // Case with a set of categories - $oCategoriesSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT AuditCategory WHERE id IN (:categories)", array('categories' => explode(',', $sCategories)))); + $oCategoriesSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT AuditCategory WHERE id IN (:categories)", ['categories' => explode(',', $sCategories)])); $sCategories = implode(", ", $oCategoriesSet->GetColumnAsArray('name')); $oCategoriesSet->Rewind(); $sTitle = Dict::Format('UI:Audit:Interactive:Categories:Title', $sCategories); @@ -343,7 +315,7 @@ try } elseif (!empty($sDomainKey)) { // Case with a single Domain $oAuditDomain = MetaModel::GetObject('AuditDomain', $sDomainKey); - $oCategoriesSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT AuditCategory AS c JOIN lnkAuditCategoryToAuditDomain AS lnk ON lnk.category_id = c.id WHERE lnk.domain_id = :domain", array('domain' => $oAuditDomain->GetKey()))); + $oCategoriesSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT AuditCategory AS c JOIN lnkAuditCategoryToAuditDomain AS lnk ON lnk.category_id = c.id WHERE lnk.domain_id = :domain", ['domain' => $oAuditDomain->GetKey()])); $sDomainName = $oAuditDomain->GetName(); $sTitle = Dict::Format('UI:Audit:Interactive:Domain:Title', $sDomainName); $sSubTitle = Dict::Format('UI:Audit:Interactive:Domain:SubTitle', $sDomainName); @@ -400,16 +372,16 @@ try // Add a button in the above toolbar $sAuditCategoryClass = get_class($oAuditCategory); if (UserRights::IsActionAllowed($sAuditCategoryClass, UR_ACTION_READ)) { - $oToolbar->AddSubBlock(ButtonUIBlockFactory::MakeIconLink('fas fa-wrench fa-lg', Dict::S('UI:Audit:ViewRules'), ApplicationContext::MakeObjectUrl($sAuditCategoryClass, $oAuditCategory->GetKey()).'&#ObjectProperties=tab_ClassAuditCategoryAttributerules_list'),); + $oToolbar->AddSubBlock(ButtonUIBlockFactory::MakeIconLink('fas fa-wrench fa-lg', Dict::S('UI:Audit:ViewRules'), ApplicationContext::MakeObjectUrl($sAuditCategoryClass, $oAuditCategory->GetKey()).'&#ObjectProperties=tab_ClassAuditCategoryAttributerules_list'), ); } - $aResults = array(); + $aResults = []; try { $iCount = 0; $oDefinitionFilter = DBObjectSearch::FromOQL($oAuditCategory->Get('definition_set')); $oDefinitionFilter->UpdateContextFromUser(); FilterByContext($oDefinitionFilter, $oAppContext); - $aObjectsWithErrors = array(); + $aObjectsWithErrors = []; if (!empty($currentOrganization)) { if (MetaModel::IsValidFilterCode($oDefinitionFilter->GetClass(), 'org_id')) { $oDefinitionFilter->AddCondition('org_id', $currentOrganization, '='); @@ -421,7 +393,7 @@ try $oRulesFilter->AddCondition('category_id', $oAuditCategory->GetKey(), '='); $oRulesSet = new DBObjectSet($oRulesFilter); while ($oAuditRule = $oRulesSet->fetch()) { - $aRow = array(); + $aRow = []; $aRow['description'] = $oAuditRule->GetName(); if ($iCount == 0) { // nothing to check, really ! @@ -431,16 +403,15 @@ try } else { try { $oFilter = GetRuleResultFilter($oAuditRule->GetKey(), $oDefinitionFilter, $oAppContext); - $aErrors = $oFilter->SelectAttributeToArray('id'); + $aErrors = $oFilter->SelectAttributeToArray('id'); $iErrorsCount = count($aErrors); foreach ($aErrors as $aErrorRow) { $aObjectsWithErrors[$aErrorRow['id']] = true; } - $aRow['nb_errors'] = ($iErrorsCount == 0) ? '0' : "GetKey()."&rule=".$oAuditRule->GetKey().$oAppContext->GetForLink(true)."\">$iErrorsCount GetKey()."&rule=".$oAuditRule->GetKey().$oAppContext->GetForLink(true)."\">"; + $aRow['nb_errors'] = ($iErrorsCount == 0) ? '0' : "GetKey()."&rule=".$oAuditRule->GetKey().$oAppContext->GetForLink(true)."\">$iErrorsCount GetKey()."&rule=".$oAuditRule->GetKey().$oAppContext->GetForLink(true)."\">"; $aRow['percent_ok'] = sprintf('%.2f', 100.0 * (($iCount - $iErrorsCount) / $iCount)); $aRow['class'] = $oAuditCategory->GetReportColor($iCount, $iErrorsCount); - } - catch (Exception $e) { + } catch (Exception $e) { $aRow['nb_errors'] = Dict::S('UI:Audit:OqlError'); $aRow['percent_ok'] = Dict::S('UI:Audit:Error:ValueNA'); $aRow['class'] = 'red'; @@ -462,57 +433,50 @@ try $oWorkingBlock->SetCount((int)$oWorkingBlock->GetCount() + ($iCount - $iTotalErrors)); $oAuditCategoryPanelBlock->SetSubTitle(Dict::Format('UI:Audit:AuditCategory:Subtitle', $iTotalErrors, $iCount, $sOverallPercentOk)); + } catch (Exception $e) { + $sMessage = Dict::Format('UI:Audit:ErrorIn_Category_Reason', $oAuditCategory->GetHyperlink(), utils::HtmlEntities($e->getMessage())); + $oErrorAlert = AlertUIBlockFactory::MakeForFailure(Dict::S('UI:Audit:ErrorIn_Category'), $sMessage); + $oErrorAlert->AddCSSClass('ibo-audit--error-alert'); + $oP->AddUiBlock($oErrorAlert); + continue; } - catch(Exception $e) - { - $sMessage = Dict::Format('UI:Audit:ErrorIn_Category_Reason', $oAuditCategory->GetHyperlink(), utils::HtmlEntities($e->getMessage())); - $oErrorAlert = AlertUIBlockFactory::MakeForFailure(Dict::S('UI:Audit:ErrorIn_Category'), $sMessage); - $oErrorAlert->AddCSSClass('ibo-audit--error-alert'); - $oP->AddUiBlock($oErrorAlert); - continue; + + $oAuditCategoryPanelBlock->SetColorFromColorSemantic($sClass); + $oAuditCategoryPanelBlock->AddCSSClass('ibo-audit--audit-category--panel'); + $aData = []; + foreach ($aResults as $aRow) { + $aData[] = [ + 'audit_rule' => $aRow['description'], + 'nb_err' => $aRow['nb_errors'], + 'percentage_ok' => $aRow['percent_ok'], + '@class' => 'ibo-is-'.$aRow['class'].'', + ]; + } + + $aAttribs = [ + 'audit_rule' => ['label' => Dict::S('UI:Audit:HeaderAuditRule'), 'description' => Dict::S('UI:Audit:HeaderAuditRule')], + 'nb_err' => ['label' => Dict::S('UI:Audit:HeaderNbErrors'), 'description' => Dict::S('UI:Audit:HeaderNbErrors')], + 'percentage_ok' => ['label' => Dict::S('UI:Audit:PercentageOk'), 'description' => Dict::S('UI:Audit:PercentageOk')], + ]; + + $oAttachmentTableBlock = DataTableUIBlockFactory::MakeForStaticData('', $aAttribs, $aData, null, [], "", ['pageLength' => -1]); + $oAuditCategoryPanelBlock->AddSubBlock($oAttachmentTableBlock); + $aAuditCategoryPanels[] = $oAuditCategoryPanelBlock; } - - $oAuditCategoryPanelBlock->SetColorFromColorSemantic($sClass); - $oAuditCategoryPanelBlock->AddCSSClass('ibo-audit--audit-category--panel'); - $aData = []; - foreach($aResults as $aRow) - { - $aData[] = array( - 'audit_rule' => $aRow['description'], - 'nb_err' => $aRow['nb_errors'], - 'percentage_ok' => $aRow['percent_ok'], - '@class' => 'ibo-is-'.$aRow['class'].'', - ); + foreach ($aAuditCategoryPanels as $oAuditCategoryPanel) { + $oP->AddUiBlock($oAuditCategoryPanel); } - - $aAttribs = array( - 'audit_rule' => array('label' => Dict::S('UI:Audit:HeaderAuditRule'), 'description' => Dict::S('UI:Audit:HeaderAuditRule')), - 'nb_err' => array('label' => Dict::S('UI:Audit:HeaderNbErrors'), 'description' => Dict::S('UI:Audit:HeaderNbErrors')), - 'percentage_ok' => array('label' => Dict::S('UI:Audit:PercentageOk'), 'description' => Dict::S('UI:Audit:PercentageOk')), - ); - - $oAttachmentTableBlock = DataTableUIBlockFactory::MakeForStaticData('', $aAttribs, $aData, null, [], "", array('pageLength' => -1)); - $oAuditCategoryPanelBlock->AddSubBlock($oAttachmentTableBlock); - $aAuditCategoryPanels[] = $oAuditCategoryPanelBlock; - } - foreach ($aAuditCategoryPanels as $oAuditCategoryPanel) { - $oP->AddUiBlock($oAuditCategoryPanel); - } } $oP->output(); -} -catch(CoreException $e) -{ +} catch (CoreException $e) { require_once(APPROOT.'/setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); - $oP->add("

      ".Dict::S('UI:FatalErrorMessage')."

      \n"); - $oP->error(Dict::Format('UI:Error_Details', $e->getHtmlDesc())); + $oP->add("

      ".Dict::S('UI:FatalErrorMessage')."

      \n"); + $oP->error(Dict::Format('UI:Error_Details', $e->getHtmlDesc())); $oP->output(); - if (MetaModel::IsLogEnabledIssue()) - { - if (MetaModel::IsValidClass('EventIssue')) - { + if (MetaModel::IsLogEnabledIssue()) { + if (MetaModel::IsValidClass('EventIssue')) { $oLog = new EventIssue(); $oLog->Set('message', $e->getMessage()); @@ -529,19 +493,15 @@ catch(CoreException $e) // For debugging only //throw $e; -} -catch(Exception $e) -{ +} catch (Exception $e) { require_once(APPROOT.'/setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); - $oP->add("

      ".Dict::S('UI:FatalErrorMessage')."

      \n"); - $oP->error(Dict::Format('UI:Error_Details', $e->getMessage())); + $oP->add("

      ".Dict::S('UI:FatalErrorMessage')."

      \n"); + $oP->error(Dict::Format('UI:Error_Details', $e->getMessage())); $oP->output(); - if (MetaModel::IsLogEnabledIssue()) - { - if (MetaModel::IsValidClass('EventIssue')) - { + if (MetaModel::IsLogEnabledIssue()) { + if (MetaModel::IsValidClass('EventIssue')) { $oLog = new EventIssue(); $oLog->Set('message', $e->getMessage()); @@ -549,7 +509,7 @@ catch(Exception $e) $oLog->Set('issue', 'PHP Exception'); $oLog->Set('impact', 'Page could not be displayed'); $oLog->Set('callstack', $e->getTrace()); - $oLog->Set('data', array()); + $oLog->Set('data', []); $oLog->DBInsertNoReload(); } diff --git a/pages/csvimport.php b/pages/csvimport.php index 8c1181733..926e3f4c0 100644 --- a/pages/csvimport.php +++ b/pages/csvimport.php @@ -1,4 +1,5 @@ AddSubBlock($oOption); - $aValidClasses = array(); - $aClassCategories = array('bizmodel', 'addon/authentication'); + $aValidClasses = []; + $aClassCategories = ['bizmodel', 'addon/authentication']; if ($bAdvanced) { $aClassCategories[] = 'grant_by_profile'; } @@ -136,10 +137,9 @@ try { */ function CountCharsFromSet($sString, $aSet) { - $aResult = array(); + $aResult = []; $aCount = count_chars($sString); - foreach($aSet as $sChar) - { + foreach ($aSet as $sChar) { $aResult[$sChar] = isset($aCount[ord($sChar)]) ? $aCount[ord($sChar)] : 0; } return $aResult; @@ -155,35 +155,33 @@ try { { $iLine = 0; $iMaxLine = 20; // Process max 20 lines to guess the parameters - foreach($aPossibleSeparators as $sSep) - { + foreach ($aPossibleSeparators as $sSep) { $aGuesses[$sSep]['total'] = $aGuesses[$sSep]['max'] = 0; $aGuesses[$sSep]['min'] = 999; } - $aStats = array(); - while(($iLine < count($aCSVData)) && ($iLine < $iMaxLine) ) - { - if (strlen($aCSVData[$iLine]) > 0) - { + $aStats = []; + while (($iLine < count($aCSVData)) && ($iLine < $iMaxLine)) { + if (strlen($aCSVData[$iLine]) > 0) { $aStats[$iLine] = CountCharsFromSet($aCSVData[$iLine], $aPossibleSeparators); } $iLine++; } $iLine = 1; - foreach($aStats as $aLineStats) - { - foreach($aPossibleSeparators as $sSep) - { + foreach ($aStats as $aLineStats) { + foreach ($aPossibleSeparators as $sSep) { $aGuesses[$sSep]['total'] += $aLineStats[$sSep]; - if ($aLineStats[$sSep] > $aGuesses[$sSep]['max']) $aGuesses[$sSep]['max'] = $aLineStats[$sSep]; - if ($aLineStats[$sSep] < $aGuesses[$sSep]['min']) $aGuesses[$sSep]['min'] = $aLineStats[$sSep]; + if ($aLineStats[$sSep] > $aGuesses[$sSep]['max']) { + $aGuesses[$sSep]['max'] = $aLineStats[$sSep]; + } + if ($aLineStats[$sSep] < $aGuesses[$sSep]['min']) { + $aGuesses[$sSep]['min'] = $aLineStats[$sSep]; + } } $iLine++; } - $aScores = array(); - foreach($aGuesses as $sSep => $aData) - { + $aScores = []; + foreach ($aGuesses as $sSep => $aData) { $aScores[$sSep] = $aData['total'] + $aData['max'] - $aData['min']; } arsort($aScores, SORT_NUMERIC); // Sort the array, higher scores first @@ -200,10 +198,10 @@ try { function GuessParameters($sCSVData) { $aData = explode("\n", $sCSVData); - $sSeparator = GuessFromFrequency($aData, array("\t", ',', ';', '|')); // Guess the most frequent (and regular) character on each line - $sQualifier = GuessFromFrequency($aData, array('"', "'")); // Guess the most frequent (and regular) character on each line + $sSeparator = GuessFromFrequency($aData, ["\t", ',', ';', '|']); // Guess the most frequent (and regular) character on each line + $sQualifier = GuessFromFrequency($aData, ['"', "'"]); // Guess the most frequent (and regular) character on each line - return array('separator' => $sSeparator, 'qualifier' => $sQualifier); + return ['separator' => $sSeparator, 'qualifier' => $sQualifier]; } /** @@ -212,10 +210,10 @@ try { * @param string $sClass The class of objects to synchronize * @param integer $iCount The number of objects to synchronize */ - function DisplaySynchroBanner(WebPage $oP, $sClass, $iCount) - { - $oP->AddSubBlock(AlertUIBlockFactory::MakeForInformation(MetaModel::GetClassIcon($sClass)." ".Dict::Format('UI:Title:BulkSynchro_nbItem_ofClass_class', $iCount, MetaModel::GetName($sClass)))); - } + function DisplaySynchroBanner(WebPage $oP, $sClass, $iCount) + { + $oP->AddSubBlock(AlertUIBlockFactory::MakeForInformation(MetaModel::GetClassIcon($sClass)." ".Dict::Format('UI:Title:BulkSynchro_nbItem_ofClass_class', $iCount, MetaModel::GetName($sClass)))); + } /** * Process the CSV data, for real or as a simulation @@ -232,11 +230,11 @@ try { } // CSRF transaction id verification - if(!utils::IsTransactionValid(utils::ReadPostedParam('transaction_id', '', 'raw_data'))){ + if (!utils::IsTransactionValid(utils::ReadPostedParam('transaction_id', '', 'raw_data'))) { throw new CoreException(Dict::S('UI:Error:InvalidToken')); } - $aResult = array(); + $aResult = []; $sCSVData = utils::ReadParam('csvdata', '', false, 'raw_data'); $sCSVDataTruncated = utils::ReadParam('csvdata_truncated', '', false, 'raw_data'); $sSeparator = utils::ReadParam('separator', ',', false, 'raw_data'); @@ -244,23 +242,41 @@ try { $bHeaderLine = (utils::ReadParam('header_line', '0') == 1); $iNbSkippedLines = utils::ReadParam('nb_skipped_lines', '0'); $iBoxSkipLines = utils::ReadParam('box_skiplines', '0'); - $aFieldsMapping = utils::ReadParam('field', array(), false, 'raw_data'); - $aSearchFields = utils::ReadParam('search_field', array(), false, 'field_name'); + $aFieldsMapping = utils::ReadParam('field', [], false, 'raw_data'); + $aSearchFields = utils::ReadParam('search_field', [], false, 'field_name'); $iCurrentStep = $bSimulate ? 4 : 5; $bAdvanced = utils::ReadParam('advanced', 0); $sEncoding = utils::ReadParam('encoding', 'UTF-8'); $sSynchroScope = utils::ReadParam('synchro_scope', '', false, 'raw_data'); - $aSynchroUpdate = utils::ReadParam('synchro_update', array()); + $aSynchroUpdate = utils::ReadParam('synchro_update', []); $sDateTimeFormat = utils::ReadParam('date_time_format', 'default'); $sCustomDateTimeFormat = utils::ReadParam('custom_date_time_format', (string)AttributeDateTime::GetFormat(), false, 'raw_data'); - return CSVImportPageProcessor::ProcessData($iBoxSkipLines, $iNbSkippedLines, $sDateTimeFormat, $sCustomDateTimeFormat, $sClassName, $oPage, $aSynchroUpdate, $sCSVData, $sSeparator, $sTextQualifier, $bHeaderLine, $aResult, $aSearchFields, $aFieldsMapping, $bSimulate, $sCSVDataTruncated, - $iCurrentStep, $sEncoding, - $bAdvanced, $sSynchroScope); + return CSVImportPageProcessor::ProcessData( + $iBoxSkipLines, + $iNbSkippedLines, + $sDateTimeFormat, + $sCustomDateTimeFormat, + $sClassName, + $oPage, + $aSynchroUpdate, + $sCSVData, + $sSeparator, + $sTextQualifier, + $bHeaderLine, + $aResult, + $aSearchFields, + $aFieldsMapping, + $bSimulate, + $sCSVDataTruncated, + $iCurrentStep, + $sEncoding, + $bAdvanced, + $sSynchroScope + ); } - /** * Perform the actual load of the CSV data and display the results * @param WebPage $oPage The web page to display the wizard @@ -306,14 +322,14 @@ try { $sCSVData = utils::ReadParam('csvdata', '', false, 'raw_data'); $sCSVDataTruncated = utils::ReadParam('csvdata_truncated', '', false, 'raw_data'); $sSeparator = utils::ReadParam('separator', ',', false, 'raw_data'); - if ($sSeparator == 'tab') $sSeparator = "\t"; - if ($sSeparator == 'other') - { + if ($sSeparator == 'tab') { + $sSeparator = "\t"; + } + if ($sSeparator == 'other') { $sSeparator = utils::ReadParam('other_separator', ',', false, 'raw_data'); } $sTextQualifier = utils::ReadParam('text_qualifier', '"', false, 'raw_data'); - if ($sTextQualifier == 'other') - { + if ($sTextQualifier == 'other') { $sTextQualifier = utils::ReadParam('other_qualifier', '"', false, 'raw_data'); } $bHeaderLine = (utils::ReadParam('header_line', '0') == 1); @@ -333,7 +349,7 @@ try { $oClassesSelect = SelectUIBlockFactory::MakeForSelect("class_name", "select_class_name"); $oDefaultSelect = SelectOptionUIBlockFactory::MakeForSelectOption("$sClassName", MetaModel::GetName($sClassName), true); $oClassesSelect->AddSubBlock($oDefaultSelect); - $aSynchroUpdate = utils::ReadParam('synchro_update', array()); + $aSynchroUpdate = utils::ReadParam('synchro_update', []); } else { $oClassesSelect = GetClassesSelectUIBlock('class_name', $sClassName, UR_ACTION_BULK_MODIFY, (bool)$bAdvanced); } @@ -381,7 +397,7 @@ try { $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden("synchro_scope", $sSynchroScope)); $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden("date_time_format", $sDateTimeFormat)); $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden("custom_date_time_format", $sCustomDateTimeFormat)); - $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden("transaction_id", utils::GetNewTransactionId(), "transaction_id")); // adding transaction_id field for next step (simulation) + $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden("transaction_id", utils::GetNewTransactionId(), "transaction_id")); // adding transaction_id field for next step (simulation) if (!empty($sSynchroScope)) { foreach ($aSynchroUpdate as $sKey => $value) { @@ -403,10 +419,9 @@ try { $('#advanced').on('click', function(ev) { DoReload(); } ); EOF ); - if ($sClassName != '') - { - $aFieldsMapping = utils::ReadParam('field', array(), false, 'raw_data'); - $aSearchFields = utils::ReadParam('search_field', array(), false, 'field_name'); + if ($sClassName != '') { + $aFieldsMapping = utils::ReadParam('field', [], false, 'raw_data'); + $aSearchFields = utils::ReadParam('search_field', [], false, 'field_name'); $sFieldsMapping = addslashes(json_encode($aFieldsMapping)); $sSearchFields = addslashes(json_encode($aSearchFields)); @@ -414,7 +429,7 @@ EOF } $oPage->add_script( -<<IsEmpty()) - { - $sCSVData = $oDocument->GetData(); - } - break; + $oDocument = utils::ReadPostedDocument('csvdata'); + if (!$oDocument->IsEmpty()) { + $sCSVData = $oDocument->GetData(); + } + break; default: - $sCSVData = utils::ReadPostedParam('csvdata', '', 'raw_data'); + $sCSVData = utils::ReadPostedParam('csvdata', '', 'raw_data'); } $sEncoding = utils::ReadParam('encoding', 'UTF-8'); // Compute a subset of the data set, now that we know the charset - if ($sEncoding == 'UTF-8') - { + if ($sEncoding == 'UTF-8') { // Remove the BOM if any - if (substr($sCSVData, 0, 3) == UTF8_BOM) - { + if (substr($sCSVData, 0, 3) == UTF8_BOM) { $sCSVData = substr($sCSVData, 3); } // Clean the input // Todo: warn the user if some characters are lost/substituted $sUTF8Data = iconv('UTF-8', 'UTF-8//IGNORE//TRANSLIT', $sCSVData); - } - else - { + } else { $sUTF8Data = iconv($sEncoding, 'UTF-8//IGNORE//TRANSLIT', $sCSVData); } @@ -682,16 +691,15 @@ EOF $iSkippedLines = utils::ReadParam('nb_skipped_lines', ''); $bBoxSkipLines = utils::ReadParam('box_skiplines', 0); $sTextQualifier = utils::ReadParam('text_qualifier', '', false, 'raw_data'); - if ($sTextQualifier == '') // May be set to an empty value by the previous page - { + if ($sTextQualifier == '') { // May be set to an empty value by the previous page $sTextQualifier = $aGuesses['qualifier']; } - $sOtherTextQualifier = in_array($sTextQualifier, array('"', "'")) ? '' : $sTextQualifier; + $sOtherTextQualifier = in_array($sTextQualifier, ['"', "'"]) ? '' : $sTextQualifier; $bHeaderLine = utils::ReadParam('header_line', 0); $sClassName = utils::ReadParam('class_name', '', false, 'class'); $bAdvanced = utils::ReadParam('advanced', 0); - $aFieldsMapping = utils::ReadParam('field', array(), false, 'raw_data'); - $aSearchFields = utils::ReadParam('search_field', array(), false, 'field_name'); + $aFieldsMapping = utils::ReadParam('field', [], false, 'raw_data'); + $aSearchFields = utils::ReadParam('search_field', [], false, 'field_name'); // Create a truncated version of the data used for the fast preview // Take about 20 lines of data... knowing that some lines may contain carriage returns @@ -721,7 +729,7 @@ EOF $oSet = new DBObjectSet($oSearch); $iCount = $oSet->Count(); DisplaySynchroBanner($oPage, $sClassName, $iCount); - $aSynchroUpdate = utils::ReadParam('synchro_update', array()); + $aSynchroUpdate = utils::ReadParam('synchro_update', []); } $oPanel = TitleUIBlockFactory::MakeForPage(Dict::S('UI:Title:CSVImportStep2')); $oPage->AddSubBlock($oPanel); @@ -729,7 +737,6 @@ EOF $oForm = FormUIBlockFactory::MakeStandard('wizForm'); $oPage->AddSubBlock($oForm); - $oContainer = PanelUIBlockFactory::MakeNeutral(''); $oForm->AddSubBlock($oContainer); @@ -741,20 +748,19 @@ EOF $oFieldSetSeparator = FieldSetUIBlockFactory::MakeStandard(Dict::S('UI:CSVImport:SeparatorCharacter')); $oMulticolumn->AddColumn(ColumnUIBlockFactory::MakeForBlock($oFieldSetSeparator)); - $aSep = array( + $aSep = [ ';' => Dict::S('UI:CSVImport:SeparatorSemicolon+'), ',' => Dict::S('UI:CSVImport:SeparatorComma+'), 'tab' => Dict::S('UI:CSVImport:SeparatorTab+'), - ); + ]; $sSeparator = utils::ReadParam('separator', '', false, 'raw_data'); - if ($sSeparator == '') // May be set to an empty value by the previous page - { + if ($sSeparator == '') { // May be set to an empty value by the previous page $sSeparator = $aGuesses['separator']; } if ($sSeparator == "\t") { $sSeparator = "tab"; } - $sOtherSeparator = in_array($sSeparator, array(',', ';', "\t")) ? '' : $sSeparator; + $sOtherSeparator = in_array($sSeparator, [',', ';', "\t"]) ? '' : $sSeparator; $aSep['other'] = Dict::S('UI:CSVImport:SeparatorOther').' '; foreach ($aSep as $sVal => $sLabel) { @@ -772,10 +778,10 @@ EOF $oFieldSetTextQualifier = FieldSetUIBlockFactory::MakeStandard(Dict::S('UI:CSVImport:TextQualifierCharacter')); $oMulticolumn->AddColumn(ColumnUIBlockFactory::MakeForBlock($oFieldSetTextQualifier)); - $aQualifiers = array( + $aQualifiers = [ '"' => Dict::S('UI:CSVImport:QualifierDoubleQuote+'), '\'' => Dict::S('UI:CSVImport:QualifierSimpleQuote+'), - ); + ]; $aQualifiers['other'] = Dict::S('UI:CSVImport:QualifierOther').' AddSubBlock($oCheckBoxHeader); $oFieldSetCommentsAndHeader->AddSubBlock(new Html('
      ')); - $oCheckBoxSkip = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('UI:CSVImport:Skip_N_LinesAtTheBeginning', ''), "box_skiplines", "1", "box_skiplines", - "checkbox"); + $oCheckBoxSkip = InputUIBlockFactory::MakeForInputWithLabel( + Dict::Format('UI:CSVImport:Skip_N_LinesAtTheBeginning', ''), + "box_skiplines", + "1", + "box_skiplines", + "checkbox" + ); $oCheckBoxSkip->GetInput()->AddCSSClass('ibo-input-checkbox'); $oCheckBoxSkip->GetInput()->SetIsChecked(($bBoxSkipLines == 1)); $oCheckBoxSkip->SetBeforeInput(false); @@ -922,9 +933,9 @@ EOF ); } EOF - ); + ); $oPage->add_ready_script( -<<Count(); DisplaySynchroBanner($oPage, $sClassName, $iCount); - $aSynchroUpdate = utils::ReadParam('synchro_update', array()); + $aSynchroUpdate = utils::ReadParam('synchro_update', []); } else { $aSynchroUpdate = null; } @@ -980,8 +991,8 @@ EOF if ($sEncoding == '') { $sEncoding = MetaModel::GetConfig()->Get('csv_file_default_charset'); } - $aFieldsMapping = utils::ReadParam('field', array(), false, 'raw_data'); - $aSearchFields = utils::ReadParam('search_field', array(), false, 'field_name'); + $aFieldsMapping = utils::ReadParam('field', [], false, 'raw_data'); + $aSearchFields = utils::ReadParam('search_field', [], false, 'field_name'); $aPossibleEncodings = utils::GetPossibleEncodings(MetaModel::GetConfig()->GetCSVImportCharsets()); foreach ($aPossibleEncodings as $sIconvCode => $sDisplayName) { @@ -1016,7 +1027,6 @@ EOF $oFormPaste = FormUIBlockFactory::MakeStandard(); $oTabPaste->AddSubBlock($oFormPaste); - $sCSVData = utils::ReadParam('csvdata', '', false, utils::ENUM_SANITIZATION_FILTER_STRING); $oTextarea = new TextArea('csvdata', $sCSVData, '', 120, 30); $oTextarea->AddCSSClasses(['ibo-input-text', 'ibo-is-code']); @@ -1086,25 +1096,28 @@ ajax_request = $.post(GetAbsoluteUrlAppRoot()+'pages/ajax.csvimport.php', ); } EOF - ); + ); $oPage->add_ready_script( -<<Get('csv_import_history_display')) - { + if (Utils::GetConfig()->Get('csv_import_history_display')) { $oPage->SetCurrentTabContainer('tabs1'); - $oPage->AddAjaxTab('UI:History:BulkImports', utils::GetAbsoluteUrlAppRoot().'pages/csvimport.php?step=11', true /* bCache */, - null, AjaxTab::ENUM_TAB_PLACEHOLDER_MISC); + $oPage->AddAjaxTab( + 'UI:History:BulkImports', + utils::GetAbsoluteUrlAppRoot().'pages/csvimport.php?step=11', + true /* bCache */, + null, + AjaxTab::ENUM_TAB_PLACEHOLDER_MISC + ); } } - switch($iStep) - { + switch ($iStep) { case 11: // Asynchronous tab $oPage = new AjaxPage(''); @@ -1142,19 +1155,15 @@ EOF } $oPage->output(); -} -catch(CoreException $e) -{ +} catch (CoreException $e) { require_once(APPROOT.'/setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); $oP->add("

      ".Dict::S('UI:FatalErrorMessage')."

      \n"); $oP->error(Dict::Format('UI:Error_Details', $e->getHtmlDesc())); $oP->output(); - if (MetaModel::IsLogEnabledIssue()) - { - if (MetaModel::IsValidClass('EventIssue')) - { + if (MetaModel::IsLogEnabledIssue()) { + if (MetaModel::IsValidClass('EventIssue')) { $oLog = new EventIssue(); $oLog->Set('message', $e->getMessage()); @@ -1171,19 +1180,15 @@ catch(CoreException $e) // For debugging only //throw $e; -} -catch(Exception $e) -{ +} catch (Exception $e) { require_once(APPROOT.'/setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); $oP->add("

      ".Dict::S('UI:FatalErrorMessage')."

      \n"); $oP->error(Dict::Format('UI:Error_Details', $e->getMessage())); $oP->output(); - if (MetaModel::IsLogEnabledIssue()) - { - if (MetaModel::IsValidClass('EventIssue')) - { + if (MetaModel::IsLogEnabledIssue()) { + if (MetaModel::IsValidClass('EventIssue')) { $oLog = new EventIssue(); $oLog->Set('message', $e->getMessage()); @@ -1191,7 +1196,7 @@ catch(Exception $e) $oLog->Set('issue', 'PHP Exception'); $oLog->Set('impact', 'Page could not be displayed'); $oLog->Set('callstack', $e->getTrace()); - $oLog->Set('data', array()); + $oLog->Set('data', []); $oLog->DBInsertNoReload(); } diff --git a/pages/exec.php b/pages/exec.php index a5c369226..83e82b548 100644 --- a/pages/exec.php +++ b/pages/exec.php @@ -1,4 +1,5 @@ ComputeAndReport("Session Start"); - $sEnvFullPath = APPROOT.'env-'.$sEnvironment; $sPageRelativePath = $sModule.'/'.$sPage; $sPageEnvFullPath = $sEnvFullPath.'/'.$sPageRelativePath; diff --git a/pages/graphviz.php b/pages/graphviz.php index 39ad3fb61..792ea8e92 100644 --- a/pages/graphviz.php +++ b/pages/graphviz.php @@ -1,4 +1,5 @@ p("no lifecycle for this class"); - } - else - { + } else { $aStates = MetaModel::EnumStates($sClass); $aStimuli = MetaModel::EnumStimuli($sClass); $sDotFileContent .= "digraph finite_state_machine { @@ -60,18 +58,15 @@ function GraphvizLifecycle($sClass) node [ fontname=Verdana style=filled fillcolor=\"#ffffff\" ]; edge [ fontname=Verdana ]; "; - $aStatesLinks = array(); - foreach ($aStates as $sStateCode => $aStateDef) - { - $aStatesLinks[$sStateCode] = array('in' => 0, 'out' => 0); + $aStatesLinks = []; + foreach ($aStates as $sStateCode => $aStateDef) { + $aStatesLinks[$sStateCode] = ['in' => 0, 'out' => 0]; } - - foreach ($aStates as $sStateCode => $aStateDef) - { + + foreach ($aStates as $sStateCode => $aStateDef) { $sStateLabel = MetaModel::GetStateLabel($sClass, $sStateCode); $sStateDescription = MetaModel::GetStateDescription($sClass, $sStateCode); - foreach(MetaModel::EnumTransitions($sClass, $sStateCode) as $sStimulusCode => $aTransitionDef) - { + foreach (MetaModel::EnumTransitions($sClass, $sStateCode) as $sStimulusCode => $aTransitionDef) { $aStatesLinks[$sStateCode]['out']++; $aStatesLinks[$aTransitionDef['target_state']]['in']++; $sStimulusLabel = $aStimuli[$sStimulusCode]->GetLabel(); @@ -79,19 +74,14 @@ function GraphvizLifecycle($sClass) $sDotFileContent .= "\t$sStateCode -> {$aTransitionDef['target_state']} [ label=\"".GraphvizEscape($sStimulusLabel)."\"];\n"; } } - foreach($aStates as $sStateCode => $aStateDef) - { - if (($aStatesLinks[$sStateCode]['out'] > 0) || ($aStatesLinks[$sStateCode]['in'] > 0)) - { + foreach ($aStates as $sStateCode => $aStateDef) { + if (($aStatesLinks[$sStateCode]['out'] > 0) || ($aStatesLinks[$sStateCode]['in'] > 0)) { // Show only reachable states $sStateLabel = str_replace(' ', '\n', MetaModel::GetStateLabel($sClass, $sStateCode)); - if ( ($aStatesLinks[$sStateCode]['in'] == 0) || ($aStatesLinks[$sStateCode]['out'] == 0)) - { + if (($aStatesLinks[$sStateCode]['in'] == 0) || ($aStatesLinks[$sStateCode]['out'] == 0)) { // End or Start state, make it look different $sDotFileContent .= "\t$sStateCode [ shape=doublecircle,label=\"".GraphvizEscape($sStateLabel)."\"];\n"; - } - else - { + } else { $sDotFileContent .= "\t$sStateCode [ shape=circle,label=\"".GraphvizEscape($sStateLabel)."\"];\n"; } } @@ -108,39 +98,33 @@ $sModuleDir = dirname($sDeclarationFile); $sImageFilePath = $sModuleDir."/lifecycle/".$sClass.".png"; $sDotExecutable = MetaModel::GetConfig()->Get('graphviz_path'); -if (file_exists($sDotExecutable)) -{ +if (file_exists($sDotExecutable)) { // create the file with Graphviz $sImageFilePath = APPROOT."data/lifecycle/".$sClass.".svg"; - if (!is_dir(APPROOT."data")) - { + if (!is_dir(APPROOT."data")) { @mkdir(APPROOT."data"); } - if (!is_dir(APPROOT."data/lifecycle")) - { + if (!is_dir(APPROOT."data/lifecycle")) { @mkdir(APPROOT."data/lifecycle"); } $sDotDescription = GraphvizLifecycle($sClass); $sDotFilePath = APPROOT."data/lifecycle/{$sClass}.dot"; - + $rFile = @fopen($sDotFilePath, "w"); @fwrite($rFile, $sDotDescription); @fclose($rFile); - $aOutput = array(); + $aOutput = []; $CommandLine = "\"$sDotExecutable\" -v -Tsvg < \"$sDotFilePath\" -o \"$sImageFilePath\" 2>&1"; - + exec($CommandLine, $aOutput, $iRetCode); - if ($iRetCode != 0) - { + if ($iRetCode != 0) { header('Content-type: text/html'); echo "

      Error:

      "; echo "

      The command:

      $CommandLine
      returned $iRetCode

      "; echo "

      The output of the command is:

      \n".implode("\n", $aOutput)."

      "; echo "
      "; echo "

      Content of the '".basename($sDotFilePath)."' file:

      \n$sDotDescription
      "; - } - else - { + } else { header('Content-type: image/svg+xml'); header('Content-Disposition: inline; filename="'.$sClass.'.svg"'); readfile($sImageFilePath); @@ -148,9 +132,7 @@ if (file_exists($sDotExecutable)) @unlink($sDotFilePath); // Image file is removed as well as there is no cache system yet @unlink($sImageFilePath); -} -else -{ +} else { header('Content-type: image/png'); header('Content-Disposition: inline; filename="'.$sClass.'.png"'); readfile($sImageFilePath); diff --git a/pages/index.php b/pages/index.php index 7e4fc5ca3..750fb70f2 100644 --- a/pages/index.php +++ b/pages/index.php @@ -1,3 +1,3 @@ diff --git a/pages/logoff.php b/pages/logoff.php index 229cb0c01..953b00ee3 100644 --- a/pages/logoff.php +++ b/pages/logoff.php @@ -1,4 +1,5 @@ Get('login_debug'); -if ($bLoginDebug) -{ +if ($bLoginDebug) { IssueLog::Info("---------------------------------"); - if (isset($sAuthUser)) - { + if (isset($sAuthUser)) { IssueLog::Info("--> Logout user: [$sAuthUser]"); - } - else - { + } else { IssueLog::Info("--> Logout"); } $sSessionLog = session_id().' '.utils::GetSessionLog(); @@ -71,13 +66,10 @@ if ($bLoginDebug) $aPluginList = LoginWebPage::GetLoginPluginList('iLogoutExtension'); /** @var iLogoutExtension $oLogoutExtension */ -foreach ($aPluginList as $oLogoutExtension) -{ - if ($bLoginDebug) - { +foreach ($aPluginList as $oLogoutExtension) { + if ($bLoginDebug) { $sCurrSessionLog = session_id().' '.utils::GetSessionLog(); - if ($sCurrSessionLog != $sSessionLog) - { + if ($sCurrSessionLog != $sSessionLog) { $sSessionLog = $sCurrSessionLog; IssueLog::Info("SESSION: $sSessionLog"); } @@ -87,11 +79,9 @@ foreach ($aPluginList as $oLogoutExtension) $oLogoutExtension->LogoutAction(); } -if ($bLoginDebug) -{ +if ($bLoginDebug) { $sCurrSessionLog = session_id().' '.utils::GetSessionLog(); - if ($sCurrSessionLog != $sSessionLog) - { + if ($sCurrSessionLog != $sSessionLog) { $sSessionLog = $sCurrSessionLog; IssueLog::Info("SESSION: $sSessionLog"); } @@ -100,8 +90,8 @@ if ($bLoginDebug) LoginWebPage::ResetSession(true); if ($bLoginDebug) { - $sSessionLog = session_id().' '.utils::GetSessionLog(); - IssueLog::Info("SESSION: $sSessionLog"); + $sSessionLog = session_id().' '.utils::GetSessionLog(); + IssueLog::Info("SESSION: $sSessionLog"); } $oPage = LoginWebPage::NewLoginWebPage(); diff --git a/pages/notifications.php b/pages/notifications.php index 71cbd23f7..7b8a91aad 100644 --- a/pages/notifications.php +++ b/pages/notifications.php @@ -1,4 +1,5 @@ SetCurrentTab('UI:NotificationsMenu:Actions:'.$sClassToDisplay); $iBlock = 0; - foreach($aActionClasses as $sActionClass) - { + foreach ($aActionClasses as $sActionClass) { $oFilter = new DBObjectSearch($sActionClass); $oFilter->AddCondition('finalclass', $sActionClass); // derived classes will be further processed - $aParams = array('panel_title' => MetaModel::GetName($sActionClass)); + $aParams = ['panel_title' => MetaModel::GetName($sActionClass)]; $sBlockId = 'block_'.utils::Sanitize($sClassToDisplay, '', utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER).'_'.$iBlock; $oBlock = new DisplayBlock($oFilter, 'list', false, $aParams); @@ -91,8 +90,14 @@ function DisplayActionsTab(iTopWebPage &$oP, string $sClassToDisplay, array $aCl // Main program // $oP = new iTopWebPage(Dict::S('Menu:NotificationsMenu+')); -$oP->SetBreadCrumbEntry('ui-tool-notifications', Dict::S('Menu:NotificationsMenu'), Dict::S('Menu:NotificationsMenu+'), '', 'fas fa-bell', - iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); +$oP->SetBreadCrumbEntry( + 'ui-tool-notifications', + Dict::S('Menu:NotificationsMenu'), + Dict::S('Menu:NotificationsMenu+'), + '', + 'fas fa-bell', + iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES +); $oPageContentLayout = PageContentFactory::MakeStandardEmpty(); $oP->SetContentLayout($oPageContentLayout); @@ -115,7 +120,7 @@ $oP->SetCurrentTabContainer('Tabs_0'); $oP->SetCurrentTab('UI:NotificationsMenu:Triggers'); $oFilter = new DBObjectSearch('Trigger'); -$aParams = array('panel_title' => Dict::S('UI:NotificationsMenu:AvailableTriggers')); +$aParams = ['panel_title' => Dict::S('UI:NotificationsMenu:AvailableTriggers')]; $oBlock = new DisplayBlock($oFilter, 'list', false, $aParams); $oBlock->Display($oP, 'block_0', $aParams); diff --git a/pages/oauth.landing.php b/pages/oauth.landing.php index 5c70944ec..0f065a839 100644 --- a/pages/oauth.landing.php +++ b/pages/oauth.landing.php @@ -1,6 +1,5 @@ GenerateUrl(NotificationsCenterController::ROUTE_NAMESPACE.'.display_page', [], true); $oNotificationsBlock->AddSubBlock(new Html('

      '.Dict::Format('UI:Preferences:Notifications+', $sNotificationsCenterUrl).'

      ')); $oContentLayout->AddMainBlock($oNotificationsBlock); - ////////////////////////////////////////////////////////////////////////// // // Favorite Organizations // ////////////////////////////////////////////////////////////////////////// - $oFavoriteOrganizationsBlock = new Panel(Dict::S('UI:FavoriteOrganizations'), array(), 'grey', 'ibo-favorite-organizations'); + $oFavoriteOrganizationsBlock = new Panel(Dict::S('UI:FavoriteOrganizations'), [], 'grey', 'ibo-favorite-organizations'); $oFavoriteOrganizationsBlock->SetSubTitle(Dict::S('UI:FavoriteOrganizations+')); $oFavoriteOrganizationsBlock->AddCSSClass('ibo-datatable-panel'); $oFavoriteOrganizationsForm = new Form(); @@ -210,7 +210,7 @@ JS // ////////////////////////////////////////////////////////////////////////// - $oShortcutsBlock = new BlockShortcuts(Dict::S('Menu:MyShortcuts'), array(), 'grey', 'ibo-shortcuts'); + $oShortcutsBlock = new BlockShortcuts(Dict::S('Menu:MyShortcuts'), [], 'grey', 'ibo-shortcuts'); $oShortcutsBlock->AddCSSClass('ibo-datatable-panel'); $oShortcutsBlock->sIdShortcuts = 'shortcut_list'; @@ -234,12 +234,22 @@ JS $oShortcutsToolBar = ToolbarUIBlockFactory::MakeForButton(); $oShortcutsBlock->AddSubBlock($oShortcutsToolBar); // - Rename button - $oShortcutsRenameButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Rename'), null, null, false, - "shortcut_btn_rename"); + $oShortcutsRenameButton = ButtonUIBlockFactory::MakeForSecondaryAction( + Dict::S('UI:Button:Rename'), + null, + null, + false, + "shortcut_btn_rename" + ); $oShortcutsToolBar->AddSubBlock($oShortcutsRenameButton); // - Delete button - $oShortcutsDeleteButton = ButtonUIBlockFactory::MakeForSecondaryAction(Dict::S('UI:Button:Delete'), null, null, false, - "shortcut_btn_delete"); + $oShortcutsDeleteButton = ButtonUIBlockFactory::MakeForSecondaryAction( + Dict::S('UI:Button:Delete'), + null, + null, + false, + "shortcut_btn_delete" + ); $oShortcutsToolBar->AddSubBlock($oShortcutsDeleteButton); } $oContentLayout->AddMainBlock($oShortcutsBlock); @@ -253,26 +263,27 @@ JS $oUser = UserRights::GetUserObject(); /** @var iNewsroomProvider[] $aProviders */ $aProviders = InterfaceDiscovery::GetInstance()->FindItopClasses(iNewsroomProvider::class); - foreach($aProviders as $cProvider) - { + foreach ($aProviders as $cProvider) { $oProvider = new $cProvider(); - if ($oProvider->IsApplicable($oUser)) - { + if ($oProvider->IsApplicable($oUser)) { $iCountProviders++; } } $bNewsroomEnabled = (MetaModel::GetConfig()->Get('newsroom_enabled') !== false); - if ($bNewsroomEnabled && ($iCountProviders > 0)) - { - $oNewsroomBlock = new Panel(Dict::S('UI:Newsroom:Preferences'), array(), 'grey', 'ibo-newsroom'); + if ($bNewsroomEnabled && ($iCountProviders > 0)) { + $oNewsroomBlock = new Panel(Dict::S('UI:Newsroom:Preferences'), [], 'grey', 'ibo-newsroom'); $sNewsroomHtml = ''; $sNewsroomHtml .= ''; $iNewsroomDisplaySize = (int)appUserPreferences::GetPref('newsroom_display_size', 7); - if ($iNewsroomDisplaySize < 1) $iNewsroomDisplaySize = 1; - if ($iNewsroomDisplaySize > 20) $iNewsroomDisplaySize = 20; + if ($iNewsroomDisplaySize < 1) { + $iNewsroomDisplaySize = 1; + } + if ($iNewsroomDisplaySize > 20) { + $iNewsroomDisplaySize = 20; + } $sInput = ''; $sIcon = ''; $sNewsroomHtml .= Dict::Format('UI:Newsroom:DisplayAtMost_X_Messages', $sInput, $sIcon); @@ -281,22 +292,16 @@ JS * @var iNewsroomProvider[] $aProviders */ $sAppRootUrl = utils::GetAbsoluteUrlAppRoot(); - foreach($aProviders as $cProvider) - { + foreach ($aProviders as $cProvider) { $oProvider = new $cProvider(); - if ($oProvider->IsApplicable($oUser)) - { + if ($oProvider->IsApplicable($oUser)) { $sUrl = $oProvider->GetPreferencesUrl(); $sProviderClass = get_class($oProvider); $sPreferencesLink = ''; - if ($sUrl !== null) - { - if(substr($sUrl, 0, strlen($sAppRootUrl)) === $sAppRootUrl) - { + if ($sUrl !== null) { + if (substr($sUrl, 0, strlen($sAppRootUrl)) === $sAppRootUrl) { $sTarget = ''; // Internal link, open in the same window - } - else - { + } else { $sTarget = ' target="_blank"'; // External link, open in new window } $sPreferencesLink = ' - '.Dict::S('UI:Newsroom:ConfigurationLink').''; @@ -306,8 +311,10 @@ JS // Forbid disabling internal newsroom provider $sDisabledForHtml = $sProviderClass === iTopNewsroomProvider::class ? 'disabled' : ''; - $sNewsroomHtml .= '
      '.$sPreferencesLink.'
      '; + $sNewsroomHtml .= '
      '.$sPreferencesLink.'
      '; } } @@ -317,7 +324,8 @@ JS // - Reset button $oNewsroomResetCacheButton = ButtonUIBlockFactory::MakeForAlternativeDestructiveAction(Dict::S('UI:Newsroom:ResetCache')); - $oNewsroomResetCacheButton->SetOnClickJsCode(<<SetOnClickJsCode( + <<SetOnClickJsCode("window.location.href = '$sURL'"); $oNewsroomToolbar->AddSubBlock($oNewsroomCancelButton); // - Submit button - $oNewsroomSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), 'operation', - 'apply_newsroom_preferences', true); + $oNewsroomSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction( + Dict::S('UI:Button:Apply'), + 'operation', + 'apply_newsroom_preferences', + true + ); $oNewsroomToolbar->AddSubBlock($oNewsroomSubmitButton); - $sNewsroomEndHtml = ''; $oNewsroomEndHtmlBlock = new Html($sNewsroomEndHtml); @@ -350,7 +361,7 @@ JS ////////////////////////////////////////////////////////////////////////// // Panel - $oKeyboardShortcutBlock = new Panel(Dict::S('UI:Preferences:PersonalizeKeyboardShortcuts:Title'), array(), 'grey', 'ibo_keyboard_shortcuts'); + $oKeyboardShortcutBlock = new Panel(Dict::S('UI:Preferences:PersonalizeKeyboardShortcuts:Title'), [], 'grey', 'ibo_keyboard_shortcuts'); // Form $oKeyboardShortcutForm = new Form('ibo-form-for-user-interface-preferences'); $oKeyboardShortcutForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', 'apply_keyboard_shortcuts')) @@ -412,7 +423,6 @@ JS $oKeyboardShortcutSubmitButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Apply'), 'operation', 'apply_keyboard_shortcuts', true); $oKeyboardShortcutToolbar->AddSubBlock($oKeyboardShortcutSubmitButton); - $oContentLayout->AddMainBlock($oKeyboardShortcutBlock); ////////////////////////////////////////////////////////////////////////// @@ -421,23 +431,20 @@ JS // ////////////////////////////////////////////////////////////////////////// - $oUserPicturePlaceHolderBlock = new Panel(Dict::S('UI:Preferences:ChooseAPlaceholder'), array(), 'grey', 'ibo-user-picture-placeholder'); + $oUserPicturePlaceHolderBlock = new Panel(Dict::S('UI:Preferences:ChooseAPlaceholder'), [], 'grey', 'ibo-user-picture-placeholder'); $sUserPicturesFolderRelPath = 'images/user-pictures/'; - $sUserPicturesFolderAbsPath = APPROOT . $sUserPicturesFolderRelPath; - $sUserPicturesFolderAbsUrl = utils::GetAbsoluteUrlAppRoot() . $sUserPicturesFolderRelPath; + $sUserPicturesFolderAbsPath = APPROOT.$sUserPicturesFolderRelPath; + $sUserPicturesFolderAbsUrl = utils::GetAbsoluteUrlAppRoot().$sUserPicturesFolderRelPath; $sUserDefaultPicture = appUserPreferences::GetPref('user_picture_placeholder', 'default-placeholder.png'); $sUserPicturePlaceHolderHtml = ''; $sUserPicturePlaceHolderHtml .= '

      '.Dict::S('UI:Preferences:ChooseAPlaceholder+').'

      '; - foreach (scandir($sUserPicturesFolderAbsPath) as $sUserPicture) - { - if ($sUserPicture === '.' || $sUserPicture === '..') - { + foreach (scandir($sUserPicturesFolderAbsPath) as $sUserPicture) { + if ($sUserPicture === '.' || $sUserPicture === '..') { continue; } $sAdditionalClass = ''; - if ($sUserDefaultPicture === $sUserPicture) - { + if ($sUserDefaultPicture === $sUserPicture) { $sAdditionalClass = ' ibo-is-active'; } $sUserPicturePlaceHolderHtml .= ' '; @@ -473,7 +480,7 @@ $('[data-role="ibo-preferences--user-preferences--picture-placeholder--image"]') }); }); JS -); + ); $sUserPicturePlaceHolderHtml .= << @@ -484,8 +491,7 @@ HTML $oContentLayout->AddMainBlock($oUserPicturePlaceHolderBlock); /** @var iPreferencesExtension $oLoginExtensionInstance */ - foreach (MetaModel::EnumPlugins('iPreferencesExtension') as $oPreferencesExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iPreferencesExtension') as $oPreferencesExtensionInstance) { $oPreferencesExtensionInstance->DisplayPreferences($oP); } @@ -503,7 +509,7 @@ HTML function GetLanguageFieldBlock(): iUIBlock { $aAvailableLanguages = Dict::GetLanguages(); - $aSortedLanguages = array(); + $aSortedLanguages = []; foreach ($aAvailableLanguages as $sCode => $aLang) { if (MetaModel::GetConfig()->Get('demo_mode') && ($sCode !== Dict::GetUserLanguage())) { // Demo mode: only the current user language is listed in the available choices @@ -582,10 +588,12 @@ function GetTabsLayoutFieldBlock(): iUIBlock ]; $oSelect = SelectUIBlockFactory::MakeForSelectWithLabel('tab_layout', Dict::S('UI:Preferences:Tabs:Layout:Label')); foreach ($aOptionsValues as $sValue) { - $oSelect->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption( - $sValue, - Dict::S('UI:Preferences:Tabs:Layout:'.ucfirst($sValue)), - $sValue === $sCurrentValue) + $oSelect->AddSubBlock( + SelectOptionUIBlockFactory::MakeForSelectOption( + $sValue, + Dict::S('UI:Preferences:Tabs:Layout:'.ucfirst($sValue)), + $sValue === $sCurrentValue + ) ); } @@ -610,10 +618,12 @@ function GetTabsNavigationFieldBlock(): iUIBlock ]; $oSelect = SelectUIBlockFactory::MakeForSelectWithLabel('tab_scrollable', Dict::S('UI:Preferences:Tabs:Scrollable:Label')); foreach ($aOptionsValues as $sValue => $sDictEntrySuffix) { - $oSelect->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption( - $sValue, - Dict::S('UI:Preferences:Tabs:Scrollable:'.$sDictEntrySuffix), - $sValue === $sCurrentValueAsString) + $oSelect->AddSubBlock( + SelectOptionUIBlockFactory::MakeForSelectOption( + $sValue, + Dict::S('UI:Preferences:Tabs:Scrollable:'.$sDictEntrySuffix), + $sValue === $sCurrentValueAsString + ) ); } @@ -678,7 +688,6 @@ HTML; return new Html($sHtml); } - /** * @return \Combodo\iTop\Application\UI\Base\iUIBlock * @throws \CoreException @@ -717,7 +726,7 @@ function GetToastsPositionFieldBlock(): iUIBlock $sPosition = appUserPreferences::GetPref('toasts_vertical_position', "bottom"); $oSelect = SelectUIBlockFactory::MakeForSelectWithLabel('toasts_vertical_position', Dict::S('UI:Preferences:General:Toasts')); - + $oSelect->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption("bottom", Dict::S('UI:Preferences:General:Toasts:Bottom'), $sPosition === "bottom")); $oSelect->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption("top", Dict::S('UI:Preferences:General:Toasts:Top'), $sPosition === "top")); @@ -754,7 +763,7 @@ try { case 'apply': $oFilter = DBObjectSearch::FromOQL('SELECT Organization'); $sSelectionMode = utils::ReadParam('selectionMode', ''); - $aExceptions = utils::ReadParam('storedSelection', array()); + $aExceptions = utils::ReadParam('storedSelection', []); if (($sSelectionMode == 'negative') && (count($aExceptions) == 0)) { // All Orgs selected appUserPreferences::SetPref('favorite_orgs', null); @@ -816,17 +825,17 @@ try { // - Obsolete data $bShowObsoleteData = (bool)utils::ReadParam('show_obsolete_data', 0); appUserPreferences::SetPref('show_obsolete_data', $bShowObsoleteData); - + // - Summary cards $bShowSummaryCards = (bool)utils::ReadParam('show_summary_cards', 0); appUserPreferences::SetPref('show_summary_cards', $bShowSummaryCards); // - Toast notifications $sToastsVerticalPosition = utils::ReadParam('toasts_vertical_position', "bottom"); - if(utils::IsNotNullOrEmptyString($sToastsVerticalPosition) && in_array($sToastsVerticalPosition, ["bottom", "top"], true)) { + if (utils::IsNotNullOrEmptyString($sToastsVerticalPosition) && in_array($sToastsVerticalPosition, ["bottom", "top"], true)) { appUserPreferences::SetPref('toasts_vertical_position', $sToastsVerticalPosition); } - + // Redirect to force a reload/display of the page in case language has been changed $oAppContext = new ApplicationContext(); $sURL = utils::GetAbsoluteUrlAppRoot().'pages/preferences.php?'.$oAppContext->GetForLink(); @@ -878,29 +887,25 @@ try { } } $bProvidersModified = false; - foreach ($aProviders as $cProvider) - { + foreach ($aProviders as $cProvider) { // Forbid disabling internal newsroom provider if ($cProvider === iTopNewsroomProvider::class) { continue; } $oProvider = new $cProvider(); - if ($oProvider->IsApplicable($oUser)) - { + if ($oProvider->IsApplicable($oUser)) { $sProviderClass = get_class($oProvider); $bProviderEnabled = (utils::ReadParam('newsroom_provider_'.$sProviderClass, 'off') == 'on'); $bCurrentValue = appUserPreferences::GetPref('newsroom_provider_'.$sProviderClass, true); - if ($bCurrentValue != $bProviderEnabled) - { + if ($bCurrentValue != $bProviderEnabled) { // Save the preference only if it differs from the current value $bProvidersModified = true; appUserPreferences::SetPref('newsroom_provider_'.$sProviderClass, $bProviderEnabled); } } } - if ($bProvidersModified) - { + if ($bProvidersModified) { $oPage->add_ready_script( <<SetBreadCrumbEntry('ui-tool-preferences', Dict::S('UI:Preferences'), Dict::S('UI:Preferences'), '', - 'fas fa-user-cog', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); + $oPage->SetBreadCrumbEntry( + 'ui-tool-preferences', + Dict::S('UI:Preferences'), + Dict::S('UI:Preferences'), + '', + 'fas fa-user-cog', + iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES + ); DisplayPreferences($oPage); } } - + $oPage->output(); -} -catch(CoreException $e) -{ +} catch (CoreException $e) { require_once(APPROOT.'/setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); - $oP->add("

      ".Dict::S('UI:FatalErrorMessage')."

      \n"); - $oP->error(Dict::Format('UI:Error_Details', $e->getHtmlDesc())); + $oP->add("

      ".Dict::S('UI:FatalErrorMessage')."

      \n"); + $oP->error(Dict::Format('UI:Error_Details', $e->getHtmlDesc())); $oP->output(); - if (MetaModel::IsLogEnabledIssue()) - { - if (MetaModel::IsValidClass('EventIssue')) - { + if (MetaModel::IsLogEnabledIssue()) { + if (MetaModel::IsValidClass('EventIssue')) { $oLog = new EventIssue(); $oLog->Set('message', $e->getMessage()); @@ -949,19 +956,15 @@ catch(CoreException $e) // For debugging only //throw $e; -} -catch(Exception $e) -{ +} catch (Exception $e) { require_once(APPROOT.'/setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); - $oP->add("

      ".Dict::S('UI:FatalErrorMessage')."

      \n"); - $oP->error(Dict::Format('UI:Error_Details', $e->getMessage())); + $oP->add("

      ".Dict::S('UI:FatalErrorMessage')."

      \n"); + $oP->error(Dict::Format('UI:Error_Details', $e->getMessage())); $oP->output(); - if (MetaModel::IsLogEnabledIssue()) - { - if (MetaModel::IsValidClass('EventIssue')) - { + if (MetaModel::IsLogEnabledIssue()) { + if (MetaModel::IsValidClass('EventIssue')) { $oLog = new EventIssue(); $oLog->Set('message', $e->getMessage()); @@ -969,7 +972,7 @@ catch(Exception $e) $oLog->Set('issue', 'PHP Exception'); $oLog->Set('impact', 'Page could not be displayed'); $oLog->Set('callstack', $e->getTrace()); - $oLog->Set('data', array()); + $oLog->Set('data', []); $oLog->DBInsertNoReload(); } diff --git a/pages/run_query.php b/pages/run_query.php index 62da736e3..04150d451 100644 --- a/pages/run_query.php +++ b/pages/run_query.php @@ -1,4 +1,5 @@ array( + $aExamples = [ + 'Pedagogic examples' => [ "Person" => "SELECT Person", "Person having an 'A' in their name" => "SELECT Person AS B WHERE B.name LIKE '%A%'", "Organization having a name beginning by 'My'" => "SELECT Organization WHERE name REGEXP '^My .*$'", "Changes planned on new year's day" => "SELECT Change AS ch WHERE ch.start_date >= '2009-12-31' AND ch.end_date <= '2010-01-01'", "IPs in a range" => "SELECT DatacenterDevice AS dev WHERE INET_ATON(dev.managementip) > INET_ATON('10.22.32.224') AND INET_ATON(dev.managementip) < INET_ATON('10.22.32.255')", "Persons below a given root organization" => "SELECT Person AS P JOIN Organization AS Node ON P.org_id = Node.id JOIN Organization AS Root ON Node.parent_id BELOW Root.id WHERE Root.id=1", - ), - 'Usefull examples' => array( + ], + 'Usefull examples' => [ "NW interfaces of equipment in production for customer 'Demo'" => "SELECT PhysicalInterface AS if JOIN DatacenterDevice AS dev ON if.connectableci_id = dev.id WHERE dev.status = 'production' AND dev.organization_name = 'Demo'", "My tickets" => "SELECT Ticket AS t WHERE t.agent_id = :current_contact_id", "People being owner of an active ticket" => "SELECT Person AS p JOIN UserRequest AS u ON u.agent_id = p.id WHERE u.status != 'closed'", "Contracts terminating in the next thirty days" => "SELECT Contract AS c WHERE c.end_date > NOW() AND c.end_date < DATE_ADD(NOW(), INTERVAL 30 DAY)", "Orphan tickets (opened one hour ago, still not assigned)" => "SELECT UserRequest AS u WHERE u.start_date < DATE_SUB(NOW(), INTERVAL 60 MINUTE) AND u.status = 'new'", "Long lasting incidents (duration > 8 hours)" => "SELECT UserRequest AS u WHERE u.close_date > DATE_ADD(u.start_date, INTERVAL 8 HOUR)", - ), - ); + ], + ]; - $aDisplayData = array(); + $aDisplayData = []; $oAppContext = new ApplicationContext(); $sContext = $oAppContext->GetForForm(); foreach ($aExamples as $sTopic => $aQueries) { @@ -81,23 +82,23 @@ function ShowExamples($oP, $sExpression) $oFormButton->AddSubBlock($oButton); $oFormButton->AddSubBlock(new Html($sContext)); //$aDisplayData[$sTopic][] = array( - $aDisplayData[Dict::S('UI:RunQuery:QueryExamples')][] = array( + $aDisplayData[Dict::S('UI:RunQuery:QueryExamples')][] = [ 'desc' => "
      ".utils::EscapeHtml($sDescription)."
      ", 'oql' => "
      ".utils::EscapeHtml($sOql)."
      ", 'go' => BlockRenderer::RenderBlockTemplates($oFormButton), - ); + ]; } } - $aDisplayConfig = array(); - $aDisplayConfig['desc'] = array( + $aDisplayConfig = []; + $aDisplayConfig['desc'] = [ 'label' => Dict::S('UI:RunQuery:HeaderPurpose'), 'description' => Dict::S('UI:RunQuery:HeaderPurpose+'), - ); - $aDisplayConfig['oql'] = array( + ]; + $aDisplayConfig['oql'] = [ 'label' => Dict::S('UI:RunQuery:HeaderOQLExpression'), 'description' => Dict::S('UI:RunQuery:HeaderOQLExpression+'), - ); - $aDisplayConfig['go'] = array('label' => '', 'description' => ''); + ]; + $aDisplayConfig['go'] = ['label' => '', 'description' => '']; foreach ($aDisplayData as $sTopic => $aQueriesDisplayData) { $bShowOpened = $bUsingExample; @@ -120,8 +121,7 @@ $sEncoding = utils::ReadParam('encoding', 'oql'); ShowExamples($oP, $sExpression); -try -{ +try { if ($sEncoding == 'crypted') { // Translate $sExpression into a oql expression $oFilter = DBObjectSearch::unserialize($sExpression); @@ -129,32 +129,23 @@ try } $oFilter = null; - $aArgs = array(); + $aArgs = []; $sSyntaxError = null; - if (!empty($sExpression)) - { - try - { + if (!empty($sExpression)) { + try { $oFilter = DBObjectSearch::FromOQL($sExpression); - } - catch(Exception $e) - { - if ($e instanceof OqlException) - { + } catch (Exception $e) { + if ($e instanceof OqlException) { $sSyntaxError = $e->getHtmlDesc(); - } - else - { + } else { $sSyntaxError = $e->getMessage(); } } - if ($oFilter) - { - $aArgs = array(); - foreach($oFilter->GetQueryParams() as $sParam => $foo) - { + if ($oFilter) { + $aArgs = []; + foreach ($oFilter->GetQueryParams() as $sParam => $foo) { $value = utils::ReadParam('arg_'.$sParam, null, true, 'raw_data'); if (!is_null($value)) { $aArgs[$sParam] = $value; @@ -180,7 +171,8 @@ try $oQueryTextArea->AddCSSClasses(['ibo-input-text', 'ibo-query-oql', 'ibo-is-code']); $oQueryForm->AddSubBlock($oQueryTextArea); - $oP->add_ready_script(<<add_ready_script( + << 0) { //--- Query arguments $oQueryForm->AddSubBlock(TitleUIBlockFactory::MakeNeutral(Dict::S('UI:RunQuery:QueryArguments'), 3)->AddCSSClass("ibo-collapsible-section--title")); - $oQueryArgsContainer = UIContentBlockUIBlockFactory::MakeStandard(null,['wizContainer']); + $oQueryArgsContainer = UIContentBlockUIBlockFactory::MakeStandard(null, ['wizContainer']); $oQueryForm->AddSubBlock($oQueryArgsContainer); foreach ($aArgs as $sParam => $sValue) { - $oInput = InputUIBlockFactory::MakeStandard("text",'arg_'.$sParam, $sValue); - $oArgInput = \Combodo\iTop\Application\UI\Base\Component\Field\FieldUIBlockFactory::MakeFromObject($sParam,$oInput,Field::ENUM_FIELD_LAYOUT_SMALL); + $oInput = InputUIBlockFactory::MakeStandard("text", 'arg_'.$sParam, $sValue); + $oArgInput = \Combodo\iTop\Application\UI\Base\Component\Field\FieldUIBlockFactory::MakeFromObject($sParam, $oInput, Field::ENUM_FIELD_LAYOUT_SMALL); $oArgInput->AddCSSClass("ibo-field--label-small"); //$oArgInput = InputUIBlockFactory::MakeForInputWithLabel( $sParam, 'arg_'.$sParam, $sValue ); $oQueryArgsContainer->AddSubBlock($oArgInput); @@ -216,10 +208,9 @@ JS $oQueryForm->AddSubBlock($oToolbarButtons); $oToolbarButtons->AddSubBlock($oQuerySubmit); - if ($oFilter) { //--- Query filter - $oPanelResult= PanelUIBlockFactory::MakeWithBrandingSecondaryColor(Dict::S('UI:RunQuery:QueryResults')); + $oPanelResult = PanelUIBlockFactory::MakeWithBrandingSecondaryColor(Dict::S('UI:RunQuery:QueryResults')); $oP->AddSubBlock($oPanelResult); $oResultBlock = new DisplayBlock($oFilter, 'list', false); $oPanelResult->AddSubBlock($oResultBlock->GetDisplay($oP, 'runquery')); @@ -228,10 +219,10 @@ JS //$iCount = $oResultBlock->GetDisplayedCount(); $sPageId = "ui-search-".$oFilter->GetClass(); $sLabel = MetaModel::GetName($oFilter->GetClass()); - $aArgs = array(); + $aArgs = []; foreach (array_merge($_POST, $_GET) as $sKey => $value) { if (is_array($value)) { - $aItems = array(); + $aItems = []; foreach ($value as $sItemKey => $sItemValue) { $aArgs[] = $sKey.'['.$sItemKey.']='.urlencode($sItemValue); } @@ -242,7 +233,6 @@ JS $sUrl = utils::GetAbsoluteUrlAppRoot().'pages/run_query.php?'.implode('&', $aArgs); $oP->SetBreadCrumbEntry($sPageId, $sLabel, $oFilter->ToOQL(true), $sUrl, 'fas fa-terminal', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); - //--- More info $aMoreInfoBlocks = []; @@ -254,14 +244,13 @@ JS $oSerializedQuerySet->AddSubBlock(UIContentBlockUIBlockFactory::MakeForCode($oFilter->serialize())); $aMoreInfoBlocks[] = $oSerializedQuerySet; - $aModifierProperties = MetaModel::MakeModifierProperties($oFilter); // Avoid adding all the fields for counts or "group by" requests - $aCountAttToLoad = array(); + $aCountAttToLoad = []; $sMainClass = null; foreach ($oFilter->GetSelectedClasses() as $sClassAlias => $sClass) { - $aCountAttToLoad[$sClassAlias] = array(); + $aCountAttToLoad[$sClassAlias] = []; if (empty($sMainClass)) { $sMainClass = $sClass; } @@ -279,7 +268,7 @@ JS } // SQL Count - $sSQL = $oFilter->MakeSelectQuery(array(), $aRealArgs, $aCountAttToLoad, null, 0, 0, true); + $sSQL = $oFilter->MakeSelectQuery([], $aRealArgs, $aCountAttToLoad, null, 0, 0, true); $oCountResultQuerySet = new FieldSet(Dict::S('UI:RunQuery:ResultSQLCount')); $oCountResultQuerySet->AddSubBlock(UIContentBlockUIBlockFactory::MakeForCode($sSQL)); $aMoreInfoBlocks[] = $oCountResultQuerySet; @@ -324,13 +313,13 @@ JS $sEscapedExpression = json_encode(utils::EscapeHtml($sFixedExpression)); $oUseSuggestedQueryButton = ButtonUIBlockFactory::MakeForDestructiveAction('Use this query'); $oUseSuggestedQueryButton->SetOnClickJsCode( -<<AddSubBlock($oUseSuggestedQueryButton); + $oSyntaxErrorPanel->AddSubBlock($oUseSuggestedQueryButton); } else { $oSyntaxErrorPanel->AddSubBlock(HtmlFactory::MakeParagraph($e->getHtmlDesc())); } @@ -341,8 +330,7 @@ JS $oSyntaxErrorPanel->AddSubBlock(HtmlFactory::MakeParagraph($e->getMessage())); } } -} -catch (Exception $e) { +} catch (Exception $e) { $oErrorAlert = AlertUIBlockFactory::MakeForFailure( Dict::Format('UI:RunQuery:Error', $e->getMessage()), '
      '.$e->getTraceAsString().'
      ' @@ -352,4 +340,3 @@ catch (Exception $e) { } $oP->output(); - diff --git a/pages/schema.php b/pages/schema.php index 343c7bcb5..0dd7feff2 100644 --- a/pages/schema.php +++ b/pages/schema.php @@ -1,4 +1,5 @@ ".MetaModel::GetName($sClass)." (".$sClass.")"; + return "".MetaModel::GetName($sClass)." (".$sClass.")"; } /** @@ -41,25 +44,20 @@ function MakeClassHLink($sClass, $sContext) function DisplaySubclasses($oPage, $sClass, $sContext) { $aChildClasses = MetaModel::EnumChildClasses($sClass); - if (count($aChildClasses) != 0) - { + if (count($aChildClasses) != 0) { $oPage->add("
        \n"); - $aOrderedClasses = array(); - foreach ($aChildClasses as $sClassName) - { + $aOrderedClasses = []; + foreach ($aChildClasses as $sClassName) { // Skip indirect childs, they will be handled somewhere else - if (MetaModel::GetParentPersistentClass($sClassName) == $sClass) - { + if (MetaModel::GetParentPersistentClass($sClassName) == $sClass) { $aOrderedClasses[$sClassName] = MetaModel::GetName($sClassName); } } // Sort on the display name asort($aOrderedClasses); - foreach ($aOrderedClasses as $sClassName => $sDisplayName) - { + foreach ($aOrderedClasses as $sClassName => $sDisplayName) { // Skip indirect childs, they will be handled somewhere else - if (MetaModel::GetParentPersistentClass($sClassName) == $sClass) - { + if (MetaModel::GetParentPersistentClass($sClassName) == $sClass) { $oPage->add("
      • ".MakeClassHLink($sClassName, $sContext)."\n"); DisplaySubclasses($oPage, $sClassName, $sContext); $oPage->add("
      • \n"); @@ -73,40 +71,33 @@ function DisplaySubclasses($oPage, $sClass, $sContext) */ function GetSubclasses($sClass, $sContext) { - - $sHtml = ''; - try{ - $aChildClasses = MetaModel::EnumChildClasses($sClass); - if (count($aChildClasses) != 0) - { - $sHtml .= "
          "; - $aOrderedClasses = array(); - foreach ($aChildClasses as $sClassName) - { - // Skip indirect childs, they will be handled somewhere else - if (MetaModel::GetParentPersistentClass($sClassName) == $sClass) - { - $aOrderedClasses[$sClassName] = MetaModel::GetName($sClassName); + $sHtml = ''; + try { + $aChildClasses = MetaModel::EnumChildClasses($sClass); + if (count($aChildClasses) != 0) { + + $sHtml .= "
            "; + $aOrderedClasses = []; + foreach ($aChildClasses as $sClassName) { + // Skip indirect childs, they will be handled somewhere else + if (MetaModel::GetParentPersistentClass($sClassName) == $sClass) { + $aOrderedClasses[$sClassName] = MetaModel::GetName($sClassName); + } } - } - // Sort on the display name - asort($aOrderedClasses); - foreach ($aOrderedClasses as $sClassName => $sDisplayName) - { - // Skip indirect childs, they will be handled somewhere else - if (MetaModel::GetParentPersistentClass($sClassName) == $sClass) - { - $sHtml .="
          • ".MakeClassHLink($sClassName, $sContext); - $sHtml .= GetSubclasses($sClassName, $sContext); - $sHtml .= "
          • "; + // Sort on the display name + asort($aOrderedClasses); + foreach ($aOrderedClasses as $sClassName => $sDisplayName) { + // Skip indirect childs, they will be handled somewhere else + if (MetaModel::GetParentPersistentClass($sClassName) == $sClass) { + $sHtml .= "
          • ".MakeClassHLink($sClassName, $sContext); + $sHtml .= GetSubclasses($sClassName, $sContext); + $sHtml .= "
          • "; + } } + $sHtml .= "
          "; } - $sHtml .= "
        "; - } - } - - catch(Exception $e){ + } catch (Exception $e) { } return $sHtml; } @@ -116,12 +107,9 @@ function GetSubclasses($sClass, $sContext) */ function DisplayLifecycle($oPage, $sClass) { - if (!MetaModel::HasLifecycle($sClass)) - { + if (!MetaModel::HasLifecycle($sClass)) { $oPage->p(Dict::S('UI:Schema:NoLifeCyle')); - } - else - { + } else { $aStates = MetaModel::EnumStates($sClass); $aStimuli = MetaModel::EnumStimuli($sClass); $oPage->add("\n"); @@ -130,7 +118,6 @@ function DisplayLifecycle($oPage, $sClass) $("#img-lifecycle").attr('href',$("#img-lifecycle").attr('src')); $("#img-lifecycle").magnificPopup({type: 'image', closeOnContentClick: true}); EOF - ); $oOpenAllButton = ButtonUIBlockFactory::MakeForAlternativePrimaryAction('Open All', '', '', false, 'lifecycleOpenAll'); $oOpenAllButton->SetOnClickJsCode( @@ -138,7 +125,6 @@ EOF $('#LifeCycleList').find('.expandable-hitarea').click(); $('#LifeCycleAttrOptList').find('.expandable-hitarea').click(); JS - ); $oCloseAllButton = ButtonUIBlockFactory::MakeForAlternativePrimaryAction('Close All', '', '', false, 'lifecycleCloseAll'); $oCloseAllButton->SetOnClickJsCode( @@ -146,46 +132,35 @@ JS $('#LifeCycleList').find('.collapsable-hitarea').click(); $('#LifeCycleAttrOptList').find('.collapsable-hitarea').click(); JS - ); $oPage->AddUiBlock($oOpenAllButton); $oPage->AddUiBlock($oCloseAllButton); $oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral(Dict::S('UI:Schema:LifeCycleTransitions'), 3)); $oPage->add("
          \n"); - foreach ($aStates as $sStateCode => $aStateDef) - { + foreach ($aStates as $sStateCode => $aStateDef) { $sStateLabel = MetaModel::GetStateLabel($sClass, $sStateCode); $sStateDescription = MetaModel::GetStateDescription($sClass, $sStateCode); $oPage->add("
        • $sStateLabel ($sStateCode) $sStateDescription\n"); $oPage->add("
            \n"); - foreach (MetaModel::EnumTransitions($sClass, $sStateCode) as $sStimulusCode => $aTransitionDef) - { + foreach (MetaModel::EnumTransitions($sClass, $sStateCode) as $sStimulusCode => $aTransitionDef) { $sStimulusLabel = $aStimuli[$sStimulusCode]->GetLabel(); $sTargetState = $aTransitionDef['target_state']; $sTargetStateLabel = MetaModel::GetStateLabel($sClass, $sTargetState); - if (count($aTransitionDef['actions']) > 0) - { - $aActionsDesc = array(); - foreach ($aTransitionDef['actions'] as $actionHandler) - { - if (is_string($actionHandler)) - { + if (count($aTransitionDef['actions']) > 0) { + $aActionsDesc = []; + foreach ($aTransitionDef['actions'] as $actionHandler) { + if (is_string($actionHandler)) { $aActionsDesc[] = $actionHandler; - } - else - { - $aParamsDesc = array(); - foreach ($actionHandler['params'] as $aParamData) - { + } else { + $aParamsDesc = []; + foreach ($actionHandler['params'] as $aParamData) { $aParamsDesc[] = $aParamData['type'].':'.$aParamData['value']; } $aActionsDesc[] = $actionHandler['verb'].'('.implode(', ', $aParamsDesc).')'; } } $sActions = " (".implode(', ', $aActionsDesc).")"; - } - else - { + } else { $sActions = ""; } @@ -199,55 +174,42 @@ JS $oPage->add("
          \n"); $oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral(Dict::S('UI:Schema:LifeCyleAttributeOptions'), 3)); $oPage->add("
            \n"); - foreach ($aStates as $sStateCode => $aStateDef) - { + foreach ($aStates as $sStateCode => $aStateDef) { $sStateLabel = MetaModel::GetStateLabel($sClass, $sStateCode); $sStateDescription = MetaModel::GetStateDescription($sClass, $sStateCode); $oPage->add("
          • $sStateLabel ($sStateCode) $sStateDescription\n"); - if (count($aStates[$sStateCode]['attribute_list']) > 0) - { + if (count($aStates[$sStateCode]['attribute_list']) > 0) { $oPage->add("
              \n"); - foreach ($aStates[$sStateCode]['attribute_list'] as $sAttCode => $iOptions) - { + foreach ($aStates[$sStateCode]['attribute_list'] as $sAttCode => $iOptions) { $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); $sAttLabel = $oAttDef->GetLabel(); - $aOptions = array(); - if ($iOptions & OPT_ATT_HIDDEN) - { + $aOptions = []; + if ($iOptions & OPT_ATT_HIDDEN) { $aOptions[] = Dict::S('UI:Schema:LifeCycleHiddenAttribute'); } - if ($iOptions & OPT_ATT_READONLY) - { + if ($iOptions & OPT_ATT_READONLY) { $aOptions[] = Dict::S('UI:Schema:LifeCycleReadOnlyAttribute'); } - if ($iOptions & OPT_ATT_MANDATORY) - { + if ($iOptions & OPT_ATT_MANDATORY) { $aOptions[] = Dict::S('UI:Schema:LifeCycleMandatoryAttribute'); } - if ($iOptions & OPT_ATT_MUSTCHANGE) - { + if ($iOptions & OPT_ATT_MUSTCHANGE) { $aOptions[] = Dict::S('UI:Schema:LifeCycleAttributeMustChange'); } - if ($iOptions & OPT_ATT_MUSTPROMPT) - { + if ($iOptions & OPT_ATT_MUSTPROMPT) { $aOptions[] = Dict::S('UI:Schema:LifeCycleAttributeMustPrompt'); } - if (count($aOptions)) - { + if (count($aOptions)) { $sOptions = implode(', ', $aOptions); - } - else - { + } else { $sOptions = ""; } $oPage->add("
            • $sAttLabel $sOptions
            • \n"); } $oPage->add("
          • \n"); - } - else - { + } else { $oPage->p("".Dict::S('UI:Schema:LifeCycleEmptyList').""); } } @@ -257,7 +219,6 @@ JS } } - /** * Helper for the trigger */ @@ -265,7 +226,7 @@ function DisplayTriggers($oPage, $sClass) { $sClassList = implode("', '", MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL)); $oSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObject WHERE target_class IN ('$sClassList')")); - cmdbAbstractObject::DisplaySet($oPage, $oSet, array('block_id' => 'triggers')); + cmdbAbstractObject::DisplaySet($oPage, $oSet, ['block_id' => 'triggers']); } function DisplayEvents(WebPage $oPage, $sClass) @@ -301,7 +262,7 @@ function DisplayEvents(WebPage $oPage, $sClass) } else { $oObject = MetaModel::NewObject($sClass); foreach (MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL, false) as $sParentClass) { - $aSources[] = $sParentClass; + $aSources[] = $sParentClass; } } $aListeners = []; @@ -345,7 +306,7 @@ function DisplayEvents(WebPage $oPage, $sClass) } } $sListener = $sListenerClass.'->'.$aListener['callback'][1].'(\Combodo\iTop\Service\Events\EventData $oEventData)'; - } else if (is_array($aListener['callback'])) { + } elseif (is_array($aListener['callback'])) { $sListener = $aListener['callback'][0].'::'.$aListener['callback'][1]; } else { $sListener = $aListener['callback'].'(\Combodo\iTop\Service\Events\EventData $oEventData)'; @@ -368,28 +329,24 @@ function DisplayEvents(WebPage $oPage, $sClass) function DisplayClassesList($oPage, $oLayout, $sContext) { $sSelectedClass = utils::ReadParam('class', '', false, 'class'); - + $oLayout->AddSideHtml("
            "); - + $oListSearch = new Select("ibo-datamodel-viewer--class-search"); $oListSearch->SetName('aa'); // Get all the "root" classes for display - $aRootClasses = array(); + $aRootClasses = []; $aClassLabelAndCodeAsJSON = []; - $aClassLabelAsJSON = array(); - $aClassCodeAsJSON = array(); + $aClassLabelAsJSON = []; + $aClassCodeAsJSON = []; $oOptionSearch = SelectOptionUIBlockFactory::MakeForSelectOption('', "select option", true); $oListSearch->AddOption($oOptionSearch->SetDisabled(true)); - foreach (MetaModel::GetClasses() as $sClassName) - { - if (MetaModel::IsRootClass($sClassName)) - { + foreach (MetaModel::GetClasses() as $sClassName) { + if (MetaModel::IsRootClass($sClassName)) { $aRootClasses[$sClassName] = MetaModel::GetName($sClassName); - } - elseif (MetaModel::IsStandaloneClass($sClassName)) - { + } elseif (MetaModel::IsStandaloneClass($sClassName)) { $aRootClasses[$sClassName] = MetaModel::GetName($sClassName); } $sLabelClassName = MetaModel::GetName($sClassName); @@ -398,9 +355,9 @@ function DisplayClassesList($oPage, $oLayout, $sContext) $oListSearch->AddOption($oOptionSearch); //Fetch classes names for autocomplete purpose // - Encode as JSON to escape quotes and other characters - array_push ($aClassLabelAndCodeAsJSON, ["value"=>$sClassName,"label"=>"$sLabelClassName ($sClassName)"]); - array_push ($aClassLabelAsJSON, ["value"=>$sClassName,"label"=>"$sLabelClassName"]); - array_push ($aClassCodeAsJSON, ["value"=>$sClassName,"label"=>"$sClassName"]); + array_push($aClassLabelAndCodeAsJSON, ["value" => $sClassName,"label" => "$sLabelClassName ($sClassName)"]); + array_push($aClassLabelAsJSON, ["value" => $sClassName,"label" => "$sLabelClassName"]); + array_push($aClassCodeAsJSON, ["value" => $sClassName,"label" => "$sClassName"]); } usort($aClassLabelAndCodeAsJSON, "Label_sort"); $oLayout->AddSideBlock($oListSearch); @@ -457,22 +414,17 @@ JS } JS - ); // Sort them alphabetically on their display name asort($aClassLabelAndCodeAsJSON); //usort($aRootClasses,"Label_sort"); - foreach ($aRootClasses as $sClassName => $sDisplayName) - { - if (MetaModel::IsRootClass($sClassName)) - { + foreach ($aRootClasses as $sClassName => $sDisplayName) { + if (MetaModel::IsRootClass($sClassName)) { $oLayout->AddSideHtml("
          • ".MakeClassHLink($sClassName, $sContext)."\n"); $oLayout->AddSideHtml(GetSubclasses($sClassName, $sContext)); $oLayout->AddSideHtml("
          • \n"); - } - elseif (MetaModel::IsStandaloneClass($sClassName)) - { + } elseif (MetaModel::IsStandaloneClass($sClassName)) { $oLayout->AddSideHtml("
          • ".MakeClassHLink($sClassName, $sContext)."
          • \n"); } } @@ -480,8 +432,9 @@ JS $oPage->add_ready_script('$("#ibo-datamodel-viewer--classes-list--list").treeview();'); } -function Label_sort($building_a, $building_b) { - return strnatcmp ($building_a["label"], $building_b["label"]); +function Label_sort($building_a, $building_b) +{ + return strnatcmp($building_a["label"], $building_b["label"]); } /** @@ -489,29 +442,23 @@ function Label_sort($building_a, $building_b) { */ function DisplayRelatedClassesGraph($oPage, $sClass) { - try - { + try { $bOnTheLeft = true; $bSkipLinkingClasses = false; // 1) Fetching referencing classes data // - $aData = array(); - $aOrigins = array('_' => true); + $aData = []; + $aOrigins = ['_' => true]; $aRefs = MetaModel::EnumReferencingClasses($sClass, $bSkipLinkingClasses); $sSelfReference = "false"; - if (count($aRefs) != 0) - { - foreach ($aRefs as $sRemoteClass => $aRemoteKeys) - { - foreach ($aRemoteKeys as $sExtKeyAttCode => $oExtKeyAttDef) - { - if ($sRemoteClass != $sClass) - { + if (count($aRefs) != 0) { + foreach ($aRefs as $sRemoteClass => $aRemoteKeys) { + foreach ($aRemoteKeys as $sExtKeyAttCode => $oExtKeyAttDef) { + if ($sRemoteClass != $sClass) { // ref_prefix to avoid collision between attributes labels that refer to this class and local attributes label that references other classes - $aAttribute = array('label' => 'ref_'.$sExtKeyAttCode); + $aAttribute = ['label' => 'ref_'.$sExtKeyAttCode]; // Test if a distant attribut exists and if it uses a link class - if (!($oExtKeyAttDef->GetMirrorLinkAttribute() == null ? false : $oExtKeyAttDef->GetMirrorLinkAttribute() instanceof AttributeLinkedSetIndirect)) - { + if (!($oExtKeyAttDef->GetMirrorLinkAttribute() == null ? false : $oExtKeyAttDef->GetMirrorLinkAttribute() instanceof AttributeLinkedSetIndirect)) { $aAttribute['related'] = $sRemoteClass; $aAttribute['related_icon'] = MetaModel::GetClassIcon($aAttribute['related'], false); $aAttribute['related_position'] = $bOnTheLeft ? -1 : 1; @@ -529,24 +476,21 @@ function DisplayRelatedClassesGraph($oPage, $sClass) // 2) Fetching referenced classes data // - $aDataRef = array( - array( + $aDataRef = [ + [ 'label' => $sClass, 'icon' => MetaModel::GetClassIcon($sClass, false), 'origin_index' => 0, 'alphabetical_index' => 0, 'origin' => '_', - ), - ); + ], + ]; $bOnTheLeft = true; - $aOriginsRef = array('_' => true); - foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - $aAttribute = array('label' => $sAttCode); - if ($oAttDef->IsLinkSet()) - { - if ($oAttDef->IsIndirect()) - { + $aOriginsRef = ['_' => true]; + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + $aAttribute = ['label' => $sAttCode]; + if ($oAttDef->IsLinkSet()) { + if ($oAttDef->IsIndirect()) { $sRemoteAttDef = $oAttDef->GetExtKeyToRemote(); $aAttribute['related'] = MetaModel::GetAttributeDef($oAttDef->GetLinkedClass(), $sRemoteAttDef)->GetTargetClass(); $aAttribute['related_icon'] = MetaModel::GetClassIcon($aAttribute['related'], false); @@ -557,9 +501,7 @@ function DisplayRelatedClassesGraph($oPage, $sClass) $aAttribute['tooltip_data']['to_me'] = $oAttDef->GetExtKeyToMe(); $bOnTheLeft = !$bOnTheLeft; // Toggle the side - } - else - { + } else { $aAttribute['related'] = $oAttDef->GetLinkedClass(); $aAttribute['related_icon'] = MetaModel::GetClassIcon($aAttribute['related'], false); $aAttribute['related_position'] = $bOnTheLeft ? 1 : -1; @@ -567,22 +509,16 @@ function DisplayRelatedClassesGraph($oPage, $sClass) $bOnTheLeft = !$bOnTheLeft; // Toggle the side } - } - else - { - if ($oAttDef->IsHierarchicalKey()) - { + } else { + if ($oAttDef->IsHierarchicalKey()) { $aAttribute['related'] = $sClass; $aAttribute['related_icon'] = MetaModel::GetClassIcon($aAttribute['related'], false); $aAttribute['related_position'] = $bOnTheLeft ? 1 : -1; $aAttribute['relation_type'] = 2; $bOnTheLeft = !$bOnTheLeft; // Toggle the side $sSelfReference = "true"; - } - else - { - if ($oAttDef->IsExternalKey()) - { + } else { + if ($oAttDef->IsExternalKey()) { $aAttribute['related'] = $oAttDef->GetTargetClass(); $aAttribute['related_icon'] = MetaModel::GetClassIcon($aAttribute['related'], false); $aAttribute['related_position'] = $bOnTheLeft ? 1 : -1; @@ -592,8 +528,7 @@ function DisplayRelatedClassesGraph($oPage, $sClass) } } } - if ($oAttDef->IsLinkSet() || $oAttDef->IsHierarchicalKey() || $oAttDef->IsExternalKey()) - { + if ($oAttDef->IsLinkSet() || $oAttDef->IsHierarchicalKey() || $oAttDef->IsExternalKey()) { $sOrigin = MetaModel::GetAttributeOrigin($sClass, $sAttCode); $aAttribute['origin'] = $sOrigin; @@ -604,39 +539,31 @@ function DisplayRelatedClassesGraph($oPage, $sClass) } - //sort referencing data $aOrigins = array_keys($aOrigins); $idx = 0; $bOnTheLeft = true; - foreach ($aData as $sAttCode => $aAttribute) - { + foreach ($aData as $sAttCode => $aAttribute) { $is_also_referenced = false; - foreach ($aDataRef as $sAttCodeRef => $aAttributeRef) - { - if (!empty($aDataRef[$sAttCodeRef]['related']) && ($aData[$sAttCode]['related'] == $aDataRef[$sAttCodeRef]['related'])) - { + foreach ($aDataRef as $sAttCodeRef => $aAttributeRef) { + if (!empty($aDataRef[$sAttCodeRef]['related']) && ($aData[$sAttCode]['related'] == $aDataRef[$sAttCodeRef]['related'])) { $is_also_referenced = true; } } - if (!$is_also_referenced) - { + if (!$is_also_referenced) { $aData[$sAttCode]['related_position'] = ($bOnTheLeft) ? -1 : 1; $bOnTheLeft = !$bOnTheLeft; $aData[$sAttCode]['origin_index'] = ($aData[$sAttCode]['related_position'] == -1) ? ++$idx : $idx; - } - else - { + } else { unset($aData[$sAttCode]); } } ksort($aData); $idx = 0; - $aFinalDataReferencing = array(); - foreach ($aData as $sAttCode => $aAttribute) - { + $aFinalDataReferencing = []; + foreach ($aData as $sAttCode => $aAttribute) { $aData[$sAttCode]['alphabetical_index'] = $aAttribute['related_position'] == 1 ? ++$idx : $idx; $aFinalDataReferencing[] = $aData[$sAttCode]; } @@ -646,15 +573,13 @@ function DisplayRelatedClassesGraph($oPage, $sClass) //sort referenced data $idx = 1; - foreach ($aDataRef as $sAttCode => $aAttribute) - { + foreach ($aDataRef as $sAttCode => $aAttribute) { $aDataRef[$sAttCode]['origin_index'] = $idx++; } $idx = 1; - $aFinalData = array(); - foreach ($aDataRef as $sAttCode => $aAttribute) - { + $aFinalData = []; + foreach ($aDataRef as $sAttCode => $aAttribute) { $aDataRef[$sAttCode]['alphabetical_index'] = $idx++; $aFinalData[] = $aDataRef[$sAttCode]; } @@ -960,9 +885,7 @@ if(window.IntersectionObserver) { } JS ); - } - catch (Exception $e) - { + } catch (Exception $e) { $oPage->p(''.Dict::Format('UI:RunQuery:Error', $e->getMessage()).''); } } @@ -978,9 +901,8 @@ JS */ function DisplayClassDetails($oPage, $sClass, $sContext) { - $aParentClasses = array(); - foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass) - { + $aParentClasses = []; + foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass) { $aParentClasses[] = MakeClassHLink($sParentClass, $sContext); } if (count($aParentClasses) > 0) { @@ -1004,9 +926,9 @@ function DisplayClassDetails($oPage, $sClass, $sContext) $oPage->SetCurrentTabContainer('details'); // List the attributes of the object $aForwardChangeTracking = MetaModel::GetTrackForwardExternalKeys($sClass); - $aDetails = array(); + $aDetails = []; - $aOrigins = array(); + $aOrigins = []; foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { if ($oAttDef->IsExternalKey()) { $sValue = Dict::Format('UI:Schema:ExternalKey_To', MakeClassHLink($oAttDef->GetTargetClass(), $sContext)); @@ -1017,9 +939,7 @@ function DisplayClassDetails($oPage, $sClass, $sContext) } } elseif ($oAttDef->IsLinkSet()) { $sValue = MakeClassHLink($oAttDef->GetLinkedClass(), $sContext); - } - else - { + } else { $sValue = $oAttDef->GetDescription(); } $sType = get_class($oAttDef); @@ -1031,30 +951,25 @@ function DisplayClassDetails($oPage, $sClass, $sContext) $sAllowedValues = ""; $sMoreInfo = ""; $sDefaultNullValue = ''; - if (call_user_func(array(get_class($oAttDef), 'IsBasedOnDBColumns'))) - { + if (call_user_func([get_class($oAttDef), 'IsBasedOnDBColumns'])) { - $aMoreInfo = array(); - if ($oAttDef->IsNullAllowed()) - { + $aMoreInfo = []; + if ($oAttDef->IsNullAllowed()) { $aMoreInfo[] = Dict::S('UI:Schema:NullAllowed'); $sDefaultNullValue = (!is_null($oAttDef->GetNullValue()) ? $oAttDef->GetNullValue() : null); - if (!is_null($sDefaultNullValue) && !is_string($sDefaultNullValue)) - { + if (!is_null($sDefaultNullValue) && !is_string($sDefaultNullValue)) { $sDefaultNullValue = json_encode($sDefaultNullValue); } - $sDefaultNullValue = (!is_null($sDefaultNullValue) ? Dict::Format('UI:Schema:DefaultNullValue', - $sDefaultNullValue) : ''); - } - else - { + $sDefaultNullValue = (!is_null($sDefaultNullValue) ? Dict::Format( + 'UI:Schema:DefaultNullValue', + $sDefaultNullValue + ) : ''); + } else { $aMoreInfo[] = Dict::S('UI:Schema:NullNotAllowed'); } - if ($oAttDef->GetDefaultValue()) - { + if ($oAttDef->GetDefaultValue()) { $sDefaultValue = $oAttDef->GetDefaultValue(); - if (!is_string($sDefaultValue)) - { + if (!is_string($sDefaultValue)) { $sDefaultValue = json_encode($sDefaultValue); } $aMoreInfo[] = Dict::Format("UI:Schema:Default_Description", $sDefaultValue); @@ -1064,28 +979,22 @@ function DisplayClassDetails($oPage, $sClass, $sContext) $sAttrCode = $oAttDef->GetCode(); $sIsEnumValues = 'false'; $sAllowedValuesEscpd = '""'; - if ($oAttDef instanceof AttributeEnum) - { + if ($oAttDef instanceof AttributeEnum) { // Display localized values for the enum (which depend on the localization provided by the class) - $aLocalizedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, array()); - $aDescription = array(); - foreach ($aLocalizedValues as $val => $sDisplay) - { + $aLocalizedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, []); + $aDescription = []; + foreach ($aLocalizedValues as $val => $sDisplay) { $aDescription[] = $sDisplay." (".$val.")"; } $sAllowedValues = implode(', ', $aDescription); $sIsEnumValues = 'true'; - } - elseif (is_object($oAllowedValuesDef = $oAttDef->GetValuesDef())) - { + } elseif (is_object($oAllowedValuesDef = $oAttDef->GetValuesDef())) { $sAllowedValues = str_replace("Filter: ", "", $oAllowedValuesDef->GetValuesDescription()); $sAllowedValuesEscpd = utils::HtmlEntities($sAllowedValues); $sFilterURL = urlencode($sAllowedValues); $sAllowedValues = ' '.Dict::S('UI:Schema:Attribute/Filter').""; - } - else - { + } else { $sAllowedValues = ''; } $sAttrValueEscpd = utils::HtmlEntities($sValue); @@ -1093,29 +1002,29 @@ function DisplayClassDetails($oPage, $sClass, $sContext) $sAttrOriginEscpd = utils::HtmlEntities($sOrigin); $sDefaultNullValueEscpd = utils::HtmlEntities($sDefaultNullValue); - $aDetails[] = array( + $aDetails[] = [ 'code' => ''.$oAttDef->GetLabel().' ('.$oAttDef->GetCode().')', 'type' => ''.$sTypeDict.' ('.$sType.')', 'origincolor' => '
            ', 'origin' => "$sOrigin", 'values' => $sAllowedValues, 'moreinfo' => ''.$sMoreInfo.'', - ); + ]; } $oPage->SetCurrentTab('UI:Schema:Attributes'); - $aConfig = array( - 'origincolor' => array('label' => "", 'description' => ""), - 'code' => array('label' => Dict::S('UI:Schema:AttributeCode'), 'description' => Dict::S('UI:Schema:AttributeCode+')), - 'type' => array('label' => Dict::S('UI:Schema:Type'), 'description' => Dict::S('UI:Schema:Type+')), - 'values' => array('label' => Dict::S('UI:Schema:AllowedValues'), 'description' => Dict::S('UI:Schema:AllowedValues+')), - 'moreinfo' => array('label' => Dict::S('UI:Schema:MoreInfo'), 'description' => Dict::S('UI:Schema:MoreInfo+')), - 'origin' => array('label' => Dict::S('UI:Schema:Origin'), 'description' => Dict::S('UI:Schema:Origin+')), - ); + $aConfig = [ + 'origincolor' => ['label' => "", 'description' => ""], + 'code' => ['label' => Dict::S('UI:Schema:AttributeCode'), 'description' => Dict::S('UI:Schema:AttributeCode+')], + 'type' => ['label' => Dict::S('UI:Schema:Type'), 'description' => Dict::S('UI:Schema:Type+')], + 'values' => ['label' => Dict::S('UI:Schema:AllowedValues'), 'description' => Dict::S('UI:Schema:AllowedValues+')], + 'moreinfo' => ['label' => Dict::S('UI:Schema:MoreInfo'), 'description' => Dict::S('UI:Schema:MoreInfo+')], + 'origin' => ['label' => Dict::S('UI:Schema:Origin'), 'description' => Dict::S('UI:Schema:Origin+')], + ]; $oTablePanel = PanelUIBlockFactory::MakeForClass($sClass, ''); $oTablePanel->AddCSSClass('ibo-datatable-panel'); - $oAttributesTable = DataTableUIBlockFactory::MakeForStaticData('', $aConfig, $aDetails, 'ibo-datamodel-viewer--attributes-table', [], "", array('pageLength' => -1)); + $oAttributesTable = DataTableUIBlockFactory::MakeForStaticData('', $aConfig, $aDetails, 'ibo-datamodel-viewer--attributes-table', [], "", ['pageLength' => -1]); $oTablePanel->AddSubBlock($oAttributesTable); $oPage->AddUiBlock($oTablePanel); $sOrigins = json_encode(array_keys($aOrigins)); @@ -1140,9 +1049,8 @@ EOF $oPage->SetCurrentTab('UI:Schema:RelatedClasses'); DisplayRelatedClassesGraph($oPage, $sClass); - - if (MetaModel::HasChildrenClasses($sClass)) - { + + if (MetaModel::HasChildrenClasses($sClass)) { $oPage->SetCurrentTab('UI:Schema:ChildClasses'); $oPage->add("
              "); $oPage->add("
            • ".$sClass."\n"); @@ -1151,7 +1059,7 @@ EOF $oPage->add("
            \n"); $oPage->add_ready_script('$("#ClassHierarchy").treeview({collapsed: false,});'); } - + $oPage->SetCurrentTab('UI:Schema:LifeCycle'); DisplayLifecycle($oPage, $sClass); @@ -1165,14 +1073,12 @@ EOF $oPage->SetCurrentTabContainer(); } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // MAIN BLOCK // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Display the menu on the left - $oAppContext = new ApplicationContext(); $sContext = $oAppContext->GetForLink(true); $operation = utils::ReadParam('operation', ''); @@ -1184,8 +1090,14 @@ $oPage->SetContentLayout($oLayout); $oPage->no_cache(); -$oPage->SetBreadCrumbEntry('ui-tool-datamodel', Dict::S('Menu:DataModelMenu'), Dict::S('Menu:DataModelMenu+'), '', - 'fas fa-book', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); +$oPage->SetBreadCrumbEntry( + 'ui-tool-datamodel', + Dict::S('Menu:DataModelMenu'), + Dict::S('Menu:DataModelMenu+'), + '', + 'fas fa-book', + iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES +); $oTitle = TitleUIBlockFactory::MakeForPage(Dict::S('UI:Schema:Title')); $oPage->AddUiBlock($oTitle); @@ -1195,17 +1107,16 @@ $oLayout->AddSideHtml("
      "); $oPage->add("
      "); $oPage->add("
      "); -switch ($operation) -{ +switch ($operation) { case 'details_class': $sClass = utils::ReadParam('class', '', false, 'class'); //if we want to see class details & class is given then display it, otherwise act default (just show the class list) - if ($sClass != '') - { + if ($sClass != '') { $oPage->set_title(Dict::Format('UI:Schema:TitleForClass', $sClass)); DisplayClassDetails($oPage, $sClass, $sContext); break; } + // no break default: } $oPage->add("
      "); diff --git a/pages/tagadmin.php b/pages/tagadmin.php index 213ff6ecf..9296da43b 100644 --- a/pages/tagadmin.php +++ b/pages/tagadmin.php @@ -1,4 +1,5 @@ SetBreadCrumbEntry('ui-tool-tag-admin', Dict::S('Menu:TagAdminMenu'), Dict::S('Menu:TagAdminMenu+'), '', 'fas fa-tags', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); $sSearchHeaderForceDropdown = '\n"; - try - { - if ($sOperation == 'search_form') - { + try { + if ($sOperation == 'search_form') { $sOQL = "SELECT $sClass $sOQLClause"; $oFilter = DBObjectSearch::FromOQL($sOQL); - } - else - { + } else { // Second part: advanced search form: - if (!empty($sFilter)) - { + if (!empty($sFilter)) { $oFilter = DBSearch::unserialize($sFilter); - } - else if (!empty($sClass)) - { + } elseif (!empty($sClass)) { $oFilter = new DBObjectSearch($sClass); } } - } - catch (CoreException $e) - { + } catch (CoreException $e) { $oFilter = new DBObjectSearch($sClass); $oP->P("".Dict::Format('UI:TagSetFieldData:Error', $e->getHtmlDesc()).""); } - if (!empty($oFilter)) - { + if (!empty($oFilter)) { $oSearchContext = new ContextTag(ContextTag::TAG_OBJECT_SEARCH); $oSet = new CMDBObjectSet($oFilter); @@ -121,9 +108,7 @@ try // Menu node $sFilter = $oFilter->ToOQL(); $oP->add("\n\n"); - } - else - { + } else { $oP->add("

      "); $oP->add(Dict::S('UI:TagAdminMenu:NoTags')); $oP->add("

      "); @@ -131,9 +116,7 @@ try $oP->add("
      \n"); $oP->output(); -} -catch (Exception $e) -{ +} catch (Exception $e) { require_once(APPROOT.'setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); diff --git a/portal/index.php b/portal/index.php index 7dbefbd1b..1f5ff0391 100644 --- a/portal/index.php +++ b/portal/index.php @@ -23,38 +23,30 @@ use Combodo\iTop\Application\WebPage\ErrorPage; require_once('../approot.inc.php'); require_once(APPROOT.'/application/application.inc.php'); -try -{ +try { require_once(APPROOT.'/application/startup.inc.php'); require_once(APPROOT.'/application/loginwebpage.class.inc.php'); LoginWebPage::DoLogin(false /* bMustBeAdmin */, true /* IsAllowedToPortalUsers */); // Check user rights and prompt if needed -} -catch(Exception $e) -{ +} catch (Exception $e) { require_once(APPROOT.'/setup/setuppage.class.inc.php'); $oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError')); - $oP->add("

      ".Dict::S('UI:FatalErrorMessage')."

      \n"); + $oP->add("

      ".Dict::S('UI:FatalErrorMessage')."

      \n"); $oP->error(Dict::Format('UI:Error_Details', $e->getMessage())); $oP->output(); - if (MetaModel::IsLogEnabledIssue()) - { - if (MetaModel::IsValidClass('EventIssue')) - { - try - { + if (MetaModel::IsLogEnabledIssue()) { + if (MetaModel::IsValidClass('EventIssue')) { + try { $oLog = new EventIssue(); - + $oLog->Set('message', $e->getMessage()); $oLog->Set('userinfo', ''); $oLog->Set('issue', 'PHP Exception'); $oLog->Set('impact', 'Page could not be displayed'); $oLog->Set('callstack', $e->getTrace()); - $oLog->Set('data', array()); + $oLog->Set('data', []); $oLog->DBInsertNoReload(); - } - catch(Exception $e) - { + } catch (Exception $e) { IssueLog::Error("Failed to log issue into the DB"); } } diff --git a/resources/symfony/config/bundles.php b/resources/symfony/config/bundles.php index e60880154..beef9841b 100644 --- a/resources/symfony/config/bundles.php +++ b/resources/symfony/config/bundles.php @@ -1,8 +1,8 @@ ['all' => true], - Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], - Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], - Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true], + Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], + Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], + Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true], ]; diff --git a/resources/symfony/config/packages/itop_configuration_bridge.php b/resources/symfony/config/packages/itop_configuration_bridge.php index ce3534a50..34d4ddfd5 100644 --- a/resources/symfony/config/packages/itop_configuration_bridge.php +++ b/resources/symfony/config/packages/itop_configuration_bridge.php @@ -1,4 +1,5 @@ '.$sLogMessage.''; } - function FatalErrorCatcher($sOutput) { - if (preg_match('|<'.PHP_FATAL_ERROR_TAG.'>.*|s', $sOutput, $aMatches)) - { + if (preg_match('|<'.PHP_FATAL_ERROR_TAG.'>.*|s', $sOutput, $aMatches)) { header("HTTP/1.0 500 Internal server error."); $errors = ''; - foreach ($aMatches as $sMatch) - { + foreach ($aMatches as $sMatch) { $errors .= strip_tags($sMatch)."\n"; } $sOutput = "$errors\n"; - // Logging to a file does not work if the whole memory is exhausted... + // Logging to a file does not work if the whole memory is exhausted... // SetupLog::Error("Fatal error - in $__FILE__ , $errors"); } return $sOutput; @@ -132,7 +120,6 @@ require_once(APPROOT.'/core/kpi.class.inc.php'); require_once(APPROOT.'/core/cmdbsource.class.inc.php'); require_once('./xmldataloader.class.inc.php'); - // Never cache this page header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Fri, 17 Jul 1970 05:00:00 GMT"); // Date in the past @@ -141,41 +128,38 @@ header("Expires: Fri, 17 Jul 1970 05:00:00 GMT"); // Date in the past * Main program */ $sOperation = Utils::ReadParam('operation', ''); -try -{ +try { SetupUtils::CheckSetupToken(); - switch($sOperation) - { + switch ($sOperation) { case 'async_action': - ini_set('max_execution_time', max(240, ini_get('max_execution_time'))); - // While running the setup it is desirable to see any error that may happen - ini_set('display_errors', true); - ini_set('display_startup_errors', true); - - require_once(APPROOT.'/setup/wizardcontroller.class.inc.php'); - require_once(APPROOT.'/setup/wizardsteps.class.inc.php'); - - $sClass = utils::ReadParam('step_class', ''); - $sState = utils::ReadParam('step_state', ''); - $sActionCode = utils::ReadParam('code', ''); - $aParams = utils::ReadParam('params', array(), false, 'raw_data'); - $oPage = new AjaxPage(''); - $oDummyController = new WizardController(''); - if (is_subclass_of($sClass, 'WizardStep')) - { - /** @var WizardStep $oStep */ - $oStep = new $sClass($oDummyController, $sState); - $sConfigFile = utils::GetConfigFilePath(); - if (file_exists($sConfigFile) && !is_writable($sConfigFile) && $oStep->RequiresWritableConfig()) { - $sRelativePath = utils::GetConfigFilePathRelative(); - $oPage->error("Error: the configuration file '".$sRelativePath."' already exists and cannot be overwritten."); - $oPage->p("The wizard cannot modify the configuration file for you. If you want to upgrade ".ITOP_APPLICATION.", make sure that the file '".$sRelativePath."' can be modified by the web server."); - $oPage->output(); - } else { - $oStep->AsyncAction($oPage, $sActionCode, $aParams); + ini_set('max_execution_time', max(240, ini_get('max_execution_time'))); + // While running the setup it is desirable to see any error that may happen + ini_set('display_errors', true); + ini_set('display_startup_errors', true); + + require_once(APPROOT.'/setup/wizardcontroller.class.inc.php'); + require_once(APPROOT.'/setup/wizardsteps.class.inc.php'); + + $sClass = utils::ReadParam('step_class', ''); + $sState = utils::ReadParam('step_state', ''); + $sActionCode = utils::ReadParam('code', ''); + $aParams = utils::ReadParam('params', [], false, 'raw_data'); + $oPage = new AjaxPage(''); + $oDummyController = new WizardController(''); + if (is_subclass_of($sClass, 'WizardStep')) { + /** @var WizardStep $oStep */ + $oStep = new $sClass($oDummyController, $sState); + $sConfigFile = utils::GetConfigFilePath(); + if (file_exists($sConfigFile) && !is_writable($sConfigFile) && $oStep->RequiresWritableConfig()) { + $sRelativePath = utils::GetConfigFilePathRelative(); + $oPage->error("Error: the configuration file '".$sRelativePath."' already exists and cannot be overwritten."); + $oPage->p("The wizard cannot modify the configuration file for you. If you want to upgrade ".ITOP_APPLICATION.", make sure that the file '".$sRelativePath."' can be modified by the web server."); + $oPage->output(); + } else { + $oStep->AsyncAction($oPage, $sActionCode, $aParams); + } } - } $oPage->output(); break; @@ -189,23 +173,17 @@ try default: throw(new Exception("Error unsupported operation '$sOperation'")); } -} -catch(Exception $e) -{ +} catch (Exception $e) { header("HTTP/1.0 500 Internal server error."); echo "

      An error happened while processing the installation:

      \n"; echo '

      '.$e."

      \n"; SetupLog::Error("An error happened while processing the installation: ".$e); } -if (function_exists('memory_get_peak_usage')) -{ - if ($sOperation == 'file') - { +if (function_exists('memory_get_peak_usage')) { + if ($sOperation == 'file') { SetupLog::Info("loading file '$sFileName', peak memory usage. ".memory_get_peak_usage()); - } - else - { + } else { SetupLog::Info("operation '$sOperation', peak memory usage. ".memory_get_peak_usage()); } -} \ No newline at end of file +} diff --git a/setup/applicationinstaller.class.inc.php b/setup/applicationinstaller.class.inc.php index 754846884..945fdd179 100644 --- a/setup/applicationinstaller.class.inc.php +++ b/setup/applicationinstaller.class.inc.php @@ -1,4 +1,5 @@ oParams->Get('target_env', ''); - if ($sTargetEnvironment !== '') - { + if ($sTargetEnvironment !== '') { return $sTargetEnvironment; } @@ -100,17 +100,12 @@ class ApplicationInstaller $sStep = ''; $sStepLabel = ''; $iOverallStatus = self::OK; - do - { - if ($bVerbose) - { - if ($sStep != '') - { + do { + if ($bVerbose) { + if ($sStep != '') { echo "$sStepLabel\n"; echo "Executing '$sStep'\n"; - } - else - { + } else { echo "Starting the installation...\n"; } } @@ -118,11 +113,9 @@ class ApplicationInstaller $sStep = $aRes['next-step']; $sStepLabel = $aRes['next-step-label']; $sMessage = $aRes['message']; - if ($bVerbose) - { - switch ($aRes['status']) - { - case self::OK; + if ($bVerbose) { + switch ($aRes['status']) { + case self::OK: echo "Ok. ".$aRes['percentage-completed']." % done.\n"; break; @@ -142,11 +135,8 @@ class ApplicationInstaller echo $aRes['percentage-completed']." % done.\n"; break; } - } - else - { - switch ($aRes['status']) - { + } else { + switch ($aRes['status']) { case self::ERROR: $iOverallStatus = self::ERROR; break; @@ -155,8 +145,7 @@ class ApplicationInstaller break; } } - } - while(($aRes['status'] != self::ERROR) && ($aRes['next-step'] != '')); + } while (($aRes['status'] != self::ERROR) && ($aRes['next-step'] != '')); return ($iOverallStatus == self::OK); } @@ -167,8 +156,7 @@ class ApplicationInstaller $sConfigFile = APPCONF.$sTargetEnvironment.'/'.ITOP_CONFIG_FILE; try { $oConfig = new Config($sConfigFile); - } - catch (Exception $e) { + } catch (Exception $e) { return null; } @@ -189,21 +177,19 @@ class ApplicationInstaller */ public function ExecuteStep($sStep = '', $sInstallComment = null) { - try - { + try { $fStart = microtime(true); SetupLog::Info("##### STEP {$sStep} start"); $this->EnterReadOnlyMode(); - switch ($sStep) - { + switch ($sStep) { case '': - $aResult = array( + $aResult = [ 'status' => self::OK, 'message' => '', 'percentage-completed' => 0, 'next-step' => 'copy', 'next-step-label' => 'Copying data model files', - ); + ]; // Log the parameters... $oDoc = new DOMDocument('1.0', 'UTF-8'); @@ -217,8 +203,7 @@ class ApplicationInstaller // Save the response file as a stand-alone file as well $sFileName = 'install-'.date('Y-m-d'); $index = 0; - while (file_exists(APPROOT.'log/'.$sFileName.'.xml')) - { + while (file_exists(APPROOT.'log/'.$sFileName.'.xml')) { $index++; $sFileName = 'install-'.date('Y-m-d').'-'.$index; } @@ -233,18 +218,15 @@ class ApplicationInstaller self::DoCopy($aCopies); $sReport = "Copying..."; - $aResult = array( + $aResult = [ 'status' => self::OK, 'message' => $sReport, - ); - if (isset($aPreinstall['backup'])) - { + ]; + if (isset($aPreinstall['backup'])) { $aResult['next-step'] = 'backup'; $aResult['next-step-label'] = 'Performing a backup of the database'; $aResult['percentage-completed'] = 20; - } - else - { + } else { $aResult['next-step'] = 'compile'; $aResult['next-step-label'] = 'Compiling the data model'; $aResult['percentage-completed'] = 20; @@ -262,13 +244,13 @@ class ApplicationInstaller $sMySQLBinDir = $this->oParams->Get('mysql_bindir', null); self::DoBackup($oTempConfig, $sDestination, $sSourceConfigFile, $sMySQLBinDir); - $aResult = array( + $aResult = [ 'status' => self::OK, 'message' => "Created backup", 'next-step' => 'compile', 'next-step-label' => 'Compiling the data model', 'percentage-completed' => 20, - ); + ]; break; case 'compile': @@ -277,7 +259,7 @@ class ApplicationInstaller $sExtensionDir = $this->oParams->Get('extensions_dir', 'extensions'); $sTargetEnvironment = $this->GetTargetEnv(); $sTargetDir = $this->GetTargetDir(); - $aMiscOptions = $this->oParams->Get('options', array()); + $aMiscOptions = $this->oParams->Get('options', []); $bUseSymbolicLinks = null; if ((isset($aMiscOptions['symlinks']) && $aMiscOptions['symlinks'])) { @@ -290,36 +272,49 @@ class ApplicationInstaller } $aParamValues = $this->oParams->GetParamForConfigArray(); - self::DoCompile($aSelectedModules, $sSourceDir, $sExtensionDir, $sTargetDir, $sTargetEnvironment, - $bUseSymbolicLinks, $aParamValues); + self::DoCompile( + $aSelectedModules, + $sSourceDir, + $sExtensionDir, + $sTargetDir, + $sTargetEnvironment, + $bUseSymbolicLinks, + $aParamValues + ); - $aResult = array( + $aResult = [ 'status' => self::OK, 'message' => '', 'next-step' => 'db-schema', 'next-step-label' => 'Updating database schema', 'percentage-completed' => 40, - ); + ]; break; case 'db-schema': - $aSelectedModules = $this->oParams->Get('selected_modules', array()); + $aSelectedModules = $this->oParams->Get('selected_modules', []); $sTargetEnvironment = $this->GetTargetEnv(); $sTargetDir = $this->GetTargetDir(); $aParamValues = $this->oParams->GetParamForConfigArray(); $bOldAddon = $this->oParams->Get('old_addon', false); $sUrl = $this->oParams->Get('url', ''); - self::DoUpdateDBSchema($aSelectedModules, $sTargetDir, $aParamValues, $sTargetEnvironment, - $bOldAddon, $sUrl); + self::DoUpdateDBSchema( + $aSelectedModules, + $sTargetDir, + $aParamValues, + $sTargetEnvironment, + $bOldAddon, + $sUrl + ); - $aResult = array( + $aResult = [ 'status' => self::OK, 'message' => '', 'next-step' => 'after-db-create', 'next-step-label' => 'Creating profiles', 'percentage-completed' => 60, - ); + ]; break; case 'after-db-create': @@ -330,19 +325,27 @@ class ApplicationInstaller $sAdminUser = $aAdminParams['user']; $sAdminPwd = $aAdminParams['pwd']; $sAdminLanguage = $aAdminParams['language']; - $aSelectedModules = $this->oParams->Get('selected_modules', array()); + $aSelectedModules = $this->oParams->Get('selected_modules', []); $bOldAddon = $this->oParams->Get('old_addon', false); - self::AfterDBCreate($sTargetDir, $aParamValues, $sAdminUser, $sAdminPwd, $sAdminLanguage, - $aSelectedModules, $sTargetEnvironment, $bOldAddon); + self::AfterDBCreate( + $sTargetDir, + $aParamValues, + $sAdminUser, + $sAdminPwd, + $sAdminLanguage, + $aSelectedModules, + $sTargetEnvironment, + $bOldAddon + ); - $aResult = array( + $aResult = [ 'status' => self::OK, 'message' => '', 'next-step' => 'load-data', 'next-step-label' => 'Loading data', 'percentage-completed' => 80, - ); + ]; break; case 'load-data': @@ -353,16 +356,22 @@ class ApplicationInstaller $bOldAddon = $this->oParams->Get('old_addon', false); $bSampleData = ($this->oParams->Get('sample_data', 0) == 1); - self::DoLoadFiles($aSelectedModules, $sTargetDir, $aParamValues, $sTargetEnvironment, $bOldAddon, - $bSampleData); + self::DoLoadFiles( + $aSelectedModules, + $sTargetDir, + $aParamValues, + $sTargetEnvironment, + $bOldAddon, + $bSampleData + ); - $aResult = array( + $aResult = [ 'status' => self::INFO, 'message' => 'All data loaded', 'next-step' => 'create-config', 'next-step-label' => 'Creating the configuration File', 'percentage-completed' => 99, - ); + ]; break; case 'create-config': @@ -371,51 +380,56 @@ class ApplicationInstaller $sPreviousConfigFile = $this->oParams->Get('previous_configuration_file', ''); $sDataModelVersion = $this->oParams->Get('datamodel_version', '0.0.0'); $bOldAddon = $this->oParams->Get('old_addon', false); - $aSelectedModuleCodes = $this->oParams->Get('selected_modules', array()); - $aSelectedExtensionCodes = $this->oParams->Get('selected_extensions', array()); + $aSelectedModuleCodes = $this->oParams->Get('selected_modules', []); + $aSelectedExtensionCodes = $this->oParams->Get('selected_extensions', []); $aParamValues = $this->oParams->GetParamForConfigArray(); - self::DoCreateConfig($sTargetDir, $sPreviousConfigFile, $sTargetEnvironment, $sDataModelVersion, - $bOldAddon, $aSelectedModuleCodes, $aSelectedExtensionCodes, $aParamValues, $sInstallComment); + self::DoCreateConfig( + $sTargetDir, + $sPreviousConfigFile, + $sTargetEnvironment, + $sDataModelVersion, + $bOldAddon, + $aSelectedModuleCodes, + $aSelectedExtensionCodes, + $aParamValues, + $sInstallComment + ); - $aResult = array( + $aResult = [ 'status' => self::INFO, 'message' => 'Configuration file created', 'next-step' => '', 'next-step-label' => 'Completed', 'percentage-completed' => 100, - ); + ]; $this->ExitReadOnlyMode(); break; - default: - $aResult = array( + $aResult = [ 'status' => self::ERROR, 'message' => '', 'next-step' => '', 'next-step-label' => "Unknown setup step '$sStep'.", 'percentage-completed' => 100, - ); + ]; break; } - } - catch (Exception $e) - { - $aResult = array( + } catch (Exception $e) { + $aResult = [ 'status' => self::ERROR, 'message' => $e->getMessage(), 'next-step' => '', 'next-step-label' => '', 'percentage-completed' => 100, - ); + ]; SetupLog::Error('An exception occurred: '.$e->getMessage().' at line '.$e->getLine().' in file '.$e->getFile()); $idx = 0; // Log the call stack, but not the parameters since they may contain passwords or other sensitive data SetupLog::Ok("Call stack:"); - foreach ($e->getTrace() as $aTrace) - { + foreach ($e->getTrace() as $aTrace) { $sLine = empty($aTrace['line']) ? "" : $aTrace['line']; $sFile = empty($aTrace['file']) ? "" : $aTrace['file']; $sClass = empty($aTrace['class']) ? "" : $aTrace['class']; @@ -425,9 +439,7 @@ class ApplicationInstaller SetupLog::Ok("#$idx $sFile($sLine): $sVerb(...)"); $idx++; } - } - finally - { + } finally { $fDuration = round(microtime(true) - $fStart, 2); SetupLog::Info("##### STEP {$sStep} duration: {$fDuration}s"); } @@ -437,13 +449,11 @@ class ApplicationInstaller private function EnterReadOnlyMode() { - if ($this->GetTargetEnv() != 'production') - { + if ($this->GetTargetEnv() != 'production') { return; } - if (SetupUtils::IsInReadOnlyMode()) - { + if (SetupUtils::IsInReadOnlyMode()) { return; } @@ -452,25 +462,21 @@ class ApplicationInstaller private function ExitReadOnlyMode() { - if ($this->GetTargetEnv() != 'production') - { + if ($this->GetTargetEnv() != 'production') { return; } - if (!SetupUtils::IsInReadOnlyMode()) - { + if (!SetupUtils::IsInReadOnlyMode()) { return; } SetupUtils::ExitReadOnlyMode(); } - protected static function DoCopy($aCopies) { - $aReports = array(); - foreach ($aCopies as $aCopy) - { + $aReports = []; + foreach ($aCopies as $aCopy) { $sSource = $aCopy['source']; $sDestination = APPROOT.$aCopy['destination']; @@ -479,12 +485,9 @@ class ApplicationInstaller SetupUtils::copydir($sSource, $sDestination); $aReports[] = "'{$aCopy['source']}' to '{$aCopy['destination']}' (OK)"; } - if (count($aReports) > 0) - { + if (count($aReports) > 0) { $sReport = "Copies: ".count($aReports).': '.implode('; ', $aReports); - } - else - { + } else { $sReport = "No file copy"; } return $sReport; @@ -513,7 +516,6 @@ class ApplicationInstaller $oBackup->CreateCompressedBackup($sTargetFile, $sSourceConfigFile); } - /** * @param array $aSelectedModules * @param string $sSourceDir @@ -542,28 +544,24 @@ class ApplicationInstaller } $sSourcePath = APPROOT.$sSourceDir; - $aDirsToScan = array($sSourcePath); + $aDirsToScan = [$sSourcePath]; $sExtensionsPath = APPROOT.$sExtensionDir; - if (is_dir($sExtensionsPath)) - { + if (is_dir($sExtensionsPath)) { // if the extensions dir exists, scan it for additional modules as well $aDirsToScan[] = $sExtensionsPath; } $sExtraPath = APPROOT.'/data/'.$sEnvironment.'-modules/'; - if (is_dir($sExtraPath)) - { + if (is_dir($sExtraPath)) { // if the extra dir exists, scan it for additional modules as well $aDirsToScan[] = $sExtraPath; } $sTargetPath = APPROOT.$sTargetDir; - if (!is_dir($sSourcePath)) - { + if (!is_dir($sSourcePath)) { throw new Exception("Failed to find the source directory '$sSourcePath', please check the rights of the web server"); } $bIsAlreadyInMaintenanceMode = SetupUtils::IsInMaintenanceMode(); - if (($sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode) - { + if (($sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode) { $sConfigFilePath = utils::GetConfigFilePath($sEnvironment); if (is_file($sConfigFilePath)) { $oConfig = new Config($sConfigFilePath); @@ -578,21 +576,15 @@ class ApplicationInstaller SetupUtils::EnterMaintenanceMode($oConfig); } - if (!is_dir($sTargetPath)) - { - if (!mkdir($sTargetPath)) - { + if (!is_dir($sTargetPath)) { + if (!mkdir($sTargetPath)) { throw new Exception("Failed to create directory '$sTargetPath', please check the rights of the web server"); - } - else - { + } else { // adjust the rights if and only if the directory was just created // owner:rwx user/group:rx chmod($sTargetPath, 0755); } - } - else if (substr($sTargetPath, 0, strlen(APPROOT)) == APPROOT) - { + } elseif (substr($sTargetPath, 0, strlen(APPROOT)) == APPROOT) { // If the directory is under the root folder - as expected - let's clean-it before compiling SetupUtils::tidydir($sTargetPath); } @@ -603,25 +595,21 @@ class ApplicationInstaller $oFactory->LoadModule($oDictModule); $sDeltaFile = APPROOT.'core/datamodel.core.xml'; - if (file_exists($sDeltaFile)) - { + if (file_exists($sDeltaFile)) { $oCoreModule = new MFCoreModule('core', 'Core Module', $sDeltaFile); $oFactory->LoadModule($oCoreModule); } $sDeltaFile = APPROOT.'application/datamodel.application.xml'; - if (file_exists($sDeltaFile)) - { + if (file_exists($sDeltaFile)) { $oApplicationModule = new MFCoreModule('application', 'Application Module', $sDeltaFile); $oFactory->LoadModule($oApplicationModule); } $aModules = $oFactory->FindModules(); - foreach($aModules as $oModule) - { + foreach ($aModules as $oModule) { $sModule = $oModule->GetName(); - if (in_array($sModule, $aSelectedModules)) - { + if (in_array($sModule, $aSelectedModules)) { $oFactory->LoadModule($oModule); } } @@ -629,8 +617,7 @@ class ApplicationInstaller $oFactory->SaveToFile(APPROOT.'data/datamodel-'.$sEnvironment.'.xml'); $sDeltaFile = APPROOT.'data/'.$sEnvironment.'.delta.xml'; - if (file_exists($sDeltaFile)) - { + if (file_exists($sDeltaFile)) { $oDelta = new MFDeltaModule($sDeltaFile); $oFactory->LoadModule($oDelta); $oFactory->SaveToFile(APPROOT.'data/datamodel-'.$sEnvironment.'-with-delta.xml'); @@ -648,8 +635,7 @@ class ApplicationInstaller // Special case to patch a ugly patch in itop-config-mgmt $sFileToPatch = $sTargetPath.'/itop-config-mgmt-1.0.0/model.itop-config-mgmt.php'; - if (file_exists($sFileToPatch)) - { + if (file_exists($sFileToPatch)) { $sContent = file_get_contents($sFileToPatch); $sContent = str_replace("require_once(APPROOT.'modules/itop-welcome-itil/model.itop-welcome-itil.php');", "//\n// The line below is no longer needed in iTop 2.0 -- patched by the setup program\n// require_once(APPROOT.'modules/itop-welcome-itil/model.itop-welcome-itil.php');", $sContent); @@ -660,13 +646,11 @@ class ApplicationInstaller // Set an "Instance UUID" identifying this machine based on a file located in the data directory $sInstanceUUIDFile = APPROOT.'data/instance.txt'; SetupUtils::builddir(APPROOT.'data'); - if (!file_exists($sInstanceUUIDFile)) - { + if (!file_exists($sInstanceUUIDFile)) { $sIntanceUUID = utils::CreateUUID('filesystem'); file_put_contents($sInstanceUUIDFile, $sIntanceUUID); } - if (($sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode) - { + if (($sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode) { SetupUtils::ExitMaintenanceMode(); } } @@ -698,12 +682,11 @@ class ApplicationInstaller $oConfig = new Config(); $oConfig->UpdateFromParams($aParamValues, $sModulesDir); - if ($bOldAddon) - { + if ($bOldAddon) { // Old version of the add-on for backward compatibility with pre-2.0 data models - $oConfig->SetAddons(array( + $oConfig->SetAddons([ 'user rights' => 'addons/userrights/userrightsprofile.db.class.inc.php', - )); + ]); } $oProductionEnv = new RunTimeEnvironment($sTargetEnvironment); @@ -717,39 +700,32 @@ class ApplicationInstaller // priv_internalUser caused troubles because MySQL transforms table names to lower case under Windows // This becomes an issue when moving your installation data to/from Windows // Starting 2.0, all table names must be lowercase - if ($sMode != 'install') - { + if ($sMode != 'install') { SetupLog::Info("Renaming '{$sDBPrefix}priv_internalUser' into '{$sDBPrefix}priv_internaluser' (lowercase)"); // This command will have no effect under Windows... // and it has been written in two steps so as to make it work under windows! CMDBSource::SelectDB($sDBName); - try - { + try { $sRepair = "RENAME TABLE `{$sDBPrefix}priv_internalUser` TO `{$sDBPrefix}priv_internaluser_other`, `{$sDBPrefix}priv_internaluser_other` TO `{$sDBPrefix}priv_internaluser`"; CMDBSource::Query($sRepair); - } - catch (Exception $e) - { + } catch (Exception $e) { SetupLog::Info("Renaming '{$sDBPrefix}priv_internalUser' failed (already done in a previous upgrade?)"); } // let's remove the records in priv_change which have no counterpart in priv_changeop SetupLog::Info("Cleanup of '{$sDBPrefix}priv_change' to remove orphan records"); CMDBSource::SelectDB($sDBName); - try - { + try { $sTotalCount = "SELECT COUNT(*) FROM `{$sDBPrefix}priv_change`"; $iTotalCount = (int)CMDBSource::QueryToScalar($sTotalCount); SetupLog::Info("There is a total of $iTotalCount records in {$sDBPrefix}priv_change."); $sOrphanCount = "SELECT COUNT(c.id) FROM `{$sDBPrefix}priv_change` AS c left join `{$sDBPrefix}priv_changeop` AS o ON c.id = o.changeid WHERE o.id IS NULL"; $iOrphanCount = (int)CMDBSource::QueryToScalar($sOrphanCount); - SetupLog::Info("There are $iOrphanCount useless records in {$sDBPrefix}priv_change (".sprintf('%.2f', ((100.0*$iOrphanCount)/$iTotalCount))."%)"); - if ($iOrphanCount > 0) - { + SetupLog::Info("There are $iOrphanCount useless records in {$sDBPrefix}priv_change (".sprintf('%.2f', ((100.0 * $iOrphanCount) / $iTotalCount))."%)"); + if ($iOrphanCount > 0) { //N°3793 - if ($iOrphanCount > 100000) - { + if ($iOrphanCount > 100000) { SetupLog::Info("There are too much useless records ($iOrphanCount) in {$sDBPrefix}priv_change. Cleanup cannot be done during setup."); } else { SetupLog::Info("Removing the orphan records..."); @@ -757,14 +733,10 @@ class ApplicationInstaller CMDBSource::Query($sCleanup); SetupLog::Info("Cleanup completed successfully."); } - } - else - { + } else { SetupLog::Info("Ok, nothing to cleanup."); } - } - catch (Exception $e) - { + } catch (Exception $e) { SetupLog::Info("Cleanup of orphan records in `{$sDBPrefix}priv_change` failed: ".$e->getMessage()); } @@ -775,15 +747,13 @@ class ApplicationInstaller $aAvailableModules = $oProductionEnv->AnalyzeInstallation(MetaModel::GetConfig(), APPROOT.$sModulesDir); $oProductionEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'BeforeDatabaseCreation'); - if(!$oProductionEnv->CreateDatabaseStructure(MetaModel::GetConfig(), $sMode)) - { + if (!$oProductionEnv->CreateDatabaseStructure(MetaModel::GetConfig(), $sMode)) { throw new Exception("Failed to create/upgrade the database structure for environment '$sTargetEnvironment'"); } // Set a DBProperty with a unique ID to identify this instance of iTop $sUUID = DBProperty::GetProperty('database_uuid', ''); - if ($sUUID === '') - { + if ($sUUID === '') { $sUUID = utils::CreateUUID('database'); DBProperty::SetProperty('database_uuid', $sUUID, 'Installation/upgrade of '.ITOP_APPLICATION, 'Unique ID of this '.ITOP_APPLICATION.' Database'); } @@ -792,12 +762,10 @@ class ApplicationInstaller // Let's initialize the field with 'interactive' for all records were it's null // Then check if some records should hold a different value, based on a pattern matching in the userinfo field CMDBSource::SelectDB($sDBName); - try - { + try { $sCount = "SELECT COUNT(*) FROM `{$sDBPrefix}priv_change` WHERE `origin` IS NULL"; $iCount = (int)CMDBSource::QueryToScalar($sCount); - if ($iCount > 0) - { + if ($iCount > 0) { SetupLog::Info("Initializing '{$sDBPrefix}priv_change.origin' ($iCount records to update)"); // By default all uninitialized values are considered as 'interactive' @@ -812,13 +780,11 @@ class ApplicationInstaller $sInit = "UPDATE `{$sDBPrefix}priv_change` SET `origin` = 'csv-interactive' WHERE `userinfo` LIKE '%(CSV)' AND origin = 'interactive'"; CMDBSource::Query($sInit); - // Syncho data sources were identified by the comment at the end // Unfortunately the comment is localized, so we have to search for all possible patterns $sCurrentLanguage = Dict::GetUserLanguage(); - $aSuffixes = array(); - foreach(array_keys(Dict::GetLanguages()) as $sLangCode) - { + $aSuffixes = []; + foreach (array_keys(Dict::GetLanguages()) as $sLangCode) { Dict::SetUserLanguage($sLangCode); $sSuffix = CMDBSource::Quote('%'.Dict::S('Core:SyncDataExchangeComment')); $aSuffixes[$sSuffix] = true; @@ -830,26 +796,20 @@ class ApplicationInstaller CMDBSource::Query($sInit); SetupLog::Info("Initialization of '{$sDBPrefix}priv_change.origin' completed."); - } - else - { + } else { SetupLog::Info("'{$sDBPrefix}priv_change.origin' already initialized, nothing to do."); } - } - catch (Exception $e) - { + } catch (Exception $e) { SetupLog::Error("Initializing '{$sDBPrefix}priv_change.origin' failed: ".$e->getMessage()); } // priv_async_task now has a 'status' field to distinguish between the various statuses rather than just relying on the date columns // Let's initialize the field with 'planned' or 'error' for all records were it's null CMDBSource::SelectDB($sDBName); - try - { + try { $sCount = "SELECT COUNT(*) FROM `{$sDBPrefix}priv_async_task` WHERE `status` IS NULL"; $iCount = (int)CMDBSource::QueryToScalar($sCount); - if ($iCount > 0) - { + if ($iCount > 0) { SetupLog::Info("Initializing '{$sDBPrefix}priv_async_task.status' ($iCount records to update)"); $sInit = "UPDATE `{$sDBPrefix}priv_async_task` SET `status` = 'planned' WHERE (`status` IS NULL) AND (`started` IS NULL)"; @@ -859,14 +819,10 @@ class ApplicationInstaller CMDBSource::Query($sInit); SetupLog::Info("Initialization of '{$sDBPrefix}priv_async_task.status' completed."); - } - else - { + } else { SetupLog::Info("'{$sDBPrefix}priv_async_task.status' already initialized, nothing to do."); } - } - catch (Exception $e) - { + } catch (Exception $e) { SetupLog::Error("Initializing '{$sDBPrefix}priv_async_task.status' failed: ".$e->getMessage()); } @@ -886,10 +842,15 @@ class ApplicationInstaller } protected static function AfterDBCreate( - $sModulesDir, $aParamValues, $sAdminUser, $sAdminPwd, $sAdminLanguage, $aSelectedModules, $sTargetEnvironment, + $sModulesDir, + $aParamValues, + $sAdminUser, + $sAdminPwd, + $sAdminLanguage, + $aSelectedModules, + $sTargetEnvironment, $bOldAddon - ) - { + ) { /** * @since 3.2.0 move the ContextTag init at the very beginning of the method * @noinspection PhpUnusedLocalVariableInspection @@ -901,12 +862,11 @@ class ApplicationInstaller $oConfig = new Config(); $oConfig->UpdateFromParams($aParamValues, $sModulesDir); - if ($bOldAddon) - { + if ($bOldAddon) { // Old version of the add-on for backward compatibility with pre-2.0 data models - $oConfig->SetAddons(array( + $oConfig->SetAddons([ 'user rights' => 'addons/userrights/userrightsprofile.db.class.inc.php', - )); + ]); } $oProductionEnv = new RunTimeEnvironment($sTargetEnvironment); @@ -921,14 +881,10 @@ class ApplicationInstaller $oProductionEnv->UpdatePredefinedObjects(); - if($sMode == 'install') - { - if (!self::CreateAdminAccount(MetaModel::GetConfig(), $sAdminUser, $sAdminPwd, $sAdminLanguage)) - { + if ($sMode == 'install') { + if (!self::CreateAdminAccount(MetaModel::GetConfig(), $sAdminUser, $sAdminPwd, $sAdminLanguage)) { throw(new Exception("Failed to create the administrator account '$sAdminUser'")); - } - else - { + } else { SetupLog::Info("Administrator account '$sAdminUser' created."); } } @@ -946,21 +902,21 @@ class ApplicationInstaller { SetupLog::Info('CreateAdminAccount'); - if (UserRights::CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage)) - { + if (UserRights::CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage)) { return true; - } - else - { + } else { return false; } } protected static function DoLoadFiles( - $aSelectedModules, $sModulesDir, $aParamValues, $sTargetEnvironment = 'production', $bOldAddon = false, + $aSelectedModules, + $sModulesDir, + $aParamValues, + $sTargetEnvironment = 'production', + $bOldAddon = false, $bSampleData = false - ) - { + ) { /** * @since 3.2.0 move the ContextTag init at the very beginning of the method * @noinspection PhpUnusedLocalVariableInspection @@ -970,19 +926,17 @@ class ApplicationInstaller $oConfig = new Config(); $oConfig->UpdateFromParams($aParamValues, $sModulesDir); - if ($bOldAddon) - { + if ($bOldAddon) { // Old version of the add-on for backward compatibility with pre-2.0 data models - $oConfig->SetAddons(array( + $oConfig->SetAddons([ 'user rights' => 'addons/userrights/userrightsprofile.db.class.inc.php', - )); + ]); } $oProductionEnv = new RunTimeEnvironment($sTargetEnvironment); //Load the MetaModel if needed (asynchronous mode) - if (!self::$bMetaModelStarted) - { + if (!self::$bMetaModelStarted) { $oProductionEnv->InitDataModel($oConfig, false); // load data model and connect to the database self::$bMetaModelStarted = true; // No need to reload the final MetaModel in case the installer runs synchronously @@ -991,7 +945,7 @@ class ApplicationInstaller $aAvailableModules = $oProductionEnv->AnalyzeInstallation($oConfig, APPROOT.$sModulesDir); $oProductionEnv->LoadData($aAvailableModules, $aSelectedModules, $bSampleData); - // Perform after dbload setup tasks here + // Perform after dbload setup tasks here // $oProductionEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'AfterDataLoad'); } @@ -1013,8 +967,15 @@ class ApplicationInstaller * @throws \Exception */ protected static function DoCreateConfig( - $sModulesDir, $sPreviousConfigFile, $sTargetEnvironment, $sDataModelVersion, $bOldAddon, $aSelectedModuleCodes, - $aSelectedExtensionCodes, $aParamValues, $sInstallComment = null + $sModulesDir, + $sPreviousConfigFile, + $sTargetEnvironment, + $sDataModelVersion, + $bOldAddon, + $aSelectedModuleCodes, + $aSelectedExtensionCodes, + $aParamValues, + $sInstallComment = null ) { /** * @since 3.2.0 move the ContextTag init at the very beginning of the method @@ -1026,22 +987,16 @@ class ApplicationInstaller $sMode = $aParamValues['mode']; $bPreserveModuleSettings = false; - if ($sMode == 'upgrade') - { - try - { + if ($sMode == 'upgrade') { + try { $oOldConfig = new Config($sPreviousConfigFile); $oConfig = clone($oOldConfig); $bPreserveModuleSettings = true; - } - catch(Exception $e) - { + } catch (Exception $e) { // In case the previous configuration is corrupted... start with a blank new one $oConfig = new Config(); } - } - else - { + } else { $oConfig = new Config(); // To preserve backward compatibility while upgrading to 2.0.3 (when tracking_level_linked_set_default has been introduced) // the default value on upgrade differs from the default value at first install @@ -1051,26 +1006,23 @@ class ApplicationInstaller $oConfig->Set('access_mode', ACCESS_FULL); // Final config update: add the modules $oConfig->UpdateFromParams($aParamValues, $sModulesDir, $bPreserveModuleSettings); - if ($bOldAddon) - { + if ($bOldAddon) { // Old version of the add-on for backward compatibility with pre-2.0 data models - $oConfig->SetAddons(array( + $oConfig->SetAddons([ 'user rights' => 'addons/userrights/userrightsprofile.db.class.inc.php', - )); + ]); } // Record which modules are installed... $oProductionEnv = new RunTimeEnvironment($sTargetEnvironment); $oProductionEnv->InitDataModel($oConfig, true); // load data model and connect to the database - if (!$oProductionEnv->RecordInstallation($oConfig, $sDataModelVersion, $aSelectedModuleCodes, $aSelectedExtensionCodes, $sInstallComment)) - { + if (!$oProductionEnv->RecordInstallation($oConfig, $sDataModelVersion, $aSelectedModuleCodes, $aSelectedExtensionCodes, $sInstallComment)) { throw new Exception("Failed to record the installation information"); } // Make sure the root configuration directory exists - if (!file_exists(APPCONF)) - { + if (!file_exists(APPCONF)) { mkdir(APPCONF); chmod(APPCONF, 0770); // RWX for owner and group, nothing for others SetupLog::Info("Created configuration directory: ".APPCONF); diff --git a/setup/appupgradecopy.php b/setup/appupgradecopy.php index 6a8465e5f..e27166470 100644 --- a/setup/appupgradecopy.php +++ b/setup/appupgradecopy.php @@ -15,8 +15,7 @@ function AppUpgradeCopyFiles($sSourceDir) CoreUpdater::CopyDir($sSourceDir, APPROOT); // Update Core update files $sSource = realpath($sSourceDir.'/datamodels/2.x/itop-core-update'); - if ($sSource !== false) - { + if ($sSource !== false) { CoreUpdater::CopyDir($sSource, APPROOT.'env-production/itop-core-update'); } -} \ No newline at end of file +} diff --git a/setup/backup.class.inc.php b/setup/backup.class.inc.php index 424578973..5e9ffa197 100644 --- a/setup/backup.class.inc.php +++ b/setup/backup.class.inc.php @@ -1,9 +1,10 @@ sDBSubName = $oConfig->get('db_subname'); } - /** * Create a normalized backup name, depending on the current date/time and Database * @@ -225,26 +222,23 @@ class DBBackup * * @param string $sSourceConfigFile * @param string $sTmpFolder - * @param bool $bSkipSQLDumpForTesting + * @param bool $bSkipSQLDumpForTesting * * @return array list of files to archive * @throws \Exception */ protected function PrepareFilesToBackup($sSourceConfigFile, $sTmpFolder, $bSkipSQLDumpForTesting = false) { - $aRet = array(); - if (is_dir($sTmpFolder)) - { + $aRet = []; + if (is_dir($sTmpFolder)) { SetupUtils::rrmdir($sTmpFolder); } $this->LogInfo("backup: creating tmp dir '$sTmpFolder'"); @mkdir($sTmpFolder, 0777, true); - if (is_null($sSourceConfigFile)) - { + if (is_null($sSourceConfigFile)) { $sSourceConfigFile = MetaModel::GetConfig()->GetLoadedFile(); } - if (!empty($sSourceConfigFile)) - { + if (!empty($sSourceConfigFile)) { $sFile = $sTmpFolder.'/config-itop.php'; $this->LogInfo("backup: adding resource '$sSourceConfigFile'"); @copy($sSourceConfigFile, $sFile); // During unattended install config file may be absent @@ -252,16 +246,14 @@ class DBBackup } $sDeltaFile = APPROOT.'data/'.utils::GetCurrentEnvironment().'.delta.xml'; - if (file_exists($sDeltaFile)) - { + if (file_exists($sDeltaFile)) { $sFile = $sTmpFolder.'/delta.xml'; $this->LogInfo("backup: adding resource '$sDeltaFile'"); copy($sDeltaFile, $sFile); $aRet[] = $sFile; } $sExtraDir = APPROOT.'data/'.utils::GetCurrentEnvironment().'-modules/'; - if (is_dir($sExtraDir)) - { + if (is_dir($sExtraDir)) { $sModules = utils::GetCurrentEnvironment().'-modules'; $sFile = $sTmpFolder.'/'.$sModules; $this->LogInfo("backup: adding resource '$sExtraDir'"); @@ -270,38 +262,31 @@ class DBBackup } $aExtraFiles = []; - if (MetaModel::GetConfig() !== null) // During unattended install config file may be absent - { + if (MetaModel::GetConfig() !== null) { // During unattended install config file may be absent $aExtraFiles = MetaModel::GetModuleSetting('itop-backup', 'extra_files', []); } - foreach (InterfaceDiscovery::GetInstance()->FindItopClasses(iBackupExtraFilesExtension::class) as $sExtensionClass) - { + foreach (InterfaceDiscovery::GetInstance()->FindItopClasses(iBackupExtraFilesExtension::class) as $sExtensionClass) { /** @var iBackupExtraFilesExtension $oExtensionInstance */ $oExtensionInstance = new $sExtensionClass(); $aExtraFiles = array_merge($aExtraFiles, $oExtensionInstance->GetExtraFilesRelPaths()); } - foreach($aExtraFiles as $sExtraFileOrDir) - { - if(!file_exists(APPROOT.'/'.$sExtraFileOrDir)) { + foreach ($aExtraFiles as $sExtraFileOrDir) { + if (!file_exists(APPROOT.'/'.$sExtraFileOrDir)) { continue; // Ignore non-existing files } $sExtraFullPath = utils::RealPath(APPROOT.'/'.$sExtraFileOrDir, APPROOT); - if ($sExtraFullPath === false) - { + if ($sExtraFullPath === false) { throw new Exception("Backup: Aborting, resource '$sExtraFileOrDir'. Considered as UNSAFE because not inside the iTop directory."); } - if (is_dir($sExtraFullPath)) - { + if (is_dir($sExtraFullPath)) { $sFile = $sTmpFolder.'/'.$sExtraFileOrDir; $this->LogInfo("backup: adding directory '$sExtraFileOrDir'"); SetupUtils::copydir($sExtraFullPath, $sFile); $aRet[] = $sFile; - } - elseif (file_exists($sExtraFullPath)) - { + } elseif (file_exists($sExtraFullPath)) { $sFile = $sTmpFolder.'/'.$sExtraFileOrDir; $this->LogInfo("backup: adding file '$sExtraFileOrDir'"); @mkdir(dirname($sFile), 0755, true); @@ -309,8 +294,7 @@ class DBBackup $aRet[] = $sFile; } } - if (!$bSkipSQLDumpForTesting) - { + if (!$bSkipSQLDumpForTesting) { $sDataFile = $sTmpFolder.'/itop-dump.sql'; $this->DoBackup($sDataFile); $aRet[] = $sDataFile; @@ -344,19 +328,16 @@ class DBBackup $this->DBConnect(); $sTables = ''; - if ($this->sDBSubName != '') - { + if ($this->sDBSubName != '') { // This instance of iTop uses a prefix for the tables, so there may be other tables in the database // Let's explicitely list all the tables and views to dump $aTables = $this->EnumerateTables(); - if (count($aTables) == 0) - { + if (count($aTables) == 0) { // No table has been found with the given prefix throw new BackupException("No table has been found with the given prefix"); } - $aEscapedTables = array(); - foreach ($aTables as $sTable) - { + $aEscapedTables = []; + foreach ($aTables as $sTable) { $aEscapedTables[] = self::EscapeShellArg($sTable); } $sTables = implode(' ', $aEscapedTables); @@ -391,39 +372,32 @@ EOF; file_put_contents($sMySQLDumpCnfFile, $sMySQLDumpCnf, LOCK_EX); // Note: opt implicitly sets lock-tables... which cancels the benefit of single-transaction! - // skip-lock-tables compensates and allows for writes during a backup - $sCommand = "$sMySQLDump --defaults-extra-file=\"$sMySQLDumpCnfFile\" --opt --skip-lock-tables --default-character-set=" . $sMysqldumpCharset . " --add-drop-database --single-transaction --host=$sHost $sPortAndTransportOptions --user=$sUser $sTlsOptions --result-file=$sTmpFileName $sDBName $sTables 2>&1"; - $sCommandDisplay = "$sMySQLDump --defaults-extra-file=\"$sMySQLDumpCnfFile\" --opt --skip-lock-tables --default-character-set=" . $sMysqldumpCharset . " --add-drop-database --single-transaction --host=$sHost $sPortAndTransportOptions --user=xxxxx $sTlsOptions --result-file=$sTmpFileName $sDBName $sTables"; + // skip-lock-tables compensates and allows for writes during a backup + $sCommand = "$sMySQLDump --defaults-extra-file=\"$sMySQLDumpCnfFile\" --opt --skip-lock-tables --default-character-set=".$sMysqldumpCharset." --add-drop-database --single-transaction --host=$sHost $sPortAndTransportOptions --user=$sUser $sTlsOptions --result-file=$sTmpFileName $sDBName $sTables 2>&1"; + $sCommandDisplay = "$sMySQLDump --defaults-extra-file=\"$sMySQLDumpCnfFile\" --opt --skip-lock-tables --default-character-set=".$sMysqldumpCharset." --add-drop-database --single-transaction --host=$sHost $sPortAndTransportOptions --user=xxxxx $sTlsOptions --result-file=$sTmpFileName $sDBName $sTables"; // Now run the command for real $this->LogInfo("backup: generate data file with command: $sCommandDisplay"); - $aOutput = array(); + $aOutput = []; $iRetCode = 0; exec($sCommand, $aOutput, $iRetCode); @unlink($sMySQLDumpCnfFile); - foreach ($aOutput as $sLine) - { + foreach ($aOutput as $sLine) { $this->LogInfo("mysqldump said: $sLine"); } - if ($iRetCode != 0) - { + if ($iRetCode != 0) { // Cleanup residual output (Happens with Error 2020: Got packet bigger than 'maxallowedpacket' bytes...) - if (file_exists($sBackupFileName)) - { + if (file_exists($sBackupFileName)) { unlink($sBackupFileName); } $this->LogError("Failed to execute: $sCommandDisplay. The command returned:$iRetCode"); - foreach ($aOutput as $sLine) - { + foreach ($aOutput as $sLine) { $this->LogError("mysqldump said: $sLine"); } - if (count($aOutput) == 1) - { + if (count($aOutput) == 1) { $sMoreInfo = trim($aOutput[0]); - } - else - { + } else { $sMoreInfo = "Check the log files 'log/setup.log' or 'log/error.log' for more information."; } throw new BackupException("Failed to execute mysqldump: ".$sMoreInfo); @@ -439,8 +413,7 @@ EOF; */ public function DownloadBackup($sFile) { - if (!file_exists($sFile)) - { + if (!file_exists($sFile)) { throw new InvalidParameterException('Invalid file path'); } @@ -473,25 +446,27 @@ EOF; $sTlsEnabled = $oConfig->Get('db_tls.enabled'); $sTlsCA = $oConfig->Get('db_tls.ca'); - try - { - $oMysqli = CMDBSource::GetMysqliInstance($sServer, $sUser, $sPwd, $sSource, $sTlsEnabled, $sTlsCA, - false); + try { + $oMysqli = CMDBSource::GetMysqliInstance( + $sServer, + $sUser, + $sPwd, + $sSource, + $sTlsEnabled, + $sTlsCA, + false + ); - if ($oMysqli->connect_errno) - { + if ($oMysqli->connect_errno) { $sHost = is_null($this->iDBPort) ? $this->sDBHost : $this->sDBHost.' on port '.$this->iDBPort; - throw new MySQLException('Could not connect to the DB server '.$oMysqli->connect_errno.' (mysql errno: '.$oMysqli->connect_error, array('host' => $sHost, 'user' => $sUser)); - } - if (!$oMysqli->select_db($this->sDBName)) - { + throw new MySQLException('Could not connect to the DB server '.$oMysqli->connect_errno.' (mysql errno: '.$oMysqli->connect_error, ['host' => $sHost, 'user' => $sUser]); + } + if (!$oMysqli->select_db($this->sDBName)) { throw new BackupException("The database '$this->sDBName' does not seem to exist"); } return $oMysqli; - } - catch (MySQLException $e) - { + } catch (MySQLException $e) { throw new BackupException($e->getMessage()); } } @@ -504,28 +479,22 @@ EOF; protected function EnumerateTables() { $oMysqli = $this->DBConnect(); - if ($this->sDBSubName != '') - { + if ($this->sDBSubName != '') { $oResult = $oMysqli->query("SHOW TABLES LIKE '{$this->sDBSubName}%'"); - } - else - { + } else { $oResult = $oMysqli->query("SHOW TABLES"); } - if (!$oResult) - { + if (!$oResult) { throw new BackupException("Failed to execute the SHOW TABLES query: ".$oMysqli->error); } - $aTables = array(); - while ($aRow = $oResult->fetch_row()) - { + $aTables = []; + while ($aRow = $oResult->fetch_row()) { $aTables[] = $aRow[0]; } return $aTables; } - /** * @param Config $oConfig * @@ -541,25 +510,18 @@ EOF; public static function GetMysqlCliTlsOptions($oConfig) { $bDbTlsEnabled = $oConfig->Get('db_tls.enabled'); - if (!$bDbTlsEnabled) - { + if (!$bDbTlsEnabled) { return ''; } $sTlsOptions = ''; // Mysql 5.7.11 and upper deprecated --ssl and uses --ssl-mode instead - if (CMDBSource::IsSslModeDBVersion()) - { - if(empty($oConfig->Get('db_tls.ca'))) - { + if (CMDBSource::IsSslModeDBVersion()) { + if (empty($oConfig->Get('db_tls.ca'))) { $sTlsOptions .= ' --ssl-mode=REQUIRED'; - } - else - { + } else { $sTlsOptions .= ' --ssl-mode=VERIFY_CA'; } - } - else - { + } else { $sTlsOptions .= ' --ssl'; } @@ -582,8 +544,7 @@ EOF; */ private static function GetMysqliCliSingleOption($sCliArgName, $sData) { - if (empty($sData)) - { + if (empty($sData)) { return ''; } @@ -613,7 +574,7 @@ EOF; $sPortOption = self::GetMysqliCliSingleOption('port', $iPort); $sTransportOptions = ' --protocol=tcp'; - return $sPortOption . $sTransportOptions; + return $sPortOption.$sTransportOptions; } if (is_null($iPort)) { @@ -632,8 +593,7 @@ EOF; { if (empty($sMySQLBinDir)) { $sMySQLCommand = $sCmd; - } - else { + } else { $sMySQLBinDir = escapeshellcmd($sMySQLBinDir); $sMySQLCommand = '"'.$sMySQLBinDir.'/$sCmd"'; if (!file_exists($sMySQLCommand)) { @@ -666,15 +626,12 @@ class TarGzArchive implements BackupArchive { // remove leading and tailing / $sFile = trim($sFile, "/ \t\n\r\0\x0B"); - if ($this->aFiles === null) - { + if ($this->aFiles === null) { // Initial load $this->buildFileList(); } - foreach ($this->aFiles as $aArchFile) - { - if ($aArchFile['filename'] == $sFile) - { + foreach ($this->aFiles as $aArchFile) { + if ($aArchFile['filename'] == $sFile) { return true; } } @@ -691,15 +648,12 @@ class TarGzArchive implements BackupArchive { // remove leading and tailing / $sDirectory = trim($sDirectory, "/ \t\n\r\0\x0B"); - if ($this->aFiles === null) - { + if ($this->aFiles === null) { // Initial load $this->buildFileList(); } - foreach ($this->aFiles as $aArchFile) - { - if (($aArchFile['typeflag'] == 5) && ($aArchFile['filename'] == $sDirectory)) - { + foreach ($this->aFiles as $aArchFile) { + if (($aArchFile['typeflag'] == 5) && ($aArchFile['filename'] == $sDirectory)) { return true; } } @@ -764,4 +718,3 @@ class TarGzArchive implements BackupArchive $this->aFiles = $this->oArchive->listContent(); } } - diff --git a/setup/compat/domcompat.php b/setup/compat/domcompat.php index 271c1c798..a98d58a40 100644 --- a/setup/compat/domcompat.php +++ b/setup/compat/domcompat.php @@ -1,4 +1,5 @@ getLineNo().')'; - } - parent::__construct($message, $code, $previous); - } + /** + * Overrides the Exception default constructor to automatically add informations about the concerned node (path and + * line number) + * + * @param string $message + * @param $code + * @param $previous + * @param DesignElement|null $node DOMNode causing the DOMFormatException + */ + public function __construct($message, $code = 0, $previous = null, DesignElement $node = null) + { + if ($node !== null) { + $message .= ' ('.MFDocument::GetItopNodePath($node).' at line '.$node->getLineNo().')'; + } + parent::__construct($message, $code, $previous); + } } /** * Compiler class - */ + */ class MFCompiler { - const DATA_PRECOMPILED_FOLDER = 'data'.DIRECTORY_SEPARATOR.'precompiled_styles'.DIRECTORY_SEPARATOR; + public const DATA_PRECOMPILED_FOLDER = 'data'.DIRECTORY_SEPARATOR.'precompiled_styles'.DIRECTORY_SEPARATOR; /** * @var string @@ -107,7 +105,7 @@ class MFCompiler * @var string * @since 2.7.5 3.0.0 N°4020 */ - const REBUILD_HKEYS_NEVER = APPROOT.'data/.setup-rebuild-hkeys-never'; + public const REBUILD_HKEYS_NEVER = APPROOT.'data/.setup-rebuild-hkeys-never'; /** @var \ModelFactory */ protected $oFactory; @@ -315,31 +313,24 @@ class MFCompiler SetupUtils::builddir($sTempTargetDir); // Here is the directory } - try - { + try { $this->DoCompile($sTempTargetDir, $sFinalTargetDir, $oP = null, $bUseSymbolicLinks); - } - catch (Exception $e) - { - if ($sTempTargetDir != $sFinalTargetDir) - { + } catch (Exception $e) { + if ($sTempTargetDir != $sFinalTargetDir) { // Cleanup the temporary directory SetupUtils::rrmdir($sTempTargetDir); } - if (($this->sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode) - { + if (($this->sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode) { SetupUtils::ExitMaintenanceMode(); } throw $e; } - if ($sTempTargetDir != $sFinalTargetDir) - { + if ($sTempTargetDir != $sFinalTargetDir) { // Move the results to the target directory SetupUtils::movedir($sTempTargetDir, $sFinalTargetDir); } - if (($this->sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode) - { + if (($this->sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode) { SetupUtils::ExitMaintenanceMode(); } @@ -347,18 +338,15 @@ class MFCompiler // In case of bad luck (this happens **sometimes** - see N. 550), we may analyze the database structure // with the previous datamodel still loaded (in opcode cache) and thus fail to create the new fields // Finally the application crashes (because of the missing field) when the cache gets updated - if (function_exists('opcache_reset')) - { + if (function_exists('opcache_reset')) { // Zend opcode cache opcache_reset(); } - if (function_exists('apc_clear_cache')) - { + if (function_exists('apc_clear_cache')) { // old style APC apc_clear_cache(); } } - /** * Perform the actual "Compilation" of all modules @@ -370,15 +358,14 @@ class MFCompiler */ protected function DoCompile($sTempTargetDir, $sFinalTargetDir, $oP = null, $bUseSymbolicLinks = false) { - $aAllClasses = array(); // flat list of classes - $aModulesInfo = array(); // Hash array of module_name => array('version' => string, 'root_dir' => string) + $aAllClasses = []; // flat list of classes + $aModulesInfo = []; // Hash array of module_name => array('version' => string, 'root_dir' => string) // Determine the target modules for the MENUS // - $aMenuNodes = array(); - $aMenusByModule = array(); - foreach ($this->oFactory->GetNodes('menus/menu') as $oMenuNode) - { + $aMenuNodes = []; + $aMenusByModule = []; + foreach ($this->oFactory->GetNodes('menus/menu') as $oMenuNode) { $sMenuId = $oMenuNode->getAttribute('id'); $aMenuNodes[$sMenuId] = $oMenuNode; @@ -408,7 +395,7 @@ class MFCompiler // List root classes // - $this->aRootClasses = array(); + $this->aRootClasses = []; foreach ($this->oFactory->ListRootClasses() as $oClass) { $this->Log("Root class (with child classes): ".$oClass->getAttribute('id')); $this->aRootClasses[$oClass->getAttribute('id')] = $oClass; @@ -421,8 +408,8 @@ class MFCompiler // Compile, module by module // $aModules = $this->oFactory->GetLoadedModules(); - $aDataModelFiles = array(); - $aWebservicesFiles = array(); + $aDataModelFiles = []; + $aWebservicesFiles = []; $iStart = strlen(realpath(APPROOT)); $sRelFinalTargetDir = substr($sFinalTargetDir, strlen(APPROOT)); @@ -451,32 +438,26 @@ class MFCompiler $sRelativeDir = $sModuleName; $sRealRelativeDir = $sModuleName; } - $aModulesInfo[$sModuleName] = array('root_dir' => $sRealRelativeDir, 'version' => $sModuleVersion); + $aModulesInfo[$sModuleName] = ['root_dir' => $sRealRelativeDir, 'version' => $sModuleVersion]; $sCompiledCode = ''; $oConstants = $this->oFactory->ListConstants($sModuleName); - if ($oConstants->length > 0) - { - foreach($oConstants as $oConstant) - { + if ($oConstants->length > 0) { + foreach ($oConstants as $oConstant) { $sCompiledCode .= $this->CompileConstant($oConstant)."\n"; } } $oEvents = $this->oFactory->ListEvents($sModuleName); - if ($oEvents->length > 0) - { - foreach($oEvents as $oEvent) - { + if ($oEvents->length > 0) { + foreach ($oEvents as $oEvent) { $sCompiledCode .= $this->CompileEvent($oEvent, $sModuleName)."\n"; } } - if (array_key_exists($sModuleName, $this->aSnippets)) - { - foreach( $this->aSnippets[$sModuleName]['before'] as $aSnippet) - { + if (array_key_exists($sModuleName, $this->aSnippets)) { + foreach ($this->aSnippets[$sModuleName]['before'] as $aSnippet) { $sCompiledCode .= "\n"; $sCompiledCode .= "/**\n"; $sCompiledCode .= " * Snippet: {$aSnippet['snippet_id']}\n"; @@ -485,26 +466,18 @@ class MFCompiler } } - $oClasses = $this->oFactory->ListClasses($sModuleName); $iClassCount = $oClasses->length; - if ($iClassCount == 0) - { + if ($iClassCount == 0) { $this->Log("Found module without classes declared: $sModuleName"); - } - else - { + } else { /** @var \MFElement $oClass */ - foreach($oClasses as $oClass) - { + foreach ($oClasses as $oClass) { $sClass = $oClass->getAttribute("id"); $aAllClasses[] = $sClass; - try - { + try { $sCompiledCode .= $this->CompileClass($oClass, $sTempTargetDir, $sFinalTargetDir, $sRelativeDir); - } - catch (DOMFormatException $e) - { + } catch (DOMFormatException $e) { $sMessage = "Failed to process class '$sClass', "; if (!empty($sModuleRootDir)) { $sMessage .= "from '$sModuleRootDir': "; @@ -515,12 +488,9 @@ class MFCompiler } } - if (!array_key_exists($sModuleName, $aMenusByModule)) - { + if (!array_key_exists($sModuleName, $aMenusByModule)) { $this->Log("Found module without menus declared: $sModuleName"); - } - else - { + } else { $sMenuCreationClass = 'MenuCreation_'.preg_replace('/[^A-Za-z0-9_]/', '_', $sModuleName); $sCompiledCode .= <<GetId()}' (location : '$sModuleRootDir') contains an unknown menuId : '$sMenuId'"); } - if ($oMenuNode->getAttribute("xsi:type") == 'MenuGroup') - { + if ($oMenuNode->getAttribute("xsi:type") == 'MenuGroup') { // Note: this algorithm is wrong // 1 - the module may appear empty in the current module, while children are defined in other modules // 2 - check recursively that child nodes are not empty themselves @@ -572,43 +538,33 @@ EOF; // a- browse the modules and build the menu tree // b- browse the tree and blacklist empty menus // c- before compiling, discard if blacklisted - if (!in_array($oMenuNode->getAttribute("id"), $aParentMenus)) - { + if (!in_array($oMenuNode->getAttribute("id"), $aParentMenus)) { // Discard empty menu groups continue; } } - try - { + try { /** @var iTopWebPage $oP */ $aMenuLines = $this->CompileMenu($oMenuNode, $sTempTargetDir, $sFinalTargetDir, $sRelativeDir, $oP); - } - catch (DOMFormatException $e) - { + } catch (DOMFormatException $e) { throw new Exception("Failed to process menu '$sMenuId', from '$sModuleRootDir': ".$e->getMessage()); } $sParent = $oMenuNode->GetChildText('parent', null); - if (($oMenuNode->GetChildText('enable_admin_only') == '1') || isset($aAdminMenus[$sParent])) - { + if (($oMenuNode->GetChildText('enable_admin_only') == '1') || isset($aAdminMenus[$sParent])) { $aMenuLinesForAdmins = array_merge($aMenuLinesForAdmins, $aMenuLines); $aAdminMenus[$oMenuNode->getAttribute("id")] = true; - } - else - { + } else { $aMenuLinesForAll = array_merge($aMenuLinesForAll, $aMenuLines); } } $sIndent = "\t\t"; - foreach ($aMenuLinesForAll as $sPHPLine) - { + foreach ($aMenuLinesForAll as $sPHPLine) { $sCompiledCode .= $sIndent.$sPHPLine."\n"; } - if (count($aMenuLinesForAdmins) > 0) - { + if (count($aMenuLinesForAdmins) > 0) { $sCompiledCode .= $sIndent."if (UserRights::IsAdministrator())\n"; $sCompiledCode .= $sIndent."{\n"; - foreach ($aMenuLinesForAdmins as $sPHPLine) - { + foreach ($aMenuLinesForAdmins as $sPHPLine) { $sCompiledCode .= $sIndent."\t".$sPHPLine."\n"; } $sCompiledCode .= $sIndent."}\n"; @@ -623,15 +579,12 @@ EOF; // User rights // - if ($sModuleName == $sUserRightsModule) - { + if ($sModuleName == $sUserRightsModule) { $sCompiledCode .= $this->CompileUserRights($oUserRightsNode); } - if (array_key_exists($sModuleName, $this->aSnippets)) - { - foreach( $this->aSnippets[$sModuleName]['after'] as $aSnippet) - { + if (array_key_exists($sModuleName, $this->aSnippets)) { + foreach ($this->aSnippets[$sModuleName]['after'] as $aSnippet) { $sCompiledCode .= "\n"; $sCompiledCode .= "/**\n"; $sCompiledCode .= " * Snippet: {$aSnippet['snippet_id']}\n"; @@ -639,15 +592,13 @@ EOF; $sCompiledCode .= $aSnippet['content']."\n"; } } - + // Create (overwrite if existing) the compiled file // - if (strlen($sCompiledCode) > 0) - { + if (strlen($sCompiledCode) > 0) { // We have compiled something: write the code somewhere // - if (strlen($sModuleRootDir) > 0) - { + if (strlen($sModuleRootDir) > 0) { // Write the code into the given module as model..php // $sModelFileName = 'model.'.$sModuleName.'.php'; @@ -655,9 +606,7 @@ EOF; $this->WritePHPFile($sResultFile, $sModuleName, $sModuleVersion, $sCompiledCode); // In case the model file wasn't present in the module file, we're adding it ! (N°4875) $oModule->AddFileToInclude('business', $sModelFileName); - } - else - { + } else { // Write the code into core/main.php // $this->sMainPHPCode .= @@ -674,8 +623,7 @@ EOF; } // files to include (PHP datamodels) - foreach($oModule->GetFilesToInclude('business') as $sRelFileName) - { + foreach ($oModule->GetFilesToInclude('business') as $sRelFileName) { if (file_exists("{$sTempTargetDir}/{$sRelativeDir}/{$sRelFileName}")) { $aDataModelFiles[] = "MetaModel::IncludeModule(MODULESROOT.'/$sRelativeDir/$sRelFileName');"; } else { @@ -717,8 +665,7 @@ PHP; // Compile the dictionaries -out of the modules // $sDictDir = $sTempTargetDir.'/dictionaries'; - if (!is_dir($sDictDir)) - { + if (!is_dir($sDictDir)) { $this->Log("Creating directory $sDictDir"); mkdir($sDictDir, 0777, true); } @@ -732,10 +679,8 @@ PHP; $oBrandingNode = $this->oFactory->GetNodes('branding')->item(0); $this->CompileBranding($oBrandingNode, $sTempTargetDir, $sFinalTargetDir); - if (array_key_exists('_core_', $this->aSnippets)) - { - foreach( $this->aSnippets['_core_']['before'] as $aSnippet) - { + if (array_key_exists('_core_', $this->aSnippets)) { + foreach ($this->aSnippets['_core_']['before'] as $aSnippet) { $this->sMainPHPCode .= "\n"; $this->sMainPHPCode .= "/**\n"; $this->sMainPHPCode .= " * Snippet: {$aSnippet['snippet_id']}\n"; @@ -743,7 +688,7 @@ PHP; $this->sMainPHPCode .= $aSnippet['content']."\n"; } } - + // Compile the portals /** @var \MFElement $oPortalsNode */ $oPortalsNode = $this->oFactory->GetNodes('/itop_design/portals')->item(0); @@ -757,11 +702,9 @@ PHP; /** @var \MFElement $oParametersNode */ $oParametersNode = $this->oFactory->GetNodes('/itop_design/module_parameters')->item(0); $this->CompileParameters($oParametersNode, $sTempTargetDir, $sFinalTargetDir); - - if (array_key_exists('_core_', $this->aSnippets)) - { - foreach( $this->aSnippets['_core_']['after'] as $aSnippet) - { + + if (array_key_exists('_core_', $this->aSnippets)) { + foreach ($this->aSnippets['_core_']['after'] as $aSnippet) { $this->sMainPHPCode .= "\n"; $this->sMainPHPCode .= "/**\n"; $this->sMainPHPCode .= " * Snippet: {$aSnippet['snippet_id']}\n"; @@ -770,14 +713,12 @@ PHP; } } - if (count($this->aRelations) > 0) - { + if (count($this->aRelations) > 0) { $this->sMainPHPCode .= "\n"; $this->sMainPHPCode .= "/**\n"; $this->sMainPHPCode .= " * Relations\n"; $this->sMainPHPCode .= " */\n"; - foreach($this->aRelations as $sRelationCode => $aData) - { + foreach ($this->aRelations as $sRelationCode => $aData) { $sRelCodeSafe = addslashes($sRelationCode); $this->sMainPHPCode .= "MetaModel::RegisterRelation('$sRelCodeSafe');\n"; } @@ -791,7 +732,7 @@ PHP; $sCurrDate = date(DATE_ISO8601); // Autoload $sPHPFile = $sTempTargetDir.'/autoload.php'; - $sPHPFileContent = + $sPHPFileContent = << $value) - { - if (is_null($value)) - { + foreach ($aItems as $key => $value) { + if (is_null($value)) { $aTransformed[] = $key; - } - else - { - if (is_array($value)) - { + } else { + if (is_array($value)) { $this->ArrayOfItemsToZList($value); } $aTransformed[$key] = $value; @@ -847,29 +782,26 @@ EOF * Helper to format the flags for an attribute, in a given state * @param object $oAttNode DOM node containing the information to build the flags * Returns string PHP flags, based on the OPT_ATT_ constants, or empty (meaning 0, can be omitted) - */ + */ protected function FlagsToPHP($oAttNode) { - static $aNodeAttributeToFlag = array( + static $aNodeAttributeToFlag = [ 'mandatory' => 'OPT_ATT_MANDATORY', 'read_only' => 'OPT_ATT_READONLY', 'must_prompt' => 'OPT_ATT_MUSTPROMPT', 'must_change' => 'OPT_ATT_MUSTCHANGE', 'hidden' => 'OPT_ATT_HIDDEN', - ); - - $aFlags = array(); - foreach ($aNodeAttributeToFlag as $sNodeAttribute => $sFlag) - { + ]; + + $aFlags = []; + foreach ($aNodeAttributeToFlag as $sNodeAttribute => $sFlag) { $bFlag = ($oAttNode->GetOptionalElement($sNodeAttribute) != null); - if ($bFlag) - { + if ($bFlag) { $aFlags[] = $sFlag; } } - if (empty($aFlags)) - { - $aFlags[] = 'OPT_ATT_NORMAL'; // When no flag is defined, reset the state to "normal" + if (empty($aFlags)) { + $aFlags[] = 'OPT_ATT_NORMAL'; // When no flag is defined, reset the state to "normal" } $sRes = implode(' | ', $aFlags); return $sRes; @@ -885,31 +817,29 @@ EOF */ protected function TrackingLevelToPHP($sAttType, $sTrackingLevel) { - static $aXmlToPHP_Links = array( + static $aXmlToPHP_Links = [ 'none' => 'LINKSET_TRACKING_NONE', 'list' => 'LINKSET_TRACKING_LIST', 'details' => 'LINKSET_TRACKING_DETAILS', 'all' => 'LINKSET_TRACKING_ALL', - ); - - static $aXmlToPHP_Others = array( + ]; + + static $aXmlToPHP_Others = [ 'none' => 'ATTRIBUTE_TRACKING_NONE', 'all' => 'ATTRIBUTE_TRACKING_ALL', - ); + ]; - switch ($sAttType) - { - case 'AttributeLinkedSetIndirect': - case 'AttributeLinkedSet': - $aXmlToPHP = $aXmlToPHP_Links; - break; + switch ($sAttType) { + case 'AttributeLinkedSetIndirect': + case 'AttributeLinkedSet': + $aXmlToPHP = $aXmlToPHP_Links; + break; - default: - $aXmlToPHP = $aXmlToPHP_Others; + default: + $aXmlToPHP = $aXmlToPHP_Others; } - if (!array_key_exists($sTrackingLevel, $aXmlToPHP)) - { + if (!array_key_exists($sTrackingLevel, $aXmlToPHP)) { throw new DOMFormatException("Tracking level: unknown value '$sTrackingLevel', expecting a value in {".implode(', ', array_keys($aXmlToPHP))."}"); } return $aXmlToPHP[$sTrackingLevel]; @@ -925,22 +855,20 @@ EOF */ protected function EditModeToPHP($sEditMode) { - static $aXmlToPHP = array( + static $aXmlToPHP = [ 'none' => 'LINKSET_EDITMODE_NONE', 'add_only' => 'LINKSET_EDITMODE_ADDONLY', 'actions' => 'LINKSET_EDITMODE_ACTIONS', 'in_place' => 'LINKSET_EDITMODE_INPLACE', 'add_remove' => 'LINKSET_EDITMODE_ADDREMOVE', - ); - - if (!array_key_exists($sEditMode, $aXmlToPHP)) - { + ]; + + if (!array_key_exists($sEditMode, $aXmlToPHP)) { throw new DOMFormatException("Edit mode: unknown value '$sEditMode'"); } return $aXmlToPHP[$sEditMode]; } - /** * Helper to format the edit-when for direct linkset * @@ -951,55 +879,41 @@ EOF */ protected function EditWhenToPHP($sEditWhen): string { - static $aXmlToPHP = array( + static $aXmlToPHP = [ 'never' => 'LINKSET_EDITWHEN_NEVER', 'on_host_edition' => 'LINKSET_EDITWHEN_ON_HOST_EDITION', 'on_host_display' => 'LINKSET_EDITWHEN_ON_HOST_DISPLAY', 'always' => 'LINKSET_EDITWHEN_ALWAYS', - ); + ]; - if (!array_key_exists($sEditWhen, $aXmlToPHP)) - { + if (!array_key_exists($sEditWhen, $aXmlToPHP)) { throw new DOMFormatException("Edit mode: unknown value '$sEditWhen'"); } return $aXmlToPHP[$sEditWhen]; } - + /** * Format a path (file or url) as an absolute path or relative to the module or the app - */ + */ protected function PathToPHP($sPath, $sModuleRelativeDir, $bIsUrl = false) { - if ($sPath == '') - { + if ($sPath == '') { $sPHP = "''"; - } - elseif (substr($sPath, 0, 2) == '$$') - { + } elseif (substr($sPath, 0, 2) == '$$') { // Absolute $sPHP = self::QuoteForPHP(substr($sPath, 2)); - } - elseif (substr($sPath, 0, 1) == '$') - { + } elseif (substr($sPath, 0, 1) == '$') { // Relative to the application - if ($bIsUrl) - { + if ($bIsUrl) { $sPHP = "utils::GetAbsoluteUrlAppRoot().".self::QuoteForPHP(substr($sPath, 1)); - } - else - { + } else { $sPHP = "APPROOT.".self::QuoteForPHP(substr($sPath, 1)); } - } - else - { + } else { // Relative to the module - if ($bIsUrl) - { + if ($bIsUrl) { $sPHP = "utils::GetAbsoluteUrlModulePage('$sModuleRelativeDir', ".self::QuoteForPHP($sPath).")"; - } - else - { + } else { $sPHP = "__DIR__.'/$sPath'"; } } @@ -1019,14 +933,10 @@ EOF protected function GetPropString($oNode, string $sTag, string $sDefault = null, bool $bAddQuotes = true) { $val = $oNode->GetChildText($sTag); - if (is_null($val)) - { - if (is_null($sDefault)) - { + if (is_null($val)) { + if (is_null($sDefault)) { return null; - } - else - { + } else { $val = $sDefault; } } @@ -1049,18 +959,15 @@ EOF protected function GetMandatoryPropString($oNode, string $sTag, bool $bAddQuotes = true) { $val = $oNode->GetChildText($sTag); - if (!is_null($val) && ($val !== '')) - { + if (!is_null($val) && ($val !== '')) { if ($bAddQuotes) { return "'".$val."'"; } else { return $val; } - } - else - { + } else { throw new DOMFormatException("missing (or empty) mandatory tag '$sTag' under the tag '".$oNode->nodeName."'"); - } + } } /** @@ -1074,12 +981,10 @@ EOF { $sValue = $this->GetPropBoolean($oNode, $sTag, $bDefault); - if ($sValue == null) - { + if ($sValue == null) { return null; } - if ($sValue == 'true') - { + if ($sValue == 'true') { return true; } @@ -1097,14 +1002,10 @@ EOF protected function GetPropBoolean($oNode, $sTag, $bDefault = null) { $val = $oNode->GetChildText($sTag); - if (is_null($val)) - { - if (is_null($bDefault)) - { + if (is_null($val)) { + if (is_null($bDefault)) { return null; - } - else - { + } else { return $bDefault ? 'true' : 'false'; } } @@ -1121,8 +1022,7 @@ EOF protected function GetMandatoryPropBoolean($oNode, $sTag) { $val = $oNode->GetChildText($sTag); - if (is_null($val)) - { + if (is_null($val)) { throw new DOMFormatException("missing (or empty) mandatory tag '$sTag' under the tag '".$oNode->nodeName."'"); } return $val == 'true' ? 'true' : 'false'; @@ -1131,14 +1031,10 @@ EOF protected function GetPropNumber($oNode, $sTag, $nDefault = null) { $val = $oNode->GetChildText($sTag); - if (is_null($val)) - { - if (is_null($nDefault)) - { + if (is_null($val)) { + if (is_null($nDefault)) { return null; - } - else - { + } else { $val = $nDefault; } } @@ -1155,8 +1051,7 @@ EOF protected function GetMandatoryPropNumber($oNode, $sTag) { $val = $oNode->GetChildText($sTag); - if (is_null($val)) - { + if (is_null($val)) { throw new DOMFormatException("missing (or empty) mandatory tag '$sTag' under the tag '".$oNode->nodeName."'"); } return (string)$val; @@ -1164,18 +1059,15 @@ EOF /** * Adds quotes and escape characters - */ + */ protected function QuoteForPHP($sStr, $bSimpleQuotes = false) { $sStr = $sStr ?? ''; - if ($bSimpleQuotes) - { - $sEscaped = str_replace(array('\\', "'"), array('\\\\', "\\'"), $sStr); + if ($bSimpleQuotes) { + $sEscaped = str_replace(['\\', "'"], ['\\\\', "\\'"], $sStr); $sRet = "'$sEscaped'"; - } - else - { - $sEscaped = str_replace(array('\\', '"', "\n"), array('\\\\', '\\"', '\\n'), $sStr); + } else { + $sEscaped = str_replace(['\\', '"', "\n"], ['\\\\', '\\"', '\\n'], $sStr); $sRet = '"'.$sEscaped.'"'; } return $sRet; @@ -1249,7 +1141,6 @@ EOF $sOutput .= " )\n"; $sOutput .= ");\n"; - return $sOutput; } @@ -1259,47 +1150,37 @@ EOF $sType = $oConstant->getAttribute('xsi:type'); $sText = $oConstant->GetText(null); - switch ($sType) - { - case 'integer': - if (is_null($sText)) - { - // No data given => null - $sScalar = 'null'; - } - else - { - $sScalar = (string)(int)$sText; - } - break; - - case 'float': - if (is_null($sText)) - { - // No data given => null - $sScalar = 'null'; - } - else - { - $sScalar = (string)(float)$sText; - } - break; - - case 'bool': - if (is_null($sText)) - { - // No data given => null - $sScalar = 'null'; - } - else - { - $sScalar = ($sText == 'true') ? 'true' : 'false'; - } - break; + switch ($sType) { + case 'integer': + if (is_null($sText)) { + // No data given => null + $sScalar = 'null'; + } else { + $sScalar = (string)(int)$sText; + } + break; - case 'string': - default: - $sScalar = $this->QuoteForPHP($sText, true); + case 'float': + if (is_null($sText)) { + // No data given => null + $sScalar = 'null'; + } else { + $sScalar = (string)(float)$sText; + } + break; + + case 'bool': + if (is_null($sText)) { + // No data given => null + $sScalar = 'null'; + } else { + $sScalar = ($sText == 'true') ? 'true' : 'false'; + } + break; + + case 'string': + default: + $sScalar = $this->QuoteForPHP($sText, true); } $sPHPDefine = "define('$sName', $sScalar);"; return $sPHPDefine; @@ -1324,7 +1205,7 @@ EOF // Class characteristics // - $aClassParams = array(); + $aClassParams = []; $aClassParams['category'] = $this->GetPropString($oProperties, 'category', ''); $aClassParams['key_type'] = "'autoincrement'"; if ((bool)$this->GetPropNumber($oProperties, 'is_link', 0)) { @@ -1337,7 +1218,7 @@ EOF $oNameAttributes = $oNaming->GetUniqueElement('attributes'); /** @var \DOMNodeList $oAttributes */ $oAttributes = $oNameAttributes->getElementsByTagName('attribute'); - $aNameAttCodes = array(); + $aNameAttCodes = []; /** @var \MFElement $oAttribute */ foreach ($oAttributes as $oAttribute) { $aNameAttCodes[] = $oAttribute->getAttribute('id'); @@ -1351,7 +1232,7 @@ EOF if ($oComplementaryNameAttributes = $oNaming->GetOptionalElement('complementary_attributes')) { /** @var \DOMNodeList $oAttributes */ $oComplementaryAttributes = $oComplementaryNameAttributes->getElementsByTagName('attribute'); - $aComplementaryNameAttCodes = array(); + $aComplementaryNameAttCodes = []; /** @var \MFElement $oAttribute */ foreach ($oComplementaryAttributes as $oComplementaryAttribute) { $aComplementaryNameAttCodes[] = $oComplementaryAttribute->getAttribute('id'); @@ -1391,7 +1272,7 @@ EOF // Reconcialiation if ($oReconciliation = $oProperties->GetOptionalElement('reconciliation')) { $oReconcAttributes = $oReconciliation->getElementsByTagName('attribute'); - $aReconcAttCodes = array(); + $aReconcAttCodes = []; foreach ($oReconcAttributes as $oAttribute) { $aReconcAttCodes[] = $oAttribute->getAttribute('id'); } @@ -1424,12 +1305,11 @@ EOF $sCss .= $aClassStyleData['scss']; } - $oOrder = $oProperties->GetOptionalElement('order'); if ($oOrder) { $oColumnsNode = $oOrder->GetUniqueElement('columns'); $oColumns = $oColumnsNode->getElementsByTagName('column'); - $aSortColumns = array(); + $aSortColumns = []; foreach ($oColumns as $oColumn) { $aSortColumns[] = "'".$oColumn->getAttribute('id')."' => ".(($oColumn->getAttribute('ascending') == 'true') ? 'true' : 'false'); } @@ -1438,11 +1318,9 @@ EOF } } - if ($oIndexes = $oProperties->GetOptionalElement('indexes')) - { - $aIndexes = array(); - foreach($oIndexes->getElementsByTagName('index') as $oIndex) - { + if ($oIndexes = $oProperties->GetOptionalElement('indexes')) { + $aIndexes = []; + foreach ($oIndexes->getElementsByTagName('index') as $oIndex) { $sIndexId = $oIndex->getAttribute('id'); /** @var DesignElement $oAttributes */ $oAttributes = $oIndex->GetUniqueElement('attributes'); @@ -1486,8 +1364,7 @@ PHP; } } - if (!empty($sEvents)) - { + if (!empty($sEvents)) { $sMethods .= <<GetOptionalElement('uniqueness_rules')) { - $aUniquenessRules = array(); + $aUniquenessRules = []; /** @var \MFElement $oUniquenessSingleRule */ foreach ($oUniquenessRules->GetElementsByTagName('rule') as $oUniquenessSingleRule) { $sCurrentRuleId = $oUniquenessSingleRule->getAttribute('id'); $oAttributes = $oUniquenessSingleRule->GetUniqueElement('attributes', false); if ($oAttributes) { - $aUniquenessAttributes = array(); + $aUniquenessAttributes = []; foreach ($oAttributes->getElementsByTagName('attribute') as $oAttribute) { $aUniquenessAttributes[] = $oAttribute->getAttribute('id'); } @@ -1529,8 +1406,11 @@ EOF; $aUniquenessRules[$sCurrentRuleId]['filter'] = $oUniquenessSingleRule->GetChildText('filter'); $aUniquenessRules[$sCurrentRuleId]['disabled'] = $this->GetPropBooleanConverted($oUniquenessSingleRule, 'disabled', null); - $aUniquenessRules[$sCurrentRuleId]['is_blocking'] = $this->GetPropBooleanConverted($oUniquenessSingleRule, 'is_blocking', - null); + $aUniquenessRules[$sCurrentRuleId]['is_blocking'] = $this->GetPropBooleanConverted( + $oUniquenessSingleRule, + 'is_blocking', + null + ); } // we will check for rules validity later as for now we don't have objects hierarchy (see \MetaModel::InitClasses) @@ -1548,37 +1428,29 @@ EOF; // Fields // $oFields = $oClass->GetOptionalElement('fields'); - if ($oFields) - { + if ($oFields) { $this->CompileFiles($oFields, $sTempTargetDir.'/'.$sModuleRelativeDir, $sFinalTargetDir.'/'.$sModuleRelativeDir, ''); } $sAttributes = ''; - $aTagFieldsInfo = array(); + $aTagFieldsInfo = []; /** @var \DOMElement $oField */ - foreach($this->oFactory->ListFields($oClass) as $oField) - { - try - { + foreach ($this->oFactory->ListFields($oClass) as $oField) { + try { // $oField $sAttCode = $oField->getAttribute('id'); $sAttType = $oField->getAttribute('xsi:type'); - $aParameters = $this->CompileAttribute($sAttType, $oField, $sModuleRelativeDir, $sClass, $sAttCode, $sCss, $aTagFieldsInfo, $sTempTargetDir); - $aParams = array(); - foreach($aParameters as $sKey => $sValue) - { - if (!is_null($sValue)) - { + $aParams = []; + foreach ($aParameters as $sKey => $sValue) { + if (!is_null($sValue)) { $aParams[] = '"'.$sKey.'"=>'.$sValue; } } $sParams = implode(', ', $aParams); $sAttributes .= " MetaModel::Init_AddAttribute(new $sAttType(\"$sAttCode\", array($sParams)));\n"; - } - catch(Exception $e) - { + } catch (Exception $e) { throw new DOMFormatException("Field: '$sAttCode', (type: $sAttType), ".$e->getMessage()); } } @@ -1593,61 +1465,54 @@ EOF; $sLifecycle .= "\t\t//\n"; $oStimuli = $oLifecycle->GetUniqueElement('stimuli'); - foreach ($oStimuli->getElementsByTagName('stimulus') as $oStimulus) - { + foreach ($oStimuli->getElementsByTagName('stimulus') as $oStimulus) { $sStimulus = $oStimulus->getAttribute('id'); $sStimulusClass = $oStimulus->getAttribute('xsi:type'); $sLifecycle .= " MetaModel::Init_DefineStimulus(new ".$sStimulusClass."(\"".$sStimulus."\", array()));\n"; } $oHighlightScale = $oLifecycle->GetUniqueElement('highlight_scale', false); - if ($oHighlightScale) - { + if ($oHighlightScale) { $sHighlightScale = "\t\t// Higlight Scale\n"; $sHighlightScale .= " MetaModel::Init_DefineHighlightScale( array(\n"; $this->CompileFiles($oHighlightScale, $sTempTargetDir.'/'.$sModuleRelativeDir, $sFinalTargetDir.'/'.$sModuleRelativeDir, ''); - foreach ($oHighlightScale->getElementsByTagName('item') as $oItem) - { + foreach ($oHighlightScale->getElementsByTagName('item') as $oItem) { $sItemCode = $oItem->getAttribute('id'); $fRank = (float)$oItem->GetChildText('rank'); $sColor = $oItem->GetChildText('color'); - if (($sIcon = $oItem->GetChildText('icon')) && (strlen($sIcon) > 0)) - { + if (($sIcon = $oItem->GetChildText('icon')) && (strlen($sIcon) > 0)) { $sIcon = $sModuleRelativeDir.'/'.$sIcon; $sIcon = "utils::GetAbsoluteUrlModulesRoot().'$sIcon'"; - } - else - { + } else { $sIcon = "''"; } - switch($sColor) - { + switch ($sColor) { // Known PHP constants: keep the literal value as-is case 'HILIGHT_CLASS_CRITICAL': case 'HIGHLIGHT_CLASS_CRITICAL': - $sColor = 'HILIGHT_CLASS_CRITICAL'; - break; + $sColor = 'HILIGHT_CLASS_CRITICAL'; + break; case 'HILIGHT_CLASS_OK': case 'HIGHLIGHT_CLASS_OK': - $sColor = 'HILIGHT_CLASS_OK'; - break; + $sColor = 'HILIGHT_CLASS_OK'; + break; case 'HIGHLIGHT_CLASS_WARNING': case 'HILIGHT_CLASS_WARNING': - $sColor = 'HILIGHT_CLASS_WARNING'; - break; + $sColor = 'HILIGHT_CLASS_WARNING'; + break; case 'HIGHLIGHT_CLASS_NONE': case 'HILIGHT_CLASS_NONE': - $sColor = 'HILIGHT_CLASS_NONE'; - break; + $sColor = 'HILIGHT_CLASS_NONE'; + break; default: - // Future extension, specify your own color?? - $sColor = "'".addslashes($sColor)."'"; + // Future extension, specify your own color?? + $sColor = "'".addslashes($sColor)."'"; } $sHighlightScale .= " '$sItemCode' => array('rank' => $fRank, 'color' => $sColor, 'icon' => $sIcon),\n"; @@ -1656,62 +1521,48 @@ EOF; } $oStates = $oLifecycle->GetUniqueElement('states'); - $aStatesDependencies = array(); - $aStates = array(); - foreach ($oStates->getElementsByTagName('state') as $oState) - { + $aStatesDependencies = []; + $aStates = []; + foreach ($oStates->getElementsByTagName('state') as $oState) { $aStatesDependencies[$oState->getAttribute('id')] = $oState->GetChildText('inherit_flags_from', ''); $aStates[$oState->getAttribute('id')] = $oState; } - $aStatesOrder = array(); - while (count($aStatesOrder) < count($aStatesDependencies)) - { + $aStatesOrder = []; + while (count($aStatesOrder) < count($aStatesDependencies)) { $iResolved = 0; - foreach($aStatesDependencies as $sState => $sInheritFrom) - { - if (is_null($sInheritFrom)) - { + foreach ($aStatesDependencies as $sState => $sInheritFrom) { + if (is_null($sInheritFrom)) { // Already recorded as resolved continue; - } - elseif ($sInheritFrom == '') - { + } elseif ($sInheritFrom == '') { // Resolved $aStatesOrder[$sState] = $sInheritFrom; $aStatesDependencies[$sState] = null; $iResolved++; - } - elseif (isset($aStatesOrder[$sInheritFrom])) - { + } elseif (isset($aStatesOrder[$sInheritFrom])) { // Resolved $aStatesOrder[$sState] = $sInheritFrom; $aStatesDependencies[$sState] = null; $iResolved++; } } - if ($iResolved == 0) - { + if ($iResolved == 0) { // No change on this loop -> there are unmet dependencies - $aRemainingDeps = array(); - foreach($aStatesDependencies as $sState => $sParentState) - { - if (strlen($sParentState) > 0) - { + $aRemainingDeps = []; + foreach ($aStatesDependencies as $sState => $sParentState) { + if (strlen($sParentState) > 0) { $aRemainingDeps[] = $sState.' ('.$sParentState.')'; } } throw new DOMFormatException("Could not solve inheritance for states: ".implode(', ', $aRemainingDeps)); } } - foreach ($aStatesOrder as $sState => $foo) - { + foreach ($aStatesOrder as $sState => $foo) { $oState = $aStates[$sState]; $oInitialStatePath = $oState->GetOptionalElement('initial_state_path'); - if ($oInitialStatePath) - { - $aInitialStatePath = array(); - foreach ($oInitialStatePath->getElementsByTagName('state_ref') as $oIntermediateState) - { + if ($oInitialStatePath) { + $aInitialStatePath = []; + foreach ($oInitialStatePath->getElementsByTagName('state_ref') as $oIntermediateState) { $aInitialStatePath[] = "'".$oIntermediateState->GetText()."'"; } $sInitialStatePath = 'Array('.implode(', ', $aInitialStatePath).')'; @@ -1723,11 +1574,9 @@ EOF; $sAttributeInherit = $oState->GetChildText('inherit_flags_from', ''); $sLifecycle .= " \"attribute_inherit\" => '$sAttributeInherit',\n"; $oHighlight = $oState->GetUniqueElement('highlight', false); - if ($oHighlight) - { + if ($oHighlight) { $sCode = $oHighlight->GetChildText('code', ''); - if ($sCode != '') - { + if ($sCode != '') { $sLifecycle .= " 'highlight' => array('code' => '$sCode'),\n"; } @@ -1736,52 +1585,42 @@ EOF; $sLifecycle .= " \"attribute_list\" => array(\n"; $oFlags = $oState->GetUniqueElement('flags'); - foreach ($oFlags->getElementsByTagName('attribute') as $oAttributeNode) - { + foreach ($oFlags->getElementsByTagName('attribute') as $oAttributeNode) { $sFlags = $this->FlagsToPHP($oAttributeNode); - if (strlen($sFlags) > 0) - { + if (strlen($sFlags) > 0) { $sAttCode = $oAttributeNode->GetAttribute('id'); $sLifecycle .= " '$sAttCode' => $sFlags,\n"; } } $sLifecycle .= " ),\n"; - if (!is_null($oInitialStatePath)) - { + if (!is_null($oInitialStatePath)) { $sLifecycle .= " \"initial_state_path\" => $sInitialStatePath,\n"; } $sLifecycle .= " )\n"; $sLifecycle .= " );\n"; $oTransitions = $oState->GetUniqueElement('transitions'); - foreach ($oTransitions->getElementsByTagName('transition') as $oTransition) - { + foreach ($oTransitions->getElementsByTagName('transition') as $oTransition) { $sStimulus = $oTransition->getAttribute('id'); $sTargetState = $oTransition->GetChildText('target'); $oActions = $oTransition->GetUniqueElement('actions'); - $aVerbs = array(); - foreach ($oActions->getElementsByTagName('action') as $oAction) - { + $aVerbs = []; + foreach ($oActions->getElementsByTagName('action') as $oAction) { $sVerb = $oAction->GetChildText('verb'); $oParams = $oAction->GetOptionalElement('params'); - $aActionParams = array(); - if ($oParams) - { + $aActionParams = []; + if ($oParams) { $oParamNodes = $oParams->getElementsByTagName('param'); - foreach($oParamNodes as $oParam) - { + foreach ($oParamNodes as $oParam) { $sParamType = $oParam->getAttribute('xsi:type'); - if ($sParamType == '') - { + if ($sParamType == '') { $sParamType = 'string'; } $aActionParams[] = "array('type' => '$sParamType', 'value' => ".self::QuoteForPHP($oParam->textContent).")"; } - } - else - { + } else { // Old (pre 2.1.0) format, when no parameter is specified, assume 1 parameter: reference sStimulusCode $aActionParams[] = "array('type' => 'reference', 'value' => 'sStimulusCode')"; } @@ -1790,28 +1629,25 @@ EOF; } $sActions = implode(', ', $aVerbs); - $sLifecycle .= " MetaModel::Init_DefineTransition(\"$sState\", \"$sStimulus\", array(\n"; - $sLifecycle .= " \"target_state\"=>\"$sTargetState\",\n"; - $sLifecycle .= " \"actions\"=>array($sActions),\n"; - $sLifecycle .= " \"user_restriction\"=>null,\n"; - $sLifecycle .= " \"attribute_list\"=>array(\n"; + $sLifecycle .= " MetaModel::Init_DefineTransition(\"$sState\", \"$sStimulus\", array(\n"; + $sLifecycle .= " \"target_state\"=>\"$sTargetState\",\n"; + $sLifecycle .= " \"actions\"=>array($sActions),\n"; + $sLifecycle .= " \"user_restriction\"=>null,\n"; + $sLifecycle .= " \"attribute_list\"=>array(\n"; $oFlags = $oTransition->GetOptionalElement('flags'); - if($oFlags !== null) - { - foreach ($oFlags->getElementsByTagName('attribute') as $oAttributeNode) - { - $sFlags = $this->FlagsToPHP($oAttributeNode); - if (strlen($sFlags) > 0) - { - $sAttCode = $oAttributeNode->GetAttribute('id'); - $sLifecycle .= " '$sAttCode' => $sFlags,\n"; - } - } - } + if ($oFlags !== null) { + foreach ($oFlags->getElementsByTagName('attribute') as $oAttributeNode) { + $sFlags = $this->FlagsToPHP($oAttributeNode); + if (strlen($sFlags) > 0) { + $sAttCode = $oAttributeNode->GetAttribute('id'); + $sLifecycle .= " '$sAttCode' => $sFlags,\n"; + } + } + } - $sLifecycle .= " )\n"; - $sLifecycle .= " ));\n"; + $sLifecycle .= " )\n"; + $sLifecycle .= " ));\n"; } } } @@ -1892,17 +1728,14 @@ EOF; // Relations // $oRelations = $oClass->GetOptionalElement('relations'); - if ($oRelations) - { - $aRelations = array(); - foreach($oRelations->getElementsByTagName('relation') as $oRelation) - { + if ($oRelations) { + $aRelations = []; + foreach ($oRelations->getElementsByTagName('relation') as $oRelation) { $sRelationId = $oRelation->getAttribute('id'); - $this->aRelations[$sRelationId] = array('id' => $sRelationId); + $this->aRelations[$sRelationId] = ['id' => $sRelationId]; $oNeighbours = $oRelation->GetUniqueElement('neighbours'); - foreach($oNeighbours->getElementsByTagName('neighbour') as $oNeighbour) - { + foreach ($oNeighbours->getElementsByTagName('neighbour') as $oNeighbour) { $sNeighbourId = $oNeighbour->getAttribute('id'); $sDirection = $oNeighbour->GetChildText('direction', 'both'); @@ -1910,12 +1743,10 @@ EOF; $sQueryDown = $oNeighbour->GetChildText('query_down'); $sQueryUp = $oNeighbour->GetChildText('query_up'); - if (($sQueryDown == '') && ($sAttribute == '')) - { + if (($sQueryDown == '') && ($sAttribute == '')) { throw new DOMFormatException("Relation '$sRelationId/$sNeighbourId': either a query or an attribute must be specified"); } - if (($sQueryDown != '') && ($sAttribute != '')) - { + if (($sQueryDown != '') && ($sAttribute != '')) { throw new DOMFormatException("Relation '$sRelationId/$sNeighbourId': both a query and and attribute have been specified... which one should be used?"); } @@ -1926,7 +1757,7 @@ EOF; } elseif ($sDirection != 'down') { throw new DOMFormatException("Relation '$sRelationId/$sNeighbourId': unknown direction ($sDirection), expecting 'both' or 'down'"); } - $aRelations[$sRelationId][$sNeighbourId] = array( + $aRelations[$sRelationId][$sNeighbourId] = [ '_legacy_' => false, 'sDirection' => $sDirection, 'sDefinedInClass' => $sClass, @@ -1934,7 +1765,7 @@ EOF; 'sQueryDown' => $sQueryDown, 'sQueryUp' => $sQueryUp, 'sAttribute' => $sAttribute, - ); + ]; } } @@ -1942,12 +1773,10 @@ EOF; $sMethods .= "\t{\n"; $sMethods .= "\t\tswitch (\$sRelCode)\n"; $sMethods .= "\t\t{\n"; - foreach ($aRelations as $sRelationId => $aRelationData) - { + foreach ($aRelations as $sRelationId => $aRelationData) { $sMethods .= "\t\tcase '$sRelationId':\n"; $sMethods .= "\t\t\t\$aRels = array(\n"; - foreach ($aRelationData as $sNeighbourId => $aData) - { + foreach ($aRelationData as $sNeighbourId => $aData) { //$sData = str_replace("\n", "\n\t\t\t\t", var_export($aData, true)); $sData = var_export($aData, true); $sMethods .= "\t\t\t\t'$sNeighbourId' => $sData,\n"; @@ -1967,21 +1796,16 @@ EOF; $bIsAbstractClass = ($oProperties->GetChildText('abstract') == 'true'); $oPhpParent = $oClass->GetUniqueElement('php_parent', false); $aRequiredFiles = []; - if ($oPhpParent) - { + if ($oPhpParent) { $sParentClass = $oPhpParent->GetChildText('name', ''); - if ($sParentClass == '') - { + if ($sParentClass == '') { throw new Exception("Failed to process class '".$oClass->getAttribute('id')."', missing required tag 'name' under 'php_parent'."); } $sIncludeFile = $oPhpParent->GetChildText('file', ''); - if ($sIncludeFile != '') - { + if ($sIncludeFile != '') { $aRequiredFiles[] = $sIncludeFile; } - } - else - { + } else { $sParentClass = $oClass->GetChildText('parent', 'DBObject'); } $sInitMethodCalls = @@ -1997,20 +1821,19 @@ EOF; $sPHP .= $this->GeneratePhpCodeForClass($sClassName, $sParentClass, $sClassParams, $sInitMethodCalls, $bIsAbstractClass, $sMethods, $aRequiredFiles, $sCodeComment); // N°931 generates TagFieldData classes for AttributeTag fields - if (!empty($aTagFieldsInfo)) - { + if (!empty($aTagFieldsInfo)) { $sTagClassParentClass = "TagSetFieldData"; - $aTagClassParams = array - ( + $aTagClassParams = + [ 'category' => 'bizmodel', 'key_type' => 'autoincrement', - 'name_attcode' => array('label'), + 'name_attcode' => ['label'], 'state_attcode' => '', - 'reconc_keys' => array('code'), + 'reconc_keys' => ['code'], 'db_table' => '', // no need to have a corresponding table : this class exists only for rights, no additional field 'db_key_field' => 'id', 'db_finalclass_field' => 'finalclass', - ); + ]; $sTagInitMethodCalls = << 'label', )); EOF - ; - foreach ($aTagFieldsInfo as $sTagFieldName) - { + ; + foreach ($aTagFieldsInfo as $sTagFieldName) { $sTagClassName = static::GetTagDataClassName($sClassName, $sTagFieldName); $sTagClassParams = var_export($aTagClassParams, true); $sPHP .= $this->GeneratePhpCodeForClass($sTagClassName, $sTagClassParentClass, $sTagClassParams, $sTagInitMethodCalls); @@ -2056,13 +1878,11 @@ EOF { $aParameters = []; - $aDependencies = array(); + $aDependencies = []; $oDependencies = $oField->GetOptionalElement('dependencies'); - if (!is_null($oDependencies)) - { + if (!is_null($oDependencies)) { $oDepNodes = $oDependencies->getElementsByTagName('attribute'); - foreach($oDepNodes as $oDepAttribute) - { + foreach ($oDepNodes as $oDepAttribute) { $aDependencies[] = "'".$oDepAttribute->getAttribute('id')."'"; } } @@ -2254,7 +2074,7 @@ EOF $oXMLDoc->save($sTempTargetDir.'/'.$sFileName); $aParameters['definition_file'] = "'".str_replace("'", "\\'", $sFileName)."'"; } - } else if($sAttType == 'AttributeClass'){ + } elseif ($sAttType == 'AttributeClass') { $this->CompileCommonProperty('sql', $oField, $aParameters, $sModuleRelativeDir); $this->CompileCommonProperty('is_null_allowed', $oField, $aParameters, $sModuleRelativeDir, false); $this->CompileCommonProperty('default_value', $oField, $aParameters, $sModuleRelativeDir, ''); @@ -2262,7 +2082,7 @@ EOF $aParameters['class_category'] = $this->GetPropString($oField, 'class_category', ''); $aParameters['more_values'] = $this->GetPropString($oField, 'more_values', ''); $aParameters['depends_on'] = $sDependencies; - }else { + } else { $this->CompileCommonProperty('sql', $oField, $aParameters, $sModuleRelativeDir); $this->CompileCommonProperty('is_null_allowed', $oField, $aParameters, $sModuleRelativeDir, false); $this->CompileCommonProperty('default_value', $oField, $aParameters, $sModuleRelativeDir, ''); @@ -2329,19 +2149,19 @@ EOF break; case 'edit_when': $sEditWhen = $oField->GetChildText('edit_when'); - if(!is_null($sEditWhen)){ + if (!is_null($sEditWhen)) { $aParameters['edit_when'] = $this->EditWhenToPHP($sEditWhen); } break; case 'mappings': $oMappings = $oField->GetUniqueElement('mappings'); $oMappingNodes = $oMappings->getElementsByTagName('mapping'); - $aMapping = array(); + $aMapping = []; foreach ($oMappingNodes as $oMapping) { $sMappingId = $oMapping->getAttribute('id'); $sMappingAttCode = $oMapping->GetChildText('attcode'); $aMapping[$sMappingId]['attcode'] = $sMappingAttCode; - $aMapping[$sMappingId]['values'] = array(); + $aMapping[$sMappingId]['values'] = []; $oMetaValues = $oMapping->GetUniqueElement('metavalues'); foreach ($oMetaValues->getElementsByTagName('metavalue') as $oMetaValue) { $sMetaValue = $oMetaValue->getAttribute('id'); @@ -2365,7 +2185,7 @@ EOF case 'states': $oStates = $oField->GetUniqueElement('states'); $oStateNodes = $oStates->getElementsByTagName('state'); - $aStates = array(); + $aStates = []; foreach ($oStateNodes as $oState) { $aStates[] = '"'.$oState->GetAttribute('id').'"'; } @@ -2374,7 +2194,7 @@ EOF case 'thresholds': $oThresholds = $oField->GetUniqueElement('thresholds'); $oThresholdNodes = $oThresholds->getElementsByTagName('threshold'); - $aThresholds = array(); + $aThresholds = []; foreach ($oThresholdNodes as $oThreshold) { $iPercent = (int)$oThreshold->getAttribute('id'); @@ -2388,10 +2208,10 @@ EOF $oActions = $oThreshold->GetUniqueElement('actions'); $oActionNodes = $oActions->getElementsByTagName('action'); - $aActions = array(); + $aActions = []; foreach ($oActionNodes as $oAction) { $oParams = $oAction->GetOptionalElement('params'); - $aActionParams = array(); + $aActionParams = []; if ($oParams) { $oParamNodes = $oParams->getElementsByTagName('param'); foreach ($oParamNodes as $oParam) { @@ -2525,9 +2345,9 @@ EOF $sCode = $this->GetMandatoryPropString($oValue, 'code', false); $sRankAsString = $this->GetPropNumber($oValue, 'rank'); // Consider value as ranked only if it is the desired sort type, this is to avoid issues if a node is left when sort type isn't "rank" - if (utils::IsNotNullOrEmptyString($sRankAsString) && ($sSortType === static::ENUM_ATTRIBUTE_ENUM_SORT_TYPE_RANK)){ + if (utils::IsNotNullOrEmptyString($sRankAsString) && ($sSortType === static::ENUM_ATTRIBUTE_ENUM_SORT_TYPE_RANK)) { $aValuesWithRank[$sCode] = (float) $sRankAsString; - } else { + } else { $aValuesWithoutRank[$sCode] = true; } @@ -2556,6 +2376,7 @@ EOF // Default language (fallback -eg. english- if no dict entry for the current language -eg. italian-) can change at anytime in the configuration file -eg. from english to french- // if that was to happen, users would not understand why they have labels from in english instead of french, which would cause support questions / investigations. $sLocalizedSortAsPHPParam = ', true'; + // no break default: // Sort values by their code ksort($aValuesWithoutRank); @@ -2732,10 +2553,10 @@ CSS; // - Convert SCSS variable to CSS variable use as SCSS variable cannot be used elsewhere than during SCSS compiling // Note: We check the $sXXXColorForCSS instead of the $sXXXColorForOrm because its value has been altered. if ($bHasMainColor && (stripos($sMainColorForCss, '$') === 0)) { - $sMainColorForOrm = "'var($sMainColorCssVariableName)'"; + $sMainColorForOrm = "'var($sMainColorCssVariableName)'"; } if ($bHasComplementaryColor && (stripos($sComplementaryColorForCss, '$') === 0)) { - $sComplementaryColorForOrm = "'var($sComplementaryColorCssVariableName)'"; + $sComplementaryColorForOrm = "'var($sComplementaryColorCssVariableName)'"; } $aData['orm_style_instantiation'] = "$sOrmStylePrefix new ormStyle($sCssRegularClassForOrm, $sCssAlternativeClassForOrm, $sMainColorForOrm, $sComplementaryColorForOrm, $sDecorationClasses, $sIconRelPath)"; @@ -2749,7 +2570,6 @@ CSS; return 'TagSetFieldDataFor_'.$sTagSuffix; } - /** * @param \MFElement $oMenu * @param string $sTempTargetDir @@ -2769,136 +2589,118 @@ CSS; $sMenuClass = $oMenu->getAttribute("xsi:type"); $sParent = $oMenu->GetChildText('parent', null); - if ($sParent) - { + if ($sParent) { $sParentSpec = "\$__comp_menus__['$sParent']->GetIndex()"; - } - else - { + } else { $sParentSpec = '-1'; } $fRank = (float) $oMenu->GetChildText('rank'); - if ($sEnableClass = $oMenu->GetChildText('enable_class')) - { + if ($sEnableClass = $oMenu->GetChildText('enable_class')) { $sEnableAction = $oMenu->GetChildText('enable_action', 'UR_ACTION_MODIFY'); $sEnablePermission = $oMenu->GetChildText('enable_permission', 'UR_ALLOWED_YES'); $sEnableStimulus = $oMenu->GetChildText('enable_stimulus'); - if ($sEnableStimulus != null) - { + if ($sEnableStimulus != null) { $sOptionalEnableParams = ", '$sEnableClass', $sEnableAction, $sEnablePermission, '$sEnableStimulus'"; - } - else - { + } else { $sOptionalEnableParams = ", '$sEnableClass', $sEnableAction, $sEnablePermission, null"; } - } - else - { + } else { $sOptionalEnableParams = ", null, UR_ACTION_MODIFY, UR_ALLOWED_YES, null"; } - switch($sMenuClass) - { - case 'WebPageMenuNode': - $sUrl = $oMenu->GetChildText('url'); - $sUrlSpec = $this->PathToPHP($sUrl, $sModuleRelativeDir, true /* Url */); - $bIsLinkInNewWindow = $this->GetPropBooleanConverted($oMenu, 'in_new_window', false); - if ($bIsLinkInNewWindow) - { - $sOptionalEnableParams .= ', true'; - } - $sNewMenu = "new WebPageMenuNode('$sMenuId', $sUrlSpec, $sParentSpec, $fRank {$sOptionalEnableParams});"; - break; + switch ($sMenuClass) { + case 'WebPageMenuNode': + $sUrl = $oMenu->GetChildText('url'); + $sUrlSpec = $this->PathToPHP($sUrl, $sModuleRelativeDir, true /* Url */); + $bIsLinkInNewWindow = $this->GetPropBooleanConverted($oMenu, 'in_new_window', false); + if ($bIsLinkInNewWindow) { + $sOptionalEnableParams .= ', true'; + } + $sNewMenu = "new WebPageMenuNode('$sMenuId', $sUrlSpec, $sParentSpec, $fRank {$sOptionalEnableParams});"; + break; - case 'DashboardMenuNode': - $sTemplateFile = $oMenu->GetChildText('definition_file', ''); - if ($sTemplateFile != '') - { + case 'DashboardMenuNode': + $sTemplateFile = $oMenu->GetChildText('definition_file', ''); + if ($sTemplateFile != '') { + $sTemplateSpec = $this->PathToPHP($sTemplateFile, $sModuleRelativeDir); + } else { + $oDashboardDefinition = $oMenu->GetOptionalElement('definition'); + if ($oDashboardDefinition == null) { + throw(new DOMFormatException('Missing definition for Dashboard menu "'.$sMenuId.'" expecting either a tag "definition_file" or "definition".')); + } + $sFileName = strtolower(str_replace([':', '/', '\\', '*'], '_', $sMenuId)).'_dashboard.xml'; + $sTemplateSpec = $this->PathToPHP($sFileName, $sModuleRelativeDir); + + $oXMLDoc = new DOMDocument('1.0', 'UTF-8'); + $oXMLDoc->formatOutput = true; // indent (must be loaded with option LIBXML_NOBLANKS) + $oXMLDoc->preserveWhiteSpace = true; // otherwise the formatOutput option would have no effect + + $oRootNode = $oXMLDoc->createElement('dashboard'); // make sure that the document is not empty + $oRootNode->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); + $oXMLDoc->appendChild($oRootNode); + foreach ($oDashboardDefinition->childNodes as $oNode) { + $oDefNode = $oXMLDoc->importNode($oNode, true); // layout, cells, etc Nodes and below + $oRootNode->appendChild($oDefNode); + } + $oXMLDoc->save($sTempTargetDir.'/'.$sModuleRelativeDir.'/'.$sFileName); + } + $sNewMenu = "new DashboardMenuNode('$sMenuId', $sTemplateSpec, $sParentSpec, $fRank {$sOptionalEnableParams});"; + break; + + case 'ShortcutContainerMenuNode': + $sNewMenu = "new ShortcutContainerMenuNode('$sMenuId', $sParentSpec, $fRank {$sOptionalEnableParams});"; + break; + + case 'OQLMenuNode': + $sOQL = self::QuoteForPHP($oMenu->GetChildText('oql')); + $bSearch = ($oMenu->GetChildText('do_search') == '1') ? 'true' : 'false'; + $sSearchFormOpenXML = $oMenu->GetChildText('search_form_open'); + switch ($sSearchFormOpenXML) { + case '1': + $sSearchFormOpen = 'true'; + break; + + case '0': + $sSearchFormOpen = 'false'; + break; + + default: + $sSearchFormOpen = 'true'; + } + $sNewMenu = "new OQLMenuNode('$sMenuId', $sOQL, $sParentSpec, $fRank, $bSearch {$sOptionalEnableParams}, $sSearchFormOpen);"; + break; + + case 'NewObjectMenuNode': + $sClass = $oMenu->GetChildText('class'); + $sNewMenu = "new NewObjectMenuNode('$sMenuId', '$sClass', $sParentSpec, $fRank {$sOptionalEnableParams});"; + break; + + case 'SearchMenuNode': + $sClass = $oMenu->GetChildText('class'); + $sNewMenu = "new SearchMenuNode('$sMenuId', '$sClass', $sParentSpec, $fRank, null {$sOptionalEnableParams});"; + break; + + case 'TemplateMenuNode': + $sTemplateFile = $oMenu->GetChildText('template_file'); $sTemplateSpec = $this->PathToPHP($sTemplateFile, $sModuleRelativeDir); - } - else - { - $oDashboardDefinition = $oMenu->GetOptionalElement('definition'); - if ($oDashboardDefinition == null) - { - throw(new DOMFormatException('Missing definition for Dashboard menu "'.$sMenuId.'" expecting either a tag "definition_file" or "definition".')); - } - $sFileName = strtolower(str_replace(array(':', '/', '\\', '*'), '_', $sMenuId)).'_dashboard.xml'; - $sTemplateSpec = $this->PathToPHP($sFileName, $sModuleRelativeDir); - - $oXMLDoc = new DOMDocument('1.0', 'UTF-8'); - $oXMLDoc->formatOutput = true; // indent (must be loaded with option LIBXML_NOBLANKS) - $oXMLDoc->preserveWhiteSpace = true; // otherwise the formatOutput option would have no effect - - $oRootNode = $oXMLDoc->createElement('dashboard'); // make sure that the document is not empty - $oRootNode->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); - $oXMLDoc->appendChild($oRootNode); - foreach ($oDashboardDefinition->childNodes as $oNode) - { - $oDefNode = $oXMLDoc->importNode($oNode, true); // layout, cells, etc Nodes and below - $oRootNode->appendChild($oDefNode); - } - $oXMLDoc->save($sTempTargetDir.'/'.$sModuleRelativeDir.'/'.$sFileName); - } - $sNewMenu = "new DashboardMenuNode('$sMenuId', $sTemplateSpec, $sParentSpec, $fRank {$sOptionalEnableParams});"; - break; - - case 'ShortcutContainerMenuNode': - $sNewMenu = "new ShortcutContainerMenuNode('$sMenuId', $sParentSpec, $fRank {$sOptionalEnableParams});"; - break; - - case 'OQLMenuNode': - $sOQL = self::QuoteForPHP($oMenu->GetChildText('oql')); - $bSearch = ($oMenu->GetChildText('do_search') == '1') ? 'true' : 'false'; - $sSearchFormOpenXML = $oMenu->GetChildText('search_form_open'); - switch($sSearchFormOpenXML) - { - case '1': - $sSearchFormOpen = 'true'; + $sNewMenu = "new TemplateMenuNode('$sMenuId', $sTemplateSpec, $sParentSpec, $fRank {$sOptionalEnableParams});"; break; - - case '0': - $sSearchFormOpen = 'false'; + + case 'MenuGroup': + $oStyleNode = $oMenu->GetOptionalElement('style'); + // Note: We use '' as the default value to ease the MenuGroup::__construct() call as we would have to make a different processing to not put the quotes around the parameter in case of null. + $sDecorationClasses = ($oStyleNode === null) ? '' : $oStyleNode->GetChildText('decoration_classes', ''); + + $sNewMenu = "new MenuGroup('$sMenuId', $fRank, '$sDecorationClasses' {$sOptionalEnableParams});"; break; - - default: - $sSearchFormOpen = 'true'; - } - $sNewMenu = "new OQLMenuNode('$sMenuId', $sOQL, $sParentSpec, $fRank, $bSearch {$sOptionalEnableParams}, $sSearchFormOpen);"; - break; - case 'NewObjectMenuNode': - $sClass = $oMenu->GetChildText('class'); - $sNewMenu = "new NewObjectMenuNode('$sMenuId', '$sClass', $sParentSpec, $fRank {$sOptionalEnableParams});"; - break; - - case 'SearchMenuNode': - $sClass = $oMenu->GetChildText('class'); - $sNewMenu = "new SearchMenuNode('$sMenuId', '$sClass', $sParentSpec, $fRank, null {$sOptionalEnableParams});"; - break; - - case 'TemplateMenuNode': - $sTemplateFile = $oMenu->GetChildText('template_file'); - $sTemplateSpec = $this->PathToPHP($sTemplateFile, $sModuleRelativeDir); - $sNewMenu = "new TemplateMenuNode('$sMenuId', $sTemplateSpec, $sParentSpec, $fRank {$sOptionalEnableParams});"; - break; - - case 'MenuGroup': - $oStyleNode = $oMenu->GetOptionalElement('style'); - // Note: We use '' as the default value to ease the MenuGroup::__construct() call as we would have to make a different processing to not put the quotes around the parameter in case of null. - $sDecorationClasses = ($oStyleNode === null) ? '' : $oStyleNode->GetChildText('decoration_classes', ''); - - $sNewMenu = "new MenuGroup('$sMenuId', $fRank, '$sDecorationClasses' {$sOptionalEnableParams});"; - break; - - default: - $sNewMenu = "new $sMenuClass('$sMenuId', $fRank {$sOptionalEnableParams});"; + default: + $sNewMenu = "new $sMenuClass('$sMenuId', $fRank {$sOptionalEnableParams});"; } - $aPHPMenu = array("\$__comp_menus__['$sMenuId'] = $sNewMenu"); - if ($sAutoReload = $oMenu->GetChildText('auto_reload')) - { + $aPHPMenu = ["\$__comp_menus__['$sMenuId'] = $sNewMenu"]; + if ($sAutoReload = $oMenu->GetChildText('auto_reload')) { $sAutoReload = self::QuoteForPHP($sAutoReload); $aPHPMenu[] = "\$__comp_menus__['$sMenuId']->SetParameters(array('auto_reload' => $sAutoReload));"; } @@ -2910,52 +2712,42 @@ CSS; */ protected function CumulateGrant(&$aGrants, $sKey, $bGrant) { - if (isset($aGrants[$sKey])) - { - if (!$bGrant) - { + if (isset($aGrants[$sKey])) { + if (!$bGrant) { $aGrants[$sKey] = false; } - } - else - { + } else { $aGrants[$sKey] = $bGrant; } } protected function CompileUserRights($oUserRightsNode) { - static $aActionsInShort = array( + static $aActionsInShort = [ 'read' => 'r', 'bulk read' => 'br', 'write' => 'w', 'bulk write' => 'bw', 'delete' => 'd', 'bulk delete' => 'bd', - ); + ]; // Preliminary : create an index so that links will be taken into account implicitely - $aLinkToClasses = array(); + $aLinkToClasses = []; $oClasses = $this->oFactory->ListAllClasses(); - foreach($oClasses as $oClass) - { + foreach ($oClasses as $oClass) { $bIsLink = false; $oProperties = $oClass->GetOptionalElement('properties'); - if ($oProperties) - { + if ($oProperties) { $bIsLink = (bool) $this->GetPropNumber($oProperties, 'is_link', 0); } - if ($bIsLink) - { - foreach($this->oFactory->ListFields($oClass) as $oField) - { + if ($bIsLink) { + foreach ($this->oFactory->ListFields($oClass) as $oField) { $sAttType = $oField->getAttribute('xsi:type'); - - if (($sAttType == 'AttributeExternalKey') || ($sAttType == 'AttributeHierarchicalKey')) - { + + if (($sAttType == 'AttributeExternalKey') || ($sAttType == 'AttributeHierarchicalKey')) { $sOnTargetDel = $oField->GetChildText('on_target_delete'); - if (($sOnTargetDel == 'DEL_AUTO') || ($sOnTargetDel == 'DEL_SILENT') || ($sOnTargetDel == 'DEL_NONE')) - { + if (($sOnTargetDel == 'DEL_AUTO') || ($sOnTargetDel == 'DEL_SILENT') || ($sOnTargetDel == 'DEL_NONE')) { $sTargetClass = $oField->GetChildText('target_class'); $aLinkToClasses[$oClass->getAttribute('id')][] = $sTargetClass; } @@ -2966,17 +2758,15 @@ CSS; // Groups // - $aGroupClasses = array(); + $aGroupClasses = []; $oGroups = $oUserRightsNode->GetUniqueElement('groups'); - foreach($oGroups->getElementsByTagName('group') as $oGroup) - { + foreach ($oGroups->getElementsByTagName('group') as $oGroup) { $sGroupId = $oGroup->getAttribute("id"); - $aClasses = array(); + $aClasses = []; $oClasses = $oGroup->GetUniqueElement('classes'); - foreach($oClasses->getElementsByTagName('class') as $oClass) - { - + foreach ($oClasses->getElementsByTagName('class') as $oClass) { + $sClass = $oClass->getAttribute("id"); $aClasses[] = $sClass; @@ -2989,65 +2779,52 @@ CSS; // Profiles and grants // - $aProfiles = array(); + $aProfiles = []; // Hardcode the administrator profile - $aProfiles[1] = array( + $aProfiles[1] = [ 'name' => 'Administrator', 'description' => 'Has the rights on everything (bypassing any control)', - ); + ]; - $aGrants = array(); + $aGrants = []; $oProfiles = $oUserRightsNode->GetUniqueElement('profiles'); - foreach($oProfiles->getElementsByTagName('profile') as $oProfile) - { + foreach ($oProfiles->getElementsByTagName('profile') as $oProfile) { $iProfile = $oProfile->getAttribute("id"); $sName = $oProfile->GetChildText('name'); $sDescription = $oProfile->GetChildText('description'); $oGroups = $oProfile->GetUniqueElement('groups'); - foreach($oGroups->getElementsByTagName('group') as $oGroup) - { + foreach ($oGroups->getElementsByTagName('group') as $oGroup) { $sGroupId = $oGroup->getAttribute("id"); $oActions = $oGroup->GetUniqueElement('actions'); - foreach($oActions->getElementsByTagName('action') as $oAction) - { + foreach ($oActions->getElementsByTagName('action') as $oAction) { $sAction = $oAction->getAttribute("id"); - if (strpos($sAction, 'action:') === 0) - { + if (strpos($sAction, 'action:') === 0) { $sType = 'action'; $sActionCode = substr($sAction, strlen('action:')); $sActionCode = $aActionsInShort[$sActionCode]; - } - else - { + } else { $sType = 'stimulus'; $sActionCode = substr($sAction, strlen('stimulus:')); } $sGrant = $oAction->GetText(); $bGrant = ($sGrant == 'allow'); - - if ($sGroupId == '*') - { - $aGrantClasses = array('*'); - } - else - { + + if ($sGroupId == '*') { + $aGrantClasses = ['*']; + } else { if (array_key_exists($sGroupId, $aGroupClasses) === false) { SetupLog::Error("Profile \"$sName\" relies on group \"$sGroupId\" but it does not seem to be present in the DM yet (did you forgot a dependency in your module?)"); } $aGrantClasses = $aGroupClasses[$sGroupId]; } - foreach ($aGrantClasses as $sClass) - { - if ($sType == 'stimulus') - { + foreach ($aGrantClasses as $sClass) { + if ($sType == 'stimulus') { $this->CumulateGrant($aGrants, $iProfile.'_'.$sClass.'_s_'.$sActionCode, $bGrant); $this->CumulateGrant($aGrants, $iProfile.'_'.$sClass.'+_s_'.$sActionCode, $bGrant); // subclasses inherit this grant - } - else - { + } else { $this->CumulateGrant($aGrants, $iProfile.'_'.$sClass.'_'.$sActionCode, $bGrant); $this->CumulateGrant($aGrants, $iProfile.'_'.$sClass.'+_'.$sActionCode, $bGrant); // subclasses inherit this grant } @@ -3055,10 +2832,10 @@ CSS; } } - $aProfiles[$iProfile] = array( + $aProfiles[$iProfile] = [ 'name' => $sName, 'description' => $sDescription, - ); + ]; } $sProfiles = var_export($aProfiles, true); @@ -3216,24 +2993,22 @@ class ProfilesConfig } EOF; - return $sPHP; + return $sPHP; } // function CompileUserRights protected function CompileDictionaries($oDictionaries, $sTempTargetDir, $sFinalTargetDir) { - $aLanguages = array(); - foreach($oDictionaries as $oDictionaryNode) - { + $aLanguages = []; + foreach ($oDictionaries as $oDictionaryNode) { $sLang = $oDictionaryNode->getAttribute('id'); $sEnglishLanguageDesc = $oDictionaryNode->GetChildText('english_description'); $sLocalizedLanguageDesc = $oDictionaryNode->GetChildText('localized_description'); - $aLanguages[$sLang] = array('description' => $sEnglishLanguageDesc, 'localized_description' => $sLocalizedLanguageDesc); + $aLanguages[$sLang] = ['description' => $sEnglishLanguageDesc, 'localized_description' => $sLocalizedLanguageDesc]; - $aEntriesPHP = array(); + $aEntriesPHP = []; $oEntries = $oDictionaryNode->GetUniqueElement('entries'); /** @var MFElement $oEntry */ - foreach ($oEntries->getElementsByTagName('entry') as $oEntry) - { + foreach ($oEntries->getElementsByTagName('entry') as $oEntry) { $sStringCode = $oEntry->getAttribute('id'); $sValue = $oEntry->GetText(''); $aEntriesPHP[] = "\t'$sStringCode' => ".self::QuoteForPHP(self::FilterDictString($sValue), true).","; @@ -3266,15 +3041,14 @@ Dict::SetLanguagesList( $sLanguagesDump ); EOF; - + file_put_contents($sLanguagesFile, $sLanguagesFileContent); } protected static function FilterDictString(string $s): string { - if (strpos($s, '~') !== false) - { - return str_replace(array('~~', '~*'), '', $s); + if (strpos($s, '~') !== false) { + return str_replace(['~~', '~*'], '', $s); } return $s; } @@ -3293,17 +3067,14 @@ EOF; protected function CompileFiles($oNode, $sTempTargetDir, $sFinalTargetDir, $sRelativePath) { $oFileRefs = $oNode->GetNodes(".//fileref"); - foreach ($oFileRefs as $oFileRef) - { + foreach ($oFileRefs as $oFileRef) { $sFileId = $oFileRef->getAttribute('ref'); - if ($sFileId !== '') - { + if ($sFileId !== '') { $oNodes = $this->oFactory->GetNodes("/itop_design/files/file[@id='$sFileId']"); - if ($oNodes->length == 0) - { + if ($oNodes->length == 0) { throw new DOMFormatException('Could not find the file with ref '.$sFileId); } - + $sName = $oNodes->item(0)->GetChildText('name'); $sData = base64_decode($oNodes->item(0)->GetChildText('data')); $aPathInfo = pathinfo($sName); @@ -3311,20 +3082,18 @@ EOF; $sFilePath = $sTempTargetDir.'/images/'.$sFile; @mkdir($sTempTargetDir.'/images'); file_put_contents($sFilePath, $sData); - if (!file_exists($sFilePath)) - { + if (!file_exists($sFilePath)) { throw new Exception('Could not write icon file '.$sFilePath); } $oParentNode = $oFileRef->parentNode; $oParentNode->removeChild($oFileRef); - + $oTextNode = $oParentNode->ownerDocument->createTextNode($sRelativePath.'/images/'.$sFile); $oParentNode->appendChild($oTextNode); } } } - /** * @param \MFElement $oBrandingNode * @param string $sTempTargetDir @@ -3339,12 +3108,11 @@ EOF; $sIcon = trim($oBrandingNode->GetChildText($sNodeName) ?? ''); if (strlen($sIcon) > 0) { $sSourceFile = $sTempTargetDir.'/'.$sIcon; - $aIconName=explode(".", $sIcon); - $sIconExtension=$aIconName[count($aIconName)-1]; + $aIconName = explode(".", $sIcon); + $sIconExtension = $aIconName[count($aIconName) - 1]; $sTargetFile = '/branding/'.$sTargetFile.'.'.$sIconExtension; - if (!file_exists($sSourceFile)) - { + if (!file_exists($sSourceFile)) { throw new Exception("Branding $sNodeName: could not find the file $sIcon ($sSourceFile)"); } @@ -3369,17 +3137,16 @@ EOF; // Note: During compilation, we don't have access to "env-xxx", so we have to set several imports paths: // - The CSS directory for the native imports (eg. "../css/css-variables.scss") // - The SCSS from modules - $aImportsPaths = array( + $aImportsPaths = [ APPROOT.'css/', APPROOT.'css/backoffice/main.scss', $sTempTargetDir.'/', - ); + ]; // Build compiled themes folder $sThemesRelDirPath = 'branding/themes/'; $sThemesAbsDirPath = $sTempTargetDir.$sThemesRelDirPath; - if(!is_dir($sThemesAbsDirPath)) - { + if (!is_dir($sThemesAbsDirPath)) { SetupUtils::builddir($sThemesAbsDirPath); } @@ -3392,21 +3159,21 @@ EOF; // Parsing theme from common theme node /** @var \MFElement $oThemesCommonNodes */ $oThemesCommonNodes = $oBrandingNode->GetUniqueElement('themes_common', false); - $aThemesCommonParameters = array( - 'variables' => array(), - 'variable_imports' => array(), - 'utility_imports' => array(), - 'stylesheets' => array(), - ); - - if($oThemesCommonNodes !== null) { + $aThemesCommonParameters = [ + 'variables' => [], + 'variable_imports' => [], + 'utility_imports' => [], + 'stylesheets' => [], + ]; + + if ($oThemesCommonNodes !== null) { /** @var \DOMNodeList $oThemesCommonVariables */ $oThemesCommonVariables = $oThemesCommonNodes->GetNodes('variables/variable'); foreach ($oThemesCommonVariables as $oVariable) { $sVariableId = $oVariable->getAttribute('id'); $aThemesCommonParameters['variables'][$sVariableId] = $oVariable->GetText(); } - + /** @var \DOMNodeList $oThemesCommonImports */ $oThemesCommonImports = $oThemesCommonNodes->GetNodes('imports/import'); foreach ($oThemesCommonImports as $oImport) { @@ -3420,7 +3187,7 @@ EOF; SetupLog::Warning('CompileThemes: Theme common has an import (#'.$sImportId.') without explicit xsi:type, it will be ignored. Check Datamodel XML Reference to fix it.'); } } - + // Stylesheets // - Manually added in the XML /** @var \DOMNodeList $oThemesCommonStylesheets */ @@ -3432,18 +3199,17 @@ EOF; } // Parsing themes from DM - $aThemes = array(); + $aThemes = []; /** @var \DOMNodeList $oThemeNodes */ $oThemeNodes = $oBrandingNode->GetNodes('themes/theme'); - foreach($oThemeNodes as $oTheme) - { + foreach ($oThemeNodes as $oTheme) { $sThemeId = $oTheme->getAttribute('id'); - $aThemeParameters = array( - 'variables' => array(), - 'variable_imports' => array(), - 'utility_imports' => array(), - 'stylesheets' => array(), - ); + $aThemeParameters = [ + 'variables' => [], + 'variable_imports' => [], + 'utility_imports' => [], + 'stylesheets' => [], + ]; /** @var \DOMNodeList $oVariables */ $oVariables = $oTheme->GetNodes('variables/variable'); @@ -3470,8 +3236,7 @@ EOF; // - Manually added in the XML /** @var \DOMNodeList $oStylesheets */ $oStylesheets = $oTheme->GetNodes('stylesheets/stylesheet'); - foreach($oStylesheets as $oStylesheet) - { + foreach ($oStylesheets as $oStylesheet) { $sStylesheetId = $oStylesheet->getAttribute('id'); $aThemeParameters['stylesheets'][$sStylesheetId] = $oStylesheet->GetText(); } @@ -3481,11 +3246,11 @@ EOF; // - Overload default values with module ones foreach ($aThemeParameters as $sThemeParameterName => $aThemeParameter) { - if(array_key_exists($sThemeParameterName, $aThemesCommonParameters)){ + if (array_key_exists($sThemeParameterName, $aThemesCommonParameters)) { $aThemeParameters[$sThemeParameterName] = array_merge($aThemeParameter, $aThemesCommonParameters[$sThemeParameterName]); } } - + $aThemes[$sThemeId] = [ 'theme_parameters' => $aThemeParameters, 'precompiled_stylesheet' => $oTheme->GetChildText('precompiled_stylesheet', ''), @@ -3493,36 +3258,33 @@ EOF; } // Force to have a default theme if none in the DM - if(empty($aThemes)) - { + if (empty($aThemes)) { $aDefaultThemeInfo = ThemeHandler::GetDefaultThemeInformation(); $aDefaultThemeInfo['parameters']['stylesheets'][$sDmStylesheetId] = $sThemesRelDirPath.$sDmStylesheetFilename; $aThemes[$aDefaultThemeInfo['name']] = $aDefaultThemeInfo['parameters']; } - $sPostCompilationPrecompiledThemeFolder = APPROOT . self::DATA_PRECOMPILED_FOLDER; - if (! is_dir($sPostCompilationPrecompiledThemeFolder)){ + $sPostCompilationPrecompiledThemeFolder = APPROOT.self::DATA_PRECOMPILED_FOLDER; + if (! is_dir($sPostCompilationPrecompiledThemeFolder)) { mkdir($sPostCompilationPrecompiledThemeFolder); } // Compile themes $fStart = microtime(true); - foreach($aThemes as $sThemeId => $aThemeInfos) - { + foreach ($aThemes as $sThemeId => $aThemeInfos) { $aThemeParameters = $aThemeInfos['theme_parameters']; $sPrecompiledStylesheet = $aThemeInfos['precompiled_stylesheet']; $sThemeDir = $sThemesAbsDirPath.$sThemeId; - if(!is_dir($sThemeDir)) - { + if (!is_dir($sThemeDir)) { SetupUtils::builddir($sThemeDir); } // Check if a precompiled version of the theme is supplied - $sPostCompilationLatestPrecompiledFile = $sPostCompilationPrecompiledThemeFolder . $sThemeId . ".css"; + $sPostCompilationLatestPrecompiledFile = $sPostCompilationPrecompiledThemeFolder.$sThemeId.".css"; $sPrecompiledFileToUse = $this->UseLatestPrecompiledFile($sTempTargetDir, $sPrecompiledStylesheet, $sPostCompilationLatestPrecompiledFile, $sThemeId); - if ($sPrecompiledFileToUse != null){ + if ($sPrecompiledFileToUse != null) { copy($sPrecompiledFileToUse, $sThemeDir.'/main.css'); // Make sure that the copy of the precompiled file is older than any other files to force a validation of the signature touch($sThemeDir.'/main.css', 1577836800 /* 2020-01-01 00:00:00 */); @@ -3534,7 +3296,7 @@ EOF; $bHasCompiled = static::$oThemeHandlerService->CompileTheme($sThemeId, true, $this->sCompilationTimeStamp, $aThemeParameters, $aImportsPaths, $sTempTargetDir); if ($bHasCompiled) { - if (utils::GetConfig()->Get('theme.enable_precompilation')){ + if (utils::GetConfig()->Get('theme.enable_precompilation')) { /*if (utils::IsDevelopmentEnvironment() && ! empty(trim($sPrecompiledStylesheet))) //N°4438 - Disable (temporary) copy of precompiled stylesheets after setup { //help developers to detect & push theme precompilation changes $sInitialPrecompiledFilePath = null; @@ -3562,10 +3324,11 @@ EOF; SetupLog::Info("No theme '$sThemeId' compilation was required during setup."); } } - $this->Log(sprintf('Themes compilation took: %.3f ms for %d themes.', (microtime(true) - $fStart)*1000.0, count($aThemes))); + $this->Log(sprintf('Themes compilation took: %.3f ms for %d themes.', (microtime(true) - $fStart) * 1000.0, count($aThemes))); } - public static function SetThemeHandlerService(ThemeHandlerService $oThemeHandlerService): void { + public static function SetThemeHandlerService(ThemeHandlerService $oThemeHandlerService): void + { self::$oThemeHandlerService = $oThemeHandlerService; } @@ -3579,35 +3342,36 @@ EOF; * * @return string : file path of latest precompiled file to use for setup */ - public function UseLatestPrecompiledFile(string $sTempTargetDir, string $sPrecompiledFileUri, $sPostCompilationLatestPrecompiledFile, $sThemeId) : ?string { + public function UseLatestPrecompiledFile(string $sTempTargetDir, string $sPrecompiledFileUri, $sPostCompilationLatestPrecompiledFile, $sThemeId): ?string + { if (! utils::GetConfig()->Get('theme.enable_precompilation')) { return null; } $bDataXmlPrecompiledFileExists = false; clearstatcache(); - if (!empty($sPrecompiledFileUri)){ - $sDataXmlProvidedPrecompiledFile = $sTempTargetDir . DIRECTORY_SEPARATOR . $sPrecompiledFileUri; + if (!empty($sPrecompiledFileUri)) { + $sDataXmlProvidedPrecompiledFile = $sTempTargetDir.DIRECTORY_SEPARATOR.$sPrecompiledFileUri; $bDataXmlPrecompiledFileExists = file_exists($sDataXmlProvidedPrecompiledFile) ; - if (!$bDataXmlPrecompiledFileExists){ + if (!$bDataXmlPrecompiledFileExists) { SetupLog::Warning("Missing defined theme '$sThemeId' precompiled file configured with: '$sPrecompiledFileUri'"); } else { - $sSourceDir = APPROOT . utils::GetConfig()->Get('source_dir'); + $sSourceDir = APPROOT.utils::GetConfig()->Get('source_dir'); $aDirToCheck = [ $sSourceDir, - APPROOT . DIRECTORY_SEPARATOR . 'extensions/', + APPROOT.DIRECTORY_SEPARATOR.'extensions/', ]; $iDataXmlFileLastModified = 0; - foreach ($aDirToCheck as $sDir){ - $sCurrentFile = $sDir . DIRECTORY_SEPARATOR . $sPrecompiledFileUri; - if (is_file($sCurrentFile)){ + foreach ($aDirToCheck as $sDir) { + $sCurrentFile = $sDir.DIRECTORY_SEPARATOR.$sPrecompiledFileUri; + if (is_file($sCurrentFile)) { $iDataXmlFileLastModified = max($iDataXmlFileLastModified, @filemtime($sCurrentFile)); } } - if ($iDataXmlFileLastModified == 0){ + if ($iDataXmlFileLastModified == 0) { SetupLog::Warning("Missing defined theme '$sThemeId' precompiled file in datamodels/X.x or extensions directory configured with: '$sPrecompiledFileUri'. That should not happen!"); $bDataXmlPrecompiledFileExists = false; } @@ -3617,17 +3381,17 @@ EOF; $bPostCompilationPrecompiledFileExists = file_exists($sPostCompilationLatestPrecompiledFile); - if (!$bDataXmlPrecompiledFileExists && !$bPostCompilationPrecompiledFileExists){ + if (!$bDataXmlPrecompiledFileExists && !$bPostCompilationPrecompiledFileExists) { return null; } - if (!$bDataXmlPrecompiledFileExists){ + if (!$bDataXmlPrecompiledFileExists) { $sPrecompiledFileToUse = $sPostCompilationLatestPrecompiledFile; - } else if (!$bPostCompilationPrecompiledFileExists){ + } elseif (!$bPostCompilationPrecompiledFileExists) { $sPrecompiledFileToUse = $sDataXmlProvidedPrecompiledFile; - } else{ + } else { $iPostCompilationFileLastModified = @filemtime($sPostCompilationLatestPrecompiledFile); - SetupLog::Debug("Theme '$sThemeId' check mtime between data XML file " . $iDataXmlFileLastModified . " and latest postcompilation file: " . $iPostCompilationFileLastModified); + SetupLog::Debug("Theme '$sThemeId' check mtime between data XML file ".$iDataXmlFileLastModified." and latest postcompilation file: ".$iPostCompilationFileLastModified); $sPrecompiledFileToUse = $iDataXmlFileLastModified > $iPostCompilationFileLastModified ? $sDataXmlProvidedPrecompiledFile : $sPostCompilationLatestPrecompiledFile; } @@ -3648,21 +3412,20 @@ EOF; { // Enable relative paths SetupUtils::builddir($sTempTargetDir.'/branding'); - if ($oBrandingNode) - { + if ($oBrandingNode) { // Transform file refs into files in the images folder $this->CompileFiles($oBrandingNode, $sTempTargetDir.'/branding', $sFinalTargetDir.'/branding', 'branding'); $aDataBranding = []; - $aLogosToCompile = [ - ['sNodeName' => 'login_logo', 'sTargetFile' => 'login-logo', 'sType' => Branding::ENUM_LOGO_TYPE_LOGIN_LOGO], - ['sNodeName' => 'main_logo', 'sTargetFile' => 'main-logo-full', 'sType' => Branding::ENUM_LOGO_TYPE_MAIN_LOGO_FULL], - ['sNodeName' => 'main_logo_compact', 'sTargetFile' => 'main-logo-compact', 'sType' => Branding::ENUM_LOGO_TYPE_MAIN_LOGO_COMPACT], - ['sNodeName' => 'portal_logo', 'sTargetFile' => 'portal-logo', 'sType' => Branding::ENUM_LOGO_TYPE_PORTAL_LOGO], - ['sNodeName' => 'login_favicon', 'sTargetFile' => 'login_favicon', 'sType' => Branding::ENUM_LOGO_TYPE_LOGIN_FAVICON], - ['sNodeName' => 'main_favicon', 'sTargetFile' => 'main_favicon', 'sType' => Branding::ENUM_LOGO_TYPE_MAIN_FAVICON], - ['sNodeName' => 'portal_favicon', 'sTargetFile' => 'portal_favicon', 'sType' => Branding::ENUM_LOGO_TYPE_PORTAL_FAVICON], - ]; + $aLogosToCompile = [ + ['sNodeName' => 'login_logo', 'sTargetFile' => 'login-logo', 'sType' => Branding::ENUM_LOGO_TYPE_LOGIN_LOGO], + ['sNodeName' => 'main_logo', 'sTargetFile' => 'main-logo-full', 'sType' => Branding::ENUM_LOGO_TYPE_MAIN_LOGO_FULL], + ['sNodeName' => 'main_logo_compact', 'sTargetFile' => 'main-logo-compact', 'sType' => Branding::ENUM_LOGO_TYPE_MAIN_LOGO_COMPACT], + ['sNodeName' => 'portal_logo', 'sTargetFile' => 'portal-logo', 'sType' => Branding::ENUM_LOGO_TYPE_PORTAL_LOGO], + ['sNodeName' => 'login_favicon', 'sTargetFile' => 'login_favicon', 'sType' => Branding::ENUM_LOGO_TYPE_LOGIN_FAVICON], + ['sNodeName' => 'main_favicon', 'sTargetFile' => 'main_favicon', 'sType' => Branding::ENUM_LOGO_TYPE_MAIN_FAVICON], + ['sNodeName' => 'portal_favicon', 'sTargetFile' => 'portal_favicon', 'sType' => Branding::ENUM_LOGO_TYPE_PORTAL_FAVICON], + ]; foreach ($aLogosToCompile as $aLogo) { $sLogo = $this->CompileLogo($oBrandingNode, $sTempTargetDir, $sFinalTargetDir, $aLogo['sNodeName'], $aLogo['sTargetFile']); if ($sLogo != null) { @@ -3678,12 +3441,11 @@ EOF; file_put_contents($sWorkingPath.'/branding/logos.json', json_encode($aDataBranding)); // Cleanup the images directory (eventually made by CompileFiles) - if (file_exists($sTempTargetDir.'/branding/images')) - { + if (file_exists($sTempTargetDir.'/branding/images')) { SetupUtils::rrmdir($sTempTargetDir.'/branding/images'); } - // Compile themes + // Compile themes $this->CompileThemes($oBrandingNode, $sTempTargetDir); } } @@ -3695,40 +3457,34 @@ EOF; */ protected function CompilePortals($oPortalsNode, $sTempTargetDir, $sFinalTargetDir) { - if ($oPortalsNode) - { + if ($oPortalsNode) { // Create some static PHP data in /core/main.php $oPortals = $oPortalsNode->GetNodes('portal'); - $aPortalsConfig = array(); - foreach($oPortals as $oPortal) - { + $aPortalsConfig = []; + foreach ($oPortals as $oPortal) { $sPortalId = $oPortal->getAttribute('id'); - $aPortalsConfig[$sPortalId] = array(); + $aPortalsConfig[$sPortalId] = []; $aPortalsConfig[$sPortalId]['rank'] = (float)$oPortal->GetChildText('rank', 0); $aPortalsConfig[$sPortalId]['handler'] = $oPortal->GetChildText('handler', 'PortalDispatcher'); $aPortalsConfig[$sPortalId]['url'] = $oPortal->GetChildText('url', 'portal/index.php'); $oAllow = $oPortal->GetOptionalElement('allow'); - $aPortalsConfig[$sPortalId]['allow'] = array(); - if ($oAllow) - { - foreach($oAllow->GetNodes('profile') as $oProfile) - { + $aPortalsConfig[$sPortalId]['allow'] = []; + if ($oAllow) { + foreach ($oAllow->GetNodes('profile') as $oProfile) { $aPortalsConfig[$sPortalId]['allow'][] = $oProfile->getAttribute('id'); } } $oDeny = $oPortal->GetOptionalElement('deny'); - $aPortalsConfig[$sPortalId]['deny'] = array(); - if ($oDeny) - { - foreach($oDeny->GetNodes('profile') as $oProfile) - { + $aPortalsConfig[$sPortalId]['deny'] = []; + if ($oDeny) { + foreach ($oDeny->GetNodes('profile') as $oProfile) { $aPortalsConfig[$sPortalId]['deny'][] = $oProfile->getAttribute('id'); } - } + } } - - uasort($aPortalsConfig, array(get_class($this), 'SortOnRank')); - + + uasort($aPortalsConfig, [get_class($this), 'SortOnRank']); + $this->sMainPHPCode .= "\n"; $this->sMainPHPCode .= "/**\n"; $this->sMainPHPCode .= " * Portal(s) definition(s) extracted from the XML definition at compile time\n"; @@ -3760,18 +3516,16 @@ EOF; */ protected function CompileParameters($oParametersNode, $sTempTargetDir, $sFinalTargetDir) { - if ($oParametersNode) - { + if ($oParametersNode) { // Create some static PHP data in /core/main.php $oParameters = $oParametersNode->GetNodes('parameters'); - $aParametersConfig = array(); - foreach($oParameters as $oParams) - { + $aParametersConfig = []; + foreach ($oParameters as $oParams) { $sModuleId = $oParams->getAttribute('id'); $oParamsReader = new MFParameters($oParams); $aParametersConfig[$sModuleId] = $oParamsReader->GetAll(); } - + $this->sMainPHPCode .= "\n"; $this->sMainPHPCode .= "/**\n"; $this->sMainPHPCode .= " * Modules parameters extracted from the XML definition at compile time\n"; @@ -3799,12 +3553,10 @@ EOF; */ protected function CompileModuleDesigns($oDesigns, $sTempTargetDir, $sFinalTargetDir) { - if ($oDesigns) - { + if ($oDesigns) { SetupUtils::builddir($sTempTargetDir.'/core/module_designs/images'); $this->CompileFiles($oDesigns, $sTempTargetDir.'/core/module_designs', $sFinalTargetDir.'/core/module_designs', 'core/module_designs'); - foreach ($oDesigns->GetNodes('module_design') as $oDesign) - { + foreach ($oDesigns->GetNodes('module_design') as $oDesign) { $oDoc = new ModuleDesign(); $oClone = $oDoc->importNode($oDesign->cloneNode(true), true); $oDoc->appendChild($oClone); @@ -3819,58 +3571,44 @@ EOF; protected function LoadSnippets() { $oSnippets = $this->oFactory->GetNodes('/itop_design/snippets/snippet'); - foreach($oSnippets as $oSnippet) - { + foreach ($oSnippets as $oSnippet) { $sSnippetId = $oSnippet->getAttribute('id'); $sPlacement = $oSnippet->GetChildText('placement', null); - if ($sPlacement == 'core') - { + if ($sPlacement == 'core') { $sModuleId = '_core_'; - } - else if ($sPlacement == 'module') - { + } elseif ($sPlacement == 'module') { $sModuleId = $oSnippet->GetChildText('module', null); - if ($sModuleId == null) - { + if ($sModuleId == null) { throw new DOMFormatException("Invalid definition for snippet id='$sSnippetId' with placement=module. Missing '' tag."); } - } - else if ($sPlacement === 'null') - { + } elseif ($sPlacement === 'null') { throw new DOMFormatException("Invalid definition for snippet id='$sSnippetId'. Missing tag."); - } - else - { + } else { throw new DOMFormatException("Invalid definition for snippet id='$sSnippetId'. Incorrect value '$sPlacement' for tag. The allowed values are either 'core' or 'module'."); } - if (!array_key_exists($sModuleId, $this->aSnippets)) - { - $this->aSnippets[$sModuleId] = array('before' => array(), 'after' => array()); + if (!array_key_exists($sModuleId, $this->aSnippets)) { + $this->aSnippets[$sModuleId] = ['before' => [], 'after' => []]; } $fOrder = (float) $oSnippet->GetChildText('rank', 0); $sContent = $oSnippet->GetChildText('content', ''); - if ($fOrder < 0) - { - $this->aSnippets[$sModuleId]['before'][] = array( + if ($fOrder < 0) { + $this->aSnippets[$sModuleId]['before'][] = [ 'rank' => $fOrder, 'content' => $sContent, 'snippet_id' => $sSnippetId, - ); - } - else - { - $this->aSnippets[$sModuleId]['after'][] = array( + ]; + } else { + $this->aSnippets[$sModuleId]['after'][] = [ 'rank' => $fOrder, 'content' => $sContent, 'snippet_id' => $sSnippetId, - ); + ]; } } - foreach($this->aSnippets as $sModuleId => $void) - { - uasort($this->aSnippets[$sModuleId]['before'], array(get_class($this), 'SortOnRank')); - uasort($this->aSnippets[$sModuleId]['after'], array(get_class($this), 'SortOnRank')); + foreach ($this->aSnippets as $sModuleId => $void) { + uasort($this->aSnippets[$sModuleId]['before'], [get_class($this), 'SortOnRank']); + uasort($this->aSnippets[$sModuleId]['after'], [get_class($this), 'SortOnRank']); } } @@ -3922,14 +3660,14 @@ EOF; $sContext = '["'.implode('", "', $aContexts).'"]'; } - $aEventListeners[] = array( + $aEventListeners[] = [ 'event_name' => $sEventName, 'callback' => $sCallback, 'content' => $sCallbackFct, 'rank' => $fRank, 'source' => $sEventSource, 'context' => $sContext, - ); + ]; } if (empty($aEventListeners)) { @@ -3960,13 +3698,13 @@ $sRegister PHP; $fOrder = 0; - $this->aSnippets[$sModuleId]['after'][] = array( + $this->aSnippets[$sModuleId]['after'][] = [ 'rank' => $fOrder, 'content' => $sContent, 'snippet_id' => $sClassName, - ); + ]; foreach ($this->aSnippets as $sModuleId => $void) { - uasort($this->aSnippets[$sModuleId]['after'], array(get_class($this), 'SortOnRank')); + uasort($this->aSnippets[$sModuleId]['after'], [get_class($this), 'SortOnRank']); } } @@ -4001,7 +3739,6 @@ PHP; return $aDefinition; } - /** * @throws \DOMFormatException * @since 3.1.0 N°6040 @@ -4068,7 +3805,6 @@ PHP; return $this->aDynamicAttributeDefinitions[$sAttributeName]['properties']; } - /** * We can't use var_export() as we need to output some PHP code, for example `utils::GetAbsoluteUrlModulesRoot()` calls * @@ -4078,9 +3814,8 @@ PHP; */ private function GetAssociativeArrayAsPhpCode($aAssocArray) { - $aArrayPhp = array(); - foreach ($aAssocArray as $sKey => $sPHPValue) - { + $aArrayPhp = []; + foreach ($aAssocArray as $sKey => $sPHPValue) { $aArrayPhp[] = " '$sKey' => $sPHPValue,"; } $sArrayPhp = implode("\n", $aArrayPhp); @@ -4113,17 +3848,13 @@ PHP; ) { $sPHP = "\n\n$sCodeComment\n"; - foreach ($aRequiredFiles as $sIncludeFile) - { + foreach ($aRequiredFiles as $sIncludeFile) { $sPHP .= "\nrequire_once('$sIncludeFile');\n"; } - if ($bIsAbstractClass) - { + if ($bIsAbstractClass) { $sPHP .= 'abstract class '.$sClassName; - } - else - { + } else { $sPHP .= 'class '.$sClassName; } $sPHP .= " extends $sParentClassName\n"; @@ -4155,8 +3886,8 @@ EOF; private function GeneratePhpCodeForZlist(string $sListCode, DOMNode $oListNode): string { $aAttributes = $oListNode->GetNodeAsArrayOfItems(); - if(!is_array($aAttributes)) { - $aAttributes = array(); + if (!is_array($aAttributes)) { + $aAttributes = []; } $this->ArrayOfItemsToZList($aAttributes); @@ -4185,13 +3916,11 @@ EOF; */ protected function WriteFile($sFilename, $sContent, $flags = null) { - if (is_file($sFilename) || is_link($sFilename)) - { + if (is_file($sFilename) || is_link($sFilename)) { @unlink($sFilename); } $ret = file_put_contents($sFilename, $sContent, $flags ?? 0); - if ($ret === false) - { + if ($ret === false) { $iLen = strlen($sContent); $fFree = @disk_free_space(dirname($sFilename)); $aErr = error_get_last(); @@ -4305,15 +4034,11 @@ XML; */ protected function WritePHPFile($sResultFile, $sModuleName, $sModuleVersion, $sCompiledCode) { - if (is_file($sResultFile)) - { + if (is_file($sResultFile)) { $this->Log("Updating $sResultFile for module $sModuleName in version $sModuleVersion"); - } - else - { + } else { $sResultDir = dirname($sResultFile); - if (!is_dir($sResultDir)) - { + if (!is_dir($sResultDir)) { $this->Log("Creating directory $sResultDir"); mkdir($sResultDir, 0777, true); } @@ -4346,8 +4071,7 @@ EOF; private static function RemoveSurroundingQuotes($sValue) { - if (utils::StartsWith($sValue, '\'') && utils::EndsWith($sValue, '\'')) - { + if (utils::StartsWith($sValue, '\'') && utils::EndsWith($sValue, '\'')) { $sValue = substr($sValue, 1, -1); } diff --git a/setup/email.test.php b/setup/email.test.php index 75b68ba93..184a2124a 100644 --- a/setup/email.test.php +++ b/setup/email.test.php @@ -1,4 +1,5 @@ add_http_headers('DENY'); - /** * Helper to check server setting required to send an email */ @@ -48,85 +48,64 @@ function CheckEmailSetting($oP) { $bRet = true; - if (function_exists('php_ini_loaded_file')) // PHP >= 5.2.4 - { + if (function_exists('php_ini_loaded_file')) { // PHP >= 5.2.4 $sPhpIniFile = php_ini_loaded_file(); - } - else - { + } else { $sPhpIniFile = 'php.ini'; } $sTransport = MetaModel::GetConfig()->Get('email_transport'); - switch($sTransport) - { + switch ($sTransport) { case 'PHPMail': - $oP->info("iTop is configured to use PHP's mail function to send emails."); - $bIsWindows = (array_key_exists('WINDIR', $_SERVER) || array_key_exists('windir', $_SERVER)); - if ($bIsWindows) - { - $sSmtpServer = ini_get('SMTP'); - if (empty($sSmtpServer)) - { - $oP->error("The SMTP server is not defined. Please add the 'SMTP' directive into $sPhpIniFile"); - $bRet = false; + $oP->info("iTop is configured to use PHP's mail function to send emails."); + $bIsWindows = (array_key_exists('WINDIR', $_SERVER) || array_key_exists('windir', $_SERVER)); + if ($bIsWindows) { + $sSmtpServer = ini_get('SMTP'); + if (empty($sSmtpServer)) { + $oP->error("The SMTP server is not defined. Please add the 'SMTP' directive into $sPhpIniFile"); + $bRet = false; + } elseif (strcasecmp($sSmtpServer, 'localhost') == 0) { + $oP->warning("Your SMTP server is configured to 'localhost'. You might want to set or change the 'SMTP' directive into $sPhpIniFile"); + } else { + $oP->info("Your SMTP server: $sSmtpServer. To change this value, modify the 'SMTP' directive into $sPhpIniFile"); + } + + $iSmtpPort = (int) ini_get('smtp_port'); + if (empty($iSmtpPort)) { + $oP->info("The SMTP port is not defined. Please add the 'smtp_port' directive into $sPhpIniFile"); + $bRet = false; + } elseif ($iSmtpPort == 25) { + $oP->info("Your SMTP port is configured to the default value: 25. You might want to set or change the 'smtp_port' directive into $sPhpIniFile"); + } else { + $oP->info("Your SMTP port is configured to $iSmtpPort. You might want to set or change the 'smtp_port' directive into $sPhpIniFile"); + } + } else { + // Not a windows system + $sSendMail = ini_get('sendmail_path'); + if (empty($sSendMail)) { + $oP->error("The command to send mail is not defined. Please add the 'sendmail_path' directive into $sPhpIniFile. A recommended setting is sendmail_path=sendmail -t -i"); + $bRet = false; + } else { + $oP->info("The command to send mail is: $sSendMail. To change this value, modify the 'sendmail_path' directive into $sPhpIniFile"); + } } - else if (strcasecmp($sSmtpServer, 'localhost') == 0) - { - $oP->warning("Your SMTP server is configured to 'localhost'. You might want to set or change the 'SMTP' directive into $sPhpIniFile"); - } - else - { - $oP->info("Your SMTP server: $sSmtpServer. To change this value, modify the 'SMTP' directive into $sPhpIniFile"); - } - - $iSmtpPort = (int) ini_get('smtp_port'); - if (empty($iSmtpPort)) - { - $oP->info("The SMTP port is not defined. Please add the 'smtp_port' directive into $sPhpIniFile"); - $bRet = false; - } - else if ($iSmtpPort == 25) - { - $oP->info("Your SMTP port is configured to the default value: 25. You might want to set or change the 'smtp_port' directive into $sPhpIniFile"); - } - else - { - $oP->info("Your SMTP port is configured to $iSmtpPort. You might want to set or change the 'smtp_port' directive into $sPhpIniFile"); - } - } - else - { - // Not a windows system - $sSendMail = ini_get('sendmail_path'); - if (empty($sSendMail)) - { - $oP->error("The command to send mail is not defined. Please add the 'sendmail_path' directive into $sPhpIniFile. A recommended setting is sendmail_path=sendmail -t -i"); - $bRet = false; - } - else - { - $oP->info("The command to send mail is: $sSendMail. To change this value, modify the 'sendmail_path' directive into $sPhpIniFile"); - } - } - break; + break; case 'SMTP': - $oP->info("iTop is configured to use the $sTransport transport."); - $sHost = MetaModel::GetConfig()->Get('email_transport_smtp.host'); - $sPort = MetaModel::GetConfig()->Get('email_transport_smtp.port'); - $sEncryption = MetaModel::GetConfig()->Get('email_transport_smtp.encryption'); - $sDisplayEncryption = empty($sEncryption) ? 'no encryption ' : $sEncryption; - $sUserName = MetaModel::GetConfig()->Get('email_transport_smtp.username'); - $sDisplayUserName = empty($sUserName) ? 'no user ' : $sUserName; - $sPassword = MetaModel::GetConfig()->Get('email_transport_smtp.password'); - $sDisplayPassword = empty($sPassword) ? 'no password ' : str_repeat('*', strlen($sPassword)); - $oP->info("SMTP configuration (from config-itop.php): host: $sHost, port: $sPort, user: $sDisplayUserName, password: $sDisplayPassword, encryption: $sDisplayEncryption."); - if (($sHost == 'localhost') && ($sPort == '25') && ($sUserName == '') && ($sPassword == '') ) - { - $oP->warning("The default settings may not be suitable for your environment. You may want to adjust these values by editing iTop's configuration file (".utils::GetConfigFilePathRelative().")."); - } - break; + $oP->info("iTop is configured to use the $sTransport transport."); + $sHost = MetaModel::GetConfig()->Get('email_transport_smtp.host'); + $sPort = MetaModel::GetConfig()->Get('email_transport_smtp.port'); + $sEncryption = MetaModel::GetConfig()->Get('email_transport_smtp.encryption'); + $sDisplayEncryption = empty($sEncryption) ? 'no encryption ' : $sEncryption; + $sUserName = MetaModel::GetConfig()->Get('email_transport_smtp.username'); + $sDisplayUserName = empty($sUserName) ? 'no user ' : $sUserName; + $sPassword = MetaModel::GetConfig()->Get('email_transport_smtp.password'); + $sDisplayPassword = empty($sPassword) ? 'no password ' : str_repeat('*', strlen($sPassword)); + $oP->info("SMTP configuration (from config-itop.php): host: $sHost, port: $sPort, user: $sDisplayUserName, password: $sDisplayPassword, encryption: $sDisplayEncryption."); + if (($sHost == 'localhost') && ($sPort == '25') && ($sUserName == '') && ($sPassword == '')) { + $oP->warning("The default settings may not be suitable for your environment. You may want to adjust these values by editing iTop's configuration file (".utils::GetConfigFilePathRelative().")."); + } + break; case 'SMTP_OAuth': $oP->info("iTop is configured to use the $sTransport transport."); @@ -153,63 +132,58 @@ function CheckEmailSetting($oP) } break; - case 'Null': - $oP->warning("iTop is configured to use the Null transport: emails sending will have no effect."); - $bRet = false; - break; - + $oP->warning("iTop is configured to use the Null transport: emails sending will have no effect."); + $bRet = false; + break; + case 'LogFile': - $oP->warning("iTop is configured to use the LogFile transport: emails will not be sent but logged to the file: 'log/mail.log'."); - $bRet = true; - break; - + $oP->warning("iTop is configured to use the LogFile transport: emails will not be sent but logged to the file: 'log/mail.log'."); + $bRet = true; + break; + default: - $oP->error("Unknown transport '$sTransport' configured."); - $bRet = false; + $oP->error("Unknown transport '$sTransport' configured."); + $bRet = false; } - if ($bRet) - { + if ($bRet) { $oP->ok("PHP settings are ok to proceed with a test of the email"); } $bConfigAsync = MetaModel::GetConfig()->Get('email_asynchronous'); - if ($bConfigAsync) - { + if ($bConfigAsync) { $oP->warning("iTop is configured to send emails asynchronously. Make sure that cron.php is scheduled to run in the background, otherwise regular emails will not be sent. For the purpose of this test, the email will be sent synchronously."); } - + return $bRet; } - /** * Display the form for the first step of the test wizard * which consists in a basic check of the configuration and display of a form for testing - */ + */ function DisplayStep1(SetupPage $oP) { $sNextOperation = 'step2'; $oP->add("

      iTop email test

      \n"); $oP->add("

      Checking prerequisites

      \n"); - if (CheckEmailSetting($oP)) - { + if (CheckEmailSetting($oP)) { $sRedStar = '*'; $oP->add("

      Try to send an email

      \n"); $oP->add("
      \n"); // Form goes here $oP->add("
      Test recipient\n"); - $aForm = array(); - $aForm[] = array( + $aForm = []; + $aForm[] = [ 'label' => "To$sRedStar:", 'input' => "", 'help' => ' email address (e.g. john.foo@worldcompany.com)', - ); + ]; $sDefaultFrom = MetaModel::GetConfig()->Get('email_transport_smtp.username'); - $aForm[] = array( + $aForm[] = [ 'label' => "From:", 'input' => "", 'help' => ' defaults to the configuration param "email_default_sender_address" or "To" field.', - ); + ]; $oP->form($aForm); $oP->add("
      \n"); $oP->add("\n"); @@ -225,7 +199,7 @@ function DisplayStep1(SetupPage $oP) /** * Display the form for the second step of the configuration wizard * which consists in sending an email, which maybe a problem under Windows - */ + */ function DisplayStep2(SetupPage $oP, $sFrom, $sTo) { //$sNextOperation = 'step3'; @@ -240,16 +214,12 @@ function DisplayStep2(SetupPage $oP, $sFrom, $sTo) $oEmail->SetSubject("Test iTop"); $oEmail->SetBody("

      Hello,

      The email function is now working fine.

      You may now be able to use the notification function.

      iTop

      "); $iRes = $oEmail->Send($aIssues, true /* force synchronous exec */); - switch ($iRes) - { + switch ($iRes) { case EMAIL_SEND_OK: $sTransport = MetaModel::GetConfig()->Get('email_transport'); - if ($sTransport == 'LogFile') - { + if ($sTransport == 'LogFile') { $oP->ok("The email has been logged into the file ".APPROOT."/log/mail.log."); - } - else - { + } else { $oP->ok("The email has been sent, check your inbox for the incoming mail..."); } $oP->add("\n"); @@ -261,8 +231,7 @@ function DisplayStep2(SetupPage $oP, $sFrom, $sTo) break; case EMAIL_SEND_ERROR: - foreach ($aIssues as $sError) - { + foreach ($aIssues as $sError) { $oP->error(htmlentities($sError, ENT_QUOTES, 'utf-8')); } $oP->add("\n"); @@ -279,15 +248,12 @@ function DisplayStep2(SetupPage $oP, $sFrom, $sTo) // generate a notice date_default_timezone_set('Europe/Paris'); - -try -{ - switch($sOperation) - { +try { + switch ($sOperation) { case 'step1': - DisplayStep1($oP); - break; - + DisplayStep1($oP); + break; + case 'step2': $oP->no_cache(); $sTo = Utils::ReadParam('to', '', false, 'raw_data'); @@ -296,17 +262,12 @@ try break; default: - $oP->error("Error: unsupported operation '$sOperation'"); - + $oP->error("Error: unsupported operation '$sOperation'"); + } -} -catch(Exception $e) -{ +} catch (Exception $e) { $oP->error("Error: '".htmlentities($e->getMessage(), ENT_QUOTES, 'utf-8')."'"); -} -catch(CoreException $e) -{ - $oP->error("Error: '".$e->getHtmlDesc()."'"); +} catch (CoreException $e) { + $oP->error("Error: '".$e->getHtmlDesc()."'"); } $oP->output(); - diff --git a/setup/extensionsmap.class.inc.php b/setup/extensionsmap.class.inc.php index 440608f12..6c113a231 100644 --- a/setup/extensionsmap.class.inc.php +++ b/setup/extensionsmap.class.inc.php @@ -1,4 +1,5 @@ sCode = ''; @@ -99,12 +100,12 @@ class iTopExtension $this->bMarkedAsChosen = false; $this->sVersion = ITOP_VERSION; $this->sInstalledVersion = ''; - $this->aModules = array(); - $this->aModuleVersion = array(); - $this->aModuleInfo = array(); + $this->aModules = []; + $this->aModuleVersion = []; + $this->aModuleInfo = []; $this->sSourceDir = ''; $this->bVisible = true; - $this->aMissingDependencies = array(); + $this->aMissingDependencies = []; } } @@ -120,29 +121,27 @@ class iTopExtensionsMap * @return void */ protected $aExtensions; - + /** * The list of directories browsed using the ReadDir method when building the map * @var string[] */ protected $aScannedDirs; - - public function __construct($sFromEnvironment = 'production', $bNormalizeOldExtensions = true, $aExtraDirs = array()) + + public function __construct($sFromEnvironment = 'production', $bNormalizeOldExtensions = true, $aExtraDirs = []) { - $this->aExtensions = array(); - $this->aScannedDirs = array(); + $this->aExtensions = []; + $this->aScannedDirs = []; $this->ScanDisk($sFromEnvironment); - foreach($aExtraDirs as $sDir) - { - $this->ReadDir($sDir, iTopExtension::SOURCE_REMOTE); + foreach ($aExtraDirs as $sDir) { + $this->ReadDir($sDir, iTopExtension::SOURCE_REMOTE); } $this->CheckDependencies($sFromEnvironment); - if ($bNormalizeOldExtensions) - { + if ($bNormalizeOldExtensions) { $this->NormalizeOldExtensions(); } } - + /** * Populate the list of available (pseudo)extensions by scanning the disk * where the iTop files are located @@ -151,14 +150,15 @@ class iTopExtensionsMap */ protected function ScanDisk($sEnvironment) { - if (!$this->ReadInstallationWizard(APPROOT.'/datamodels/2.x') && !$this->ReadInstallationWizard(APPROOT.'/datamodels/2.x')) - { - if(!$this->ReadDir(APPROOT.'/datamodels/2.x', iTopExtension::SOURCE_WIZARD)) $this->ReadDir(APPROOT.'/datamodels/1.x', iTopExtension::SOURCE_WIZARD); + if (!$this->ReadInstallationWizard(APPROOT.'/datamodels/2.x') && !$this->ReadInstallationWizard(APPROOT.'/datamodels/2.x')) { + if (!$this->ReadDir(APPROOT.'/datamodels/2.x', iTopExtension::SOURCE_WIZARD)) { + $this->ReadDir(APPROOT.'/datamodels/1.x', iTopExtension::SOURCE_WIZARD); + } } $this->ReadDir(APPROOT.'/extensions', iTopExtension::SOURCE_MANUAL); $this->ReadDir(APPROOT.'/data/'.$sEnvironment.'-modules', iTopExtension::SOURCE_REMOTE); } - + /** * Read the information contained in the "installation.xml" file in the given directory * and create pseudo extensions from the list of choices described in this file @@ -167,23 +167,22 @@ class iTopExtensionsMap */ protected function ReadInstallationWizard($sDir) { - if (!is_readable($sDir.'/installation.xml')) return false; - + if (!is_readable($sDir.'/installation.xml')) { + return false; + } + $oXml = new XMLParameters($sDir.'/installation.xml'); - foreach($oXml->Get('steps') as $aStepInfo) - { - if (array_key_exists('options', $aStepInfo)) - { + foreach ($oXml->Get('steps') as $aStepInfo) { + if (array_key_exists('options', $aStepInfo)) { $this->ProcessWizardChoices($aStepInfo['options']); } - if (array_key_exists('alternatives', $aStepInfo)) - { + if (array_key_exists('alternatives', $aStepInfo)) { $this->ProcessWizardChoices($aStepInfo['alternatives']); } } return true; } - + /** * Helper to process a "choice" array read from the installation.xml file * @param array $aChoices @@ -191,26 +190,20 @@ class iTopExtensionsMap */ protected function ProcessWizardChoices($aChoices) { - foreach($aChoices as $aChoiceInfo) - { - if (array_key_exists('extension_code', $aChoiceInfo)) - { + foreach ($aChoices as $aChoiceInfo) { + if (array_key_exists('extension_code', $aChoiceInfo)) { $oExtension = new iTopExtension(); $oExtension->sCode = $aChoiceInfo['extension_code']; $oExtension->sLabel = $aChoiceInfo['title']; - if (array_key_exists('modules', $aChoiceInfo)) - { + if (array_key_exists('modules', $aChoiceInfo)) { // Some wizard choices are not associated with any module $oExtension->aModules = $aChoiceInfo['modules']; } - if (array_key_exists('sub_options', $aChoiceInfo)) - { - if (array_key_exists('options', $aChoiceInfo['sub_options'])) - { + if (array_key_exists('sub_options', $aChoiceInfo)) { + if (array_key_exists('options', $aChoiceInfo['sub_options'])) { $this->ProcessWizardChoices($aChoiceInfo['sub_options']['options']); } - if (array_key_exists('alternatives', $aChoiceInfo['sub_options'])) - { + if (array_key_exists('alternatives', $aChoiceInfo['sub_options'])) { $this->ProcessWizardChoices($aChoiceInfo['sub_options']['alternatives']); } } @@ -218,7 +211,7 @@ class iTopExtensionsMap } } } - + /** * Add an extension to the list of existing extensions, taking care of removing duplicates * (only the latest/greatest version is kept) @@ -227,19 +220,14 @@ class iTopExtensionsMap */ protected function AddExtension(iTopExtension $oNewExtension) { - foreach($this->aExtensions as $key => $oExtension) - { - if ($oExtension->sCode == $oNewExtension->sCode) - { - if (version_compare($oNewExtension->sVersion, $oExtension->sVersion, '>')) - { + foreach ($this->aExtensions as $key => $oExtension) { + if ($oExtension->sCode == $oNewExtension->sCode) { + if (version_compare($oNewExtension->sVersion, $oExtension->sVersion, '>')) { // This "new" extension is "newer" than the previous one, let's replace the previous one unset($this->aExtensions[$key]); $this->aExtensions[$oNewExtension->sCode.'/'.$oNewExtension->sVersion] = $oNewExtension; return; - } - else - { + } else { // This "new" extension is not "newer" than the previous one, let's ignore it return; } @@ -248,7 +236,7 @@ class iTopExtensionsMap // Finally it's not a duplicate, let's add it to the list $this->aExtensions[$oNewExtension->sCode.'/'.$oNewExtension->sVersion] = $oNewExtension; } - + /** * Read (recursively) a directory to find if it contains extensions (or modules) * @@ -260,21 +248,20 @@ class iTopExtensionsMap */ protected function ReadDir($sSearchDir, $sSource, $sParentExtensionId = null) { - if (!is_readable($sSearchDir)) return false; + if (!is_readable($sSearchDir)) { + return false; + } $hDir = opendir($sSearchDir); - if ($hDir !== false) - { - if ($sParentExtensionId == null) - { - // We're not recursing, let's add the directory to the list of scanned dirs - $this->aScannedDirs[] = $sSearchDir; - } + if ($hDir !== false) { + if ($sParentExtensionId == null) { + // We're not recursing, let's add the directory to the list of scanned dirs + $this->aScannedDirs[] = $sSearchDir; + } $sExtensionId = null; - $aSubDirectories = array(); + $aSubDirectories = []; // First check if there is an extension.xml file in this directory - if (is_readable($sSearchDir.'/extension.xml')) - { + if (is_readable($sSearchDir.'/extension.xml')) { $oXml = new XMLParameters($sSearchDir.'/extension.xml'); $oExtension = new iTopExtension(); $oExtension->sCode = $oXml->Get('extension_code'); @@ -285,23 +272,18 @@ class iTopExtensionsMap $oExtension->sMoreInfoUrl = $oXml->Get('more_info_url'); $oExtension->sSource = $sSource; $oExtension->sSourceDir = $sSearchDir; - + $sParentExtensionId = $sExtensionId = $oExtension->sCode.'/'.$oExtension->sVersion; $this->AddExtension($oExtension); } // Then scan the other files and subdirectories - while (($sFile = readdir($hDir)) !== false) - { - if (($sFile !== '.') && ($sFile !== '..')) - { - $aMatches = array(); - if (is_dir($sSearchDir.'/'.$sFile)) - { + while (($sFile = readdir($hDir)) !== false) { + if (($sFile !== '.') && ($sFile !== '..')) { + $aMatches = []; + if (is_dir($sSearchDir.'/'.$sFile)) { // Recurse after parsing all the regular files $aSubDirectories[] = $sSearchDir.'/'.$sFile; - } - else if (preg_match('/^module\.(.*).php$/i', $sFile, $aMatches)) - { + } elseif (preg_match('/^module\.(.*).php$/i', $sFile, $aMatches)) { // Found a module $aModuleInfo = $this->GetModuleInfo($sSearchDir.'/'.$sFile); // If we are not already inside a formal extension, then the module itself is considered @@ -309,30 +291,26 @@ class iTopExtensionsMap // to this extension $sModuleId = $aModuleInfo[1]; list($sModuleName, $sModuleVersion) = ModuleDiscovery::GetModuleName($sModuleId); - if ($sModuleVersion == '') - { + if ($sModuleVersion == '') { // Provide a default module version since version is mandatory when recording ExtensionInstallation $sModuleVersion = '0.0.1'; } - + if (($sParentExtensionId !== null) && (array_key_exists($sParentExtensionId, $this->aExtensions)) && ($this->aExtensions[$sParentExtensionId] instanceof iTopExtension)) { // Already inside an extension, let's add this module the list of modules belonging to this extension $this->aExtensions[$sParentExtensionId]->aModules[] = $sModuleName; $this->aExtensions[$sParentExtensionId]->aModuleVersion[$sModuleName] = $sModuleVersion; $this->aExtensions[$sParentExtensionId]->aModuleInfo[$sModuleName] = $aModuleInfo[2]; - } - else - { + } else { // Not already inside an folder containing an 'extension.xml' file - + // Ignore non-visible modules and auto-select ones, since these are never prompted // as a choice to the end-user $bVisible = true; - if (!$aModuleInfo[2]['visible'] || isset($aModuleInfo[2]['auto_select'])) - { - $bVisible = false; + if (!$aModuleInfo[2]['visible'] || isset($aModuleInfo[2]['auto_select'])) { + $bVisible = false; } - + // Let's create a "fake" extension from this module (containing just this module) for backwards compatibility $oExtension = new iTopExtension(); $oExtension->sCode = $sModuleName; @@ -342,7 +320,7 @@ class iTopExtensionsMap $oExtension->sSource = $sSource; $oExtension->bMandatory = $aModuleInfo[2]['mandatory']; $oExtension->sMoreInfoUrl = $aModuleInfo[2]['doc.more_information']; - $oExtension->aModules = array($sModuleName); + $oExtension->aModules = [$sModuleName]; $oExtension->aModuleVersion[$sModuleName] = $sModuleVersion; $oExtension->aModuleInfo[$sModuleName] = $aModuleInfo[2]; $oExtension->sSourceDir = $sSearchDir; @@ -357,16 +335,15 @@ class iTopExtensionsMap } } closedir($hDir); - foreach($aSubDirectories as $sDir) - { + foreach ($aSubDirectories as $sDir) { // Recurse inside the subdirectories - $this->ReadDir($sDir, $sSource, $sExtensionId); + $this->ReadDir($sDir, $sSource, $sExtensionId); } return true; } return false; } - + /** * Check if some extension contains a module with missing dependencies... * If so, populate the aMissingDepenencies array @@ -375,38 +352,28 @@ class iTopExtensionsMap */ protected function CheckDependencies($sFromEnvironment) { - $aSearchDirs = array(); - - if (is_dir(APPROOT.'/datamodels/2.x')) - { + $aSearchDirs = []; + + if (is_dir(APPROOT.'/datamodels/2.x')) { $aSearchDirs[] = APPROOT.'/datamodels/2.x'; - } - else if (is_dir(APPROOT.'/datamodels/1.x')) - { + } elseif (is_dir(APPROOT.'/datamodels/1.x')) { $aSearchDirs[] = APPROOT.'/datamodels/1.x'; } $aSearchDirs = array_merge($aSearchDirs, $this->aScannedDirs); - - try - { + + try { $aAllModules = ModuleDiscovery::GetAvailableModules($aSearchDirs, true); - } - catch(MissingDependencyException $e) - { + } catch (MissingDependencyException $e) { // Some modules have missing dependencies // Let's check what is the impact at the "extensions" level - foreach($this->aExtensions as $sKey => $oExtension) - { - foreach($oExtension->aModules as $sModuleName) - { - if (array_key_exists($sModuleName, $oExtension->aModuleVersion)) - { + foreach ($this->aExtensions as $sKey => $oExtension) { + foreach ($oExtension->aModules as $sModuleName) { + if (array_key_exists($sModuleName, $oExtension->aModuleVersion)) { // This information is not available for pseudo modules defined in the installation wizard, but let's ignore them $sVersion = $oExtension->aModuleVersion[$sModuleName]; $sModuleId = $sModuleName.'/'.$sVersion; - - if (array_key_exists($sModuleId, $e->aModulesInfo)) - { + + if (array_key_exists($sModuleId, $e->aModulesInfo)) { // The extension actually contains a module which has unmet dependencies $aModuleInfo = $e->aModulesInfo[$sModuleId]; $this->aExtensions[$sKey]->aMissingDependencies = array_merge($oExtension->aMissingDependencies, $aModuleInfo['dependencies']); @@ -416,7 +383,7 @@ class iTopExtensionsMap } } } - + /** * Read the information from a module file (module.xxx.php) * Closely inspired (almost copied/pasted !!) from ModuleDiscovery::ListModuleFiles @@ -426,21 +393,18 @@ class iTopExtensionsMap protected function GetModuleInfo($sModuleFile) { static $iDummyClassIndex = 0; - - $aModuleInfo = array(); // will be filled by the "eval" line below... - try - { - $aMatches = array(); + + $aModuleInfo = []; // will be filled by the "eval" line below... + try { + $aMatches = []; $sModuleFileContents = file_get_contents($sModuleFile); - $sModuleFileContents = str_replace(array(''), '', $sModuleFileContents); + $sModuleFileContents = str_replace([''], '', $sModuleFileContents); $sModuleFileContents = str_replace('__FILE__', "'".addslashes($sModuleFile)."'", $sModuleFileContents); preg_match_all('/class ([A-Za-z0-9_]+) extends ([A-Za-z0-9_]+)/', $sModuleFileContents, $aMatches); //print_r($aMatches); $idx = 0; - foreach($aMatches[1] as $sClassName) - { - if (class_exists($sClassName)) - { + foreach ($aMatches[1] as $sClassName) { + if (class_exists($sClassName)) { // rename any class declaration inside the code to prevent a "duplicate class" declaration // and change its parent class as well so that nobody will find it and try to execute it // Note: don't use the same naming scheme as ModuleDiscovery otherwise you 'll have the duplicate class error again !! @@ -449,28 +413,23 @@ class iTopExtensionsMap $idx++; } // Replace the main function call by an assignment to a variable, as an array... - $sModuleFileContents = str_replace(array('SetupWebPage::AddModule', 'ModuleDiscovery::AddModule'), '$aModuleInfo = array', $sModuleFileContents); - + $sModuleFileContents = str_replace(['SetupWebPage::AddModule', 'ModuleDiscovery::AddModule'], '$aModuleInfo = array', $sModuleFileContents); + eval($sModuleFileContents); // Assigns $aModuleInfo - - if (count($aModuleInfo) === 0) - { + + if (count($aModuleInfo) === 0) { SetupLog::Warning("Eval of $sModuleFile did not return the expected information..."); } - } - catch(ParseError $e) - { - // Continue... + } catch (ParseError $e) { + // Continue... SetupLog::Warning("Eval of $sModuleFile caused a parse error: ".$e->getMessage()." at line ".$e->getLine()); - } - catch(Exception $e) - { + } catch (Exception $e) { // Continue... SetupLog::Warning("Eval of $sModuleFile caused an exception: ".$e->getMessage()); } return $aModuleInfo; } - + /** * Get all available extensions * @return iTopExtension[] @@ -479,7 +438,7 @@ class iTopExtensionsMap { return $this->aExtensions; } - + /** * Mark the given extension as chosen * @param string $sExtensionCode The code of the extension (code without verison number) @@ -488,16 +447,14 @@ class iTopExtensionsMap */ public function MarkAsChosen($sExtensionCode, $bMark = true) { - foreach($this->aExtensions as $oExtension) - { - if ($oExtension->sCode == $sExtensionCode) - { + foreach ($this->aExtensions as $oExtension) { + if ($oExtension->sCode == $sExtensionCode) { $oExtension->bMarkedAsChosen = $bMark; break; } } } - + /** * Tells if a given extension(code) is marked as chosen * @param string $sExtensionCode @@ -505,10 +462,8 @@ class iTopExtensionsMap */ public function IsMarkedAsChosen($sExtensionCode) { - foreach($this->aExtensions as $oExtension) - { - if ($oExtension->sCode == $sExtensionCode) - { + foreach ($this->aExtensions as $oExtension) { + if ($oExtension->sCode == $sExtensionCode) { return $oExtension->bMarkedAsChosen; } } @@ -523,33 +478,29 @@ class iTopExtensionsMap */ protected function SetInstalledVersion($sExtensionCode, $sInstalledVersion) { - foreach($this->aExtensions as $oExtension) - { - if ($oExtension->sCode == $sExtensionCode) - { + foreach ($this->aExtensions as $oExtension) { + if ($oExtension->sCode == $sExtensionCode) { $oExtension->sInstalledVersion = $sInstalledVersion; break; } } } - + /** * Get the list of the "chosen" extensions * @return iTopExtension[] */ public function GetChoices() { - $aResult = array(); - foreach($this->aExtensions as $oExtension) - { - if ($oExtension->bMarkedAsChosen) - { + $aResult = []; + foreach ($this->aExtensions as $oExtension) { + if ($oExtension->bMarkedAsChosen) { $aResult[] = $oExtension; } } return $aResult; } - + /** * Load the choices (i.e. MarkedAsChosen) from the database defined in the supplied Config * @param Config $oConfig @@ -557,30 +508,25 @@ class iTopExtensionsMap */ public function LoadChoicesFromDatabase(Config $oConfig) { - try - { - $aInstalledExtensions = array(); - if (CMDBSource::DBName() === null) - { + try { + $aInstalledExtensions = []; + if (CMDBSource::DBName() === null) { CMDBSource::InitFromConfig($oConfig); } $sLatestInstallationDate = CMDBSource::QueryToScalar("SELECT max(installed) FROM ".$oConfig->Get('db_subname')."priv_extension_install"); $aInstalledExtensions = CMDBSource::QueryToArray("SELECT * FROM ".$oConfig->Get('db_subname')."priv_extension_install WHERE installed = '".$sLatestInstallationDate."'"); - } - catch (MySQLException $e) - { + } catch (MySQLException $e) { // No database or erroneous information return false; } - - foreach($aInstalledExtensions as $aDBInfo) - { + + foreach ($aInstalledExtensions as $aDBInfo) { $this->MarkAsChosen($aDBInfo['code']); $this->SetInstalledVersion($aDBInfo['code'], $aDBInfo['version']); } return true; } - + /** * Find is a single-module extension is contained within another extension * @param iTopExtension $oExtension @@ -589,26 +535,25 @@ class iTopExtensionsMap public function IsExtensionObsoletedByAnother(iTopExtension $oExtension) { // Complex extensions (more than 1 module) are never considered as obsolete - if (count($oExtension->aModules) != 1) return null; - - foreach($this->GetAllExtensions() as $oOtherExtension) - { - if (($oOtherExtension->sSourceDir != $oExtension->sSourceDir) && ($oOtherExtension->sSource != iTopExtension::SOURCE_WIZARD)) - { + if (count($oExtension->aModules) != 1) { + return null; + } + + foreach ($this->GetAllExtensions() as $oOtherExtension) { + if (($oOtherExtension->sSourceDir != $oExtension->sSourceDir) && ($oOtherExtension->sSource != iTopExtension::SOURCE_WIZARD)) { if (array_key_exists($oExtension->sCode, $oOtherExtension->aModuleVersion) && - (version_compare($oOtherExtension->aModuleVersion[$oExtension->sCode], $oExtension->sVersion, '>=')) ) - { + (version_compare($oOtherExtension->aModuleVersion[$oExtension->sCode], $oExtension->sVersion, '>='))) { // Found another extension containing a more recent version of the extension/module return $oOtherExtension; } } } - + // No match at all return null; - + } - + /** * Search for multi-module extensions that are NOT deployed as an extension (i.e. shipped with an extension.xml file) * but as a bunch of un-related modules based on the signature of some well-known extensions. If such an extension is found, @@ -617,53 +562,46 @@ class iTopExtensionsMap */ public function NormalizeOldExtensions($sInSourceOnly = iTopExtension::SOURCE_MANUAL) { - $aSignatures = $this->GetOldExtensionsSignatures(); - foreach($aSignatures as $sExtensionCode => $aExtensionSignatures) - { - $bFound = false; - foreach($aExtensionSignatures['versions'] as $sVersion => $aModules) - { - $bInstalled = true; - foreach($aModules as $sModuleId) - { - if(!$this->ModuleIsPresent($sModuleId, $sInSourceOnly)) - { - $bFound = false; - break; // One missing module is enough to determine that the extension/version is not present - } - else - { - $bInstalled = $bInstalled && (!$this->ModuleIsInstalled($sModuleId, $sInSourceOnly)); - $bFound = true; - } - } - if ($bFound) break; // The current version matches the signature - } - - if ($bFound) - { - $oExtension = new iTopExtension(); - $oExtension->sCode = $sExtensionCode; - $oExtension->sLabel = $aExtensionSignatures['label']; - $oExtension->sSource = $sInSourceOnly; - $oExtension->sDescription = $aExtensionSignatures['description']; - $oExtension->sVersion = $sVersion; - $oExtension->aModules = array(); - if ($bInstalled) - { - $oExtension->sInstalledVersion = $sVersion; - $oExtension->bMarkedAsChosen = true; - } - foreach($aModules as $sModuleId) - { - list($sModuleName, $sModuleVersion) = ModuleDiscovery::GetModuleName($sModuleId); - $oExtension->aModules[] = $sModuleName; - } - $this->ReplaceModulesByNormalizedExtension($aExtensionSignatures['versions'][$sVersion], $oExtension); - } - } + $aSignatures = $this->GetOldExtensionsSignatures(); + foreach ($aSignatures as $sExtensionCode => $aExtensionSignatures) { + $bFound = false; + foreach ($aExtensionSignatures['versions'] as $sVersion => $aModules) { + $bInstalled = true; + foreach ($aModules as $sModuleId) { + if (!$this->ModuleIsPresent($sModuleId, $sInSourceOnly)) { + $bFound = false; + break; // One missing module is enough to determine that the extension/version is not present + } else { + $bInstalled = $bInstalled && (!$this->ModuleIsInstalled($sModuleId, $sInSourceOnly)); + $bFound = true; + } + } + if ($bFound) { + break; + } // The current version matches the signature + } + + if ($bFound) { + $oExtension = new iTopExtension(); + $oExtension->sCode = $sExtensionCode; + $oExtension->sLabel = $aExtensionSignatures['label']; + $oExtension->sSource = $sInSourceOnly; + $oExtension->sDescription = $aExtensionSignatures['description']; + $oExtension->sVersion = $sVersion; + $oExtension->aModules = []; + if ($bInstalled) { + $oExtension->sInstalledVersion = $sVersion; + $oExtension->bMarkedAsChosen = true; + } + foreach ($aModules as $sModuleId) { + list($sModuleName, $sModuleVersion) = ModuleDiscovery::GetModuleName($sModuleId); + $oExtension->aModules[] = $sModuleName; + } + $this->ReplaceModulesByNormalizedExtension($aExtensionSignatures['versions'][$sVersion], $oExtension); + } + } } - + /** * Check if the given module-code/version is present on the disk * @param string $sModuleIdToFind The module ID (code/version) to search for @@ -672,9 +610,9 @@ class iTopExtensionsMap */ protected function ModuleIsPresent($sModuleIdToFind, $sInSourceOnly) { - return (array_key_exists($sModuleIdToFind, $this->aExtensions) && ($this->aExtensions[$sModuleIdToFind]->sSource == $sInSourceOnly)); + return (array_key_exists($sModuleIdToFind, $this->aExtensions) && ($this->aExtensions[$sModuleIdToFind]->sSource == $sInSourceOnly)); } - + /** * Check if the given module-code/version is currently installed * @param string $sModuleIdToFind The module ID (code/version) to search for @@ -683,11 +621,11 @@ class iTopExtensionsMap */ protected function ModuleIsInstalled($sModuleIdToFind, $sInSourceOnly) { - return (array_key_exists($sModuleIdToFind, $this->aExtensions) && - ($this->aExtensions[$sModuleIdToFind]->sSource == $sInSourceOnly) && - ($this->aExtensions[$sModuleIdToFind]->sInstalledVersion !== '') ); + return (array_key_exists($sModuleIdToFind, $this->aExtensions) && + ($this->aExtensions[$sModuleIdToFind]->sSource == $sInSourceOnly) && + ($this->aExtensions[$sModuleIdToFind]->sInstalledVersion !== '')); } - + /** * Tells if the given module name is "chosen" since it is part of a "chosen" extension (in the specified source dir) * @param string $sModuleNameToFind @@ -697,19 +635,17 @@ class iTopExtensionsMap public function ModuleIsChosenAsPartOfAnExtension($sModuleNameToFind, $sInSourceOnly = iTopExtension::SOURCE_REMOTE) { $bChosen = false; - - foreach($this->GetAllExtensions() as $oExtension) - { + + foreach ($this->GetAllExtensions() as $oExtension) { if (($oExtension->sSource == $sInSourceOnly) && ($oExtension->bMarkedAsChosen == true) && - (array_key_exists($sModuleNameToFind, $oExtension->aModuleVersion))) - { + (array_key_exists($sModuleNameToFind, $oExtension->aModuleVersion))) { return true; } } return false; } - + /** * Replace a given set of stand-alone modules by one single "extension" * @param string[] $aModules @@ -717,13 +653,12 @@ class iTopExtensionsMap */ protected function ReplaceModulesByNormalizedExtension($aModules, iTopExtension $oNewExtension) { - foreach($aModules as $sModuleId) - { - unset($this->aExtensions[$sModuleId]); - } - $this->AddExtension($oNewExtension); + foreach ($aModules as $sModuleId) { + unset($this->aExtensions[$sModuleId]); + } + $this->AddExtension($oNewExtension); } - + /** * Get the list of signatures of some well-known multi-module extensions without extension.xml file (should not exist anymore) * @@ -731,637 +666,637 @@ class iTopExtensionsMap */ protected function GetOldExtensionsSignatures() { - // Generated by the Factory using the page export_component_versions_for_normalisation.php - return array ( - 'combodo-approval-process-light' => - array ( - 'label' => 'Approval process light', - 'description' => 'Approve a request via a simple email', - 'versions' => - array ( - '1.0.1' => - array ( - 0 => 'approval-base/2.1.0', - 1 => 'combodo-approval-light/1.0.1', - ), - '1.0.2' => - array ( - 0 => 'approval-base/2.1.1', - 1 => 'combodo-approval-light/1.0.2', - ), - '1.0.3' => - array ( - 0 => 'approval-base/2.1.2', - 1 => 'combodo-approval-light/1.0.2', - ), - '1.1.0' => - array ( - 0 => 'approval-base/2.2.2', - 1 => 'combodo-approval-light/1.0.2', - ), - '1.1.1' => - array ( - 0 => 'approval-base/2.2.3', - 1 => 'combodo-approval-light/1.0.2', - ), - '1.1.2' => - array ( - 0 => 'approval-base/2.2.6', - 1 => 'combodo-approval-light/1.0.2', - ), - '1.1.3' => - array ( - 0 => 'approval-base/2.2.6', - 1 => 'combodo-approval-light/1.0.3', - ), - '1.2.0' => - array ( - 0 => 'approval-base/2.3.0', - 1 => 'combodo-approval-light/1.0.3', - ), - '1.2.1' => - array ( - 0 => 'approval-base/2.4.0', - 1 => 'combodo-approval-light/1.0.4', - ), - '1.3.0' => - array ( - 0 => 'approval-base/2.4.2', - 1 => 'combodo-approval-light/1.1.1', - ), - '1.3.1' => - array ( - 0 => 'approval-base/2.5.0', - 1 => 'combodo-approval-light/1.1.1', - ), - '1.3.2' => - array ( - 0 => 'approval-base/2.5.0', - 1 => 'combodo-approval-light/1.1.2', - ), - '1.2.2' => - array ( - 0 => 'approval-base/2.4.2', - 1 => 'combodo-approval-light/1.0.5', - ), - '1.3.3' => - array ( - 0 => 'approval-base/2.5.1', - 1 => 'combodo-approval-light/1.1.2', - ), - '1.3.4' => - array ( - 0 => 'approval-base/2.5.2', - 1 => 'combodo-approval-light/1.1.2', - ), - '1.3.5' => - array ( - 0 => 'approval-base/2.5.3', - 1 => 'combodo-approval-light/1.1.2', - ), - '1.4.0' => - array ( - 0 => 'approval-base/2.5.3', - 1 => 'combodo-approval-light/1.1.2', - 2 => 'itop-approval-portal/1.0.0', - ), - ), - ), - 'combodo-approval-process-automation' => - array ( - 'label' => 'Approval process automation', - 'description' => 'Control your approval process with predefined rules based on service catalog', - 'versions' => - array ( - '1.0.1' => - array ( - 0 => 'approval-base/2.1.0', - 1 => 'combodo-approval-extended/1.0.2', - ), - '1.0.2' => - array ( - 0 => 'approval-base/2.1.1', - 1 => 'combodo-approval-extended/1.0.4', - ), - '1.0.3' => - array ( - 0 => 'approval-base/2.1.2', - 1 => 'combodo-approval-extended/1.0.4', - ), - '1.1.0' => - array ( - 0 => 'approval-base/2.2.2', - 1 => 'combodo-approval-extended/1.0.4', - ), - '1.1.1' => - array ( - 0 => 'approval-base/2.2.3', - 1 => 'combodo-approval-extended/1.0.4', - ), - '1.1.2' => - array ( - 0 => 'approval-base/2.2.6', - 1 => 'combodo-approval-extended/1.0.5', - ), - '1.1.3' => - array ( - 0 => 'approval-base/2.2.6', - 1 => 'combodo-approval-extended/1.0.6', - ), - '1.2.0' => - array ( - 0 => 'approval-base/2.3.0', - 1 => 'combodo-approval-extended/1.0.7', - ), - '1.2.1' => - array ( - 0 => 'approval-base/2.4.0', - 1 => 'combodo-approval-extended/1.0.8', - ), - '1.3.0' => - array ( - 0 => 'approval-base/2.4.2', - 1 => 'combodo-approval-extended/1.2.1', - ), - '1.3.1' => - array ( - 0 => 'approval-base/2.5.0', - 1 => 'combodo-approval-extended/1.2.1', - ), - '1.3.2' => - array ( - 0 => 'approval-base/2.5.0', - 1 => 'combodo-approval-extended/1.2.2', - ), - '1.2.2' => - array ( - 0 => 'approval-base/2.4.2', - 1 => 'combodo-approval-extended/1.0.9', - ), - '1.3.3' => - array ( - 0 => 'approval-base/2.5.1', - 1 => 'combodo-approval-extended/1.2.3', - ), - '1.3.4' => - array ( - 0 => 'approval-base/2.5.2', - 1 => 'combodo-approval-extended/1.2.3', - ), - '1.3.5' => - array ( - 0 => 'approval-base/2.5.3', - 1 => 'combodo-approval-extended/1.2.3', - ), - '1.4.0' => - array ( - 0 => 'approval-base/2.5.3', - 1 => 'combodo-approval-extended/1.2.3', - 3 => 'itop-approval-portal/1.0.0', - ), - ), - ), - 'combodo-predefined-response-models' => - array ( - 'label' => 'Predefined response models', - 'description' => 'Pick common answers from a list of predefined replies grouped by categories to update tickets log', - 'versions' => - array ( - '1.0.0' => - array ( - 0 => 'precanned-replies/1.0.0', - 1 => 'precanned-replies-pro/1.0.0', - ), - '1.0.1' => - array ( - 0 => 'precanned-replies/1.0.1', - 1 => 'precanned-replies-pro/1.0.1', - ), - '1.0.2' => - array ( - 0 => 'precanned-replies/1.0.2', - 1 => 'precanned-replies-pro/1.0.1', - ), - '1.0.3' => - array ( - 0 => 'precanned-replies/1.0.3', - 1 => 'precanned-replies-pro/1.0.1', - ), - '1.0.4' => - array ( - 0 => 'precanned-replies/1.0.3', - 1 => 'precanned-replies-pro/1.0.2', - ), - '1.0.5' => - array ( - 0 => 'precanned-replies/1.0.4', - 1 => 'precanned-replies-pro/1.0.2', - ), - '1.1.0' => - array ( - 0 => 'precanned-replies/1.1.0', - 1 => 'precanned-replies-pro/1.0.2', - ), - '1.1.1' => - array ( - 0 => 'precanned-replies/1.1.1', - 1 => 'precanned-replies-pro/1.0.2', - ), - ), - ), - 'combodo-customized-request-forms' => - array ( - 'label' => 'Customized request forms', - 'description' => 'Define personalized request forms based on the service catalog. Add extra fields for a given type of request.', - 'versions' => - array ( - '1.0.1' => - array ( - 0 => 'templates-base/2.1.1', - 1 => 'itop-request-template/1.0.0', - ), - '1.0.2' => - array ( - 0 => 'templates-base/2.1.2', - 1 => 'itop-request-template/1.0.0', - ), - '1.0.3' => - array ( - 0 => 'templates-base/2.1.2', - 1 => 'itop-request-template/1.0.1', - ), - '1.0.4' => - array ( - 0 => 'templates-base/2.1.3', - 1 => 'itop-request-template/1.0.1', - ), - '1.0.5' => - array ( - 0 => 'templates-base/2.1.4', - 1 => 'itop-request-template/1.0.1', - ), - '2.0.0' => - array ( - 0 => 'templates-base/3.0.0', - 1 => 'itop-request-template/2.0.0', - 2 => 'itop-request-template-portal/1.0.0', - ), - '2.0.1' => - array ( - 0 => 'templates-base/3.0.1', - 1 => 'itop-request-template/2.0.0', - 2 => 'itop-request-template-portal/1.0.0', - ), - '2.0.2' => - array ( - 0 => 'templates-base/3.0.2', - 1 => 'itop-request-template/2.0.0', - 2 => 'itop-request-template-portal/1.0.0', - ), - '2.0.3' => - array ( - 0 => 'templates-base/3.0.4', - 1 => 'itop-request-template/2.0.0', - 2 => 'itop-request-template-portal/1.0.0', - ), - '2.0.4' => - array ( - 0 => 'templates-base/3.0.5', - 1 => 'itop-request-template/2.0.0', - 2 => 'itop-request-template-portal/1.0.0', - ), - '2.0.5' => - array ( - 0 => 'templates-base/3.0.6', - 1 => 'itop-request-template/2.0.0', - 2 => 'itop-request-template-portal/1.0.0', - ), - '2.0.6' => - array ( - 0 => 'templates-base/3.0.8', - 1 => 'itop-request-template/2.0.0', - 2 => 'itop-request-template-portal/1.0.0', - ), - '2.0.7' => - array ( - 0 => 'templates-base/3.0.9', - 1 => 'itop-request-template/2.0.0', - 2 => 'itop-request-template-portal/1.0.0', - ), - '2.0.8' => - array ( - 0 => 'templates-base/3.0.12', - 1 => 'itop-request-template/2.0.0', - 2 => 'itop-request-template-portal/1.0.0', - ), - ), - ), - 'combodo-sla-considering-business-hours' => - array ( - 'label' => 'SLA considering business hours', - 'description' => 'Compute SLAs taking into account service coverage window and holidays', - 'versions' => - array ( - '2.0.1' => - array ( - 0 => 'combodo-sla-computation/2.0.1', - 1 => 'combodo-coverage-windows-computation/2.0.0', - ), - '2.1.0' => - array ( - 0 => 'combodo-sla-computation/2.1.0', - 1 => 'combodo-coverage-windows-computation/2.0.0', - ), - '2.1.1' => - array ( - 0 => 'combodo-sla-computation/2.1.1', - 1 => 'combodo-coverage-windows-computation/2.0.0', - ), - '2.1.2' => - array ( - 0 => 'combodo-sla-computation/2.1.2', - 1 => 'combodo-coverage-windows-computation/2.0.0', - ), - '2.1.3' => - array ( - 0 => 'combodo-sla-computation/2.1.2', - 1 => 'combodo-coverage-windows-computation/2.0.1', - ), - '2.0.2' => - array ( - 0 => 'combodo-sla-computation/2.0.1', - 1 => 'combodo-coverage-windows-computation/2.0.1', - ), - '2.1.4' => - array ( - 0 => 'combodo-sla-computation/2.1.3', - 1 => 'combodo-coverage-windows-computation/2.0.1', - ), - '2.1.5' => - array ( - 0 => 'combodo-sla-computation/2.1.5', - 1 => 'combodo-coverage-windows-computation/2.0.1', - ), - '2.1.6' => - array ( - 0 => 'combodo-sla-computation/2.1.5', - 1 => 'combodo-coverage-windows-computation/2.0.2', - ), - '2.1.7' => - array ( - 0 => 'combodo-sla-computation/2.1.6', - 1 => 'combodo-coverage-windows-computation/2.0.2', - ), - '2.1.8' => - array ( - 0 => 'combodo-sla-computation/2.1.7', - 1 => 'combodo-coverage-windows-computation/2.0.2', - ), - '2.1.9' => - array ( - 0 => 'combodo-sla-computation/2.1.8', - 1 => 'combodo-coverage-windows-computation/2.0.2', - ), - ), - ), - 'combodo-mail-to-ticket-automation' => - array ( - 'label' => 'Mail to ticket automation', - 'description' => 'Scan several mailboxes to create or update tickets.', - 'versions' => - array ( - '2.6.0' => - array ( - 0 => 'combodo-email-synchro/2.6.0', - 1 => 'itop-standard-email-synchro/2.6.0', - ), - '2.6.1' => - array ( - 0 => 'combodo-email-synchro/2.6.1', - 1 => 'itop-standard-email-synchro/2.6.0', - ), - '2.6.2' => - array ( - 0 => 'combodo-email-synchro/2.6.2', - 1 => 'itop-standard-email-synchro/2.6.0', - ), - '2.6.3' => - array ( - 0 => 'combodo-email-synchro/2.6.2', - 1 => 'itop-standard-email-synchro/2.6.1', - ), - '2.6.4' => - array ( - 0 => 'combodo-email-synchro/2.6.3', - 1 => 'itop-standard-email-synchro/2.6.2', - ), - '2.6.5' => - array ( - 0 => 'combodo-email-synchro/2.6.4', - 1 => 'itop-standard-email-synchro/2.6.2', - ), - '2.6.6' => - array ( - 0 => 'combodo-email-synchro/2.6.5', - 1 => 'itop-standard-email-synchro/2.6.3', - ), - '2.6.7' => - array ( - 0 => 'combodo-email-synchro/2.6.6', - 1 => 'itop-standard-email-synchro/2.6.4', - ), - '2.6.8' => - array ( - 0 => 'combodo-email-synchro/2.6.7', - 1 => 'itop-standard-email-synchro/2.6.4', - ), - '2.6.9' => - array ( - 0 => 'combodo-email-synchro/2.6.8', - 1 => 'itop-standard-email-synchro/2.6.5', - ), - '2.6.10' => - array ( - 0 => 'combodo-email-synchro/2.6.9', - 1 => 'itop-standard-email-synchro/2.6.6', - ), - '2.6.11' => - array ( - 0 => 'combodo-email-synchro/2.6.10', - 1 => 'itop-standard-email-synchro/2.6.6', - ), - '2.6.12' => - array ( - 0 => 'combodo-email-synchro/2.6.11', - 1 => 'itop-standard-email-synchro/2.6.6', - ), - '3.0.0' => - array ( - 0 => 'combodo-email-synchro/3.0.0', - 1 => 'itop-standard-email-synchro/3.0.0', - ), - '3.0.1' => - array ( - 0 => 'combodo-email-synchro/3.0.1', - 1 => 'itop-standard-email-synchro/3.0.1', - ), - '3.0.2' => - array ( - 0 => 'combodo-email-synchro/3.0.2', - 1 => 'itop-standard-email-synchro/3.0.1', - ), - '3.0.3' => - array ( - 0 => 'combodo-email-synchro/3.0.3', - 1 => 'itop-standard-email-synchro/3.0.3', - ), - '3.0.4' => - array ( - 0 => 'combodo-email-synchro/3.0.3', - 1 => 'itop-standard-email-synchro/3.0.4', - ), - '3.0.5' => - array ( - 0 => 'combodo-email-synchro/3.0.4', - 1 => 'itop-standard-email-synchro/3.0.4', - ), - '3.0.6' => - array ( - 0 => 'combodo-email-synchro/3.0.5', - 1 => 'itop-standard-email-synchro/3.0.4', - ), - '3.0.7' => - array ( - 0 => 'combodo-email-synchro/3.0.5', - 1 => 'itop-standard-email-synchro/3.0.5', - ), - ), - ), - 'combodo-configurator-for-automatic-object-creation' => - array ( - 'label' => 'Configurator for automatic object creation', - 'description' => 'Templating based on existing objects.', - 'versions' => - array ( - '1.0.13' => - array ( - 1 => 'itop-stencils/1.0.6', - ), - ), - ), - 'combodo-user-actions-configurator' => - array ( - 'label' => 'User actions configurator', - 'description' => 'Configure user actions to simplify and automate processes (e.g. create an incident from a CI).', - 'versions' => - array ( - '1.0.0' => - array ( - 0 => 'itop-object-copier/1.0.0', - ), - '1.0.1' => - array ( - 0 => 'itop-object-copier/1.0.1', - ), - '1.0.2' => - array ( - 0 => 'itop-object-copier/1.0.2', - ), - '1.0.3' => - array ( - 0 => 'itop-object-copier/1.0.3', - ), - '1.1.0' => - array ( - 0 => 'itop-object-copier/1.1.0', - ), - '1.1.1' => - array ( - 0 => 'itop-object-copier/1.1.1', - ), - '1.1.2' => - array ( - 0 => 'itop-object-copier/1.1.2', - ), - '1.1.3' => - array ( - 0 => 'itop-object-copier/1.1.3', - ), - '1.1.4' => - array ( - 0 => 'itop-object-copier/1.1.4', - ), - '1.1.5' => - array ( - 0 => 'itop-object-copier/1.1.5', - ), - '1.1.6' => - array ( - 0 => 'itop-object-copier/1.1.6', - ), - '1.1.7' => - array ( - 0 => 'itop-object-copier/1.1.7', - ), - '1.1.8' => - array ( - 0 => 'itop-object-copier/1.1.8', - ), - ), - ), - 'combodo-send-updates-by-email' => - array ( - 'label' => 'Send updates by email', - 'description' => 'Send an email to pre-configured contacts when a ticket log is updated.', - 'versions' => - array ( - '1.0.1' => - array ( - 0 => 'email-reply/1.0.1', - ), - '1.0.3' => - array ( - 0 => 'email-reply/1.0.3', - ), - '1.1.1' => - array ( - 0 => 'email-reply/1.1.1', - ), - '1.1.2' => - array ( - 0 => 'email-reply/1.1.2', - ), - '1.1.3' => - array ( - 0 => 'email-reply/1.1.3', - ), - '1.1.4' => - array ( - 0 => 'email-reply/1.1.4', - ), - '1.1.5' => - array ( - 0 => 'email-reply/1.1.5', - ), - '1.1.6' => - array ( - 0 => 'email-reply/1.1.6', - ), - '1.1.7' => - array ( - 0 => 'email-reply/1.1.7', - ), - // 1.1.8 was never released - '1.1.9' => - array ( - 0 => 'email-reply/1.1.9', - ), - '1.1.10' => - array ( - 0 => 'email-reply/1.1.10', - ), - ), - ), - ); + // Generated by the Factory using the page export_component_versions_for_normalisation.php + return [ + 'combodo-approval-process-light' => + [ + 'label' => 'Approval process light', + 'description' => 'Approve a request via a simple email', + 'versions' => + [ + '1.0.1' => + [ + 0 => 'approval-base/2.1.0', + 1 => 'combodo-approval-light/1.0.1', + ], + '1.0.2' => + [ + 0 => 'approval-base/2.1.1', + 1 => 'combodo-approval-light/1.0.2', + ], + '1.0.3' => + [ + 0 => 'approval-base/2.1.2', + 1 => 'combodo-approval-light/1.0.2', + ], + '1.1.0' => + [ + 0 => 'approval-base/2.2.2', + 1 => 'combodo-approval-light/1.0.2', + ], + '1.1.1' => + [ + 0 => 'approval-base/2.2.3', + 1 => 'combodo-approval-light/1.0.2', + ], + '1.1.2' => + [ + 0 => 'approval-base/2.2.6', + 1 => 'combodo-approval-light/1.0.2', + ], + '1.1.3' => + [ + 0 => 'approval-base/2.2.6', + 1 => 'combodo-approval-light/1.0.3', + ], + '1.2.0' => + [ + 0 => 'approval-base/2.3.0', + 1 => 'combodo-approval-light/1.0.3', + ], + '1.2.1' => + [ + 0 => 'approval-base/2.4.0', + 1 => 'combodo-approval-light/1.0.4', + ], + '1.3.0' => + [ + 0 => 'approval-base/2.4.2', + 1 => 'combodo-approval-light/1.1.1', + ], + '1.3.1' => + [ + 0 => 'approval-base/2.5.0', + 1 => 'combodo-approval-light/1.1.1', + ], + '1.3.2' => + [ + 0 => 'approval-base/2.5.0', + 1 => 'combodo-approval-light/1.1.2', + ], + '1.2.2' => + [ + 0 => 'approval-base/2.4.2', + 1 => 'combodo-approval-light/1.0.5', + ], + '1.3.3' => + [ + 0 => 'approval-base/2.5.1', + 1 => 'combodo-approval-light/1.1.2', + ], + '1.3.4' => + [ + 0 => 'approval-base/2.5.2', + 1 => 'combodo-approval-light/1.1.2', + ], + '1.3.5' => + [ + 0 => 'approval-base/2.5.3', + 1 => 'combodo-approval-light/1.1.2', + ], + '1.4.0' => + [ + 0 => 'approval-base/2.5.3', + 1 => 'combodo-approval-light/1.1.2', + 2 => 'itop-approval-portal/1.0.0', + ], + ], + ], + 'combodo-approval-process-automation' => + [ + 'label' => 'Approval process automation', + 'description' => 'Control your approval process with predefined rules based on service catalog', + 'versions' => + [ + '1.0.1' => + [ + 0 => 'approval-base/2.1.0', + 1 => 'combodo-approval-extended/1.0.2', + ], + '1.0.2' => + [ + 0 => 'approval-base/2.1.1', + 1 => 'combodo-approval-extended/1.0.4', + ], + '1.0.3' => + [ + 0 => 'approval-base/2.1.2', + 1 => 'combodo-approval-extended/1.0.4', + ], + '1.1.0' => + [ + 0 => 'approval-base/2.2.2', + 1 => 'combodo-approval-extended/1.0.4', + ], + '1.1.1' => + [ + 0 => 'approval-base/2.2.3', + 1 => 'combodo-approval-extended/1.0.4', + ], + '1.1.2' => + [ + 0 => 'approval-base/2.2.6', + 1 => 'combodo-approval-extended/1.0.5', + ], + '1.1.3' => + [ + 0 => 'approval-base/2.2.6', + 1 => 'combodo-approval-extended/1.0.6', + ], + '1.2.0' => + [ + 0 => 'approval-base/2.3.0', + 1 => 'combodo-approval-extended/1.0.7', + ], + '1.2.1' => + [ + 0 => 'approval-base/2.4.0', + 1 => 'combodo-approval-extended/1.0.8', + ], + '1.3.0' => + [ + 0 => 'approval-base/2.4.2', + 1 => 'combodo-approval-extended/1.2.1', + ], + '1.3.1' => + [ + 0 => 'approval-base/2.5.0', + 1 => 'combodo-approval-extended/1.2.1', + ], + '1.3.2' => + [ + 0 => 'approval-base/2.5.0', + 1 => 'combodo-approval-extended/1.2.2', + ], + '1.2.2' => + [ + 0 => 'approval-base/2.4.2', + 1 => 'combodo-approval-extended/1.0.9', + ], + '1.3.3' => + [ + 0 => 'approval-base/2.5.1', + 1 => 'combodo-approval-extended/1.2.3', + ], + '1.3.4' => + [ + 0 => 'approval-base/2.5.2', + 1 => 'combodo-approval-extended/1.2.3', + ], + '1.3.5' => + [ + 0 => 'approval-base/2.5.3', + 1 => 'combodo-approval-extended/1.2.3', + ], + '1.4.0' => + [ + 0 => 'approval-base/2.5.3', + 1 => 'combodo-approval-extended/1.2.3', + 3 => 'itop-approval-portal/1.0.0', + ], + ], + ], + 'combodo-predefined-response-models' => + [ + 'label' => 'Predefined response models', + 'description' => 'Pick common answers from a list of predefined replies grouped by categories to update tickets log', + 'versions' => + [ + '1.0.0' => + [ + 0 => 'precanned-replies/1.0.0', + 1 => 'precanned-replies-pro/1.0.0', + ], + '1.0.1' => + [ + 0 => 'precanned-replies/1.0.1', + 1 => 'precanned-replies-pro/1.0.1', + ], + '1.0.2' => + [ + 0 => 'precanned-replies/1.0.2', + 1 => 'precanned-replies-pro/1.0.1', + ], + '1.0.3' => + [ + 0 => 'precanned-replies/1.0.3', + 1 => 'precanned-replies-pro/1.0.1', + ], + '1.0.4' => + [ + 0 => 'precanned-replies/1.0.3', + 1 => 'precanned-replies-pro/1.0.2', + ], + '1.0.5' => + [ + 0 => 'precanned-replies/1.0.4', + 1 => 'precanned-replies-pro/1.0.2', + ], + '1.1.0' => + [ + 0 => 'precanned-replies/1.1.0', + 1 => 'precanned-replies-pro/1.0.2', + ], + '1.1.1' => + [ + 0 => 'precanned-replies/1.1.1', + 1 => 'precanned-replies-pro/1.0.2', + ], + ], + ], + 'combodo-customized-request-forms' => + [ + 'label' => 'Customized request forms', + 'description' => 'Define personalized request forms based on the service catalog. Add extra fields for a given type of request.', + 'versions' => + [ + '1.0.1' => + [ + 0 => 'templates-base/2.1.1', + 1 => 'itop-request-template/1.0.0', + ], + '1.0.2' => + [ + 0 => 'templates-base/2.1.2', + 1 => 'itop-request-template/1.0.0', + ], + '1.0.3' => + [ + 0 => 'templates-base/2.1.2', + 1 => 'itop-request-template/1.0.1', + ], + '1.0.4' => + [ + 0 => 'templates-base/2.1.3', + 1 => 'itop-request-template/1.0.1', + ], + '1.0.5' => + [ + 0 => 'templates-base/2.1.4', + 1 => 'itop-request-template/1.0.1', + ], + '2.0.0' => + [ + 0 => 'templates-base/3.0.0', + 1 => 'itop-request-template/2.0.0', + 2 => 'itop-request-template-portal/1.0.0', + ], + '2.0.1' => + [ + 0 => 'templates-base/3.0.1', + 1 => 'itop-request-template/2.0.0', + 2 => 'itop-request-template-portal/1.0.0', + ], + '2.0.2' => + [ + 0 => 'templates-base/3.0.2', + 1 => 'itop-request-template/2.0.0', + 2 => 'itop-request-template-portal/1.0.0', + ], + '2.0.3' => + [ + 0 => 'templates-base/3.0.4', + 1 => 'itop-request-template/2.0.0', + 2 => 'itop-request-template-portal/1.0.0', + ], + '2.0.4' => + [ + 0 => 'templates-base/3.0.5', + 1 => 'itop-request-template/2.0.0', + 2 => 'itop-request-template-portal/1.0.0', + ], + '2.0.5' => + [ + 0 => 'templates-base/3.0.6', + 1 => 'itop-request-template/2.0.0', + 2 => 'itop-request-template-portal/1.0.0', + ], + '2.0.6' => + [ + 0 => 'templates-base/3.0.8', + 1 => 'itop-request-template/2.0.0', + 2 => 'itop-request-template-portal/1.0.0', + ], + '2.0.7' => + [ + 0 => 'templates-base/3.0.9', + 1 => 'itop-request-template/2.0.0', + 2 => 'itop-request-template-portal/1.0.0', + ], + '2.0.8' => + [ + 0 => 'templates-base/3.0.12', + 1 => 'itop-request-template/2.0.0', + 2 => 'itop-request-template-portal/1.0.0', + ], + ], + ], + 'combodo-sla-considering-business-hours' => + [ + 'label' => 'SLA considering business hours', + 'description' => 'Compute SLAs taking into account service coverage window and holidays', + 'versions' => + [ + '2.0.1' => + [ + 0 => 'combodo-sla-computation/2.0.1', + 1 => 'combodo-coverage-windows-computation/2.0.0', + ], + '2.1.0' => + [ + 0 => 'combodo-sla-computation/2.1.0', + 1 => 'combodo-coverage-windows-computation/2.0.0', + ], + '2.1.1' => + [ + 0 => 'combodo-sla-computation/2.1.1', + 1 => 'combodo-coverage-windows-computation/2.0.0', + ], + '2.1.2' => + [ + 0 => 'combodo-sla-computation/2.1.2', + 1 => 'combodo-coverage-windows-computation/2.0.0', + ], + '2.1.3' => + [ + 0 => 'combodo-sla-computation/2.1.2', + 1 => 'combodo-coverage-windows-computation/2.0.1', + ], + '2.0.2' => + [ + 0 => 'combodo-sla-computation/2.0.1', + 1 => 'combodo-coverage-windows-computation/2.0.1', + ], + '2.1.4' => + [ + 0 => 'combodo-sla-computation/2.1.3', + 1 => 'combodo-coverage-windows-computation/2.0.1', + ], + '2.1.5' => + [ + 0 => 'combodo-sla-computation/2.1.5', + 1 => 'combodo-coverage-windows-computation/2.0.1', + ], + '2.1.6' => + [ + 0 => 'combodo-sla-computation/2.1.5', + 1 => 'combodo-coverage-windows-computation/2.0.2', + ], + '2.1.7' => + [ + 0 => 'combodo-sla-computation/2.1.6', + 1 => 'combodo-coverage-windows-computation/2.0.2', + ], + '2.1.8' => + [ + 0 => 'combodo-sla-computation/2.1.7', + 1 => 'combodo-coverage-windows-computation/2.0.2', + ], + '2.1.9' => + [ + 0 => 'combodo-sla-computation/2.1.8', + 1 => 'combodo-coverage-windows-computation/2.0.2', + ], + ], + ], + 'combodo-mail-to-ticket-automation' => + [ + 'label' => 'Mail to ticket automation', + 'description' => 'Scan several mailboxes to create or update tickets.', + 'versions' => + [ + '2.6.0' => + [ + 0 => 'combodo-email-synchro/2.6.0', + 1 => 'itop-standard-email-synchro/2.6.0', + ], + '2.6.1' => + [ + 0 => 'combodo-email-synchro/2.6.1', + 1 => 'itop-standard-email-synchro/2.6.0', + ], + '2.6.2' => + [ + 0 => 'combodo-email-synchro/2.6.2', + 1 => 'itop-standard-email-synchro/2.6.0', + ], + '2.6.3' => + [ + 0 => 'combodo-email-synchro/2.6.2', + 1 => 'itop-standard-email-synchro/2.6.1', + ], + '2.6.4' => + [ + 0 => 'combodo-email-synchro/2.6.3', + 1 => 'itop-standard-email-synchro/2.6.2', + ], + '2.6.5' => + [ + 0 => 'combodo-email-synchro/2.6.4', + 1 => 'itop-standard-email-synchro/2.6.2', + ], + '2.6.6' => + [ + 0 => 'combodo-email-synchro/2.6.5', + 1 => 'itop-standard-email-synchro/2.6.3', + ], + '2.6.7' => + [ + 0 => 'combodo-email-synchro/2.6.6', + 1 => 'itop-standard-email-synchro/2.6.4', + ], + '2.6.8' => + [ + 0 => 'combodo-email-synchro/2.6.7', + 1 => 'itop-standard-email-synchro/2.6.4', + ], + '2.6.9' => + [ + 0 => 'combodo-email-synchro/2.6.8', + 1 => 'itop-standard-email-synchro/2.6.5', + ], + '2.6.10' => + [ + 0 => 'combodo-email-synchro/2.6.9', + 1 => 'itop-standard-email-synchro/2.6.6', + ], + '2.6.11' => + [ + 0 => 'combodo-email-synchro/2.6.10', + 1 => 'itop-standard-email-synchro/2.6.6', + ], + '2.6.12' => + [ + 0 => 'combodo-email-synchro/2.6.11', + 1 => 'itop-standard-email-synchro/2.6.6', + ], + '3.0.0' => + [ + 0 => 'combodo-email-synchro/3.0.0', + 1 => 'itop-standard-email-synchro/3.0.0', + ], + '3.0.1' => + [ + 0 => 'combodo-email-synchro/3.0.1', + 1 => 'itop-standard-email-synchro/3.0.1', + ], + '3.0.2' => + [ + 0 => 'combodo-email-synchro/3.0.2', + 1 => 'itop-standard-email-synchro/3.0.1', + ], + '3.0.3' => + [ + 0 => 'combodo-email-synchro/3.0.3', + 1 => 'itop-standard-email-synchro/3.0.3', + ], + '3.0.4' => + [ + 0 => 'combodo-email-synchro/3.0.3', + 1 => 'itop-standard-email-synchro/3.0.4', + ], + '3.0.5' => + [ + 0 => 'combodo-email-synchro/3.0.4', + 1 => 'itop-standard-email-synchro/3.0.4', + ], + '3.0.6' => + [ + 0 => 'combodo-email-synchro/3.0.5', + 1 => 'itop-standard-email-synchro/3.0.4', + ], + '3.0.7' => + [ + 0 => 'combodo-email-synchro/3.0.5', + 1 => 'itop-standard-email-synchro/3.0.5', + ], + ], + ], + 'combodo-configurator-for-automatic-object-creation' => + [ + 'label' => 'Configurator for automatic object creation', + 'description' => 'Templating based on existing objects.', + 'versions' => + [ + '1.0.13' => + [ + 1 => 'itop-stencils/1.0.6', + ], + ], + ], + 'combodo-user-actions-configurator' => + [ + 'label' => 'User actions configurator', + 'description' => 'Configure user actions to simplify and automate processes (e.g. create an incident from a CI).', + 'versions' => + [ + '1.0.0' => + [ + 0 => 'itop-object-copier/1.0.0', + ], + '1.0.1' => + [ + 0 => 'itop-object-copier/1.0.1', + ], + '1.0.2' => + [ + 0 => 'itop-object-copier/1.0.2', + ], + '1.0.3' => + [ + 0 => 'itop-object-copier/1.0.3', + ], + '1.1.0' => + [ + 0 => 'itop-object-copier/1.1.0', + ], + '1.1.1' => + [ + 0 => 'itop-object-copier/1.1.1', + ], + '1.1.2' => + [ + 0 => 'itop-object-copier/1.1.2', + ], + '1.1.3' => + [ + 0 => 'itop-object-copier/1.1.3', + ], + '1.1.4' => + [ + 0 => 'itop-object-copier/1.1.4', + ], + '1.1.5' => + [ + 0 => 'itop-object-copier/1.1.5', + ], + '1.1.6' => + [ + 0 => 'itop-object-copier/1.1.6', + ], + '1.1.7' => + [ + 0 => 'itop-object-copier/1.1.7', + ], + '1.1.8' => + [ + 0 => 'itop-object-copier/1.1.8', + ], + ], + ], + 'combodo-send-updates-by-email' => + [ + 'label' => 'Send updates by email', + 'description' => 'Send an email to pre-configured contacts when a ticket log is updated.', + 'versions' => + [ + '1.0.1' => + [ + 0 => 'email-reply/1.0.1', + ], + '1.0.3' => + [ + 0 => 'email-reply/1.0.3', + ], + '1.1.1' => + [ + 0 => 'email-reply/1.1.1', + ], + '1.1.2' => + [ + 0 => 'email-reply/1.1.2', + ], + '1.1.3' => + [ + 0 => 'email-reply/1.1.3', + ], + '1.1.4' => + [ + 0 => 'email-reply/1.1.4', + ], + '1.1.5' => + [ + 0 => 'email-reply/1.1.5', + ], + '1.1.6' => + [ + 0 => 'email-reply/1.1.6', + ], + '1.1.7' => + [ + 0 => 'email-reply/1.1.7', + ], + // 1.1.8 was never released + '1.1.9' => + [ + 0 => 'email-reply/1.1.9', + ], + '1.1.10' => + [ + 0 => 'email-reply/1.1.10', + ], + ], + ], + ]; } } diff --git a/setup/index.php b/setup/index.php index 468ba60da..1ff7201f3 100644 --- a/setup/index.php +++ b/setup/index.php @@ -1,4 +1,5 @@ array( + public static $aVersions = [ + '1.0' => [ 'previous' => null, 'go_to_previous' => null, 'next' => '1.1', 'go_to_next' => 'From10To11', - ), - '1.1' => array( + ], + '1.1' => [ 'previous' => '1.0', 'go_to_previous' => 'From11To10', 'next' => '1.2', 'go_to_next' => 'From11To12', - ), - '1.2' => array( + ], + '1.2' => [ 'previous' => '1.1', 'go_to_previous' => 'From12To11', 'next' => '1.3', 'go_to_next' => 'From12To13', - ), - '1.3' => array( // iTop >= 2.2.0 + ], + '1.3' => [ // iTop >= 2.2.0 'previous' => '1.2', 'go_to_previous' => 'From13To12', 'next' => '1.4', 'go_to_next' => 'From13To14', - ), - '1.4' => array( // iTop >= 2.4.0 + ], + '1.4' => [ // iTop >= 2.4.0 'previous' => '1.3', 'go_to_previous' => 'From14To13', 'next' => '1.5', 'go_to_next' => 'From14To15', - ), - '1.5' => array( // iTop >= 2.5.0 + ], + '1.5' => [ // iTop >= 2.5.0 'previous' => '1.4', 'go_to_previous' => 'From15To14', 'next' => '1.6', 'go_to_next' => 'From15To16', - ), - '1.6' => array( // iTop >= 2.6.0 + ], + '1.6' => [ // iTop >= 2.6.0 'previous' => '1.5', 'go_to_previous' => 'From16To15', 'next' => '1.7', 'go_to_next' => 'From16To17', - ), - '1.7' => array( // iTop >= 2.7.0 + ], + '1.7' => [ // iTop >= 2.7.0 'previous' => '1.6', 'go_to_previous' => 'From17To16', 'next' => '3.0', 'go_to_next' => 'From17To30', - ), - '3.0' => array( + ], + '3.0' => [ 'previous' => '1.7', 'go_to_previous' => 'From30To17', 'next' => '3.1', 'go_to_next' => 'From30To31', - ), - '3.1' => array( + ], + '3.1' => [ 'previous' => '3.0', 'go_to_previous' => 'From31To30', 'next' => '3.2', 'go_to_next' => 'From31To32', - ), - '3.2' => array( + ], + '3.2' => [ 'previous' => '3.1', 'go_to_previous' => 'From32To31', 'next' => null, 'go_to_next' => null, - ), - ); + ], + ]; /** * The Document to work on @@ -148,10 +148,10 @@ class iTopDesignFormat */ protected function LogError($sMessage) { - $this->aLog[] = array( + $this->aLog[] = [ 'severity' => 'Error', 'msg' => $sMessage, - ); + ]; $this->bStatus = false; } @@ -161,10 +161,10 @@ class iTopDesignFormat */ protected function LogWarning($sMessage) { - $this->aLog[] = array( + $this->aLog[] = [ 'severity' => 'Warning', 'msg' => $sMessage, - ); + ]; } /** @@ -173,10 +173,10 @@ class iTopDesignFormat */ protected function LogInfo($sMessage) { - $this->aLog[] = array( + $this->aLog[] = [ 'severity' => 'Info', 'msg' => $sMessage, - ); + ]; } /** @@ -207,11 +207,9 @@ class iTopDesignFormat */ public function GetErrors() { - $aErrors = array(); - foreach ($this->aLog as $aLogEntry) - { - if ($aLogEntry['severity'] == 'Error') - { + $aErrors = []; + foreach ($this->aLog as $aLogEntry) { + if ($aLogEntry['severity'] == 'Error') { $aErrors[] = $aLogEntry['msg']; } } @@ -223,11 +221,9 @@ class iTopDesignFormat */ public function GetWarnings() { - $aErrors = array(); - foreach ($this->aLog as $aLogEntry) - { - if ($aLogEntry['severity'] == 'Warning') - { + $aErrors = []; + foreach ($this->aLog as $aLogEntry) { + if ($aLogEntry['severity'] == 'Warning') { $aErrors[] = $aLogEntry['msg']; } } @@ -284,33 +280,35 @@ class iTopDesignFormat */ public static function GetItopNodePath($oNode) { - if ($oNode instanceof DOMDocument) return ''; + if ($oNode instanceof DOMDocument) { + return ''; + } $sId = $oNode->getAttribute('id'); $sNodeDesc = ($sId != '') ? $oNode->nodeName.'['.$sId.']' : $oNode->nodeName; return self::GetItopNodePath($oNode->parentNode).'/'.$sNodeDesc; - } + } /** * Test the conversion without altering the DOM - * + * * @param string $sTargetVersion The desired version (or the latest possible version if not specified) * @param object $oFactory Full data model (not yet used, aimed at allowing conversion that could not be performed without knowing the * whole data model) * - * @return bool True on success + * @return bool True on success */ public function CheckConvert($sTargetVersion = ITOP_DESIGN_LATEST_VERSION, $oFactory = null) { // Clone the document - $this->oDocument = $this->oDocument->cloneNode(true); + $this->oDocument = $this->oDocument->cloneNode(true); return $this->Convert($sTargetVersion, $oFactory); } /** * Make adjustements to the DOM to migrate it to the specified version (default is latest) * For now only the conversion from version 1.0 to 1.1 is supported. - * + * * @param string $sTargetVersion The desired version (or the latest possible version if not specified) * @param object $oFactory Full data model (not yet used, aimed at allowing conversion that could not be performed without knowing the * whole data model) @@ -319,13 +317,12 @@ class iTopDesignFormat */ public function Convert($sTargetVersion = ITOP_DESIGN_LATEST_VERSION, $oFactory = null) { - $this->aLog = array(); + $this->aLog = []; $this->bStatus = true; try { $sVersion = $this->GetVersion(); - } - catch (iTopXmlException $e) { + } catch (iTopXmlException $e) { $this->LogError($e->getMessage()); return $this->bStatus; @@ -334,8 +331,7 @@ class iTopDesignFormat $this->LogInfo("Converting from $sVersion to $sTargetVersion"); try { $this->DoConvert($sVersion, $sTargetVersion, $oFactory); - } - catch (Exception|Error $e) { + } catch (Exception|Error $e) { $this->LogError($e->getMessage()); return false; @@ -353,7 +349,7 @@ class iTopDesignFormat /** * Does the conversion, eventually in a recursive manner - * + * * @param string $sFrom The source format version * @param string $sTo The desired format version * @param object $oFactory Full data model (not yet used, aimed at allowing conversion that could not be performed without knowing the @@ -361,47 +357,40 @@ class iTopDesignFormat */ protected function DoConvert($sFrom, $sTo, $oFactory = null) { - if ($sFrom == $sTo) - { + if ($sFrom == $sTo) { return; } - if (!array_key_exists($sFrom, self::$aVersions)) - { + if (!array_key_exists($sFrom, self::$aVersions)) { $this->LogError("Unknown source format version: $sFrom"); return; } - if (!array_key_exists($sTo, self::$aVersions)) - { + if (!array_key_exists($sTo, self::$aVersions)) { $this->LogError("Unknown target format version: $sTo"); return; // unknown versions are not supported } - + $aVersionIds = array_keys(self::$aVersions); $iFrom = array_search($sFrom, $aVersionIds); $iTo = array_search($sTo, $aVersionIds); - if ($iFrom < $iTo) - { + if ($iFrom < $iTo) { // This is an upgrade $sIntermediate = self::$aVersions[$sFrom]['next']; $sTransform = self::$aVersions[$sFrom]['go_to_next']; $this->LogInfo("Upgrading from $sFrom to $sIntermediate ($sTransform)"); - } - else - { + } else { // This is a downgrade $sIntermediate = self::$aVersions[$sFrom]['previous']; $sTransform = self::$aVersions[$sFrom]['go_to_previous']; $this->LogInfo("Downgrading from $sFrom to $sIntermediate ($sTransform)"); } // Transform to the intermediate format - $aCallSpec = array($this, $sTransform); + $aCallSpec = [$this, $sTransform]; try { call_user_func($aCallSpec, $oFactory); // Recurse $this->DoConvert($sIntermediate, $sTo, $oFactory); - } - catch (Exception $e) { + } catch (Exception $e) { $this->LogError($e->getMessage()); } } @@ -436,45 +425,37 @@ class iTopDesignFormat // which don't already have one $oXPath = new DOMXPath($this->oDocument); $oNodeList = $oXPath->query('/itop_design/classes//class/lifecycle/states/state/transitions/transition/stimulus'); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $oNode->parentNode->SetAttribute('id', $oNode->textContent); $this->DeleteNode($oNode); } - + // Adjust the XML to transparently add an id (=percent) on all thresholds of stopwatches // which don't already have one $oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@xsi:type='AttributeStopWatch']/thresholds/threshold/percent"); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $oNode->parentNode->SetAttribute('id', $oNode->textContent); $this->DeleteNode($oNode); } - + // Adjust the XML to transparently add an id (=action:) on all allowed actions (profiles) // which don't already have one $oNodeList = $oXPath->query('/itop_design/user_rights/profiles/profile/groups/group/actions/action'); - foreach ($oNodeList as $oNode) - { - if ($oNode->getAttribute('id') == '') - { - $oNode->SetAttribute('id', 'action:' . $oNode->getAttribute('xsi:type')); + foreach ($oNodeList as $oNode) { + if ($oNode->getAttribute('id') == '') { + $oNode->SetAttribute('id', 'action:'.$oNode->getAttribute('xsi:type')); $oNode->removeAttribute('xsi:type'); - } - elseif ($oNode->getAttribute('xsi:type') == 'stimulus') - { - $oNode->SetAttribute('id', 'stimulus:' . $oNode->getAttribute('id')); + } elseif ($oNode->getAttribute('xsi:type') == 'stimulus') { + $oNode->SetAttribute('id', 'stimulus:'.$oNode->getAttribute('id')); $oNode->removeAttribute('xsi:type'); } } - + // Adjust the XML to transparently add an id (=value) on all values of an enum which don't already have one. // This enables altering an enum for just adding/removing one value, intead of redefining the whole list of values. $oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@xsi:type='AttributeEnum']/values/value"); - foreach ($oNodeList as $oNode) - { - if ($oNode->getAttribute('id') == '') - { + foreach ($oNodeList as $oNode) { + if ($oNode->getAttribute('id') == '') { $oNode->SetAttribute('id', $oNode->textContent); } } @@ -490,60 +471,49 @@ class iTopDesignFormat // Move the id down to a stimulus node on all life-cycle transitions $oXPath = new DOMXPath($this->oDocument); $oNodeList = $oXPath->query('/itop_design/classes//class/lifecycle/states/state/transitions/transition[@id]'); - foreach ($oNodeList as $oNode) - { - if ($oXPath->query('descendant-or-self::*[@_delta or @_rename_from]', $oNode)->length > 0) - { + foreach ($oNodeList as $oNode) { + if ($oXPath->query('descendant-or-self::*[@_delta or @_rename_from]', $oNode)->length > 0) { $this->LogError('Alterations have been defined under the node: '.self::GetItopNodePath($oNode)); } $oStimulus = $oNode->ownerDocument->createElement('stimulus', $oNode->getAttribute('id')); $oNode->appendChild($oStimulus); $oNode->removeAttribute('id'); } - + // Move the id down to a percent node on all thresholds $oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@xsi:type='AttributeStopWatch']/thresholds/threshold[@id]"); - foreach ($oNodeList as $oNode) - { - if ($oXPath->query('descendant-or-self::*[@_delta or @_rename_from]', $oNode)->length > 0) - { + foreach ($oNodeList as $oNode) { + if ($oXPath->query('descendant-or-self::*[@_delta or @_rename_from]', $oNode)->length > 0) { $this->LogError('Alterations have been defined under the node: '.self::GetItopNodePath($oNode)); } $oStimulus = $oNode->ownerDocument->createElement('percent', $oNode->getAttribute('id')); $oNode->appendChild($oStimulus); $oNode->removeAttribute('id'); } - - // Restore the type and id on profile/actions + + // Restore the type and id on profile/actions $oNodeList = $oXPath->query('/itop_design/user_rights/profiles/profile/groups/group/actions/action'); - foreach ($oNodeList as $oNode) - { - if ($oXPath->query('descendant-or-self::*[@_delta or @_rename_from]', $oNode)->length > 0) - { + foreach ($oNodeList as $oNode) { + if ($oXPath->query('descendant-or-self::*[@_delta or @_rename_from]', $oNode)->length > 0) { $this->LogError('Alterations have been defined under the node: '.self::GetItopNodePath($oNode)); } - if (substr($oNode->getAttribute('id'), 0, strlen('action')) == 'action') - { + if (substr($oNode->getAttribute('id'), 0, strlen('action')) == 'action') { // The id has the form 'action:' $sActionCode = substr($oNode->getAttribute('id'), strlen('action:')); $oNode->removeAttribute('id'); $oNode->setAttribute('xsi:type', $sActionCode); - } - else - { + } else { // The id has the form 'stimulus:' $sStimulusCode = substr($oNode->getAttribute('id'), strlen('stimulus:')); $oNode->setAttribute('id', $sStimulusCode); $oNode->setAttribute('xsi:type', 'stimulus'); } } - + // Remove the id on all enum values $oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@xsi:type='AttributeEnum']/values/value[@id]"); - foreach ($oNodeList as $oNode) - { - if ($oXPath->query('descendant-or-self::*[@_delta or @_rename_from]', $oNode)->length > 0) - { + foreach ($oNodeList as $oNode) { + if ($oXPath->query('descendant-or-self::*[@_delta or @_rename_from]', $oNode)->length > 0) { $this->LogError('Alterations have been defined under the node: '.self::GetItopNodePath($oNode)); } $oNode->removeAttribute('id'); @@ -571,8 +541,7 @@ class iTopDesignFormat // Transform ObjectKey attributes into Integer // $oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@xsi:type='AttributeObjectKey']"); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $oNode->setAttribute('xsi:type', 'AttributeInteger'); // The property class_attcode is left there (doing no harm) $this->LogWarning('The attribute '.self::GetItopNodePath($oNode).' has been degraded into an integer attribute. Any OQL query using this attribute will fail.'); @@ -581,37 +550,32 @@ class iTopDesignFormat // Remove Redundancy settings attributes (no redundancy could be defined in the previous format) // $oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@xsi:type='AttributeRedundancySettings']"); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $this->LogWarning('The attribute '.self::GetItopNodePath($oNode).' is of no use and must be removed.'); $this->DeleteNode($oNode); } // Later: transform the relations into code (iif defined as an SQL query) $oNodeList = $oXPath->query('/itop_design/classes//class/relations'); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $this->LogWarning('The relations defined in '.self::GetItopNodePath($oNode).' will be lost.'); $this->DeleteNode($oNode); } $oNodeList = $oXPath->query('/itop_design/portal'); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $this->LogWarning('Portal definition will be lost.'); $this->DeleteNode($oNode); } $oNodeList = $oXPath->query('/itop_design/module_parameters'); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $this->LogWarning('Module parameters will be lost.'); $this->DeleteNode($oNode); } $oNodeList = $oXPath->query('/itop_design/snippets'); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $this->LogWarning('Code snippets will be lost.'); $this->DeleteNode($oNode); } @@ -636,8 +600,7 @@ class iTopDesignFormat $oXPath = new DOMXPath($this->oDocument); $oNodeList = $oXPath->query('/itop_design/module_designs/module_design'); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $this->LogWarning('The module design defined in '.self::GetItopNodePath($oNode).' will be lost.'); $this->DeleteNode($oNode); } @@ -645,8 +608,7 @@ class iTopDesignFormat // Remove MetaEnum attributes // $oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@xsi:type='AttributeMetaEnum']"); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $this->LogWarning('The attribute '.self::GetItopNodePath($oNode).' is irrelevant and must be removed.'); $this->DeleteNode($oNode); } @@ -654,8 +616,7 @@ class iTopDesignFormat // Remove CustomFields attributes // $oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@xsi:type='AttributeCustomFields']"); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $this->LogWarning('The attribute '.self::GetItopNodePath($oNode).' is irrelevant and must be removed.'); $this->DeleteNode($oNode); } @@ -663,8 +624,7 @@ class iTopDesignFormat // Remove Image attributes // $oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@xsi:type='AttributeImage']"); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $this->LogWarning('The attribute '.self::GetItopNodePath($oNode).' is irrelevant and must be removed.'); $this->DeleteNode($oNode); } @@ -672,8 +632,7 @@ class iTopDesignFormat // Discard _delta="if_exists" // $oNodeList = $oXPath->query("//*[@_delta='if_exists']"); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $this->LogWarning('The flag _delta="if_exists" on '.self::GetItopNodePath($oNode).' is irrelevant and must be replaced by _delta="must_exist".'); $oNode->setAttribute('_delta', 'must_exist'); } @@ -696,30 +655,27 @@ class iTopDesignFormat protected function From14To13($oFactory) { $oXPath = new DOMXPath($this->oDocument); - + // Transform _delta="force" into _delta="define" // $oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@_delta='force']"); $iCount = 0; - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $oNode->setAttribute('_delta', 'define'); $iCount++; } - if ($iCount > 0) - { + if ($iCount > 0) { $this->LogWarning('The attribute _delta="force" is not supported, converted to _delta="define" ('.$iCount.' instances processed).'); } - // Remove attribute flags on transitions - // - $oNodeList = $oXPath->query("/itop_design/classes//class/lifecycle/states/state/transitions/transition/flags"); - $this->LogWarning('Before removing flags nodes'); - foreach ($oNodeList as $oNode) - { - $this->LogWarning('Attribute flags '.self::GetItopNodePath($oNode).' is irrelevant on transition and must be removed.'); - $this->DeleteNode($oNode); - } + // Remove attribute flags on transitions + // + $oNodeList = $oXPath->query("/itop_design/classes//class/lifecycle/states/state/transitions/transition/flags"); + $this->LogWarning('Before removing flags nodes'); + foreach ($oNodeList as $oNode) { + $this->LogWarning('Attribute flags '.self::GetItopNodePath($oNode).' is irrelevant on transition and must be removed.'); + $this->DeleteNode($oNode); + } } /** @@ -735,8 +691,7 @@ class iTopDesignFormat // $sPath = "/itop_design/menus/menu[@xsi:type!='MenuGroup' and @xsi:type!='TemplateMenuNode']"; $oNodeList = $oXPath->query("$sPath/enable_class | $sPath/enable_action | $sPath/enable_permission | $sPath/enable_stimulus"); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $this->LogWarning('Node '.self::GetItopNodePath($oNode).' is irrelevant in this version, it will be ignored. Use enable_admin_only instead.'); } } @@ -786,14 +741,16 @@ class iTopDesignFormat protected function From16To17($oFactory) { // N°2275 Clean branding node (move "define" from collection to logos or theme, noe that any other nodes will be seen as "merge") - $this->CleanDefineOnCollectionNode('/itop_design/branding', - '*[self::main_logo or self::login_logo or self::portal_logo]|themes/theme'); + $this->CleanDefineOnCollectionNode( + '/itop_design/branding', + '*[self::main_logo or self::login_logo or self::portal_logo]|themes/theme' + ); // N°2275 Clean portal form properties node (move "define" from collection to each property) $this->CleanDefineOnCollectionNode('/itop_design/module_designs/module_design[@id="itop-portal"]/forms/form/properties', '*'); // N°2806 Clean legacy portal constants - $aConstantsIDsToRemove = array( + $aConstantsIDsToRemove = [ 'PORTAL_POWER_USER_PROFILE', 'PORTAL_SERVICECATEGORY_QUERY', 'PORTAL_SERVICE_SUBCATEGORY_QUERY', @@ -823,9 +780,8 @@ class iTopDesignFormat 'PORTAL_USERREQUEST_DETAILS_ZLIST', 'PORTAL_USERREQUEST_DISPLAY_QUERY', 'PORTAL_USERREQUEST_DISPLAY_POWERUSER_QUERY', - ); - foreach($aConstantsIDsToRemove as $sConstantIDToRemove) - { + ]; + foreach ($aConstantsIDsToRemove as $sConstantIDToRemove) { $sXPath = '/itop_design/constants/constant[@id="'.$sConstantIDToRemove.'"]'; $this->RemoveNodeFromXPath($sXPath); } @@ -914,12 +870,12 @@ class iTopDesignFormat $oNode->setAttribute('id', 'ibo-page-banner--background-color'); } - $oNodeList = $oXPath->query( '/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="backoffice-environment-banner-text-color"]'); + $oNodeList = $oXPath->query('/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="backoffice-environment-banner-text-color"]'); foreach ($oNodeList as $oNode) { $oNode->setAttribute('id', 'ibo-page-banner--text-color'); } - $oNodeList = $oXPath->query( '/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="backoffice-environment-banner-text-content"]'); + $oNodeList = $oXPath->query('/itop_design/branding/themes/theme[@id="test-red"]/variables/variable[@id="backoffice-environment-banner-text-content"]'); foreach ($oNodeList as $oNode) { $oNode->setAttribute('id', 'ibo-page-banner--text-content'); } @@ -1032,12 +988,12 @@ class iTopDesignFormat } // Add new attribute to theme import nodes - + $oNodeList = $oXPath->query('/itop_design/branding/themes/theme/imports/import'); foreach ($oNodeList as $oNode) { $oNode->removeAttribute('xsi:type'); } - + // Remove class style $oNodeList = $oXPath->query("/itop_design/classes//class/properties"); foreach ($oNodeList as $oNode) { @@ -1126,12 +1082,11 @@ class iTopDesignFormat $oXPath = new DOMXPath($this->oDocument); $oNodeList = $oXPath->query($sPath); - foreach ($oNodeList as $oNode) - { + foreach ($oNodeList as $oNode) { $this->LogWarning('Node '.self::GetItopNodePath($oNode).' is irrelevant in this version, it will be removed.'); - $this->DeleteNode($oNode); - } + $this->DeleteNode($oNode); } + } /** * Clean a collection node by removing the _delta="define" on it and moving it to the item nodes. @@ -1149,17 +1104,14 @@ class iTopDesignFormat // Iterate over collections $oCollectionNodeList = $oXPath->query($sCollectionXPath); /** @var \DOMElement $oCollectionNode */ - foreach ($oCollectionNodeList as $oCollectionNode) - { + foreach ($oCollectionNodeList as $oCollectionNode) { // Move _delta="define" from collection to items - if (($oCollectionNode->hasAttribute('_delta')) && ($oCollectionNode->getAttribute('_delta') === "define")) - { + if (($oCollectionNode->hasAttribute('_delta')) && ($oCollectionNode->getAttribute('_delta') === "define")) { $oCollectionNode->removeAttribute('_delta'); $oItemNodeList = $oXPath->query($sItemsRelativeXPath, $oCollectionNode); /** @var \DOMElement $oItemNode */ - foreach ($oItemNodeList as $oItemNode) - { + foreach ($oItemNodeList as $oItemNode) { $oItemNode->setAttribute('_delta', 'define'); } } diff --git a/setup/modelfactory.class.inc.php b/setup/modelfactory.class.inc.php index e12064982..dea6a2f1b 100644 --- a/setup/modelfactory.class.inc.php +++ b/setup/modelfactory.class.inc.php @@ -1,4 +1,5 @@ sId = $sId; [$this->sName, $this->sVersion] = ModuleDiscovery::GetModuleName($sId); - if (strlen($this->sVersion) == 0) - { + if (strlen($this->sVersion) == 0) { $this->sVersion = '1.0.0'; } $this->sRootDir = $sRootDir; $this->sLabel = $sLabel; - $this->aDataModels = array(); + $this->aDataModels = []; $this->bAutoSelect = $bAutoSelect; $this->sAutoSelect = 'false'; - $this->aFilesToInclude = array('addons' => array(), 'business' => array(), 'webservices' => array(),); + $this->aFilesToInclude = ['addons' => [], 'business' => [], 'webservices' => [],]; if (is_null($sRootDir)) { return; } // Scan the module's root directory to find the datamodel(*).xml files - if ($hDir = opendir($sRootDir)) - { + if ($hDir = opendir($sRootDir)) { // This is the correct way to loop over the directory. (according to the documentation) - while (($sFile = readdir($hDir)) !== false) - { - if (preg_match('/^datamodel(.*)\.xml$/i', $sFile, $aMatches)) - { + while (($sFile = readdir($hDir)) !== false) { + if (preg_match('/^datamodel(.*)\.xml$/i', $sFile, $aMatches)) { $this->aDataModels[] = $this->sRootDir.'/'.$aMatches[0]; } } @@ -211,7 +208,6 @@ class MFModule } } - /** * @return string */ @@ -275,7 +271,7 @@ class MFModule */ public function ListClasses() { - return array(); + return []; } /** @@ -283,17 +279,16 @@ class MFModule */ public function GetDictionaryFiles() { - $aDictionaries = array(); - foreach (array($this->sRootDir, $this->sRootDir.'/dictionaries') as $sRootDir) - { - if ($hDir = @opendir($sRootDir)) - { - while (($sFile = readdir($hDir)) !== false) - { - $aMatches = array(); - if (preg_match("/^[^\\.]+.dict.".$this->sName.'.php$/i', $sFile, - $aMatches)) // Dictionary files are named like .dict..php - { + $aDictionaries = []; + foreach ([$this->sRootDir, $this->sRootDir.'/dictionaries'] as $sRootDir) { + if ($hDir = @opendir($sRootDir)) { + while (($sFile = readdir($hDir)) !== false) { + $aMatches = []; + if (preg_match( + "/^[^\\.]+.dict.".$this->sName.'.php$/i', + $sFile, + $aMatches + )) { // Dictionary files are named like .dict..php $aDictionaries[] = $sRootDir.'/'.$sFile; } } @@ -375,8 +370,8 @@ class MFDeltaModule extends MFModule parent::__construct('datamodel-delta', '', 'Additional Delta'); $this->sName = 'delta'; $this->sVersion = '1.0'; - $this->aDataModels = array($sDeltaFile); - $this->aFilesToInclude = array('addons' => array(), 'business' => array(), 'webservices' => array(),); + $this->aDataModels = [$sDeltaFile]; + $this->aFilesToInclude = ['addons' => [], 'business' => [], 'webservices' => [],]; } /** @@ -408,7 +403,7 @@ class MFDeltaModule extends MFModule */ public function GetDictionaryFiles() { - return array(); + return []; } } @@ -431,8 +426,8 @@ class MFCoreModule extends MFModule parent::__construct($sName, '', $sLabel); $this->sName = $sName; $this->sVersion = '1.0'; - $this->aDataModels = array($sDeltaFile); - $this->aFilesToInclude = array('addons' => array(), 'business' => array(), 'webservices' => array(),); + $this->aDataModels = [$sDeltaFile]; + $this->aFilesToInclude = ['addons' => [], 'business' => [], 'webservices' => [],]; } /** @@ -456,7 +451,7 @@ class MFCoreModule extends MFModule */ public function GetDictionaryFiles() { - return array(); + return []; } } @@ -479,8 +474,8 @@ class MFDictModule extends MFModule parent::__construct($sName, $sRootDir, $sLabel); $this->sName = $sName; $this->sVersion = '1.0'; - $this->aDataModels = array(); - $this->aFilesToInclude = array('addons' => array(), 'business' => array(), 'webservices' => array(),); + $this->aDataModels = []; + $this->aFilesToInclude = ['addons' => [], 'business' => [], 'webservices' => [],]; } /** @@ -506,22 +501,19 @@ class MFDictModule extends MFModule */ public function GetDictionaryFiles($sDir = null) { - $aDictionaries = array(); + $aDictionaries = []; $sDictionaryFilePattern = '*dictionary.itop.*.php'; - if($sDir === null) - { + if ($sDir === null) { $sDir = $this->sRootDir; } - if ($hDir = opendir($sDir)) - { + if ($hDir = opendir($sDir)) { // Matching files $aDictionaries = glob($sDir.'/'.$sDictionaryFilePattern); // Directories to scan - foreach(glob($sDir.'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $sSubDir) - { + foreach (glob($sDir.'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $sSubDir) { /** @noinspection SlowArrayOperationsInLoopInspection */ $aDictionaries = array_merge($aDictionaries, $this->GetDictionaryFiles($sSubDir)); } @@ -531,7 +523,6 @@ class MFDictModule extends MFModule } } - /** * ModelFactory: the class that manages the in-memory representation of the XML MetaModel * @@ -556,13 +547,12 @@ class ModelFactory protected $aRootDirs; protected $oDOMDocument; protected $oRoot; - static protected $aWellKnownParents = array('DBObject', 'CMDBObject', 'cmdbAbstractObject'); - static protected $aLoadedModules; - static protected $aLoadErrors; + protected static $aWellKnownParents = ['DBObject', 'CMDBObject', 'cmdbAbstractObject']; + protected static $aLoadedModules; + protected static $aLoadErrors; protected $aDict; protected $aDictKeys; - /** * ModelFactory constructor. * @@ -571,10 +561,10 @@ class ModelFactory * * @throws \Exception */ - public function __construct($aRootDirs, $aRootNodeExtensions = array()) + public function __construct($aRootDirs, $aRootNodeExtensions = []) { - $this->aDict = array(); - $this->aDictKeys = array(); + $this->aDict = []; + $this->aDictKeys = []; $this->aRootDirs = $aRootDirs; $this->oDOMDocument = new MFDocument(); $this->oRoot = $this->oDOMDocument->CreateElement('itop_design'); @@ -588,8 +578,7 @@ class ModelFactory $oDictionaries = $this->oDOMDocument->CreateElement('dictionaries'); $this->oRoot->appendChild($oDictionaries); - foreach (self::$aWellKnownParents as $sWellKnownParent) - { + foreach (self::$aWellKnownParents as $sWellKnownParent) { $this->AddWellKnownParent($oClasses, $sWellKnownParent); } $oMenus = $this->oDOMDocument->CreateElement('menus'); @@ -600,13 +589,12 @@ class ModelFactory $oEvents = $this->oDOMDocument->CreateElement('events'); $this->oRoot->appendChild($oEvents); - foreach ($aRootNodeExtensions as $sElementName) - { + foreach ($aRootNodeExtensions as $sElementName) { $oElement = $this->oDOMDocument->CreateElement($sElementName); $this->oRoot->appendChild($oElement); } - self::$aLoadedModules = array(); - self::$aLoadErrors = array(); + self::$aLoadedModules = []; + self::$aLoadErrors = []; libxml_use_internal_errors(true); } @@ -620,8 +608,7 @@ class ModelFactory */ public function Dump($oNode = null, $bReturnRes = false) { - if (is_null($oNode)) - { + if (is_null($oNode)) { $oNode = $this->oRoot; } @@ -637,9 +624,8 @@ class ModelFactory $this->oRoot = $this->oDOMDocument->firstChild; $oModules = $this->oRoot->getElementsByTagName('loaded_modules')->item(0); - self::$aLoadedModules = array(); - foreach ($oModules->getElementsByTagName('module') as $oModuleNode) - { + self::$aLoadedModules = []; + foreach ($oModules->getElementsByTagName('module') as $oModuleNode) { $sId = $oModuleNode->getAttribute('id'); $sRootDir = $oModuleNode->GetChildText('root_dir'); $sLabel = $oModuleNode->GetChildText('label'); @@ -751,8 +737,12 @@ class ModelFactory $oParentNode = $oSubClassNode->parentNode; $iLine = ModelFactory::GetXMLLineNumber($oParentNode); $sItopNodePath = DesignDocument::GetItopNodePath($oParentNode); - throw new MFException("$sItopNodePath at line $iLine: _delta=\"$sParentDeltaSpec\" not supported for classes in hierarchy", - MFException::NOT_FOUND, $iLine, $sItopNodePath); + throw new MFException( + "$sItopNodePath at line $iLine: _delta=\"$sParentDeltaSpec\" not supported for classes in hierarchy", + MFException::NOT_FOUND, + $iLine, + $sItopNodePath + ); } } @@ -810,8 +800,12 @@ class ModelFactory if (is_null($oNodeForTargetParent)) { $iLine = ModelFactory::GetXMLLineNumber($oSourceParentClassNode); $sItopNodePath = DesignDocument::GetItopNodePath($oSourceParentClassNode); - throw new MFException($sItopNodePath." at line $iLine: invalid parent class '$sParentClassName'", - MFException::NOT_FOUND, $iLine, $sItopNodePath); + throw new MFException( + $sItopNodePath." at line $iLine: invalid parent class '$sParentClassName'", + MFException::NOT_FOUND, + $iLine, + $sItopNodePath + ); } $oNextParentSibling = $oNodeForTargetParent->nextSibling; if ($oNextParentSibling) { @@ -841,8 +835,12 @@ class ModelFactory if ($bMustExist) { $iLine = ModelFactory::GetXMLLineNumber($oSourceNode); $sItopNodePath = DesignDocument::GetItopNodePath($oSourceNode); - throw new MFException($sItopNodePath.' at line '.$iLine.': could not be found or marked as removed', - MFException::NOT_FOUND, $iLine, $sItopNodePath); + throw new MFException( + $sItopNodePath.' at line '.$iLine.': could not be found or marked as removed', + MFException::NOT_FOUND, + $iLine, + $sItopNodePath + ); } if ($bIfExists) { // Do not continue deeper @@ -851,8 +849,13 @@ class ModelFactory if (!$bSpecifiedMerge && $sMode === self::LOAD_DELTA_MODE_STRICT && ($sSearchId !== '' || is_null($oSourceNode->GetFirstElementChild()))) { $iLine = ModelFactory::GetXMLLineNumber($oSourceNode); $sItopNodePath = DesignDocument::GetItopNodePath($oSourceNode); - throw new MFException($sItopNodePath.' at line '.$iLine.': could not be found or marked as removed (strict mode)', - MFException::NOT_FOUND, $iLine, $sItopNodePath, 'strict mode'); + throw new MFException( + $sItopNodePath.' at line '.$iLine.': could not be found or marked as removed (strict mode)', + MFException::NOT_FOUND, + $iLine, + $sItopNodePath, + 'strict mode' + ); } // Ignore renaming non-existant node @@ -903,8 +906,13 @@ class ModelFactory if ($sMode === self::LOAD_DELTA_MODE_STRICT && !$oSourceNode->hasAttribute('_rename_from') && trim($oSourceNode->GetText('')) !== '') { $iLine = ModelFactory::GetXMLLineNumber($oSourceNode); $sItopNodePath = DesignDocument::GetItopNodePath($oSourceNode); - throw new MFException($sItopNodePath.' at line '.$iLine.': cannot be modified without _delta flag (strict mode)', - MFException::AMBIGUOUS_LEAF, $iLine, $sItopNodePath, 'strict mode'); + throw new MFException( + $sItopNodePath.' at line '.$iLine.': cannot be modified without _delta flag (strict mode)', + MFException::AMBIGUOUS_LEAF, + $iLine, + $sItopNodePath, + 'strict mode' + ); } else { // Lax mode: same as redefine // Replace the existing node by the given node - copy child nodes as well @@ -980,12 +988,20 @@ class ModelFactory $iLine = $this->GetXMLLineNumber($oSourceNode); if ($oTargetNode == null) { - throw new MFException($sPath.' at line '.$iLine.": could not be deleted (not found)", MFException::COULD_NOT_BE_DELETED, - $iLine, $sPath); + throw new MFException( + $sPath.' at line '.$iLine.": could not be deleted (not found)", + MFException::COULD_NOT_BE_DELETED, + $iLine, + $sPath + ); } if ($oTargetNode->IsRemoved()) { - throw new MFException($sPath.' at line '.$iLine.": could not be deleted (already marked as deleted)", - MFException::ALREADY_DELETED, $iLine, $sPath); + throw new MFException( + $sPath.' at line '.$iLine.": could not be deleted (already marked as deleted)", + MFException::ALREADY_DELETED, + $iLine, + $sPath + ); } $oTargetNode->Delete(); break; @@ -993,8 +1009,13 @@ class ModelFactory default: $sPath = MFDocument::GetItopNodePath($oSourceNode); $iLine = $this->GetXMLLineNumber($oSourceNode); - throw new MFException($sPath.' at line '.$iLine.": unexpected value for attribute _delta: '".$sDeltaSpec."'", - MFException::INVALID_DELTA, $iLine, $sPath, $sDeltaSpec); + throw new MFException( + $sPath.' at line '.$iLine.": unexpected value for attribute _delta: '".$sDeltaSpec."'", + MFException::INVALID_DELTA, + $iLine, + $sPath, + $sDeltaSpec + ); } if ($oTargetNode && $oTargetNode->parentNode) { @@ -1036,7 +1057,7 @@ class ModelFactory } $oSubClassNodes = $this->GetChildClasses($oClassNode); - foreach($oSubClassNodes as $oSubClassNode) { + foreach ($oSubClassNodes as $oSubClassNode) { // Put the subclass before the parent classes to delete in reverse order $this->DeleteSubClasses($oSubClassNode, false); } @@ -1078,10 +1099,9 @@ class ModelFactory * * @throws \Exception */ - public function LoadModule(MFModule $oModule, $aLanguages = array()) + public function LoadModule(MFModule $oModule, $aLanguages = []) { - try - { + try { $aDataModels = $oModule->GetDataModelFiles(); $sModuleName = $oModule->GetName(); self::$aLoadedModules[] = $oModule; @@ -1095,71 +1115,56 @@ class ModelFactory $oModules = $this->oRoot->getElementsByTagName('loaded_modules')->item(0); $oModules->appendChild($oModuleNode); - foreach ($aDataModels as $sXmlFile) - { + foreach ($aDataModels as $sXmlFile) { $oDocument = new MFDocument(); libxml_clear_errors(); $oDocument->load($sXmlFile); $aErrors = libxml_get_errors(); - if (count($aErrors) > 0) - { + if (count($aErrors) > 0) { throw new Exception($this->GetXMLErrorMessage($aErrors)); } $oXPath = new DOMXPath($oDocument); $oNodeList = $oXPath->query('/itop_design/classes//class'); - foreach ($oNodeList as $oNode) - { - if ($oNode->getAttribute('_created_in') == '') - { + foreach ($oNodeList as $oNode) { + if ($oNode->getAttribute('_created_in') == '') { $oNode->SetAttribute('_created_in', $sModuleName); } } $oNodeList = $oXPath->query('/itop_design/constants/constant'); - foreach ($oNodeList as $oNode) - { - if ($oNode->getAttribute('_created_in') == '') - { + foreach ($oNodeList as $oNode) { + if ($oNode->getAttribute('_created_in') == '') { $oNode->SetAttribute('_created_in', $sModuleName); } } $oNodeList = $oXPath->query('/itop_design/events/event'); - foreach ($oNodeList as $oNode) - { - if ($oNode->getAttribute('_created_in') == '') - { + foreach ($oNodeList as $oNode) { + if ($oNode->getAttribute('_created_in') == '') { $oNode->SetAttribute('_created_in', $sModuleName); } } $oNodeList = $oXPath->query('/itop_design/menus/menu'); - foreach ($oNodeList as $oNode) - { - if ($oNode->getAttribute('_created_in') == '') - { + foreach ($oNodeList as $oNode) { + if ($oNode->getAttribute('_created_in') == '') { $oNode->SetAttribute('_created_in', $sModuleName); } } $oUserRightsNode = $oXPath->query('/itop_design/user_rights')->item(0); - if ($oUserRightsNode) - { - if ($oUserRightsNode->getAttribute('_created_in') == '') - { + if ($oUserRightsNode) { + if ($oUserRightsNode->getAttribute('_created_in') == '') { $oUserRightsNode->SetAttribute('_created_in', $sModuleName); } } $oAlteredNodes = $oXPath->query('/itop_design//*[@_delta]'); - if ($oAlteredNodes->length > 0) - { - foreach ($oAlteredNodes as $oAlteredNode) - { + if ($oAlteredNodes->length > 0) { + foreach ($oAlteredNodes as $oAlteredNode) { $oAlteredNode->SetAttribute('_altered_in', $sModuleName); } } $oFormat = new iTopDesignFormat($oDocument); - if (!$oFormat->Convert()) - { + if (!$oFormat->Convert()) { $sError = implode(', ', $oFormat->GetErrors()); throw new Exception("Cannot load module $sModuleName, failed to upgrade to datamodel format of: $sXmlFile. Reason(s): $sError"); } @@ -1171,40 +1176,36 @@ class ModelFactory $aDictionaries = $oModule->GetDictionaryFiles(); $sPHPFile = 'undefined'; - try - { + try { $this->ResetTempDictionary(); - foreach ($aDictionaries as $sPHPFile) - { + foreach ($aDictionaries as $sPHPFile) { $sDictFileContents = file_get_contents($sPHPFile); - $sDictFileContents = str_replace(array('<'.'?'.'php', '?'.'>'), '', $sDictFileContents); + $sDictFileContents = str_replace(['<'.'?'.'php', '?'.'>'], '', $sDictFileContents); $sDictFileContents = str_replace('Dict::Add', '$this->AddToTempDictionary', $sDictFileContents); eval($sDictFileContents); } - foreach ($this->aDict as $sLanguageCode => $aDictDefinition) - { - if ((count($aLanguages) > 0) && !in_array($sLanguageCode, $aLanguages)) - { + foreach ($this->aDict as $sLanguageCode => $aDictDefinition) { + if ((count($aLanguages) > 0) && !in_array($sLanguageCode, $aLanguages)) { // skip some languages if the parameter says so continue; } $this->IntegrateDictEntriesIntoXML($sLanguageCode, $aDictDefinition); } - } catch (Exception|Error $e) // Error can occurs on eval() calls - { - throw new DictException('Failed to load dictionary file "' . $sPHPFile . '"', [ - 'exception_class' => get_class($e), - 'exception_msg' => $e->getMessage(), - ]); - } - } - catch (Exception $e) { - $aLoadedModuleNames = array(); + } catch (Exception|Error $e) { // Error can occurs on eval() calls + throw new DictException('Failed to load dictionary file "'.$sPHPFile.'"', [ + 'exception_class' => get_class($e), + 'exception_msg' => $e->getMessage(), + ]); + } + } catch (Exception $e) { + $aLoadedModuleNames = []; foreach (self::$aLoadedModules as $oLoadedModule) { $aLoadedModuleNames[] = $oLoadedModule->GetName().':'.$oLoadedModule->GetVersion(); } - throw new Exception('Error loading module "'.$oModule->GetName().'": '.$e->getMessage().' - Loaded modules: '.implode(', ', - $aLoadedModuleNames)); + throw new Exception('Error loading module "'.$oModule->GetName().'": '.$e->getMessage().' - Loaded modules: '.implode( + ', ', + $aLoadedModuleNames + )); } } @@ -1225,8 +1226,10 @@ class ModelFactory $oDictionaries->AddChildNode($oXmlDict); $oXmlEntries = $this->oDOMDocument->CreateElement('english_description', $aDictDefinition['english_description']); $oXmlDict->appendChild($oXmlEntries); - $oXmlEntries = $this->oDOMDocument->CreateElement('localized_description', - $aDictDefinition['localized_description']); + $oXmlEntries = $this->oDOMDocument->CreateElement( + 'localized_description', + $aDictDefinition['localized_description'] + ); $oXmlDict->appendChild($oXmlEntries); $oXmlEntries = $this->oDOMDocument->CreateElement('entries'); $oXmlDict->appendChild($oXmlEntries); @@ -1264,20 +1267,18 @@ class ModelFactory { $this->aDict[$sLanguageCode]['english_description'] = $sEnglishLanguageDesc; $this->aDict[$sLanguageCode]['localized_description'] = $sLocalizedLanguageDesc; - if (!array_key_exists('entries', $this->aDict[$sLanguageCode])) - { - $this->aDict[$sLanguageCode]['entries'] = array(); + if (!array_key_exists('entries', $this->aDict[$sLanguageCode])) { + $this->aDict[$sLanguageCode]['entries'] = []; } - foreach ($aEntries as $sKey => $sValue) - { + foreach ($aEntries as $sKey => $sValue) { $this->aDict[$sLanguageCode]['entries'][$sKey] = $sValue; } } protected function ResetTempDictionary() { - $this->aDict = array(); + $this->aDict = []; } /** @@ -1285,7 +1286,7 @@ class ModelFactory * * @Deprecated Errors are now sent by Exception */ - function HasLoadErrors() + public function HasLoadErrors() { DeprecatedCallsLog::NotifyDeprecatedPhpMethod('Errors are now sent by Exception'); @@ -1296,7 +1297,7 @@ class ModelFactory * @Deprecated Errors are now sent by Exception * @return array */ - function GetLoadErrors() + public function GetLoadErrors() { DeprecatedCallsLog::NotifyDeprecatedPhpMethod('Errors are now sent by Exception'); @@ -1311,8 +1312,7 @@ class ModelFactory protected function GetXMLErrorMessage($aErrors) { $sMessage = "Data model source file ({$aErrors[0]->file}) could not be loaded : \n"; - foreach ($aErrors as $oXmlError) - { + foreach ($aErrors as $oXmlError) { // XML messages already ends with \n $sMessage .= $oXmlError->message; } @@ -1325,39 +1325,31 @@ class ModelFactory * * @return MFModule[] */ - function GetLoadedModules($bExcludeWorkspace = true) + public function GetLoadedModules($bExcludeWorkspace = true) { - if ($bExcludeWorkspace) - { - $aModules = array(); - foreach (self::$aLoadedModules as $oModule) - { - if (!$oModule instanceof MFWorkspace) - { + if ($bExcludeWorkspace) { + $aModules = []; + foreach (self::$aLoadedModules as $oModule) { + if (!$oModule instanceof MFWorkspace) { $aModules[] = $oModule; } } - } - else - { + } else { $aModules = self::$aLoadedModules; } return $aModules; } - /** * @param $sModuleName * * @return mixed|null */ - function GetModule($sModuleName) + public function GetModule($sModuleName) { - foreach (self::$aLoadedModules as $oModule) - { - if ($oModule->GetName() == $sModuleName) - { + foreach (self::$aLoadedModules as $oModule) { + if ($oModule->GetName() == $sModuleName) { return $oModule; } } @@ -1414,16 +1406,12 @@ class ModelFactory */ public function AddClass(DOMNode $oClassNode, $sModuleName) { - if ($oClassNode->hasAttribute('id')) - { + if ($oClassNode->hasAttribute('id')) { $sClassName = $oClassNode->GetAttribute('id'); - } - else - { + } else { throw new Exception('ModelFactory::AddClass: Cannot add a class with no name'); } - if ($this->ClassNameExists($oClassNode->getAttribute('id'))) - { + if ($this->ClassNameExists($oClassNode->getAttribute('id'))) { throw new Exception("ModelFactory::AddClass: Cannot add the already existing class $sClassName"); } $sParentClass = $oClassNode->GetChildText('parent', ''); @@ -1472,7 +1460,7 @@ $sHeader EOF - ; + ; } /** @@ -1524,8 +1512,7 @@ EOF public function ListAllClasses($bIncludeMetas = false) { $sXPath = "/itop_design/classes/class[@id]"; - if ($bIncludeMetas === true) - { + if ($bIncludeMetas === true) { $sXPath .= "|/itop_design/meta/classes/class[@id]"; } @@ -1572,8 +1559,7 @@ EOF $oClassNode = $this->GetNodes("/itop_design/classes/class[@id='$sClassName']")->item(0); // If not, check if class among exposed meta classes (PHP classes) - if (is_null($oClassNode) && ($bIncludeMetas === true)) - { + if (is_null($oClassNode) && ($bIncludeMetas === true)) { /** @var \MFElement|null $oClassNode */ $oClassNode = $this->GetNodes("/itop_design/meta/classes/class[@id='$sClassName']")->item(0); } @@ -1617,15 +1603,13 @@ EOF */ public function GetField($sClassName, $sAttCode) { - if (!$this->ClassNameExists($sClassName)) - { + if (!$this->ClassNameExists($sClassName)) { return null; } $oClassNode = $this->GetClass($sClassName); /** @var \MFElement|null $oFieldNode */ $oFieldNode = $this->GetNodes("fields/field[@id='$sAttCode']", $oClassNode)->item(0); - if (($oFieldNode == null) && ($sParentClass = $oClassNode->GetChildText('parent'))) - { + if (($oFieldNode == null) && ($sParentClass = $oClassNode->GetChildText('parent'))) { return $this->GetField($sParentClass, $sAttCode); } @@ -1686,7 +1670,6 @@ EOF return $this->oRoot->ListChanges(); } - /** * Import the node into the delta * @@ -1799,8 +1782,7 @@ EOF { // Search into the deleted node as well! $oNodeSet = $this->oDOMDocument->GetNodes("//*[@$sAttribute='$sPreviousValue']", null, false); - foreach ($oNodeSet as $oTouchedNode) - { + foreach ($oNodeSet as $oTouchedNode) { $oTouchedNode->setAttribute($sAttribute, $sNewValue); } } @@ -1814,41 +1796,31 @@ EOF * @return \MFDocument * @throws \Exception */ - public function GetDeltaDocument($aNodesToIgnore = array(), $aAttributes = null) + public function GetDeltaDocument($aNodesToIgnore = [], $aAttributes = null) { $oDelta = new MFDocument(); - foreach ($this->ListChanges() as $oAlteredNode) - { + foreach ($this->ListChanges() as $oAlteredNode) { $this->ImportNodeAndPathDelta($oDelta, $oAlteredNode); } - foreach ($aNodesToIgnore as $sXPath) - { + foreach ($aNodesToIgnore as $sXPath) { $oNodesToRemove = $oDelta->GetNodes($sXPath); - foreach ($oNodesToRemove as $oNode) - { - if ($oNode instanceof DOMAttr) - { + foreach ($oNodesToRemove as $oNode) { + if ($oNode instanceof DOMAttr) { $oNode->ownerElement->removeAttributeNode($oNode); - } - else - { + } else { $oNode->parentNode->removeChild($oNode); } } } $oNodesToClean = $oDelta->GetNodes('/itop_design//*[@_altered_in]'); - foreach ($oNodesToClean as $oNode) - { + foreach ($oNodesToClean as $oNode) { $oNode->removeAttribute('_altered_in'); } - if ($aAttributes != null) - { - foreach ($aAttributes as $sAttribute => $value) - { - if ($oDelta->documentElement) // yes, this may happen when still no change has been performed (and a module has been selected for installation) - { + if ($aAttributes != null) { + foreach ($aAttributes as $sAttribute => $value) { + if ($oDelta->documentElement) { // yes, this may happen when still no change has been performed (and a module has been selected for installation) $oDelta->documentElement->setAttribute($sAttribute, $value); } } @@ -1866,7 +1838,7 @@ EOF * @return string * @throws \Exception */ - public function GetDelta($aNodesToIgnore = array(), $aAttributes = null) + public function GetDelta($aNodesToIgnore = [], $aAttributes = null) { $oDelta = $this->GetDeltaDocument($aNodesToIgnore, $aAttributes); @@ -1883,24 +1855,19 @@ EOF public function FindModules() { $aAvailableModules = ModuleDiscovery::GetAvailableModules($this->aRootDirs); - $aResult = array(); - foreach ($aAvailableModules as $sId => $aModule) - { + $aResult = []; + foreach ($aAvailableModules as $sId => $aModule) { $oModule = new MFModule($sId, $aModule['root_dir'], $aModule['label'], isset($aModule['auto_select'])); - if (isset($aModule['auto_select'])) - { + if (isset($aModule['auto_select'])) { $oModule->SetAutoSelect($aModule['auto_select']); } - if (isset($aModule['datamodel']) && is_array($aModule['datamodel'])) - { + if (isset($aModule['datamodel']) && is_array($aModule['datamodel'])) { $oModule->SetFilesToInclude($aModule['datamodel'], 'business'); } - if (isset($aModule['webservice']) && is_array($aModule['webservice'])) - { + if (isset($aModule['webservice']) && is_array($aModule['webservice'])) { $oModule->SetFilesToInclude($aModule['webservice'], 'webservices'); } - if (isset($aModule['addons']) && is_array($aModule['addons'])) - { + if (isset($aModule['addons']) && is_array($aModule['addons'])) { $oModule->SetFilesToInclude($aModule['addons'], 'addons'); } $aResult[] = $oModule; @@ -1926,7 +1893,8 @@ EOF /** * @return mixed */ - public function GetRootDirs() { + public function GetRootDirs() + { return $this->aRootDirs; } @@ -1989,17 +1957,14 @@ class MFElement extends Combodo\iTop\DesignElement public function GetUniqueElement($sTagName, $bMustExist = true) { $oNode = null; - foreach ($this->childNodes as $oChildNode) - { + foreach ($this->childNodes as $oChildNode) { /** @var MFElement $oChildNode */ - if (($oChildNode->nodeName == $sTagName) && !$oChildNode->IsRemoved()) - { + if (($oChildNode->nodeName == $sTagName) && !$oChildNode->IsRemoved()) { $oNode = $oChildNode; break; } } - if ($bMustExist && is_null($oNode)) - { + if ($bMustExist && is_null($oNode)) { $sXPath = DesignDocument::GetItopNodePath($this); throw new DOMFormatException("Missing unique tag: $sTagName in: $sXPath"); } @@ -2024,45 +1989,33 @@ class MFElement extends Combodo\iTop\DesignElement public function GetNodeAsArrayOfItems($sElementName = 'items') { $oItems = $this->GetOptionalElement($sElementName); - if ($oItems) - { - $res = array(); - $aRanks = array(); - foreach ($oItems->childNodes as $oItem) - { - if ($oItem instanceof DOMElement) - { + if ($oItems) { + $res = []; + $aRanks = []; + foreach ($oItems->childNodes as $oItem) { + if ($oItem instanceof DOMElement) { // When an attribute is missing - if ($oItem->hasAttribute('id')) - { + if ($oItem->hasAttribute('id')) { $key = $oItem->getAttribute('id'); - if (array_key_exists($key, $res)) - { + if (array_key_exists($key, $res)) { // Houston! $sXPath = DesignDocument::GetItopNodePath($this); throw new DOMFormatException("id '$key' already used in $sXPath", 0, null, $oItem); } $res[$key] = $oItem->GetNodeAsArrayOfItems(); - } - else - { + } else { $res[] = $oItem->GetNodeAsArrayOfItems(); } $sRank = $oItem->GetChildText('rank'); - if ($sRank != '') - { + if ($sRank != '') { $aRanks[] = (float)$sRank; - } - else - { + } else { $aRanks[] = count($aRanks) > 0 ? max($aRanks) + 1 : 0; } array_multisort($aRanks, $res); } } - } - else - { + } else { $res = $this->GetText(); } @@ -2076,25 +2029,20 @@ class MFElement extends Combodo\iTop\DesignElement */ protected static function AddItemToNode($oXmlDoc, $oXMLNode, $itemValue) { - if (is_array($itemValue)) - { + if (is_array($itemValue)) { $oXmlItems = $oXmlDoc->CreateElement('items'); $oXMLNode->appendChild($oXmlItems); - foreach ($itemValue as $key => $item) - { + foreach ($itemValue as $key => $item) { $oXmlItem = $oXmlDoc->CreateElement('item'); $oXmlItems->appendChild($oXmlItem); - if (is_string($key)) - { + if (is_string($key)) { $oXmlItem->SetAttribute('key', $key); } self::AddItemToNode($oXmlDoc, $oXmlItem, $item); } - } - else - { + } else { $oXmlText = $oXmlDoc->CreateTextNode((string)$itemValue); $oXMLNode->appendChild($oXmlText); } @@ -2105,17 +2053,14 @@ class MFElement extends Combodo\iTop\DesignElement */ protected function DeleteChildren() { - while (isset($this->firstChild)) - { - if ($this->firstChild instanceof MFElement) - { + while (isset($this->firstChild)) { + if ($this->firstChild instanceof MFElement) { $this->firstChild->DeleteChildren(); } $this->removeChild($this->firstChild); } } - /** * Check if the current node is under a node 'added' or 'altered' * Usage: In such a case, the change must not be tracked @@ -2124,11 +2069,9 @@ class MFElement extends Combodo\iTop\DesignElement */ public function IsInDefinition() { - // Iterate through the parents: reset the flag if any of them has a flag set - for ($oParent = $this; $oParent instanceof MFElement; $oParent = $oParent->parentNode) - { - if ($oParent->GetAlteration() != '') - { + // Iterate through the parents: reset the flag if any of them has a flag set + for ($oParent = $this; $oParent instanceof MFElement; $oParent = $oParent->parentNode) { + if ($oParent->GetAlteration() != '') { return true; } } @@ -2146,10 +2089,8 @@ class MFElement extends Combodo\iTop\DesignElement public function IsAlteredByModule($aModules) { // Iterate through the parents: reset the flag if any of them has a flag set - for ($oParent = $this; $oParent instanceof MFElement; $oParent = $oParent->parentNode) - { - if (in_array($oParent->getAttribute('_altered_in'), $aModules)) - { + for ($oParent = $this; $oParent instanceof MFElement; $oParent = $oParent->parentNode) { + if (in_array($oParent->getAttribute('_altered_in'), $aModules)) { return true; } } @@ -2174,10 +2115,8 @@ class MFElement extends Combodo\iTop\DesignElement */ public function AddTrace() { - if (!is_null(self::$aTraceAttributes)) - { - foreach (self::$aTraceAttributes as $sAttribute => $value) - { + if (!is_null(self::$aTraceAttributes)) { + foreach (self::$aTraceAttributes as $sAttribute => $value) { $this->setAttribute($sAttribute, $value); } } @@ -2198,8 +2137,7 @@ class MFElement extends Combodo\iTop\DesignElement $oNode->AddTrace(); $oExisting = $this->_FindChildNode($oNode); - if ($oExisting) - { + if ($oExisting) { if (!$oExisting->IsRemoved()) { $sPath = MFDocument::GetItopNodePath($oNode); $iLine = ModelFactory::GetXMLLineNumber($oNode); @@ -2212,14 +2150,11 @@ EOF; } $oExisting->ReplaceWithSingleNode($oNode); $sFlag = 'replaced'; - } - else - { + } else { $this->appendChild($oNode); $sFlag = 'added'; } - if (!$this->IsInDefinition()) - { + if (!$this->IsInDefinition()) { $oNode->SetAlteration($sFlag); } } @@ -2242,20 +2177,27 @@ EOF; $oNode->AddTrace(); $oExisting = $this->_FindChildNode($oNode, $sSearchId); - if (!$oExisting) - { + if (!$oExisting) { $sPath = MFDocument::GetItopNodePath($this)."/".$oNode->tagName.(empty($sSearchId) ? '' : "[$sSearchId]"); $iLine = ModelFactory::GetXMLLineNumber($oNode); - throw new MFException($sPath." at line $iLine: could not be modified (not found)", MFException::COULD_NOT_BE_MODIFIED_NOT_FOUND, - $sPath, $iLine); + throw new MFException( + $sPath." at line $iLine: could not be modified (not found)", + MFException::COULD_NOT_BE_MODIFIED_NOT_FOUND, + $sPath, + $iLine + ); } $sPrevFlag = $oExisting->GetAlteration(); $sOldId = $oExisting->getAttribute('_old_id'); if ($oExisting->IsRemoved()) { $sPath = MFDocument::GetItopNodePath($this)."/".$oNode->tagName.(empty($sSearchId) ? '' : "[$sSearchId]"); $iLine = ModelFactory::GetXMLLineNumber($oNode); - throw new MFException($sPath." at line $iLine: could not be modified (marked as deleted)", - MFException::COULD_NOT_BE_MODIFIED_ALREADY_DELETED, $sPath, $iLine); + throw new MFException( + $sPath." at line $iLine: could not be modified (marked as deleted)", + MFException::COULD_NOT_BE_MODIFIED_ALREADY_DELETED, + $sPath, + $iLine + ); } $oExisting->ReplaceWithSingleNode($oNode); if (!$this->IsInDefinition()) { @@ -2286,11 +2228,9 @@ EOF; $oNode->AddTrace(); $oExisting = $this->_FindChildNode($oNode, $sSearchId); - if ($oExisting) - { + if ($oExisting) { $sOldId = $oExisting->getAttribute('_old_id'); - if (!empty($sOldId)) - { + if (!empty($sOldId)) { $oNode->setAttribute('_old_id', $sOldId); } @@ -2301,24 +2241,18 @@ EOF; $sFlag = $sPrevFlag; // added, replaced or '' } $oExisting->ReplaceWithSingleNode($oNode); - } - else - { + } else { $this->appendChild($oNode); $sFlag = $bForce ? 'forced' : 'added'; } - if (!$this->IsInDefinition()) - { - if ($sFlag == '') - { + if (!$this->IsInDefinition()) { + if ($sFlag == '') { $sFlag = $bForce ? 'forced' : 'replaced'; } $oNode->SetAlteration($sFlag); } } - - /** * Replaces a node by another one, making sure that recursive nodes are preserved * @@ -2348,8 +2282,7 @@ EOF; */ public function Delete(bool $bIsConditional = false) { - switch ($this->GetAlteration()) - { + switch ($this->GetAlteration()) { case 'replaced': $sFlag = $bIsConditional ? 'remove_needed' : 'removed'; break; @@ -2362,14 +2295,12 @@ EOF; default: $sFlag = $bIsConditional ? 'remove_needed' : 'removed'; - if ($this->IsInDefinition()) - { + if ($this->IsInDefinition()) { $sFlag = null; break; } } - if ($sFlag) - { + if ($sFlag) { // If class move the node AFTER all the removed classes to keep the delete order // and remain compatible with GetDelta/LoadDelta class flattening if ($this->IsClassNode()) { @@ -2381,9 +2312,7 @@ EOF; // Add trace data $this->AddTrace(); - } - else - { + } else { // Remove the node entirely $this->parentNode->removeChild($this); } @@ -2397,26 +2326,18 @@ EOF; public function Rename($sId) { $sAlteration = $this->GetAlteration(); - if (($sAlteration == 'replaced') || ($sAlteration == 'forced') || !$this->IsInDefinition()) - { + if (($sAlteration == 'replaced') || ($sAlteration == 'forced') || !$this->IsInDefinition()) { $sOriginalId = $this->getAttribute('_old_id'); - if ($sOriginalId == '') - { + if ($sOriginalId == '') { $sRenameOrig = $this->getAttribute('_rename_from'); - if (empty($sRenameOrig)) - { + if (empty($sRenameOrig)) { $this->setAttribute('_old_id', $this->getAttribute('id')); - } - else - { + } else { $this->setAttribute('_old_id', $sRenameOrig); $this->removeAttribute('_rename_from'); } - } - else - { - if ($sOriginalId == $sId) - { + } else { + if ($sOriginalId == $sId) { $this->removeAttribute('_old_id'); } } @@ -2427,7 +2348,6 @@ EOF; $this->AddTrace(); } - /** * List changes below a given node (see also MFDocument::ListChanges) */ @@ -2461,8 +2381,8 @@ EOF; } $oNode->parentNode->removeChild($oNode); } else { - // marked as added or modified, just reset the flag - $oNode->RemoveAlteration(); + // marked as added or modified, just reset the flag + $oNode->RemoveAlteration(); } } } @@ -2525,8 +2445,7 @@ class MFDocument extends \Combodo\iTop\DesignDocument public function saveXML(DOMNode $node = null, $options = 0) { $oRootNode = $this->firstChild; - if (!$oRootNode) - { + if (!$oRootNode) { $oRootNode = $this->createElement('itop_design'); // make sure that the document is not empty $oRootNode->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); $oRootNode->setAttribute('version', ITOP_DESIGN_LATEST_VERSION); @@ -2552,12 +2471,11 @@ class MFDocument extends \Combodo\iTop\DesignDocument * * @since 3.1.0 N°4517 $namespaceURI parameter must be empty string by default so */ - function createElement($sName, $value = null, $namespaceURI = '') + public function createElement($sName, $value = null, $namespaceURI = '') { /** @var \MFElement $oElement */ $oElement = $this->importNode(new MFElement($sName, null, $namespaceURI)); - if (($value !== '') && ($value !== null)) - { + if (($value !== '') && ($value !== null)) { $oElement->appendChild(new DOMText($value)); } @@ -2596,17 +2514,13 @@ class MFDocument extends \Combodo\iTop\DesignDocument $oXPath->registerNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $oXPath->registerPhpFunctions(); - if ($bSafe) - { + if ($bSafe) { $sXPath = "($sXPath)[not(@_alteration) or (@_alteration!='removed' and @_alteration!='remove_needed')]"; } - if (is_null($oContextNode)) - { + if (is_null($oContextNode)) { $oResult = $oXPath->query($sXPath); - } - else - { + } else { $oResult = $oXPath->query($sXPath, $oContextNode); } @@ -2626,12 +2540,9 @@ class MFDocument extends \Combodo\iTop\DesignDocument $sQuotedId = self::XPathQuote($sId); $sXPath = "($sXPath)[@id=$sQuotedId and (not(@_alteration) or @_alteration!='removed' or @_alteration!='remove_needed')]"; - if (is_null($oContextNode)) - { + if (is_null($oContextNode)) { return $oXPath->query($sXPath); - } - else - { + } else { return $oXPath->query($sXPath, $oContextNode); } } @@ -2655,7 +2566,7 @@ class MFParameters */ public function __construct(DOMNode $oNode) { - $this->aData = array(); + $this->aData = []; $this->LoadFromDOM($oNode); } @@ -2667,8 +2578,7 @@ class MFParameters */ public function Get($sCode, $default = '') { - if (array_key_exists($sCode, $this->aData)) - { + if (array_key_exists($sCode, $this->aData)) { return $this->aData[$sCode]; } @@ -2690,11 +2600,9 @@ class MFParameters */ public function LoadFromDOM(DOMNode $oNode) { - $this->aData = array(); - foreach ($oNode->childNodes as $oChildNode) - { - if ($oChildNode instanceof DOMElement) - { + $this->aData = []; + foreach ($oNode->childNodes as $oChildNode) { + if ($oChildNode instanceof DOMElement) { $this->aData[$oChildNode->nodeName] = $this->ReadElement($oChildNode); } } @@ -2709,33 +2617,24 @@ class MFParameters protected function ReadElement(DOMNode $oNode) { $value = null; - if ($oNode instanceof DOMElement) - { + if ($oNode instanceof DOMElement) { $sDefaultNodeType = ($this->HasChildNodes($oNode)) ? 'hash' : 'string'; $sNodeType = $oNode->getAttribute('type'); - if ($sNodeType == '') - { + if ($sNodeType == '') { $sNodeType = $sDefaultNodeType; } - switch ($sNodeType) - { + switch ($sNodeType) { case 'array': - $value = array(); + $value = []; // Treat the current element as zero based array, child tag names are NOT meaningful $sFirstTagName = null; - foreach ($oNode->childNodes as $oChildElement) - { - if ($oChildElement instanceof DOMElement) - { - if ($sFirstTagName == null) - { + foreach ($oNode->childNodes as $oChildElement) { + if ($oChildElement instanceof DOMElement) { + if ($sFirstTagName == null) { $sFirstTagName = $oChildElement->nodeName; - } - else - { - if ($sFirstTagName != $oChildElement->nodeName) - { + } else { + if ($sFirstTagName != $oChildElement->nodeName) { throw new Exception("Invalid Parameters: mixed tags ('$sFirstTagName' and '".$oChildElement->nodeName."') inside array '".$oNode->nodeName."'"); } } @@ -2748,14 +2647,11 @@ class MFParameters break; case 'hash': - $value = array(); + $value = []; // Treat the current element as a hash, child tag names are keys - foreach ($oNode->childNodes as $oChildElement) - { - if ($oChildElement instanceof DOMElement) - { - if (array_key_exists($oChildElement->nodeName, $value)) - { + foreach ($oNode->childNodes as $oChildElement) { + if ($oChildElement instanceof DOMElement) { + if (array_key_exists($oChildElement->nodeName, $value)) { throw new Exception("Invalid Parameters file: duplicate tags '".$oChildElement->nodeName."' inside hash '".$oNode->nodeName."'"); } $val = $this->ReadElement($oChildElement); @@ -2771,12 +2667,9 @@ class MFParameters case 'bool': case 'boolean': - if (($this->GetText($oNode) == 'true') || ($this->GetText($oNode) == 1)) - { + if (($this->GetText($oNode) == 'true') || ($this->GetText($oNode) == 1)) { $value = true; - } - else - { + } else { $value = false; } break; @@ -2785,11 +2678,8 @@ class MFParameters default: $value = str_replace('\n', "\n", (string)$this->GetText($oNode)); } - } - else - { - if ($oNode instanceof DOMText) - { + } else { + if ($oNode instanceof DOMText) { $value = $oNode->wholeText; } } @@ -2808,10 +2698,8 @@ class MFParameters { $sRet = $sDefaultValue; - foreach ($oNode->attributes as $oAttribute) - { - if ($oAttribute->nodeName == $sAttName) - { + foreach ($oNode->attributes as $oAttribute) { + if ($oAttribute->nodeName == $sAttName) { $sRet = $oAttribute->nodeValue; break; } @@ -2831,23 +2719,17 @@ class MFParameters public function GetText($oNode, $sDefault = null) { $sText = null; - foreach ($oNode->childNodes as $oChildNode) - { - if ($oChildNode instanceof DOMText) - { - if (is_null($sText)) - { + foreach ($oNode->childNodes as $oChildNode) { + if ($oChildNode instanceof DOMText) { + if (is_null($sText)) { $sText = ''; } $sText .= $oChildNode->wholeText; } } - if (is_null($sText)) - { + if (is_null($sText)) { return $sDefault; - } - else - { + } else { return $sText; } } @@ -2861,12 +2743,9 @@ class MFParameters */ public function HasChildNodes($oNode) { - if ($oNode instanceof DOMElement) - { - foreach ($oNode->childNodes as $oChildNode) - { - if ($oChildNode instanceof DOMElement) - { + if ($oNode instanceof DOMElement) { + foreach ($oNode->childNodes as $oChildNode) { + if ($oChildNode instanceof DOMElement) { return true; } } @@ -2878,7 +2757,7 @@ class MFParameters /** * @param \XMLParameters $oTask */ - function Merge(XMLParameters $oTask) + public function Merge(XMLParameters $oTask) { //todo: clarify the usage of this function that CANNOT work $this->aData = $this->array_merge_recursive_distinct($this->aData, $oTask->aData); @@ -2914,14 +2793,10 @@ class MFParameters { $merged = $array1; - foreach ($array2 as $key => &$value) - { - if (is_array($value) && isset ($merged [$key]) && is_array($merged [$key])) - { + foreach ($array2 as $key => &$value) { + if (is_array($value) && isset($merged [$key]) && is_array($merged [$key])) { $merged [$key] = $this->array_merge_recursive_distinct($merged [$key], $value); - } - else - { + } else { $merged [$key] = $value; } } diff --git a/setup/modulediscovery.class.inc.php b/setup/modulediscovery.class.inc.php index 96822a982..a37d261db 100644 --- a/setup/modulediscovery.class.inc.php +++ b/setup/modulediscovery.class.inc.php @@ -1,4 +1,5 @@ 'One line description shown during the interactive setup', 'dependencies' => 'array of module ids', 'mandatory' => 'boolean', @@ -77,17 +78,15 @@ class ModuleDiscovery 'data.sample' => 'array of sample data files', 'doc.manual_setup' => 'url', 'doc.more_information' => 'url', - ); - + ]; // Cache the results and the source directories protected static $m_aSearchDirs = null; - protected static $m_aModules = array(); - protected static $m_aModuleVersionByName = array(); + protected static $m_aModules = []; + protected static $m_aModuleVersionByName = []; // All the entries below are list of file paths relative to the module directory - protected static $m_aFilesList = array('datamodel', 'webservice', 'dictionary', 'data.struct', 'data.sample'); - + protected static $m_aFilesList = ['datamodel', 'webservice', 'dictionary', 'data.struct', 'data.sample']; // ModulePath is used by AddModule to get the path of the module being included (in ListModuleFiles) protected static $m_sModulePath = null; @@ -105,47 +104,37 @@ class ModuleDiscovery */ public static function AddModule($sFilePath, $sId, $aArgs) { - if (!array_key_exists('itop_version', $aArgs)) - { + if (!array_key_exists('itop_version', $aArgs)) { // Assume 1.0.2 $aArgs['itop_version'] = '1.0.2'; } - foreach (array_keys(self::$m_aModuleArgs) as $sArgName) - { - if (!array_key_exists($sArgName, $aArgs)) - { + foreach (array_keys(self::$m_aModuleArgs) as $sArgName) { + if (!array_key_exists($sArgName, $aArgs)) { throw new Exception("Module '$sId': missing argument '$sArgName'"); - } + } } $aArgs['root_dir'] = dirname($sFilePath); $aArgs['module_file'] = $sFilePath; list($sModuleName, $sModuleVersion) = static::GetModuleName($sId); - if ($sModuleVersion == '') - { + if ($sModuleVersion == '') { $sModuleVersion = '1.0.0'; } - if (array_key_exists($sModuleName, self::$m_aModuleVersionByName)) - { - if (version_compare($sModuleVersion, self::$m_aModuleVersionByName[$sModuleName]['version'], '>')) - { + if (array_key_exists($sModuleName, self::$m_aModuleVersionByName)) { + if (version_compare($sModuleVersion, self::$m_aModuleVersionByName[$sModuleName]['version'], '>')) { // Newer version, let's upgrade $sIdToRemove = self::$m_aModuleVersionByName[$sModuleName]['id']; unset(self::$m_aModules[$sIdToRemove]); self::$m_aModuleVersionByName[$sModuleName]['version'] = $sModuleVersion; self::$m_aModuleVersionByName[$sModuleName]['id'] = $sId; - } - else - { + } else { // Older (or equal) version, let's ignore it return; } - } - else - { + } else { // First version to be loaded for this module, remember it self::$m_aModuleVersionByName[$sModuleName]['version'] = $sModuleVersion; self::$m_aModuleVersionByName[$sModuleName]['id'] = $sId; @@ -169,24 +158,19 @@ class ModuleDiscovery } */ // Populate automatically the list of dictionary files - $aMatches = array(); - if(preg_match('|^([^/]+)|', $sId, $aMatches)) // ModuleName = everything before the first forward slash - { + $aMatches = []; + if (preg_match('|^([^/]+)|', $sId, $aMatches)) { // ModuleName = everything before the first forward slash $sModuleName = $aMatches[1]; $sDir = dirname($sFilePath); $aDirs = [ $sDir => self::$m_sModulePath, - $sDir.'/dictionaries' => self::$m_sModulePath.'/dictionaries' + $sDir.'/dictionaries' => self::$m_sModulePath.'/dictionaries', ]; - foreach ($aDirs as $sRootDir => $sPath) - { - if ($hDir = @opendir($sRootDir)) - { - while (($sFile = readdir($hDir)) !== false) - { - $aMatches = array(); - if (preg_match("/^[^\\.]+.dict.$sModuleName.php$/i", $sFile, $aMatches)) // Dictionary files named like .dict..php are loaded automatically - { + foreach ($aDirs as $sRootDir => $sPath) { + if ($hDir = @opendir($sRootDir)) { + while (($sFile = readdir($hDir)) !== false) { + $aMatches = []; + if (preg_match("/^[^\\.]+.dict.$sModuleName.php$/i", $sFile, $aMatches)) { // Dictionary files named like .dict..php are loaded automatically self::$m_aModules[$sId]['dictionary'][] = $sPath.'/'.$sFile; } } @@ -224,11 +208,9 @@ class ModuleDiscovery // Order the modules to take into account their inter-dependencies $aDependencies = []; $aSelectedModules = []; - foreach($aModules as $sId => $aModule) - { + foreach ($aModules as $sId => $aModule) { list($sModuleName, ) = self::GetModuleName($sId); - if (is_null($aModulesToLoad) || in_array($sModuleName, $aModulesToLoad)) - { + if (is_null($aModulesToLoad) || in_array($sModuleName, $aModulesToLoad)) { $aDependencies[$sId] = $aModule['dependencies']; $aSelectedModules[$sModuleName] = true; } @@ -236,46 +218,36 @@ class ModuleDiscovery ksort($aDependencies); $aOrderedModules = []; $iLoopCount = 1; - while(($iLoopCount < count($aModules)) && (count($aDependencies) > 0) ) - { - foreach($aDependencies as $sId => $aRemainingDeps) - { + while (($iLoopCount < count($aModules)) && (count($aDependencies) > 0)) { + foreach ($aDependencies as $sId => $aRemainingDeps) { $bDependenciesSolved = true; - foreach($aRemainingDeps as $sDepId) - { - if (!self::DependencyIsResolved($sDepId, $aOrderedModules, $aSelectedModules)) - { + foreach ($aRemainingDeps as $sDepId) { + if (!self::DependencyIsResolved($sDepId, $aOrderedModules, $aSelectedModules)) { $bDependenciesSolved = false; } } - if ($bDependenciesSolved) - { + if ($bDependenciesSolved) { $aOrderedModules[] = $sId; unset($aDependencies[$sId]); } } $iLoopCount++; } - if ($bAbortOnMissingDependency && count($aDependencies) > 0) - { + if ($bAbortOnMissingDependency && count($aDependencies) > 0) { $aModulesInfo = []; $aModuleDeps = []; - foreach($aDependencies as $sId => $aDeps) - { + foreach ($aDependencies as $sId => $aDeps) { $aModule = $aModules[$sId]; $aDepsWithIcons = []; - foreach($aDeps as $sIndex => $sDepId) - { - if (self::DependencyIsResolved($sDepId, $aOrderedModules, $aSelectedModules)) - { - $aDepsWithIcons[$sIndex] = '✅ ' . $sDepId; - } else - { - $aDepsWithIcons[$sIndex] = '❌ ' . $sDepId; + foreach ($aDeps as $sIndex => $sDepId) { + if (self::DependencyIsResolved($sDepId, $aOrderedModules, $aSelectedModules)) { + $aDepsWithIcons[$sIndex] = '✅ '.$sDepId; + } else { + $aDepsWithIcons[$sIndex] = '❌ '.$sDepId; } } $aModuleDeps[] = "{$aModule['label']} (id: $sId) depends on: ".implode(' + ', $aDepsWithIcons); - $aModulesInfo[$sId] = array('module' => $aModule, 'dependencies' => $aDepsWithIcons); + $aModulesInfo[$sId] = ['module' => $aModule, 'dependencies' => $aDepsWithIcons]; } $sMessage = "The following modules have unmet dependencies:\n".implode(",\n", $aModuleDeps); $oException = new MissingDependencyException($sMessage); @@ -283,9 +255,8 @@ class ModuleDiscovery throw $oException; } // Return the ordered list, so that the dependencies are met... - $aResult = array(); - foreach($aOrderedModules as $sId) - { + $aResult = []; + foreach ($aOrderedModules as $sId) { $aResult[$sId] = $aModules[$sId]; } return $aResult; @@ -306,88 +277,66 @@ class ModuleDiscovery protected static function DependencyIsResolved($sDepString, $aOrderedModules, $aSelectedModules) { $bResult = false; - $aModuleVersions = array(); + $aModuleVersions = []; // Separate the module names from their version for an easier comparison later - foreach($aOrderedModules as $sModuleId) - { - $aMatches = array(); - if (preg_match('|^([^/]+)/(.*)$|', $sModuleId, $aMatches)) - { + foreach ($aOrderedModules as $sModuleId) { + $aMatches = []; + if (preg_match('|^([^/]+)/(.*)$|', $sModuleId, $aMatches)) { $aModuleVersions[$aMatches[1]] = $aMatches[2]; - } - else - { + } else { // No version number found, assume 1.0.0 $aModuleVersions[$sModuleId] = '1.0.0'; } } - if (preg_match_all('/([^\(\)&| ]+)/', $sDepString, $aMatches)) - { - $aReplacements = array(); - $aPotentialPrerequisites = array(); - foreach($aMatches as $aMatch) - { - foreach($aMatch as $sModuleId) - { + if (preg_match_all('/([^\(\)&| ]+)/', $sDepString, $aMatches)) { + $aReplacements = []; + $aPotentialPrerequisites = []; + foreach ($aMatches as $aMatch) { + foreach ($aMatch as $sModuleId) { // $sModuleId in the dependency string is made of a / // where the operator is < <= = > >= (by default >=) - $aModuleMatches = array(); - if(preg_match('|^([^/]+)/(?=?)([^><=]+)$|', $sModuleId, $aModuleMatches)) - { + $aModuleMatches = []; + if (preg_match('|^([^/]+)/(?=?)([^><=]+)$|', $sModuleId, $aModuleMatches)) { $sModuleName = $aModuleMatches[1]; $aPotentialPrerequisites[$sModuleName] = true; $sOperator = $aModuleMatches[2]; - if ($sOperator == '') - { + if ($sOperator == '') { $sOperator = '>='; } $sExpectedVersion = $aModuleMatches[3]; - if (array_key_exists($sModuleName, $aModuleVersions)) - { + if (array_key_exists($sModuleName, $aModuleVersions)) { // module is present, check the version $sCurrentVersion = $aModuleVersions[$sModuleName]; - if (version_compare($sCurrentVersion, $sExpectedVersion, $sOperator)) - { + if (version_compare($sCurrentVersion, $sExpectedVersion, $sOperator)) { $aReplacements[$sModuleId] = '(true)'; // Add parentheses to protect against invalid condition causing - // a function call that results in a runtime fatal error - } - else - { + // a function call that results in a runtime fatal error + } else { $aReplacements[$sModuleId] = '(false)'; // Add parentheses to protect against invalid condition causing - // a function call that results in a runtime fatal error + // a function call that results in a runtime fatal error } - } - else - { + } else { // module is not present $aReplacements[$sModuleId] = '(false)'; // Add parentheses to protect against invalid condition causing - // a function call that results in a runtime fatal error + // a function call that results in a runtime fatal error } } } } $bMissingPrerequisite = false; - foreach (array_keys($aPotentialPrerequisites) as $sModuleName) - { - if (array_key_exists($sModuleName, $aSelectedModules)) - { + foreach (array_keys($aPotentialPrerequisites) as $sModuleName) { + if (array_key_exists($sModuleName, $aSelectedModules)) { // This module is actually a prerequisite - if (!array_key_exists($sModuleName, $aModuleVersions)) - { + if (!array_key_exists($sModuleName, $aModuleVersions)) { $bMissingPrerequisite = true; } } } - if ($bMissingPrerequisite) - { + if ($bMissingPrerequisite) { $bResult = false; - } - else - { + } else { $sBooleanExpr = str_replace(array_keys($aReplacements), array_values($aReplacements), $sDepString); $bOk = @eval('$bResult = '.$sBooleanExpr.'; return true;'); - if ($bOk == false) - { + if ($bOk == false) { SetupLog::Warning("Eval of '$sBooleanExpr' returned false"); echo "Failed to parse the boolean Expression = '$sBooleanExpr'
      "; } @@ -409,21 +358,17 @@ class ModuleDiscovery */ public static function GetAvailableModules($aSearchDirs, $bAbortOnMissingDependency = false, $aModulesToLoad = null) { - if (self::$m_aSearchDirs != $aSearchDirs) - { + if (self::$m_aSearchDirs != $aSearchDirs) { self::ResetCache(); } - if (is_null(self::$m_aSearchDirs)) - { + if (is_null(self::$m_aSearchDirs)) { self::$m_aSearchDirs = $aSearchDirs; // Not in cache, let's scan the disk - foreach($aSearchDirs as $sSearchDir) - { + foreach ($aSearchDirs as $sSearchDir) { $sLookupDir = realpath($sSearchDir); - if ($sLookupDir == '') - { + if ($sLookupDir == '') { throw new Exception("Invalid directory '$sSearchDir'"); } @@ -431,9 +376,7 @@ class ModuleDiscovery self::ListModuleFiles(basename($sSearchDir), dirname($sSearchDir)); } return self::GetModules($bAbortOnMissingDependency, $aModulesToLoad); - } - else - { + } else { // Reuse the previous results return self::GetModules($bAbortOnMissingDependency, $aModulesToLoad); } @@ -442,8 +385,8 @@ class ModuleDiscovery public static function ResetCache() { self::$m_aSearchDirs = null; - self::$m_aModules = array(); - self::$m_aModuleVersionByName = array(); + self::$m_aModules = []; + self::$m_aModuleVersionByName = []; } /** @@ -453,18 +396,15 @@ class ModuleDiscovery */ public static function GetModuleName($sModuleId) { - $aMatches = array(); - if (preg_match('!^(.*)/(.*)$!', $sModuleId, $aMatches)) - { + $aMatches = []; + if (preg_match('!^(.*)/(.*)$!', $sModuleId, $aMatches)) { $sName = $aMatches[1]; $sVersion = $aMatches[2]; - } - else - { + } else { $sName = $sModuleId; $sVersion = ""; } - return array($sName, $sVersion); + return [$sName, $sVersion]; } /** @@ -480,34 +420,25 @@ class ModuleDiscovery static $iDummyClassIndex = 0; $sDirectory = $sRootDir.'/'.$sRelDir; - if ($hDir = opendir($sDirectory)) - { + if ($hDir = opendir($sDirectory)) { // This is the correct way to loop over the directory. (according to the documentation) - while (($sFile = readdir($hDir)) !== false) - { - $aMatches = array(); - if (is_dir($sDirectory.'/'.$sFile)) - { - if (($sFile != '.') && ($sFile != '..') && ($sFile != '.svn') && ($sFile != 'vendor')) - { + while (($sFile = readdir($hDir)) !== false) { + $aMatches = []; + if (is_dir($sDirectory.'/'.$sFile)) { + if (($sFile != '.') && ($sFile != '..') && ($sFile != '.svn') && ($sFile != 'vendor')) { self::ListModuleFiles($sRelDir.'/'.$sFile, $sRootDir); } - } - else if (preg_match('/^module\.(.*).php$/i', $sFile, $aMatches)) - { + } elseif (preg_match('/^module\.(.*).php$/i', $sFile, $aMatches)) { self::SetModulePath($sRelDir); - try - { + try { $sModuleFileContents = file_get_contents($sDirectory.'/'.$sFile); - $sModuleFileContents = str_replace(array(''), '', $sModuleFileContents); + $sModuleFileContents = str_replace([''], '', $sModuleFileContents); $sModuleFileContents = str_replace('__FILE__', "'".addslashes($sDirectory.'/'.$sFile)."'", $sModuleFileContents); preg_match_all('/class ([A-Za-z0-9_]+) extends ([A-Za-z0-9_]+)/', $sModuleFileContents, $aMatches); //print_r($aMatches); $idx = 0; - foreach($aMatches[1] as $sClassName) - { - if (class_exists($sClassName)) - { + foreach ($aMatches[1] as $sClassName) { + if (class_exists($sClassName)) { // rename the class inside the code to prevent a "duplicate class" declaration // and change its parent class as well so that nobody will find it and try to execute it $sModuleFileContents = str_replace($sClassName.' extends '.$aMatches[2][$idx], $sClassName.'_'.($iDummyClassIndex++).' extends DummyHandler', $sModuleFileContents); @@ -516,35 +447,27 @@ class ModuleDiscovery } $bRet = eval($sModuleFileContents); - if ($bRet === false) - { + if ($bRet === false) { SetupLog::Warning("Eval of $sRelDir/$sFile returned false"); } //echo "

      Done.

      \n"; - } - catch(ParseError $e) - { - // PHP 7 + } catch (ParseError $e) { + // PHP 7 SetupLog::Warning("Eval of $sRelDir/$sFile caused an exception: ".$e->getMessage()." at line ".$e->getLine()); - } - catch(Exception $e) - { + } catch (Exception $e) { // Continue... SetupLog::Warning("Eval of $sRelDir/$sFile caused an exception: ".$e->getMessage()); } } } closedir($hDir); - } - else - { + } else { throw new Exception("Data directory (".$sDirectory.") not found or not readable."); } } } // End of class - /** Alias for backward compatibility with old module files in which * the declaration of a module invokes SetupWebPage::AddModule() * whereas the new form is ModuleDiscovery::AddModule() @@ -585,6 +508,6 @@ class SetupWebPage extends ModuleDiscovery * the class (in case some piece of code enumerate the classes derived from a well known class) * Note that this will not work if someone enumerates the classes that implement a given interface */ -class DummyHandler { +class DummyHandler +{ } - diff --git a/setup/moduleinstallation.class.inc.php b/setup/moduleinstallation.class.inc.php index 535f22daf..9695e7c74 100644 --- a/setup/moduleinstallation.class.inc.php +++ b/setup/moduleinstallation.class.inc.php @@ -1,9 +1,10 @@ - /** * Persistent class ModuleInstallation to record the installed modules * Log of module installations @@ -29,33 +29,32 @@ class ModuleInstallation extends DBObject { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core,view_in_gui", "key_type" => "autoincrement", - 'name_attcode' => array('name', 'version'), + 'name_attcode' => ['name', 'version'], "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_module_install", "db_key_field" => "id", "db_finalclass_field" => "", - 'order_by_default' => array('installed' => false), - ); + 'order_by_default' => ['installed' => false], + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values" => null, "sql" => "name", "default_value" => null, "is_null_allowed" => false, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeString("version", array("allowed_values" => null, "sql" => "version", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeDateTime("installed", array("allowed_values" => null, "sql" => "installed", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeText("comment", array("allowed_values" => null, "sql" => "comment", "default_value" => null, "is_null_allowed" => true, "depends_on" => array()))); - MetaModel::Init_AddAttribute(new AttributeExternalKey("parent_id", array("targetclass" => "ModuleInstallation", "jointype" => "", "allowed_values" => null, "sql" => "parent_id", "is_null_allowed" => true, "on_target_delete" => DEL_MANUAL, "depends_on" => array()))); - + MetaModel::Init_AddAttribute(new AttributeString("name", ["allowed_values" => null, "sql" => "name", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("version", ["allowed_values" => null, "sql" => "version", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDateTime("installed", ["allowed_values" => null, "sql" => "installed", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeText("comment", ["allowed_values" => null, "sql" => "comment", "default_value" => null, "is_null_allowed" => true, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeExternalKey("parent_id", ["targetclass" => "ModuleInstallation", "jointype" => "", "allowed_values" => null, "sql" => "parent_id", "is_null_allowed" => true, "on_target_delete" => DEL_MANUAL, "depends_on" => []])); // Display lists - MetaModel::Init_SetZListItems('details', array('name', 'version', 'installed', 'comment', 'parent_id')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('installed', 'comment')); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('details', ['name', 'version', 'installed', 'comment', 'parent_id']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['installed', 'comment']); // Attributes to be displayed for a list // Search criteria -// MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form -// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + // MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form + // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form } } @@ -70,31 +69,28 @@ class ExtensionInstallation extends cmdbAbstractObject { public static function Init() { - $aParams = array - ( + $aParams = + [ "category" => "core,view_in_gui", "key_type" => "autoincrement", "name_attcode" => "", "state_attcode" => "", - "reconc_keys" => array(), + "reconc_keys" => [], "db_table" => "priv_extension_install", "db_key_field" => "id", "db_finalclass_field" => "", - ); + ]; MetaModel::Init_Params($aParams); //MetaModel::Init_InheritAttributes(); - MetaModel::Init_AddAttribute(new AttributeString("code", array("allowed_values"=>null, "sql"=>"code", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("label", array("allowed_values"=>null, "sql"=>"label", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("version", array("allowed_values"=>null, "sql"=>"version", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeString("source", array("allowed_values"=>null, "sql"=>"source", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); - MetaModel::Init_AddAttribute(new AttributeDateTime("installed", array("allowed_values"=>null, "sql"=>"installed", "default_value"=>'NOW()', "is_null_allowed"=>false, "depends_on"=>array()))); - - + MetaModel::Init_AddAttribute(new AttributeString("code", ["allowed_values" => null, "sql" => "code", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("label", ["allowed_values" => null, "sql" => "label", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("version", ["allowed_values" => null, "sql" => "version", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeString("source", ["allowed_values" => null, "sql" => "source", "default_value" => null, "is_null_allowed" => false, "depends_on" => []])); + MetaModel::Init_AddAttribute(new AttributeDateTime("installed", ["allowed_values" => null, "sql" => "installed", "default_value" => 'NOW()', "is_null_allowed" => false, "depends_on" => []])); + // Display lists - MetaModel::Init_SetZListItems('details', array('code', 'label', 'version', 'installed', 'source')); // Attributes to be displayed for the complete details - MetaModel::Init_SetZListItems('list', array('code', 'label', 'version', 'installed', 'source')); // Attributes to be displayed for a list - MetaModel::Init_SetZListItems('standard_search', array('code', 'label', 'version', 'installed', 'source')); // Attributes to be displayed in the search form + MetaModel::Init_SetZListItems('details', ['code', 'label', 'version', 'installed', 'source']); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', ['code', 'label', 'version', 'installed', 'source']); // Attributes to be displayed for a list + MetaModel::Init_SetZListItems('standard_search', ['code', 'label', 'version', 'installed', 'source']); // Attributes to be displayed in the search form } } - - diff --git a/setup/moduleinstaller.class.inc.php b/setup/moduleinstaller.class.inc.php index 0a22479dc..1ea9c9753 100644 --- a/setup/moduleinstaller.class.inc.php +++ b/setup/moduleinstaller.class.inc.php @@ -1,9 +1,10 @@ - require_once(APPROOT.'setup/setuppage.class.inc.php'); /** * Class ModuleInstaller - * Defines the API to implement module specific actions during the setup + * Defines the API to implement module specific actions during the setup * * @copyright Copyright (C) 2010-2024 Combodo SAS * @license http://opensource.org/licenses/AGPL-3.0 @@ -43,7 +43,7 @@ abstract class ModuleInstallerAPI public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) { } - + /** * Handler called after the creation/update of the database schema * @param $oConfiguration Config The new configuration of the application @@ -54,41 +54,39 @@ abstract class ModuleInstallerAPI { } - /** - * Handler called at the end of the setup of the database (profiles and admin accounts created), but before the data load - * @param $oConfiguration Config The new configuration of the application - * @param $sPreviousVersion string Previous version number of the module (empty string in case of first install) - * @param $sCurrentVersion string Current version number of the module - */ - public static function AfterDatabaseSetup(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) - { - } + /** + * Handler called at the end of the setup of the database (profiles and admin accounts created), but before the data load + * @param $oConfiguration Config The new configuration of the application + * @param $sPreviousVersion string Previous version number of the module (empty string in case of first install) + * @param $sCurrentVersion string Current version number of the module + */ + public static function AfterDatabaseSetup(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) + { + } - /** - * Handler called at the end of the data load - * @param $oConfiguration Config The new configuration of the application - * @param $sPreviousVersion string Previous version number of the module (empty string in case of first install) - * @param $sCurrentVersion string Current version number of the module - */ - public static function AfterDataLoad(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) - { - } + /** + * Handler called at the end of the data load + * @param $oConfiguration Config The new configuration of the application + * @param $sPreviousVersion string Previous version number of the module (empty string in case of first install) + * @param $sCurrentVersion string Current version number of the module + */ + public static function AfterDataLoad(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion) + { + } /** * Helper to complete the renaming of a class - * The renaming is made in the datamodel definition, but the name has to be changed in the DB as well + * The renaming is made in the datamodel definition, but the name has to be changed in the DB as well * Must be called after DB update, i.e within an implementation of AfterDatabaseCreation() - * - * @param string $sFrom Original name (already INVALID in the current datamodel) + * + * @param string $sFrom Original name (already INVALID in the current datamodel) * @param string $sTo New name (valid in the current datamodel) - * @return void + * @return void */ public static function RenameClassInDB($sFrom, $sTo) { - try - { - if (!MetaModel::IsStandaloneClass($sTo)) - { + try { + if (!MetaModel::IsStandaloneClass($sTo)) { $sRootClass = MetaModel::GetRootClass($sTo); $sTableName = MetaModel::DBGetTable($sRootClass); $sFinalClassCol = MetaModel::DBGetClassField($sRootClass); @@ -97,77 +95,61 @@ abstract class ModuleInstallerAPI $iAffectedRows = CMDBSource::AffectedRows(); SetupLog::Info("Renaming class in DB - final class from '$sFrom' to '$sTo': $iAffectedRows rows affected"); } - } - catch(Exception $e) - { + } catch (Exception $e) { SetupLog::Warning("Failed to rename class in DB - final class from '$sFrom' to '$sTo'. Reason: ".$e->getMessage()); - } + } } /** - * Helper to modify an enum value - * The change is made in the datamodel definition, but the value has to be changed in the DB as well + * Helper to modify an enum value + * The change is made in the datamodel definition, but the value has to be changed in the DB as well * Must be called BEFORE DB update, i.e within an implementation of BeforeDatabaseCreation() - * This helper does change ONE value at a time - * + * This helper does change ONE value at a time + * * @param string $sClass A valid class name * @param string $sAttCode The enum attribute code - * @param string $sFrom Original value (already INVALID in the current datamodel) + * @param string $sFrom Original value (already INVALID in the current datamodel) * @param string $sTo New value (valid in the current datamodel) - * @return void + * @return void */ public static function RenameEnumValueInDB($sClass, $sAttCode, $sFrom, $sTo) { - try - { - if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + try { + if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) { SetupLog::Warning("Changing enum in DB - $sClass::$sAttCode - from '$sFrom' to '$sTo' failed. Reason '$sAttCode' is not a valid attribute of the class '$sClass'."); return; } $sOriginClass = MetaModel::GetAttributeOrigin($sClass, $sAttCode); $sTableName = MetaModel::DBGetTable($sOriginClass); - + $oAttDef = MetaModel::GetAttributeDef($sOriginClass, $sAttCode); - if ($oAttDef instanceof AttributeEnum) - { + if ($oAttDef instanceof AttributeEnum) { $oValDef = $oAttDef->GetValuesDef(); - if ($oValDef) - { - $aNewValues = array_keys($oValDef->GetValues(array(), "")); - if (in_array($sTo, $aNewValues)) - { + if ($oValDef) { + $aNewValues = array_keys($oValDef->GetValues([], "")); + if (in_array($sTo, $aNewValues)) { $sEnumCol = $oAttDef->Get("sql"); $aFields = CMDBSource::QueryToArray("SHOW COLUMNS FROM `$sTableName` WHERE Field = '$sEnumCol'"); - if (isset($aFields[0]['Type'])) - { + if (isset($aFields[0]['Type'])) { $sColType = $aFields[0]['Type']; // Note: the parsing should rely on str_getcsv (requires PHP 5.3) to cope with escaped string - if (preg_match("/^enum\('(.*)'\)$/", $sColType, $aMatches)) - { + if (preg_match("/^enum\('(.*)'\)$/", $sColType, $aMatches)) { $aCurrentValues = explode("','", $aMatches[1]); - } - else - { + } else { // not an enum currently : return ! // we could update values, but a clear error message will be displayed when altering the column return; } } - if (!in_array($sFrom, $aNewValues)) - { - if (!in_array($sTo, $aCurrentValues)) // if not already transformed! - { + if (!in_array($sFrom, $aNewValues)) { + if (!in_array($sTo, $aCurrentValues)) { // if not already transformed! $sNullSpec = $oAttDef->IsNullAllowed() ? 'NULL' : 'NOT NULL'; - - if (strtolower($sTo) == strtolower($sFrom)) - { + + if (strtolower($sTo) == strtolower($sFrom)) { SetupLog::Info("Changing enum in DB - $sClass::$sAttCode from '$sFrom' to '$sTo' (just a change in the case)"); - $aTargetValues = array(); - foreach ($aCurrentValues as $sValue) - { - if ($sValue == $sFrom) - { + $aTargetValues = []; + foreach ($aCurrentValues as $sValue) { + if ($sValue == $sFrom) { $sValue = $sTo; } $aTargetValues[] = $sValue; @@ -175,9 +157,7 @@ abstract class ModuleInstallerAPI $sColumnDefinition = "ENUM(".implode(",", CMDBSource::Quote($aTargetValues)).") $sNullSpec"; $sRepair = "ALTER TABLE `$sTableName` MODIFY `$sEnumCol` $sColumnDefinition"; CMDBSource::Query($sRepair); - } - else - { + } else { // 1st - Allow both values in the column definition // SetupLog::Info("Changing enum in DB - $sClass::$sAttCode from '$sFrom' to '$sTo'"); @@ -186,21 +166,19 @@ abstract class ModuleInstallerAPI $sColumnDefinition = "ENUM(".implode(",", CMDBSource::Quote($aAllValues)).") $sNullSpec"; $sRepair = "ALTER TABLE `$sTableName` MODIFY `$sEnumCol` $sColumnDefinition"; CMDBSource::Query($sRepair); - + // 2nd - Change the old value into the new value // $sRepair = "UPDATE `$sTableName` SET `$sEnumCol` = '$sTo' WHERE `$sEnumCol` = BINARY '$sFrom'"; CMDBSource::Query($sRepair); $iAffectedRows = CMDBSource::AffectedRows(); SetupLog::Info("Changing enum in DB - $iAffectedRows rows updated"); - + // 3rd - Remove the useless value from the column definition // - $aTargetValues = array(); - foreach ($aCurrentValues as $sValue) - { - if ($sValue == $sFrom) - { + $aTargetValues = []; + foreach ($aCurrentValues as $sValue) { + if ($sValue == $sFrom) { $sValue = $sTo; } $aTargetValues[] = $sValue; @@ -211,21 +189,15 @@ abstract class ModuleInstallerAPI SetupLog::Info("Changing enum in DB - removed useless value '$sFrom'"); } } - } - else - { + } else { SetupLog::Warning("Changing enum in DB - $sClass::$sAttCode - '$sFrom' is still a valid value (".implode(', ', $aNewValues).")"); } - } - else - { + } else { SetupLog::Warning("Changing enum in DB - $sClass::$sAttCode - '$sTo' is not a known value (".implode(', ', $aNewValues).")"); } } } - } - catch(Exception $e) - { + } catch (Exception $e) { SetupLog::Warning("Changing enum in DB - $sClass::$sAttCode - '$sTo' failed. Reason ".$e->getMessage()); } } @@ -253,30 +225,27 @@ abstract class ModuleInstallerAPI */ public static function MoveColumnInDB($sOrigTable, $sOrigColumn, $sDstTable, $sDstColumn, bool $bIgnoreExistingDstColumn = false) { - if (!MetaModel::DBExists(false)) - { + if (!MetaModel::DBExists(false)) { // Install from scratch, no migration return; } - if (!CMDBSource::IsTable($sOrigTable) || !CMDBSource::IsField($sOrigTable, $sOrigColumn)) - { + if (!CMDBSource::IsTable($sOrigTable) || !CMDBSource::IsField($sOrigTable, $sOrigColumn)) { // Original field is not present return; } - + $bDstTableFieldExists = CMDBSource::IsField($sDstTable, $sDstColumn); - if (!CMDBSource::IsTable($sDstTable) || ($bDstTableFieldExists && !$bIgnoreExistingDstColumn)) - { + if (!CMDBSource::IsTable($sDstTable) || ($bDstTableFieldExists && !$bIgnoreExistingDstColumn)) { // Destination field is already created, and we are not ignoring it return; } // Create the destination field if necessary - if($bDstTableFieldExists === false){ + if ($bDstTableFieldExists === false) { $sSpec = CMDBSource::GetFieldSpec($sOrigTable, $sOrigColumn); $sQueryAdd = "ALTER TABLE `{$sDstTable}` ADD `{$sDstColumn}` {$sSpec}"; - CMDBSource::Query($sQueryAdd); + CMDBSource::Query($sQueryAdd); } // Copy the data @@ -306,25 +275,21 @@ abstract class ModuleInstallerAPI */ public static function RenameTableInDB(string $sOrigTable, string $sDstTable) { - if ($sOrigTable == $sDstTable) - { + if ($sOrigTable == $sDstTable) { throw new CoreUnexpectedValue("Origin table and destination table are the same"); } - if (!MetaModel::DBExists(false)) - { + if (!MetaModel::DBExists(false)) { // Install from scratch, no migration return; } - if (!CMDBSource::IsTable($sOrigTable)) - { + if (!CMDBSource::IsTable($sOrigTable)) { SetupLog::Warning(sprintf('Rename table in DB - Origin table %s doesn\'t exist', $sOrigTable)); return; } - if (CMDBSource::IsTable($sDstTable)) - { + if (CMDBSource::IsTable($sDstTable)) { SetupLog::Warning(sprintf('Rename table in DB - Destination table %s already exists', $sDstTable)); return; } diff --git a/setup/parameters.class.inc.php b/setup/parameters.class.inc.php index 0bc938250..40680a2da 100644 --- a/setup/parameters.class.inc.php +++ b/setup/parameters.class.inc.php @@ -1,4 +1,5 @@ aData = null; @@ -14,8 +15,7 @@ abstract class Parameters public function Get($sCode, $default = '') { - if (array_key_exists($sCode, $this->aData)) - { + if (array_key_exists($sCode, $this->aData)) { return $this->aData[$sCode]; } return $default; @@ -27,7 +27,7 @@ abstract class Parameters public function GetParamForConfigArray() { $aDBParams = $this->Get('database'); - $aParamValues = array( + $aParamValues = [ 'mode' => $this->Get('mode'), 'db_server' => $aDBParams['server'], 'db_user' => $aDBParams['user'], @@ -41,7 +41,7 @@ abstract class Parameters 'language' => $this->Get('language', ''), 'graphviz_path' => $this->Get('graphviz_path', ''), 'source_dir' => $this->Get('source_dir', ''), - ); + ]; return $aParamValues; } @@ -53,51 +53,37 @@ abstract class Parameters public function ToXML(DOMNode $oRoot, $data = null, $sNodeName = null) { - if ($data === null) - { + if ($data === null) { $data = $this->aData; } - - if (is_array($data)) - { - if ($oRoot instanceof DOMDocument) - { + + if (is_array($data)) { + if ($oRoot instanceof DOMDocument) { $oNode = $oRoot->createElement($sNodeName); - } - else - { + } else { $oNode = $oRoot->ownerDocument->createElement($sNodeName); } $oRoot->appendChild($oNode); $aKeys = array_keys($data); $bNumericKeys = true; - foreach($aKeys as $subkey) - { - if(((int)$subkey) !== $subkey) - { + foreach ($aKeys as $subkey) { + if (((int)$subkey) !== $subkey) { $bNumericKeys = false; break; } } - if ($bNumericKeys) - { + if ($bNumericKeys) { $oNode->setAttribute("type", "array"); - foreach($data as $key => $value) - { - $this->ToXML($oNode, $value , 'item'); + foreach ($data as $key => $value) { + $this->ToXML($oNode, $value, 'item'); + } + } else { + foreach ($data as $key => $value) { + $this->ToXML($oNode, $value, $key); } } - else - { - foreach($data as $key => $value) - { - $this->ToXML($oNode, $value , $key); - } - } - } - else - { + } else { $oNode = $oRoot->ownerDocument->createElement($sNodeName); $oRoot->appendChild($oNode); $oTextNode = $oRoot->ownerDocument->createTextNode($data); @@ -113,11 +99,10 @@ class PHPParameters extends Parameters { $this->aData = $aData; } - + public function LoadFromFile($sParametersFile) { - if ($this->aData == null) - { + if ($this->aData == null) { require_once($sParametersFile); $this->aData = $ITOP_PARAMS; // Defined in the file loaded just above } @@ -139,88 +124,75 @@ class XMLParameters extends Parameters public function LoadFromFile($sParametersFile) { $this->sParametersFile = $sParametersFile; - if ($this->aData == null) - { + if ($this->aData == null) { libxml_use_internal_errors(true); $oXML = @simplexml_load_file($this->sParametersFile); - if (!$oXML) - { - $aMessage = array(); - foreach(libxml_get_errors() as $oError) - { + if (!$oXML) { + $aMessage = []; + foreach (libxml_get_errors() as $oError) { $aMessage[] = "(line: {$oError->line}) ".$oError->message; // Beware: $oError->columns sometimes returns wrong (misleading) value } libxml_clear_errors(); throw new InvalidParameterException("Invalid Parameters file '{$this->sParametersFile}': ".implode(' ', $aMessage)); } - - $this->aData = array(); - foreach($oXML as $key => $oElement) - { + + $this->aData = []; + foreach ($oXML as $key => $oElement) { $this->aData[(string)$key] = $this->ReadElement($oElement); } } } - + protected function ReadElement(SimpleXMLElement $oElement) { $sDefaultNodeType = (count($oElement->children()) > 0) ? 'hash' : 'string'; $sNodeType = $this->GetAttribute('type', $oElement, $sDefaultNodeType); - switch($sNodeType) - { + switch ($sNodeType) { case 'array': - $value = array(); - // Treat the current element as zero based array, child tag names are NOT meaningful - $sFirstTagName = null; - foreach($oElement->children() as $oChildElement) - { - if ($sFirstTagName == null) - { - $sFirstTagName = $oChildElement->getName(); + $value = []; + // Treat the current element as zero based array, child tag names are NOT meaningful + $sFirstTagName = null; + foreach ($oElement->children() as $oChildElement) { + if ($sFirstTagName == null) { + $sFirstTagName = $oChildElement->getName(); + } elseif ($sFirstTagName != $oChildElement->getName()) { + throw new InvalidParameterException("Invalid Parameters file '{$this->sParametersFile}': mixed tags ('$sFirstTagName' and '".$oChildElement->getName()."') inside array '".$oElement->getName()."'"); + } + $val = $this->ReadElement($oChildElement); + $value[] = $val; } - else if ($sFirstTagName != $oChildElement->getName()) - { - throw new InvalidParameterException("Invalid Parameters file '{$this->sParametersFile}': mixed tags ('$sFirstTagName' and '".$oChildElement->getName()."') inside array '".$oElement->getName()."'"); - } - $val = $this->ReadElement($oChildElement); - $value[] = $val; - } - break; - + break; + case 'hash': - $value = array(); - // Treat the current element as a hash, child tag names are keys - foreach($oElement->children() as $oChildElement) - { - if (array_key_exists($oChildElement->getName(), $value)) - { - throw new InvalidParameterException("Invalid Parameters file '{$this->sParametersFile}': duplicate tags '".$oChildElement->getName()."' inside hash '".$oElement->getName()."'"); + $value = []; + // Treat the current element as a hash, child tag names are keys + foreach ($oElement->children() as $oChildElement) { + if (array_key_exists($oChildElement->getName(), $value)) { + throw new InvalidParameterException("Invalid Parameters file '{$this->sParametersFile}': duplicate tags '".$oChildElement->getName()."' inside hash '".$oElement->getName()."'"); + } + $val = $this->ReadElement($oChildElement); + $value[$oChildElement->getName()] = $val; } - $val = $this->ReadElement($oChildElement); - $value[$oChildElement->getName()] = $val; - } - break; - + break; + case 'int': case 'integer': - $value = (int)$oElement; - break; - + $value = (int)$oElement; + break; + case 'string': default: - $value = (string)$oElement; + $value = (string)$oElement; } return $value; } - + protected function GetAttribute($sAttName, $oElement, $sDefaultValue) { $sRet = $sDefaultValue; - foreach($oElement->attributes() as $sKey => $oChildElement) - { - if ((string)$sKey == $sAttName) - { + foreach ($oElement->attributes() as $sKey => $oChildElement) { + if ((string)$sKey == $sAttName) { $sRet = (string)$oChildElement; break; } diff --git a/setup/phpcheck.php b/setup/phpcheck.php index 34f5ccf58..a97fa6af6 100644 --- a/setup/phpcheck.php +++ b/setup/phpcheck.php @@ -1,2 +1,3 @@ PHP works!'; \ No newline at end of file + +echo '

      PHP works!

      '; diff --git a/setup/phpinfo.php b/setup/phpinfo.php index a8d5bd847..24524659f 100644 --- a/setup/phpinfo.php +++ b/setup/phpinfo.php @@ -1,4 +1,5 @@ diff --git a/setup/setuppage.class.inc.php b/setup/setuppage.class.inc.php index 546b08594..2beda5e1d 100644 --- a/setup/setuppage.class.inc.php +++ b/setup/setuppage.class.inc.php @@ -1,4 +1,5 @@ LinkScriptFromAppRoot('node_modules/@popperjs/core/dist/umd/popper.js'); $this->LinkScriptFromAppRoot('node_modules/tippy.js/dist/tippy-bundle.umd.js'); $this->LinkScriptFromAppRoot("setup/setup.js"); - $this->LinkScriptFromAppRoot("setup/csp-detection.js?itop_version_wiki_syntax=" . utils::GetItopVersionWikiSyntax()); + $this->LinkScriptFromAppRoot("setup/csp-detection.js?itop_version_wiki_syntax=".utils::GetItopVersionWikiSyntax()); $this->LinkStylesheetFromAppRoot('css/font-awesome/css/all.min.css'); $this->LinkStylesheetFromAppRoot('css/font-combodo/font-combodo.css'); $this->LinkStylesheetFromAppRoot('node_modules/tippy.js/dist/tippy.css'); @@ -72,7 +72,7 @@ class SetupPage extends NiceWebPage /** * Overriden because the application is not fully loaded when the setup is being run */ - function GetApplicationContext() + public function GetApplicationContext() { return ''; } @@ -104,33 +104,22 @@ class SetupPage extends NiceWebPage public function form($aData) { $this->add("\n"); - foreach ($aData as $aRow) - { + foreach ($aData as $aRow) { $this->add("\n"); - if (isset($aRow['label']) && isset($aRow['input']) && isset($aRow['help'])) - { + if (isset($aRow['label']) && isset($aRow['input']) && isset($aRow['help'])) { $this->add("\n"); $this->add("\n"); $this->add("\n"); - } - else - { - if (isset($aRow['label']) && isset($aRow['help'])) - { + } else { + if (isset($aRow['label']) && isset($aRow['help'])) { $this->add("\n"); $this->add("\n"); - } - else - { - if (isset($aRow['label']) && isset($aRow['input'])) - { + } else { + if (isset($aRow['label']) && isset($aRow['input'])) { $this->add("\n"); $this->add("\n"); - } - else - { - if (isset($aRow['label'])) - { + } else { + if (isset($aRow['label'])) { $this->add("\n"); } } @@ -145,14 +134,12 @@ class SetupPage extends NiceWebPage { $this->add("

      $sTitle

      "); $this->p('
        '); - foreach ($aItems as $sItem) - { + foreach ($aItems as $sItem) { $this->p("
      • $sItem
      • \n"); } $this->p('
      '); $this->add_ready_script("$('#{$sId}').on('click', function() { $(this).toggleClass('open'); $('#{$sId}_list').toggle();} );\n"); - if (!$bOpen) - { + if (!$bOpen) { $this->add_ready_script("$('#{$sId}').toggleClass('open'); $('#{$sId}_list').toggle();\n"); } } diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index e01f2e49c..d04c920df 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -1,9 +1,10 @@ iSeverity = $iSeverity; $this->sLabel = $sLabel; $this->sDescription = $sDescription; @@ -46,7 +49,8 @@ class CheckResult { * @return string * @since 3.0.0 N°2214 */ - public function __toString(): string { + public function __toString(): string + { $sPrintDesc = (empty($this->sDescription)) ? '' : " ({$this->sDescription})"; return "{$this->sLabel}$sPrintDesc"; @@ -60,8 +64,10 @@ class CheckResult { * * @since 3.0.0 N°2214 */ - public static function FilterCheckResultArray(array $aResults, array $aCheckResultSeverities): array { - return array_filter($aResults, + public static function FilterCheckResultArray(array $aResults, array $aCheckResultSeverities): array + { + return array_filter( + $aResults, static function ($v) use ($aCheckResultSeverities) { if (in_array($v->iSeverity, $aCheckResultSeverities, true)) { return $v; @@ -69,7 +75,8 @@ class CheckResult { return false; }, - ARRAY_FILTER_USE_BOTH); + ARRAY_FILTER_USE_BOTH + ); } /** @@ -80,7 +87,8 @@ class CheckResult { * * @since 3.0.0 N°2214 */ - public static function FromObjectsToStrings(array $aResults): array { + public static function FromObjectsToStrings(array $aResults): array + { return array_map(static function ($value) { return $value->__toString(); }, $aResults); @@ -96,18 +104,18 @@ class CheckResult { class SetupUtils { // -- Minimum versions (requirements : forbids installation if not met) - const PHP_MIN_VERSION = '8.1.0'; - const MYSQL_MIN_VERSION = '5.7.0'; // 5.6 is no longer supported - const MYSQL_NOT_VALIDATED_VERSION = ''; // MySQL 8 is now OK (N°2010 in 2.7.0) but has no query cache so mind the perf on large volumes ! + public const PHP_MIN_VERSION = '8.1.0'; + public const MYSQL_MIN_VERSION = '5.7.0'; // 5.6 is no longer supported + public const MYSQL_NOT_VALIDATED_VERSION = ''; // MySQL 8 is now OK (N°2010 in 2.7.0) but has no query cache so mind the perf on large volumes ! // -- versions that will be the minimum in next iTop major release (warning if not met) - const PHP_NEXT_MIN_VERSION = ''; // No new PHP requirement for next iTop version yet - const MYSQL_NEXT_MIN_VERSION = ''; // No new MySQL requirement for next iTop version yet + public const PHP_NEXT_MIN_VERSION = ''; // No new PHP requirement for next iTop version yet + public const MYSQL_NEXT_MIN_VERSION = ''; // No new MySQL requirement for next iTop version yet // -- First recent version that is not yet validated by Combodo (warning) - const PHP_NOT_VALIDATED_VERSION = '8.4.0'; + public const PHP_NOT_VALIDATED_VERSION = '8.4.0'; - const MIN_MEMORY_LIMIT = '32M'; - const SUHOSIN_GET_MAX_VALUE_LENGTH = 2048; + public const MIN_MEMORY_LIMIT = '32M'; + public const SUHOSIN_GET_MAX_VALUE_LENGTH = 2048; /** * Check configuration parameters, for example : @@ -135,8 +143,9 @@ class SetupUtils * @since 3.0.0 N°2214 disable some checks when in CLI mode * @since 3.0.0 N°2214 replace SetupLog::Ok calls by CheckResult::TRACE */ - public static function CheckPhpAndExtensions() { - $aResult = array(); + public static function CheckPhpAndExtensions() + { + $aResult = []; // For log file(s) if (!is_dir(APPROOT.'log')) { @@ -167,83 +176,61 @@ class SetupUtils asort($aMandatoryExtensions); // Sort the list to look clean ! ksort($aOptionalExtensions); // Sort the list to look clean ! - $aExtensionsOk = array(); - $aMissingExtensions = array(); - $aMissingExtensionsLinks = array(); + $aExtensionsOk = []; + $aMissingExtensions = []; + $aMissingExtensionsLinks = []; // First check the mandatory extensions - foreach($aMandatoryExtensions as $sExtension) - { - if (extension_loaded($sExtension)) - { + foreach ($aMandatoryExtensions as $sExtension) { + if (extension_loaded($sExtension)) { $aExtensionsOk[] = $sExtension; - } - else - { + } else { $aMissingExtensions[] = $sExtension; $aMissingExtensionsLinks[] = "$sExtension"; } } - if (count($aExtensionsOk) > 0) - { + if (count($aExtensionsOk) > 0) { $aResult[] = new CheckResult(CheckResult::INFO, "Required PHP extension(s): ".implode(', ', $aExtensionsOk)."."); } - if (count($aMissingExtensions) > 0) - { + if (count($aMissingExtensions) > 0) { $aResult[] = new CheckResult(CheckResult::ERROR, "Missing PHP extension(s): ".implode(', ', $aMissingExtensionsLinks)."."); } // Next check the optional extensions - $aExtensionsOk = array(); - $aMissingExtensions = array(); - foreach($aOptionalExtensions as $sExtension => $sMessage) - { + $aExtensionsOk = []; + $aMissingExtensions = []; + foreach ($aOptionalExtensions as $sExtension => $sMessage) { //if sMessage is an array, extensions in it are conditional between them - if (is_array($sMessage)) - { + if (is_array($sMessage)) { $bIsAtLeastOneLoaded = false; $sConditionalMissingMessage = ''; - foreach($sMessage as $sConditionalExtension => $sConditionalMessage) - { - if (extension_loaded($sConditionalExtension)) - { + foreach ($sMessage as $sConditionalExtension => $sConditionalMessage) { + if (extension_loaded($sConditionalExtension)) { $bIsAtLeastOneLoaded = true; $aExtensionsOk[] = $sConditionalExtension; - } - else - { + } else { $sConditionalMissingMessage = $sConditionalMessage; } } - if(!$bIsAtLeastOneLoaded) - { + if (!$bIsAtLeastOneLoaded) { $aMissingExtensions[$sExtension] = $sConditionalMissingMessage; } - } - else - { - if (extension_loaded($sExtension)) - { + } else { + if (extension_loaded($sExtension)) { $aExtensionsOk[] = $sExtension; - } - else - { + } else { $aMissingExtensions[$sExtension] = $sMessage; } } } - if (count($aExtensionsOk) > 0) - { + if (count($aExtensionsOk) > 0) { $aResult[] = new CheckResult(CheckResult::INFO, "Optional PHP extension(s): ".implode(', ', $aExtensionsOk)."."); } - if (count($aMissingExtensions) > 0) - { - foreach($aMissingExtensions as $sExtension => $sMessage) - { + if (count($aMissingExtensions) > 0) { + foreach ($aMissingExtensions as $sExtension => $sMessage) { $aResult[] = new CheckResult(CheckResult::WARNING, "Missing optional PHP extension: $sExtension. ".$sMessage); } } // Check some ini settings here - if (function_exists('php_ini_loaded_file')) // PHP >= 5.2.4 - { + if (function_exists('php_ini_loaded_file')) { // PHP >= 5.2.4 $sPhpIniFile = php_ini_loaded_file(); // Other included/scanned files if ($sFileList = php_ini_scanned_files()) { @@ -259,45 +246,57 @@ class SetupUtils } if (!utils::IsModeCLI() && !ini_get('file_uploads')) { - $aResult[] = new CheckResult(CheckResult::ERROR, - "Files upload is not allowed on this server (file_uploads = ".ini_get('file_uploads').")."); + $aResult[] = new CheckResult( + CheckResult::ERROR, + "Files upload is not allowed on this server (file_uploads = ".ini_get('file_uploads').")." + ); } if (!utils::IsModeCLI()) { $sUploadTmpDir = self::GetUploadTmpDir(); if (empty($sUploadTmpDir)) { $sUploadTmpDir = '/tmp'; - $aResult[] = new CheckResult(CheckResult::WARNING, - "Temporary directory for files upload is not defined (upload_tmp_dir), assuming that $sUploadTmpDir is used."); + $aResult[] = new CheckResult( + CheckResult::WARNING, + "Temporary directory for files upload is not defined (upload_tmp_dir), assuming that $sUploadTmpDir is used." + ); } // check that the upload directory is indeed writable from PHP if (!empty($sUploadTmpDir)) { if (!file_exists($sUploadTmpDir)) { - $aResult[] = new CheckResult(CheckResult::ERROR, - "Temporary directory for files upload ($sUploadTmpDir) does not exist or cannot be read by PHP."); - } - else { + $aResult[] = new CheckResult( + CheckResult::ERROR, + "Temporary directory for files upload ($sUploadTmpDir) does not exist or cannot be read by PHP." + ); + } else { if (!is_writable($sUploadTmpDir)) { - $aResult[] = new CheckResult(CheckResult::ERROR, - "Temporary directory for files upload ($sUploadTmpDir) is not writable."); - } - else { - $aResult[] = new CheckResult(CheckResult::TRACE, - "Info - Temporary directory for files upload ($sUploadTmpDir) is writable."); + $aResult[] = new CheckResult( + CheckResult::ERROR, + "Temporary directory for files upload ($sUploadTmpDir) is not writable." + ); + } else { + $aResult[] = new CheckResult( + CheckResult::TRACE, + "Info - Temporary directory for files upload ($sUploadTmpDir) is writable." + ); } } } } if (!utils::IsModeCLI() && !ini_get('upload_max_filesize')) { - $aResult[] = new CheckResult(CheckResult::ERROR, - "File upload is not allowed on this server (upload_max_filesize = ".ini_get('upload_max_filesize').")."); + $aResult[] = new CheckResult( + CheckResult::ERROR, + "File upload is not allowed on this server (upload_max_filesize = ".ini_get('upload_max_filesize').")." + ); } $iMaxFileUploads = ini_get('max_file_uploads'); if (!utils::IsModeCLI() && !empty($iMaxFileUploads) && ($iMaxFileUploads < 1)) { - $aResult[] = new CheckResult(CheckResult::ERROR, - "File upload is not allowed on this server (max_file_uploads = ".ini_get('max_file_uploads').")."); + $aResult[] = new CheckResult( + CheckResult::ERROR, + "File upload is not allowed on this server (max_file_uploads = ".ini_get('max_file_uploads').")." + ); } if (!utils::IsModeCLI()) { @@ -305,8 +304,10 @@ class SetupUtils $iMaxPostSize = utils::ConvertToBytes(ini_get('post_max_size')); if ($iMaxPostSize <= $iMaxUploadSize) { - $aResult[] = new CheckResult(CheckResult::WARNING, - "post_max_size (".ini_get('post_max_size').") in php.ini should be strictly greater than upload_max_filesize (".ini_get('upload_max_filesize').") otherwise you cannot upload files of the maximum size."); + $aResult[] = new CheckResult( + CheckResult::WARNING, + "post_max_size (".ini_get('post_max_size').") in php.ini should be strictly greater than upload_max_filesize (".ini_get('upload_max_filesize').") otherwise you cannot upload files of the maximum size." + ); } $aResult[] = new CheckResult(CheckResult::TRACE, "Info - upload_max_filesize: ".ini_get('upload_max_filesize')); @@ -334,30 +335,28 @@ class SetupUtils } // Special case for APC - if (extension_loaded('apc')) - { + if (extension_loaded('apc')) { $sAPCVersion = phpversion('apc'); $aResult[] = new CheckResult(CheckResult::INFO, "APC detected (version $sAPCVersion). The APC cache will be used to speed-up ".ITOP_APPLICATION."."); } // Special case Suhosin extension - if (extension_loaded('suhosin')) - { + if (extension_loaded('suhosin')) { $sSuhosinVersion = phpversion('suhosin'); $aOk[] = "Suhosin extension detected (version $sSuhosinVersion)."; $iGetMaxValueLength = ini_get('suhosin.get.max_value_length'); if ($iGetMaxValueLength < self::SUHOSIN_GET_MAX_VALUE_LENGTH) { - $aResult[] = new CheckResult(CheckResult::WARNING, - "suhosin.get.max_value_length ($iGetMaxValueLength) is too small, the minimum value recommended to run the application is ".self::SUHOSIN_GET_MAX_VALUE_LENGTH."."); - } - else { + $aResult[] = new CheckResult( + CheckResult::WARNING, + "suhosin.get.max_value_length ($iGetMaxValueLength) is too small, the minimum value recommended to run the application is ".self::SUHOSIN_GET_MAX_VALUE_LENGTH."." + ); + } else { $aResult[] = new CheckResult(CheckResult::TRACE, "Info - suhosin.get.max_value_length = $iGetMaxValueLength, ok."); } } - if (function_exists('php_ini_loaded_file')) // PHP >= 5.2.4 - { + if (function_exists('php_ini_loaded_file')) { // PHP >= 5.2.4 $sPhpIniFile = php_ini_loaded_file(); // Other included/scanned files if ($sFileList = php_ini_scanned_files()) { @@ -387,22 +386,27 @@ class SetupUtils $sSavePath = substr($sSavePath, $iPos + 1); } if (!is_writable($sSavePath)) { - $aResult[] = new CheckResult(CheckResult::ERROR, - "The value for session.save_path ($sSavePath) is not writable for the web server. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)"); - } - else { - $aResult[] = new CheckResult(CheckResult::INFO, - "The value for session.save_path ($sSavePath) is writable for the web server."); + $aResult[] = new CheckResult( + CheckResult::ERROR, + "The value for session.save_path ($sSavePath) is not writable for the web server. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)" + ); + } else { + $aResult[] = new CheckResult( + CheckResult::INFO, + "The value for session.save_path ($sSavePath) is writable for the web server." + ); } + } else { + $aResult[] = new CheckResult( + CheckResult::WARNING, + "Empty path for session.save_path. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)" + ); } - else { - $aResult[] = new CheckResult(CheckResult::WARNING, - "Empty path for session.save_path. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)"); - } - } - else { - $aResult[] = new CheckResult(CheckResult::INFO, - "session.save_handler is: '".ini_get('session.save_handler')."' (different from 'files')."); + } else { + $aResult[] = new CheckResult( + CheckResult::INFO, + "session.save_handler is: '".ini_get('session.save_handler')."' (different from 'files')." + ); } } @@ -451,38 +455,43 @@ class SetupUtils * * @since 3.0.0 N°2214 replace SetupLog::Log calls by CheckResult::TRACE */ - private static function CheckPhpVersion(array &$aResult) { + private static function CheckPhpVersion(array &$aResult) + { $aResult[] = new CheckResult(CheckResult::TRACE, 'Info - CheckPHPVersion'); $sPhpVersion = phpversion(); if (version_compare($sPhpVersion, self::PHP_MIN_VERSION, '>=')) { - $aResult[] = new CheckResult(CheckResult::INFO, - "The current PHP Version (".$sPhpVersion.") is greater than the minimum version required to run ".ITOP_APPLICATION.", which is (".self::PHP_MIN_VERSION.")"); - + $aResult[] = new CheckResult( + CheckResult::INFO, + "The current PHP Version (".$sPhpVersion.") is greater than the minimum version required to run ".ITOP_APPLICATION.", which is (".self::PHP_MIN_VERSION.")" + ); $sPhpNextMinVersion = self::PHP_NEXT_MIN_VERSION; // mandatory before PHP 5.5 (arbitrary expressions), keeping compat because we're in the setup ! if (!empty($sPhpNextMinVersion)) { if (version_compare($sPhpVersion, self::PHP_NEXT_MIN_VERSION, '>=')) { - $aResult[] = new CheckResult(CheckResult::INFO, - "The current PHP Version (".$sPhpVersion.") is greater than the minimum version required to run next ".ITOP_APPLICATION." major release, which is (".self::PHP_NEXT_MIN_VERSION.")"); - } - else - { - $aResult[] = new CheckResult(CheckResult::WARNING, - "The current PHP Version (".$sPhpVersion.") is lower than the minimum version required to run next ".ITOP_APPLICATION." major release, which is (".self::PHP_NEXT_MIN_VERSION.")"); + $aResult[] = new CheckResult( + CheckResult::INFO, + "The current PHP Version (".$sPhpVersion.") is greater than the minimum version required to run next ".ITOP_APPLICATION." major release, which is (".self::PHP_NEXT_MIN_VERSION.")" + ); + } else { + $aResult[] = new CheckResult( + CheckResult::WARNING, + "The current PHP Version (".$sPhpVersion.") is lower than the minimum version required to run next ".ITOP_APPLICATION." major release, which is (".self::PHP_NEXT_MIN_VERSION.")" + ); } } - if (version_compare($sPhpVersion, self::PHP_NOT_VALIDATED_VERSION, '>=')) - { - $aResult[] = new CheckResult(CheckResult::WARNING, - "The current PHP Version (".$sPhpVersion.") is not yet validated by Combodo. You may experience some incompatibility issues."); + if (version_compare($sPhpVersion, self::PHP_NOT_VALIDATED_VERSION, '>=')) { + $aResult[] = new CheckResult( + CheckResult::WARNING, + "The current PHP Version (".$sPhpVersion.") is not yet validated by Combodo. You may experience some incompatibility issues." + ); } - } - else - { - $aResult[] = new CheckResult(CheckResult::ERROR, - "Error: The current PHP Version (".$sPhpVersion.") is lower than the minimum version required to run ".ITOP_APPLICATION.", which is (".self::PHP_MIN_VERSION.")"); + } else { + $aResult[] = new CheckResult( + CheckResult::ERROR, + "Error: The current PHP Version (".$sPhpVersion.") is lower than the minimum version required to run ".ITOP_APPLICATION.", which is (".self::PHP_MIN_VERSION.")" + ); } } @@ -497,10 +506,11 @@ class SetupUtils * * @since 3.0.0 N°2214 replace SetupLog::Log calls by CheckResult::TRACE */ - public static function CheckSelectedModules($sSourceDir, $sExtensionDir, $aSelectedModules) { - $aResult = array(); + public static function CheckSelectedModules($sSourceDir, $sExtensionDir, $aSelectedModules) + { + $aResult = []; - $aDirsToScan = array(APPROOT.$sSourceDir); + $aDirsToScan = [APPROOT.$sSourceDir]; $sExtensionsPath = APPROOT.$sExtensionDir; if (is_dir($sExtensionsPath)) { // if the extensions dir exists, scan it for additional modules as well @@ -525,8 +535,9 @@ class SetupUtils * * @since 3.0.0 N°2214 replace SetupLog::Log calls by CheckResult::TRACE */ - public static function CheckBackupPrerequisites($sDBBackupPath, $sMySQLBinDir = null) { - $aResult = array(); + public static function CheckBackupPrerequisites($sDBBackupPath, $sMySQLBinDir = null) + { + $aResult = []; $aResult[] = new CheckResult(CheckResult::TRACE, 'Info - CheckBackupPrerequisites'); // zip extension @@ -558,27 +569,28 @@ class SetupUtils $aResult[] = new CheckResult(CheckResult::ERROR, $e->getMessage()); return $aResult; } - if (!empty($sMySQLBinDir)) { - $aResult[] = new CheckResult(CheckResult::TRACE, 'Info - Found mysql_bindir: '.$sMySQLBinDir); - } + if (!empty($sMySQLBinDir)) { + $aResult[] = new CheckResult(CheckResult::TRACE, 'Info - Found mysql_bindir: '.$sMySQLBinDir); + } $sCommand = "$sMySQLDump -V 2>&1"; - $aOutput = array(); + $aOutput = []; $iRetCode = 0; exec($sCommand, $aOutput, $iRetCode); - if ($iRetCode == 0) - { + if ($iRetCode == 0) { $aResult[] = new CheckResult(CheckResult::INFO, "mysqldump is present: Ok."); - } - elseif ($iRetCode == 1) { + } elseif ($iRetCode == 1) { // Unfortunately $aOutput is not really usable since we don't know its encoding (character set) - $aResult[] = new CheckResult(CheckResult::ERROR, - "mysqldump could not be found. Please make sure it is installed and in the path."); - } - else { + $aResult[] = new CheckResult( + CheckResult::ERROR, + "mysqldump could not be found. Please make sure it is installed and in the path." + ); + } else { // Unfortunately $aOutput is not really usable since we don't know its encoding (character set) - $aResult[] = new CheckResult(CheckResult::ERROR, - "mysqldump could not be executed (retcode=$iRetCode): Please make sure it is installed and ".(empty($sMySQLBinDir) ? "in the path" : "located at : $sMySQLDump")); + $aResult[] = new CheckResult( + CheckResult::ERROR, + "mysqldump could not be executed (retcode=$iRetCode): Please make sure it is installed and ".(empty($sMySQLBinDir) ? "in the path" : "located at : $sMySQLDump") + ); } foreach ($aOutput as $sLine) { $aResult[] = new CheckResult(CheckResult::TRACE, 'Info - mysqldump -V said: '.$sLine); @@ -611,7 +623,8 @@ class SetupUtils * * @since 3.0.0 N°2214 replace SetupLog::Log calls by CheckResult::TRACE */ - public static function CheckGraphviz($sGraphvizPath) { + public static function CheckGraphviz($sGraphvizPath) + { $aResult = []; $aResult[] = new CheckResult(CheckResult::TRACE, 'Info - CheckGraphviz'); @@ -620,8 +633,10 @@ class SetupUtils $aDisabled = explode(', ', ini_get('disable_functions')); $aResult[] = new CheckResult(CheckResult::TRACE, 'Info - PHP functions disabled: '.implode(', ', $aDisabled)); if (in_array('exec', $aDisabled)) { - $aResult[] = new CheckResult(CheckResult::ERROR, - self::GetStringForJsonEncode('The PHP exec() function has been disabled on this server', 'Could not find Graphviz\' dot')); + $aResult[] = new CheckResult( + CheckResult::ERROR, + self::GetStringForJsonEncode('The PHP exec() function has been disabled on this server', 'Could not find Graphviz\' dot') + ); } // availability of dot / dot.exe @@ -632,34 +647,39 @@ class SetupUtils if (!is_file($sGraphvizPath) || !is_executable($sGraphvizPath)) { //N°3412 avoid shell injection $aResult = []; - $aResult[] = new CheckResult(CheckResult::WARNING, + $aResult[] = new CheckResult( + CheckResult::WARNING, self::GetStringForJsonEncode("$sGraphvizPath could not be executed: Please make sure it is installed and in the path", 'Graphviz could not be executed') ); return $aResult; } - if (!utils::IsWindowsEnvironment()){ + if (!utils::IsWindowsEnvironment()) { $sGraphvizPath = escapeshellcmd($sGraphvizPath); } } $sCommand = "\"$sGraphvizPath\" -V 2>&1"; - $aOutput = array(); + $aOutput = []; $iRetCode = 0; exec($sCommand, $aOutput, $iRetCode); if ($iRetCode == 0) { - $aResult[] = new CheckResult(CheckResult::INFO, - self::GetStringForJsonEncode("dot is present: ".$aOutput[0], 'Graphviz\' dot found')); + $aResult[] = new CheckResult( + CheckResult::INFO, + self::GetStringForJsonEncode("dot is present: ".$aOutput[0], 'Graphviz\' dot found') + ); } elseif ($iRetCode == 1) { - $aResult[] = new CheckResult(CheckResult::WARNING, + $aResult[] = new CheckResult( + CheckResult::WARNING, self::GetStringForJsonEncode( "dot could not be found: ".implode(' ', $aOutput)." - Please make sure it is installed and in the path.", 'Could not find Graphviz\' dot' ) ); } else { - $aResult[] = new CheckResult(CheckResult::WARNING, + $aResult[] = new CheckResult( + CheckResult::WARNING, self::GetStringForJsonEncode( "dot could not be executed (retcode=$iRetCode): Please make sure it is installed and in the path", 'Could not find Graphviz\' dot' @@ -684,7 +704,8 @@ class SetupUtils * * @since 3.0.0 */ - private static function GetStringForJsonEncode(string $sValue, string $sFallbackValue): string { + private static function GetStringForJsonEncode(string $sValue, string $sFallbackValue): string + { return (json_encode($sValue) !== false) ? $sValue : $sFallbackValue; @@ -697,7 +718,8 @@ class SetupUtils * @return string Path to the system's temp directory * @uses \sys_get_temp_dir() */ - public static function GetTmpDir() { + public static function GetTmpDir() + { return realpath(sys_get_temp_dir()); } @@ -706,7 +728,8 @@ class SetupUtils * * @return string Path to the temp directory used for uploading files */ - public static function GetUploadTmpDir() { + public static function GetUploadTmpDir() + { $sPath = ini_get('upload_tmp_dir'); if (empty($sPath)) { $sPath = self::GetTmpDir(); @@ -722,8 +745,7 @@ class SetupUtils */ public static function rrmdir($dir) { - if ((strlen(trim($dir)) == 0) || ($dir == '/') || ($dir == '\\')) - { + if ((strlen(trim($dir)) == 0) || ($dir == '/') || ($dir == '\\')) { throw new Exception("Attempting to delete directory: '$dir'"); } self::tidydir($dir); @@ -737,7 +759,8 @@ class SetupUtils * * @throws Exception */ - public static function tidydir(string $dir): void { + public static function tidydir(string $dir): void + { if ((strlen(trim($dir)) == 0) || ($dir == '/') || ($dir == '\\')) { throw new Exception("Attempting to delete directory: '$dir'"); } @@ -753,7 +776,7 @@ class SetupUtils } else { if (!unlink($dir.'/'.$file)) { SetupLog::Ok("Warning - FAILED to remove file '$dir/$file'"); - } else if (file_exists($dir.'/'.$file)) { + } elseif (file_exists($dir.'/'.$file)) { SetupLog::Ok("Warning - FAILED to remove file '$dir/.$file'"); } } @@ -769,13 +792,11 @@ class SetupUtils */ public static function builddir($dir) { - if (empty($dir)) - { + if (empty($dir)) { // avoid infinite loops :/ return; } - if (!is_dir($dir)) - { + if (!is_dir($dir)) { $parent = dirname($dir); self::builddir($parent); if (!mkdir($dir) && !is_dir($dir)) { @@ -816,49 +837,33 @@ class SetupUtils */ public static function copydir($sSource, $sDest, $bUseSymbolicLinks = false) { - if (is_dir($sSource)) - { - if (!is_dir($sDest)) - { + if (is_dir($sSource)) { + if (!is_dir($sDest)) { mkdir($sDest, 0777 /* Default */, true); } $aFiles = scandir($sSource); - if(sizeof($aFiles) > 0 ) - { - foreach($aFiles as $sFile) - { - if ($sFile == '.' || $sFile == '..' || $sFile == '.svn' || $sFile == '.git') - { + if (sizeof($aFiles) > 0) { + foreach ($aFiles as $sFile) { + if ($sFile == '.' || $sFile == '..' || $sFile == '.svn' || $sFile == '.git') { // Skip continue; } - if (is_dir($sSource.'/'.$sFile)) - { + if (is_dir($sSource.'/'.$sFile)) { // Recurse self::copydir($sSource.'/'.$sFile, $sDest.'/'.$sFile, $bUseSymbolicLinks); - } - else - { - if ($bUseSymbolicLinks) - { - if (function_exists('symlink')) - { - if (file_exists($sDest.'/'.$sFile)) - { + } else { + if ($bUseSymbolicLinks) { + if (function_exists('symlink')) { + if (file_exists($sDest.'/'.$sFile)) { unlink($sDest.'/'.$sFile); } symlink($sSource.'/'.$sFile, $sDest.'/'.$sFile); - } - else - { + } else { throw(new Exception("Error, cannot *copy* '$sSource/$sFile' to '$sDest/$sFile' using symbolic links, 'symlink' is not supported on this system.")); } - } - else - { - if (is_link($sDest.'/'.$sFile)) - { + } else { + if (is_link($sDest.'/'.$sFile)) { unlink($sDest.'/'.$sFile); } copy($sSource.'/'.$sFile, $sDest.'/'.$sFile); @@ -867,27 +872,17 @@ class SetupUtils } } return true; - } - elseif (is_file($sSource)) - { - if ($bUseSymbolicLinks) - { - if (function_exists('symlink')) - { + } elseif (is_file($sSource)) { + if ($bUseSymbolicLinks) { + if (function_exists('symlink')) { return symlink($sSource, $sDest); - } - else - { + } else { throw(new Exception("Error, cannot *copy* '$sSource' to '$sDest' using symbolic links, 'symlink' is not supported on this system.")); } - } - else - { + } else { return copy($sSource, $sDest); } - } - else - { + } else { return false; } } @@ -905,23 +900,18 @@ class SetupUtils */ public static function movedir($sSource, $sDest, $bRemoveSource = true) { - if (!is_dir($sSource)) - { + if (!is_dir($sSource)) { throw new Exception("movedir: the source directory '$sSource' is not a valid directory or cannot be read"); } - if (!is_dir($sDest)) - { + if (!is_dir($sDest)) { self::builddir($sDest); - } - else - { + } else { self::tidydir($sDest); } self::copydir($sSource, $sDest); self::tidydir($sSource); - if($bRemoveSource === true) - { + if ($bRemoveSource === true) { self::rmdir_safe($sSource); } } @@ -931,30 +921,26 @@ class SetupUtils $sSourceDir = ''; $sSourceEnvironment = ''; $sConfigFile = ''; - $aResult = array( + $aResult = [ 'found' => false, - ); + ]; - if (file_exists($sDir.'/config-itop.php')) - { + if (file_exists($sDir.'/config-itop.php')) { $sSourceDir = $sDir; $sSourceEnvironment = ''; $sConfigFile = $sDir.'/config-itop.php'; $aResult['found'] = true; - } - else if (file_exists($sDir.'/conf/production/config-itop.php')) - { + } elseif (file_exists($sDir.'/conf/production/config-itop.php')) { $sSourceDir = $sDir; $sSourceEnvironment = 'production'; $sConfigFile = $sDir.'/conf/production/config-itop.php'; $aResult['found'] = true; } - if ($aResult['found']) - { + if ($aResult['found']) { $oPrevConf = new Config($sConfigFile); - $aResult = array( + $aResult = [ 'found' => true, 'source_dir' => $sSourceDir, 'source_environment' => $sSourceEnvironment, @@ -968,7 +954,7 @@ class SetupUtils 'db_tls_ca' => $oPrevConf->Get('db_tls.ca'), 'graphviz_path' => $oPrevConf->Get('graphviz_path'), 'mysql_bindir' => $oPrevConf->GetModuleSetting('itop-backup', 'mysql_bindir', ''), - ); + ]; } return $aResult; @@ -982,28 +968,31 @@ class SetupUtils */ public static function CheckDiskSpace($sDir) { - while(($f = @disk_free_space($sDir)) == false) - { - if ($sDir == dirname($sDir)) break; - if ($sDir == '.') break; + while (($f = @disk_free_space($sDir)) == false) { + if ($sDir == dirname($sDir)) { + break; + } + if ($sDir == '.') { + break; + } $sDir = dirname($sDir); } return $f; } - /** - * @param float $fBytes size in raw bytes, for example 162594750464.0 - * @return string formatted string, for example "161.62 GB" - * - * @link https://en.wiktionary.org/wiki/byte byte and not Byte - * @link https://en.wikipedia.org/wiki/Kilobyte kB and not KB (IEC 80000-13) - * @link https://en.wiktionary.org/wiki/petabyte petabyte PB - * @link https://en.wiktionary.org/wiki/exabyte exabyte EB - */ + /** + * @param float $fBytes size in raw bytes, for example 162594750464.0 + * @return string formatted string, for example "161.62 GB" + * + * @link https://en.wiktionary.org/wiki/byte byte and not Byte + * @link https://en.wikipedia.org/wiki/Kilobyte kB and not KB (IEC 80000-13) + * @link https://en.wiktionary.org/wiki/petabyte petabyte PB + * @link https://en.wiktionary.org/wiki/exabyte exabyte EB + */ public static function HumanReadableSize($fBytes) { - $aSizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB'); + $aSizes = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB']; $index = 0; while (($fBytes > 1000) && ($index < count($aSizes))) { $index++; @@ -1031,7 +1020,15 @@ class SetupUtils * @param string $sNewDBName */ public static function DisplayDBParameters( - $oPage, $bIsItopInstall, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, $bTlsEnabled, $sTlsCA, + $oPage, + $bIsItopInstall, + $sDBServer, + $sDBUser, + $sDBPwd, + $sDBName, + $sDBPrefix, + $bTlsEnabled, + $sTlsCA, $sNewDBName = '' ) { $sWikiVersion = utils::GetItopVersionWikiSyntax(); //eg : '2_7_0'; @@ -1084,7 +1081,8 @@ class SetupUtils $oPage->add(''); // Sub options toggle (TLS, prefix) - $oPage->add_script(<<<'JS' + $oPage->add_script( + <<<'JS' function toggleCollapsableOptions($tbody) { $tbody.children().not(":first-child").toggle(); updateCollapsableImage($tbody); @@ -1094,8 +1092,7 @@ function updateCollapsableImage($tbody) { } JS ); - if ($bTlsEnabled) - { + if ($bTlsEnabled) { $oPage->add_ready_script('toggleCollapsableOptions($("tbody#tls_options"));'); } $oPage->add_ready_script( @@ -1250,22 +1247,22 @@ EOF * Array of database names (as strings) or null if not allowed) */ public static function CheckDbServer( - $sDBServer, $sDBUser, $sDBPwd, $bTlsEnabled = false, $sTlsCA = null - ) - { - $aResult = array('checks' => array(), 'databases' => null); + $sDBServer, + $sDBUser, + $sDBPwd, + $bTlsEnabled = false, + $sTlsCA = null + ) { + $aResult = ['checks' => [], 'databases' => null]; - if ($bTlsEnabled) - { - if (!empty($sTlsCA) && !self::CheckFileExists($sTlsCA, $aResult, 'Can\'t open SSL CA file')) - { + if ($bTlsEnabled) { + if (!empty($sTlsCA) && !self::CheckFileExists($sTlsCA, $aResult, 'Can\'t open SSL CA file')) { return $aResult; } } - try - { - $oDBSource = new CMDBSource; + try { + $oDBSource = new CMDBSource(); $oDBSource->Init($sDBServer, $sDBUser, $sDBPwd, '', $bTlsEnabled, $sTlsCA); $aResult['checks'][] = new CheckResult(CheckResult::INFO, "Connection to '$sDBServer' as '$sDBUser' successful."); $aResult['checks'][] = new CheckResult(CheckResult::INFO, "Info - User privileges: ".($oDBSource->GetRawPrivileges())); @@ -1280,16 +1277,17 @@ EOF $sMaxAllowedPacketFriendly = utils::BytesToFriendlyFormat($iMaxAllowedPacket); $iMaxUploadSize = utils::ConvertToBytes(ini_get('upload_max_filesize')); $sMaxUploadSizeFriendly = utils::BytesToFriendlyFormat($iMaxUploadSize); - if ($iMaxAllowedPacket >= (500 + $iMaxUploadSize)) // Allow some space for the query + the file to upload - { + if ($iMaxAllowedPacket >= (500 + $iMaxUploadSize)) { // Allow some space for the query + the file to upload $aResult['checks'][] = new CheckResult(CheckResult::INFO, "MySQL server's max_allowed_packet ($sMaxAllowedPacketFriendly) is big enough compared to upload_max_filesize ($sMaxUploadSizeFriendly)."); - } else if ($iMaxAllowedPacket < $iMaxUploadSize) { + } elseif ($iMaxAllowedPacket < $iMaxUploadSize) { $sWikiVersion = utils::GetItopVersionWikiSyntax(); //eg : '2_7_0'; $sAttachmentsVarsWikiPageUrl = 'https://www.itophub.io/wiki/page?id='.$sWikiVersion .':install:php_and_mysql_configuration#attachments_upload'; - $aResult['checks'][] = new CheckResult(CheckResult::WARNING, - "MySQL server's max_allowed_packet ($sMaxAllowedPacketFriendly) is not big enough compared to upload_max_filesize ($sMaxUploadSizeFriendly), whereas it should has a greater value. Consider increasing its value of at least 500KB. See the documentation for details."); + $aResult['checks'][] = new CheckResult( + CheckResult::WARNING, + "MySQL server's max_allowed_packet ($sMaxAllowedPacketFriendly) is not big enough compared to upload_max_filesize ($sMaxUploadSizeFriendly), whereas it should has a greater value. Consider increasing its value of at least 500KB. See the documentation for details." + ); } $iMaxConnections = $oDBSource->GetServerVariable('max_connections'); @@ -1299,21 +1297,18 @@ EOF $aResult['checks'][] = new CheckResult(CheckResult::INFO, "MySQL server's max_connections is set to $iMaxConnections."); } - $iClusters = $oDBSource->GetClusterNb(); - if ($iClusters > 0) { - SetupLog::Warning('Warning - Using Galera will cause malfunctions and data corruptions. Combodo does not support this type of infrastructure.'); - $aResult['checks'][] = new CheckResult(CheckResult::WARNING, 'Using Galera will cause malfunctions and data corruptions. Combodo does not support this type of infrastructure.'); - } + $iClusters = $oDBSource->GetClusterNb(); + if ($iClusters > 0) { + SetupLog::Warning('Warning - Using Galera will cause malfunctions and data corruptions. Combodo does not support this type of infrastructure.'); + $aResult['checks'][] = new CheckResult(CheckResult::WARNING, 'Using Galera will cause malfunctions and data corruptions. Combodo does not support this type of infrastructure.'); + } try { $aResult['databases'] = $oDBSource->ListDB(); - } - catch (Exception $e) { + } catch (Exception $e) { $aResult['databases'] = null; } - } - catch(Exception $e) - { + } catch (Exception $e) { return false; } @@ -1332,8 +1327,7 @@ EOF */ private static function CheckFileExists($sPath, &$aResult, $sErrorMessage) { - if (!is_readable($sPath)) - { + if (!is_readable($sPath)) { $aResult['checks'][] = new CheckResult(CheckResult::ERROR, $sErrorMessage); return false; @@ -1358,39 +1352,42 @@ EOF && ($sDBVendor === CMDBSource::ENUM_DB_VENDOR_MYSQL) && version_compare($sDBVersion, self::MYSQL_NOT_VALIDATED_VERSION, '>=') ) { - $aResult['checks'][] = new CheckResult(CheckResult::ERROR, - "Error: Current MySQL version is $sDBVersion. iTop doesn't yet support MySQL ".self::MYSQL_NOT_VALIDATED_VERSION." and above."); + $aResult['checks'][] = new CheckResult( + CheckResult::ERROR, + "Error: Current MySQL version is $sDBVersion. iTop doesn't yet support MySQL ".self::MYSQL_NOT_VALIDATED_VERSION." and above." + ); return false; } $bRet = false; - if (version_compare($sDBVersion, self::MYSQL_MIN_VERSION, '>=')) - { - $aResult['checks'][] = new CheckResult(CheckResult::INFO, - "Current MySQL version ($sDBVersion), greater than minimum required version (".self::MYSQL_MIN_VERSION.")"); + if (version_compare($sDBVersion, self::MYSQL_MIN_VERSION, '>=')) { + $aResult['checks'][] = new CheckResult( + CheckResult::INFO, + "Current MySQL version ($sDBVersion), greater than minimum required version (".self::MYSQL_MIN_VERSION.")" + ); $sMySqlNextMinVersion = self::MYSQL_NEXT_MIN_VERSION; // mandatory before PHP 5.5 (arbitrary expressions), keeping compat because we're in the setup ! - if (!empty($sMySqlNextMinVersion)) - { - if (version_compare($sDBVersion, self::MYSQL_NEXT_MIN_VERSION, '>=')) - { - $aResult['checks'][] = new CheckResult(CheckResult::INFO, - "Current MySQL version ($sDBVersion), greater than minimum required version for next ".ITOP_APPLICATION." release (".self::MYSQL_NEXT_MIN_VERSION.")"); - } - else - { - $aResult['checks'][] = new CheckResult(CheckResult::WARNING, - "Warning : Current MySQL version is $sDBVersion, minimum required version for next ".ITOP_APPLICATION." release will be ".self::MYSQL_NEXT_MIN_VERSION); + if (!empty($sMySqlNextMinVersion)) { + if (version_compare($sDBVersion, self::MYSQL_NEXT_MIN_VERSION, '>=')) { + $aResult['checks'][] = new CheckResult( + CheckResult::INFO, + "Current MySQL version ($sDBVersion), greater than minimum required version for next ".ITOP_APPLICATION." release (".self::MYSQL_NEXT_MIN_VERSION.")" + ); + } else { + $aResult['checks'][] = new CheckResult( + CheckResult::WARNING, + "Warning : Current MySQL version is $sDBVersion, minimum required version for next ".ITOP_APPLICATION." release will be ".self::MYSQL_NEXT_MIN_VERSION + ); } } $bRet = true; - } - else - { - $aResult['checks'][] = new CheckResult(CheckResult::ERROR, - "Error: Current MySQL version is $sDBVersion, minimum required version is ".self::MYSQL_MIN_VERSION); + } else { + $aResult['checks'][] = new CheckResult( + CheckResult::ERROR, + "Error: Current MySQL version is $sDBVersion, minimum required version is ".self::MYSQL_MIN_VERSION + ); $bRet = false; } @@ -1408,10 +1405,13 @@ EOF * @throws \MySQLException */ public static function GetMySQLVersion( - $sDBServer, $sDBUser, $sDBPwd, $bTlsEnabled = false, $sTlsCa = null - ) - { - $oDBSource = new CMDBSource; + $sDBServer, + $sDBUser, + $sDBPwd, + $bTlsEnabled = false, + $sTlsCa = null + ) { + $oDBSource = new CMDBSource(); $oDBSource->Init($sDBServer, $sDBUser, $sDBPwd, '', $bTlsEnabled, $sTlsCa); $sDBVersion = $oDBSource->GetDBVersion(); @@ -1429,13 +1429,11 @@ EOF if ($bIsWindows && (preg_match('@([%!"])@', $sDBPwd) > 0)) { // Unsupported Password, warn the user $oPage->add_ready_script( -<<Error:On Windows, the backup won\'t work because database password contains %, ! or " character'); JS ); - } - else - { + } else { $sTlsEnabled = (isset($aParameters['db_tls_enabled'])) ? $aParameters['db_tls_enabled'] : null; $sTlsCA = (isset($aParameters['db_tls_ca'])) ? $aParameters['db_tls_ca'] : null; @@ -1443,30 +1441,22 @@ JS $checks = SetupUtils::CheckDbServer($sDBServer, $sDBUser, $sDBPwd, $sTlsEnabled, $sTlsCA); - if ($checks === false) - { + if ($checks === false) { // Connection failed, disable the "Next" button $oPage->add_ready_script('$("#wiz_form").data("db_connection", "error");'); $oPage->add_ready_script( <<Error:No connection to the database'); JS - ); - } - else - { - $aErrors = array(); - $aWarnings = array(); - foreach ($checks['checks'] as $oCheck) - { - if ($oCheck->iSeverity == CheckResult::ERROR) - { + ); + } else { + $aErrors = []; + $aWarnings = []; + foreach ($checks['checks'] as $oCheck) { + if ($oCheck->iSeverity == CheckResult::ERROR) { $aErrors[] = $oCheck->sLabel; - } - else - { - if ($oCheck->iSeverity == CheckResult::WARNING) - { + } else { + if ($oCheck->iSeverity == CheckResult::WARNING) { $aWarnings[] = $oCheck->sLabel; } } @@ -1581,7 +1571,7 @@ JS if (strpos($sSourceDir, APPROOT) !== false) { $sRelativeSourceDir = str_replace(APPROOT, '', $sSourceDir); - } else if (strpos($sSourceDir, $oWizard->GetParameter('previous_version_dir')) !== false) { + } elseif (strpos($sSourceDir, $oWizard->GetParameter('previous_version_dir')) !== false) { $sRelativeSourceDir = str_replace($oWizard->GetParameter('previous_version_dir'), '', $sSourceDir); } else { throw(new Exception('Internal error: AnalyzeInstallation: source_dir is neither under APPROOT nor under previous_installation_dir ???')); @@ -1590,7 +1580,7 @@ JS $aParamValues = $oWizard->GetParamForConfigArray(); $aParamValues['source_dir'] = $sRelativeSourceDir; $oConfig->UpdateFromParams($aParamValues, null); - $aDirsToScan = array($sSourceDir); + $aDirsToScan = [$sSourceDir]; if (is_dir(APPROOT.'extensions')) { $aDirsToScan[] = APPROOT.'extensions'; @@ -1599,18 +1589,15 @@ JS $aDirsToScan[] = $oWizard->GetParameter('copy_extensions_from'); } $sExtraDir = APPROOT.'data/production-modules/'; - if (is_dir($sExtraDir)) - { + if (is_dir($sExtraDir)) { $aDirsToScan[] = $sExtraDir; } $oProductionEnv = new RunTimeEnvironment(); $aAvailableModules = $oProductionEnv->AnalyzeInstallation($oConfig, $aDirsToScan, $bAbortOnMissingDependency, $aModulesToLoad); - foreach($aAvailableModules as $key => $aModule) - { + foreach ($aAvailableModules as $key => $aModule) { $bIsExtra = (array_key_exists('root_dir', $aModule) && (strpos($aModule['root_dir'], $sExtraDir) !== false)); // Some modules (root, datamodel) have no 'root_dir' - if ($bIsExtra) - { + if ($bIsExtra) { // Modules in data/production-modules/ are considered as mandatory and always installed $aAvailableModules[$key]['visible'] = false; } @@ -1671,18 +1658,15 @@ JS */ public static function CheckManualInstallDirEmpty($aModules, $sExtensionsDir = 'extensions') { - if (!static::IsProductVersion($aModules)) - { + if (!static::IsProductVersion($aModules)) { return ''; } $sManualInstallModulesFullPath = APPROOT.$sExtensionsDir.DIRECTORY_SEPARATOR; //simple test in order to prevent install iTop pro with module in extension folder $aFileInfo = scandir($sManualInstallModulesFullPath); - foreach ($aFileInfo as $sFolder) - { - if ($sFolder != "." && $sFolder != ".." && is_dir($sManualInstallModulesFullPath.$sFolder) === true) - { + foreach ($aFileInfo as $sFolder) { + if ($sFolder != "." && $sFolder != ".." && is_dir($sManualInstallModulesFullPath.$sFolder) === true) { return "Some modules are present in the '$sExtensionsDir' directory, this is not allowed when using ".ITOP_APPLICATION; } } @@ -1699,86 +1683,71 @@ JS * @return hash Hash array ('added' => array(), 'removed' => array(), 'modified' => array()) * @internal param array $aDOMManifest Array of array('path' => relative_path 'size'=> iSize, 'md5' => sHexMD5) */ - public static function CheckDirAgainstManifest($sBaseDir, $sSourceDir, $aManifest, $aExcludeNames = array('.svn', '.git'), $aResult = null) + public static function CheckDirAgainstManifest($sBaseDir, $sSourceDir, $aManifest, $aExcludeNames = ['.svn', '.git'], $aResult = null) { -//echo "CheckDirAgainstManifest($sBaseDir, $sSourceDir ...)\n"; - if ($aResult === null) - { - $aResult = array('added' => array(), 'removed' => array(), 'modified' => array()); + //echo "CheckDirAgainstManifest($sBaseDir, $sSourceDir ...)\n"; + if ($aResult === null) { + $aResult = ['added' => [], 'removed' => [], 'modified' => []]; } - if (substr($sSourceDir, 0, 1) == '/') - { + if (substr($sSourceDir, 0, 1) == '/') { $sSourceDir = substr($sSourceDir, 1); } // Manifest limited to all the files supposed to be located in this directory - $aDirManifest = array(); - foreach($aManifest as $aFileInfo) - { + $aDirManifest = []; + foreach ($aManifest as $aFileInfo) { $sDir = dirname($aFileInfo['path']); - if ($sDir == '.') - { + if ($sDir == '.') { // Hmm... the file seems located at the root of iTop $sDir = ''; } - if ($sDir == $sSourceDir) - { + if ($sDir == $sSourceDir) { $aDirManifest[basename($aFileInfo['path'])] = $aFileInfo; } } -//echo "The manifest contains ".count($aDirManifest)." files for the directory '$sSourceDir' (and below)\n"; + //echo "The manifest contains ".count($aDirManifest)." files for the directory '$sSourceDir' (and below)\n"; // Read the content of the directory - foreach(glob($sBaseDir.'/'.$sSourceDir .'/*') as $sFilePath) - { + foreach (glob($sBaseDir.'/'.$sSourceDir.'/*') as $sFilePath) { $sFile = basename($sFilePath); -//echo "Checking $sFile ($sFilePath)\n"; + //echo "Checking $sFile ($sFilePath)\n"; - if (in_array(basename($sFile), $aExcludeNames)) continue; - - if(is_dir($sFilePath)) - { - $aResult = self::CheckDirAgainstManifest($sBaseDir, $sSourceDir.'/'.$sFile, $aManifest, $aExcludeNames, $aResult); + if (in_array(basename($sFile), $aExcludeNames)) { + continue; } - else - { - if (!array_key_exists($sFile, $aDirManifest)) - { -//echo "New file ".$sFile." in $sSourceDir\n"; + + if (is_dir($sFilePath)) { + $aResult = self::CheckDirAgainstManifest($sBaseDir, $sSourceDir.'/'.$sFile, $aManifest, $aExcludeNames, $aResult); + } else { + if (!array_key_exists($sFile, $aDirManifest)) { + //echo "New file ".$sFile." in $sSourceDir\n"; $aResult['added'][$sSourceDir.'/'.$sFile] = true; - } - else - { + } else { $aStats = stat($sFilePath); - if ($aStats['size'] != $aDirManifest[$sFile]['size']) - { + if ($aStats['size'] != $aDirManifest[$sFile]['size']) { // Different sizes $aResult['modified'][$sSourceDir.'/'.$sFile] = 'Different sizes. Original size: '.$aDirManifest[$sFile]['size'].' bytes, actual file size on disk: '.$aStats['size'].' bytes.'; - } - else - { + } else { // Same size, compare the md5 signature $sMD5 = md5_file($sFilePath); - if ($sMD5 != $aDirManifest[$sFile]['md5']) - { + if ($sMD5 != $aDirManifest[$sFile]['md5']) { $aResult['modified'][$sSourceDir.'/'.$sFile] = 'Content modified (MD5 checksums differ).'; -//echo $sSourceDir.'/'.$sFile." modified ($sMD5 == {$aDirManifest[$sFile]['md5']})\n"; + //echo $sSourceDir.'/'.$sFile." modified ($sMD5 == {$aDirManifest[$sFile]['md5']})\n"; } -//else -//{ -// echo $sSourceDir.'/'.$sFile." unmodified ($sMD5 == {$aDirManifest[$sFile]['md5']})\n"; -//} + //else + //{ + // echo $sSourceDir.'/'.$sFile." unmodified ($sMD5 == {$aDirManifest[$sFile]['md5']})\n"; + //} } -//echo "Removing ".$sFile." from aDirManifest\n"; + //echo "Removing ".$sFile." from aDirManifest\n"; unset($aDirManifest[$sFile]); } } } // What remains in the array are files that were deleted - foreach($aDirManifest as $sDeletedFile => $void) - { + foreach ($aDirManifest as $sDeletedFile => $void) { $aResult['removed'][$sSourceDir.'/'.$sDeletedFile] = true; } return $aResult; @@ -1787,53 +1756,49 @@ JS public static function CheckDataModelFiles($sManifestFile, $sBaseDir) { $oXML = simplexml_load_file($sManifestFile); - $aManifest = array(); - foreach($oXML as $oFileInfo) - { - $aManifest[] = array('path' => (string)$oFileInfo->path, 'size' => (int)$oFileInfo->size, 'md5' => (string)$oFileInfo->md5); + $aManifest = []; + foreach ($oXML as $oFileInfo) { + $aManifest[] = ['path' => (string)$oFileInfo->path, 'size' => (int)$oFileInfo->size, 'md5' => (string)$oFileInfo->md5]; } $sBaseDir = preg_replace('|modules/?$|', '', $sBaseDir); $aResults = self::CheckDirAgainstManifest($sBaseDir, 'modules', $aManifest); -// echo "
      Comparison of ".dirname($sBaseDir)."/modules against $sManifestFile:\n".print_r($aResults, true)."
      "; + // echo "
      Comparison of ".dirname($sBaseDir)."/modules against $sManifestFile:\n".print_r($aResults, true)."
      "; return $aResults; } public static function CheckPortalFiles($sManifestFile, $sBaseDir) { $oXML = simplexml_load_file($sManifestFile); - $aManifest = array(); - foreach($oXML as $oFileInfo) - { - $aManifest[] = array('path' => (string)$oFileInfo->path, 'size' => (int)$oFileInfo->size, 'md5' => (string)$oFileInfo->md5); + $aManifest = []; + foreach ($oXML as $oFileInfo) { + $aManifest[] = ['path' => (string)$oFileInfo->path, 'size' => (int)$oFileInfo->size, 'md5' => (string)$oFileInfo->md5]; } $aResults = self::CheckDirAgainstManifest($sBaseDir, 'portal', $aManifest); -// echo "
      Comparison of ".dirname($sBaseDir)."/portal:\n".print_r($aResults, true)."
      "; + // echo "
      Comparison of ".dirname($sBaseDir)."/portal:\n".print_r($aResults, true)."
      "; return $aResults; } public static function CheckApplicationFiles($sManifestFile, $sBaseDir) { $oXML = simplexml_load_file($sManifestFile); - $aManifest = array(); - foreach($oXML as $oFileInfo) - { - $aManifest[] = array('path' => (string)$oFileInfo->path, 'size' => (int)$oFileInfo->size, 'md5' => (string)$oFileInfo->md5); + $aManifest = []; + foreach ($oXML as $oFileInfo) { + $aManifest[] = ['path' => (string)$oFileInfo->path, 'size' => (int)$oFileInfo->size, 'md5' => (string)$oFileInfo->md5]; } - $aResults = array('added' => array(), 'removed' => array(), 'modified' => array()); - foreach(array('addons', 'core', 'dictionaries', 'js', 'application', 'css', 'pages', 'synchro', 'webservices') as $sDir) - { + $aResults = ['added' => [], 'removed' => [], 'modified' => []]; + foreach (['addons', 'core', 'dictionaries', 'js', 'application', 'css', 'pages', 'synchro', 'webservices'] as $sDir) { $aTmp = self::CheckDirAgainstManifest($sBaseDir, $sDir, $aManifest); $aResults['added'] = array_merge($aResults['added'], $aTmp['added']); $aResults['modified'] = array_merge($aResults['modified'], $aTmp['modified']); $aResults['removed'] = array_merge($aResults['removed'], $aTmp['removed']); } -// echo "
      Comparison of ".dirname($sBaseDir)."/portal:\n".print_r($aResults, true)."
      "; + // echo "
      Comparison of ".dirname($sBaseDir)."/portal:\n".print_r($aResults, true)."
      "; return $aResults; } @@ -1846,10 +1811,8 @@ JS public static function CheckVersion($sInstalledVersion, $sSourceDir) { $sManifestFilePath = self::GetVersionManifest($sInstalledVersion); - if ($sSourceDir != '') - { - if (file_exists($sManifestFilePath)) - { + if ($sSourceDir != '') { + if (file_exists($sManifestFilePath)) { $aDMchanges = self::CheckDataModelFiles($sManifestFilePath, $sSourceDir); //$aPortalChanges = self::CheckPortalFiles($sManifestFilePath, $sSourceDir); //$aCodeChanges = self::CheckApplicationFiles($sManifestFilePath, $sSourceDir); @@ -1857,14 +1820,10 @@ JS //echo("Changes detected compared to $sInstalledVersion:
      DataModel:
      ".print_r($aDMchanges, true)."
      "); //echo("Changes detected compared to $sInstalledVersion:
      DataModel:
      ".print_r($aDMchanges, true)."

      Portal:
      ".print_r($aPortalChanges, true)."

      Code:
      ".print_r($aCodeChanges, true)."
      "); return $aDMchanges; - } - else - { + } else { return false; } - } - else - { + } else { throw(new Exception("Cannot check version '$sInstalledVersion', no source directory provided to check the files.")); } } @@ -1891,18 +1850,14 @@ JS */ public static function CheckWritableDirs($aWritableDirs) { - $aNonWritableDirs = array(); + $aNonWritableDirs = []; foreach ($aWritableDirs as $sDir) { $sFullPath = APPROOT.$sDir; if (is_dir($sFullPath) && !is_writable($sFullPath)) { $aNonWritableDirs[APPROOT.$sDir] = new CheckResult(CheckResult::ERROR, "The directory '".APPROOT.$sDir."' exists but is not writable for the application."); - } - else if (file_exists($sFullPath) && !is_dir($sFullPath)) - { + } elseif (file_exists($sFullPath) && !is_dir($sFullPath)) { $aNonWritableDirs[APPROOT.$sDir] = new CheckResult(CheckResult::ERROR, ITOP_APPLICATION." needs the directory '".APPROOT.$sDir."' to be writable. However file named '".APPROOT.$sDir."' already exists."); - } - else if (!is_dir($sFullPath) && !is_writable(APPROOT)) - { + } elseif (!is_dir($sFullPath) && !is_writable(APPROOT)) { $aNonWritableDirs[APPROOT.$sDir] = new CheckResult(CheckResult::ERROR, ITOP_APPLICATION." needs the directory '".APPROOT.$sDir."' to be writable. The directory '".APPROOT.$sDir."' does not exist and '".APPROOT."' is not writable, the application cannot create the directory '$sDir' inside it."); } } @@ -1914,8 +1869,7 @@ JS $sBaseDir = APPROOT.'datamodels'; $aDirs = glob($sBaseDir.'/*', GLOB_MARK | GLOB_ONLYDIR); - if ($aDirs !== false) - { + if ($aDirs !== false) { sort($aDirs); // Windows: there is a backslash at the end (though the path is made of slashes!!!) $sDir = basename(array_pop($aDirs)); @@ -1947,22 +1901,18 @@ JS */ public static function GetLicenses($sEnv = null) { - $aLicenses = array(); + $aLicenses = []; $aLicenceFiles = glob(APPROOT.'setup/licenses/*.xml'); if (empty($sEnv)) { $aLicenceFiles = array_merge($aLicenceFiles, glob(APPROOT.'datamodels/*/*/license.*.xml')); $aLicenceFiles = array_merge($aLicenceFiles, glob(APPROOT.'extensions/{*,*/*}/license.*.xml', GLOB_BRACE)); $aLicenceFiles = array_merge($aLicenceFiles, glob(APPROOT.'data/*-modules/{*,*/*}/license.*.xml', GLOB_BRACE)); - } - else - { + } else { $aLicenceFiles = array_merge($aLicenceFiles, glob(APPROOT.'env-'.$sEnv.'/*/license.*.xml')); } - foreach ($aLicenceFiles as $sFile) - { + foreach ($aLicenceFiles as $sFile) { $oXml = simplexml_load_file($sFile); - if (!empty($oXml->license)) - { + if (!empty($oXml->license)) { foreach ($oXml->license as $oLicense) { $aLicenses[(string)$oLicense->product] = $oLicense; } @@ -1998,8 +1948,7 @@ JS public static function ExitMaintenanceMode($bLog = true) { @unlink(MAINTENANCE_MODE_FILE); - if ($bLog) - { + if ($bLog) { SetupLog::Info("<---- Exiting maintenance mode"); } } @@ -2022,8 +1971,7 @@ JS public static function ExitReadOnlyMode($bLog = true) { @unlink(READONLY_MODE_FILE); - if ($bLog) - { + if ($bLog) { SetupLog::Info("<---- Exiting read only mode"); } } @@ -2039,8 +1987,7 @@ JS */ private static function WaitCronTermination($oConfig, $sMode) { - try - { + try { // Wait for cron to stop if (is_null($oConfig) || ContextTag::Check(ContextTag::TAG_CRON)) { return; @@ -2058,13 +2005,11 @@ JS $iStarted = time(); $iMaxDuration = $oConfig->Get('cron_max_execution_time'); $iTimeLimit = $iStarted + $iMaxDuration; - while ($oMutex->IsLocked()) - { + while ($oMutex->IsLocked()) { SetupLog::Info("Waiting for cron to stop ($iCount)"); $iCount++; sleep(1); - if (time() > $iTimeLimit) - { + if (time() > $iTimeLimit) { throw new Exception("Cannot enter $sMode mode, consider stopping the cron temporarily"); } } @@ -2147,7 +2092,8 @@ JS /** * @return string[] */ - public static function GetPHPMandatoryExtensions() { + public static function GetPHPMandatoryExtensions() + { return [ 'mysqli', 'iconv', @@ -2170,7 +2116,8 @@ JS /** * @return array */ - public static function GetPHPOptionalExtensions() { + public static function GetPHPOptionalExtensions() + { $aOptionalExtensions = [ 'mcrypt, sodium or openssl' => [ 'mcrypt' => 'Strong encryption will not be used.', @@ -2194,7 +2141,7 @@ JS */ class SetupInfo { - public static $aSelectedModules = array(); + public static $aSelectedModules = []; /** * Called by the setup process to initializes the list of selected modules. Do not call this method diff --git a/setup/unattended-install/InstallationFileService.php b/setup/unattended-install/InstallationFileService.php index e44a8d046..aa8224fbe 100644 --- a/setup/unattended-install/InstallationFileService.php +++ b/setup/unattended-install/InstallationFileService.php @@ -5,7 +5,8 @@ require_once(APPROOT.'/setup/setuppage.class.inc.php'); require_once(APPROOT.'/setup/wizardcontroller.class.inc.php'); require_once(APPROOT.'/setup/wizardsteps.class.inc.php'); -class InstallationFileService { +class InstallationFileService +{ /** @var \RunTimeEnvironment $oProductionEnv */ private $oProductionEnv; @@ -28,17 +29,19 @@ class InstallationFileService { * @param bool $bInstallationOptionalChoicesChecked : this option is used only when no extensions are selected (ie empty * $aSelectedExtensions) */ - public function __construct(string $sInstallationPath, string $sTargetEnvironment='production', array $aSelectedExtensions = [], bool $bInstallationOptionalChoicesChecked=true) { + public function __construct(string $sInstallationPath, string $sTargetEnvironment = 'production', array $aSelectedExtensions = [], bool $bInstallationOptionalChoicesChecked = true) + { $this->sInstallationPath = $sInstallationPath; $this->aSelectedModules = []; $this->aUnSelectedModules = []; $this->sTargetEnvironment = $sTargetEnvironment; $this->aSelectedExtensions = $aSelectedExtensions; - $this->aAfterComputationSelectedExtensions = (count($aSelectedExtensions)==0) ? [] : $aSelectedExtensions; + $this->aAfterComputationSelectedExtensions = (count($aSelectedExtensions) == 0) ? [] : $aSelectedExtensions; $this->bInstallationOptionalChoicesChecked = $bInstallationOptionalChoicesChecked; } - public function Init(): void { + public function Init(): void + { clearstatcache(); $this->ProcessDefaultModules(); @@ -47,45 +50,54 @@ class InstallationFileService { $this->ProcessAutoSelectModules(); } - public function GetProductionEnv(): RunTimeEnvironment { - if (is_null($this->oProductionEnv)){ + public function GetProductionEnv(): RunTimeEnvironment + { + if (is_null($this->oProductionEnv)) { $this->oProductionEnv = new RunTimeEnvironment(); } return $this->oProductionEnv; } - public function SetProductionEnv(RunTimeEnvironment $oProductionEnv): void { + public function SetProductionEnv(RunTimeEnvironment $oProductionEnv): void + { $this->oProductionEnv = $oProductionEnv; } - public function GetAfterComputationSelectedExtensions(): array { + public function GetAfterComputationSelectedExtensions(): array + { return $this->aAfterComputationSelectedExtensions; } - public function SetItopExtensionsMap(ItopExtensionsMap $oItopExtensionsMap): void { + public function SetItopExtensionsMap(ItopExtensionsMap $oItopExtensionsMap): void + { $this->oItopExtensionsMap = $oItopExtensionsMap; } - public function GetItopExtensionsMap(): ItopExtensionsMap { - if (is_null($this->oItopExtensionsMap)){ + public function GetItopExtensionsMap(): ItopExtensionsMap + { + if (is_null($this->oItopExtensionsMap)) { $this->oItopExtensionsMap = new iTopExtensionsMap($this->sTargetEnvironment, true); } return $this->oItopExtensionsMap; } - public function GetAutoSelectModules(): array { + public function GetAutoSelectModules(): array + { return $this->aAutoSelectModules; } - public function GetSelectedModules(): array { + public function GetSelectedModules(): array + { return $this->aSelectedModules; } - public function GetUnSelectedModules(): array { + public function GetUnSelectedModules(): array + { return $this->aUnSelectedModules; } - public function ProcessInstallationChoices(): void { + public function ProcessInstallationChoices(): void + { $oXMLParameters = new XMLParameters($this->sInstallationPath); $aSteps = $oXMLParameters->Get('steps', []); if (! is_array($aSteps)) { @@ -107,20 +119,21 @@ class InstallationFileService { } } - foreach ($this->aSelectedModules as $sModuleId => $sVal){ - if (array_key_exists($sModuleId, $this->aUnSelectedModules)){ + foreach ($this->aSelectedModules as $sModuleId => $sVal) { + if (array_key_exists($sModuleId, $this->aUnSelectedModules)) { unset($this->aUnSelectedModules[$sModuleId]); } } } - private function ProcessUnSelectedChoice($aChoiceInfo) { + private function ProcessUnSelectedChoice($aChoiceInfo) + { if (!is_array($aChoiceInfo)) { return; } $aCurrentModules = $aChoiceInfo["modules"] ?? []; - foreach ($aCurrentModules as $sModuleId){ + foreach ($aCurrentModules as $sModuleId) { $this->aUnSelectedModules[$sModuleId] = true; } @@ -151,7 +164,8 @@ class InstallationFileService { } } - private function ProcessSelectedChoice($aChoiceInfo, bool $bAllChecked) { + private function ProcessSelectedChoice($aChoiceInfo, bool $bAllChecked) + { if (!is_array($aChoiceInfo)) { return; } @@ -161,17 +175,17 @@ class InstallationFileService { $aCurrentModules = $aChoiceInfo["modules"] ?? []; $sExtensionCode = $aChoiceInfo["extension_code"] ?? null; - if (0 === count($this->aSelectedExtensions)){ + if (0 === count($this->aSelectedExtensions)) { $bSelected = $bAllChecked || $sDefault === "true" || $sMandatory === "true"; - if ($bSelected){ - $this->aAfterComputationSelectedExtensions[]= $sExtensionCode; + if ($bSelected) { + $this->aAfterComputationSelectedExtensions[] = $sExtensionCode; } } else { $bSelected = $sMandatory === "true" || (null !== $sExtensionCode && in_array($sExtensionCode, $this->aSelectedExtensions)); } - foreach ($aCurrentModules as $sModuleId){ + foreach ($aCurrentModules as $sModuleId) { if ($bSelected) { $this->aSelectedModules[$sModuleId] = true; } else { @@ -218,19 +232,19 @@ class InstallationFileService { } } - private function GetExtraDirs() : array { + private function GetExtraDirs(): array + { $aSearchDirs = []; $aDirs = [ '/datamodels/1.x', '/datamodels/2.x', - 'data/' . $this->sTargetEnvironment . '-modules', + 'data/'.$this->sTargetEnvironment.'-modules', 'extensions', ]; - foreach ($aDirs as $sRelativeDir){ + foreach ($aDirs as $sRelativeDir) { $sDirPath = APPROOT.$sRelativeDir; - if (is_dir($sDirPath)) - { + if (is_dir($sDirPath)) { $aSearchDirs[] = $sDirPath; } } @@ -238,8 +252,9 @@ class InstallationFileService { return $aSearchDirs; } - public function ProcessDefaultModules() : void { - $sProductionModuleDir = APPROOT.'data/' . $this->sTargetEnvironment . '-modules/'; + public function ProcessDefaultModules(): void + { + $sProductionModuleDir = APPROOT.'data/'.$this->sTargetEnvironment.'-modules/'; $aAvailableModules = $this->GetProductionEnv()->AnalyzeInstallation(MetaModel::GetConfig(), $this->GetExtraDirs(), false, null); @@ -255,8 +270,10 @@ class InstallationFileService { $this->aSelectedModules[$sModuleId] = true; continue; } - $bIsExtra = (array_key_exists('root_dir', $aModule) && (strpos($aModule['root_dir'], - $sProductionModuleDir) !== false)); // Some modules (root, datamodel) have no 'root_dir' + $bIsExtra = (array_key_exists('root_dir', $aModule) && (strpos( + $aModule['root_dir'], + $sProductionModuleDir + ) !== false)); // Some modules (root, datamodel) have no 'root_dir' if ($bIsExtra) { // Modules in data/production-modules/ are considered as mandatory and always installed $this->aSelectedModules[$sModuleId] = true; @@ -265,32 +282,31 @@ class InstallationFileService { } } - public function ProcessAutoSelectModules() : void { - foreach($this->GetAutoSelectModules() as $sModuleId => $aModule) - { + public function ProcessAutoSelectModules(): void + { + foreach ($this->GetAutoSelectModules() as $sModuleId => $aModule) { try { $bSelected = false; SetupInfo::SetSelectedModules($this->aSelectedModules); eval('$bSelected = ('.$aModule['auto_select'].');'); - if ($bSelected) - { + if ($bSelected) { // Modules in data/production-modules/ are considered as mandatory and always installed $this->aSelectedModules[$sModuleId] = true; } - } - catch (Exception $e) { + } catch (Exception $e) { } } } - public function CanChooseUnpackageExtension(iTopExtension $oExtension) : bool { - if ($oExtension->sSource === iTopExtension::SOURCE_REMOTE){ + public function CanChooseUnpackageExtension(iTopExtension $oExtension): bool + { + if ($oExtension->sSource === iTopExtension::SOURCE_REMOTE) { SetupLog::Info("Data Extension can be selected", null, ['extension' => $oExtension->sCode]); return true; } $bSelectable = $this->bInstallationOptionalChoicesChecked && ($oExtension->sSource === iTopExtension::SOURCE_MANUAL); - if ($bSelectable){ + if ($bSelectable) { SetupLog::Info("Manual Extension can be selected", null, ['extension' => $oExtension->sCode]); } else { SetupLog::Debug("Manual Extension can NOT be selected", null, ['extension' => $oExtension->sCode]); @@ -299,18 +315,22 @@ class InstallationFileService { return $bSelectable; } - public function ProcessExtensionModulesNotSpecifiedInChoices() { + public function ProcessExtensionModulesNotSpecifiedInChoices() + { /** @var \iTopExtension $oExtension */ - foreach($this->GetItopExtensionsMap()->GetAllExtensions() as $oExtension) { - if (in_array($oExtension->sCode, $this->aAfterComputationSelectedExtensions)){ + foreach ($this->GetItopExtensionsMap()->GetAllExtensions() as $oExtension) { + if (in_array($oExtension->sCode, $this->aAfterComputationSelectedExtensions)) { //extension already processed in installation.xml - SetupLog::Info("Extension already processed via installation choices", null, + SetupLog::Info( + "Extension already processed via installation choices", + null, [ 'extension' => $oExtension->sCode, - ]) ; + ] + ) ; continue; } - if ($this->CanChooseUnpackageExtension($oExtension)){ + if ($this->CanChooseUnpackageExtension($oExtension)) { if (($oExtension->bVisible) && (count($oExtension->aMissingDependencies) === 0)) { $aCurrentModules = []; $aUnselectableModules = []; @@ -332,23 +352,28 @@ class InstallationFileService { } if ($bIsExtensionSelectable) { - SetupLog::Debug("Add modules from unpackaged extension", null, + SetupLog::Debug( + "Add modules from unpackaged extension", + null, [ 'extension' => $oExtension->sCode, 'source' => $oExtension->sSource, 'modules to add' => array_keys($aCurrentModules), - ]); + ] + ); $this->aSelectedModules = array_merge($this->aSelectedModules, $aCurrentModules); $this->aAfterComputationSelectedExtensions[] = $oExtension->sCode; } else { - SetupLog::Warning("Unpackaged extension can not be selected due to modules incompatible with installation choices", + SetupLog::Warning( + "Unpackaged extension can not be selected due to modules incompatible with installation choices", null, [ 'extension' => $oExtension->sCode, 'source' => $oExtension->sSource, 'modules' => array_keys($aCurrentModules), 'unselectable modules' => $aUnselectableModules, - ]); + ] + ); } } } diff --git a/setup/unattended-install/unattended-install.php b/setup/unattended-install/unattended-install.php index 4151318ad..34cf4901b 100644 --- a/setup/unattended-install/unattended-install.php +++ b/setup/unattended-install/unattended-install.php @@ -1,11 +1,11 @@ [--installation_xml=] [--use_itop_config] Options: @@ -22,27 +22,26 @@ Advanced options: --clean=1 In case of a first installation, cleanup the environment before proceeding: delete the configuration file, the cache directory, the target directory, the database (default: 0) --install=0 Set to 0 to perform a dry-run (default: 1) EOF; - exit(-1); + exit(-1); } ///////////////////////////////////////////////// $oCtx = new ContextTag(ContextTag::TAG_SETUP); $sCleanName = strtolower(trim(PHP_SAPI)); -if ($sCleanName !== 'cli') -{ +if ($sCleanName !== 'cli') { echo "Mode CLI only"; exit(-1); } if (in_array('--help', $argv)) { - PrintUsageAndExit(); + PrintUsageAndExit(); } $sParamFile = utils::ReadParam('param-file', null, true /* CLI allowed */, 'raw_data') ?? utils::ReadParam('response_file', null, true /* CLI allowed */, 'raw_data'); if (is_null($sParamFile)) { echo "Missing mandatory argument `--param-file`.\n"; - PrintUsageAndExit(); + PrintUsageAndExit(); } $bCheckConsistency = (utils::ReadParam('check-consistency', '0', true /* CLI allowed */) == '1'); @@ -56,8 +55,7 @@ $oParams = new XMLParameters($sParamFile); $sMode = $oParams->Get('mode'); $sTargetEnvironment = $oParams->Get('target_env', ''); -if ($sTargetEnvironment == '') -{ +if ($sTargetEnvironment == '') { $sTargetEnvironment = 'production'; } @@ -106,12 +104,12 @@ SetupLog::Info($sMsg, null, $aSelectedModules); // Configuration file $sConfigFile = APPCONF.$sTargetEnvironment.'/'.ITOP_CONFIG_FILE; $bUseItopConfig = in_array('--use_itop_config', $argv); -if ($bUseItopConfig && file_exists($sConfigFile)){ +if ($bUseItopConfig && file_exists($sConfigFile)) { //unattended run based on db settings coming from itop configuration copy($sConfigFile, "$sConfigFile.backup"); $oConfig = new Config($sConfigFile); - $aDBXmlSettings = $oParams->Get('database', array()); + $aDBXmlSettings = $oParams->Get('database', []); $aDBXmlSettings ['server'] = $oConfig->Get('db_host'); $aDBXmlSettings ['user'] = $oConfig->Get('db_user'); $aDBXmlSettings ['pwd'] = $oConfig->Get('db_pwd'); @@ -127,7 +125,7 @@ if ($bUseItopConfig && file_exists($sConfigFile)){ 'source_dir' => 'source_dir', 'graphviz_path' => 'graphviz_path', ]; - foreach($aFields as $sSetupField => $sConfField){ + foreach ($aFields as $sSetupField => $sConfField) { $oParams->Set($sSetupField, $oConfig->Get($sConfField)); } @@ -135,7 +133,7 @@ if ($bUseItopConfig && file_exists($sConfigFile)){ $oParams->Set('language', $oConfig->GetDefaultLanguage()); } else { //unattended run based on db settings coming from response_file (XML file) - $aDBXmlSettings = $oParams->Get('database', array()); + $aDBXmlSettings = $oParams->Get('database', []); } $sDBServer = $aDBXmlSettings['server']; @@ -146,36 +144,29 @@ $sDBPrefix = $aDBXmlSettings['prefix']; $bDBTlsEnabled = $aDBXmlSettings['db_tls_enabled']; $sDBTlsCa = $aDBXmlSettings['db_tls_ca']; -if ($sMode == 'install') -{ +if ($sMode == 'install') { echo "Installation mode detected.\n"; $bClean = utils::ReadParam('clean', false, true /* CLI allowed */); - if ($bClean) - { + if ($bClean) { echo "Cleanup mode detected.\n"; - if (file_exists($sConfigFile)) - { + if (file_exists($sConfigFile)) { echo "Trying to delete the configuration file: '$sConfigFile'.\n"; @chmod($sConfigFile, 0770); // RWX for owner and group, nothing for others unlink($sConfigFile); - } - else - { + } else { echo "No config file to delete ($sConfigFile does not exist).\n"; } // Starting with iTop 2.7.0, a failed setup leaves some lock files, let's remove them - $aLockFiles = array( + $aLockFiles = [ 'data/.readonly' => 'read-only lock file', 'data/.maintenance' => 'maintenance mode lock file', - ); - foreach($aLockFiles as $sFile => $sDescription) - { - $sLockFile = APPROOT.$sFile; - if (file_exists($sLockFile)) - { + ]; + foreach ($aLockFiles as $sFile => $sDescription) { + $sLockFile = APPROOT.$sFile; + if (file_exists($sLockFile)) { echo "Trying to delete the $sDescription: '$sLockFile'.\n"; unlink($sLockFile); } @@ -184,69 +175,49 @@ if ($sMode == 'install') // Starting with iTop 2.6.0, let's remove the cache directory as well // Can cause some strange issues in the setup (apparently due to the Dict class being automatically loaded ??) $sCacheDir = APPROOT.'data/cache-'.$sTargetEnvironment; - if (file_exists($sCacheDir)) - { - if (is_dir($sCacheDir)) - { - echo "Emptying the cache directory '$sCacheDir'.\n"; - SetupUtils::tidydir($sCacheDir); - } - else - { + if (file_exists($sCacheDir)) { + if (is_dir($sCacheDir)) { + echo "Emptying the cache directory '$sCacheDir'.\n"; + SetupUtils::tidydir($sCacheDir); + } else { die("ERROR the cache directory '$sCacheDir' exists, but is NOT a directory !!!\nExiting.\n"); } } // env-xxx directory $sTargetDir = APPROOT.'env-'.$sTargetEnvironment; - if (file_exists($sTargetDir)) - { - if (is_dir($sTargetDir)) - { - echo "Emptying the target directory '$sTargetDir'.\n"; - SetupUtils::tidydir($sTargetDir); - } - else - { + if (file_exists($sTargetDir)) { + if (is_dir($sTargetDir)) { + echo "Emptying the target directory '$sTargetDir'.\n"; + SetupUtils::tidydir($sTargetDir); + } else { die("ERROR the target dir '$sTargetDir' exists, but is NOT a directory !!!\nExiting.\n"); } - } - else - { + } else { echo "No target directory to delete ($sTargetDir does not exist).\n"; } - if ($sDBPrefix != '') - { + if ($sDBPrefix != '') { die("Cleanup not implemented for a partial database (prefix= '$sDBPrefix')\nExiting."); } - try - { + try { $oMysqli = CMDBSource::GetMysqliInstance($sDBServer, $sDBUser, $sDBPwd, null, $bDBTlsEnabled, $sDBTlsCa, true); - if ($oMysqli->select_db($sDBName)) - { + if ($oMysqli->select_db($sDBName)) { echo "Deleting database '$sDBName'\n"; $oMysqli->query("DROP DATABASE `$sDBName`"); - } - else - { + } else { echo "The database '$sDBName' does not seem to exist. Nothing to cleanup.\n"; } - } - catch (MySQLException $e) - { - die($e->getMessage()."\nExiting"); + } catch (MySQLException $e) { + die($e->getMessage()."\nExiting"); } } -} -else -{ +} else { //use settings from itop conf $sTargetEnvironment = $oParams->Get('target_env', ''); - if ($sTargetEnvironment == '') - { + if ($sTargetEnvironment == '') { $sTargetEnvironment = 'production'; } $sTargetDir = APPROOT.'env-'.$sTargetEnvironment; @@ -260,10 +231,8 @@ $sSourceDir = $oParams->Get('source_dir', 'datamodels/latest'); $sExtensionDir = $oParams->Get('extensions_dir', 'extensions'); $aChecks = array_merge($aChecks, SetupUtils::CheckSelectedModules($sSourceDir, $sExtensionDir, $aSelectedModules)); -foreach($aChecks as $oCheckResult) -{ - switch ($oCheckResult->iSeverity) - { +foreach ($aChecks as $oCheckResult) { + switch ($oCheckResult->iSeverity) { case CheckResult::ERROR: $bHasErrors = true; $sHeader = "Error"; @@ -284,15 +253,13 @@ foreach($aChecks as $oCheckResult) break; } echo $sHeader.": ".$oCheckResult->sLabel; - if (strlen($oCheckResult->sDescription)) - { + if (strlen($oCheckResult->sDescription)) { echo ' - '.$oCheckResult->sDescription; } echo "\n"; } -if ($bHasErrors) -{ +if ($bHasErrors) { echo "Encountered stopper issues. Aborting...\n"; $sLogMsg = "Encountered stopper issues. Aborting..."; echo "$sLogMsg\n"; @@ -303,103 +270,76 @@ if ($bHasErrors) $bFoundIssues = false; $bInstall = utils::ReadParam('install', true, true /* CLI allowed */); -if ($bInstall) -{ +if ($bInstall) { echo "Starting the unattended installation...\n"; $oWizard = new ApplicationInstaller($oParams); $bRes = $oWizard->ExecuteAllSteps(); - if (!$bRes) - { + if (!$bRes) { echo "\nencountered installation issues!"; $bFoundIssues = true; - } - else - { - try - { + } else { + try { $oMysqli = CMDBSource::GetMysqliInstance($sDBServer, $sDBUser, $sDBPwd, null, $bDBTlsEnabled, $sDBTlsCa, true); - if ($oMysqli->select_db($sDBName)) - { + if ($oMysqli->select_db($sDBName)) { // Check the presence of a table to record information about the MTP (from the Designer) $sDesignerUpdatesTable = $sDBPrefix.'priv_designer_update'; $sSQL = "SELECT id FROM `$sDesignerUpdatesTable`"; - if ($oMysqli->query($sSQL) !== false) - { + if ($oMysqli->query($sSQL) !== false) { // Record the Designer Udpates in the priv_designer_update table $sDeltaFile = APPROOT.'data/'.$sTargetEnvironment.'.delta.xml'; - if (is_readable($sDeltaFile)) - { + if (is_readable($sDeltaFile)) { // Retrieve the revision $oDoc = new DOMDocument(); $oDoc->load($sDeltaFile); $iRevision = 0; $iRevision = $oDoc->firstChild->getAttribute('revision_id'); - if ($iRevision > 0) // Safety net, just in case... - { + if ($iRevision > 0) { // Safety net, just in case... $sDate = date('Y-m-d H:i:s'); $sSQL = "INSERT INTO `$sDesignerUpdatesTable` (revision_id, compilation_date, comment) VALUES ($iRevision, '$sDate', 'Deployed using unattended.php.')"; - if ($oMysqli->query($sSQL) !== false) - { + if ($oMysqli->query($sSQL) !== false) { echo "\nDesigner update (MTP at revision $iRevision) successfully recorded.\n"; - } - else - { + } else { echo "\nFailed to record designer updates(".$oMysqli->error.").\n"; } - } - else - { + } else { echo "\nFailed to read the revision from $sDeltaFile file. No designer update information will be recorded.\n"; } - } - else - { + } else { echo "\nNo $sDeltaFile file (or the file is not accessible). No designer update information to record.\n"; } } } - } - catch (MySQLException $e) - { - // Continue anyway + } catch (MySQLException $e) { + // Continue anyway } } -} -else -{ +} else { echo "No installation requested.\n"; } -if (!$bFoundIssues && $bCheckConsistency) -{ +if (!$bFoundIssues && $bCheckConsistency) { echo "Checking data model consistency.\n"; ob_start(); $sCheckRes = ''; - try - { + try { MetaModel::CheckDefinitions(false); $sCheckRes = ob_get_clean(); - } - catch(Exception $e) - { + } catch (Exception $e) { $sCheckRes = ob_get_clean()."\nException: ".$e->getMessage(); } - if (strlen($sCheckRes) > 0) - { + if (strlen($sCheckRes) > 0) { echo $sCheckRes; echo "\nfound consistency issues!"; $bFoundIssues = true; } } -if (! $bFoundIssues) -{ +if (! $bFoundIssues) { // last line: used to check the install // the only way to track issues in case of Fatal error or even parsing error! $sLogMsg = "installed!"; - if ($bUseItopConfig && is_file("$sConfigFile.backup")) - { + if ($bUseItopConfig && is_file("$sConfigFile.backup")) { echo "\nuse config file provided by backup in $sConfigFile."; copy("$sConfigFile.backup", $sConfigFile); } diff --git a/setup/wizard.php b/setup/wizard.php index 39891f2b7..5d52ec952 100644 --- a/setup/wizard.php +++ b/setup/wizard.php @@ -1,4 +1,5 @@ sInitialStepClass = $sInitialStepClass; $this->sInitialState = $sInitialState; - $this->aParameters = array(); - $this->aSteps = array(); + $this->aParameters = []; + $this->aSteps = []; } - + /** * Pushes information about the current step onto the stack * @param hash $aStepInfo Array('class' => , 'state' => ) @@ -59,7 +60,7 @@ class WizardController { array_push($this->aSteps, $aStepInfo); } - + /** * Removes information about the previous step from the stack * @return hash Array('class' => , 'state' => ) @@ -68,7 +69,7 @@ class WizardController { return array_pop($this->aSteps); } - + /** * Reads a "persistent" parameter from the wizard's context * @param string $sParamCode The code identifying this parameter @@ -91,7 +92,7 @@ class WizardController public function GetParamForConfigArray(): array { /** @noinspection PhpUnnecessaryLocalVariableInspection */ - $aParamValues = array( + $aParamValues = [ 'db_server' => $this->GetParameter('db_server', ''), 'db_user' => $this->GetParameter('db_user', ''), 'db_pwd' => $this->GetParameter('db_pwd', ''), @@ -99,7 +100,7 @@ class WizardController 'db_prefix' => $this->GetParameter('db_prefix', ''), 'db_tls_enabled' => $this->GetParameter('db_tls_enabled', false), 'db_tls_ca' => $this->GetParameter('db_tls_ca', ''), - ); + ]; return $aParamValues; } @@ -114,7 +115,7 @@ class WizardController { $this->aParameters[$sParamCode] = $value; } - + /** * Stores the value of the page's parameter in a "persistent" parameter in the wizard's context * @param string $sParamCode The code identifying this parameter @@ -126,7 +127,7 @@ class WizardController $value = utils::ReadParam($sParamCode, $defaultValue, false, $sSanitizationFilter); $this->aParameters[$sParamCode] = $value; } - + /** * Starts the wizard by displaying it in its initial state */ @@ -146,23 +147,17 @@ class WizardController $sCurrentState = utils::ReadParam('_state', $this->sInitialState); /** @var \WizardStep $oStep */ $oStep = new $sCurrentStepClass($this, $sCurrentState); - if ($oStep->ValidateParams()) - { - $this->PushStep(array('class' => $sCurrentStepClass, 'state' => $sCurrentState)); + if ($oStep->ValidateParams()) { + $this->PushStep(['class' => $sCurrentStepClass, 'state' => $sCurrentState]); $aPossibleSteps = $oStep->GetPossibleSteps(); $aNextStepInfo = $oStep->ProcessParams(true); // true => moving forward - if (in_array($aNextStepInfo['class'], $aPossibleSteps)) - { + if (in_array($aNextStepInfo['class'], $aPossibleSteps)) { $oNextStep = new $aNextStepInfo['class']($this, $aNextStepInfo['state']); $this->DisplayStep($oNextStep); - } - else - { + } else { throw new Exception("Internal error: Unexpected next step '{$aNextStepInfo['class']}'. The possible next steps are: ".implode(', ', $aPossibleSteps)); } - } - else - { + } else { $this->DisplayStep($oStep); } } @@ -176,13 +171,13 @@ class WizardController $sCurrentState = utils::ReadParam('_state', $this->sInitialState); $oStep = new $sCurrentStepClass($this, $sCurrentState); $aNextStepInfo = $oStep->ProcessParams(false); // false => Moving backwards - + // Display the previous step $aCurrentStepInfo = $this->PopStep(); $oStep = new $aCurrentStepInfo['class']($this, $aCurrentStepInfo['state']); $this->DisplayStep($oStep); } - + /** * Displays the specified 'step' of the wizard * @param WizardStep $oStep The 'step' to display @@ -190,14 +185,11 @@ class WizardController protected function DisplayStep(WizardStep $oStep) { $oPage = new SetupPage($oStep->GetTitle()); - if ($oStep->RequiresWritableConfig()) - { + if ($oStep->RequiresWritableConfig()) { $sConfigFile = utils::GetConfigFilePath(); - if (file_exists($sConfigFile)) - { + if (file_exists($sConfigFile)) { // The configuration file already exists - if (!is_writable($sConfigFile)) - { + if (!is_writable($sConfigFile)) { SetupUtils::ExitReadOnlyMode(false); // Reset readonly mode in case of problem SetupUtils::EraseSetupToken(); $sRelativePath = utils::GetConfigFilePathRelative(); @@ -215,7 +207,7 @@ HTML; // Prevent token creation exit; } - } + } } $oPage->LinkScriptFromAppRoot('setup/setup.js'); $oPage->add_script("function CanMoveForward()\n{\n".$oStep->JSCanMoveForward()."\n}\n"); @@ -247,7 +239,7 @@ HTML; // Hack to have the "Next >>" button, be the default button, since the first submit button in the form is the default one $oPage->add_ready_script( -<<aParameters = utils::ReadParam('_params', array(), false, 'raw_data'); + $this->aParameters = utils::ReadParam('_params', [], false, 'raw_data'); $this->aSteps = json_decode(utils::ReadParam('_steps', '[]', false, 'raw_data'), true /* bAssoc */); - - switch($sOperation) - { + + switch ($sOperation) { case 'next': - $this->Next(); - break; - + $this->Next(); + break; + case 'back': - $this->Back(); - break; - + $this->Back(); + break; + default: - $this->Start(); + $this->Start(); } } - + /** * Provides information about the structure/workflow of the wizard by listing * the possible list of 'steps' and their dependencies @@ -318,22 +309,24 @@ on the page's parameters */ public function DumpStructure($sStep = '', $aAllSteps = null) { - if ($aAllSteps == null) $aAllSteps = array(); - if ($sStep == '') $sStep = $this->sInitialStepClass; - + if ($aAllSteps == null) { + $aAllSteps = []; + } + if ($sStep == '') { + $sStep = $this->sInitialStepClass; + } + $oStep = new $sStep($this, ''); $aAllSteps[$sStep] = $oStep->GetPossibleSteps(); - foreach($aAllSteps[$sStep] as $sNextStep) - { - if (!array_key_exists($sNextStep, $aAllSteps)) - { - $aAllSteps = $this->DumpStructure($sNextStep , $aAllSteps); + foreach ($aAllSteps[$sStep] as $sNextStep) { + if (!array_key_exists($sNextStep, $aAllSteps)) { + $aAllSteps = $this->DumpStructure($sNextStep, $aAllSteps); } } - + return $aAllSteps; } - + /** * Dump the wizard's structure as a string suitable to produce a chart * using graphviz's "dot" program @@ -345,25 +338,20 @@ on the page's parameters $sOutput = "digraph finite_state_machine {\n"; //$sOutput .= "\trankdir=LR;"; $sOutput .= "\tsize=\"10,12\"\n"; - - $aDeadEnds = array($this->sInitialStepClass); - foreach($aAllSteps as $sStep => $aNextSteps) - { - if (count($aNextSteps) == 0) - { + + $aDeadEnds = [$this->sInitialStepClass]; + foreach ($aAllSteps as $sStep => $aNextSteps) { + if (count($aNextSteps) == 0) { $aDeadEnds[] = $sStep; } } $sOutput .= "\tnode [shape = doublecircle]; ".implode(' ', $aDeadEnds).";\n"; $sOutput .= "\tnode [shape = box];\n"; - foreach($aAllSteps as $sStep => $aNextSteps) - { + foreach ($aAllSteps as $sStep => $aNextSteps) { $oStep = new $sStep($this, ''); $sOutput .= "\t$sStep [ label = \"".$oStep->GetTitle()."\"];\n"; - if (count($aNextSteps) > 0) - { - foreach($aNextSteps as $sNextStep) - { + if (count($aNextSteps) > 0) { + foreach ($aNextSteps as $sNextStep) { $sOutput .= "\t$sStep -> $sNextStep;\n"; } } @@ -394,18 +382,18 @@ abstract class WizardStep * @var string */ protected $sCurrentState; - + public function __construct(WizardController $oWizard, $sCurrentState) { $this->oWizard = $oWizard; $this->sCurrentState = $sCurrentState; } - + public function GetState() { return $this->sCurrentState; } - + /** * Displays the wizard page for the current class/state * The page can contain any number of "" fields, but no "..." tag @@ -445,7 +433,7 @@ abstract class WizardStep * @return string The title of the wizard page for the current step */ abstract public function GetTitle(); - + /** * Tells whether the parameters are Ok to move forward * @return boolean True to move forward, false to stey on the same step @@ -454,7 +442,7 @@ abstract class WizardStep { return true; } - + /** * Tells whether this step/state is the last one of the wizard (dead-end) * @return boolean True if the 'Next >>' button should be displayed @@ -463,7 +451,7 @@ abstract class WizardStep { return true; } - + /** * Tells whether the "Next" button should be enabled interactively * @return string A piece of javascript code returning either true or false @@ -472,7 +460,7 @@ abstract class WizardStep { return 'return true;'; } - + /** * Returns the label for the " Next >> " button * @return string The label for the button @@ -481,7 +469,7 @@ abstract class WizardStep { return 'Next'; } - + /** * Tells whether this step/state allows to go back or not * @return boolean True if the '<< Back' button should be displayed @@ -490,7 +478,7 @@ abstract class WizardStep { return true; } - + /** * Tells whether the "Back" button should be enabled interactively * @return string A piece of javascript code returning either true or false @@ -523,9 +511,9 @@ abstract class WizardStep * Example of a simple Setup Wizard with some parameters to store * the installation mode (install | upgrade) and a simple asynchronous * (AJAX) action. - * + * * The setup wizard is executed by the following code: - * + * * $oWizard = new WizardController('Step1'); * $oWizard->Run(); * @@ -535,12 +523,12 @@ class Step1 extends WizardStep { return 'Welcome'; } - + public function GetPossibleSteps() { return array('Step2', 'Step2bis'); } - + public function ProcessParams($bMoveForward = true) { $sNextStep = ''; @@ -554,11 +542,11 @@ class Step1 extends WizardStep { $this->oWizard->SetParameter('install_mode', 'upgrade'); $sNextStep = 'Step2bis'; - + } return array('class' => $sNextStep, 'state' => ''); } - + public function Display(WebPage $oPage) { $oPage->p('This is Step 1!'); @@ -576,17 +564,17 @@ class Step2 extends WizardStep { return 'Installation Parameters'; } - + public function GetPossibleSteps() { return array('Step3'); } - + public function ProcessParams($bMoveForward = true) { return array('class' => 'Step3', 'state' => ''); } - + public function Display(WebPage $oPage) { $oPage->p('This is Step 2! (Installation)'); @@ -599,12 +587,12 @@ class Step2bis extends WizardStep { return 'Upgrade Parameters'; } - + public function GetPossibleSteps() { return array('Step2ter'); } - + public function ProcessParams($bMoveForward = true) { $sUpgradeInfo = utils::ReadParam('upgrade_info'); @@ -613,7 +601,7 @@ class Step2bis extends WizardStep $this->oWizard->SetParameter('additional_upgrade_info', $sAdditionalUpgradeInfo); return array('class' => 'Step2ter', 'state' => ''); } - + public function Display(WebPage $oPage) { $oPage->p('This is Step 2bis! (Upgrade)'); @@ -621,18 +609,18 @@ class Step2bis extends WizardStep $oPage->p('Type your name here: '); $sAdditionalUpgradeInfo = $this->oWizard->GetParameter('additional_upgrade_info', ''); $oPage->p('The installer replies: '); - + $oPage->add_ready_script("$('#upgrade_info').change(function() { $('#v_upgrade_info').html(''); WizardAsyncAction('', { upgrade_info: $('#upgrade_info').val() }); });"); } - + public function AsyncAction(WebPage $oPage, $sCode, $aParameters) { usleep(300000); // 300 ms $sName = $aParameters['upgrade_info']; $sReply = addslashes("Hello ".$sName); - + $oPage->add_ready_script( << 'Step3', 'state' => ''); } - + public function Display(WebPage $oPage) { $oPage->p('This is Step 2ter! (Upgrade)'); @@ -671,22 +659,22 @@ class Step3 extends WizardStep { return 'Installation Complete'; } - + public function GetPossibleSteps() { return array(); } - + public function ProcessParams($bMoveForward = true) { return array('class' => '', 'state' => ''); } - + public function Display(WebPage $oPage) { $oPage->p('This is the FINAL Step'); } - + public function CanMoveForward() { return false; diff --git a/setup/wizardsteps.class.inc.php b/setup/wizardsteps.class.inc.php index f4be0d0cc..80adeac11 100644 --- a/setup/wizardsteps.class.inc.php +++ b/setup/wizardsteps.class.inc.php @@ -1,4 +1,5 @@ oWizard->SetParameter('authent', $sUID); - return array('class' => 'WizStepInstallOrUpgrade', 'state' => ''); + return ['class' => 'WizStepInstallOrUpgrade', 'state' => '']; } public function Display(WebPage $oPage) { // Store the misc_options for the future... - $aMiscOptions = utils::ReadParam('option', array(), false, 'raw_data'); + $aMiscOptions = utils::ReadParam('option', [], false, 'raw_data'); $sMiscOptions = $this->oWizard->GetParameter('misc_options', json_encode($aMiscOptions)); $this->oWizard->SetParameter('misc_options', $sMiscOptions); $oPage->add(""); $oPage->add_ready_script( -<< 0) { alert("Internet Explorer version 10 or older is NOT supported! (Check that IE is not running in compatibility mode)"); @@ -100,13 +101,11 @@ EOF $oPage->add('

      '.ITOP_APPLICATION.' Installation Wizard

      '); $aResults = SetupUtils::CheckPhpAndExtensions(); $this->bCanMoveForward = true; - $aInfo = array(); - $aWarnings = array(); - $aErrors = array(); - foreach($aResults as $oCheckResult) - { - switch($oCheckResult->iSeverity) - { + $aInfo = []; + $aWarnings = []; + $aErrors = []; + foreach ($aResults as $oCheckResult) { + switch ($oCheckResult->iSeverity) { case CheckResult::ERROR: $aErrors[] = $oCheckResult->sLabel; $this->bCanMoveForward = false; @@ -127,43 +126,34 @@ EOF } $sStyle = 'style="display:none;overflow:auto;"'; $sToggleButtons = ''; - if (count($aErrors)> 0) - { + if (count($aErrors) > 0) { $sStyle = 'overflow:auto;"'; $sTitle = count($aErrors).' Error(s), '.count($aWarnings).' Warning(s).'; $sH2Class = 'text-error'; - } - else if (count($aWarnings)> 0) - { + } elseif (count($aWarnings) > 0) { $sTitle = count($aWarnings).' Warning(s) '.$sToggleButtons; $sH2Class = 'text-warning'; - } - else - { + } else { $sTitle = 'Ok. '.$sToggleButtons; $sH2Class = 'text-valid'; } $oPage->add( -<<Prerequisites validation: $sTitle
      HTML ); - foreach($aErrors as $sText) - { + foreach ($aErrors as $sText) { $oPage->error($sText); } - foreach($aWarnings as $sText) - { + foreach ($aWarnings as $sText) { $oPage->warning($sText); } - foreach($aInfo as $sText) - { + foreach ($aInfo as $sText) { $oPage->ok($sText); } $oPage->add('
      '); - if (!$this->bCanMoveForward) - { + if (!$this->bCanMoveForward) { $oPage->p('Sorry, the installation cannot continue. Please fix the errors and reload this page to launch the installation again.'); $oPage->p(''); } @@ -188,7 +178,7 @@ class WizStepInstallOrUpgrade extends WizardStep public function GetPossibleSteps() { - return array('WizStepDetectedInfo', 'WizStepLicense'); + return ['WizStepDetectedInfo', 'WizStepLicense']; } public function ProcessParams($bMoveForward = true) @@ -207,21 +197,18 @@ class WizStepInstallOrUpgrade extends WizardStep $this->oWizard->SaveParameter('db_tls_enabled', false); $this->oWizard->SaveParameter('db_tls_ca', ''); - if ($sInstallMode == 'install') - { + if ($sInstallMode == 'install') { $this->oWizard->SetParameter('install_mode', 'install'); $sFullSourceDir = SetupUtils::GetLatestDataModelDir(); $this->oWizard->SetParameter('source_dir', $sFullSourceDir); $this->oWizard->SetParameter('datamodel_version', SetupUtils::GetDataModelVersion($sFullSourceDir)); $sNextStep = 'WizStepLicense'; - } - else - { + } else { $this->oWizard->SetParameter('install_mode', 'upgrade'); $sNextStep = 'WizStepDetectedInfo'; } - return array('class' => $sNextStep, 'state' => ''); + return ['class' => $sNextStep, 'state' => '']; } public function Display(WebPage $oPage) @@ -238,8 +225,7 @@ class WizStepInstallOrUpgrade extends WizardStep $sTlsCA = $this->oWizard->GetParameter('db_tls_ca', ''); $sMySQLBinDir = $this->oWizard->GetParameter('mysql_bindir', null); $sPreviousVersionDir = ''; - if ($sInstallMode == '') - { + if ($sInstallMode == '') { $sDBBackupPath = APPROOT.'data/backups/manual/setup-'.date('Y-m-d_H_i'); $bDBBackup = true; $aPreviousInstance = SetupUtils::GetPreviousInstance(APPROOT); @@ -256,36 +242,44 @@ class WizStepInstallOrUpgrade extends WizardStep $sMySQLBinDir = $aPreviousInstance['mysql_bindir']; $this->oWizard->SaveParameter('mysql_bindir', $aPreviousInstance['mysql_bindir']); $sPreviousVersionDir = APPROOT; - } - else - { + } else { $sInstallMode = 'install'; } } $sPreviousVersionDir = $this->oWizard->GetParameter('previous_version_dir', $sPreviousVersionDir); $sUpgradeInfoStyle = ''; - if ($sInstallMode == 'install') - { + if ($sInstallMode == 'install') { $sUpgradeInfoStyle = ' style="display: none;" '; } $oPage->add('
      What do you want to do?
      '); $sChecked = ($sInstallMode == 'install') ? ' checked ' : ''; - $oPage->p(''); + $oPage->p(''); $sChecked = ($sInstallMode == 'upgrade') ? ' checked ' : ''; $sDisabled = (($sInstallMode == 'install') && (empty($sPreviousVersionDir))) ? ' disabled' : ''; - $oPage->p(''); + $oPage->p(''); - $sUpgradeDir = utils::HtmlEntities($sPreviousVersionDir); - $oPage->add(<<add( + <<
      Location on the disk:
      HTML ); - SetupUtils::DisplayDBParameters($oPage, false, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, - $sTlsEnabled, $sTlsCA, null); + SetupUtils::DisplayDBParameters( + $oPage, + false, + $sDBServer, + $sDBUser, + $sDBPwd, + $sDBName, + $sDBPrefix, + $sTlsEnabled, + $sTlsCA, + null + ); $aBackupChecks = SetupUtils::CheckBackupPrerequisites($sDBBackupPath, $sMySQLBinDir); $bCanBackup = true; @@ -319,7 +313,7 @@ HTML $oPage->add(''); //$oPage->add(''); $oPage->add_ready_script( -<<oWizard->SetParameter('upgrade_type', $sUpgradeType); $bDisplayLicense = $this->oWizard->GetParameter('display_license'); - switch ($sUpgradeType) - { + switch ($sUpgradeType) { case 'keep-previous': - $sSourceDir = utils::ReadParam('relative_source_dir', '', false, 'raw_data'); - $this->oWizard->SetParameter('source_dir', $this->oWizard->GetParameter('previous_version_dir').'/'.$sSourceDir); - $this->oWizard->SetParameter('datamodel_version', utils::ReadParam('datamodel_previous_version', '', false, 'raw_data')); - break; + $sSourceDir = utils::ReadParam('relative_source_dir', '', false, 'raw_data'); + $this->oWizard->SetParameter('source_dir', $this->oWizard->GetParameter('previous_version_dir').'/'.$sSourceDir); + $this->oWizard->SetParameter('datamodel_version', utils::ReadParam('datamodel_previous_version', '', false, 'raw_data')); + break; case 'use-compatible': - $sDataModelPath = utils::ReadParam('datamodel_path', '', false, 'raw_data'); - $this->oWizard->SetParameter('source_dir', $sDataModelPath); - $this->oWizard->SaveParameter('datamodel_version', ''); - break; + $sDataModelPath = utils::ReadParam('datamodel_path', '', false, 'raw_data'); + $this->oWizard->SetParameter('source_dir', $sDataModelPath); + $this->oWizard->SaveParameter('datamodel_version', ''); + break; default: - // Do nothing, maybe the user pressed the Back button + // Do nothing, maybe the user pressed the Back button } - if ($bDisplayLicense) - { - $aRet = array('class' => 'WizStepLicense2', 'state' => ''); - } - else - { - $aRet = array('class' => 'WizStepUpgradeMiscParams', 'state' => ''); + if ($bDisplayLicense) { + $aRet = ['class' => 'WizStepLicense2', 'state' => '']; + } else { + $aRet = ['class' => 'WizStepUpgradeMiscParams', 'state' => '']; } return $aRet; } @@ -469,7 +458,7 @@ class WizStepDetectedInfo extends WizardStep public function Display(WebPage $oPage) { $oPage->add_style( -<<oWizard->GetParameter('previous_version_dir', ''); $aInstalledInfo = SetupUtils::GetApplicationVersion($this->oWizard); - if ($aInstalledInfo === false) - { + if ($aInstalledInfo === false) { throw(new Exception('No previous version of '.ITOP_APPLICATION.' found in the supplied database. The upgrade cannot continue.')); - } - else if (strcasecmp($aInstalledInfo['product_name'], ITOP_APPLICATION) != 0) - { + } elseif (strcasecmp($aInstalledInfo['product_name'], ITOP_APPLICATION) != 0) { $oPage->p("Warning: The installed products seem different. Are you sure that you want to upgrade {$aInstalledInfo['product_name']} with ".ITOP_APPLICATION."?"); } @@ -538,17 +524,16 @@ EOF $sUpgradeDMVersion = SetupUtils::GetDataModelVersion($sCompatibleDMDir); $sPreviousSourceDir = isset($aInstalledInfo['source_dir']) ? $aInstalledInfo['source_dir'] : 'modules'; $aChanges = false; - if (is_dir($sPreviousVersionDir)) - { + if (is_dir($sPreviousVersionDir)) { // Check if the previous version is a "genuine" one or not... $aChanges = SetupUtils::CheckVersion($sInstalledDataModelVersion, $sPreviousVersionDir.'/'.$sPreviousSourceDir); } - if (($aChanges !== false) && ( (count($aChanges['added']) > 0) || (count($aChanges['removed']) > 0) || (count($aChanges['modified']) > 0)) ) { + if (($aChanges !== false) && ((count($aChanges['added']) > 0) || (count($aChanges['removed']) > 0) || (count($aChanges['modified']) > 0))) { // Some changes were detected, prompt the user to keep or discard them $oPage->p(" Some modifications were detected between the ".ITOP_APPLICATION." version in '$sPreviousVersionDir' and a genuine $sInstalledVersion version."); $oPage->p("What do you want to do?"); - $aWritableDirs = array('modules', 'portal'); + $aWritableDirs = ['modules', 'portal']; $aErrors = SetupUtils::CheckWritableDirs($aWritableDirs); $sChecked = ($this->oWizard->GetParameter('upgrade_type') == 'keep-previous') ? ' checked ' : ''; $sDisabled = (count($aErrors) > 0) ? ' disabled ' : ''; @@ -582,31 +567,26 @@ EOF } if (count($aChanges['removed']) > 0) { $oPage->add('
        Deleted files:'); - foreach ($aChanges['removed'] as $sFilePath => $void) - { + foreach ($aChanges['removed'] as $sFilePath => $void) { $oPage->add('
      • '.$sFilePath.'
      • '); } $oPage->add('
      '); } - if (count($aChanges['modified']) > 0) - { + if (count($aChanges['modified']) > 0) { $oPage->add('
        Modified files:'); - foreach($aChanges['modified'] as $sFilePath => $void) - { + foreach ($aChanges['modified'] as $sFilePath => $void) { $oPage->add('
      • '.$sFilePath.'
      • '); } $oPage->add('
      '); } $oPage->add(''); - } - else - { + } else { // No changes detected... or no way to tell because of the lack of a manifest or previous source dir // Use the "compatible" datamodel as-is. $sCompatibleDMDirToDisplay = utils::HtmlEntities($sCompatibleDMDir); - $sUpgradeDMVersionToDisplay = utils::HtmlEntities($sUpgradeDMVersion); + $sUpgradeDMVersionToDisplay = utils::HtmlEntities($sUpgradeDMVersion); $oPage->add( -<<The datamodel will be upgraded from version $sInstalledDataModelVersion to version $sUpgradeDMVersion. @@ -617,7 +597,7 @@ HTML } $oPage->add_ready_script( -<<oWizard->GetParameter('db_tls_enabled', ''), $this->oWizard->GetParameter('db_tls_ca', '') ); - if ($oMutex->IsLocked()) - { + if ($oMutex->IsLocked()) { $oPage->add('
      '.ITOP_APPLICATION.' cron process is being executed on the target database. '.ITOP_APPLICATION.' cron process will be stopped during the setup execution.
      '); } } @@ -672,13 +651,13 @@ class WizStepLicense extends WizardStep public function GetPossibleSteps() { - return array('WizStepDBParams'); + return ['WizStepDBParams']; } public function ProcessParams($bMoveForward = true) { $this->oWizard->SaveParameter('accept_license', 'no'); - return array('class' => 'WizStepDBParams', 'state' => ''); + return ['class' => 'WizStepDBParams', 'state' => '']; } /** @@ -695,55 +674,55 @@ class WizStepLicense extends WizardStep return (($sMode === 'install') && SetupUtils::IsConnectableToITopHub($aModules)); } - /** - * @param WebPage $oPage - */ - public function Display(WebPage $oPage) - { - $aLicenses = SetupUtils::GetLicenses(); - $oPage->add_style( - <<add_style( + <<add('

      Licenses agreements for the components of '.ITOP_APPLICATION.'

      '); - $oPage->add_style('div a.no-arrow { background:transparent; padding-left:0;}'); - $oPage->add_style('.toggle { cursor:pointer; text-decoration:underline; color:#1C94C4; }'); - $oPage->add('
      '); - $oPage->add('Components of '.ITOP_APPLICATION.''); - $oPage->add('
        '); - $index = 0; - foreach ($aLicenses as $oLicense) { - $oPage->add('
      • '.$oLicense->product.', © '.$oLicense->author.' is licensed under the '.$oLicense->license_type.' license. (Details)'); - $oPage->add(''); - $oPage->add_ready_script('$(".license_text a").attr("target", "_blank").addClass("no-arrow");'); - $oPage->add_ready_script('$("#toggle_'.$index.'").on("click", function() { $("#license_'.$index.'").toggle(); } );'); - $index++; - } - $oPage->add('
      '); - $oPage->add('
      '); - $sChecked = ($this->oWizard->GetParameter('accept_license', 'no') == 'yes') ? ' checked ' : ''; - $oPage->add('
      '); - if ($this->NeedsGdprConsent()) { - $oPage->add('
      '); - $oPage->add('
      '); - $oPage->add('European General Data Protection Regulation'); - $oPage->add('
      '.ITOP_APPLICATION.' software is compliant with the processing of personal data according to the European General Data Protection Regulation (GDPR).

      + $oPage->add('

      Licenses agreements for the components of '.ITOP_APPLICATION.'

      '); + $oPage->add_style('div a.no-arrow { background:transparent; padding-left:0;}'); + $oPage->add_style('.toggle { cursor:pointer; text-decoration:underline; color:#1C94C4; }'); + $oPage->add('
      '); + $oPage->add('Components of '.ITOP_APPLICATION.''); + $oPage->add('
        '); + $index = 0; + foreach ($aLicenses as $oLicense) { + $oPage->add('
      • '.$oLicense->product.', © '.$oLicense->author.' is licensed under the '.$oLicense->license_type.' license. (Details)'); + $oPage->add(''); + $oPage->add_ready_script('$(".license_text a").attr("target", "_blank").addClass("no-arrow");'); + $oPage->add_ready_script('$("#toggle_'.$index.'").on("click", function() { $("#license_'.$index.'").toggle(); } );'); + $index++; + } + $oPage->add('
      '); + $oPage->add('
      '); + $sChecked = ($this->oWizard->GetParameter('accept_license', 'no') == 'yes') ? ' checked ' : ''; + $oPage->add('
      '); + if ($this->NeedsGdprConsent()) { + $oPage->add('
      '); + $oPage->add('
      '); + $oPage->add('European General Data Protection Regulation'); + $oPage->add('
      '.ITOP_APPLICATION.' software is compliant with the processing of personal data according to the European General Data Protection Regulation (GDPR).

      By installing '.ITOP_APPLICATION.' you agree that some information will be collected by Combodo to help you manage your instances and for statistical purposes. This data remains anonymous until it is associated to a user account on iTop Hub.

      List of collected data available in our Data privacy section.


      '); - $oPage->add(''); - $oPage->add(''); - $oPage->add('
      '); - } - $oPage->add_ready_script('$(".check_select").bind("click change", function() { WizardUpdateButtons(); });'); + $oPage->add(''); + $oPage->add(''); + $oPage->add('
      '); + } + $oPage->add_ready_script('$(".check_select").bind("click change", function() { WizardUpdateButtons(); });'); - $oPage->add_script( - <<add_script( + << 'WizStepUpgradeMiscParams', 'state' => ''); + return ['class' => 'WizStepUpgradeMiscParams', 'state' => '']; } } @@ -797,7 +775,7 @@ class WizStepDBParams extends WizardStep public function GetPossibleSteps() { - return array('WizStepAdminAccount'); + return ['WizStepAdminAccount']; } public function ProcessParams($bMoveForward = true) @@ -813,7 +791,7 @@ class WizStepDBParams extends WizardStep $this->oWizard->SaveParameter('db_tls_enabled', false); $this->oWizard->SaveParameter('db_tls_ca', ''); - return array('class' => 'WizStepAdminAccount', 'state' => ''); + return ['class' => 'WizStepAdminAccount', 'state' => '']; } public function Display(WebPage $oPage) @@ -829,29 +807,35 @@ class WizStepDBParams extends WizardStep $sNewDBName = $this->oWizard->GetParameter('db_new_name', false); $oPage->add('
      {$aRow['label']}{$aRow['input']}{$aRow['help']}{$aRow['label']}{$aRow['help']}{$aRow['label']}{$aRow['input']}{$aRow['label']}
      '); - SetupUtils::DisplayDBParameters($oPage, true, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, $sTlsEnabled, - $sTlsCA, $sNewDBName); + SetupUtils::DisplayDBParameters( + $oPage, + true, + $sDBServer, + $sDBUser, + $sDBPwd, + $sDBName, + $sDBPrefix, + $sTlsEnabled, + $sTlsCA, + $sNewDBName + ); $sAuthentToken = $this->oWizard->GetParameter('authent', ''); $oPage->add(''); $oPage->add('
      '); $sCreateDB = $this->oWizard->GetParameter('create_db', 'yes'); - if ($sCreateDB == 'no') - { + if ($sCreateDB == 'no') { $oPage->add_ready_script('$("#existing_db").prop("checked", true);'); - } - else - { + } else { $oPage->add_ready_script('$("#create_db").prop("checked", true);'); } } public function AsyncAction(WebPage $oPage, $sCode, $aParameters) { - switch($sCode) - { + switch ($sCode) { case 'check_db': - SetupUtils:: AsyncCheckDB($oPage, $aParameters); - break; + SetupUtils::AsyncCheckDB($oPage, $aParameters); + break; } } @@ -888,7 +872,7 @@ class WizStepAdminAccount extends WizardStep public function GetPossibleSteps() { - return array(WizStepInstallMiscParams::class); + return [WizStepInstallMiscParams::class]; } public function ProcessParams($bMoveForward = true) @@ -898,7 +882,7 @@ class WizStepAdminAccount extends WizardStep $this->oWizard->SaveParameter('confirm_pwd', ''); $this->oWizard->SaveParameter('admin_language', 'EN US'); - return array('class' => WizStepInstallMiscParams::class, 'state' => ''); + return ['class' => WizStepInstallMiscParams::class, 'state' => '']; } public function Display(WebPage $oPage) @@ -961,11 +945,10 @@ EOF return bRet; EOF - ; + ; } } - /** * @since 3.0.0 N°4092 */ @@ -983,7 +966,8 @@ abstract class AbstractWizStepMiscParams extends WizardStep $oPage->add('Dev parameters'); $oPage->p('
    '); @@ -2250,25 +2122,21 @@ class WizStepSummary extends WizardStep $oPage->add('
    '); $oPage->add('
    Other Parameters
      '); - if ($sMode == 'install') - { + if ($sMode == 'install') { $oPage->add('
    • Default language: '.$aInstallParams['language'].'
    • '); } $oPage->add('
    • URL to access the application: '.$aInstallParams['url'].'
    • '); $oPage->add('
    • Graphviz\' dot path: '.$aInstallParams['graphviz_path'].'
    • '); - if ($aInstallParams['sample_data'] == 'yes') - { + if ($aInstallParams['sample_data'] == 'yes') { $oPage->add('
    • Sample data will be loaded into the database.
    • '); } - if ($aInstallParams['old_addon']) - { + if ($aInstallParams['old_addon']) { $oPage->add('
    • Compatibility mode: Using the version 1.2 of the UserRightsProfiles add-on.
    • '); } $oPage->add('
    '); - if ($sMode == 'install') - { + if ($sMode == 'install') { $oPage->add('
    Admininistrator Account
      '); $oPage->add('
    • Login: '.$aInstallParams['admin_account']['user'].'
    • '); $oPage->add('
    • Password: '.$aInstallParams['admin_account']['pwd'].'
    • '); @@ -2277,8 +2145,7 @@ class WizStepSummary extends WizardStep } $aMiscOptions = $aInstallParams['options']; - if (count($aMiscOptions) > 0) - { + if (count($aMiscOptions) > 0) { $oPage->add('
      Miscellaneous Options
        '); foreach ($aMiscOptions as $sKey => $sValue) { $oPage->add('
      • '.$sKey.': '.$sValue.'
      • '); @@ -2348,56 +2215,48 @@ JS $sBackupDestination = ''; $sPreviousConfigurationFile = ''; $sDBName = $this->oWizard->GetParameter('db_name'); - if ($sMode == 'upgrade') - { + if ($sMode == 'upgrade') { $sPreviousVersionDir = $this->oWizard->GetParameter('previous_version_dir', ''); - if (!empty($sPreviousVersionDir)) - { + if (!empty($sPreviousVersionDir)) { $aPreviousInstance = SetupUtils::GetPreviousInstance($sPreviousVersionDir); - if ($aPreviousInstance['found']) - { + if ($aPreviousInstance['found']) { $sPreviousConfigurationFile = $aPreviousInstance['configuration_file']; } } - if ($this->oWizard->GetParameter('db_backup', false)) - { + if ($this->oWizard->GetParameter('db_backup', false)) { $sBackupDestination = $this->oWizard->GetParameter('db_backup_path', ''); } - } - else - { + } else { $sDBNewName = $this->oWizard->GetParameter('db_new_name', ''); - if ($sDBNewName != '') - { + if ($sDBNewName != '') { $sDBName = $sDBNewName; // Database will be created } } $sSourceDir = $this->oWizard->GetParameter('source_dir'); - $aCopies = array(); - if (($sMode == 'upgrade') && ($this->oWizard->GetParameter('upgrade_type') == 'keep-previous')) - { + $aCopies = []; + if (($sMode == 'upgrade') && ($this->oWizard->GetParameter('upgrade_type') == 'keep-previous')) { $sPreviousVersionDir = $this->oWizard->GetParameter('previous_version_dir'); - $aCopies[] = array('source' => $sSourceDir, 'destination' => 'modules'); // Source is an absolute path, destination is relative to APPROOT - $aCopies[] = array('source' => $sPreviousVersionDir.'/portal', 'destination' => 'portal'); // Source is an absolute path, destination is relative to APPROOT + $aCopies[] = ['source' => $sSourceDir, 'destination' => 'modules']; // Source is an absolute path, destination is relative to APPROOT + $aCopies[] = ['source' => $sPreviousVersionDir.'/portal', 'destination' => 'portal']; // Source is an absolute path, destination is relative to APPROOT $sSourceDir = APPROOT.'modules'; } - $aInstallParams = array ( + $aInstallParams = [ 'mode' => $sMode, - 'preinstall' => array ( + 'preinstall' => [ 'copies' => $aCopies, // 'backup' => see below - ), + ], 'source_dir' => str_replace(APPROOT, '', $sSourceDir), 'datamodel_version' => $this->oWizard->GetParameter('datamodel_version'), //TODO: let the installer compute this automatically... 'previous_configuration_file' => $sPreviousConfigurationFile, 'extensions_dir' => 'extensions', 'target_env' => 'production', 'workspace_dir' => '', - 'database' => array ( + 'database' => [ 'server' => $this->oWizard->GetParameter('db_server'), 'user' => $this->oWizard->GetParameter('db_user'), 'pwd' => $this->oWizard->GetParameter('db_pwd'), @@ -2405,14 +2264,14 @@ JS 'db_tls_enabled' => $this->oWizard->GetParameter('db_tls_enabled'), 'db_tls_ca' => $this->oWizard->GetParameter('db_tls_ca'), 'prefix' => $this->oWizard->GetParameter('db_prefix'), - ), + ], 'url' => $this->oWizard->GetParameter('application_url'), 'graphviz_path' => $this->oWizard->GetParameter('graphviz_path'), - 'admin_account' => array ( + 'admin_account' => [ 'user' => $this->oWizard->GetParameter('admin_user'), 'pwd' => $this->oWizard->GetParameter('admin_pwd'), 'language' => $this->oWizard->GetParameter('admin_language'), - ), + ], 'language' => $this->oWizard->GetParameter('default_language'), 'selected_modules' => $aSelectedModules, 'selected_extensions' => $aSelectedExtensions, @@ -2420,14 +2279,13 @@ JS 'old_addon' => $this->oWizard->GetParameter('old_addon', false), // whether or not to use the "old" userrights profile addon 'options' => json_decode($this->oWizard->GetParameter('misc_options', '[]'), true), 'mysql_bindir' => $this->oWizard->GetParameter('mysql_bindir'), - ); + ]; - if ($sBackupDestination != '') - { - $aInstallParams['preinstall']['backup'] = array ( + if ($sBackupDestination != '') { + $aInstallParams['preinstall']['backup'] = [ 'destination' => $sBackupDestination, 'configuration_file' => $sPreviousConfigurationFile, - ); + ]; } return $aInstallParams; @@ -2455,9 +2313,7 @@ JS ExecuteStep('{$aRes['next-step']}'); EOF ); - } - else if ($aRes['status'] != ApplicationInstaller::ERROR) - { + } elseif ($aRes['status'] != ApplicationInstaller::ERROR) { // Installation complete, move to the next step of the wizard $oPage->add_ready_script( << '', 'state' => ''); + return ['class' => '', 'state' => '']; } public function Display(WebPage $oPage) { // Check if there are some manual steps required: - $aManualSteps = array(); + $aManualSteps = []; $aAvailableModules = SetupUtils::AnalyzeInstallation($this->oWizard); $sRootUrl = utils::GetAbsoluteUrlAppRoot(true); $aSelectedModules = json_decode($this->oWizard->GetParameter('selected_modules'), true); - foreach($aSelectedModules as $sModuleId) - { - if (!empty($aAvailableModules[$sModuleId]['doc.manual_setup'])) - { + foreach ($aSelectedModules as $sModuleId) { + if (!empty($aAvailableModules[$sModuleId]['doc.manual_setup'])) { $sUrl = $aAvailableModules[$sModuleId]['doc.manual_setup']; $sManualStepUrl = utils::IsURL($sUrl) ? $sUrl : $sRootUrl.$sUrl; $aManualSteps[$aAvailableModules[$sModuleId]['label']] = $sManualStepUrl; } } $oPage->add('
        '); - if (count($aManualSteps) > 0) - { + if (count($aManualSteps) > 0) { $oPage->add("

        Manual operations required

        "); $oPage->p("In order to complete the installation, the following manual operations are required:"); - foreach($aManualSteps as $sModuleLabel => $sUrl) { + foreach ($aManualSteps as $sModuleLabel => $sUrl) { $oPage->p("Manual instructions for $sModuleLabel"); } $oPage->add("

        Congratulations for installing ".ITOP_APPLICATION."

        "); - } - else - { + } else { $oPage->add("

        Congratulations for installing ".ITOP_APPLICATION."

        "); $oPage->ok("The installation completed successfully."); } $bHasBackup = false; - if (($this->oWizard->GetParameter('mode', '') == 'upgrade') && $this->oWizard->GetParameter('db_backup', false) && $this->oWizard->GetParameter('authent', false)) - { + if (($this->oWizard->GetParameter('mode', '') == 'upgrade') && $this->oWizard->GetParameter('db_backup', false) && $this->oWizard->GetParameter('authent', false)) { $sBackupDestination = $this->oWizard->GetParameter('db_backup_path', ''); - if (file_exists($sBackupDestination.'.tar.gz')) - { + if (file_exists($sBackupDestination.'.tar.gz')) { $bHasBackup = true; // To mitigate security risks: pass only the filename without the extension, the download will add the extension itself $oPage->p('Your backup is ready'); - $oPage->p(' Download '.basename($sBackupDestination).''); - } - else - { + $oPage->p(' Download '.basename($sBackupDestination).''); + } else { $oPage->p(' Warning: Backup creation failed !'); } } @@ -2580,7 +2427,6 @@ class WizStepDone extends WizardStep $oPage->add('
        '); - $oConfig = new Config(utils::GetConfigFilePath()); $aParamValues = $this->oWizard->GetParamForConfigArray(); $oConfig->UpdateFromParams($aParamValues); @@ -2591,13 +2437,12 @@ class WizStepDone extends WizardStep $oProductionEnv->InitDataModel($oConfig, true); $sIframeUrl = $oConfig->GetModuleSetting('itop-hub-connector', 'setup_url', ''); - $sSetupTokenFile = APPROOT.'data/.setup'; - $sSetupToken = bin2hex(random_bytes(12)); - file_put_contents($sSetupTokenFile, $sSetupToken); - $sIframeUrl.= "&setup_token=$sSetupToken"; + $sSetupTokenFile = APPROOT.'data/.setup'; + $sSetupToken = bin2hex(random_bytes(12)); + file_put_contents($sSetupTokenFile, $sSetupToken); + $sIframeUrl .= "&setup_token=$sSetupToken"; - if ($sIframeUrl != '') - { + if ($sIframeUrl != '') { $oPage->add(''); $oPage->add_script(" @@ -2651,8 +2496,7 @@ class WizStepDone extends WizardStep SetupUtils::EraseSetupToken(); // For security reasons: add the extension now so that this action can be used to read *only* .tar.gz files from the disk... $sBackupFile = $aParameters['backup'].'.tar.gz'; - if (file_exists($sBackupFile)) - { + if (file_exists($sBackupFile)) { // Make sure there is NO output at all before our content, otherwise the document will be corrupted $sPreviousContent = ob_get_clean(); $oPage->SetContentType('application/gzip'); diff --git a/setup/xmldataloader.class.inc.php b/setup/xmldataloader.class.inc.php index dc995b976..9510272b2 100644 --- a/setup/xmldataloader.class.inc.php +++ b/setup/xmldataloader.class.inc.php @@ -1,9 +1,10 @@ - /** * Load XML data from a set of files * @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ -define ('KEYS_CACHE_FILE', APPROOT.'data/keyscache.tmp'); +define('KEYS_CACHE_FILE', APPROOT.'data/keyscache.tmp'); /** * Class to load sets of objects from XML files into the database * XML files can be produced by the 'export' web service or by any other means @@ -49,17 +49,17 @@ class XMLDataLoader public function __construct() { - $this->m_aKeys = array(); - $this->m_aObjectsCache = array(); + $this->m_aKeys = []; + $this->m_aObjectsCache = []; $this->m_oChange = null; $this->m_sCacheFileName = KEYS_CACHE_FILE; $this->LoadKeysCache(); $this->m_bSessionActive = true; - $this->m_aErrors = array(); - $this->m_aWarnings = array(); + $this->m_aErrors = []; + $this->m_aWarnings = []; $this->m_iCountCreated = 0; } - + public function StartSession($oChange) { // Do cleanup any existing cache file (shall not be necessary unless a setup was interrupted abruptely) @@ -68,22 +68,17 @@ class XMLDataLoader $this->m_oChange = $oChange; $this->m_bSessionActive = true; } - + public function EndSession($bStrict = false) { $this->ResolveExternalKeys(); $this->m_bSessionActive = false; - if (count($this->m_aErrors) > 0) - { + if (count($this->m_aErrors) > 0) { return false; - } - elseif ($bStrict && count($this->m_aWarnings) > 0) - { + } elseif ($bStrict && count($this->m_aWarnings) > 0) { return false; - } - else - { + } else { return true; } } @@ -102,81 +97,70 @@ class XMLDataLoader { return $this->m_iCountCreated; } - + public function __destruct() { // Stopping in the middle of a session, let's save the context information - if ($this->m_bSessionActive) - { + if ($this->m_bSessionActive) { $this->SaveKeysCache(); - } - else - { + } else { $this->ClearKeysCache(); } } - + /** * Stores the keys & object cache in a file */ protected function SaveKeysCache() { - if (!is_dir(APPROOT.'data')) - { + if (!is_dir(APPROOT.'data')) { mkdir(APPROOT.'data'); } $hFile = @fopen($this->m_sCacheFileName, 'w'); - if ($hFile !== false) - { - $sData = serialize( array('keys' => $this->m_aKeys, + if ($hFile !== false) { + $sData = serialize(['keys' => $this->m_aKeys, 'objects' => $this->m_aObjectsCache, 'change' => $this->m_oChange, 'errors' => $this->m_aErrors, 'warnings' => $this->m_aWarnings, - )); + ]); fwrite($hFile, $sData); fclose($hFile); - } - else - { + } else { throw new Exception("Cannot write to file: '{$this->m_sCacheFileName}'"); } } - + /** * Loads the keys & object cache from the tmp file */ protected function LoadKeysCache() { $sFileContent = @file_get_contents($this->m_sCacheFileName); - if (!empty($sFileContent)) - { + if (!empty($sFileContent)) { $aCache = unserialize($sFileContent); $this->m_aKeys = $aCache['keys']; - $this->m_aObjectsCache = $aCache['objects']; + $this->m_aObjectsCache = $aCache['objects']; $this->m_oChange = $aCache['change']; $this->m_aErrors = $aCache['errors']; $this->m_aWarnings = $aCache['warnings']; } - } - + } + /** * Remove the tmp file used to store the keys cache */ protected function ClearKeysCache() { - if(is_file($this->m_sCacheFileName)) - { + if (is_file($this->m_sCacheFileName)) { unlink($this->m_sCacheFileName); - } - else - { + } else { //echo "

        Hm, it looks like the file does not exist!!!

        "; } - $this->m_aKeys = array(); - $this->m_aObjectsCache = array(); - } - + $this->m_aKeys = []; + $this->m_aObjectsCache = []; + } + /** * Helper function to load the objects from a standard XML file into the database * @@ -186,7 +170,7 @@ class XMLDataLoader * * @since 3.0.0 Added $bSearch parameter */ - function LoadFile($sFilePath, $bUpdateKeyCacheOnly = false, bool $bSearch = false) + public function LoadFile($sFilePath, $bUpdateKeyCacheOnly = false, bool $bSearch = false) { global $aKeys; @@ -197,15 +181,15 @@ class XMLDataLoader throw(new Exception("Unable to load xml file - $sFilePath")); } - $aReplicas = array(); + $aReplicas = []; foreach ($oXml as $sClass => $oXmlObj) { if (!MetaModel::IsValidClass($sClass)) { SetupLog::Error("Unknown class - $sClass"); throw(new Exception("Unknown class - $sClass")); } - $iSrcId = (integer)$oXmlObj['id']; // Mandatory to cast - + $iSrcId = (int)$oXmlObj['id']; // Mandatory to cast + // Import algorithm // Here enumerate all the attributes of the object // for all attribute that is neither an external field @@ -216,52 +200,38 @@ class XMLDataLoader // Once all the objects have been created re-assign all the external keys to // their actual Ids $iExistingId = $this->GetObjectKey($sClass, $iSrcId); - if ($iExistingId != 0) - { + if ($iExistingId != 0) { $oTargetObj = MetaModel::GetObject($sClass, $iExistingId); - } - else - { + } else { $oTargetObj = MetaModel::NewObject($sClass); } - foreach($oXmlObj as $sAttCode => $oSubNode) - { - if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + foreach ($oXmlObj as $sAttCode => $oSubNode) { + if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) { $sMsg = "Unknown attribute code - $sClass/$sAttCode"; continue; // ignore silently... } $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - if (($oAttDef->IsWritable()) && ($oAttDef->IsScalar())) - { - if ($oAttDef->IsExternalKey()) - { - if (substr(trim($oSubNode), 0, 6) == 'SELECT') - { + if (($oAttDef->IsWritable()) && ($oAttDef->IsScalar())) { + if ($oAttDef->IsExternalKey()) { + if (substr(trim($oSubNode), 0, 6) == 'SELECT') { $sQuery = trim($oSubNode); $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sQuery)); $iMatches = $oSet->Count(); - if ($iMatches == 1) - { + if ($iMatches == 1) { $oFoundObject = $oSet->Fetch(); $iExtKey = $oFoundObject->GetKey(); - } - else - { + } else { $sMsg = "Ext key not reconcilied - $sClass/$iSrcId - $sAttCode: '".$sQuery."' - found $iMatches matche(s)"; SetupLog::Error($sMsg); $this->m_aErrors[] = $sMsg; $iExtKey = 0; } - } - else - { - $iDstObj = (integer)($oSubNode); + } else { + $iDstObj = (int)($oSubNode); // Attempt to find the object in the list of loaded objects $iExtKey = $this->GetObjectKey($oAttDef->GetTargetClass(), $iDstObj); - if ($iExtKey == 0) - { + if ($iExtKey == 0) { $iExtKey = -$iDstObj; // Convention: Unresolved keys are stored as negative ! $oTargetObj->RegisterAsDirty(); } @@ -269,31 +239,23 @@ class XMLDataLoader } //$oTargetObj->CheckValue($sAttCode, $iExtKey); $oTargetObj->Set($sAttCode, $iExtKey); - } - elseif ($oAttDef instanceof AttributeBlob) - { + } elseif ($oAttDef instanceof AttributeBlob) { $sMimeType = (string) $oSubNode->mimetype; $sFileName = (string) $oSubNode->filename; $data = base64_decode((string) $oSubNode->data); $oDoc = new ormDocument($data, $sMimeType, $sFileName); $oTargetObj->Set($sAttCode, $oDoc); - } - elseif ($oAttDef instanceof AttributeTagSet) - { + } elseif ($oAttDef instanceof AttributeTagSet) { // TODO - } - else - { + } else { $value = (string)$oSubNode; - if ($value == '') - { + if ($value == '') { $value = $oAttDef->GetNullValue(); } $res = $oTargetObj->CheckValue($sAttCode, $value); - if ($res !== true) - { + if ($res !== true) { // $res contains the error description $sMsg = "Value not allowed - $sClass/$iSrcId - $sAttCode: '".$oSubNode."' ; $res"; SetupLog::Error($sMsg); @@ -307,153 +269,123 @@ class XMLDataLoader } return true; } - + /** * Get the new ID of an object in the database given its original ID * This may fail (return 0) if the object has not yet been created in the database - * This is why the order of the import may be important - */ + * This is why the order of the import may be important + */ protected function GetObjectKey($sClass, $iSrcId) { - if (isset($this->m_aKeys[$sClass]) && isset($this->m_aKeys[$sClass][$iSrcId])) - { + if (isset($this->m_aKeys[$sClass]) && isset($this->m_aKeys[$sClass][$iSrcId])) { return $this->m_aKeys[$sClass][$iSrcId]; } return 0; } - + /** * Store an object in the database and remember the mapping * between its original ID and the newly created ID in the database - */ + */ protected function StoreObject($sClass, $oTargetObj, $iSrcId, $bSearch = false, $bUpdateKeyCacheOnly = false) { $iObjId = 0; - try - { - if ($bSearch) - { + try { + if ($bSearch) { // Check if the object does not already exist, based on its usual reconciliation keys... $aReconciliationKeys = MetaModel::GetReconcKeys($sClass); - if (count($aReconciliationKeys) > 0) - { + if (count($aReconciliationKeys) > 0) { // Some reconciliation keys have been defined, use them to search for the object $oSearch = new DBObjectSearch($sClass); $iConditionsCount = 0; - foreach($aReconciliationKeys as $sAttCode) - { - if ($oTargetObj->Get($sAttCode) != '') - { + foreach ($aReconciliationKeys as $sAttCode) { + if ($oTargetObj->Get($sAttCode) != '') { $oSearch->AddCondition($sAttCode, $oTargetObj->Get($sAttCode), '='); $iConditionsCount++; } } - if ($iConditionsCount > 0) // Search only if there are some valid conditions... - { + if ($iConditionsCount > 0) { // Search only if there are some valid conditions... $oSet = new DBObjectSet($oSearch); - if ($oSet->count() == 1) - { + if ($oSet->count() == 1) { // The object already exists, reuse it $oExistingObject = $oSet->Fetch(); $iObjId = $oExistingObject->GetKey(); } } } - } - - if ($iObjId == 0) - { - if($oTargetObj->IsNew()) - { - if (!$bUpdateKeyCacheOnly) - { - $iObjId = $oTargetObj->DBInsertNoReload(); + } + + if ($iObjId == 0) { + if ($oTargetObj->IsNew()) { + if (!$bUpdateKeyCacheOnly) { + $iObjId = $oTargetObj->DBInsertNoReload(); $this->m_iCountCreated++; } - } - else - { + } else { $iObjId = $oTargetObj->GetKey(); - if (!$bUpdateKeyCacheOnly) - { + if (!$bUpdateKeyCacheOnly) { $oTargetObj->DBUpdate(); } } - } - } - catch(Exception $e) - { + } + } catch (Exception $e) { SetupLog::Error("An object could not be recorded - $sClass/$iSrcId - ".$e->getMessage()); $this->m_aErrors[] = "An object could not be recorded - $sClass/$iSrcId - ".$e->getMessage(); } $aParentClasses = MetaModel::EnumParentClasses($sClass); $aParentClasses[] = $sClass; - foreach($aParentClasses as $sObjClass) - { + foreach ($aParentClasses as $sObjClass) { $this->m_aKeys[$sObjClass][$iSrcId] = $iObjId; } $this->m_aObjectsCache[$sClass][$iObjId] = $oTargetObj; } - + /** * Maps an external key to its (newly created) value */ - + protected function ResolveExternalKeys() { /** * @var string $sClass * @var \CMDBObject[] $oObjList */ - foreach($this->m_aObjectsCache as $sClass => $oObjList) - { - foreach($oObjList as $oTargetObj) - { + foreach ($this->m_aObjectsCache as $sClass => $oObjList) { + foreach ($oObjList as $oTargetObj) { $bChanged = false; $sClass = get_class($oTargetObj); - foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode=>$oAttDef) - { - if ( ($oAttDef->IsExternalKey()) && ($oTargetObj->Get($sAttCode) < 0) ) // Convention unresolved key = negative - { + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if (($oAttDef->IsExternalKey()) && ($oTargetObj->Get($sAttCode) < 0)) { // Convention unresolved key = negative $sTargetClass = $oAttDef->GetTargetClass(); $iTempKey = $oTargetObj->Get($sAttCode); $iExtKey = $this->GetObjectKey($sTargetClass, -$iTempKey); - if ($iExtKey == 0) - { + if ($iExtKey == 0) { $sMsg = "unresolved extkey in $sClass::".$oTargetObj->GetKey()."(".$oTargetObj->GetName().")::$sAttCode=$sTargetClass::$iTempKey"; SetupLog::Warning($sMsg); $this->m_aWarnings[] = $sMsg; //echo "
        aKeys[".$sTargetClass."]:\n";
         							//print_r($this->m_aKeys[$sTargetClass]);
         							//echo "
        \n"; - } - else - { + } else { $bChanged = true; $oTargetObj->Set($sAttCode, $iExtKey); } } } - if ($bChanged) - { - try - { - if (is_subclass_of($oTargetObj, 'CMDBObject')) - { + if ($bChanged) { + try { + if (is_subclass_of($oTargetObj, 'CMDBObject')) { $oTargetObj::SetCurrentChange($this->m_oChange); } $oTargetObj->DBUpdate(); - } - catch(Exception $e) - { + } catch (Exception $e) { $this->m_aErrors[] = "The object changes could not be tracked - $sClass/$iExtKey - ".$e->getMessage(); } } } } - + return true; } } -?> diff --git a/sources/Application/Branding.php b/sources/Application/Branding.php index 7352eb3b2..946714c7e 100644 --- a/sources/Application/Branding.php +++ b/sources/Application/Branding.php @@ -1,4 +1,5 @@ $sLanguage, 'maximize' => [], 'detectChanges' => [ - 'initialValue' => $sInitialValue + 'initialValue' => $sInitialValue, ], 'objectShortcut' => [ - 'buttonLabel' => Dict::S('UI:ObjectShortcutInsert') + 'buttonLabel' => Dict::S('UI:ObjectShortcutInsert'), ], 'htmlSupport' => $aSanitizerConfiguration, - ); + ]; // Mentions - if($bWithMentions){ - try{ + if ($bWithMentions) { + try { $aMentionConfiguration = self::GetMentionConfiguration(); $aConfiguration['mention'] = $aMentionConfiguration; - } - catch(Exception $e){ + } catch (Exception $e) { ExceptionLog::LogException($e); } } @@ -78,7 +77,7 @@ class CKEditorHelper * @return array|array[] * @throws \Exception */ - private static function GetMentionConfiguration() : array + private static function GetMentionConfiguration(): array { // initialize feeds $aMentionConfiguration = ['feeds' => []]; @@ -87,7 +86,7 @@ class CKEditorHelper $aMentionsAllowedClasses = MetaModel::GetConfig()->Get('mentions.allowed_classes'); // iterate throw classes... - foreach($aMentionsAllowedClasses as $sMentionMarker => $sMentionScope) { + foreach ($aMentionsAllowedClasses as $sMentionMarker => $sMentionScope) { // Retrieve mention class // - First test if the conf is a simple data model class @@ -108,7 +107,7 @@ class CKEditorHelper 'minimumCharacters' => MetaModel::GetConfig()->Get('min_autocomplete_chars'), 'feed_type' => 'ajax', 'feed_ajax_options' => [ - 'url' => utils::GetAbsoluteUrlAppRoot(). "pages/ajax.render.php?route=object.search_for_mentions&marker=".urlencode($sMentionMarker)."&needle=", + 'url' => utils::GetAbsoluteUrlAppRoot()."pages/ajax.render.php?route=object.search_for_mentions&marker=".urlencode($sMentionMarker)."&needle=", 'throttle' => 500, 'marker' => $sMentionMarker, ], @@ -127,12 +126,12 @@ class CKEditorHelper * * @return string|null */ - public static function PrepareCKEditorValueTextEncodingForTextarea(string $sValue = null) : ?string + public static function PrepareCKEditorValueTextEncodingForTextarea(string $sValue = null): ?string { - if($sValue === null){ + if ($sValue === null) { return null; } - return str_replace( '&', '&', $sValue ); + return str_replace('&', '&', $sValue); } /** @@ -150,10 +149,9 @@ class CKEditorHelper { // link CKEditor JS files foreach (static::GetJSFilesRelPathsForCKEditor() as $sFile) { - try{ + try { $oPage->LinkScriptFromAppRoot($sFile); - } - catch(Exception $e){ + } catch (Exception $e) { ExceptionLog::LogException($e); } } @@ -166,12 +164,11 @@ class CKEditorHelper $oPage->add_ready_script("CombodoCKEditorHandler.CreateInstance('#$sInputElementId', $sConfigJS)"); // handle mentions template - if($bWithMentions){ - try{ + if ($bWithMentions) { + try { $sMentionTemplate = self::GetMentionsTemplate($sInputElementId); $oPage->add($sMentionTemplate); - } - catch(Exception $e){ + } catch (Exception $e) { ExceptionLog::LogException($e); } } @@ -193,12 +190,11 @@ class CKEditorHelper public static function ConfigureCKEditorElementForRenderingOutput(RenderingOutput $oOutput, string $sInputElementId, string $sInitialValue = null, bool $bWithMentions = false, bool $bAddJSFiles = true, array $aOverloadConfiguration = []): void { // link CKEditor JS files - if($bAddJSFiles){ + if ($bAddJSFiles) { foreach (static::GetJSFilesRelPathsForCKEditor() as $sFile) { - try{ + try { $oOutput->AddJsFile($sFile); - } - catch(Exception $e){ + } catch (Exception $e) { ExceptionLog::LogException($e); } } @@ -212,12 +208,11 @@ class CKEditorHelper $oOutput->AddJs("CombodoCKEditorHandler.CreateInstance('#$sInputElementId', $sConfigJS)"); // mentions template - if($bWithMentions){ - try{ + if ($bWithMentions) { + try { $sMentionTemplate = self::GetMentionsTemplate($sInputElementId); $oOutput->add($sMentionTemplate); - } - catch(Exception $e){ + } catch (Exception $e) { ExceptionLog::LogException($e); } } @@ -256,7 +251,7 @@ HTML; 'node_modules/ckeditor5-itop-build/build/ckeditor.js', 'js/highlight/highlight.min.js', 'js/ckeditor.handler.js', - 'js/ckeditor.feeds.js' + 'js/ckeditor.feeds.js', ]; // add CKEditor translations resource @@ -267,13 +262,12 @@ HTML; // add corresponding ckeditor language file // P1 language + country // P2 language - $sLanguageFileRelPath = 'node_modules/ckeditor5-itop-build/build/translations/' . $sLanguage . '-' . $sCountry . '.js'; - if(file_exists(APPROOT . $sLanguageFileRelPath)){ + $sLanguageFileRelPath = 'node_modules/ckeditor5-itop-build/build/translations/'.$sLanguage.'-'.$sCountry.'.js'; + if (file_exists(APPROOT.$sLanguageFileRelPath)) { $aJSRelPaths[] = $sLanguageFileRelPath; - } - else { - $sLanguageFileRelPath = 'node_modules/ckeditor5-itop-build/build/translations/' . $sLanguage . '.js'; - if(file_exists(APPROOT . $sLanguageFileRelPath)){ + } else { + $sLanguageFileRelPath = 'node_modules/ckeditor5-itop-build/build/translations/'.$sLanguage.'.js'; + if (file_exists(APPROOT.$sLanguageFileRelPath)) { $aJSRelPaths[] = $sLanguageFileRelPath; } } @@ -288,26 +282,26 @@ HTML; * @throws \ConfigException * @throws \CoreException */ - public static function GetDOMSanitizerForCKEditor(DOMSanitizer $oSanitizer = null) : array + public static function GetDOMSanitizerForCKEditor(DOMSanitizer $oSanitizer = null): array { - if($oSanitizer === null) { + if ($oSanitizer === null) { /* @var $oSanitizer DOMSanitizer */ $sSanitizerClass = utils::GetConfig()->Get('html_sanitizer'); $oSanitizer = new $sSanitizerClass(); } - + $aWhitelist = [ 'allow' => [], - 'disallow' => [] + 'disallow' => [], ]; - + // Build the allow list foreach ($oSanitizer->GetTagsWhiteList() as $sTag => $aAttributes) { $aAllowedItem = [ 'name' => $sTag, 'attributes' => [], 'classes' => false, - 'styles' => false + 'styles' => false, ]; foreach ($aAttributes as $aAttr) { @@ -317,7 +311,7 @@ HTML; $aAllowedItem['classes'] = true; } elseif (isset($oSanitizer->GetAttrsWhiteList()[$aAttr])) { $aAllowedItem['attributes'][$aAttr] = [ - 'pattern' => $oSanitizer->GetAttrsWhiteList()[$aAttr] + 'pattern' => $oSanitizer->GetAttrsWhiteList()[$aAttr], ]; } else { $aAllowedItem['attributes'][$aAttr] = true; @@ -339,7 +333,7 @@ HTML; ]; foreach ($oSanitizer->GetAttrsBlackList() as $aAttr) { - $aDisallowedItem['attributes'][$aAttr] = true; + $aDisallowedItem['attributes'][$aAttr] = true; } if (empty($aDisallowedItem['attributes'])) { @@ -348,7 +342,7 @@ HTML; $aWhitelist['disallow'][] = $aDisallowedItem; } - + return $aWhitelist; } -} \ No newline at end of file +} diff --git a/sources/Application/Helper/ExportHelper.php b/sources/Application/Helper/ExportHelper.php index 41536898e..5e76b9d7e 100644 --- a/sources/Application/Helper/ExportHelper.php +++ b/sources/Application/Helper/ExportHelper.php @@ -1,6 +1,7 @@ SetIsClosable(false); return $oAlert; } -} \ No newline at end of file +} diff --git a/sources/Application/Helper/FormHelper.php b/sources/Application/Helper/FormHelper.php index 227dbe54a..0d6327998 100644 --- a/sources/Application/Helper/FormHelper.php +++ b/sources/Application/Helper/FormHelper.php @@ -1,4 +1,5 @@ '; + $aExtraParams['fieldsComments'][$sAttCode] = ' '; } } } @@ -93,12 +93,12 @@ class FormHelper } return null; } - + /** * Returns true if the object has a mandatory attribute blob - * + * * @see N°6861 - Display warning when creating/editing a mandatory blob in modal - * + * * @param \DBObject $oObject * * @return bool @@ -111,7 +111,7 @@ class FormHelper /** * Returns an Alert explaining what will happen when a mandatory attribute blob is displayed in a form - * + * * @see N°6861 - Display warning when creating/editing a mandatory blob in modal * @see self::ENUM_MANDATORY_BLOB_MODE_XXX * @@ -122,19 +122,19 @@ class FormHelper public static function GetAlertForMandatoryAttributeBlobInputsInModal(string $sMode = self::ENUM_MANDATORY_BLOB_MODE_MODIFY_EMPTY): Alert { $sMessage = Dict::S('UI:Object:Modal:'.$sMode.':MandatoryAttributeBlobInputs:Warning:Text'); - + // If the mandatory attribute is already filled, there's no risk to make an object incomplete so we display an information level alert - if($sMode === self::ENUM_MANDATORY_BLOB_MODE_MODIFY_FILLED){ + if ($sMode === self::ENUM_MANDATORY_BLOB_MODE_MODIFY_FILLED) { return AlertUIBlockFactory::MakeForInformation('', $sMessage); } return AlertUIBlockFactory::MakeForWarning('', $sMessage); } - + /** * Update flags to be sent to form with url parameters * For now only supports "readonly" param - * + * * @param \DBObject $oObject * @param array $aExtraParams * @@ -145,21 +145,21 @@ class FormHelper { $aRawValues = utils::ReadParam('readonly', [], '', 'raw_data'); $sObjectClass = get_class($oObject); - - if(array_key_exists('fieldsFlags', $aExtraParams) === false ) { + + if (array_key_exists('fieldsFlags', $aExtraParams) === false) { $aExtraParams['fieldsFlags'] = []; - } - - if(array_key_exists('forceFieldsSubmission', $aExtraParams) === false ) { + } + + if (array_key_exists('forceFieldsSubmission', $aExtraParams) === false) { $aExtraParams['forceFieldsSubmission'] = []; } // - For each attribute present in readonly array in url, add a flag and mark them as to be submitted with their default value - foreach($aRawValues as $sAttCode => $sValue) { - if(MetaModel::IsValidAttCode($sObjectClass, $sAttCode)) { + foreach ($aRawValues as $sAttCode => $sValue) { + if (MetaModel::IsValidAttCode($sObjectClass, $sAttCode)) { $aExtraParams['fieldsFlags'][$sAttCode] = array_key_exists($sAttCode, $aExtraParams['fieldsFlags']) ? $aExtraParams['fieldsFlags'][$sAttCode] & OPT_ATT_READONLY : OPT_ATT_READONLY; - + $aExtraParams['forceFieldsSubmission'][] = $sAttCode; } } @@ -167,14 +167,15 @@ class FormHelper /** * Get attribute flag for an object allowing to cross-check with extra flags present in a form - * + * * @param \DBObject $oObject * @param string $sAttCode * @param array $aExtraFlags * * @return int */ - public static function GetAttributeFlagsForObject(DBObject $oObject, string $sAttCode, array $aExtraFlags = []): int { + public static function GetAttributeFlagsForObject(DBObject $oObject, string $sAttCode, array $aExtraFlags = []): int + { $iFlags = $oObject->GetFormAttributeFlags($sAttCode); if (array_key_exists($sAttCode, $aExtraFlags)) { // the caller may override some flags if needed @@ -182,4 +183,4 @@ class FormHelper } return $iFlags; } -} \ No newline at end of file +} diff --git a/sources/Application/Helper/Session.php b/sources/Application/Helper/Session.php index cbd65eb7f..5fc2b0622 100644 --- a/sources/Application/Helper/Session.php +++ b/sources/Application/Helper/Session.php @@ -1,10 +1,10 @@ LinkScriptFromAppRoot('js/jquery.mousewheel.js'); $oPage->LinkScriptFromAppRoot('js/simple_graph.js'); } -} \ No newline at end of file +} diff --git a/sources/Application/Newsroom/iTopNewsroomProvider.php b/sources/Application/Newsroom/iTopNewsroomProvider.php index fb5f808b5..157ef9484 100644 --- a/sources/Application/Newsroom/iTopNewsroomProvider.php +++ b/sources/Application/Newsroom/iTopNewsroomProvider.php @@ -16,9 +16,10 @@ use User; * @package Combodo\iTop\Application\Newsroom * @since 3.2.0 */ -class iTopNewsroomProvider extends NewsroomProviderBase { - - public function IsApplicable(User $oUser = null){ +class iTopNewsroomProvider extends NewsroomProviderBase +{ + public function IsApplicable(User $oUser = null) + { return true; } public function GetLabel() @@ -43,11 +44,11 @@ class iTopNewsroomProvider extends NewsroomProviderBase { private static function MakeURL($sRouteCode) { - return Router::GetInstance()->GenerateUrl(iTopNewsroomController::ROUTE_NAMESPACE . '.' . $sRouteCode); + return Router::GetInstance()->GenerateUrl(iTopNewsroomController::ROUTE_NAMESPACE.'.'.$sRouteCode); } public function GetTTL() { return MetaModel::GetConfig()->Get('notifications.itop.newsroom_cache_time') * 60; } -} \ No newline at end of file +} diff --git a/sources/Application/Search/CriterionConversion/criteriontooql.class.inc.php b/sources/Application/Search/CriterionConversion/criteriontooql.class.inc.php index 0d668addf..139fe34d6 100644 --- a/sources/Application/Search/CriterionConversion/criteriontooql.class.inc.php +++ b/sources/Application/Search/CriterionConversion/criteriontooql.class.inc.php @@ -1,4 +1,5 @@ 'ContainsToOql', self::OP_EQUALS => 'EqualsToOql', self::OP_STARTS_WITH => 'StartsWithToOql', @@ -77,10 +70,9 @@ class CriterionToOQL extends CriterionConversionAbstract self::OP_IN => 'InToOql', self::OP_MATCHES => 'MatchesToOql', self::OP_ALL => 'AllToOql', - ); + ]; - if (array_key_exists($sOperator, $aMappedOperators)) - { + if (array_key_exists($sOperator, $aMappedOperators)) { $sFct = $aMappedOperators[$sOperator]; return self::$sFct($oSearch, $sRef, $aCriteria); @@ -93,9 +85,8 @@ class CriterionToOQL extends CriterionConversionAbstract private static function GetValues($aCriteria) { - if (!array_key_exists('values', $aCriteria)) - { - return array(); + if (!array_key_exists('values', $aCriteria)) { + return []; } return $aCriteria['values']; @@ -103,12 +94,10 @@ class CriterionToOQL extends CriterionConversionAbstract private static function GetValue($aValues, $iIndex) { - if (!array_key_exists($iIndex, $aValues)) - { + if (!array_key_exists($iIndex, $aValues)) { return null; } - if (!array_key_exists('value', $aValues[$iIndex])) - { + if (!array_key_exists('value', $aValues[$iIndex])) { return null; } @@ -155,8 +144,7 @@ class CriterionToOQL extends CriterionConversionAbstract { $aValues = self::GetValues($aCriteria); $sValue = self::GetValue($aValues, 0); - if (($aCriteria['widget'] == AttributeDefinition::SEARCH_WIDGET_TYPE_NUMERIC) && ($sValue === '0')) - { + if (($aCriteria['widget'] == AttributeDefinition::SEARCH_WIDGET_TYPE_NUMERIC) && ($sValue === '0')) { return "({$sRef} = '0')"; } @@ -182,10 +170,9 @@ class CriterionToOQL extends CriterionConversionAbstract protected static function MatchesToOql($oSearch, $sRef, $aCriteria) { $aValues = self::GetValues($aCriteria); - $aRawValues = array(); + $aRawValues = []; $bHasUnDefined = isset($aCriteria['has_undefined']) ? $aCriteria['has_undefined'] : false; - for($i = 0; $i < count($aValues); $i++) - { + for ($i = 0; $i < count($aValues); $i++) { $sRawValue = self::GetValue($aValues, $i); if (!utils::StrLen($sRawValue)) { $bHasUnDefined = true; @@ -194,21 +181,16 @@ class CriterionToOQL extends CriterionConversionAbstract } } // This allow to search for complete words - if (!empty($aRawValues)) - { + if (!empty($aRawValues)) { $sValue = implode(' ', $aRawValues).' _'; - } - else - { - if ($bHasUnDefined) - { + } else { + if ($bHasUnDefined) { return "({$sRef} = '')"; } return "1"; } - if ($bHasUnDefined) - { + if ($bHasUnDefined) { return "((({$sRef} MATCHES '{$sValue}') OR ({$sRef} = '')) AND 1)"; } return "({$sRef} MATCHES '{$sValue}')"; @@ -216,10 +198,8 @@ class CriterionToOQL extends CriterionConversionAbstract protected static function EmptyToOql($oSearch, $sRef, $aCriteria) { - if (isset($aCriteria['widget'])) - { - switch ($aCriteria['widget']) - { + if (isset($aCriteria['widget'])) { + switch ($aCriteria['widget']) { case AttributeDefinition::SEARCH_WIDGET_TYPE_NUMERIC: case AttributeDefinition::SEARCH_WIDGET_TYPE_EXTERNAL_FIELD: case AttributeDefinition::SEARCH_WIDGET_TYPE_DATE: @@ -233,10 +213,8 @@ class CriterionToOQL extends CriterionConversionAbstract protected static function NotEmptyToOql($oSearch, $sRef, $aCriteria) { - if (isset($aCriteria['widget'])) - { - switch ($aCriteria['widget']) - { + if (isset($aCriteria['widget'])) { + switch ($aCriteria['widget']) { case AttributeDefinition::SEARCH_WIDGET_TYPE_NUMERIC: case AttributeDefinition::SEARCH_WIDGET_TYPE_EXTERNAL_FIELD: case AttributeDefinition::SEARCH_WIDGET_TYPE_DATE: @@ -266,71 +244,54 @@ class CriterionToOQL extends CriterionConversionAbstract $sClass = $aCriteria['class']; $aValues = self::GetValues($aCriteria); - if (count($aValues) == 0) - { + if (count($aValues) == 0) { // Ignore when nothing is selected return "1"; } $oAttDef = null; - try - { + try { $aAttributeDefs = MetaModel::ListAttributeDefs($sClass); - } catch (\CoreException $e) - { + } catch (\CoreException $e) { return "1"; } - if (array_key_exists($sAttCode, $aAttributeDefs)) - { + if (array_key_exists($sAttCode, $aAttributeDefs)) { $oAttDef = $aAttributeDefs[$sAttCode]; } // Hierarchical keys $sHierarchicalKeyCode = false; $sTargetClass = ''; - if (isset($oAttDef) && $oAttDef->IsExternalKey() && ($aCriteria['widget'] == AttributeDefinition::SEARCH_WIDGET_TYPE_HIERARCHICAL_KEY)) - { - if ($oAttDef instanceof AttributeExternalKey) - { + if (isset($oAttDef) && $oAttDef->IsExternalKey() && ($aCriteria['widget'] == AttributeDefinition::SEARCH_WIDGET_TYPE_HIERARCHICAL_KEY)) { + if ($oAttDef instanceof AttributeExternalKey) { $sTargetClass = $oAttDef->GetTargetClass(); - } - else - { + } else { /** @var AttributeExternalKey $oFinalAttDef */ $oFinalAttDef = $oAttDef->GetFinalAttDef(); $sTargetClass = $oFinalAttDef->GetTargetClass(); } - try - { + try { $sHierarchicalKeyCode = MetaModel::IsHierarchicalClass($sTargetClass); - } catch (\CoreException $e) - { + } catch (\CoreException $e) { } } $sFilterOnUndefined = ''; - if ($oAttDef instanceof AttributeEnum) - { + if ($oAttDef instanceof AttributeEnum) { $aAllowedValues = SearchForm::GetFieldAllowedValues($oAttDef); - if (array_key_exists('values', $aAllowedValues)) - { + if (array_key_exists('values', $aAllowedValues)) { // Can't invert the test if NULL is allowed - if (!$oAttDef->IsNullAllowed()) - { + if (!$oAttDef->IsNullAllowed()) { $aAllowedValues = $aAllowedValues['values']; - if (count($aValues) == count($aAllowedValues)) - { + if (count($aValues) == count($aAllowedValues)) { // All entries are selected return "1"; } // more selected values than remaining so use NOT IN - else - { - if (count($aValues) > (count($aAllowedValues) / 2)) - { - foreach($aValues as $aValue) - { + else { + if (count($aValues) > (count($aAllowedValues) / 2)) { + foreach ($aValues as $aValue) { unset($aAllowedValues[$aValue['value']]); } $sInList = implode("','", array_keys($aAllowedValues)); @@ -340,11 +301,9 @@ class CriterionToOQL extends CriterionConversionAbstract } } // search for "undefined" - for($i = 0; $i < count($aValues); $i++) - { + for ($i = 0; $i < count($aValues); $i++) { $aValue = $aValues[$i]; - if (isset($aValue['value']) && ($aValue['value'] === 'null')) - { + if (isset($aValue['value']) && ($aValue['value'] === 'null')) { $sFilterOnUndefined = "ISNULL({$sRef})"; unset($aValues[$i]); break; @@ -353,14 +312,11 @@ class CriterionToOQL extends CriterionConversionAbstract } } - if ($sHierarchicalKeyCode !== false) - { + if ($sHierarchicalKeyCode !== false) { // search for "undefined" - for($i = 0; $i < count($aValues); $i++) - { + for ($i = 0; $i < count($aValues); $i++) { $aValue = $aValues[$i]; - if (isset($aValue['value']) && ($aValue['value'] === '0')) - { + if (isset($aValue['value']) && ($aValue['value'] === '0')) { $sFilterOnUndefined = "({$sRef} = '0')"; unset($aValues[$i]); break; @@ -368,28 +324,22 @@ class CriterionToOQL extends CriterionConversionAbstract } } - $aInValues = array(); - foreach($aValues as $aValue) - { + $aInValues = []; + foreach ($aValues as $aValue) { $aInValues[] = $aValue['value']; } $sInList = implode("','", $aInValues); $sCondition = '1'; - if (count($aInValues) == 1) - { + if (count($aInValues) == 1) { $sCondition = "({$sRef} = '$sInList')"; - } - elseif (count($aInValues) > 1) - { + } elseif (count($aInValues) > 1) { $sCondition = "({$sRef} IN ('$sInList'))"; } // Hierarchical keys - try - { - if (($sHierarchicalKeyCode !== false) && ($oSearch instanceof DBObjectSearch)) - { + try { + if (($sHierarchicalKeyCode !== false) && ($oSearch instanceof DBObjectSearch)) { // NOTE: The hierarchy does not work for unions for now. It'll be done with the full support of unions in search. // Add all the joins for hierarchical key $oFilter = new DBObjectSearch($sTargetClass); @@ -404,22 +354,17 @@ class CriterionToOQL extends CriterionConversionAbstract // Use the 'below' operator by default $oSearch->AddCondition_PointingTo($oHKFilter, $sAttCode); $oCriteria = $oSearch->GetCriteria(); - $aArgs = MetaModel::PrepareQueryArguments(array(), $oSearch->GetInternalParams(), $oSearch->GetExpectedArguments() ); + $aArgs = MetaModel::PrepareQueryArguments([], $oSearch->GetInternalParams(), $oSearch->GetExpectedArguments()); $oSearch->ResetCondition(); $sCondition = $oCriteria->RenderExpression(false, $aArgs); } - } catch (Exception $e) - { + } catch (Exception $e) { } - if (!empty($sFilterOnUndefined)) - { - if (count($aValues) === 0) - { + if (!empty($sFilterOnUndefined)) { + if (count($aValues) === 0) { $sCondition = $sFilterOnUndefined; - } - else - { + } else { // Add 'AND 1' to group the 'OR' inside an AND list for OQL parsing $sCondition = "(({$sCondition} OR {$sFilterOnUndefined}) AND 1)"; } @@ -430,55 +375,44 @@ class CriterionToOQL extends CriterionConversionAbstract protected static function BetweenDatesToOql($oSearch, $sRef, $aCriteria) { - $aOQL = array(); + $aOQL = []; $aValues = self::GetValues($aCriteria); - if (count($aValues) != 2) - { + if (count($aValues) != 2) { return "1"; } $sWidget = $aCriteria['widget']; - if ($sWidget == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE_TIME) - { + if ($sWidget == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE_TIME) { $sAttributeClass = AttributeDateTime::class; - } - else - { + } else { $sAttributeClass = AttributeDate::class; } $oFormat = $sAttributeClass::GetFormat(); $sStartDate = $aValues[0]['value']; - if (!empty($sStartDate)) - { - try - { + if (!empty($sStartDate)) { + try { $oDate = $oFormat->parse($sStartDate); $sStartDate = $oDate->format($sAttributeClass::GetSQLFormat()); $aOQL[] = "({$sRef} >= '$sStartDate')"; - } catch (Exception $e) - { + } catch (Exception $e) { } } $sEndDate = $aValues[1]['value']; - if (!empty($sEndDate)) - { - try - { + if (!empty($sEndDate)) { + try { $oDate = $oFormat->parse($sEndDate); $sEndDate = $oDate->format($sAttributeClass::GetSQLFormat()); $aOQL[] = "({$sRef} <= '$sEndDate')"; - } catch (Exception $e) - { + } catch (Exception $e) { } } $sOQL = implode(' AND ', $aOQL); - if (empty($sOQL)) - { + if (empty($sOQL)) { $sOQL = "1"; } @@ -495,41 +429,30 @@ class CriterionToOQL extends CriterionConversionAbstract */ protected static function BetweenToOql($oSearch, $sRef, $aCriteria) { - $aOQL = array(); + $aOQL = []; $aValues = self::GetValues($aCriteria); - if (count($aValues) != 2) - { + if (count($aValues) != 2) { return "1"; } - if (isset($aValues[0]['value'])) - { + if (isset($aValues[0]['value'])) { $sStartNum = trim($aValues[0]['value']); - if (is_numeric($sStartNum)) - { + if (is_numeric($sStartNum)) { $aOQL[] = "({$sRef} >= '$sStartNum')"; - } - else - { - if (!empty($sStartNum)) - { + } else { + if (!empty($sStartNum)) { throw new AjaxSearchException("'$sStartNum' is not a numeric value", 400); } } } - if (isset($aValues[1]['value'])) - { + if (isset($aValues[1]['value'])) { $sEndNum = trim($aValues[1]['value']); - if (is_numeric($sEndNum)) - { + if (is_numeric($sEndNum)) { $aOQL[] = "({$sRef} <= '$sEndNum')"; - } - else - { - if (!empty($sEndNum)) - { + } else { + if (!empty($sEndNum)) { throw new AjaxSearchException("'$sEndNum' is not a numeric value", 400); } } @@ -537,15 +460,13 @@ class CriterionToOQL extends CriterionConversionAbstract $sOQL = implode(' AND ', $aOQL); - if (empty($sOQL)) - { + if (empty($sOQL)) { $sOQL = "1"; } return $sOQL; } - protected static function AllToOql($oSearch, $sRef, $aCriteria) { return "1"; diff --git a/sources/Application/Search/CriterionConversion/criteriontosearchform.class.inc.php b/sources/Application/Search/CriterionConversion/criteriontosearchform.class.inc.php index 84b7101d2..7fe9c2745 100644 --- a/sources/Application/Search/CriterionConversion/criteriontosearchform.class.inc.php +++ b/sources/Application/Search/CriterionConversion/criteriontosearchform.class.inc.php @@ -1,4 +1,5 @@ 'TextToSearchForm', AttributeDefinition::SEARCH_WIDGET_TYPE_EXTERNAL_FIELD => 'ExternalFieldToSearchForm', AttributeDefinition::SEARCH_WIDGET_TYPE_DATE => 'DateTimeToSearchForm', @@ -77,112 +73,87 @@ class CriterionToSearchForm extends CriterionConversionAbstract AttributeDefinition::SEARCH_WIDGET_TYPE_ENUM => 'EnumToSearchForm', AttributeDefinition::SEARCH_WIDGET_TYPE_SET => 'SetToSearchForm', AttributeDefinition::SEARCH_WIDGET_TYPE_TAG_SET => 'TagSetToSearchForm', - ); + ]; - foreach($aAndCriterionRaw as $aCriteria) - { - if (isset($aCriteria['label'])) - { + foreach ($aAndCriterionRaw as $aCriteria) { + if (isset($aCriteria['label'])) { $aCriteria['label'] = preg_replace("@\)$@", '', $aCriteria['label']); $aCriteria['label'] = preg_replace("@^\(@", '', $aCriteria['label']); } $aCriteria['is_removable'] = $bIsRemovable; $sClass = ''; - if (isset($aCriteria['ref'])) - { + if (isset($aCriteria['ref'])) { $aRef = explode('.', $aCriteria['ref']); - if (isset($aClasses[$aRef[0]])) - { + if (isset($aClasses[$aRef[0]])) { $sClass = $aClasses[$aRef[0]]; $aCriteria['class'] = $sClass; } } // Check criteria validity - if (!isset($aCriteria['ref']) || !isset($aAllFields[$aCriteria['ref']])) - { + if (!isset($aCriteria['ref']) || !isset($aAllFields[$aCriteria['ref']])) { $aCriteria['widget'] = AttributeDefinition::SEARCH_WIDGET_TYPE_RAW; $aCriteria['label'] = Dict::S('UI:Search:Criteria:Raw:Filtered'); - if (isset($aCriteria['ref'])) - { - try - { + if (isset($aCriteria['ref'])) { + try { $aCriteria['label'] = Dict::Format('UI:Search:Criteria:Raw:FilteredOn', MetaModel::GetName($sClass)); - } - catch (Exception $e) - { + } catch (Exception $e) { } } } - if (array_key_exists('widget', $aCriteria)) - { - if (array_key_exists($aCriteria['widget'], $aMappingOperatorToFunction)) - { + if (array_key_exists('widget', $aCriteria)) { + if (array_key_exists($aCriteria['widget'], $aMappingOperatorToFunction)) { $sFct = $aMappingOperatorToFunction[$aCriteria['widget']]; $aAndCriterion = array_merge($aAndCriterion, self::$sFct($aCriteria, $aAllFields)); - } - else - { + } else { $aAndCriterion[] = $aCriteria; } } } // Regroup criterion by variable name (no ref first) - usort($aAndCriterion, function ($a, $b) - { - if (array_key_exists('ref', $a) || array_key_exists('ref', $b)) - { - if (array_key_exists('ref', $a) && array_key_exists('ref', $b)) - { + usort($aAndCriterion, function ($a, $b) { + if (array_key_exists('ref', $a) || array_key_exists('ref', $b)) { + if (array_key_exists('ref', $a) && array_key_exists('ref', $b)) { $iRefCmp = strcmp($a['ref'], $b['ref']); - if ($iRefCmp != 0) - { + if ($iRefCmp != 0) { return $iRefCmp; } return strcmp($a['operator'], $b['operator']); } - if (array_key_exists('ref', $a)) - { + if (array_key_exists('ref', $a)) { return 1; } return -1; } - if (array_key_exists('oql', $a) && array_key_exists('oql', $b)) - { + if (array_key_exists('oql', $a) && array_key_exists('oql', $b)) { return strcmp($a['oql'], $b['oql']); } return 0; }); - $aMergeFctByWidget = array( + $aMergeFctByWidget = [ AttributeDefinition::SEARCH_WIDGET_TYPE_DATE => 'MergeDate', AttributeDefinition::SEARCH_WIDGET_TYPE_DATE_TIME => 'MergeDateTime', AttributeDefinition::SEARCH_WIDGET_TYPE_NUMERIC => 'MergeNumeric', AttributeDefinition::SEARCH_WIDGET_TYPE_ENUM => 'MergeEnumExtKeys', AttributeDefinition::SEARCH_WIDGET_TYPE_EXTERNAL_KEY => 'MergeEnumExtKeys', - ); + ]; $aPrevCriterion = null; - $aMergedCriterion = array(); - foreach($aAndCriterion as $aCurrCriterion) - { - if (!is_null($aPrevCriterion)) - { - if (array_key_exists('ref', $aPrevCriterion) && array_key_exists('widget', $aPrevCriterion)) - { + $aMergedCriterion = []; + foreach ($aAndCriterion as $aCurrCriterion) { + if (!is_null($aPrevCriterion)) { + if (array_key_exists('ref', $aPrevCriterion) && array_key_exists('widget', $aPrevCriterion)) { // If previous has ref, the current has ref as the array is sorted with all without ref first - if (($aPrevCriterion['ref'] == $aCurrCriterion['ref']) && ($aPrevCriterion['widget'] == $aCurrCriterion['widget'])) - { + if (($aPrevCriterion['ref'] == $aCurrCriterion['ref']) && ($aPrevCriterion['widget'] == $aCurrCriterion['widget'])) { // Same attribute, try to merge - if (array_key_exists('widget', $aCurrCriterion)) - { - if (array_key_exists($aCurrCriterion['widget'], $aMergeFctByWidget)) - { + if (array_key_exists('widget', $aCurrCriterion)) { + if (array_key_exists($aCurrCriterion['widget'], $aMergeFctByWidget)) { $sFct = $aMergeFctByWidget[$aCurrCriterion['widget']]; $aPrevCriterion = self::$sFct($aPrevCriterion, $aCurrCriterion, $aMergedCriterion); continue; @@ -195,44 +166,35 @@ class CriterionToSearchForm extends CriterionConversionAbstract $aPrevCriterion = $aCurrCriterion; } - if (!is_null($aPrevCriterion)) - { + if (!is_null($aPrevCriterion)) { $aMergedCriterion[] = $aPrevCriterion; } // Sort by label criterion by variable name (no ref first) - usort($aMergedCriterion, function ($a, $b) - { + usort($aMergedCriterion, function ($a, $b) { if (($a['widget'] === AttributeDefinition::SEARCH_WIDGET_TYPE_RAW) || - ($b['widget'] === AttributeDefinition::SEARCH_WIDGET_TYPE_RAW)) - { + ($b['widget'] === AttributeDefinition::SEARCH_WIDGET_TYPE_RAW)) { if (($a['widget'] === AttributeDefinition::SEARCH_WIDGET_TYPE_RAW) && - ($b['widget'] === AttributeDefinition::SEARCH_WIDGET_TYPE_RAW)) - { - if (!isset($a['label'])) - { + ($b['widget'] === AttributeDefinition::SEARCH_WIDGET_TYPE_RAW)) { + if (!isset($a['label'])) { return -1; } - if (!isset($b['label'])) - { + if (!isset($b['label'])) { return 1; } return strcmp($a['label'], $b['label']); } - if ($a['widget'] === AttributeDefinition::SEARCH_WIDGET_TYPE_RAW) - { + if ($a['widget'] === AttributeDefinition::SEARCH_WIDGET_TYPE_RAW) { return -1; } return 1; } - if (!isset($a['label'])) - { + if (!isset($a['label'])) { return -1; } - if (!isset($b['label'])) - { + if (!isset($b['label'])) { return 1; } return strcmp($a['label'], $b['label']); @@ -253,8 +215,7 @@ class CriterionToSearchForm extends CriterionConversionAbstract { $sPrevOperator = $aPrevCriterion['operator']; $sCurrOperator = $aCurrCriterion['operator']; - if (($sPrevOperator != '<=') || ($sCurrOperator != '>=')) - { + if (($sPrevOperator != '<=') || ($sCurrOperator != '>=')) { $aMergedCriterion[] = $aPrevCriterion; return $aCurrCriterion; @@ -274,9 +235,9 @@ class CriterionToSearchForm extends CriterionConversionAbstract $sFirstDateValue = $oDate->format(AttributeDate::GetSQLFormat()); $sFirstDateLabel = $oFormat->format($oDate); - $aCurrCriterion['values'] = array(); - $aCurrCriterion['values'][] = array('value' => $sFirstDateValue, 'label' => $sFirstDateLabel); - $aCurrCriterion['values'][] = array('value' => $sLastDateValue, 'label' => $sLastDateLabel); + $aCurrCriterion['values'] = []; + $aCurrCriterion['values'][] = ['value' => $sFirstDateValue, 'label' => $sFirstDateLabel]; + $aCurrCriterion['values'][] = ['value' => $sLastDateValue, 'label' => $sLastDateLabel]; $aCurrCriterion['oql'] = "({$aPrevCriterion['oql']} AND {$aCurrCriterion['oql']})"; $aCurrCriterion['label'] = $aPrevCriterion['label'].' '.Dict::S('Expression:Operator:AND', 'AND').' '.$aCurrCriterion['label']; @@ -298,8 +259,7 @@ class CriterionToSearchForm extends CriterionConversionAbstract { $sPrevOperator = $aPrevCriterion['operator']; $sCurrOperator = $aCurrCriterion['operator']; - if (($sPrevOperator != '<=') || ($sCurrOperator != '>=')) - { + if (($sPrevOperator != '<=') || ($sCurrOperator != '>=')) { $aMergedCriterion[] = $aPrevCriterion; return $aCurrCriterion; @@ -318,13 +278,15 @@ class CriterionToSearchForm extends CriterionConversionAbstract $sFirstDateValue = $oDate->format(AttributeDateTime::GetSQLFormat()); $sFirstDateLabel = AttributeDateTime::GetFormat()->Format($sFirstDateValue); - $aCurrCriterion['values'] = array(); - $aCurrCriterion['values'][] = array('value' => $sFirstDateValue, 'label' => $sFirstDateLabel); - $aCurrCriterion['values'][] = array('value' => $sLastDateValue, 'label' => $sLastDateLabel); + $aCurrCriterion['values'] = []; + $aCurrCriterion['values'][] = ['value' => $sFirstDateValue, 'label' => $sFirstDateLabel]; + $aCurrCriterion['values'][] = ['value' => $sLastDateValue, 'label' => $sLastDateLabel]; $aCurrCriterion['oql'] = "({$aPrevCriterion['oql']} AND {$aCurrCriterion['oql']})"; - $aCurrCriterion['label'] = $aPrevCriterion['label'].' '.Dict::S('Expression:Operator:AND', - 'AND').' '.$aCurrCriterion['label']; + $aCurrCriterion['label'] = $aPrevCriterion['label'].' '.Dict::S( + 'Expression:Operator:AND', + 'AND' + ).' '.$aCurrCriterion['label']; $aMergedCriterion[] = $aCurrCriterion; @@ -343,8 +305,7 @@ class CriterionToSearchForm extends CriterionConversionAbstract { $sPrevOperator = $aPrevCriterion['operator']; $sCurrOperator = $aCurrCriterion['operator']; - if (($sPrevOperator != '<=') || ($sCurrOperator != '>=')) - { + if (($sPrevOperator != '<=') || ($sCurrOperator != '>=')) { $aMergedCriterion[] = $aPrevCriterion; return $aCurrCriterion; @@ -353,9 +314,9 @@ class CriterionToSearchForm extends CriterionConversionAbstract // Merge into 'between' operation. $sLastNum = $aPrevCriterion['values'][0]['value']; $sFirstNum = $aCurrCriterion['values'][0]['value']; - $aCurrCriterion['values'] = array(); - $aCurrCriterion['values'][] = array('value' => $sFirstNum, 'label' => "$sFirstNum"); - $aCurrCriterion['values'][] = array('value' => $sLastNum, 'label' => "$sLastNum"); + $aCurrCriterion['values'] = []; + $aCurrCriterion['values'][] = ['value' => $sFirstNum, 'label' => "$sFirstNum"]; + $aCurrCriterion['values'][] = ['value' => $sLastNum, 'label' => "$sLastNum"]; $aCurrCriterion['oql'] = "({$aPrevCriterion['oql']} AND {$aCurrCriterion['oql']})"; $aCurrCriterion['label'] = $aPrevCriterion['label'].' '.Dict::S('Expression:Operator:AND', 'AND').' '.$aCurrCriterion['label']; @@ -368,9 +329,8 @@ class CriterionToSearchForm extends CriterionConversionAbstract private static function SerializeValues($aValues) { - $aSerializedValues = array(); - foreach($aValues as $aValue) - { + $aSerializedValues = []; + foreach ($aValues as $aValue) { $aSerializedValues[] = serialize($aValue); } @@ -397,8 +357,7 @@ class CriterionToSearchForm extends CriterionConversionAbstract $bStartWithPercent = substr($sValue, 0, 1) == '%' ? true : false; $bEndWithPercent = substr($sValue, -1) == '%' ? true : false; - switch (true) - { + switch (true) { case ('' == $sValue and ($sOperator == '=' or $sOperator == 'LIKE')): $aCriteria['operator'] = CriterionConversionAbstract::OP_EMPTY; break; @@ -425,7 +384,7 @@ class CriterionToSearchForm extends CriterionConversionAbstract break; } - return array($aCriteria); + return [$aCriteria]; } protected static function ExternalFieldToSearchForm($aCriteria, $aFields) @@ -436,8 +395,7 @@ class CriterionToSearchForm extends CriterionConversionAbstract $bStartWithPercent = substr($sValue, 0, 1) == '%' ? true : false; $bEndWithPercent = substr($sValue, -1) == '%' ? true : false; - switch (true) - { + switch (true) { case ($sOperator == 'ISNULL'): case ('' == $sValue and ($sOperator == 'LIKE')): $aCriteria['operator'] = CriterionConversionAbstract::OP_EMPTY; @@ -465,59 +423,44 @@ class CriterionToSearchForm extends CriterionConversionAbstract break; } - return array($aCriteria); + return [$aCriteria]; } protected static function DateTimeToSearchForm($aCriterion, $aFields) { if ((!array_key_exists('is_relative', $aCriterion) || !$aCriterion['is_relative']) - && (!isset($aCriterion['unit']) || ($aCriterion['unit'] == 'DAY'))) - { + && (!isset($aCriterion['unit']) || ($aCriterion['unit'] == 'DAY'))) { // Convert '=' in 'between' - if (isset($aCriterion['operator'])) - { - switch ($aCriterion['operator']) - { + if (isset($aCriterion['operator'])) { + switch ($aCriterion['operator']) { case '=': - if (isset($aCriterion['has_undefined']) && (isset($aCriterion['values'][0]['value']) && ($aCriterion['values'][0]['value'] == 0))) - { + if (isset($aCriterion['has_undefined']) && (isset($aCriterion['values'][0]['value']) && ($aCriterion['values'][0]['value'] == 0))) { // Special case for NOT EMPTY $aCriterion['operator'] = CriterionConversionAbstract::OP_NOT_EMPTY; - } - else - { + } else { $aCriterion['operator'] = CriterionConversionAbstract::OP_BETWEEN_DATES; $sWidget = $aCriterion['widget']; - if ($sWidget == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE) - { + if ($sWidget == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE) { $aCriterion['values'][1] = $aCriterion['values'][0]; - } - else - { + } else { $sDate = $aCriterion['values'][0]['value']; $oDate = new DateTime($sDate); $sFirstDateValue = $oDate->format(AttributeDateTime::GetSQLFormat()); - try - { + try { $sFirstDateLabel = AttributeDateTime::GetFormat()->Format($sFirstDateValue); - $aCriterion['values'][0] = array('value' => $sFirstDateValue, 'label' => "$sFirstDateLabel"); - } - catch (Exception $e) - { + $aCriterion['values'][0] = ['value' => $sFirstDateValue, 'label' => "$sFirstDateLabel"]; + } catch (Exception $e) { } $oDate->add(DateInterval::createFromDateString('1 day')); $oDate->sub(DateInterval::createFromDateString('1 second')); $sLastDateValue = $oDate->format(AttributeDateTime::GetSQLFormat()); - try - { + try { $sLastDateLabel = AttributeDateTime::GetFormat()->Format($sLastDateValue); - $aCriterion['values'][1] = array('value' => $sLastDateValue, 'label' => "$sLastDateLabel"); - } - catch (Exception $e) - { + $aCriterion['values'][1] = ['value' => $sLastDateValue, 'label' => "$sLastDateLabel"]; + } catch (Exception $e) { } } } @@ -530,13 +473,10 @@ class CriterionToSearchForm extends CriterionConversionAbstract case '>': $aCriterion['operator'] = '>='; $sWidget = $aCriterion['widget']; - if ($sWidget == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE) - { + if ($sWidget == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE) { $sDelta = '1 day'; $sAttributeClass = AttributeDate::class; - } - else - { + } else { $sDelta = '1 second'; $sAttributeClass = AttributeDateTime::class; } @@ -547,23 +487,20 @@ class CriterionToSearchForm extends CriterionConversionAbstract $oDate = new DateTime($sFirstDate); $oDate->add(DateInterval::createFromDateString($sDelta)); $sFirstDateValue = $oDate->format($sAttributeClass::GetSQLFormat()); - try - { + try { $sFirstDateLabel = $oFormat->format($oDate); - $aCriterion['values'][0] = array('value' => $sFirstDateValue, 'label' => $sFirstDateLabel); - } catch (Exception $e) {} + $aCriterion['values'][0] = ['value' => $sFirstDateValue, 'label' => $sFirstDateLabel]; + } catch (Exception $e) { + } break; case '<': $aCriterion['operator'] = '<='; $sWidget = $aCriterion['widget']; - if ($sWidget == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE) - { + if ($sWidget == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE) { $sDelta = '1 day'; $sAttributeClass = AttributeDate::class; - } - else - { + } else { $sDelta = '1 second'; $sAttributeClass = AttributeDateTime::class; } @@ -574,26 +511,23 @@ class CriterionToSearchForm extends CriterionConversionAbstract $oDate = new DateTime($sFirstDate); $oDate->sub(DateInterval::createFromDateString($sDelta)); $sFirstDateValue = $oDate->format($sAttributeClass::GetSQLFormat()); - try - { + try { $sFirstDateLabel = $oFormat->format($oDate); - $aCriterion['values'][0] = array('value' => $sFirstDateValue, 'label' => $sFirstDateLabel); - } catch (Exception $e) {} + $aCriterion['values'][0] = ['value' => $sFirstDateValue, 'label' => $sFirstDateLabel]; + } catch (Exception $e) { + } break; } } - return array($aCriterion); + return [$aCriterion]; } - if (isset($aCriterion['values'][0]['value'])) - { + if (isset($aCriterion['values'][0]['value'])) { $sLabel = $aCriterion['values'][0]['value']; - if (isset($aCriterion['verb'])) - { - switch ($aCriterion['verb']) - { + if (isset($aCriterion['verb'])) { + switch ($aCriterion['verb']) { case 'DATE_SUB': $sLabel = '-'.$sLabel; break; @@ -602,8 +536,7 @@ class CriterionToSearchForm extends CriterionConversionAbstract break; } } - if (isset($aCriterion['unit'])) - { + if (isset($aCriterion['unit'])) { $sLabel .= Dict::S('Expression:Unit:Short:'.$aCriterion['unit'], $aCriterion['unit']); } $aCriterion['values'][0]['label'] = "$sLabel"; @@ -612,34 +545,31 @@ class CriterionToSearchForm extends CriterionConversionAbstract // Temporary until the JS widget support relative dates $aCriterion['widget'] = AttributeDefinition::SEARCH_WIDGET_TYPE_RAW; - return array($aCriterion); + return [$aCriterion]; } protected static function NumericToSearchForm($aCriteria, $aFields) { - switch ($aCriteria['operator']) - { - case 'ISNULL': + switch ($aCriteria['operator']) { + case 'ISNULL': $aCriteria['operator'] = CriterionConversionAbstract::OP_EMPTY; break; case '=': - if (isset($aCriteria['has_undefined']) && (isset($aCriteria['values'][0]['value']) && ($aCriteria['values'][0]['value'] == 0))) - { + if (isset($aCriteria['has_undefined']) && (isset($aCriteria['values'][0]['value']) && ($aCriteria['values'][0]['value'] == 0))) { // Special case for NOT EMPTY $aCriteria['operator'] = CriterionConversionAbstract::OP_NOT_EMPTY; } break; } - return array($aCriteria); + return [$aCriteria]; } protected static function EnumToSearchForm($aCriteria, $aFields) { $sOperator = $aCriteria['operator']; - switch ($sOperator) - { + switch ($sOperator) { case '=': // Same as IN $aCriteria['operator'] = CriterionConversionAbstract::OP_IN; @@ -657,14 +587,12 @@ class CriterionToSearchForm extends CriterionConversionAbstract case 'ISNULL': // Special case when undefined and/or other values are selected $aCriteria['operator'] = CriterionConversionAbstract::OP_IN; - if (isset($aCriteria['has_undefined']) && $aCriteria['has_undefined']) - { - if (!isset($aCriteria['values'])) - { - $aCriteria['values'] = array(); + if (isset($aCriteria['has_undefined']) && $aCriteria['has_undefined']) { + if (!isset($aCriteria['values'])) { + $aCriteria['values'] = []; } // Convention for 'undefined' enums - $aCriteria['values'][] = array('value' => 'null', 'label' => Dict::S('Enum:Undefined')); + $aCriteria['values'][] = ['value' => 'null', 'label' => Dict::S('Enum:Undefined')]; } break; default: @@ -673,58 +601,49 @@ class CriterionToSearchForm extends CriterionConversionAbstract break; } - return array($aCriteria); + return [$aCriteria]; } protected static function TagSetToSearchForm($aCriteria, $aFields) { - $aCriterion = array($aCriteria); + $aCriterion = [$aCriteria]; $sOperator = $aCriteria['operator']; - switch ($sOperator) - { + switch ($sOperator) { case 'MATCHES': // Nothing special to do - if (isset($aCriteria['has_undefined']) && $aCriteria['has_undefined']) - { - if (!isset($aCriteria['values'])) - { - $aCriteria['values'] = array(); + if (isset($aCriteria['has_undefined']) && $aCriteria['has_undefined']) { + if (!isset($aCriteria['values'])) { + $aCriteria['values'] = []; } // Convention for 'undefined' tag set - $aCriteria['values'][] = array('value' => '', 'label' => Dict::S('Enum:Undefined')); + $aCriteria['values'][] = ['value' => '', 'label' => Dict::S('Enum:Undefined')]; } break; case 'OR': case 'ISNULL': $aCriteria['operator'] = CriterionConversionAbstract::OP_EQUALS; - if (isset($aCriteria['has_undefined']) && $aCriteria['has_undefined']) - { - if (!isset($aCriteria['values'])) - { - $aCriteria['values'] = array(); + if (isset($aCriteria['has_undefined']) && $aCriteria['has_undefined']) { + if (!isset($aCriteria['values'])) { + $aCriteria['values'] = []; } // Convention for 'undefined' tag set - $aCriteria['values'][] = array('value' => '', 'label' => Dict::S('Enum:Undefined')); + $aCriteria['values'][] = ['value' => '', 'label' => Dict::S('Enum:Undefined')]; } break; case '=': $aCriteria['operator'] = CriterionConversionAbstract::OP_MATCHES; - if (isset($aCriteria['has_undefined']) && $aCriteria['has_undefined']) - { - $aCriteria['values'] = array(); + if (isset($aCriteria['has_undefined']) && $aCriteria['has_undefined']) { + $aCriteria['values'] = []; // Convention for 'undefined' tag set - $aCriteria['values'][] = array('value' => '', 'label' => Dict::S('Enum:Undefined')); - } - else - { + $aCriteria['values'][] = ['value' => '', 'label' => Dict::S('Enum:Undefined')]; + } else { // Split values into a list of Matches - $aCriterion = array(); + $aCriterion = []; $aValues = $aCriteria['values']; - foreach($aValues as $aValue) - { - $aCriteria['values'] = array($aValue); + foreach ($aValues as $aValue) { + $aCriteria['values'] = [$aValue]; $aCriterion[] = $aCriteria; } } @@ -741,14 +660,13 @@ class CriterionToSearchForm extends CriterionConversionAbstract protected static function SetToSearchForm($aCriteria, $aFields) { $aCriteria['widget'] = AttributeDefinition::SEARCH_WIDGET_TYPE_RAW; - return array($aCriteria); + return [$aCriteria]; } protected static function ExternalKeyToSearchForm($aCriteria, $aFields) { $sOperator = $aCriteria['operator']; - switch ($sOperator) - { + switch ($sOperator) { case '=': // Same as IN $aCriteria['operator'] = CriterionConversionAbstract::OP_IN; @@ -763,7 +681,7 @@ class CriterionToSearchForm extends CriterionConversionAbstract break; } - return array($aCriteria); + return [$aCriteria]; } /** @@ -776,32 +694,25 @@ class CriterionToSearchForm extends CriterionConversionAbstract { $sRef = $aCriteria['ref']; $aValues = $aCriteria['values']; - if (array_key_exists($sRef, $aFields)) - { + if (array_key_exists($sRef, $aFields)) { $aField = $aFields[$sRef]; - if (array_key_exists('allowed_values', $aField) && array_key_exists('values', $aField['allowed_values'])) - { + if (array_key_exists('allowed_values', $aField) && array_key_exists('values', $aField['allowed_values'])) { $aAllowedValues = $aField['allowed_values']['values']; - } - else - { + } else { // Can't obtain the list of allowed values, just set as unknown $aCriteria['widget'] = AttributeDefinition::SEARCH_WIDGET_TYPE_RAW; } } - if (isset($aAllowedValues)) - { - foreach($aValues as $aValue) - { + if (isset($aAllowedValues)) { + foreach ($aValues as $aValue) { $sValue = $aValue['value']; unset($aAllowedValues[$sValue]); } - $aCriteria['values'] = array(); + $aCriteria['values'] = []; - foreach($aAllowedValues as $sValue => $sLabel) - { - $aValue = array('value' => $sValue, 'label' => "$sLabel"); + foreach ($aAllowedValues as $sValue => $sLabel) { + $aValue = ['value' => $sValue, 'label' => "$sLabel"]; $aCriteria['values'][] = $aValue; } $aCriteria['operator'] = 'IN'; diff --git a/sources/Application/Search/ajaxsearchexception.class.inc.php b/sources/Application/Search/ajaxsearchexception.class.inc.php index 9a5b1d85c..5f08fcba8 100644 --- a/sources/Application/Search/ajaxsearchexception.class.inc.php +++ b/sources/Application/Search/ajaxsearchexception.class.inc.php @@ -1,4 +1,5 @@ AddConditionExpression($oHiddenCriteriaExpression); } - if (empty($aExpression)) - { + if (empty($aExpression)) { return $oSearch; } @@ -78,8 +72,7 @@ class CriterionParser $oSearch->AddConditionExpression($oExpression); return $oSearch; - } catch (OQLException $e) - { + } catch (OQLException $e) { IssueLog::Error($e->getMessage()); } return null; @@ -87,22 +80,19 @@ class CriterionParser private static function ParseAndList($oSearch, $aAnd) { - $aExpression = array(); - foreach($aAnd as $aCriteria) - { + $aExpression = []; + foreach ($aAnd as $aCriteria) { $sExpression = CriterionToOQL::Convert($oSearch, $aCriteria); - if ($sExpression !== '1') - { + if ($sExpression !== '1') { $aExpression[] = $sExpression; } } - if (empty($aExpression)) - { + if (empty($aExpression)) { return '1'; } return '('.implode(" AND ", $aExpression).')'; } -} \ No newline at end of file +} diff --git a/sources/Application/Search/searchform.class.inc.php b/sources/Application/Search/searchform.class.inc.php index b01ce94ec..64cf2d3f3 100644 --- a/sources/Application/Search/searchform.class.inc.php +++ b/sources/Application/Search/searchform.class.inc.php @@ -1,13 +1,12 @@ AddUiBlock($this->GetSearchFormUIBlock($oPage, $oSet, $aExtraParams)); return ''; } - public function GetSearchFormUIBlock(WebPage $oPage, DBObjectSet $oSet, $aExtraParams = array()) + public function GetSearchFormUIBlock(WebPage $oPage, DBObjectSet $oSet, $aExtraParams = []) { $oUiBlock = new UIContentBlock(); $oUiBlock->AddMultipleJsFilesRelPaths([ @@ -76,10 +75,9 @@ class SearchForm $oAppContext = new ApplicationContext(); $sClassName = $oSet->GetFilter()->GetClass(); - $aListParams = array(); + $aListParams = []; - foreach($aExtraParams as $key => $value) - { + foreach ($aExtraParams as $key => $value) { $aListParams[$key] = $value; } @@ -127,7 +125,7 @@ class SearchForm } else { $aSubClasses = MetaModel::GetSubclasses($sRootClass); if (count($aSubClasses) > 0) { - $aOptions = array(); + $aOptions = []; $aOptions[MetaModel::GetName($sRootClass)] = "
      '); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Input/AbstractInput.php b/sources/Application/UI/Base/Component/Input/AbstractInput.php index ccbb1525e..a7857d3b6 100644 --- a/sources/Application/UI/Base/Component/Input/AbstractInput.php +++ b/sources/Application/UI/Base/Component/Input/AbstractInput.php @@ -1,4 +1,5 @@ bShowFilename; } - -} \ No newline at end of file + +} diff --git a/sources/Application/UI/Base/Component/Input/FileSelect/FileSelectUIBlockFactory.php b/sources/Application/UI/Base/Component/Input/FileSelect/FileSelectUIBlockFactory.php index 902375988..b41718fea 100644 --- a/sources/Application/UI/Base/Component/Input/FileSelect/FileSelectUIBlockFactory.php +++ b/sources/Application/UI/Base/Component/Input/FileSelect/FileSelectUIBlockFactory.php @@ -1,13 +1,12 @@ sLabel); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Input/InputUIBlockFactory.php b/sources/Application/UI/Base/Component/Input/InputUIBlockFactory.php index 534b12406..22e259c19 100644 --- a/sources/Application/UI/Base/Component/Input/InputUIBlockFactory.php +++ b/sources/Application/UI/Base/Component/Input/InputUIBlockFactory.php @@ -1,13 +1,12 @@ SetType($sInputType); $oInput->SetValue($sInputValue); @@ -109,4 +110,4 @@ class InputUIBlockFactory extends AbstractUIBlockFactory return new InputWithLabel($sLabel, $oInput, $sId); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Input/InputWithLabel.php b/sources/Application/UI/Base/Component/Input/InputWithLabel.php index b2d3d1cf1..ee5d3b71f 100644 --- a/sources/Application/UI/Base/Component/Input/InputWithLabel.php +++ b/sources/Application/UI/Base/Component/Input/InputWithLabel.php @@ -1,13 +1,12 @@ oInput->GetId() => $this->oInput]; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Input/RichText/RichText.php b/sources/Application/UI/Base/Component/Input/RichText/RichText.php index ba3a1c217..a6102f112 100644 --- a/sources/Application/UI/Base/Component/Input/RichText/RichText.php +++ b/sources/Application/UI/Base/Component/Input/RichText/RichText.php @@ -1,9 +1,12 @@ sValue = $sValue; - if(is_array($this->aConfig)) { + if (is_array($this->aConfig)) { $this->aConfig['detectChanges'] = ['initialValue' => $sValue]; } @@ -111,4 +114,4 @@ class RichText extends UIBlock { return $this->aConfig; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Input/Select/Select.php b/sources/Application/UI/Base/Component/Input/Select/Select.php index 9b1c2028a..4d2ba01ba 100644 --- a/sources/Application/UI/Base/Component/Input/Select/Select.php +++ b/sources/Application/UI/Base/Component/Input/Select/Select.php @@ -1,13 +1,12 @@ bSelected = $bSelected; return $this; - } - + } + /** * @return bool */ @@ -101,4 +100,4 @@ class SelectOption extends UIBlock return $this; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Input/Select/SelectOptionUIBlockFactory.php b/sources/Application/UI/Base/Component/Input/Select/SelectOptionUIBlockFactory.php index adffb6e17..803e85b8b 100644 --- a/sources/Application/UI/Base/Component/Input/Select/SelectOptionUIBlockFactory.php +++ b/sources/Application/UI/Base/Component/Input/Select/SelectOptionUIBlockFactory.php @@ -1,13 +1,12 @@ GetType() === iDataProvider::TYPE_SIMPLE_PROVIDER; } - -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Input/Set/DataProvider/AjaxDataProvider.php b/sources/Application/UI/Base/Component/Input/Set/DataProvider/AjaxDataProvider.php index 5345ff53c..137e7f79b 100644 --- a/sources/Application/UI/Base/Component/Input/Set/DataProvider/AjaxDataProvider.php +++ b/sources/Application/UI/Base/Component/Input/Set/DataProvider/AjaxDataProvider.php @@ -1,4 +1,5 @@ iMaxResults; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Input/Set/DataProvider/AjaxDataProviderForOQL.php b/sources/Application/UI/Base/Component/Input/Set/DataProvider/AjaxDataProviderForOQL.php index bb6f56080..652d9e121 100644 --- a/sources/Application/UI/Base/Component/Input/Set/DataProvider/AjaxDataProviderForOQL.php +++ b/sources/Application/UI/Base/Component/Input/Set/DataProvider/AjaxDataProviderForOQL.php @@ -1,4 +1,5 @@ SetDataSearchFields(['friendlyname', 'additional_field']); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Input/Set/DataProvider/SimpleDataProvider.php b/sources/Application/UI/Base/Component/Input/Set/DataProvider/SimpleDataProvider.php index 0f23adb16..c21cde9a1 100644 --- a/sources/Application/UI/Base/Component/Input/Set/DataProvider/SimpleDataProvider.php +++ b/sources/Application/UI/Base/Component/Input/Set/DataProvider/SimpleDataProvider.php @@ -1,4 +1,5 @@ bIsDisabled = $bIsDisabled; return $this; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Input/Set/SetUIBlockFactory.php b/sources/Application/UI/Base/Component/Input/Set/SetUIBlockFactory.php index 736562884..ab588ed96 100644 --- a/sources/Application/UI/Base/Component/Input/Set/SetUIBlockFactory.php +++ b/sources/Application/UI/Base/Component/Input/Set/SetUIBlockFactory.php @@ -1,4 +1,5 @@ SetType('checkbox'); } - + public function SetIsToggled(bool $bIsToggled): static { return $this->SetIsChecked($bIsToggled); @@ -34,4 +33,4 @@ class Toggler extends Input { { return $this->IsChecked(); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Input/tInputLabel.php b/sources/Application/UI/Base/Component/Input/tInputLabel.php index 489cc49fe..857769425 100644 --- a/sources/Application/UI/Base/Component/Input/tInputLabel.php +++ b/sources/Application/UI/Base/Component/Input/tInputLabel.php @@ -1,10 +1,10 @@ sDescription) > 0; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/MedallionIcon/MedallionIcon.php b/sources/Application/UI/Base/Component/MedallionIcon/MedallionIcon.php index 99b6dd233..89ea8f0db 100644 --- a/sources/Application/UI/Base/Component/MedallionIcon/MedallionIcon.php +++ b/sources/Application/UI/Base/Component/MedallionIcon/MedallionIcon.php @@ -1,4 +1,5 @@ sImageUrl = $sImageUrl; - $this->sIconClass= $sIconClass; + $this->sIconClass = $sIconClass; } /** @@ -78,7 +78,7 @@ class MedallionIcon extends UIBlock $this->sIconClass = $sIconClass; return $this; } - + /** * @return string */ @@ -97,5 +97,5 @@ class MedallionIcon extends UIBlock $this->sDescription = $sDescription; return $this; } - -} \ No newline at end of file + +} diff --git a/sources/Application/UI/Base/Component/Modal/DoNotShowAgainOptionBlock.php b/sources/Application/UI/Base/Component/Modal/DoNotShowAgainOptionBlock.php index a135b3676..39b7675f6 100644 --- a/sources/Application/UI/Base/Component/Modal/DoNotShowAgainOptionBlock.php +++ b/sources/Application/UI/Base/Component/Modal/DoNotShowAgainOptionBlock.php @@ -1,4 +1,5 @@ SetLabel(Dict::S('UI:UserPref:DoNotShowAgain')); $this->AddSubBlock($oCheckBox); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Panel/Panel.php b/sources/Application/UI/Base/Component/Panel/Panel.php index 494a9dfa7..547b3e677 100644 --- a/sources/Application/UI/Base/Component/Panel/Panel.php +++ b/sources/Application/UI/Base/Component/Panel/Panel.php @@ -1,4 +1,5 @@ SetContentAreaBlocks(static::ENUM_CONTENT_AREA_MAIN, $aBlocks); return $this; @@ -530,7 +531,8 @@ class Panel extends UIContentBlock * @return \Combodo\iTop\Application\UI\Base\iUIBlock[] * @throws \Exception */ - public function GetMainBlocks(): array { + public function GetMainBlocks(): array + { return $this->GetContentAreaBlocks(static::ENUM_CONTENT_AREA_MAIN); } @@ -586,7 +588,8 @@ class Panel extends UIContentBlock * * @return $this */ - public function SetToolBlocks(array $aBlocks) { + public function SetToolBlocks(array $aBlocks) + { $this->SetContentAreaBlocks(static::ENUM_CONTENT_AREA_TOOLBAR, $aBlocks); return $this; @@ -598,7 +601,8 @@ class Panel extends UIContentBlock * @return \Combodo\iTop\Application\UI\Base\iUIBlock[] * @throws \Exception */ - public function GetToolbarBlocks(): array { + public function GetToolbarBlocks(): array + { return $this->GetContentAreaBlocks(static::ENUM_CONTENT_AREA_TOOLBAR); } @@ -654,7 +658,8 @@ class Panel extends UIContentBlock /** * @inheritDoc */ - public function AddHtml(string $sHtml) { + public function AddHtml(string $sHtml) + { $oBlock = new Html($sHtml); $this->AddMainBlock($oBlock); @@ -666,7 +671,8 @@ class Panel extends UIContentBlock * * @inheritDoc */ - public function AddSubBlock(?iUIBlock $oSubBlock) { + public function AddSubBlock(?iUIBlock $oSubBlock) + { if ($oSubBlock) { $this->AddMainBlock($oSubBlock); } @@ -680,7 +686,8 @@ class Panel extends UIContentBlock * * @return $this */ - public function RemoveSubBlock(string $sId) { + public function RemoveSubBlock(string $sId) + { foreach ($this->GetContentAreas() as $oContentArea) { $oContentArea->RemoveSubBlock($sId); } @@ -695,7 +702,8 @@ class Panel extends UIContentBlock * * @return bool */ - public function HasSubBlock(string $sId): bool { + public function HasSubBlock(string $sId): bool + { foreach ($this->GetContentAreas() as $oContentArea) { if ($oContentArea->HasSubBlock($sId)) { return true; @@ -710,7 +718,8 @@ class Panel extends UIContentBlock * * @inheritDoc */ - public function GetSubBlock(string $sId): ?iUIBlock { + public function GetSubBlock(string $sId): ?iUIBlock + { foreach ($this->GetContentAreas() as $oContentArea) { $oSubBlock = $oContentArea->GetSubBlock($sId); if (!is_null($oSubBlock)) { @@ -727,7 +736,8 @@ class Panel extends UIContentBlock * @inheritDoc * @return $this|\Combodo\iTop\Application\UI\Base\Layout\iUIContentBlock */ - public function SetSubBlocks(array $aSubBlocks): iUIContentBlock { + public function SetSubBlocks(array $aSubBlocks): iUIContentBlock + { $this->SetMainBlocks($aSubBlocks); return $this; diff --git a/sources/Application/UI/Base/Component/Panel/PanelUIBlockFactory.php b/sources/Application/UI/Base/Component/Panel/PanelUIBlockFactory.php index 663c88956..344f25b4e 100644 --- a/sources/Application/UI/Base/Component/Panel/PanelUIBlockFactory.php +++ b/sources/Application/UI/Base/Component/Panel/PanelUIBlockFactory.php @@ -1,4 +1,5 @@ sTooltip); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Pill/PillFactory.php b/sources/Application/UI/Base/Component/Pill/PillFactory.php index 71bed2187..b80302477 100644 --- a/sources/Application/UI/Base/Component/Pill/PillFactory.php +++ b/sources/Application/UI/Base/Component/Pill/PillFactory.php @@ -1,13 +1,12 @@ aParams); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/PopoverMenu/NewsroomMenu/NewsroomMenuFactory.php b/sources/Application/UI/Base/Component/PopoverMenu/NewsroomMenu/NewsroomMenuFactory.php index 2f0748e85..efc028f3d 100644 --- a/sources/Application/UI/Base/Component/PopoverMenu/NewsroomMenu/NewsroomMenuFactory.php +++ b/sources/Application/UI/Base/Component/PopoverMenu/NewsroomMenu/NewsroomMenuFactory.php @@ -1,4 +1,5 @@ FindItopClasses(iNewsroomProvider::class); - foreach($aProviders as $cProvider) { + foreach ($aProviders as $cProvider) { $oProvider = new $cProvider(); $oConfig = MetaModel::GetConfig(); $oProvider->SetConfig($oConfig); $bProviderEnabled = appUserPreferences::GetPref('newsroom_provider_'.get_class($oProvider), true); if ($bProviderEnabled && $oProvider->IsApplicable($oUser)) { - $aProviderParams[] = array( + $aProviderParams[] = [ 'label' => $oProvider->GetLabel(), 'fetch_url' => $oProvider->GetFetchURL(), 'target' => utils::StartsWith($oProvider->GetFetchURL(), $oConfig->Get('app_root_url')) ? '_self' : '_blank', @@ -80,25 +81,25 @@ class NewsroomMenuFactory 'mark_all_as_read_url' => $oProvider->GetMarkAllAsReadURL(), 'placeholders' => $oProvider->GetPlaceholders(), 'ttl' => $oProvider->GetTTL(), - ); + ]; } } - $sImageUrl= 'fas fa-comment-dots'; - $sPlaceholderImageUrl= 'far fa-envelope'; - $aParams = array( + $sImageUrl = 'fas fa-comment-dots'; + $sPlaceholderImageUrl = 'far fa-envelope'; + $aParams = [ 'image_icon' => $sImageUrl, 'no_message_icon' => file_get_contents(APPROOT.'images/illustrations/undraw_social_serenity.svg'), 'placeholder_image_icon' => $sPlaceholderImageUrl, 'cache_uuid' => 'itop-newsroom-'.UserRights::GetUserId().'-'.md5(APPROOT), 'providers' => $aProviderParams, 'display_limit' => (int)appUserPreferences::GetPref('newsroom_display_size', 7), - 'labels' => array( + 'labels' => [ 'no_notification' => 'UI:Newsroom:NoNewMessage', 'x_notifications' => 'UI:Newsroom:XNewMessage', 'mark_all_as_read' => 'UI:Newsroom:MarkAllAsRead', - 'view_all' => 'UI:Newsroom:ViewAllMessages' - ), - ); + 'view_all' => 'UI:Newsroom:ViewAllMessages', + ], + ]; return $aParams; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenu.php b/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenu.php index fb99021f5..a92324206 100644 --- a/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenu.php +++ b/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenu.php @@ -1,4 +1,5 @@ HasSection($sId)) - { + if (false === $this->HasSection($sId)) { $this->aSections[$sId] = [ 'aItems' => [], ]; @@ -357,8 +356,7 @@ class PopoverMenu extends UIBlock */ public function RemoveSection(string $sId) { - if (true === $this->HasSection($sId)) - { + if (true === $this->HasSection($sId)) { unset($this->aSections[$sId]); } @@ -387,8 +385,7 @@ class PopoverMenu extends UIBlock */ public function ClearSection(string $sId) { - if (false === $this->HasSection($sId)) - { + if (false === $this->HasSection($sId)) { throw new Exception('Could not clear section "'.$sId.'" as it does not exist in the "'.$this->GetId().'" menu'); } @@ -448,13 +445,11 @@ class PopoverMenu extends UIBlock */ public function RemoveItem(string $sSectionId, string $sItemId) { - if (false === $this->HasSection($sSectionId)) - { + if (false === $this->HasSection($sSectionId)) { throw new Exception('Could not remove en item from the "'.$sSectionId.'" as it does not seem to exist in the "'.$this->GetId().'" menu.'); } - if (array_key_exists($sItemId, $this->aSections[$sSectionId]['aItems'])) - { + if (array_key_exists($sItemId, $this->aSections[$sSectionId]['aItems'])) { unset($this->aSections[$sSectionId]['aItems'][$sItemId]); } @@ -472,7 +467,7 @@ class PopoverMenu extends UIBlock */ public function AddItems(string $sSectionId, array $aItems) { - foreach($aItems as $oItem){ + foreach ($aItems as $oItem) { $this->AddItem($sSectionId, $oItem); } @@ -525,12 +520,11 @@ class PopoverMenu extends UIBlock $aSubBlocks = []; foreach ($this->aSections as $sSectionId => $aSectionData) { - foreach($aSectionData['aItems'] as $sItemId => $oItem) - { + foreach ($aSectionData['aItems'] as $sItemId => $oItem) { $aSubBlocks[$sItemId] = $oItem; } } return $aSubBlocks; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuFactory.php b/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuFactory.php index 83dd5a679..d4d19c91a 100644 --- a/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuFactory.php +++ b/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuFactory.php @@ -1,4 +1,5 @@ $aItemData) { + foreach ($aOriginalItems as $sItemID => $aItemData) { $aTransformedItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItemData($sItemID, $aItemData); } @@ -273,4 +265,4 @@ class PopoverMenuFactory return $oMenu; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuItem/JsPopoverMenuItem.php b/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuItem/JsPopoverMenuItem.php index 6fe0b0f65..95a4b7b65 100644 --- a/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuItem/JsPopoverMenuItem.php +++ b/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuItem/JsPopoverMenuItem.php @@ -1,4 +1,5 @@ * @package Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem - * @property \JSPopupMenuItem $oPopupMenuItem + * @property \JSPopupMenuItem $oPopupMenuItem * @since 3.0.0 */ class JsPopoverMenuItem extends PopoverMenuItem @@ -63,4 +63,4 @@ class JsPopoverMenuItem extends PopoverMenuItem return $aJsFiles; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuItem/PopoverMenuItem.php b/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuItem/PopoverMenuItem.php index e52bdc834..9e07716b2 100644 --- a/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuItem/PopoverMenuItem.php +++ b/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuItem/PopoverMenuItem.php @@ -1,4 +1,5 @@ oPopupMenuItem->GetCssClasses(); } - + /** * @return string * @uses oPopupMenuItem @@ -137,7 +137,7 @@ class PopoverMenuItem extends UIBlock { return $this->oPopupMenuItem->GetTooltip(); } - + /** * @return $this * @uses oPopupMenuItem @@ -149,7 +149,6 @@ class PopoverMenuItem extends UIBlock return $this; } - /** * @return string * @uses oPopupMenuItem @@ -160,5 +159,4 @@ class PopoverMenuItem extends UIBlock return $this->oPopupMenuItem->GetUID(); } - -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuItem/PopoverMenuItemFactory.php b/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuItem/PopoverMenuItemFactory.php index 55f9e50b9..0959cff92 100644 --- a/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuItem/PopoverMenuItemFactory.php +++ b/sources/Application/UI/Base/Component/PopoverMenu/PopoverMenuItem/PopoverMenuItemFactory.php @@ -1,4 +1,5 @@ oPopupMenuItem->GetUrl(); } - + /** * @see \URLPopupMenuItem::GetTarget() * @return string @@ -50,4 +50,4 @@ class UrlPopoverMenuItem extends PopoverMenuItem { return $this->oPopupMenuItem->GetTarget(); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/QuickCreate/QuickCreate.php b/sources/Application/UI/Base/Component/QuickCreate/QuickCreate.php index b7ae9ee76..8239aa465 100644 --- a/sources/Application/UI/Base/Component/QuickCreate/QuickCreate.php +++ b/sources/Application/UI/Base/Component/QuickCreate/QuickCreate.php @@ -1,4 +1,5 @@ SetEndpoint(static::DEFAULT_ENDPOINT_REL_URL); - $this->aAvailableClasses = $this->FilterAvailableClasses(UserRights::GetAllowedClasses(UR_ACTION_CREATE, array('bizmodel'), true)); + $this->aAvailableClasses = $this->FilterAvailableClasses(UserRights::GetAllowedClasses(UR_ACTION_CREATE, ['bizmodel'], true)); $this->aLastClasses = $aLastClasses; $this->iMaxAutocompleteResults = (int) MetaModel::GetConfig()->Get('quick_create.max_autocomplete_results'); $this->bShowHistory = (bool) MetaModel::GetConfig()->Get('quick_create.show_history'); @@ -135,14 +135,14 @@ class QuickCreate extends UIBlock implements iKeyboardShortcut { $aFilteredClasses = []; - foreach ($aClasses as $sClassName => $sClassLabel){ + foreach ($aClasses as $sClassName => $sClassLabel) { // Skip not derivating from cmdbAbstractObject - if(false === is_a($sClassName, '\cmdbAbstractObject', true)) { + if (false === is_a($sClassName, '\cmdbAbstractObject', true)) { continue; } // Skip n:n classes - if(MetaModel::IsLinkClass($sClassName)) { + if (MetaModel::IsLinkClass($sClassName)) { continue; } @@ -212,4 +212,4 @@ class QuickCreate extends UIBlock implements iKeyboardShortcut { return "[data-role='".static::BLOCK_CODE."']"; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/QuickCreate/QuickCreateFactory.php b/sources/Application/UI/Base/Component/QuickCreate/QuickCreateFactory.php index 95a7d1c01..e7916acc8 100644 --- a/sources/Application/UI/Base/Component/QuickCreate/QuickCreateFactory.php +++ b/sources/Application/UI/Base/Component/QuickCreate/QuickCreateFactory.php @@ -1,4 +1,5 @@ Get('quick_create.max_history_results'); - if(count($aHistoryEntries) > $iMaxHistoryResults) - { + if (count($aHistoryEntries) > $iMaxHistoryResults) { $aHistoryEntries = array_slice($aHistoryEntries, 0, $iMaxHistoryResults); } } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Spinner/Spinner.php b/sources/Application/UI/Base/Component/Spinner/Spinner.php index 787c8f8fa..cc91ab122 100644 --- a/sources/Application/UI/Base/Component/Spinner/Spinner.php +++ b/sources/Application/UI/Base/Component/Spinner/Spinner.php @@ -1,4 +1,5 @@ sDescription = $sDescription; return $this; } - + /** * @return bool */ @@ -68,7 +68,7 @@ class Spinner extends UIBlock { return $this->sDescription !== ''; } - + /** * @return string */ @@ -86,4 +86,4 @@ class Spinner extends UIBlock $this->sSize = $sSize; return $this; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Spinner/SpinnerUIBlockFactory.php b/sources/Application/UI/Base/Component/Spinner/SpinnerUIBlockFactory.php index 96e3162a4..ad2178e1b 100644 --- a/sources/Application/UI/Base/Component/Spinner/SpinnerUIBlockFactory.php +++ b/sources/Application/UI/Base/Component/Spinner/SpinnerUIBlockFactory.php @@ -1,13 +1,12 @@ SetSize(Spinner::ENUM_SPINNER_SIZE_SMALL); return $oSpinner; } - + /** * @api * @@ -80,4 +79,4 @@ class SpinnerUIBlockFactory extends AbstractUIBlockFactory $oSpinner->SetSize(Spinner::ENUM_SPINNER_SIZE_LARGE); return $oSpinner; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Template/Template.php b/sources/Application/UI/Base/Component/Template/Template.php index ad645d33d..24dc60365 100644 --- a/sources/Application/UI/Base/Component/Template/Template.php +++ b/sources/Application/UI/Base/Component/Template/Template.php @@ -1,4 +1,5 @@ sText; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Title/Title.php b/sources/Application/UI/Base/Component/Title/Title.php index a6dbb9e02..425852e56 100644 --- a/sources/Application/UI/Base/Component/Title/Title.php +++ b/sources/Application/UI/Base/Component/Title/Title.php @@ -1,4 +1,5 @@ bIsMedallion; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Title/TitleUIBlockFactory.php b/sources/Application/UI/Base/Component/Title/TitleUIBlockFactory.php index 404805a8f..a554a2753 100644 --- a/sources/Application/UI/Base/Component/Title/TitleUIBlockFactory.php +++ b/sources/Application/UI/Base/Component/Title/TitleUIBlockFactory.php @@ -1,13 +1,12 @@ SetIcon($sIconUrl, $sIconCoverMethod, $bIsMedallion); @@ -85,4 +86,4 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory { return new Title($oTitle, $iLevel, $sId); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Component/Toolbar/Separator/AbstractSeparator.php b/sources/Application/UI/Base/Component/Toolbar/Separator/AbstractSeparator.php index 6d9b8ba89..6afc1fdd0 100644 --- a/sources/Application/UI/Base/Component/Toolbar/Separator/AbstractSeparator.php +++ b/sources/Application/UI/Base/Component/Toolbar/Separator/AbstractSeparator.php @@ -1,4 +1,5 @@ GetOrigin()) { + switch ($this->GetOrigin()) { case CMDBChangeOrigin::CSV_INTERACTIVE: case CMDBChangeOrigin::CSV_IMPORT: $sDecorationClasses = 'fas fa-fw fa-file-import'; @@ -364,4 +364,4 @@ class ActivityEntry extends UIBlock return $sDecorationClasses; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/ActivityEntryFactory.php b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/ActivityEntryFactory.php index 39b9f3e85..a6e42e24d 100644 --- a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/ActivityEntryFactory.php +++ b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/ActivityEntryFactory.php @@ -1,4 +1,5 @@ Get('login'); - // We sanitize OrmEntry even if it's already sanitized: if the entry is somehow truncated or metadata are wrong we may break whole page DOM + // We sanitize OrmEntry even if it's already sanitized: if the entry is somehow truncated or metadata are wrong we may break whole page DOM $oEntry = new CaseLogEntry( DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $aOrmEntry['date']), $sUserLogin, @@ -154,4 +154,4 @@ class ActivityEntryFactory return $sFactoryFqcn; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/CMDBChangeOp/CMDBChangeOpAttachmentAddedFactory.php b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/CMDBChangeOp/CMDBChangeOpAttachmentAddedFactory.php index fd3fc66a1..bb0cabc6d 100644 --- a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/CMDBChangeOp/CMDBChangeOpAttachmentAddedFactory.php +++ b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/CMDBChangeOp/CMDBChangeOpAttachmentAddedFactory.php @@ -1,4 +1,5 @@ Get('userinfo'); // - Try to find user login from its ID if present (since iTop 3.0.0) - if(empty($iAuthorId) === false) - { + if (empty($iAuthorId) === false) { $oAuthor = MetaModel::GetObject('User', $iAuthorId, false, true); - if(empty($oAuthor) === false) - { + if (empty($oAuthor) === false) { $sAuthorLogin = $oAuthor->Get('login'); } } return $sAuthorLogin; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/CMDBChangeOp/CMDBChangeOpSetAttributeFactory.php b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/CMDBChangeOp/CMDBChangeOpSetAttributeFactory.php index 9ab107e1c..5a9426b20 100644 --- a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/CMDBChangeOp/CMDBChangeOpSetAttributeFactory.php +++ b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/CMDBChangeOp/CMDBChangeOpSetAttributeFactory.php @@ -1,4 +1,5 @@ Get('newvalue')); $oEntry = new TransitionEntry($oDateTime, $sAuthorLogin, $sHostObjectClass, $sOriginStateLabel, $sTargetStateLabel); - } - else - { + } else { $oEntry = parent::MakeFromCmdbChangeOp($oChangeOp); } return $oEntry; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/CaseLogEntry.php b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/CaseLogEntry.php index 71d94c11f..5e1715b90 100644 --- a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/CaseLogEntry.php +++ b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/CaseLogEntry.php @@ -1,4 +1,5 @@ sAttCode = $sAttCode; $this->SetCaseLogRank(static::DEFAULT_CASELOG_RANK); } - + /* * Set the author and its information based on the $sAuthorLogin using parent call - * If no parent call found no matching User, fallback on caselog author name and display it as foreign message + * If no parent call found no matching User, fallback on caselog author name and display it as foreign message * * @param string $sAuthorLogin * @@ -84,13 +84,13 @@ class CaseLogEntry extends ActivityEntry public function SetAuthor(string $sAuthorLogin) { parent::SetAuthor($sAuthorLogin); - + // If no User was found in parent call - if($this->sAuthorLogin === '') { + if ($this->sAuthorLogin === '') { // Use caselog user_login info as friendlyname and compute its initials $this->sAuthorFriendlyname = $this->sAuthorName; $this->sAuthorInitials = utils::ToAcronym($this->sAuthorFriendlyname); - + // Reset Picture as we probably have default image $this->sAuthorPictureAbsUrl = null; // Reset bIsFromCurrentUser as UserRights often consider '' login as current user login @@ -132,4 +132,4 @@ class CaseLogEntry extends ActivityEntry { return $this->iCaseLogRank; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/EditsEntry.php b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/EditsEntry.php index 90a6d1e06..69dbc5c55 100644 --- a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/EditsEntry.php +++ b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/EditsEntry.php @@ -1,4 +1,5 @@ aAttributes)) - { + if (array_key_exists($sAttCode, $this->aAttributes)) { unset($this->aAttributes[$sAttCode]); } @@ -180,8 +179,7 @@ class EditsEntry extends ActivityEntry // We need the array to be indexed by numbers instead of being associative $aAttributesData = array_values($this->GetAttributes()); $iAttributesCount = count($aAttributesData); - switch($iAttributesCount) - { + switch ($iAttributesCount) { case 0: $sDescriptionAsHtml = ''; break; @@ -204,8 +202,7 @@ class EditsEntry extends ActivityEntry $sFirstAttLabelAsHtml = ''.$aAttributesData[0]['label'].''; $sSecondAttLabelAsHtml = ''.$aAttributesData[1]['label'].''; - switch($iAttributesCount) - { + switch ($iAttributesCount) { case 2: $sDescriptionAsHtml = Dict::Format('Change:TwoAttributesChanged', $sFirstAttLabelAsHtml, $sSecondAttLabelAsHtml); break; @@ -222,4 +219,4 @@ class EditsEntry extends ActivityEntry return $sDescriptionAsHtml; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/EventNotification/EventNotificationEmailFactory.php b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/EventNotification/EventNotificationEmailFactory.php index d72ae3cec..bc811f426 100644 --- a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/EventNotification/EventNotificationEmailFactory.php +++ b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/EventNotification/EventNotificationEmailFactory.php @@ -1,4 +1,5 @@ sMessage; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/TransitionEntry.php b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/TransitionEntry.php index ca308f12b..d98b0ae90 100644 --- a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/TransitionEntry.php +++ b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityEntry/TransitionEntry.php @@ -1,4 +1,5 @@ sTargetStateLabel; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanel.php b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanel.php index ef70eecb6..bf9bd258f 100644 --- a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanel.php +++ b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanel.php @@ -1,4 +1,5 @@ AddCaseLogTab($sCaseLogAttCode); } - return $this; } @@ -186,7 +184,8 @@ class ActivityPanel extends UIBlock * * @return int */ - public function GetObjectId(): int { + public function GetObjectId(): int + { return $this->oObject->GetKey(); } @@ -195,7 +194,8 @@ class ActivityPanel extends UIBlock * * @return string */ - public function GetObjectClass(): string { + public function GetObjectClass(): string + { return get_class($this->oObject); } @@ -211,7 +211,7 @@ class ActivityPanel extends UIBlock public function SetObjectMode(string $sMode) { // Consistency check - if(!in_array($sMode, cmdbAbstractObject::EnumDisplayModes())){ + if (!in_array($sMode, cmdbAbstractObject::EnumDisplayModes())) { throw new Exception("Activity panel: Object mode '$sMode' not allowed, should be either ".implode(' / ', cmdbAbstractObject::EnumDisplayModes())); } @@ -301,8 +301,7 @@ class ActivityPanel extends UIBlock // Reset entries $this->aEntries = []; - foreach ($aEntries as $oEntry) - { + foreach ($aEntries as $oEntry) { $this->AddEntry($oEntry); } @@ -316,8 +315,7 @@ class ActivityPanel extends UIBlock */ public function GetEntries(): array { - if ($this->bAreEntriesSorted === false) - { + if ($this->bAreEntriesSorted === false) { $this->SortEntries(); } @@ -336,18 +334,15 @@ class ActivityPanel extends UIBlock $aCurrentGroup = ['author_login' => null, 'origin' => null, 'entries' => []]; $aPreviousEntryData = ['author_login' => null, 'origin' => null]; - foreach($this->GetEntries() as $sId => $oEntry) - { + foreach ($this->GetEntries() as $sId => $oEntry) { // New entry data $sAuthorLogin = $oEntry->GetAuthorLogin(); $sOrigin = $oEntry->GetOrigin(); // Check if it's time to change of group - if(($sAuthorLogin !== $aPreviousEntryData['author_login']) || ($sOrigin !== $aPreviousEntryData['origin'])) - { + if (($sAuthorLogin !== $aPreviousEntryData['author_login']) || ($sOrigin !== $aPreviousEntryData['origin'])) { // Flush current group if necessary - if(empty($aCurrentGroup['entries']) === false) - { + if (empty($aCurrentGroup['entries']) === false) { $aGroupedEntries[] = $aCurrentGroup; } @@ -360,8 +355,7 @@ class ActivityPanel extends UIBlock } // Flush last group - if(empty($aCurrentGroup['entries']) === false) - { + if (empty($aCurrentGroup['entries']) === false) { $aGroupedEntries[] = $aCurrentGroup; } @@ -375,16 +369,14 @@ class ActivityPanel extends UIBlock */ protected function SortEntries() { - if(count($this->aEntries) > 1) - { - uasort($this->aEntries, function($oEntryA, $oEntryB){ + if (count($this->aEntries) > 1) { + uasort($this->aEntries, function ($oEntryA, $oEntryB) { /** @var ActivityEntry $oEntryA */ /** @var ActivityEntry $oEntryB */ $sDateTimeA = $oEntryA->GetRawDateTime(); $sDateTimeB = $oEntryB->GetRawDateTime(); - if ($sDateTimeA === $sDateTimeB) - { + if ($sDateTimeA === $sDateTimeB) { return 0; } @@ -410,14 +402,12 @@ class ActivityPanel extends UIBlock $this->bAreEntriesSorted = false; // Add case log to the panel and update metadata when necessary - if ($oEntry instanceof CaseLogEntry) - { + if ($oEntry instanceof CaseLogEntry) { $sCaseLogAttCode = $oEntry->GetAttCode(); $sAuthorLogin = $oEntry->GetAuthorLogin(); // Initialize case log metadata - if ($this->HasCaseLogTab($sCaseLogAttCode) === false) - { + if ($this->HasCaseLogTab($sCaseLogAttCode) === false) { $this->AddCaseLogTab($sCaseLogAttCode); } @@ -428,8 +418,7 @@ class ActivityPanel extends UIBlock // - Message count $this->aCaseLogs[$sCaseLogAttCode]['total_messages_count']++; // - Authors - if(array_key_exists($sAuthorLogin, $this->aCaseLogs[$sCaseLogAttCode]['authors']) === false) - { + if (array_key_exists($sAuthorLogin, $this->aCaseLogs[$sCaseLogAttCode]['authors']) === false) { $this->aCaseLogs[$sCaseLogAttCode]['authors'][$sAuthorLogin] = [ 'messages_count' => 0, ]; @@ -450,12 +439,10 @@ class ActivityPanel extends UIBlock */ public function RemoveEntry(string $sEntryId) { - if (array_key_exists($sEntryId, $this->aEntries)) - { + if (array_key_exists($sEntryId, $this->aEntries)) { // Recompute case logs metadata only if necessary $oEntry = $this->aEntries[$sEntryId]; - if ($oEntry instanceof CaseLogEntry) - { + if ($oEntry instanceof CaseLogEntry) { $sCaseLogAttCode = $oEntry->GetAttCode(); $sAuthorLogin = $oEntry->GetAuthorLogin(); @@ -464,8 +451,7 @@ class ActivityPanel extends UIBlock $this->aCaseLogs[$sCaseLogAttCode]['total_messages_count']--; // - Authors $this->aCaseLogs[$sCaseLogAttCode]['authors'][$sAuthorLogin]['messages_count']--; - if($this->aCaseLogs[$sCaseLogAttCode]['authors'][$sAuthorLogin]['messages_count'] === 0) - { + if ($this->aCaseLogs[$sCaseLogAttCode]['authors'][$sAuthorLogin]['messages_count'] === 0) { unset($this->aCaseLogs[$sCaseLogAttCode]['authors'][$sAuthorLogin]); } } @@ -564,8 +550,7 @@ class ActivityPanel extends UIBlock protected function AddCaseLogTab(string $sAttCode) { // Add case log only if not already existing - if (!array_key_exists($sAttCode, $this->aCaseLogs)) - { + if (!array_key_exists($sAttCode, $this->aCaseLogs)) { $iFlags = ($this->GetObject()->IsNew()) ? $this->GetObject()->GetInitialStateAttributeFlags($sAttCode) : $this->GetObject()->GetAttributeFlags($sAttCode); $bIsHidden = (OPT_ATT_HIDDEN === ($iFlags & OPT_ATT_HIDDEN)); $bIsReadOnly = (OPT_ATT_READONLY === ($iFlags & OPT_ATT_READONLY)); @@ -615,8 +600,7 @@ class ActivityPanel extends UIBlock */ protected function RemoveCaseLogTab(string $sAttCode) { - if (array_key_exists($sAttCode, $this->aCaseLogs)) - { + if (array_key_exists($sAttCode, $this->aCaseLogs)) { unset($this->aCaseLogs[$sAttCode]); } @@ -694,7 +678,7 @@ class ActivityPanel extends UIBlock */ public function SetCaseLogTabEntryForm(string $sCaseLogId, CaseLogEntryForm $oCaseLogEntryForm) { - if ($this->HasCaseLogTab($sCaseLogId)){ + if ($this->HasCaseLogTab($sCaseLogId)) { $this->aCaseLogTabsEntryForms[$sCaseLogId] = $oCaseLogEntryForm; } @@ -744,8 +728,7 @@ class ActivityPanel extends UIBlock foreach ($this->GetCaseLogTabsEntryForms() as $oCaseLogEntryForm) { if ($oCaseLogEntryForm->IsSubmitAutonomous()) { $iAutonomousSubmission++; - } - else { + } else { $iBridgedSubmissions++; } } @@ -949,7 +932,7 @@ class ActivityPanel extends UIBlock */ public function GetSubBlocks(): array { - $aSubBlocks = array(); + $aSubBlocks = []; foreach ($this->GetCaseLogTabsEntryForms() as $sCaseLogId => $oCaseLogEntryForm) { $aSubBlocks[$oCaseLogEntryForm->GetId()] = $oCaseLogEntryForm; @@ -975,7 +958,6 @@ class ActivityPanel extends UIBlock return $this; } - /** * @return bool * @throws \CoreException @@ -984,4 +966,4 @@ class ActivityPanel extends UIBlock { return \UserRights::IsActionAllowed($this->GetObjectClass(), UR_ACTION_MODIFY); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanelFactory.php b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanelFactory.php index 64821ce89..db9d8ea07 100644 --- a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanelFactory.php +++ b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanelFactory.php @@ -1,4 +1,5 @@ GetCaseLogTabs(); - foreach($aCaseLogTabs as $sCaseLogAttCode => $aCaseLogData) - { + foreach ($aCaseLogTabs as $sCaseLogAttCode => $aCaseLogData) { /** @var \ormCaseLog $oCaseLog */ $oCaseLog = $oObject->Get($sCaseLogAttCode); @@ -160,8 +159,7 @@ class ActivityPanelFactory while ($oNotifEvent = $oNotifEventsSet->Fetch()) { try { $oEntry = ActivityEntryFactory::MakeFromEventNotification($oNotifEvent); - } - catch (Exception $oException) { + } catch (Exception $oException) { IssueLog::Debug(static::class.': Could not create entry from EventNotification #'.$oNotifEvent->GetKey().' related to trigger "'.$oNotifEvent->Get('trigger_id_friendlyname').'" / action "'.$oNotifEvent->Get('action_id_friendlyname').'" / object #'.$oNotifEvent->Get('object_id').': '.$oException->getMessage()); continue; } @@ -177,4 +175,4 @@ class ActivityPanelFactory return $oActivityPanel; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanelHelper.php b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanelHelper.php index 61732f1e5..46019053c 100644 --- a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanelHelper.php +++ b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanelHelper.php @@ -1,4 +1,5 @@ AddConditionExpression( new BinaryExpression( - new FieldExpression('id', 'CO'), '<', new VariableExpression('id') + new FieldExpression('id', 'CO'), + '<', + new VariableExpression('id') ) ); $aArgs['id'] = $sChangeOpIdToOffsetFrom; @@ -162,8 +164,7 @@ class ActivityPanelHelper $iChangeId = $oChangeOp->Get('change'); try { $oEntry = ActivityEntryFactory::MakeFromCmdbChangeOp($oChangeOp, $oChange); - } - catch (Exception $oException) { + } catch (Exception $oException) { IssueLog::Debug(static::class.': Could not create entry from CMDBChangeOp #'.$oChangeOp->GetKey().' related to '.$oChangeOp->Get('objclass').'::'.$oChangeOp->Get('objkey').': '.$oException->getMessage()); continue; } @@ -192,4 +193,4 @@ class ActivityPanelHelper return $aResults; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanelPrint.php b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanelPrint.php index 4ceb421c3..e6d8c3601 100644 --- a/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanelPrint.php +++ b/sources/Application/UI/Base/Layout/ActivityPanel/ActivityPanelPrint.php @@ -1,4 +1,5 @@ $aTransitionDef) { - $iActionAllowed = (get_class($aStimuli[$sStimulusCode]) == 'StimulusUserAction') ? UserRights::IsStimulusAllowed($sObjClass, - $sStimulusCode, $oSetToCheckRights) : UR_ALLOWED_NO; + $iActionAllowed = (get_class($aStimuli[$sStimulusCode]) == 'StimulusUserAction') ? UserRights::IsStimulusAllowed( + $sObjClass, + $sStimulusCode, + $oSetToCheckRights + ) : UR_ALLOWED_NO; switch ($iActionAllowed) { case UR_ALLOWED_YES: $oMenuItem = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem( @@ -107,4 +109,4 @@ JS return $oMenu; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/Dashboard/DashboardColumn.php b/sources/Application/UI/Base/Layout/Dashboard/DashboardColumn.php index 7ad0f9c2d..03f592935 100644 --- a/sources/Application/UI/Base/Layout/Dashboard/DashboardColumn.php +++ b/sources/Application/UI/Base/Layout/Dashboard/DashboardColumn.php @@ -1,13 +1,12 @@ bLastRow = $bLastRow; return $this; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/Dashboard/DashboardLayout.php b/sources/Application/UI/Base/Layout/Dashboard/DashboardLayout.php index e1d04d5dd..b1d0d7efd 100644 --- a/sources/Application/UI/Base/Layout/Dashboard/DashboardLayout.php +++ b/sources/Application/UI/Base/Layout/Dashboard/DashboardLayout.php @@ -1,10 +1,10 @@ aDashboardRows; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/Dashboard/DashboardRow.php b/sources/Application/UI/Base/Layout/Dashboard/DashboardRow.php index 31ffc9e76..c73e9ded9 100644 --- a/sources/Application/UI/Base/Layout/Dashboard/DashboardRow.php +++ b/sources/Application/UI/Base/Layout/Dashboard/DashboardRow.php @@ -1,10 +1,10 @@ iRowIndex = $iRowIndex; return $this; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/MultiColumn/Column/Column.php b/sources/Application/UI/Base/Layout/MultiColumn/Column/Column.php index 14608a2ed..12c47605a 100644 --- a/sources/Application/UI/Base/Layout/MultiColumn/Column/Column.php +++ b/sources/Application/UI/Base/Layout/MultiColumn/Column/Column.php @@ -1,4 +1,5 @@ sAppFullIconUrl = Branding::GetFullMainLogoAbsoluteUrl(); $this->sAppIconLink = $oConfig->Get('app_icon_url'); $this->SetShowMenusCount($oConfig->Get('navigation_menu.show_menus_count')); - $this->aSiloSelection = array(); + $this->aSiloSelection = []; $this->aMenuGroups = ApplicationMenu::GetMenuGroups($oAppContext->GetAsHash()); $this->oUserMenu = $oUserMenu; $this->oNewsroomMenu = $oNewsroomMenu; @@ -197,7 +200,7 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut $oAppContext = new ApplicationContext(); $sCurrentOrganization = $oAppContext->GetCurrentValue('org_id'); - if(!empty($sCurrentOrganization)) { + if (!empty($sCurrentOrganization)) { return $sCurrentOrganization; } return ''; @@ -287,7 +290,7 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut $sPropCode = 'app_icon_url'; // Try if a custom URL was set in the configuration file - if(MetaModel::GetConfig()->IsCustomValue($sPropCode)) { + if (MetaModel::GetConfig()->IsCustomValue($sPropCode)) { $this->sAppIconLink = MetaModel::GetConfig()->Get($sPropCode); } // Otherwise use the home page @@ -300,7 +303,8 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut * @return True if the silo selection is enabled, false otherwise * @since 3.1.0 */ - public function IsSiloSelectionEnabled() : bool { + public function IsSiloSelectionEnabled(): bool + { return MetaModel::GetConfig()->Get('navigation_menu.show_organization_filter'); } @@ -315,7 +319,7 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut $this->bHasSiloSelected = false; $this->sSiloLabel = null; - if (! $this->IsSiloSelectionEnabled()){ + if (! $this->IsSiloSelectionEnabled()) { return; } @@ -323,8 +327,7 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut // List of visible Organizations $iCount = 0; $oSet = null; - if (MetaModel::IsValidClass('Organization')) - { + if (MetaModel::IsValidClass('Organization')) { // Display the list of *favorite* organizations... but keeping in mind what is the real number of organizations $aFavoriteOrgs = appUserPreferences::GetPref('favorite_orgs', null); $oSearchFilter = new DBObjectSearch('Organization'); @@ -335,14 +338,12 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut // Now get the list of Orgs to be displayed in the menu $oSearchFilter = DBObjectSearch::FromOQL(ApplicationMenu::GetFavoriteSiloQuery()); $oSearchFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', true); - if (!empty($aFavoriteOrgs)) - { + if (!empty($aFavoriteOrgs)) { $oSearchFilter->AddCondition('id', $aFavoriteOrgs, 'IN'); } $oSet = new CMDBObjectSet($oSearchFilter); // List of favorite orgs } - switch ($iCount) - { + switch ($iCount) { case 0: case 1: // No such dimension/silo or only one possible choice => nothing to select @@ -352,7 +353,7 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut $oAppContext = new ApplicationContext(); $iCurrentOrganization = $oAppContext->GetCurrentValue('org_id'); - if(!empty($iCurrentOrganization)) { + if (!empty($iCurrentOrganization)) { $oCurrentOrganization = MetaModel::GetObject('Organization', $iCurrentOrganization, true, true); $this->bHasSiloSelected = true; $this->sSiloLabel = $oCurrentOrganization->GetRawName(); @@ -364,12 +365,22 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut $oWidget = new UIExtKeyWidget('Organization', 'org_id', '', true /* search mode */); $iMaxComboLength = MetaModel::GetConfig()->Get('max_combo_length'); - $this->aSiloSelection['html'] .= $oWidget->DisplaySelect($oPage, $iMaxComboLength, false, Dict::S('UI:Layout:NavigationMenu:Silo:Label'), $oSet, $iCurrentOrganization, false, 'c[org_id]', '', - array( + $this->aSiloSelection['html'] .= $oWidget->DisplaySelect( + $oPage, + $iMaxComboLength, + false, + Dict::S('UI:Layout:NavigationMenu:Silo:Label'), + $oSet, + $iCurrentOrganization, + false, + 'c[org_id]', + '', + [ 'iFieldSize' => 20, 'iMinChars' => MetaModel::GetConfig()->Get('min_autocomplete_chars'), 'sDefaultValue' => Dict::S('UI:AllOrganizations'), - )); + ] + ); $this->aSiloSelection['html'] .= $oPage->GetHtml(); // Add other dimensions/context information to this form $oAppContext->Reset('org_id'); // org_id is handled above and we want to be able to change it here ! @@ -378,7 +389,7 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut $this->aSiloSelection['html'] .= ''; $sAddClearButton = ""; - if ($this->bHasSiloSelected ){ + if ($this->bHasSiloSelected) { $sAddClearButton = "$('#mini_clear_org_id').removeClass('ibo-is-hidden');"; } @@ -415,21 +426,17 @@ JS; { $bIsExpanded = false; // Check if menu should be opened only if we re not in demo mode - if (false === MetaModel::GetConfig()->Get('demo_mode')) - { + if (false === MetaModel::GetConfig()->Get('demo_mode')) { // Force state if necessary... - if (utils::ReadParam('force_menu_pane', null) === 0) - { + if (utils::ReadParam('force_menu_pane', null) === 0) { $bIsExpanded = false; } // ... otherwise look for the new user pref ... - elseif (appUserPreferences::GetPref('navigation_menu.expanded', null) !== null) - { + elseif (appUserPreferences::GetPref('navigation_menu.expanded', null) !== null) { $bIsExpanded = appUserPreferences::GetPref('navigation_menu.expanded', null) === 'expanded'; } // ... or fallback on the old one - elseif (appUserPreferences::GetPref('menu_pane', null) !== null) - { + elseif (appUserPreferences::GetPref('menu_pane', null) !== null) { $bIsExpanded = appUserPreferences::GetPref('menu_pane', null) === 'opened'; } } @@ -469,7 +476,7 @@ JS; 'sOrganization' => UserRights::GetContactOrganizationFriendlyname(), 'sFirstname' => UserRights::GetContactFirstname(), 'sPictureUrl' => $sPictureUrl, - 'sWelcomeMessage' => Dict::Format('UI:Layout:NavigationMenu:UserInfo:WelcomeMessage:Text', UserRights::GetContactFirstname()) + 'sWelcomeMessage' => Dict::Format('UI:Layout:NavigationMenu:UserInfo:WelcomeMessage:Text', UserRights::GetContactFirstname()), ]; // Logon message diff --git a/sources/Application/UI/Base/Layout/NavigationMenu/NavigationMenuFactory.php b/sources/Application/UI/Base/Layout/NavigationMenu/NavigationMenuFactory.php index 93936d1f5..77c065be9 100644 --- a/sources/Application/UI/Base/Layout/NavigationMenu/NavigationMenuFactory.php +++ b/sources/Application/UI/Base/Layout/NavigationMenu/NavigationMenuFactory.php @@ -1,4 +1,5 @@ Get('newsroom_enabled')) - { + if (MetaModel::GetConfig()->Get('newsroom_enabled')) { $oNewsroomMenu = NewsroomMenuFactory::MakeNewsroomMenuForNavigationMenu(); } - + return new NavigationMenu( - new ApplicationContext(), PopoverMenuFactory::MakeUserMenuForNavigationMenu(), $oNewsroomMenu, NavigationMenu::BLOCK_CODE + new ApplicationContext(), + PopoverMenuFactory::MakeUserMenuForNavigationMenu(), + $oNewsroomMenu, + NavigationMenu::BLOCK_CODE ); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/Object/ObjectDetails.php b/sources/Application/UI/Base/Layout/Object/ObjectDetails.php index c66300666..4cfd4b6c0 100644 --- a/sources/Application/UI/Base/Layout/Object/ObjectDetails.php +++ b/sources/Application/UI/Base/Layout/Object/ObjectDetails.php @@ -1,4 +1,5 @@ GetIcon(false); // Note: Class icons are a square image with no margin around, so they need to be zoomed out in the medallion - $sIconCoverMethod = $oObject->HasInstanceIcon() && !$oObject->HasHighlightIcon() ? static::ENUM_ICON_COVER_METHOD_COVER : static::ENUM_ICON_COVER_METHOD_ZOOMOUT; + $sIconCoverMethod = $oObject->HasInstanceIcon() && !$oObject->HasHighlightIcon() ? static::ENUM_ICON_COVER_METHOD_COVER : static::ENUM_ICON_COVER_METHOD_ZOOMOUT; $this->SetIcon($sIconUrl, $sIconCoverMethod, true); } @@ -288,4 +288,4 @@ class ObjectDetails extends Panel implements iKeyboardShortcut { return "[data-role='".static::BLOCK_CODE."']"; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/Object/ObjectFactory.php b/sources/Application/UI/Base/Layout/Object/ObjectFactory.php index 814dee276..c74751842 100644 --- a/sources/Application/UI/Base/Layout/Object/ObjectFactory.php +++ b/sources/Application/UI/Base/Layout/Object/ObjectFactory.php @@ -1,4 +1,5 @@ oObject = $oObject; - + $this->ComputeDetails(); $this->SetToolBlocks([]); $this->ComputeActions(); @@ -63,25 +62,26 @@ class ObjectSummary extends ObjectDetails /** * Compute object zlists and build the Field map that will be displayed - * + * * @return void * @throws \ArchivedObjectException * @throws \CoreException * @throws \DictExceptionMissingString */ - public function ComputeDetails(){ + public function ComputeDetails() + { $sClass = $this->sClassName; - + $aDetailsList = MetaModel::GetZListItems($sClass, 'summary'); - - if(empty($aDetailsList)){ + + if (empty($aDetailsList)) { $aComplementAttributeSpec = MetaModel::GetNameSpec($sClass, FriendlyNameType::COMPLEMENTARY); $aAdditionalField = $aComplementAttributeSpec[1]; if (!empty($aAdditionalField)) { $aDetailsList = $aAdditionalField; } } - + $aFieldsMap = []; foreach ($aDetailsList as $sAttCode) { $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); @@ -91,10 +91,9 @@ class ObjectSummary extends ObjectDetails $this->aObjectDisplayValues = $aFieldsMap; } - /** * Build the Actions that will be displayed in the summary header - * + * * @return void * @throws \Exception */ @@ -103,27 +102,26 @@ class ObjectSummary extends ObjectDetails $oRouter = Router::GetInstance(); $oDetailsButton = null; // We can pass a DBObject to the UIBlock, so we check for the DisplayModifyForm method - if(method_exists($this->oObject, 'DisplayModifyForm') && UserRights::IsActionAllowed($this->sClassName, UR_ACTION_MODIFY)) { + if (method_exists($this->oObject, 'DisplayModifyForm') && UserRights::IsActionAllowed($this->sClassName, UR_ACTION_MODIFY)) { $oPopoverMenu = new PopoverMenu(); - + $oDetailsAction = new URLPopupMenuItem( 'UI:Menu:View', Dict::S('UI:Menu:View'), ApplicationContext::MakeObjectUrl($this->sClassName, $this->sObjectId), '_blank' - ); + ); $oModifyButton = ButtonUIBlockFactory::MakeLinkNeutral( $oRouter->GenerateUrl('object.modify', ['class' => $this->sClassName, 'id' => $this->sObjectId]), Dict::S('UI:Menu:Modify'), 'fas fa-external-link-alt', '_blank', ); - + $oPopoverMenu->AddItem('more-actions', PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem($oDetailsAction))->SetContainer(PopoverMenu::ENUM_CONTAINER_PARENT); - + $oDetailsButton = ButtonGroupUIBlockFactory::MakeButtonWithOptionsMenu($oModifyButton, $oPopoverMenu); - } - else { + } else { $oDetailsButton = ButtonUIBlockFactory::MakeLinkNeutral( ApplicationContext::MakeObjectUrl($this->sClassName, $this->sObjectId), Dict::S('UI:Menu:View'), @@ -131,7 +129,7 @@ class ObjectSummary extends ObjectDetails '_blank', ); } - + $this->oActions = $oDetailsButton; $this->AddToolbarBlock($oDetailsButton); } @@ -158,7 +156,8 @@ class ObjectSummary extends ObjectDetails /** * @return array */ - public function GetDisplayValues() { + public function GetDisplayValues() + { return $this->aObjectDisplayValues; } @@ -188,4 +187,4 @@ class ObjectSummary extends ObjectDetails { return ""; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/PageContent/PageContent.php b/sources/Application/UI/Base/Layout/PageContent/PageContent.php index d202e3146..19a4b564a 100644 --- a/sources/Application/UI/Base/Layout/PageContent/PageContent.php +++ b/sources/Application/UI/Base/Layout/PageContent/PageContent.php @@ -1,4 +1,5 @@ SetMainBlocks([]); @@ -69,7 +71,8 @@ class PageContent extends UIBlock implements iUIContentBlock { * * @return $this */ - public function SetMainBlocks(array $aBlocks) { + public function SetMainBlocks(array $aBlocks) + { $this->SetContentAreaBlocks(static::ENUM_CONTENT_AREA_MAIN, $aBlocks); return $this; @@ -81,7 +84,8 @@ class PageContent extends UIBlock implements iUIContentBlock { * @return \Combodo\iTop\Application\UI\Base\iUIBlock[] * @throws \Exception */ - public function GetMainBlocks() { + public function GetMainBlocks() + { return $this->GetContentAreaBlocks(static::ENUM_CONTENT_AREA_MAIN); } @@ -137,7 +141,8 @@ class PageContent extends UIBlock implements iUIContentBlock { * * @return $this */ - public function SetExtraHtmlContent(string $sExtraHtmlContent) { + public function SetExtraHtmlContent(string $sExtraHtmlContent) + { $this->sExtraHtmlContent = $sExtraHtmlContent; return $this; @@ -148,7 +153,8 @@ class PageContent extends UIBlock implements iUIContentBlock { * * @return string */ - public function GetExtraHtmlContent() { + public function GetExtraHtmlContent() + { return $this->sExtraHtmlContent; } @@ -159,7 +165,8 @@ class PageContent extends UIBlock implements iUIContentBlock { /** * @inheritDoc */ - public function AddHtml(string $sHtml) { + public function AddHtml(string $sHtml) + { $oBlock = new Html($sHtml); $this->AddMainBlock($oBlock); @@ -171,7 +178,8 @@ class PageContent extends UIBlock implements iUIContentBlock { * * @inheritDoc */ - public function AddSubBlock(?iUIBlock $oSubBlock) { + public function AddSubBlock(?iUIBlock $oSubBlock) + { if ($oSubBlock) { $this->AddMainBlock($oSubBlock); } @@ -185,7 +193,8 @@ class PageContent extends UIBlock implements iUIContentBlock { * * @return $this */ - public function RemoveSubBlock(string $sId) { + public function RemoveSubBlock(string $sId) + { foreach ($this->GetContentAreas() as $oContentArea) { $oContentArea->RemoveSubBlock($sId); } @@ -200,7 +209,8 @@ class PageContent extends UIBlock implements iUIContentBlock { * * @return bool */ - public function HasSubBlock(string $sId): bool { + public function HasSubBlock(string $sId): bool + { foreach ($this->GetContentAreas() as $oContentArea) { if ($oContentArea->HasSubBlock($sId)) { return true; @@ -215,7 +225,8 @@ class PageContent extends UIBlock implements iUIContentBlock { * * @inheritDoc */ - public function GetSubBlock(string $sId): ?iUIBlock { + public function GetSubBlock(string $sId): ?iUIBlock + { foreach ($this->GetContentAreas() as $oContentArea) { $oSubBlock = $oContentArea->GetSubBlock($sId); if (!is_null($oSubBlock)) { diff --git a/sources/Application/UI/Base/Layout/PageContent/PageContentFactory.php b/sources/Application/UI/Base/Layout/PageContent/PageContentFactory.php index 1fbb9d44d..9046ea085 100644 --- a/sources/Application/UI/Base/Layout/PageContent/PageContentFactory.php +++ b/sources/Application/UI/Base/Layout/PageContent/PageContentFactory.php @@ -1,4 +1,5 @@ SetSideBlocks([]); @@ -58,7 +60,8 @@ class PageContentWithSideContent extends PageContent { * * @return $this */ - public function SetSideBlocks(array $aBlocks) { + public function SetSideBlocks(array $aBlocks) + { $this->SetContentAreaBlocks(static::ENUM_CONTENT_AREA_SIDE, $aBlocks); return $this; @@ -70,7 +73,8 @@ class PageContentWithSideContent extends PageContent { * @return \Combodo\iTop\Application\UI\Base\iUIBlock[] * @throws \Exception */ - public function GetSideBlocks(): array { + public function GetSideBlocks(): array + { return $this->GetContentAreaBlocks(static::ENUM_CONTENT_AREA_SIDE); } @@ -82,7 +86,8 @@ class PageContentWithSideContent extends PageContent { * * @return $this */ - public function AddSideBlock(iUIBlock $oBlock) { + public function AddSideBlock(iUIBlock $oBlock) + { $this->AddBlockToContentArea(static::ENUM_CONTENT_AREA_SIDE, $oBlock); return $this; @@ -95,7 +100,8 @@ class PageContentWithSideContent extends PageContent { * * @return $this */ - public function AddSideHtml(string $sHtml) { + public function AddSideHtml(string $sHtml) + { $this->AddBlockToContentArea(static::ENUM_CONTENT_AREA_SIDE, new Html($sHtml)); return $this; @@ -123,4 +129,4 @@ class PageContentWithSideContent extends PageContent { { return parent::HasSubBlocks() || !empty($this->GetSideBlocks()); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Base/Layout/TabContainer/Tab/AjaxTab.php b/sources/Application/UI/Base/Layout/TabContainer/Tab/AjaxTab.php index 343042bb8..ed8009b72 100644 --- a/sources/Application/UI/Base/Layout/TabContainer/Tab/AjaxTab.php +++ b/sources/Application/UI/Base/Layout/TabContainer/Tab/AjaxTab.php @@ -1,4 +1,5 @@ sUrl = $sUrl; return $this; @@ -101,7 +101,8 @@ class AjaxTab extends Tab /** * @return string */ - public function GetUrl(): string { + public function GetUrl(): string + { return $this->sUrl; } @@ -112,7 +113,8 @@ class AjaxTab extends Tab * * @return $this */ - public function SetCache(bool $bCache) { + public function SetCache(bool $bCache) + { $this->bCache = $bCache; return $this; @@ -123,7 +125,8 @@ class AjaxTab extends Tab * * @return string */ - public function GetCache(): string { + public function GetCache(): string + { return $this->bCache ? 'true' : 'false'; } @@ -133,7 +136,8 @@ class AjaxTab extends Tab * * @return $this */ - public function SetPlaceholderRelPath(string $sPlaceholderRelPath) { + public function SetPlaceholderRelPath(string $sPlaceholderRelPath) + { $this->sPlaceholderRelPath = $sPlaceholderRelPath; return $this; @@ -143,7 +147,8 @@ class AjaxTab extends Tab * * @return string */ - public function GetPlaceholderRelPath(): string { + public function GetPlaceholderRelPath(): string + { return $this->sPlaceholderRelPath; } @@ -152,7 +157,8 @@ class AjaxTab extends Tab * @return string * @throws \Exception */ - public function GetPlaceholderAbsPath(): string { + public function GetPlaceholderAbsPath(): string + { return utils::GetAbsoluteUrlAppRoot().$this->sPlaceholderRelPath; } @@ -163,7 +169,8 @@ class AjaxTab extends Tab /** * @inheritDoc */ - public function GetParameters(): array { + public function GetParameters(): array + { $aParams = parent::GetParameters(); $aParams['sURL'] = $this->GetUrl(); @@ -180,7 +187,8 @@ class AjaxTab extends Tab * @inheritDoc * @throws \Combodo\iTop\Application\UI\Base\UIException */ - public function AddHtml(string $sHtml) { + public function AddHtml(string $sHtml) + { throw new UIException($this, Dict::Format('UIBlock:Error:AddBlockForbidden', $this->GetId())); } @@ -188,14 +196,16 @@ class AjaxTab extends Tab * @inheritDoc * @throws \Combodo\iTop\Application\UI\Base\UIException */ - public function AddSubBlock(?iUIBlock $oSubBlock) { + public function AddSubBlock(?iUIBlock $oSubBlock) + { throw new UIException($this, Dict::Format('UIBlock:Error:AddBlockForbidden', $this->GetId())); } /** * @inheritDoc */ - public function GetSubBlocks(): array { + public function GetSubBlocks(): array + { return []; } } diff --git a/sources/Application/UI/Base/Layout/TabContainer/Tab/Tab.php b/sources/Application/UI/Base/Layout/TabContainer/Tab/Tab.php index 0898371c3..eeec4f3c7 100644 --- a/sources/Application/UI/Base/Layout/TabContainer/Tab/Tab.php +++ b/sources/Application/UI/Base/Layout/TabContainer/Tab/Tab.php @@ -1,4 +1,5 @@ $this->GetId(), - 'aTabs' => $aTabs + 'aTabs' => $aTabs, ]; } @@ -193,7 +192,8 @@ class TabContainer extends UIContentBlock * * @return $this */ - public function SetLayout($sLayout) { + public function SetLayout($sLayout) + { $this->sLayout = $sLayout; return $this; @@ -202,7 +202,8 @@ class TabContainer extends UIContentBlock /** * @return string */ - public function GetLayout(): string { + public function GetLayout(): string + { return $this->sLayout; } @@ -210,7 +211,8 @@ class TabContainer extends UIContentBlock * @param bool $bIsScrollable * @return $this */ - public function SetIsScrollable($bIsScrollable) { + public function SetIsScrollable($bIsScrollable) + { $this->bIsScrollable = $bIsScrollable; return $this; @@ -219,7 +221,8 @@ class TabContainer extends UIContentBlock /** * @return bool */ - public function GetIsScrollable(): bool { + public function GetIsScrollable(): bool + { return $this->bIsScrollable; } } diff --git a/sources/Application/UI/Base/Layout/TopBar/TopBar.php b/sources/Application/UI/Base/Layout/TopBar/TopBar.php index bbb6f4ea6..680ee5263 100644 --- a/sources/Application/UI/Base/Layout/TopBar/TopBar.php +++ b/sources/Application/UI/Base/Layout/TopBar/TopBar.php @@ -1,4 +1,5 @@ no matter its options / CSS classes / ... */ protected $bHasForcedDiv; diff --git a/sources/Application/UI/Base/Layout/UIContentBlockUIBlockFactory.php b/sources/Application/UI/Base/Layout/UIContentBlockUIBlockFactory.php index a760abf74..ec8cd41e7 100644 --- a/sources/Application/UI/Base/Layout/UIContentBlockUIBlockFactory.php +++ b/sources/Application/UI/Base/Layout/UIContentBlockUIBlockFactory.php @@ -1,13 +1,12 @@ aJsFilesRelPath)) { + if (!in_array($sPath, $this->aJsFilesRelPath)) { $this->aJsFilesRelPath[] = $sPath; } @@ -357,7 +359,7 @@ abstract class UIBlock implements iUIBlock */ public function AddMultipleJsFilesRelPaths(array $aPaths) { - foreach($aPaths as $sPath){ + foreach ($aPaths as $sPath) { $this->AddJsFileRelPath($sPath); } @@ -369,7 +371,7 @@ abstract class UIBlock implements iUIBlock */ public function AddCssFileRelPath(string $sPath) { - if(!in_array($sPath, $this->aCssFilesRelPath)) { + if (!in_array($sPath, $this->aCssFilesRelPath)) { $this->aCssFilesRelPath[] = $sPath; } @@ -381,7 +383,7 @@ abstract class UIBlock implements iUIBlock */ public function AddMultipleCssFilesRelPaths(array $aPaths) { - foreach($aPaths as $sPath){ + foreach ($aPaths as $sPath) { $this->AddCssFileRelPath($sPath); } diff --git a/sources/Application/UI/Base/UIException.php b/sources/Application/UI/Base/UIException.php index a61b4ee73..caa0245dc 100644 --- a/sources/Application/UI/Base/UIException.php +++ b/sources/Application/UI/Base/UIException.php @@ -1,13 +1,12 @@ aContentAreasBlocks); } @@ -40,7 +43,8 @@ trait tUIContentAreas { * * @return \Combodo\iTop\Application\UI\Base\Layout\iUIContentBlock[] */ - protected function GetContentAreas(): array { + protected function GetContentAreas(): array + { return $this->aContentAreasBlocks; } @@ -51,7 +55,8 @@ trait tUIContentAreas { * * @return bool */ - protected function IsExistingContentArea(string $sAreaId): bool { + protected function IsExistingContentArea(string $sAreaId): bool + { return isset($this->aContentAreasBlocks[$sAreaId]); } @@ -197,7 +202,8 @@ trait tUIContentAreas { * * @return $this */ - protected function RemoveBlockFromContentArea(string $sAreaId, string $sBlockId) { + protected function RemoveBlockFromContentArea(string $sAreaId, string $sBlockId) + { if (array_key_exists($sAreaId, $this->aContentAreasBlocks)) { $this->aContentAreasBlocks[$sAreaId]->RemoveSubBlock($sBlockId); } diff --git a/sources/Application/UI/DisplayBlock/BlockChart/BlockChart.php b/sources/Application/UI/DisplayBlock/BlockChart/BlockChart.php index 88ed71ae3..ed51da31b 100644 --- a/sources/Application/UI/DisplayBlock/BlockChart/BlockChart.php +++ b/sources/Application/UI/DisplayBlock/BlockChart/BlockChart.php @@ -1,4 +1,5 @@ sTargetClass = $this->GetTargetClass(); - + // User rights $this->bIsAllowCreate = $this->bIsAttEditable && UserRights::IsActionAllowed($this->oAttDef->GetLinkedClass(), UR_ACTION_CREATE) == UR_ALLOWED_YES; $this->bIsAllowModify = $this->bIsAttEditable && UserRights::IsActionAllowed($this->oAttDef->GetLinkedClass(), UR_ACTION_MODIFY) == UR_ALLOWED_YES; $this->bIsAllowDelete = $this->bIsAttEditable && UserRights::IsActionAllowed($this->oAttDef->GetLinkedClass(), UR_ACTION_DELETE) == UR_ALLOWED_YES; } - /** * @param string $sKey * @param \DBObject|null $oDBObject @@ -141,12 +141,16 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock */ public function GetDictionaryEntry(string $sKey, DBObject $oDBObject = null) { - return $this->oAttDef->SearchSpecificLabel($sKey, '', true, + return $this->oAttDef->SearchSpecificLabel( + $sKey, + '', + true, MetaModel::GetName($this->sObjectClass), $this->oDbObject->Get('friendlyname'), $this->oAttDef->GetLabel(), MetaModel::GetName($this->sTargetClass), - $oDBObject !== null ? $oDBObject->Get('friendlyname') : '{item}'); + $oDBObject !== null ? $oDBObject->Get('friendlyname') : '{item}' + ); } /** @@ -199,9 +203,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock $oBlock = new DisplayBlock($oLinkSet->GetFilter(), DisplayBlock::ENUM_STYLE_LIST_IN_OBJECT, false); $this->AddSubBlock($oBlock->GetRenderContent($oPage, $this->GetExtraParam(), $this->sTableId)); } - - - + /** * GetTableId. * @@ -233,7 +235,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock * @throws ArchivedObjectException * @throws CoreException */ - abstract function GetExtraParam(): array; + abstract public function GetExtraParam(): array; /** * Return row actions. @@ -244,7 +246,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock * * @return string[][] */ - abstract function GetRowActions(): array; + abstract public function GetRowActions(): array; /** * GetTargetClass. @@ -254,8 +256,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock * @return string * @throws Exception */ - abstract function GetTargetClass(): string; - + abstract public function GetTargetClass(): string; /** * GetAttCode. @@ -296,4 +297,4 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock { return "oWidget{$this->GetId()}"; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Links/Direct/BlockDirectLinkSetEditTable.php b/sources/Application/UI/Links/Direct/BlockDirectLinkSetEditTable.php index b302c5ce7..c28baf7cf 100644 --- a/sources/Application/UI/Links/Direct/BlockDirectLinkSetEditTable.php +++ b/sources/Application/UI/Links/Direct/BlockDirectLinkSetEditTable.php @@ -1,4 +1,5 @@ oUILinksDirectWidget = $oUILinksDirectWidget; // compute - $this->aLabels = array( + $this->aLabels = [ 'creation_title' => Dict::Format('UI:CreationTitle_Class', MetaModel::GetName($this->oUILinksDirectWidget->GetLinkedClass())), 'selection_title' => Dict::Format('UI:SelectionOf_Class', MetaModel::GetName($this->oUILinksDirectWidget->GetLinkedClass())), - ); + ]; $oContext = new ApplicationContext(); $this->sSubmitUrl = utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?'.$oContext->GetForLink(); @@ -182,8 +183,7 @@ class BlockDirectLinkSetEditTable extends UIContentBlock $oTablePanel->AddToolbarBlock($oToolbar); $oTablePanel->AddSubBlock($oDatatable); $this->AddSubBlock($oTablePanel); - } - catch (\Exception $e) { + } catch (\Exception $e) { $oAlert = AlertUIBlockFactory::MakeForDanger('error', Dict::S('UI:Datatables:Language:Error')); $oAlert->SetIsClosable(false); $oAlert->SetIsCollapsible(false); @@ -217,20 +217,20 @@ class BlockDirectLinkSetEditTable extends UIContentBlock case LINKSET_EDITMODE_INPLACE: // The whole linkset can be edited 'in-place' case LINKSET_EDITMODE_ACTIONS: // Show the usual 'Actions' popup menu - if ($this->bIsAllowCreate) { - $oActionButtonCreate = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Create')); - $oActionButtonCreate->SetTooltip(Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($this->oAttributeLinkedSet->GetLinkedClass()))) - ->AddDataAttribute('action', 'create') - ->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('createRow');"); - $oToolbar->AddSubBlock($oActionButtonCreate); - } + if ($this->bIsAllowCreate) { + $oActionButtonCreate = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Create')); + $oActionButtonCreate->SetTooltip(Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($this->oAttributeLinkedSet->GetLinkedClass()))) + ->AddDataAttribute('action', 'create') + ->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('createRow');"); + $oToolbar->AddSubBlock($oActionButtonCreate); + } - if ($this->bIsAllowDelete) { - $oActionButtonDelete = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Delete')); - $oActionButtonDelete->AddDataAttribute('action', 'delete') - ->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('deleteSelection');"); - $oToolbar->AddSubBlock($oActionButtonDelete); - } + if ($this->bIsAllowDelete) { + $oActionButtonDelete = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Delete')); + $oActionButtonDelete->AddDataAttribute('action', 'delete') + ->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('deleteSelection');"); + $oToolbar->AddSubBlock($oActionButtonDelete); + } break; case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place' @@ -273,14 +273,14 @@ class BlockDirectLinkSetEditTable extends UIContentBlock private function GetTableRows(WebPage $oPage, iDBObjectSetIterator $oValue): array { // result data - $aRows = array(); + $aRows = []; // set pointer to start $oValue->Rewind(); // create a row table for each value... while ($oLinkObj = $oValue->Fetch()) { - $aRow = array(); + $aRow = []; $aRow['form::select'] = ''; foreach ($this->oUILinksDirectWidget->GetZList() as $sLinkedAttCode) { $aRow[$sLinkedAttCode] = $oLinkObj->GetAsHTML($sLinkedAttCode); @@ -307,19 +307,27 @@ class BlockDirectLinkSetEditTable extends UIContentBlock */ private function GetRowActions(DBObject $oHostObject): array { - $aRowActions = array(); + $aRowActions = []; - $sDeleteButtonTooltip = $this->oAttributeLinkedSet->SearchSpecificLabel('UI:Links:Delete:Button+', '', true, + $sDeleteButtonTooltip = $this->oAttributeLinkedSet->SearchSpecificLabel( + 'UI:Links:Delete:Button+', + '', + true, MetaModel::GetName($this->oAttributeLinkedSet->GetHostClass()), $oHostObject->Get('friendlyname'), $this->oAttributeLinkedSet->GetLabel(), - MetaModel::GetName($this->oUILinksDirectWidget->GetLinkedClass())); + MetaModel::GetName($this->oUILinksDirectWidget->GetLinkedClass()) + ); - $sRemoveButtonTooltip = $this->oAttributeLinkedSet->SearchSpecificLabel('UI:Links:Remove:Button+', '', true, + $sRemoveButtonTooltip = $this->oAttributeLinkedSet->SearchSpecificLabel( + 'UI:Links:Remove:Button+', + '', + true, MetaModel::GetName($this->oAttributeLinkedSet->GetHostClass()), $oHostObject->Get('friendlyname'), $this->oAttributeLinkedSet->GetLabel(), - MetaModel::GetName($this->oUILinksDirectWidget->GetLinkedClass())); + MetaModel::GetName($this->oUILinksDirectWidget->GetLinkedClass()) + ); // until a full link set refactoring (continue using edit_mode property) switch ($this->oAttributeLinkedSet->GetEditMode()) { @@ -331,24 +339,24 @@ class BlockDirectLinkSetEditTable extends UIContentBlock case LINKSET_EDITMODE_INPLACE: // The whole linkset can be edited 'in-place' case LINKSET_EDITMODE_ACTIONS: // Show the usual 'Actions' popup menu - if ($this->bIsAllowDelete) { - $aRowActions[] = array( - 'label' => 'UI:Links:Delete:Button', - 'tooltip' => $sDeleteButtonTooltip, - 'icon_classes' => 'fas fa-trash', - 'js_row_action' => "$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('Remove', $(':checkbox', oTrElement));", - ); - } + if ($this->bIsAllowDelete) { + $aRowActions[] = [ + 'label' => 'UI:Links:Delete:Button', + 'tooltip' => $sDeleteButtonTooltip, + 'icon_classes' => 'fas fa-trash', + 'js_row_action' => "$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('Remove', $(':checkbox', oTrElement));", + ]; + } break; case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place' if ($this->bIsAllowModify) { - $aRowActions[] = array( + $aRowActions[] = [ 'label' => 'UI:Links:Remove:Button', 'tooltip' => $sRemoveButtonTooltip, 'icon_classes' => 'fas fa-minus', 'js_row_action' => "$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('Remove', $(':checkbox', oTrElement));", - ); + ]; } break; @@ -358,4 +366,4 @@ class BlockDirectLinkSetEditTable extends UIContentBlock return $aRowActions; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Links/Direct/BlockDirectLinkSetViewTable.php b/sources/Application/UI/Links/Direct/BlockDirectLinkSetViewTable.php index c86a3995e..c50cb5c2a 100644 --- a/sources/Application/UI/Links/Direct/BlockDirectLinkSetViewTable.php +++ b/sources/Application/UI/Links/Direct/BlockDirectLinkSetViewTable.php @@ -1,4 +1,5 @@ $this->oAttDef->GetExtKeyToMe(), 'object_id' => $this->oDbObject->GetKey(), 'menu' => MetaModel::GetConfig()->Get('allow_menu_on_linkset'), @@ -41,7 +42,7 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable 'currentId' => $this->GetTableId(), 'panel_title' => $this->oAttDef->GetLabel(), 'panel_icon' => MetaModel::GetClassIcon($this->GetTargetClass(), false), - ); + ]; // Description if ($this->oAttDef->HasDescription()) { @@ -65,7 +66,7 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable /** @inheritdoc * */ public function GetRowActions(): array { - $aRowActions = array(); + $aRowActions = []; // until a full link set refactoring (continue using edit_mode property) switch ($this->oAttDef->GetEditMode()) { @@ -74,7 +75,7 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable case LINKSET_EDITMODE_ADDONLY: // The only possible action is to open (in a new window) the form to create a new object if ($this->bIsAllowModify) { - $aRowActions[] = array( + $aRowActions[] = [ 'label' => 'UI:Links:ModifyObject:Button', 'name' => 'ModifyButton', 'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_BUTTON_TOOLTIP), @@ -83,47 +84,14 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable 'metadata' => [ 'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_MODAL_TITLE), ], - ); + ]; } break; case LINKSET_EDITMODE_INPLACE: // The whole linkset can be edited 'in-place' case LINKSET_EDITMODE_ACTIONS: // Show the usual 'Actions' popup menu - if ($this->bIsAllowModify) { - $aRowActions[] = array( - 'label' => 'UI:Links:ModifyObject:Button', - 'name' => 'ModifyButton', - 'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_BUTTON_TOOLTIP), - 'icon_classes' => 'fas fa-pen', - 'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], oTrElement, aRowData['{$this->sTargetClass}/friendlyname']);", - 'metadata' => [ - 'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_MODAL_TITLE), - ], - ); - } - - if ($this->bIsAllowDelete) { - $aRowActions[] = array( - 'label' => 'UI:Links:Delete:Button', - 'name' => 'DeleteButton', - 'tooltip' => $this->GetDictionaryEntry(static::DICT_DELETE_BUTTON_TOOLTIP), - 'icon_classes' => 'fas fa-trash', - 'color' => Button::ENUM_COLOR_SCHEME_DESTRUCTIVE, - 'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DeleteLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], oTrElement);", - 'confirmation' => [ - 'title' => $this->GetDictionaryEntry(static::DICT_DELETE_MODAL_TITLE), - 'message' => $this->GetDictionaryEntry(static::DICT_DELETE_MODAL_MESSAGE), - 'confirm_button_class' => 'ibo-is-danger', - 'row_data' => "{$this->sTargetClass}/hyperlink", - 'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(), - ], - ); - } - break; - - case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place' if ($this->bIsAllowModify) { - $aRowActions[] = array( + $aRowActions[] = [ 'label' => 'UI:Links:ModifyObject:Button', 'name' => 'ModifyButton', 'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_BUTTON_TOOLTIP), @@ -132,11 +100,44 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable 'metadata' => [ 'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_MODAL_TITLE), ], - ); + ]; + } + + if ($this->bIsAllowDelete) { + $aRowActions[] = [ + 'label' => 'UI:Links:Delete:Button', + 'name' => 'DeleteButton', + 'tooltip' => $this->GetDictionaryEntry(static::DICT_DELETE_BUTTON_TOOLTIP), + 'icon_classes' => 'fas fa-trash', + 'color' => Button::ENUM_COLOR_SCHEME_DESTRUCTIVE, + 'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DeleteLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], oTrElement);", + 'confirmation' => [ + 'title' => $this->GetDictionaryEntry(static::DICT_DELETE_MODAL_TITLE), + 'message' => $this->GetDictionaryEntry(static::DICT_DELETE_MODAL_MESSAGE), + 'confirm_button_class' => 'ibo-is-danger', + 'row_data' => "{$this->sTargetClass}/hyperlink", + 'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(), + ], + ]; + } + break; + + case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place' + if ($this->bIsAllowModify) { + $aRowActions[] = [ + 'label' => 'UI:Links:ModifyObject:Button', + 'name' => 'ModifyButton', + 'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_BUTTON_TOOLTIP), + 'icon_classes' => 'fas fa-pen', + 'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], oTrElement, aRowData['{$this->sTargetClass}/friendlyname']);", + 'metadata' => [ + 'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_MODAL_TITLE), + ], + ]; } if ($this->bIsAllowModify) { - $aRowActions[] = array( + $aRowActions[] = [ 'label' => 'UI:Links:Remove:Button', 'name' => 'RemoveButton', 'tooltip' => $this->GetDictionaryEntry(static::DICT_REMOVE_BUTTON_TOOLTIP), @@ -148,7 +149,7 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable 'row_data' => "{$this->sTargetClass}/hyperlink", 'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(), ], - ); + ]; } break; @@ -169,7 +170,7 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable */ private function GetDefault(): array { - $aDefaults = array($this->oAttDef->GetExtKeyToMe() => $this->oDbObject->GetKey()); + $aDefaults = [$this->oAttDef->GetExtKeyToMe() => $this->oDbObject->GetKey()]; $oAppContext = new \ApplicationContext(); foreach ($oAppContext->GetNames() as $sKey) { if (MetaModel::IsValidAttCode($this->sObjectClass, $sKey)) { @@ -179,4 +180,4 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable return $aDefaults; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php b/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php index 85187862b..85f6228af 100644 --- a/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php +++ b/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php @@ -1,4 +1,5 @@ sWizHelper = 'oWizardHelper'.$sFormPrefix; $oValue->Rewind(); $bAllowRemoteExtKeyEdit = $oValue->Count() <= utils::GetConfig()->Get('link_set_max_edit_ext_key'); - $aForm = array(); + $aForm = []; $iMaxAddedId = 0; $iAddedId = -1; // Unique id for new links $this->aRemoved = json_decode(\utils::ReadPostedParam("attr_{$sFormPrefix}{$this->oUILinksWidget->GetAttCode()}_tbd", '[]', 'raw_data'), true); @@ -174,7 +175,8 @@ class BlockIndirectLinkSetEditTable extends UIContentBlock $sAttCode = substr($sName, strlen($sPrefix)); $oCurrentLink->Set($sAttCode, $sValue); $sEscapedValue = addslashes($sValue); - $oPage->add_ready_script(<<add_ready_script( + <<oUILinksWidget->GetInputId()}.OnValueChange($sCurrentLinkId, $iAddedId, "$sAttCode", "$sEscapedValue"); EOF ); @@ -190,8 +192,6 @@ EOF $oLinkedObj = MetaModel::GetObject($this->oUILinksWidget->GetRemoteClass(), $oCurrentLink->Get($this->oUILinksWidget->GetExternalKeyToRemote()), false /* Must not be found */, true); } - - $iMaxAddedId = max($iMaxAddedId, $key); $aForm[$key] = $this->GetFormRow($oPage, $oLinkedObj, $oCurrentLink, $aArgs, $oCurrentObj, $key, $bReadOnly, $bAllowRemoteExtKeyEdit); } @@ -267,8 +267,8 @@ EOF public function GetFormRow(WebPage $oP, DBObject $oLinkedObj, $linkObjOrId, $aArgs, $oCurrentObj, $iUniqueId, $bReadOnly = false, $bAllowRemoteExtKeyEdit = true) { $sPrefix = "{$this->oUILinksWidget->GetAttCode()}{$this->oUILinksWidget->GetNameSuffix()}"; - $aRow = array(); - $aFieldsMap = array(); + $aRow = []; + $aFieldsMap = []; $iKey = 0; if (is_object($linkObjOrId) && (!$linkObjOrId->IsNew())) { @@ -299,23 +299,30 @@ EOF } $sState = $linkObjOrId->GetState(); - $sRemoteKeySafeFieldId = $this->GetFieldId($aArgs['this']->GetKey(), $this->oUILinksWidget->GetExternalKeyToRemote());; + $sRemoteKeySafeFieldId = $this->GetFieldId($aArgs['this']->GetKey(), $this->oUILinksWidget->GetExternalKeyToRemote()); + ; } else { // form for creating a new record if (is_object($linkObjOrId)) { // New link existing only in memory $oNewLinkObj = $linkObjOrId; $iRemoteObjKey = $oNewLinkObj->Get($this->oUILinksWidget->GetExternalKeyToRemote()); - $oNewLinkObj->Set($this->oUILinksWidget->GetExternalKeyToMe(), - $oCurrentObj); // Setting the extkey with the object also fills the related external fields + $oNewLinkObj->Set( + $this->oUILinksWidget->GetExternalKeyToMe(), + $oCurrentObj + ); // Setting the extkey with the object also fills the related external fields } else { $iRemoteObjKey = $linkObjOrId; $oNewLinkObj = MetaModel::NewObject($this->oUILinksWidget->GetLinkedClass()); $oRemoteObj = MetaModel::GetObject($this->oUILinksWidget->GetRemoteClass(), $iRemoteObjKey); - $oNewLinkObj->Set($this->oUILinksWidget->GetExternalKeyToRemote(), - $oRemoteObj); // Setting the extkey with the object alsoo fills the related external fields - $oNewLinkObj->Set($this->oUILinksWidget->GetExternalKeyToMe(), - $oCurrentObj); // Setting the extkey with the object also fills the related external fields + $oNewLinkObj->Set( + $this->oUILinksWidget->GetExternalKeyToRemote(), + $oRemoteObj + ); // Setting the extkey with the object alsoo fills the related external fields + $oNewLinkObj->Set( + $this->oUILinksWidget->GetExternalKeyToMe(), + $oCurrentObj + ); // Setting the extkey with the object also fills the related external fields } $sPrefix .= "[-$iUniqueId]["; $sNameSuffix = "]"; // To make a tabular form @@ -328,20 +335,21 @@ EOF if ($iUniqueId > 0) { // Rows created with ajax call need OnLinkAdded call. // - $oP->add_ready_script( - <<add_ready_script( + <<oUILinksWidget->GetInputId()}.OnLinkAdded($iUniqueId, $iRemoteObjKey); EOF - ); + ); } else { // Rows added before loading the form don't have to call OnLinkAdded. // Listeners are already present and DOM is not recreated $iPositiveUniqueId = -$iUniqueId; - $oP->add_ready_script(<<add_ready_script( + <<oUILinksWidget->GetInputId()}.AddLink($iPositiveUniqueId, $iRemoteObjKey); EOF - ); + ); } foreach ($this->oUILinksWidget->GetEditableFields() as $sFieldCode) { @@ -353,11 +361,11 @@ EOF $aFieldsMap[$sFieldCode] = $sSafeFieldId; $sValue = $oNewLinkObj->Get($sFieldCode); - $oP->add_ready_script( - <<add_ready_script( + <<oUILinksWidget->GetInputId()}.OnValueChange($iKey, $iUniqueId, '$sFieldCode', '$sValue'); JS - ); + ); } $sState = ''; @@ -439,17 +447,17 @@ JS $sFieldForHtml = $oAttDef->GetAsHTML($sValue); } else { $sFieldForHtml = cmdbAbstractObject::GetFormElementForField( - $oP, - $this->oUILinksWidget->GetLinkedClass(), - $sFieldCode, - $oAttDef, - $sValue, - $sDisplayValue, - $sSafeFieldId, - $sNameSuffix, - 0, - $aArgs - ); + $oP, + $this->oUILinksWidget->GetLinkedClass(), + $sFieldCode, + $oAttDef, + $sValue, + $sDisplayValue, + $sSafeFieldId, + $sNameSuffix, + 0, + $aArgs + ); } $aRow[$sRowFieldCode] = <<oAttributeLinkedSetIndirect->SearchSpecificLabel('UI:Links:Remove:Button+', '', true, + $sRemoveButtonTooltip = $this->oAttributeLinkedSetIndirect->SearchSpecificLabel( + 'UI:Links:Remove:Button+', + '', + true, MetaModel::GetName($this->oAttributeLinkedSetIndirect->GetHostClass()), $oHostObject->Get('friendlyname'), $this->oAttributeLinkedSetIndirect->GetLabel(), - MetaModel::GetName($this->oUILinksWidget->GetRemoteClass())); + MetaModel::GetName($this->oUILinksWidget->GetRemoteClass()) + ); if ($this->bIsAllowDelete) { - $aRowActions[] = array( + $aRowActions[] = [ 'label' => 'UI:Links:Remove:Button', 'tooltip' => $sRemoveButtonTooltip, 'icon_classes' => 'fas fa-minus', 'js_row_action' => "oWidget{$this->oUILinksWidget->GetInputId()}.Remove(oTrElement);", - ); + ]; } return $aRowActions; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetViewTable.php b/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetViewTable.php index 073d636c9..c97c4b785 100644 --- a/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetViewTable.php +++ b/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetViewTable.php @@ -1,4 +1,5 @@ oAttDef->GetLinkedClass(), $this->oAttDef->GetExtKeyToRemote()); return $oLinkingAttDef->GetTargetClass(); - } - catch (Exception $e) { + } catch (Exception $e) { return '?'; } } @@ -38,7 +38,7 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable /** @inheritdoc */ public function GetExtraParam(): array { - $aExtraParams = array( + $aExtraParams = [ 'link_attr' => $this->oAttDef->GetExtKeyToMe(), 'object_id' => $this->oDbObject->GetKey(), 'target_attr' => $this->oAttDef->GetExtKeyToRemote(), @@ -52,7 +52,7 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable 'currentId' => $this->GetTableId(), 'panel_title' => $this->oAttDef->GetLabel(), 'panel_icon' => MetaModel::GetClassIcon($this->GetTargetClass(), false), - ); + ]; // Description if ($this->oAttDef->HasDescription()) { @@ -60,7 +60,7 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable } // Add creation in modal if creation allowed - if ( $this->bIsAllowCreate) { + if ($this->bIsAllowCreate) { $aExtraParams['creation_in_modal'] = true; $aExtraParams['creation_in_modal_tooltip'] = $this->GetDictionaryEntry(static::DICT_ADD_BUTTON_TOOLTIP); $aExtraParams['creation_in_modal_form_title'] = $this->GetDictionaryEntry(static::DICT_ADD_MODAL_TITLE); @@ -75,10 +75,10 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable /** @inheritdoc */ public function GetRowActions(): array { - $aRowActions = array(); + $aRowActions = []; if ($this->bIsAllowModify) { - $aRowActions[] = array( + $aRowActions[] = [ 'label' => 'UI:Links:ModifyLink:Button', 'name' => 'ModifyButton', 'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_LINK_BUTTON_TOOLTIP), @@ -87,11 +87,11 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable 'metadata' => [ 'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_LINK_MODAL_TITLE), ], - ); + ]; } if ($this->bIsAllowDelete) { - $aRowActions[] = array( + $aRowActions[] = [ 'label' => 'UI:Links:Remove:Button', 'name' => 'RemoveButton', 'tooltip' => $this->GetDictionaryEntry(static::DICT_REMOVE_BUTTON_TOOLTIP), @@ -103,7 +103,7 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable 'row_data' => "Remote/hyperlink", 'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(), ], - ); + ]; } return $aRowActions; @@ -126,4 +126,4 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable return $sAttCodesToDisplay; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Links/Indirect/BlockObjectPickerDialog.php b/sources/Application/UI/Links/Indirect/BlockObjectPickerDialog.php index d8cdf0ff0..994b8b629 100644 --- a/sources/Application/UI/Links/Indirect/BlockObjectPickerDialog.php +++ b/sources/Application/UI/Links/Indirect/BlockObjectPickerDialog.php @@ -1,4 +1,5 @@ AddSubBlock(InputUIBlockFactory::MakeForHidden("count_{$this->oUILinksWidget->GetLinkedSetId()}", '0', "count_{$this->oUILinksWidget->GetLinkedSetId()}")); } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Links/Set/BlockLinkSetDisplayAsProperty.php b/sources/Application/UI/Links/Set/BlockLinkSetDisplayAsProperty.php index 39cef28c9..4fcc11527 100644 --- a/sources/Application/UI/Links/Set/BlockLinkSetDisplayAsProperty.php +++ b/sources/Application/UI/Links/Set/BlockLinkSetDisplayAsProperty.php @@ -1,4 +1,5 @@ sUIPage?operation=details&class=$this->sTargetClass&id=$id$this->sAppContext" .'" target="_self"'; } -} \ No newline at end of file +} diff --git a/sources/Application/UI/Links/Set/LinkSetUIBlockFactory.php b/sources/Application/UI/Links/Set/LinkSetUIBlockFactory.php index 325a730fd..99d42f5bc 100644 --- a/sources/Application/UI/Links/Set/LinkSetUIBlockFactory.php +++ b/sources/Application/UI/Links/Set/LinkSetUIBlockFactory.php @@ -1,4 +1,5 @@ m_oTabs->GetCurrentTabLength(); - return array('tc' => $sCurrentTabContainer, 'tab' => $sCurrentTab, 'offset' => $iOffset); + return ['tc' => $sCurrentTabContainer, 'tab' => $sCurrentTab, 'offset' => $iOffset]; } else { return parent::start_capture(); } @@ -344,12 +345,12 @@ class AjaxPage extends WebPage implements iTabbedPage { assert(false); } - + /** * @inheritDoc */ public static function FilterXSS($sHTML) { - return str_ireplace(array(''), array(''), $sHTML); + return str_ireplace([''], [''], $sHTML); } } diff --git a/sources/Application/WebPage/CLILikeWebPage.php b/sources/Application/WebPage/CLILikeWebPage.php index dafd627b4..a6b66a419 100644 --- a/sources/Application/WebPage/CLILikeWebPage.php +++ b/sources/Application/WebPage/CLILikeWebPage.php @@ -1,4 +1,5 @@ add('#'.$sText."
      \n"); diff --git a/sources/Application/WebPage/CLIPage.php b/sources/Application/WebPage/CLIPage.php index bfb7be97b..bb844e82e 100644 --- a/sources/Application/WebPage/CLIPage.php +++ b/sources/Application/WebPage/CLIPage.php @@ -1,9 +1,10 @@ s_title = $s_title; - } + public function __construct($s_title) + { + $this->s_title = $s_title; + } - public function output() - { - if (class_exists('DBSearch')) { - DBSearch::RecordQueryTrace(); - } - if (class_exists('ExecutionKPI')) { - ExecutionKPI::ReportStats(); - } - } + public function output() + { + if (class_exists('DBSearch')) { + DBSearch::RecordQueryTrace(); + } + if (class_exists('ExecutionKPI')) { + ExecutionKPI::ReportStats(); + } + } public function add($sText) { @@ -70,27 +70,21 @@ class CLIPage implements Page echo "#".$sText."\n"; } - public function table($aConfig, $aData, $aParams = array()) + public function table($aConfig, $aData, $aParams = []) { - $aCells = array(); - foreach($aConfig as $sName=>$aDef) - { - if (strlen($aDef['description']) > 0) - { + $aCells = []; + foreach ($aConfig as $sName => $aDef) { + if (strlen($aDef['description']) > 0) { $aCells[] = $aDef['label'].' ('.$aDef['description'].')'; - } - else - { + } else { $aCells[] = $aDef['label']; } } echo implode(';', $aCells)."\n"; - foreach($aData as $aRow) - { - $aCells = array(); - foreach($aConfig as $sName=>$aAttribs) - { + foreach ($aData as $aRow) { + $aCells = []; + foreach ($aConfig as $sName => $aAttribs) { $sValue = $aRow["$sName"]; $aCells[] = $sValue; } diff --git a/sources/Application/WebPage/CSVPage.php b/sources/Application/WebPage/CSVPage.php index 3dc1f5711..6f768a06b 100644 --- a/sources/Application/WebPage/CSVPage.php +++ b/sources/Application/WebPage/CSVPage.php @@ -1,9 +1,10 @@ add_header("Content-type: text/plain; charset=".self::PAGES_CHARSET); - $this->no_cache(); - $this->add_http_headers(); - //$this->add_header("Content-Transfer-Encoding: binary"); - $oKpi->ComputeStats(get_class($this).' creation', 'CSVPage'); - } + public function __construct($s_title) + { + $oKpi = new ExecutionKPI(); + parent::__construct($s_title); + $this->add_header("Content-type: text/plain; charset=".self::PAGES_CHARSET); + $this->no_cache(); + $this->add_http_headers(); + //$this->add_header("Content-Transfer-Encoding: binary"); + $oKpi->ComputeStats(get_class($this).' creation', 'CSVPage'); + } - public function output() - { - $this->add_header("Content-Length: ".strlen(trim($this->s_content))); + public function output() + { + $this->add_header("Content-Length: ".strlen(trim($this->s_content))); - // Get the unexpected output but do nothing with it - $sTrash = $this->ob_get_clean_safe(); + // Get the unexpected output but do nothing with it + $sTrash = $this->ob_get_clean_safe(); - $oKpi = new ExecutionKPI(); - foreach ($this->a_headers as $s_header) { - header($s_header); - } - echo trim($this->s_content); - echo "\n"; - $oKpi->ComputeAndReport('Echoing ('.round(strlen($this->s_content) / 1024).' Kb)'); + $oKpi = new ExecutionKPI(); + foreach ($this->a_headers as $s_header) { + header($s_header); + } + echo trim($this->s_content); + echo "\n"; + $oKpi->ComputeAndReport('Echoing ('.round(strlen($this->s_content) / 1024).' Kb)'); - if (class_exists('DBSearch')) { - DBSearch::RecordQueryTrace(); - } - ExecutionKPI::ReportStats(); - } + if (class_exists('DBSearch')) { + DBSearch::RecordQueryTrace(); + } + ExecutionKPI::ReportStats(); + } public function small_p($sText) { @@ -81,29 +81,23 @@ class CSVPage extends WebPage public function add_comment($sText) { $this->s_content .= "#".$sText."\n"; - } + } - public function table($aConfig, $aData, $aParams = array()) + public function table($aConfig, $aData, $aParams = []) { - $aCells = array(); - foreach($aConfig as $sName=>$aDef) - { - if (strlen($aDef['description']) > 0) - { + $aCells = []; + foreach ($aConfig as $sName => $aDef) { + if (strlen($aDef['description']) > 0) { $aCells[] = $aDef['label'].' ('.$aDef['description'].')'; - } - else - { + } else { $aCells[] = $aDef['label']; } } $this->s_content .= implode(';', $aCells)."\n"; - foreach($aData as $aRow) - { - $aCells = array(); - foreach($aConfig as $sName=>$aAttribs) - { + foreach ($aData as $aRow) { + $aCells = []; + foreach ($aConfig as $sName => $aAttribs) { $sValue = $aRow["$sName"]; $aCells[] = $sValue; } @@ -111,4 +105,3 @@ class CSVPage extends WebPage } } } - diff --git a/sources/Application/WebPage/CaptureWebPage.php b/sources/Application/WebPage/CaptureWebPage.php index f11fefdc9..a9d6db36a 100644 --- a/sources/Application/WebPage/CaptureWebPage.php +++ b/sources/Application/WebPage/CaptureWebPage.php @@ -1,9 +1,10 @@ a_scripts); - if (!empty($this->s_deferred_content)) - { + if (!empty($this->s_deferred_content)) { $sRet .= "\n\$('body').append('".addslashes(str_replace("\n", '', $this->s_deferred_content))."');"; } @@ -93,4 +92,3 @@ class CaptureWebPage extends WebPage throw new Exception(__method__.' should not be called'); } } - diff --git a/sources/Application/WebPage/DownloadPage.php b/sources/Application/WebPage/DownloadPage.php index 0fed20db8..0abc82be1 100644 --- a/sources/Application/WebPage/DownloadPage.php +++ b/sources/Application/WebPage/DownloadPage.php @@ -1,4 +1,5 @@ add("
      $sText
      "); - if(utils::IsEasterEggAllowed()) - { + if (utils::IsEasterEggAllowed()) { $this->add('
      '.Dict::S('UI:ErrorPage:UnstableVersion').'
      '); - $this->add(''); + $this->add(''); $this->add('
      '.nl2br(Dict::S('UI:ErrorPage:KittyDisclaimer')).'
      '); } $this->log_error($sText); diff --git a/sources/Application/WebPage/JsonPPage.php b/sources/Application/WebPage/JsonPPage.php index a469f9f4a..694586871 100644 --- a/sources/Application/WebPage/JsonPPage.php +++ b/sources/Application/WebPage/JsonPPage.php @@ -1,4 +1,5 @@ sCallbackName . '(' . $sContent . ');'; + return $this->sCallbackName.'('.$sContent.');'; } -} \ No newline at end of file +} diff --git a/sources/Application/WebPage/JsonPage.php b/sources/Application/WebPage/JsonPage.php index 2e185ab25..4f8895a81 100644 --- a/sources/Application/WebPage/JsonPage.php +++ b/sources/Application/WebPage/JsonPage.php @@ -1,4 +1,5 @@ add_header('Content-type: ' . $this->sContentType); + $this->add_header('Content-type: '.$this->sContentType); foreach ($this->a_headers as $s_header) { header($s_header); @@ -126,4 +127,4 @@ class JsonPage extends WebPage $oKpi->ComputeAndReport('Echoing ('.round(strlen($sContent) / 1024).' Kb)'); ExecutionKPI::ReportStats(); } -} \ No newline at end of file +} diff --git a/sources/Application/WebPage/NiceWebPage.php b/sources/Application/WebPage/NiceWebPage.php index 4e105a5dc..d2c4ab2af 100644 --- a/sources/Application/WebPage/NiceWebPage.php +++ b/sources/Application/WebPage/NiceWebPage.php @@ -1,4 +1,5 @@ LinkScriptFromAppRoot('node_modules/jquery/dist/jquery.min.js'); $this->LinkScriptFromAppRoot('js/ajax_hook.js'); $this->LinkScriptFromAppRoot('js/jquery.blockUI.js'); - if (utils::IsDevelopmentEnvironment()) // Needed since many other plugins still rely on oldies like $.browser - { + if (utils::IsDevelopmentEnvironment()) { // Needed since many other plugins still rely on oldies like $.browser $this->LinkScriptFromAppRoot('js/jquery-migrate.dev-params.js'); $this->LinkScriptFromAppRoot('node_modules/jquery-migrate/dist/jquery-migrate.js'); } else { @@ -180,12 +180,11 @@ JS $this->add_dict_entries('UI:Combo'); } - public function SetRootUrl($sRootUrl) - { - $this->m_sRootUrl = $sRootUrl; - } - + { + $this->m_sRootUrl = $sRootUrl; + } + public function small_p($sText) { $this->add("

      $sText

      \n"); @@ -201,7 +200,7 @@ JS return utils::GetAbsoluteUrlModulesRoot(); } - function GetApplicationContext() + public function GetApplicationContext() { $oAppContext = new ApplicationContext(); return $oAppContext->GetForLink(); @@ -211,13 +210,11 @@ JS public function MakeClassesSelect($sName, $sDefaultValue, $iWidthPx, $iActionCode = null) { // $aTopLevelClasses = array('bizService', 'bizContact', 'logInfra', 'bizDocument'); - // These are classes wich root class is cmdbAbstractObject ! + // These are classes wich root class is cmdbAbstractObject ! $this->add(""); } @@ -234,8 +231,7 @@ JS public function add_select($aChoices, $sName, $sDefaultValue, $iWidthPx) { $this->add(" "; - if ($bVertical) - { - if ($idx == 0) - { + if ($bVertical) { + if ($idx == 0) { // Validation icon at the end of the first line $sHTMLValue .= " {$sValidationField}\n"; } @@ -1561,8 +1540,7 @@ JS; $idx++; } $sHTMLValue .= ""; - if (!$bVertical) - { + if (!$bVertical) { // Validation icon at the end of the line $sHTMLValue .= " {$sValidationField}\n"; } @@ -1593,26 +1571,18 @@ JS; protected function ob_get_clean_safe() { $sOutput = ob_get_contents(); - if ($sOutput === false) - { + if ($sOutput === false) { $sMsg = "Design/integration issue: No output buffer. Some piece of code has called ob_get_clean() or ob_end_clean() without calling ob_start()"; - if ($this->bTrashUnexpectedOutput) - { + if ($this->bTrashUnexpectedOutput) { IssueLog::Error($sMsg); $sOutput = ''; - } - else - { + } else { $sOutput = $sMsg; } - } - else - { + } else { ob_end_clean(); // on some versions of PHP doing so when the output buffering is stopped can cause a notice - if ($this->bTrashUnexpectedOutput) - { - if (trim($sOutput) != '') - { + if ($this->bTrashUnexpectedOutput) { + if (trim($sOutput) != '') { if (Utils::GetConfig() && Utils::GetConfig()->Get('debug_report_spurious_chars')) { IssueLog::Error("Trashing unexpected output:'$sOutput'\n"); } @@ -1855,11 +1825,10 @@ JS; * * @return bool True if the format is Ok, false otherwise */ - function IsOutputFormatAvailable($sOutputFormat) + public function IsOutputFormatAvailable($sOutputFormat) { $bResult = false; - switch ($sOutputFormat) - { + switch ($sOutputFormat) { case 'html': $bResult = true; // Always supported break; @@ -1892,8 +1861,7 @@ JS; */ public function GetOutputOption($sFormat, $sOptionName) { - if (isset($this->a_OutputOptions[$sFormat][$sOptionName])) - { + if (isset($this->a_OutputOptions[$sFormat][$sOptionName])) { return $this->a_OutputOptions[$sFormat][$sOptionName]; } @@ -1909,12 +1877,9 @@ JS; */ public function SetOutputOption($sFormat, $sOptionName, $sValue) { - if (!isset($this->a_OutputOptions[$sFormat])) - { - $this->a_OutputOptions[$sFormat] = array($sOptionName => $sValue); - } - else - { + if (!isset($this->a_OutputOptions[$sFormat])) { + $this->a_OutputOptions[$sFormat] = [$sOptionName => $sValue]; + } else { $this->a_OutputOptions[$sFormat][$sOptionName] = $sValue; } } @@ -1925,7 +1890,7 @@ JS; * * @return string */ - public function RenderPopupMenuItems($aActions, $aFavoriteActions = array()) + public function RenderPopupMenuItems($aActions, $aFavoriteActions = []) { $sPrevUrl = ''; $sHtml = ''; @@ -1933,12 +1898,14 @@ JS; foreach ($aActions as $sActionId => $aAction) { $sDataActionId = 'data-action-id="'.$sActionId.'"'; $sClass = isset($aAction['css_classes']) ? 'class="'.implode(' ', $aAction['css_classes']).'"' : ''; - $sOnClick = isset($aAction['onclick']) ? 'onclick="'.htmlspecialchars($aAction['onclick'], ENT_QUOTES, - "UTF-8").'"' : ''; + $sOnClick = isset($aAction['onclick']) ? 'onclick="'.htmlspecialchars( + $aAction['onclick'], + ENT_QUOTES, + "UTF-8" + ).'"' : ''; $sTarget = isset($aAction['target']) ? "target=\"{$aAction['target']}\"" : ""; if (empty($aAction['url'])) { - if ($sPrevUrl != '') // Don't output consecutively two separators... - { + if ($sPrevUrl != '') { // Don't output consecutively two separators... $sHtml .= "
    • {$aAction['label']}
    • "; } $sPrevUrl = ''; @@ -2008,7 +1975,6 @@ JS; } } - /** * @deprecated 3.0.0 use {@link \Combodo\iTop\Application\UI\Base\Component\CollapsibleSection\CollapsibleSection} * @@ -2020,7 +1986,8 @@ JS; return; } - $this->add_script(<<<'EOD' + $this->add_script( + <<<'EOD' function initCollapsibleSection(iSectionId, bOpenedByDefault, sSectionStateStorageKey) { var bStoredSectionState = JSON.parse(localStorage.getItem(sSectionStateStorageKey)); diff --git a/sources/Application/WebPage/XMLPage.php b/sources/Application/WebPage/XMLPage.php index 340da3a2e..3b4863e07 100644 --- a/sources/Application/WebPage/XMLPage.php +++ b/sources/Application/WebPage/XMLPage.php @@ -1,9 +1,10 @@ m_bPassThrough) - { + if (!$this->m_bPassThrough) { $oKpi = new ExecutionKPI(); // Get the unexpected output but do nothing with it @@ -75,8 +74,7 @@ class XMLPage extends WebPage $sCharset = self::PAGES_CHARSET; $this->s_content = "\n".trim($this->s_content); $this->add_header("Content-Length: ".strlen($this->s_content)); - foreach($this->a_headers as $s_header) - { + foreach ($this->a_headers as $s_header) { header($s_header); } $oKpi->ComputeAndReport(get_class($this).' output'); @@ -96,12 +94,9 @@ class XMLPage extends WebPage } else { if ($this->m_bHeaderSent) { echo $sText; - } - else - { + } else { $s_captured_output = $this->ob_get_clean_safe(); - foreach($this->a_headers as $s_header) - { + foreach ($this->a_headers as $s_header) { header($s_header); } $sCharset = self::PAGES_CHARSET; @@ -118,7 +113,7 @@ class XMLPage extends WebPage { } - public function table($aConfig, $aData, $aParams = array()) + public function table($aConfig, $aData, $aParams = []) { } } diff --git a/sources/Application/WebPage/iTopPDF.php b/sources/Application/WebPage/iTopPDF.php index da43e0388..f2915af2f 100644 --- a/sources/Application/WebPage/iTopPDF.php +++ b/sources/Application/WebPage/iTopPDF.php @@ -1,4 +1,5 @@ ImageEps($sImagePath, $x, $y, $w, $h);; + $this->ImageEps($sImagePath, $x, $y, $w, $h); + ; } elseif ($imgtype == 'svg') { - $this->ImageSVG($sImagePath, $x, $y, $w, $h);; + $this->ImageSVG($sImagePath, $x, $y, $w, $h); + ; } else { - $this->Image($sImagePath, $x, $y, $w, $h);; + $this->Image($sImagePath, $x, $y, $w, $h); + ; } } @@ -89,14 +92,44 @@ class iTopPDF extends TCPDF // Display the title (centered) $this->SetXY($aMargins['left'] + $iPageNumberWidth, 0); - $this->MultiCell($this->getPageWidth() - $aMargins['left'] - $aMargins['right'] - 2 * $iPageNumberWidth, 15, $this->sDocumentTitle, - 0, 'C', false, 0 /* $ln */, '', '', true, 0, false, true, 15, 'M' /* $valign */); + $this->MultiCell( + $this->getPageWidth() - $aMargins['left'] - $aMargins['right'] - 2 * $iPageNumberWidth, + 15, + $this->sDocumentTitle, + 0, + 'C', + false, + 0 /* $ln */, + '', + '', + true, + 0, + false, + true, + 15, + 'M' /* $valign */ + ); $this->SetFontParams('', 10); // Display the page number (right aligned) // Warning: the 'R'ight alignment does not work when using placeholders like $this->getAliasNumPage() or $this->getAliasNbPages() - $this->MultiCell($iPageNumberWidth, 15, Dict::Format('Core:BulkExport:PDF:PageNumber', $this->page), 0, 'R', false, 0 /* $ln */, '', - '', true, 0, false, true, 15, 'M' /* $valign */); + $this->MultiCell( + $iPageNumberWidth, + 15, + Dict::Format('Core:BulkExport:PDF:PageNumber', $this->page), + 0, + 'R', + false, + 0 /* $ln */, + '', + '', + true, + 0, + false, + true, + 15, + 'M' /* $valign */ + ); // Branding logo $sBrandingIcon = Branding::GetLogoRelativePath(Branding::ENUM_LOGO_TYPE_MAIN_LOGO_FULL); diff --git a/sources/Application/WebPage/iTopWebPage.php b/sources/Application/WebPage/iTopWebPage.php index 66fdac763..f11de225d 100644 --- a/sources/Application/WebPage/iTopWebPage.php +++ b/sources/Application/WebPage/iTopWebPage.php @@ -1,4 +1,5 @@ /templates/) to the default page template */ - const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/itopwebpage/layout'; + public const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/itopwebpage/layout'; private $m_aMessages; @@ -150,7 +151,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage utils::InitArchiveMode(); - $this->m_aMessages = array(); + $this->m_aMessages = []; $this->SetRootUrl(utils::GetAbsoluteUrlAppRoot()); $this->add_header("Content-type: text/html; charset=".self::PAGES_CHARSET); $this->no_cache(); @@ -198,7 +199,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage // Tooltips $this->LinkScriptFromAppRoot('node_modules/@popperjs/core/dist/umd/popper.min.js'); $this->LinkScriptFromAppRoot('node_modules/tippy.js/dist/tippy-bundle.umd.min.js'); - + // Toasts $this->LinkScriptFromAppRoot('node_modules/toastify-js/src/toastify.js'); @@ -288,7 +289,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage */ protected function PrepareLayout() { - $aDaysMin = array( + $aDaysMin = [ Dict::S('DayOfWeek-Sunday-Min'), Dict::S('DayOfWeek-Monday-Min'), Dict::S('DayOfWeek-Tuesday-Min'), @@ -296,8 +297,8 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage Dict::S('DayOfWeek-Thursday-Min'), Dict::S('DayOfWeek-Friday-Min'), Dict::S('DayOfWeek-Saturday-Min'), - ); - $aMonthsShort = array( + ]; + $aMonthsShort = [ Dict::S('Month-01-Short'), Dict::S('Month-02-Short'), Dict::S('Month-03-Short'), @@ -310,12 +311,12 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage Dict::S('Month-10-Short'), Dict::S('Month-11-Short'), Dict::S('Month-12-Short'), - ); + ]; $sTimeFormat = AttributeDateTime::GetFormat()->ToTimeFormat(); $oTimeFormat = new DateTimeFormat($sTimeFormat); // Date picker options - $aPickerOptions = array( + $aPickerOptions = [ 'showOn' => 'button', 'buttonText' => '', // N°6455 class will be added after JQuery UI widget 'dateFormat' => AttributeDate::GetFormat()->ToDatePicker(), @@ -325,7 +326,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage 'dayNamesMin' => $aDaysMin, 'monthNamesShort' => $aMonthsShort, 'firstDay' => (int)Dict::S('Calendar-FirstDayOfWeek'), - ); + ]; $sJSDatePickerOptions = json_encode($aPickerOptions); // Time picker additional options @@ -344,8 +345,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage $aPickerOptions['controlType'] = 'select'; $aPickerOptions['closeText'] = Dict::S('UI:Button:Ok'); $sJSDateTimePickerOptions = json_encode($aPickerOptions); - if ($sTimePickerLang != '"en"') - { + if ($sTimePickerLang != '"en"') { // More options that cannot be passed via json_encode since they must be evaluated client-side $aMoreJSOptions = ", 'timeText': $.timepicker.regional[$sTimePickerLang].timeText, @@ -433,19 +433,18 @@ JS $.blockUI.defaults.message= ''; $.blockUI.defaults.overlayCSS = {} JS - ); + ); - // TODO 3.0.0: To preserve - $this->add_ready_script(InlineImage::FixImagesWidth()); + // TODO 3.0.0: To preserve + $this->add_ready_script(InlineImage::FixImagesWidth()); - // user pref for client side - // see GetUserPreference() in utils.js - $sUserPrefs = appUserPreferences::GetAsJSON(); - $this->add_script("var oUserPreferences = $sUserPrefs;"); + // user pref for client side + // see GetUserPreference() in utils.js + $sUserPrefs = appUserPreferences::GetAsJSON(); + $this->add_script("var oUserPreferences = $sUserPrefs;"); } } - /** * @see static::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_IMAGE, static::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES * @@ -486,7 +485,6 @@ JS $this->GetTopBarLayout()->SetBreadcrumbs(new Breadcrumbs($this->GetBreadCrumbsNewEntry(), Breadcrumbs::BLOCK_CODE)); } - /** * @internal * @return \Combodo\iTop\Application\UI\Base\Layout\NavigationMenu\NavigationMenu @@ -597,11 +595,9 @@ JS { $aNewEntry = null; - if ($this->bBreadCrumbEnabled) - { + if ($this->bBreadCrumbEnabled) { // Default entry values - if (is_null($this->sBreadCrumbEntryId)) - { + if (is_null($this->sBreadCrumbEntryId)) { $this->sBreadCrumbEntryId = $this->s_title; $this->sBreadCrumbEntryLabel = $this->s_title; $this->sBreadCrumbEntryDescription = $this->s_title; @@ -640,7 +636,7 @@ JS $sAPIClassName = iPageUIExtension::class; /** @var \iPageUIExtension $oExtensionInstance */ foreach (MetaModel::EnumPlugins($sAPIClassName) as $oExtensionInstance) { - DeprecatedCallsLog::NotifyDeprecatedPhpApi(get_class($oExtensionInstance), $sAPIClassName, "GetBannerHtml", "use " . iPageUIBlockExtension::class . "::GetBannerBlock() instead"); + DeprecatedCallsLog::NotifyDeprecatedPhpApi(get_class($oExtensionInstance), $sAPIClassName, "GetBannerHtml", "use ".iPageUIBlockExtension::class."::GetBannerBlock() instead"); $sBannerHtml .= $oExtensionInstance->GetBannerHtml($this); } @@ -662,8 +658,7 @@ JS // Call the extensions to add content to the page, warning they can also add styles or scripts through as they have access to the iTopWebPage /** @var \iPageUIBlockExtension $oExtensionInstance */ - foreach (MetaModel::EnumPlugins('iPageUIBlockExtension') as $oExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iPageUIBlockExtension') as $oExtensionInstance) { $oBlock = $oExtensionInstance->GetBannerBlock(); if ($oBlock) { $oBanner->AddSubBlock($oBlock); @@ -690,7 +685,7 @@ JS $sAPIClassName = iPageUIExtension::class; /** @var \iPageUIExtension $oExtensionInstance */ foreach (MetaModel::EnumPlugins($sAPIClassName) as $oExtensionInstance) { - DeprecatedCallsLog::NotifyDeprecatedPhpApi(get_class($oExtensionInstance), $sAPIClassName, "GetNorthPaneHtml", "use " . iPageUIBlockExtension::class . "::GetHeaderBlock() instead"); + DeprecatedCallsLog::NotifyDeprecatedPhpApi(get_class($oExtensionInstance), $sAPIClassName, "GetNorthPaneHtml", "use ".iPageUIBlockExtension::class."::GetHeaderBlock() instead"); $sHeaderHtml .= $oExtensionInstance->GetNorthPaneHtml($this); } @@ -727,11 +722,10 @@ JS } // Access mode - $sRestrictionMessage =''; + $sRestrictionMessage = ''; if (!MetaModel::DBHasAccess(ACCESS_ADMIN_WRITE)) { $sRestrictionMessage = Dict::S('UI:AccessRO-All'); - } - elseif (!MetaModel::DBHasAccess(ACCESS_USER_WRITE)) { + } elseif (!MetaModel::DBHasAccess(ACCESS_USER_WRITE)) { $sRestrictionMessage = Dict::S('UI:AccessRO-Users'); } @@ -761,8 +755,7 @@ HTML; // Call the extensions to add content to the page, warning they can also add styles or scripts through as they have access to the iTopWebPage /** @var \iPageUIBlockExtension $oExtensionInstance */ - foreach (MetaModel::EnumPlugins('iPageUIBlockExtension') as $oExtensionInstance) - { + foreach (MetaModel::EnumPlugins('iPageUIBlockExtension') as $oExtensionInstance) { $oBlock = $oExtensionInstance->GetHeaderBlock(); if ($oBlock) { $oHeader->AddSubBlock($oBlock); @@ -789,7 +782,7 @@ HTML; $sAPIClassName = iPageUIExtension::class; /** @var \iPageUIExtension $oExtensionInstance */ foreach (MetaModel::EnumPlugins($sAPIClassName) as $oExtensionInstance) { - DeprecatedCallsLog::NotifyDeprecatedPhpApi(get_class($oExtensionInstance), $sAPIClassName, "GetSouthPaneHtml", "use " . iPageUIBlockExtension::class . "::GetFooterBlock() instead"); + DeprecatedCallsLog::NotifyDeprecatedPhpApi(get_class($oExtensionInstance), $sAPIClassName, "GetSouthPaneHtml", "use ".iPageUIBlockExtension::class."::GetFooterBlock() instead"); $sFooterHtml .= $oExtensionInstance->GetSouthPaneHtml($this); } @@ -954,7 +947,7 @@ HTML; $aData['aLayouts']['oPageContent'] = $this->GetContentLayout(); $aData['aDeferredBlocks']['oPageContent'] = $this->GetDeferredBlocks($this->GetContentLayout()); // - Prepare generic templates - $aData['aTemplates'] = array(); + $aData['aTemplates'] = []; // TODO 3.1 Replace hardcoded 'Please wait' with dict entries @@ -967,12 +960,12 @@ HTML; // - Small loader template $oSmallLoaderTemplateContentBlock = new UIContentBlock(); - $oSmallLoaderTemplateContentBlock->AddSubBlock(SpinnerUIBlockFactory::MakeSmall(null , 'Please wait')); + $oSmallLoaderTemplateContentBlock->AddSubBlock(SpinnerUIBlockFactory::MakeSmall(null, 'Please wait')); $aData['aTemplates'][] = TemplateUIBlockFactory::MakeForBlock('ibo-small-loading-placeholder-template', $oSmallLoaderTemplateContentBlock); // - Large loader template $oLargeLoaderTemplateContentBlock = new UIContentBlock(); - $oLargeLoaderTemplateContentBlock->AddSubBlock(SpinnerUIBlockFactory::MakeLarge(null , 'Please wait')); + $oLargeLoaderTemplateContentBlock->AddSubBlock(SpinnerUIBlockFactory::MakeLarge(null, 'Please wait')); $aData['aTemplates'][] = TemplateUIBlockFactory::MakeForBlock('ibo-large-loading-placeholder-template', $oLargeLoaderTemplateContentBlock); // - Do not show again template @@ -1033,7 +1026,7 @@ HTML; */ public function AddTabContainer($sTabContainer, $sPrefix = '', iUIContentBlock $oParentBlock = null) { - if(is_null($oParentBlock)) { + if (is_null($oParentBlock)) { $oParentBlock = PanelUIBlockFactory::MakeNeutral(''); $this->AddUiBlock($oParentBlock); } @@ -1152,14 +1145,11 @@ HTML; $sCurrentTabContainer = $this->m_oTabs->GetCurrentTabContainer(); $sCurrentTab = $this->m_oTabs->GetCurrentTab(); - if (!empty($sCurrentTabContainer) && !empty($sCurrentTab)) - { + if (!empty($sCurrentTabContainer) && !empty($sCurrentTab)) { $iOffset = $this->m_oTabs->GetCurrentTabLength(); - return array('tc' => $sCurrentTabContainer, 'tab' => $sCurrentTab, 'offset' => $iOffset); - } - else - { + return ['tc' => $sCurrentTabContainer, 'tab' => $sCurrentTab, 'offset' => $iOffset]; + } else { return parent::start_capture(); } } @@ -1169,19 +1159,13 @@ HTML; */ public function end_capture($offset) { - if (is_array($offset)) - { - if ($this->m_oTabs->TabExists($offset['tc'], $offset['tab'])) - { + if (is_array($offset)) { + if ($this->m_oTabs->TabExists($offset['tc'], $offset['tab'])) { $sCaptured = $this->m_oTabs->TruncateTab($offset['tc'], $offset['tab'], $offset['offset']); - } - else - { + } else { $sCaptured = ''; } - } - else - { + } else { $sCaptured = parent::end_capture($offset); } @@ -1208,13 +1192,12 @@ HTML; */ public function AddApplicationMessage($sHtmlMessage, $sHtmlIcon = null, $sTip = null) { - if (strlen($sHtmlMessage)) - { - $this->m_aMessages[] = array( + if (strlen($sHtmlMessage)) { + $this->m_aMessages[] = [ 'icon' => $sHtmlIcon, 'message' => $sHtmlMessage, 'tip' => $sTip, - ); + ]; } } diff --git a/sources/Application/WebPage/iTopWizardWebPage.php b/sources/Application/WebPage/iTopWizardWebPage.php index 5692605d7..ef04217ef 100644 --- a/sources/Application/WebPage/iTopWizardWebPage.php +++ b/sources/Application/WebPage/iTopWizardWebPage.php @@ -1,9 +1,10 @@ m_iCurrentStep = $iCurrentStep; - $this->m_aSteps = $aSteps; - $oKpi->ComputeStats(get_class($this).' creation', 'iTopWizardWebPage'); - } - - public function output() - { - $aSteps = array(); - $iIndex = 0; - foreach($this->m_aSteps as $sStepTitle) - { - $iIndex++; - $sStyle = ($iIndex == $this->m_iCurrentStep) ? 'wizActiveStep' : 'wizStep'; - $aSteps[] = "
      $sStepTitle
      "; - } - $sWizardHeader = "

      ".utils::EscapeHtml($this->s_title)."

      \n".implode("
      ", $aSteps)."
      \n"; - $this->s_content = "$sWizardHeader
      ".$this->s_content."
      "; - parent::output(); + $this->m_aSteps = $aSteps; + $oKpi->ComputeStats(get_class($this).' creation', 'iTopWizardWebPage'); + } + + public function output() + { + $aSteps = []; + $iIndex = 0; + foreach ($this->m_aSteps as $sStepTitle) { + $iIndex++; + $sStyle = ($iIndex == $this->m_iCurrentStep) ? 'wizActiveStep' : 'wizStep'; + $aSteps[] = "
      $sStepTitle
      "; + } + $sWizardHeader = "

      ".utils::EscapeHtml($this->s_title)."

      \n".implode("
      ", $aSteps)."
      \n"; + $this->s_content = "$sWizardHeader
      ".$this->s_content."
      "; + parent::output(); } } diff --git a/sources/Application/WelcomePopup/Message.php b/sources/Application/WelcomePopup/Message.php index 80face188..0b3577735 100644 --- a/sources/Application/WelcomePopup/Message.php +++ b/sources/Application/WelcomePopup/Message.php @@ -5,10 +5,8 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - namespace Combodo\iTop\Application\WelcomePopup; - use iWelcomePopupExtension; use utils; @@ -18,7 +16,8 @@ use utils; * @author Guillaume Lajarige * @package Combodo\iTop\Application\WelcomePopup */ -class Message { +class Message +{ /** @var string Default TWIG template */ protected const DEFAULT_TWIG_TEMPLATE_REL_PATH = 'templates/application/welcome-popup/templates/left-title-description-right-illustration.html.twig'; @@ -191,4 +190,4 @@ class Message { { return $this->sTWIGTemplateRelPath; } -} \ No newline at end of file +} diff --git a/sources/Application/WelcomePopup/MessageFactory.php b/sources/Application/WelcomePopup/MessageFactory.php index 2c357da86..a9efa6c84 100644 --- a/sources/Application/WelcomePopup/MessageFactory.php +++ b/sources/Application/WelcomePopup/MessageFactory.php @@ -5,10 +5,8 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - namespace Combodo\iTop\Application\WelcomePopup; - use iWelcomePopupExtension; /** @@ -18,7 +16,8 @@ use iWelcomePopupExtension; * @package Combodo\iTop\Application\WelcomePopup * @api */ -class MessageFactory { +class MessageFactory +{ /** * @param string $sId Unique ID of the message within its provider * @param string $sTitle Title of the message in plain text @@ -115,4 +114,4 @@ class MessageFactory { $sTWIGTemplateRelPath ); } -} \ No newline at end of file +} diff --git a/sources/Application/WelcomePopup/Provider/DefaultProvider.php b/sources/Application/WelcomePopup/Provider/DefaultProvider.php index eaef57ed3..cdb0a6d6a 100644 --- a/sources/Application/WelcomePopup/Provider/DefaultProvider.php +++ b/sources/Application/WelcomePopup/Provider/DefaultProvider.php @@ -1,4 +1,5 @@ GenerateUrl(iTopNewsroomController::ROUTE_NAMESPACE . ".view_all")), - utils::GetAbsoluteUrlAppRoot() . "images/illustrations/undraw_newspaper.svg" + Dict::Format("UI:WelcomePopup:Message:320_02_Newsroom:Description", Router::GetInstance()->GenerateUrl(iTopNewsroomController::ROUTE_NAMESPACE.".view_all")), + utils::GetAbsoluteUrlAppRoot()."images/illustrations/undraw_newspaper.svg" ), MessageFactory::MakeForLeftIllustrationAsSVGMarkupRightTexts( "320_03_NotificationsCenter", Dict::S("UI:WelcomePopup:Message:320_03_NotificationsCenter:Title"), - Dict::Format("UI:WelcomePopup:Message:320_03_NotificationsCenter:Description", Router::GetInstance()->GenerateUrl(NotificationsCenterController::ROUTE_NAMESPACE . ".display_page")), - utils::GetAbsoluteUrlAppRoot() . "images/illustrations/undraw_preferences_popup.svg" + Dict::Format("UI:WelcomePopup:Message:320_03_NotificationsCenter:Description", Router::GetInstance()->GenerateUrl(NotificationsCenterController::ROUTE_NAMESPACE.".display_page")), + utils::GetAbsoluteUrlAppRoot()."images/illustrations/undraw_preferences_popup.svg" ), MessageFactory::MakeForLeftTextsRightIllustrationAsSVGMarkup( "320_05_A11yThemes", Dict::S("UI:WelcomePopup:Message:320_05_A11yThemes:Title"), - Dict::Format("UI:WelcomePopup:Message:320_05_A11yThemes:Description", utils::GetAbsoluteUrlAppRoot() . "pages/preferences.php"), - utils::GetAbsoluteUrlAppRoot() . "images/illustrations/undraw_designer_mindset.svg" + Dict::Format("UI:WelcomePopup:Message:320_05_A11yThemes:Description", utils::GetAbsoluteUrlAppRoot()."pages/preferences.php"), + utils::GetAbsoluteUrlAppRoot()."images/illustrations/undraw_designer_mindset.svg" ), ]; // For users that can configure notifications - if (UserRights::IsActionAllowed(\Trigger::class, \UR_ACTION_MODIFY)) - { + if (UserRights::IsActionAllowed(\Trigger::class, \UR_ACTION_MODIFY)) { $aMessages[] = MessageFactory::MakeForLeftTextsRightIllustrationAsSVGMarkup( "320_04_PowerfulNotifications_AdminOnly", Dict::S("UI:WelcomePopup:Message:320_04_PowerfulNotifications_AdminOnly:Title"), - Dict::Format("UI:WelcomePopup:Message:320_04_PowerfulNotifications_AdminOnly:Description", utils::GetAbsoluteUrlAppRoot() . "pages/notifications.php"), - utils::GetAbsoluteUrlAppRoot() . "images/illustrations/undraw_new_notifications.svg" + Dict::Format("UI:WelcomePopup:Message:320_04_PowerfulNotifications_AdminOnly:Description", utils::GetAbsoluteUrlAppRoot()."pages/notifications.php"), + utils::GetAbsoluteUrlAppRoot()."images/illustrations/undraw_new_notifications.svg" ); } diff --git a/sources/Application/WelcomePopup/WelcomePopupService.php b/sources/Application/WelcomePopup/WelcomePopupService.php index 54a5f171f..c478f9d47 100644 --- a/sources/Application/WelcomePopup/WelcomePopupService.php +++ b/sources/Application/WelcomePopup/WelcomePopupService.php @@ -58,7 +58,7 @@ class WelcomePopupService if ($aProviderMessageData1['message']->GetImportance() === $aProviderMessageData2['message']->GetImportance()) { return strcmp($aProviderMessageData1['message']->GetID(), $aProviderMessageData2['message']->GetID()); } - return ($aProviderMessageData1['message']->GetImportance() < $aProviderMessageData2['message']->GetImportance()) ? -1 : 1; + return ($aProviderMessageData1['message']->GetImportance() < $aProviderMessageData2['message']->GetImportance()) ? -1 : 1; } /**********************/ @@ -84,7 +84,7 @@ class WelcomePopupService $this->LoadProviders(); return $this->ProcessMessages(); } - + /** * Get the {@see \Combodo\iTop\Application\WelcomePopup\Message} to display from a list of {@see \iWelcomePopupExtension} instances * The messages are ordered by importance ({@see \iWelcomePopupExtension::ENUM_IMPORTANCE_CRITICAL} first) then by ID @@ -97,7 +97,7 @@ class WelcomePopupService $this->LoadProviders(); /** @var array $aAllProvidersMessagesData */ $aAllProvidersMessagesData = []; - foreach($this->aMessagesProviders as $oProvider) { + foreach ($this->aMessagesProviders as $oProvider) { $aProviderMessages = $oProvider->GetMessages(); if (count($aProviderMessages) === 0) { IssueLog::Debug('Empty list of messages for '.$oProvider::class, LogChannels::CONSOLE); @@ -105,9 +105,9 @@ class WelcomePopupService } $sProviderIconRelPath = $oProvider->GetIconRelPath(); - foreach($aProviderMessages as $oMessage) { + foreach ($aProviderMessages as $oMessage) { if (false === ($oMessage instanceof Message)) { - IssueLog::Error('Invalid message returned by iWelcomePopupExtension::GetMessages(), must be of class ' . Message::class, LogChannels::CONSOLE, [ + IssueLog::Error('Invalid message returned by iWelcomePopupExtension::GetMessages(), must be of class '.Message::class, LogChannels::CONSOLE, [ 'provider_class' => $oProvider::class, 'message' => $oMessage, ]); @@ -124,13 +124,13 @@ class WelcomePopupService // Filter the acknowledged messages AFTER getting all messages // This allows for "replacing" a message (from another provider for example) // by automatically acknowledging it when called in GetMessages() - foreach($aAllProvidersMessagesData as $key => $aProviderMessageData) { + foreach ($aAllProvidersMessagesData as $key => $aProviderMessageData) { if ($this->IsMessageAcknowledged($aProviderMessageData['uuid'])) { IssueLog::Debug('Ignoring already acknowledged message '.$aProviderMessageData['uuid'], LogChannels::CONSOLE); unset($aAllProvidersMessagesData[$key]); } } - usort($aAllProvidersMessagesData, [static::class, 'SortOnImportance']); + usort($aAllProvidersMessagesData, [static::class, 'SortOnImportance']); return $aAllProvidersMessagesData; } @@ -162,21 +162,23 @@ class WelcomePopupService if ($oProvider !== null) { $oProvider->AcknowledgeMessage($sMessageId); } - } catch(Exception $e) { + } catch (Exception $e) { IssueLog::Error("Failed to acknowledge the message $sMessageUUID for user ".UserRights::GetConnectedUserId().". Reason: ".$e->getMessage(), LogChannels::CONSOLE); } } - + /** * Load the provider of messages, decoupled from the constructor for testability */ protected function LoadProviders(): void { - if ($this->aMessagesProviders !== null) return; + if ($this->aMessagesProviders !== null) { + return; + } $aProviders = []; $aProviderClasses = InterfaceDiscovery::GetInstance()->FindItopClasses(iWelcomePopupExtension::class); - foreach($aProviderClasses as $sProviderClass) { + foreach ($aProviderClasses as $sProviderClass) { $aProviders[] = new $sProviderClass(); } $this->SetMessagesProviders($aProviders); @@ -189,9 +191,9 @@ class WelcomePopupService */ protected function IsMessageAcknowledged(string $sMessageUUID): bool { - $iUserId = UserRights::GetConnectedUserId(); + $iUserId = UserRights::GetConnectedUserId(); if (static::$aAcknowledgedMessages === null) { - + $oSearch = new DBObjectSearch(WelcomePopupAcknowledge::class); $oSearch->AddCondition('user_id', $iUserId); $oSet = new DBObjectSet($oSearch); @@ -200,7 +202,7 @@ class WelcomePopupService } return in_array($sMessageUUID, static::$aAcknowledgedMessages); } - + /** * Set the cache of acknowledged messages (useful for testing) * @param array $aAcknowledgedMessages @@ -218,7 +220,7 @@ class WelcomePopupService { $this->aMessagesProviders = $aMessagesProviders; } - + /** * Retrieve the provider associated with a message * @param string $sMessageUUID @@ -228,14 +230,14 @@ class WelcomePopupService { $this->LoadProviders(); $sProviderKey = substr($sMessageUUID, 0, strpos($sMessageUUID, '::')); - foreach($this->aMessagesProviders as $oProvider) { + foreach ($this->aMessagesProviders as $oProvider) { if ($this->MakeStringFitIn($oProvider::class, static::PROVIDER_KEY_LENGTH) === $sProviderKey) { return $oProvider; } } return null; } - + /** * Shorten the given string (if needed) but preserving its uniqueness * @param string $sProviderClass @@ -244,12 +246,11 @@ class WelcomePopupService */ protected function MakeStringFitIn(string $sProviderClass, int $iLengthLimit): string { - if(mb_strlen($sProviderClass) <= $iLengthLimit) { + if (mb_strlen($sProviderClass) <= $iLengthLimit) { return $sProviderClass; } - // Truncate the string to $iLimitLength and replace the first carahcters with the MD5 of the complete string + // Truncate the string to $iLimitLength and replace the first carahcters with the MD5 of the complete string $sMD5 = md5($sProviderClass, false); return $sMD5.'-'.mb_substr($sProviderClass, -($iLengthLimit - strlen($sMD5) - 1)); // strlen is OK on the MD5 string, and '-' is not allowed in a class name } } - diff --git a/sources/Controller/AbstractAppController.php b/sources/Controller/AbstractAppController.php index 184fd878c..f70870224 100644 --- a/sources/Controller/AbstractAppController.php +++ b/sources/Controller/AbstractAppController.php @@ -1,4 +1,5 @@ GetAsHTML($sAttCode); $bExcludeRawValue = false; // Only retrieve raw (stored) value for simple fields - foreach (cmdbAbstractObject::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) - { + foreach (cmdbAbstractObject::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) { $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - if (is_a($oAttDef, $sAttDefClassToExclude, true)) - { + if (is_a($oAttDef, $sAttDefClassToExclude, true)) { $bExcludeRawValue = true; break; } @@ -110,7 +109,7 @@ class AjaxRenderController if (!$bExcludeRawValue) { $oRawValue = $aObject[$sAlias]->Get($sAttCode); - if(($oRawValue instanceof AttributeTagSet) || ($oRawValue instanceof ormSet)){ + if (($oRawValue instanceof AttributeTagSet) || ($oRawValue instanceof ormSet)) { $aObj[$sAlias."/".$sAttCode."/raw"] = implode(", ", $oRawValue->GetValues()); } else { $aObj[$sAlias."/".$sAttCode."/raw"] = $oRawValue; @@ -150,18 +149,18 @@ class AjaxRenderController $aErr = error_get_last(); if (($aErr !== null) && ($aErr['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR))) { ob_end_clean(); - echo json_encode(array('code' => 'error', 'percentage' => 100, 'message' => Dict::Format('UI:Error_Details', $aErr['message']))); + echo json_encode(['code' => 'error', 'percentage' => 100, 'message' => Dict::Format('UI:Error_Details', $aErr['message'])]); } }); try { $token = utils::ReadParam('token', null); $sTokenForDisplay = utils::HtmlEntities($token); - $aResult = array( // Fallback error, just in case + $aResult = [ // Fallback error, just in case 'code' => 'error', 'percentage' => 100, 'message' => "Export not found for token: '$sTokenForDisplay'", - ); + ]; $data = ''; if ($token === null) { if ($bTokenOnly) { @@ -171,14 +170,14 @@ class AjaxRenderController $sExpression = utils::ReadParam('expression', null, false, 'raw_data'); $iQueryId = utils::ReadParam('query', null); if ($sExpression === null) { - $oQuerySearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', array('query_id' => $iQueryId)); + $oQuerySearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', ['query_id' => $iQueryId]); $oQuerySearch->UpdateContextFromUser(); $oQueries = new DBObjectSet($oQuerySearch); if ($oQueries->Count() > 0) { $oQuery = $oQueries->Fetch(); $sExpression = $oQuery->Get('oql'); } else { - $aResult = array('code' => 'error', 'percentage' => 100, 'message' => "Invalid query phrasebook identifier: '$iQueryId'"); + $aResult = ['code' => 'error', 'percentage' => 100, 'message' => "Invalid query phrasebook identifier: '$iQueryId'"]; } } if ($sExpression !== null) { @@ -226,10 +225,10 @@ class AjaxRenderController } $oPage->SetData($aResult); } catch (BulkExportException $e) { - $aResult = array('code' => 'error', 'percentage' => 100, 'message' => utils::HtmlEntities($e->GetLocalizedMessage())); + $aResult = ['code' => 'error', 'percentage' => 100, 'message' => utils::HtmlEntities($e->GetLocalizedMessage())]; $oPage->SetData($aResult); } catch (Exception $e) { - $aResult = array('code' => 'error', 'percentage' => 100, 'message' => utils::HtmlEntities($e->getMessage())); + $aResult = ['code' => 'error', 'percentage' => 100, 'message' => utils::HtmlEntities($e->getMessage())]; $oPage->SetData($aResult); } } @@ -249,7 +248,7 @@ class AjaxRenderController $oPage->SetData($aResult); } - /** + /** * @param string $sFilter * * @return array @@ -258,7 +257,7 @@ class AjaxRenderController public static function SearchAndRefresh(string $sFilter): array { $extraParams = utils::ReadParam('extra_params', '', false, 'raw_data'); - $aExtraParams = array(); + $aExtraParams = []; if (is_array($extraParams)) { $aExtraParams = $extraParams; } else { @@ -279,9 +278,9 @@ class AjaxRenderController $sTableId = utils::ReadParam('list_id', ''); $iLength = utils::ReadParam('end', 10, false, utils::ENUM_SANITIZATION_FILTER_INTEGER); - $aColumns = utils::ReadParam('columns', array(), false, 'raw_data'); + $aColumns = utils::ReadParam('columns', [], false, 'raw_data'); $sSelectMode = utils::ReadParam('select_mode', ''); - $aClassAliases = utils::ReadParam('class_aliases', array()); + $aClassAliases = utils::ReadParam('class_aliases', []); $aResult = DataTableUIBlockFactory::GetOptionsForRendering($aColumns, $sSelectMode, $sFilter, $iLength, $aClassAliases, $aExtraParams, $sTableId); return $aResult; @@ -301,10 +300,10 @@ class AjaxRenderController * @throws \MySQLHasGoneAwayException * @throws \OQLException */ - public static function Search(string $sEncoding, string $sFilter):array + public static function Search(string $sEncoding, string $sFilter): array { $extraParams = utils::ReadParam('extra_params', '', false, 'raw_data'); - $aExtraParams = array(); + $aExtraParams = []; if (is_array($extraParams)) { $aExtraParams = $extraParams; } else { @@ -340,8 +339,8 @@ class AjaxRenderController // The first column is used for the selection (radio / checkbox) and is not sortable $iSortCol--; } - $aColumns = utils::ReadParam('columns', array(), false, 'raw_data'); - $aClassAliases = utils::ReadParam('class_aliases', array()); + $aColumns = utils::ReadParam('columns', [], false, 'raw_data'); + $aClassAliases = utils::ReadParam('class_aliases', []); foreach ($aColumns as $sClass => $aAttCodes) { foreach ($aAttCodes as $sAttCode => $aAttProperties) { @@ -405,11 +404,11 @@ class AjaxRenderController IssueLog::Warning( "ajax.render.php received an invalid array for columns : check max_input_vars value in php.ini !", null, - array( + [ 'controller' => '\Combodo\iTop\Controller\AjaxRenderController::Search', 'max_input_vars' => $iMaxInputVarsValue, 'class.attcode with invalid format' => "$sClass.$sAttCode", - ) + ] ); $aColumns[$sClass][$sAttCode]['checked'] = 'false'; } @@ -417,20 +416,20 @@ class AjaxRenderController } // Filter the list to removed linked set since we are not able to display them here - $sIdName = isset($extraParams["id_for_select"])?$extraParams["id_for_select"]:""; - $aOrderBy = array(); + $sIdName = isset($extraParams["id_for_select"]) ? $extraParams["id_for_select"] : ""; + $aOrderBy = []; $iSortIndex = 0; - $aColumnsLoad = array(); + $aColumnsLoad = []; foreach ($aClassAliases as $sAlias => $sClassName) { - $aColumnsLoad[$sAlias] = array(); + $aColumnsLoad[$sAlias] = []; if (!isset($aColumns[$sAlias])) { continue; } - // It's better to use default class order than asc first column when none specified by the request - if($bForceSort && count(MetaModel::GetOrderByDefault($sClassName)) > 0){ + // It's better to use default class order than asc first column when none specified by the request + if ($bForceSort && count(MetaModel::GetOrderByDefault($sClassName)) > 0) { $iSortCol = -1; - + $aDefaultOrder = MetaModel::GetOrderByDefault($sClassName); foreach ($aDefaultOrder as $sAttCode => $bOrder) { $aOrderBy[$sAlias.'.'.$sAttCode] = $bOrder; @@ -502,8 +501,8 @@ class AjaxRenderController $iPageSize = utils::ReadParam('page_size', 10, false, utils::ENUM_SANITIZATION_FILTER_INTEGER); $sTableId = utils::ReadParam('table_id', null, false, 'raw_data'); $bSaveAsDefaults = (utils::ReadParam('defaults', 'true') == 'true'); - $aClassAliases = utils::ReadParam('class_aliases', array(), false, 'raw_data'); - $aColumns = utils::ReadParam('columns', array(), false, 'raw_data'); + $aClassAliases = utils::ReadParam('class_aliases', [], false, 'raw_data'); + $aColumns = utils::ReadParam('columns', [], false, 'raw_data'); foreach ($aColumns as $sAlias => $aList) { foreach ($aList as $sAttCode => $aData) { @@ -538,7 +537,7 @@ class AjaxRenderController public static function DatatableResetSettings(): bool { $sTableId = utils::ReadParam('table_id', null, false, 'raw_data'); - $aClassAliases = utils::ReadParam('class_aliases', array(), false, 'raw_data'); + $aClassAliases = utils::ReadParam('class_aliases', [], false, 'raw_data'); $bResetAll = (utils::ReadParam('defaults', 'true') == 'true'); $oSettings = new DataTableSettings($aClassAliases, $sTableId); @@ -578,7 +577,7 @@ class AjaxRenderController // Security filtering $aFields = $oGroupByExp->ListRequiredFields(); foreach ($aFields as $sFieldAlias) { - $aMatches = array(); + $aMatches = []; if (preg_match('/^([^.]+)\\.([^.]+)$/', $sFieldAlias, $aMatches)) { $sFieldClass = $oFilter->GetClassName($aMatches[1]); $oAttDef = MetaModel::GetAttributeDef($sFieldClass, $aMatches[2]); @@ -610,10 +609,10 @@ class AjaxRenderController if (isset($aExtraParams['order_direction']) && isset($aExtraParams['order_by'])) { switch ($aExtraParams['order_by']) { case 'attribute': - $aOrderBy = array('grouped_by_1' => ($aExtraParams['order_direction'] === 'asc')); + $aOrderBy = ['grouped_by_1' => ($aExtraParams['order_direction'] === 'asc')]; break; case 'function': - $aOrderBy = array($sFctVar => ($aExtraParams['order_direction'] === 'asc')); + $aOrderBy = [$sFctVar => ($aExtraParams['order_direction'] === 'asc')]; break; } } @@ -625,9 +624,9 @@ class AjaxRenderController $aRes = CMDBSource::QueryToArray($sSql); - $aGroupBy = array(); - $aLabels = array(); - $aValues = array(); + $aGroupBy = []; + $aLabels = []; + $aValues = []; $iTotalCount = 0; foreach ($aRes as $iRow => $aRow) { $sValue = $aRow['grouped_by_1']; @@ -638,7 +637,7 @@ class AjaxRenderController $iTotalCount += $aRow['_itop_count_']; } - $aResult = array(); + $aResult = []; $oAppContext = new ApplicationContext(); $sParams = $oAppContext->GetForLink(true); foreach ($aGroupBy as $iRow => $iCount) { @@ -649,14 +648,14 @@ class AjaxRenderController if (isset($aExtraParams['query_params'])) { $aQueryParams = $aExtraParams['query_params']; } else { - $aQueryParams = array(); + $aQueryParams = []; } $sFilter = rawurlencode($oSubsetSearch->serialize(false, $aQueryParams)); - $aResult[] = array( + $aResult[] = [ 'group' => $aLabels[$iRow], 'value' => "$iCount", - ); // TO DO: add the context information + ]; // TO DO: add the context information } } else { @@ -696,7 +695,7 @@ class AjaxRenderController $aExtraParams = utils::ReadParam('extra_params', '', false, 'raw_data'); $oFilter = DBObjectSearch::FromOQL($sFilter); $oFilter->SetShowObsoleteData(utils::ShowObsoleteData()); - $aQueryParams = array(); + $aQueryParams = []; if (isset($aExtraParams['query_params'])) { $aQueryParams = $aExtraParams['query_params']; } @@ -810,7 +809,8 @@ class AjaxRenderController foreach ($aLicenses as $oLicense) { $oPage->add('
    • '.$oLicense->product.', © '.$oLicense->author.' is licensed under the '.$oLicense->license_type.' license. (Details)'); $oPage->add(''); - $oPage->add_ready_script(<<add_ready_script( + <<add('
      '); - $oPage->add('
      '); + $oPage->add('
      '); $oPage->add('
      '.$sVersionString.'
      '); $oPage->add("
      "); self::DisplayAboutLicenses($oPage); @@ -885,7 +885,7 @@ EOF // Get the datamodel directory $oFilter = DBObjectSearch::FromOQL('SELECT ModuleInstallation WHERE name="datamodel"'); - $oSet = new DBObjectSet($oFilter, array('installed' => false)); // Most recent first + $oSet = new DBObjectSet($oFilter, ['installed' => false]); // Most recent first $oLastInstall = $oSet->Fetch(); $sLastInstallDate = $oLastInstall->Get('installed'); $aDataModelInfo = json_decode($oLastInstall->Get('comment'), true); @@ -894,7 +894,7 @@ EOF require_once(APPROOT.'setup/runtimeenv.class.inc.php'); $sCurrEnv = utils::GetCurrentEnvironment(); $oRuntimeEnv = new RunTimeEnvironment($sCurrEnv); - $aSearchDirs = array(APPROOT.$sDataModelSourceDir); + $aSearchDirs = [APPROOT.$sDataModelSourceDir]; if (file_exists(APPROOT.'extensions')) { $aSearchDirs[] = APPROOT.'extensions'; } @@ -904,22 +904,22 @@ EOF } $aAvailableModules = $oRuntimeEnv->AnalyzeInstallation(MetaModel::GetConfig(), $aSearchDirs); - $aItopSettings = array('cron_max_execution_time', 'timezone'); - $aPHPSettings = array('memory_limit', 'max_execution_time', 'upload_max_filesize', 'post_max_size'); - $aMySQLSettings = array('max_allowed_packet', 'key_buffer_size', 'query_cache_size'); - $aMySQLStatuses = array('Key_read_requests', 'Key_reads'); + $aItopSettings = ['cron_max_execution_time', 'timezone']; + $aPHPSettings = ['memory_limit', 'max_execution_time', 'upload_max_filesize', 'post_max_size']; + $aMySQLSettings = ['max_allowed_packet', 'key_buffer_size', 'query_cache_size']; + $aMySQLStatuses = ['Key_read_requests', 'Key_reads']; if (extension_loaded('suhosin')) { $aPHPSettings[] = 'suhosin.post.max_vars'; $aPHPSettings[] = 'suhosin.get.max_value_length'; } - $aMySQLVars = array(); + $aMySQLVars = []; foreach (CMDBSource::QueryToArray('SHOW VARIABLES') as $aRow) { $aMySQLVars[$aRow['Variable_name']] = $aRow['Value']; } - $aMySQLStats = array(); + $aMySQLStats = []; foreach (CMDBSource::QueryToArray('SHOW GLOBAL STATUS') as $aRow) { $aMySQLStats[$aRow['Variable_name']] = $aRow['Value']; } @@ -927,7 +927,7 @@ EOF // Display // $oPage->add('
      '); - $oPage->add('
      '); + $oPage->add('
      '); $oPage->add('
      '.$sVersionString.'
      '.'MySQL: '.$sMySQLVersion.'
      '.'PHP: '.$sPHPVersion.'
      '); $oPage->add("
      "); @@ -964,7 +964,6 @@ EOF $oPage->add("
      "); $oPage->add(''); - // MUST NOT be localized, as the information given here will be sent to the support $oPage->add("".Dict::S('UI:About:Support')."
      \n"); $oPage->add("
      "); @@ -1027,5 +1026,4 @@ EOF $oPage->add("
      "); } - } diff --git a/sources/Controller/Base/Layout/ActivityPanelController.php b/sources/Controller/Base/Layout/ActivityPanelController.php index 5b637eece..7d0436d8e 100644 --- a/sources/Controller/Base/Layout/ActivityPanelController.php +++ b/sources/Controller/Base/Layout/ActivityPanelController.php @@ -1,4 +1,5 @@ OnFormSubmit($oObject); } diff --git a/sources/Controller/Base/Layout/ObjectController.php b/sources/Controller/Base/Layout/ObjectController.php index 84db6f59e..043633dcf 100644 --- a/sources/Controller/Base/Layout/ObjectController.php +++ b/sources/Controller/Base/Layout/ObjectController.php @@ -1,4 +1,5 @@ IsHandlingXmlHttpRequest()) { $oPage = new AjaxPage(''); } else { @@ -77,9 +78,7 @@ class ObjectController extends AbstractController $this->AddRequiredForModificationJsFilesToPage($oPage); } - - if (empty($sClass)) - { + if (empty($sClass)) { throw new ApplicationException(Dict::Format('UI:Error:1ParametersMissing', 'class')); } if (!is_subclass_of($sClass, cmdbAbstractObject::class)) { @@ -87,43 +86,36 @@ class ObjectController extends AbstractController } // If the specified class has subclasses, ask the user an instance of which class to create $aSubClasses = MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL); // Including the specified class itself - $aPossibleClasses = array(); + $aPossibleClasses = []; $sRealClass = ''; - if ($bCheckSubClass) - { - foreach($aSubClasses as $sCandidateClass) - { - if (!MetaModel::IsAbstract($sCandidateClass) && (UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) - { + if ($bCheckSubClass) { + foreach ($aSubClasses as $sCandidateClass) { + if (!MetaModel::IsAbstract($sCandidateClass) && (UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) { $aPossibleClasses[$sCandidateClass] = MetaModel::GetName($sCandidateClass); } } // Only one of the subclasses can be instantiated... - if (count($aPossibleClasses) === 1) - { + if (count($aPossibleClasses) === 1) { $aKeys = array_keys($aPossibleClasses); $sRealClass = $aKeys[0]; } - } - else - { + } else { $sRealClass = $sClass; } - if (!empty($sRealClass)) - { + if (!empty($sRealClass)) { // Set all the default values in an object and clone this "default" object $oObjToClone = MetaModel::NewObject($sRealClass); // 1st - set context values $oAppContext->InitObjectFromContext($oObjToClone); // 2nd - set values from the page argument 'default' $oObjToClone->UpdateObjectFromArg('default'); - $aPrefillFormParam = array( + $aPrefillFormParam = [ 'user' => Session::Get('auth_user'), 'context' => $oAppContext->GetAsHash(), - 'default' => utils::ReadParam('default', array(), '', 'raw_data'), + 'default' => utils::ReadParam('default', [], '', 'raw_data'), 'origin' => 'console', - ); + ]; // 3rd - prefill API $oObjToClone->PrefillForm('creation_from_0', $aPrefillFormParam); @@ -134,18 +126,18 @@ class ObjectController extends AbstractController $sHeaderTitle = Dict::Format('UI:CreationTitle_Class', $sClassLabel); // Note: some code has been duplicated to the case 'apply_new' when a data integrity issue has been found - $aFormExtraParams = array('wizard_container' => 1, 'keep_source_object' => true); - + $aFormExtraParams = ['wizard_container' => 1, 'keep_source_object' => true]; + // - Update flags with parameters set in URL FormHelper::UpdateFlagsFromContext($oObjToClone, $aFormExtraParams); - + if ($this->IsHandlingXmlHttpRequest()) { $aFormExtraParams['js_handlers'] = []; $aFormExtraParams['noRelations'] = true; $aFormExtraParams['hide_transitions'] = true; // Add a random prefix to avoid ID collision for form elements $aFormExtraParams['formPrefix'] = utils::Sanitize(uniqid('', true), '', utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER).'_'; - // We display this form in a modal, once we submit (in ajax) we probably want to only close the modal + // We display this form in a modal, once we submit (in ajax) we probably want to only close the modal $aFormExtraParams['js_handlers']['form_on_submit'] = <<AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE)); } - + $aFormExtraParams['js_handlers']['cancel_button_on_click'] = <<SetContentLayout(PageContentFactory::MakeForObjectDetails($oObjToClone, cmdbAbstractObject::ENUM_DISPLAY_MODE_CREATE)); } - cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, $oObjToClone, array(), $aFormExtraParams); + cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, $oObjToClone, [], $aFormExtraParams); } else { if ($this->IsHandlingXmlHttpRequest()) { $oClassForm = cmdbAbstractObject::DisplayFormBlockSelectClassToCreate($sClass, MetaModel::GetName($sClass), $oAppContext, $aPossibleClasses, ['state' => $sStateCode]); @@ -209,9 +201,8 @@ JS; JS ); $oPage->AddUiBlock($oClassForm); - } - else{ - cmdbAbstractObject::DisplaySelectClassToCreate($sClass, $oPage, $oAppContext, $aPossibleClasses,['state' => $sStateCode]); + } else { + cmdbAbstractObject::DisplaySelectClassToCreate($sClass, $oPage, $oAppContext, $aPossibleClasses, ['state' => $sStateCode]); } } return $oPage; @@ -233,8 +224,7 @@ JS $sFormTitle = utils::ReadPostedParam('form_title', null, utils::ENUM_SANITIZATION_FILTER_STRING); // Check parameters - if (utils::IsNullOrEmptyString($sClass) || utils::IsNullOrEmptyString($sId)) - { + if (utils::IsNullOrEmptyString($sClass) || utils::IsNullOrEmptyString($sId)) { throw new ApplicationException(Dict::Format('UI:Error:2ParametersMissing', 'class', 'id')); } @@ -248,11 +238,11 @@ JS // - Is allowed to edit it? $oSet = CMDBObjectSet::FromObject($oObj); if (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY, $oSet) == UR_ALLOWED_NO) { - throw new SecurityException('User not allowed to modify this object', array('class' => $sClass, 'id' => $sId)); + throw new SecurityException('User not allowed to modify this object', ['class' => $sClass, 'id' => $sId]); } // Prepare web page (should more likely be some kind of response object like for Symfony) - $aFormExtraParams = array('wizard_container' => 1); + $aFormExtraParams = ['wizard_container' => 1]; FormHelper::UpdateFlagsFromContext($oObj, $aFormExtraParams); // Allow form title customization @@ -265,7 +255,7 @@ JS $aFormExtraParams['js_handlers'] = []; $aFormExtraParams['noRelations'] = true; $aFormExtraParams['hide_transitions'] = true; - // We display this form in a modal, once we submit (in ajax) we probably want to only close the modal + // We display this form in a modal, once we submit (in ajax) we probably want to only close the modal $aFormExtraParams['js_handlers']['form_on_submit'] = <<Get($sMandatoryBlobAttCode); // If the current value of the mandatory attribute is not empty, display a different message - if($oMandatoryBlobAttCodeValue instanceof \ormDocument && !$oMandatoryBlobAttCodeValue->IsEmpty()){ + if ($oMandatoryBlobAttCodeValue instanceof \ormDocument && !$oMandatoryBlobAttCodeValue->IsEmpty()) { $sAlertFormMandatoryAttMessageMode = FormHelper::ENUM_MANDATORY_BLOB_MODE_MODIFY_FILLED; } $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal($sAlertFormMandatoryAttMessageMode)); @@ -329,7 +318,7 @@ JS; return $oPage; } - + /** * @return iTopWebPage|JsonPage Object edit form in its webpage * @throws \ApplicationException @@ -350,29 +339,27 @@ JS; $oPage->DisableBreadCrumb(); $this->AddRequiredForModificationJsFilesToPage($oPage); } - + $sClass = utils::ReadPostedParam('class', '', 'class'); $sClassLabel = MetaModel::GetName($sClass); $sFormPrefix = utils::ReadPostedParam('formPrefix', '', utils::ENUM_SANITIZATION_FILTER_STRING); $sTransactionId = utils::ReadPostedParam('transaction_id', '', 'transaction_id'); - $aErrors = array(); - $aWarnings = array(); - if ( empty($sClass) ) - { - IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not created (empty class)', $sClass, array( + $aErrors = []; + $aWarnings = []; + if (empty($sClass)) { + IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not created (empty class)', $sClass, [ '$sTransactionId' => $sTransactionId, '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); + ]); throw new ApplicationException(Dict::Format('UI:Error:1ParametersMissing', 'class')); } - if (!utils::IsTransactionValid($sTransactionId, false)) - { + if (!utils::IsTransactionValid($sTransactionId, false)) { $sUser = UserRights::GetUser(); IssueLog::Error(__CLASS__.'::'.__METHOD__." : invalid transaction_id ! data: user='$sUser', class='$sClass'"); - + if ($this->IsHandlingXmlHttpRequest()) { $aResult['data'] = ['error_message' => Dict::S('UI:Error:ObjectAlreadyCreated')]; } else { @@ -382,25 +369,20 @@ JS; $oPage->AddUiBlock($oErrorAlert); } - IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not created (invalid transaction_id)', $sClass, array( + IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not created (invalid transaction_id)', $sClass, [ '$sTransactionId' => $sTransactionId, '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); - } - else - { + ]); + } else { $oObj = MetaModel::NewObject($sClass); - if (MetaModel::HasLifecycle($sClass)) - { + if (MetaModel::HasLifecycle($sClass)) { $sStateAttCode = MetaModel::GetStateAttributeCode($sClass); $sTargetState = utils::ReadPostedParam('obj_state', ''); - if ($sTargetState != '') - { + if ($sTargetState != '') { $sOrigState = utils::ReadPostedParam('obj_state_orig', ''); - if ($sTargetState != $sOrigState) - { + if ($sTargetState != $sOrigState) { $aWarnings[] = Dict::S('UI:StateChanged'); } $oObj->Set($sStateAttCode, $sTargetState); @@ -408,24 +390,21 @@ JS; } $aErrors = $oObj->UpdateObjectFromPostedForm($sFormPrefix); } - if (isset($oObj) && is_object($oObj)) - { + if (isset($oObj) && is_object($oObj)) { $sClass = get_class($oObj); $sClassLabel = MetaModel::GetName($sClass); - try - { - if (!empty($aErrors) || !empty($aWarnings)) - { - IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not created (see $aErrors)', $sClass, array( + try { + if (!empty($aErrors) || !empty($aWarnings)) { + IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not created (see $aErrors)', $sClass, [ '$sTransactionId' => $sTransactionId, '$aErrors' => $aErrors, '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); + ]); - throw new CoreCannotSaveObjectException(array('id' => $oObj->GetKey(), 'class' => $sClass, 'issues' => $aErrors)); + throw new CoreCannotSaveObjectException(['id' => $oObj->GetKey(), 'class' => $sClass, 'issues' => $aErrors]); } // Transactions are now handled in DBInsert @@ -438,15 +417,14 @@ JS; $oObj->CheckChangedExtKeysValues(); $oObj->DBInsertNoReload(); - - IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object created', $sClass, array( + IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object created', $sClass, [ '$id' => $oObj->GetKey(), '$sTransactionId' => $sTransactionId, '$aErrors' => $aErrors, '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); + ]); utils::RemoveTransaction($sTransactionId); $oPage->set_title(Dict::S('UI:PageTitle:ObjectCreated')); @@ -462,8 +440,7 @@ JS; $oPage->add("

      $sMessage

      "); try { ApplyNextAction($oPage, $oObj, $sNextAction); - } - catch (ApplicationException $e) { + } catch (ApplicationException $e) { $sMessage = $e->getMessage(); $sSeverity = 'info'; ReloadAndDisplay($oPage, $oObj, 'create', $sMessage, $sSeverity); @@ -477,8 +454,7 @@ JS; ReloadAndDisplay($oPage, $oObj, 'create', $sMessage, 'ok'); } } - } - catch (CoreCannotSaveObjectException $e) { + } catch (CoreCannotSaveObjectException $e) { // Found issues, explain and give the user a second chance // $aIssues = $e->getIssues(); @@ -517,7 +493,8 @@ JS; * @throws \DictExceptionMissingString * @throws \MySQLException */ - public function OperationApplyModify(){ + public function OperationApplyModify() + { $bPrintable = utils::ReadParam('printable', '0') === '1'; $aResult = []; if ($this->IsHandlingXmlHttpRequest()) { @@ -534,86 +511,79 @@ JS; $sClassLabel = MetaModel::GetName($sClass); $id = utils::ReadPostedParam('id', ''); $sTransactionId = utils::ReadPostedParam('transaction_id', '', 'transaction_id'); - if ( empty($sClass) || empty($id)) - { - IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not updated (empty class or id)', $sClass, array( + if (empty($sClass) || empty($id)) { + IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not updated (empty class or id)', $sClass, [ '$id' => $id, '$sTransactionId' => $sTransactionId, '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); + ]); // TODO 3.1 Do not crash with an exception in ajax throw new ApplicationException(Dict::Format('UI:Error:2ParametersMissing', 'class', 'id')); } $bDisplayDetails = true; $oObj = MetaModel::GetObject($sClass, $id, false); - if ($oObj === null) - { + if ($oObj === null) { $bDisplayDetails = false; if ($this->IsHandlingXmlHttpRequest()) { $aResult['data'] = ['error_message' => Dict::S('UI:ObjectDoesNotExist')]; } else { $oPage->set_title(Dict::S('UI:ErrorPageTitle')); - + $oErrorAlert = AlertUIBlockFactory::MakeForFailure(Dict::S('UI:ObjectDoesNotExist')); $oErrorAlert->SetIsClosable(false) ->SetIsCollapsible(false); $oPage->AddUiBlock($oErrorAlert); } - - IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not updated (id not found)', $sClass, array( + + IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not updated (id not found)', $sClass, [ '$id' => $id, '$sTransactionId' => $sTransactionId, '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); - } - elseif (!utils::IsTransactionValid($sTransactionId, false)) - { + ]); + } elseif (!utils::IsTransactionValid($sTransactionId, false)) { //TODO: since $bDisplayDetails= true, there will be an redirection, thus, the content generated here is ignored, only the $sMessage and $sSeverity are used after the redirection $sUser = UserRights::GetUser(); IssueLog::Error(__CLASS__.'::'.__METHOD__." : invalid transaction_id ! data: user='$sUser', class='$sClass'"); - + if ($this->IsHandlingXmlHttpRequest()) { $aResult['data'] = ['error_message' => Dict::S('UI:Error:ObjectAlreadyUpdated')]; } else { $oPage->set_title(Dict::Format('UI:ModificationPageTitle_Object_Class', $oObj->GetRawName(), $sClassLabel)); // Set title will take care of the encoding $oPage->p("".Dict::S('UI:Error:ObjectAlreadyUpdated')."\n"); } - + $sMessage = Dict::Format('UI:Error:ObjectAlreadyUpdated', MetaModel::GetName(get_class($oObj)), $oObj->GetName()); $sSeverity = 'error'; - IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not updated (invalid transaction_id)', $sClass, array( + IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not updated (invalid transaction_id)', $sClass, [ '$id' => $id, '$sTransactionId' => $sTransactionId, '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); - } - else - { + ]); + } else { $aErrors = $oObj->UpdateObjectFromPostedForm(); $sMessage = ''; $sSeverity = 'ok'; - if (!$oObj->IsModified() && empty($aErrors)) - { + if (!$oObj->IsModified() && empty($aErrors)) { if ($this->IsHandlingXmlHttpRequest()) { $aResult['data'] = ['error_message' => Dict::Format('UI:Class_Object_NotUpdated', MetaModel::GetName(get_class($oObj)), $oObj->GetName())]; } else { $oPage->set_title(Dict::Format('UI:ModificationPageTitle_Object_Class', $oObj->GetRawName(), $sClassLabel)); // Set title will take care of the encoding } - + $sMessage = Dict::Format('UI:Class_Object_NotUpdated', MetaModel::GetName(get_class($oObj)), $oObj->GetName()); $sSeverity = 'info'; - IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not updated (see either $aErrors or IsModified)', $sClass, array( + IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object not updated (see either $aErrors or IsModified)', $sClass, [ '$id' => $id, '$sTransactionId' => $sTransactionId, '$aErrors' => $aErrors, @@ -621,11 +591,9 @@ JS; '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); - } - else - { - IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object updated', $sClass, array( + ]); + } else { + IssueLog::Trace(__CLASS__.'::'.__METHOD__.' Object updated', $sClass, [ '$id' => $id, '$sTransactionId' => $sTransactionId, '$aErrors' => $aErrors, @@ -633,11 +601,11 @@ JS; '$sUser' => UserRights::GetUser(), 'HTTP_REFERER' => @$_SERVER['HTTP_REFERER'], 'REQUEST_URI' => @$_SERVER['REQUEST_URI'], - )); + ]); try { if (!empty($aErrors)) { - throw new CoreCannotSaveObjectException(array('id' => $oObj->GetKey(), 'class' => $sClass, 'issues' => $aErrors)); + throw new CoreCannotSaveObjectException(['id' => $oObj->GetKey(), 'class' => $sClass, 'issues' => $aErrors]); } $oObj->CheckChangedExtKeysValues(); @@ -655,9 +623,7 @@ JS; if ($this->IsHandlingXmlHttpRequest()) { $aResult['success'] = true; } - } - catch (CoreCannotSaveObjectException $e) - { + } catch (CoreCannotSaveObjectException $e) { // Found issues, explain and give the user a second chance // $bDisplayDetails = false; @@ -666,13 +632,13 @@ JS; $aResult['data'] = ['error_message' => $e->getHtmlMessage()]; } else { $oPage->AddHeaderMessage($e->getHtmlMessage(), 'message_error'); - $oObj->DisplayModifyForm($oPage, - array('wizard_container' => true)); // wizard_container: display the wizard border and the title + $oObj->DisplayModifyForm( + $oPage, + ['wizard_container' => true] + ); // wizard_container: display the wizard border and the title } - - } - catch (DeleteException $e) - { + + } catch (DeleteException $e) { if ($this->IsHandlingXmlHttpRequest()) { $aResult['data'] = ['error_message' => Dict::Format('UI:Class_Object_NotUpdated', MetaModel::GetName(get_class($oObj)), $oObj->GetName())]; } else { @@ -680,8 +646,15 @@ JS; // - 1) Don't be afraid nothing was modified $sMessage = Dict::Format('UI:Class_Object_NotUpdated', MetaModel::GetName(get_class($oObj)), $oObj->GetName()); $sSeverity = 'info'; - cmdbAbstractObject::SetSessionMessage(get_class($oObj), $oObj->GetKey(), 'UI:Class_Object_NotUpdated', $sMessage, - $sSeverity, 0, true /* must not exist */); + cmdbAbstractObject::SetSessionMessage( + get_class($oObj), + $oObj->GetKey(), + 'UI:Class_Object_NotUpdated', + $sMessage, + $sSeverity, + 0, + true /* must not exist */ + ); // - 2) Ok, there was some trouble indeed $sMessage = $e->getMessage(); $sSeverity = 'error'; @@ -702,8 +675,7 @@ JS; if (!empty($sNextAction)) { try { ApplyNextAction($oPage, $oObj, $sNextAction); - } - catch (ApplicationException $e) { + } catch (ApplicationException $e) { $sMessage = $e->getMessage(); $sSeverity = 'info'; ReloadAndDisplay($oPage, $oObj, 'update', $sMessage, $sSeverity); @@ -736,28 +708,25 @@ JS; return $oPage; } - public function OperationSummary() { + public function OperationSummary() + { $oPage = new AjaxPage(''); $sClass = utils::ReadParam('obj_class', '', false, utils::ENUM_SANITIZATION_FILTER_CLASS); $sObjectKey = utils::ReadParam('obj_key', 0, false); - + // - Check if we are allowed to see/make summary for this class - if(SummaryCardService::IsAllowedForClass($sClass)){ - if (is_numeric($sObjectKey)) - { + if (SummaryCardService::IsAllowedForClass($sClass)) { + if (is_numeric($sObjectKey)) { $oObj = MetaModel::GetObject($sClass, $sObjectKey, false /* MustBeFound */); - } - else - { + } else { $oObj = MetaModel::GetObjectByName($sClass, $sObjectKey, false /* MustBeFound */); } - - if($oObj !== null) { + + if ($oObj !== null) { $oPage->AddUiBlock(new ObjectSummary($oObj)); } - } - else { + } else { $oPage->AddUiBlock( AlertUIBlockFactory::MakeForFailure(Dict::S('UI:Error:ActionNotAllowed')) ->SetIsCollapsible(false) @@ -817,7 +786,7 @@ JS; // Retrieve this reference object (for OQL) $sThisObjectData = utils::ReadPostedParam('this_object_data', null, utils::ENUM_SANITIZATION_FILTER_RAW_DATA); $oThisObj = null; - if($sThisObjectData !== null) { + if ($sThisObjectData !== null) { $oThisObj = ObjectRepository::GetObjectFromWizardHelperData($sThisObjectData); } @@ -830,7 +799,7 @@ JS; // Data post processor // Note: Data post processor allow you to perform actions on search result (compute object result statistics, add others information...). if ($aResult !== null && $aDataProcessor !== null) { - $aResult = call_user_func(array($aDataProcessor['class_name'], 'Execute'), $aResult, $aDataProcessor['settings']); + $aResult = call_user_func([$aDataProcessor['class_name'], 'Execute'], $aResult, $aDataProcessor['settings']); } return $oPage->SetData([ @@ -862,7 +831,7 @@ JS; throw new ApplicationException('Invalid marker "'.$sMarker.'"'); } - $aMatches = array(); + $aMatches = []; // Retrieve mentioned class from marker $sMentionedClass = $aMentionsAllowedClasses[$sMarker]; if (MetaModel::IsValidClass($sMentionedClass) === false) { @@ -881,8 +850,8 @@ JS; $aTriggerMentionedSearches = []; - $aTriggerSetParams = array('class_list' => MetaModel::EnumParentClasses($sHostClass, ENUM_PARENT_CLASSES_ALL)); - $oTriggerSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObjectMention AS t WHERE t.target_class IN (:class_list)"), array(), $aTriggerSetParams); + $aTriggerSetParams = ['class_list' => MetaModel::EnumParentClasses($sHostClass, ENUM_PARENT_CLASSES_ALL)]; + $oTriggerSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObjectMention AS t WHERE t.target_class IN (:class_list)"), [], $aTriggerSetParams); /** @var \TriggerOnObjectMention $oTrigger */ while ($oTrigger = $oTriggerSet->Fetch()) { $sTriggerMentionedOQL = $oTrigger->Get('mentioned_filter'); @@ -914,7 +883,6 @@ JS; $sObjectImageAttCode = MetaModel::GetImageAttributeCode($sSearchMainClassName); - // Optimize fields to load $aObjectAttCodesToLoad = []; if (MetaModel::IsValidAttCode($sSearchMainClassName, $sObjectImageAttCode)) { @@ -948,8 +916,7 @@ JS; try { $oObject = MetaModel::GetObject($sObjectClass, $sObjectKey); $aObjectData = ObjectRepository::ConvertObjectToArray($oObject, $sObjectClass); - } - catch (Exception $e) { + } catch (Exception $e) { $bSuccess = false; } @@ -958,4 +925,4 @@ JS; 'success' => $bSuccess, ]); } -} \ No newline at end of file +} diff --git a/sources/Controller/Links/LinkSetController.php b/sources/Controller/Links/LinkSetController.php index 3480f5010..9a5b27811 100644 --- a/sources/Controller/Links/LinkSetController.php +++ b/sources/Controller/Links/LinkSetController.php @@ -1,4 +1,5 @@ IsHandlingXmlHttpRequest()) { throw new CoreException('LinksetController can only be called in ajax.'); } - + $oPage = new JsonPage(); $sErrorMessage = null; $bOperationSuccess = false; @@ -63,8 +64,7 @@ class LinkSetController extends AbstractController if (!$bOperationSuccess) { $sErrorMessage = json_encode($oDeletionPlan->GetIssues()); } - } - catch (Exception $e) { + } catch (Exception $e) { $sErrorMessage = $e->getMessage(); } } else { @@ -89,7 +89,7 @@ class LinkSetController extends AbstractController if (!$this->IsHandlingXmlHttpRequest()) { throw new CoreException('LinksetController can only be called in ajax.'); } - + $oPage = new JsonPage(); $sErrorMessage = null; $bOperationSuccess = false; @@ -107,8 +107,7 @@ class LinkSetController extends AbstractController $oLinkedObject->Set($sExternalKeyAttCode, null); $oLinkedObject->DBWrite(); $bOperationSuccess = true; - } - catch (Exception $e) { + } catch (Exception $e) { $sErrorMessage = $e->getMessage(); } } else { @@ -149,7 +148,7 @@ class LinkSetController extends AbstractController $sRealClass = ''; $aSubClasses = MetaModel::EnumChildClasses($sProposedRealClass, ENUM_CHILD_CLASSES_ALL); // Including the specified class itself - $aPossibleClasses = array(); + $aPossibleClasses = []; foreach ($aSubClasses as $sCandidateClass) { if (!MetaModel::IsAbstract($sCandidateClass) && (UserRights::IsActionAllowed($sCandidateClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) { if ($sCandidateClass == $sProposedRealClass) { @@ -167,13 +166,13 @@ class LinkSetController extends AbstractController if ($sRealClass != '') { $oLinksetDef = MetaModel::GetAttributeDef($sClass, $sAttCode); $sExtKeyToMe = $oLinksetDef->GetExtKeyToMe(); - $aFieldFlags = array($sExtKeyToMe => OPT_ATT_READONLY); + $aFieldFlags = [$sExtKeyToMe => OPT_ATT_READONLY]; $oObj = DBObject::MakeDefaultInstance($sRealClass); $oSourceObj = MetaModel::GetObject($sClass, $sId); $oObj->Set($sExtKeyToMe, $sId); - $aPrefillParam = array('source_obj' => $oSourceObj); + $aPrefillParam = ['source_obj' => $oSourceObj]; $oObj->PrefillForm('creation_from_editinplace', $aPrefillParam); // We display this form in a modal, once we submit (in ajax) we probably want to only close the modal $sFormOnSubmitJsCode = @@ -203,7 +202,6 @@ class LinkSetController extends AbstractController } JS; - $aExtraParams = [ 'noRelations' => true, 'hide_transitions' => true, @@ -228,20 +226,18 @@ JS // Remove blob edition from creation form @see N°5863 to allow blob edition in modal context FormHelper::DisableAttributeBlobInputs($sRealClass, $aExtraParams); - - if(FormHelper::HasMandatoryAttributeBlobInputs($oObj)){ - $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE)); - } - cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, $oObj, array(), $aExtraParams); - } - else - { + if (FormHelper::HasMandatoryAttributeBlobInputs($oObj)) { + $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE)); + } + + cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, $oObj, [], $aExtraParams); + } else { // - We'll let the user select a class if multiple classes are available $oClassForm = FormUIBlockFactory::MakeStandard(); - + // - When the user submit, redo the same request but with a real class - + $sCurrentParameters = json_encode([ 'att_code' => $sAttCode, 'host_class' => $sClass, @@ -295,8 +291,7 @@ JS } $aObjectData = ObjectRepository::ConvertObjectToArray($oObject, $sObjectClass); $aObjectData['link_keys'] = [$sObjectKey]; - } - catch (Exception $e) { + } catch (Exception $e) { $bSuccess = false; } @@ -305,4 +300,4 @@ JS 'success' => $bSuccess, ]); } -} \ No newline at end of file +} diff --git a/sources/Controller/Newsroom/iTopNewsroomController.php b/sources/Controller/Newsroom/iTopNewsroomController.php index 5d737da60..5c24eb0f0 100644 --- a/sources/Controller/Newsroom/iTopNewsroomController.php +++ b/sources/Controller/Newsroom/iTopNewsroomController.php @@ -37,7 +37,6 @@ use UserRights; use utils; use appUserPreferences; - /** * Class iTopNewsroomController * @@ -64,7 +63,7 @@ class iTopNewsroomController extends Controller $oBulkActionsBlock = PanelUIBlockFactory::MakeForInformation(Dict::S('UI:Newsroom:iTopNotification:ViewAllPage:Title')); $oBulkActionsBlock->AddSubTitleBlock(new Html(Dict::S('UI:Newsroom:iTopNotification:ViewAllPage:SubTitle'))); $sPictureUrl = UserRights::GetUserPictureAbsUrl(); - $oBulkActionsBlock->SetIcon($sPictureUrl,Panel::ENUM_ICON_COVER_METHOD_CONTAIN, true); + $oBulkActionsBlock->SetIcon($sPictureUrl, Panel::ENUM_ICON_COVER_METHOD_CONTAIN, true); $oNotificationsCenterButton = ButtonUIBlockFactory::MakeIconLink( 'fas fa-cogs', @@ -90,7 +89,7 @@ class iTopNewsroomController extends Controller $oMarkAllAsReadButton->SetIconClass('far fa-envelope-open') ->AddCSSClass('ibo-notifications--view-all--read-action') ->SetOnClickJsCode( - <<SetIconClass('far fa-envelope') ->AddCSSClass('ibo-notifications--view-all--unread-action') ->SetOnClickJsCode( - <<SetIconClass('fas fa-trash-alt') ->AddCSSClass('ibo-notifications--view-all--delete-action') ->SetOnClickJsCode( - <<AddSubBlock($oMarkAllAsReadButton); $oAllModeButtonsContainer->AddSubBlock($oMarkAllAsUnreadButton); $oAllModeButtonsContainer->AddSubBlock($oDeleteAllButton); $oToolbar->AddSubBlock($oAllModeButtonsContainer); - + $oSelectedModelButtonsContainer = new UIContentBlock('ibo-notifications--view-all--selected-mode-buttons', ['ibo-is-hidden', 'ibo-notifications--view-all--bulk-buttons', 'ibo-notifications--view-all--selected-mode-buttons']); // Make button mark all selected as read $oMarkSelectedAsReadButton = ButtonUIBlockFactory::MakeForSecondaryAction( @@ -230,7 +229,7 @@ JS $oMarkSelectedAsReadButton->SetIconClass('far fa-envelope-open') ->AddCSSClass('ibo-notifications--view-all--read-action') ->SetOnClickJsCode( - <<SetIconClass('far fa-envelope') ->AddCSSClass('ibo-notifications--view-all--unread-action') ->SetOnClickJsCode( - <<SetIconClass('fas fa-trash-alt') ->AddCSSClass('ibo-notifications--view-all--delete-action') ->SetOnClickJsCode( - <<AddSubBlock($oMarkSelectedAsReadButton); $oSelectedModelButtonsContainer->AddSubBlock($oMarkSelectedAsUnreadButton); $oSelectedModelButtonsContainer->AddSubBlock($oDeleteSelectedButton); - + $oToolbar->AddSubBlock($oSelectedModelButtonsContainer); - + // Make toggler to switch between "all" and "selected" mode $oTogglerContentBlock = new UIContentBlock('ibo-notifications--view-all--toggler', ['ibo-notifications--view-all--toggler']); $oToggler = new Toggler(); $oInputWithLabel = InputUIBlockFactory::MakeInputWithLabel('slider', Dict::S('UI:Newsroom:iTopNotification:SelectMode:Label'), $oToggler); $oTogglerContentBlock->AddSubBlock($oInputWithLabel); $oToolbar->AddSubBlock($oTogglerContentBlock); - + $oBulkActionsBlock->AddSubBlock($oToolbar); $oPage->AddUiBlock($oBulkActionsBlock); - + // Search for all notifications for the current user $oSearch = DBObjectSearch::FromOQL('SELECT EventNotificationNewsroom'); $oSearch->AddCondition('contact_id', UserRights::GetContactId(), '='); - $oSet = new DBObjectSet($oSearch, array('read' => true, 'date' => false), array()); - + $oSet = new DBObjectSet($oSearch, ['read' => true, 'date' => false], []); + // Add main content block $oMainContentBlock = new UIContentBlock(null, ['ibo-notifications--view-all--container']); $oPage->AddUiBlock($oMainContentBlock); - + while ($oEvent = $oSet->Fetch()) { $iEventId = $oEvent->GetKey(); // Prepare object summary block @@ -383,10 +382,9 @@ JS $oImage = $oEvent->Get('icon'); if (!$oImage->IsEmpty()) { $sIconUrl = $oImage->GetDisplayURL(get_class($oEvent), $iEventId, 'icon'); - $oEventBlock->SetIcon($sIconUrl, Panel::ENUM_ICON_COVER_METHOD_COVER,true); + $oEventBlock->SetIcon($sIconUrl, Panel::ENUM_ICON_COVER_METHOD_COVER, true); } - - + // Common actions $sDeleteUrl = Router::GetInstance()->GenerateUrl(self::ROUTE_NAMESPACE.'.delete_event', ['notification_id' => $oEvent->GetKey(), 'token' => $sCSRFToken]); $oDeleteButton = ButtonUIBlockFactory::MakeForAlternativeDestructiveAction( @@ -417,12 +415,13 @@ JS ->SetIconClass('fas fa-trash-alt') ->SetTooltip(Dict::S('UI:Newsroom:iTopNotification:ViewAllPage:Action:Delete:Label')); - $oViewButton = ButtonUIBlockFactory::MakeIconLink('fas fa-external-link-alt', + $oViewButton = ButtonUIBlockFactory::MakeIconLink( + 'fas fa-external-link-alt', Dict::S('UI:Newsroom:iTopNotification:ViewAllPage:Action:ViewObject:Label'), Router::GetInstance()->GenerateUrl(self::ROUTE_NAMESPACE.'.view_event', ['event_id' => $iEventId]), '_blank' ); - + // Mark as read action $oMarkAsReadButton = ButtonUIBlockFactory::MakeForAlternativeSecondaryAction( '', @@ -454,7 +453,7 @@ JS }); JS ); - + $oMarkAsUnreadButton = ButtonUIBlockFactory::MakeForAlternativeSecondaryAction( '', 'UI:Newsroom:iTopNotification:ViewAllPage:Action:MarkAsUnread:Label', @@ -483,7 +482,7 @@ JS }); JS ); - + // Add actions to the object summary block and remove old button $oOldButtonId = $oEventBlock->GetActions()->GetId(); $oEventBlock->RemoveSubBlock($oOldButtonId); @@ -494,25 +493,23 @@ JS $oActionsBlock->AddSubBlock($oViewButton); $oActionsBlock->AddSubBlock($oDeleteButton); $oEventBlock->SetActions($oActionsBlock); - - + $oMainContentBlock->AddSubBlock($oEventBlock); } - + // Add empty content block $oEmptyContentBlock = new UIContentBlock('ibo-notifications--view-all--empty', ['ibo-notifications--view-all--empty', 'ibo-svg-illustration--container']); $oEmptyContentBlock->AddSubBlock(new Html(file_get_contents(APPROOT.'/images/illustrations/undraw_social_serenity.svg'))); $oEmptyContentBlock->AddSubBlock(TitleUIBlockFactory::MakeNeutral(Dict::S('UI:Newsroom:iTopNotification:ViewAllPage:Empty:Title'))); $oPage->AddUiBlock($oEmptyContentBlock); - + // Hide empty content block if there are notifications - if($oSet->Count() === 0){ + if ($oSet->Count() === 0) { $oMainContentBlock->AddCSSClass('ibo-is-hidden'); - } - else { + } else { $oEmptyContentBlock->AddCSSClass('ibo-is-hidden'); } - + return $oPage; } @@ -534,7 +531,7 @@ JS if (utils::IsNotNullOrEmptyString($iContactId)) { $oSearch = DBObjectSearch::FromOQL('SELECT EventNotificationNewsroom WHERE contact_id = :contact_id AND read = "no"'); - $oSet = new DBObjectSet($oSearch, array(), array('contact_id' => $iContactId)); + $oSet = new DBObjectSet($oSearch, [], ['contact_id' => $iContactId]); while ($oMessage = $oSet->Fetch()) { $sTitle = $oMessage->Get('title'); @@ -549,7 +546,7 @@ HTML; $sIcon = $oMessage->Get('icon') !== null ? $oMessage->Get('icon')->GetDisplayURL('EventNotificationNewsroom', $oMessage->GetKey(), 'icon') : Branding::GetCompactMainLogoAbsoluteUrl(); - $aMessages[] = array( + $aMessages[] = [ 'id' => $oMessage->GetKey(), 'text' => $sText, 'url' => Router::GetInstance()->GenerateUrl(self::ROUTE_NAMESPACE.'.view_event', ['event_id' => $oMessage->GetKey()]), @@ -557,7 +554,7 @@ HTML; 'start_date' => $oMessage->Get('date'), 'priority' => $oMessage->Get('priority'), 'image' => $sIcon, - ); + ]; } } @@ -582,10 +579,9 @@ HTML; $iCount = 0; $iContactId = UserRights::GetContactId(); - if (utils::IsNotNullOrEmptyString($iContactId)) { $oSearch = DBObjectSearch::FromOQL('SELECT EventNotificationNewsroom WHERE contact_id = :contact_id AND read = "no"'); - $oSet = new DBObjectSet($oSearch, array(), array('contact_id' => $iContactId)); + $oSet = new DBObjectSet($oSearch, [], ['contact_id' => $iContactId]); while ($oEvent = $oSet->Fetch()) { $oEvent->Set('read', 'yes'); @@ -622,8 +618,7 @@ HTML; $sUrl = $oEvent->Get('url'); header("Location: $sUrl"); } - } - catch (ArchivedObjectException|CoreException $e) { + } catch (ArchivedObjectException|CoreException $e) { $this->DisplayPageNotFound(); } } @@ -729,14 +724,14 @@ HTML; protected function PerformAction(string $sAction, array $aNotificationIds): array { $sCSRFToken = utils::ReadParam('token', '', false, 'raw_data'); - if(utils::IsTransactionValid($sCSRFToken, false) === false){ + if (utils::IsTransactionValid($sCSRFToken, false) === false) { throw new SecurityException('Invalid CSRF token'); } $sActionAsCamelCase = utils::ToCamelCase($sAction); $aReturnData = [ 'status' => 'error', - 'message' => 'Invalid notification(s)' + 'message' => 'Invalid notification(s)', ]; // Check action type @@ -757,7 +752,7 @@ HTML; // No notification found $iCount = $oSet->Count(); - if($iCount === 0) { + if ($iCount === 0) { $aReturnData['message'] = Dict::S("UI:Newsroom:iTopNotification:ViewAllPage:Action:$sActionAsCamelCase:NoEvent:Message"); return $aReturnData; } @@ -787,4 +782,4 @@ HTML; return $aReturnData; } -} \ No newline at end of file +} diff --git a/sources/Controller/Notifications/ActionController.php b/sources/Controller/Notifications/ActionController.php index d42d9e760..ce392a455 100644 --- a/sources/Controller/Notifications/ActionController.php +++ b/sources/Controller/Notifications/ActionController.php @@ -1,4 +1,5 @@ AddCSSClass('ibo-datatable-panel'); $oNotificationsPanel->AddSubTitleBlock(new Html(Dict::S('UI:NotificationsCenter:Panel:SubTitle'))); $sPictureUrl = UserRights::GetUserPictureAbsUrl(); - $oNotificationsPanel->SetIcon($sPictureUrl,Panel::ENUM_ICON_COVER_METHOD_CONTAIN, true); + $oNotificationsPanel->SetIcon($sPictureUrl, Panel::ENUM_ICON_COVER_METHOD_CONTAIN, true); $oAllNewsPageButton = ButtonUIBlockFactory::MakeIconLink( 'fas fa-bell', @@ -75,10 +76,10 @@ class NotificationsCenterController extends Controller $oNotificationsPanel->SetToolBlocks([$oAllNewsPageButton]); $oNotificationsCenterTableColumns = [ - 'trigger' => array('label' => MetaModel::GetName('Trigger')), - 'trigger_class' => array('label' => MetaModel::GetAttributeDef('Trigger', 'finalclass')->GetLabel()), - 'complement' => array('label' => MetaModel::GetAttributeDef('Trigger', 'complement')->GetLabel()), - 'channels' => array('label' => Dict::S('UI:NotificationsCenter:Panel:Table:Channels')), + 'trigger' => ['label' => MetaModel::GetName('Trigger')], + 'trigger_class' => ['label' => MetaModel::GetAttributeDef('Trigger', 'finalclass')->GetLabel()], + 'complement' => ['label' => MetaModel::GetAttributeDef('Trigger', 'complement')->GetLabel()], + 'channels' => ['label' => Dict::S('UI:NotificationsCenter:Panel:Table:Channels')], ]; // Get all subscribed/unsubscribed actions notifications for the current user @@ -153,13 +154,13 @@ class NotificationsCenterController extends Controller $aSetValues[] = $aChannel['value']; $aChannels[$sNotificationClass]['mixed'] = true; $aChannels[$sNotificationClass]['mixed_value'] = Dict::Format('UI:NotificationsCenter:Channel:OutOf:Text', $aChannel['total_subscribed'], $aChannel['total']); - } else if ($aChannel['subscribed'] === true) { + } elseif ($aChannel['subscribed'] === true) { $aSetValues[] = $aChannel['value']; } - + // Explode status array into a readable string - $aChannels[$sNotificationClass]['additional_field'] = implode(', ', array_map(function($iCount, $sStatus) use($sNotificationClass) { - return $iCount.' '. MetaModel::GetStateLabel($sNotificationClass, $sStatus); + $aChannels[$sNotificationClass]['additional_field'] = implode(', ', array_map(function ($iCount, $sStatus) use ($sNotificationClass) { + return $iCount.' '.MetaModel::GetStateLabel($sNotificationClass, $sStatus); }, $aChannel['status'], array_keys($aChannel['status']))); } // Create a input set for the channels @@ -206,8 +207,7 @@ $.ajax({ JS ); // Set the minimum number of channels to 1 if the subscription policy is {@see SubscriptionPolicy::ForceAtLeastOneChannel} - if($sTriggerSubscriptionPolicy === SubscriptionPolicy::ForceAtLeastOneChannel->value) - { + if ($sTriggerSubscriptionPolicy === SubscriptionPolicy::ForceAtLeastOneChannel->value) { $oChannelSet->SetMinItems(1); } $oChannelSet->SetOnItemRemoveJs( @@ -284,13 +284,13 @@ JS * @return \JsonPage * @throws \Exception */ - function OperationUnsubscribeFromChannel(): \JsonPage + public function OperationUnsubscribeFromChannel(): \JsonPage { // Get the CSRF token from the request and check if it's valid if (!$this->CheckPostedCSRF()) { throw new \Exception('Invalid token'); } - + // Get the channel from the request $sChannel = utils::ReadParam('channel', '', true, 'raw_data'); $aChannel = explode('|', $sChannel); @@ -310,14 +310,14 @@ JS if ($oTrigger->Get('subscription_policy') === SubscriptionPolicy::ForceAllChannels->value) { throw new \Exception('You are not allowed to unsubscribe from this channel'); } - + // Check if we are subscribed to at least 1 channel $oSubscribedActionsNotificationsSet = NotificationsRepository::GetInstance()->SearchSubscriptionsByTriggerContactSubscriptionAndFinalclass($iTriggerId, \UserRights::GetContactId(), '1', $sFinalclass); if ($oSubscribedActionsNotificationsSet->Count() === 0) { throw new \Exception('You are not subscribed to any channel'); } // Check the trigger subscription policy and if we are subscribed to at least 1 channel if necessary - if($oTrigger->Get('subscription_policy') === SubscriptionPolicy::ForceAtLeastOneChannel->value) { + if ($oTrigger->Get('subscription_policy') === SubscriptionPolicy::ForceAtLeastOneChannel->value) { $oTotalSubscribedActionsNotificationsSet = NotificationsRepository::GetInstance()->SearchSubscriptionsByTriggerContactAndSubscription($iTriggerId, \UserRights::GetContactId(), '1'); if (($oTotalSubscribedActionsNotificationsSet->Count() - $oSubscribedActionsNotificationsSet->Count()) === 0) { throw new \Exception('You can\'t unsubscribe from this channel, you must be subscribed to at least one channel'); @@ -332,8 +332,7 @@ JS 'status' => 'success', 'message' => Dict::S('UI:NotificationsCenter:Unsubscribe:Success'), ]; - } - catch (Exception $e) { + } catch (Exception $e) { // Return an error message if an exception is thrown $aReturnData = [ 'status' => 'error', @@ -350,17 +349,17 @@ JS * @return \JsonPage * @throws \Exception */ - function OperationSubscribeToChannel(): \JsonPage + public function OperationSubscribeToChannel(): \JsonPage { // Get the CSRF token from the request and check if it's valid if (!$this->CheckPostedCSRF()) { throw new \Exception('Invalid token'); } - + // Get the channel from the request $sChannel = utils::ReadParam('channel', '', true, 'raw_data'); $aChannel = explode('|', $sChannel); - + $oPage = new \JsonPage(); $aReturnData = []; try { @@ -385,8 +384,7 @@ JS 'status' => 'success', 'message' => Dict::S('UI:NotificationsCenter:Subscribe:Success'), ]; - } - catch (Exception $e) { + } catch (Exception $e) { // Return an error message if an exception is thrown $aReturnData = [ 'status' => 'error', @@ -398,4 +396,4 @@ JS return $oPage; } -} \ No newline at end of file +} diff --git a/sources/Controller/OAuth/OAuthLandingController.php b/sources/Controller/OAuth/OAuthLandingController.php index a6429738c..f941443c4 100644 --- a/sources/Controller/OAuth/OAuthLandingController.php +++ b/sources/Controller/OAuth/OAuthLandingController.php @@ -13,4 +13,4 @@ class OAuthLandingController extends Controller $this->AddLinkedScript(utils::GetAbsoluteUrlAppRoot().'js/ajax_hook.js'); $this->DisplayPage([], null, static::ENUM_PAGE_TYPE_BASIC_HTML); } -} \ No newline at end of file +} diff --git a/sources/Controller/PreferencesController.php b/sources/Controller/PreferencesController.php index 918accd99..04f235dad 100644 --- a/sources/Controller/PreferencesController.php +++ b/sources/Controller/PreferencesController.php @@ -1,4 +1,5 @@ $bResult, ]); } -} \ No newline at end of file +} diff --git a/sources/Controller/WelcomePopupController.php b/sources/Controller/WelcomePopupController.php index f930e0718..ef794c1a2 100644 --- a/sources/Controller/WelcomePopupController.php +++ b/sources/Controller/WelcomePopupController.php @@ -1,4 +1,5 @@ AcknowledgeMessage($sMessageUUID); $aResult = ['success' => true]; - } - catch (Exception $oException) { + } catch (Exception $oException) { $aResult = [ 'success' => false, 'error_message' => $oException->getMessage(), @@ -42,4 +42,3 @@ class WelcomePopupController extends AbstractController return $oPage; } } - diff --git a/sources/Controller/iController.php b/sources/Controller/iController.php index 17d454d1e..a44fa2fb0 100644 --- a/sources/Controller/iController.php +++ b/sources/Controller/iController.php @@ -1,4 +1,5 @@ $oOAuthClient->Get('client_id'), 'clientSecret' => $oOAuthClient->Get('client_secret'), 'redirectUri' => $oOAuthClient->Get('redirect_url'), - 'tenant' => $oOAuthClient->Get('tenant'), + 'tenant' => $oOAuthClient->Get('tenant'), ]; $this->oVendorProvider = new Azure($aOptions, $collaborators); diff --git a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php index 77006d436..6fb8c0546 100644 --- a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php +++ b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php @@ -125,4 +125,4 @@ class OAuthClientProviderFactory return new $sProviderClass($oOAuthClient, $aCollaborators); } -} \ No newline at end of file +} diff --git a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php index 838a8783e..52fa2e4b7 100644 --- a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php +++ b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php @@ -7,7 +7,7 @@ use League\OAuth2\Client\Provider\Google; class OAuthClientProviderGoogle extends OAuthClientProviderAbstract { /** @var string */ - static protected $sVendorName = 'Google'; + protected static $sVendorName = 'Google'; public function __construct($oOAuthClient, array $collaborators = []) { @@ -24,4 +24,4 @@ class OAuthClientProviderGoogle extends OAuthClientProviderAbstract $this->oVendorProvider = new Google($aOptions, $collaborators); } -} \ No newline at end of file +} diff --git a/sources/Core/CMDBChange/CMDBChangeOrigin.php b/sources/Core/CMDBChange/CMDBChangeOrigin.php index c8aa5cff3..66e1dea36 100644 --- a/sources/Core/CMDBChange/CMDBChangeOrigin.php +++ b/sources/Core/CMDBChange/CMDBChangeOrigin.php @@ -1,4 +1,5 @@ m_aData = array(); + $this->m_aData = []; $this->m_oMessage = new SymfonyEmail(); $this->InitRecipientFrom(); @@ -129,12 +130,11 @@ class EMailSymfony extends Email { try { AsyncSendEmail::AddToQueue($this, $oLog); - } - catch (Exception $e) { - $aIssues = array($e->GetMessage()); + } catch (Exception $e) { + $aIssues = [$e->GetMessage()]; return EMAIL_SEND_ERROR; } - $aIssues = array(); + $aIssues = []; return EMAIL_SEND_PENDING; } @@ -165,11 +165,10 @@ class EMailSymfony extends Email $sPassword = self::$m_oConfig->Get('email_transport_smtp.password'); $bVerifyPeer = static::$m_oConfig->Get('email_transport_smtp.verify_peer'); - // Build the DSN string $sDsnUser = $sUserName !== null ? rawurlencode($sUserName) : ''; - $sDsnPassword = ($sPassword !== null && $sPassword !== '') ? ':' . rawurlencode($sPassword) : ''; - $sDsnPort = $sHost . (strlen($sPort) ? ':' . $sPort : ''); + $sDsnPassword = ($sPassword !== null && $sPassword !== '') ? ':'.rawurlencode($sPassword) : ''; + $sDsnPort = $sHost.(strlen($sPort) ? ':'.$sPort : ''); $sDsn = null; if (strtolower($sEncryption) === 'ssl') { @@ -188,7 +187,7 @@ class EMailSymfony extends Email // Handle peer verification $oStream = $oTransport->getStream(); - $aOptions= $oStream->getStreamOptions(); + $aOptions = $oStream->getStreamOptions(); if (!$bVerifyPeer && array_key_exists('ssl', $aOptions)) { // Disable verification $aOptions['ssl']['verify_peer'] = false; @@ -226,7 +225,7 @@ class EMailSymfony extends Email case 'LogFile': // Use a custom transport that writes to a log file // Note: the log file is not rotated, so this should be used for debugging - $oTransport = new SymfonyFileTransport(APPROOT . 'log/', 'mail.log'); + $oTransport = new SymfonyFileTransport(APPROOT.'log/', 'mail.log'); $oMailer = new Mailer($oTransport); break; @@ -245,19 +244,17 @@ class EMailSymfony extends Email } $oMailer->send($this->m_oMessage); - $aIssues = array(); + $aIssues = []; $oKPI->ComputeStats('Email Sent', 'Succeded'); return EMAIL_SEND_OK; - } - catch (TransportExceptionInterface $e) { + } catch (TransportExceptionInterface $e) { IssueLog::Warning('Email sending failed: '.$e->getMessage()); - $aIssues = array($e->getMessage()); + $aIssues = [$e->getMessage()]; $oKPI->ComputeStats('Email Sent', 'Error received'); return EMAIL_SEND_ERROR; - } - catch (Exception $e) { + } catch (Exception $e) { $oKPI->ComputeStats('Email Sent', 'Error received'); throw $e; } @@ -325,10 +322,10 @@ class EMailSymfony extends Email $this->SetRecipientFrom($this->m_aData['to']); } - if($iSyncAsync === true) { + if ($iSyncAsync === true) { return $this->SendSynchronous($aIssues, $oLog); } else { - switch($iSyncAsync) { + switch ($iSyncAsync) { case Email::ENUM_SEND_FORCE_SYNCHRONOUS: return $this->SendSynchronous($aIssues, $oLog); case Email::ENUM_SEND_FORCE_ASYNCHRONOUS: @@ -337,7 +334,7 @@ class EMailSymfony extends Email default: $oConfig = $this->LoadConfig(); $bConfigASYNC = $oConfig->Get('email_asynchronous'); - if($bConfigASYNC) { + if ($bConfigASYNC) { return $this->SendAsynchronous($aIssues, $oLog); } else { return $this->SendSynchronous($aIssues, $oLog); @@ -352,7 +349,7 @@ class EMailSymfony extends Email public function AddToHeader($sKey, $sValue) { if (!array_key_exists('headers', $this->m_aData)) { - $this->m_aData['headers'] = array(); + $this->m_aData['headers'] = []; } $this->m_aData['headers'][$sKey] = $sValue; @@ -367,7 +364,7 @@ class EMailSymfony extends Email // Note: The email library will add the angle brackets for you // so let's remove the angle brackets if present, for historical reasons - $sId = str_replace(array('<', '>'), '', $sId); + $sId = str_replace(['<', '>'], '', $sId); $this->m_oMessage->getHeaders()->addIdHeader('Message-ID', $sId); } @@ -381,10 +378,10 @@ class EMailSymfony extends Email { // Note: Symfony will add the angle brackets // let's remove the angle brackets if present, for historical reasons - $sId = str_replace(array('<', '>'), '', $sMessageId); - $this->m_aData['in_reply_to'] = '<' . $sId . '>'; + $sId = str_replace(['<', '>'], '', $sMessageId); + $this->m_aData['in_reply_to'] = '<'.$sId.'>'; - $this->m_oMessage->getHeaders()->addTextHeader('In-Reply-To', '<' . $sId . '>'); + $this->m_oMessage->getHeaders()->addTextHeader('In-Reply-To', '<'.$sId.'>'); } /** @@ -397,7 +394,7 @@ class EMailSymfony extends Email $sBody = static::InlineCssIntoBodyContent($sBody, $sCustomStyles); } - $this->m_aData['body'] = array('body' => $sBody, 'mimeType' => $sMimeType); + $this->m_aData['body'] = ['body' => $sBody, 'mimeType' => $sMimeType]; $oTextPart = new TextPart(strip_tags($sBody), 'utf-8', 'plain', 'base64'); @@ -409,12 +406,11 @@ class EMailSymfony extends Email // Default root part is the HTML body $oRootPart = $oAlternativePart; - if(count($aAdditionalParts) > 0) { + if (count($aAdditionalParts) > 0) { $aRelatedParts = array_merge([$oAlternativePart], $aAdditionalParts); $oRootPart = new RelatedPart(...$aRelatedParts); } - } - else { + } else { // Default root part is the text body $oRootPart = $oTextPart; } @@ -442,9 +438,9 @@ class EMailSymfony extends Email $sMimeSubtype = $this->GetMimeSubtype($sMimeType); if (!array_key_exists('parts', $this->m_aData)) { - $this->m_aData['parts'] = array(); + $this->m_aData['parts'] = []; } - $this->m_aData['parts'][] = array('text' => $sText, 'mimeType' => $sMimeType); + $this->m_aData['parts'][] = ['text' => $sText, 'mimeType' => $sMimeType]; $oNewPart = new TextPart($sText, $sMimeType, $sMimeSubtype, 'base64'); $this->m_oMessage->addPart($oNewPart); @@ -453,20 +449,19 @@ class EMailSymfony extends Email public function AddAttachment($data, $sFileName, $sMimeType) { if (!array_key_exists('attachments', $this->m_aData)) { - $this->m_aData['attachments'] = array(); + $this->m_aData['attachments'] = []; } - $this->m_aData['attachments'][] = array('data' => base64_encode($data), 'filename' => $sFileName, 'mimeType' => $sMimeType); + $this->m_aData['attachments'][] = ['data' => base64_encode($data), 'filename' => $sFileName, 'mimeType' => $sMimeType]; $oBody = $this->m_oMessage->getBody(); $oRootPart = $oBody; $aAttachmentPart = new DataPart($data, $sFileName, $sMimeType, 'base64'); - if( $oBody instanceof MixedPart) { + if ($oBody instanceof MixedPart) { $aCurrentParts = $oBody->getParts(); $aCurrentParts[] = $aAttachmentPart; $oRootPart = new MixedPart(...$aCurrentParts); - } - else { + } else { $oRootPart = new MixedPart($oBody, $aAttachmentPart); } @@ -489,7 +484,7 @@ class EMailSymfony extends Email */ protected function AddressStringToArray($sAddressCSVList) { - $aAddresses = array(); + $aAddresses = []; foreach (explode(',', $sAddressCSVList) as $sAddress) { $sAddress = trim($sAddress); if (strlen($sAddress) > 0) { @@ -513,14 +508,14 @@ class EMailSymfony extends Email $aRes = $this->m_oMessage->getTo(); if ($bAsString) { - $aStrings = array(); + $aStrings = []; foreach ($aRes as $oEmail) { $sName = $oEmail->getName(); $sEmail = $oEmail->getAddress(); if (empty($sName)) { $aStrings[] = $sEmail; } else { - $sName = str_replace(array('<', '>'), '', $sName); + $sName = str_replace(['<', '>'], '', $sName); $aStrings[] = "$sName <$sEmail>"; } } @@ -550,20 +545,20 @@ class EMailSymfony extends Email public function SetRecipientFrom($sAddress, $sLabel = '') { - $this->m_aData['from'] = array('address' => $sAddress, 'label' => $sLabel); + $this->m_aData['from'] = ['address' => $sAddress, 'label' => $sLabel]; if ($sLabel != '') { $this->m_oMessage->from(sprintf('%s <%s>', $sLabel, $sAddress)); - } else if (!empty($sAddress)) { + } elseif (!empty($sAddress)) { $this->m_oMessage->from($sAddress); } } public function SetRecipientReplyTo($sAddress, $sLabel = '') { - $this->m_aData['reply_to'] = array('address' => $sAddress, 'label' => $sLabel); + $this->m_aData['reply_to'] = ['address' => $sAddress, 'label' => $sLabel]; if ($sLabel != '') { $this->m_oMessage->replyTo(sprintf('%s <%s>', $sLabel, $sAddress)); - } else if (!empty($sAddress)) { + } elseif (!empty($sAddress)) { $this->m_oMessage->replyTo($sAddress); } } @@ -588,4 +583,4 @@ class EMailSymfony extends Email return $sBody; } -} \ No newline at end of file +} diff --git a/sources/Core/Email/Transport/SymfonyFileTransport.php b/sources/Core/Email/Transport/SymfonyFileTransport.php index 6f007a1bd..4958e4790 100644 --- a/sources/Core/Email/Transport/SymfonyFileTransport.php +++ b/sources/Core/Email/Transport/SymfonyFileTransport.php @@ -19,7 +19,7 @@ class SymfonyFileTransport extends AbstractTransport public function __construct(?string $sLogDir = null, string $sFilename = 'mail.log', ?EventDispatcherInterface $oDispatcher = null, ?LoggerInterface $oLogger = null) { parent::__construct($oDispatcher, $oLogger); - $this->sDir = rtrim($sLogDir ?? APPROOT . 'log/', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + $this->sDir = rtrim($sLogDir ?? APPROOT.'log/', DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; $this->sFilename = $sFilename; } @@ -60,4 +60,3 @@ class SymfonyFileTransport extends AbstractTransport return 'logfile'; } } - diff --git a/sources/Core/Email/Transport/SymfonyOAuthTransport.php b/sources/Core/Email/Transport/SymfonyOAuthTransport.php index 553bcb590..6ff9b68af 100644 --- a/sources/Core/Email/Transport/SymfonyOAuthTransport.php +++ b/sources/Core/Email/Transport/SymfonyOAuthTransport.php @@ -21,8 +21,7 @@ class SymfonyOAuthTransport extends EsmtpTransport { /** @var OAuthClientProviderAbstract|null */ protected static $oProvider = null; - const LOG_CHANNEL = 'OAuth'; - + public const LOG_CHANNEL = 'OAuth'; public function __construct($aConfig = [], ?LoggerInterface $oLogger = null) { @@ -90,16 +89,14 @@ class SymfonyOAuthTransport extends EsmtpTransport try { $oAccessToken = $oProvider->GetAccessToken(); - } - catch (\Throwable $e) { + } catch (\Throwable $e) { IssueLog::Error('Failed to get OAuth provider access token: '.$e->getMessage(), 'OAuth'); throw new TransportException('Failed to obtain OAuth access token for SMTP', 0, $e); } if ($oAccessToken === null) { throw new IdentityProviderException('Not prior authentication to OAuth', 255, []); - } - elseif ($oAccessToken->hasExpired()) { + } elseif ($oAccessToken->hasExpired()) { self::$oProvider->SetAccessToken(self::$oProvider->GetVendorProvider()->getAccessToken('refresh_token', [ 'refresh_token' => $oAccessToken->getRefreshToken(), 'scope' => self::$oProvider->GetScope(), @@ -124,8 +121,7 @@ class SymfonyOAuthTransport extends EsmtpTransport // Ensure a fresh token is available and set as SMTP password try { $this->ensureOAuthTokenIsReady(); - } - catch (IdentityProviderException $e) { + } catch (IdentityProviderException $e) { IssueLog::Error('Failed to get SMTP oAuth credentials for incoming mails for provider '.self::$oProvider::GetVendorName(), static::LOG_CHANNEL, [ 'exception.message' => $e->getMessage(), 'exception.stack' => $e->getTraceAsString(), diff --git a/sources/Core/Email/Transport/SymfonyPHPMailTransport.php b/sources/Core/Email/Transport/SymfonyPHPMailTransport.php index 6c969c598..7f2334ff2 100644 --- a/sources/Core/Email/Transport/SymfonyPHPMailTransport.php +++ b/sources/Core/Email/Transport/SymfonyPHPMailTransport.php @@ -1,4 +1,5 @@ get('Subject')->getBodyAsString(); } - /** * @param Email $oRawEmail * @@ -56,13 +56,13 @@ class SymfonyPHPMailTransport extends AbstractTransport $sHeaders = ''; foreach ($oHeaders->all() as $header) { if (strtolower($header->getName()) !== 'to' && strtolower($header->getName()) !== 'subject') { - $sHeaders .= $header->toString() . "\r\n"; + $sHeaders .= $header->toString()."\r\n"; } } $oBodyHeader = $oRawEmail->getBody()->getPreparedHeaders(); foreach ($oBodyHeader->all() as $header) { - $sHeaders .= $header->toString() . "\r\n"; + $sHeaders .= $header->toString()."\r\n"; } // Remove trailing line break @@ -85,7 +85,6 @@ class SymfonyPHPMailTransport extends AbstractTransport $success = mail($sTo, $sSubject, $sBody, $sHeaders); - if (!$success) { throw new \RuntimeException('The mail() function failed to send the message. Check server mail configuration.'); } @@ -95,4 +94,4 @@ class SymfonyPHPMailTransport extends AbstractTransport { return 'phpmail://default'; } -} \ No newline at end of file +} diff --git a/sources/Core/Email/iEMail.php b/sources/Core/Email/iEMail.php index 55ae758ba..ce64adf33 100644 --- a/sources/Core/Email/iEMail.php +++ b/sources/Core/Email/iEMail.php @@ -16,7 +16,7 @@ interface iEMail * @throws \CoreException * @throws \Symfony\Component\CssSelector\Exception\SyntaxErrorException */ - static public function UnSerializeV2($sSerializedMessage); + public static function UnSerializeV2($sSerializedMessage); public function Send(&$aIssues, $bForceSynchronous = false, $oLog = null); @@ -48,4 +48,4 @@ interface iEMail public function SetRecipientReplyTo($sAddress, $sLabel = ''); -} \ No newline at end of file +} diff --git a/sources/Core/EventListener/AttributeBlobEventListener.php b/sources/Core/EventListener/AttributeBlobEventListener.php index 4db7ee276..123aa8159 100644 --- a/sources/Core/EventListener/AttributeBlobEventListener.php +++ b/sources/Core/EventListener/AttributeBlobEventListener.php @@ -1,4 +1,5 @@ Get('document'); $sTriggerClass = TriggerOnAttributeBlobDownload::class; - $aTriggerContextArgs = array( + $aTriggerContextArgs = [ 'this->object()' => $oObject, 'attribute_code' => $sAttCode, 'file->mime_type' => $oDocument->GetMimeType(), @@ -68,9 +69,9 @@ class AttributeBlobEventListener implements iEventServiceSetup 'file->downloads_count' => $oDocument->GetDownloadsCount(), 'file->data' => $oDocument->GetData(), 'file->data_as_base64' => base64_encode($oDocument->GetData()), - ); - $aTriggerParams = array('class_list' => MetaModel::EnumParentClasses(get_class($oObject), ENUM_PARENT_CLASSES_ALL)); - $oTriggerSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT $sTriggerClass AS t WHERE t.target_class IN (:class_list)"), array(), $aTriggerParams); + ]; + $aTriggerParams = ['class_list' => MetaModel::EnumParentClasses(get_class($oObject), ENUM_PARENT_CLASSES_ALL)]; + $oTriggerSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT $sTriggerClass AS t WHERE t.target_class IN (:class_list)"), [], $aTriggerParams); /** @var \Trigger $oTrigger */ while ($oTrigger = $oTriggerSet->Fetch()) { @@ -86,4 +87,4 @@ class AttributeBlobEventListener implements iEventServiceSetup } } } -} \ No newline at end of file +} diff --git a/sources/Core/Kpi/KpiLogData.php b/sources/Core/Kpi/KpiLogData.php index 91a1b147b..2701be80a 100644 --- a/sources/Core/Kpi/KpiLogData.php +++ b/sources/Core/Kpi/KpiLogData.php @@ -1,4 +1,5 @@ sType = $sType; - $this->sOperation = $sOperation; - $this->sArguments = @iconv(mb_detect_encoding($sArguments, mb_detect_order(), true), 'UTF-8', $sArguments); - $this->fStartTime = $fStartTime; - $this->fStopTime = $fStopTime; - $this->sExtension = $sExtension; - $this->iInitialMemory = $iInitialMemory; - $this->iCurrentMemory = $iCurrentMemory; - $this->iPeakMemory = $iPeakMemory; - $this->aData = $aData; - } + /** + * @param string $sType + * @param string $sOperation + * @param string $sArguments + * @param float $fStartTime + * @param float $fStopTime + * @param string $sExtension + * @param int $iInitialMemory + * @param int $iCurrentMemory + * @param array $aData + */ + public function __construct($sType, $sOperation, $sArguments, $fStartTime, $fStopTime, $sExtension, $iInitialMemory = 0, $iCurrentMemory = 0, $iPeakMemory = 0, $aData = []) + { + $this->sType = $sType; + $this->sOperation = $sOperation; + $this->sArguments = @iconv(mb_detect_encoding($sArguments, mb_detect_order(), true), 'UTF-8', $sArguments); + $this->fStartTime = $fStartTime; + $this->fStopTime = $fStopTime; + $this->sExtension = $sExtension; + $this->iInitialMemory = $iInitialMemory; + $this->iCurrentMemory = $iCurrentMemory; + $this->iPeakMemory = $iPeakMemory; + $this->aData = $aData; + } - /** - * Return the CSV Header - * - * @return string - */ - public static function GetCSVHeader() - { - return "Type,Operation,Arguments,StartTime,StopTime,Duration,Extension,InitialMemory,CurrentMemory,PeakMemory"; - } + /** + * Return the CSV Header + * + * @return string + */ + public static function GetCSVHeader() + { + return "Type,Operation,Arguments,StartTime,StopTime,Duration,Extension,InitialMemory,CurrentMemory,PeakMemory"; + } - /** - * Return the CSV line for the values - * @return string - */ - public function GetCSV() - { - $fDuration = sprintf('%01.4f', $this->fStopTime - $this->fStartTime); - $sType = $this->RemoveQuotes($this->sType); - $sOperation = $this->RemoveQuotes($this->sOperation); - $sArguments = $this->RemoveQuotes($this->sArguments); - $sExtension = $this->RemoveQuotes($this->sExtension); - return "\"$sType\",\"$sOperation\",\"$sArguments\",$this->fStartTime,$this->fStopTime,$fDuration,\"$sExtension\",$this->iInitialMemory,$this->iCurrentMemory,$this->iPeakMemory"; - } + /** + * Return the CSV line for the values + * @return string + */ + public function GetCSV() + { + $fDuration = sprintf('%01.4f', $this->fStopTime - $this->fStartTime); + $sType = $this->RemoveQuotes($this->sType); + $sOperation = $this->RemoveQuotes($this->sOperation); + $sArguments = $this->RemoveQuotes($this->sArguments); + $sExtension = $this->RemoveQuotes($this->sExtension); + return "\"$sType\",\"$sOperation\",\"$sArguments\",$this->fStartTime,$this->fStopTime,$fDuration,\"$sExtension\",$this->iInitialMemory,$this->iCurrentMemory,$this->iPeakMemory"; + } - private function RemoveQuotes(string $sEntry): string - { - return str_replace('"', "'", $sEntry); - } + private function RemoveQuotes(string $sEntry): string + { + return str_replace('"', "'", $sEntry); + } - /** - * @param \Combodo\iTop\Core\Kpi\KpiLogData $oOther - * - * @return float - */ - public function Compare(KpiLogData $oOther): float - { - if ($oOther->fStartTime > $this->fStartTime) { - return -1; - } - return 1; - } + /** + * @param \Combodo\iTop\Core\Kpi\KpiLogData $oOther + * + * @return float + */ + public function Compare(KpiLogData $oOther): float + { + if ($oOther->fStartTime > $this->fStartTime) { + return -1; + } + return 1; + } - public function Contains(KpiLogData $oOther): bool - { - if ($oOther->fStartTime < $this->fStartTime) { - return false; - } + public function Contains(KpiLogData $oOther): bool + { + if ($oOther->fStartTime < $this->fStartTime) { + return false; + } - if ($oOther->fStartTime > $this->fStopTime) { - return false; - } + if ($oOther->fStartTime > $this->fStopTime) { + return false; + } - return true; - } + return true; + } - public function __toString() - { - return "$this->sType:$this->sOperation:$this->sArguments"; - } + public function __toString() + { + return "$this->sType:$this->sOperation:$this->sArguments"; + } - public function GetUUID(): string - { - return sha1($this->__toString()); - } -} \ No newline at end of file + public function GetUUID(): string + { + return sha1($this->__toString()); + } +} diff --git a/sources/Core/MetaModel/FriendlyNameType.php b/sources/Core/MetaModel/FriendlyNameType.php index af35c3d89..6eaa18f47 100644 --- a/sources/Core/MetaModel/FriendlyNameType.php +++ b/sources/Core/MetaModel/FriendlyNameType.php @@ -1,4 +1,5 @@ GetApprootPathWithSlashes() . $this->GetDependenciesRootFolderRelPath(); + return $this->GetApprootPathWithSlashes().$this->GetDependenciesRootFolderRelPath(); } /** @@ -77,16 +78,17 @@ abstract class AbstractFolderAnalyzer */ public function ListAllFilesAbsPaths(bool $bCheckQuestionableFilesOnly = true): array { - $aAllTestDirs = array(); + $aAllTestDirs = []; $sPath = realpath($this->GetDependenciesRootFolderAbsPath()); - $oDirectoryIterator = new RecursiveDirectoryIterator($sPath, FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO|FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS); + $oDirectoryIterator = new RecursiveDirectoryIterator($sPath, FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS); $iterator = new RecursiveIteratorIterator( $oDirectoryIterator, - RecursiveIteratorIterator::CHILD_FIRST); + RecursiveIteratorIterator::CHILD_FIRST + ); /** @var DirectoryIterator $file */ - foreach($iterator as $file) { + foreach ($iterator as $file) { $sDirName = $file->getFilename(); if ($bCheckQuestionableFilesOnly && !static::IsQuestionnableFile($sDirName)) { continue; @@ -110,7 +112,7 @@ abstract class AbstractFolderAnalyzer */ public function ListAllowedFilesAbsPaths(): array { - return array_map(fn ($sRelPath): string => $this->GetDependenciesRootFolderAbsPath() . $sRelPath, $this->ListAllowedFilesRelPaths()); + return array_map(fn ($sRelPath): string => $this->GetDependenciesRootFolderAbsPath().$sRelPath, $this->ListAllowedFilesRelPaths()); } /** @@ -123,7 +125,7 @@ abstract class AbstractFolderAnalyzer */ public function ListDeniedFilesAbsPaths(): array { - return array_map(fn ($sRelPath): string => $this->GetDependenciesRootFolderAbsPath() . $sRelPath, $this->ListDeniedFilesRelPaths()); + return array_map(fn ($sRelPath): string => $this->GetDependenciesRootFolderAbsPath().$sRelPath, $this->ListDeniedFilesRelPaths()); } /** @@ -135,4 +137,4 @@ abstract class AbstractFolderAnalyzer $aAllTestDir = $this->ListAllFilesAbsPaths(false); return array_intersect($aDeniedTestDir, $aAllTestDir); } -} \ No newline at end of file +} diff --git a/sources/Dependencies/Composer/iTopComposer.php b/sources/Dependencies/Composer/iTopComposer.php index d0512fbf0..3831d59e7 100644 --- a/sources/Dependencies/Composer/iTopComposer.php +++ b/sources/Dependencies/Composer/iTopComposer.php @@ -1,4 +1,5 @@ currentValue->IsEmpty()) - { + if ($this->currentValue->IsEmpty()) { $sValue = Dict::S('Portal:File:None'); - } - else - { + } else { $sFilename = $this->currentValue->GetFileName(); $iSize = utils::BytesToFriendlyFormat(utils::Strlen($this->currentValue->GetData())); $sOpenLink = $this->GetDisplayUrl(); diff --git a/sources/Form/Field/CaseLogField.php b/sources/Form/Field/CaseLogField.php index 6d81eecb0..d913e8132 100644 --- a/sources/Form/Field/CaseLogField.php +++ b/sources/Form/Field/CaseLogField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. diff --git a/sources/Form/Field/CheckboxField.php b/sources/Form/Field/CheckboxField.php index ae29513c3..7c4f94a04 100644 --- a/sources/Form/Field/CheckboxField.php +++ b/sources/Form/Field/CheckboxField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -27,5 +27,5 @@ namespace Combodo\iTop\Form\Field; class CheckboxField extends MultipleChoicesField { /** @inheritDoc */ - const DEFAULT_MULTIPLE_VALUES_ENABLED = true; + public const DEFAULT_MULTIPLE_VALUES_ENABLED = true; } diff --git a/sources/Form/Field/DateField.php b/sources/Form/Field/DateField.php index 3b704f1d9..c3a43bc22 100644 --- a/sources/Form/Field/DateField.php +++ b/sources/Form/Field/DateField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -24,5 +24,4 @@ namespace Combodo\iTop\Form\Field; */ class DateField extends StringField { - } diff --git a/sources/Form/Field/DateTimeField.php b/sources/Form/Field/DateTimeField.php index 691d383c8..65e163116 100644 --- a/sources/Form/Field/DateTimeField.php +++ b/sources/Form/Field/DateTimeField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -88,13 +88,13 @@ class DateTimeField extends StringField return $this; } - /** - * Set the DateOnly flag - * - * @param boolean $bDateOnly - * - * @return \Combodo\iTop\Form\Field\DateTimeField - */ + /** + * Set the DateOnly flag + * + * @param boolean $bDateOnly + * + * @return \Combodo\iTop\Form\Field\DateTimeField + */ public function SetDateOnly(bool $bDateOnly) { $this->bDateOnly = $bDateOnly; @@ -109,7 +109,6 @@ class DateTimeField extends StringField return $this->bDateOnly; } - /** * Allow date time picker widget popup to be positioned relative to a specific dom element. * diff --git a/sources/Form/Field/DurationField.php b/sources/Form/Field/DurationField.php index b9895b5f9..4c03e0455 100644 --- a/sources/Form/Field/DurationField.php +++ b/sources/Form/Field/DurationField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -27,7 +27,6 @@ use Str; */ class DurationField extends AbstractSimpleField { - /** * Note: This is inspired by AttributeDuration::GetAsHTML() * diff --git a/sources/Form/Field/EmailField.php b/sources/Form/Field/EmailField.php index d9a3e4091..4c8a1b1bc 100644 --- a/sources/Form/Field/EmailField.php +++ b/sources/Form/Field/EmailField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -34,17 +34,16 @@ class EmailField extends StringField * @throws \ConfigException * @throws \CoreException */ - public function GetDisplayValue() - { - $sLabel = Str::pure2html($this->currentValue); - if (utils::StrLen($sLabel) > 128) - { - // Truncate the length to 128 characters, by removing the middle - $sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20); - } + public function GetDisplayValue() + { + $sLabel = Str::pure2html($this->currentValue); + if (utils::StrLen($sLabel) > 128) { + // Truncate the length to 128 characters, by removing the middle + $sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20); + } - $sUrlDecorationClass = utils::GetConfig()->Get('email_decoration_class'); + $sUrlDecorationClass = utils::GetConfig()->Get('email_decoration_class'); - return "currentValue\">$sLabel"; - } + return "currentValue\">$sLabel"; + } } diff --git a/sources/Form/Field/Field.php b/sources/Form/Field/Field.php index 50bc30322..30561503d 100644 --- a/sources/Form/Field/Field.php +++ b/sources/Form/Field/Field.php @@ -19,29 +19,29 @@ use Combodo\iTop\Form\Validator\MandatoryValidator; */ abstract class Field { - /** @var string */ - const ENUM_DISPLAY_MODE_COSY = 'cosy'; // Label above value - /** @var string */ - const ENUM_DISPLAY_MODE_COMPACT = 'compact'; // Label and value side by side - /** @var string */ - const ENUM_DISPLAY_MODE_DENSE = 'dense'; // Label and value side by side, closely + /** @var string */ + public const ENUM_DISPLAY_MODE_COSY = 'cosy'; // Label above value + /** @var string */ + public const ENUM_DISPLAY_MODE_COMPACT = 'compact'; // Label and value side by side + /** @var string */ + public const ENUM_DISPLAY_MODE_DENSE = 'dense'; // Label and value side by side, closely /** @var string */ - const DEFAULT_LABEL = ''; + public const DEFAULT_LABEL = ''; /** @var string */ - const DEFAULT_DESCRIPTION = ''; + public const DEFAULT_DESCRIPTION = ''; /** @var array */ - const DEFAULT_METADATA = array(); + public const DEFAULT_METADATA = []; /** @var bool */ - const DEFAULT_HIDDEN = false; + public const DEFAULT_HIDDEN = false; /** @var bool */ - const DEFAULT_READ_ONLY = false; + public const DEFAULT_READ_ONLY = false; /** @var bool */ - const DEFAULT_MANDATORY = false; - /** @var string */ - const DEFAULT_DISPLAY_MODE = self::ENUM_DISPLAY_MODE_COSY; + public const DEFAULT_MANDATORY = false; + /** @var string */ + public const DEFAULT_DISPLAY_MODE = self::ENUM_DISPLAY_MODE_COSY; /** @var bool */ - const DEFAULT_VALID = true; + public const DEFAULT_VALID = true; /** @var string */ protected $sId; @@ -93,7 +93,7 @@ abstract class Field { $this->sId = $sId; // No space in such an id, that could be used as a DOM node id - $this->sGlobalId = 'field_' . str_replace(' ', '_', $sId) . '_' . uniqid(); + $this->sGlobalId = 'field_'.str_replace(' ', '_', $sId).'_'.uniqid(); $this->sLabel = static::DEFAULT_LABEL; $this->sDescription = static::DEFAULT_DESCRIPTION; $this->aMetadata = static::DEFAULT_METADATA; @@ -101,10 +101,10 @@ abstract class Field $this->bReadOnly = static::DEFAULT_READ_ONLY; $this->bMandatory = static::DEFAULT_MANDATORY; $this->sDisplayMode = static::DEFAULT_DISPLAY_MODE; - $this->aValidators = array(); + $this->aValidators = []; $this->bValidationDisabled = false; $this->bValid = static::DEFAULT_VALID; - $this->aErrorMessages = array(); + $this->aErrorMessages = []; $this->onFinalizeCallback = $onFinalizeCallback; } @@ -219,14 +219,14 @@ abstract class Field return $this->bMandatory; } - /** - * - * @return string - */ + /** + * + * @return string + */ public function GetDisplayMode() - { - return $this->sDisplayMode; - } + { + return $this->sDisplayMode; + } public function GetValidators() { @@ -269,7 +269,7 @@ abstract class Field { return $this->currentValue; } - + /** * Sets the field formpath * Usually Called by the form when adding the field @@ -361,20 +361,20 @@ abstract class Field if (false === $bMandatory) { foreach ($this->aValidators as $iKey => $oValue) { if ($oValue instanceof MandatoryValidator) { - unset($this->aValidators[$iKey]); - } - } - } + unset($this->aValidators[$iKey]); + } + } + } $this->bMandatory = $bMandatory; return $this; } - /** - * @return AbstractValidator - * @since 3.1.0 N°6414 - */ + /** + * @return AbstractValidator + * @since 3.1.0 N°6414 + */ protected function GetMandatoryValidatorInstance(): AbstractValidator { return new MandatoryValidator(); @@ -395,16 +395,16 @@ abstract class Field return $this; } - /** - * - * @param string $sDisplayMode - * @return $this - */ + /** + * + * @param string $sDisplayMode + * @return $this + */ public function SetDisplayMode(string $sDisplayMode) - { - $this->sDisplayMode = $sDisplayMode; - return $this; - } + { + $this->sDisplayMode = $sDisplayMode; + return $this; + } /** * @@ -480,10 +480,10 @@ abstract class Field return $this; } - /** - * @param AbstractValidator $oValidator - * @return $this - */ + /** + * @param AbstractValidator $oValidator + * @return $this + */ public function AddValidator(AbstractValidator $oValidator) { $this->aValidators[] = $oValidator; @@ -506,20 +506,20 @@ abstract class Field } /** - * @param string $sValidatorClassName validator class name, should be one of {@see AbstractValidator} children - * @return $this - * @since 3.1.0 N°6414 - */ - final public function RemoveValidatorsOfClass(string $sValidatorClassName) - { - foreach ($this->aValidators as $iKey => $oValue) { - if ($oValue instanceof $sValidatorClassName) { - unset($this->aValidators[$iKey]); - } - } + * @param string $sValidatorClassName validator class name, should be one of {@see AbstractValidator} children + * @return $this + * @since 3.1.0 N°6414 + */ + final public function RemoveValidatorsOfClass(string $sValidatorClassName) + { + foreach ($this->aValidators as $iKey => $oValue) { + if ($oValue instanceof $sValidatorClassName) { + unset($this->aValidators[$iKey]); + } + } - return $this; - } + return $this; + } /** * Note : Function is protected as aErrorMessages should not be add from outside @@ -542,7 +542,7 @@ abstract class Field */ protected function EmptyErrorMessages() { - $this->aErrorMessages = array(); + $this->aErrorMessages = []; return $this; } diff --git a/sources/Form/Field/FileUploadField.php b/sources/Form/Field/FileUploadField.php index ab08c4ea3..0f0e49540 100644 --- a/sources/Form/Field/FileUploadField.php +++ b/sources/Form/Field/FileUploadField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -29,12 +29,12 @@ use Closure; class FileUploadField extends AbstractSimpleField { /** @var bool DEFAULT_ALLOW_DELETE */ - const DEFAULT_ALLOW_DELETE = true; + public const DEFAULT_ALLOW_DELETE = true; /** * @var bool DEFAULT_DISPLAY_OPENED * @since 3.2.1 N°7534 */ - const DEFAULT_DISPLAY_OPENED = false; + public const DEFAULT_DISPLAY_OPENED = false; /** @var string|null $sTransactionId */ protected $sTransactionId; @@ -187,7 +187,7 @@ class FileUploadField extends AbstractSimpleField */ public function SetAllowDelete(bool $bAllowDelete) { - $this->bAllowDelete = (boolean) $bAllowDelete; + $this->bAllowDelete = (bool) $bAllowDelete; return $this; } @@ -199,7 +199,7 @@ class FileUploadField extends AbstractSimpleField * @return FileUploadField * @since 3.2.1 N°7534 */ - public function SetDisplayOpened(bool $bDisplayOpened) : FileUploadField + public function SetDisplayOpened(bool $bDisplayOpened): FileUploadField { $this->bDisplayOpened = $bDisplayOpened; @@ -212,7 +212,7 @@ class FileUploadField extends AbstractSimpleField * @return boolean * @since 3.2.1 N°7534 */ - public function GetDisplayOpened() : bool + public function GetDisplayOpened(): bool { return $this->bDisplayOpened; } diff --git a/sources/Form/Field/HiddenField.php b/sources/Form/Field/HiddenField.php index 43040f5f4..92f3e61f2 100644 --- a/sources/Form/Field/HiddenField.php +++ b/sources/Form/Field/HiddenField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -27,5 +27,5 @@ namespace Combodo\iTop\Form\Field; class HiddenField extends TextField { /** @inheritDoc */ - const DEFAULT_HIDDEN = true; + public const DEFAULT_HIDDEN = true; } diff --git a/sources/Form/Field/ImageField.php b/sources/Form/Field/ImageField.php index 055aa9044..1d3019e2a 100644 --- a/sources/Form/Field/ImageField.php +++ b/sources/Form/Field/ImageField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -34,12 +34,9 @@ class ImageField extends BlobField */ public function GetDisplayValue() { - if ($this->currentValue->IsEmpty()) - { + if ($this->currentValue->IsEmpty()) { $sValue = Dict::S('Portal:File:None'); - } - else - { + } else { $sFilename = $this->currentValue->GetFileName(); $iSize = utils::BytesToFriendlyFormat(utils::StrLen($this->currentValue->GetData())); $sOpenLink = $this->GetDisplayUrl(); diff --git a/sources/Form/Field/LabelField.php b/sources/Form/Field/LabelField.php index dcb9d3f30..dc7d12405 100644 --- a/sources/Form/Field/LabelField.php +++ b/sources/Form/Field/LabelField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -26,5 +26,4 @@ namespace Combodo\iTop\Form\Field; */ class LabelField extends TextField { - } diff --git a/sources/Form/Field/LinkedSetField.php b/sources/Form/Field/LinkedSetField.php index 360cb98a7..0a766f00c 100644 --- a/sources/Form/Field/LinkedSetField.php +++ b/sources/Form/Field/LinkedSetField.php @@ -32,11 +32,11 @@ use Combodo\iTop\Form\Validator\LinkedSetValidator; class LinkedSetField extends AbstractSimpleField { /** @var bool DEFAULT_INDIRECT */ - const DEFAULT_INDIRECT = false; + public const DEFAULT_INDIRECT = false; /** @var bool DEFAULT_DISPLAY_OPENED */ - const DEFAULT_DISPLAY_OPENED = false; + public const DEFAULT_DISPLAY_OPENED = false; /** @var bool DEFAULT_DISPLAY_LIMITED_ACCESS_ITEMS */ - const DEFAULT_DISPLAY_LIMITED_ACCESS_ITEMS = false; + public const DEFAULT_DISPLAY_LIMITED_ACCESS_ITEMS = false; /** @var string $sTargetClass */ protected $sTargetClass; @@ -71,9 +71,9 @@ class LinkedSetField extends AbstractSimpleField $this->bIndirect = static::DEFAULT_INDIRECT; $this->bDisplayOpened = static::DEFAULT_DISPLAY_OPENED; $this->bDisplayLimitedAccessItems = static::DEFAULT_DISPLAY_LIMITED_ACCESS_ITEMS; - $this->aLimitedAccessItemIDs = array(); - $this->aAttributesToDisplay = array(); - $this->aLnkAttributesToDisplay = array(); + $this->aLimitedAccessItemIDs = []; + $this->aAttributesToDisplay = []; + $this->aLnkAttributesToDisplay = []; $this->sSearchEndpoint = null; $this->sInformationEndpoint = null; @@ -218,7 +218,7 @@ class LinkedSetField extends AbstractSimpleField return $this; } - + /** * Returns IDs of the linked items with a limited access (not visible or not editable) * @@ -280,25 +280,25 @@ class LinkedSetField extends AbstractSimpleField public function GetLnkAttributesToDisplay(bool $bAttCodesOnly = false) { return ($bAttCodesOnly) ? array_keys($this->aLnkAttributesToDisplay) : $this->aLnkAttributesToDisplay; - } + } - /** - * @param array $aAttributesToDisplay - * @return $this - * @since 3.1.0 N°803 - */ - public function SetLnkAttributesToDisplay(array $aAttributesToDisplay) - { - $this->aLnkAttributesToDisplay = $aAttributesToDisplay; + /** + * @param array $aAttributesToDisplay + * @return $this + * @since 3.1.0 N°803 + */ + public function SetLnkAttributesToDisplay(array $aAttributesToDisplay) + { + $this->aLnkAttributesToDisplay = $aAttributesToDisplay; - $this->RemoveValidatorsOfClass(LinkedSetValidator::class); - $this->AddValidator(new LinkedSetValidator($aAttributesToDisplay)); + $this->RemoveValidatorsOfClass(LinkedSetValidator::class); + $this->AddValidator(new LinkedSetValidator($aAttributesToDisplay)); - return $this; - } + return $this; + } - /** - * @return string|null + /** + * @return string|null */ public function GetSearchEndpoint() { diff --git a/sources/Form/Field/MultipleChoicesField.php b/sources/Form/Field/MultipleChoicesField.php index a388960fb..2b7947dae 100644 --- a/sources/Form/Field/MultipleChoicesField.php +++ b/sources/Form/Field/MultipleChoicesField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -34,7 +34,7 @@ use Combodo\iTop\Form\Validator\MultipleChoicesValidator; abstract class MultipleChoicesField extends AbstractSimpleField { /** @var bool DEFAULT_MULTIPLE_VALUES_ENABLED */ - const DEFAULT_MULTIPLE_VALUES_ENABLED = false; + public const DEFAULT_MULTIPLE_VALUES_ENABLED = false; /** @var bool $bMultipleValuesEnabled */ protected $bMultipleValuesEnabled; @@ -48,8 +48,8 @@ abstract class MultipleChoicesField extends AbstractSimpleField { parent::__construct($sId, $onFinalizeCallback); $this->bMultipleValuesEnabled = static::DEFAULT_MULTIPLE_VALUES_ENABLED; - $this->aChoices = array(); - $this->currentValue = array(); + $this->aChoices = []; + $this->currentValue = []; $this->InitValidators(); } @@ -60,14 +60,10 @@ abstract class MultipleChoicesField extends AbstractSimpleField public function GetCurrentValue() { $value = null; - if (!empty($this->currentValue)) - { - if ($this->bMultipleValuesEnabled) - { + if (!empty($this->currentValue)) { + if ($this->bMultipleValuesEnabled) { $value = $this->currentValue; - } - else - { + } else { reset($this->currentValue); $value = current($this->currentValue); } @@ -84,17 +80,12 @@ abstract class MultipleChoicesField extends AbstractSimpleField */ public function SetCurrentValue($currentValue) { - if (is_array($currentValue)) - { + if (is_array($currentValue)) { $this->currentValue = $currentValue; - } - elseif (is_null($currentValue)) - { - $this->currentValue = array(); - } - else - { - $this->currentValue = array($currentValue); + } elseif (is_null($currentValue)) { + $this->currentValue = []; + } else { + $this->currentValue = [$currentValue]; } return $this; } @@ -147,8 +138,7 @@ abstract class MultipleChoicesField extends AbstractSimpleField */ public function RemoveValue($value) { - if (array_key_exists($value, $this->currentValue)) - { + if (array_key_exists($value, $this->currentValue)) { unset($this->currentValue[$value]); } return $this; @@ -199,49 +189,49 @@ abstract class MultipleChoicesField extends AbstractSimpleField } $this->aChoices[$sId] = $choice; - $this->InitValidators(); + $this->InitValidators(); - return $this; - } + return $this; + } - /** - * @param string $sId - * - * @return $this - */ - public function RemoveChoice(string $sId) - { - if (in_array($sId, $this->aChoices)) { - unset($this->aChoices[$sId]); - } + /** + * @param string $sId + * + * @return $this + */ + public function RemoveChoice(string $sId) + { + if (in_array($sId, $this->aChoices)) { + unset($this->aChoices[$sId]); + } - return $this; - } + return $this; + } - /** - * @param bool $bReadOnly - * @return MultipleChoicesField - * @since 3.1.0 N°6414 - */ - public function SetReadOnly(bool $bReadOnly) - { - if ($bReadOnly) { - /** @noinspection PhpRedundantOptionalArgumentInspection */ - $this->SetValidationDisabled(true); - } else { - $this->SetValidationDisabled(false); - } + /** + * @param bool $bReadOnly + * @return MultipleChoicesField + * @since 3.1.0 N°6414 + */ + public function SetReadOnly(bool $bReadOnly) + { + if ($bReadOnly) { + /** @noinspection PhpRedundantOptionalArgumentInspection */ + $this->SetValidationDisabled(true); + } else { + $this->SetValidationDisabled(false); + } - return parent::SetReadOnly($bReadOnly); - } + return parent::SetReadOnly($bReadOnly); + } - /** - * @return void - * @since 3.1.0 N°6414 - */ - protected function InitValidators(): void - { - $this->RemoveValidatorsOfClass(MultipleChoicesValidator::class); - $this->AddValidator(new MultipleChoicesValidator($this->aChoices)); - } + /** + * @return void + * @since 3.1.0 N°6414 + */ + protected function InitValidators(): void + { + $this->RemoveValidatorsOfClass(MultipleChoicesValidator::class); + $this->AddValidator(new MultipleChoicesValidator($this->aChoices)); + } } diff --git a/sources/Form/Field/MultipleSelectField.php b/sources/Form/Field/MultipleSelectField.php index a6ba708eb..da55f4c2c 100644 --- a/sources/Form/Field/MultipleSelectField.php +++ b/sources/Form/Field/MultipleSelectField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -27,5 +27,5 @@ namespace Combodo\iTop\Form\Field; class MultipleSelectField extends SelectField { /** @inheritDoc */ - const DEFAULT_MULTIPLE_VALUES_ENABLED = true; + public const DEFAULT_MULTIPLE_VALUES_ENABLED = true; } diff --git a/sources/Form/Field/PasswordField.php b/sources/Form/Field/PasswordField.php index 10b814c11..361a288fb 100644 --- a/sources/Form/Field/PasswordField.php +++ b/sources/Form/Field/PasswordField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -26,5 +26,4 @@ namespace Combodo\iTop\Form\Field; */ class PasswordField extends TextField { - } diff --git a/sources/Form/Field/PhoneField.php b/sources/Form/Field/PhoneField.php index 2fb98334e..6fc4e3415 100644 --- a/sources/Form/Field/PhoneField.php +++ b/sources/Form/Field/PhoneField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -34,17 +34,16 @@ class PhoneField extends StringField * @throws \ConfigException * @throws \CoreException */ - public function GetDisplayValue() - { - $sLabel = Str::pure2html($this->currentValue); - if (utils::StrLen($sLabel) > 128) - { - // Truncate the length to 128 characters, by removing the middle - $sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20); - } + public function GetDisplayValue() + { + $sLabel = Str::pure2html($this->currentValue); + if (utils::StrLen($sLabel) > 128) { + // Truncate the length to 128 characters, by removing the middle + $sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20); + } - $sUrlDecorationClass = utils::GetConfig()->Get('phone_number_decoration_class'); + $sUrlDecorationClass = utils::GetConfig()->Get('phone_number_decoration_class'); - return "currentValue\">$sLabel"; - } + return "currentValue\">$sLabel"; + } } diff --git a/sources/Form/Field/RadioField.php b/sources/Form/Field/RadioField.php index 3d310ba18..b607a2dd5 100644 --- a/sources/Form/Field/RadioField.php +++ b/sources/Form/Field/RadioField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -27,6 +27,6 @@ namespace Combodo\iTop\Form\Field; class RadioField extends MultipleChoicesField { /** @inheritDoc */ - const DEFAULT_MULTIPLE_VALUES_ENABLED = false; + public const DEFAULT_MULTIPLE_VALUES_ENABLED = false; } diff --git a/sources/Form/Field/SelectField.php b/sources/Form/Field/SelectField.php index 779d788f4..8e91193c9 100644 --- a/sources/Form/Field/SelectField.php +++ b/sources/Form/Field/SelectField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -32,12 +32,12 @@ class SelectField extends MultipleChoicesField { // Overloaded constants /** @inheritDoc */ - const DEFAULT_MULTIPLE_VALUES_ENABLED = false; + public const DEFAULT_MULTIPLE_VALUES_ENABLED = false; /** @var string DEFAULT_NULL_CHOICE_LABEL */ - const DEFAULT_NULL_CHOICE_LABEL = 'UI:SelectOne'; + public const DEFAULT_NULL_CHOICE_LABEL = 'UI:SelectOne'; /** @var bool DEFAULT_STARTS_WITH_NULL_CHOICE */ - const DEFAULT_STARTS_WITH_NULL_CHOICE = true; + public const DEFAULT_STARTS_WITH_NULL_CHOICE = true; /** @var bool $bStartsWithNullChoice */ protected $bStartsWithNullChoice; @@ -62,11 +62,11 @@ class SelectField extends MultipleChoicesField return $this->bStartsWithNullChoice; } - /** - * @param bool $bStartsWithNullChoice - * - * @return $this - */ + /** + * @param bool $bStartsWithNullChoice + * + * @return $this + */ public function SetStartsWithNullChoice(bool $bStartsWithNullChoice) { $this->bStartsWithNullChoice = $bStartsWithNullChoice; @@ -82,9 +82,8 @@ class SelectField extends MultipleChoicesField public function GetChoices() { $aChoices = parent::GetChoices(); - if ($this->bStartsWithNullChoice && !array_key_exists(null, $aChoices)) - { - $aChoices = array(null => Dict::S(static::DEFAULT_NULL_CHOICE_LABEL)) + $aChoices; + if ($this->bStartsWithNullChoice && !array_key_exists(null, $aChoices)) { + $aChoices = [null => Dict::S(static::DEFAULT_NULL_CHOICE_LABEL)] + $aChoices; } return $aChoices; diff --git a/sources/Form/Field/SelectObjectField.php b/sources/Form/Field/SelectObjectField.php index 271abcb85..8f1743327 100644 --- a/sources/Form/Field/SelectObjectField.php +++ b/sources/Form/Field/SelectObjectField.php @@ -38,9 +38,9 @@ use MetaModel; class SelectObjectField extends AbstractSimpleField { /** @var int CONTROL_SELECT */ - const CONTROL_SELECT = 1; + public const CONTROL_SELECT = 1; /** @var int CONTROL_RADIO_VERTICAL */ - const CONTROL_RADIO_VERTICAL = 2; + public const CONTROL_RADIO_VERTICAL = 2; /** @var \DBSearch $oSearch */ protected $oSearch; @@ -176,7 +176,8 @@ class SelectObjectField extends AbstractSimpleField /** * @return \DBSearch */ - public function GetSearch() { + public function GetSearch() + { return $this->oSearch; } @@ -217,14 +218,16 @@ class SelectObjectField extends AbstractSimpleField /** * @return int */ - public function GetControlType() { + public function GetControlType() + { return $this->iControlType; } /** * @return string|null */ - public function GetSearchEndpoint() { + public function GetSearchEndpoint() + { return $this->sSearchEndpoint; } @@ -241,7 +244,8 @@ class SelectObjectField extends AbstractSimpleField * * @deprecated 3.1.0 N°6414 use ResetCurrentValueIfNotAmongAllowedValues instead */ - public function VerifyCurrentValue(bool $bAlways = false) { + public function VerifyCurrentValue(bool $bAlways = false) + { DeprecatedCallsLog::NotifyDeprecatedPhpMethod('3.1.0 N°6414 use ResetCurrentValueIfNotAmongAllowedValues instead'); $this->ResetCurrentValueIfNotAmongAllowedValues($bAlways); } @@ -259,7 +263,8 @@ class SelectObjectField extends AbstractSimpleField * * @since 3.1.0 N°6414 replaces VerifyCurrentValue$ */ - public function ResetCurrentValueIfNotAmongAllowedValues(bool $bAlways = false) { + public function ResetCurrentValueIfNotAmongAllowedValues(bool $bAlways = false) + { if (!$this->GetReadOnly() || $bAlways) { $oValuesSet = FieldHelper::GetObjectsSetFromSearchAndCurrentValueId($this->oSearch, $this->currentValue); diff --git a/sources/Form/Field/SetField.php b/sources/Form/Field/SetField.php index 224cfd53e..63079b1af 100644 --- a/sources/Form/Field/SetField.php +++ b/sources/Form/Field/SetField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -26,5 +26,4 @@ namespace Combodo\iTop\Form\Field; */ class SetField extends AbstractSimpleField { - } diff --git a/sources/Form/Field/StringField.php b/sources/Form/Field/StringField.php index 615ce8a3f..801ec06ae 100644 --- a/sources/Form/Field/StringField.php +++ b/sources/Form/Field/StringField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -21,5 +21,4 @@ namespace Combodo\iTop\Form\Field; class StringField extends TextField { - } diff --git a/sources/Form/Field/SubFormField.php b/sources/Form/Field/SubFormField.php index aded979e8..0f9c4706f 100644 --- a/sources/Form/Field/SubFormField.php +++ b/sources/Form/Field/SubFormField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -29,14 +29,14 @@ use Combodo\iTop\Form\Form; */ class SubFormField extends Field { - protected $oForm; + protected $oForm; - /** - * @inheritDoc - */ + /** + * @inheritDoc + */ public function __construct(string $sId, Closure $onFinalizeCallback = null) { - $this->oForm = new Form('subform_' . $sId); + $this->oForm = new Form('subform_'.$sId); parent::__construct($sId, $onFinalizeCallback); } @@ -52,7 +52,7 @@ class SubFormField extends Field /** * * @param \Combodo\iTop\Form\Form $oForm - * + * * @return \Combodo\iTop\Form\Field\SubFormField */ public function SetForm(Form $oForm) @@ -61,12 +61,12 @@ class SubFormField extends Field return $this; } - /** - * Checks the validators to see if the field's current value is valid. - * Then sets $bValid and $aErrorMessages. - * - * @inheritDoc - */ + /** + * Checks the validators to see if the field's current value is valid. + * Then sets $bValid and $aErrorMessages. + * + * @inheritDoc + */ public function Validate() { return $this->oForm->Validate(); @@ -87,9 +87,8 @@ class SubFormField extends Field */ public function GetErrorMessages() { - $aRet = array(); - foreach ($this->oForm->GetErrorMessages() as $sSubFieldId => $aSubFieldMessages) - { + $aRet = []; + foreach ($this->oForm->GetErrorMessages() as $sSubFieldId => $aSubFieldMessages) { $aRet[] = $sSubFieldId.': '.implode(', ', $aSubFieldMessages); } return $aRet; @@ -104,14 +103,14 @@ class SubFormField extends Field return $this->oForm->GetCurrentValues(); } - /** - * - * @param array $value - * - * @return \Combodo\iTop\Form\Field\SubFormField - * - * @throws \Exception - */ + /** + * + * @param array $value + * + * @return \Combodo\iTop\Form\Field\SubFormField + * + * @throws \Exception + */ public function SetCurrentValue($value) { $this->oForm->SetCurrentValues($value); @@ -124,13 +123,13 @@ class SubFormField extends Field * @param boolean $bMandatory */ public function SetMandatory(bool $bMandatory) - { - foreach ($this->oForm->GetFields() as $oField) { - $oField->SetMandatory($bMandatory); - } + { + foreach ($this->oForm->GetFields() as $oField) { + $oField->SetMandatory($bMandatory); + } - return parent::SetMandatory($bMandatory); - } + return parent::SetMandatory($bMandatory); + } /** * Sets the read-only flag on all the fields on the form @@ -139,12 +138,11 @@ class SubFormField extends Field */ public function SetReadOnly(bool $bReadOnly) { - foreach ($this->oForm->GetFields() as $oField) - { + foreach ($this->oForm->GetFields() as $oField) { $oField->SetReadOnly($bReadOnly); $oField->SetMandatory(false); } - return parent::SetReadOnly($bReadOnly); + return parent::SetReadOnly($bReadOnly); } /** @@ -154,11 +152,10 @@ class SubFormField extends Field */ public function SetHidden(bool $bHidden) { - foreach ($this->oForm->GetFields() as $oField) - { + foreach ($this->oForm->GetFields() as $oField) { $oField->SetHidden($bHidden); } - return parent::SetHidden($bHidden); + return parent::SetHidden($bHidden); } /** @@ -170,15 +167,14 @@ class SubFormField extends Field return $this->oForm->FindSubForm($sFormPath); } - /** - * @throws \Exception - */ - public function OnFinalize() + /** + * @throws \Exception + */ + public function OnFinalize() { - $sFormId = 'subform_' . $this->sId; - if ($this->sFormPath !== null) - { - $sFormId = $this->sFormPath . '-' . $sFormId; + $sFormId = 'subform_'.$this->sId; + if ($this->sFormPath !== null) { + $sFormId = $this->sFormPath.'-'.$sFormId; } $this->oForm->SetId($sFormId); diff --git a/sources/Form/Field/TagSetField.php b/sources/Form/Field/TagSetField.php index 6ac47c3a4..1a3edbb21 100644 --- a/sources/Form/Field/TagSetField.php +++ b/sources/Form/Field/TagSetField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -26,5 +26,4 @@ namespace Combodo\iTop\Form\Field; */ class TagSetField extends AbstractSimpleField { - } diff --git a/sources/Form/Field/TextAreaField.php b/sources/Form/Field/TextAreaField.php index 4aadb0759..42b63d2bf 100644 --- a/sources/Form/Field/TextAreaField.php +++ b/sources/Form/Field/TextAreaField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -34,11 +34,11 @@ use AttributeText; class TextAreaField extends TextField { /** @var string */ - const ENUM_FORMAT_TEXT = 'text'; + public const ENUM_FORMAT_TEXT = 'text'; /** @var string */ - const ENUM_FORMAT_HTML = 'html'; + public const ENUM_FORMAT_HTML = 'html'; /** @var string */ - const DEFAULT_FORMAT = 'html'; + public const DEFAULT_FORMAT = 'html'; /** @var string */ protected $sFormat; @@ -121,17 +121,14 @@ class TextAreaField extends TextField $this->sTransactionId = $sTransactionId; return $this; } - + public function GetDisplayValue() { - if ($this->GetFormat() == TextAreaField::ENUM_FORMAT_TEXT) - { - $sValue = \Str::pure2html($this->GetCurrentValue()); + if ($this->GetFormat() == TextAreaField::ENUM_FORMAT_TEXT) { + $sValue = \Str::pure2html($this->GetCurrentValue()); $sValue = AttributeText::RenderWikiHtml($sValue); - return "
      ".str_replace("\n", "
      \n", $sValue).'
      '; - } - else - { + return "
      ".str_replace("\n", "
      \n", $sValue).'
      '; + } else { $sValue = AttributeText::RenderWikiHtml($this->GetCurrentValue(), true /* wiki only */); return "
      ".InlineImage::FixUrls($sValue).'
      '; } diff --git a/sources/Form/Field/TextField.php b/sources/Form/Field/TextField.php index 6314e8564..e687a99cd 100644 --- a/sources/Form/Field/TextField.php +++ b/sources/Form/Field/TextField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -26,5 +26,4 @@ namespace Combodo\iTop\Form\Field; */ abstract class TextField extends AbstractSimpleField { - } diff --git a/sources/Form/Field/UrlField.php b/sources/Form/Field/UrlField.php index 1d83cb1ae..8c8605dac 100644 --- a/sources/Form/Field/UrlField.php +++ b/sources/Form/Field/UrlField.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -30,41 +30,40 @@ use utils; */ class UrlField extends StringField { - /** @var string */ - const DEFAULT_TARGET = '_blank'; + /** @var string */ + public const DEFAULT_TARGET = '_blank'; - /** @var string */ + /** @var string */ protected $sTarget; - /** - * @inheritDoc - */ - public function __construct(string $sId, Closure $onFinalizeCallback = null) - { - parent::__construct($sId, $onFinalizeCallback); - - $this->sTarget = static::DEFAULT_TARGET; - } - - public function SetTarget($sTarget) - { - $this->sTarget = $sTarget; - - return $this; - } - /** * @inheritDoc */ - public function GetDisplayValue() - { - $sLabel = Str::pure2html($this->currentValue); - if (utils::StrLen($sLabel) > 128) - { - // Truncate the length to 128 characters, by removing the middle - $sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20); - } + public function __construct(string $sId, Closure $onFinalizeCallback = null) + { + parent::__construct($sId, $onFinalizeCallback); - return "sTarget\" href=\"$this->currentValue\">$sLabel"; - } + $this->sTarget = static::DEFAULT_TARGET; + } + + public function SetTarget($sTarget) + { + $this->sTarget = $sTarget; + + return $this; + } + + /** + * @inheritDoc + */ + public function GetDisplayValue() + { + $sLabel = Str::pure2html($this->currentValue); + if (utils::StrLen($sLabel) > 128) { + // Truncate the length to 128 characters, by removing the middle + $sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20); + } + + return "sTarget\" href=\"$this->currentValue\">$sLabel"; + } } diff --git a/sources/Form/Form.php b/sources/Form/Form.php index f55d6bb8c..0bbdb4b56 100644 --- a/sources/Form/Form.php +++ b/sources/Form/Form.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -50,10 +50,10 @@ class Form { $this->sId = $sId; $this->sTransactionId = null; - $this->aFields = array(); - $this->aDependencies = array(); + $this->aFields = []; + $this->aDependencies = []; $this->bValid = true; - $this->aErrorMessages = array(); + $this->aErrorMessages = []; $this->iEditableFieldCount = null; } @@ -76,8 +76,7 @@ class Form // Setting id for the form itself $this->sId = $sId; // Then setting formpath to its fields - foreach ($this->aFields as $oField) - { + foreach ($this->aFields as $oField) { $oField->SetFormPath($sId); } @@ -129,26 +128,24 @@ class Form */ public function GetCurrentValues() { - $aValues = array(); - foreach ($this->aFields as $sId => $oField) - { + $aValues = []; + foreach ($this->aFields as $sId => $oField) { $aValues[$sId] = $oField->GetCurrentValue(); } return $aValues; } - /** - * - * @param array $aValues Must be a hash array of "Field id" => "Field value" - * - * @return \Combodo\iTop\Form\Form - * - * @throws \Exception - */ + /** + * + * @param array $aValues Must be a hash array of "Field id" => "Field value" + * + * @return \Combodo\iTop\Form\Form + * + * @throws \Exception + */ public function SetCurrentValues($aValues) { - foreach ($aValues as $sId => $value) - { + foreach ($aValues as $sId => $value) { $oField = $this->GetField($sId); $oField->SetCurrentValue($value); } @@ -197,12 +194,9 @@ class Form */ protected function SetErrorMessages($aErrorMessages, $sFieldId = null) { - if ($sFieldId === null) - { + if ($sFieldId === null) { $this->aErrorMessages = $aErrorMessages; - } - else - { + } else { $this->aErrorMessages[$sFieldId] = $aErrorMessages; } return $this; @@ -219,9 +213,8 @@ class Form */ protected function AddErrorMessage($sErrorMessage, $sFieldId = '_main') { - if (!isset($this->aErrorMessages[$sFieldId])) - { - $this->aErrorMessages[$sFieldId] = array(); + if (!isset($this->aErrorMessages[$sFieldId])) { + $this->aErrorMessages[$sFieldId] = []; } $this->aErrorMessages[$sFieldId][] = $sErrorMessage; return $this; @@ -234,7 +227,7 @@ class Form */ protected function EmptyErrorMessages() { - $this->aErrorMessages = array(); + $this->aErrorMessages = []; return $this; } @@ -246,9 +239,8 @@ class Form */ public function GetField($sId) { - if (!array_key_exists($sId, $this->aFields)) - { - throw new Exception('Field with ID "' . $sId . '" was not found in the Form of ID "' . $this->sId . '".'); + if (!array_key_exists($sId, $this->aFields)) { + throw new Exception('Field with ID "'.$sId.'" was not found in the Form of ID "'.$this->sId.'".'); } return $this->aFields[$sId]; } @@ -269,7 +261,7 @@ class Form * @param array $aDependsOnIds * @return \Combodo\iTop\Form\Form */ - public function AddField(Field $oField, $aDependsOnIds = array()) + public function AddField(Field $oField, $aDependsOnIds = []) { $oField->SetFormPath($this->sId); $this->aFields[$oField->GetId()] = $oField; @@ -283,8 +275,7 @@ class Form */ public function RemoveField($sId) { - if (array_key_exists($sId, $this->aFields)) - { + if (array_key_exists($sId, $this->aFields)) { unset($this->aFields[$sId]); } return $this; @@ -310,9 +301,8 @@ class Form */ public function GetFieldDependencies($sFieldId) { - if (!array_key_exists($sFieldId, $this->aDependencies)) - { - throw new Exception('Field with ID "' . $sFieldId . '" had no dependancies declared in the Form.'); + if (!array_key_exists($sFieldId, $this->aDependencies)) { + throw new Exception('Field with ID "'.$sFieldId.'" had no dependancies declared in the Form.'); } return $this->aDependencies[$sFieldId]; } @@ -325,8 +315,7 @@ class Form */ public function AddFieldDependencies($sFieldId, array $aDependsOnIds) { - foreach ($aDependsOnIds as $sDependsOnId) - { + foreach ($aDependsOnIds as $sDependsOnId) { $this->AddFieldDependency($sFieldId, $sDependsOnId); } return $this; @@ -338,63 +327,56 @@ class Form * @param string $sDependsOnId * @return \Combodo\iTop\Form\Form */ - public function AddFieldDependency($sFieldId, $sDependsOnId) - { - if (!array_key_exists($sFieldId, $this->aDependencies)) - { - $this->aDependencies[$sFieldId] = array(); - } - $this->aDependencies[$sFieldId][] = $sDependsOnId; - return $this; - } + public function AddFieldDependency($sFieldId, $sDependsOnId) + { + if (!array_key_exists($sFieldId, $this->aDependencies)) { + $this->aDependencies[$sFieldId] = []; + } + $this->aDependencies[$sFieldId][] = $sDependsOnId; + return $this; + } - /** - * Returns a hash array of the fields impacts on other fields. Key being the field that impacts the fields stored in the value as a regular array - * (It kind of reversed the dependencies array) - * - * eg : - * - 'service' => array('subservice', 'template') - * - 'subservice' => array() - * - ... - * - * @return array - */ - public function GetFieldsImpacts() - { - $aRes = array(); + /** + * Returns a hash array of the fields impacts on other fields. Key being the field that impacts the fields stored in the value as a regular array + * (It kind of reversed the dependencies array) + * + * eg : + * - 'service' => array('subservice', 'template') + * - 'subservice' => array() + * - ... + * + * @return array + */ + public function GetFieldsImpacts() + { + $aRes = []; - foreach ($this->aDependencies as $sImpactedFieldId => $aDependentFieldsIds) - { - foreach ($aDependentFieldsIds as $sDependentFieldId) - { - if (!array_key_exists($sDependentFieldId, $aRes)) - { - $aRes[$sDependentFieldId] = array(); - } - $aRes[$sDependentFieldId][] = $sImpactedFieldId; - } - } + foreach ($this->aDependencies as $sImpactedFieldId => $aDependentFieldsIds) { + foreach ($aDependentFieldsIds as $sDependentFieldId) { + if (!array_key_exists($sDependentFieldId, $aRes)) { + $aRes[$sDependentFieldId] = []; + } + $aRes[$sDependentFieldId][] = $sImpactedFieldId; + } + } - return $aRes; - } + return $aRes; + } - /** - * Returns the number of editable fields in this form. - * - * @param bool $bForce - * - * @return integer - */ + /** + * Returns the number of editable fields in this form. + * + * @param bool $bForce + * + * @return integer + */ public function GetEditableFieldCount($bForce = false) { // Count is usally done by the Finalize function but it can be done there if Finalize hasn't been called yet or if we choose to force it. - if (($this->iEditableFieldCount === null) || ($bForce === true)) - { + if (($this->iEditableFieldCount === null) || ($bForce === true)) { $this->iEditableFieldCount = 0; - foreach ($this->aFields as $oField) - { - if ($oField->IsEditable()) - { + foreach ($this->aFields as $oField) { + if ($oField->IsEditable()) { $this->iEditableFieldCount++; } } @@ -421,10 +403,8 @@ class Form public function HasVisibleFields() { $bRet = false; - foreach ($this->aFields as $oField) - { - if (!$oField->GetHidden()) - { + foreach ($this->aFields as $oField) { + if (!$oField->GetHidden()) { $bRet = true; break; } @@ -434,13 +414,12 @@ class Form /** * Forces the form to a read only state by setting read only to true on all its fields - * + * * @return \Combodo\iTop\Form\Form */ public function MakeReadOnly() { - foreach ($this->GetFields() as $oField) - { + foreach ($this->GetFields() as $oField) { $oField->SetReadOnly(true); } @@ -454,129 +433,114 @@ class Form public function FindSubForm($sFormPath) { $ret = null; - if ($sFormPath == $this->sId) - { + if ($sFormPath == $this->sId) { $ret = $this; - } - else - { - foreach ($this->aFields as $oField) - { - if ($oField instanceof SubFormField) - { + } else { + foreach ($this->aFields as $oField) { + if ($oField instanceof SubFormField) { $ret = $oField->FindSubForm($sFormPath); - if ($ret !== null) break; + if ($ret !== null) { + break; + } } } } return $ret; } - /** - * Resets CaseLog fields value in the form and its sub-forms - * - * @return Form - */ + /** + * Resets CaseLog fields value in the form and its sub-forms + * + * @return Form + */ public function ResetCaseLogFields() - { - foreach($this->GetFields() as $oField) - { - if($oField instanceof CaseLogField) - { - $oField->SetCurrentValue(null); - } - elseif($oField instanceof SubFormField) - { - $oField->GetForm()->ResetCaseLogFields(); - } - } + { + foreach ($this->GetFields() as $oField) { + if ($oField instanceof CaseLogField) { + $oField->SetCurrentValue(null); + } elseif ($oField instanceof SubFormField) { + $oField->GetForm()->ResetCaseLogFields(); + } + } - return $this; - } + return $this; + } - /** - * Finalizes each field, following the dependencies so that a field can compute its value or other properties, - * depending on other fields - * - * @throws \Exception - */ - public function Finalize() - { - $aFieldList = array(); // Fields ordered by dependence + /** + * Finalizes each field, following the dependencies so that a field can compute its value or other properties, + * depending on other fields + * + * @throws \Exception + */ + public function Finalize() + { + $aFieldList = []; // Fields ordered by dependence // Clone the dependency data : $aDependencies will be truncated as the fields are added to the list $aDependencies = $this->aDependencies; $bMadeProgress = true; // Safety net in case of circular references - foreach ($aDependencies as $sImpactedBy => $aSomeFields) - { - foreach ($aSomeFields as $i => $sSomeId) - { - if (!array_key_exists($sSomeId, $this->aFields)) - { - throw new Exception('Unmet dependency : Field ' . $sImpactedBy . ' expecting field ' . $sSomeId . ' which is not in the Form'); + foreach ($aDependencies as $sImpactedBy => $aSomeFields) { + foreach ($aSomeFields as $i => $sSomeId) { + if (!array_key_exists($sSomeId, $this->aFields)) { + throw new Exception('Unmet dependency : Field '.$sImpactedBy.' expecting field '.$sSomeId.' which is not in the Form'); } } } - while ($bMadeProgress && count($aFieldList) < count($this->aFields)) - { + while ($bMadeProgress && count($aFieldList) < count($this->aFields)) { $bMadeProgress = false; - foreach ($this->aFields as $sId => $oField) - { - if (array_key_exists($sId, $aFieldList)) + foreach ($this->aFields as $sId => $oField) { + if (array_key_exists($sId, $aFieldList)) { continue; - if (isset($aDependencies[$sId]) && count($aDependencies[$sId]) > 0) continue; + } + if (isset($aDependencies[$sId]) && count($aDependencies[$sId]) > 0) { + continue; + } // Add the field at the end of the list $aFieldList[$sId] = $oField; $bMadeProgress = true; // Track that this dependency has been solved - foreach ($aDependencies as $sImpactedBy => $aSomeFields) - { - foreach ($aSomeFields as $i => $sSomeId) - { - if ($sSomeId == $sId) - { + foreach ($aDependencies as $sImpactedBy => $aSomeFields) { + foreach ($aSomeFields as $i => $sSomeId) { + if ($sSomeId == $sId) { unset($aDependencies[$sImpactedBy][$i]); } } } } } - if (!$bMadeProgress) - { - throw new Exception('Unmet dependencies (might be a circular reference) : ' . implode(', ', array_keys($aDependencies))); + if (!$bMadeProgress) { + throw new Exception('Unmet dependencies (might be a circular reference) : '.implode(', ', array_keys($aDependencies))); } - foreach ($aFieldList as $sId => $oField) - { + foreach ($aFieldList as $sId => $oField) { $oField->OnFinalize(); - if ($oField->IsEditable()) - { + if ($oField->IsEditable()) { $this->iEditableFieldCount++; } } - } + } /** * Validate the form and return if it's valid or not - * + * * @return boolean */ - public function Validate() - { - $this->SetValid(true); - $this->EmptyErrorMessages(); + public function Validate() + { + $this->SetValid(true); + $this->EmptyErrorMessages(); - foreach ($this->aFields as $oField) { - if (!$oField->Validate()) { - $this->SetValid(false); - foreach ($oField->GetErrorMessages() as $sErrorMessage) { - $this->AddErrorMessage(Dict::S($sErrorMessage), $oField->Getid()); - } - } - } + foreach ($this->aFields as $oField) { + if (!$oField->Validate()) { + $this->SetValid(false); + foreach ($oField->GetErrorMessages() as $sErrorMessage) { + $this->AddErrorMessage(Dict::S($sErrorMessage), $oField->Getid()); + } + } + } - return $this->GetValid(); - } + return $this->GetValid(); + } } diff --git a/sources/Form/FormManager.php b/sources/Form/FormManager.php index cfac2ceb1..653ab8799 100644 --- a/sources/Form/FormManager.php +++ b/sources/Form/FormManager.php @@ -31,7 +31,7 @@ use CoreException; */ abstract class FormManager { - /** @var \Combodo\iTop\Form\Form $oForm */ + /** @var \Combodo\iTop\Form\Form $oForm */ protected $oForm; /** @var \Combodo\iTop\Renderer\FormRenderer $oRenderer */ protected $oRenderer; @@ -45,26 +45,22 @@ abstract class FormManager * * @return $this */ - static function FromJSON($sJson) + public static function FromJSON($sJson) { // Overload in child class when needed - if (is_array($sJson)) - { + if (is_array($sJson)) { $aJson = $sJson; - } - else - { + } else { $aJson = json_decode($sJson, true); } $oFormManager = new static(); $sFormRendererClass = $aJson['formrenderer_class']; - // N°7455 - Ensure form renderer class extends FormRenderer - if (false === is_a($sFormRendererClass, FormRenderer::class, true)) - { - throw new CoreException('Form renderer class must extend '.FormRenderer::class); - } + // N°7455 - Ensure form renderer class extends FormRenderer + if (false === is_a($sFormRendererClass, FormRenderer::class, true)) { + throw new CoreException('Form renderer class must extend '.FormRenderer::class); + } /** @var \Combodo\iTop\Renderer\FormRenderer $oFormRenderer */ $oFormRenderer = new $sFormRendererClass(); @@ -147,13 +143,13 @@ abstract class FormManager public function ToJSON() { // Overload in child class when needed - return array( + return [ 'id' => $this->oForm->GetId(), 'transaction_id' => $this->oForm->GetTransactionId(), 'formmanager_class' => $this->GetClass(), 'formrenderer_class' => get_class($this->GetRenderer()), - 'formrenderer_endpoint' => $this->GetRenderer()->GetEndpoint() - ); + 'formrenderer_endpoint' => $this->GetRenderer()->GetEndpoint(), + ]; } abstract public function Build(); @@ -174,14 +170,14 @@ abstract class FormManager */ public function OnSubmit($aArgs = null) { - $aData = array( + $aData = [ 'valid' => true, - 'messages' => array( - 'success' => array(), - 'warnings' => array(), // Not used as of today, just to show that the structure is ready for change like this. - 'error' => array(), - ), - ); + 'messages' => [ + 'success' => [], + 'warnings' => [], // Not used as of today, just to show that the structure is ready for change like this. + 'error' => [], + ], + ]; $this->CheckTransaction($aData); @@ -198,7 +194,7 @@ abstract class FormManager $isTransactionValid = \utils::IsTransactionValid($this->oForm->GetTransactionId(), false); //The transaction token is kept in order to preserve BC with ajax forms (the second call would fail if the token is deleted). (The GC will take care of cleaning the token for us later on) if (!$isTransactionValid) { $aData['messages']['error'] += [ - '_main' => [\Dict::S('UI:Error:InvalidToken')] //This message is generic, if you override this method you should use a more precise message. @see \Combodo\iTop\Portal\Form\ObjectFormManager::CheckTransaction + '_main' => [\Dict::S('UI:Error:InvalidToken')], //This message is generic, if you override this method you should use a more precise message. @see \Combodo\iTop\Portal\Form\ObjectFormManager::CheckTransaction ]; $aData['valid'] = false; } diff --git a/sources/Form/Helper/FieldHelper.php b/sources/Form/Helper/FieldHelper.php index e056e270c..b0dccf234 100644 --- a/sources/Form/Helper/FieldHelper.php +++ b/sources/Form/Helper/FieldHelper.php @@ -1,4 +1,5 @@ DeepClone(); $oCheckIdAgainstCurrentValueExpression = new BinaryExpression( new FieldExpression('id', $oSearchForExistingCurrentValue->GetClassAlias()), @@ -33,4 +36,4 @@ class FieldHelper { return new DBObjectSet($oSearchForExistingCurrentValue); } -} \ No newline at end of file +} diff --git a/sources/Form/Validator/AbstractRegexpValidator.php b/sources/Form/Validator/AbstractRegexpValidator.php index 20e6b2f56..a6538435a 100644 --- a/sources/Form/Validator/AbstractRegexpValidator.php +++ b/sources/Form/Validator/AbstractRegexpValidator.php @@ -1,4 +1,5 @@ sErrorMessage]; } - /** - * Returns the regular expression of the validator. - * - * @param boolean $bWithSlashes If true, surrounds $sRegExp with '/'. Used with preg_match & co - * - * @return string - */ - public function GetRegExp($bWithSlashes = false) - { - if ($bWithSlashes) { - $sRet = '/'.str_replace('/', '\\/', $this->sRegExp).'/'; - } else { - $sRet = $this->sRegExp; - } + /** + * Returns the regular expression of the validator. + * + * @param boolean $bWithSlashes If true, surrounds $sRegExp with '/'. Used with preg_match & co + * + * @return string + */ + public function GetRegExp($bWithSlashes = false) + { + if ($bWithSlashes) { + $sRet = '/'.str_replace('/', '\\/', $this->sRegExp).'/'; + } else { + $sRet = $this->sRegExp; + } - return $sRet; - } -} \ No newline at end of file + return $sRet; + } +} diff --git a/sources/Form/Validator/AbstractValidator.php b/sources/Form/Validator/AbstractValidator.php index 3cb74cd36..ef7e689ef 100644 --- a/sources/Form/Validator/AbstractValidator.php +++ b/sources/Form/Validator/AbstractValidator.php @@ -1,4 +1,5 @@ sErrorMessage = $sErrorMessage; - } - else { + } else { $this->sErrorMessage = static::DEFAULT_ERROR_MESSAGE; } } @@ -56,4 +56,4 @@ abstract class AbstractValidator { return $this->sErrorMessage; } -} \ No newline at end of file +} diff --git a/sources/Form/Validator/CustomRegexpValidator.php b/sources/Form/Validator/CustomRegexpValidator.php index 04c21015a..bfd5dcf52 100644 --- a/sources/Form/Validator/CustomRegexpValidator.php +++ b/sources/Form/Validator/CustomRegexpValidator.php @@ -1,4 +1,5 @@ sRegExp = $sRegExp; // must be done after parent constructor call ! } -} \ No newline at end of file +} diff --git a/sources/Form/Validator/IntegerValidator.php b/sources/Form/Validator/IntegerValidator.php index ec577a8c5..1c01ac3b2 100644 --- a/sources/Form/Validator/IntegerValidator.php +++ b/sources/Form/Validator/IntegerValidator.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. diff --git a/sources/Form/Validator/LinkedSetValidator.php b/sources/Form/Validator/LinkedSetValidator.php index a30349b79..61aa5a2e1 100644 --- a/sources/Form/Validator/LinkedSetValidator.php +++ b/sources/Form/Validator/LinkedSetValidator.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -30,45 +30,45 @@ use utils; */ class LinkedSetValidator extends AbstractRegexpValidator { - public const VALIDATOR_NAME = 'linkedset_validator'; - private $aAttributesToDisplayCodes; + public const VALIDATOR_NAME = 'linkedset_validator'; + private $aAttributesToDisplayCodes; - public function __construct($aAttributesToDisplayCodes) - { - $this->aAttributesToDisplayCodes = $aAttributesToDisplayCodes; + public function __construct($aAttributesToDisplayCodes) + { + $this->aAttributesToDisplayCodes = $aAttributesToDisplayCodes; - parent::__construct(); - } + parent::__construct(); + } - public function Validate($value): array - { - $aErrorMessages = []; + public function Validate($value): array + { + $aErrorMessages = []; - /** @var ormLinkSet $oSet */ - $oSet = $value; + /** @var ormLinkSet $oSet */ + $oSet = $value; - // validate each links... - /** @var \DBObject $oItem */ - foreach ($oSet as $oItem) { - $aChanges = $oItem->ListChanges(); - foreach ($aChanges as $sAttCode => $AttValue) { - if (!in_array($sAttCode, $this->aAttributesToDisplayCodes)) { - continue; - } - $res = $oItem->CheckValue($sAttCode); - if ($res !== true) { - $sAttLabel = $oItem->GetLabel($sAttCode); - $sItem = utils::IsNullOrEmptyString($oItem->Get('friendlyname')) - ? Dict::S('UI:Links:NewItem') - : $oItem->Get('friendlyname'); - $sIssue = Dict::Format('Core:CheckValueError', $sAttLabel, $sAttCode, $res); - $aErrorMessages[] = '' . $sItem . ' : ' . $sIssue; - } - } - } + // validate each links... + /** @var \DBObject $oItem */ + foreach ($oSet as $oItem) { + $aChanges = $oItem->ListChanges(); + foreach ($aChanges as $sAttCode => $AttValue) { + if (!in_array($sAttCode, $this->aAttributesToDisplayCodes)) { + continue; + } + $res = $oItem->CheckValue($sAttCode); + if ($res !== true) { + $sAttLabel = $oItem->GetLabel($sAttCode); + $sItem = utils::IsNullOrEmptyString($oItem->Get('friendlyname')) + ? Dict::S('UI:Links:NewItem') + : $oItem->Get('friendlyname'); + $sIssue = Dict::Format('Core:CheckValueError', $sAttLabel, $sAttCode, $res); + $aErrorMessages[] = ''.$sItem.' : '.$sIssue; + } + } + } - $oSet->Rewind(); + $oSet->Rewind(); - return $aErrorMessages; - } + return $aErrorMessages; + } } diff --git a/sources/Form/Validator/MandatoryValidator.php b/sources/Form/Validator/MandatoryValidator.php index a7f0e5744..6f7d14691 100644 --- a/sources/Form/Validator/MandatoryValidator.php +++ b/sources/Form/Validator/MandatoryValidator.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. diff --git a/sources/Form/Validator/MultipleChoicesValidator.php b/sources/Form/Validator/MultipleChoicesValidator.php index 769a45d30..ecdb21858 100644 --- a/sources/Form/Validator/MultipleChoicesValidator.php +++ b/sources/Form/Validator/MultipleChoicesValidator.php @@ -1,4 +1,5 @@ aChoices = $aChoices; - } + public function __construct(array $aChoices) + { + parent::__construct(); + $this->aChoices = $aChoices; + } - /** - * @param mixed $value Warning can either be an array (if multiple values are allowed in the field) or a primitive : {@see \Combodo\iTop\Form\Field\MultipleChoicesField::GetCurrentValue()} - * - * @return array|string[] - */ - public function Validate($value): array - { - $aErrorMessages = []; - if (false === is_array($value)) { - $this->CheckValueAgainstChoices($value, $aErrorMessages); + /** + * @param mixed $value Warning can either be an array (if multiple values are allowed in the field) or a primitive : {@see \Combodo\iTop\Form\Field\MultipleChoicesField::GetCurrentValue()} + * + * @return array|string[] + */ + public function Validate($value): array + { + $aErrorMessages = []; + if (false === is_array($value)) { + $this->CheckValueAgainstChoices($value, $aErrorMessages); - return $aErrorMessages; - } + return $aErrorMessages; + } - if (count($value) === 0) { - return []; - } + if (count($value) === 0) { + return []; + } - /** @noinspection PhpUnusedLocalVariableInspection */ - foreach ($value as $sCode => $valueItem) { - if (utils::IsNullOrEmptyString($valueItem)) { - continue; - } - $this->CheckValueAgainstChoices($valueItem, $aErrorMessages); - } + /** @noinspection PhpUnusedLocalVariableInspection */ + foreach ($value as $sCode => $valueItem) { + if (utils::IsNullOrEmptyString($valueItem)) { + continue; + } + $this->CheckValueAgainstChoices($valueItem, $aErrorMessages); + } - return $aErrorMessages; - } + return $aErrorMessages; + } - private function CheckValueAgainstChoices(string $sValue, array &$aErrorMessages): void - { - if (false === array_key_exists($sValue, $this->aChoices)) { - $aErrorMessages[] = "Value ({$sValue}) is not part of the field possible values list"; - } - } -} \ No newline at end of file + private function CheckValueAgainstChoices(string $sValue, array &$aErrorMessages): void + { + if (false === array_key_exists($sValue, $this->aChoices)) { + $aErrorMessages[] = "Value ({$sValue}) is not part of the field possible values list"; + } + } +} diff --git a/sources/Form/Validator/NotEmptyExtKeyValidator.php b/sources/Form/Validator/NotEmptyExtKeyValidator.php index cbd091fa1..5ed356e24 100644 --- a/sources/Form/Validator/NotEmptyExtKeyValidator.php +++ b/sources/Form/Validator/NotEmptyExtKeyValidator.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. diff --git a/sources/Form/Validator/SelectObjectValidator.php b/sources/Form/Validator/SelectObjectValidator.php index a4d0c69cd..352f099bf 100644 --- a/sources/Form/Validator/SelectObjectValidator.php +++ b/sources/Form/Validator/SelectObjectValidator.php @@ -1,4 +1,5 @@ oSearch = $oSearch; - } + $this->oSearch = $oSearch; + } - public function Validate($value): array - { - if (utils::IsNullOrEmptyString($value)) { - return []; - } - if (($value === 0) || ($value === '0')) { - return []; - } + public function Validate($value): array + { + if (utils::IsNullOrEmptyString($value)) { + return []; + } + if (($value === 0) || ($value === '0')) { + return []; + } - $oSetForExistingCurrentValue = FieldHelper::GetObjectsSetFromSearchAndCurrentValueId($this->oSearch, $value); - $iObjectsCount = $oSetForExistingCurrentValue->CountWithLimit(1); + $oSetForExistingCurrentValue = FieldHelper::GetObjectsSetFromSearchAndCurrentValueId($this->oSearch, $value); + $iObjectsCount = $oSetForExistingCurrentValue->CountWithLimit(1); - if ($iObjectsCount === 0) { - return ["Value $value does not match the corresponding filter set"]; - } + if ($iObjectsCount === 0) { + return ["Value $value does not match the corresponding filter set"]; + } - return []; - } -} \ No newline at end of file + return []; + } +} diff --git a/sources/Form/Validator/Validator.php b/sources/Form/Validator/Validator.php index 83c3a8d4f..337e8be0e 100644 --- a/sources/Form/Validator/Validator.php +++ b/sources/Form/Validator/Validator.php @@ -4,7 +4,7 @@ // // This file is part of iTop. // -// iTop is free software; you can redistribute it and/or modify +// iTop is free software; you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. @@ -21,7 +21,6 @@ namespace Combodo\iTop\Form\Validator; use DeprecatedCallsLog; - /** * Description of Validator * diff --git a/sources/Kernel.php b/sources/Kernel.php index 8d5bc5345..a4db5484a 100644 --- a/sources/Kernel.php +++ b/sources/Kernel.php @@ -1,4 +1,5 @@ getProjectDir() . '/resources/symfony/config'; + return $this->getProjectDir().'/resources/symfony/config'; } public function getCacheDir(): string { $sEnv = Session::Get('itop_env', 'production'); - return $this->getProjectDir() . "/data/cache-$sEnv/symfony"; + return $this->getProjectDir()."/data/cache-$sEnv/symfony"; } public function getLogDir(): string { - return $this->getProjectDir() . '/log/symfony'; + return $this->getProjectDir().'/log/symfony'; } } diff --git a/sources/Renderer/BlockRenderer.php b/sources/Renderer/BlockRenderer.php index 1e01eb5c6..76f7b5738 100644 --- a/sources/Renderer/BlockRenderer.php +++ b/sources/Renderer/BlockRenderer.php @@ -1,4 +1,5 @@ oBlock->GetHtmlTemplateRelPath())) - { + if (!empty($this->oBlock->GetHtmlTemplateRelPath())) { $sOutput = TwigHelper::RenderTemplate( static::$oTwigEnv, $this->GetTemplateParameters(), @@ -147,8 +147,7 @@ class BlockRenderer public function RenderJsInline(string $sType) { $sOutput = ''; - if(!empty($this->oBlock->GetJsTemplatesRelPath($sType))) - { + if (!empty($this->oBlock->GetJsTemplatesRelPath($sType))) { $sOutput = TwigHelper::RenderTemplate( static::$oTwigEnv, $this->GetTemplateParameters(), @@ -162,8 +161,7 @@ class BlockRenderer public function RenderJsInlineRecursively(UIBlock $oBlock, string $sType) { $sOutput = ''; - if(!empty($oBlock->GetJsTemplatesRelPath($sType))) - { + if (!empty($oBlock->GetJsTemplatesRelPath($sType))) { $sOutput = trim(TwigHelper::RenderTemplate( static::$oTwigEnv, array_merge(['oUIBlock' => $oBlock], $this->aContextParams, $oBlock->GetParameters()), @@ -171,8 +169,8 @@ class BlockRenderer $sType )); } - foreach ($oBlock->GetSubBlocks() as $oSubBlock){ - $sOutput = $sOutput . $this->RenderJsInlineRecursively($oSubBlock, $sType); + foreach ($oBlock->GetSubBlocks() as $oSubBlock) { + $sOutput = $sOutput.$this->RenderJsInlineRecursively($oSubBlock, $sType); } return trim($sOutput); @@ -187,8 +185,7 @@ class BlockRenderer public function RenderCssInline() { $sOutput = ''; - if(!empty($this->oBlock->GetCssTemplateRelPath())) - { + if (!empty($this->oBlock->GetCssTemplateRelPath())) { $sOutput = TwigHelper::RenderTemplate( static::$oTwigEnv, $this->GetTemplateParameters(), diff --git a/sources/Renderer/Bootstrap/BsFieldRendererMappings.php b/sources/Renderer/Bootstrap/BsFieldRendererMappings.php index 68f8bc0eb..9156c65be 100644 --- a/sources/Renderer/Bootstrap/BsFieldRendererMappings.php +++ b/sources/Renderer/Bootstrap/BsFieldRendererMappings.php @@ -1,4 +1,5 @@ AllowAllData(); $sObjectClass = get_class($this->oField->GetObject()); - $this->oAttachmentsSet = new DBObjectSet($oSearch, array(), array('class' => $sObjectClass, 'item_id' => $this->oField->GetObject()->GetKey())); + $this->oAttachmentsSet = new DBObjectSet($oSearch, [], ['class' => $sObjectClass, 'item_id' => $this->oField->GetObject()->GetKey()]); } /** @@ -76,8 +76,8 @@ class BsFileUploadFieldRenderer extends BsFieldRenderer $sCollapseTogglerIconVisibleClass = 'glyphicon-menu-down'; $sCollapseTogglerIconHiddenClass = 'glyphicon-menu-down collapsed'; $sCollapseTogglerClass = 'form_linkedset_toggler'; - $sCollapseTogglerId = $sCollapseTogglerClass . '_' . $this->oField->GetGlobalId(); - $sFieldWrapperId = 'form_upload_wrapper_' . $this->oField->GetGlobalId(); + $sCollapseTogglerId = $sCollapseTogglerClass.'_'.$this->oField->GetGlobalId(); + $sFieldWrapperId = 'form_upload_wrapper_'.$this->oField->GetGlobalId(); $sFieldDescriptionForHTMLTag = ($this->oField->HasDescription()) ? 'data-tooltip-content="'.utils::HtmlEntities($this->oField->GetDescription()).'"' : ''; // Preparing collapsed state @@ -94,15 +94,14 @@ class BsFileUploadFieldRenderer extends BsFieldRenderer // Label $oOutput->AddHtml('
      '); - if ($this->oField->GetLabel() !== '') - { + if ($this->oField->GetLabel() !== '') { $iAttachmentsCount = $this->oAttachmentsSet->Count(); $oOutput ->AddHtml(''); } @@ -168,8 +167,7 @@ JS // Removing upload input if in read only // TODO : Add max upload size when itop attachment has been refactored - if (!$this->oField->GetReadOnly()) - { + if (!$this->oField->GetReadOnly()) { $oOutput->AddHtml('
      '.Dict::S('Attachments:AddAttachment').''.InlineImage::GetMaxUpload().'
      '); } // Ending files container @@ -190,7 +188,7 @@ JS '{{sLineStyle}}', '{{sDocDownloadUrl}}', '{{sDocDisplayUrl}}', - true, + true, '{{sAttachmentThumbUrl}}', '{{sFileName}}', '{{sAttachmentMeta}}', @@ -383,14 +381,12 @@ JS $sDeleteBtn = Dict::S('Portal:Button:Delete'); // If in read only and no attachments, we display a short message - if ($this->oField->GetReadOnly() && ($this->oAttachmentsSet->Count() === 0)) - { + if ($this->oField->GetReadOnly() && ($this->oAttachmentsSet->Count() === 0)) { $oOutput->AddHtml(Dict::S('Attachments:NoAttachment')); - } - else - { + } else { $sTableHead = self::GetAttachmentTableHeader($bIsDeleteAllowed); - $oOutput->Addhtml(<<Addhtml( + << $sTableHead @@ -398,8 +394,7 @@ HTML ); /** @var \Attachment $oAttachment */ - while ($oAttachment = $this->oAttachmentsSet->Fetch()) - { + while ($oAttachment = $this->oAttachmentsSet->Fetch()) { $iAttId = $oAttachment->GetKey(); $sLineStyle = ''; @@ -418,8 +413,7 @@ HTML if ($oDoc->IsPreviewAvailable()) { $bHasPreview = true; $iMaxSizeForPreview = MetaModel::GetModuleSetting('itop-attachments', 'icon_preview_max_size', AbstractAttachmentsRenderer::DEFAULT_MAX_SIZE_FOR_PREVIEW); - if ($oDoc->GetSize() <= $iMaxSizeForPreview) - { + if ($oDoc->GetSize() <= $iMaxSizeForPreview) { $sAttachmentThumbUrl = $sDocDownloadUrl; } } @@ -431,8 +425,7 @@ HTML $bIsTempAttachment = ($oAttachment->Get('item_id') === 0); $sAttachmentDate = ''; $iAttachmentDateRaw = ''; - if (!$bIsTempAttachment) - { + if (!$bIsTempAttachment) { $sAttachmentDate = $oAttachment->Get('creation_date'); $iAttachmentDateRaw = AttributeDateTime::GetAsUnixSeconds($sAttachmentDate); } @@ -455,7 +448,8 @@ HTML )); } - $oOutput->Addhtml(<<Addhtml( + << HTML @@ -511,18 +505,29 @@ HTML; * @since 2.7.0 */ protected static function GetAttachmentTableRow( - $iAttId, $sLineStyle, $sDocDownloadUrl, $sDocDisplayUrl, $bHasPreview, $sAttachmentThumbUrl, $sFileName, $sAttachmentMeta, $sFileSize, - $iFileSizeRaw, $iFileDownloadsCount, $sAttachmentDate, $iAttachmentDateRaw, $bIsDeleteAllowed + $iAttId, + $sLineStyle, + $sDocDownloadUrl, + $sDocDisplayUrl, + $bHasPreview, + $sAttachmentThumbUrl, + $sFileName, + $sAttachmentMeta, + $sFileSize, + $iFileSizeRaw, + $iFileDownloadsCount, + $sAttachmentDate, + $iAttachmentDateRaw, + $bIsDeleteAllowed ) { $sDeleteCell = ''; - if ($bIsDeleteAllowed) - { + if ($bIsDeleteAllowed) { $sDeleteBtnLabel = Dict::S('Portal:Button:Delete'); $sDeleteCell = ''; } $sHtml = ""; - if($bHasPreview) { + if ($bHasPreview) { $sHtml .= "\" data-tooltip-html-enabled=true>"; } else { $sHtml .= ""; diff --git a/sources/Renderer/Bootstrap/FieldRenderer/BsLinkedSetFieldRenderer.php b/sources/Renderer/Bootstrap/FieldRenderer/BsLinkedSetFieldRenderer.php index de626b9b9..af15d9e93 100644 --- a/sources/Renderer/Bootstrap/FieldRenderer/BsLinkedSetFieldRenderer.php +++ b/sources/Renderer/Bootstrap/FieldRenderer/BsLinkedSetFieldRenderer.php @@ -39,15 +39,15 @@ use utils; * Description of BsLinkedSetFieldRenderer * * @author Guillaume Lajarige - * - * @property \Combodo\iTop\Form\Field\LinkedSetField $oField - * + * + * @property \Combodo\iTop\Form\Field\LinkedSetField $oField + * */ class BsLinkedSetFieldRenderer extends BsFieldRenderer { - /** - * @inheritDoc - */ + /** + * @inheritDoc + */ public function Render() { $oOutput = parent::Render(); @@ -62,7 +62,7 @@ class BsLinkedSetFieldRenderer extends BsFieldRenderer // we sort the table on the first non link column $iSortColumnIndex = count($this->oField->GetLnkAttributesToDisplay()); // if we are in edition mode, we skip the first column (selection checkbox column) - if(!$this->oField->GetReadOnly()){ + if (!$this->oField->GetReadOnly()) { $iSortColumnIndex++; } @@ -72,17 +72,17 @@ class BsLinkedSetFieldRenderer extends BsFieldRenderer $sAttCodesToDisplayAsJson = json_encode($this->oField->GetAttributesToDisplay(true)); $sLnkAttCodesToDisplayAsJson = json_encode($this->oField->GetLnkAttributesToDisplay(true)); - $aItems = array(); - $aItemIds = array(); - $aAddedItemIds = array(); - $aAddedTargetIds = array(); + $aItems = []; + $aItemIds = []; + $aAddedItemIds = []; + $aAddedTargetIds = []; $this->InjectRendererFileAssets($this->oField->GetLinkedClass(), $this->oField->GetLnkAttributesToDisplay(true), $oOutput); $this->PrepareItems($aItems, $aItemIds, $oOutput, $aAddedItemIds, $aAddedTargetIds); $sItemsAsJson = json_encode($aItems); - $sItemIdsAsJson = utils::EscapeHtml(json_encode(array('current' => $aItemIds, 'add' => $aAddedItemIds))); + $sItemIdsAsJson = utils::EscapeHtml(json_encode(['current' => $aItemIds, 'add' => $aAddedItemIds])); foreach ($aAddedTargetIds as $sId) { - $aItemIds[$sId] = array(); + $aItemIds[$sId] = []; } if (!$this->oField->GetHidden()) { @@ -120,7 +120,7 @@ class BsLinkedSetFieldRenderer extends BsFieldRenderer // Rendering table // - Vars - $sTableId = 'table_' . $this->oField->GetGlobalId(); + $sTableId = 'table_'.$this->oField->GetGlobalId(); // - Output $oOutput->AddHtml( <<oField->GetGlobalId(); - $sButtonAddId = 'btn_add_' . $this->oField->GetGlobalId(); + $sButtonRemoveId = 'btn_remove_'.$this->oField->GetGlobalId(); + $sButtonAddId = 'btn_add_'.$this->oField->GetGlobalId(); $sLabelRemove = Dict::S('UI:Button:Remove'); $sLabelAdd = Dict::S('UI:Button:AddObject'); // - Output $oOutput->AddHtml( -<<
      @@ -607,7 +607,7 @@ EOF $sAddButtonEndpoint = str_replace('-sMode-', 'from-attribute', $this->oField->GetSearchEndpoint()); // - Output $oOutput->AddJs( - <<oField->GetGlobalId()} = function() @@ -704,9 +704,8 @@ JS } } // ... and in hidden mode - else - { - $oOutput->AddHtml(''); + else { + $oOutput->AddHtml(''); } // End of table rendering @@ -716,18 +715,18 @@ JS return $oOutput; } - /** - * @param $aItems - * @param $aItemIds - * - * @throws \Exception - * @throws \CoreException - */ + /** + * @param $aItems + * @param $aItemIds + * + * @throws \Exception + * @throws \CoreException + */ protected function PrepareItems(&$aItems, &$aItemIds, $oOutput, &$aAddedItemIds, &$aAddedTargetIds) { /** @var \ormLinkSet $oValueSet */ $oValueSet = $this->oField->GetCurrentValue(); - $oValueSet->OptimizeColumnLoad(array($this->oField->GetTargetClass() => $this->oField->GetAttributesToDisplay(true))); + $oValueSet->OptimizeColumnLoad([$this->oField->GetTargetClass() => $this->oField->GetAttributesToDisplay(true)]); while ($oItem = $oValueSet->Fetch()) { // In case of indirect linked set, we must retrieve the remote object @@ -735,8 +734,7 @@ JS try { // Note : AllowAllData set to true here instead of checking scope's flag because we are displaying a value that has been set and validated $oRemoteItem = MetaModel::GetObject($this->oField->GetTargetClass(), $oItem->Get($this->oField->GetExtKeyToRemote()), true, true); - } - catch (Exception $e) { + } catch (Exception $e) { // In some cases we can't retrieve an object from a linkedset, eg. when the extkey to remote is 0 due to a database corruption. // Rather than crashing we rather just skip the object like in the administration console IssueLog::Error('Could not retrieve object of linkedset in form #'.$this->oField->GetFormPath().' for field #'.$this->oField->GetId().'. Message: '.$e->getMessage()); @@ -752,17 +750,17 @@ JS continue; } - $aItemProperties = array( + $aItemProperties = [ 'id' => ($this->oField->IsIndirect() && $oItem->IsNew()) ? -1 * $oRemoteItem->GetKey() : $oItem->GetKey(), 'target_id' => $oRemoteItem->GetKey(), 'name' => $oItem->GetName(), - 'attributes' => array(), + 'attributes' => [], 'limited_access' => $bLimitedAccessItem, 'disabled' => true, 'active' => false, 'inactive' => true, 'not-selectable' => true, - ); + ]; // Link attributes to display $this->PrepareItem($oItem, $this->oField->GetLinkedClass(), $this->oField->GetLnkAttributesToDisplay(true), !$this->oField->GetReadOnly(), $aItemProperties, 'lnk__'); @@ -774,10 +772,10 @@ JS // and form reconstruct $aItems[] = $aItemProperties; if ($oItem->IsNew()) { - $aAddedItemIds[-1 * $aItemProperties['id']] = array(); + $aAddedItemIds[-1 * $aItemProperties['id']] = []; $aAddedTargetIds[] = $oRemoteItem->GetKey(); } else { - $aItemIds[$aItemProperties['id']] = array(); + $aItemIds[$aItemProperties['id']] = []; } } $oValueSet->rewind(); @@ -794,9 +792,9 @@ JS protected function InjectRendererFileAssets(string $sClass, array $aAttributesCodesToDisplay, $oOutput) { // handle abstract class - while(MetaModel::IsAbstract($sClass)){ + while (MetaModel::IsAbstract($sClass)) { $aChildClasses = MetaModel::EnumChildClasses($sClass); - if(count($aChildClasses) > 0){ + if (count($aChildClasses) > 0) { $sClass = $aChildClasses[0]; } } @@ -850,7 +848,7 @@ JS // Prepare attribute properties $aAttProperties = [ - 'prefix'=> $sAttribueKeyPrefix, + 'prefix' => $sAttribueKeyPrefix, 'object_class' => $sClass, 'object_id' => $oItem->GetKey(), 'attribute_code' => $sAttCode, @@ -859,10 +857,8 @@ JS // - Value raw // For simple fields, we get the raw (stored) value as well $bExcludeRawValue = false; - foreach (ApplicationHelper::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) - { - if (is_a($oAttDef, $sAttDefClassToExclude, true)) - { + foreach (ApplicationHelper::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) { + if (is_a($oAttDef, $sAttDefClassToExclude, true)) { $bExcludeRawValue = true; break; } @@ -890,7 +886,7 @@ JS $aAttProperties['value_html'] = $oFieldOutput->GetHtml(); } - } else if ($oAttDef->IsExternalKey()) { + } elseif ($oAttDef->IsExternalKey()) { /** @var \AttributeExternalKey $oAttDef */ $aAttProperties['value_html'] = utils::EscapeHtml($oItem->Get($sAttCode.'_friendlyname')); diff --git a/sources/Renderer/Bootstrap/FieldRenderer/BsSelectObjectFieldRenderer.php b/sources/Renderer/Bootstrap/FieldRenderer/BsSelectObjectFieldRenderer.php index b91d53dec..20af0cf72 100644 --- a/sources/Renderer/Bootstrap/FieldRenderer/BsSelectObjectFieldRenderer.php +++ b/sources/Renderer/Bootstrap/FieldRenderer/BsSelectObjectFieldRenderer.php @@ -40,7 +40,6 @@ use utils; */ class BsSelectObjectFieldRenderer extends BsFieldRenderer { - /** * @inheritDoc */ @@ -57,23 +56,20 @@ class BsSelectObjectFieldRenderer extends BsFieldRenderer $this->oField->SetHierarchical(false); // Rendering field in edition mode - if (!$this->oField->GetReadOnly() && !$this->oField->GetHidden()) - { + if (!$this->oField->GetReadOnly() && !$this->oField->GetHidden()) { // Debug trace: This is very useful when this kind of field doesn't return the expected values. - if(ContextTag::Check('debug')) - { + if (ContextTag::Check('debug')) { IssueLog::Info('Form field #'.$this->oField->GetId().' OQL query: '.$this->oField->GetSearch()->ToOQL(true)); } // Rendering field // - Opening container - $oOutput->AddHtml('
      '); + $oOutput->AddHtml('
      '); // Label $oOutput->AddHtml('
      '); - if ($this->oField->GetLabel() !== '') - { - $oOutput->AddHtml(''); + if ($this->oField->GetLabel() !== '') { + $oOutput->AddHtml(''); } $oOutput->AddHtml('
      '); @@ -83,40 +79,37 @@ class BsSelectObjectFieldRenderer extends BsFieldRenderer // - As a select // TODO : This should be changed when we do the radio button display. For now we display everything with select //if ($iFieldControlType === SelectObjectField::CONTROL_SELECT) - if (true) - { + if (true) { // Checking if regular select or autocomplete $oSearch = $this->oField->GetSearch()->DeepClone(); $oCountSet = new DBObjectSet($oSearch); $iSetCount = $oCountSet->Count(); // Note : Autocomplete/Search is disabled for template fields as they are not external keys, thus they will just be displayed as regular select. - $bRegularSelect = ( ($iSetCount < $this->oField->GetMaximumComboLength()) || ($this->oField->GetSearchEndpoint() === null) || ($this->oField->GetSearchEndpoint() === '') ); + $bRegularSelect = (($iSetCount < $this->oField->GetMaximumComboLength()) || ($this->oField->GetSearchEndpoint() === null) || ($this->oField->GetSearchEndpoint() === '')); unset($oCountSet); // - For regular select - if ($bRegularSelect) - { + if ($bRegularSelect) { // HTML for select part // - Opening row $oOutput->AddHtml('
      '); // - Rendering select - $oOutput->AddHtml('
      '); - $oOutput->AddHtml(''); $oOutput->AddHtml(''); // - Retrieving choices $oChoicesSet = new DBObjectSet($oSearch); - $oChoicesSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => array('friendlyname'))); - while ($oChoice = $oChoicesSet->Fetch()) - { + $oChoicesSet->OptimizeColumnLoad([$oSearch->GetClassAlias() => ['friendlyname']]); + while ($oChoice = $oChoicesSet->Fetch()) { // Note : The test is a double equal on purpose as the type of the value received from the XHR is not always the same as the type of the allowed values. (eg : string vs int) $sSelectedAtt = ($this->oField->GetCurrentValue() == $oChoice->GetKey()) ? 'selected' : ''; - $oOutput->AddHtml(''); + $oOutput->AddHtml(''); } unset($oChoicesSet); $oOutput->AddHtml(''); $oOutput->AddHtml('
      '); // - Closing col for autocomplete & opening col for hierarchy, rendering hierarchy button, closing col and row - $oOutput->AddHtml('
      '); + $oOutput->AddHtml('
      '); $this->RenderHierarchicalSearch($oOutput); $oOutput->AddHtml('
      '); // - Closing row @@ -124,7 +117,7 @@ class BsSelectObjectFieldRenderer extends BsFieldRenderer // JS FieldChange trigger (:input are not always at the same depth) $oOutput->AddJs( -<<oField->GetGlobalId()}").off("change keyup").on("change keyup", function(){ var me = this; @@ -139,7 +132,7 @@ EOF // Attaching JS widget $oOutput->AddJs( -<<GetValidatorsAsJson()} }); @@ -147,30 +140,23 @@ EOF ); } // - For autocomplete - else - { - $sAutocompleteFieldId = 's_ac_' . $this->oField->GetGlobalId(); + else { + $sAutocompleteFieldId = 's_ac_'.$this->oField->GetGlobalId(); $sEndpoint = str_replace('-sMode-', 'autocomplete', $this->oField->GetSearchEndpoint()); $sNoResultText = Dict::S('Portal:Autocomplete:NoResult'); // Retrieving field value $currentValue = $this->oField->GetCurrentValue(); - if (!empty($currentValue)) - { - try - { + if (!empty($currentValue)) { + try { // Note : AllowAllData set to true here instead of checking scope's flag because we are displaying a value that has been set and validated $oFieldValue = MetaModel::GetObject($sFieldValueClass, $this->oField->GetCurrentValue(), true, true); - } - catch (CoreException $e) - { - IssueLog::Error('Could not retrieve object ' . $sFieldValueClass . '::' . $this->oField->GetCurrentValue() . ' for "' . $this->oField->GetId() . '" field.'); + } catch (CoreException $e) { + IssueLog::Error('Could not retrieve object '.$sFieldValueClass.'::'.$this->oField->GetCurrentValue().' for "'.$this->oField->GetId().'" field.'); throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious()); } $sFieldValue = $oFieldValue->GetName(); - } - else - { + } else { $sFieldValue = ''; } @@ -178,8 +164,8 @@ EOF // - Opening input group $oOutput->AddHtml('
      '); // - Rendering autocomplete search - $oOutput->AddHtml(''); - $oOutput->AddHtml(''); + $oOutput->AddHtml(''); + $oOutput->AddHtml(''); // - Rendering buttons // - Rendering hierarchy button $this->RenderHierarchicalSearch($oOutput); @@ -192,7 +178,7 @@ EOF // Note : Not used for that field type // Attaching JS widget $oOutput->AddJs( -<<GetValidatorsAsJson()}, 'get_current_value_callback': function(me, oEvent, oData){ @@ -225,7 +211,7 @@ EOF // Preparing JS part for autocomplete $oOutput->AddJs( -<<oField->GetId()} = new Bloodhound({ queryTokenizer: Bloodhound.tokenizers.whitespace, datumTokenizer: Bloodhound.tokenizers.whitespace, @@ -314,29 +300,21 @@ EOF $oOutput->AddHtml('
      '); } // ... and in read-only mode (or hidden) - else - { + else { // Retrieving field value - if ($this->oField->GetCurrentValue() !== null && $this->oField->GetCurrentValue() !== 0 && $this->oField->GetCurrentValue() !== '') - { + if ($this->oField->GetCurrentValue() !== null && $this->oField->GetCurrentValue() !== 0 && $this->oField->GetCurrentValue() !== '') { // Note : AllowAllData set to true here instead of checking scope's flag because we are displaying a value that has been set and validated $oFieldValue = MetaModel::GetObjectWithArchive($sFieldValueClass, $this->oField->GetCurrentValue(), true, true); $sFieldHtmlValue = $oFieldValue->GetName(); - if($oFieldValue->IsArchived()) - { - $sFieldHtmlValue = '' . $sFieldHtmlValue; - } - else - { + if ($oFieldValue->IsArchived()) { + $sFieldHtmlValue = ''.$sFieldHtmlValue; + } else { $sFieldUrl = ApplicationContext::MakeObjectUrl($sFieldValueClass, $this->oField->GetCurrentValue()); - if (!empty($sFieldUrl)) - { - $sFieldHtmlValue = '' . $sFieldHtmlValue . ''; + if (!empty($sFieldUrl)) { + $sFieldHtmlValue = ''.$sFieldHtmlValue.''; } } - } - else - { + } else { $sFieldHtmlValue = Dict::S('UI:UndefinedObject'); } @@ -344,13 +322,11 @@ EOF $oOutput->AddHtml('
      '); // Showing label / value only if read-only but not hidden - if (!$this->oField->GetHidden()) - { + if (!$this->oField->GetHidden()) { // Label $oOutput->AddHtml('
      '); - if ($this->oField->GetLabel() !== '') - { - $oOutput->AddHtml(''); + if ($this->oField->GetLabel() !== '') { + $oOutput->AddHtml(''); } $oOutput->AddHtml('
      '); @@ -361,7 +337,7 @@ EOF } // Adding hidden value - $oOutput->AddHtml(''); + $oOutput->AddHtml(''); // Closing container $oOutput->AddHtml('
      '); @@ -377,15 +353,14 @@ EOF */ protected function RenderHierarchicalSearch(RenderingOutput &$oOutput) { - if ($this->oField->GetHierarchical()) - { - $sHierarchicalButtonId = 's_hi_' . $this->oField->GetGlobalId(); + if ($this->oField->GetHierarchical()) { + $sHierarchicalButtonId = 's_hi_'.$this->oField->GetGlobalId(); $sEndpoint = str_replace('-sMode-', 'hierarchy', $this->oField->GetSearchEndpoint()); - $oOutput->AddHtml('
      '); + $oOutput->AddHtml('
      '); $oOutput->AddJs( -<<oField->GetGlobalId(); + $sSearchButtonId = 's_rg_'.$this->oField->GetGlobalId(); $sEndpoint = str_replace('-sMode-', 'from-attribute', $this->oField->GetSearchEndpoint()); - $oOutput->AddHtml('
      '); + $oOutput->AddHtml('
      '); $oOutput->AddJs( -<<oField->GetMandatory()) ? 'form_mandatory' : ''; $sFieldDescriptionForHTMLTag = ($this->oField->HasDescription()) ? 'data-tooltip-content="'.utils::HtmlEntities($this->oField->GetDescription()).'"' : ''; // Vars to build the table -// $sAttributesToDisplayAsJson = json_encode($this->oField->GetAttributesToDisplay()); -// $sAttCodesToDisplayAsJson = json_encode($this->oField->GetAttributesToDisplay(true)); -// $aItems = array(); -// $aItemIds = array(); -// $this->PrepareItems($aItems, $aItemIds); -// $sItemsAsJson = json_encode($aItems); -// $sItemIdsAsJson = htmlentities(json_encode(array('current' => $aItemIds)), ENT_QUOTES, 'UTF-8'); + // $sAttributesToDisplayAsJson = json_encode($this->oField->GetAttributesToDisplay()); + // $sAttCodesToDisplayAsJson = json_encode($this->oField->GetAttributesToDisplay(true)); + // $aItems = array(); + // $aItemIds = array(); + // $this->PrepareItems($aItems, $aItemIds); + // $sItemsAsJson = json_encode($aItems); + // $sItemIdsAsJson = htmlentities(json_encode(array('current' => $aItemIds)), ENT_QUOTES, 'UTF-8'); // Rendering field - if (!$this->oField->GetHidden()) - { + if (!$this->oField->GetHidden()) { /** @var \ormSet $oOrmItemSet */ $oOrmItemSet = $this->oField->GetCurrentValue(); // Opening container - $oOutput->AddHtml('
      '); + $oOutput->AddHtml('
      '); // Label $oOutput->AddHtml('
      '); - if ($this->oField->GetLabel() !== '') - { - $oOutput->AddHtml('
    • '.$this->m_oStatLog->GetLabel('stats_nb_obj_new_unchanged').': '.$this->m_oStatLog->Get('stats_nb_obj_new_unchanged').' ('.$this->m_oStatLog->Get('stats_nb_obj_new_unchanged_warnings').' warnings)'."
    • \n"; $sStatistics .= "
    \n"; - $this->m_oDataSource->SendNotification("errors ($iErrors)", - "

    The synchronization has been executed, $iErrors errors have been encountered. Click here to see the records being currently in error.

    ".$sStatistics); - } - else - { + $this->m_oDataSource->SendNotification( + "errors ($iErrors)", + "

    The synchronization has been executed, $iErrors errors have been encountered. Click here to see the records being currently in error.

    ".$sStatistics + ); + } else { //$this->m_oDataSource->SendNotification('success', '

    The synchronization has been successfully executed.

    '); } - } - catch (SynchroExceptionNotStarted $e) - { + } catch (SynchroExceptionNotStarted $e) { $oMutex->Unlock(); // Set information for reporting... but delete the object in DB $this->m_oStatLog->Set('end_date', time()); $this->m_oStatLog->Set('status', 'error'); $this->m_oStatLog->Set('last_error', $e->getMessage()); $this->m_oStatLog->DBDelete(); - $this->m_oDataSource->SendNotification('fatal error', - '

    The synchronization could not start: \''.$e->getMessage().'\'

    Please check its configuration

    '); - } - catch (Exception $e) - { + $this->m_oDataSource->SendNotification( + 'fatal error', + '

    The synchronization could not start: \''.$e->getMessage().'\'

    Please check its configuration

    ' + ); + } catch (Exception $e) { $oMutex->Unlock(); $this->m_oStatLog->Set('end_date', time()); $this->m_oStatLog->Set('status', 'error'); $this->m_oStatLog->Set('last_error', $e->getMessage()); $this->m_oStatLog->DBUpdate(); - $this->m_oDataSource->SendNotification('exception', - '

    The synchronization has been interrupted: \''.$e->getMessage().'\'

    Please contact the application support team

    '); + $this->m_oDataSource->SendNotification( + 'exception', + '

    The synchronization has been interrupted: \''.$e->getMessage().'\'

    Please contact the application support team

    ' + ); } self::$m_oCurrentTask = null; @@ -3223,46 +3120,39 @@ class SynchroExecution $this->m_oStatLog->Set('status_curr_pos', -1); $iMaxChunkSize = utils::ReadParam('max_chunk_size', 0, true /* allow CLI */); - if ($iMaxChunkSize > 0) - { + if ($iMaxChunkSize > 0) { // Split the execution into several processes // Each process will call DoSynchronizeChunk() // The loop will end when a process does not reply "continue" on the last line of its output - if (!utils::IsModeCLI()) - { + if (!utils::IsModeCLI()) { throw new SynchroExceptionNotStarted(Dict::S('Core:SyncSplitModeCLIOnly')); } - $aArguments = array(); + $aArguments = []; $aArguments['source'] = $this->m_oDataSource->GetKey(); $aArguments['log'] = $this->m_oStatLog->GetKey(); $aArguments['change'] = $this->m_oChange->GetKey(); $aArguments['chunk'] = $iMaxChunkSize; - if ($this->m_bIsImportPhaseDateKnown) - { + if ($this->m_bIsImportPhaseDateKnown) { $aArguments['last_full_load'] = $this->m_oImportPhaseStartDate->Format('Y-m-d H:i:s'); - } - else - { + } else { $aArguments['last_full_load'] = ''; } $this->m_oStatLog->DBUpdate(); $iStepCount = 0; - do - { + do { $aArguments['step_count'] = $iStepCount; $iStepCount++; set_time_limit(0); // On Linux the time spent outside of the script does not count, but on Windows it does, so let give us time ! - list ($iRes, $aOut) = utils::ExecITopScript('synchro/priv_sync_chunk.php', $aArguments); + list($iRes, $aOut) = utils::ExecITopScript('synchro/priv_sync_chunk.php', $aArguments); // Reload the log that has been modified by the processes $this->m_oStatLog->Reload(); $sLastRes = strtolower(trim(end($aOut))); - switch ($sLastRes) - { + switch ($sLastRes) { case 'continue': $bContinue = true; break; @@ -3273,18 +3163,15 @@ class SynchroExecution default: $this->m_oStatLog->AddTrace('The script did not reply with the expected keywords:'); - $aIndentedOut = array(); - foreach ($aOut as $sOut) - { + $aIndentedOut = []; + foreach ($aOut as $sOut) { $aIndentedOut[] = "-> $sOut"; $this->m_oStatLog->AddTrace(">>> $sOut"); } throw new Exception("Encountered an error in an underspinned process:\n".implode("\n", $aIndentedOut)); } } while ($bContinue); - } - else - { + } else { $this->PrepareProcessing(/* first pass */); $this->DoJob1UpdateReplicas(); $this->DoJob2CreateOrUpdateItopObjects(); @@ -3325,8 +3212,7 @@ class SynchroExecution $this->m_oStatLog->AddTrace("Synchronizing chunk - curr_job:$iCurrJob, curr_pos:$iCurrPos, max_chunk_size:$iMaxChunkSize"); - switch ($iCurrJob) - { + switch ($iCurrJob) { case 1: default: $this->DoJob1UpdateReplicas($iMaxChunkSize, $iCurrPos); @@ -3373,78 +3259,67 @@ class SynchroExecution // Get all the replicas that were not seen in the last import and mark them as obsolete $sDeletePolicy = $this->m_oDataSource->Get('delete_policy'); - if ($sDeletePolicy !== 'ignore') - { + if ($sDeletePolicy !== 'ignore') { $sSelectToObsolete = "SELECT SynchroReplica WHERE id > :curr_pos AND sync_source_id = :source_id AND status IN ('new', 'synchronized', 'modified', 'orphan') AND status_last_seen < :last_import"; - $oSetScope = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToObsolete), array() /* order by*/, array( + $oSetScope = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToObsolete), [] /* order by*/, [ 'source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLastFullLoadStartDate, 'curr_pos' => $iCurrPos, - )); + ]); $iCountScope = $oSetScope->Count(); $sDebugOql = $oSetScope->GetFilter()->ToOQL(true); $this->m_oStatLog->AddTrace("Searching for replicas to mark as obsolete using query: '$sDebugOql', returned $iCountScope replica(s)."); - if (($this->m_iCountAllReplicas > 10) && ($this->m_iCountAllReplicas == $iCountScope) && MetaModel::GetConfig()->Get('synchro_prevent_delete_all')) - { + if (($this->m_iCountAllReplicas > 10) && ($this->m_iCountAllReplicas == $iCountScope) && MetaModel::GetConfig()->Get('synchro_prevent_delete_all')) { throw new SynchroExceptionNotStarted(Dict::S('Core:SyncTooManyMissingReplicas')); } - if ($iMaxReplica) - { + if ($iMaxReplica) { // Consider a given subset, starting from replica iCurrPos, limited to the count of iMaxReplica // The replica have to be ordered by id - $oSetToProcess = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToObsolete), array('id' => true) /* order by*/, array( + $oSetToProcess = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToObsolete), ['id' => true] /* order by*/, [ 'source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLastFullLoadStartDate, 'curr_pos' => $iCurrPos, - )); + ]); $oSetToProcess->SetLimit($iMaxReplica); - } - else - { + } else { $oSetToProcess = $oSetScope; } $iLastReplicaProcessed = -1; /** @var SynchroReplica $oReplica */ - while($oReplica = $oSetToProcess->Fetch()) - { + while ($oReplica = $oSetToProcess->Fetch()) { set_time_limit(intval($iLoopTimeLimit)); $iLastReplicaProcessed = $oReplica->GetKey(); - switch ($sDeletePolicy) - { + switch ($sDeletePolicy) { case 'update': case 'update_then_delete': $this->m_oStatLog->AddTrace("Destination object to be updated", $oReplica); - $aToUpdate = array(); - $aToUpdateSpec = explode(';', - $this->m_oDataSource->Get('delete_policy_update')); //ex: 'status:obsolete;description:stopped', - foreach ($aToUpdateSpec as $sUpdateSpec) - { + $aToUpdate = []; + $aToUpdateSpec = explode( + ';', + $this->m_oDataSource->Get('delete_policy_update') + ); //ex: 'status:obsolete;description:stopped', + foreach ($aToUpdateSpec as $sUpdateSpec) { $aUpdateSpec = explode(':', $sUpdateSpec); - if (count($aUpdateSpec) == 2) - { + if (count($aUpdateSpec) == 2) { $sAttCode = $aUpdateSpec[0]; $sValue = $aUpdateSpec[1]; $aToUpdate[$sAttCode] = $sValue; } } $oReplica->Set('status_last_error', ''); - if ($oReplica->Get('dest_id') == '') - { + if ($oReplica->Get('dest_id') == '') { $oReplica->Set('status', 'obsolete'); $this->m_oStatLog->Inc('stats_nb_replica_disappeared_no_action'); - } - else - { + } else { $oReplica->UpdateDestObject($aToUpdate, $this->m_oChange, $this->m_oStatLog); - if ($oReplica->Get('status_last_error') == '') - { + if ($oReplica->Get('status_last_error') == '') { // Change the status of the replica IIF $oReplica->Set('status', 'obsolete'); } } - $oReplica->DBUpdate(); + $oReplica->DBUpdate(); break; case 'delete': @@ -3458,10 +3333,8 @@ class SynchroExecution break; } } - if ($iMaxReplica) - { - if ($iMaxReplica < $iCountScope) - { + if ($iMaxReplica) { + if ($iMaxReplica < $iCountScope) { // Continue with this job! $this->m_oStatLog->Set('status_curr_pos', $iLastReplicaProcessed); $this->m_oStatLog->AddTrace("<<< End of DoJob1(\$iMaxReplica = $iMaxReplica, \$iCurrPos = $iCurrPos) (returning true => more replicas to process)"); @@ -3473,11 +3346,13 @@ class SynchroExecution //Count "seen" objects $sSelectSeen = "SELECT SynchroReplica WHERE sync_source_id = :source_id AND status IN ('new', 'synchronized', 'modified', 'orphan') AND status_last_seen >= :last_import"; - $oSetSeen = new DBObjectSet(DBObjectSearch::FromOQL($sSelectSeen), array() /* order by*/, - array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLastFullLoadStartDate)); + $oSetSeen = new DBObjectSet( + DBObjectSearch::FromOQL($sSelectSeen), + [] /* order by*/, + ['source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLastFullLoadStartDate] + ); $this->m_oStatLog->Set('stats_nb_replica_seen', $oSetSeen->Count()); - // Job complete! $this->m_oStatLog->Set('status_curr_job', 2); $this->m_oStatLog->Set('status_curr_pos', -1); @@ -3511,26 +3386,26 @@ class SynchroExecution // Get all the replicas that are 'new' or modified or synchronized with a warning // $sSelectToSync = "SELECT SynchroReplica WHERE id > :curr_pos AND (status = 'new' OR status = 'modified' OR (status = 'synchronized' AND status_last_warning != '')) AND sync_source_id = :source_id AND status_last_seen >= :last_import"; - $oSetScope = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToSync), array(), array( + $oSetScope = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToSync), [], [ 'source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLimitDate, 'curr_pos' => $iCurrPos, - ), $this->m_aExtDataSpec); + ], $this->m_aExtDataSpec); $iCountScope = $oSetScope->Count(); $sDebugOQL = $oSetScope->GetFilter()->ToOQL(true); $this->m_oStatLog->AddTrace("Looking for - new, modified or synchonized with a warning - replicas using the OQL query: '$sDebugOQL', returned $iCountScope replicas."); - if ($iMaxReplica) - { + if ($iMaxReplica) { // Consider a given subset, starting from replica iCurrPos, limited to the count of iMaxReplica // The replica have to be ordered by id - $oSetToProcess = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToSync), array('id' => true) /* order by*/, - array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLimitDate, 'curr_pos' => $iCurrPos), - $this->m_aExtDataSpec); + $oSetToProcess = new DBObjectSet( + DBObjectSearch::FromOQL($sSelectToSync), + ['id' => true] /* order by*/, + ['source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLimitDate, 'curr_pos' => $iCurrPos], + $this->m_aExtDataSpec + ); $oSetToProcess->SetLimit($iMaxReplica); - } - else - { + } else { $oSetToProcess = $oSetScope; } @@ -3543,8 +3418,13 @@ class SynchroExecution set_time_limit(intval($iLoopTimeLimit)); $iLastReplicaProcessed = $oReplica->GetKey(); $this->m_oStatLog->AddTrace("Synchronizing replica id=$iLastReplicaProcessed."); - $oReplica->Synchro($this->m_oDataSource, $this->m_aReconciliationKeys, $this->m_aAttributes, $this->m_oChange, - $this->m_oStatLog); + $oReplica->Synchro( + $this->m_oDataSource, + $this->m_aReconciliationKeys, + $this->m_aAttributes, + $this->m_oChange, + $this->m_oStatLog + ); $this->m_oStatLog->AddTrace("Updating replica id=$iLastReplicaProcessed."); $oReplica->DBUpdate(); } @@ -3554,10 +3434,8 @@ class SynchroExecution cmdbAbstractObject::FireEventDbLinksChangedForAllObjects(); } - if ($iMaxReplica) - { - if ($iMaxReplica < $iCountScope) - { + if ($iMaxReplica) { + if ($iMaxReplica < $iCountScope) { // Continue with this job! $this->m_oStatLog->Set('status_curr_pos', $iLastReplicaProcessed); $this->m_oStatLog->AddTrace("<<< End of DoJob2(\$iMaxReplica = $iMaxReplica, \$iCurrPos = $iCurrPos) (returning true => more replicas to process)"); @@ -3595,8 +3473,7 @@ class SynchroExecution $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop'); $sDeletePolicy = $this->m_oDataSource->Get('delete_policy'); - if ($sDeletePolicy !== 'update_then_delete') - { + if ($sDeletePolicy !== 'update_then_delete') { $this->m_oStatLog->AddTrace("\$sDeletePoliciy = $sDeletePolicy != 'update_then_delete', nothing to do!"); // Job complete! $this->m_oStatLog->Set('status_curr_job', 0); @@ -3612,51 +3489,46 @@ class SynchroExecution // $oDeletionDate = $this->m_oLastFullLoadStartDate; $iDeleteRetention = $this->m_oDataSource->Get('delete_policy_retention'); // Duration in seconds - if ($iDeleteRetention > 0) - { + if ($iDeleteRetention > 0) { $sInterval = "-$iDeleteRetention seconds"; $oDeletionDate->Modify($sInterval); } $sDeletionDate = $oDeletionDate->Format('Y-m-d H:i:s'); - if ($bFirstPass) - { + if ($bFirstPass) { $this->m_oStatLog->AddTrace("Deletion date: $sDeletionDate"); } $sSelectToDelete = "SELECT SynchroReplica WHERE id > :curr_pos AND sync_source_id = :source_id AND status IN ('obsolete') AND status_last_seen < :last_import"; - $oSetScope = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToDelete), array(), array( + $oSetScope = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToDelete), [], [ 'source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sDeletionDate, 'curr_pos' => $iCurrPos, - )); + ]); $iCountScope = $oSetScope->Count(); - if ($iMaxReplica) - { + if ($iMaxReplica) { // Consider a given subset, starting from replica iCurrPos, limited to the count of iMaxReplica // The replica have to be ordered by id - $oSetToProcess = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToDelete), array('id' => true) /* order by*/, - array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sDeletionDate, 'curr_pos' => $iCurrPos)); + $oSetToProcess = new DBObjectSet( + DBObjectSearch::FromOQL($sSelectToDelete), + ['id' => true] /* order by*/, + ['source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sDeletionDate, 'curr_pos' => $iCurrPos] + ); $oSetToProcess->SetLimit($iMaxReplica); - } - else - { + } else { $oSetToProcess = $oSetScope; } $iLastReplicaProcessed = -1; /** @var SynchroReplica $oReplica */ - while($oReplica = $oSetToProcess->Fetch()) - { + while ($oReplica = $oSetToProcess->Fetch()) { set_time_limit(intval($iLoopTimeLimit)); $iLastReplicaProcessed = $oReplica->GetKey(); $this->m_oStatLog->AddTrace('Destination object to be DELETED', $oReplica); $oReplica->DeleteDestObject($this->m_oChange, $this->m_oStatLog); } - if ($iMaxReplica) - { - if ($iMaxReplica < $iCountScope) - { + if ($iMaxReplica) { + if ($iMaxReplica < $iCountScope) { // Continue with this job! $this->m_oStatLog->Set('status_curr_pos', $iLastReplicaProcessed); $this->m_oStatLog->AddTrace("<<< End of DoJob3\$iMaxReplica = $iMaxReplica, \$iCurrPos = $iCurrPos) (returning true => more replicas to process)"); diff --git a/tests/manual-visual-tests/Backoffice/RenderAllUiBlocks.php b/tests/manual-visual-tests/Backoffice/RenderAllUiBlocks.php index 91e3f7946..a54b0fcfe 100644 --- a/tests/manual-visual-tests/Backoffice/RenderAllUiBlocks.php +++ b/tests/manual-visual-tests/Backoffice/RenderAllUiBlocks.php @@ -56,7 +56,8 @@ $oPage = new iTopWebPage('Render all UI blocks'); $oPageContentLayout = PageContentFactory::MakeStandardEmpty(); $oPage->SetContentLayout($oPageContentLayout); -$oPage->add_style(<<add_style( + <<AddUiBlock($oCollapsibleSectionSaveState); $oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Fieldset/field examples', 2)); - $oDashletFieldset1 = new FieldSet('Fieldset 1'); $oDashletField1 = FieldUIBlockFactory::MakeStandard('Field A'); $oDashletInput1 = InputUIBlockFactory::MakeStandard('text', 'input1', 'Input 1'); @@ -360,13 +360,13 @@ $oDashletFieldset2->AddSubBlock($oDashletField6); // Code ///////// -$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Code examples (MakeForCode)', 2 )); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Code examples (MakeForCode)', 2)); $oCode1 = UIContentBlockUIBlockFactory::MakeForCode('function mean(int $a, int $b) { return ($a + $b)/2 }'); $oPage->AddUiBlock($oCode1); -$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Code examples (MakeForPreformatted)', 2 )); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Code examples (MakeForPreformatted)', 2)); $oCode2 = UIContentBlockUIBlockFactory::MakeForPreformatted('function mean(int $a, int $b) { return ($a + $b)/2 }'); @@ -376,7 +376,7 @@ $oPage->AddUiBlock($oCode2); // Pill ///////// -$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Pill examples', 2 )); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Pill examples', 2)); $oBlock = new UIContentBlockWithJSRefreshCallback(null, ["ibo-dashlet-header-dynamic--container"]); $oPage->AddUiBlock($oBlock); @@ -397,95 +397,97 @@ $oBlock->AddSubBlock($oPill6); // Title ///////// -$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title examples', 2 )); -$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 1', 1 )); -$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 2', 2 )); -$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 3', 3 )); -$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 4', 4 )); -$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 5', 5 )); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title examples', 2)); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 1', 1)); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 2', 2)); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 3', 3)); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 4', 4)); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Title example 5', 5)); ///////// // DataTable ///////// -$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Datatable examples', 2 )); +$oPage->AddUiBlock(TitleUIBlockFactory::MakeNeutral('Datatable examples', 2)); -$oPage->AddUiBlock(DataTableUIBlockFactory::MakeForStaticData('Static datatable', - array( - 'a' => array('label' => 'a'), - 'b' => array('label' => 'b'), - 'c' => array('label' => 'c'), - 'd' => array('label' => 'd') - ), - array( - array( - 'a' => 'A1', 'b' => 'B1', 'c' => 'C1', 'd' => 'D1' - ), array( - 'a' => 'A2', 'b' => 'B2', 'c' => 'C2', 'd' => 'D2' - ), array( - 'a' => 'A3', 'b' => 'B3', 'c' => 'C3', 'd' => 'D3' - ), array( +$oPage->AddUiBlock(DataTableUIBlockFactory::MakeForStaticData( + 'Static datatable', + [ + 'a' => ['label' => 'a'], + 'b' => ['label' => 'b'], + 'c' => ['label' => 'c'], + 'd' => ['label' => 'd'], + ], + [ + [ + 'a' => 'A1', 'b' => 'B1', 'c' => 'C1', 'd' => 'D1', + ], [ + 'a' => 'A2', 'b' => 'B2', 'c' => 'C2', 'd' => 'D2', + ], [ + 'a' => 'A3', 'b' => 'B3', 'c' => 'C3', 'd' => 'D3', + ], [ 'a' => 'A4', 'b' => 'B4', 'c' => 'C4', 'd' => 'D4', - ), - array( + ], + [ '@class' => 'ibo-is-red', 'a' => 'A5 (Red highlighting)', 'b' => 'B5', 'c' => 'C5', 'd' => 'D5', - ), - array( + ], + [ '@class' => 'ibo-is-danger', 'a' => 'A6 (Danger highlighting)', 'b' => 'B6', 'c' => 'C6', 'd' => 'D6', - ), - array( + ], + [ '@class' => 'ibo-is-orange', 'a' => 'A7 (Orange highlighting)', 'b' => 'B7', 'c' => 'C7', 'd' => 'D7', - ), - array( + ], + [ '@class' => 'ibo-is-warning', 'a' => 'A8 (Warning highlighting)', 'b' => 'B8', 'c' => 'C8', 'd' => 'D8', - ), - array( + ], + [ '@class' => 'ibo-is-blue', 'a' => 'A9 (Blue highlighting)', 'b' => 'B9', 'c' => 'C9', 'd' => 'D9', - ), - array( + ], + [ '@class' => 'ibo-is-info', 'a' => 'A10 (Info highlighting)', 'b' => 'B10', 'c' => 'C10', 'd' => 'D10', - ), - array( + ], + [ '@class' => 'ibo-is-green', 'a' => 'A11 (Green highlighting)', 'b' => 'B11', 'c' => 'C11', 'd' => 'D11', - ), - array( + ], + [ '@class' => 'ibo-is-success', 'a' => 'A12 (Success highlighting)', 'b' => 'B12', 'c' => 'C12', 'd' => 'D12', - ), - ))); + ], + ] +)); ///////// // Set diff --git a/tests/manual-visual-tests/sanitize_test.php b/tests/manual-visual-tests/sanitize_test.php index fd65b1727..bfa771668 100644 --- a/tests/manual-visual-tests/sanitize_test.php +++ b/tests/manual-visual-tests/sanitize_test.php @@ -7,7 +7,8 @@ require_once '../../approot.inc.php'; require_once(APPROOT.'/application\utils.inc.php'); $index = 0; -function testSanitize ($sValue, $sType, &$index ){ +function testSanitize($sValue, $sType, &$index) +{ $sDefaultVal = '!defaultVal!'; $sValueEscapedJs = str_replace('"', '\"', $sValue); $sSanitizedValue = utils::Sanitize($sValue, $sDefaultVal, $sType); @@ -43,7 +44,7 @@ HTML; $index++; } -$aValues = array( +$aValues = [ "test", "t;e-s_t$", "123test", @@ -55,9 +56,9 @@ $aValues = array( "éèç", "q
    è
    =hcb test", // "q
    è
    =hcb test", -); +]; -$aTypes = array( +$aTypes = [ utils::ENUM_SANITIZATION_FILTER_CONTEXT_PARAM, utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER, utils::ENUM_SANITIZATION_FILTER_FIELD_NAME, @@ -66,7 +67,7 @@ $aTypes = array( utils::ENUM_SANITIZATION_FILTER_STRING, utils::ENUM_SANITIZATION_FILTER_TRANSACTION_ID, utils::ENUM_SANITIZATION_FILTER_VARIABLE_NAME, -); +]; ?> diff --git a/tests/php-unit-tests/experiments/runClassInSeparateProcessTest.php b/tests/php-unit-tests/experiments/runClassInSeparateProcessTest.php index 66ce826f7..8b01463d2 100644 --- a/tests/php-unit-tests/experiments/runClassInSeparateProcessTest.php +++ b/tests/php-unit-tests/experiments/runClassInSeparateProcessTest.php @@ -13,14 +13,15 @@ namespace Combodo\iTop\Test\UnitTest; */ class runClassInSeparateProcessTest extends ItopDataTestCase { - static public function setUpBeforeClass(): void + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); // TODO: Change the autogenerated stub file_put_contents( dirname(__FILE__).'/pid.txt', getmypid().';'.static::class.';'.__METHOD__."\n", - FILE_APPEND); + FILE_APPEND + ); } protected function LogPid() @@ -28,16 +29,17 @@ class runClassInSeparateProcessTest extends ItopDataTestCase file_put_contents( dirname(__FILE__).'/pid.txt', getmypid().';'.static::class.';'.$this->getName()."\n", - FILE_APPEND); + FILE_APPEND + ); } - function testA() + public function testA() { $this->LogPid(); static::assertTrue(true); } - function testB() + public function testB() { $this->LogPid(); static::assertTrue(true); @@ -46,13 +48,13 @@ class runClassInSeparateProcessTest extends ItopDataTestCase /** * @dataProvider CProvider */ - function testC($i) + public function testC($i) { $this->LogPid(); static::assertTrue(true); } - function CProvider() + public function CProvider() { return [ [1], diff --git a/tests/php-unit-tests/experiments/tearDownAfterFailureTest.php b/tests/php-unit-tests/experiments/tearDownAfterFailureTest.php index ff820dbbd..20c8df3f6 100644 --- a/tests/php-unit-tests/experiments/tearDownAfterFailureTest.php +++ b/tests/php-unit-tests/experiments/tearDownAfterFailureTest.php @@ -1,6 +1,7 @@ ['arg1'], ]; - $sCompiledLanguagesFilePath = APPROOT . 'env-' . \utils::GetCurrentEnvironment() . '/dictionaries/languages.php'; + $sCompiledLanguagesFilePath = APPROOT.'env-'.\utils::GetCurrentEnvironment().'/dictionaries/languages.php'; $this->assertFileExists($sCompiledLanguagesFilePath, 'We must have an existing compiled language.php file in the current env !'); require_once($sCompiledLanguagesFilePath); $this->assertNotEmpty(Dict::GetLanguages(), 'the languages.php file exists but didn\'t load any language'); - foreach (glob(APPROOT . 'env-' . \utils::GetCurrentEnvironment() . '/dictionaries/*.dict.php') as $sDictFile) { + foreach (glob(APPROOT.'env-'.\utils::GetCurrentEnvironment().'/dictionaries/*.dict.php') as $sDictFile) { if (preg_match('/.*\\/(.*).dict.php/', $sDictFile, $aMatches)) { $sLangCode = $aMatches[1]; $sLanguageCode = strtoupper(str_replace('-', ' ', $sLangCode)); Dict::SetUserLanguage($sLanguageCode); foreach ($aLabelsToTest as $sLabelKey => $aLabelArgs) { - echo "Testing $sDictFile, label $sLabelKey with " . \var_export($aLabelArgs, true) . "\n"; + echo "Testing $sDictFile, label $sLabelKey with ".\var_export($aLabelArgs, true)."\n"; try { $sLabelValue = Dict::Format($sLabelKey, ...$aLabelArgs); //$this->debug($sLabelValue); @@ -71,7 +73,7 @@ class CompiledDictionariesConsistencyTest extends ItopTestCase ]); } } - $this->assertEquals([], $aFailedLabels, "$sDictFile : test fail for lang $sLangCode and labels (" . implode(", ", $aFailedLabels) . ')'); + $this->assertEquals([], $aFailedLabels, "$sDictFile : test fail for lang $sLangCode and labels (".implode(", ", $aFailedLabels).')'); } } } diff --git a/tests/php-unit-tests/integration-tests/DetectStaticPollutionTest.php b/tests/php-unit-tests/integration-tests/DetectStaticPollutionTest.php index 6422ded62..1b37a9dbb 100644 --- a/tests/php-unit-tests/integration-tests/DetectStaticPollutionTest.php +++ b/tests/php-unit-tests/integration-tests/DetectStaticPollutionTest.php @@ -35,7 +35,7 @@ class detectStaticPollutionTest extends TestCase * * @return void */ - function testDetectPolluters($sPattern, $sFix) + public function testDetectPolluters($sPattern, $sFix) { $sScannedDir = dirname(__FILE__).'/../unitary-tests'; @@ -44,7 +44,7 @@ class detectStaticPollutionTest extends TestCase $Iterator = new RecursiveIteratorIterator($oDirectory); foreach (new RegexIterator($Iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH) as $aMatch) { $sFile = $aMatch[0]; - if(is_file($sFile)) { + if (is_file($sFile)) { $sFileContents = file_get_contents($sFile); if (preg_match_all($sPattern, $sFileContents, $keys, PREG_PATTERN_ORDER)) { $aPolluters = array_merge($aPolluters, $this->FindMatches($sFile, $sFileContents, $sPattern)); diff --git a/tests/php-unit-tests/integration-tests/DictionariesConsistencyAfterSetupTest.php b/tests/php-unit-tests/integration-tests/DictionariesConsistencyAfterSetupTest.php index e69d5cb65..be9aa1dcf 100644 --- a/tests/php-unit-tests/integration-tests/DictionariesConsistencyAfterSetupTest.php +++ b/tests/php-unit-tests/integration-tests/DictionariesConsistencyAfterSetupTest.php @@ -16,7 +16,7 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase "Class:DatacenterDevice/Attribute:redundancy/count", "Class:DatacenterDevice/Attribute:redundancy/disabled", "Class:DatacenterDevice/Attribute:redundancy/percent", - "Class:TriggerOnThresholdReached/Attribute:threshold_index+" + "Class:TriggerOnThresholdReached/Attribute:threshold_index+", ]; protected function setUp(): void @@ -33,7 +33,8 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase $this->SetNonPublicStaticProperty(\Dict::class, 'm_aData', $aDictEntriesByLanguage); } - public function FormatProvider(){ + public function FormatProvider() + { return [ 'key does not exist in dictionnary' => [ 'sTemplate' => null, @@ -55,13 +56,14 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase * @since 2.7.10 N°5491 - Inconsistent dictionary entries regarding arguments to pass to Dict::Format * @dataProvider FormatProvider */ - public function testFormatWithOneArgumentAndCustomKey(?string $sTemplate, $sExpectedTranslation){ + public function testFormatWithOneArgumentAndCustomKey(?string $sTemplate, $sExpectedTranslation) + { //tricky way to mock GetLabelAndLangCode behavior via connected user language $sLangCode = \Dict::GetUserLanguage(); $aDictByLang = $this->GetNonPublicStaticProperty(\Dict::class, 'm_aData'); $sDictKey = 'ITOP::DICT:FORMAT:BROKEN:KEY'; - if (! is_null($sTemplate)){ + if (! is_null($sTemplate)) { $aDictByLang[$sLangCode][$sDictKey] = $sTemplate; } @@ -72,7 +74,8 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase //test works after setup (no annotation @beforesetup) //even if it does not extend ItopDataTestCase - private function ReadDictKeys($sLangCode) : array { + private function ReadDictKeys($sLangCode): array + { \Dict::InitLangIfNeeded($sLangCode); $aDictEntries = $this->GetNonPublicStaticProperty(\Dict::class, 'm_aData'); @@ -90,28 +93,30 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase * * @return array */ - private function GetKeyArgCountMap($aDictEntry) { + private function GetKeyArgCountMap($aDictEntry) + { $aKeyArgsCount = []; - foreach ($aDictEntry as $sKey => $sValue){ + foreach ($aDictEntry as $sKey => $sValue) { $aKeyArgsCount[$sKey] = $this->countArg($sValue); } ksort($aKeyArgsCount); return $aKeyArgsCount; } - private function countArg($sLabel) { + private function countArg($sLabel) + { $iMaxIndex = 0; - if (preg_match_all("/%(\d+)/", $sLabel, $aMatches)){ + if (preg_match_all("/%(\d+)/", $sLabel, $aMatches)) { $aSubMatches = $aMatches[1]; - if (is_array($aSubMatches)){ - foreach ($aSubMatches as $aCurrentMatch){ + if (is_array($aSubMatches)) { + foreach ($aSubMatches as $aCurrentMatch) { $iIndex = $aCurrentMatch; $iMaxIndex = ($iMaxIndex < $iIndex) ? $iIndex : $iMaxIndex; } } - } else if ((false !== strpos($sLabel, "%s")) + } elseif ((false !== strpos($sLabel, "%s")) || (false !== strpos($sLabel, "%d")) - ){ + ) { $iMaxIndex = 1; } @@ -122,7 +127,8 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase * Warning: hardcoded list of languages * It is hard to have it dynamically via Dict::GetLanguages as for each lang Dict::Init should be called first **/ - public function LangCodeProvider(){ + public function LangCodeProvider() + { return [ 'cs' => [ 'CS CZ' ], 'da' => [ 'DA DA' ], @@ -154,7 +160,6 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase $aDictEntry = $this->ReadDictKeys($sLanguageCodeToTest); - $aKeyArgsCountMap = []; $aKeyArgsCountMap[$sReferenceLangCode] = $this->GetKeyArgCountMap($aReferenceLangDictEntry); //$aKeyArgsCountMap[$sCode] = $this->GetKeyArgCountMap($aDictEntry); @@ -164,30 +169,30 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase $aMismatchedKeys = []; - foreach ($aKeyArgsCountMap[$sReferenceLangCode] as $sKey => $iExpectedNbOfArgs){ - if (0 === $iExpectedNbOfArgs){ - //no arg needed in EN. + foreach ($aKeyArgsCountMap[$sReferenceLangCode] as $sKey => $iExpectedNbOfArgs) { + if (0 === $iExpectedNbOfArgs) { + //no arg needed in EN. //let s assume job has been done correctly in EN to simplify continue; } - if (in_array($sKey, self::$aLabelCodeNotToCheck)){ + if (in_array($sKey, self::$aLabelCodeNotToCheck)) { //false positive: do not test continue; } - if (array_key_exists($sKey, $aDictEntry)){ + if (array_key_exists($sKey, $aDictEntry)) { $aPlaceHolders = []; - for ($i=0; $i<$iExpectedNbOfArgs; $i++){ - $aPlaceHolders[]=$i; + for ($i = 0; $i < $iExpectedNbOfArgs; $i++) { + $aPlaceHolders[] = $i; } $sLabelTemplate = $aDictEntry[$sKey]; - try{ + try { vsprintf($sLabelTemplate, $aPlaceHolders); - } catch(\Throwable $e){ + } catch (\Throwable $e) { $sError = $e->getMessage(); - if (array_key_exists($sError, $aMismatchedKeys)){ + if (array_key_exists($sError, $aMismatchedKeys)) { $aMismatchedKeys[$sError][$sKey] = $iExpectedNbOfArgs; } else { $aMismatchedKeys[$sError] = [$sKey => $iExpectedNbOfArgs]; @@ -197,7 +202,7 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase } $iCount = 0; - foreach ($aMismatchedKeys as $sError => $aKeys){ + foreach ($aMismatchedKeys as $sError => $aKeys) { var_dump($sError); foreach ($aKeys as $sKey => $iExpectedNbOfArgs) { $iCount++; @@ -222,7 +227,8 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase $this->assertEquals([], $aMismatchedKeys, $sErrorMsg); } - public function testEveryEnglishEntryShouldHaveItsFrenchCounterpart() { + public function testEveryEnglishEntryShouldHaveItsFrenchCounterpart() + { $sReferenceLangCode = 'EN US'; $aReferenceLangDictEntries = $this->ReadDictKeys($sReferenceLangCode); @@ -233,13 +239,14 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase $this->assertCount(0, $aMissingEntries, "The following entries are missing in french dictionaries : \n - ".implode("\n - ", $aMissingEntries)); } - public function testEveryFrenchEntryShouldBeTranslated() { + public function testEveryFrenchEntryShouldBeTranslated() + { $sFrenchLangCode = 'FR FR'; $aFrenchDictEntries = $this->ReadDictKeys($sFrenchLangCode); $aUntranslatedEntries = []; - foreach ($aFrenchDictEntries as $sKey => $sValue){ - if(mb_substr($sValue,-2) === '~~'){ + foreach ($aFrenchDictEntries as $sKey => $sValue) { + if (mb_substr($sValue, -2) === '~~') { $aUntranslatedEntries[] = $sKey.' => '.var_export($sValue, true); } } @@ -247,7 +254,8 @@ class DictionariesConsistencyAfterSetupTest extends ItopTestCase $this->assertCount(0, $aUntranslatedEntries, "The following french entries require translation : \n - ".implode("\n - ", $aUntranslatedEntries)); } - public function VsprintfProvider(){ + public function VsprintfProvider() + { return [ 'not enough args' => [ "sLabelTemplate" => "$1%s", diff --git a/tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php b/tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php index ba13cb2e3..ca5ab5a58 100644 --- a/tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php +++ b/tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php @@ -1,4 +1,5 @@ setUp(); $sAppRoot = static::GetAppRoot(); - $aDictFilesCore = []; $sCoreDictionariesPath = realpath($sAppRoot.'dictionaries'); $sDictFilePattern = '/^.+\.dict.*\.php$/i'; $oDirIterator = new RecursiveDirectoryIterator($sCoreDictionariesPath, RecursiveDirectoryIterator::SKIP_DOTS); $oIterator = new RecursiveIteratorIterator($oDirIterator, RecursiveIteratorIterator::SELF_FIRST); $oRegexIterator = new RegexIterator($oIterator, $sDictFilePattern, RegexIterator::GET_MATCH); - foreach($oRegexIterator as $file) { + foreach ($oRegexIterator as $file) { $aDictFilesCore[] = $file[0]; } - $aDictFilesModules = array_merge( glob($sAppRoot.'datamodels/2.x/*/*.dict*.php'), // legacy form in modules glob($sAppRoot.'datamodels/2.x/*/dictionaries/*.dict*.php'), // modern form in modules @@ -170,15 +176,14 @@ class DictionariesConsistencyTest extends ItopTestCase ); $this->RemoveModulesWithout7246Fixes($aDictFilesModules); - $aDictFiles = array_merge($aDictFilesCore, $aDictFilesModules); - $aTestCases = array(); + $aTestCases = []; foreach ($aDictFiles as $sDictFile) { preg_match('/^(.*)\\.dict/', basename($sDictFile), $aMatches); $sDictFileLangPrefix = $aMatches[1]; - $aTestCases[$sDictFile] = array('sDictFile' => $sDictFile, 'sLanguagePrefix' => $sDictFileLangPrefix); + $aTestCases[$sDictFile] = ['sDictFile' => $sDictFile, 'sLanguagePrefix' => $sDictFileLangPrefix]; } return $aTestCases; @@ -189,11 +194,11 @@ class DictionariesConsistencyTest extends ItopTestCase * * @since 3.0.5 3.1.2 3.2.0 N°7246 */ - private function RemoveModulesWithout7246Fixes(array &$aDictFilesModules):void + private function RemoveModulesWithout7246Fixes(array &$aDictFilesModules): void { - require_once static::GetAppRoot() . 'approot.inc.php'; // mandatory for tearDownAfterClass to work, of not present will thow `Undefined constant "LINKSET_TRACKING_LIST"` + require_once static::GetAppRoot().'approot.inc.php'; // mandatory for tearDownAfterClass to work, of not present will thow `Undefined constant "LINKSET_TRACKING_LIST"` $this->RequireOnceItopFile('core/config.class.inc.php'); // source of the ITOP_VERSION constant - if (version_compare(ITOP_VERSION, '3.2.0', '>=')) { + if (version_compare(ITOP_VERSION, '3.2.0', '>=')) { return; } @@ -246,7 +251,8 @@ class DictionariesConsistencyTest extends ItopTestCase $this->CheckDictionarySyntax(__DIR__.'/dictionaries-test/fr.dictionary.itop.core.OK.php', true); } - private function GetPhpCodeFromDictFile(string $sDictFile) : string { + private function GetPhpCodeFromDictFile(string $sDictFile): string + { $sPHP = file_get_contents($sDictFile); // Strip php tag to allow "eval" $sPHP = substr(trim($sPHP), strlen('fail("Failed to detect syntax error in dictionary `{$sDictFile}` (which is known as being INCORRECT)"); } - } - catch (Error $e) { + } catch (Error $e) { if ($bIsSyntaxValid) { $iLine = $e->getLine() - $iLineShift; $this->fail("Invalid dictionary: {$e->getMessage()} in {$sDictFile}:{$iLine}"); } - } - catch (Exception $e) { + } catch (Exception $e) { if ($bIsSyntaxValid) { $iLine = $e->getLine() - $iLineShift; $sExceptionClass = get_class($e); @@ -303,7 +307,8 @@ class DictionariesConsistencyTest extends ItopTestCase * * @since 3.0.5 3.1.2 3.2.0 N°7143 */ - public function testNoDictFileInDatamodelsModuleRootDirectory():void { + public function testNoDictFileInDatamodelsModuleRootDirectory(): void + { $sAppRoot = static::GetAppRoot(); $aDictFilesInDatamodelsModuleRootDir = glob($sAppRoot.'datamodels/2.x/*/*.dict*.php'); $this->assertNotFalse($aDictFilesInDatamodelsModuleRootDir, 'Searching for files returned an error'); @@ -311,7 +316,7 @@ class DictionariesConsistencyTest extends ItopTestCase $aExcludedModulesList = $this->GetLtsCompatibleModulesList(); $aDictFilesInDatamodelsModuleRootDir = array_filter( $aDictFilesInDatamodelsModuleRootDir, - function($sDictFileFullPath) use ($aExcludedModulesList) { + function ($sDictFileFullPath) use ($aExcludedModulesList) { $sModuleFullPath = dirname($sDictFileFullPath); $sModuleDirectory = basename($sModuleFullPath); return !in_array($sModuleDirectory, $aExcludedModulesList); @@ -319,7 +324,9 @@ class DictionariesConsistencyTest extends ItopTestCase ); $sDictFilesInDatamodelsModuleRootDirList = var_export($aDictFilesInDatamodelsModuleRootDir, true); - $this->assertCount(0, $aDictFilesInDatamodelsModuleRootDir, + $this->assertCount( + 0, + $aDictFilesInDatamodelsModuleRootDir, <<GetPhpCodeFromDictFile($sDictFileToTestFullPath); @@ -406,17 +415,18 @@ EOF * * @return void */ - public function testDictKeyDefinedOnceForWholeProject(string $sLang): void { + public function testDictKeyDefinedOnceForWholeProject(string $sLang): void + { $this->markTestSkipped("Skip because duplicates exists in modules, while once is installed at setup. Possible solution : centralize common string in another dictionnary, and then enable this test."); Dict::EnableLoadEntries(true); $aDictKeysDefinedMultipleTimes = []; - foreach ($this->DictionaryFileProvider() as $aDictFile) { - if($aDictFile['sLanguagePrefix'] !== $sLang) continue; - + if ($aDictFile['sLanguagePrefix'] !== $sLang) { + continue; + } Dict::ResetFileDuplicate(); $sDictFileToTestFullPath = $aDictFile['sDictFile']; @@ -426,21 +436,20 @@ EOF foreach (Dict::$aKeysDuplicate as $sDictKey => $iNumberOfDuplicates) { if (array_key_exists($sDictKey, $aDictKeysDefinedMultipleTimes)) { - $aDictKeysDefinedMultipleTimes[$sDictKey]+= $iNumberOfDuplicates; + $aDictKeysDefinedMultipleTimes[$sDictKey] += $iNumberOfDuplicates; } else { $aDictKeysDefinedMultipleTimes[$sDictKey] = $iNumberOfDuplicates; } } } - $aDictKeysDefinedMoreThanOnce = array_filter($aDictKeysDefinedMultipleTimes, static function($iNumberOfDuplicates) { + $aDictKeysDefinedMoreThanOnce = array_filter($aDictKeysDefinedMultipleTimes, static function ($iNumberOfDuplicates) { return $iNumberOfDuplicates > 0; }); - $this->assertEmpty($aDictKeysDefinedMoreThanOnce, "Some keys (". sizeof($aDictKeysDefinedMoreThanOnce).") are defined multiple times in the whole projectin lang $sLang: ".var_export($aDictKeysDefinedMoreThanOnce, true)); + $this->assertEmpty($aDictKeysDefinedMoreThanOnce, "Some keys (".sizeof($aDictKeysDefinedMoreThanOnce).") are defined multiple times in the whole projectin lang $sLang: ".var_export($aDictKeysDefinedMoreThanOnce, true)); } - - /** + /** * @dataProvider DictionaryFileProvider */ public function testNoRemainingTildesInTranslatedKeys(string $sDictFileToTestFullPath): void @@ -449,7 +458,6 @@ EOF $sReferenceLangCode = 'EN US'; $sReferenceDictName = 'en'; - $sDictFileToTestPhp = $this->GetPhpCodeFromDictFile($sDictFileToTestFullPath); eval($sDictFileToTestPhp); @@ -482,7 +490,6 @@ EOF $aLangToTestDictEntries = Dict::$m_aData[$sLanguageCodeToTest]; $aReferenceLangDictEntries = Dict::$m_aData[$sReferenceLangCode]; - $this->assertGreaterThan(0, count($aLangToTestDictEntries), 'There should be at least one entry in the dictionary file to test'); $aLangToTestDictEntriesNotEmptyValues = array_filter( $aLangToTestDictEntries, @@ -493,7 +500,6 @@ EOF ); $this->assertNotEmpty($aLangToTestDictEntriesNotEmptyValues); - $aTranslatedKeysWithTildes = []; foreach ($aReferenceLangDictEntries as $sDictKey => $sReferenceLangLabel) { if (false === array_key_exists($sDictKey, $aLangToTestDictEntries)) { @@ -522,13 +528,13 @@ EOF $sLanguageCodeToTest.'_file_location' => $this->MakeFilePathClickable($sDictFileToTestFullPath, $sDictKeyLineNumberInDictFileToTest), $sLanguageCodeToTest => $sTranslatedLabel, $sReferenceLangCode.'_file_location' => $this->MakeFilePathClickable($sDictFileReferenceFullPath, $sDictKeyLineNumberInDictFileReference), - $sReferenceLangCode => $sReferenceLangLabel + $sReferenceLangCode => $sReferenceLangLabel, ]; } $sPathRoot = static::GetAppRoot(); $sDictFileToTestRelativePath = str_replace($sPathRoot, '', $sDictFileToTestFullPath); - $this->assertEmpty($aTranslatedKeysWithTildes, "In {$sDictFileToTestRelativePath} \n following keys are different from their '{$sReferenceDictName}' counterpart (translated ?) but have tildes at the end:\n" . var_export($aTranslatedKeysWithTildes, true)); + $this->assertEmpty($aTranslatedKeysWithTildes, "In {$sDictFileToTestRelativePath} \n following keys are different from their '{$sReferenceDictName}' counterpart (translated ?) but have tildes at the end:\n".var_export($aTranslatedKeysWithTildes, true)); } /** @@ -538,18 +544,19 @@ EOF * @return string a path that is clickable in PHPStorm 🤩 * For this to happen we need full path with correct dir sep + line number * If it is not, check in File | Settings | Tools | Terminal the hyperlink option is checked - */ - private function MakeFilePathClickable(string $sFullPath, int $iLineNumber):string { - return str_replace(array('//', '/'), array('/', DIRECTORY_SEPARATOR), $sFullPath).':'.$iLineNumber; + */ + private function MakeFilePathClickable(string $sFullPath, int $iLineNumber): string + { + return str_replace(['//', '/'], ['/', DIRECTORY_SEPARATOR], $sFullPath).':'.$iLineNumber; } private function FindDictKeyLineNumberInContent(string $sFileContent, string $sDictKey): int { - $aContentLines = explode("\n", $sFileContent); + $aContentLines = explode("\n", $sFileContent); $sDictKeyToFind = "'{$sDictKey}'"; // adding string delimiters to match exact dict key (eg if not we would match 'Core:AttributeDateTime?SmartSearch' for 'Core:AttributeDateTime') - foreach($aContentLines as $iLineNumber => $line) { - if(strpos($line, $sDictKeyToFind) !== false){ + foreach ($aContentLines as $iLineNumber => $line) { + if (strpos($line, $sDictKeyToFind) !== false) { return $iLineNumber; } } @@ -576,7 +583,7 @@ EOF [ 'Español, Castellaño', // old value 'Español, Castellano', // new value since N°3635 - ] + ], ], 'fr' => ['FR FR', 'French', 'Français'], 'hu' => ['HU HU', 'Hungarian', 'Magyar'], diff --git a/tests/php-unit-tests/integration-tests/dictionaries-test/fr.dictionary.itop.core.OK.php b/tests/php-unit-tests/integration-tests/dictionaries-test/fr.dictionary.itop.core.OK.php index 0658e7c86..1257587cc 100644 --- a/tests/php-unit-tests/integration-tests/dictionaries-test/fr.dictionary.itop.core.OK.php +++ b/tests/php-unit-tests/integration-tests/dictionaries-test/fr.dictionary.itop.core.OK.php @@ -4,8 +4,8 @@ * @used-by \Combodo\iTop\Test\UnitTest\Integration\DictionariesConsistencyTest::testPlaygroundDictionariesPhpSyntax */ -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ 'MyDictKey1' => 'l\'échappement : bon exemple 1'.ITOP_APPLICATION, 'MyDictKey2' => 'l\'échappement : bon exemple 2', 'MyDictKey3' => 'l\'échappement : bon exemple 3', -)); +]); diff --git a/tests/php-unit-tests/integration-tests/iTopModulesPhpVersionChecklistTest.php b/tests/php-unit-tests/integration-tests/iTopModulesPhpVersionChecklistTest.php index 6ae1eb4ff..7f0a90916 100644 --- a/tests/php-unit-tests/integration-tests/iTopModulesPhpVersionChecklistTest.php +++ b/tests/php-unit-tests/integration-tests/iTopModulesPhpVersionChecklistTest.php @@ -1,4 +1,5 @@ GetItopModuleVersion($sPhpFile); - $this->assertSame($sExpectedVersion, $sActualVersion, - 'Module desc file does not contain the same version as the core: '.$sPhpFile); + $this->assertSame( + $sExpectedVersion, + $sActualVersion, + 'Module desc file does not contain the same version as the core: '.$sPhpFile + ); } self::assertEquals([], $aModuleWithError, 'Some modules have wrong versions ! They should match '.$sExpectedVersion); @@ -90,11 +96,11 @@ class iTopModulesPhpVersionIntegrationTest extends ItopTestCase { * @dataProvider ItopWikiVersionProvider * @since 2.7.7 3.0.1 3.1.1 N°4714 new ITOP_CORE_VERSION constant */ - public function testItopWikiVersion($sItopVersion, $sExpectedWikiVersion) { + public function testItopWikiVersion($sItopVersion, $sExpectedWikiVersion) + { try { $sActualWikiVersion = utils::GetItopVersionWikiSyntax($sItopVersion); - } - catch (ApplicationException $e) { + } catch (ApplicationException $e) { self::fail('Cannot get wiki version : '.$e->getMessage()); } self::assertSame($sExpectedWikiVersion, $sActualWikiVersion, 'Computed wiki version is wrong !'); diff --git a/tests/php-unit-tests/integration-tests/iTopModulesXmlVersionChecklistTest.php b/tests/php-unit-tests/integration-tests/iTopModulesXmlVersionChecklistTest.php index 21f77380b..047084b37 100644 --- a/tests/php-unit-tests/integration-tests/iTopModulesXmlVersionChecklistTest.php +++ b/tests/php-unit-tests/integration-tests/iTopModulesXmlVersionChecklistTest.php @@ -1,4 +1,5 @@ RequireOnceItopFile('setup/itopdesignformat.class.inc.php'); } - /** * Verify if the `datamodels/2.x/datamodel.*.xml` files refer to the latest version of the design * This is an integration test @@ -61,8 +60,11 @@ class iTopModulesXmlVersionIntegrationTest extends ItopTestCase if ($oFormat->Convert()) { // Compare the original and new format $sExpectedXmlVersion = ITOP_DESIGN_LATEST_VERSION; - $this->assertSame($oTransformedXml->saveXML(), $oOriginalXml->saveXML(), - "Datamodel file $sXmlFile:2 not in the latest format ($sExpectedXmlVersion)"); + $this->assertSame( + $oTransformedXml->saveXML(), + $oOriginalXml->saveXML(), + "Datamodel file $sXmlFile:2 not in the latest format ($sExpectedXmlVersion)" + ); } else { $this->fail("Failed to convert $sXmlFile into the latest format"); } @@ -80,11 +82,11 @@ class iTopModulesXmlVersionIntegrationTest extends ItopTestCase $aXmlFiles[] = $sAppRoot.'core/datamodel.core.xml'; $aXmlFiles[] = $sAppRoot.'application/datamodel.application.xml'; - $aTestCases = array(); + $aTestCases = []; foreach ($aXmlFiles as $sXmlFile) { - $aTestCases[$sXmlFile] = array( + $aTestCases[$sXmlFile] = [ 'sXmlFile' => $sXmlFile, - ); + ]; } return $aTestCases; diff --git a/tests/php-unit-tests/integration-tests/iTopXmlVersionChecklistTest.php b/tests/php-unit-tests/integration-tests/iTopXmlVersionChecklistTest.php index 4217df123..05da70703 100644 --- a/tests/php-unit-tests/integration-tests/iTopXmlVersionChecklistTest.php +++ b/tests/php-unit-tests/integration-tests/iTopXmlVersionChecklistTest.php @@ -1,4 +1,5 @@ RequireOnceItopFile('setup/itopdesignformat.class.inc.php'); } - /** * Verify if the latest version of the XML datamodel is aligned with the app. core version * This is an integration test diff --git a/tests/php-unit-tests/integration-tests/itop-hub-connector/AjaxPageTest.php b/tests/php-unit-tests/integration-tests/itop-hub-connector/AjaxPageTest.php index f9d8af0d2..ef433203c 100644 --- a/tests/php-unit-tests/integration-tests/itop-hub-connector/AjaxPageTest.php +++ b/tests/php-unit-tests/integration-tests/itop-hub-connector/AjaxPageTest.php @@ -1,14 +1,16 @@ assertNotNull($aRes, "Response should be a valid json, found instead:" . PHP_EOL . $sOutput); + $this->assertNotNull($aRes, "Response should be a valid json, found instead:".PHP_EOL.$sOutput); $this->assertEquals( [ 'code' => 0, - 'message' => 'Ok', - 'fields' => [] + 'message' => 'Ok', + 'fields' => [], ], $aRes ); @@ -73,4 +75,4 @@ class AjaxPageTest extends ItopDataTestCase { return $sOutput; } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/legacy-tests/GroupByAndFunctions.php b/tests/php-unit-tests/legacy-tests/GroupByAndFunctions.php index 4dbbaf8f6..aab4968fd 100644 --- a/tests/php-unit-tests/legacy-tests/GroupByAndFunctions.php +++ b/tests/php-unit-tests/legacy-tests/GroupByAndFunctions.php @@ -1,4 +1,5 @@ set_base(utils::GetAbsoluteUrlAppRoot().'tests/'); $oP->set_title('Grouping with functions'); $oP->add('

    Grouping with functions

    '); $oP->add('
    '); -try -{ - if (!empty($sOQL)) - { +try { + if (!empty($sOQL)) { // Getting class attributes $oSearch = DBSearch::FromOQL($sOQL); $aSearches = $oSearch->GetSearches(); - if ($oSearch instanceof DBUnionSearch) - { + if ($oSearch instanceof DBUnionSearch) { $sClass = $aSearches[0]->GetClassAlias(); $sRealClass = $aSearches[0]->GetClass(); - } - else - { + } else { $sClass = $oSearch->GetClassAlias(); $sRealClass = $oSearch->GetClass(); } @@ -74,22 +65,17 @@ try $sAttributesOptions3 = ''; $sAttributesOptions4 = ''; - foreach(array('_itop_sum_', '_itop_avg_', '_itop_min_', '_itop_max_', '_itop_count_', 'group1', 'group2') as $sAttCode) - { + foreach (['_itop_sum_', '_itop_avg_', '_itop_min_', '_itop_max_', '_itop_count_', 'group1', 'group2'] as $sAttCode) { $sAttributesOptions3 .= ''; $sAttributesOptions4 .= ''; } - foreach(MetaModel::ListAttributeDefs($sRealClass) as $sAttCode => $oAttDef) - { + foreach (MetaModel::ListAttributeDefs($sRealClass) as $sAttCode => $oAttDef) { // Skip this attribute if not defined in this table - if ($oSearch instanceof DBUnionSearch) - { - foreach($aSearches as $oSubQuery) - { + if ($oSearch instanceof DBUnionSearch) { + foreach ($aSearches as $oSubQuery) { $sSubClass = $oSubQuery->GetClass(); - if (!MetaModel::IsValidAttCode($sSubClass, $sAttCode)) - { + if (!MetaModel::IsValidAttCode($sSubClass, $sAttCode)) { continue 2; } } @@ -109,22 +95,17 @@ try $sFuncField = utils::ReadParam('funcfield', ''); $sFuncFieldOption = ''; - foreach(MetaModel::ListAttributeDefs($sRealClass) as $sAttCode => $oAttDef) - { + foreach (MetaModel::ListAttributeDefs($sRealClass) as $sAttCode => $oAttDef) { // Skip this attribute if not defined in this table - if ($oSearch instanceof DBUnionSearch) - { - foreach($aSearches as $oSubQuery) - { + if ($oSearch instanceof DBUnionSearch) { + foreach ($aSearches as $oSubQuery) { $sSubClass = $oSubQuery->GetClass(); - if (!MetaModel::IsValidAttCode($sSubClass, $sAttCode)) - { + if (!MetaModel::IsValidAttCode($sSubClass, $sAttCode)) { continue 2; } } } - switch (get_class($oAttDef)) - { + switch (get_class($oAttDef)) { case 'Integer': case 'AttributeDecimal': case 'AttributeDuration': @@ -135,9 +116,7 @@ try } } } -} -catch (Exception $e) -{ +} catch (Exception $e) { $oP->p('
    '.$e->getMessage().'
    '); $bError = true; } @@ -158,8 +137,7 @@ $oP->add( EOF ); -if (!empty($sOQL) && !$bError) -{ +if (!empty($sOQL) && !$bError) { $oP->add( << @@ -210,55 +188,46 @@ $oP->add(""); $sSQL = ''; - -if (empty($sOQL) || empty($sGroupBy1)) -{ +if (empty($sOQL) || empty($sGroupBy1)) { $oP->output(); return; } -try -{ +try { $iLimitStart = 0; - $aOrderBy = array(); - if (!empty($sOrderBy1)) - { + $aOrderBy = []; + if (!empty($sOrderBy1)) { $aOrderBy[$sOrderBy1] = ($sInvOrder1 != 'on'); } - if (!empty($sOrderBy2)) - { + if (!empty($sOrderBy2)) { $aOrderBy[$sOrderBy2] = ($sInvOrder2 != 'on'); } - $aGroupBy = array(); + $aGroupBy = []; $oExpr1 = Expression::FromOQL($sClass.'.'.$sGroupBy1); $aGroupBy["group1"] = $oExpr1; - if (!empty($sGroupBy2)) - { + if (!empty($sGroupBy2)) { $oExpr2 = Expression::FromOQL($sClass.'.'.$sGroupBy2); $aGroupBy["group2"] = $oExpr2; } - $aArgs = array(); + $aArgs = []; - if (empty($sFuncField)) - { - $aFunctions = array(); - } - else - { + if (empty($sFuncField)) { + $aFunctions = []; + } else { $oTimeExpr = Expression::FromOQL($sClass.'.'.$sFuncField); - $oSumExpr = new FunctionExpression('SUM', array($oTimeExpr)); - $oAvgExpr = new FunctionExpression('AVG', array($oTimeExpr)); - $oMinExpr = new FunctionExpression('MIN', array($oTimeExpr)); - $oMaxExpr = new FunctionExpression('MAX', array($oTimeExpr)); + $oSumExpr = new FunctionExpression('SUM', [$oTimeExpr]); + $oAvgExpr = new FunctionExpression('AVG', [$oTimeExpr]); + $oMinExpr = new FunctionExpression('MIN', [$oTimeExpr]); + $oMaxExpr = new FunctionExpression('MAX', [$oTimeExpr]); // Alias => Expression - $aFunctions = array( + $aFunctions = [ '_itop_sum_' => $oSumExpr, '_itop_avg_' => $oAvgExpr, '_itop_min_' => $oMinExpr, '_itop_max_' => $oMaxExpr, - ); + ]; } $sSQL = $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy, $iLimit, $iLimitStart); @@ -266,28 +235,23 @@ try $aRes = CMDBSource::QueryToArray($sSQL); // Display results - if (!empty($aRes)) - { + if (!empty($aRes)) { $oP->add('
    '); $oP->add(''); $aLine = $aRes[0]; - $aCols = array(); + $aCols = []; $oP->add(''); - foreach(array_keys($aLine) as $item) - { - if (!is_numeric($item)) - { + foreach (array_keys($aLine) as $item) { + if (!is_numeric($item)) { $aCols[] = $item; $oP->add(""); } } $oP->add(''); - foreach($aRes as $aLine) - { + foreach ($aRes as $aLine) { $oP->add(''); - foreach($aCols as $sCol) - { + foreach ($aCols as $sCol) { $oP->add(""); } $oP->add(''); @@ -295,14 +259,10 @@ try $oP->add('
    $item
    ".$aLine[$sCol]."
    '); $oP->add('
    '); - } - else - { + } else { $oP->add("

    No Result

    \n"); } -} -catch (Exception $e) -{ +} catch (Exception $e) { $oP->p('
    '.$e->getMessage().'
    '); $bError = true; } @@ -341,4 +301,4 @@ foreach($aClassSelection as $sClass) } } } -*/ \ No newline at end of file +*/ diff --git a/tests/php-unit-tests/legacy-tests/VerifyOQL.php b/tests/php-unit-tests/legacy-tests/VerifyOQL.php index 9e1fcaf1a..936f49e97 100644 --- a/tests/php-unit-tests/legacy-tests/VerifyOQL.php +++ b/tests/php-unit-tests/legacy-tests/VerifyOQL.php @@ -1,10 +1,10 @@ array( + $aExamples = [ + 'Pedagogic examples' => [ "Web applications" => "SELECT WebApplication", "Person having an 'A' in their name" => "SELECT Person AS B WHERE B.name LIKE '%A%'", "Servers having a name like dbserver1.demo.com or dbserver023.foo.fr" => "SELECT Server WHERE name REGEXP '^dbserver[0-9]+\\\\..+\\\\.[a-z]{2,3}$'", "Changes planned on new year's day" => "SELECT Change AS ch WHERE ch.start_date >= '2009-12-31' AND ch.end_date <= '2010-01-01'", "IPs in a range" => "SELECT DatacenterDevice AS dev WHERE INET_ATON(dev.managementip) > INET_ATON('10.22.32.224') AND INET_ATON(dev.managementip) < INET_ATON('10.22.32.255')", "Persons below a given root organization" => "SELECT Person AS P JOIN Organization AS Node ON P.org_id = Node.id JOIN Organization AS Root ON Node.parent_id BELOW Root.id WHERE Root.id=1", - ), - 'Usefull examples' => array( + ], + 'Usefull examples' => [ "NW interfaces of equipment in production for customer 'Demo'" => "SELECT PhysicalInterface AS if JOIN DatacenterDevice AS dev ON if.connectableci_id = dev.id WHERE dev.status = 'production' AND dev.organization_name = 'Demo'", "My tickets" => "SELECT Ticket AS t WHERE t.agent_id = :current_contact_id", "People being owner of an active ticket" => "SELECT Person AS p JOIN UserRequest AS u ON u.agent_id = p.id WHERE u.status != 'closed'", "Contracts terminating in the next thirty days" => "SELECT Contract AS c WHERE c.end_date > NOW() AND c.end_date < DATE_ADD(NOW(), INTERVAL 30 DAY)", "Orphan tickets (opened one hour ago, still not assigned)" => "SELECT UserRequest AS u WHERE u.start_date < DATE_SUB(NOW(), INTERVAL 60 MINUTE) AND u.status = 'new'", "Long lasting incidents (duration > 8 hours)" => "SELECT UserRequest AS u WHERE u.close_date > DATE_ADD(u.start_date, INTERVAL 8 HOUR)", - ), - ); + ], + ]; - $aDisplayData = array(); + $aDisplayData = []; $oAppContext = new ApplicationContext(); $sContext = $oAppContext->GetForForm(); - foreach ($aExamples as $sTopic => $aQueries) - { - foreach ($aQueries as $sDescription => $sOql) - { + foreach ($aExamples as $sTopic => $aQueries) { + foreach ($aQueries as $sDescription => $sOql) { $sHighlight = ''; $sDisable = ''; - if ($sOql == $sExpression) - { + if ($sOql == $sExpression) { // this one is currently being tested, highlight it $sHighlight = "background-color:yellow;"; $sDisable = 'disabled'; @@ -74,20 +71,19 @@ function ShowExamples($oP, $sExpression) $bUsingExample = true; } //$aDisplayData[$sTopic][] = array( - $aDisplayData[Dict::S('UI:RunQuery:QueryExamples')][] = array( + $aDisplayData[Dict::S('UI:RunQuery:QueryExamples')][] = [ 'desc' => "
    ".utils::EscapeHtml($sDescription)."
    ", 'oql' => "
    ".utils::EscapeHtml($sOql)."
    ", 'go' => "
    $sContext
    \n", - ); + ]; } } - $aDisplayConfig = array(); - $aDisplayConfig['desc'] = array('label' => Dict::S('UI:RunQuery:HeaderPurpose'), 'description' => Dict::S('UI:RunQuery:HeaderPurpose+')); - $aDisplayConfig['oql'] = array('label' => Dict::S('UI:RunQuery:HeaderOQLExpression'), 'description' => Dict::S('UI:RunQuery:HeaderOQLExpression+')); - $aDisplayConfig['go'] = array('label' => '', 'description' => ''); + $aDisplayConfig = []; + $aDisplayConfig['desc'] = ['label' => Dict::S('UI:RunQuery:HeaderPurpose'), 'description' => Dict::S('UI:RunQuery:HeaderPurpose+')]; + $aDisplayConfig['oql'] = ['label' => Dict::S('UI:RunQuery:HeaderOQLExpression'), 'description' => Dict::S('UI:RunQuery:HeaderOQLExpression+')]; + $aDisplayConfig['go'] = ['label' => '', 'description' => '']; - foreach ($aDisplayData as $sTopic => $aQueriesDisplayData) - { + foreach ($aDisplayData as $sTopic => $aQueriesDisplayData) { $bShowOpened = $bUsingExample; $oP->StartCollapsibleSection($sTopic, $bShowOpened); $oP->table($aDisplayConfig, $aQueriesDisplayData); @@ -107,10 +103,8 @@ $sEncoding = utils::ReadParam('encoding', 'oql'); ShowExamples($oP, $sExpression); -try -{ - if ($sEncoding == 'crypted') - { +try { + if ($sEncoding == 'crypted') { // Translate $sExpression into a oql expression $sClearText = base64_decode($sExpression); echo "FYI: '$sClearText'
    \n"; @@ -119,37 +113,27 @@ try } $oFilter = null; - $aArgs = array(); + $aArgs = []; $sSyntaxError = null; - if (!empty($sExpression)) - { - try - { + if (!empty($sExpression)) { + try { $oFilter = DBObjectSearch::FromOQL($sExpression); - } catch (Exception $e) - { - if ($e instanceof OqlException) - { + } catch (Exception $e) { + if ($e instanceof OqlException) { $sSyntaxError = $e->getHtmlDesc(); - } - else - { + } else { $sSyntaxError = $e->getMessage(); } } - if ($oFilter) - { - $aArgs = array(); - foreach ($oFilter->GetQueryParams() as $sParam => $foo) - { + if ($oFilter) { + $aArgs = []; + foreach ($oFilter->GetQueryParams() as $sParam => $foo) { $value = utils::ReadParam('arg_'.$sParam, null, true, 'raw_data'); - if (!is_null($value)) - { + if (!is_null($value)) { $aArgs[$sParam] = $value; - } - else { + } else { $aArgs[$sParam] = ''; } } @@ -160,7 +144,8 @@ try $oP->add("
    \n"); $oP->add(Dict::S('UI:RunQuery:ExpressionToEvaluate')."
    \n"); $oP->add("\n"); - $oP->add_ready_script(<<add_ready_script( + << 0) - { + if (count($aArgs) > 0) { $oP->add("
    \n"); $oP->add("

    Query arguments

    \n"); - foreach ($aArgs as $sParam => $sValue) - { + foreach ($aArgs as $sParam => $sValue) { $oP->p("$sParam: \n"); } $oP->add("
    \n"); @@ -185,9 +168,7 @@ JS $oP->add($oAppContext->GetForForm()); $oP->add("\n"); - - if ($oFilter) - { + if ($oFilter) { $oP->add("

    Query results

    \n"); $oResultBlock = new DisplayBlock($oFilter, 'list', false); @@ -197,19 +178,14 @@ JS //$iCount = $oResultBlock->GetDisplayedCount(); $sPageId = "ui-search-".$oFilter->GetClass(); $sLabel = MetaModel::GetName($oFilter->GetClass()); - $aArgs = array(); - foreach (array_merge($_POST, $_GET) as $sKey => $value) - { - if (is_array($value)) - { - $aItems = array(); - foreach ($value as $sItemKey => $sItemValue) - { + $aArgs = []; + foreach (array_merge($_POST, $_GET) as $sKey => $value) { + if (is_array($value)) { + $aItems = []; + foreach ($value as $sItemKey => $sItemValue) { $aArgs[] = $sKey.'['.$sItemKey.']='.urlencode($sItemValue); } - } - else - { + } else { $aArgs[] = $sKey.'='.urlencode($value); } } @@ -233,25 +209,21 @@ JS $oSQLObjectQueryBuilder = new SQLObjectQueryBuilder($oFilter); $oBuild = new QueryBuilderContext($oFilter, $aModifierProperties); $oSQLQueryCount = $oSQLObjectQueryBuilder->BuildSQLQueryStruct(null, true, $aModifierProperties); - $oP->p('
    '.$oSQLQueryCount->RenderSelect(array(), array(), 0, 0, true, true).'
    '); + $oP->p('
    '.$oSQLQueryCount->RenderSelect([], [], 0, 0, true, true).'
    '); $oP->EndCollapsibleSection(); $oP->StartCollapsibleSection('SQL'); $oSQLObjectQueryBuilder = new SQLObjectQueryBuilder($oFilter); $oBuild = new QueryBuilderContext($oFilter, $aModifierProperties); $oSQLQuery = $oSQLObjectQueryBuilder->BuildSQLQueryStruct(null, false, $aModifierProperties); - $oP->p('
    '.$oSQLQuery->RenderSelect(array(), array(), 10, 0, false, true).'
    '); + $oP->p('
    '.$oSQLQuery->RenderSelect([], [], 10, 0, false, true).'
    '); $oP->EndCollapsibleSection(); - } - elseif ($sSyntaxError) - { - if ($e instanceof OqlException) - { + } elseif ($sSyntaxError) { + if ($e instanceof OqlException) { $sWrongWord = $e->GetWrongWord(); $aSuggestedWords = $e->GetSuggestions(); - if (count($aSuggestedWords) > 0) - { + if (count($aSuggestedWords) > 0) { $sSuggestedWord = OqlException::FindClosestString($sWrongWord, $aSuggestedWords); if (strlen($sSuggestedWord) > 0) { @@ -262,26 +234,18 @@ JS $sFixedExpressionHtml = $sBefore.''.$sSuggestedWord.''.$sAfter; $oP->p("Suggesting: $sFixedExpressionHtml"); $oP->add(''); - } - else - { + } else { $oP->p(''.Dict::Format('UI:RunQuery:Error', $e->getHtmlDesc()).''); } - } - else - { + } else { $oP->p(''.Dict::Format('UI:RunQuery:Error', $e->getHtmlDesc()).''); } - } - else - { + } else { $oP->p(''.Dict::Format('UI:RunQuery:Error', $e->getMessage()).''); } } -} catch (Exception $e) -{ +} catch (Exception $e) { $oP->p(''.Dict::Format('UI:RunQuery:Error', $e->getMessage()).''); } $oP->output(); - diff --git a/tests/php-unit-tests/legacy-tests/benchmark.php b/tests/php-unit-tests/legacy-tests/benchmark.php index 32592d3d2..9f0d60fde 100644 --- a/tests/php-unit-tests/legacy-tests/benchmark.php +++ b/tests/php-unit-tests/legacy-tests/benchmark.php @@ -1,4 +1,5 @@ m_aRequested = array( + $this->m_aRequested = [ 'plannedcontacts' => $iPlannedContacts, 'plannedcontracts' => $iPlannedContracts, - ); - $this->m_aPlanned = array( + ]; + $this->m_aPlanned = [ 'Contacts' => $iPlannedContacts, 'Contracts' => $iPlannedContracts, 'Documents' => $iPlannedContracts * 2, - ); + ]; } public function PlanCis($iPlannedCIs) { - $this->m_aRequested = array( + $this->m_aRequested = [ 'plannedcis' => $iPlannedCIs, - ); + ]; $this->m_iIfByServer = 2; $this->m_iIfByNWDevice = 10; @@ -74,7 +75,7 @@ class BenchmarkDataCreation $iSolutions = ceil($iApplications / 2); $iProcesses = ceil($iSolutions / 2); - $this->m_aPlanned = array( + $this->m_aPlanned = [ 'Network devices' => $iNWDevices, 'Servers' => $iServers, 'Interfaces' => $iInterfaces, @@ -82,45 +83,43 @@ class BenchmarkDataCreation 'Applications' => $iApplications, 'Solutions' => $iSolutions, 'Processes' => $iProcesses, - ); + ]; } public function PlanTickets($iPlannedTickets, $iBigTicketCis) { - $this->m_aRequested = array( + $this->m_aRequested = [ 'plannedtickets' => $iPlannedTickets, 'plannedbigticketcis' => $iBigTicketCis, - ); + ]; - $this->m_aPlanned = array( + $this->m_aPlanned = [ 'Incidents' => ceil($iPlannedTickets / 2), 'Changes' => ceil($iPlannedTickets / 2), 'Big ticket: CIs' => $iBigTicketCis, - ); + ]; } public function ShowPlans($oP) { $oP->add("

    Planned creations

    \n"); $aPlanned = $this->m_aPlanned; - $aForm = array(); - foreach ($aPlanned as $sKey => $iCount) - { - $aForm[] = array( + $aForm = []; + foreach ($aPlanned as $sKey => $iCount) { + $aForm[] = [ 'label' => $sKey, 'input' => $iCount, - ); + ]; } $oP->form($aForm); } - + public function ShowForm($oP, $sNextOperation) { $aRequested = $this->m_aRequested; $oP->add("
    \n"); $oP->add("\n"); - foreach($this->m_aRequested as $sName => $sValue) - { + foreach ($this->m_aRequested as $sName => $sValue) { $oP->add("\n"); } $oP->add("\n"); @@ -132,10 +131,8 @@ class BenchmarkDataCreation $mu_t1 = MyHelpers::getmicrotime(); $oMyObject = MetaModel::NewObject($sClass); - foreach($aData as $sProp => $value) - { - if (is_array($value)) - { + foreach ($aData as $sProp => $value) { + if (is_array($value)) { // transform into a link set $sCSVSpec = implode('|', $value); $oAttDef = MetaModel::GetAttributeDef($sClass, $sProp); @@ -152,21 +149,19 @@ class BenchmarkDataCreation $mu_t2 = MyHelpers::getmicrotime(); $this->m_aStatsByClass[$sClass][] = $mu_t2 - $mu_t1; - + return $iId; } - static $m_aClassIdCache = array(); + public static $m_aClassIdCache = []; protected function GetClassIds($sClass) { - if (!isset(self::$m_aClassIdCache[$sClass])) - { + if (!isset(self::$m_aClassIdCache[$sClass])) { // Load the cache now - self::$m_aClassIdCache[$sClass] = array(); - + self::$m_aClassIdCache[$sClass] = []; + $oSet = new DBObjectSet(new DBObjectSearch($sClass)); - while($oObj = $oSet->Fetch()) - { + while ($oObj = $oSet->Fetch()) { self::$m_aClassIdCache[$sClass][] = $oObj->GetKey(); } } @@ -176,20 +171,18 @@ class BenchmarkDataCreation protected function RandomId($sClass, $sClassDesc = '') { $sClassId = "$sClass ($sClassDesc)"; - if (isset($this->m_aCreatedByDesc[$sClassId])) - { + if (isset($this->m_aCreatedByDesc[$sClassId])) { return $this->m_aCreatedByDesc[$sClassId][array_rand($this->m_aCreatedByDesc[$sClassId])]; } - + $aIds = self::GetClassIds($sClass); return $aIds[array_rand($aIds)]; } - static protected function FindId($sClass) + protected static function FindId($sClass) { $oSet = new DBObjectSet(new DBObjectSearch($sClass)); - if ($oSet->Count() < 1) - { + if ($oSet->Count() < 1) { return null; } @@ -197,11 +190,10 @@ class BenchmarkDataCreation return $oObj->GetKey(); } - static protected function FindIdFromOQL($sOQL) + protected static function FindIdFromOQL($sOQL) { $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL)); - if ($oSet->Count() < 1) - { + if ($oSet->Count() < 1) { return null; } @@ -211,22 +203,15 @@ class BenchmarkDataCreation protected function my_array_rand($aData, $iCount) { - if ($iCount == 0) - { - return array(); - } - elseif ($iCount == 1) - { + if ($iCount == 0) { + return []; + } elseif ($iCount == 1) { // array_rand() for one item returns only the key $key = array_rand($aData); - $aSample = array($key); - } - elseif ($iCount <= count($aData)) - { + $aSample = [$key]; + } elseif ($iCount <= count($aData)) { $aSample = array_rand($aData, $iCount); - } - else - { + } else { $aSample = array_merge(array_keys($aData), self::my_array_rand($aData, $iCount - count($aData))); } return $aSample; @@ -240,12 +225,11 @@ class BenchmarkDataCreation $aTargets = self::GetClassIds($sToClass); $aSample = self::my_array_rand($aTargets, $iCount); - foreach($aSample as $key) - { - $aData = array( + foreach ($aSample as $key) { + $aData = [ $sAttCodeFrom => $iFrom, $sAttCodeTo => $aTargets[$key], - ); + ]; $this->CreateObject($sLinkClass, $aData); } } @@ -253,158 +237,153 @@ class BenchmarkDataCreation public function CreateStructure($oP) { $aClasses = MetaModel::GetClasses(); - $aActions = array('Read', 'Bulk Read', 'Delete', 'Bulk Delete', 'Modify', 'Bulk Modify'); - $aStdProfiles = array(2, 3, 4, 5, 6, 7, 8, 9); + $aActions = ['Read', 'Bulk Read', 'Delete', 'Bulk Delete', 'Modify', 'Bulk Modify']; + $aStdProfiles = [2, 3, 4, 5, 6, 7, 8, 9]; //////////////////////////////////////// // New specific profile, giving access to everything // - $aData = array( + $aData = [ 'name' => 'Data guru', 'description' => 'Could do anything, because everything is granted', - ); + ]; $iGuruProfile = $this->CreateObject('URP_Profiles', $aData); - foreach($aClasses as $sClass) - { - foreach($aActions as $sAction) - { - $aData = array( + foreach ($aClasses as $sClass) { + foreach ($aActions as $sAction) { + $aData = [ 'profileid' => $iGuruProfile, 'class' => $sClass, 'permission' => 'yes', 'action' => $sAction, - ); + ]; $this->CreateObject('URP_ActionGrant', $aData); } } // User login with super access rights // - $aData = array( + $aData = [ 'org_id' => self::FindId('Organization'), 'location_id' => self::FindId('Location'), 'first_name' => 'Jesus', 'name' => 'Deus', 'email' => 'guru@combodo.com', - ); + ]; $iPerson = $this->CreateObject('Person', $aData); - $aData = array( + $aData = [ 'contactid' => $iPerson, 'login' => 'guru', 'password' => 'guru', 'language' => 'EN US', - 'profile_list' => array("profileid:$iGuruProfile;reason:he is the one"), - ); + 'profile_list' => ["profileid:$iGuruProfile;reason:he is the one"], + ]; $iLogin = $this->CreateObject('UserLocal', $aData); //////////////////////////////////////// // User login having all std profiles // - $aData = array( + $aData = [ 'org_id' => self::FindId('Organization'), 'location_id' => self::FindId('Location'), 'first_name' => 'Little ze', 'name' => 'Foo', 'email' => 'foo@combodo.com', - ); + ]; $iPerson = $this->CreateObject('Person', $aData); - $aProfileSet = array(); - foreach($aStdProfiles as $iProfileId) - { + $aProfileSet = []; + foreach ($aStdProfiles as $iProfileId) { $aProfileSet[] = "profileid:$iProfileId;reason:xxx"; } - $aData = array( + $aData = [ 'contactid' => $iPerson, 'login' => 'foo', 'password' => 'foo', 'language' => 'EN US', 'profile_list' => $aProfileSet, - ); + ]; $iLogin = $this->CreateObject('UserLocal', $aData); ///////////////////////// // // Organizations // - $aData = array( + $aData = [ 'name' => 'Benchmark', - ); + ]; $iOrg = $this->CreateObject('Organization', $aData); - + ///////////////////////// // // Locations // - $aData = array( + $aData = [ 'org_id' => $iOrg, 'name' => 'Rio de Janeiro', - ); + ]; $iLoc = $this->CreateObject('Location', $aData); - + ///////////////////////// // // Teams // - $aData = array( + $aData = [ 'org_id' => $iOrg, 'location_id' => $iLoc, 'name' => 'Fluminense', 'email' => 'fluminense@combodo.com', - ); + ]; $iTeam = $this->CreateObject('Team', $aData); - + ///////////////////////// // // Persons // - for($i = 0 ; $i < $this->m_aPlanned['Contacts'] ; $i++) - { - $aData = array( + for ($i = 0 ; $i < $this->m_aPlanned['Contacts'] ; $i++) { + $aData = [ 'org_id' => $iOrg, 'location_id' => $iLoc, 'first_name' => 'Joaõ', 'name' => 'Ningem #'.$i, 'email' => 'foo'.$i.'@nowhere.fr', - ); + ]; $iPerson = $this->CreateObject('Person', $aData); // Contract/Infra // - $aData = array( + $aData = [ 'contact_id' => $iPerson, 'team_id' => $this->RandomId('Team'), - ); + ]; $this->CreateObject('lnkTeamToContact', $aData); } - + ///////////////////////// // // Services // - $aData = array( + $aData = [ 'org_id' => $iOrg, 'name' => 'My Service', - ); + ]; $iService = $this->CreateObject('Service', $aData); ///////////////////////// // // Service subcategories // - $aData = array( + $aData = [ 'name' => 'My subcategory', 'service_id' => $iService, - ); + ]; $iOrg = $this->CreateObject('ServiceSubcategory', $aData); ///////////////////////// // // Contracts // - for($i = 0 ; $i < $this->m_aPlanned['Contracts'] ; $i++) - { - $aData = array( + for ($i = 0 ; $i < $this->m_aPlanned['Contracts'] ; $i++) { + $aData = [ 'name' => "Contract #$i", 'description' => 'Created for benchmarking purposes', 'org_id' => $this->RandomId('Organization'), @@ -412,19 +391,18 @@ class BenchmarkDataCreation 'start_date' => '2009-12-25', 'end_date' => '2019-08-01', 'support_team_id' => $this->RandomId('Team'), - ); + ]; $iContract = $this->CreateObject('CustomerContract', $aData); // Contract/Contact (10% of contacts) // $iContactCount = ceil($this->m_aPlanned['Contracts'] / 10); - for($iLinked = 0 ; $iLinked < $iContactCount ; $iLinked++) - { - $aData = array( + for ($iLinked = 0 ; $iLinked < $iContactCount ; $iLinked++) { + $aData = [ 'contact_id' => $this->RandomId('Person'), 'contract_id' => $iContract, 'role' => 'role '.$iLinked, - ); + ]; $this->CreateObject('lnkContractToContact', $aData); } } @@ -434,20 +412,18 @@ class BenchmarkDataCreation // Documents // $sMyDoc = ''; - for($i = 0 ; $i < 1000 ; $i++) - { + for ($i = 0 ; $i < 1000 ; $i++) { // 100 chars $sMyDoc .= "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678\n"; } $oRefDoc = new ormDocument($sMyDoc, 'text/plain'); - for($i = 0 ; $i < $this->m_aPlanned['Documents'] ; $i++) - { - $aData = array( + for ($i = 0 ; $i < $this->m_aPlanned['Documents'] ; $i++) { + $aData = [ 'org_id' => $iOrg, 'name' => "document$i", 'contents' => $oRefDoc, - ); + ]; $this->CreateObject('FileDoc', $aData); } } @@ -461,29 +437,27 @@ class BenchmarkDataCreation // // Servers // - for($i = 0 ; $i < $this->m_aPlanned['Servers'] ; $i++) - { - $aData = array( + for ($i = 0 ; $i < $this->m_aPlanned['Servers'] ; $i++) { + $aData = [ 'org_id' => $iOrg, 'location_id' => $iLoc, 'name' => 'server'.$i, 'status' => 'production', - ); + ]; $iServer = $this->CreateObject('Server', $aData); // Contract/Infra $this->CreateLinks($iServer, 1, 'lnkContractToCI', 'ci_id', 'contract_id'); // Interfaces - for($iLinked = 0 ; $iLinked < $this->m_iIfByServer ; $iLinked++) - { - $aData = array( + for ($iLinked = 0 ; $iLinked < $this->m_iIfByServer ; $iLinked++) { + $aData = [ 'name' => "eth$iLinked", 'status' => 'implementation', 'org_id' => $iOrg, 'device_id' => $iServer, 'status' => 'production', - ); + ]; $this->CreateObject('NetworkInterface', $aData, 'server if'); } } @@ -492,14 +466,13 @@ class BenchmarkDataCreation // // Network devices // - for($i = 0 ; $i < $this->m_aPlanned['Network devices'] ; $i++) - { - $aData = array( + for ($i = 0 ; $i < $this->m_aPlanned['Network devices'] ; $i++) { + $aData = [ 'org_id' => $iOrg, 'location_id' => $iLoc, 'name' => 'equipment #'.$i, 'status' => 'production', - ); + ]; $iNWDevice = $this->CreateObject('NetworkDevice', $aData); // Contract/Infra @@ -507,16 +480,15 @@ class BenchmarkDataCreation // Interfaces // - for($iLinked = 0 ; $iLinked < $this->m_iIfByNWDevice ; $iLinked++) - { - $aData = array( + for ($iLinked = 0 ; $iLinked < $this->m_iIfByNWDevice ; $iLinked++) { + $aData = [ 'name' => "eth$iLinked", 'status' => 'implementation', 'org_id' => $iOrg, 'device_id' => $iNWDevice, 'connected_if' => $this->RandomId('NetworkInterface', 'server if'), 'status' => 'production', - ); + ]; $this->CreateObject('NetworkInterface', $aData, 'equipment if'); } } @@ -525,11 +497,10 @@ class BenchmarkDataCreation // // Application Software // - for($i = 0 ; $i < $this->m_aPlanned['Application SW'] ; $i++) - { - $aData = array( + for ($i = 0 ; $i < $this->m_aPlanned['Application SW'] ; $i++) { + $aData = [ 'name' => 'Software #'.$i, - ); + ]; $iNWDevice = $this->CreateObject('Application', $aData); } @@ -537,15 +508,14 @@ class BenchmarkDataCreation // // Applications // - for($i = 0 ; $i < $this->m_aPlanned['Applications'] ; $i++) - { - $aData = array( + for ($i = 0 ; $i < $this->m_aPlanned['Applications'] ; $i++) { + $aData = [ 'org_id' => $iOrg, 'device_id' => $this->RandomId('Server'), 'software_id' => $this->RandomId('Application'), 'name' => 'Application #'.$i, 'status' => 'production', - ); + ]; $iAppInstance = $this->CreateObject('ApplicationInstance', $aData); // Contract/Infra @@ -556,13 +526,12 @@ class BenchmarkDataCreation // // Application Solution // - for($i = 0 ; $i < $this->m_aPlanned['Solutions'] ; $i++) - { - $aData = array( + for ($i = 0 ; $i < $this->m_aPlanned['Solutions'] ; $i++) { + $aData = [ 'org_id' => $iOrg, 'name' => 'Solution #'.$i, 'status' => 'production', - ); + ]; $iAppSolution = $this->CreateObject('ApplicationSolution', $aData); // Contract/Infra @@ -573,13 +542,12 @@ class BenchmarkDataCreation // // Business Process // - for($i = 0 ; $i < $this->m_aPlanned['Processes'] ; $i++) - { - $aData = array( + for ($i = 0 ; $i < $this->m_aPlanned['Processes'] ; $i++) { + $aData = [ 'org_id' => $iOrg, 'name' => 'Process #'.$i, 'status' => 'production', - ); + ]; $iProcess = $this->CreateObject('BusinessProcess', $aData); // Contract/Infra @@ -596,9 +564,8 @@ class BenchmarkDataCreation // // Incident Tickets // - for($i = 0 ; $i < $this->m_aPlanned['Incidents'] ; $i++) - { - $aData = array( + for ($i = 0 ; $i < $this->m_aPlanned['Incidents'] ; $i++) { + $aData = [ 'org_id' => $iOrg, 'caller_id' => $this->RandomId('Person'), 'workgroup_id' => $this->RandomId('Team'), @@ -608,7 +575,7 @@ class BenchmarkDataCreation 'title' => 'Incident #'.$i, 'description' => 'O que aconteceu?', 'ticket_log' => 'Testing...', - ); + ]; $iTicket = $this->CreateObject('Incident', $aData); // Incident/Infra @@ -624,7 +591,7 @@ class BenchmarkDataCreation // // Big Ticket // - $aData = array( + $aData = [ 'org_id' => $iOrg, 'caller_id' => $this->RandomId('Person'), 'workgroup_id' => $this->RandomId('Team'), @@ -634,7 +601,7 @@ class BenchmarkDataCreation 'title' => 'Big ticket', 'description' => 'O que aconteceu?', 'ticket_log' => 'Testing...', - ); + ]; $iTicket = $this->CreateObject('Incident', $aData); // Incident/Infra @@ -649,9 +616,8 @@ class BenchmarkDataCreation // // Change Tickets // - for($i = 0 ; $i < $this->m_aPlanned['Changes'] ; $i++) - { - $aData = array( + for ($i = 0 ; $i < $this->m_aPlanned['Changes'] ; $i++) { + $aData = [ 'org_id' => $iOrg, 'requestor_id' => $this->RandomId('Person'), 'workgroup_id' => $this->RandomId('Team'), @@ -662,13 +628,13 @@ class BenchmarkDataCreation 'manager_id' => $this->RandomId('Person'), 'title' => 'change #'.$i, 'description' => "Let's do something there", - ); + ]; $iTicket = $this->CreateObject('NormalChange', $aData); // Incident/Infra $iInfraCount = rand(1, 6); $this->CreateLinks($iTicket, $iInfraCount, 'lnkTicketToCI', 'ticket_id', 'ci_id'); - + // Incident/Infra $iContactCount = rand(1, 6); $this->CreateLinks($iTicket, $iContactCount, 'lnkTicketToContact', 'ticket_id', 'contact_id'); @@ -677,16 +643,15 @@ class BenchmarkDataCreation public function MakeFeedback($oP) { - foreach($this->m_aCreatedByClass as $sClass => $aClassIds) - { + foreach ($this->m_aCreatedByClass as $sClass => $aClassIds) { $iSample = reset($aClassIds); $sSample = "sample"; - + $iDuration = number_format(array_sum($this->m_aStatsByClass[$sClass]), 3); $fDurationMin = number_format(min($this->m_aStatsByClass[$sClass]), 3); $fDurationMax = number_format(max($this->m_aStatsByClass[$sClass]), 3); $fDurationAverage = number_format(array_sum($this->m_aStatsByClass[$sClass]) / count($this->m_aStatsByClass[$sClass]), 3); - + $oP->add("
      "); $oP->add("
    • "); $oP->add("$sClass: ".count($this->m_aStatsByClass[$sClass])." - $sSample
      "); @@ -699,7 +664,7 @@ class BenchmarkDataCreation /** * Ask the user what are the settings for the data load - */ + */ function DisplayStep1(SetupPage $oP) { $sNextOperation = 'step2'; @@ -707,17 +672,17 @@ function DisplayStep1(SetupPage $oP) $oP->add("\n"); $oP->add("
      Data load configuration\n"); - $aForm = array(); - $aForm[] = array( + $aForm = []; + $aForm[] = [ 'label' => "Contacts:", 'input' => "", 'help' => '', - ); - $aForm[] = array( + ]; + $aForm[] = [ 'label' => "Contracts:", 'input' => "", 'help' => '', - ); + ]; $oP->form($aForm); $oP->add("
      \n"); $oP->add("\n"); @@ -726,12 +691,12 @@ function DisplayStep1(SetupPage $oP) $oP->add("\n"); $oP->add("
      Data load configuration\n"); - $aForm = array(); - $aForm[] = array( + $aForm = []; + $aForm[] = [ 'label' => "Main CIs:", 'input' => "", 'help' => ' exclude interfaces, subnets or any other type of secondary CI', - ); + ]; $oP->form($aForm); $oP->add("
      \n"); $oP->add("\n"); @@ -740,17 +705,17 @@ function DisplayStep1(SetupPage $oP) $oP->add("\n"); $oP->add("
      Data load configuration\n"); - $aForm = array(); - $aForm[] = array( + $aForm = []; + $aForm[] = [ 'label' => "Tickets:", 'input' => "", 'help' => ' 50% incidents, 50% changes', - ); - $aForm[] = array( + ]; + $aForm[] = [ 'label' => "CIs for the big ticket:", 'input' => "", 'help' => 'Number of CI for the single big ticket', - ); + ]; $oP->form($aForm); $oP->add("
      \n"); $oP->add("\n"); @@ -758,7 +723,6 @@ function DisplayStep1(SetupPage $oP) $oP->add("
    • \n"); } - /** * Main program */ @@ -771,13 +735,11 @@ $oP = new SetupPage('iTop benchmark utility'); ExecutionKPI::EnableDuration(); $oKPI = new ExecutionKPI(); -try -{ - switch($sOperation) - { +try { + switch ($sOperation) { case 'step1': - DisplayStep1($oP); - break; + DisplayStep1($oP); + break; case 'create_structure': $oP->no_cache(); @@ -792,71 +754,66 @@ try break; case 'create_structure_go': - $oP->no_cache(); - $iPlannedContacts = Utils::ReadParam('plannedcontacts'); - $iPlannedContracts = Utils::ReadParam('plannedcontracts'); + $oP->no_cache(); + $iPlannedContacts = Utils::ReadParam('plannedcontacts'); + $iPlannedContracts = Utils::ReadParam('plannedcontracts'); - $oDataCreation = new BenchmarkDataCreation(); - $oDataCreation->PlanStructure($iPlannedContacts, $iPlannedContracts); - $oDataCreation->CreateStructure($oP); - $oDataCreation->MakeFeedback($oP); - break; + $oDataCreation = new BenchmarkDataCreation(); + $oDataCreation->PlanStructure($iPlannedContacts, $iPlannedContracts); + $oDataCreation->CreateStructure($oP); + $oDataCreation->MakeFeedback($oP); + break; case 'create_cis': - $oP->no_cache(); - $iPlannedCIs = Utils::ReadParam('plannedcis'); + $oP->no_cache(); + $iPlannedCIs = Utils::ReadParam('plannedcis'); - $oDataCreation = new BenchmarkDataCreation(); - $oDataCreation->PlanCis($iPlannedCIs); - $oDataCreation->ShowPlans($oP); - $oDataCreation->ShowForm($oP, 'create_cis_go'); - break; + $oDataCreation = new BenchmarkDataCreation(); + $oDataCreation->PlanCis($iPlannedCIs); + $oDataCreation->ShowPlans($oP); + $oDataCreation->ShowForm($oP, 'create_cis_go'); + break; case 'create_cis_go': - $oP->no_cache(); - $iPlannedCIs = Utils::ReadParam('plannedcis'); + $oP->no_cache(); + $iPlannedCIs = Utils::ReadParam('plannedcis'); - $oDataCreation = new BenchmarkDataCreation(); - $oDataCreation->PlanCis($iPlannedCIs); - $oDataCreation->CreateCis($oP); - $oDataCreation->MakeFeedback($oP); - break; + $oDataCreation = new BenchmarkDataCreation(); + $oDataCreation->PlanCis($iPlannedCIs); + $oDataCreation->CreateCis($oP); + $oDataCreation->MakeFeedback($oP); + break; case 'create_tickets': - $oP->no_cache(); - $iPlannedTickets = Utils::ReadParam('plannedtickets'); - $iBigTicketCis = Utils::ReadParam('plannedbigticketcis'); + $oP->no_cache(); + $iPlannedTickets = Utils::ReadParam('plannedtickets'); + $iBigTicketCis = Utils::ReadParam('plannedbigticketcis'); - $oDataCreation = new BenchmarkDataCreation(); - $oDataCreation->PlanTickets($iPlannedTickets, $iBigTicketCis); - $oDataCreation->ShowPlans($oP); - $oDataCreation->ShowForm($oP, 'create_tickets_go'); - break; + $oDataCreation = new BenchmarkDataCreation(); + $oDataCreation->PlanTickets($iPlannedTickets, $iBigTicketCis); + $oDataCreation->ShowPlans($oP); + $oDataCreation->ShowForm($oP, 'create_tickets_go'); + break; case 'create_tickets_go': - $oP->no_cache(); - $iPlannedTickets = Utils::ReadParam('plannedtickets'); - $iBigTicketCis = Utils::ReadParam('plannedbigticketcis'); + $oP->no_cache(); + $iPlannedTickets = Utils::ReadParam('plannedtickets'); + $iBigTicketCis = Utils::ReadParam('plannedbigticketcis'); - $oDataCreation = new BenchmarkDataCreation(); - $oDataCreation->PlanTickets($iPlannedTickets, $iBigTicketCis); - $oDataCreation->CreateTickets($oP); - $oDataCreation->MakeFeedback($oP); - break; + $oDataCreation = new BenchmarkDataCreation(); + $oDataCreation->PlanTickets($iPlannedTickets, $iBigTicketCis); + $oDataCreation->CreateTickets($oP); + $oDataCreation->MakeFeedback($oP); + break; default: - $oP->error("Error: unsupported operation '$sOperation'"); + $oP->error("Error: unsupported operation '$sOperation'"); } -} -catch(ZZException $e) -{ - $oP->error("Error: '".$e->getMessage()."'"); -} -catch(ZZCoreException $e) -{ - $oP->error("Error: '".$e->getHtmlDesc()."'"); +} catch (ZZException $e) { + $oP->error("Error: '".$e->getMessage()."'"); +} catch (ZZCoreException $e) { + $oP->error("Error: '".$e->getHtmlDesc()."'"); } $oKPI->ComputeAndReport('Total execution'); //DBSearch::RecordQueryTrace(); $oP->output(); -?> diff --git a/tests/php-unit-tests/legacy-tests/build_test_oql.php b/tests/php-unit-tests/legacy-tests/build_test_oql.php index 56fed1383..79037178d 100644 --- a/tests/php-unit-tests/legacy-tests/build_test_oql.php +++ b/tests/php-unit-tests/legacy-tests/build_test_oql.php @@ -1,4 +1,5 @@ File '$sTestFile' generated with ".($iCount-1000)." entries (from $iRead captured OQL).\n"; +echo "
      File '$sTestFile' generated with ".($iCount - 1000)." entries (from $iRead captured OQL).\n"; function ConvertArray($aArray) { - if (is_null($aArray)) - { + if (is_null($aArray)) { return 'null'; } - if (empty($aArray)) - { + if (empty($aArray)) { return 'array()'; } - return 'unserialize(\''.str_replace("'", "\\'",serialize($aArray)).'\')'; + return 'unserialize(\''.str_replace("'", "\\'", serialize($aArray)).'\')'; } diff --git a/tests/php-unit-tests/legacy-tests/config-test-farm.php b/tests/php-unit-tests/legacy-tests/config-test-farm.php index aec9a1916..b6f16dd3f 100644 --- a/tests/php-unit-tests/legacy-tests/config-test-farm.php +++ b/tests/php-unit-tests/legacy-tests/config-test-farm.php @@ -8,31 +8,29 @@ // The file is used in MetaModel::LoadConfig() which does all the necessary initialization job // -$MySettings = array( +$MySettings = [ 'db_host' => 'localhost', 'db_user' => 'root', 'db_pwd' => '', 'db_name' => 'TestFarm', 'db_subname' => '', // use it to differentiate two applications instances running on the same DB -); +]; // Modules: file names should be specified as a absolute paths -$MyModules = array( - 'application' => array ( +$MyModules = [ + 'application' => [ // '../core/event.class.inc.php', // '../core/action.class.inc.php', // '../core/trigger.class.inc.php', // to be continued... - ), - 'business' => array ( + ], + 'business' => [ '../business/test_farm.class.inc.php', // to be continued... - ), - 'addons' => array ( + ], + 'addons' => [ //'user rights' => '/addons/userrights/userrightsnull.class.inc.php', // or userrightsmatrix.class.inc.php // other modules to come later - ) -); - -?> + ], +]; diff --git a/tests/php-unit-tests/legacy-tests/replay_query_log.php b/tests/php-unit-tests/legacy-tests/replay_query_log.php index bdd468f07..d7a7efdc7 100644 --- a/tests/php-unit-tests/legacy-tests/replay_query_log.php +++ b/tests/php-unit-tests/legacy-tests/replay_query_log.php @@ -27,15 +27,11 @@ function LogResult($sString) function LogBenchmarkCSV() { - $aValues = array(); - foreach (func_get_args() as $arg) - { - if (is_string($arg)) - { + $aValues = []; + foreach (func_get_args() as $arg) { + if (is_string($arg)) { $aValues[] = '"'.str_replace('"', '""', $arg).'"'; - } - else - { + } else { $aValues[] = (string) $arg; } } @@ -47,18 +43,17 @@ class QueryLogEntry { public function __construct($aLogEntryId, $aLogEntryData) { - $this->aErrors = array(); + $this->aErrors = []; $this->sSql = ''; $this->MakeDuration = 0; $this->fExecDuration = 0; $this->iTableCount = 0; - $this->aRows = array(); + $this->aRows = []; $this->sLogId = $aLogEntryId; $this->sOql = $aLogEntryData['oql']; $this->sOqlHtml = htmlentities($this->sOql, ENT_QUOTES, 'UTF-8'); - $aQueryData = unserialize($aLogEntryData['data']); $this->oFilter = $aQueryData['filter']; $this->sClass = $this->oFilter->GetClass(); @@ -66,8 +61,7 @@ class QueryLogEntry $iRepeat = utils::ReadParam('repeat', 3); - if ($aQueryData['type'] == 'select') - { + if ($aQueryData['type'] == 'select') { $this->aOrderBy = $aQueryData['order_by']; $this->aAttToLoad = $aQueryData['att_to_load']; $this->aExtendedDataSpec = $aQueryData['extended_data_spec']; @@ -75,68 +69,50 @@ class QueryLogEntry $this->iLimitStart = $aQueryData['limit_start']; $this->bGetCount = $aQueryData['is_count']; - if ($this->bGetCount) - { + if ($this->bGetCount) { $this->sQueryType = 'COUNT'; $this->sQueryDesc = ''; - } - else - { + } else { $this->sQueryType = 'LIST'; $this->sQueryDesc = "limit count: $this->iLimitCount"; $this->sQueryDesc .= "; limit start: $this->iLimitStart"; - if (count($this->aOrderBy) > 0) - { + if (count($this->aOrderBy) > 0) { $this->sQueryDesc .= "; order by: ".implode(',', array_keys($this->aOrderBy)); } - if (is_array($this->aAttToLoad)) - { + if (is_array($this->aAttToLoad)) { $this->sQueryDesc .= "; attributes: ".implode(',', array_keys($this->aAttToLoad)); } } $fRefTime = MyHelpers::getmicrotime(); - try - { - for($i = 0 ; $i < $iRepeat ; $i++) - { + try { + for ($i = 0 ; $i < $iRepeat ; $i++) { $this->sSql = $this->oFilter->MakeSelectQuery($this->aOrderBy, $this->aArgs, $this->aAttToLoad, $this->aExtendedDataSpec, $this->iLimitCount, $this->iLimitStart, $this->bGetCount); } - } - catch(Exception $e) - { + } catch (Exception $e) { $this->aErrors[] = "Failed to create the SQL:".$e->getMessage(); } $this->fMakeDuration = (MyHelpers::getmicrotime() - $fRefTime) / $iRepeat; - } - elseif ($aQueryData['type'] == 'group_by') - { + } elseif ($aQueryData['type'] == 'group_by') { $this->aGroupByExpr = $aQueryData['group_by_expr']; $this->sQueryType = 'GROUP BY'; - $aGroupedBy = array(); - foreach ($this->aGroupByExpr as $oExpr) - { + $aGroupedBy = []; + foreach ($this->aGroupByExpr as $oExpr) { $aGroupedBy[] = $oExpr->RenderExpression(); } $this->sQueryDesc = implode(', ', $aGroupedBy); $fRefTime = MyHelpers::getmicrotime(); - try - { - for($i = 0 ; $i < $iRepeat ; $i++) - { + try { + for ($i = 0 ; $i < $iRepeat ; $i++) { $this->sSql = $this->oFilter->MakeGroupByQuery($this->aArgs, $this->aGroupByExpr); } - } - catch(Exception $e) - { + } catch (Exception $e) { $this->aErrors[] = "Failed to create the SQL:".$e->getMessage(); } $this->fMakeDuration = (MyHelpers::getmicrotime() - $fRefTime) / $iRepeat; - } - else - { + } else { // unsupported $this->sQueryType = 'ERROR'; $this->sQueryDesc = "Unkown type of query: ".$aQueryData['type']; @@ -145,44 +121,34 @@ class QueryLogEntry public function Exec() { - if ($this->sSql != '') - { + if ($this->sSql != '') { $iRepeat = utils::ReadParam('repeat', 3); - try - { + try { $resQuery = null; $fRefTime = MyHelpers::getmicrotime(); - for($i = 0 ; $i < $iRepeat ; $i++) - { + for ($i = 0 ; $i < $iRepeat ; $i++) { $resQuery = CMDBSource::Query($this->sSql); } $this->fExecDuration = (MyHelpers::getmicrotime() - $fRefTime) / $iRepeat; - // This is not relevant... - if (preg_match_all('|\s*JOIN\s*\(\s*`|', $this->sSql, $aMatches)) // JOIN (`mytable... - { + // This is not relevant... + if (preg_match_all('|\s*JOIN\s*\(\s*`|', $this->sSql, $aMatches)) { // JOIN (`mytable... $this->iTableCount = 1 + count($aMatches[0]); - } - else - { + } else { $this->iTableCount = 1; } - } - catch (Exception $e) - { + } catch (Exception $e) { $this->aErrors[] = "Failed to execute the SQL:".$e->getMessage(); } - if ($resQuery) - { - while ($aRow = CMDBSource::FetchArray($resQuery)) - { + if ($resQuery) { + while ($aRow = CMDBSource::FetchArray($resQuery)) { $this->aRows[] = $aRow; } CMDBSource::FreeResult($resQuery); } } } - + public function HasErrors() { return (count($this->aErrors) > 0); @@ -193,8 +159,7 @@ class QueryLogEntry $oP->p($this->sOqlHtml); $oP->p($this->sQueryType); $oP->p($this->sQueryDesc); - foreach ($this->aErrors as $sError) - { + foreach ($this->aErrors as $sError) { $oP->p($sError); } } @@ -217,7 +182,6 @@ LoginWebPage::DoLogin(); // Check user rights and prompt if needed $oP = new WebPage('Replay queries.log'); - ini_set('memory_limit', '512M'); require_once(APPROOT.'/data/queries.log'); @@ -226,131 +190,113 @@ $oP->p("Nombre de requêtes: ".$iCount); $sOperation = utils::ReadParam('operation', ''); -switch ($sOperation) -{ -case '': -default: - $oP->add("
        \n"); - foreach ($aQueriesLog as $sQueryId => $aOqlData) - { - $sOql = $aOqlData['oql']; - $sOqlHtml = htmlentities($sOql, ENT_QUOTES, 'UTF-8'); - $oP->add("
      1. $sOqlHtml zoom
      2. \n"); - } - $oP->add("
      \n"); - - $oP->add("
      \n"); - $oP->add("\n"); - $oP->add("
      \n"); - - $oP->add("
      \n"); - $oP->add("\n"); - $oP->add("
      \n"); - break; - -case 'zoom': - $sQueryId = utils::ReadParam('query', '', false, 'raw_data'); - $oP->add("

      Zoom on query

      \n"); - $oQuery = new QueryLogEntry($sQueryId, $aQueriesLog[$sQueryId]); - $oQuery->Exec(); - $oQuery->Display($oP); - - $oP->add("
      $oQuery->sSql
      \n"); - $oP->p("Tables: $oQuery->iTableCount"); - - if (strlen($oQuery->sSql) > 0) - { - $aExplain = CMDBSource::ExplainQuery($oQuery->sSql); - $oP->add("

      Explain

      \n"); - $oP->add("\n"); - foreach ($aExplain as $aRow) - { - $oP->add(" \n"); - $oP->add(" \n"); - $oP->add(" \n"); +switch ($sOperation) { + case '': + default: + $oP->add("
        \n"); + foreach ($aQueriesLog as $sQueryId => $aOqlData) { + $sOql = $aOqlData['oql']; + $sOqlHtml = htmlentities($sOql, ENT_QUOTES, 'UTF-8'); + $oP->add("
      1. $sOqlHtml zoom
      2. \n"); } - $oP->add("
      ".implode('', $aRow)."
      \n"); - } - - if (count($oQuery->aRows)) - { - $oP->add("

      Values

      \n"); - $oP->add("\n"); - foreach ($oQuery->aRows as $iRow => $aRow) - { - $oP->add(" \n"); - $oP->add(" \n"); - $oP->add(" \n"); - } - $oP->add("
      ".implode('', $aRow)."
      \n"); - } - else - { - $oP->p("No data"); - } - - break; + $oP->add("\n"); + $oP->add("
      \n"); + $oP->add("\n"); + $oP->add("
      \n"); -case 'check': - $oP->add("

      List queries in error

      \n"); - foreach ($aQueriesLog as $sQueryId => $aOqlData) - { - $oQuery = new QueryLogEntry($sQueryId, $aOqlData); + $oP->add("
      \n"); + $oP->add("\n"); + $oP->add("
      \n"); + break; + + case 'zoom': + $sQueryId = utils::ReadParam('query', '', false, 'raw_data'); + $oP->add("

      Zoom on query

      \n"); + $oQuery = new QueryLogEntry($sQueryId, $aQueriesLog[$sQueryId]); $oQuery->Exec(); - - if ($oQuery->HasErrors()) - { - $oQuery->Display($oP); - $oP->p("zoom"); + $oQuery->Display($oP); + + $oP->add("
      $oQuery->sSql
      \n"); + $oP->p("Tables: $oQuery->iTableCount"); + + if (strlen($oQuery->sSql) > 0) { + $aExplain = CMDBSource::ExplainQuery($oQuery->sSql); + $oP->add("

      Explain

      \n"); + $oP->add("\n"); + foreach ($aExplain as $aRow) { + $oP->add(" \n"); + $oP->add(" \n"); + $oP->add(" \n"); + } + $oP->add("
      ".implode('', $aRow)."
      \n"); } - } - break; - -case 'benchmark': - $oP->add("

      Create data/queries.xxx reports

      \n"); - // Reset the log contents - file_put_contents(APPROOT.'data/queries.results.log', date('Y-m-d H:i:s')."\n"); - file_put_contents(APPROOT.'data/queries.benchmark.csv', ''); - LogBenchmarkCSV('type', 'properties', 'make duration', 'class', 'tables', 'query length', 'exec duration', 'rows', 'oql'); - - $iErrors = 0; - - foreach ($aQueriesLog as $sQueryId => $aOqlData) - { - $oQuery = new QueryLogEntry($sQueryId, $aOqlData); - $oQuery->Exec(); - - LogResult('-----------------------------------------------------------'); - LogResult($oQuery->sOql); - LogResult($oQuery->sQueryType); - if (strlen($oQuery->sQueryDesc) > 0) - { - LogResult($oQuery->sQueryDesc); + if (count($oQuery->aRows)) { + $oP->add("

      Values

      \n"); + $oP->add("\n"); + foreach ($oQuery->aRows as $iRow => $aRow) { + $oP->add(" \n"); + $oP->add(" \n"); + $oP->add(" \n"); + } + $oP->add("
      ".implode('', $aRow)."
      \n"); + } else { + $oP->p("No data"); } - - if ($oQuery->HasErrors()) - { - foreach($oQuery->aErrors as $sError) - { - LogResult($sError); - $iErrors++; + + break; + + case 'check': + $oP->add("

      List queries in error

      \n"); + foreach ($aQueriesLog as $sQueryId => $aOqlData) { + $oQuery = new QueryLogEntry($sQueryId, $aOqlData); + $oQuery->Exec(); + + if ($oQuery->HasErrors()) { + $oQuery->Display($oP); + $oP->p("zoom"); } } - else - { - LogResult("row count = ".count($oQuery->aRows)); - foreach($oQuery->aRows as $iRow => $aRow) - { - LogResult("row: ".serialize($aRow)); - if ($iRow > 100) break; + break; + + case 'benchmark': + $oP->add("

      Create data/queries.xxx reports

      \n"); + // Reset the log contents + file_put_contents(APPROOT.'data/queries.results.log', date('Y-m-d H:i:s')."\n"); + file_put_contents(APPROOT.'data/queries.benchmark.csv', ''); + LogBenchmarkCSV('type', 'properties', 'make duration', 'class', 'tables', 'query length', 'exec duration', 'rows', 'oql'); + + $iErrors = 0; + + foreach ($aQueriesLog as $sQueryId => $aOqlData) { + $oQuery = new QueryLogEntry($sQueryId, $aOqlData); + $oQuery->Exec(); + + LogResult('-----------------------------------------------------------'); + LogResult($oQuery->sOql); + LogResult($oQuery->sQueryType); + if (strlen($oQuery->sQueryDesc) > 0) { + LogResult($oQuery->sQueryDesc); + } + + if ($oQuery->HasErrors()) { + foreach ($oQuery->aErrors as $sError) { + LogResult($sError); + $iErrors++; + } + } else { + LogResult("row count = ".count($oQuery->aRows)); + foreach ($oQuery->aRows as $iRow => $aRow) { + LogResult("row: ".serialize($aRow)); + if ($iRow > 100) { + break; + } + } + + LogBenchmarkCSV($oQuery->sQueryType, $oQuery->sQueryDesc, sprintf('%1.3f', round($oQuery->fMakeDuration, 3)), $oQuery->sClass, $oQuery->iTableCount, strlen($oQuery->sSql), sprintf('%1.4f', round($oQuery->fExecDuration, 4)), count($oQuery->aRows), $oQuery->sOql); } - - LogBenchmarkCSV($oQuery->sQueryType, $oQuery->sQueryDesc, sprintf('%1.3f', round($oQuery->fMakeDuration, 3)), $oQuery->sClass, $oQuery->iTableCount, strlen($oQuery->sSql), sprintf('%1.4f', round($oQuery->fExecDuration, 4)), count($oQuery->aRows), $oQuery->sOql); } - } } $oP->output(); -?> diff --git a/tests/php-unit-tests/legacy-tests/test.class.inc.php b/tests/php-unit-tests/legacy-tests/test.class.inc.php index fb29aac13..bb79c27ab 100644 --- a/tests/php-unit-tests/legacy-tests/test.class.inc.php +++ b/tests/php-unit-tests/legacy-tests/test.class.inc.php @@ -1,9 +1,10 @@ m_aSuccesses = array(); - $this->m_aWarnings = array(); - $this->m_aErrors = array(); + $this->m_aSuccesses = []; + $this->m_aWarnings = []; + $this->m_aErrors = []; } - static public function GetName() {return "fooname";} - static public function GetDescription(){return "foodesc";} + public static function GetName() + { + return "fooname"; + } + public static function GetDescription() + { + return "foodesc"; + } - protected function DoPrepare() {return true;} + protected function DoPrepare() + { + return true; + } abstract protected function DoExecute(); - protected function DoCleanup() {return true;} + protected function DoCleanup() + { + return true; + } protected static function DumpVariable($var) { - echo "
      \n"; 
      +		echo "
      \n";
       		print_r($var);
       		echo "
      \n"; } @@ -142,24 +152,25 @@ abstract class TestHandler { // Note: return false to call the default handler (stop the program if an error) - if ($errstr == 'assert()') $errno = E_USER_ERROR; + if ($errstr == 'assert()') { + $errno = E_USER_ERROR; + } - switch ($errno) - { - case E_USER_ERROR: - case E_WARNING: //(assertion failed) - $this->ReportError("$errfile@$errline - $errstr"); - break; - case E_USER_WARNING: - $this->ReportWarning("$errfile@$errline - $errstr"); - break; - case E_USER_NOTICE: - $this->ReportWarning("$errfile@$errline - $errstr"); - break; - default: - $this->ReportWarning("$errfile@$errline - Unknown error type: [$errno] $errstr"); - echo "Unknown error type: [$errno] $errstr in $errfile at $errline
      \n"; - break; + switch ($errno) { + case E_USER_ERROR: + case E_WARNING: //(assertion failed) + $this->ReportError("$errfile@$errline - $errstr"); + break; + case E_USER_WARNING: + $this->ReportWarning("$errfile@$errline - $errstr"); + break; + case E_USER_NOTICE: + $this->ReportWarning("$errfile@$errline - $errstr"); + break; + default: + $this->ReportWarning("$errfile@$errline - Unknown error type: [$errno] $errstr"); + echo "Unknown error type: [$errno] $errstr in $errfile at $errline
      \n"; + break; } return true; // do not call the default handler } @@ -167,24 +178,17 @@ abstract class TestHandler public function Execute() { ob_start(); - set_error_handler(array($this, 'error_handler')); - try - { + set_error_handler([$this, 'error_handler']); + try { $this->DoPrepare(); $this->DoExecute(); - } - catch (ExceptionFromError $e) - { + } catch (ExceptionFromError $e) { $this->ReportError($e->getMessage().' - '.$e->getTraceAsHtml()); - } - catch (CoreException $e) - { + } catch (CoreException $e) { //$this->ReportError($e->getMessage()); //$this->ReportError($e->__tostring()); $this->ReportError($e->getMessage().' - '.$e->getTraceAsHtml()); - } - catch (Exception $e) - { + } catch (Exception $e) { //$this->ReportError($e->getMessage()); //$this->ReportError($e->__tostring()); $this->ReportError('class '.get_class($e).' --- '.$e->getMessage().' - '.$e->getTraceAsString()); @@ -194,10 +198,10 @@ abstract class TestHandler return (count($this->GetErrors()) == 0); } - static protected function DoPostRequestAuth($sRelativeUrl, $aData, $sLogin = 'admin', $sPassword = 'admin', $sOptionnalHeaders = null) + protected static function DoPostRequestAuth($sRelativeUrl, $aData, $sLogin = 'admin', $sPassword = 'admin', $sOptionnalHeaders = null) { $aDataAndAuth = $aData; -// To be changed to use basic authentication + // To be changed to use basic authentication $aDataAndAuth['operation'] = 'login'; $aDataAndAuth['auth_user'] = $sLogin; $aDataAndAuth['auth_pwd'] = $sPassword; @@ -212,50 +216,41 @@ abstract class TestHandler // Source: http://netevil.org/blog/2006/nov/http-post-from-php-without-curl // originaly named after do_post_request // Partially adapted to our coding conventions - static protected function DoPostRequest($sUrl, $aData, $sOptionnalHeaders = null) + protected static function DoPostRequest($sUrl, $aData, $sOptionnalHeaders = null) { // $sOptionnalHeaders is a string containing additional HTTP headers that you would like to send in your request. $sData = http_build_query($aData); - $aParams = array('http' => array( + $aParams = ['http' => [ 'method' => 'POST', 'content' => $sData, - 'header'=> "Content-type: application/x-www-form-urlencoded\r\nContent-Length: ".strlen($sData)."\r\n", - )); - if ($sOptionnalHeaders !== null) - { + 'header' => "Content-type: application/x-www-form-urlencoded\r\nContent-Length: ".strlen($sData)."\r\n", + ]]; + if ($sOptionnalHeaders !== null) { $aParams['http']['header'] .= $sOptionnalHeaders; } $ctx = stream_context_create($aParams); $fp = @fopen($sUrl, 'rb', false, $ctx); - if (!$fp) - { + if (!$fp) { global $php_errormsg; - if (isset($php_errormsg)) - { + if (isset($php_errormsg)) { throw new Exception("Problem with $sUrl, $php_errormsg"); - } - else - { + } else { throw new Exception("Problem with $sUrl"); } } $response = @stream_get_contents($fp); - if ($response === false) - { + if ($response === false) { throw new Exception("Problem reading data from $sUrl, $php_errormsg"); } return $response; } } - - - /** - * Test to execute a piece of code (checks if an error occurs) + * Test to execute a piece of code (checks if an error occurs) * * @package iTopORM */ @@ -264,9 +259,8 @@ abstract class TestFunction extends TestHandler // simply overload DoExecute (temporary) } - /** - * Test to execute a piece of code (checks if an error occurs) + * Test to execute a piece of code (checks if an error occurs) * * @package iTopORM */ @@ -275,7 +269,7 @@ abstract class TestWebServices extends TestHandler } /** - * Test to execute a piece of code (checks if an error occurs) + * Test to execute a piece of code (checks if an error occurs) * * @package iTopORM */ @@ -283,60 +277,52 @@ abstract class TestSoapWebService extends TestHandler { // simply overload DoExecute (temporary) - function __construct() + public function __construct() { parent::__construct(); } } /** - * Test to check that a function outputs some values depending on its input + * Test to check that a function outputs some values depending on its input * * @package iTopORM */ abstract class TestFunctionInOut extends TestFunction { -// abstract static public function GetCallSpec(); // parameters to call_user_func -// abstract static public function GetInOut(); // array of input => output + // abstract static public function GetCallSpec(); // parameters to call_user_func + // abstract static public function GetInOut(); // array of input => output protected function DoExecute() { $aTests = $this->GetInOut(); - if (is_array($aTests)) - { - foreach ($aTests as $iTestId => $aTest) - { + if (is_array($aTests)) { + foreach ($aTests as $iTestId => $aTest) { $ret = call_user_func_array($this->GetCallSpec(), $aTest['args']); - if ($ret != $aTest['output']) - { + if ($ret != $aTest['output']) { // Note: to be improved to cope with non string parameters $this->ReportError("Found '$ret' while expecting '".$aTest['output']."'", $iTestId); - } - else - { + } else { $this->ReportSuccess("Found the expected output '$ret'", $iTestId); } } - } - else - { + } else { $ret = call_user_func($this->GetCallSpec()); $this->ReportSuccess('Finished successfully'); } } } - /** - * Test to check an URL (Searches for Error/Warning/Etc keywords) + * Test to check an URL (Searches for Error/Warning/Etc keywords) * * @package iTopORM */ abstract class TestUrl extends TestHandler { -// abstract static public function GetUrl(); -// abstract static public function GetErrorKeywords(); -// abstract static public function GetWarningKeywords(); + // abstract static public function GetUrl(); + // abstract static public function GetErrorKeywords(); + // abstract static public function GetWarningKeywords(); protected function DoExecute() { @@ -344,9 +330,8 @@ abstract class TestUrl extends TestHandler } } - /** - * Test to check a user management module + * Test to check a user management module * * @package iTopORM */ @@ -358,7 +343,6 @@ abstract class TestUserRights extends TestHandler } } - /** * Test to execute a scenario on a given DB * @@ -366,10 +350,10 @@ abstract class TestUserRights extends TestHandler */ abstract class TestScenarioOnDB extends TestHandler { -// abstract static public function GetDBHost(); -// abstract static public function GetDBUser(); -// abstract static public function GetDBPwd(); -// abstract static public function GetDBName(); + // abstract static public function GetDBHost(); + // abstract static public function GetDBUser(); + // abstract static public function GetDBPwd(); + // abstract static public function GetDBName(); protected function DoPrepare() { @@ -380,8 +364,7 @@ abstract class TestScenarioOnDB extends TestHandler CMDBSource::Init($sDBHost, $sDBUser, $sDBPwd); CMDBSource::SetCharacterSet(); - if (CMDBSource::IsDB($sDBName)) - { + if (CMDBSource::IsDB($sDBName)) { CMDBSource::DropDB($sDBName); } CMDBSource::CreateDB($sDBName); @@ -393,26 +376,28 @@ abstract class TestScenarioOnDB extends TestHandler } } - /** - * Test to use a business model on a given DB + * Test to use a business model on a given DB * * @package iTopORM */ abstract class TestBizModel extends TestHandler { -// abstract static public function GetDBSubName(); -// abstract static public function GetBusinessModelFile(); -// abstract static public function GetConfigFile(); + // abstract static public function GetDBSubName(); + // abstract static public function GetBusinessModelFile(); + // abstract static public function GetConfigFile(); - static public function GetConfigFile() {return 'conf/production/config-itop.php';} + public static function GetConfigFile() + { + return 'conf/production/config-itop.php'; + } protected function DoPrepare() { $sConfigFile = APPROOT.$this->GetConfigFile(); MetaModel::Startup($sConfigFile); -// #@# Temporary disabled by Romain -// MetaModel::CheckDefinitions(); + // #@# Temporary disabled by Romain + // MetaModel::CheckDefinitions(); // something here to create records... but that's another story } @@ -420,52 +405,45 @@ abstract class TestBizModel extends TestHandler protected $m_oChange; protected function GetCurrentChange() { - if (!isset($this->m_oChange)) - { - new CMDBChange(); + if (!isset($this->m_oChange)) { + new CMDBChange(); $oMyChange = MetaModel::NewObject("CMDBChange"); $oMyChange->Set("date", time()); $oMyChange->Set("userinfo", "Someone doing some tests"); $iChangeId = $oMyChange->DBInsertNoReload(); - $this->m_oChange = $oMyChange; + $this->m_oChange = $oMyChange; } return $this->m_oChange; } protected function ObjectToDB($oNew, $bReload = false) { - if ($bReload) - { + if ($bReload) { $iId = $oNew->DBInsert(); - } - else - { + } else { $iId = $oNew->DBInsertNoReload(); } return $iId; } - protected function UpdateObjectInDB($oObject) + protected function UpdateObjectInDB($oObject) { $oObject->DBUpdate(); } protected function ResetDB() { - if (MetaModel::DBExists(false)) - { + if (MetaModel::DBExists(false)) { MetaModel::DBDrop(); } MetaModel::DBCreate(); } - static protected function show_list($oObjectSet) + protected static function show_list($oObjectSet) { $oObjectSet->Rewind(); - $aData = array(); - while ($oItem = $oObjectSet->Fetch()) - { - $aValues = array(); - foreach(MetaModel::GetAttributesList(get_class($oItem)) as $sAttCode) - { + $aData = []; + while ($oItem = $oObjectSet->Fetch()) { + $aValues = []; + foreach (MetaModel::GetAttributesList(get_class($oItem)) as $sAttCode) { $aValues[$sAttCode] = $oItem->GetAsHTML($sAttCode); } //echo $oItem->GetKey()." => ".implode(", ", $aValues)."
      \n"; @@ -474,22 +452,21 @@ abstract class TestBizModel extends TestHandler echo MyHelpers::make_table_from_assoc_array($aData); } - static protected function search_and_show_list(DBSearch $oMyFilter) + protected static function search_and_show_list(DBSearch $oMyFilter) { $oObjSet = new CMDBObjectSet($oMyFilter); echo $oMyFilter->ToOQL()."' - Found ".$oObjSet->Count()." items.
      \n"; self::show_list($oObjSet); } - static protected function search_and_show_list_from_oql($sOQL) + protected static function search_and_show_list_from_oql($sOQL) { - echo $sOQL."...
      \n"; + echo $sOQL."...
      \n"; $oNewFilter = DBObjectSearch::FromOQL($sOQL); self::search_and_show_list($oNewFilter); } } - /** * Test to execute a scenario common to any business model (tries to build all the possible queries, etc.) * @@ -497,12 +474,12 @@ abstract class TestBizModel extends TestHandler */ abstract class TestBizModelGeneric extends TestBizModel { - static public function GetName() + public static function GetName() { return 'Full test on a given business model'; } - static public function GetDescription() + public static function GetDescription() { return 'Systematic tests: gets each and every existing class and tries every attribute, search filters, etc.'; } @@ -511,8 +488,7 @@ abstract class TestBizModelGeneric extends TestBizModel { parent::DoPrepare(); - if (!MetaModel::DBExists(false)) - { + if (!MetaModel::DBExists(false)) { MetaModel::DBCreate(); } // something here to create records... but that's another story @@ -520,12 +496,13 @@ abstract class TestBizModelGeneric extends TestBizModel protected function DoExecute() { - foreach(MetaModel::GetClasses() as $sClassName) - { - if (MetaModel::HasTable($sClassName)) continue; + foreach (MetaModel::GetClasses() as $sClassName) { + if (MetaModel::HasTable($sClassName)) { + continue; + } $oNobody = MetaModel::GetObject($sClassName, 123); - $oBaby = new $sClassName; + $oBaby = new $sClassName(); $oFilter = new DBObjectSearch($sClassName); // Challenge reversibility of OQL / filter object @@ -533,8 +510,7 @@ abstract class TestBizModelGeneric extends TestBizModel $sExpr1 = $oFilter->ToOQL(); $oNewFilter = DBObjectSearch::FromOQL($sExpr1); $sExpr2 = $oNewFilter->ToOQL(); - if ($sExpr1 != $sExpr2) - { + if ($sExpr1 != $sExpr2) { $this->ReportError("Found two different OQL expression out of the (same?) filter: $sExpr1 != $sExpr2"); } @@ -546,6 +522,3 @@ abstract class TestBizModelGeneric extends TestBizModel return true; } } - - -?> diff --git a/tests/php-unit-tests/legacy-tests/test.php b/tests/php-unit-tests/legacy-tests/test.php index d10a9fefd..003f75da0 100644 --- a/tests/php-unit-tests/legacy-tests/test.php +++ b/tests/php-unit-tests/legacy-tests/test.php @@ -33,8 +33,7 @@ line-height:100%; function ReadMandatoryParam($sName) { $value = utils::ReadParam($sName, null); - if (is_null($value)) - { + if (is_null($value)) { echo "

      Missing mandatory argument $sName

      "; exit; } @@ -45,12 +44,16 @@ function IsAValidTestClass($sClassName) { // Must be a child of TestHandler // - if (!is_subclass_of($sClassName, 'TestHandler')) return false; + if (!is_subclass_of($sClassName, 'TestHandler')) { + return false; + } // Must not be abstract // $oReflectionClass = new ReflectionClass($sClassName); - if (!$oReflectionClass->isInstantiable()) return false; + if (!$oReflectionClass->isInstantiable()) { + return false; + } return true; } @@ -64,17 +67,13 @@ function GetTestClassLine($sClassName) function DisplayEvents($aEvents, $sTitle) { echo "

      $sTitle

      \n"; - if (count($aEvents) > 0) - { + if (count($aEvents) > 0) { echo "
        \n"; - foreach ($aEvents as $sEvent) - { + foreach ($aEvents as $sEvent) { echo "
      • $sEvent
      • \n"; } echo "
      \n"; - } - else - { + } else { echo "

      none

      \n"; } } @@ -92,36 +91,30 @@ require_once('./testlist.inc.php'); require_once(APPROOT.'/core/cmdbobject.class.inc.php'); - $sTodo = utils::ReadParam("todo", ""); -if ($sTodo == '') -{ +if ($sTodo == '') { // Show the list of tests // echo "

      Existing tests

      \n"; echo "
        \n"; - foreach (get_declared_classes() as $sClassName) - { - if (!IsAValidTestClass($sClassName)) continue; - - $sName = call_user_func(array($sClassName, 'GetName')); - $sDescription = call_user_func(array($sClassName, 'GetDescription')); + foreach (get_declared_classes() as $sClassName) { + if (!IsAValidTestClass($sClassName)) { + continue; + } + + $sName = call_user_func([$sClassName, 'GetName']); + $sDescription = call_user_func([$sClassName, 'GetDescription']); echo "
      • $sName ($sDescription)
      • \n"; } echo "
      \n"; -} -else if ($sTodo == 'exec') -{ +} elseif ($sTodo == 'exec') { // Execute a test // $sTestClass = ReadMandatoryParam("testid"); - if (!IsAValidTestClass($sTestClass)) - { + if (!IsAValidTestClass($sTestClass)) { echo "

      Wrong value for testid, expecting a valid class name

      \n"; - } - else - { + } else { $oTest = new $sTestClass(); $iStartLine = GetTestClassLine($sTestClass); echo "

      Testing: ".$oTest->GetName()."

      \n"; @@ -129,19 +122,16 @@ else if ($sTodo == 'exec') $bRes = $oTest->Execute(); } -/* -MyHelpers::var_dump_html($oTest->GetResults()); -MyHelpers::var_dump_html($oTest->GetWarnings()); -MyHelpers::var_dump_html($oTest->GetErrors()); -*/ + /* + MyHelpers::var_dump_html($oTest->GetResults()); + MyHelpers::var_dump_html($oTest->GetWarnings()); + MyHelpers::var_dump_html($oTest->GetErrors()); + */ - if ($bRes) - { + if ($bRes) { echo "

      Success :-)

      \n"; DisplayEvents($oTest->GetResults(), 'Results'); - } - else - { + } else { echo "

      Failure :-(

      \n"; } DisplayEvents($oTest->GetErrors(), 'Errors'); @@ -153,10 +143,7 @@ MyHelpers::var_dump_html($oTest->GetErrors()); echo "
      \n"; echo $oTest->GetOutput(); echo "
      \n"; +} else { } -else -{ -} - ?> diff --git a/tests/php-unit-tests/legacy-tests/testlist.inc.php b/tests/php-unit-tests/legacy-tests/testlist.inc.php index d6b40cea9..63fe60678 100644 --- a/tests/php-unit-tests/legacy-tests/testlist.inc.php +++ b/tests/php-unit-tests/legacy-tests/testlist.inc.php @@ -1,9 +1,10 @@ Enum links"; self::DumpVariable(MetaModel::EnumReferencedClasses("cmdbTeam")); @@ -126,56 +129,53 @@ class TestMyBizModel extends TestBizModel self::DumpVariable(MetaModel::GetLinkClasses()); self::DumpVariable(MetaModel::GetLinkLabel("Liens_entre_contacts_et_workshop", "toworkshop")); } - - function test_list_attributes() + + public function test_list_attributes() { echo "

      List attributes

      "; - foreach(MetaModel::ListAttributeDefs("cmdbTeam") as $sAttCode=>$oAttDef) - { + foreach (MetaModel::ListAttributeDefs("cmdbTeam") as $sAttCode => $oAttDef) { echo $oAttDef->GetLabel()." / ".$oAttDef->GetDescription()." / ".$oAttDef->GetType()."
      \n"; } } - - function test_search() + + public function test_search() { echo "

      Two searches

      "; $oFilterAllDevs = new DBObjectSearch("cmdbTeam"); $oAllDevs = new DBObjectSet($oFilterAllDevs); - + echo "Found ".$oAllDevs->Count()." items.
      \n"; - while ($oDev = $oAllDevs->Fetch()) - { - $aValues = array(); - foreach(MetaModel::GetAttributesList($oAllDevs->GetClass()) as $sAttCode) - { + while ($oDev = $oAllDevs->Fetch()) { + $aValues = []; + foreach (MetaModel::GetAttributesList($oAllDevs->GetClass()) as $sAttCode) { $aValues[] = MetaModel::GetLabel(get_class($oDev), $sAttCode)." (".MetaModel::GetDescription(get_class($oDev), $sAttCode).") = ".$oDev->GetAsHTML($sAttCode); } echo $oDev->GetKey()." => ".implode(", ", $aValues)."
      \n"; } - + // a second one $oMyFilter = new DBObjectSearch("cmdbContact"); //$oMyFilter->AddCondition("name", "aii", "Finishes with"); $oMyFilter->AddCondition("name", "aii"); $this->search_and_show_list($oMyFilter); - + } - - function test_reload() + + public function test_reload() { echo "

      Reload

      "; $team = MetaModel::GetObject("cmdbContact", "2"); echo "Chargement de l'attribut headcount: {$team->Get("headcount")}
      \n"; self::DumpVariable($team); } - - function test_setattribute() + + public function test_setattribute() { echo "

      Set attribute and update

      "; /** @var cmdbTeam $team */ $team = MetaModel::GetObject("cmdbTeam", "2"); - $team->Set("headcount", rand(1,1000)); - $team->Set("email", "Luis ".rand(9,250)); + $team->Set("headcount", rand(1, 1000)); + $team->Set("email", "Luis ".rand(9, 250)); self::DumpVariable($team->ListChanges()); echo "New headcount = {$team->Get("headcount")}
      \n"; echo "Computed name = {$team->Get("name")}
      \n"; @@ -184,17 +184,17 @@ class TestMyBizModel extends TestBizModel //DBSearch::StartDebugQuery(); $team->DBUpdate(); //DBSearch::StopDebugQuery(); - + echo "

      Check the modified team

      "; $oTeam = MetaModel::GetObject("cmdbTeam", "2"); self::DumpVariable($oTeam); } - function test_newobject() + public function test_newobject() { echo "

      Create a new object (team)

      "; $oNewTeam = MetaModel::NewObject("cmdbTeam"); $oNewTeam->Set("name", "ekip2choc #".rand(1000, 2000)); - $oNewTeam->Set("email", "machin".rand(1,100)."@tnut.com"); + $oNewTeam->Set("email", "machin".rand(1, 100)."@tnut.com"); $oNewTeam->Set("email", null); $oNewTeam->Set("owner", "ITOP"); $oNewTeam->Set("headcount", "0".rand(38000, 38999)); // should be reset to an int value @@ -206,35 +206,34 @@ class TestMyBizModel extends TestBizModel echo "Deleted team: $iId
      "; self::DumpVariable($oTeam); } - - - function test_updatecolumn() + + public function test_updatecolumn() { $oMyChange = MetaModel::NewObject("CMDBChange"); $oMyChange->Set("date", time()); - $oMyChange->Set("userinfo", "test_updatecolumn / Made by robot #".rand(1,100)); + $oMyChange->Set("userinfo", "test_updatecolumn / Made by robot #".rand(1, 100)); $iChangeId = $oMyChange->DBInsert(); - - $sNewEmail = "updatecol".rand(9,250)."@quedlaballe.com"; + + $sNewEmail = "updatecol".rand(9, 250)."@quedlaballe.com"; echo "

      Update a the email: set to '$sNewEmail'

      "; $oMyFilter = new DBObjectSearch("cmdbContact"); $oMyFilter->AddCondition("name", "o", "Contains"); - + echo "Candidates before:
      "; $this->search_and_show_list($oMyFilter); - - MetaModel::BulkUpdateTracked($oMyChange, $oMyFilter, array("email" => $sNewEmail)); - + + MetaModel::BulkUpdateTracked($oMyChange, $oMyFilter, ["email" => $sNewEmail]); + echo "Candidates after:
      "; $this->search_and_show_list($oMyFilter); } - - function test_error() + + public function test_error() { trigger_error("Stop requested", E_USER_ERROR); } - - function test_changetracking() + + public function test_changetracking() { echo '

      Create a change

      '; /** @var CMDBChange $oMyChange * */ @@ -260,49 +259,49 @@ class TestMyBizModel extends TestBizModel echo "Deleted team: $iId
      "; self::DumpVariable($oTeam); } - - function test_zlist() + + public function test_zlist() { echo "

      Test ZLists

      "; $aZLists = MetaModel::EnumZLists(); - foreach ($aZLists as $sListCode) - { + foreach ($aZLists as $sListCode) { $aListInfos = MetaModel::GetZListInfo($sListCode); echo "

      List '".$sListCode."' (".$aListInfos["description"].") of type '".$aListInfos["type"]."'

      \n"; - - foreach (MetaModel::GetSubclasses("cmdbObjectHomeMade") as $sKlass) - { + + foreach (MetaModel::GetSubclasses("cmdbObjectHomeMade") as $sKlass) { $aItems = MetaModel::FlattenZlist(MetaModel::GetZListItems($sKlass, $sListCode)); - if (count($aItems) == 0) continue; - + if (count($aItems) == 0) { + continue; + } + echo "$sKlass - $sListCode : {".implode(", ", $aItems)."}
      \n"; } } - + echo "

      IsAttributeInZList()...

      "; echo "Liens_entre_contacts_et_workshop::ws_info in list1 ? ".(MetaModel::IsAttributeInZList("Liens_entre_contacts_et_workshop", "list1", "ws_info") ? "yes" : "no")."
      \n"; echo "Liens_entre_contacts_et_workshop::toworkshop in list1 ? ".(MetaModel::IsAttributeInZList("Liens_entre_contacts_et_workshop", "list1", "toworkshop") ? "yes" : "no")."
      \n"; - + } - - function test_pkey() + + public function test_pkey() { echo "

      Test search on pkey

      "; $sExpr1 = "SELECT cmdbContact WHERE id IN (40, 42)"; $sExpr2 = "SELECT cmdbContact WHERE IN NOT IN (40, 42)"; $this->search_and_show_list_from_oql($sExpr1); $this->search_and_show_list_from_oql($sExpr2); - + echo "Et maintenant, on fusionne....
      \n"; $oSet1 = new CMDBObjectSet(DBObjectSearch::FromOQL($sExpr1)); $oSet2 = new CMDBObjectSet(DBObjectSearch::FromOQL($sExpr2)); $oIntersect = $oSet1->CreateIntersect($oSet2); $oDelta = $oSet1->CreateDelta($oSet2); - + $oMerge = clone $oSet1; $oAppend->Append($oSet2); $oAppend->Append($oSet2); - + echo "Set1 - Found ".$oSet1->Count()." items.
      \n"; echo "Set2 - Found ".$oSet2->Count()." items.
      \n"; echo "Intersect - Found ".$oIntersect->Count()." items.
      \n"; @@ -310,51 +309,50 @@ class TestMyBizModel extends TestBizModel echo "Append - Found ".$oAppend->Count()." items.
      \n"; //$this->show_list($oObjSet); } - - function test_relations() + + public function test_relations() { echo "

      Test relations

      "; - + //self::DumpVariable(MetaModel::EnumRelationQueries("cmdbObjectHomeMade", "Potes")); self::DumpVariable(MetaModel::EnumRelationQueries("cmdbContact", "Potes")); - + $iMaxDepth = 9; echo "Max depth = $iMaxDepth
      \n"; - + $oObj = MetaModel::GetObject("cmdbContact", 18); $aRels = $oObj->GetRelatedObjectsDown("Potes", $iMaxDepth); echo $oObj->Get('name')." has some 'Potes'...
      \n"; - foreach ($aRels as $sClass => $aObjs) - { + foreach ($aRels as $sClass => $aObjs) { echo "$sClass, count = ".count($aObjs)." => ".implode(', ', array_keys($aObjs))."
      \n"; $oObjectSet = CMDBObjectSet::FromArray($sClass, $aObjs); $this->show_list($oObjectSet); } - + echo "

      Test relations - same results, by the mean of a OQL

      "; $this->search_and_show_list_from_oql("cmdbContact: RELATED (Potes, $iMaxDepth) TO (cmdbContact: pkey = 18)"); - + } - - function test_linkedset() + + public function test_linkedset() { echo "

      Linked set attributes

      \n"; $oObj = MetaModel::GetObject("cmdbContact", 18); - + echo "
      Current workshops
      \n"; $oSetWorkshopsCurr = $oObj->Get("myworkshops"); $this->show_list($oSetWorkshopsCurr); - + echo "
      Setting workshops
      \n"; $oNewLink = new cmdbLiens(); $oNewLink->Set('toworkshop', 2); $oNewLink->Set('function', 'mafonctioooon'); $oNewLink->Set('a1', 'tralala1'); $oNewLink->Set('a2', 'F7M'); - $oSetWorkshops = CMDBObjectSet::FromArray("cmdbLiens", array($oNewLink)); - $oObj->Set("myworkshops", $oSetWorkshops); + $oSetWorkshops = CMDBObjectSet::FromArray("cmdbLiens", [$oNewLink]); + $oObj->Set("myworkshops", $oSetWorkshops); $this->show_list($oSetWorkshops); - + echo "
      New workshops
      \n"; $oSetWorkshopsCurr = $oObj->Get("myworkshops"); $this->show_list($oSetWorkshopsCurr); @@ -362,26 +360,24 @@ class TestMyBizModel extends TestBizModel CMDBObject::SetTrackInfo('test_linkedset / Made by robot #'.rand(1, 100)); $oObj->DBUpdate(); $oObj = MetaModel::GetObject("cmdbContact", 18); - + echo "
      After the write
      \n"; $oSetWorkshopsCurr = $oObj->Get("myworkshops"); $this->show_list($oSetWorkshopsCurr); } - - function test_object_lifecycle() + + public function test_object_lifecycle() { echo "

      Test object lifecycle

      "; - - + self::DumpVariable(MetaModel::GetStateAttributeCode("cmdbContact")); self::DumpVariable(MetaModel::EnumStates("cmdbContact")); self::DumpVariable(MetaModel::EnumStimuli("cmdbContact")); - foreach(MetaModel::EnumStates("cmdbContact") as $sStateCode => $aStateDef) - { + foreach (MetaModel::EnumStates("cmdbContact") as $sStateCode => $aStateDef) { echo "

      Transition from $sStateCode

      \n"; self::DumpVariable(MetaModel::EnumTransitions("cmdbContact", $sStateCode)); } - + $oObj = MetaModel::GetObject("cmdbContact", 18); echo "Current state: ".$oObj->GetState()."... let's go to school..."; self::DumpVariable($oObj->EnumTransitions()); @@ -394,11 +390,10 @@ class TestMyBizModel extends TestBizModel $oObj->ApplyStimulus("raise"); // should give an error } - protected function DoExecute() { -// $this->ReportError("Found two different OQL expression out of the (same?) filter: $sExpr1 != $sExpr2"); -// $this->ReportSuccess('Found '.$oSet->Count()." objects of class $sClassName"); + // $this->ReportError("Found two different OQL expression out of the (same?) filter: $sExpr1 != $sExpr2"); + // $this->ReportSuccess('Found '.$oSet->Count()." objects of class $sClassName"); //$this->test_linksinfo(); //$this->test_list_attributes(); //$this->test_search(); @@ -417,19 +412,18 @@ class TestMyBizModel extends TestBizModel } } - /////////////////////////////////////////////////////////////////////////// // Test queries /////////////////////////////////////////////////////////////////////////// class TestItopEfficiency extends TestBizModel { - static public function GetName() + public static function GetName() { return 'Itop - benchmark'; } - static public function GetDescription() + public static function GetDescription() { return 'Measure time to perform the queries'; } @@ -439,24 +433,21 @@ class TestItopEfficiency extends TestBizModel echo "

      Testing query: $sOqlQuery

      "; $fStart = MyHelpers::getmicrotime(); - for($i=0 ; $i < COUNT_BENCHMARK ; $i++) - { + for ($i = 0 ; $i < COUNT_BENCHMARK ; $i++) { $oFilter = DBObjectSearch::FromOQL($sOqlQuery); } $fDuration = MyHelpers::getmicrotime() - $fStart; $fParsingDuration = $fDuration / COUNT_BENCHMARK; $fStart = MyHelpers::getmicrotime(); - for($i=0 ; $i < COUNT_BENCHMARK ; $i++) - { + for ($i = 0 ; $i < COUNT_BENCHMARK ; $i++) { $sSQL = $oFilter->MakeSelectQuery(); } $fDuration = MyHelpers::getmicrotime() - $fStart; $fBuildDuration = $fDuration / COUNT_BENCHMARK; $fStart = MyHelpers::getmicrotime(); - for($i=0 ; $i < COUNT_BENCHMARK ; $i++) - { + for ($i = 0 ; $i < COUNT_BENCHMARK ; $i++) { $res = CMDBSource::Query($sSQL); } $fDuration = MyHelpers::getmicrotime() - $fStart; @@ -471,8 +462,7 @@ class TestItopEfficiency extends TestBizModel $fFetchDuration = $fDuration; $fStart = MyHelpers::getmicrotime(); - for($i=0 ; $i < COUNT_BENCHMARK ; $i++) - { + for ($i = 0 ; $i < COUNT_BENCHMARK ; $i++) { $sOql = $oFilter->ToOQL(); } $fDuration = MyHelpers::getmicrotime() - $fStart; @@ -487,11 +477,10 @@ class TestItopEfficiency extends TestBizModel echo "
    \n"; // Everything but the ToOQL (wich is interesting, anyhow) - $fTotal = $fParsingDuration + $fBuildDuration + $fQueryDuration + $fFetchDuration; + $fTotal = $fParsingDuration + $fBuildDuration + $fQueryDuration + $fFetchDuration; - if ($fTotal == 0) - { - $aRet = array( + if ($fTotal == 0) { + $aRet = [ 'rows' => CMDBSource::NbRows($res), 'duration (s)' => '0 (negligeable)', 'parsing (%)' => '?', @@ -500,11 +489,9 @@ class TestItopEfficiency extends TestBizModel 'fetch (%)' => '?', 'to OQL (%)' => '?', 'parsing+build (%)' => '?', - ); - } - else - { - $aRet = array( + ]; + } else { + $aRet = [ 'rows' => CMDBSource::NbRows($res), 'duration (s)' => round($fTotal, 4), 'parsing (%)' => round(100 * $fParsingDuration / $fTotal, 1), @@ -513,17 +500,17 @@ class TestItopEfficiency extends TestBizModel 'fetch (%)' => round(100 * $fFetchDuration / $fTotal, 1), 'to OQL (%)' => round(100 * $fToOqlDuration / $fTotal, 1), 'parsing+build (%)' => round(100 * ($fParsingDuration + $fBuildDuration) / $fTotal, 1), - ); + ]; } return $aRet; } - + protected function DoExecute() { - define ('COUNT_BENCHMARK', 3); + define('COUNT_BENCHMARK', 3); echo "

    The test will be repeated ".COUNT_BENCHMARK." times

    "; - $aQueries = array( + $aQueries = [ 'SELECT CMDBChangeOpSetAttribute', 'SELECT CMDBChangeOpSetAttribute WHERE id=10', 'SELECT CMDBChangeOpSetAttribute WHERE id=123456789', @@ -535,21 +522,18 @@ class TestItopEfficiency extends TestBizModel 'SELECT Server', 'SELECT Server WHERE id=1', 'SELECT UserRequest JOIN Person ON UserRequest.agent_id = Person.id WHERE Person.id = 5', - ); - $aStats = array(); - foreach ($aQueries as $sOQL) - { + ]; + $aStats = []; + foreach ($aQueries as $sOQL) { $aStats[$sOQL] = $this->DoBenchmark($sOQL); } - $aData = array(); - foreach ($aStats as $sOQL => $aResults) - { - $aValues = array(); + $aData = []; + foreach ($aStats as $sOQL => $aResults) { + $aValues = []; $aValues['OQL'] = htmlentities($sOQL, ENT_QUOTES, 'UTF-8'); - foreach($aResults as $sDesc => $sInfo) - { + foreach ($aResults as $sDesc => $sInfo) { $aValues[$sDesc] = htmlentities($sInfo, ENT_QUOTES, 'UTF-8'); } $aData[] = $aValues; @@ -564,12 +548,12 @@ class TestItopEfficiency extends TestBizModel class TestQueries extends TestBizModel { - static public function GetName() + public static function GetName() { return 'Itop - queries'; } - static public function GetDescription() + public static function GetDescription() { return 'Try as many queries as possible'; } @@ -607,9 +591,8 @@ class TestQueries extends TestBizModel // Everything but the ToOQL (which is interesting, anyhow) $fTotal = $fParsingDuration + $fBuildDuration + $fQueryDuration + $fFetchDuration; - if ($fTotal == 0) - { - $aRet = array( + if ($fTotal == 0) { + $aRet = [ 'rows' => CMDBSource::NbRows($res), 'duration (s)' => '0 (negligeable)', 'parsing (%)' => '?', @@ -619,11 +602,9 @@ class TestQueries extends TestBizModel 'to OQL (%)' => '?', 'parsing+build (%)' => '?', 'joins' => $iJoins, - ); - } - else - { - $aRet = array( + ]; + } else { + $aRet = [ 'rows' => CMDBSource::NbRows($res), 'duration (s)' => round($fTotal, 4), 'parsing (%)' => round(100 * $fParsingDuration / $fTotal, 1), @@ -633,33 +614,29 @@ class TestQueries extends TestBizModel 'to OQL (%)' => round(100 * $fToOqlDuration / $fTotal, 1), 'parsing+build (%)' => round(100 * ($fParsingDuration + $fBuildDuration) / $fTotal, 1), 'joins' => $iJoins, - ); + ]; } return $aRet; } - + protected function DoExecute() { - $aQueries = array(); - foreach (MetaModel::GetClasses() as $sClass) - { + $aQueries = []; + foreach (MetaModel::GetClasses() as $sClass) { $aQueries[] = 'SELECT '.$sClass; $aQueries[] = 'SELECT '.$sClass.' WHERE id = 1'; - } - $aStats = array(); - foreach ($aQueries as $sOQL) - { + } + $aStats = []; + foreach ($aQueries as $sOQL) { $aStats[$sOQL] = $this->DoBenchmark($sOQL); } - $aData = array(); - foreach ($aStats as $sOQL => $aResults) - { - $aValues = array(); + $aData = []; + foreach ($aStats as $sOQL => $aResults) { + $aValues = []; $aValues['OQL'] = htmlentities($sOQL, ENT_QUOTES, 'UTF-8'); - foreach($aResults as $sDesc => $sInfo) - { + foreach ($aResults as $sDesc => $sInfo) { $aValues[$sDesc] = htmlentities($sInfo, ENT_QUOTES, 'UTF-8'); } $aData[] = $aValues; @@ -674,12 +651,12 @@ class TestQueries extends TestBizModel class TestQueriesByAPI extends TestBizModel { - static public function GetName() + public static function GetName() { return 'Itop - queries build programmaticaly'; } - static public function GetDescription() + public static function GetDescription() { return 'Validate the DBObjectSearch API, through a set of complex (though realistic cases)'; } @@ -687,14 +664,14 @@ class TestQueriesByAPI extends TestBizModel protected function DoExecute() { // Note: relying on eval() - after upgrading to PHP 5.3 we can move to closure (aka anonymous functions) - $aQueries = array( - 'Basic (validate the test)' => array( + $aQueries = [ + 'Basic (validate the test)' => [ 'search' => ' $oSearch = DBObjectSearch::FromOQL("SELECT P FROM Organization AS O JOIN Person AS P ON P.org_id = O.id WHERE org_id = 2"); ', - 'oql' => 'SELECT P FROM Organization AS O JOIN Person AS P ON P.org_id = O.id WHERE P.org_id = 2' - ), - 'Double constraint' => array( + 'oql' => 'SELECT P FROM Organization AS O JOIN Person AS P ON P.org_id = O.id WHERE P.org_id = 2', + ], + 'Double constraint' => [ 'search' => ' $oSearch = DBObjectSearch::FromOQL("SELECT Contact AS c"); $sClass = $oSearch->GetClass(); @@ -724,26 +701,24 @@ if ($oAttDef->IsExternalKey()) } } ', - 'oql' => 'SELECT Contact AS C JOIN Organization ???' - ), - 'Simplified issue' => array( + 'oql' => 'SELECT Contact AS C JOIN Organization ???', + ], + 'Simplified issue' => [ 'search' => ' $oSearch = DBObjectSearch::FromOQL("SELECT P FROM Organization AS O JOIN Person AS P ON P.org_id = O.id WHERE O.id = 2"); $oOrgSearch = new DBObjectSearch("Organization", "O2"); $oOrgSearch->AddCondition("id", 2); $oSearch->AddCondition_PointingTo($oOrgSearch, "org_id"); ', - 'oql' => 'SELECT P FROM Organization AS O JOIN Person AS P ON P.org_id = O.id JOIN Organization AS O2 ON P.org_id = O2.id WHERE O.id = 2 AND O2.id = 2' - ), - ); - foreach ($aQueries as $sQueryDesc => $aQuerySpec) - { + 'oql' => 'SELECT P FROM Organization AS O JOIN Person AS P ON P.org_id = O.id JOIN Organization AS O2 ON P.org_id = O2.id WHERE O.id = 2 AND O2.id = 2', + ], + ]; + foreach ($aQueries as $sQueryDesc => $aQuerySpec) { echo "

    Query $sQueryDesc

    \n"; echo "

    Using code: ".highlight_string("', true)."

    \n"; echo "

    Expected OQL: ".$aQuerySpec['oql']."

    \n"; - if (isset($oSearch)) - { + if (isset($oSearch)) { unset($oSearch); } eval($aQuerySpec['search']); @@ -756,12 +731,11 @@ $oSearch->AddCondition_PointingTo($oOrgSearch, "org_id"); $sSQL = $oSearch->MakeSelectQuery(); $res = CMDBSource::Query($sSQL); - foreach (CMDBSource::ExplainQuery($sSQL) as $aRow) - { + foreach (CMDBSource::ExplainQuery($sSQL) as $aRow) { } } -// throw new UnitTestException("Expecting result '{$aWebService['expected result']}', but got '$res'"); + // throw new UnitTestException("Expecting result '{$aWebService['expected result']}', but got '$res'"); } } @@ -772,12 +746,12 @@ $oSearch->AddCondition_PointingTo($oOrgSearch, "org_id"); class TestImportREST extends TestWebServices { - static public function GetName() + public static function GetName() { return 'CSV import (REST)'; } - static public function GetDescription() + public static function GetDescription() { return 'Test various options and fonctionality of import.php'; } @@ -787,21 +761,17 @@ class TestImportREST extends TestWebServices $sCsvData = $aLoadSpec['csvdata']; echo "
    \n"; - if (is_null($iTestId)) - { + if (is_null($iTestId)) { echo "

    {$aLoadSpec['desc']}

    \n"; - } - else - { + } else { echo "

    $iTestId - {$aLoadSpec['desc']}

    \n"; } - $aPostData = array('csvdata' => $sCsvData); + $aPostData = ['csvdata' => $sCsvData]; - $aGetParams = array(); - $aGetParamReport = array(); - foreach($aLoadSpec['args'] as $sArg => $sValue) - { + $aGetParams = []; + $aGetParamReport = []; + foreach ($aLoadSpec['args'] as $sArg => $sValue) { $aGetParams[] = $sArg.'='.urlencode($sValue); $aGetParamReport[] = $sArg.'='.$sValue; } @@ -813,12 +783,9 @@ class TestImportREST extends TestWebServices $sArguments = implode('
    ', $aGetParamReport); - if (strlen($sCsvData) > 5000) - { + if (strlen($sCsvData) > 5000) { $sCsvDataViewable = 'INPUT TOO LONG TO BE DISPLAYED ('.strlen($sCsvData).")\n".substr($sCsvData, 0, 500)."\n... TO BE CONTINUED"; - } - else - { + } else { $sCsvDataViewable = $sCsvData; } @@ -835,379 +802,374 @@ class TestImportREST extends TestWebServices echo "
    \n"; } - + protected function DoExecute() { - $aLoads = array( - array( + $aLoads = [ + [ 'desc' => 'Missing class', 'login' => 'admin', 'password' => 'admin', - 'args' => array( - ), + 'args' => [ + ], 'csvdata' => "xxx", - ), - array( + ], + [ 'desc' => 'Wrong class', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'toto', - ), + ], 'csvdata' => "xxx", - ), - array( + ], + [ 'desc' => 'Wrong output type', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'NetworkDevice', 'output' => 'onthefly', - ), + ], 'csvdata' => "xxx", - ), - array( + ], + [ 'desc' => 'Weird format, working anyhow...', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Server', 'output' => 'details', 'separator' => '*', 'qualifier' => '@', 'reconciliationkeys' => 'org_id,name', - ), + ], 'csvdata' => 'name*org_id server01*2 @server02@@combodo@* 2 server45*99', - ), - array( + ], + [ 'desc' => 'Load an organization', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Organization', 'output' => 'details', 'separator' => ';', 'reconciliationkeys' => '', - ), + ], 'csvdata' => "name;code\nWorldCompany;WCY", - ), - array( + ], + [ 'desc' => 'Load a location', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'details', 'separator' => ';', 'reconciliationkeys' => '', - ), + ], 'csvdata' => "name;org_id;address\nParis;1;Centre de la Franca", - ), - array( + ], + [ 'desc' => 'Load a person', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Person', 'output' => 'details', 'separator' => ';', 'reconciliationkeys' => '', - ), + ], 'csvdata' => "email;name;first_name;org_id;phone\njohn.foo@starac.com;Foo;John;1;+33(1)23456789", - ), - array( + ], + [ 'desc' => 'Load a person - wrong email format', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Person', 'output' => 'details', 'separator' => ';', 'reconciliationkeys' => '', - ), + ], 'csvdata' => "email;name;first_name;org_id\nemailPASbon;Foo;John;1", - ), - array( + ], + [ 'desc' => 'Load a team', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Team', 'output' => 'details', 'separator' => ';', 'reconciliationkeys' => '', - ), + ], 'csvdata' => "name;org_id;location_name\nSquadra Azzura2;1;Paris", - ), - array( + ], + [ 'desc' => 'Load server', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Server', 'output' => 'details', 'separator' => ';', 'reconciliationkeys' => '', - ), + ], 'csvdata' => "name;status;owner_name;location_name;location_id->org_name;os_family;os_version;management_ip;cpu;ram;brand;model;serial_number\nlocalhost.;production;Demo;Grenoble;Demo;Ubuntu 9.10;2.6.31-19-generic-#56-Ubuntu SMP Thu Jan 28 01:26:53 UTC 2010;16.16.230.232;Intel(R) Core(TM)2 Duo CPU T7100 @ 1.80GHz;2005;Hewlett-Packard;HP Compaq 6510b (GM108UC#ABF);CNU7370BNP", - ), - array( + ], + [ 'desc' => 'Load server (column header localized in english)', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Server', 'output' => 'details', 'separator' => ';', 'reconciliationkeys' => '', - ), + ], 'csvdata' => "Name;Status;Owner Organization;Location;location_id->org_name;OS Family;OS Version;Management IP;CPU;RAM;Brand;Model;Serial Number\nlocalhost.;production;Demo;Grenoble;Demo;Ubuntu 9.10;2.6.31-19-generic-#56-Ubuntu SMP Thu Jan 28 01:26:53 UTC 2010;16.16.230.232;Intel(R) Core(TM)2 Duo CPU T7100 @ 1.80GHz;2005;Hewlett-Packard;HP Compaq 6510b (GM108UC#ABF);CNU7370BNP", - ), - array( + ], + [ 'desc' => 'Load server (directly from Export results)', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Server', 'output' => 'details', 'reconciliationkeys' => '', - ), + ], 'csvdata' => 'id,Name,Status,Owner organization,Owner organization->Name,Business criticity,Brand,Model,Serial Number,Asset Reference,Description,Location,Location->Name,Location details,Management IP,Default Gateway,CPU,RAM,Hard Disk,OS Family,OS Version 1,"dbserver1.demo.com","production",2,"Demo","medium","HP","DL380","","","ouille [[Server:webserver.demo.com]]",1,"Grenoble","","10.1.1.10","255.255.255.0","2","16Gb","120Gb","Linux","Debian (Lenny)"', - ), - array( + ], + [ 'desc' => 'Load server - wrong value for status', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Server', 'output' => 'details', 'separator' => ';', 'reconciliationkeys' => '', - ), + ], 'csvdata' => "name;status;owner_name;location_name;location_id->org_name;os_family;os_version;management_ip;cpu;ram;brand;model;serial_number\nlocalhost.;Production;Demo;Grenoble;Demo;Ubuntu 9.10;2.6.31-19-generic-#56-Ubuntu SMP Thu Jan 28 01:26:53 UTC 2010;16.16.230.232;Intel(R) Core(TM)2 Duo CPU T7100 @ 1.80GHz;2005;Hewlett-Packard;HP Compaq 6510b (GM108UC#ABF);CNU7370BNP", - ), - array( + ], + [ 'desc' => 'Load NW if', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'NetworkInterface', 'output' => 'details', 'separator' => ';', 'reconciliationkeys' => '', - ), + ], 'csvdata' => "name;status;org_id;device_name;physical_type;ip_address;ip_mask;mac_address;speed\neth0;implementation;2;localhost.;ethernet;16.16.230.232;255.255.240.0;00:1a:4b:68:e3:97;\nlo;implementation;2;localhost.;ethernet;127.0.0.1;255.0.0.0;;", - ), + ], // Data Bruno - array( + [ 'desc' => 'Load NW devices from real life', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'NetworkDevice', 'output' => 'details', 'separator' => ';', 'reconciliationkeys' => 'org_id,Name', - ), + ], 'csvdata' => 'name;management_ip;importance;Owner organization->Name;type truc-machin-bidule;172.15.255.150;high;My Company/Department;switch 10.15.255.222;10.15.255.222;high;My Company/Department;switch', - ), - array( + ], + [ 'desc' => 'Load NW ifs', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'NetworkInterface', 'output' => 'details', 'separator' => ';', 'reconciliationkeys' => 'device_id->name,name', - ), + ], 'csvdata' => 'device_id->name;org_id->name;name;ip_address;ip_mask;speed;link_type;mac_address;physical_type truc-machin-bidule;My Company/Department;"GigabitEthernet44";;;0;downlink;00 12 F2 CB C4 EB ;ethernet truc-machin-bidule;My Company/Department;"GigabitEthernet38";;;0;downlink;00 12 F2 CB C4 E5 ;ethernet un-autre;My Company/Department;"GigabitEthernet2/3";;;1000000000;uplink;00 12 F2 20 0F 1A ;ethernet', - ), - array( + ], + [ 'desc' => 'The simplest data load', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'details', - ), + ], 'csvdata' => "name\nParis", - ), - array( + ], + [ 'desc' => 'The simplest data load + org', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'details', 'separator' => ';', - ), + ], 'csvdata' => "name;org_id\nParis;2", - ), - array( + ], + [ 'desc' => 'The simplest data load + org (name)', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'details', 'separator' => ';', - ), + ], 'csvdata' => "name;org_name\nParis;Demo", - ), - array( + ], + [ 'desc' => 'The simplest data load + org (code)', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'details', 'separator' => ';', - ), + ], 'csvdata' => "name;org_id->code\nParis;DEMO", - ), - array( + ], + [ 'desc' => 'Ouput: summary', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'summary', 'separator' => ';', - ), + ], 'csvdata' => "name;org_id->code\nParis;DEMO", - ), - array( + ], + [ 'desc' => 'Ouput: retcode', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'retcode', 'separator' => ';', - ), + ], 'csvdata' => "name;org_id->code\nParis;DEMO", - ), - array( + ], + [ 'desc' => 'Error in reconciliation list', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'details', 'separator' => ';', 'reconciliationkeys' => 'org_id', - ), + ], 'csvdata' => "org_name;name\nDemo;Paris", - ), - array( + ], + [ 'desc' => 'Error in attribute list that does not allow to compute reconciliation scheme', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'details', 'separator' => ';', - ), + ], 'csvdata' => "org_name;country\nDemo;France", - ), - array( + ], + [ 'desc' => 'Error in attribute list - case A', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'details', 'separator' => ';', - ), + ], 'csvdata' => "name;org\nParis;2", - ), - array( + ], + [ 'desc' => 'Error in attribute list - case B1 (key->attcode)', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'details', 'separator' => ';', - ), + ], 'csvdata' => "name;org->code\nParis;DEMO", - ), - array( + ], + [ 'desc' => 'Error in attribute list - case B2 (key->attcode)', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'details', 'separator' => ';', - ), + ], 'csvdata' => "name;org_id->duns\nParis;DEMO", - ), - array( + ], + [ 'desc' => 'Always changing... special comment in change tracking', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'details', 'separator' => ';', - 'comment' => 'automated testing' - ), + 'comment' => 'automated testing', + ], 'csvdata' => "org_name;name;address\nDemo;Le pantheon;Addresse bidon:".((string)microtime(true)), - ), - array( + ], + [ 'desc' => 'Always changing... but "simulate"', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'Location', 'output' => 'details', 'separator' => ';', 'simulate' => '1', - 'comment' => 'SHOULD NEVER APPEAR IN THE HISTORY' - ), + 'comment' => 'SHOULD NEVER APPEAR IN THE HISTORY', + ], 'csvdata' => "org_name;name;address\nDemo;Le pantheon;restore address?", - ), - array( + ], + [ 'desc' => 'Load a user account', 'login' => 'admin', 'password' => 'admin', - 'args' => array( + 'args' => [ 'class' => 'UserLocal', 'output' => 'details', 'separator' => ',', 'simulate' => '0', - 'comment' => 'automated testing' - ), + 'comment' => 'automated testing', + ], 'csvdata' => "login,password,profile_list\nby_import_csv,fakepwd,profileid->name:Configuration Manager|profileid:10;reason:direct id", - ), - ); + ], + ]; - $sSubTests = utils::ReadParam('subtests', null, true, 'raw_data'); - if (is_null($sSubTests)) - { - foreach ($aLoads as $iTestId => $aLoadSpec) - { + $sSubTests = utils::ReadParam('subtests', null, true, 'raw_data'); + if (is_null($sSubTests)) { + foreach ($aLoads as $iTestId => $aLoadSpec) { $this->DoExecSingleLoad($aLoadSpec, $iTestId); } - } - else - { + } else { $aSubTests = explode(',', $sSubTests); - foreach ($aSubTests as $iTestId) - { + foreach ($aSubTests as $iTestId) { $this->DoExecSingleLoad($aLoads[$iTestId], $iTestId); } } @@ -1221,28 +1183,27 @@ define('IMPORT_COUNT', 4000); class TestImportRESTMassive extends TestImportREST { - static public function GetName() + public static function GetName() { return 'CSV import (REST) - HUGE data set ('.IMPORT_COUNT.' PCs)'; } - static public function GetDescription() + public static function GetDescription() { return 'Stress import.php'; } protected function DoExecute() { - $aLoadSpec = array( + $aLoadSpec = [ 'desc' => 'Loading PCs: '.IMPORT_COUNT, - 'args' => array( + 'args' => [ 'class' => 'PC', 'output' => 'summary', - ), + ], 'csvdata' => "name;org_id;brand\n", - ); - for($i = 0 ; $i <= IMPORT_COUNT ; $i++) - { + ]; + for ($i = 0 ; $i <= IMPORT_COUNT ; $i++) { $aLoadSpec['csvdata'] .= "pc.import.$i;2;Combodo\n"; } $this->DoExecSingleLoad($aLoadSpec); @@ -1253,318 +1214,317 @@ class TestImportRESTMassive extends TestImportREST // Test SOAP services /////////////////////////////////////////////////////////////////////////// -$aCreateTicketSpecs = array( - array( +$aCreateTicketSpecs = [ + [ 'service_category' => 'BasicServices', 'verb' => 'GetVersion', // 'expected result' => '1.0.1', 'expected result' => '$ITOP_VERSION$ [dev]', 'explain result' => 'no comment!', - 'args' => array(), - ), - array( + 'args' => [], + ], + [ 'service_category' => '', 'verb' => 'CreateIncidentTicket', 'expected result' => true, 'explain result' => 'link attribute unknown + a CI not found', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'admin', /* sPassword */ 'desc of ticket', /* sDescription */ 'initial situation blah blah blah', /* sInitialSituation */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Telecom and connectivity'))), /* aServiceDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Network Troubleshooting'))), /* aServiceSubcategoryDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aCallerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Demo')]), /* aCustomerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Telecom and connectivity')]), /* aServiceDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Network Troubleshooting')]), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ - array( + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Hardware support')]), /* aWorkgroupDesc */ + [ new SOAPLinkCreationSpec( 'InfrastructureCI', - array(new SOAPSearchCondition('name', 'dbserver1.demo.com')), - array(new SOAPAttributeValue('impacting', 'very critical')) + [new SOAPSearchCondition('name', 'dbserver1.demo.com')], + [new SOAPAttributeValue('impacting', 'very critical')] ), new SOAPLinkCreationSpec( 'NetworkDevice', - array(new SOAPSearchCondition('name', 'switch01')), - array(new SOAPAttributeValue('impact', 'who cares')) + [new SOAPSearchCondition('name', 'switch01')], + [new SOAPAttributeValue('impact', 'who cares')] ), new SOAPLinkCreationSpec( 'Server', - array(new SOAPSearchCondition('name', 'thisone')), - array(new SOAPAttributeValue('impact', 'our lives')) + [new SOAPSearchCondition('name', 'thisone')], + [new SOAPAttributeValue('impact', 'our lives')] ), - ), /* aImpact */ + ], /* aImpact */ '1', /* sImpact */ '1', /* sUrgency */ - ), - ), - array( + ], + ], + [ 'service_category' => '', 'verb' => 'CreateIncidentTicket', 'expected result' => true, 'explain result' => 'caller not specified', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'admin', /* sPassword */ 'PC burning', /* sDescription */ 'The power supply suddenly started to warm up', /* sInitialSituation */ new SOAPExternalKeySearch(), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Computers and peripherals'))), /* aServiceDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Demo')]), /* aCustomerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Computers and peripherals')]), /* aServiceDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ - array( + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Hardware support')]), /* aWorkgroupDesc */ + [ new SOAPLinkCreationSpec( 'InfrastructureCI', - array(new SOAPSearchCondition('name', 'dbserver1.demo.com')), - array() + [new SOAPSearchCondition('name', 'dbserver1.demo.com')], + [] ), /* aImpact */ - ), + ], '1', /* sImpact */ '1', /* sUrgency */ - ), - ), - array( + ], + ], + [ 'service_category' => '', 'verb' => 'CreateIncidentTicket', 'expected result' => false, 'explain result' => 'wrong class on CI to attach', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'admin', /* sPassword */ 'PC burning', /* sDescription */ 'The power supply suddenly started to warm up', /* sInitialSituation */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Computers and peripherals'))), /* aServiceDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aCallerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Demo')]), /* aCustomerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Computers and peripherals')]), /* aServiceDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ - array( + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Hardware support')]), /* aWorkgroupDesc */ + [ new SOAPLinkCreationSpec( 'logInfra', - array(new SOAPSearchCondition('dummyfiltercode', 2)), - array(new SOAPAttributeValue('impact', 'very critical')) + [new SOAPSearchCondition('dummyfiltercode', 2)], + [new SOAPAttributeValue('impact', 'very critical')] ), - ), /* aImpact */ + ], /* aImpact */ '1', /* sImpact */ '1', /* sUrgency */ - ), - ), - array( + ], + ], + [ 'service_category' => '', 'verb' => 'CreateIncidentTicket', 'expected result' => false, 'explain result' => 'wrong search condition on CI to attach', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'admin', /* sPassword */ 'PC burning', /* sDescription */ 'The power supply suddenly started to warm up', /* sInitialSituation */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Computers and peripherals'))), /* aServiceDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aCallerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Demo')]), /* aCustomerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Computers and peripherals')]), /* aServiceDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ - array( + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Hardware support')]), /* aWorkgroupDesc */ + [ new SOAPLinkCreationSpec( 'InfrastructureCI', - array(new SOAPSearchCondition('dummyfiltercode', 2)), - array(new SOAPAttributeValue('impact', 'very critical')) + [new SOAPSearchCondition('dummyfiltercode', 2)], + [new SOAPAttributeValue('impact', 'very critical')] ), - ), /* aImpact */ + ], /* aImpact */ '1', /* sImpact */ '1', /* sUrgency */ - ), - ), - array( + ], + ], + [ 'service_category' => '', 'verb' => 'CreateIncidentTicket', 'expected result' => true, 'explain result' => 'no CI to attach (empty array)', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'admin', /* sPassword */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Computers and peripherals'))), /* aServiceDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aCallerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Demo')]), /* aCustomerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Computers and peripherals')]), /* aServiceDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ - array( - ), /* aImpact */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Hardware support')]), /* aWorkgroupDesc */ + [ + ], /* aImpact */ '1', /* sImpact */ '1', /* sUrgency */ - ), - ), - array( + ], + ], + [ 'service_category' => '', 'verb' => 'CreateIncidentTicket', 'expected result' => true, 'explain result' => 'no CI to attach (null)', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'admin', /* sPassword */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Computers and peripherals'))), /* aServiceDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aCallerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Demo')]), /* aCustomerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Computers and peripherals')]), /* aServiceDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Hardware support')]), /* aWorkgroupDesc */ null, /* aImpact */ '1', /* sImpact */ '1', /* sUrgency */ - ), - ), - array( + ], + ], + [ 'service_category' => '', 'verb' => 'CreateIncidentTicket', 'expected result' => true, 'explain result' => 'caller unknown', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'admin', /* sPassword */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1000))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Computers and peripherals'))), /* aServiceDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1000)]), /* aCallerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Demo')]), /* aCustomerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Computers and peripherals')]), /* aServiceDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ - array( - ), /* aImpact */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Hardware support')]), /* aWorkgroupDesc */ + [ + ], /* aImpact */ '1', /* sImpact */ '1', /* sUrgency */ - ), - ), - array( + ], + ], + [ 'service_category' => '', 'verb' => 'CreateIncidentTicket', 'expected result' => false, 'explain result' => 'wrong values for impact and urgency', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'admin', /* sPassword */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Computers and peripherals'))), /* aServiceDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aCallerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Demo')]), /* aCustomerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Computers and peripherals')]), /* aServiceDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ - array( - ), /* aImpact */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Hardware support')]), /* aWorkgroupDesc */ + [ + ], /* aImpact */ '6', /* sImpact */ '7', /* sUrgency */ - ), - ), - array( + ], + ], + [ 'service_category' => '', 'verb' => 'CreateIncidentTicket', 'expected result' => false, 'explain result' => 'wrong password', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'xxxxx', /* sPassword */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Computers and peripherals'))), /* aServiceDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aCallerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Demo')]), /* aCustomerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Computers and peripherals')]), /* aServiceDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ - array( - ), /* aImpact */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Hardware support')]), /* aWorkgroupDesc */ + [ + ], /* aImpact */ '1', /* sImpact */ '1', /* sUrgency */ - ), - ), - array( + ], + ], + [ 'service_category' => '', 'verb' => 'CreateIncidentTicket', 'expected result' => false, 'explain result' => 'wrong login', - 'args' => array( + 'args' => [ 'xxxxx', /* sLogin */ 'yyyyy', /* sPassword */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* aCustomerDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Computers and peripherals'))), /* aServiceDesc */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aCallerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Demo')]), /* aCustomerDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Computers and peripherals')]), /* aServiceDesc */ + new SOAPExternalKeySearch([new SOAPSearchCondition('id', 1)]), /* aServiceSubcategoryDesc */ 'sub product of the service', /* sProduct */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Hardware support'))), /* aWorkgroupDesc */ - array( - ), /* aImpact */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Hardware support')]), /* aWorkgroupDesc */ + [ + ], /* aImpact */ '1', /* sImpact */ '1', /* sUrgency */ - ), - ), - array( + ], + ], + [ 'service_category' => '', 'verb' => 'SearchObjects', 'expected result' => true, 'explain result' => '', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'admin', /* sPassword */ 'SELECT Incident WHERE id > 20', /* sOQL */ - ), - ), - array( + ], + ], + [ 'service_category' => '', 'verb' => 'SearchObjects', 'expected result' => false, 'explain result' => 'wrong OQL', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'admin', /* sPassword */ 'SELECT ThisClassDoesNotExist', /* sOQL */ - ), - ), -); + ], + ], +]; - -$aManageCloudUsersSpecs = array( - array( +$aManageCloudUsersSpecs = [ + [ 'service_category' => '', 'verb' => 'SearchObjects', 'expected result' => false, 'explain result' => 'wrong OQL', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'admin', /* sPassword */ 'SELECT ThisClassDoesNotExist', /* sOQL */ - ), - ), - array( + ], + ], + [ 'service_category' => '', 'verb' => 'SearchObjects', 'expected result' => true, 'explain result' => 'ok', - 'args' => array( + 'args' => [ 'admin', /* sLogin */ 'admin', /* sPassword */ 'SELECT Organization', /* sOQL */ - ), - ), - array( + ], + ], + [ 'service_category' => 'CloudUsersManagementService', 'verb' => 'CreateAccount', 'expected result' => true, 'explain result' => 'ok', - 'args' => array( + 'args' => [ 'admin', /* sAdminLogin */ 'admin', /* sAdminPassword */ 'http://myserver.mydomain.fr:8080', /* sCloudMgrUrl */ @@ -1573,27 +1533,27 @@ $aManageCloudUsersSpecs = array( 'Dupont', /* sLastName */ 1, /* iOrgId */ 'FR FR', /* sLanguage */ - array( - array( + [ + [ new SOAPKeyValue('profile_id', '2'), new SOAPKeyValue('reason', 'whynot'), - ), - array( + ], + [ new SOAPKeyValue('profile_id', '3'), new SOAPKeyValue('reason', 'because'), - ), - ), /* aProfiles (array of key/value pairs) */ - array( - ), /* aAllowedOrgs (array of key/value pairs) */ + ], + ], /* aProfiles (array of key/value pairs) */ + [ + ], /* aAllowedOrgs (array of key/value pairs) */ 'comment on the creation operation', /* sComment */ - ), - ), - array( + ], + ], + [ 'service_category' => 'CloudUsersManagementService', 'verb' => 'ModifyAccount', 'expected result' => true, 'explain result' => 'ok', - 'args' => array( + 'args' => [ 'admin', /* sAdminLogin */ 'admin', /* sAdminPassword */ 'andros@combodo.com', /* sLogin */ @@ -1601,47 +1561,53 @@ $aManageCloudUsersSpecs = array( 'robot', /* sLastName */ 2, /* iOrgId */ 'EN US', /* sLanguage */ - array( - array( + [ + [ new SOAPKeyValue('profile_id', '3'), new SOAPKeyValue('reason', 'because'), - ), - ), /* aProfiles (array of key/value pairs) */ - array( - ), /* aAllowedOrgs (array of key/value pairs) */ + ], + ], /* aProfiles (array of key/value pairs) */ + [ + ], /* aAllowedOrgs (array of key/value pairs) */ 'comment on the modify operation', /* sComment */ - ), - ), - array( + ], + ], + [ 'service_category' => 'CloudUsersManagementService', 'verb' => 'DeleteAccount', 'expected result' => true, 'explain result' => '', - 'args' => array( + 'args' => [ 'admin', /* sAdminLogin */ 'admin', /* sAdminPassword */ 'andros@combodo.com', /* sLogin */ 'comment on the deletion operation', /* sComment */ - ), - ), - array( + ], + ], + [ 'service_category' => 'CloudUsersManagementService', 'verb' => 'DeleteAccount', 'expected result' => false, 'explain result' => 'wrong login', - 'args' => array( + 'args' => [ 'admin', /* sAdminLogin */ 'admin', /* sAdminPassword */ 'taratatata@sdf.com', /* sLogin */ 'comment on the deletion operation', /* sComment */ - ), - ), -); + ], + ], +]; abstract class TestSoap extends TestSoapWebService { - static public function GetName() {return 'Test SOAP';} - static public function GetDescription() {return 'Do basic stuff to test the SOAP capability';} + public static function GetName() + { + return 'Test SOAP'; + } + public static function GetDescription() + { + return 'Do basic stuff to test the SOAP capability'; + } protected $m_aTestSpecs; @@ -1654,108 +1620,97 @@ abstract class TestSoap extends TestSoapWebService // this file is generated dynamically with location = here $sWsdlUri = 'http'.(utils::IsConnectionSecure() ? 's' : '').'://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].dirname($_SERVER['SCRIPT_NAME']).'/../webservices/itop.wsdl.php'; - ini_set("soap.wsdl_cache_enabled","0"); + ini_set("soap.wsdl_cache_enabled", "0"); - foreach ($this->m_aTestSpecs as $iPos => $aWebService) - { + foreach ($this->m_aTestSpecs as $iPos => $aWebService) { echo "

    SOAP call #$iPos - {$aWebService['verb']}

    \n"; echo "

    Using WSDL: $sWsdlUriForService

    \n"; echo "

    {$aWebService['explain result']}

    \n"; $sWsdlUriForService = $sWsdlUri.'?service_category='.$aWebService['service_category']; - $this->m_SoapClient = new SoapClient - ( + $this->m_SoapClient = new SoapClient( $sWsdlUriForService, - array( + [ 'classmap' => $aSOAPMapping, 'trace' => 1, - ) + ] ); - - if (false) - { - self::DumpVariable($this->m_SoapClient->__getTypes()); - } - try - { - $oRes = call_user_func_array(array($this->m_SoapClient, $aWebService['verb']), $aWebService['args']); + if (false) { + self::DumpVariable($this->m_SoapClient->__getTypes()); } - catch(SoapFault $e) - { - print "
    \n"; 
    -				print "Request: \n".htmlspecialchars($this->m_SoapClient->__getLastRequest()) ."\n"; 
    -				print "Response: \n".htmlspecialchars($this->m_SoapClient->__getLastResponse())."\n"; 
    +
    +			try {
    +				$oRes = call_user_func_array([$this->m_SoapClient, $aWebService['verb']], $aWebService['args']);
    +			} catch (SoapFault $e) {
    +				print "
    \n";
    +				print "Request: \n".htmlspecialchars($this->m_SoapClient->__getLastRequest())."\n";
    +				print "Response: \n".htmlspecialchars($this->m_SoapClient->__getLastResponse())."\n";
     				print "
    "; - print "Response in HTML:

    ".$this->m_SoapClient->__getLastResponse()."

    "; + print "Response in HTML:

    ".$this->m_SoapClient->__getLastResponse()."

    "; throw $e; } self::DumpVariable($oRes); - - print "
    \n"; 
    -			print "Request: \n".htmlspecialchars($this->m_SoapClient->__getLastRequest()) ."\n"; 
    -			print "Response: \n".htmlspecialchars($this->m_SoapClient->__getLastResponse())."\n"; 
    +
    +			print "
    \n";
    +			print "Request: \n".htmlspecialchars($this->m_SoapClient->__getLastRequest())."\n";
    +			print "Response: \n".htmlspecialchars($this->m_SoapClient->__getLastResponse())."\n";
     			print "
    "; - if ($oRes instanceof SOAPResult) - { + if ($oRes instanceof SOAPResult) { $res = $oRes->status; - } - elseif ($oRes instanceof SOAPSimpleResult) - { + } elseif ($oRes instanceof SOAPSimpleResult) { $res = $oRes->status; - } - else - { + } else { $res = $oRes; } - if ($res != $aWebService['expected result']) - { + if ($res != $aWebService['expected result']) { echo "Expecting:
    \n"; var_dump($aWebService['expected result']); echo "Obtained:
    \n"; var_dump($res); throw new UnitTestException("Expecting result '{$aWebService['expected result']}', but got '$res'"); } - } + } } } abstract class TestSoapDirect extends TestBizModel { - static public function GetName() {return 'Test web services locally';} - static public function GetDescription() {return 'Invoke the service directly (troubleshooting)';} + public static function GetName() + { + return 'Test web services locally'; + } + public static function GetDescription() + { + return 'Invoke the service directly (troubleshooting)'; + } protected $m_aTestSpecs; protected function DoExecute() { - foreach ($this->m_aTestSpecs as $iPos => $aWebService) - { + foreach ($this->m_aTestSpecs as $iPos => $aWebService) { $sServiceClass = $aWebService['service_category']; - if (empty($sServiceClass)) $sServiceClass = 'BasicServices'; + if (empty($sServiceClass)) { + $sServiceClass = 'BasicServices'; + } $oWebServices = new $sServiceClass(); echo "

    SOAP call #$iPos - {$aWebService['verb']}

    \n"; echo "

    {$aWebService['explain result']}

    \n"; - $oRes = call_user_func_array(array($oWebServices, $aWebService['verb']), $aWebService['args']); + $oRes = call_user_func_array([$oWebServices, $aWebService['verb']], $aWebService['args']); self::DumpVariable($oRes); - if ($oRes instanceof SOAPResult) - { + if ($oRes instanceof SOAPResult) { $res = $oRes->status; - } - elseif ($oRes instanceof SOAPSimpleResult) - { + } elseif ($oRes instanceof SOAPSimpleResult) { $res = $oRes->status; - } - else - { + } else { $res = $oRes; } - if ($res != $aWebService['expected result']) - { + if ($res != $aWebService['expected result']) { echo "Expecting:
    \n"; var_dump($aWebService['expected result']); echo "Obtained:
    \n"; @@ -1769,7 +1724,10 @@ abstract class TestSoapDirect extends TestBizModel class TestSoap_Tickets extends TestSoap { - static public function GetName() {return 'Test SOAP - create ticket';} + public static function GetName() + { + return 'Test SOAP - create ticket'; + } protected function DoExecute() { @@ -1781,7 +1739,10 @@ class TestSoap_Tickets extends TestSoap class TestSoapDirect_Tickets extends TestSoapDirect { - static public function GetName() {return 'Test SOAP without SOAP - create ticket';} + public static function GetName() + { + return 'Test SOAP without SOAP - create ticket'; + } protected function DoExecute() { @@ -1791,10 +1752,12 @@ class TestSoapDirect_Tickets extends TestSoapDirect } } - class TestSoap_ManageCloudUsers extends TestSoap { - static public function GetName() {return 'Test SOAP - manage Cloud Users';} + public static function GetName() + { + return 'Test SOAP - manage Cloud Users'; + } protected function DoExecute() { @@ -1806,7 +1769,10 @@ class TestSoap_ManageCloudUsers extends TestSoap class TestSoapDirect_ManageCloudUsers extends TestSoapDirect { - static public function GetName() {return 'Test SOAP without SOAP - manage Cloud Users';} + public static function GetName() + { + return 'Test SOAP without SOAP - manage Cloud Users'; + } protected function DoExecute() { @@ -1816,14 +1782,18 @@ class TestSoapDirect_ManageCloudUsers extends TestSoapDirect } } - ////////////////////// End of SOAP TESTS - class TestTriggerAndEmail extends TestBizModel { - static public function GetName() {return 'Test trigger and email';} - static public function GetDescription() {return 'Create a trigger and an email, then activates the trigger';} + public static function GetName() + { + return 'Test trigger and email'; + } + public static function GetDescription() + { + return 'Create a trigger and an email, then activates the trigger'; + } protected function CreateEmailSpec($oTrigger, $sStatus, $sTo, $sCC, $sTesterEmail) { @@ -1885,8 +1855,7 @@ class TestTriggerAndEmail extends TestBizModel // Error in OQL field(s) // - $this->CreateEmailSpec - ( + $this->CreateEmailSpec( $oMyTrigger, 'test', "SELECT Person WHERE naime = 'Dali'", @@ -1896,8 +1865,7 @@ class TestTriggerAndEmail extends TestBizModel // Error: no recipient // - $this->CreateEmailSpec - ( + $this->CreateEmailSpec( $oMyTrigger, 'test', "", @@ -1907,8 +1875,7 @@ class TestTriggerAndEmail extends TestBizModel // Test // - $this->CreateEmailSpec - ( + $this->CreateEmailSpec( $oMyTrigger, 'test', "SELECT Person WHERE name LIKE 'testemail%'", @@ -1918,8 +1885,7 @@ class TestTriggerAndEmail extends TestBizModel // Test failing because of a wrong test recipient address // - $this->CreateEmailSpec - ( + $this->CreateEmailSpec( $oMyTrigger, 'test', "SELECT Person WHERE name LIKE 'testemail%'", @@ -1929,8 +1895,7 @@ class TestTriggerAndEmail extends TestBizModel // Normal behavior // - $this->CreateEmailSpec - ( + $this->CreateEmailSpec( $oMyTrigger, 'enabled', "SELECT Person WHERE name LIKE 'testemail%'", @@ -1940,8 +1905,7 @@ class TestTriggerAndEmail extends TestBizModel // Does nothing, because it is disabled // - $this->CreateEmailSpec - ( + $this->CreateEmailSpec( $oMyTrigger, 'disabled', "SELECT Person WHERE name = 'testemail%'", @@ -1957,12 +1921,12 @@ class TestTriggerAndEmail extends TestBizModel class TestDBProperties extends TestBizModel { - static public function GetName() + public static function GetName() { return 'Itop - DB Properties'; } - static public function GetDescription() + public static function GetDescription() { return 'Write and read a dummy property'; } @@ -1978,12 +1942,12 @@ class TestDBProperties extends TestBizModel class TestCreateObjects extends TestBizModel { - static public function GetName() + public static function GetName() { return 'Itop - create objects'; } - static public function GetDescription() + public static function GetDescription() { return 'Create weird objects (reproduce a bug?)'; } @@ -1991,7 +1955,7 @@ class TestCreateObjects extends TestBizModel protected function DoExecute() { $oMyObj = MetaModel::NewObject("Server"); - $oMyObj->Set("name", "test".rand(1,1000)); + $oMyObj->Set("name", "test".rand(1, 1000)); $oMyObj->Set("org_id", 2); $oMyObj->Set("status", 'production'); $this->ObjectToDB($oMyObj, $bReload = true); @@ -2037,12 +2001,12 @@ class TestCreateObjects extends TestBizModel class TestSetLinkset extends TestBizModel { - static public function GetName() + public static function GetName() { return 'Itop - Link set from a string'; } - static public function GetDescription() + public static function GetDescription() { return 'Create a user account, setting its profile by the mean of a string (prerequisite to CSV import of linksets)'; } @@ -2055,7 +2019,7 @@ class TestSetLinkset extends TestBizModel //$oUser->Set('contactid', 0); //$oUser->Set('language', $sLanguage); - $sLinkSetSpec = "profileid:10;reason:service manager|profileid->name:Problem Manager;'reason:problem manager;glandeur"; + $sLinkSetSpec = "profileid:10;reason:service manager|profileid->name:Problem Manager;'reason:problem manager;glandeur"; $oAttDef = MetaModel::GetAttributeDef('UserLocal', 'profile_list'); $oSet = $oAttDef->MakeValueFromString($sLinkSetSpec, $bLocalizedValue = false); @@ -2071,23 +2035,30 @@ abstract class TestLinkSet extends TestBizModel { protected function StandardizedDump($oSet, $sAttPrefixToIgnore) { - if (!$oSet->m_bLoaded) $oSet->Load(); + if (!$oSet->m_bLoaded) { + $oSet->Load(); + } $oSet->Rewind(); - $aRet = array(); - while($oObject = $oSet->Fetch()) - { - $aValues = array(); - foreach(MetaModel::ListAttributeDefs(get_class($oObject)) as $sAttCode => $oAttDef) - { + $aRet = []; + while ($oObject = $oSet->Fetch()) { + $aValues = []; + foreach (MetaModel::ListAttributeDefs(get_class($oObject)) as $sAttCode => $oAttDef) { //if (!$oAttDef->IsPartOfFingerprint()) continue; //if ($oAttDef->IsMagic()) continue; - if ($sAttCode == 'friendlyname') continue; - if (substr($sAttCode, -strlen('_archive_flag')) == '_archive_flag') continue; - if (substr($sAttCode, -strlen('_obsolescence_flag')) == '_obsolescence_flag') continue; - if (substr($sAttCode, 0, strlen($sAttPrefixToIgnore)) == $sAttPrefixToIgnore) continue; - if ($oAttDef->IsScalar()) - { + if ($sAttCode == 'friendlyname') { + continue; + } + if (substr($sAttCode, -strlen('_archive_flag')) == '_archive_flag') { + continue; + } + if (substr($sAttCode, -strlen('_obsolescence_flag')) == '_obsolescence_flag') { + continue; + } + if (substr($sAttCode, 0, strlen($sAttPrefixToIgnore)) == $sAttPrefixToIgnore) { + continue; + } + if ($oAttDef->IsScalar()) { $aValues[] = $oObject->Get($sAttCode); } } @@ -2101,12 +2072,12 @@ abstract class TestLinkSet extends TestBizModel class TestLinkSetRecording_NN_WithDuplicates extends TestLinkSet { - static public function GetName() + public static function GetName() { return 'Linkset N-N having duplicated allowed (Connectable CI to Network Device)'; } - static public function GetDescription() + public static function GetDescription() { return 'Simulate CSV/data synchro type of recording. Check the values and the history. Lots of issues there: #1145, #1146 and #1147'; } @@ -2115,7 +2086,7 @@ class TestLinkSetRecording_NN_WithDuplicates extends TestLinkSet { CMDBSource::Query('START TRANSACTION'); //CMDBSource::Query('ROLLBACK'); automatique ! - + //////////////////////////////////////////////////////////////////////////////// // Set the stage // @@ -2124,303 +2095,301 @@ class TestLinkSetRecording_NN_WithDuplicates extends TestLinkSet $oServer->Set('org_id', 3); $oServer->DBInsert(); $iServer = $oServer->GetKey(); - + $oTypes = new DBObjectSet(DBObjectSearch::FromOQL('SELECT NetworkDeviceType WHERE name = "Router"')); $oType = $oTypes->fetch(); - + $oDevice = MetaModel::NewObject('NetworkDevice'); $oDevice->Set('name', 'test device A'); $oDevice->Set('org_id', 3); $oDevice->Set('networkdevicetype_id', $oType->GetKey()); $oDevice->DBInsert(); $iDev1 = $oDevice->GetKey(); - + $oDevice = MetaModel::NewObject('NetworkDevice'); $oDevice->Set('name', 'test device B'); $oDevice->Set('org_id', 3); $oDevice->Set('networkdevicetype_id', $oType->GetKey()); $oDevice->DBInsert(); $iDev2 = $oDevice->GetKey(); - - + //////////////////////////////////////////////////////////////////////////////// // Scenarii // - $aScenarii = array( - array( + $aScenarii = [ + [ 'description' => 'Add the first item', - 'links' => array( - array( + 'links' => [ + [ 'networkdevice_id' => $iDev1, 'connectableci_id' => $iServer, 'network_port' => '', 'device_port' => '', - ), - ), - 'expected-res' => array ( - "$iDev1, test device A, unit test linkset, , , downlink, test device A", - ), + ], + ], + 'expected-res' => [ + "$iDev1, test device A, unit test linkset, , , downlink, test device A", + ], 'history_added' => 1, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Modify the unique item', - 'links' => array( - array( + 'links' => [ + [ 'networkdevice_id' => $iDev1, 'connectableci_id' => $iServer, 'network_port' => 'devTagada', 'device_port' => '', - ), - ), - 'expected-res' => array ( - "$iDev1, test device A, unit test linkset, devTagada, , downlink, test device A", - ), + ], + ], + 'expected-res' => [ + "$iDev1, test device A, unit test linkset, devTagada, , downlink, test device A", + ], 'history_added' => 1, 'history_removed' => 1, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Modify again the original item and add a second item', - 'links' => array( - array( + 'links' => [ + [ 'networkdevice_id' => $iDev1, 'connectableci_id' => $iServer, 'network_port' => '', 'device_port' => '', - ), - array( + ], + [ 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => '', 'device_port' => '', - ), - ), - 'expected-res' => array ( - "$iDev1, test device A, unit test linkset, , , downlink, test device A", - "$iDev2, test device B, unit test linkset, , , downlink, test device B", - ), + ], + ], + 'expected-res' => [ + "$iDev1, test device A, unit test linkset, , , downlink, test device A", + "$iDev2, test device B, unit test linkset, , , downlink, test device B", + ], 'history_added' => 2, 'history_removed' => 1, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'No change, the links are added in the reverse order', - 'links' => array( - array( + 'links' => [ + [ 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => '', 'device_port' => '', - ), - array( + ], + [ 'networkdevice_id' => $iDev1, 'connectableci_id' => $iServer, 'network_port' => '', 'device_port' => '', - ), - ), - 'expected-res' => array ( - "$iDev1, test device A, unit test linkset, , , downlink, test device A", - "$iDev2, test device B, unit test linkset, , , downlink, test device B", - ), + ], + ], + 'expected-res' => [ + "$iDev1, test device A, unit test linkset, , , downlink, test device A", + "$iDev2, test device B, unit test linkset, , , downlink, test device B", + ], 'history_added' => 0, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Change on attribute on both links at the same time', - 'links' => array( - array( + 'links' => [ + [ 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => 'PortDev B', 'device_port' => '', - ), - array( + ], + [ 'networkdevice_id' => $iDev1, 'connectableci_id' => $iServer, 'network_port' => 'PortDev A', 'device_port' => '', - ), - ), - 'expected-res' => array ( - "$iDev1, test device A, unit test linkset, PortDev A, , downlink, test device A", - "$iDev2, test device B, unit test linkset, PortDev B, , downlink, test device B", - ), + ], + ], + 'expected-res' => [ + "$iDev1, test device A, unit test linkset, PortDev A, , downlink, test device A", + "$iDev2, test device B, unit test linkset, PortDev B, , downlink, test device B", + ], 'history_added' => 2, 'history_removed' => 2, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Removing A', - 'links' => array( - array( + 'links' => [ + [ 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => 'PortDev B', 'device_port' => '', - ), - ), - 'expected-res' => array ( - "$iDev2, test device B, unit test linkset, PortDev B, , downlink, test device B", - ), + ], + ], + 'expected-res' => [ + "$iDev2, test device B, unit test linkset, PortDev B, , downlink, test device B", + ], 'history_added' => 0, 'history_removed' => 1, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Adding B again - with a different port (duplicate!)', - 'links' => array( - array( + 'links' => [ + [ 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => 'port_123', 'device_port' => '', - ), - array( + ], + [ 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => 'port_456', 'device_port' => '', - ), - ), - 'expected-res' => array ( - "$iDev2, test device B, unit test linkset, port_123, , downlink, test device B", - "$iDev2, test device B, unit test linkset, port_456, , downlink, test device B", - ), + ], + ], + 'expected-res' => [ + "$iDev2, test device B, unit test linkset, port_123, , downlink, test device B", + "$iDev2, test device B, unit test linkset, port_456, , downlink, test device B", + ], 'history_added' => 2, 'history_removed' => 1, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'No change (creating a set with the reloaded links, like in the UI)', - 'links' => array( - array( + 'links' => [ + [ 'id' => "SELECT lnkConnectableCIToNetworkDevice WHERE networkdevice_id = $iDev2 AND connectableci_id = $iServer AND network_port = 'port_123'", 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => 'port_123', 'device_port' => '', - ), - array( + ], + [ 'id' => "SELECT lnkConnectableCIToNetworkDevice WHERE networkdevice_id = $iDev2 AND connectableci_id = $iServer AND network_port = 'port_456'", 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => 'port_456', 'device_port' => '', - ), - ), - 'expected-res' => array ( + ], + ], + 'expected-res' => [ "$iDev2, test device B, unit test linkset, port_123, , downlink, test device B", "$iDev2, test device B, unit test linkset, port_456, , downlink, test device B", - ), + ], 'history_added' => 0, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Change an attribute on one link (based on reloaded links, like in the UI)', - 'links' => array( - array( + 'links' => [ + [ 'id' => "SELECT lnkConnectableCIToNetworkDevice WHERE networkdevice_id = $iDev2 AND connectableci_id = $iServer AND network_port = 'port_123'", 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => 'port_123_modified', 'device_port' => '', - ), - array( + ], + [ 'id' => "SELECT lnkConnectableCIToNetworkDevice WHERE networkdevice_id = $iDev2 AND connectableci_id = $iServer AND network_port = 'port_456'", 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => 'port_456', 'device_port' => '', - ), - ), - 'expected-res' => array ( + ], + ], + 'expected-res' => [ "$iDev2, test device B, unit test linkset, port_123_modified, , downlink, test device B", "$iDev2, test device B, unit test linkset, port_456, , downlink, test device B", - ), + ], 'history_added' => 0, 'history_removed' => 0, 'history_modified' => 1, - ), - array( + ], + [ 'description' => 'Remove the second link (set based on reloaded links, like in the UI)', - 'links' => array( - array( + 'links' => [ + [ 'id' => "SELECT lnkConnectableCIToNetworkDevice WHERE networkdevice_id = $iDev2 AND connectableci_id = $iServer AND network_port = 'port_123_modified'", 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => 'port_123_modified', 'device_port' => '', - ), - ), - 'expected-res' => array ( + ], + ], + 'expected-res' => [ "$iDev2, test device B, unit test linkset, port_123_modified, , downlink, test device B", - ), + ], 'history_added' => 0, 'history_removed' => 1, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Remove all', - 'links' => array( - ), - 'expected-res' => array ( - ), + 'links' => [ + ], + 'expected-res' => [ + ], 'history_added' => 0, 'history_removed' => 1, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Create one link from scratch, no port, to prepare for the next test case', - 'links' => array( - array( + 'links' => [ + [ 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => 'portX', 'device_port' => '', - ), - ), - 'expected-res' => array ( + ], + ], + 'expected-res' => [ "$iDev2, test device B, unit test linkset, portX, , downlink, test device B", - ), + ], 'history_added' => 1, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Device B twice (same characteristics) - known issue #1145 (test failing until we fix it)', - 'links' => array( - array( + 'links' => [ + [ 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => 'portX', 'device_port' => '', - ), - array( + ], + [ 'networkdevice_id' => $iDev2, 'connectableci_id' => $iServer, 'network_port' => 'portX', 'device_port' => '', - ), - ), - 'expected-res' => array ( - "$iDev2, test device B, unit test linkset, portX, , downlink, test device B", - "$iDev2, test device B, unit test linkset, portX, , downlink, test device B", - ), + ], + ], + 'expected-res' => [ + "$iDev2, test device B, unit test linkset, portX, , downlink, test device B", + "$iDev2, test device B, unit test linkset, portX, , downlink, test device B", + ], 'history_added' => 1, 'history_removed' => 0, 'history_modified' => 0, - ), - ); - - foreach ($aScenarii as $aScenario) - { + ], + ]; + + foreach ($aScenarii as $aScenario) { echo "

    ".$aScenario['description']."

    \n"; - + $oChange = MetaModel::NewObject("CMDBChange"); $oChange->Set("date", time()); $oChange->Set("userinfo", CMDBChange::GetCurrentUserName()); @@ -2428,80 +2397,74 @@ class TestLinkSetRecording_NN_WithDuplicates extends TestLinkSet $oChange->DBInsert(); CMDBObject::SetCurrentChange($oChange); $iChange = $oChange->GetKey(); - + // Prepare set $oLinkset = DBObjectSet::FromScratch('lnkConnectableCIToNetworkDevice'); - foreach ($aScenario['links'] as $aLinkData) - { - if (array_key_exists('id', $aLinkData)) - { + foreach ($aScenario['links'] as $aLinkData) { + if (array_key_exists('id', $aLinkData)) { $sOQL = $aLinkData['id']; $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL)); $oLink1 = $oSet->Fetch(); - if (!is_object($oLink1)) throw new Exception('Failed to find the lnkConnectableCIToNetworkDevice: '.$sOQL); - } - else - { + if (!is_object($oLink1)) { + throw new Exception('Failed to find the lnkConnectableCIToNetworkDevice: '.$sOQL); + } + } else { $oLink1 = MetaModel::NewObject('lnkConnectableCIToNetworkDevice'); } - foreach ($aLinkData as $sAttCode => $value) - { - if ($sAttCode == 'id') continue; + foreach ($aLinkData as $sAttCode => $value) { + if ($sAttCode == 'id') { + continue; + } $oLink1->Set($sAttCode, $value); } $oLinkset->AddObject($oLink1); } - + // Write $oServer = MetaModel::GetObject('Server', $iServer); $oServer->Set('networkdevice_list', $oLinkset); $oServer->DBWrite(); - + // Check Results $bFoundIssue = false; $oServer = MetaModel::GetObject('Server', $iServer); $oLinkset = $oServer->Get('networkdevice_list'); - + $aRes = $this->StandardizedDump($oLinkset, 'connectableci_id'); $sRes = var_export($aRes, true); echo "Found:
    ".$sRes."
    \n"; - + $sExpectedRes = var_export($aScenario['expected-res'], true); - if ($sRes != $sExpectedRes) - { + if ($sRes != $sExpectedRes) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting:
    ".$sExpectedRes."
    \n"; } - + // Check History - $aQueryParams = array('change' => $iChange, 'objclass' => get_class($oServer), 'objkey' => $oServer->GetKey()); - - $oAdded = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'added'"), array(), $aQueryParams); + $aQueryParams = ['change' => $iChange, 'objclass' => get_class($oServer), 'objkey' => $oServer->GetKey()]; + + $oAdded = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'added'"), [], $aQueryParams); echo "added: ".$oAdded->Count()."
    \n"; - if ($aScenario['history_added'] != $oAdded->Count()) - { + if ($aScenario['history_added'] != $oAdded->Count()) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting: ".$aScenario['history_added']."
    \n"; } - - $oRemoved = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'removed'"), array(), $aQueryParams); + + $oRemoved = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'removed'"), [], $aQueryParams); echo "removed: ".$oRemoved->Count()."
    \n"; - if ($aScenario['history_removed'] != $oRemoved->Count()) - { + if ($aScenario['history_removed'] != $oRemoved->Count()) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting: ".$aScenario['history_removed']."
    \n"; } - - $oModified = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksTune WHERE objclass = :objclass AND objkey = :objkey AND change = :change"), array(), $aQueryParams); + + $oModified = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksTune WHERE objclass = :objclass AND objkey = :objkey AND change = :change"), [], $aQueryParams); echo "modified: ".$oModified->Count()."
    \n"; - if ($aScenario['history_modified'] != $oModified->Count()) - { + if ($aScenario['history_modified'] != $oModified->Count()) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting: ".$aScenario['history_modified']."
    \n"; } - - if ($bFoundIssue) - { + + if ($bFoundIssue) { throw new Exception('Stopping on failed scenario'); } } @@ -2510,12 +2473,12 @@ class TestLinkSetRecording_NN_WithDuplicates extends TestLinkSet class TestLinkSetRecording_NN_NoDuplicates extends TestLinkSet { - static public function GetName() + public static function GetName() { return 'Linksets N-N in general (99% of them)'; } - static public function GetDescription() + public static function GetDescription() { return 'Simulate CSV/data synchro type of recording. Check the values and the history.'; } @@ -2524,7 +2487,7 @@ class TestLinkSetRecording_NN_NoDuplicates extends TestLinkSet { CMDBSource::Query('START TRANSACTION'); //CMDBSource::Query('ROLLBACK'); automatique ! - + //////////////////////////////////////////////////////////////////////////////// // Set the stage // @@ -2533,213 +2496,212 @@ class TestLinkSetRecording_NN_NoDuplicates extends TestLinkSet $oTeam->Set('org_id', 3); $oTeam->DBInsert(); $iTeam = $oTeam->GetKey(); - + $oPerson = MetaModel::NewObject('Person'); $oPerson->Set('name', 'test person A'); $oPerson->Set('first_name', 'totoche'); $oPerson->Set('org_id', 3); $oPerson->DBInsert(); $iPerson1 = $oPerson->GetKey(); - + $oPerson = MetaModel::NewObject('Person'); $oPerson->Set('name', 'test person B'); $oPerson->Set('first_name', 'totoche'); $oPerson->Set('org_id', 3); $oPerson->DBInsert(); $iPerson2 = $oPerson->GetKey(); - + $oTypes = new DBObjectSet(DBSearch::FromOQL('SELECT ContactType WHERE name="Manager"')); $iRole = $oTypes->Fetch()->GetKey(); //////////////////////////////////////////////////////////////////////////////// // Scenarii // - $aScenarii = array( - array( + $aScenarii = [ + [ 'description' => 'Add the first item', - 'links' => array( - array( + 'links' => [ + [ 'person_id' => $iPerson1, 'team_id' => $iTeam, 'role_id' => 0, - ), - ), - 'expected-res' => array ( - "unit test linkset, $iPerson1, test person A, 0, , totoche test person A, ", - ), + ], + ], + 'expected-res' => [ + "unit test linkset, $iPerson1, test person A, 0, , totoche test person A, ", + ], 'history_added' => 1, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Modify the unique item', - 'links' => array( - array( + 'links' => [ + [ 'person_id' => $iPerson1, 'team_id' => $iTeam, 'role_id' => $iRole, - ), - ), - 'expected-res' => array ( - "unit test linkset, $iPerson1, test person A, $iRole, Manager, totoche test person A, Manager", - ), + ], + ], + 'expected-res' => [ + "unit test linkset, $iPerson1, test person A, $iRole, Manager, totoche test person A, Manager", + ], 'history_added' => 0, 'history_removed' => 0, 'history_modified' => 1, - ), - array( + ], + [ 'description' => 'Modify again the original item and add a second item', - 'links' => array( - array( + 'links' => [ + [ 'person_id' => $iPerson1, 'team_id' => $iTeam, 'role_id' => 0, - ), - array( + ], + [ 'person_id' => $iPerson2, 'team_id' => $iTeam, 'role_id' => 0, - ), - ), - 'expected-res' => array ( - "unit test linkset, $iPerson1, test person A, 0, , totoche test person A, ", - "unit test linkset, $iPerson2, test person B, 0, , totoche test person B, ", - ), + ], + ], + 'expected-res' => [ + "unit test linkset, $iPerson1, test person A, 0, , totoche test person A, ", + "unit test linkset, $iPerson2, test person B, 0, , totoche test person B, ", + ], 'history_added' => 1, 'history_removed' => 0, 'history_modified' => 1, - ), - array( + ], + [ 'description' => 'No change, the links are added in the reverse order', - 'links' => array( - array( + 'links' => [ + [ 'person_id' => $iPerson2, 'team_id' => $iTeam, 'role_id' => 0, - ), - array( + ], + [ 'person_id' => $iPerson1, 'team_id' => $iTeam, 'role_id' => 0, - ), - ), - 'expected-res' => array ( - "unit test linkset, $iPerson1, test person A, 0, , totoche test person A, ", - "unit test linkset, $iPerson2, test person B, 0, , totoche test person B, ", - ), + ], + ], + 'expected-res' => [ + "unit test linkset, $iPerson1, test person A, 0, , totoche test person A, ", + "unit test linkset, $iPerson2, test person B, 0, , totoche test person B, ", + ], 'history_added' => 0, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Removing A', - 'links' => array( - array( + 'links' => [ + [ 'person_id' => $iPerson2, 'team_id' => $iTeam, 'role_id' => 0, - ), - ), - 'expected-res' => array ( - "unit test linkset, $iPerson2, test person B, 0, , totoche test person B, ", - ), + ], + ], + 'expected-res' => [ + "unit test linkset, $iPerson2, test person B, 0, , totoche test person B, ", + ], 'history_added' => 0, 'history_removed' => 1, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Adding B again (duplicate!)', - 'links' => array( - array( + 'links' => [ + [ 'person_id' => $iPerson2, 'team_id' => $iTeam, 'role_id' => 0, - ), - array( + ], + [ 'person_id' => $iPerson2, 'team_id' => $iTeam, 'role_id' => 0, - ), - ), - 'expected-res' => array ( - "unit test linkset, $iPerson2, test person B, 0, , totoche test person B, ", - ), + ], + ], + 'expected-res' => [ + "unit test linkset, $iPerson2, test person B, 0, , totoche test person B, ", + ], 'history_added' => 0, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Remove all', - 'links' => array( - ), - 'expected-res' => array ( - ), + 'links' => [ + ], + 'expected-res' => [ + ], 'history_added' => 0, 'history_removed' => 1, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Add the first item (again)', - 'links' => array( - array( + 'links' => [ + [ 'person_id' => $iPerson1, 'team_id' => $iTeam, 'role_id' => 0, - ), - ), - 'expected-res' => array ( - "unit test linkset, $iPerson1, test person A, 0, , totoche test person A, ", - ), + ], + ], + 'expected-res' => [ + "unit test linkset, $iPerson1, test person A, 0, , totoche test person A, ", + ], 'history_added' => 1, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Set the role (based on reloaded links, like in the UI)', - 'links' => array( - array( + 'links' => [ + [ 'id' => "SELECT lnkPersonToTeam WHERE person_id=$iPerson1 AND team_id=$iTeam", 'person_id' => $iPerson1, 'team_id' => $iTeam, 'role_id' => $iRole, - ), - ), - 'expected-res' => array ( - "unit test linkset, $iPerson1, test person A, 14, Manager, totoche test person A, Manager", - ), + ], + ], + 'expected-res' => [ + "unit test linkset, $iPerson1, test person A, 14, Manager, totoche test person A, Manager", + ], 'history_added' => 0, 'history_removed' => 0, 'history_modified' => 1, - ), - array( + ], + [ 'description' => 'Clear the role and add another person with a role (based on reloaded links, like in the UI)', - 'links' => array( - array( + 'links' => [ + [ 'id' => "SELECT lnkPersonToTeam WHERE person_id=$iPerson1 AND team_id=$iTeam", 'person_id' => $iPerson1, 'team_id' => $iTeam, 'role_id' => 0, - ), - array( + ], + [ 'person_id' => $iPerson2, 'team_id' => $iTeam, 'role_id' => $iRole, - ), - ), - 'expected-res' => array ( - "unit test linkset, $iPerson1, test person A, 0, , totoche test person A, ", - "unit test linkset, $iPerson2, test person B, 14, Manager, totoche test person B, Manager", - ), + ], + ], + 'expected-res' => [ + "unit test linkset, $iPerson1, test person A, 0, , totoche test person A, ", + "unit test linkset, $iPerson2, test person B, 14, Manager, totoche test person B, Manager", + ], 'history_added' => 1, 'history_removed' => 0, 'history_modified' => 1, - ), - ); - - foreach ($aScenarii as $aScenario) - { + ], + ]; + + foreach ($aScenarii as $aScenario) { echo "

    ".$aScenario['description']."

    \n"; - + $oChange = MetaModel::NewObject("CMDBChange"); $oChange->Set("date", time()); $oChange->Set("userinfo", CMDBChange::GetCurrentUserName()); @@ -2747,80 +2709,74 @@ class TestLinkSetRecording_NN_NoDuplicates extends TestLinkSet $oChange->DBInsert(); CMDBObject::SetCurrentChange($oChange); $iChange = $oChange->GetKey(); - + // Prepare set $oLinkset = DBObjectSet::FromScratch('lnkPersonToTeam'); - foreach ($aScenario['links'] as $aLinkData) - { - if (array_key_exists('id', $aLinkData)) - { + foreach ($aScenario['links'] as $aLinkData) { + if (array_key_exists('id', $aLinkData)) { $sOQL = $aLinkData['id']; $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL)); $oLink1 = $oSet->Fetch(); - if (!is_object($oLink1)) throw new Exception('Failed to find the lnkPersonToTeam: '.$sOQL); - } - else - { + if (!is_object($oLink1)) { + throw new Exception('Failed to find the lnkPersonToTeam: '.$sOQL); + } + } else { $oLink1 = MetaModel::NewObject('lnkPersonToTeam'); } - foreach ($aLinkData as $sAttCode => $value) - { - if ($sAttCode == 'id') continue; + foreach ($aLinkData as $sAttCode => $value) { + if ($sAttCode == 'id') { + continue; + } $oLink1->Set($sAttCode, $value); } $oLinkset->AddObject($oLink1); } - + // Write $oTeam = MetaModel::GetObject('Team', $iTeam); $oTeam->Set('persons_list', $oLinkset); $oTeam->DBWrite(); - + // Check Results $bFoundIssue = false; $oTeam = MetaModel::GetObject('Team', $iTeam); $oLinkset = $oTeam->Get('persons_list'); - + $aRes = $this->StandardizedDump($oLinkset, 'team_id'); $sRes = var_export($aRes, true); echo "Found:
    ".$sRes."
    \n"; - + $sExpectedRes = var_export($aScenario['expected-res'], true); - if ($sRes != $sExpectedRes) - { + if ($sRes != $sExpectedRes) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting:
    ".$sExpectedRes."
    \n"; } - + // Check History - $aQueryParams = array('change' => $iChange, 'objclass' => get_class($oTeam), 'objkey' => $oTeam->GetKey()); - - $oAdded = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'added'"), array(), $aQueryParams); + $aQueryParams = ['change' => $iChange, 'objclass' => get_class($oTeam), 'objkey' => $oTeam->GetKey()]; + + $oAdded = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'added'"), [], $aQueryParams); echo "added: ".$oAdded->Count()."
    \n"; - if ($aScenario['history_added'] != $oAdded->Count()) - { + if ($aScenario['history_added'] != $oAdded->Count()) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting: ".$aScenario['history_added']."
    \n"; } - - $oRemoved = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'removed'"), array(), $aQueryParams); + + $oRemoved = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'removed'"), [], $aQueryParams); echo "removed: ".$oRemoved->Count()."
    \n"; - if ($aScenario['history_removed'] != $oRemoved->Count()) - { + if ($aScenario['history_removed'] != $oRemoved->Count()) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting: ".$aScenario['history_removed']."
    \n"; } - - $oModified = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksTune WHERE objclass = :objclass AND objkey = :objkey AND change = :change"), array(), $aQueryParams); + + $oModified = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksTune WHERE objclass = :objclass AND objkey = :objkey AND change = :change"), [], $aQueryParams); echo "modified: ".$oModified->Count()."
    \n"; - if ($aScenario['history_modified'] != $oModified->Count()) - { + if ($aScenario['history_modified'] != $oModified->Count()) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting: ".$aScenario['history_modified']."
    \n"; } - - if ($bFoundIssue) - { + + if ($bFoundIssue) { throw new Exception('Stopping on failed scenario'); } } @@ -2829,12 +2785,12 @@ class TestLinkSetRecording_NN_NoDuplicates extends TestLinkSet class TestLinkSetRecording_1N extends TestLinkSet { - static public function GetName() + public static function GetName() { return 'Linkset 1-N (Network Interface vs Server: Edit in-place)'; } - static public function GetDescription() + public static function GetDescription() { return 'Simulate CSV/data synchro type of recording. Check the values and the history.'; } @@ -2856,103 +2812,102 @@ class TestLinkSetRecording_1N extends TestLinkSet //////////////////////////////////////////////////////////////////////////////// // Scenarii // - $aScenarii = array( - array( + $aScenarii = [ + [ 'description' => 'Add the first interface', - 'interfaces' => array( - array( + 'interfaces' => [ + [ 'connectableci_id' => $iServer, 'name' => 'eth0', 'speed' => '1000.00', - ), - ), - 'expected-res' => array ( + ], + ], + 'expected-res' => [ "eth0, , , , , , 1000.00, $iServer, unit test linkset, PhysicalInterface, unit test linkset, Server", - ), + ], 'history_added' => 1, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Add a second interface', - 'interfaces' => array( - array( + 'interfaces' => [ + [ 'connectableci_id' => $iServer, 'name' => 'eth0', 'speed' => '1000.00', - ), - array( + ], + [ 'connectableci_id' => $iServer, 'name' => 'eth1', 'speed' => '1000.00', - ), - ), - 'expected-res' => array ( + ], + ], + 'expected-res' => [ "eth0, , , , , , 1000.00, $iServer, unit test linkset, PhysicalInterface, unit test linkset, Server", "eth1, , , , , , 1000.00, $iServer, unit test linkset, PhysicalInterface, unit test linkset, Server", - ), + ], 'history_added' => 1, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Change the speed of an interface', - 'interfaces' => array( - array( + 'interfaces' => [ + [ 'connectableci_id' => $iServer, 'name' => 'eth0', 'speed' => '100.00', - ), - array( + ], + [ 'connectableci_id' => $iServer, 'name' => 'eth1', 'speed' => '1000.00', - ), - ), - 'expected-res' => array ( + ], + ], + 'expected-res' => [ "eth0, , , , , , 100.00, $iServer, unit test linkset, PhysicalInterface, unit test linkset, Server", "eth1, , , , , , 1000.00, $iServer, unit test linkset, PhysicalInterface, unit test linkset, Server", - ), + ], 'history_added' => 1, 'history_removed' => 1, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Change the name of an interface', - 'interfaces' => array( - array( + 'interfaces' => [ + [ 'connectableci_id' => $iServer, 'name' => 'eth0-renamed', 'speed' => '1000.00', - ), - array( + ], + [ 'connectableci_id' => $iServer, 'name' => 'eth1', 'speed' => '1000.00', - ), - ), - 'expected-res' => array ( + ], + ], + 'expected-res' => [ "eth0-renamed, , , , , , 1000.00, $iServer, unit test linkset, PhysicalInterface, unit test linkset, Server", "eth1, , , , , , 1000.00, $iServer, unit test linkset, PhysicalInterface, unit test linkset, Server", - ), + ], 'history_added' => 1, 'history_removed' => 1, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Remove all interfaces', - 'interfaces' => array( - ), - 'expected-res' => array ( - ), + 'interfaces' => [ + ], + 'expected-res' => [ + ], 'history_added' => 0, 'history_removed' => 2, 'history_modified' => 0, - ), - ); + ], + ]; - foreach ($aScenarii as $aScenario) - { + foreach ($aScenarii as $aScenario) { echo "

    ".$aScenario['description']."

    \n"; $oChange = MetaModel::NewObject("CMDBChange"); @@ -2962,84 +2917,76 @@ class TestLinkSetRecording_1N extends TestLinkSet $oChange->DBInsert(); CMDBObject::SetCurrentChange($oChange); $iChange = $oChange->GetKey(); - + // Prepare set $oLinkset = DBObjectSet::FromScratch('PhysicalInterface'); - foreach ($aScenario['interfaces'] as $aIntfData) - { + foreach ($aScenario['interfaces'] as $aIntfData) { $oInterface = MetaModel::NewObject('PhysicalInterface'); - foreach ($aIntfData as $sAttCode => $value) - { + foreach ($aIntfData as $sAttCode => $value) { $oInterface->Set($sAttCode, $value); } $oLinkset->AddObject($oInterface); } - + // Write $oServer = MetaModel::GetObject('Server', $iServer); $oServer->Set('physicalinterface_list', $oLinkset); $oServer->DBWrite(); - + // Check Results $bFoundIssue = false; $oServer = MetaModel::GetObject('Server', $iServer); $oLinkset = $oServer->Get('physicalinterface_list'); - + $aRes = $this->StandardizedDump($oLinkset, 'zzz'); $sRes = var_export($aRes, true); echo "Found:
    ".$sRes."
    \n"; $sExpectedRes = var_export($aScenario['expected-res'], true); - if ($sRes != $sExpectedRes) - { + if ($sRes != $sExpectedRes) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting:
    ".$sExpectedRes."
    \n"; } - + // Check History - $aQueryParams = array('change' => $iChange, 'objclass' => get_class($oServer), 'objkey' => $oServer->GetKey()); - - $oAdded = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'added'"), array(), $aQueryParams); + $aQueryParams = ['change' => $iChange, 'objclass' => get_class($oServer), 'objkey' => $oServer->GetKey()]; + + $oAdded = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'added'"), [], $aQueryParams); echo "added: ".$oAdded->Count()."
    \n"; - if ($aScenario['history_added'] != $oAdded->Count()) - { + if ($aScenario['history_added'] != $oAdded->Count()) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting: ".$aScenario['history_added']."
    \n"; } - $oRemoved = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'removed'"), array(), $aQueryParams); + $oRemoved = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'removed'"), [], $aQueryParams); echo "removed: ".$oRemoved->Count()."
    \n"; - if ($aScenario['history_removed'] != $oRemoved->Count()) - { + if ($aScenario['history_removed'] != $oRemoved->Count()) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting: ".$aScenario['history_removed']."
    \n"; } - $oModified = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksTune WHERE objclass = :objclass AND objkey = :objkey AND change = :change"), array(), $aQueryParams); + $oModified = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksTune WHERE objclass = :objclass AND objkey = :objkey AND change = :change"), [], $aQueryParams); echo "modified: ".$oModified->Count()."
    \n"; - if ($aScenario['history_modified'] != $oModified->Count()) - { + if ($aScenario['history_modified'] != $oModified->Count()) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting: ".$aScenario['history_modified']."
    \n"; } - if ($bFoundIssue) - { + if ($bFoundIssue) { throw new Exception('Stopping on failed scenario'); } } } } - class TestLinkSetRecording_1NAdd_Remove extends TestLinkSet { - static public function GetName() + public static function GetName() { return 'Linkset 1-N (Delivery Model vs Organization: Edit Add/Remove)'; } - static public function GetDescription() + public static function GetDescription() { return 'Simulate CSV/data synchro type of recording. Check the values and the history.'; } @@ -3056,7 +3003,7 @@ class TestLinkSetRecording_1NAdd_Remove extends TestLinkSet $oProvider->Set('name', 'Test-Provider1'); $oProvider->DBInsert(); $iProvider = $oProvider->GetKey(); - + $oDM1 = new DeliveryModel(); $oDM1->Set('name', 'Test-DM-1'); $oDM1->Set('org_id', $iProvider); @@ -3072,97 +3019,96 @@ class TestLinkSetRecording_1NAdd_Remove extends TestLinkSet //////////////////////////////////////////////////////////////////////////////// // Scenarii // - $aScenarii = array( - array( + $aScenarii = [ + [ 'description' => 'Add the first customer', - 'organizations' => array( - array( + 'organizations' => [ + [ 'deliverymodel_id' => $iDM1, 'name' => 'Test-Customer-1', - ), - ), - 'expected-res' => array ( + ], + ], + 'expected-res' => [ "Test-Customer-1, , active, 0, , $iDM1, Test-DM-1, , Test-DM-1", - ), + ], 'history_added' => 0, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Remove the customer by loading an empty set', - 'organizations' => array( - ), - 'expected-res' => array ( - ), + 'organizations' => [ + ], + 'expected-res' => [ + ], 'history_added' => 0, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Create two customers at once', - 'organizations' => array( - array( + 'organizations' => [ + [ 'deliverymodel_id' => $iDM1, 'name' => 'Test-Customer-1', - ), - array( + ], + [ 'deliverymodel_id' => $iDM1, 'name' => 'Test-Customer-2', - ), - ), - 'expected-res' => array ( + ], + ], + 'expected-res' => [ "Test-Customer-1, , active, 0, , $iDM1, Test-DM-1, , Test-DM-1", "Test-Customer-2, , active, 0, , $iDM1, Test-DM-1, , Test-DM-1", - ), + ], 'history_added' => 0, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Move Customer-1 to the second Delivery Model', - 'organizations' => array( - array( + 'organizations' => [ + [ 'id' => "SELECT Organization WHERE name='Test-Customer-1'", 'deliverymodel_id' => $iDM2, 'name' => 'Test-Customer-1', - ), - array( + ], + [ 'deliverymodel_id' => $iDM1, 'name' => 'Test-Customer-2', - ), - ), - 'expected-res' => array ( + ], + ], + 'expected-res' => [ "Test-Customer-2, , active, 0, , $iDM1, Test-DM-1, , Test-DM-1", - ), + ], 'history_added' => 0, 'history_removed' => 0, 'history_modified' => 0, - ), - array( + ], + [ 'description' => 'Move Customer-1 back to the first Delivery Model and reset Customer-2 (no Delivery Model)', - 'organizations' => array( - array( + 'organizations' => [ + [ 'id' => "SELECT Organization WHERE name='Test-Customer-1'", 'deliverymodel_id' => $iDM1, 'name' => 'Test-Customer-1', - ), - array( + ], + [ 'id' => "SELECT Organization WHERE name='Test-Customer-2'", 'deliverymodel_id' => 0, 'name' => 'Test-Customer-2', - ), - ), - 'expected-res' => array ( + ], + ], + 'expected-res' => [ "Test-Customer-1, , active, 0, , $iDM1, Test-DM-1, , Test-DM-1", - ), + ], 'history_added' => 0, 'history_removed' => 0, 'history_modified' => 0, - ), - ); + ], + ]; - foreach ($aScenarii as $aScenario) - { + foreach ($aScenarii as $aScenario) { echo "

    ".$aScenario['description']."

    \n"; $oChange = MetaModel::NewObject("CMDBChange"); @@ -3175,22 +3121,21 @@ class TestLinkSetRecording_1NAdd_Remove extends TestLinkSet // Prepare set $oLinkset = DBObjectSet::FromScratch('Organization'); - foreach ($aScenario['organizations'] as $aOrgData) - { - if (array_key_exists('id', $aOrgData)) - { + foreach ($aScenario['organizations'] as $aOrgData) { + if (array_key_exists('id', $aOrgData)) { $sOQL = $aOrgData['id']; $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL)); $oOrg = $oSet->Fetch(); - if (!is_object($oOrg)) throw new Exception('Failed to find the Organization: '.$sOQL); - } - else - { + if (!is_object($oOrg)) { + throw new Exception('Failed to find the Organization: '.$sOQL); + } + } else { $oOrg = MetaModel::NewObject('Organization'); } - foreach ($aOrgData as $sAttCode => $value) - { - if ($sAttCode == 'id') continue; + foreach ($aOrgData as $sAttCode => $value) { + if ($sAttCode == 'id') { + continue; + } $oOrg->Set($sAttCode, $value); } $oLinkset->AddObject($oOrg); @@ -3211,41 +3156,36 @@ class TestLinkSetRecording_1NAdd_Remove extends TestLinkSet echo "Found:
    ".$sRes."
    \n"; $sExpectedRes = var_export($aScenario['expected-res'], true); - if ($sRes != $sExpectedRes) - { + if ($sRes != $sExpectedRes) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting:
    ".$sExpectedRes."
    \n"; } // Check History - $aQueryParams = array('change' => $iChange, 'objclass' => get_class($oDM), 'objkey' => $oDM->GetKey()); + $aQueryParams = ['change' => $iChange, 'objclass' => get_class($oDM), 'objkey' => $oDM->GetKey()]; - $oAdded = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'added'"), array(), $aQueryParams); + $oAdded = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'added'"), [], $aQueryParams); echo "added: ".$oAdded->Count()."
    \n"; - if ($aScenario['history_added'] != $oAdded->Count()) - { + if ($aScenario['history_added'] != $oAdded->Count()) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting: ".$aScenario['history_added']."
    \n"; } - $oRemoved = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'removed'"), array(), $aQueryParams); + $oRemoved = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksAddRemove WHERE objclass = :objclass AND objkey = :objkey AND change = :change AND type = 'removed'"), [], $aQueryParams); echo "removed: ".$oRemoved->Count()."
    \n"; - if ($aScenario['history_removed'] != $oRemoved->Count()) - { + if ($aScenario['history_removed'] != $oRemoved->Count()) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting: ".$aScenario['history_removed']."
    \n"; } - $oModified = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksTune WHERE objclass = :objclass AND objkey = :objkey AND change = :change"), array(), $aQueryParams); + $oModified = new DBObjectSet(DBSearch::FromOQL("SELECT CMDBChangeOpSetAttributeLinksTune WHERE objclass = :objclass AND objkey = :objkey AND change = :change"), [], $aQueryParams); echo "modified: ".$oModified->Count()."
    \n"; - if ($aScenario['history_modified'] != $oModified->Count()) - { + if ($aScenario['history_modified'] != $oModified->Count()) { $bFoundIssue = true; echo "NOT COMPLIANT!!! Expecting: ".$aScenario['history_modified']."
    \n"; } - if ($bFoundIssue) - { + if ($bFoundIssue) { throw new Exception('Stopping on failed scenario'); } } @@ -3254,13 +3194,19 @@ class TestLinkSetRecording_1NAdd_Remove extends TestLinkSet class TestDateTimeFormats extends TestBizModel { - static public function GetName() {return 'Check Date & Time formating and parsing';} - static public function GetDescription() {return 'Check the formating and parsing of dates for various formats';} + public static function GetName() + { + return 'Check Date & Time formating and parsing'; + } + public static function GetDescription() + { + return 'Check the formating and parsing of dates for various formats'; + } public function DoExecute() { require_once(APPROOT.'core/datetimeformat.class.inc.php'); $bRet = true; - $aTestFormats = array( + $aTestFormats = [ 'French (short)' => 'd/m/Y H:i:s', 'French (short - no seconds)' => 'd/m/Y H:i', 'French (long)' => 'd/m/Y H\\h i\\m\\i\\n s\\s', @@ -3270,60 +3216,53 @@ class TestDateTimeFormats extends TestBizModel 'English UK' => 'd/m/Y H:i:s', 'German' => 'd.m.Y H:i:s', 'SQL' => 'Y-m-d H:i:s', - ); + ]; // Valid date and times, all tests should pass - $aTestDates = array('2015-01-01 00:00:00', '2015-12-31 23:59:00', '2016-01-01 08:21:00', '2016-02-28 12:30:00', '2016-02-29 16:47:00', /*'2016-02-29 14:30:17'*/); - foreach($aTestFormats as $sDesc => $sFormat) - { + $aTestDates = ['2015-01-01 00:00:00', '2015-12-31 23:59:00', '2016-01-01 08:21:00', '2016-02-28 12:30:00', '2016-02-29 16:47:00', /*'2016-02-29 14:30:17'*/]; + foreach ($aTestFormats as $sDesc => $sFormat) { $this->ReportSuccess("Test of the '$sDesc' format: '$sFormat':"); $oFormat = new DateTimeFormat($sFormat); - foreach($aTestDates as $sTestDate) - { + foreach ($aTestDates as $sTestDate) { $oDate = new DateTime($sTestDate); $sFormattedDate = $oFormat->Format($oDate); $oParsedDate = $oFormat->Parse($sFormattedDate); $sPattern = $oFormat->ToRegExpr('/'); $bParseOk = ($oParsedDate->format('Y-m-d H:i:s') == $sTestDate); - if (!$bParseOk) - { - $this->ReportError('Parsed ('.$sFormattedDate.') date different from initial date (difference of '.((int)$oParsedDate->format('U')- (int)$oDate->format('U')).'s)'); + if (!$bParseOk) { + $this->ReportError('Parsed ('.$sFormattedDate.') date different from initial date (difference of '.((int)$oParsedDate->format('U') - (int)$oDate->format('U')).'s)'); $bRet = false; } $bValidateOk = preg_match($sPattern, $sFormattedDate); - if (!$bValidateOk) - { + if (!$bValidateOk) { $this->ReportError('Formatted date ('.$sFormattedDate.') does not match the validation pattern ('.$sPattern.')'); $bRet = false; } - + $this->ReportSuccess("Formatted date: $sFormattedDate - Parsing: ".($bParseOk ? 'Ok' : 'KO')." - Validation: ".($bValidateOk ? 'Ok' : 'KO')); } echo "

    \n"; } // Invalid date & time strings, all regexpr validation should fail - $aInvalidTestDates = array( - 'SQL' => array('2015-13-01 00:00:00', '2015-12-51 23:59:00', '2016-01-01 +08:21:00', '2016-02-28 24:30:00', '2016-02-29 16:67:88'), - 'French (short)' => array('01/01/20150 00:00:00', '01/01/20150 00:00:00', '01/13/2015 00:00:00', '01/01/2015 40:00:00', '01/01/2015 00:99:00'), - 'English US (12 hours)' => array('13/01/2015 12:00:00 am', '12/33/2015 12:00:00 am', '12/23/215 12:00:00 am', '05/04/2016 16:00:00 am', '05/04/2016 10:00:00 ap'), - ); - - foreach($aInvalidTestDates as $sFormatName => $aDatesToParse) - { + $aInvalidTestDates = [ + 'SQL' => ['2015-13-01 00:00:00', '2015-12-51 23:59:00', '2016-01-01 +08:21:00', '2016-02-28 24:30:00', '2016-02-29 16:67:88'], + 'French (short)' => ['01/01/20150 00:00:00', '01/01/20150 00:00:00', '01/13/2015 00:00:00', '01/01/2015 40:00:00', '01/01/2015 00:99:00'], + 'English US (12 hours)' => ['13/01/2015 12:00:00 am', '12/33/2015 12:00:00 am', '12/23/215 12:00:00 am', '05/04/2016 16:00:00 am', '05/04/2016 10:00:00 ap'], + ]; + + foreach ($aInvalidTestDates as $sFormatName => $aDatesToParse) { $sFormat = $aTestFormats[$sFormatName]; $oFormat = new DateTimeFormat($sFormat); $this->ReportSuccess("Test of the '$sFormatName' format: '$sFormat':"); - foreach($aDatesToParse as $sDate) - { + foreach ($aDatesToParse as $sDate) { $sPattern = $oFormat->ToRegExpr('/'); $bValidateOk = preg_match($sPattern, $sDate); - if ($bValidateOk) - { + if ($bValidateOk) { $this->ReportError('Formatted date ('.$sFormattedDate.') matches the validation pattern ('.$sPattern.') whereas it should not!'); $bRet = false; } $this->ReportSuccess("Formatted date: $sDate - Validation: ".($bValidateOk ? 'KO' : 'rejected, Ok.')); - } + } } return $bRet; } @@ -3331,12 +3270,12 @@ class TestDateTimeFormats extends TestBizModel class TestExecActions extends TestBizModel { - static public function GetName() + public static function GetName() { return 'Scripted actions API DBObject::ExecAction - syntax errors'; } - static public function GetDescription() + public static function GetDescription() { return 'Check that wrong arguments are correclty reported'; } @@ -3352,131 +3291,125 @@ class TestExecActions extends TestBizModel //////////////////////////////////////////////////////////////////////////////// // Scenarii // - $aScenarii = array( - array( + $aScenarii = [ + [ 'action' => 'set', - 'error' => 'Action: set - Invalid syntax' - ), - array( + 'error' => 'Action: set - Invalid syntax', + ], + [ 'action' => 'smurf()', - 'error' => 'Action: smurf() - Invalid verb' - ), - array( + 'error' => 'Action: smurf() - Invalid verb', + ], + [ 'action' => ' smurf () ', - 'error' => 'Action: smurf () - Invalid syntax' - ), - array( + 'error' => 'Action: smurf () - Invalid syntax', + ], + [ 'action' => 'clone(some_att_code, another_one)', - 'error' => 'Action: clone(some_att_code, another_one) - Unknown attribute Server::some_att_code' - ), - array( + 'error' => 'Action: clone(some_att_code, another_one) - Unknown attribute Server::some_att_code', + ], + [ 'action' => 'copy(toto, titi)', - 'error' => 'Action: copy(toto, titi) - Unknown attribute Server::titi' - ), - array( + 'error' => 'Action: copy(toto, titi) - Unknown attribute Server::titi', + ], + [ 'action' => 'copy(toto, name)', - 'error' => 'Action: copy(toto, name) - Unknown attribute UserRequest::toto' - ), - array( + 'error' => 'Action: copy(toto, name) - Unknown attribute UserRequest::toto', + ], + [ 'action' => 'copy()', - 'error' => 'Action: copy() - Missing argument #1: source attribute' - ), - array( + 'error' => 'Action: copy() - Missing argument #1: source attribute', + ], + [ 'action' => 'copy(title)', - 'error' => 'Action: copy(title) - Missing argument #2: target attribute' - ), - array( + 'error' => 'Action: copy(title) - Missing argument #2: target attribute', + ], + [ 'action' => 'set(toto)', - 'error' => 'Action: set(toto) - Unknown attribute Server::toto' - ), - array( + 'error' => 'Action: set(toto) - Unknown attribute Server::toto', + ], + [ 'action' => 'set(toto, something)', - 'error' => 'Action: set(toto, something) - Unknown attribute Server::toto' - ), - array( + 'error' => 'Action: set(toto, something) - Unknown attribute Server::toto', + ], + [ 'action' => 'set()', - 'error' => 'Action: set() - Missing argument #1: target attribute' - ), - array( + 'error' => 'Action: set() - Missing argument #1: target attribute', + ], + [ 'action' => 'reset(toto)', - 'error' => 'Action: reset(toto) - Unknown attribute Server::toto' - ), - array( + 'error' => 'Action: reset(toto) - Unknown attribute Server::toto', + ], + [ 'action' => 'reset()', - 'error' => 'Action: reset() - Missing argument #1: target attribute' - ), - array( + 'error' => 'Action: reset() - Missing argument #1: target attribute', + ], + [ 'action' => 'nullify(toto)', - 'error' => 'Action: nullify(toto) - Unknown attribute Server::toto' - ), - array( + 'error' => 'Action: nullify(toto) - Unknown attribute Server::toto', + ], + [ 'action' => 'nullify()', - 'error' => 'Action: nullify() - Missing argument #1: target attribute' - ), - array( + 'error' => 'Action: nullify() - Missing argument #1: target attribute', + ], + [ 'action' => 'append(toto, something)', - 'error' => 'Action: append(toto, something) - Unknown attribute Server::toto' - ), - array( + 'error' => 'Action: append(toto, something) - Unknown attribute Server::toto', + ], + [ 'action' => 'append(name)', - 'error' => 'Action: append(name) - Missing argument #2: value to append' - ), - array( + 'error' => 'Action: append(name) - Missing argument #2: value to append', + ], + [ 'action' => 'append()', - 'error' => 'Action: append() - Missing argument #1: target attribute' - ), - array( + 'error' => 'Action: append() - Missing argument #1: target attribute', + ], + [ 'action' => 'add_to_list(toto, titi)', - 'error' => 'Action: add_to_list(toto, titi) - Unknown attribute UserRequest::toto' - ), - array( + 'error' => 'Action: add_to_list(toto, titi) - Unknown attribute UserRequest::toto', + ], + [ 'action' => 'add_to_list(caller_id, titi)', - 'error' => 'Action: add_to_list(caller_id, titi) - Unknown attribute Server::titi' - ), - array( + 'error' => 'Action: add_to_list(caller_id, titi) - Unknown attribute Server::titi', + ], + [ 'action' => 'add_to_list(caller_id)', - 'error' => 'Action: add_to_list(caller_id) - Missing argument #2: target attribute (link set)' - ), - array( + 'error' => 'Action: add_to_list(caller_id) - Missing argument #2: target attribute (link set)', + ], + [ 'action' => 'add_to_list()', - 'error' => 'Action: add_to_list() - Missing argument #1: source attribute' - ), - array( + 'error' => 'Action: add_to_list() - Missing argument #1: source attribute', + ], + [ 'action' => 'apply_stimulus(toto)', - 'error' => 'Action: apply_stimulus(toto) - Unknown stimulus Server::toto' - ), - array( + 'error' => 'Action: apply_stimulus(toto) - Unknown stimulus Server::toto', + ], + [ 'action' => 'apply_stimulus()', - 'error' => 'Action: apply_stimulus() - Missing argument #1: stimulus' - ), - array( + 'error' => 'Action: apply_stimulus() - Missing argument #1: stimulus', + ], + [ 'action' => 'call_method(toto)', - 'error' => 'Action: call_method(toto) - Unknown method Server::toto()' - ), - array( + 'error' => 'Action: call_method(toto) - Unknown method Server::toto()', + ], + [ 'action' => 'call_method()', - 'error' => 'Action: call_method() - Missing argument #1: method name' - ), - ); + 'error' => 'Action: call_method() - Missing argument #1: method name', + ], + ]; - foreach ($aScenarii as $aScenario) - { + foreach ($aScenarii as $aScenario) { echo "

    ".htmlentities($aScenario['action'], ENT_QUOTES, 'UTF-8')."

    \n"; $sMessage = ''; - try - { - $oTarget->ExecActions(array($aScenario['action']), array('source' => $oSource)); + try { + $oTarget->ExecActions([$aScenario['action']], ['source' => $oSource]); $sMessage = 'Expecting an exception... none has been thrown!'; - } - catch (Exception $e) - { - if ($e->getMessage() != $aScenario['error']) - { + } catch (Exception $e) { + if ($e->getMessage() != $aScenario['error']) { $sMessage = 'Wrong message: expecting "'.$aScenario['error'].'" and got "'.$e->getMessage().'"'; } } - if ($sMessage !='') - { + if ($sMessage != '') { throw new Exception($sMessage); } } @@ -3485,19 +3418,19 @@ class TestExecActions extends TestBizModel class TestParsingOptimization extends TestBizModel { - static public function GetName() + public static function GetName() { return 'Query optimizations (Merging joins on OQL parsing)'; } - static public function GetDescription() + public static function GetDescription() { return 'Checking a few queries that do involve query optimizations (implemented for the sake of optimizing the portal)'; } protected function DoExecute() { - $aQueries = array( + $aQueries = [ "SELECT UserRequest AS u JOIN Person AS p1 ON u.caller_id=p1.id JOIN Organization AS o1 ON p1.org_id=o1.id @@ -3510,9 +3443,8 @@ class TestParsingOptimization extends TestBizModel JOIN Organization AS o1 ON p1.org_id=o1.id JOIN Person ON u.caller_id=Person.id JOIN Location AS l ON Person.location_id = l.id WHERE Person.status='active' AND p1.status='inactive' AND l.country='France'", - ); - foreach ($aQueries as $sQuery) - { + ]; + foreach ($aQueries as $sQuery) { echo "
    To Parse: ".htmlentities($sQuery, ENT_QUOTES, 'UTF-8')."
    \n"; $oSearch = DBSearch::FromOQL($sQuery); $sQueryOpt = $oSearch->ToOQL(); @@ -3525,12 +3457,12 @@ class TestParsingOptimization extends TestBizModel class TestUnions extends TestBizModel { - static public function GetName() + public static function GetName() { return 'Unions'; } - static public function GetDescription() + public static function GetDescription() { return 'Checking a few UNION queries'; } @@ -3539,27 +3471,27 @@ class TestUnions extends TestBizModel { // The two first items did reveal an issue with the query cache, //because SELECT Person on the second line must not give the same query as SELECT Person on the first line - $aQueries = array( + $aQueries = [ "SELECT Person UNION SELECT Person" => true, "SELECT Person UNION SELECT Team" => true, "SELECT Person UNION SELECT Contact" => true, "SELECT Contact UNION SELECT Person" => true, "SELECT Person UNION SELECT Organization" => false, - ); - foreach ($aQueries as $sQuery => $bSuccess) - { + ]; + foreach ($aQueries as $sQuery => $bSuccess) { echo "
    To Parse: ".htmlentities($sQuery, ENT_QUOTES, 'UTF-8')."
    \n"; - try - { + try { $oSearch = DBSearch::FromOQL($sQuery); - if (!$bSuccess) throw new Exception('This query should not be parsable!'); + if (!$bSuccess) { + throw new Exception('This query should not be parsable!'); + } CMDBSource::TestQuery($oSearch->MakeSelectQuery()); echo "

    Successfully tested the SQL query.

    \n"; - } - catch (OQLException $e) - { - if ($bSuccess) throw $e; + } catch (OQLException $e) { + if ($bSuccess) { + throw $e; + } echo "

    Failed as expected.

    \n"; } } @@ -3568,12 +3500,12 @@ class TestUnions extends TestBizModel class TestImplicitAlias extends TestBizModel { - static public function GetName() + public static function GetName() { return 'OQLImplicitAliases'; } - static public function GetDescription() + public static function GetDescription() { return 'Checking implicit aliases resolution'; } @@ -3582,7 +3514,7 @@ class TestImplicitAlias extends TestBizModel { // The two first items did reveal an issue with the query cache, //because SELECT Person on the second line must not give the same query as SELECT Person on the first line - $aQueries = array( + $aQueries = [ "SELECT Person WHERE org_id = 1" => true, "SELECT Person WHERE s.org_id = 1" => false, "SELECT Person AS p WHERE p.org_id = 1" => true, @@ -3593,21 +3525,21 @@ class TestImplicitAlias extends TestBizModel "SELECT Server JOIN Location ON Server = Location.id" => false, "SELECT Server JOIN Location ON Server.location_id = Location.id WHERE Server.org_id = 1" => true, "SELECT Server JOIN Location ON Server.location_id = Location.id WHERE org_id = 1" => false, - ); - foreach ($aQueries as $sQuery => $bSuccess) - { + ]; + foreach ($aQueries as $sQuery => $bSuccess) { echo "
    To Parse: ".htmlentities($sQuery, ENT_QUOTES, 'UTF-8')."
    \n"; - try - { + try { $oSearch = DBSearch::FromOQL($sQuery); - if (!$bSuccess) throw new Exception('This query should not be parsable!'); + if (!$bSuccess) { + throw new Exception('This query should not be parsable!'); + } CMDBSource::TestQuery($oSearch->MakeSelectQuery()); echo "

    Successfully tested the SQL query.

    \n"; - } - catch (OQLException $e) - { - if ($bSuccess) throw $e; + } catch (OQLException $e) { + if ($bSuccess) { + throw $e; + } echo "

    Failed as expected.

    \n"; } } @@ -3616,12 +3548,12 @@ class TestImplicitAlias extends TestBizModel class TestBug609 extends TestBizModel { - static public function GetName() + public static function GetName() { return 'UNION with JOINS ordered differently'; } - static public function GetDescription() + public static function GetDescription() { return '(N.609) Inconsistent SQL query (various symptoms, must mostly in the form of "Class \'IT Department\' not found"'; } @@ -3634,8 +3566,7 @@ class TestBug609 extends TestBizModel $oSearch = DBSearch::FromOQL("$sQueryB UNION $sQueryA"); $oSet = new DBObjectSet($oSearch); - while($oObject = $oSet->Fetch()) - { + while ($oObject = $oSet->Fetch()) { echo "Successfull load for ".$oObject->GetName()."
    \n"; } } @@ -3643,12 +3574,12 @@ class TestBug609 extends TestBizModel class TestBug788 extends TestBizModel { - static public function GetName() + public static function GetName() { return 'Graph - delete nodes'; } - static public function GetDescription() + public static function GetDescription() { return '(N.788) Graph not refreshed when unchecking some classes'; } @@ -3673,8 +3604,7 @@ class TestBug788 extends TestBizModel echo $oGraph->DumpAsHtmlImage(); echo $oGraph->DumpAsHTMLText(); - if ((count($oGraph->_GetNodes()) != 2) || (count($oGraph->_GetEdges()) != 1)) - { + if ((count($oGraph->_GetNodes()) != 2) || (count($oGraph->_GetEdges()) != 1)) { throw new Exception('The graph should be made of 2 nodes and 1 edge'); } @@ -3684,8 +3614,7 @@ class TestBug788 extends TestBizModel echo $oGraph->DumpAsHtmlImage(); echo $oGraph->DumpAsHTMLText(); - if ((count($oGraph->_GetNodes()) != 1) || (count($oGraph->_GetEdges()) != 0)) - { + if ((count($oGraph->_GetNodes()) != 1) || (count($oGraph->_GetEdges()) != 0)) { throw new Exception('The graph should contain only the node A'); } } @@ -3693,60 +3622,56 @@ class TestBug788 extends TestBizModel class WhereIsThe61TablesThreat extends TestBizModel { - static public function GetName() + public static function GetName() { return '61 tables'; } - static public function GetDescription() + public static function GetDescription() { return 'Evaluate where is the 61 tables limit threat'; } protected function DoExecute() { - $aClassToCount_Full = array(); - $aDistribution = array(); + $aClassToCount_Full = []; + $aDistribution = []; $iTotalClasses = 0; - foreach (MetaModel::GetClasses() as $sClass) - { - if (MetaModel::IsAbstract($sClass)) continue; + foreach (MetaModel::GetClasses() as $sClass) { + if (MetaModel::IsAbstract($sClass)) { + continue; + } $iTotalClasses++; $oSearch = DBSearch::FromOQL("SELECT $sClass WHERE id = 1"); - $oSql = $oSearch->GetSQLQueryStructure(array(), false, null); + $oSql = $oSearch->GetSQLQueryStructure([], false, null); $iCount = $oSql->CountTables(); $aClassToCount_Full[$sClass] = $iCount; - if (array_key_exists($iCount, $aDistribution)) - { + if (array_key_exists($iCount, $aDistribution)) { $aDistribution[$iCount]++; - } - else - { + } else { $aDistribution[$iCount] = 1; } } arsort($aClassToCount_Full); $iHighestCount = max($aClassToCount_Full); - for($i = 1; $i < $iHighestCount ; $i++) - { - if (!array_key_exists($i, $aDistribution)) - { + for ($i = 1; $i < $iHighestCount ; $i++) { + if (!array_key_exists($i, $aDistribution)) { $aDistribution[$i] = 0; } } ksort($aDistribution); - $i = 0; $iLimit = 15; $iCountThreshold = 10; echo "
    TOP $iLimit offenders (+ those exceeding $iCountThreshold tables)
    "; - foreach ($aClassToCount_Full as $sClass => $iCountFull) - { + foreach ($aClassToCount_Full as $sClass => $iCountFull) { $i++; - if (($iCountFull <= $iCountThreshold) && ($i >= $iLimit)) break; + if (($iCountFull <= $iCountThreshold) && ($i >= $iLimit)) { + break; + } echo "$sClass: $iCountFull tables
    "; } @@ -3755,8 +3680,7 @@ class WhereIsThe61TablesThreat extends TestBizModel echo "

    Over a total of $iTotalClasses instantiable classes.

    "; echo ""; echo ""; - foreach ($aDistribution as $iTableCount => $iClassCount) - { + foreach ($aDistribution as $iTableCount => $iClassCount) { echo ""; } echo "
    Table countClasses
    $iTableCount$iClassCount
    "; @@ -3765,12 +3689,12 @@ class WhereIsThe61TablesThreat extends TestBizModel class TestBug689 extends TestBizModel { - static public function GetName() + public static function GetName() { return 'An OQL failing to export in XML'; } - static public function GetDescription() + public static function GetDescription() { return '(N.689) Reaching the limit of 61 tables'; } @@ -3779,7 +3703,7 @@ class TestBug689 extends TestBizModel { $sOql = 'SELECT child, parent, s1, p, o FROM UserRequest AS child JOIN UserRequest AS parent ON child.parent_request_id = parent.id JOIN lnkFunctionalCIToTicket AS l1 ON l1.ticket_id = child.id JOIN Server AS s1 ON l1.functionalci_id = s1.id JOIN Person AS p ON child.caller_id = p.id JOIN Organization AS o ON p.org_id = o.id'; $oSearch = DBSearch::FromOQL($sOql); - $oSql = $oSearch->GetSQLQueryStructure(array(), false, null); + $oSql = $oSearch->GetSQLQueryStructure([], false, null); //$sSql = $oSql->RenderSelect(); echo '

    '.$sOql.'

    '; @@ -3792,12 +3716,12 @@ class TestBug689 extends TestBizModel class TestDBObjectLinkedObjects extends TestBizModel { - static public function GetName() + public static function GetName() { return 'DBObject Linked objects API'; } - static public function GetDescription() + public static function GetDescription() { return 'Add/Remove/Modify linked objects (recorded as a delta within DBObject, later recorded in DB)'; } @@ -3832,7 +3756,7 @@ class TestDBObjectLinkedObjects extends TestBizModel $oServer->Set('name', 'unit test linkset'); $oServer->Set('org_id', 3); $oLinkSet = $oServer->Get('networkdevice_list'); - $oLinkSet->AddItem(MetaModel::NewObject('lnkConnectableCIToNetworkDevice', array('networkdevice_id' => $iDev1))); + $oLinkSet->AddItem(MetaModel::NewObject('lnkConnectableCIToNetworkDevice', ['networkdevice_id' => $iDev1])); $oServer->Set('networkdevice_list', $oLinkSet); assert($oServer->IsModified(), 'Server is modified'); $oServer->DBInsert(); @@ -3845,7 +3769,7 @@ class TestDBObjectLinkedObjects extends TestBizModel assert($oLink->Get('networkdevice_id') == $iDev1, 'New device correctly attached'); $oLinkSet = $oServer->Get('networkdevice_list'); - $oLinkSet->AddItem(MetaModel::NewObject('lnkConnectableCIToNetworkDevice', array('networkdevice_id' => $iDev2))); + $oLinkSet->AddItem(MetaModel::NewObject('lnkConnectableCIToNetworkDevice', ['networkdevice_id' => $iDev2])); $oServer->Set('networkdevice_list', $oLinkSet); assert($oServer->IsModified(), 'Server is modified'); $oServer->DBUpdate(); @@ -3854,15 +3778,11 @@ class TestDBObjectLinkedObjects extends TestBizModel $oLinkSet = $oServer->Get('networkdevice_list'); assert($oLinkSet->Count() == 2, 'Two NW Dev attached'); $oNewLinkSet = clone $oLinkSet; - while ($oLink = $oLinkSet->Fetch()) - { + while ($oLink = $oLinkSet->Fetch()) { $iLinkId = $oLink->Get('networkdevice_id'); - if ($iLinkId == $iDev1) - { + if ($iLinkId == $iDev1) { $oNewLinkSet->RemoveItem($oLink->GetKey()); - } - elseif ($iLinkId == $iDev2) - { + } elseif ($iLinkId == $iDev2) { $oLink->Set('network_port', 'lePortSalut'); $oNewLinkSet->ModifyItem($oLink); } @@ -3882,12 +3802,12 @@ class TestDBObjectLinkedObjects extends TestBizModel class TestDBObjectLinkedObjectsLegacy extends TestBizModel { - static public function GetName() + public static function GetName() { return 'DBObject Linked objects API (legacy usage)'; } - static public function GetDescription() + public static function GetDescription() { return 'Alter a link set by redefining the whole list of links (not recommended!)'; } @@ -3923,11 +3843,10 @@ class TestDBObjectLinkedObjectsLegacy extends TestBizModel $oServer->Set('org_id', 3); $oLinkSet = $oServer->Get('networkdevice_list'); $oNewLinkSet = DBObjectSet::FromScratch('lnkConnectableCIToNetworkDevice'); - while ($oLink = $oLinkSet->Fetch()) - { + while ($oLink = $oLinkSet->Fetch()) { $oNewLinkSet->AddObject($oLink); } - $oNewLinkSet->AddObject(MetaModel::NewObject('lnkConnectableCIToNetworkDevice', array('networkdevice_id' => $iDev1))); + $oNewLinkSet->AddObject(MetaModel::NewObject('lnkConnectableCIToNetworkDevice', ['networkdevice_id' => $iDev1])); $oServer->Set('networkdevice_list', $oNewLinkSet); assert($oServer->IsModified(), 'Server is modified'); $oServer->DBInsert(); @@ -3941,11 +3860,10 @@ class TestDBObjectLinkedObjectsLegacy extends TestBizModel $oNewLinkSet = DBObjectSet::FromScratch('lnkConnectableCIToNetworkDevice'); $oLinkSet->Rewind(); - while ($oLink = $oLinkSet->Fetch()) - { + while ($oLink = $oLinkSet->Fetch()) { $oNewLinkSet->AddObject($oLink); } - $oNewLinkSet->AddObject(MetaModel::NewObject('lnkConnectableCIToNetworkDevice', array('networkdevice_id' => $iDev2))); + $oNewLinkSet->AddObject(MetaModel::NewObject('lnkConnectableCIToNetworkDevice', ['networkdevice_id' => $iDev2])); $oServer->Set('networkdevice_list', $oNewLinkSet); assert($oServer->IsModified(), 'Server is modified'); $oServer->DBUpdate(); @@ -3955,20 +3873,14 @@ class TestDBObjectLinkedObjectsLegacy extends TestBizModel assert($oLinkSet->Count() == 2, 'Two NW Dev attached'); $oNewLinkSet = DBObjectSet::FromScratch('lnkConnectableCIToNetworkDevice'); $oServer->Set('networkdevice_list', $oNewLinkSet); - while ($oLink = $oLinkSet->Fetch()) - { + while ($oLink = $oLinkSet->Fetch()) { $iLinkId = $oLink->Get('networkdevice_id'); - if ($iLinkId == $iDev1) - { + if ($iLinkId == $iDev1) { // Remove...ie do not add it! - } - elseif ($iLinkId == $iDev2) - { + } elseif ($iLinkId == $iDev2) { $oLink->Set('network_port', 'lePortSalut'); $oNewLinkSet->AddObject($oLink); - } - else - { + } else { $oNewLinkSet->AddObject($oLink); } } diff --git a/tests/php-unit-tests/post-build-integration-tests/SetupCssIntegrityChecklistTest.php b/tests/php-unit-tests/post-build-integration-tests/SetupCssIntegrityChecklistTest.php index 7b2c3d4ce..8e654dc96 100644 --- a/tests/php-unit-tests/post-build-integration-tests/SetupCssIntegrityChecklistTest.php +++ b/tests/php-unit-tests/post-build-integration-tests/SetupCssIntegrityChecklistTest.php @@ -1,4 +1,5 @@ assertTrue(file_exists($sCssFileAbsPath)); + // First check if the compiled file exists + $this->assertTrue(file_exists($sCssFileAbsPath)); - // Then check that it is not empty - $sVersionedCssFileContent = file_get_contents($sCssFileAbsPath); - $this->assertGreaterThan(0, strlen($sVersionedCssFileContent), "Compiled setup.css file seems empty"); + // Then check that it is not empty + $sVersionedCssFileContent = file_get_contents($sCssFileAbsPath); + $this->assertGreaterThan(0, strlen($sVersionedCssFileContent), "Compiled setup.css file seems empty"); - // Then check that the compiled file is up-to-date + // Then check that the compiled file is up-to-date $sScssFileRelPath = "css/setup.scss"; - $sScssFileAbsPath = APPROOT . $sScssFileRelPath; - touch($sScssFileAbsPath); - utils::GetCSSFromSASS($sScssFileRelPath); - $sCompiledCssFileContent = file_get_contents($sCssFileAbsPath); - $this->assertSame($sCompiledCssFileContent, $sVersionedCssFileContent, "Compiled setup.css file does not seem up to date as the one compiled just now is different"); + $sScssFileAbsPath = APPROOT.$sScssFileRelPath; + touch($sScssFileAbsPath); + utils::GetCSSFromSASS($sScssFileRelPath); + $sCompiledCssFileContent = file_get_contents($sCssFileAbsPath); + $this->assertSame($sCompiledCssFileContent, $sVersionedCssFileContent, "Compiled setup.css file does not seem up to date as the one compiled just now is different"); } } diff --git a/tests/php-unit-tests/post-build-integration-tests/iTopDesignFormatChecklistTest.php b/tests/php-unit-tests/post-build-integration-tests/iTopDesignFormatChecklistTest.php index d707ace63..e74876c07 100644 --- a/tests/php-unit-tests/post-build-integration-tests/iTopDesignFormatChecklistTest.php +++ b/tests/php-unit-tests/post-build-integration-tests/iTopDesignFormatChecklistTest.php @@ -6,7 +6,6 @@ use Combodo\iTop\Test\UnitTest\ItopTestCase; use iTopDesignFormat; use PHPUnit\Exception; - /** * Class iTopDesignFormatChecklistTest * Ticket 3053 - Check XML conversion methods @@ -31,19 +30,15 @@ class iTopDesignFormatChecklistTest extends ItopTestCase public function testCurrentVersion_DataModelConversionFunctions() { $aErrors = []; - $aDatamodelCurrentVersions = array(); + $aDatamodelCurrentVersions = []; $aDataModelFiles = $this->GetDataModelFiles(APPROOT.'/datamodels'); //retrieve current XML version in datamoldels files - foreach ($aDataModelFiles as $sDataModelFile) - { - if (preg_match('/itop_design .* version="([\d\.]*)"/', file_get_contents($sDataModelFile), $aMatches)) - { + foreach ($aDataModelFiles as $sDataModelFile) { + if (preg_match('/itop_design .* version="([\d\.]*)"/', file_get_contents($sDataModelFile), $aMatches)) { $sVersion = $aMatches[1]; - if (!array_key_exists($sVersion, $aDatamodelCurrentVersions)) - { - if (trim($sVersion) === '') - { + if (!array_key_exists($sVersion, $aDatamodelCurrentVersions)) { + if (trim($sVersion) === '') { $aErrors[] = "cannot retrieve itop_design datamodel version in $sDataModelFile:1"; continue; } @@ -57,102 +52,99 @@ class iTopDesignFormatChecklistTest extends ItopTestCase $this->assertTrue(is_array($aDatamodelCurrentVersions)); $sFirstVersion = array_keys(iTopDesignFormat::$aVersions)[0]; - $sLatestVersion = array_keys(iTopDesignFormat::$aVersions)[count(iTopDesignFormat::$aVersions)-1]; - foreach ($aDatamodelCurrentVersions as $sCurrentVersion) - { - try{ + $sLatestVersion = array_keys(iTopDesignFormat::$aVersions)[count(iTopDesignFormat::$aVersions) - 1]; + foreach ($aDatamodelCurrentVersions as $sCurrentVersion) { + try { //check we have migration function from current version to previous $this->CheckCondition(array_key_exists($sCurrentVersion, iTopDesignFormat::$aVersions), "Missing $sCurrentVersion conversion functions in iTopDesignFormat."); $aCurrentVersionInfo = iTopDesignFormat::$aVersions[$sCurrentVersion]; $this->CheckCondition(is_array($aCurrentVersionInfo), "Wrong $sCurrentVersion config in iTopDesignFormat."); $this->CheckCondition(array_key_exists('previous', $aCurrentVersionInfo), "Missing previous for $sCurrentVersion config in iTopDesignFormat."); - $this->TestDefinedFunction($aCurrentVersionInfo, 'go_to_next', $sCurrentVersion, ($sCurrentVersion=== $sLatestVersion)); - $this->TestDefinedFunction($aCurrentVersionInfo, 'go_to_previous', $sCurrentVersion, ($sCurrentVersion==='1.0')); + $this->TestDefinedFunction($aCurrentVersionInfo, 'go_to_next', $sCurrentVersion, ($sCurrentVersion === $sLatestVersion)); + $this->TestDefinedFunction($aCurrentVersionInfo, 'go_to_previous', $sCurrentVersion, ($sCurrentVersion === '1.0')); //check we have migration function from N-1 version to current one - if (($sCurrentVersion!=='1.0')) { + if (($sCurrentVersion !== '1.0')) { $sPreviousVersion = $aCurrentVersionInfo['previous']; - $this->CheckCondition(array_key_exists($sPreviousVersion, iTopDesignFormat::$aVersions), - "$sCurrentVersion: Missing $sPreviousVersion config in iTopDesignFormat."); + $this->CheckCondition( + array_key_exists($sPreviousVersion, iTopDesignFormat::$aVersions), + "$sCurrentVersion: Missing $sPreviousVersion config in iTopDesignFormat." + ); $aPreviousVersionInfo = iTopDesignFormat::$aVersions[$sPreviousVersion]; - $this->CheckCondition(is_array($aPreviousVersionInfo), - "$sCurrentVersion: wrong $sPreviousVersion config in iTopDesignFormat."); - $this->CheckCondition(array_key_exists('previous', $aPreviousVersionInfo), - "$sCurrentVersion: Missing previous for $sPreviousVersion config in iTopDesignFormat."); + $this->CheckCondition( + is_array($aPreviousVersionInfo), + "$sCurrentVersion: wrong $sPreviousVersion config in iTopDesignFormat." + ); + $this->CheckCondition( + array_key_exists('previous', $aPreviousVersionInfo), + "$sCurrentVersion: Missing previous for $sPreviousVersion config in iTopDesignFormat." + ); $this->TestDefinedFunction($aPreviousVersionInfo, 'go_to_previous', $sPreviousVersion, ($sPreviousVersion === '1.0')); $this->TestDefinedFunction($aPreviousVersionInfo, 'go_to_next', $sPreviousVersion, ($sPreviousVersion === $sLatestVersion)); } //check we have migration function from current version to next one - if (($sCurrentVersion!== $sLatestVersion)) { + if (($sCurrentVersion !== $sLatestVersion)) { $sNextVersion = $aCurrentVersionInfo['next']; - $this->CheckCondition(array_key_exists($sNextVersion, iTopDesignFormat::$aVersions), - "$sCurrentVersion: Missing $sNextVersion config in iTopDesignFormat."); + $this->CheckCondition( + array_key_exists($sNextVersion, iTopDesignFormat::$aVersions), + "$sCurrentVersion: Missing $sNextVersion config in iTopDesignFormat." + ); $aNextVersionInfo = iTopDesignFormat::$aVersions[$sNextVersion]; - $this->CheckCondition(is_array($aNextVersionInfo), - "$sCurrentVersion: wrong $sNextVersion config in iTopDesignFormat."); - $this->CheckCondition(array_key_exists('previous', $aNextVersionInfo), - "$sCurrentVersion: Missing previous for $sNextVersion config in iTopDesignFormat."); + $this->CheckCondition( + is_array($aNextVersionInfo), + "$sCurrentVersion: wrong $sNextVersion config in iTopDesignFormat." + ); + $this->CheckCondition( + array_key_exists('previous', $aNextVersionInfo), + "$sCurrentVersion: Missing previous for $sNextVersion config in iTopDesignFormat." + ); $this->TestDefinedFunction($aNextVersionInfo, 'go_to_previous', $sNextVersion, ($sNextVersion === '1.0')); $this->TestDefinedFunction($aNextVersionInfo, 'go_to_next', $sNextVersion, ($sNextVersion === $sLatestVersion)); } - } - catch(Exception $e) - { + } catch (Exception $e) { $aErrors[] = $e->getMessage(); } } - if (count($aErrors)!=0) - { + if (count($aErrors) != 0) { $sMsg = "Issue with conversion functions:\n"; $sMsg .= implode("\n", $aErrors); $this->fail($sMsg); - } - else - { + } else { $this->assertTrue(true); } } private function CheckCondition($bCondition, $sMsg) { - if ($bCondition === false) - { + if ($bCondition === false) { throw new \Exception($sMsg); } } - private function TestDefinedFunction($aCurrentVersionInfo, $sFunctionKey, $sVersion, $bNullFunction=false) + private function TestDefinedFunction($aCurrentVersionInfo, $sFunctionKey, $sVersion, $bNullFunction = false) { $sInfo = json_encode($aCurrentVersionInfo, true); - $this->CheckCondition(array_key_exists($sFunctionKey, $aCurrentVersionInfo), "Missing $sFunctionKey in $sVersion config in iTopDesignFormat: " . $sInfo); + $this->CheckCondition(array_key_exists($sFunctionKey, $aCurrentVersionInfo), "Missing $sFunctionKey in $sVersion config in iTopDesignFormat: ".$sInfo); //echo $aCurrentVersionInfo[$sFunctionKey].'\n'; - if ($bNullFunction === false) - { + if ($bNullFunction === false) { $oReflectionClass = new \ReflectionClass(iTopDesignFormat::class); - $this->CheckCondition($oReflectionClass->hasMethod($aCurrentVersionInfo[$sFunctionKey]), "wrong go_to_previous function '".$aCurrentVersionInfo[$sFunctionKey]."'' for $sVersion config in iTopDesignFormat." . $sInfo); - } - else - { + $this->CheckCondition($oReflectionClass->hasMethod($aCurrentVersionInfo[$sFunctionKey]), "wrong go_to_previous function '".$aCurrentVersionInfo[$sFunctionKey]."'' for $sVersion config in iTopDesignFormat.".$sInfo); + } else { $this->CheckCondition(is_null($aCurrentVersionInfo[$sFunctionKey]), "$sVersion $sFunctionKey function should be null"); } } public function GetDataModelFiles($sFolder) { - $aDataModelFiles = array(); - if (is_dir($sFolder)) - { - foreach (glob($sFolder."/*") as $sPath) - { - if (is_dir($sPath)) - { + $aDataModelFiles = []; + if (is_dir($sFolder)) { + foreach (glob($sFolder."/*") as $sPath) { + if (is_dir($sPath)) { /** @noinspection SlowArrayOperationsInLoopInspection */ $aDataModelFiles = array_merge($aDataModelFiles, $this->GetDataModelFiles($sPath)); - } - else if (preg_match("/datamodel\..*\.xml/", basename($sPath))) - { + } elseif (preg_match("/datamodel\..*\.xml/", basename($sPath))) { $aDataModelFiles[] = $sPath; } } diff --git a/tests/php-unit-tests/post-build-integration-tests/iTopModuleXmlInstallationChecklistTest.php b/tests/php-unit-tests/post-build-integration-tests/iTopModuleXmlInstallationChecklistTest.php index b9b88a7ce..263e675c4 100644 --- a/tests/php-unit-tests/post-build-integration-tests/iTopModuleXmlInstallationChecklistTest.php +++ b/tests/php-unit-tests/post-build-integration-tests/iTopModuleXmlInstallationChecklistTest.php @@ -4,7 +4,6 @@ namespace Combodo\iTop\Test\UnitTest\ReleaseChecklist; use Combodo\iTop\Test\UnitTest\ItopTestCase; - /** * @since 2.7.2 N°3060 / N°3061 Automatically check the installation.xml consistency * @@ -17,16 +16,14 @@ class iTopModuleXmlInstallationChecklistTest extends ItopTestCase */ public function testInstallationXmlFormat() { - $sInstallationXmlPath = APPROOT . 'datamodels/2.x/installation.xml'; + $sInstallationXmlPath = APPROOT.'datamodels/2.x/installation.xml'; $this->assertTrue(is_file($sInstallationXmlPath), "$sInstallationXmlPath does not exist"); $doc = new \DOMDocument(); - try{ + try { $doc->loadxml(file_get_contents($sInstallationXmlPath)); - } - catch(\Exception $e) - { - $this->assertFalse(true, "$sInstallationXmlPath is not a valid XML content: " . $e->getMessage()); + } catch (\Exception $e) { + $this->assertFalse(true, "$sInstallationXmlPath is not a valid XML content: ".$e->getMessage()); } } @@ -75,32 +72,24 @@ class iTopModuleXmlInstallationChecklistTest extends ItopTestCase public function GetModulesNotAutoSelected($sFolder) { $aExcludedModules = ['authent-external', 'authent-ldap']; - $aModules = array(); - if (is_dir($sFolder)) - { - foreach (glob($sFolder."/*") as $sPath) - { - if (is_dir($sPath)) - { + $aModules = []; + if (is_dir($sFolder)) { + foreach (glob($sFolder."/*") as $sPath) { + if (is_dir($sPath)) { /** @noinspection SlowArrayOperationsInLoopInspection */ $aModules = array_merge($aModules, $this->GetModulesNotAutoSelected($sPath)); - } - else if (preg_match("/module\..*\.php/", basename($sPath))) - { + } elseif (preg_match("/module\..*\.php/", basename($sPath))) { $sModulePhpContent = file_get_contents($sPath); - if (strpos($sModulePhpContent, "SetupWebPage::AddModule")!==false - && strpos($sModulePhpContent, "'mandatory' => true")===false) - { + if (strpos($sModulePhpContent, "SetupWebPage::AddModule") !== false + && strpos($sModulePhpContent, "'mandatory' => true") === false) { //filter modules autoselected due to below condition - if (strpos($sModulePhpContent, "'mandatory' => false")!==false - && strpos($sModulePhpContent, "'visible' => false")!==false) - { + if (strpos($sModulePhpContent, "'mandatory' => false") !== false + && strpos($sModulePhpContent, "'visible' => false") !== false) { continue; } $sModule = basename(dirname($sPath)); - if (in_array($sModule, $aExcludedModules))// || $sModule === 'authent-ldap') - { + if (in_array($sModule, $aExcludedModules)) {// || $sModule === 'authent-ldap') //hardcode this condition to make sure test is OK (CI context) + added a ticket to work/investigate why it is failed for these 2 cases (itop dev context) continue; } @@ -115,21 +104,15 @@ class iTopModuleXmlInstallationChecklistTest extends ItopTestCase public function GetAllModules($sFolder) { - $aModules = array(); - if (is_dir($sFolder)) - { - foreach (glob($sFolder."/*") as $sPath) - { - if (is_dir($sPath)) - { + $aModules = []; + if (is_dir($sFolder)) { + foreach (glob($sFolder."/*") as $sPath) { + if (is_dir($sPath)) { /** @noinspection SlowArrayOperationsInLoopInspection */ $aModules = array_merge($aModules, $this->GetAllModules($sPath)); - } - else if (preg_match("/module\..*\.php/", basename($sPath))) - { + } elseif (preg_match("/module\..*\.php/", basename($sPath))) { $sModulePhpContent = file_get_contents($sPath); - if (strpos($sModulePhpContent, "SetupWebPage::AddModule")!==false) - { + if (strpos($sModulePhpContent, "SetupWebPage::AddModule") !== false) { $sModule = basename(dirname($sPath)); $aModules[$sModule] = $sModule; } @@ -138,4 +121,4 @@ class iTopModuleXmlInstallationChecklistTest extends ItopTestCase } return $aModules; } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/src/BaseTestCase/ItopCustomDatamodelTestCase.php b/tests/php-unit-tests/src/BaseTestCase/ItopCustomDatamodelTestCase.php index f7bfd7369..bb3421ebc 100644 --- a/tests/php-unit-tests/src/BaseTestCase/ItopCustomDatamodelTestCase.php +++ b/tests/php-unit-tests/src/BaseTestCase/ItopCustomDatamodelTestCase.php @@ -1,4 +1,5 @@ setRunClassInSeparateProcess(true); } - /** + /** * @return string Abs path to the XML delta to use for the tests of that class */ abstract public function GetDatamodelDeltaAbsPath(): string; protected function setUp(): void { - static::LoadRequiredItopFiles(); - $this->oEnvironment = new UnitTestRunTimeEnvironment('production', $this->GetTestEnvironment()); + static::LoadRequiredItopFiles(); + $this->oEnvironment = new UnitTestRunTimeEnvironment('production', $this->GetTestEnvironment()); parent::setUp(); } @@ -107,8 +107,8 @@ abstract class ItopCustomDatamodelTestCase extends ItopDataTestCase if (false === file_exists($this->GetTestEnvironmentFolderAbsPath())) { return false; } - return $this->oEnvironment->IsUpToDate(); - } + return $this->oEnvironment->IsUpToDate(); + } /** * @inheritDoc @@ -124,10 +124,10 @@ abstract class ItopCustomDatamodelTestCase extends ItopDataTestCase // This requires XML deltas to be compatible, but it is a known and accepted trade-off. See PR #457 if (false === $this->IsEnvironmentReady()) { - $this->debug("Preparing custom environment '$sTestEnv' with the following datamodel files:"); - foreach ($this->oEnvironment->GetCustomDatamodelFiles() as $sCustomDatamodelFile) { - $this->debug(" - $sCustomDatamodelFile"); - } + $this->debug("Preparing custom environment '$sTestEnv' with the following datamodel files:"); + foreach ($this->oEnvironment->GetCustomDatamodelFiles() as $sCustomDatamodelFile) { + $this->debug(" - $sCustomDatamodelFile"); + } //---------------------------------------------------- // Clear any previous "$sTestEnv" environment @@ -169,7 +169,7 @@ abstract class ItopCustomDatamodelTestCase extends ItopDataTestCase } CMDBSource::CreateDB($oTestConfig->Get('db_name')); MetaModel::Startup($sConfFile, false /* $bModelOnly */, true /* $bAllowCache */, false /* $bTraceSourceFiles */, $sTestEnv); - // N°7446 For some reason we need to create the DB schema before starting the MM, then only we can create the tables. + // N°7446 For some reason we need to create the DB schema before starting the MM, then only we can create the tables. MetaModel::DBCreate(); $this->debug("Custom environment '$sTestEnv' is ready!"); diff --git a/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php b/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php index aa09aed74..9d4d0a45a 100644 --- a/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php +++ b/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php @@ -1,4 +1,5 @@ 1, @@ -121,15 +121,13 @@ abstract class ItopDataTestCase extends ItopTestCase $this->PrepareEnvironment(); - if (static::USE_TRANSACTION) - { + if (static::USE_TRANSACTION) { CMDBSource::Query('START TRANSACTION'); } - if (static::CREATE_TEST_ORG) - { + if (static::CREATE_TEST_ORG) { // Create a specific organization for the tests $this->iTestOrgId = $this->GivenObjectInDB('Organization', [ - 'name' => 'UnitTestOrganization', + 'name' => 'UnitTestOrganization', ]); } @@ -161,17 +159,14 @@ abstract class ItopDataTestCase extends ItopTestCase } else { $this->debug(""); $this->aCreatedObjects = array_reverse($this->aCreatedObjects); - foreach ($this->aCreatedObjects as $oObject) - { + foreach ($this->aCreatedObjects as $oObject) { /** @var DBObject $oObject */ - try - { + try { $sClass = get_class($oObject); $iKey = $oObject->GetKey(); $this->debug("Removing $sClass::$iKey"); $oObject->DBDelete(); - } - catch (Exception $e) { + } catch (Exception $e) { $this->debug("Error when removing created objects: $sClass::$iKey. Exception message: ".$e->getMessage()); } } @@ -196,7 +191,8 @@ abstract class ItopDataTestCase extends ItopTestCase /** * Helper to reset the metamodel cache : for a class and a key it will contain the SQL query, that could include silo filter */ - protected function ResetMetaModelQueyCacheGetObject() { + protected function ResetMetaModelQueyCacheGetObject() + { $this->SetNonPublicStaticProperty(MetaModel::class, 'aQueryCacheGetObject', []); } @@ -311,8 +307,7 @@ abstract class ItopDataTestCase extends ItopTestCase protected function createObject($sClass, $aParams) { $oMyObj = MetaModel::NewObject($sClass); - foreach ($aParams as $sAttCode => $oValue) - { + foreach ($aParams as $sAttCode => $oValue) { $oMyObj->Set($sAttCode, $oValue); } $oMyObj->DBInsert(); @@ -336,8 +331,7 @@ abstract class ItopDataTestCase extends ItopTestCase protected static function updateObject($sClass, $iKey, $aParams) { $oMyObj = MetaModel::GetObject($sClass, $iKey); - foreach ($aParams as $sAttCode => $oValue) - { + foreach ($aParams as $sAttCode => $oValue) { $oMyObj->Set($sAttCode, $oValue); } $oMyObj->DBUpdate(); @@ -356,9 +350,9 @@ abstract class ItopDataTestCase extends ItopTestCase protected function CreateOrganization($sName) { /** @var \Organization $oObj */ - $oObj = $this->createObject('Organization', array( + $oObj = $this->createObject('Organization', [ 'name' => $sName, - )); + ]); $this->debug("Created Organization {$oObj->Get('name')}"); return $oObj; @@ -375,13 +369,13 @@ abstract class ItopDataTestCase extends ItopTestCase protected function CreateTicket($iNum) { /** @var Ticket $oTicket */ - $oTicket = $this->createObject('UserRequest', array( + $oTicket = $this->createObject('UserRequest', [ 'ref' => 'Ticket_'.$iNum, 'title' => 'TICKET_'.$iNum, //'request_type' => 'incident', 'description' => 'Created for unit tests.', 'org_id' => $this->getTestOrgId(), - )); + ]); $this->debug("Created {$oTicket->Get('title')} ({$oTicket->Get('ref')})"); return $oTicket; @@ -407,13 +401,13 @@ abstract class ItopDataTestCase extends ItopTestCase protected function CreateTagData($sClass, $sAttCode, $sTagCode, $sTagLabel, $sTagDescription = '') { $sTagClass = TagSetFieldData::GetTagDataClassName($sClass, $sAttCode); - $oTagData = $this->createObject($sTagClass, array( + $oTagData = $this->createObject($sTagClass, [ 'code' => $sTagCode, 'label' => $sTagLabel, 'obj_class' => $sClass, 'obj_attcode' => $sAttCode, 'description' => $sTagDescription, - )); + ]); $this->debug("Created {$oTagData->Get('code')} ({$oTagData->Get('label')})"); /** @var \TagSetFieldData $oTagData */ @@ -446,7 +440,7 @@ abstract class ItopDataTestCase extends ItopTestCase private function RemoveObjects($sClass, $sOQL) { $oFilter = DBSearch::FromOQL($sOQL); - $aRes = $oFilter->ToDataArray(array('id')); + $aRes = $oFilter->ToDataArray(['id']); foreach ($aRes as $aRow) { $this->debug($aRow); $iKey = $aRow['id']; @@ -457,7 +451,8 @@ abstract class ItopDataTestCase extends ItopTestCase } } - protected function GetUserRequestParams($iNum) { + protected function GetUserRequestParams($iNum) + { return [ 'ref' => 'Ticket_'.$iNum, 'title' => 'BUG 1161_'.$iNum, @@ -483,7 +478,8 @@ abstract class ItopDataTestCase extends ItopTestCase * @uses \array_merge() * @uses createObject */ - protected function CreateUserRequest($iNum, $aUserRequestCustomParams = []) { + protected function CreateUserRequest($iNum, $aUserRequestCustomParams = []) + { $aUserRequestDefaultParams = $this->GetUserRequestParams($iNum); $aUserRequestParams = array_merge($aUserRequestDefaultParams, $aUserRequestCustomParams); @@ -507,11 +503,11 @@ abstract class ItopDataTestCase extends ItopTestCase protected function CreateServer($iNum, $iRackUnit = null) { /** @var Server $oServer */ - $oServer = $this->createObject('Server', array( + $oServer = $this->createObject('Server', [ 'name' => 'Server_'.$iNum, 'org_id' => $this->getTestOrgId(), 'nb_u' => $iRackUnit, - )); + ]); $this->debug("Created {$oServer->GetName()} ({$oServer->GetKey()})"); return $oServer; @@ -529,11 +525,11 @@ abstract class ItopDataTestCase extends ItopTestCase */ protected function CreatePhysicalInterface($iNum, $iSpeed, $iConnectableCiId) { - $oObj = $this->createObject('PhysicalInterface', array( + $oObj = $this->createObject('PhysicalInterface', [ 'name' => "$iNum", 'speed' => $iSpeed, 'connectableci_id' => $iConnectableCiId, - )); + ]); $this->debug("Created {$oObj->GetName()} ({$oObj->GetKey()})"); return $oObj; @@ -551,11 +547,11 @@ abstract class ItopDataTestCase extends ItopTestCase */ protected function CreateFiberChannelInterface($iNum, $iSpeed, $iConnectableCiId) { - $oObj = $this->createObject('FiberChannelInterface', array( + $oObj = $this->createObject('FiberChannelInterface', [ 'name' => "$iNum", 'speed' => $iSpeed, 'datacenterdevice_id' => $iConnectableCiId, - )); + ]); $this->debug("Created {$oObj->GetName()} ({$oObj->GetKey()})"); return $oObj; @@ -573,11 +569,11 @@ abstract class ItopDataTestCase extends ItopTestCase protected function CreatePerson($iNum, $iOrgId = 0) { /** @var Person $oPerson */ - $oPerson = $this->createObject('Person', array( + $oPerson = $this->createObject('Person', [ 'name' => 'Person_'.$iNum, 'first_name' => 'Test', 'org_id' => ($iOrgId == 0 ? $this->getTestOrgId() : $iOrgId), - )); + ]); $this->debug("Created {$oPerson->GetName()} ({$oPerson->GetKey()})"); return $oPerson; @@ -590,7 +586,7 @@ abstract class ItopDataTestCase extends ItopTestCase * @return \UserLocal * @throws Exception */ - protected function CreateUser($sLogin, $iProfileId, $sPassword=null, $iContactid=2) + protected function CreateUser($sLogin, $iProfileId, $sPassword = null, $iContactid = 2) { $oUser = $this->CreateContactlessUser($sLogin, $iProfileId, $sPassword); $oUser->Set('contactid', $iContactid); @@ -605,9 +601,9 @@ abstract class ItopDataTestCase extends ItopTestCase * @return \UserLocal * @throws Exception */ - protected function CreateContactlessUser($sLogin, $iProfileId, $sPassword=null) + protected function CreateContactlessUser($sLogin, $iProfileId, $sPassword = null) { - if (empty($sPassword)){ + if (empty($sPassword)) { $sPassword = $sLogin; } @@ -616,12 +612,12 @@ abstract class ItopDataTestCase extends ItopTestCase $oUserProfile->Set('reason', 'UNIT Tests'); $oSet = DBObjectSet::FromObject($oUserProfile); /** @var \UserLocal $oUser */ - $oUser = $this->createObject('UserLocal', array( + $oUser = $this->createObject('UserLocal', [ 'login' => $sLogin, 'password' => $sPassword, 'language' => 'EN US', 'profile_list' => $oSet, - )); + ]); $this->debug("Created {$oUser->GetName()} ({$oUser->GetKey()})"); return $oUser; @@ -642,15 +638,14 @@ abstract class ItopDataTestCase extends ItopTestCase /** @var \ormLinkSet $oSet */ $oSet = $oUser->Get('profile_list'); $oSet->AddItem($oUserProfile); - $oUser = $this->updateObject(User::class, $oUser->GetKey(), array( + $oUser = $this->updateObject(User::class, $oUser->GetKey(), [ 'profile_list' => $oSet, - )); + ]); $this->debug("Updated {$oUser->GetName()} ({$oUser->GetKey()})"); return $oUser; } - /** * Create a Hypervisor in database * @@ -664,18 +659,15 @@ abstract class ItopDataTestCase extends ItopTestCase protected function CreateHypervisor($iNum, $oServer, $oFarm = null) { /** @var Hypervisor $oHypervisor */ - $oHypervisor = $this->createObject('Hypervisor', array( + $oHypervisor = $this->createObject('Hypervisor', [ 'name' => 'Hypervisor_'.$iNum, 'org_id' => $this->getTestOrgId(), 'server_id' => $oServer->GetKey(), 'farm_id' => is_null($oFarm) ? 0 : $oFarm->GetKey(), - )); - if (is_null($oFarm)) - { + ]); + if (is_null($oFarm)) { $this->debug("Created {$oHypervisor->GetName()} ({$oHypervisor->GetKey()}) on {$oServer->GetName()}"); - } - else - { + } else { $this->debug("Created {$oHypervisor->GetName()} ({$oHypervisor->GetKey()}) on {$oServer->GetName()} part of {$oFarm->GetName()}"); } @@ -694,11 +686,11 @@ abstract class ItopDataTestCase extends ItopTestCase protected function CreateFarm($iNum, $sRedundancy = '1') { /** @var Farm $oFarm */ - $oFarm = $this->createObject('Farm', array( + $oFarm = $this->createObject('Farm', [ 'name' => 'Farm_'.$iNum, 'org_id' => $this->getTestOrgId(), 'redundancy' => $sRedundancy, - )); + ]); $this->debug("Created {$oFarm->GetName()} ({$oFarm->GetKey()}) redundancy $sRedundancy"); return $oFarm; @@ -716,11 +708,11 @@ abstract class ItopDataTestCase extends ItopTestCase protected function CreateVirtualMachine($iNum, $oVirtualHost) { /** @var VirtualMachine $oVirtualMachine */ - $oVirtualMachine = $this->createObject('VirtualMachine', array( + $oVirtualMachine = $this->createObject('VirtualMachine', [ 'name' => 'VirtualMachine_'.$iNum, 'org_id' => $this->getTestOrgId(), 'virtualhost_id' => $oVirtualHost->GetKey(), - )); + ]); $this->debug("Created {$oVirtualMachine->GetName()} ({$oVirtualMachine->GetKey()}) on {$oVirtualHost->GetName()}"); return $oVirtualMachine; @@ -729,24 +721,22 @@ abstract class ItopDataTestCase extends ItopTestCase protected function CreateObjectWithTagSet() { $oFaqCategory = MetaModel::GetObject('FAQCategory', 1, false); - if (empty($oFaqCategory)) - { - $oFaqCategory = $this->createObject('FAQCategory', array( + if (empty($oFaqCategory)) { + $oFaqCategory = $this->createObject('FAQCategory', [ 'name' => 'FAQCategory_phpunit', - )); + ]); } /** @var \FAQ $oFaq */ - $oFaq = $this->createObject('FAQ', array( + $oFaq = $this->createObject('FAQ', [ 'category_id' => $oFaqCategory->GetKey(), 'title' => 'FAQ_phpunit', - )); + ]); $this->debug("Created {$oFaq->GetName()}"); return $oFaq; } - /** * Add a link between a contact and a CI. * The database is not updated. @@ -782,10 +772,8 @@ abstract class ItopDataTestCase extends ItopTestCase protected function RemoveContactFromCI($oContact, $oCI) { $oContacts = $oCI->Get('contacts_list'); - foreach ($oContacts as $oLnk) - { - if ($oLnk->Get('contact_id') == $oContact->GetKey()) - { + foreach ($oContacts as $oLnk) { + if ($oLnk->Get('contact_id') == $oContact->GetKey()) { $oContacts->RemoveItem($oLnk->GetKey()); $oCI->Set('contacts_list', $oContacts); $this->debug("Removed {$oContact->GetName()} from {$oCI->Get('name')}"); @@ -817,7 +805,7 @@ abstract class ItopDataTestCase extends ItopTestCase $this->debug("Added {$oCI->GetName()} to {$oTicket->Get('ref')} with {$sImpactCode}"); - return array($oCI->GetKey() => $sImpactCode); + return [$oCI->GetKey() => $sImpactCode]; } /** @@ -832,10 +820,8 @@ abstract class ItopDataTestCase extends ItopTestCase protected function RemoveCIFromTicket($oCI, $oTicket) { $oCIs = $oTicket->Get('functionalcis_list'); - foreach ($oCIs as $oLnk) - { - if ($oLnk->Get('functionalci_id') == $oCI->GetKey()) - { + foreach ($oCIs as $oLnk) { + if ($oLnk->Get('functionalci_id') == $oCI->GetKey()) { $sImpactCode = $oLnk->Get('impact_code'); $oCIs->RemoveItem($oLnk->GetKey()); $oTicket->Set('functionalcis_list', $oCIs); @@ -860,13 +846,12 @@ abstract class ItopDataTestCase extends ItopTestCase * @return array * @throws Exception */ - protected function AddContactToTicket($oContact, $oTicket, $sRoleCode, $aParams = array()) + protected function AddContactToTicket($oContact, $oTicket, $sRoleCode, $aParams = []) { $oNewLink = new lnkContactToTicket(); $oNewLink->Set('contact_id', $oContact->GetKey()); $oNewLink->Set('role_code', $sRoleCode); - foreach ($aParams as $sAttCode => $oValue) - { + foreach ($aParams as $sAttCode => $oValue) { $oNewLink->Set($sAttCode, $oValue); } $oCIs = $oTicket->Get('contacts_list'); @@ -875,7 +860,7 @@ abstract class ItopDataTestCase extends ItopTestCase $this->debug("Added {$oContact->GetName()} to {$oTicket->Get('ref')} with {$sRoleCode}"); - return array($oContact->GetKey() => $sRoleCode); + return [$oContact->GetKey() => $sRoleCode]; } /** @@ -890,10 +875,8 @@ abstract class ItopDataTestCase extends ItopTestCase protected function RemoveContactFromTicket($oContact, $oTicket) { $oContacts = $oTicket->Get('contacts_list'); - foreach ($oContacts as $oLnk) - { - if ($oLnk->Get('contact_id') == $oContact->GetKey()) - { + foreach ($oContacts as $oLnk) { + if ($oLnk->Get('contact_id') == $oContact->GetKey()) { $sRoleCode = $oLnk->Get('role_code'); $oContacts->RemoveItem($oLnk->GetKey()); $oTicket->Set('contacts_list', $oContacts); @@ -944,18 +927,14 @@ abstract class ItopDataTestCase extends ItopTestCase $oFunction(); $iFinalCount = (int) CMDBSource::QueryToScalar("SHOW SESSION STATUS LIKE 'Queries'", 1); $iCount = $iFinalCount - 1 - $iInitialCount; - if ($iCount != $iExpectedCount) - { + if ($iCount != $iExpectedCount) { if ($sMessage === '') { $sMessage = "Expected $iExpectedCount queries. $iCount have been executed."; - } - else { + } else { $sMessage .= " - Expected $iExpectedCount queries. $iCount have been executed."; } $this->fail($sMessage); - } - else - { + } else { // Otherwise, PHP Unit will consider that no assertion has been made $this->assertTrue(true); } @@ -993,8 +972,6 @@ abstract class ItopDataTestCase extends ItopTestCase $this->assertStringContainsString($sNeedle, $aLastLines[0], $sMessage); } - - /** * Import a set of XML files describing a consistent set of iTop objects * @param string[] $aFiles @@ -1006,8 +983,7 @@ abstract class ItopDataTestCase extends ItopTestCase { $oLoader = new XMLDataLoader(); $oLoader->StartSession(CMDBObject::GetCurrentChange()); - foreach($aFiles as $sFilePath) - { + foreach ($aFiles as $sFilePath) { $oLoader->LoadFile($sFilePath, false, $bSearch); } $oLoader->EndSession(); @@ -1034,7 +1010,6 @@ abstract class ItopDataTestCase extends ItopTestCase return $ret; } - protected function DBInsertSingleTable($sTableClass, $aValues, $iKey = 0) { $sTable = MetaModel::DBGetTable($sTableClass); @@ -1044,8 +1019,8 @@ abstract class ItopDataTestCase extends ItopTestCase } // fields in first array, values in the second - $aFieldsToWrite = array(); - $aValuesToWrite = array(); + $aFieldsToWrite = []; + $aValuesToWrite = []; if (!empty($iKey) && ($iKey >= 0)) { // Add it to the list of fields to write @@ -1053,7 +1028,7 @@ abstract class ItopDataTestCase extends ItopTestCase $aValuesToWrite[] = CMDBSource::Quote($iKey); } - $aHierarchicalKeys = array(); + $aHierarchicalKeys = []; foreach (MetaModel::ListAttributeDefs($sTableClass) as $sAttCode => $oAttDef) { // Skip this attribute if not defined in this table @@ -1110,8 +1085,7 @@ abstract class ItopDataTestCase extends ItopTestCase protected function GivenObject(string $sClass, array $aParams): DBObject { $oMyObj = MetaModel::NewObject($sClass); - foreach ($aParams as $sAttCode => $oValue) - { + foreach ($aParams as $sAttCode => $oValue) { $oMyObj->Set($sAttCode, $oValue); } @@ -1333,16 +1307,14 @@ abstract class ItopDataTestCase extends ItopTestCase $this->debug("Added CI $sCIId to {$oTicket->Get('ref')} with {$sImpactCode}"); - return array($sCIId => $sImpactCode); + return [$sCIId => $sImpactCode]; } protected function RemoveLnkFunctionalCIToTicketObject($sCIId, $oTicket) { $oCIs = $oTicket->Get('functionalcis_list'); - foreach ($oCIs as $oLnk) - { - if ($oLnk->Get('functionalci_id') == $sCIId) - { + foreach ($oCIs as $oLnk) { + if ($oLnk->Get('functionalci_id') == $sCIId) { $sImpactCode = $oLnk->Get('impact_code'); $oCIs->RemoveItem($oLnk->GetKey()); $oTicket->Set('functionalcis_list', $oCIs); @@ -1355,7 +1327,7 @@ abstract class ItopDataTestCase extends ItopTestCase $this->assertTrue(false); } - protected function AddLnkContactToTicketObject($sContactId, $oTicket, $sRoleCode, $aParams = array()): array + protected function AddLnkContactToTicketObject($sContactId, $oTicket, $sRoleCode, $aParams = []): array { $aParams['contact_id'] = $sContactId; $aParams['role_code'] = $sRoleCode; @@ -1367,16 +1339,14 @@ abstract class ItopDataTestCase extends ItopTestCase $this->debug("Added contact $sContactId to {$oTicket->Get('ref')} with {$sRoleCode}"); - return array($sContactId => $sRoleCode); + return [$sContactId => $sRoleCode]; } protected function RemoveLnkContactToTicketObject($sContactId, $oTicket) { $oContacts = $oTicket->Get('contacts_list'); - foreach ($oContacts as $oLnk) - { - if ($oLnk->Get('contact_id') == $sContactId) - { + foreach ($oContacts as $oLnk) { + if ($oLnk->Get('contact_id') == $sContactId) { $sRoleCode = $oLnk->Get('role_code'); $oContacts->RemoveItem($oLnk->GetKey()); $oTicket->Set('contacts_list', $oContacts); @@ -1395,10 +1365,10 @@ abstract class ItopDataTestCase extends ItopTestCase 'password' => 'tagada-Secret,007', 'language' => 'EN US', 'profile_list' => [ - 'profileid:'.$sProfileId + 'profileid:'.$sProfileId, ], 'allowed_org_list' => [ - 'allowed_org_id:'.$iOrganization + 'allowed_org_id:'.$iOrganization, ], ]); return $sLogin; @@ -1415,7 +1385,7 @@ abstract class ItopDataTestCase extends ItopTestCase { $sLogin = 'demo_test_'.uniqid(__CLASS__, true); - $aProfileList = array_map(function($sProfileId) { + $aProfileList = array_map(function ($sProfileId) { return 'profileid:'.self::$aURP_Profiles[$sProfileId]; }, $aProfiles); @@ -1442,7 +1412,7 @@ abstract class ItopDataTestCase extends ItopTestCase } } - static protected function StartStopwatchInThePast(DBObject $oObject, string $sStopwatchAttCode, int $iDelayInSecond) + protected static function StartStopwatchInThePast(DBObject $oObject, string $sStopwatchAttCode, int $iDelayInSecond) { $iStartDate = time() - $iDelayInSecond; /** @var \ormStopWatch $oStopwatch */ @@ -1453,8 +1423,7 @@ abstract class ItopDataTestCase extends ItopTestCase $oObject->Set($sStopwatchAttCode, $oStopwatch); } - - static protected function StopStopwatchInTheFuture(DBObject $oObject, string $sStopwatchAttCode, int $iDelayInSecond) + protected static function StopStopwatchInTheFuture(DBObject $oObject, string $sStopwatchAttCode, int $iDelayInSecond) { $iEndDate = time() + $iDelayInSecond; /** @var \ormStopWatch $oStopwatch */ diff --git a/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php b/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php index f72444b79..ab1eaa1b1 100644 --- a/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php +++ b/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php @@ -1,4 +1,5 @@ LoadRequiredItopFiles(); $this->LoadRequiredTestFiles(); @@ -187,22 +189,22 @@ abstract class ItopTestCase extends KernelTestCase $sAppRootPath = static::GetFirstDirUpContainingFile(__DIR__, 'approot.inc.php'); - return $sAppRootPath . '/'; + return $sAppRootPath.'/'; } private static function GetFirstDirUpContainingFile(string $sSearchPath, string $sFileToFindGlobPattern): ?string { for ($iDepth = 0; $iDepth < 8; $iDepth++) { - $aGlobFiles = glob($sSearchPath . '/' . $sFileToFindGlobPattern); + $aGlobFiles = glob($sSearchPath.'/'.$sFileToFindGlobPattern); if (is_array($aGlobFiles) && (count($aGlobFiles) > 0)) { - return $sSearchPath . '/'; + return $sSearchPath.'/'; } $iOffsetSep = strrpos($sSearchPath, '/'); if ($iOffsetSep === false) { $iOffsetSep = strrpos($sSearchPath, '\\'); if ($iOffsetSep === false) { // Do not throw an exception here as PHPUnit will not show it clearly when determing the list of test to perform - return 'Could not find the approot file in ' . $sSearchPath; + return 'Could not find the approot file in '.$sSearchPath; } } $sSearchPath = substr($sSearchPath, 0, $iOffsetSep); @@ -210,7 +212,6 @@ abstract class ItopTestCase extends KernelTestCase return null; } - /** * Overload this method to require necessary files through {@see \Combodo\iTop\Test\UnitTest\ItopTestCase::RequireOnceItopFile()} * @@ -221,7 +222,7 @@ abstract class ItopTestCase extends KernelTestCase { // At least make sure that the autoloader will be loaded, and that the APPROOT constant is defined require_once __DIR__.'/../../../../approot.inc.php'; - } + } /** * Overload this method to require necessary files through {@see \Combodo\iTop\Test\UnitTest\ItopTestCase::RequireOnceUnitTestFile()} @@ -245,7 +246,7 @@ abstract class ItopTestCase extends KernelTestCase */ protected function RequireOnceItopFile(string $sFileRelPath): void { - require_once $this->GetAppRoot() . $sFileRelPath; + require_once $this->GetAppRoot().$sFileRelPath; } /** @@ -262,7 +263,7 @@ abstract class ItopTestCase extends KernelTestCase $aStack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); $sCallerDirAbsPath = dirname($aStack[0]['file']); - require_once $sCallerDirAbsPath . DIRECTORY_SEPARATOR . $sFileRelPath; + require_once $sCallerDirAbsPath.DIRECTORY_SEPARATOR.$sFileRelPath; } protected function debug($sMsg) @@ -271,11 +272,11 @@ abstract class ItopTestCase extends KernelTestCase if (is_string($sMsg)) { echo "$sMsg\n"; } else { - /** @noinspection ForgottenDebugOutputInspection */ - print_r($sMsg); - } - } - } + /** @noinspection ForgottenDebugOutputInspection */ + print_r($sMsg); + } + } + } public function GetMicroTime() { @@ -286,8 +287,7 @@ abstract class ItopTestCase extends KernelTestCase public function WriteToCsvHeader($sFilename, $aHeader) { $sResultFile = APPROOT.'log/'.$sFilename; - if (is_file($sResultFile)) - { + if (is_file($sResultFile)) { @unlink($sResultFile); } SetupUtils::builddir(dirname($sResultFile)); @@ -378,7 +378,9 @@ abstract class ItopTestCase extends KernelTestCase { $class = new \ReflectionClass($sClass); foreach ($class->getProperties() as $property) { - if (!$property->isStatic()) continue; + if (!$property->isStatic()) { + continue; + } $property->setAccessible(true); static::$aBackupStaticProperties[$sClass][$property->getName()] = $property->getValue(); } @@ -396,7 +398,9 @@ abstract class ItopTestCase extends KernelTestCase { $class = new \ReflectionClass($sClass); foreach ($class->getProperties() as $property) { - if (!$property->isStatic()) continue; + if (!$property->isStatic()) { + continue; + } $property->setAccessible(true); $property->setValue(null, static::$aBackupStaticProperties[$sClass][$property->getName()]); } @@ -414,7 +418,6 @@ abstract class ItopTestCase extends KernelTestCase return $oProperty; } - /** * @param object $oObject * @param string $sProperty @@ -454,38 +457,38 @@ abstract class ItopTestCase extends KernelTestCase } } - public static function CreateTmpdir() { - $sTmpDir=tempnam(sys_get_temp_dir(),''); - if (file_exists($sTmpDir)) - { + public static function CreateTmpdir() + { + $sTmpDir = tempnam(sys_get_temp_dir(), ''); + if (file_exists($sTmpDir)) { unlink($sTmpDir); } mkdir($sTmpDir); - if (is_dir($sTmpDir)) - { + if (is_dir($sTmpDir)) { return $sTmpDir; } return sys_get_temp_dir(); } - public static function RecurseMkdir($sDir){ - if (strpos($sDir, DIRECTORY_SEPARATOR) === 0){ + public static function RecurseMkdir($sDir) + { + if (strpos($sDir, DIRECTORY_SEPARATOR) === 0) { $sPath = DIRECTORY_SEPARATOR; } else { $sPath = ""; } - foreach (explode(DIRECTORY_SEPARATOR, $sDir) as $sSubDir){ + foreach (explode(DIRECTORY_SEPARATOR, $sDir) as $sSubDir) { if (($sSubDir === '..')) { break; } - if (( trim($sSubDir) === '' ) || ( $sSubDir === '.' )) { + if ((trim($sSubDir) === '') || ($sSubDir === '.')) { continue; } - $sPath .= $sSubDir . DIRECTORY_SEPARATOR; + $sPath .= $sSubDir.DIRECTORY_SEPARATOR; if (!is_dir($sPath)) { var_dump($sPath); @mkdir($sPath); @@ -494,16 +497,16 @@ abstract class ItopTestCase extends KernelTestCase } - public static function RecurseCopy($src,$dst) { + public static function RecurseCopy($src, $dst) + { $dir = opendir($src); @mkdir($dst); - while(false !== ( $file = readdir($dir)) ) { - if (( $file != '.' ) && ( $file != '..' )) { - if ( is_dir($src . '/' . $file) ) { - static::RecurseCopy($src . DIRECTORY_SEPARATOR . $file,$dst . DIRECTORY_SEPARATOR . $file); - } - else { - copy($src . DIRECTORY_SEPARATOR . $file,$dst . DIRECTORY_SEPARATOR . $file); + while (false !== ($file = readdir($dir))) { + if (($file != '.') && ($file != '..')) { + if (is_dir($src.'/'.$file)) { + static::RecurseCopy($src.DIRECTORY_SEPARATOR.$file, $dst.DIRECTORY_SEPARATOR.$file); + } else { + copy($src.DIRECTORY_SEPARATOR.$file, $dst.DIRECTORY_SEPARATOR.$file); } } } @@ -553,7 +556,7 @@ abstract class ItopTestCase extends KernelTestCase /** * @since 3.2.1 */ - static protected function AssertDateEqualsNow($sActualDate, $sMessage = ''): void + protected static function AssertDateEqualsNow($sActualDate, $sMessage = ''): void { $oActualDate = \DateTime::createFromFormat(\AttributeDate::GetInternalFormat(), $sActualDate); $oNow = new \DateTime(); @@ -563,7 +566,7 @@ abstract class ItopTestCase extends KernelTestCase /** * @since 3.2.1 */ - static protected function AssertDateTimeEqualsNow($sActualDate, $sMessage = ''): void + protected static function AssertDateTimeEqualsNow($sActualDate, $sMessage = ''): void { $oActualDateTime = \DateTime::createFromFormat(\AttributeDateTime::GetInternalFormat(), $sActualDate); $oNow = new \DateTime(); @@ -576,17 +579,17 @@ abstract class ItopTestCase extends KernelTestCase * * @see static::bootKernel(), static::getContainer() * @see \Combodo\iTop\Kernel, \Combodo\iTop\Portal\Kernel - * + * * @param string $sKernelClass * * @since 3.2.1 */ - static protected function SetKernelClass(string $sKernelClass): void + protected static function SetKernelClass(string $sKernelClass): void { $_SERVER['KERNEL_CLASS'] = $sKernelClass; } - static protected function bootKernel(array $options = []): KernelInterface + protected static function bootKernel(array $options = []): KernelInterface { if (!array_key_exists('KERNEL_CLASS', $_SERVER)) { throw new \LogicException('static::SetKernelClass() must be called before booting the kernel.'); @@ -599,31 +602,33 @@ abstract class ItopTestCase extends KernelTestCase * * @since 3.2.1 */ - static protected function ReadTail($sFilename, $iLines = 1) + protected static function ReadTail($sFilename, $iLines = 1) { $handle = fopen($sFilename, "r"); $iLineCounter = $iLines; $iPos = -2; $bBeginning = false; - $aLines = array(); + $aLines = []; while ($iLineCounter > 0) { $sChar = " "; while ($sChar != "\n") { - if(fseek($handle, $iPos, SEEK_END) == -1) { + if (fseek($handle, $iPos, SEEK_END) == -1) { $bBeginning = true; break; } $sChar = fgetc($handle); - $iPos --; + $iPos--; } - $iLineCounter --; + $iLineCounter--; if ($bBeginning) { rewind($handle); } $aLines[$iLines - $iLineCounter - 1] = fgets($handle); - if ($bBeginning) break; + if ($bBeginning) { + break; + } } - fclose ($handle); + fclose($handle); return array_reverse($aLines); } } diff --git a/tests/php-unit-tests/src/Service/UnitTestRunTimeEnvironment.php b/tests/php-unit-tests/src/Service/UnitTestRunTimeEnvironment.php index 370c5a879..8080d8abb 100644 --- a/tests/php-unit-tests/src/Service/UnitTestRunTimeEnvironment.php +++ b/tests/php-unit-tests/src/Service/UnitTestRunTimeEnvironment.php @@ -16,7 +16,6 @@ use RunTimeEnvironment; use SetupUtils; use utils; - /** * Class UnitTestRunTimeEnvironment * @@ -32,18 +31,18 @@ class UnitTestRunTimeEnvironment extends RunTimeEnvironment */ protected $aCustomDatamodelFiles = null; - /** - * @var string - */ - protected $sSourceEnv; + /** + * @var string + */ + protected $sSourceEnv; - public function __construct($sSourceEnv, $sTargetEnv) - { - parent::__construct($sTargetEnv); - $this->sSourceEnv = $sSourceEnv; - } + public function __construct($sSourceEnv, $sTargetEnv) + { + parent::__construct($sTargetEnv); + $this->sSourceEnv = $sSourceEnv; + } - public function GetEnvironment(): string + public function GetEnvironment(): string { return $this->sFinalEnv; } @@ -60,19 +59,19 @@ class UnitTestRunTimeEnvironment extends RunTimeEnvironment parent::CompileFrom($sSourceEnv, $bUseSymLinks); } - public function IsUpToDate() - { - clearstatcache(); - $fLastCompilationTime = filemtime(APPROOT.'env-'.$this->sFinalEnv); - $aModifiedFiles = []; - $this->FindFilesModifiedAfter($fLastCompilationTime, APPROOT.'datamodels/2.x', $aModifiedFiles); - $this->FindFilesModifiedAfter($fLastCompilationTime, APPROOT.'extensions', $aModifiedFiles); - $this->FindFilesModifiedAfter($fLastCompilationTime, APPROOT.'data/production-modules', $aModifiedFiles); - foreach ($this->GetCustomDatamodelFiles() as $sCustomDatamodelFile) { - if (filemtime($sCustomDatamodelFile) > $fLastCompilationTime) { - $aModifiedFiles[] = $sCustomDatamodelFile; - } - } + public function IsUpToDate() + { + clearstatcache(); + $fLastCompilationTime = filemtime(APPROOT.'env-'.$this->sFinalEnv); + $aModifiedFiles = []; + $this->FindFilesModifiedAfter($fLastCompilationTime, APPROOT.'datamodels/2.x', $aModifiedFiles); + $this->FindFilesModifiedAfter($fLastCompilationTime, APPROOT.'extensions', $aModifiedFiles); + $this->FindFilesModifiedAfter($fLastCompilationTime, APPROOT.'data/production-modules', $aModifiedFiles); + foreach ($this->GetCustomDatamodelFiles() as $sCustomDatamodelFile) { + if (filemtime($sCustomDatamodelFile) > $fLastCompilationTime) { + $aModifiedFiles[] = $sCustomDatamodelFile; + } + } // Keep only xml files $aFilesToCompile = []; foreach ($aModifiedFiles as $sModifiedFile) { @@ -80,17 +79,17 @@ class UnitTestRunTimeEnvironment extends RunTimeEnvironment $aFilesToCompile[] = $sModifiedFile; } } - $aModifiedFiles = $aFilesToCompile; - if (count($aModifiedFiles) > 0) { - echo "The following files have been modified after the last compilation:\n"; - foreach ($aModifiedFiles as $sFile) { - echo " - $sFile\n"; - } - } - return (count($aModifiedFiles) === 0); + $aModifiedFiles = $aFilesToCompile; + if (count($aModifiedFiles) > 0) { + echo "The following files have been modified after the last compilation:\n"; + foreach ($aModifiedFiles as $sFile) { + echo " - $sFile\n"; + } + } + return (count($aModifiedFiles) === 0); } - /** + /** * @inheritDoc */ protected function GetMFModulesToCompile($sSourceEnv, $sSourceDir) @@ -99,8 +98,8 @@ class UnitTestRunTimeEnvironment extends RunTimeEnvironment foreach ($this->GetCustomDatamodelFiles() as $sDeltaFile) { $sDeltaId = preg_replace('/[^\d\w]/', '', $sDeltaFile); - $sDeltaName = basename($sDeltaFile); - $sDeltaDir = dirname($sDeltaFile); + $sDeltaName = basename($sDeltaFile); + $sDeltaDir = dirname($sDeltaFile); $oDelta = new MFCoreModule($sDeltaName, "$sDeltaDir/$sDeltaName", $sDeltaFile); $aRet[$sDeltaId] = $oDelta; } @@ -119,16 +118,16 @@ class UnitTestRunTimeEnvironment extends RunTimeEnvironment // APPROOT, APPROOT/extensions/*, APPROOT/data/production-modules/*, APPROOT/data/production-modules/*/* $aTestDirs = []; - foreach(['', 'extensions/*/', 'data/production-modules/*/', 'data/production-modules/*/*/'] as $sRoot) { + foreach (['', 'extensions/*/', 'data/production-modules/*/', 'data/production-modules/*/*/'] as $sRoot) { $aTestDirs = array_merge($aTestDirs, glob(APPROOT.$sRoot.'tests', GLOB_ONLYDIR)); } $aLoadedTestClasses = []; - foreach($aTestDirs as $sTestDir) { + foreach ($aTestDirs as $sTestDir) { // Iterate on all PHP files in subdirectories // Note: grep is not available on Windows, so we will use the PHP Reflection API foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($sTestDir)) as $oFile) { - if ($oFile->isDir()){ + if ($oFile->isDir()) { continue; } if (! utils::EndsWith($oFile->getFilename(), 'Test.php')) { @@ -154,16 +153,16 @@ class UnitTestRunTimeEnvironment extends RunTimeEnvironment if (in_array($sClass, $aLoadedTestClasses)) { continue; } - $aLoadedTestClasses[]=$sClass; - require_once $sFile; + $aLoadedTestClasses[] = $sClass; + require_once $sFile; $oReflectionClass = new ReflectionClass($sClass); if ($oReflectionClass->isAbstract()) { continue; } - // Check if the class extends ItopCustomDatamodelTestCase - if (!$oReflectionClass->isSubclassOf(ItopCustomDatamodelTestCase::class)) { - continue; - } + // Check if the class extends ItopCustomDatamodelTestCase + if (!$oReflectionClass->isSubclassOf(ItopCustomDatamodelTestCase::class)) { + continue; + } /** @var \Combodo\iTop\Test\UnitTest\ItopCustomDatamodelTestCase $oTestClassInstance */ $oTestClassInstance = new $sClass(); if ($oTestClassInstance->GetTestEnvironment() !== $this->sFinalEnv) { @@ -182,18 +181,18 @@ class UnitTestRunTimeEnvironment extends RunTimeEnvironment return $this->aCustomDatamodelFiles; } - private function FindFilesModifiedAfter(float $fReferenceTimestamp, string $sPathToScan, array &$aModifiedFiles) - { - if (!is_dir($sPathToScan)) { - return; - } - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($sPathToScan)) as $oFile) { - if ($oFile->isDir()) { - continue; - } - if (filemtime($oFile->getPathname()) > $fReferenceTimestamp) { - $aModifiedFiles[] = $oFile->getPathname(); - } - } - } -} \ No newline at end of file + private function FindFilesModifiedAfter(float $fReferenceTimestamp, string $sPathToScan, array &$aModifiedFiles) + { + if (!is_dir($sPathToScan)) { + return; + } + foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($sPathToScan)) as $oFile) { + if ($oFile->isDir()) { + continue; + } + if (filemtime($oFile->getPathname()) > $fReferenceTimestamp) { + $aModifiedFiles[] = $oFile->getPathname(); + } + } + } +} diff --git a/tests/php-unit-tests/tools/run_class_by_class.php b/tests/php-unit-tests/tools/run_class_by_class.php index c36c62472..3b99ad0c7 100644 --- a/tests/php-unit-tests/tools/run_class_by_class.php +++ b/tests/php-unit-tests/tools/run_class_by_class.php @@ -1,4 +1,5 @@ >>\n"; if ($bPassthru) { passthru($sCommand, $iResultCode); - } - else { + } else { exec($sCommand, $aTrashedOutput, $iResultCode); } $bTestSuccess = ($iResultCode == 0); // or 1 in case of a failing test @@ -61,4 +61,4 @@ foreach ($aTestClasses as $sTestClass) { $bSuccess = RunTests($sTestClass); $sDuration = round(microtime(true) - $fStarted, 3); echo "$sTestClass: ".($bSuccess ? 'Ok' : "FAILURE")." [$sDuration s]\n"; -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/application/ApplicationObjectExtensionTest.php b/tests/php-unit-tests/unitary-tests/application/ApplicationObjectExtensionTest.php index 23f952343..2a176bb1d 100644 --- a/tests/php-unit-tests/unitary-tests/application/ApplicationObjectExtensionTest.php +++ b/tests/php-unit-tests/unitary-tests/application/ApplicationObjectExtensionTest.php @@ -1,4 +1,5 @@ assertEquals(2, self::$iCalls); } - public function testModificationsOnInsertWith2Extensions() { self::ResetCallCount(); @@ -100,4 +100,4 @@ class ApplicationObjectExtensionTest extends \Combodo\iTop\Test\UnitTest\ItopDat $this->assertEquals(6, self::$iCalls); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/application/DashboardLayoutTest.php b/tests/php-unit-tests/unitary-tests/application/DashboardLayoutTest.php index dcbcdf902..9f05221e9 100644 --- a/tests/php-unit-tests/unitary-tests/application/DashboardLayoutTest.php +++ b/tests/php-unit-tests/unitary-tests/application/DashboardLayoutTest.php @@ -1,4 +1,5 @@ array('DashboardLayoutOneCol', 0, array(0, 0)), - 'OneColLayout-Cell1' => array('DashboardLayoutOneCol', 1, array(0, 1)), - 'TwoColsLayout-Cell0' => array('DashboardLayoutTwoCols', 0, array(0, 0)), - 'TwoColsLayout-Cell1' => array('DashboardLayoutTwoCols', 1, array(1, 0)), - 'TwoColsLayout-Cell2' => array('DashboardLayoutTwoCols', 2, array(0, 1)), - 'TwoColsLayout-Cell3' => array('DashboardLayoutTwoCols', 3, array(1, 1)), - 'ThreeColsLayout-Cell0' => array('DashboardLayoutThreeCols', 0, array(0, 0)), - 'ThreeColsLayout-Cell1' => array('DashboardLayoutThreeCols', 1, array(1, 0)), - 'ThreeColsLayout-Cell2' => array('DashboardLayoutThreeCols', 2, array(2, 0)), - 'ThreeColsLayout-Cell3' => array('DashboardLayoutThreeCols', 3, array(0, 1)), - 'ThreeColsLayout-Cell4' => array('DashboardLayoutThreeCols', 4, array(1, 1)), - 'ThreeColsLayout-Cell5' => array('DashboardLayoutThreeCols', 5, array(2, 1)), - ); + return [ + 'OneColLayout-Cell0' => ['DashboardLayoutOneCol', 0, [0, 0]], + 'OneColLayout-Cell1' => ['DashboardLayoutOneCol', 1, [0, 1]], + 'TwoColsLayout-Cell0' => ['DashboardLayoutTwoCols', 0, [0, 0]], + 'TwoColsLayout-Cell1' => ['DashboardLayoutTwoCols', 1, [1, 0]], + 'TwoColsLayout-Cell2' => ['DashboardLayoutTwoCols', 2, [0, 1]], + 'TwoColsLayout-Cell3' => ['DashboardLayoutTwoCols', 3, [1, 1]], + 'ThreeColsLayout-Cell0' => ['DashboardLayoutThreeCols', 0, [0, 0]], + 'ThreeColsLayout-Cell1' => ['DashboardLayoutThreeCols', 1, [1, 0]], + 'ThreeColsLayout-Cell2' => ['DashboardLayoutThreeCols', 2, [2, 0]], + 'ThreeColsLayout-Cell3' => ['DashboardLayoutThreeCols', 3, [0, 1]], + 'ThreeColsLayout-Cell4' => ['DashboardLayoutThreeCols', 4, [1, 1]], + 'ThreeColsLayout-Cell5' => ['DashboardLayoutThreeCols', 5, [2, 1]], + ]; } /** @@ -59,6 +60,6 @@ class DashboardLayoutTest extends ItopTestCase $oDashboardLayout = new $sDashboardLayoutClass(); $aDashletCoordinates = $oDashboardLayout->GetDashletCoordinates($iCellIdx); - $this->assertEquals($aExpectedCoordinates,$aDashletCoordinates); + $this->assertEquals($aExpectedCoordinates, $aDashletCoordinates); } } diff --git a/tests/php-unit-tests/unitary-tests/application/DesignerFormFieldTest.php b/tests/php-unit-tests/unitary-tests/application/DesignerFormFieldTest.php index eae8975eb..7db827871 100644 --- a/tests/php-unit-tests/unitary-tests/application/DesignerFormFieldTest.php +++ b/tests/php-unit-tests/unitary-tests/application/DesignerFormFieldTest.php @@ -1,4 +1,5 @@ assertFalse(in_array($sNonExpected, $aJSNames)); $this->assertTrue(in_array($sExpected, $aJSNames)); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/application/LoginTest.php b/tests/php-unit-tests/unitary-tests/application/LoginTest.php index 5b0ba61ce..1f28ded99 100644 --- a/tests/php-unit-tests/unitary-tests/application/LoginTest.php +++ b/tests/php-unit-tests/unitary-tests/application/LoginTest.php @@ -1,15 +1,18 @@ sConfigPath, 0444); } - protected function tearDown(): void { - if (! is_null($this->sConfigTmpBackupFile) && is_file($this->sConfigTmpBackupFile)){ + protected function tearDown(): void + { + if (! is_null($this->sConfigTmpBackupFile) && is_file($this->sConfigTmpBackupFile)) { //put config back @chmod($this->sConfigPath, 0770); file_put_contents($this->sConfigPath, file_get_contents($this->sConfigTmpBackupFile)); @@ -40,18 +44,19 @@ class LoginTest extends ItopDataTestCase { parent::tearDown(); } - protected function CallItopUrlByCurl($sUri, ?array $aPostFields=[]){ + protected function CallItopUrlByCurl($sUri, ?array $aPostFields = []) + { $ch = curl_init(); - $sUrl = MetaModel::GetConfig()->Get('app_root_url') . "/$sUri"; + $sUrl = MetaModel::GetConfig()->Get('app_root_url')."/$sUri"; curl_setopt($ch, CURLOPT_URL, $sUrl); - if (0 !== sizeof($aPostFields)){ + if (0 !== sizeof($aPostFields)) { curl_setopt($ch, CURLOPT_POST, 1);// set post data to true curl_setopt($ch, CURLOPT_POSTFIELDS, $aPostFields); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $sOutput = curl_exec($ch); - curl_close ($ch); + curl_close($ch); return $sOutput; } diff --git a/tests/php-unit-tests/unitary-tests/application/MenuNodeTest.php b/tests/php-unit-tests/unitary-tests/application/MenuNodeTest.php index 053fef232..3addf7260 100644 --- a/tests/php-unit-tests/unitary-tests/application/MenuNodeTest.php +++ b/tests/php-unit-tests/unitary-tests/application/MenuNodeTest.php @@ -5,10 +5,12 @@ namespace Combodo\iTop\Test\UnitTest\Application; use Combodo\iTop\Application\WebPage\WebPage; use Combodo\iTop\Test\UnitTest\ItopDataTestCase; -class MenuNodeTest extends ItopDataTestCase { +class MenuNodeTest extends ItopDataTestCase +{ private \UserRequest $oUR; - protected function setUp(): void { + protected function setUp(): void + { parent::setUp(); clearstatcache(); @@ -20,7 +22,6 @@ class MenuNodeTest extends ItopDataTestCase { $this->oUR = $this->CreateUserRequest(666, $aUserRequestCustomParams); } - public function RenderOQLSearchProvider() { $aUseCases = []; @@ -66,16 +67,16 @@ OQL; SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (DATE_FORMAT(`UserRequest`.`ttr_escalation_deadline`, '%Y%v') != DATE_FORMAT(NOW(), '%Y%v')) OQL; - try{ + try { $sContent = $this->CallRenderOQLSearch(true, true, true, $sOql); $this->assertTrue(false !== strpos($sContent, $this->oUR->Get('title')), $sContent); - } catch(\Exception $e){ + } catch (\Exception $e) { echo($e->getMessage()); $this->fail('Without N°7750 fix Exception raised => TypeError : date(): Argument #2 ($timestamp) must be of type ?int, string given'); } } - public function CallRenderOQLSearch(bool $bSearchPane, bool $bSearchOpen, bool $bAutoreload, string $sOql) : string + public function CallRenderOQLSearch(bool $bSearchPane, bool $bSearchOpen, bool $bAutoreload, string $sOql): string { $sTitle = 'title'; $oPage = new WebPage($sTitle); @@ -94,4 +95,3 @@ OQL; return $oResponse->getContent(); } } - diff --git a/tests/php-unit-tests/unitary-tests/application/SCSSCompilationTest.php b/tests/php-unit-tests/unitary-tests/application/SCSSCompilationTest.php index 1011d8b5c..18dab9e6e 100644 --- a/tests/php-unit-tests/unitary-tests/application/SCSSCompilationTest.php +++ b/tests/php-unit-tests/unitary-tests/application/SCSSCompilationTest.php @@ -1,4 +1,5 @@ assertEquals('OK', Session::Get('test')); } - public function testIsSet() { $this->assertFalse(Session::IsSet('test')); diff --git a/tests/php-unit-tests/unitary-tests/application/ThemeHandlerTest.php b/tests/php-unit-tests/unitary-tests/application/ThemeHandlerTest.php index e889d61fa..34ea625d9 100644 --- a/tests/php-unit-tests/unitary-tests/application/ThemeHandlerTest.php +++ b/tests/php-unit-tests/unitary-tests/application/ThemeHandlerTest.php @@ -11,19 +11,18 @@ use ThemeHandler; */ class ThemeHandlerTest extends ItopTestCase { - const PATTERN = '|\\\/var[^"]+testimages|'; + public const PATTERN = '|\\\/var[^"]+testimages|'; private $oCompileCSSServiceMock; private $sCompiledThemesDirAbsPath; private $sCssAbsPath; private $sDmCssAbsPath; private $sJsonThemeParamFile; - static private $sTmpDir = null; - static private $aDirsToCleanup = []; - static private $sAbsoluteImagePath; + private static $sTmpDir = null; + private static $aDirsToCleanup = []; + private static $sAbsoluteImagePath; - - static function setUpBeforeClass(): void + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); @@ -39,10 +38,9 @@ class ThemeHandlerTest extends ItopTestCase static::$aDirsToCleanup[] = dirname(static::$sAbsoluteImagePath); } - static function tearDownAfterClass(): void + public static function tearDownAfterClass(): void { - foreach (static::$aDirsToCleanup as $sDir) - { + foreach (static::$aDirsToCleanup as $sDir) { static::RecurseRmdir($sDir); } @@ -73,35 +71,36 @@ class ThemeHandlerTest extends ItopTestCase parent::tearDown(); } - function KeepSignatureDiff($sSignature1, $sSignature2) : string { + public function KeepSignatureDiff($sSignature1, $sSignature2): string + { $aSignature1 = json_decode($sSignature1, true); $aSignature2 = json_decode($sSignature2, true); $aDiffOuput = []; - foreach ($aSignature1 as $sKey => $oVal1){ - if (is_array($oVal1) && ! empty($oVal1)){ + foreach ($aSignature1 as $sKey => $oVal1) { + if (is_array($oVal1) && ! empty($oVal1)) { $aCurrentDiffVal = []; $oVal2 = $aSignature2[$sKey]; - if (0 != sizeof($oVal1)){ - foreach ($oVal1 as $sKey1 => $sVal1){ - if (! array_key_exists($sKey1, $oVal2)){ + if (0 != sizeof($oVal1)) { + foreach ($oVal1 as $sKey1 => $sVal1) { + if (! array_key_exists($sKey1, $oVal2)) { $aCurrentDiffVal[$sKey1] = "Missing"; - } else if ($sVal1 !== $oVal2[$sKey1]) { - $aCurrentDiffVal[$sKey1] = "expected:$sVal1 | actual:" . $oVal2[$sKey1]; + } elseif ($sVal1 !== $oVal2[$sKey1]) { + $aCurrentDiffVal[$sKey1] = "expected:$sVal1 | actual:".$oVal2[$sKey1]; } } } - if (! empty($oVal2)){ - foreach ($oVal2 as $sKey2 => $sVal2){ - if (! array_key_exists($sKey2, $oVal1)){ + if (! empty($oVal2)) { + foreach ($oVal2 as $sKey2 => $sVal2) { + if (! array_key_exists($sKey2, $oVal1)) { $aCurrentDiffVal[$sKey1] = "Missing"; } } } - if (! empty($aCurrentDiffVal)){ + if (! empty($aCurrentDiffVal)) { $aDiffOuput[$sKey] = $aCurrentDiffVal; } - } else if ($oVal1 !== $aSignature2[$sKey]){ + } elseif ($oVal1 !== $aSignature2[$sKey]) { $aDiffOuput[$sKey] = "expected:$oVal1 | actual:$aSignature2[$sKey]"; } } @@ -111,14 +110,12 @@ class ThemeHandlerTest extends ItopTestCase public static function RecurseMkdir($dir) { - if (is_dir($dir)) - { + if (is_dir($dir)) { return true; } $sParentDir = dirname($dir); - if (!static::RecurseMkdir($sParentDir)) - { + if (!static::RecurseMkdir($sParentDir)) { return false; } @@ -128,28 +125,28 @@ class ThemeHandlerTest extends ItopTestCase public function testGetSignatureWithFileWithoutSignature() { $sTmpFile = tempnam(sys_get_temp_dir(), "sig"); - file_put_contents($sTmpFile,"ffff"); - $this->assertEquals("", ThemeHandler::GetSignature($sTmpFile)); + file_put_contents($sTmpFile, "ffff"); + $this->assertEquals("", ThemeHandler::GetSignature($sTmpFile)); } public function testGetSignature() { $sSig = ThemeHandler::GetSignature(APPROOT.'tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main.css'); - $sExpectedSig=<<assertEquals($sExpectedSig, $sSig); + $this->assertEquals($sExpectedSig, $sSig); } public function testGetVarSignature() { - $sSignature=<<assertEquals("37c31105548fce44fecca5cb34e455c9",$var_sig); + $this->assertEquals("37c31105548fce44fecca5cb34e455c9", $var_sig); } /** @@ -158,19 +155,17 @@ JSON; * @throws \CoreException * @dataProvider CompileThemesProviderWithoutCss */ - public function testCompileThemeWithoutCssFile_FocusOnParamAttribute($readFromParamAttributeFromJson=false) + public function testCompileThemeWithoutCssFile_FocusOnParamAttribute($readFromParamAttributeFromJson = false) { static::InitCSSDirectory(); $sExpectJsonFilePath = APPROOT.'tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/theme-parameters.json'; $sExpectedThemeParamJson = file_get_contents($sExpectJsonFilePath); $aThemeParameters = json_decode($sExpectedThemeParamJson, true); - if (is_file($this->sJsonThemeParamFile)) - { + if (is_file($this->sJsonThemeParamFile)) { unlink($this->sJsonThemeParamFile); } - if (is_file($this->sCssAbsPath)) - { + if (is_file($this->sCssAbsPath)) { unlink($this->sCssAbsPath); } @@ -178,25 +173,22 @@ JSON; ->method("CompileCSSFromSASS") ->willReturn("====CSSCOMPILEDCONTENT===="); - if($readFromParamAttributeFromJson) - { + if ($readFromParamAttributeFromJson) { copy($sExpectJsonFilePath, $this->sJsonThemeParamFile); $this->assertTrue(ThemeHandler::CompileTheme('basque-red', true, "COMPILATIONTIMESTAMP", null, [static::$sTmpDir.'/branding/themes/'], static::$sTmpDir)); - } - else - { + } else { $this->assertTrue(ThemeHandler::CompileTheme('basque-red', true, "COMPILATIONTIMESTAMP", $aThemeParameters, [static::$sTmpDir.'/branding/themes/'], static::$sTmpDir)); } $this->assertTrue(is_file($this->sCssAbsPath)); $this->assertEquals($sExpectedThemeParamJson, file_get_contents($this->sJsonThemeParamFile)); - $this->assertEquals(file_get_contents(APPROOT . 'tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main.css'), file_get_contents($this->sCssAbsPath)); + $this->assertEquals(file_get_contents(APPROOT.'tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main.css'), file_get_contents($this->sCssAbsPath)); } public function CompileThemesProviderWithoutCss() { return [ "pass ParamAttributes and Save them in Json" => [false], - "use them from saved json" => [true] + "use them from saved json" => [true], ]; } @@ -208,23 +200,23 @@ JSON; * @throws \CoreException * @dataProvider CompileThemesProviderEmptyArray */ - public function testCompileThemesEmptyArray($ThemeParametersJson, $CompileCount=0) + public function testCompileThemesEmptyArray($ThemeParametersJson, $CompileCount = 0) { - $sCssPath = static::$sTmpDir . '/branding/themes/basque-red/main.css'; - copy(APPROOT . 'tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main.css', $sCssPath); + $sCssPath = static::$sTmpDir.'/branding/themes/basque-red/main.css'; + copy(APPROOT.'tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main.css', $sCssPath); $this->oCompileCSSServiceMock->expects($this->exactly($CompileCount)) ->method("CompileCSSFromSASS") ->willReturn("====CSSCOMPILEDCONTENT===="); - $this->assertEquals($CompileCount!=0,ThemeHandler::CompileTheme('basque-red', true, "COMPILATIONTIMESTAMP", json_decode($ThemeParametersJson, true), [static::$sTmpDir.'/branding/themes/'], static::$sTmpDir)); + $this->assertEquals($CompileCount != 0, ThemeHandler::CompileTheme('basque-red', true, "COMPILATIONTIMESTAMP", json_decode($ThemeParametersJson, true), [static::$sTmpDir.'/branding/themes/'], static::$sTmpDir)); } public function CompileThemesProviderEmptyArray() { $aEmptyImports = '{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"utility_imports":[],"variable_imports":[],"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/DO_NOT_CHANGE.jqueryui.scss","main":"..\/css\/DO_NOT_CHANGE.light-grey.scss"}}'; - $aEmptyStyleSheets='{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"utility_imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"variable_imports":[],"stylesheets":[]}'; - $aEmptyVars='{"variables":[],"utility_imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"variable_imports":[],"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/DO_NOT_CHANGE.jqueryui.scss","main":"..\/css\/DO_NOT_CHANGE.light-grey.scss"}}'; + $aEmptyStyleSheets = '{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"utility_imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"variable_imports":[],"stylesheets":[]}'; + $aEmptyVars = '{"variables":[],"utility_imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"variable_imports":[],"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/DO_NOT_CHANGE.jqueryui.scss","main":"..\/css\/DO_NOT_CHANGE.light-grey.scss"}}'; return [ "empty imports" => [$aEmptyImports], "empty styles" => [$aEmptyStyleSheets], @@ -245,13 +237,13 @@ JSON; */ public function CompileThemesProvider() { - $sModifiedVariableThemeParameterJson='{"variables":{"brand-primary1":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"variable_imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/DO_NOT_CHANGE.jqueryui.scss","main":"..\/css\/DO_NOT_CHANGE.light-grey.scss"},"utility_imports":[]}'; - $sInitialThemeParamJson='{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"variable_imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/DO_NOT_CHANGE.jqueryui.scss","main":"..\/css\/DO_NOT_CHANGE.light-grey.scss"},"utility_imports":[]}'; + $sModifiedVariableThemeParameterJson = '{"variables":{"brand-primary1":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"variable_imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/DO_NOT_CHANGE.jqueryui.scss","main":"..\/css\/DO_NOT_CHANGE.light-grey.scss"},"utility_imports":[]}'; + $sInitialThemeParamJson = '{"variables":{"brand-primary":"#C53030","hover-background-color":"#F6F6F6","icons-filter":"grayscale(1)","search-form-container-bg-color":"#4A5568"},"variable_imports":{"css-variables":"..\/css\/DO_NOT_CHANGE.css-variables.scss"},"stylesheets":{"jqueryui":"..\/css\/ui-lightness\/DO_NOT_CHANGE.jqueryui.scss","main":"..\/css\/DO_NOT_CHANGE.light-grey.scss"},"utility_imports":[]}'; $sImportFilePath = '/branding/css/DO_NOT_CHANGE.css-variables.scss'; - $sVarChangedMainCssPath="tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_varchanged.css"; - $sStylesheetMainCssPath="tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_stylesheet.css"; - $sImageMainCssPath="tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_imagemodified.css"; - $sImportModifiedMainCssPath="tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_importmodified.css"; + $sVarChangedMainCssPath = "tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_varchanged.css"; + $sStylesheetMainCssPath = "tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_stylesheet.css"; + $sImageMainCssPath = "tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_imagemodified.css"; + $sImportModifiedMainCssPath = "tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_importmodified.css"; $sStylesheetFilePath = '/branding/css/DO_NOT_CHANGE.light-grey.scss'; $sImageFilePath = 'tests/php-unit-tests/unitary-tests/application/theme-handler/copied/testimages/images/green-header.gif'; return [ @@ -273,7 +265,6 @@ JSON; ]; } - /** * @param $ThemeParametersJson * @param int $iCompileCSSFromSASSCount @@ -287,13 +278,12 @@ JSON; * @throws \CoreException * @dataProvider CompileThemesProvider */ - public function testCompileThemes($ThemeParametersJson, $iCompileCSSFromSASSCount, $bMissingFile=false, $bFilesTouchedRecently=false, $bFileMd5sumModified=false, $sFileToTest=null, $sExpectedMainCssPath=null, $bSetup=true) + public function testCompileThemes($ThemeParametersJson, $iCompileCSSFromSASSCount, $bMissingFile = false, $bFilesTouchedRecently = false, $bFileMd5sumModified = false, $sFileToTest = null, $sExpectedMainCssPath = null, $bSetup = true) { static::InitCSSDirectory(); - $sAfterReplacementCssVariableMd5sum=''; - if (is_file(static::$sTmpDir.'/'.$sFileToTest)) - { + $sAfterReplacementCssVariableMd5sum = ''; + if (is_file(static::$sTmpDir.'/'.$sFileToTest)) { $sFileToTest = static::$sTmpDir.'/'.$sFileToTest; } else { $sFileToTest = APPROOT.'/'.$sFileToTest; @@ -309,14 +299,12 @@ JSON; $sLine = '$approot-relative: "'.static::$sAbsoluteImagePath.'" !default;'; $sCssVariableContent = preg_replace("/\\\$approot-relative: \"(.*)\"/", $sLine, $sCssVariableContent); file_put_contents($sCssVarPath, $sCssVariableContent); - if ($bMissingFile) - { + if ($bMissingFile) { $sAfterReplacementCssVariableMd5sum = $sBeforeReplacementCssVariableMd5sum; unlink($sFileToTest); } - if (is_file($sCssVarPath)) - { + if (is_file($sCssVarPath)) { $sAfterReplacementCssVariableMd5sum = md5_file($sCssVarPath); } @@ -324,26 +312,23 @@ JSON; $sMainCssContent = file_get_contents(APPROOT."tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/main_testcompilethemes.css"); $sMainCssContent = preg_replace('/MD5SUM/', $sAfterReplacementCssVariableMd5sum, $sMainCssContent); $sReplacement = rtrim(static::$sAbsoluteImagePath, '/'); - $sReplacement=preg_replace('|\/|', '\/', $sReplacement); - $sMainCssContent = preg_replace(static::PATTERN, $sReplacement, $sMainCssContent); - $cssPath = static::$sTmpDir . '/branding/themes/basque-red/main.css'; + $sReplacement = preg_replace('|\/|', '\/', $sReplacement); + $sMainCssContent = preg_replace(static::PATTERN, $sReplacement, $sMainCssContent); + $cssPath = static::$sTmpDir.'/branding/themes/basque-red/main.css'; file_put_contents($cssPath, $sMainCssContent); //should be after main.css modification to make sure precompilation check will be performed - if ($bFilesTouchedRecently) - { + if ($bFilesTouchedRecently) { touch($sFileToTest, time() + 2, time() + 2); } //same: it should be after main.css modification - if ($bFileMd5sumModified) - { + if ($bFileMd5sumModified) { file_put_contents($sFileToTest, "###\n".file_get_contents($sFileToTest)); touch($sFileToTest, time() + 2, time() + 2); } - if (is_file($sCssVarPath)) - { + if (is_file($sCssVarPath)) { $sAfterReplacementCssVariableMd5sum = md5_file($sCssVarPath); } @@ -352,10 +337,9 @@ JSON; ->willReturn("====CSSCOMPILEDCONTENT===="); $aThemeParameters = json_decode($ThemeParametersJson, true); - $this->assertEquals($iCompileCSSFromSASSCount!=0, ThemeHandler::CompileTheme('basque-red', $bSetup, "COMPILATIONTIMESTAMP", $aThemeParameters, [static::$sTmpDir.'/branding/themes/'], static::$sTmpDir)); + $this->assertEquals($iCompileCSSFromSASSCount != 0, ThemeHandler::CompileTheme('basque-red', $bSetup, "COMPILATIONTIMESTAMP", $aThemeParameters, [static::$sTmpDir.'/branding/themes/'], static::$sTmpDir)); - if ($iCompileCSSFromSASSCount==1) - { + if ($iCompileCSSFromSASSCount == 1) { $sExpectedMainCssFile = APPROOT.$sExpectedMainCssPath; if (!is_file($sExpectedMainCssFile)) { $this->assertTrue(false, "Cannot find expected main css file $sExpectedMainCssFile"); @@ -379,19 +363,18 @@ JSON; $sActualContent = file_get_contents($sActualCssFile); //replace absolute path to fix it in any envt - $sExpectedContent = preg_replace($aPatterns, $aReplacements, file_get_contents($sExpectedCssFile)); + $sExpectedContent = preg_replace($aPatterns, $aReplacements, file_get_contents($sExpectedCssFile)); //echo($sExpectedContent); - if ($sExpectedContent != $sActualContent) - { + if ($sExpectedContent != $sActualContent) { //try to have inner json diff failure /** @var array $aExpectedJson */ //replace absolute path to fix it in any envt - $sExpectedJson = preg_replace($aPatterns, $aReplacements, ThemeHandler::GetSignature($sExpectedCssFile)); + $sExpectedJson = preg_replace($aPatterns, $aReplacements, ThemeHandler::GetSignature($sExpectedCssFile)); $aExpectedJson = json_decode($sExpectedJson, true); /** @var array $aActualJson */ $aActualJson = json_decode(ThemeHandler::GetSignature($sActualCssFile), true); - echo (ThemeHandler::GetSignature($sActualCssFile)); + echo(ThemeHandler::GetSignature($sActualCssFile)); $this->assertEquals($aExpectedJson, $aActualJson, "CSS file dont match ($sExpectedCssFile / $sActualCssFile)"); } @@ -405,14 +388,16 @@ JSON; */ public function testGetAllUrlFromScss($sScssFile) { - $aIncludedUrls = ThemeHandler::GetAllUrlFromScss(['attr' => "123"],APPROOT.$sScssFile); + $aIncludedUrls = ThemeHandler::GetAllUrlFromScss(['attr' => "123"], APPROOT.$sScssFile); $this->assertEquals(['approot-relative', 'version', 'version1'], array_values($aIncludedUrls['aMissingVariables'])); - $this->assertEquals(["attr"=>"123"], - $aIncludedUrls['aFoundVariables']); + $this->assertEquals( + ["attr" => "123"], + $aIncludedUrls['aFoundVariables'] + ); $aExpectedCompletedUrls = [ 'css/ui-lightness/images/tutu.jpg', "css/ui-lightness/images/tata.jpeg", - "css/ui-lightness/images/tete.jpeg?g=123" + "css/ui-lightness/images/tete.jpeg?g=123", ]; $aExpectedToCompleteUrls = [ '\'abc/\'+ $approot-relative + "css/ui-lightness/images/toutou.png?v=" + $version', @@ -467,7 +452,8 @@ SCSS; $this->assertEquals(['gray-darker', 'brand-primary', 'brand-primary-lightest'], $aMissingVariables); } - public function testGetVariablesFromFile(){ + public function testGetVariablesFromFile() + { $sContent = <<< 'SCSS' $approot-relative: "../../../../../" !default; // relative to env-***/branding/themes/***/main.css $approot-relative2: "../../" !default; // relative to env-***/branding/themes/***/main.css @@ -482,7 +468,7 @@ $icons-filter: hue-rotate(0deg) !default; $toto : titi; SCSS; - file_put_contents(static::$sTmpDir . DIRECTORY_SEPARATOR . 'css-variable.scss', $sContent); + file_put_contents(static::$sTmpDir.DIRECTORY_SEPARATOR.'css-variable.scss', $sContent); $aVariables = ThemeHandler::GetVariablesFromFile( [ 'css-variable.scss' ], [ static::$sTmpDir ] @@ -504,7 +490,8 @@ SCSS; $this->assertEquals( $aExpectedVariables, - $aVariables); + $aVariables + ); } /** @@ -522,13 +509,13 @@ SCSS; public function ResolveUrlProvider() { return [ - 'XXX + $key1 UNresolved' => ["abc/'+ \$key1", ['key'=>'123'], false], - '$key1 + XXX UNresolved' => ["\$key1 + abs", ['key'=>'123'], false], - 'XXX + $key UNresolved' => ["abc/'+ \$unknownkey", ['key'=>'123'], false], - 'XXX + $key resolved' => ["abc/'+ \$key", ['key'=>'123'], "abc/123"], - 'XXX + $key1 resolved' => ["abc/'+ \$key1", ['key1'=>'123'], "abc/123"], - '$key + XXX resolved' => ["\$key + \"/abc", ['key'=>'123'], "123/abc"], - 'XXX + $key + YYY resolved' => ["abc/'+ \$key + '/def", ['key'=>'123'], "abc/123/def"], + 'XXX + $key1 UNresolved' => ["abc/'+ \$key1", ['key' => '123'], false], + '$key1 + XXX UNresolved' => ["\$key1 + abs", ['key' => '123'], false], + 'XXX + $key UNresolved' => ["abc/'+ \$unknownkey", ['key' => '123'], false], + 'XXX + $key resolved' => ["abc/'+ \$key", ['key' => '123'], "abc/123"], + 'XXX + $key1 resolved' => ["abc/'+ \$key1", ['key1' => '123'], "abc/123"], + '$key + XXX resolved' => ["\$key + \"/abc", ['key' => '123'], "123/abc"], + 'XXX + $key + YYY resolved' => ["abc/'+ \$key + '/def", ['key' => '123'], "abc/123/def"], ]; } @@ -536,8 +523,8 @@ SCSS; { static::InitCSSDirectory(); - $aStylesheetFile=glob(static::$sTmpDir."/branding/css/*.scss"); - $aStylesheetFile[]=static::$sTmpDir."/branding/css/ui-lightness/DO_NOT_CHANGE.jqueryui.scss"; + $aStylesheetFile = glob(static::$sTmpDir."/branding/css/*.scss"); + $aStylesheetFile[] = static::$sTmpDir."/branding/css/ui-lightness/DO_NOT_CHANGE.jqueryui.scss"; $expectJsonFilePath = APPROOT.'tests/php-unit-tests/unitary-tests/application/theme-handler/expected/themes/basque-red/theme-parameters.json'; $expectedThemeParamJson = file_get_contents($expectJsonFilePath); $aThemeParametersVariables = json_decode($expectedThemeParamJson, true); @@ -549,8 +536,7 @@ SCSS; $aExpectedUris = json_decode(file_get_contents(APPROOT.'tests/php-unit-tests/unitary-tests/application/theme-handler/getimages/expected-getimages.json'), true); $aExpectedImages = []; - foreach ($aExpectedUris as $sExpectedUri) - { + foreach ($aExpectedUris as $sExpectedUri) { $aExpectedImages[] = ThemeHandler::GetAppRootWithSlashes().$sExpectedUri; } @@ -561,7 +547,8 @@ SCSS; * @dataProvider FindStylesheetFileProvider * @throws \Exception */ - public function testFindStylesheetFile(string $sFileToFind, array $aAllImports){ + public function testFindStylesheetFile(string $sFileToFind, array $aAllImports) + { $sImportsPath = static::$sTmpDir.'branding/'; // Windows compat O:) @@ -575,7 +562,6 @@ SCSS; } } - $oFindStylesheetObject = new FindStylesheetObject(); ThemeHandler::FindStylesheetFile($sFileToFind, [$sImportsPath], $oFindStylesheetObject); @@ -607,15 +593,15 @@ SCSS; ], "scss with multi @imports" => [ "sFileToFind" => $sFileToFind3, - "aAllImports" => [$sFileToFind4, $sFileToFind5] + "aAllImports" => [$sFileToFind4, $sFileToFind5], ], "scss with simple @imports in another folder" => [ "sFileToFind" => "css/simple_import2.scss", - "aAllImports" => [$sFileToFind5] + "aAllImports" => [$sFileToFind5], ], "scss with @imports shortcut included_file3 => _included_file3.scss" => [ "sFileToFind" => "css/shortcut.scss", - "aAllImports" => ["css/_included_file3.scss", "css/included_scss/included_file4.scss"] + "aAllImports" => ["css/_included_file3.scss", "css/included_scss/included_file4.scss"], ], "scss with @imports shortcut same file and folder names => feature1/_feature1.scss" => [ "sFileToFind" => "css/shortcut2.scss", @@ -656,7 +642,7 @@ SCSS; return [ [ '/var/www/html/iTop/images/itop-logo-2.png', '/var/www/html/iTop/env-production/branding/themes/light-grey/../../../../images/itop-logo-2.png' ], [ '/var/www/html/iTop/env-production/branding/themes/light-grey/images/', '/var/www/html/iTop/env-production/branding/themes/light-grey/images/' ], - [ '/var/www/html/iTop/css/ui-lightness/images/ui-icons_222222_256x240.png', '/var/www/html/iTop/env-production//branding/themes/light-grey//../../../../css/ui-lightness/images/ui-icons_222222_256x240.png' ] + [ '/var/www/html/iTop/css/ui-lightness/images/ui-icons_222222_256x240.png', '/var/www/html/iTop/env-production//branding/themes/light-grey//../../../../css/ui-lightness/images/ui-icons_222222_256x240.png' ], ]; } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/application/UI/Base/Layout/NavigationMenuTest.php b/tests/php-unit-tests/unitary-tests/application/UI/Base/Layout/NavigationMenuTest.php index 678003f0f..fff05b3f4 100644 --- a/tests/php-unit-tests/unitary-tests/application/UI/Base/Layout/NavigationMenuTest.php +++ b/tests/php-unit-tests/unitary-tests/application/UI/Base/Layout/NavigationMenuTest.php @@ -13,8 +13,10 @@ use Combodo\iTop\Test\UnitTest\ItopDataTestCase; * * @package UI\Base\Layout */ -class NavigationMenuTest extends ItopDataTestCase { - public function IsAllowedProvider(){ +class NavigationMenuTest extends ItopDataTestCase +{ + public function IsAllowedProvider() + { return [ 'show menu' => [ true ], 'hide menu' => [ false ], @@ -25,17 +27,20 @@ class NavigationMenuTest extends ItopDataTestCase { * @dataProvider IsAllowedProvider * test used to make sure backward compatibility is ensured */ - public function testIsAllowed($bExpectedIsAllowed=true){ + public function testIsAllowed($bExpectedIsAllowed = true) + { \MetaModel::GetConfig()->Set('navigation_menu.show_organization_filter', $bExpectedIsAllowed); $oNavigationMenu = new NavigationMenu( $this->createMock(ApplicationContext::class), - $this->createMock(PopoverMenu::class)); + $this->createMock(PopoverMenu::class) + ); $isAllowed = $oNavigationMenu->IsSiloSelectionEnabled(); $this->assertEquals($bExpectedIsAllowed, $isAllowed); } - public function testIsAllowed_BackwardCompatibility_NoVariableInConfFile(){ + public function testIsAllowed_BackwardCompatibility_NoVariableInConfFile() + { \MetaModel::GetConfig()->Set('navigation_menu.show_organization_filter', false); $sTmpFilePath = tempnam(sys_get_temp_dir(), 'test_'); @@ -45,7 +50,7 @@ class NavigationMenuTest extends ItopDataTestCase { //remove variable for the test $aLines = file($sTmpFilePath); - $aRows = array(); + $aRows = []; foreach ($aLines as $key => $sLine) { if (!preg_match('/navigation_menu.show_organization_filter/', $sLine)) { diff --git a/tests/php-unit-tests/unitary-tests/application/WelcomePopup/WelcomePopupTest.php b/tests/php-unit-tests/unitary-tests/application/WelcomePopup/WelcomePopupTest.php index d3314fe08..ce7179414 100644 --- a/tests/php-unit-tests/unitary-tests/application/WelcomePopup/WelcomePopupTest.php +++ b/tests/php-unit-tests/unitary-tests/application/WelcomePopup/WelcomePopupTest.php @@ -21,12 +21,12 @@ class WelcomePopupTest extends ItopDataTestCase $bResult = usort($aProvidersMessagesData, [WelcomePopupService::class, 'SortOnImportance']); $this->assertTrue($bResult); - $aMessageIdsSorted = array_map(function($aItem) { + $aMessageIdsSorted = array_map(function ($aItem) { return $aItem['message']->GetId(); }, $aProvidersMessagesData); $this->assertEquals($aExpected, $aMessageIdsSorted); } - + /** * Data provider for testSortOnImportance * @return array[][]|string[][][][]|number[][][][] @@ -76,10 +76,10 @@ class WelcomePopupTest extends ItopDataTestCase { $oService = WelcomePopupService::GetInstance(); $this->InvokeNonPublicMethod(WelcomePopupService::class, 'SetAcknowledgedMessagesCache', $oService, [$aCache]); - + $this->assertEquals($bExpected, $this->InvokeNonPublicMethod(WelcomePopupService::class, 'IsMessageAcknowledged', $oService, [$sMessageId])); } - + public function isMessageAcknowledgedDataProvider() { return [ @@ -94,7 +94,7 @@ class WelcomePopupTest extends ItopDataTestCase ], ]; } - + public function testProcessMessages() { // Mock a WelcomePopup message provider, with a fixed class name @@ -103,7 +103,7 @@ class WelcomePopupTest extends ItopDataTestCase new Message('123', 'foo', '

    Hello Foo

    ', null, [], 0), new Message('456', 'bar', '

    Hello Bar

    ', null, [], 1), // Already acknowledged will be skipped ]); - + // Mock another WelcomePopup message provider, with a different class name $oProvider2 = $this->getMockBuilder(iWelcomePopupExtension::class)->setMockClassName('Provider2')->getMock(); $oProvider2->expects($this->once())->method('GetMessages')->willReturn([ @@ -113,7 +113,7 @@ class WelcomePopupTest extends ItopDataTestCase $oService = WelcomePopupService::GetInstance(); $this->InvokeNonPublicMethod(WelcomePopupService::class, 'SetAcknowledgedMessagesCache', $oService, [[get_class($oProvider1).'::456']]); $this->InvokeNonPublicMethod(WelcomePopupService::class, 'SetMessagesProviders', $oService, [[$oProvider1, $oProvider2]]); - + $aProvidersMessagesData = $this->InvokeNonPublicMethod(WelcomePopupService::class, 'ProcessMessages', $oService, []); $this->assertEquals( [ @@ -141,11 +141,11 @@ class WelcomePopupTest extends ItopDataTestCase { self::CreateUser('admin-testAcknowledgeMessage', 1, '-Passw0rd!Complex-'); UserRights::Login('admin-testAcknowledgeMessage'); - + // Mock a WelcomePopup message provider, with a fixed class name $oProvider1 = $this->getMockBuilder(iWelcomePopupExtension::class)->setMockClassName('Provider1')->getMock(); $oProvider1->expects($this->exactly(2))->method('AcknowledgeMessage'); - + // Mock another WelcomePopup message provider, with a different class name $oProvider2 = $this->getMockBuilder(iWelcomePopupExtension::class)->setMockClassName('Provider2')->getMock(); $oProvider2->expects($this->exactly(1))->method('AcknowledgeMessage'); @@ -154,24 +154,24 @@ class WelcomePopupTest extends ItopDataTestCase $sMessageUUID2 = get_class($oProvider1).'::456789'; $sMessageUUID3 = get_class($oProvider2).'::456789'; // Same message id but different provider / UUID $oService = WelcomePopupService::GetInstance(); - + $this->InvokeNonPublicMethod(WelcomePopupService::class, 'SetMessagesProviders', $oService, [[$oProvider1, $oProvider2]]); - + $oService->AcknowledgeMessage($sMessageUUID1); $this->assertTrue($this->InvokeNonPublicMethod(WelcomePopupService::class, 'IsMessageAcknowledged', $oService, [$sMessageUUID1])); $this->assertFalse($this->InvokeNonPublicMethod(WelcomePopupService::class, 'IsMessageAcknowledged', $oService, ['-This-Message-Id-Is-Not-Ack0ledg3dged!'])); $this->assertFalse($this->InvokeNonPublicMethod(WelcomePopupService::class, 'IsMessageAcknowledged', $oService, [$sMessageUUID3])); - + $oService->AcknowledgeMessage($sMessageUUID2); $this->assertTrue($this->InvokeNonPublicMethod(WelcomePopupService::class, 'IsMessageAcknowledged', $oService, [$sMessageUUID1])); $this->assertTrue($this->InvokeNonPublicMethod(WelcomePopupService::class, 'IsMessageAcknowledged', $oService, [$sMessageUUID2])); $this->assertFalse($this->InvokeNonPublicMethod(WelcomePopupService::class, 'IsMessageAcknowledged', $oService, ['-This-Message-Id-Is-Not-Ack0ledg3dged!'])); $this->assertFalse($this->InvokeNonPublicMethod(WelcomePopupService::class, 'IsMessageAcknowledged', $oService, [$sMessageUUID3])); - + $oService->AcknowledgeMessage($sMessageUUID3); $this->assertTrue($this->InvokeNonPublicMethod(WelcomePopupService::class, 'IsMessageAcknowledged', $oService, [$sMessageUUID3])); } - + /** * @dataProvider makeStringFitInProvider */ @@ -182,7 +182,7 @@ class WelcomePopupTest extends ItopDataTestCase $this->assertTrue(mb_strlen($sFitted) <= $iLimit); $this->assertEquals($sExpected, $sFitted); } - + public function makeStringFitInProvider() { return [ @@ -193,4 +193,3 @@ class WelcomePopupTest extends ItopDataTestCase } } - diff --git a/tests/php-unit-tests/unitary-tests/application/applicationContext/ApplicationContextTest.php b/tests/php-unit-tests/unitary-tests/application/applicationContext/ApplicationContextTest.php index 1eef80d2b..61b84451d 100644 --- a/tests/php-unit-tests/unitary-tests/application/applicationContext/ApplicationContextTest.php +++ b/tests/php-unit-tests/unitary-tests/application/applicationContext/ApplicationContextTest.php @@ -23,4 +23,4 @@ class ApplicationContextTest extends \Combodo\iTop\Test\UnitTest\ItopTestCase $this->assertEquals($sExpected, $sActual, 'Query parameters string should not start with & when $bIncludeAmpersand is false'); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/application/applicationContext/MockApplicationContext.php b/tests/php-unit-tests/unitary-tests/application/applicationContext/MockApplicationContext.php index a786daa35..e33cb8bd2 100644 --- a/tests/php-unit-tests/unitary-tests/application/applicationContext/MockApplicationContext.php +++ b/tests/php-unit-tests/unitary-tests/application/applicationContext/MockApplicationContext.php @@ -4,11 +4,10 @@ namespace applicationContext; class MockApplicationContext extends \ApplicationContext { - public function __construct(array $applicationContextConfig) { parent::__construct(); $this->aValues = $applicationContextConfig; } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/application/applicationextension/ApplicationExtensionTest.php b/tests/php-unit-tests/unitary-tests/application/applicationextension/ApplicationExtensionTest.php index 30d2341f1..b65e192d0 100644 --- a/tests/php-unit-tests/unitary-tests/application/applicationextension/ApplicationExtensionTest.php +++ b/tests/php-unit-tests/unitary-tests/application/applicationextension/ApplicationExtensionTest.php @@ -1,4 +1,5 @@ DBUpdate(); } } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/application/iApplicationObjectExtension/MockApplicationObjectExtensionForTest2.php b/tests/php-unit-tests/unitary-tests/application/iApplicationObjectExtension/MockApplicationObjectExtensionForTest2.php index 4168c6798..c569fc824 100644 --- a/tests/php-unit-tests/unitary-tests/application/iApplicationObjectExtension/MockApplicationObjectExtensionForTest2.php +++ b/tests/php-unit-tests/unitary-tests/application/iApplicationObjectExtension/MockApplicationObjectExtensionForTest2.php @@ -1,4 +1,5 @@ DBUpdate(); } } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/application/privUITransactionFileTest.php b/tests/php-unit-tests/unitary-tests/application/privUITransactionFileTest.php index 90d63fde7..e46acde8c 100644 --- a/tests/php-unit-tests/unitary-tests/application/privUITransactionFileTest.php +++ b/tests/php-unit-tests/unitary-tests/application/privUITransactionFileTest.php @@ -1,4 +1,5 @@ Set('transactions_gc_threshold', 100); - $iBaseLimit = time() - 24*3600; //24h + $iBaseLimit = time() - 24 * 3600; //24h $sBaseDir = sys_get_temp_dir(); $sDir = "$sBaseDir/privUITransactionFileTest/cleanupOldTransactions"; @@ -53,10 +54,10 @@ class privUITransactionFileTest extends ItopDataTestCase mkdir("$sDir", 0777, true); for ($i = 0; $i < $iCleanableCreated; $i++) { - touch("$sDir/{$sCleanablePrefix}$i", $iBaseLimit - 10*60); + touch("$sDir/{$sCleanablePrefix}$i", $iBaseLimit - 10 * 60); } for ($i = 0; $i < $iPreservableCreated; $i++) { - touch("$sDir/{$sPreservablePrefix}$i", $iBaseLimit + 10*60); + touch("$sDir/{$sPreservablePrefix}$i", $iBaseLimit + 10 * 60); } $iCleanableCount = count(glob("$sDir/{$sCleanablePrefix}*")); @@ -123,7 +124,8 @@ class privUITransactionFileTest extends ItopDataTestCase ]; } - public function rm($sDir) { + public function rm($sDir) + { $aFiles = array_diff(scandir($sDir), ['.','..']); foreach ($aFiles as $sFile) { if ((is_dir("$sDir/$sFile"))) { @@ -135,7 +137,7 @@ class privUITransactionFileTest extends ItopDataTestCase return rmdir($sDir); } - const USER_TEST_LOGIN = 'support_test_privUITransaction'; + public const USER_TEST_LOGIN = 'support_test_privUITransaction'; /** * @throws \SecurityException diff --git a/tests/php-unit-tests/unitary-tests/application/query/QueryTest.php b/tests/php-unit-tests/unitary-tests/application/query/QueryTest.php index 7751ab798..97114d5b4 100644 --- a/tests/php-unit-tests/unitary-tests/application/query/QueryTest.php +++ b/tests/php-unit-tests/unitary-tests/application/query/QueryTest.php @@ -1,4 +1,5 @@ 'Administrator'), true); + $oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => 'Administrator'], true); $this->oUser = $this->CreateUser(self::USER, $oAdminProfile->GetKey(), self::PASSWORD); } @@ -72,14 +73,14 @@ class QueryTest extends ItopDataTestCase * @param string $sOql query oql phrase * @param string|null $sFields fields to export */ - private function CreateQueryOQL(string $sName, string $sDescription, string $sOql, string $sFields = null) : QueryOQL + private function CreateQueryOQL(string $sName, string $sDescription, string $sOql, string $sFields = null): QueryOQL { $oQuery = new QueryOQL(); $oQuery->Set('name', $sName); $oQuery->Set('description', $sDescription); $oQuery->Set('oql', $sOql); - if($sFields != null){ + if ($sFields != null) { $oQuery->Set('fields', $sFields); } @@ -154,10 +155,10 @@ class QueryTest extends ItopDataTestCase */ public function getQueryProvider() { - return array( - 'Export #1' => array('query without params', 'SELECT Person'), - 'Export #2' => array('query with params', "SELECT Person WHERE first_name LIKE 'B%'") - ); + return [ + 'Export #1' => ['query without params', 'SELECT Person'], + 'Export #2' => ['query with params', "SELECT Person WHERE first_name LIKE 'B%'"], + ]; } /** @@ -177,7 +178,7 @@ class QueryTest extends ItopDataTestCase // curl options curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); - curl_setopt($curl, CURLOPT_USERPWD, self::USER . ':' . self::PASSWORD); + curl_setopt($curl, CURLOPT_USERPWD, self::USER.':'.self::PASSWORD); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Force disable of certificate check as most of dev / test env have a self-signed certificate diff --git a/tests/php-unit-tests/unitary-tests/application/twigbase/ControllerTest.php b/tests/php-unit-tests/unitary-tests/application/twigbase/ControllerTest.php index 9a6c82804..2db58d420 100644 --- a/tests/php-unit-tests/unitary-tests/application/twigbase/ControllerTest.php +++ b/tests/php-unit-tests/unitary-tests/application/twigbase/ControllerTest.php @@ -1,10 +1,12 @@ RequireOnceUnitTestFile('FakeController.php'); } - public function CheckAccessProvider() { + public function CheckAccessProvider() + { return [ 'simple token access OK' => [ 'access_token' => 'toto123', @@ -42,7 +45,8 @@ class ControllerTest extends ItopDataTestCase { * Fix N°7147 * @dataProvider CheckAccessProvider */ - public function testCheckAccess($sConfiguredAccessToken, $sHttpAccessToken, $bSuccess, $bPost=false){ + public function testCheckAccess($sConfiguredAccessToken, $sHttpAccessToken, $bSuccess, $bPost = false) + { $sModuleName = "MyModule"; $sTokenParamName = "access_token_conf_param"; @@ -51,7 +55,7 @@ class ControllerTest extends ItopDataTestCase { $_REQUEST = []; $_REQUEST['exec_module'] = $sModuleName; - if ($bPost){ + if ($bPost) { $_POST[$sTokenParamName] = $sHttpAccessToken; } else { $_REQUEST[$sTokenParamName] = $sHttpAccessToken; @@ -62,13 +66,13 @@ class ControllerTest extends ItopDataTestCase { MetaModel::GetConfig()->SetModuleSetting($sModuleName, $sTokenParamName, $sConfiguredAccessToken); - if (! $bSuccess){ + if (! $bSuccess) { $this->expectExceptionMessage("Invalid token"); } $this->InvokeNonPublicMethod(FakeController::class, "CheckAccess", $oController); - if ($bSuccess){ + if ($bSuccess) { $this->assertTrue(true, "no issue encountered"); } } diff --git a/tests/php-unit-tests/unitary-tests/application/twigbase/FakeController.php b/tests/php-unit-tests/unitary-tests/application/twigbase/FakeController.php index 262e0d8dd..0c7bbc92a 100644 --- a/tests/php-unit-tests/unitary-tests/application/twigbase/FakeController.php +++ b/tests/php-unit-tests/unitary-tests/application/twigbase/FakeController.php @@ -1,5 +1,7 @@ assertFalse(utils::EndsWith('a', 'bbbb')); @@ -87,8 +87,7 @@ class utilsTest extends ItopTestCase $sSep = DIRECTORY_SEPARATOR; $sItopRootRealPath = realpath($sAppRoot).$sSep; $sLicenseFileName = 'license.txt'; - if (!is_file($sAppRoot.$sLicenseFileName)) - { + if (!is_file($sAppRoot.$sLicenseFileName)) { $sLicenseFileName = 'LICENSE'; } @@ -96,7 +95,7 @@ class utilsTest extends ItopTestCase $sLicenseFileName => [$sAppRoot.$sLicenseFileName, $sAppRoot, $sItopRootRealPath.$sLicenseFileName], 'unexisting file' => [$sAppRoot.'license_DOES_NOT_EXIST.txt', $sAppRoot, false], '/'.$sLicenseFileName => [$sAppRoot.$sSep.$sLicenseFileName, $sAppRoot, $sItopRootRealPath.$sLicenseFileName], - '%2f'.$sLicenseFileName => [$sAppRoot.'%2f'. $sLicenseFileName, $sAppRoot, false], + '%2f'.$sLicenseFileName => [$sAppRoot.'%2f'.$sLicenseFileName, $sAppRoot, false], '../'.$sLicenseFileName => [$sAppRoot.'..'.$sSep.$sLicenseFileName, $sAppRoot, false], '%2e%2e%2f'.$sLicenseFileName => [$sAppRoot.'%2e%2e%2f'.$sLicenseFileName, $sAppRoot, false], 'application/utils.inc.php with basepath=APPROOT' => [ @@ -132,32 +131,32 @@ class utilsTest extends ItopTestCase public function LocalPathProvider() { $sAppRoot = static::GetAppRoot(); - return array( - 'index.php' => array( + return [ + 'index.php' => [ 'sAbsolutePath' => $sAppRoot.'index.php', 'expected' => 'index.php', - ), - 'non existing' => array( + ], + 'non existing' => [ 'sAbsolutePath' => $sAppRoot.'nonexisting/nonexisting', 'expected' => false, - ), - 'outside' => array( + ], + 'outside' => [ 'sAbsolutePath' => '/tmp', 'expected' => false, - ), - 'application/cmdbabstract.class.inc.php' => array( + ], + 'application/cmdbabstract.class.inc.php' => [ 'sAbsolutePath' => $sAppRoot.'application/cmdbabstract.class.inc.php', 'expected' => 'application/cmdbabstract.class.inc.php', - ), - 'dir' => array( + ], + 'dir' => [ 'sAbsolutePath' => $sAppRoot.'application/.', 'expected' => 'application', - ), - 'root' => array( + ], + 'root' => [ 'sAbsolutePath' => $sAppRoot.'.', 'expected' => '', - ), - ); + ], + ]; } /** @@ -171,14 +170,15 @@ class utilsTest extends ItopTestCase public function appRootUrlProvider() { - return array( - 'Setup index (windows antislash)' => array('http://localhost/', 'C:\Dev\wamp64\www\itop-dev\setup\index.php', 'C:\Dev\wamp64\www\itop-dev', 'http://localhost/setup/'), - 'Setup index (windows slash)' => array('http://127.0.0.1/', 'C:/web/setup/index.php', 'C:/web', 'http://127.0.0.1/setup/'), - 'Setup index (windows slash, drive letter case difference)' => array('http://127.0.0.1/', 'c:/web/setup/index.php', 'C:/web', 'http://127.0.0.1/setup/'), - ); + return [ + 'Setup index (windows antislash)' => ['http://localhost/', 'C:\Dev\wamp64\www\itop-dev\setup\index.php', 'C:\Dev\wamp64\www\itop-dev', 'http://localhost/setup/'], + 'Setup index (windows slash)' => ['http://127.0.0.1/', 'C:/web/setup/index.php', 'C:/web', 'http://127.0.0.1/setup/'], + 'Setup index (windows slash, drive letter case difference)' => ['http://127.0.0.1/', 'c:/web/setup/index.php', 'C:/web', 'http://127.0.0.1/setup/'], + ]; } - public function GetAbsoluteUrlAppRootPersistency() { + public function GetAbsoluteUrlAppRootPersistency() + { $this->setUp(); return [ @@ -260,7 +260,7 @@ class utilsTest extends ItopTestCase /** * @dataProvider GetAbsoluteUrlAppRootPersistency */ - public function testGetAbsoluteUrlAppRootPersistency($bBehindReverseProxy,$bForceTrustProxy1 ,$sExpectedAppRootUrl1,$bForceTrustProxy2 , $sExpectedAppRootUrl2,$bForceTrustProxy3 , $sExpectedAppRootUrl3) + public function testGetAbsoluteUrlAppRootPersistency($bBehindReverseProxy, $bForceTrustProxy1, $sExpectedAppRootUrl1, $bForceTrustProxy2, $sExpectedAppRootUrl2, $bForceTrustProxy3, $sExpectedAppRootUrl3) { // resetting static property for each test pass $this->SetNonPublicStaticProperty(utils::class, 'sAbsoluteUrlAppRootCache', null); @@ -291,7 +291,6 @@ class utilsTest extends ItopTestCase $this->assertEquals($sExpectedAppRootUrl3, utils::GetAbsoluteUrlAppRoot($bForceTrustProxy3)); } - /** * @dataProvider GetDefaultUrlAppRootProvider */ @@ -923,78 +922,78 @@ HTML, 'Basic positional with enough args' => [ 'Format: %1$s, %2$d, %3$s', ['Hello', 42, 'World'], - 'Format: Hello, 42, World' + 'Format: Hello, 42, World', ], 'Basic positional with args in different order' => [ 'Format: %2$s, %1$d, %3$s', [42, 'Hello', 'World'], - 'Format: Hello, 42, World' + 'Format: Hello, 42, World', ], 'Positional with reused specifiers' => [ 'Format: %1$s, %2$d, %1$s again', ['Hello', 42], - 'Format: Hello, 42, Hello again' + 'Format: Hello, 42, Hello again', ], // Missing arguments tests 'Missing one positional arg' => [ 'Format: %1$s, %2$d, %3$s', ['Hello', 42], - 'Format: Hello, 42, %3$s' + 'Format: Hello, 42, %3$s', ], 'Missing multiple positional args' => [ 'Format: %1$s, %2$s, %3$s, %4$s', ['Hello'], - 'Format: Hello, %2$s, %3$s, %4$s' + 'Format: Hello, %2$s, %3$s, %4$s', ], 'Missing first positional arg' => [ 'Format: %1$s, %2$s, %3$s', [], - 'Format: %1$s, %2$s, %3$s' + 'Format: %1$s, %2$s, %3$s', ], - + // Edge cases 'Positional with larger numbers' => [ 'Format: %2$s, %1$d, %3$s, %2$s again', [123456, 'Hello', 'World'], - 'Format: Hello, 123456, World, Hello again' + 'Format: Hello, 123456, World, Hello again', ], 'Positional specifiers with non-sequential indexes' => [ 'Format: %3$s then %1$s and %5$d', ['first', 'second', 'third', 'fourth', 42], - 'Format: third then first and 42' + 'Format: third then first and 42', ], // More complex format specifiers 'Positional with format modifiers' => [ 'Format: %1$\'*10s, %2$04d', ['Hello', 42], - 'Format: *****Hello, 0042' + 'Format: *****Hello, 0042', ], 'Positional with various types' => [ 'Format: String: %1$s, Integer: %2$d, Char: %3$c', ['Hello', 42, 65], - 'Format: String: Hello, Integer: 42, Char: A' + 'Format: String: Hello, Integer: 42, Char: A', ], // Testing with non-Latin characters 'Positional with UTF-8 characters' => [ 'Format: %1$s %2$s %3$s', ['こんにちは', 'Здравствуйте', '你好'], - 'Format: こんにちは Здравствуйте 你好' + 'Format: こんにちは Здравствуйте 你好', ], // Mixed formats 'Mixed positional with complex specifiers' => [ 'Format: %1$-10s | %2$+d', ['Hello', 42], - 'Format: Hello | +42' + 'Format: Hello | +42', ], 'Reused positional indexes with some missing' => [ 'Format: %1$s %2$d %1$s %3$s %2$d', ['Hello', 42], - 'Format: Hello 42 Hello %3$s 42' - ] + 'Format: Hello 42 Hello %3$s 42', + ], ]; } } diff --git a/tests/php-unit-tests/unitary-tests/core/ActionEmailTest.php b/tests/php-unit-tests/unitary-tests/core/ActionEmailTest.php index 4efed17d2..d21472c0a 100644 --- a/tests/php-unit-tests/unitary-tests/core/ActionEmailTest.php +++ b/tests/php-unit-tests/unitary-tests/core/ActionEmailTest.php @@ -17,18 +17,18 @@ class ActionEmailTest extends ItopDataTestCase /** * @inheritDoc */ - const CREATE_TEST_ORG = true; + public const CREATE_TEST_ORG = true; /** @var \ActionEmail|null Temp ActionEmail created for tests */ protected static $oActionEmail = null; - + /** @var \ormDocument|null Temp ormDocument for tests */ protected static $oDocument = null; /** @var \UserRequest|null Temp ormDocument for tests */ protected static $oUserRequest = null; - - /** @var string[] Dict formatted message, because the Dict class is not available in providers */ + + /** @var string[] Dict formatted message, because the Dict class is not available in providers */ protected static $aWarningMessages; protected function setUp(): void @@ -57,11 +57,11 @@ HTML static::$oDocument = new \ormDocument($sHtml, 'text/html', 'sample.html'); static::$oUserRequest = MetaModel::NewObject('UserRequest', [ 'title' => 'Test UserRequest', - 'description' => '

    Multi-line
    description

    ' + 'description' => '

    Multi-line
    description

    ', ]); static::$aWarningMessages = [ - 'warning-missing-content' => Dict::Format('ActionEmail:content_placeholder_missing', '$content$', Dict::S('Class:ActionEmail/Attribute:body')) + 'warning-missing-content' => Dict::Format('ActionEmail:content_placeholder_missing', '$content$', Dict::S('Class:ActionEmail/Attribute:body')), ]; } @@ -129,7 +129,7 @@ HTML 'subject' => 'Test subject', 'body' => 'Test body', ]); - foreach($aActionFields as $sCode => $value) { + foreach ($aActionFields as $sCode => $value) { if ($sCode === 'html_template') { // special case since the data provider cannot create ormDocument objects $oActionEmail->Set($sCode, static::$oDocument); @@ -139,9 +139,9 @@ HTML } $oActionEmail->DBInsert(); - + $oOrg = $this->CreateOrganization('testPrepareMessageContent'); - + $oContact1 = MetaModel::NewObject('Person', [ 'name' => 'Person 1', 'first_name' => 'PrepareMessageContent', @@ -150,8 +150,7 @@ HTML 'notify' => 'yes', ]); $oContact1->DBInsert(); - - + $oContact2 = MetaModel::NewObject('Person', [ 'name' => 'Person 2', 'first_name' => 'PrepareMessageContent', @@ -160,19 +159,19 @@ HTML 'notify' => 'no', ]); $oContact2->DBInsert(); - + $oLog = null; - + $aEmailContent = $this->InvokeNonPublicMethod('\ActionEmail', 'PrepareMessageContent', $oActionEmail, [$aContext, &$oLog]); // Normalize the content of the body to simplify the comparison, useful when status == test $aEmailContent['body'] = preg_replace('/title="[^"]+"/', 'title="****"', $aEmailContent['body']); $aEmailContent['body'] = preg_replace('/class="object-ref-link" href="[^"]+"/', 'class="object-ref-link" href="****"', $aEmailContent['body']); $aEmailContent['body'] = preg_replace('/References: <[^>]+>/', 'References: ****', $aEmailContent['body']); - foreach($aFieldsToCheck as $sCode => $expectedValue) { + foreach ($aFieldsToCheck as $sCode => $expectedValue) { $this->assertEquals($expectedValue, $aEmailContent[$sCode]); } } - + public function prepareMessageContentProvider() { return [ @@ -226,7 +225,7 @@ HTML 'simple-body-with-placeholder-TEST-mode' => [ 'EN US', ['body' => '

    Ticket "$this->title$" created.

    ', 'status' => 'test'], - ['body' => + ['body' => <<

    Ticket "Test UserRequest" created.

    @@ -259,7 +258,7 @@ HTML 'simple-body-with-placeholder_and_template' => [ 'EN US', ['body' => '

    Ticket "$this->title$" created.

    ', 'html_template' => true], - ['body' => + ['body' => << @@ -298,9 +297,9 @@ HTML $this->assertEquals($aWarnings, $expectedWarnings); } else { // The warning messages are localized, but the provider functions does not - // have access to the Dict class, so let's replace the value given by the + // have access to the Dict class, so let's replace the value given by the // provider by a statically precomputed and localized message - foreach($expectedWarnings as $index => $sMessageKey) { + foreach ($expectedWarnings as $index => $sMessageKey) { $expectedWarnings[$index] = static::$aWarningMessages[$sMessageKey]; } $this->assertEquals($aWarnings, $expectedWarnings); @@ -313,14 +312,14 @@ HTML 'no warnings' => [ '

    Some text here

    ', '
    $content$
    ', - null - ], + null, + ], '$content$ missing' => [ '

    Some text here

    ', '
    no placeholder
    ', - [ 'warning-missing-content' ] + [ 'warning-missing-content' ], ], - ]; + ]; } /** @@ -330,9 +329,9 @@ HTML { $oConfig = utils::GetConfig(); $sCurrentEmailAsync = $oConfig->Get('email_asynchronous'); - + $oConfig->Set('email_asynchronous', $sConfigAsyncValue); - + $oActionEmail = MetaModel::NewObject('ActionEmail', [ 'name' => 'Test action', 'status' => 'disabled', @@ -341,46 +340,45 @@ HTML 'body' => 'Test body', 'asynchronous' => $sActionAsyncValue, ]); - + self::assertEquals($sExpectedValue, $oActionEmail->IsAsynchronous()); $oConfig->Set('email_asynchronous', $sCurrentEmailAsync); } - public function asynchronousValuesContentProvider() { return [ 'ActionEmail is asynchronous' => [ 'yes', false, - true + true, ], 'ActionEmail is not asynchronous' => [ 'no', true, - false + false, ], 'ActionEmail is asynchronous and config is asynchronous' => [ 'yes', true, - true + true, ], 'ActionEmail is not asynchronous and config is not asynchronous' => [ 'no', false, - false + false, ], 'ActionEmail follows global settings, config is not asynchronous' => [ 'use_global_setting', false, - false + false, ], 'ActionEmail follows global settings, config is asynchronous' => [ 'use_global_setting', true, - true + true, ], ]; } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php b/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php index 047f39462..739cf3b65 100644 --- a/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php +++ b/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php @@ -9,23 +9,28 @@ use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use MetaModel; use UserRequest; -class AttributeDefinitionTest extends ItopDataTestCase { - const CREATE_TEST_ORG = true; +class AttributeDefinitionTest extends ItopDataTestCase +{ + public const CREATE_TEST_ORG = true; - protected function setUp(): void { + protected function setUp(): void + { parent::setUp(); require_once(APPROOT.'core/attributedef.class.inc.php'); } - public function testGetImportColumns(){ + public function testGetImportColumns() + { $oAttributeDefinition = MetaModel::GetAttributeDef("ApplicationSolution", "status"); $aImportColumns = $oAttributeDefinition->GetImportColumns(); var_dump($aImportColumns); $this->assertTrue(is_array($aImportColumns), var_export($aImportColumns, true)); - $this->assertEquals(["status" => "ENUM('active','inactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"], - $aImportColumns); + $this->assertEquals( + ["status" => "ENUM('active','inactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"], + $aImportColumns + ); } /** @@ -279,7 +284,6 @@ PHP self::assertNull($defaultValue, 'Invalid default value for Date attribute should give null default value'); } - public function testDateInvalidDefaultReturnsNullAsDefaultValue_Case2() { $oDateAttribute = $this->GivenAttribute(\WorkOrder::class, 'start_date', AttributeDate::class, '"27/01/2025"', false); @@ -337,10 +341,10 @@ PHP 'default_value' => $defaultValue, 'allowed_values' => null, 'depends_on' => [], - 'always_load_in_tables' => false + 'always_load_in_tables' => false, ]); $oAttribute->SetHostClass($sHostClass); return $oAttribute; } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/AttributeImageTest.php b/tests/php-unit-tests/unitary-tests/core/AttributeImageTest.php index 6a6aa5b16..ebb37e336 100644 --- a/tests/php-unit-tests/unitary-tests/core/AttributeImageTest.php +++ b/tests/php-unit-tests/unitary-tests/core/AttributeImageTest.php @@ -36,7 +36,8 @@ class AttributeImageTest extends ItopDataTestCase /** * Note that we need to reset manually the cache in \utils::GetAbsoluteUrlAppRoot, which is called from \AttributeImage::Get */ - private function SetNewAppRootUrl(Config $oConfig, string $sAppRootUrl):void { + private function SetNewAppRootUrl(Config $oConfig, string $sAppRootUrl): void + { $oConfig->Set('app_root_url', $sAppRootUrl); $this->SetNonPublicStaticProperty(utils::class, 'sAbsoluteUrlAppRootCache', null); } diff --git a/tests/php-unit-tests/unitary-tests/core/AttributeURLDefaultPattern.php b/tests/php-unit-tests/unitary-tests/core/AttributeURLDefaultPattern.php index 9230bbd4b..5d99448e3 100644 --- a/tests/php-unit-tests/unitary-tests/core/AttributeURLDefaultPattern.php +++ b/tests/php-unit-tests/unitary-tests/core/AttributeURLDefaultPattern.php @@ -4,7 +4,8 @@ * @since 3.0.0 N°4515 * @used-by \Combodo\iTop\Test\UnitTest\Core\AttributeURLTest */ -class AttributeURLDefaultPattern extends AttributeURL { +class AttributeURLDefaultPattern extends AttributeURL +{ public function GetValidationPattern() { /** @noinspection OneTimeUseVariablesInspection */ diff --git a/tests/php-unit-tests/unitary-tests/core/AttributeURLTest.php b/tests/php-unit-tests/unitary-tests/core/AttributeURLTest.php index a2b7aed8f..e44dd7df6 100644 --- a/tests/php-unit-tests/unitary-tests/core/AttributeURLTest.php +++ b/tests/php-unit-tests/unitary-tests/core/AttributeURLTest.php @@ -5,7 +5,8 @@ namespace Combodo\iTop\Test\UnitTest\Core; use AttributeURLDefaultPattern; use Combodo\iTop\Test\UnitTest\ItopTestCase; -class AttributeURLTest extends ItopTestCase { +class AttributeURLTest extends ItopTestCase +{ public function setUp(): void { parent::setUp(); @@ -19,7 +20,7 @@ class AttributeURLTest extends ItopTestCase { */ public function testCheckFormat(string $sUrlValue, int $iExpectedResult): void { - $oAttDefUrl = new AttributeURLDefaultPattern('myCode', ["target"=>'_blank', "allowed_values"=>null, "sql"=>'url', "default_value"=>'', "is_null_allowed"=>true, "depends_on"=>array(), "always_load_in_tables"=>false]); + $oAttDefUrl = new AttributeURLDefaultPattern('myCode', ["target" => '_blank', "allowed_values" => null, "sql" => 'url', "default_value" => '', "is_null_allowed" => true, "depends_on" => [], "always_load_in_tables" => false]); $bResult = $oAttDefUrl->CheckFormat($sUrlValue); $this->assertSame($iExpectedResult, $bResult); diff --git a/tests/php-unit-tests/unitary-tests/core/BulkChangeTest.php b/tests/php-unit-tests/unitary-tests/core/BulkChangeTest.php index 7d401b63d..eaf6f97cf 100644 --- a/tests/php-unit-tests/unitary-tests/core/BulkChangeTest.php +++ b/tests/php-unit-tests/unitary-tests/core/BulkChangeTest.php @@ -8,7 +8,7 @@ use MetaModel; class BulkChangeTest extends ItopDataTestCase { - const CREATE_TEST_ORG = true; + public const CREATE_TEST_ORG = true; protected function setUp(): void { @@ -18,17 +18,18 @@ class BulkChangeTest extends ItopDataTestCase } //bug 2888: csv import / data synchro issue with password validation - public function testPasswordBulkChangeIssue() { + public function testPasswordBulkChangeIssue() + { /** @var Person $oPerson */ - $oPerson = $this->createObject('Person', array( + $oPerson = $this->createObject('Person', [ 'first_name' => 'isaac', 'name' => 'asimov', 'email' => 'isaac.asimov@fundation.org', 'org_id' => $this->getTestOrgId(), - )); + ]); - $aData = array( - array( + $aData = [ + [ $oPerson->Get("first_name"), $oPerson->Get("name"), $oPerson->Get("email"), @@ -36,19 +37,19 @@ class BulkChangeTest extends ItopDataTestCase "iasimov", "harryseldon", "profileid->name:Administrator", - ), - ); - $aAttributes = array("language" => 3, "login" => 4, "password" => 5, "profile_list" => 6); - $aExtKeys = array( + ], + ]; + $aAttributes = ["language" => 3, "login" => 4, "password" => 5, "profile_list" => 6]; + $aExtKeys = [ "contactid" => - array("first_name" => 0, "name" => 1, "email" => 2), - ); + ["first_name" => 0, "name" => 1, "email" => 2], + ]; $oBulk = new BulkChange( "UserLocal", $aData, $aAttributes, $aExtKeys, - array("login"), + ["login"], null, null, "Y-m-d H:i:s", // date format @@ -61,13 +62,14 @@ class BulkChangeTest extends ItopDataTestCase foreach ($aRes as $aRow) { if (array_key_exists('__STATUS__', $aRow)) { $sStatus = $aRow['__STATUS__']; - $this->assertFalse(strstr($sStatus->GetDescription(), "CoreCannotSaveObjectException"), - "CSVimport/Datasynchro: Password validation failed with: ".$sStatus->GetDescription()); + $this->assertFalse( + strstr($sStatus->GetDescription(), "CoreCannotSaveObjectException"), + "CSVimport/Datasynchro: Password validation failed with: ".$sStatus->GetDescription() + ); } } } - /** * test $oBulk->Process with server 1 from demo datas * @@ -78,7 +80,8 @@ class BulkChangeTest extends ItopDataTestCase * @param $aExtKeys * @param $aReconcilKeys */ - public function testBulkChangeWithoutInitData($aCSVData, $aAttributes, $aExtKeys, $aReconcilKeys, $aResult, array $aResultHTML = null) { + public function testBulkChangeWithoutInitData($aCSVData, $aAttributes, $aExtKeys, $aReconcilKeys, $aResult, array $aResultHTML = null) + { $this->debug("aReconcilKeys:".$aReconcilKeys[0]); $oBulk = new BulkChange( "Server", @@ -106,9 +109,9 @@ class BulkChangeTest extends ItopDataTestCase $this->debug("i:".$i); $this->debug('GetCLIValue:'.$oCell->GetCLIValue()); $this->debug("aResult:".$aResult[$i]); - $this->assertEquals($aResult[$i], $oCell->GetCLIValue(), "Unexpected CLI result for cell " . $i); + $this->assertEquals($aResult[$i], $oCell->GetCLIValue(), "Unexpected CLI result for cell ".$i); if (null !== $aResultHTML) { - $this->assertEquals($aResultHTML[$i], $oCell->GetHTMLValue(), "Unexpected HTML result for cell " . $i); + $this->assertEquals($aResultHTML[$i], $oCell->GetHTMLValue(), "Unexpected HTML result for cell ".$i); } } } @@ -116,74 +119,75 @@ class BulkChangeTest extends ItopDataTestCase } } - public function bulkChangeWithoutInitDataProvider() { + public function bulkChangeWithoutInitDataProvider() + { return [ "Case 3, 5 et 8 : unchanged" => [ "csvData" => [["Demo", "Server1", "1", "production", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconciliation Keys"=> + "reconciliation Keys" => ["id"], - "expectedResult"=> + "expectedResult" => [0 => "Demo", "org_id" => "3", 1 => "Server1", 2 => "1", 3 => "production", 4 => "", "id" => 1, "__STATUS__" => "unchanged"], - "expectedResultHTML"=> + "expectedResultHTML" => [0 => "Demo", "org_id" => "3", 1 => "Server1", 2 => "1", 3 => "production", 4 => "", "id" => 1, "__STATUS__" => "unchanged"], ], "Case 9 : wrong date format" => [ "csvData" => [["Demo", "Server1", "1", "production", " + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconciliation Keys"=> + "reconciliation Keys" => ["id"], - "expectedResult"=> + "expectedResult" => [ 0 => "Demo", "org_id" => "n/a", 1 => "Server1", 2 => "1", 3 => "production", 4 => "' 1, "__STATUS__" => "Issue: wrong date format"], - "expectedResultHTML"=> + "expectedResultHTML" => [ 0 => "Demo", "org_id" => "n/a", 1 => "Server1", 2 => "1", 3 => "production", 4 => "'<date' is an invalid value", "id" => 1, "__STATUS__" => "Issue: wrong date format"], ], "Case 1 : no match" => [ "csvData" => [[" + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconciliation Keys"=> + "reconciliation Keys" => ["id"], - "expectedResult"=> + "expectedResult" => [0 => ' "No match for value ' "Server1",2 => "1", 3 => "production", 4 => "", "id" => 1, "__STATUS__" => "Issue: Unexpected attribute value(s)"], - "expectedResultHTML"=> + "expectedResultHTML" => [0 => '<Bad', "org_id" => "No match for value '<Bad'",1 => "Server1",2 => "1", 3 => "production", 4 => "", "id" => 1, "__STATUS__" => "Issue: Unexpected attribute value(s)"], ], "Case 10 : Missing mandatory value" => [ "csvData" => [["", "Server1", "1", "production", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconciliation Keys"=> + "reconciliation Keys" => ["id"], - "expectedResult"=> + "expectedResult" => [0 => null, "org_id" => "Invalid value for attribute", 1 => "Server1", 2 => "1", 3 => "production", 4 => "", "id" => 1, "__STATUS__" => "Issue: Unexpected attribute value(s)"], - "expectedResultHTML"=> + "expectedResultHTML" => [0 => null, "org_id" => "Invalid value for attribute", 1 => "Server1", 2 => "1", 3 => "production", 4 => "", "id" => 1, "__STATUS__" => "Issue: Unexpected attribute value(s)"], ], "Case 6 : Unexpected value" => [ "csvData" => [["Demo", "Server1", "1", "", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconciliation Keys"=> + "reconciliation Keys" => ["id"], - "expectedResult"=> + "expectedResult" => [ 0 => "Demo", "org_id" => "3", @@ -193,9 +197,9 @@ class BulkChangeTest extends ItopDataTestCase 4 => "", "id" => 1, "__STATUS__" => "Issue: Unexpected attribute value(s)", - "__ERRORS__" => "Unexpected value for attribute 'status': no match found, check spelling" + "__ERRORS__" => "Unexpected value for attribute 'status': no match found, check spelling", ], - "expectedResultHTML"=> + "expectedResultHTML" => [ 0 => "Demo", "org_id" => "3", @@ -205,7 +209,7 @@ class BulkChangeTest extends ItopDataTestCase 4 => "", "id" => 1, "__STATUS__" => "Issue: Unexpected attribute value(s)", - "__ERRORS__" => "Unexpected value for attribute 'status': no match found, check spelling" + "__ERRORS__" => "Unexpected value for attribute 'status': no match found, check spelling", ], ], ]; @@ -222,26 +226,27 @@ class BulkChangeTest extends ItopDataTestCase * @param $aExtKeys * @param $aReconcilKeys */ - public function testBulkChangeWithExistingData($aInitData, $aCsvData, $aAttributes, $aExtKeys, $aReconcilKeys, $aResult, $aResultHTML= null) { + public function testBulkChangeWithExistingData($aInitData, $aCsvData, $aAttributes, $aExtKeys, $aReconcilKeys, $aResult, $aResultHTML = null) + { //change value during the test - $db_core_transactions_enabled=MetaModel::GetConfig()->Get('db_core_transactions_enabled'); - MetaModel::GetConfig()->Set('db_core_transactions_enabled',false); + $db_core_transactions_enabled = MetaModel::GetConfig()->Get('db_core_transactions_enabled'); + MetaModel::GetConfig()->Set('db_core_transactions_enabled', false); if (is_array($aInitData) && sizeof($aInitData) != 0) { /** @var Server $oServer */ - $oServer = $this->createObject('Server', array( + $oServer = $this->createObject('Server', [ 'name' => $aInitData[1], 'status' => $aInitData[2], 'org_id' => $aInitData[0], 'purchase_date' => $aInitData[3], - )); - $aCsvData[0][2]=$oServer->GetKey(); - $aResult[2]=$oServer->GetKey(); - if ($aResult["id"]==="{Id of the server created by the test}") { - $aResult["id"]=$oServer->GetKey(); - if ($aResultHTML!==null){ - $aResultHTML[2]=$oServer->GetKey(); - $aResultHTML["id"]=$oServer->GetKey(); + ]); + $aCsvData[0][2] = $oServer->GetKey(); + $aResult[2] = $oServer->GetKey(); + if ($aResult["id"] === "{Id of the server created by the test}") { + $aResult["id"] = $oServer->GetKey(); + if ($aResultHTML !== null) { + $aResultHTML[2] = $oServer->GetKey(); + $aResultHTML["id"] = $oServer->GetKey(); } } $this->debug("oServer->GetKey():".$oServer->GetKey()); @@ -269,38 +274,39 @@ class BulkChangeTest extends ItopDataTestCase $this->debug("i:".$i); $this->debug('GetCLIValue:'.$oCell->GetCLIValue()); $this->debug("aResult:".$aResult[$i]); - $this->assertEquals( $aResult[$i], $oCell->GetCLIValue(), "failure on " . get_class($oCell) . ' cell type for cell number ' . $i ); + $this->assertEquals($aResult[$i], $oCell->GetCLIValue(), "failure on ".get_class($oCell).' cell type for cell number '.$i); if (null !== $aResultHTML) { - $this->assertEquals($aResultHTML[$i], $oCell->GetHTMLValue(), "failure on " . get_class($oCell) . ' cell type for cell number ' . $i); + $this->assertEquals($aResultHTML[$i], $oCell->GetHTMLValue(), "failure on ".get_class($oCell).' cell type for cell number '.$i); } - } else if ($i === "__ERRORS__") { + } elseif ($i === "__ERRORS__") { $sErrors = array_key_exists("__ERRORS__", $aResult) ? $aResult["__ERRORS__"] : ""; - $this->assertEquals( $sErrors, $oCell->GetDescription()); + $this->assertEquals($sErrors, $oCell->GetDescription()); } } - $this->assertEquals( $aResult[0], $aRow[0]->GetCLIValue()); + $this->assertEquals($aResult[0], $aRow[0]->GetCLIValue()); if (null !== $aResultHTML) { $this->assertEquals($aResultHTML[0], $aRow[0]->GetHTMLValue()); } } } - MetaModel::GetConfig()->Set('db_core_transactions_enabled',$db_core_transactions_enabled); + MetaModel::GetConfig()->Set('db_core_transactions_enabled', $db_core_transactions_enabled); } - public function bulkChangeWithExistingDataProvider() { + public function bulkChangeWithExistingDataProvider() + { return [ "Ambigous case on reconciliation" => [ - "initData"=> + "initData" => ["1", "Server1", "production", ""], "csvData" => [[">Demo", "Server1"]], - "attributes"=> + "attributes" => ["name" => 1], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["name"], - "expectedResult"=> + "expectedResult" => [ 0 => ">Demo", "org_id" => "n/a", @@ -309,7 +315,7 @@ class BulkChangeTest extends ItopDataTestCase "__STATUS__" => "Issue: ambiguous reconciliation", "__ERRORS__" => "Allowed 'status' value(s): stock,implementation,production,obsolete", ], - "expectedResultHTML"=> + "expectedResultHTML" => [ 0 => ">Demo", "org_id" => "n/a", @@ -320,17 +326,17 @@ class BulkChangeTest extends ItopDataTestCase ], ], "Case 6 - 1 : Unexpected value (update)" => [ - "initData"=> + "initData" => ["1", ">ServerTest", "production", ""], - "csvData"=> + "csvData" => [["Demo", ">ServerTest", "key - will be automatically overwritten by test", ">BadValue", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [ "id" => "{Id of the server created by the test}", 0 => "Demo", @@ -342,32 +348,32 @@ class BulkChangeTest extends ItopDataTestCase "__STATUS__" => "Issue: Unexpected attribute value(s)", "__ERRORS__" => "Allowed 'status' value(s): stock,implementation,production,obsolete", ], - "expectedResultHTML"=> - [ - "id" => "{Id of the server created by the test}", - 0 => "Demo", - "org_id" => "3", - 1 => ">ServerTest", - 2 => "1", - 3 => "'>BadValue' is an invalid value", - 4 => "", - "__STATUS__" => "Issue: Unexpected attribute value(s)", - "__ERRORS__" => "Allowed 'status' value(s): stock,implementation,production,obsolete", - ], + "expectedResultHTML" => + [ + "id" => "{Id of the server created by the test}", + 0 => "Demo", + "org_id" => "3", + 1 => ">ServerTest", + 2 => "1", + 3 => "'>BadValue' is an invalid value", + 4 => "", + "__STATUS__" => "Issue: Unexpected attribute value(s)", + "__ERRORS__" => "Allowed 'status' value(s): stock,implementation,production,obsolete", + ], ], "Case 6 - 2 : Unexpected value (update)" => [ - "initData"=> + "initData" => ["1", ">ServerTest", "production", ""], - "csvData"=> + "csvData" => [["Demo", ">ServerTest", "key", "", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [ "id" => "{Id of the server created by the test}", 0 => "Demo", @@ -379,7 +385,7 @@ class BulkChangeTest extends ItopDataTestCase "__STATUS__" => "Issue: Unexpected attribute value(s)", "__ERRORS__" => "Allowed 'status' value(s): stock,implementation,production,obsolete", ], - "expectedResultHTML"=> + "expectedResultHTML" => [ "id" => "{Id of the server created by the test}", 0 => "Demo", @@ -393,17 +399,17 @@ class BulkChangeTest extends ItopDataTestCase ], ], "Case 6 - 3 : Unexpected value (creation)" => [ - "initData"=> + "initData" => [], - "csvData"=> + "csvData" => [["Demo", ">ServerTest", "", ""]], - "attributes"=> + "attributes" => ["name" => 1, "status" => 2, "purchase_date" => 3], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["name"], - "expectedResult"=> + "expectedResult" => [ "id" => "{Id of the server created by the test}", 0 => "Demo", @@ -414,7 +420,7 @@ class BulkChangeTest extends ItopDataTestCase "__STATUS__" => "Issue: Unexpected attribute value(s)", "__ERRORS__" => "Allowed 'status' value(s): stock,implementation,production,obsolete", ], - "expectedResultHTML"=> + "expectedResultHTML" => [ "id" => "{Id of the server created by the test}", 0 => "Demo", @@ -427,164 +433,162 @@ class BulkChangeTest extends ItopDataTestCase ], ], "Case 8 : unchanged name" => [ - "initData"=> + "initData" => ["1", "", "production", ""], - "csvData"=> + "csvData" => [["Demo", "", "key", "production", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [ "id" => "{Id of the server created by the test}", - 0 => "Demo", "org_id" => "3", 1 => '', 2 => "1", 3 => "production", 4 => "", "__STATUS__" => "updated 1 cols"], - "expectedResultHTML"=> + 0 => "Demo", "org_id" => "3", 1 => '', 2 => "1", 3 => "production", 4 => "", "__STATUS__" => "updated 1 cols"], + "expectedResultHTML" => [ "id" => "{Id of the server created by the test}", - 0 => "Demo", "org_id" => "3", 1 => '<svg onclick"alert(1)">', 2 => "1", 3 => "production", 4 => "", "__STATUS__" => "updated 1 cols"], + 0 => "Demo", "org_id" => "3", 1 => '<svg onclick"alert(1)">', 2 => "1", 3 => "production", 4 => "", "__STATUS__" => "updated 1 cols"], ], "Case 3, 5 et 8 : unchanged 2" => [ - "initData"=> + "initData" => ["1", ">ServerTest", "production", ""], - "csvData"=> + "csvData" => [["Demo", ">ServerTest", "1", "production", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [ "id" => "{Id of the server created by the test}", - 0 => "Demo", "org_id" => "3", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "", "__STATUS__" => "updated 1 cols"], - "expectedResultHTML"=> + 0 => "Demo", "org_id" => "3", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "", "__STATUS__" => "updated 1 cols"], + "expectedResultHTML" => [ "id" => "{Id of the server created by the test}", - 0 => "Demo", "org_id" => "3", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "", "__STATUS__" => "updated 1 cols"], + 0 => "Demo", "org_id" => "3", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "", "__STATUS__" => "updated 1 cols"], ], "Case 9 - 1: wrong date format" => [ - "initData"=> + "initData" => ["1", ">ServerTest", "production", ""], - "csvData"=> + "csvData" => [["Demo", ">ServerTest", "1", "production", "date>"]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [ "id" => "{Id of the server created by the test}", - 0 => "Demo", "org_id" => "n/a", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "'date>' is an invalid value", "__STATUS__" => "Issue: wrong date format"], - "expectedResultHTML"=> + 0 => "Demo", "org_id" => "n/a", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "'date>' is an invalid value", "__STATUS__" => "Issue: wrong date format"], + "expectedResultHTML" => [ "id" => "{Id of the server created by the test}", - 0 => "Demo", "org_id" => "n/a", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "'date>' is an invalid value", "__STATUS__" => "Issue: wrong date format"], + 0 => "Demo", "org_id" => "n/a", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "'date>' is an invalid value", "__STATUS__" => "Issue: wrong date format"], ], "Case 9 - 2: wrong date format" => [ - "initData"=> + "initData" => ["1", ">ServerTest", "production", ""], - "csvData"=> + "csvData" => [["Demo", ">ServerTest", "1", "production", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [ "id" => "{Id of the server created by the test}", - 0 => "Demo", "org_id" => "n/a", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => '\'\' is an invalid value',"__STATUS__" => "Issue: wrong date format"], - "expectedResultHTML"=> + 0 => "Demo", "org_id" => "n/a", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => '\'\' is an invalid value',"__STATUS__" => "Issue: wrong date format"], + "expectedResultHTML" => [ "id" => "{Id of the server created by the test}", - 0 => "Demo", "org_id" => "n/a", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => '\'<svg onclick"alert(1)">\' is an invalid value',"__STATUS__" => "Issue: wrong date format"], + 0 => "Demo", "org_id" => "n/a", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => '\'<svg onclick"alert(1)">\' is an invalid value',"__STATUS__" => "Issue: wrong date format"], ], "Case 1 - 1 : no match" => [ - "initData"=> + "initData" => ["1", ">ServerTest", "production", ""], - "csvData"=> + "csvData" => [[">Bad", ">ServerTest", "1", "production", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [ "id" => "{Id of the server created by the test}", - 0 => ">Bad", "org_id" => "No match for value '>Bad'",1 => ">ServerTest",2 => "1", 3 => "production", 4 => "", "__STATUS__" => "Issue: Unexpected attribute value(s)", - "__ERRORS__" => "Object not found", + 0 => ">Bad", "org_id" => "No match for value '>Bad'",1 => ">ServerTest",2 => "1", 3 => "production", 4 => "", "__STATUS__" => "Issue: Unexpected attribute value(s)", + "__ERRORS__" => "Object not found", ], - "expectedResultHTML"=> + "expectedResultHTML" => [ "id" => "{Id of the server created by the test}", - 0 => ">Bad", "org_id" => "No match for value '>Bad'",1 => ">ServerTest",2 => "1", 3 => "production", 4 => "", "__STATUS__" => "Issue: Unexpected attribute value(s)", - "__ERRORS__" => "Object not found", + 0 => ">Bad", "org_id" => "No match for value '>Bad'",1 => ">ServerTest",2 => "1", 3 => "production", 4 => "", "__STATUS__" => "Issue: Unexpected attribute value(s)", + "__ERRORS__" => "Object not found", ], ], "Case 1 - 2 : no match" => [ - "initData"=> + "initData" => ["1", ">ServerTest", "production", ""], - "csvData"=> + "csvData" => [["", ">ServerTest", "1", "production", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [ "id" => "{Id of the server created by the test}", - 0 => '', "org_id" => "No match for value ''",1 => ">ServerTest",2 => "1", 3 => "production", 4 => "", "__STATUS__" => "Issue: Unexpected attribute value(s)", - "__ERRORS__" => "Object not found", + 0 => '', "org_id" => "No match for value ''",1 => ">ServerTest",2 => "1", 3 => "production", 4 => "", "__STATUS__" => "Issue: Unexpected attribute value(s)", + "__ERRORS__" => "Object not found", ], - "expectedResultHTML"=> + "expectedResultHTML" => [ "id" => "{Id of the server created by the test}", - 0 => '<svg onclick"alert(1)">', "org_id" => "No match for value '<svg onclick"alert(1)">'",1 => ">ServerTest",2 => "1", 3 => "production", 4 => "", "__STATUS__" => "Issue: Unexpected attribute value(s)", - "__ERRORS__" => "Object not found", + 0 => '<svg onclick"alert(1)">', "org_id" => "No match for value '<svg onclick"alert(1)">'",1 => ">ServerTest",2 => "1", 3 => "production", 4 => "", "__STATUS__" => "Issue: Unexpected attribute value(s)", + "__ERRORS__" => "Object not found", ], ], "Case 10 : Missing mandatory value" => [ - "initData"=> + "initData" => ["1", ">ServerTest", "production", ""], - "csvData"=> + "csvData" => [["", ">ServerTest", "1", "production", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [ "id" => "{Id of the server created by the test}", - 0 => "", "org_id" => "Invalid value for attribute", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "", "__STATUS__" => "Issue: Unexpected attribute value(s)", - "__ERRORS__" => "Null not allowed", + 0 => "", "org_id" => "Invalid value for attribute", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "", "__STATUS__" => "Issue: Unexpected attribute value(s)", + "__ERRORS__" => "Null not allowed", ], - "expectedResultHTML"=> + "expectedResultHTML" => [ "id" => "{Id of the server created by the test}", - 0 => "", "org_id" => "Invalid value for attribute", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "", "__STATUS__" => "Issue: Unexpected attribute value(s)", - "__ERRORS__" => "Null not allowed", + 0 => "", "org_id" => "Invalid value for attribute", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "", "__STATUS__" => "Issue: Unexpected attribute value(s)", + "__ERRORS__" => "Null not allowed", ], ], "Case 0 : Date format ok but incorrect date" => [ - "initData"=> + "initData" => ["1", ">ServerTest", "production", "2020-02-01"], - "csvData"=> + "csvData" => [["Demo", ">ServerTest", "1", "production", "2020-20-03"]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [ "id" => "{Id of the server created by the test}", - 0 => "Demo", "org_id" => "n/a", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "'2020-20-03' is an invalid value", "id" => 1, "__STATUS__" => "Issue: wrong date format"], + 0 => "Demo", "org_id" => "n/a", 1 => ">ServerTest", 2 => "1", 3 => "production", 4 => "'2020-20-03' is an invalid value", "id" => 1, "__STATUS__" => "Issue: wrong date format"], ], ]; } - - /** * test $oBulk->Process with new server and new organization datas * @@ -596,35 +600,36 @@ class BulkChangeTest extends ItopDataTestCase * @param $aExtKeys * @param $aReconcilKeys */ - public function testBulkChangeWithExistingDataAndSpecificOrg($aInitData, $aCsvData, $aAttributes, $aExtKeys, $aReconcilKeys, $aResult, $aResultHTML = null) { + public function testBulkChangeWithExistingDataAndSpecificOrg($aInitData, $aCsvData, $aAttributes, $aExtKeys, $aReconcilKeys, $aResult, $aResultHTML = null) + { //change value during the test - $db_core_transactions_enabled=MetaModel::GetConfig()->Get('db_core_transactions_enabled'); - MetaModel::GetConfig()->Set('db_core_transactions_enabled',false); + $db_core_transactions_enabled = MetaModel::GetConfig()->Get('db_core_transactions_enabled'); + MetaModel::GetConfig()->Set('db_core_transactions_enabled', false); if (is_array($aInitData) && sizeof($aInitData) != 0) { /** @var Server $oServer */ - $oOrganisation = $this->createObject('Organization', array( - 'name' => $aInitData["orgName"] - )); - if ($aResult["org_id"]==="{org id of the server created by the test}"){ + $oOrganisation = $this->createObject('Organization', [ + 'name' => $aInitData["orgName"], + ]); + if ($aResult["org_id"] === "{org id of the server created by the test}") { $aResult["org_id"] = $oOrganisation->GetKey(); - if ($aResultHTML!==null){ - $aResultHTML["org_id"]=$oOrganisation->GetKey(); + if ($aResultHTML !== null) { + $aResultHTML["org_id"] = $oOrganisation->GetKey(); } } - $oServer = $this->createObject('Server', array( + $oServer = $this->createObject('Server', [ 'name' => $aInitData["serverName"], 'status' => $aInitData["serverStatus"], 'org_id' => $oOrganisation->GetKey(), 'purchase_date' => $aInitData["serverPurchaseDate"], - )); - $aCsvData[0][2]=$oServer->GetKey(); - $aResult[2]=$oServer->GetKey(); - if ($aResult["id"]==="{Id of the server created by the test}") { - $aResult["id"]=$oServer->GetKey(); - if ($aResultHTML!==null){ - $aResultHTML[2]=$oServer->GetKey(); - $aResultHTML["id"]=$oServer->GetKey(); + ]); + $aCsvData[0][2] = $oServer->GetKey(); + $aResult[2] = $oServer->GetKey(); + if ($aResult["id"] === "{Id of the server created by the test}") { + $aResult["id"] = $oServer->GetKey(); + if ($aResultHTML !== null) { + $aResultHTML[2] = $oServer->GetKey(); + $aResultHTML["id"] = $oServer->GetKey(); } } } @@ -654,9 +659,9 @@ class BulkChangeTest extends ItopDataTestCase } elseif ($i === "__STATUS__") { $sStatus = $aRow['__STATUS__']; $this->assertEquals($aResult["__STATUS__"], $sStatus->GetDescription()); - } else if ($i === "__ERRORS__") { + } elseif ($i === "__ERRORS__") { $sErrors = array_key_exists("__ERRORS__", $aResult) ? $aResult["__ERRORS__"] : ""; - $this->assertEquals( $sErrors, $oCell->GetDescription()); + $this->assertEquals($sErrors, $oCell->GetDescription()); } } $this->assertEquals($aResult[0], $aRow[0]->GetCLIValue()); @@ -664,23 +669,24 @@ class BulkChangeTest extends ItopDataTestCase $this->assertEquals($aResultHTML[0], $aRow[0]->GetHTMLValue()); } } - MetaModel::GetConfig()->Set('db_core_transactions_enabled',$db_core_transactions_enabled); + MetaModel::GetConfig()->Set('db_core_transactions_enabled', $db_core_transactions_enabled); } - public function bulkChangeWithExistingDataAndSpecificOrgProvider() { + public function bulkChangeWithExistingDataAndSpecificOrgProvider() + { return [ "Ambigous case " => [ - "initData"=> - ["orgName" => "Demo", "serverName" => ">ServerYO", "serverStatus" => "production", "serverPurchaseDate" =>""], + "initData" => + ["orgName" => "Demo", "serverName" => ">ServerYO", "serverStatus" => "production", "serverPurchaseDate" => ""], "csvData" => [["Demo", ">Server1"]], - "attributes"=> + "attributes" => ["name" => 1], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["org_id"], - "expectedResult"=> + "expectedResult" => [ 0 => "Demo", "org_id" => "Invalid value for attribute", @@ -689,7 +695,7 @@ class BulkChangeTest extends ItopDataTestCase "__STATUS__" => "Issue: failed to reconcile", "__ERRORS__" => "Allowed 'status' value(s): stock,implemfentation,production,obsolete", ], - "expectedResultHTML"=> + "expectedResultHTML" => [ 0 => "Demo", "org_id" => "Invalid value for attribute", @@ -700,67 +706,67 @@ class BulkChangeTest extends ItopDataTestCase ], ], "Case 3 : unchanged name" => [ - "initData"=> - ["orgName" => ">dodo", "serverName" => ">ServerYO", "serverStatus" => "production", "serverPurchaseDate" =>""], - "csvData"=> + "initData" => + ["orgName" => ">dodo", "serverName" => ">ServerYO", "serverStatus" => "production", "serverPurchaseDate" => ""], + "csvData" => [[">dodo", ">ServerYO", "key will be set by the test", "production", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [0 => ">dodo", "org_id" => "{org id of the server created by the test}", 1 => ">ServerYO", 2 => "1", 3 => "production", 4 => "", "id" => "{Id of the server created by the test}", "__STATUS__" => "unchanged"], - "expectedResultHTML"=> + "expectedResultHTML" => [0 => ">dodo", "org_id" => "{org id of the server created by the test}", 1 => ">ServerYO", 2 => "1", 3 => "production", 4 => "", "id" => "{Id of the server created by the test}", "__STATUS__" => "unchanged"], ], "Case 3 bis : unchanged name" => [ - "initData"=> - ["orgName" =>"", "serverName" => ">ServerYO", "serverStatus" => "production", "serverPurchaseDate" =>""], - "csvData"=> + "initData" => + ["orgName" => "", "serverName" => ">ServerYO", "serverStatus" => "production", "serverPurchaseDate" => ""], + "csvData" => [["", ">ServerYO", "key", "production", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [0 => "", "org_id" => "{org id of the server created by the test}", 1 => ">ServerYO", 2 => "1", 3 => "production", 4 => "", "id" => "{Id of the server created by the test}", "__STATUS__" => "unchanged"], - "expectedResultHTML"=> + "expectedResultHTML" => [0 => "<svg >", "org_id" => "{org id of the server created by the test}", 1 => ">ServerYO", 2 => "1", 3 => "production", 4 => "", "id" => "{Id of the server created by the test}", "__STATUS__" => "unchanged"], ], "Case 3 ter : unchanged name" => [ - "initData"=> - ["orgName" => "", "serverName" => ">ServerYO", "serverStatus" => "production", "serverPurchaseDate" =>""], - "csvData"=> + "initData" => + ["orgName" => "", "serverName" => ">ServerYO", "serverStatus" => "production", "serverPurchaseDate" => ""], + "csvData" => [["", ">ServerYO", "key", "production", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["id"], - "expectedResult"=> + "expectedResult" => [0 => '', "org_id" => "{org id of the server created by the test}", 1 => ">ServerYO", 2 => "1", 3 => "production", 4 => "", "id" => "{Id of the server created by the test}", "__STATUS__" => "unchanged"], - "expectedResultHTML"=> + "expectedResultHTML" => [0 => '<svg onclick"alert(1)" >', "org_id" => "{org id of the server created by the test}", 1 => ">ServerYO", 2 => "1", 3 => "production", 4 => "", "id" => "{Id of the server created by the test}", "__STATUS__" => "unchanged"], ], "Case reconciliation on external key" => [ - "initData"=> - ["orgName" => "", "serverName" => ">ServerYO", "serverStatus" => "production", "serverPurchaseDate" =>""], - "csvData"=> + "initData" => + ["orgName" => "", "serverName" => ">ServerYO", "serverStatus" => "production", "serverPurchaseDate" => ""], + "csvData" => [["", ">ServerYO", "key", "production", ""]], - "attributes"=> + "attributes" => ["name" => 1, "id" => 2, "status" => 3, "purchase_date" => 4], - "extKeys"=> + "extKeys" => ["org_id" => ["name" => 0]], - "reconcilKeys"=> + "reconcilKeys" => ["org_id", "name"], - "expectedResult"=> + "expectedResult" => [0 => '', "org_id" => "{org id of the server created by the test}", 1 => ">ServerYO", 2 => "1", 3 => "production", 4 => "", "id" => "{Id of the server created by the test}", "__STATUS__" => "unchanged"], - "expectedResultHTML"=> + "expectedResultHTML" => [0 => '<svg onclick"alert(1)" >', "org_id" => "{org id of the server created by the test}", 1 => ">ServerYO", 2 => "1", 3 => "production", 4 => "", "id" => "{Id of the server created by the test}", "__STATUS__" => "unchanged"], ], ]; diff --git a/tests/php-unit-tests/unitary-tests/core/BulkExportTest.php b/tests/php-unit-tests/unitary-tests/core/BulkExportTest.php index 421b872d0..1fbe91ae7 100644 --- a/tests/php-unit-tests/unitary-tests/core/BulkExportTest.php +++ b/tests/php-unit-tests/unitary-tests/core/BulkExportTest.php @@ -5,18 +5,15 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - namespace Combodo\iTop\Test\UnitTest\Core; - use BulkExport; use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use DBObjectSearch; class BulkExportTest extends ItopDataTestCase { - const CREATE_TEST_ORG = true; - + public const CREATE_TEST_ORG = true; public function OrganizationsForExportProvider() { @@ -45,7 +42,7 @@ EOF; EOF; return [ - 'Page1'=>[ + 'Page1' => [ 'list_org' => [ ['org1', true], ['org2', true], @@ -63,9 +60,9 @@ EOF; ], 'export_org' => $sExportResultPage1, 'nb_pages' => 1, - 'expected_status' =>'run' + 'expected_status' => 'run', ], - 'Page2'=>[ + 'Page2' => [ 'list_org' => [ ['org1', true], ['org2', true], @@ -83,8 +80,8 @@ EOF; ], 'export_org' => $sExportResultPage2, 'nb_pages' => 2, - 'expected_status' =>'done' - ] + 'expected_status' => 'done', + ], ]; } @@ -99,9 +96,12 @@ EOF; * @throws \OQLException * @throws \ReflectionException */ - public function testExportWithShowObsoleteParam($aListOrg, - $sExpectedValue, $iNbPage, $sExpectedStatus) - { + public function testExportWithShowObsoleteParam( + $aListOrg, + $sExpectedValue, + $iNbPage, + $sExpectedStatus + ) { // Create tests organizations to have enough data (some obsolete) $iFirstOrg = 0; foreach ($aListOrg as $aOrg) { @@ -110,18 +110,18 @@ EOF; $oObj->Set('status', 'inactive'); $oObj->DBUpdate(); } - if($iFirstOrg === 0){ + if ($iFirstOrg === 0) { $iFirstOrg = $oObj->GetKey(); } } - + $aResult = [ // Fallback error, just in case 'code' => 'error', 'percentage' => 100, 'message' => "Export not found for token", ]; - + // Prepare status info and for obsolete data to `false` in order to check that we have less organizations // in the export result than we have in DB $aStatusInfo = [ @@ -132,15 +132,15 @@ EOF; "sClass" => "Organization", "sAttCode" => "name", "sLabel" => "Name", - "sColLabel" => "Name" - ] + "sColLabel" => "Name", + ], ], - "text_qualifier" => "\"", - "charset" => "ISO-8859-1", - "separator" => ",", - "date_format" => "Y-m-d H:i:s", - "formatted_text" => false, - "show_obsolete_data" => false + "text_qualifier" => "\"", + "charset" => "ISO-8859-1", + "separator" => ",", + "date_format" => "Y-m-d H:i:s", + "formatted_text" => false, + "show_obsolete_data" => false, ]; $oSearch = DBObjectSearch::FromOQL('SELECT Organization WHERE id >= '.$iFirstOrg); @@ -154,7 +154,7 @@ EOF; for ($i = 0; $i < $iNbPage; $i++) { $data .= $oExporter->GetNextChunk($aResult); } - $this->assertEquals($sExpectedStatus,$aResult['code']); + $this->assertEquals($sExpectedStatus, $aResult['code']); $this->assertEquals($sExpectedValue, $data); } diff --git a/tests/php-unit-tests/unitary-tests/core/CMDBSource/CMDBSourceTest.php b/tests/php-unit-tests/unitary-tests/core/CMDBSource/CMDBSourceTest.php index e69e0d02a..b9eec2c64 100644 --- a/tests/php-unit-tests/unitary-tests/core/CMDBSource/CMDBSourceTest.php +++ b/tests/php-unit-tests/unitary-tests/core/CMDBSource/CMDBSourceTest.php @@ -1,6 +1,5 @@ array(true, 'DATETIME', 'DATETIME'), - 'different types' => array(false, 'VARCHAR(255)', 'INT(11)'), - 'different types, same type options' => array(false, 'VARCHAR(11)', 'INT(11)'), - 'same int declaration, same case' => array(true, 'INT(11)', 'INT(11)'), - 'same int declaration, different case on data type' => array(true, 'INT(11)', 'int(11)'), - 'same enum declaration, same case' => array( + return [ + 'same datetime types' => [true, 'DATETIME', 'DATETIME'], + 'different types' => [false, 'VARCHAR(255)', 'INT(11)'], + 'different types, same type options' => [false, 'VARCHAR(11)', 'INT(11)'], + 'same int declaration, same case' => [true, 'INT(11)', 'INT(11)'], + 'same int declaration, different case on data type' => [true, 'INT(11)', 'int(11)'], + 'same enum declaration, same case' => [ true, "ENUM('error','idle','planned','running')", "ENUM('error','idle','planned','running')", - ), - 'same enum declaration, different case on data type' => array( + ], + 'same enum declaration, different case on data type' => [ true, "ENUM('error','idle','planned','running')", "enum('error','idle','planned','running')", - ), - 'same enum declaration, different case on type options' => array( + ], + 'same enum declaration, different case on type options' => [ false, "ENUM('ERROR','IDLE','planned','running')", "ENUM('error','idle','planned','running')", - ), - 'same enum declaration, different case on both data type and type options' => array( + ], + 'same enum declaration, different case on both data type and type options' => [ false, "ENUM('ERROR','IDLE','planned','running')", "enum('error','idle','planned','running')", - ), - 'MariaDB 10.2 nullable datetime' => array( + ], + 'MariaDB 10.2 nullable datetime' => [ true, 'DATETIME', "datetime DEFAULT 'NULL'", - ), - 'MariaDB 10.2 nullable text' => array( + ], + 'MariaDB 10.2 nullable text' => [ true, 'TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci', "text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'NULL'", - ), - 'MariaDB 10.2 nullable unsigned int' => array( + ], + 'MariaDB 10.2 nullable unsigned int' => [ true, 'INT(11) UNSIGNED', "int(11) unsigned DEFAULT 'NULL'", - ), - 'MariaDB 10.2 varchar with default value' => array( + ], + 'MariaDB 10.2 varchar with default value' => [ true, 'VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 0', "varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '0'", - ), - 'varchar with default value not at the end' => array( + ], + 'varchar with default value not at the end' => [ true, "VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 0 COMMENT 'my comment'", "varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '0' COMMENT 'my comment'", - ), - 'MariaDB 10.2 Enum with string default value' => array( + ], + 'MariaDB 10.2 Enum with string default value' => [ true, "ENUM('error','idle','planned','running') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'planned'", "enum('error','idle','planned','running') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'planned'", - ), - 'MariaDB 10.2 Enum with numeric default value' => array( + ], + 'MariaDB 10.2 Enum with numeric default value' => [ true, "ENUM('1','2','3') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '1'", "enum('1','2','3') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '1'", - ), - 'ENUM with values containing parenthesis' => array( + ], + 'ENUM with values containing parenthesis' => [ true, // see N°3065 : if having distinct values having parenthesis in enum values will cause comparison to be inexact "ENUM('CSP A','CSP M','NA','OEM(ROC)','OPEN(VL)','RETAIL (Boite)') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci", "enum('CSP A','CSP M','NA','OEM(ROC)','OPEN(VL)','RETAIL (Boite)') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci", - ), + ], // N°3065 before the fix this returned true :( - 'ENUM with different values, containing parenthesis' => array( + 'ENUM with different values, containing parenthesis' => [ false, "ENUM('value 1 (with parenthesis)','value 2') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci", "enum('value 1 (with parenthesis)','value 3') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci", - ), - ); + ], + ]; } /** @@ -204,7 +203,7 @@ class CMDBSourceTest extends ItopTestCase }); DbConnectionWrapper::SetDbConnectionMockForQuery($oMockMysqli); - $sTestErrorLogPath = APPROOT . 'log/error.phpunit.log'; + $sTestErrorLogPath = APPROOT.'log/error.phpunit.log'; IssueLog::Enable($sTestErrorLogPath); try { $this->InvokeNonPublicStaticMethod(CMDBSource::class, 'LogDeadLock', [$oDeadlockException, true, false]); diff --git a/tests/php-unit-tests/unitary-tests/core/CMDBSource/DeadLockInjection.php b/tests/php-unit-tests/unitary-tests/core/CMDBSource/DeadLockInjection.php index 0bbf9de6b..33980f471 100644 --- a/tests/php-unit-tests/unitary-tests/core/CMDBSource/DeadLockInjection.php +++ b/tests/php-unit-tests/unitary-tests/core/CMDBSource/DeadLockInjection.php @@ -1,13 +1,12 @@ bShowRequest = $bShowRequest; } - public function query($sSQL) { if (utils::StartsWith($sSQL, "SELECT")) { @@ -60,4 +58,4 @@ class DeadLockInjection } } } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/CMDBSource/TransactionsTest.php b/tests/php-unit-tests/unitary-tests/core/CMDBSource/TransactionsTest.php index 31ab95882..0153b8d23 100644 --- a/tests/php-unit-tests/unitary-tests/core/CMDBSource/TransactionsTest.php +++ b/tests/php-unit-tests/unitary-tests/core/CMDBSource/TransactionsTest.php @@ -1,4 +1,5 @@ debug("---> DBInsert()"); try { $oTicket->DBWrite(); - } - catch (Exception $e) { + } catch (Exception $e) { // If an exception occurs must be a deadlock $this->assertTrue(CMDBSource::IsDeadlockException($e), $e->getMessage()); } @@ -161,7 +161,7 @@ class TransactionsTest extends ItopTestCase } /** - * Test DBUpdate database transaction by provoking deadlock exceptions + * Test DBUpdate database transaction by provoking deadlock exceptions * * @dataProvider DBUpdateProvider * @param $iFailAt @@ -210,8 +210,7 @@ class TransactionsTest extends ItopTestCase $this->debug("---> DBUpdate()"); try { $oTicket->DBWrite(); - } - catch (Exception $e) { + } catch (Exception $e) { // If an exception occurs must be a deadlock $this->assertTrue(CMDBSource::IsDeadlockException($e)); } @@ -281,11 +280,10 @@ class TransactionsTest extends ItopTestCase try { DbConnectionWrapper::SetDbConnectionMockForQuery(); parent::tearDown(); - } - catch (MySQLTransactionNotClosedException $e) { + } catch (MySQLTransactionNotClosedException $e) { if ($this->getName() === 'testTransactionOpenedNotClosed') { $this->debug('Executing the testTransactionOpenNoClose method throws a '.MySQLTransactionNotClosedException::class.' exception in tearDown'); } } } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/CSVParserTest.php b/tests/php-unit-tests/unitary-tests/core/CSVParserTest.php index e396cbd6b..dd1634121 100644 --- a/tests/php-unit-tests/unitary-tests/core/CSVParserTest.php +++ b/tests/php-unit-tests/unitary-tests/core/CSVParserTest.php @@ -5,7 +5,6 @@ namespace Combodo\iTop\Test\UnitTest\Core; use Combodo\iTop\Test\UnitTest\ItopTestCase; use CSVParser; - class CSVParserTest extends ItopTestCase { protected function setUp(): void @@ -36,32 +35,29 @@ a2?;?b?;?c? ?a?;?b?;?ouf !? spaces trimmed out ; 1234; mac@enroe.com '; - $aExpectedResult = array( - array('line 0, col 0', 'line 0, col 1', 'line 0, col 2'), - array('a', 'b', 'c'), - array('a', 'b', null), - array(' a ', ' b ', ' c '), - array('a', 'b', 'c'), - array('', '', ''), - array('', '', ''), - array('a"', 'b', 'c'), - array("a1\na2", 'b', 'c'), - array('a1,a2', 'b', 'c'), - array('a', 'b', "c1,\",c2\n,c3"), - array('a', 'b', 'ouf !'), - array('spaces trimmed out', '1234', 'mac@enroe.com'), - ); + $aExpectedResult = [ + ['line 0, col 0', 'line 0, col 1', 'line 0, col 2'], + ['a', 'b', 'c'], + ['a', 'b', null], + [' a ', ' b ', ' c '], + ['a', 'b', 'c'], + ['', '', ''], + ['', '', ''], + ['a"', 'b', 'c'], + ["a1\na2", 'b', 'c'], + ['a1,a2', 'b', 'c'], + ['a', 'b', "c1,\",c2\n,c3"], + ['a', 'b', 'ouf !'], + ['spaces trimmed out', '1234', 'mac@enroe.com'], + ]; $oCSVParser = new CSVParser($sDataFile, $sSeparator, $sDelimiter); $aData = $oCSVParser->ToArray(1, null, 0); - foreach ($aData as $iRow => $aRow) - { - foreach ($aRow as $iCol => $cellValue) - { + foreach ($aData as $iRow => $aRow) { + foreach ($aRow as $iCol => $cellValue) { $this->assertSame($aExpectedResult[$iRow][$iCol], $cellValue, "Line $iRow, Column $iCol"); } } } } - diff --git a/tests/php-unit-tests/unitary-tests/core/DBObject/CMDBObjectTest.php b/tests/php-unit-tests/unitary-tests/core/DBObject/CMDBObjectTest.php index 8188ec08f..2fb8bcebe 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBObject/CMDBObjectTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBObject/CMDBObjectTest.php @@ -2,21 +2,18 @@ namespace Combodo\iTop\Test\UnitTest\Core; - use CMDBObject; use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use CoreException; use Exception; use MetaModel; - /** * @since 2.7.7 3.0.2 3.1.0 N°3717 tests history objects creation * * @package Combodo\iTop\Test\UnitTest\Core */ - class CMDBObjectTest extends ItopDataTestCase { private $sAdminLogin; @@ -51,8 +48,11 @@ class CMDBObjectTest extends ItopDataTestCase $oTestObject->Set('url', 'https://www.combodo.com'); $oTestObject->DBWrite(); self::assertFalse(CMDBObject::GetCurrentChange()->IsNew(), 'TrackInfo : Current change persisted'); - self::assertEquals($sTrackInfo, CMDBObject::GetCurrentChange()->Get('userinfo'), - 'TrackInfo : current change created with expected trackinfo'); + self::assertEquals( + $sTrackInfo, + CMDBObject::GetCurrentChange()->Get('userinfo'), + 'TrackInfo : current change created with expected trackinfo' + ); //-- new object with non persisted current change $sTrackInfo2 = $sTrackInfo.'_2'; @@ -64,8 +64,11 @@ class CMDBObjectTest extends ItopDataTestCase $oTestObject->Set('url', 'https://fr.wikipedia.org'); $oTestObject->DBUpdate(); self::assertFalse(CMDBObject::GetCurrentChange()->IsNew(), 'SetCurrentChange : Current change persisted'); - self::assertEquals($sTrackInfo2, CMDBObject::GetCurrentChange()->Get('userinfo'), - 'SetCurrentChange : current change created with expected trackinfo'); + self::assertEquals( + $sTrackInfo2, + CMDBObject::GetCurrentChange()->Get('userinfo'), + 'SetCurrentChange : current change created with expected trackinfo' + ); //-- new object with current change init using helper method $sTrackInfo3 = $sTrackInfo.'_3'; @@ -73,8 +76,11 @@ class CMDBObjectTest extends ItopDataTestCase $oTestObject->Set('url', 'https://en.wikipedia.org'); $oTestObject->DBUpdate(); self::assertFalse(CMDBObject::GetCurrentChange()->IsNew(), 'SetCurrentChangeFromParams : Current change persisted'); - self::assertEquals($sTrackInfo3, CMDBObject::GetCurrentChange()->Get('userinfo'), - 'SetCurrentChangeFromParams : current change created with expected trackinfo'); + self::assertEquals( + $sTrackInfo3, + CMDBObject::GetCurrentChange()->Get('userinfo'), + 'SetCurrentChangeFromParams : current change created with expected trackinfo' + ); // restore initial conditions $oTestObject->DBDelete(); @@ -82,7 +88,8 @@ class CMDBObjectTest extends ItopDataTestCase CMDBObject::SetTrackInfo($sInitialTrackInfo); } - public function CurrentChangeUnderImpersonationProvider(){ + public function CurrentChangeUnderImpersonationProvider() + { return [ 'no track info' => [ 'sTrackInfo' => null ], 'track info from approvalbase' => [ @@ -99,7 +106,8 @@ class CMDBObjectTest extends ItopDataTestCase * @runInSeparateProcess * @dataProvider CurrentChangeUnderImpersonationProvider */ - public function testCurrentChangeUnderImpersonation($sTrackInfo=null, $sExpectedChangeLogWhenImpersonation=null) { + public function testCurrentChangeUnderImpersonation($sTrackInfo = null, $sExpectedChangeLogWhenImpersonation = null) + { $this->CreateTestOrganization(); $sUid = date('dmYHis'); @@ -119,7 +127,7 @@ class CMDBObjectTest extends ItopDataTestCase // reset current change CMDBObject::SetCurrentChange(null); - if (is_null($sTrackInfo)){ + if (is_null($sTrackInfo)) { CMDBObject::SetTrackInfo(null); } else { $sTrackInfo = $this->ReplaceByFriendlyNames($sTrackInfo, $oAdminUser, $oImpersonatedUser); @@ -127,43 +135,70 @@ class CMDBObjectTest extends ItopDataTestCase } $this->CreateSimpleObject(); - if (is_null($sTrackInfo)){ - self::assertEquals($oAdminUser->GetFriendlyName(), CMDBObject::GetCurrentChange()->Get('userinfo'), - 'TrackInfo : no impersonation'); + if (is_null($sTrackInfo)) { + self::assertEquals( + $oAdminUser->GetFriendlyName(), + CMDBObject::GetCurrentChange()->Get('userinfo'), + 'TrackInfo : no impersonation' + ); } else { - self::assertEquals($sTrackInfo, CMDBObject::GetCurrentChange()->Get('userinfo'), - 'TrackInfo : no impersonation'); + self::assertEquals( + $sTrackInfo, + CMDBObject::GetCurrentChange()->Get('userinfo'), + 'TrackInfo : no impersonation' + ); } - self::assertEquals($oAdminUser->GetKey(), CMDBObject::GetCurrentChange()->Get('user_id'), - 'TrackInfo : admin userid'); + self::assertEquals( + $oAdminUser->GetKey(), + CMDBObject::GetCurrentChange()->Get('user_id'), + 'TrackInfo : admin userid' + ); \UserRights::Impersonate($sImpersonatedLogin); $this->CreateSimpleObject(); - if (is_null($sExpectedChangeLogWhenImpersonation)){ + if (is_null($sExpectedChangeLogWhenImpersonation)) { $sExpectedMsg = $this->ReplaceByFriendlyNames("AdminSurName AdminName on behalf of ImpersonatedSurName ImpersonatedName", $oAdminUser, $oImpersonatedUser); - self::assertEquals($sExpectedMsg, CMDBObject::GetCurrentChange()->Get('userinfo'), - 'TrackInfo : impersonation'); + self::assertEquals( + $sExpectedMsg, + CMDBObject::GetCurrentChange()->Get('userinfo'), + 'TrackInfo : impersonation' + ); } else { $sExpectedMsg = $this->ReplaceByFriendlyNames($sExpectedChangeLogWhenImpersonation, $oAdminUser, $oImpersonatedUser); - self::assertEquals($sExpectedMsg, CMDBObject::GetCurrentChange()->Get('userinfo'), - 'TrackInfo : impersonation'); + self::assertEquals( + $sExpectedMsg, + CMDBObject::GetCurrentChange()->Get('userinfo'), + 'TrackInfo : impersonation' + ); } - self::assertEquals(null, CMDBObject::GetCurrentChange()->Get('user_id'), - 'TrackInfo : no userid to force userinfo being displayed on UI caselog side'); + self::assertEquals( + null, + CMDBObject::GetCurrentChange()->Get('user_id'), + 'TrackInfo : no userid to force userinfo being displayed on UI caselog side' + ); \UserRights::Deimpersonate(); $this->CreateSimpleObject(); - if (is_null($sTrackInfo)){ - self::assertEquals($oAdminUser->GetFriendlyName(), CMDBObject::GetCurrentChange()->Get('userinfo'), - 'TrackInfo : no impersonation'); + if (is_null($sTrackInfo)) { + self::assertEquals( + $oAdminUser->GetFriendlyName(), + CMDBObject::GetCurrentChange()->Get('userinfo'), + 'TrackInfo : no impersonation' + ); } else { - self::assertEquals($sTrackInfo, CMDBObject::GetCurrentChange()->Get('userinfo'), - 'TrackInfo : no impersonation'); + self::assertEquals( + $sTrackInfo, + CMDBObject::GetCurrentChange()->Get('userinfo'), + 'TrackInfo : no impersonation' + ); } - self::assertEquals($oAdminUser->GetKey(), CMDBObject::GetCurrentChange()->Get('user_id'), - 'TrackInfo : admin userid'); + self::assertEquals( + $oAdminUser->GetKey(), + CMDBObject::GetCurrentChange()->Get('user_id'), + 'TrackInfo : admin userid' + ); // restore initial conditions CMDBObject::SetCurrentChange($oInitialCurrentChange); @@ -196,7 +231,7 @@ class CMDBObjectTest extends ItopDataTestCase * @dataProvider RecordObjDeletionProvider * */ - public function testRecordObjDeletion( string $sFirstName, string $sName) + public function testRecordObjDeletion(string $sFirstName, string $sName) { $oPerson = MetaModel::NewObject('Person', [ 'first_name' => $sFirstName, @@ -208,39 +243,40 @@ class CMDBObjectTest extends ItopDataTestCase $bDeletionOK = true; try { $oDeletionPlan = $this->InvokeNonPublicMethod(CMDBObject::class, 'RecordObjDeletion', $oPerson, [$oPerson->GetKey()]); - } - catch (CoreException $e) { + } catch (CoreException $e) { $bDeletionOK = false; } // We don't need to test the result (truncated string), it's already done in \DBObject::SetTrim() with N°3448 $this->assertTrue($bDeletionOK); } - - private function ReplaceByFriendlyNames($sMessage, $oAdminUser, $oImpersonatedUser) : string { + private function ReplaceByFriendlyNames($sMessage, $oAdminUser, $oImpersonatedUser): string + { $sNewMessage = str_replace('AdminSurName AdminName', $oAdminUser->GetFriendlyName(), $sMessage); $sNewMessage = str_replace('ImpersonatedSurName ImpersonatedName', $oImpersonatedUser->GetFriendlyName(), $sNewMessage); return $sNewMessage; } - private function CreateSimpleObject(){ + private function CreateSimpleObject() + { /** @var \DocumentWeb $oTestObject */ $oTestObject = MetaModel::NewObject('DocumentWeb'); $oTestObject->Set('name', 'PHPUnit test'); - $oTestObject->Set('org_id', $this->getTestOrgId() ); + $oTestObject->Set('org_id', $this->getTestOrgId()); $oTestObject->Set('url', 'https://www.combodo.com'); $oTestObject->DBWrite(); } - private function CreateUserForImpersonation($sLogin, $sProfileName, $sName, $sSurname): \UserLocal { + private function CreateUserForImpersonation($sLogin, $sProfileName, $sName, $sSurname): \UserLocal + { /** @var \Person $oPerson */ - $oPerson = $this->createObject('Person', array( + $oPerson = $this->createObject('Person', [ 'name' => $sName, 'first_name' => $sSurname, 'org_id' => $this->getTestOrgId(), - )); + ]); - $oProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => $sProfileName), true); + $oProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => $sProfileName], true); /** @var \UserLocal $oUser */ $oUser = $this->CreateUser($sLogin, $oProfile->GetKey(), "1234567Azert@", $oPerson->GetKey()); diff --git a/tests/php-unit-tests/unitary-tests/core/DBObject/CRUDEventTest.php b/tests/php-unit-tests/unitary-tests/core/DBObject/CRUDEventTest.php index 59a2829dd..a69594d27 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBObject/CRUDEventTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBObject/CRUDEventTest.php @@ -1,4 +1,5 @@ DBInsert(); // 1 insert for UserRequest, 3 insert for lnkFunctionalCIToTicket - $this->AssertEventCountEquals(4,EVENT_DB_COMPUTE_VALUES); - $this->AssertEventCountEquals(4,EVENT_DB_CHECK_TO_WRITE); - $this->AssertEventCountEquals(4,EVENT_DB_BEFORE_WRITE); - $this->AssertEventCountEquals(4,EVENT_DB_AFTER_WRITE); + $this->AssertEventCountEquals(4, EVENT_DB_COMPUTE_VALUES); + $this->AssertEventCountEquals(4, EVENT_DB_CHECK_TO_WRITE); + $this->AssertEventCountEquals(4, EVENT_DB_BEFORE_WRITE); + $this->AssertEventCountEquals(4, EVENT_DB_AFTER_WRITE); $this->AssertEventNotReceived(EVENT_DB_LINKS_CHANGED, 'Event must not be fired if host object is created with links'); $this->AssertTotalEventCountEquals(16); @@ -724,4 +725,4 @@ class CRUDEventTest extends ItopDataTestCase $this->assertArrayNotHasKey('ev_assign', $aTransitions, 'Assign transition should have been removed by EVENT_ENUM_TRANSITIONS handler'); $this->assertEquals(1, count($aRefTransitions) - count($aTransitions), 'Only one transition should have been removed'); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/DBObject/CRUDEventWithModifiedDataModelTest.php b/tests/php-unit-tests/unitary-tests/core/DBObject/CRUDEventWithModifiedDataModelTest.php index a136f30f7..464d1358c 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBObject/CRUDEventWithModifiedDataModelTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBObject/CRUDEventWithModifiedDataModelTest.php @@ -1,4 +1,5 @@ AssertEventCountEquals(0, EVENT_DB_LINKS_CHANGED, 'Event EVENT_DB_LINKS_CHANGED should not have been thrown on deleted objects'); } } - diff --git a/tests/php-unit-tests/unitary-tests/core/DBObject/CheckToWritePropagationTest.php b/tests/php-unit-tests/unitary-tests/core/DBObject/CheckToWritePropagationTest.php index 4ffe562ce..493db7e7b 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBObject/CheckToWritePropagationTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBObject/CheckToWritePropagationTest.php @@ -1,4 +1,5 @@ 'Foo', 'first_name' => 'John', 'org_id' => 3, 'location_id' => 2)); + $oObject = \MetaModel::NewObject('Person', ['name' => 'Foo', 'first_name' => 'John', 'org_id' => 3, 'location_id' => 2]); static::assertEquals('John Foo', $oObject->Get('friendlyname')); $oObject->Set('name', 'Who'); @@ -179,7 +178,7 @@ class DBObjectTest extends ItopDataTestCase */ public function testAttributeRefresh_FriendlyNameFromDB() { - $oObject = \MetaModel::NewObject('Person', array('name' => 'Gary', 'first_name' => 'Romain', 'org_id' => 3, 'location_id' => 2)); + $oObject = \MetaModel::NewObject('Person', ['name' => 'Gary', 'first_name' => 'Romain', 'org_id' => 3, 'location_id' => 2]); $oObject->DBInsert(); $iObjKey = $oObject->GetKey(); @@ -196,7 +195,7 @@ class DBObjectTest extends ItopDataTestCase */ public function testPartialAttributeEvaluation() { - $oObject = \MetaModel::NewObject('Person', array('name' => 'Foo', 'org_id' => 3, 'location_id' => 2)); + $oObject = \MetaModel::NewObject('Person', ['name' => 'Foo', 'org_id' => 3, 'location_id' => 2]); static::assertEquals(' Foo', $oObject->Get('friendlyname')); } @@ -206,7 +205,7 @@ class DBObjectTest extends ItopDataTestCase */ public function testEmptyAttributeEvaluation() { - $oObject = \MetaModel::NewObject('Person', array('org_id' => 3, 'location_id' => 2)); + $oObject = \MetaModel::NewObject('Person', ['org_id' => 3, 'location_id' => 2]); static::assertEquals(' ', $oObject->Get('friendlyname')); } @@ -230,7 +229,7 @@ class DBObjectTest extends ItopDataTestCase */ public function testAttributeRefresh_ObsolescenceFlagWithoutCascade() { - $oObject = \MetaModel::NewObject('Person', array('name' => 'Foo', 'first_name' => 'John', 'org_id' => 3, 'location_id' => 2)); + $oObject = \MetaModel::NewObject('Person', ['name' => 'Foo', 'first_name' => 'John', 'org_id' => 3, 'location_id' => 2]); static::assertEquals(false, (bool)$oObject->Get('obsolescence_flag')); $oObject->Set('status', 'inactive'); @@ -262,26 +261,26 @@ class DBObjectTest extends ItopDataTestCase */ public function testAttributeRefresh_ExternalKeysAndFields() { - $this->assertDBQueryCount(0, function() use (&$oObject){ - $oObject = \MetaModel::NewObject('Person', array('name' => 'Foo', 'first_name' => 'John', 'org_id' => 3, 'location_id' => 2)); + $this->assertDBQueryCount(0, function () use (&$oObject) { + $oObject = \MetaModel::NewObject('Person', ['name' => 'Foo', 'first_name' => 'John', 'org_id' => 3, 'location_id' => 2]); }); - $this->assertDBQueryCount(2, function() use (&$oObject){ + $this->assertDBQueryCount(2, function () use (&$oObject) { static::assertEquals('Demo', $oObject->Get('org_id_friendlyname')); static::assertEquals('Grenoble', $oObject->Get('location_id_friendlyname')); }); // External key given as an id - $this->assertDBQueryCount(1, function() use (&$oObject){ + $this->assertDBQueryCount(1, function () use (&$oObject) { $oObject->Set('org_id', 2); static::assertEquals('IT Department', $oObject->Get('org_id_friendlyname')); }); // External key given as an object - $this->assertDBQueryCount(1, function() use (&$oBordeaux){ + $this->assertDBQueryCount(1, function () use (&$oBordeaux) { $oBordeaux = \MetaModel::GetObject('Location', 1); }); - $this->assertDBQueryCount(0, function() use (&$oBordeaux, &$oObject){ + $this->assertDBQueryCount(0, function () use (&$oBordeaux, &$oObject) { /** @var DBObject $oObject */ $oObject->Set('location_id', $oBordeaux); static::assertEquals('IT Department', $oObject->Get('org_id_friendlyname')); @@ -290,7 +289,7 @@ class DBObjectTest extends ItopDataTestCase }); static::assertEquals('Bordeaux', $oObject->Get('location_id_friendlyname')); -// static::assertEquals('toto', $oObject->EvaluateExpression(\Expression::FromOQL("CONCAT(org_name, '-', location_id_friendlyname)"))); + // static::assertEquals('toto', $oObject->EvaluateExpression(\Expression::FromOQL("CONCAT(org_name, '-', location_id_friendlyname)"))); } /** @@ -302,7 +301,7 @@ class DBObjectTest extends ItopDataTestCase { $this->ResetReloadCount(); - $this->assertDBQueryCount(0, function() use (&$oObject){ + $this->assertDBQueryCount(0, function () use (&$oObject) { $oObject = \MetaModel::NewObject('Person', ['name' => 'Foo', 'first_name' => 'John', 'org_id' => 3, 'location_id' => 2]); }); // The number of queries depends on the installed modules so it varies on CI @@ -312,14 +311,14 @@ class DBObjectTest extends ItopDataTestCase $this->debug("Created $sClass::$sKey"); $this->DebugReloadCount("Person::DBInsertNoReload()"); - $this->assertDBQueryCount(0, function() use (&$oObject){ + $this->assertDBQueryCount(0, function () use (&$oObject) { static::assertEquals('Demo', $oObject->Get('org_id_friendlyname')); static::assertEquals('Grenoble', $oObject->Get('location_id_friendlyname')); }); $this->DebugReloadCount("Get('org_id_friendlyname') and Get('location_id_friendlyname')"); // External key given as an id - $this->assertDBQueryCount(1, function() use (&$oObject){ + $this->assertDBQueryCount(1, function () use (&$oObject) { $oObject->Set('org_id', 2); static::assertEquals('IT Department', $oObject->Get('org_id_friendlyname')); }); @@ -327,12 +326,12 @@ class DBObjectTest extends ItopDataTestCase $this->DebugReloadCount("Set('org_id', 2) and Get('org_id_friendlyname')"); // External key given as an object - $this->assertDBQueryCount(1, function() use (&$oBordeaux){ + $this->assertDBQueryCount(1, function () use (&$oBordeaux) { $oBordeaux = MetaModel::GetObject('Location', 1); }); $this->DebugReloadCount("GetObject('Location', 1)"); - $this->assertDBQueryCount(0, function() use (&$oBordeaux, &$oObject){ + $this->assertDBQueryCount(0, function () use (&$oBordeaux, &$oObject) { $oObject->Set('location_id', $oBordeaux); static::assertEquals('IT Department', $oObject->Get('org_id_friendlyname')); static::assertEquals('IT Department', $oObject->Get('org_name')); @@ -341,7 +340,6 @@ class DBObjectTest extends ItopDataTestCase $this->DebugReloadCount("Set('location_id',...) Get('org_id_friendlyname') Get('org_name') Get('location_id_friendlyname')"); } - /** * @covers DBObject::NewObject * @covers DBObject::Get @@ -351,7 +349,7 @@ class DBObjectTest extends ItopDataTestCase { $this->ResetReloadCount(); - $this->assertDBQueryCount(0, function() use (&$oPerson){ + $this->assertDBQueryCount(0, function () use (&$oPerson) { $oPerson = MetaModel::NewObject('Person', ['name' => 'Foo', 'first_name' => 'John', 'org_id' => 3, 'location_id' => 2]); }); // The number of queries depends on the installed modules so it varies on CI @@ -361,7 +359,7 @@ class DBObjectTest extends ItopDataTestCase $this->debug("Created $sPersonClass::$sPersonKey"); $this->DebugReloadCount("Person::DBInsertNoReload()"); - $this->assertDBQueryCount(1, function() use (&$oTeam, &$oPerson){ + $this->assertDBQueryCount(1, function () use (&$oTeam, &$oPerson) { $oTeam = MetaModel::NewObject('Team', ['name' => 'Team Foo', 'org_id' => 3]); // Add person to team $oNewLink = new lnkPersonToTeam(); @@ -387,7 +385,7 @@ class DBObjectTest extends ItopDataTestCase $this->assertCount(0, $oTeam->ListChanges()); // External key given as an id - $this->assertDBQueryCount(1, function() use (&$oTeam){ + $this->assertDBQueryCount(1, function () use (&$oTeam) { $oTeam->Set('org_id', 2); static::assertEquals('IT Department', $oTeam->Get('org_id_friendlyname')); }); @@ -395,10 +393,9 @@ class DBObjectTest extends ItopDataTestCase $this->assertCount(1, $oTeam->ListChanges()); } - public function testSetExtKeyUnsetDependentAttribute() { - $oObject = \MetaModel::NewObject('Person', array('name' => 'Foo', 'first_name' => 'John', 'org_id' => 3, 'location_id' => 2)); + $oObject = \MetaModel::NewObject('Person', ['name' => 'Foo', 'first_name' => 'John', 'org_id' => 3, 'location_id' => 2]); $oOrg = \MetaModel::GetObject('Organization', 2); $oObject->Set('org_id', $oOrg); @@ -406,13 +403,13 @@ class DBObjectTest extends ItopDataTestCase static::assertEquals(2, $oObject->Get('location_id')); // Dependent external field is updated because the Set('org_id') is done with an object - $this->assertDBQueryCount(0, function() use (&$oObject){ + $this->assertDBQueryCount(0, function () use (&$oObject) { static::assertNotEmpty($oObject->Get('org_name')); }); // Dependent external field is reset and reloaded from DB $oObject->Set('org_id', 3); - $this->assertDBQueryCount(1, function() use (&$oObject){ + $this->assertDBQueryCount(1, function () use (&$oObject) { static::assertNotEmpty($oObject->Get('org_name')); }); } @@ -469,17 +466,16 @@ class DBObjectTest extends ItopDataTestCase */ public function testModelExpressions() { - foreach (\MetaModel::GetClasses() as $sClass) - { - if (\MetaModel::IsAbstract($sClass)) continue; + foreach (\MetaModel::GetClasses() as $sClass) { + if (\MetaModel::IsAbstract($sClass)) { + continue; + } $oObject = \MetaModel::NewObject($sClass); - foreach (\MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - if ($oAttDef->IsBasedOnOQLExpression()) - { + foreach (\MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if ($oAttDef->IsBasedOnOQLExpression()) { $this->debug("$sClass::$sAttCode"); - $this->assertDBQueryCount(0, function() use (&$oObject, &$oAttDef){ + $this->assertDBQueryCount(0, function () use (&$oObject, &$oAttDef) { $oObject->EvaluateExpression($oAttDef->GetOQLExpression()); }); } @@ -602,7 +598,7 @@ class DBObjectTest extends ItopDataTestCase $oTeam = MetaModel::NewObject(Team::class, [ 'name' => 'The A Team', - 'org_id' => $oDemoOrg->GetKey() + 'org_id' => $oDemoOrg->GetKey(), ]); // Part 1 - Test with an invalid id (non-existing object) @@ -664,8 +660,7 @@ class DBObjectTest extends ItopDataTestCase try { $oTeam->CheckChangedExtKeysValues(); $this->fail('An unauthorized object should be detected as invalid'); - } - catch (InvalidExternalKeyValueException $e) { + } catch (InvalidExternalKeyValueException $e) { // Ok, the exception was expected } @@ -678,8 +673,7 @@ class DBObjectTest extends ItopDataTestCase $oTeam->DBInsert(); // persisting invalid value and resets the object changed values try { $oTeam->CheckChangedExtKeysValues(); - } - catch (InvalidExternalKeyValueException $e) { + } catch (InvalidExternalKeyValueException $e) { $this->fail('An unauthorized value should be ignored when it is not being modified'); } } @@ -743,7 +737,7 @@ class DBObjectTest extends ItopDataTestCase $oQueryOQL = \MetaModel::NewObject('QueryOQL', [ 'name' => 'Test Query', 'description' => 'Test Query', - 'oql' => 'SELECT Person' + 'oql' => 'SELECT Person', ]); $oQueryOQL->DBInsert(); @@ -766,12 +760,12 @@ class DBObjectTest extends ItopDataTestCase */ public function getAttributeIntegerDBIncrementProvider() { - return array( - 'Incrementation #1' => array('export_count', [5], 5), - 'Incrementation #2' => array('export_count', [5, 10], 15), - 'Incrementation #3' => array('export_count', [50, 20, 10, 100], 180), - 'Incrementation #4' => array('export_count', [50, 20, -10, 1000], 1060) - ); + return [ + 'Incrementation #1' => ['export_count', [5], 5], + 'Incrementation #2' => ['export_count', [5, 10], 15], + 'Incrementation #3' => ['export_count', [50, 20, 10, 100], 180], + 'Incrementation #4' => ['export_count', [50, 20, -10, 1000], 1060], + ]; } /** @@ -786,7 +780,7 @@ class DBObjectTest extends ItopDataTestCase $oQueryOQL = \MetaModel::NewObject('QueryOQL', [ 'name' => 'Test Query', 'description' => 'Test Query', - 'oql' => 'SELECT Person' + 'oql' => 'SELECT Person', ]); $oQueryOQL->DBInsert(); @@ -809,7 +803,7 @@ class DBObjectTest extends ItopDataTestCase $oQueryOQL = \MetaModel::NewObject('QueryOQL', [ 'name' => 'Test Query', 'description' => 'Test Query', - 'oql' => 'SELECT Person' + 'oql' => 'SELECT Person', ]); $oQueryOQL->DBInsert(); @@ -835,12 +829,12 @@ class DBObjectTest extends ItopDataTestCase $oQueryOQL = \MetaModel::NewObject('QueryOQL', [ 'name' => 'Test Query', 'description' => 'Test Query', - 'oql' => 'SELECT Person' + 'oql' => 'SELECT Person', ]); $oQueryOQL->DBInsert(); // assert query count - $this->assertDBQueryCount(2, function() use (&$oQueryOQL) { + $this->assertDBQueryCount(2, function () use (&$oQueryOQL) { $oQueryOQL->DBIncrement('export_count', 1); }); } @@ -976,8 +970,7 @@ class DBObjectTest extends ItopDataTestCase try { $oPerson->Set('email', 'test1@combodo.com'); $this->assertTrue(false, 'Set() should have raised a CoreException'); - } - catch (\CoreException $e) { + } catch (\CoreException $e) { $this->assertEquals($sMessage, $e->getMessage()); } @@ -1043,9 +1036,9 @@ class DBObjectTest extends ItopDataTestCase 'xml', [ 'ev_assign', - 'ev_timeout', - 'ev_wait_for_approval', - 'ev_autoresolve', + 'ev_timeout', + 'ev_wait_for_approval', + 'ev_autoresolve', ], ], 'UserRequest - XML sort when in specific state' => [ @@ -1055,10 +1048,10 @@ class DBObjectTest extends ItopDataTestCase 'xml', [ 'ev_pending', - 'ev_resolve', - 'ev_reassign', - 'ev_timeout', - 'ev_autoresolve', + 'ev_resolve', + 'ev_reassign', + 'ev_timeout', + 'ev_autoresolve', ], ], 'UserRequest - Alphabetical (labels not codes) sort' => [ @@ -1068,9 +1061,9 @@ class DBObjectTest extends ItopDataTestCase 'alphabetical', [ 'ev_assign', - 'ev_autoresolve', - 'ev_timeout', - 'ev_wait_for_approval', + 'ev_autoresolve', + 'ev_timeout', + 'ev_wait_for_approval', ], ], 'UserRequest - Alphabetical (labels not codes) sort when in specific state' => [ @@ -1079,11 +1072,11 @@ class DBObjectTest extends ItopDataTestCase 'assigned', 'alphabetical', [ - 'ev_autoresolve', + 'ev_autoresolve', 'ev_resolve', - 'ev_pending', - 'ev_reassign', - 'ev_timeout', + 'ev_pending', + 'ev_reassign', + 'ev_timeout', ], ], 'UserRequest - Fixed sort' => [ @@ -1092,10 +1085,10 @@ class DBObjectTest extends ItopDataTestCase null, 'fixed', [ - 'ev_wait_for_approval', + 'ev_wait_for_approval', 'ev_assign', - 'ev_timeout', - 'ev_autoresolve', + 'ev_timeout', + 'ev_autoresolve', ], ], 'UserRequest - Fixed sort when in specific state' => [ @@ -1115,10 +1108,10 @@ class DBObjectTest extends ItopDataTestCase null, 'relative', [ - 'ev_wait_for_approval', + 'ev_wait_for_approval', 'ev_assign', - 'ev_timeout', - 'ev_autoresolve', + 'ev_timeout', + 'ev_autoresolve', ], ], 'UserRequest - Relative sort when in specific state' => [ @@ -1210,8 +1203,7 @@ class DBObjectTest extends ItopDataTestCase $bDeletionOK = true; try { $oDeletionPlan = $oPerson->DBDelete(); - } - catch (CoreException $e) { + } catch (CoreException $e) { $bDeletionOK = false; } $this->assertTrue($bDeletionOK); @@ -1263,7 +1255,7 @@ class DBObjectTest extends ItopDataTestCase /** * @since 3.1.0-3 3.1.1 3.2.0 N°6716 test creation */ - public function testConstructorMemoryFootprint():void + public function testConstructorMemoryFootprint(): void { $idx = 0; $fStart = microtime(true); @@ -1285,7 +1277,7 @@ class DBObjectTest extends ItopDataTestCase $sCurrPeak = \utils::BytesToFriendlyFormat($iMemoryPeakUsage, 4); echo "$idx ".sprintf('%.1f ms', $fDuration * 1000)." - Peak Memory Usage: $sCurrPeak\n"; - $this->assertTrue(($iMemoryPeakUsage - $iInitialPeak) <= $iMaxAllowedMemoryIncrease , "Peak memory changed from $sInitialPeak to $sCurrPeak after $i loops"); + $this->assertTrue(($iMemoryPeakUsage - $iInitialPeak) <= $iMaxAllowedMemoryIncrease, "Peak memory changed from $sInitialPeak to $sCurrPeak after $i loops"); $fStartLoop = microtime(true); } @@ -1335,7 +1327,7 @@ class DBObjectTest extends ItopDataTestCase $sPrefix = 'a'; // just a small prefix so that the emoji bytes won't have a power of 2 (we want a non even value) $sEmojiToRepeat = '😎'; // this emoji is 4 bytes long $sEmojiRepeats = str_repeat($sEmojiToRepeat, $iValueLength - mb_strlen($sPrefix)); - $sValueToSet = $sPrefix . $sEmojiRepeats; + $sValueToSet = $sPrefix.$sEmojiRepeats; $oTicket = MetaModel::NewObject('UserRequest', [ 'ref' => 'Test Ticket', @@ -1354,14 +1346,14 @@ class DBObjectTest extends ItopDataTestCase $bIsValueToSetBelowAttrMaxSize = ($iValueLength <= $iAttrMaxSize); /** @noinspection PhpUnusedLocalVariableInspection */ [$bCheckStatus, $aCheckIssues, $bSecurityIssue] = $oTicket->CheckToWrite(); - $this->assertEquals($bIsValueToSetBelowAttrMaxSize, $bCheckStatus, "CheckResult result:" . var_export($aCheckIssues, true)); + $this->assertEquals($bIsValueToSetBelowAttrMaxSize, $bCheckStatus, "CheckResult result:".var_export($aCheckIssues, true)); $oTicket->SetTrim($sAttrCode, $sValueToSet); $sValueInObject = $oTicket->Get($sAttrCode); if ($bIsValueToSetBelowAttrMaxSize) { - $this->assertEquals($sValueToSet, $sValueInObject,'Should not alter string that is already shorter than attribute max length'); + $this->assertEquals($sValueToSet, $sValueInObject, 'Should not alter string that is already shorter than attribute max length'); } else { - $this->assertEquals($iAttrMaxSize, mb_strlen($sValueInObject),'Should truncate at the same length than attribute max length'); + $this->assertEquals($iAttrMaxSize, mb_strlen($sValueInObject), 'Should truncate at the same length than attribute max length'); $sLastCharsOfValueInObject = mb_substr($sValueInObject, -30); $this->assertStringContainsString(' -truncated', $sLastCharsOfValueInObject, 'Should end with "truncated" comment'); } @@ -1371,13 +1363,13 @@ class DBObjectTest extends ItopDataTestCase { return [ 'short string should not be truncated' => ['name','name'], - 'simple ascii string longer than 255 characters truncated' => [ - str_repeat('e',300), - str_repeat('e',232) . ' -truncated (300 chars)' - ], + 'simple ascii string longer than 255 characters truncated' => [ + str_repeat('e', 300), + str_repeat('e', 232).' -truncated (300 chars)', + ], 'smiley string longer than 255 characters truncated' => [ - str_repeat('😃',300), - str_repeat('😃',232) . ' -truncated (300 chars)' + str_repeat('😃', 300), + str_repeat('😃', 232).' -truncated (300 chars)', ], ]; @@ -1387,7 +1379,8 @@ class DBObjectTest extends ItopDataTestCase * @dataProvider SetTrimProvider * @return void */ - public function testSetTrim($sName, $sResult){ + public function testSetTrim($sName, $sResult) + { $oOrganisation = MetaModel::NewObject(Organization::class); $oOrganisation->SetTrim('name', $sName); $this->assertEquals($sResult, $oOrganisation->Get('name'), 'SetTrim must limit string to 255 characters'); @@ -1397,21 +1390,23 @@ class DBObjectTest extends ItopDataTestCase * @covers DBObject::SetComputedDate * @return void */ - public function testSetComputedDateOnAttributeDate(){ - $oObject = MetaModel::NewObject(\CustomerContract::class, ['name'=>'Test contract','org_id'=>'3','provider_id'=>'2']); - $oObject->Set('start_date',time()); + public function testSetComputedDateOnAttributeDate() + { + $oObject = MetaModel::NewObject(\CustomerContract::class, ['name' => 'Test contract','org_id' => '3','provider_id' => '2']); + $oObject->Set('start_date', time()); $oObject->SetComputedDate('end_date', "+2 weeks", 'start_date'); - $this->assertTrue(true,'No fatal error on computing date'); + $this->assertTrue(true, 'No fatal error on computing date'); } /** * @covers DBObject::SetComputedDate * @return void */ - public function testSetComputedDateOnAttributeDateTime(){ - $oObject = MetaModel::NewObject(\WorkOrder::class, ['name'=>'Test workorder','description'=>'Toto']); - $oObject->Set('start_date','2024-01-01 09:45:00'); + public function testSetComputedDateOnAttributeDateTime() + { + $oObject = MetaModel::NewObject(\WorkOrder::class, ['name' => 'Test workorder','description' => 'Toto']); + $oObject->Set('start_date', '2024-01-01 09:45:00'); $oObject->SetComputedDate('end_date', "+2 weeks", 'start_date'); - $this->assertTrue(true,'No fatal error on computing date'); + $this->assertTrue(true, 'No fatal error on computing date'); $this->assertEquals("2024-01-15 09:45:00", $oObject->Get('end_date'), 'SetComputedDate +2 weeks on a WorkOrder DateTimeAttribute'); } diff --git a/tests/php-unit-tests/unitary-tests/core/DBObject/DBObjectWithModifiedDataModelTest.php b/tests/php-unit-tests/unitary-tests/core/DBObject/DBObjectWithModifiedDataModelTest.php index cda459023..50ecef5bc 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBObject/DBObjectWithModifiedDataModelTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBObject/DBObjectWithModifiedDataModelTest.php @@ -1,4 +1,5 @@ assertEquals('resolved', $oParent->Get('status'), 'The status should have been modified to resolved (the final state after a nested stimulus)'); } } - diff --git a/tests/php-unit-tests/unitary-tests/core/DBObject/Utils/CRUDEventReceiver.php b/tests/php-unit-tests/unitary-tests/core/DBObject/Utils/CRUDEventReceiver.php index 4d1cb7ee6..f42912350 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBObject/Utils/CRUDEventReceiver.php +++ b/tests/php-unit-tests/unitary-tests/core/DBObject/Utils/CRUDEventReceiver.php @@ -1,4 +1,5 @@ bDBUpdateCalledSuccessfullyDuringEvent = false; } - /** * Event callbacks => this function counts the received events by event name and source class * If AddCallback() method has been called a specific callback is called, else only the count is done diff --git a/tests/php-unit-tests/unitary-tests/core/DBObject/Utils/ClassesWithDebug.php b/tests/php-unit-tests/unitary-tests/core/DBObject/Utils/ClassesWithDebug.php index 3581424d5..6df90d589 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBObject/Utils/ClassesWithDebug.php +++ b/tests/php-unit-tests/unitary-tests/core/DBObject/Utils/ClassesWithDebug.php @@ -1,4 +1,5 @@ assertArrayNotHasKey($sEvent, self::$aEventCallsCount, $sMessage); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/DBSearchAddConditionPointingTo.php b/tests/php-unit-tests/unitary-tests/core/DBSearchAddConditionPointingTo.php index f39b51119..38c8f7dc6 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBSearchAddConditionPointingTo.php +++ b/tests/php-unit-tests/unitary-tests/core/DBSearchAddConditionPointingTo.php @@ -1,4 +1,5 @@ Count()); - $oObjWithTagSet->Set(TAG_ATTCODE, 'tag1 tag2'); $oObjWithTagSet->DBWrite(); @@ -80,7 +80,6 @@ class DBSearchCommitTest extends ItopDataTestCase $oSet = new \DBObjectSet($oSearch); static::assertEquals(1, $oSet->Count()); - $oObjWithTagSet->Set(TAG_ATTCODE, 'tag1 tag2'); $oObjWithTagSet->DBWrite(); diff --git a/tests/php-unit-tests/unitary-tests/core/DBSearchIntersectTest.php b/tests/php-unit-tests/unitary-tests/core/DBSearchIntersectTest.php index 4a49ac3cc..dacbd5965 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBSearchIntersectTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBSearchIntersectTest.php @@ -14,7 +14,6 @@ use DBSearch; */ class DBSearchIntersectTest extends ItopTestCase { - protected function setUp(): void { parent::setUp(); @@ -46,104 +45,101 @@ class DBSearchIntersectTest extends ItopTestCase public function FilterProvider() { - $aTests = array(); + $aTests = []; - $aTests['Union filtered by parent class'] = array( + $aTests['Union filtered by parent class'] = [ 'left' => "SELECT ApplicationSolution UNION SELECT BusinessProcess", 'right' => "SELECT FunctionalCI WHERE org_id = 3", 'alias' => "ApplicationSolution", - 'result' => "SELECT `ApplicationSolution` FROM ApplicationSolution AS `ApplicationSolution` WHERE (`ApplicationSolution`.`org_id` = 3) UNION SELECT `BusinessProcess` FROM BusinessProcess AS `BusinessProcess` WHERE (`BusinessProcess`.`org_id` = 3)"); + 'result' => "SELECT `ApplicationSolution` FROM ApplicationSolution AS `ApplicationSolution` WHERE (`ApplicationSolution`.`org_id` = 3) UNION SELECT `BusinessProcess` FROM BusinessProcess AS `BusinessProcess` WHERE (`BusinessProcess`.`org_id` = 3)"]; - $aTests['Test union #2902'] = array( + $aTests['Test union #2902'] = [ 'left' => "SELECT `L-1` FROM ServiceFamily AS `L-1` WHERE 1", 'right' => "SELECT `sf` FROM ServiceFamily AS `sf` JOIN Service AS `s` ON `s`.servicefamily_id = `sf`.id JOIN lnkCustomerContractToService AS `l1` ON `l1`.service_id = `s`.id JOIN CustomerContract AS `cc` ON `l1`.customercontract_id = `cc`.id WHERE (`cc`.`org_id` = 3) UNION SELECT `sf` FROM ServiceFamily AS `sf` JOIN Service AS `s` ON `s`.servicefamily_id = `sf`.id JOIN lnkCustomerContractToService AS `l1` ON `l1`.service_id = `s`.id JOIN CustomerContract AS `cc` ON `l1`.customercontract_id = `cc`.id JOIN Organization AS `child` ON `cc`.org_id = `child`.id JOIN Organization AS `root` ON `child`.parent_id BELOW `root`.id WHERE (`root`.`id` = 3)", 'alias' => "L-1", - 'result' => "SELECT `L-1` FROM ServiceFamily AS `L-1` JOIN Service AS `s` ON `s`.servicefamily_id = `L-1`.id JOIN lnkCustomerContractToService AS `l1` ON `l1`.service_id = `s`.id JOIN CustomerContract AS `cc` ON `l1`.customercontract_id = `cc`.id WHERE (`cc`.`org_id` = 3) UNION SELECT `L-1` FROM ServiceFamily AS `L-1` JOIN Service AS `s` ON `s`.servicefamily_id = `L-1`.id JOIN lnkCustomerContractToService AS `l1` ON `l1`.service_id = `s`.id JOIN CustomerContract AS `cc` ON `l1`.customercontract_id = `cc`.id JOIN Organization AS `child` ON `cc`.org_id = `child`.id JOIN Organization AS `root` ON `child`.parent_id BELOW `root`.id WHERE (`root`.`id` = 3)"); + 'result' => "SELECT `L-1` FROM ServiceFamily AS `L-1` JOIN Service AS `s` ON `s`.servicefamily_id = `L-1`.id JOIN lnkCustomerContractToService AS `l1` ON `l1`.service_id = `s`.id JOIN CustomerContract AS `cc` ON `l1`.customercontract_id = `cc`.id WHERE (`cc`.`org_id` = 3) UNION SELECT `L-1` FROM ServiceFamily AS `L-1` JOIN Service AS `s` ON `s`.servicefamily_id = `L-1`.id JOIN lnkCustomerContractToService AS `l1` ON `l1`.service_id = `s`.id JOIN CustomerContract AS `cc` ON `l1`.customercontract_id = `cc`.id JOIN Organization AS `child` ON `cc`.org_id = `child`.id JOIN Organization AS `root` ON `child`.parent_id BELOW `root`.id WHERE (`root`.`id` = 3)"]; - $aTests['Multiple selected classes inverted'] = array( + $aTests['Multiple selected classes inverted'] = [ 'left' => "SELECT `L`, `P` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id WHERE 1", 'right' => "SELECT Person WHERE org_id = 3", 'alias' => "P", - 'result' => "SELECT `L`, `P` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id WHERE (`P`.`org_id` = 3)"); + 'result' => "SELECT `L`, `P` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id WHERE (`P`.`org_id` = 3)"]; - $aTests['Multiple selected classes inverted 1'] = array( + $aTests['Multiple selected classes inverted 1'] = [ 'left' => "SELECT `L`, `P`, `D` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id JOIN Server AS D ON D.location_id = L.id JOIN Person AS P2 ON P.manager_id = P2.id WHERE 1", 'right' => "SELECT Location WHERE org_id = 3", 'alias' => "L", - 'result' => "SELECT `L`, `P`, `D` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id JOIN Server AS `D` ON `D`.location_id = `L`.id JOIN Person AS `P2` ON `P`.manager_id = `P2`.id WHERE (`L`.`org_id` = 3)"); + 'result' => "SELECT `L`, `P`, `D` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id JOIN Server AS `D` ON `D`.location_id = `L`.id JOIN Person AS `P2` ON `P`.manager_id = `P2`.id WHERE (`L`.`org_id` = 3)"]; - $aTests['Multiple selected classes inverted 2'] = array( + $aTests['Multiple selected classes inverted 2'] = [ 'left' => "SELECT `L`, `P`, `D` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id JOIN Server AS D ON D.location_id = L.id JOIN Person AS P2 ON P.manager_id = P2.id WHERE (`L`.`org_id` = 3)", 'right' => "SELECT Person WHERE org_id = 3", 'alias' => "P", - 'result' => "SELECT `L`, `P`, `D` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id JOIN Server AS `D` ON `D`.location_id = `L`.id JOIN Person AS `P2` ON `P`.manager_id = `P2`.id WHERE ((`L`.`org_id` = 3) AND (`P`.`org_id` = 3))"); + 'result' => "SELECT `L`, `P`, `D` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id JOIN Server AS `D` ON `D`.location_id = `L`.id JOIN Person AS `P2` ON `P`.manager_id = `P2`.id WHERE ((`L`.`org_id` = 3) AND (`P`.`org_id` = 3))"]; - $aTests['Same class'] = array( + $aTests['Same class'] = [ 'left' => "SELECT Contact WHERE name = 'Christie'", 'right' => "SELECT Contact WHERE org_id = 3", 'alias' => "Contact", - 'result' => "SELECT `Contact` FROM Contact AS `Contact` WHERE ((`Contact`.`name` = 'Christie') AND (`Contact`.`org_id` = 3))"); + 'result' => "SELECT `Contact` FROM Contact AS `Contact` WHERE ((`Contact`.`name` = 'Christie') AND (`Contact`.`org_id` = 3))"]; - $aTests['Different Alias'] = array( + $aTests['Different Alias'] = [ 'left' => "SELECT Contact AS C WHERE C.name = 'Christie'", 'right' => "SELECT Contact AS CC WHERE CC.org_id = 3", 'alias' => "C", - 'result' => "SELECT `C` FROM Contact AS `C` WHERE ((`C`.`name` = 'Christie') AND (`C`.`org_id` = 3))"); + 'result' => "SELECT `C` FROM Contact AS `C` WHERE ((`C`.`name` = 'Christie') AND (`C`.`org_id` = 3))"]; - $aTests['Multiple selected classes'] = array( + $aTests['Multiple selected classes'] = [ 'left' => "SELECT `L`, `P` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE 1", 'right' => "SELECT Location WHERE org_id = 3", 'alias' => "L", - 'result' => "SELECT `L`, `P` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE (`L`.`org_id` = 3)"); + 'result' => "SELECT `L`, `P` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE (`L`.`org_id` = 3)"]; - $aTests['Joined classes'] = array( + $aTests['Joined classes'] = [ 'left' => "SELECT `L` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE 1", 'right' => "SELECT Person WHERE org_id = 3", 'alias' => "P", - 'result' => "SELECT `L` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE (`P`.`org_id` = 3)"); + 'result' => "SELECT `L` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE (`P`.`org_id` = 3)"]; - $aTests['Joined filter'] = array( + $aTests['Joined filter'] = [ 'left' => "SELECT `P` FROM Person AS `P` WHERE 1", 'right' => "SELECT `P` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id WHERE `L`.org_id = 3", 'alias' => "P", - 'result' => "SELECT `P` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id WHERE (`L`.`org_id` = 3)"); + 'result' => "SELECT `P` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id WHERE (`L`.`org_id` = 3)"]; - $aTests['Joined filter on joined classes'] = array( + $aTests['Joined filter on joined classes'] = [ 'left' => "SELECT `L` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE 1", 'right' => "SELECT Person FROM Person AS Person JOIN Location ON Person.location_id = Location.id WHERE Location.org_id = 3", 'alias' => "P", - 'result' => "SELECT `L` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id JOIN Location AS `Location` ON `P`.location_id = `Location`.id WHERE (`Location`.`org_id` = 3)"); + 'result' => "SELECT `L` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id JOIN Location AS `Location` ON `P`.location_id = `Location`.id WHERE (`Location`.`org_id` = 3)"]; - $aTests['Alias collision'] = array( + $aTests['Alias collision'] = [ 'left' => "SELECT `L` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE 1", 'right' => "SELECT Person FROM Person AS Person JOIN Location AS `L` ON Person.location_id = `L`.id WHERE `L`.org_id = 3", 'alias' => "P", - 'result' => "SELECT `L` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id JOIN Location AS `L1` ON `P`.location_id = `L1`.id WHERE (`L1`.`org_id` = 3)"); + 'result' => "SELECT `L` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id JOIN Location AS `L1` ON `P`.location_id = `L1`.id WHERE (`L1`.`org_id` = 3)"]; - $aTests['Test Subclass1'] = array( + $aTests['Test Subclass1'] = [ 'left' => "SELECT `U` FROM UserRequest AS `U` WHERE `U`.agent_id = 3", 'right' => "SELECT `Ticket` WHERE org_id = 3", 'alias' => "U", - 'result' => "SELECT `U` FROM UserRequest AS `U` WHERE ((`U`.`agent_id` = 3) AND (`U`.`org_id` = 3))"); + 'result' => "SELECT `U` FROM UserRequest AS `U` WHERE ((`U`.`agent_id` = 3) AND (`U`.`org_id` = 3))"]; - $aTests['Test Subclass and join'] = array( + $aTests['Test Subclass and join'] = [ 'left' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id WHERE `UserRequest`.agent_id = 3", 'right' => "SELECT `Ticket` WHERE org_id = 3", 'alias' => "UserRequest", - 'result' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id WHERE ((`UserRequest`.`agent_id` = 3) AND (`UserRequest`.`org_id` = 3))"); + 'result' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id WHERE ((`UserRequest`.`agent_id` = 3) AND (`UserRequest`.`org_id` = 3))"]; - $aTests['Test Subclass and union'] = array( + $aTests['Test Subclass and union'] = [ 'left' => "SELECT `U` FROM UserRequest AS `U` WHERE `U`.agent_id = 3 UNION SELECT `T` FROM Ticket AS `T` WHERE `T`.agent_id = 3 ", 'right' => "SELECT `Ticket` WHERE org_id = 3", 'alias' => "U", - 'result' => "SELECT `U` FROM UserRequest AS `U` WHERE ((`U`.`agent_id` = 3) AND (`U`.`org_id` = 3)) UNION SELECT `T` FROM Ticket AS `T` WHERE ((`T`.`agent_id` = 3) AND (`T`.`org_id` = 3))"); - - + 'result' => "SELECT `U` FROM UserRequest AS `U` WHERE ((`U`.`agent_id` = 3) AND (`U`.`org_id` = 3)) UNION SELECT `T` FROM Ticket AS `T` WHERE ((`T`.`agent_id` = 3) AND (`T`.`org_id` = 3))"]; return $aTests; } - /** * @dataProvider IntersectProvider * @@ -169,47 +165,47 @@ class DBSearchIntersectTest extends ItopTestCase public function IntersectProvider() { - $aTests = array(); + $aTests = []; - $aTests['Nested selects 2'] = array( + $aTests['Nested selects 2'] = [ 'left' => "SELECT `U` FROM UserRequest AS `U` WHERE U.agent_id = 3", 'right' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))", - 'result' => "SELECT `U` FROM UserRequest AS `U` JOIN Person AS `P` ON `U`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE ((`U`.`agent_id` = 3) AND (`U`.`org_id` IN (SELECT `Organization1` FROM Organization AS `Organization1` WHERE (`Organization1`.`id` = `U`.`org_id`))))"); + 'result' => "SELECT `U` FROM UserRequest AS `U` JOIN Person AS `P` ON `U`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE ((`U`.`agent_id` = 3) AND (`U`.`org_id` IN (SELECT `Organization1` FROM Organization AS `Organization1` WHERE (`Organization1`.`id` = `U`.`org_id`))))"]; - $aTests['Nested selects'] = array( + $aTests['Nested selects'] = [ 'left' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))", 'right' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE UserRequest.agent_id = 3", - 'result' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE ((`UserRequest`.`org_id` IN (SELECT `Organization1` FROM Organization AS `Organization1` WHERE (`Organization1`.`id` = `UserRequest`.`org_id`))) AND (`UserRequest`.`agent_id` = 3))"); + 'result' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE ((`UserRequest`.`org_id` IN (SELECT `Organization1` FROM Organization AS `Organization1` WHERE (`Organization1`.`id` = `UserRequest`.`org_id`))) AND (`UserRequest`.`agent_id` = 3))"]; - $aTests['Multiple selected classes inverted'] = array( + $aTests['Multiple selected classes inverted'] = [ 'left' => "SELECT `L`, `P` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id WHERE 1", 'right' => "SELECT Person WHERE org_id = 3", - 'result' => "SELECT `L`, `P` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id WHERE (`P`.`org_id` = 3)"); + 'result' => "SELECT `L`, `P` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id WHERE (`P`.`org_id` = 3)"]; -// $aTests['Multiple selected classes inverted 2'] = array( -// 'left' => "SELECT `L`, `P`, `D` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id JOIN Server AS D ON D.location_id = L.id JOIN Person AS P2 ON P.manager_id = P2.id WHERE (`L`.`org_id` = 3)", -// 'right' => "SELECT Person WHERE org_id = 3", -// 'result' => "SELECT `L`, `P`, `D` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id JOIN Server AS `D` ON `D`.location_id = `L`.id JOIN Person AS `P2` ON `P`.manager_id = `P2`.id WHERE ((`L`.`org_id` = 3) AND (`P`.`org_id` = 3))"); + // $aTests['Multiple selected classes inverted 2'] = array( + // 'left' => "SELECT `L`, `P`, `D` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id JOIN Server AS D ON D.location_id = L.id JOIN Person AS P2 ON P.manager_id = P2.id WHERE (`L`.`org_id` = 3)", + // 'right' => "SELECT Person WHERE org_id = 3", + // 'result' => "SELECT `L`, `P`, `D` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id JOIN Server AS `D` ON `D`.location_id = `L`.id JOIN Person AS `P2` ON `P`.manager_id = `P2`.id WHERE ((`L`.`org_id` = 3) AND (`P`.`org_id` = 3))"); - $aTests['Same class'] = array( + $aTests['Same class'] = [ 'left' => "SELECT Contact WHERE name = 'Christie'", 'right' => "SELECT Contact WHERE org_id = 3", - 'result' => "SELECT `Contact` FROM Contact AS `Contact` WHERE ((`Contact`.`name` = 'Christie') AND (`Contact`.`org_id` = 3))"); + 'result' => "SELECT `Contact` FROM Contact AS `Contact` WHERE ((`Contact`.`name` = 'Christie') AND (`Contact`.`org_id` = 3))"]; - $aTests['Different Alias'] = array( + $aTests['Different Alias'] = [ 'left' => "SELECT Contact AS C WHERE C.name = 'Christie'", 'right' => "SELECT Contact AS CC WHERE CC.org_id = 3", - 'result' => "SELECT `C` FROM Contact AS `C` WHERE ((`C`.`name` = 'Christie') AND (`C`.`org_id` = 3))"); + 'result' => "SELECT `C` FROM Contact AS `C` WHERE ((`C`.`name` = 'Christie') AND (`C`.`org_id` = 3))"]; - $aTests['Multiple selected classes'] = array( + $aTests['Multiple selected classes'] = [ 'left' => "SELECT `L`, `P` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE 1", 'right' => "SELECT Location WHERE org_id = 3", - 'result' => "SELECT `L`, `P` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE (`L`.`org_id` = 3)"); + 'result' => "SELECT `L`, `P` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE (`L`.`org_id` = 3)"]; - $aTests['Alias collision'] = array( + $aTests['Alias collision'] = [ 'left' => "SELECT `P` FROM Person AS `P` WHERE 1", 'right' => "SELECT `Person` FROM Person AS `Person` JOIN Person AS `P` ON `P`.manager_id = `Person`.id WHERE `P`.org_id = 3", - 'result' => "SELECT `P` FROM Person AS `P` JOIN Person AS `P1` ON `P1`.manager_id = `P`.id WHERE (`P1`.`org_id` = 3)"); + 'result' => "SELECT `P` FROM Person AS `P` JOIN Person AS `P1` ON `P1`.manager_id = `P`.id WHERE (`P1`.`org_id` = 3)"]; return $aTests; } @@ -352,100 +348,100 @@ class DBSearchIntersectTest extends ItopTestCase public function IntersectOptimizationProvider() { - $aQueries = array( - 'Exact same query' => array( + $aQueries = [ + 'Exact same query' => [ 'Base Query' => 'SELECT s FROM Service AS s JOIN Organization AS o ON s.org_id = o.id WHERE o.name = "The World Company"', 'Filter OQL' => 'SELECT s FROM Service AS s JOIN Organization AS o ON s.org_id = o.id WHERE o.name = "The World Company"', 'Result ' => "SELECT `s` FROM Service AS `s` JOIN Organization AS `o` ON `s`.org_id = `o`.id WHERE ((`o`.`name` = 'The World Company') AND (`o`.`name` = 'The World Company'))", - ), - 'Same query, other aliases' => array( + ], + 'Same query, other aliases' => [ 'Base Query' => 'SELECT s FROM Service AS s JOIN Organization AS o ON s.org_id = o.id WHERE o.name = "The World Company"', 'Filter OQL' => 'SELECT s2 FROM Service AS s2 JOIN Organization AS o2 ON s2.org_id = o2.id WHERE o2.name = "The World Company"', 'Result ' => "SELECT `s` FROM Service AS `s` JOIN Organization AS `o` ON `s`.org_id = `o`.id WHERE ((`o`.`name` = 'The World Company') AND (`o`.`name` = 'The World Company'))", - ), - 'Same aliases, different condition' => array( + ], + 'Same aliases, different condition' => [ 'Base Query' => 'SELECT s FROM Service AS s JOIN Organization AS o ON s.org_id = o.id WHERE o.name = "The World Company"', 'Filter OQL' => 'SELECT s FROM Service AS s JOIN Organization AS o ON s.org_id = o.id WHERE o.parent_id = 0', 'Result ' => "SELECT `s` FROM Service AS `s` JOIN Organization AS `o` ON `s`.org_id = `o`.id WHERE ((`o`.`name` = 'The World Company') AND (`o`.`parent_id` = 0))", - ), - 'Other aliases, different condition' => array( + ], + 'Other aliases, different condition' => [ 'Base Query' => 'SELECT s FROM Service AS s JOIN Organization AS o ON s.org_id = o.id WHERE o.name = "The World Company"', 'Filter OQL' => 'SELECT s2 FROM Service AS s2 JOIN Organization AS o2 ON s2.org_id = o2.id WHERE o2.parent_id = 0', 'Result ' => "SELECT `s` FROM Service AS `s` JOIN Organization AS `o` ON `s`.org_id = `o`.id WHERE ((`o`.`name` = 'The World Company') AND (`o`.`parent_id` = 0))", - ), - 'Same aliases, simpler query tree' => array( + ], + 'Same aliases, simpler query tree' => [ 'Base Query' => 'SELECT s FROM Service AS s JOIN Organization AS o ON s.org_id = o.id WHERE o.name = "The World Company"', 'Filter OQL' => 'SELECT s FROM Service AS s WHERE name LIKE "Save the World"', 'Result ' => "SELECT `s` FROM Service AS `s` JOIN Organization AS `o` ON `s`.org_id = `o`.id WHERE ((`o`.`name` = 'The World Company') AND (`s`.`name` LIKE 'Save the World'))", - ), - 'Other aliases, simpler query tree' => array( + ], + 'Other aliases, simpler query tree' => [ 'Base Query' => 'SELECT s FROM Service AS s JOIN Organization AS o ON s.org_id = o.id WHERE o.name = "The World Company"', 'Filter OQL' => 'SELECT s2 FROM Service AS s2 WHERE name LIKE "Save the World"', 'Result ' => "SELECT `s` FROM Service AS `s` JOIN Organization AS `o` ON `s`.org_id = `o`.id WHERE ((`o`.`name` = 'The World Company') AND (`s`.`name` LIKE 'Save the World'))", - ), - 'Same aliases, different query tree' => array( + ], + 'Same aliases, different query tree' => [ 'Base Query' => 'SELECT s FROM Service AS s JOIN Organization AS o ON s.org_id = o.id WHERE o.name = "The World Company"', 'Filter OQL' => 'SELECT s FROM Service AS s JOIN ServiceFamily AS f ON s.servicefamily_id = f.id WHERE s.org_id = 123 AND f.name = "Care"', 'Result ' => "SELECT `s` FROM Service AS `s` JOIN Organization AS `o` ON `s`.org_id = `o`.id JOIN ServiceFamily AS `f` ON `s`.servicefamily_id = `f`.id WHERE ((`o`.`name` = 'The World Company') AND ((`s`.`org_id` = 123) AND (`f`.`name` = 'Care')))", - ), - 'Other aliases, different query tree' => array( + ], + 'Other aliases, different query tree' => [ 'Base Query' => 'SELECT s FROM Service AS s JOIN Organization AS o ON s.org_id = o.id WHERE o.name = "The World Company"', 'Filter OQL' => 'SELECT s2 FROM Service AS s2 JOIN ServiceFamily AS f ON s2.servicefamily_id = f.id WHERE s2.org_id = 123 AND f.name = "Care"', 'Result ' => "SELECT `s` FROM Service AS `s` JOIN Organization AS `o` ON `s`.org_id = `o`.id JOIN ServiceFamily AS `f` ON `s`.servicefamily_id = `f`.id WHERE ((`o`.`name` = 'The World Company') AND ((`s`.`org_id` = 123) AND (`f`.`name` = 'Care')))", - ), + ], - '2 - Exact same query' => array( + '2 - Exact same query' => [ 'Base Query' => 'SELECT o FROM Organization AS o JOIN Service AS s ON s.org_id = o.id WHERE s.name = "Help"', 'Filter OQL' => 'SELECT o FROM Organization AS o JOIN Service AS s ON s.org_id = o.id WHERE s.name = "Help"', 'Result ' => "SELECT `o` FROM Organization AS `o` JOIN Service AS `s` ON `s`.org_id = `o`.id WHERE ((`s`.`name` = 'Help') AND (`s`.`name` = 'Help'))", - ), - '2 - Same query, other aliases' => array( + ], + '2 - Same query, other aliases' => [ 'Base Query' => 'SELECT o FROM Organization AS o JOIN Service AS s ON s.org_id = o.id WHERE s.name = "Help"', 'Filter OQL' => 'SELECT o2 FROM Organization AS o2 JOIN Service AS s2 ON s2.org_id = o2.id WHERE s2.name = "Help"', 'Result ' => "SELECT `o` FROM Organization AS `o` JOIN Service AS `s` ON `s`.org_id = `o`.id WHERE ((`s`.`name` = 'Help') AND (`s`.`name` = 'Help'))", - ), - '2 - Same aliases, different condition' => array( + ], + '2 - Same aliases, different condition' => [ 'Base Query' => 'SELECT o FROM Organization AS o JOIN Service AS s ON s.org_id = o.id WHERE s.name = "Help"', 'Filter OQL' => 'SELECT o FROM Organization AS o JOIN Service AS s ON s.org_id = o.id WHERE s.servicefamily_id = 321', 'Result ' => "SELECT `o` FROM Organization AS `o` JOIN Service AS `s` ON `s`.org_id = `o`.id WHERE ((`s`.`name` = 'Help') AND (`s`.`servicefamily_id` = 321))", - ), - '2 - Other aliases, different condition' => array( + ], + '2 - Other aliases, different condition' => [ 'Base Query' => 'SELECT o FROM Organization AS o JOIN Service AS s ON s.org_id = o.id WHERE s.name = "Help"', 'Filter OQL' => 'SELECT o2 FROM Organization AS o2 JOIN Service AS s2 ON s2.org_id = o2.id WHERE s2.servicefamily_id = 321', 'Result ' => "SELECT `o` FROM Organization AS `o` JOIN Service AS `s` ON `s`.org_id = `o`.id WHERE ((`s`.`name` = 'Help') AND (`s`.`servicefamily_id` = 321))", - ), - '2 - Same aliases, simpler query tree' => array( + ], + '2 - Same aliases, simpler query tree' => [ 'Base Query' => 'SELECT o FROM Organization AS o JOIN Service AS s ON s.org_id = o.id WHERE s.name = "Help"', 'Filter OQL' => 'SELECT o FROM Organization AS o WHERE o.name = "Demo"', 'Result ' => "SELECT `o` FROM Organization AS `o` JOIN Service AS `s` ON `s`.org_id = `o`.id WHERE ((`s`.`name` = 'Help') AND (`o`.`name` = 'Demo'))", - ), - '2 - Other aliases, simpler query tree' => array( + ], + '2 - Other aliases, simpler query tree' => [ 'Base Query' => 'SELECT o FROM Organization AS o JOIN Service AS s ON s.org_id = o.id WHERE s.name = "Help"', 'Filter OQL' => 'SELECT o2 FROM Organization AS o2 WHERE o2.name = "Demo"', 'Result ' => "SELECT `o` FROM Organization AS `o` JOIN Service AS `s` ON `s`.org_id = `o`.id WHERE ((`s`.`name` = 'Help') AND (`o`.`name` = 'Demo'))", - ), - '2 - Same aliases, different query tree' => array( + ], + '2 - Same aliases, different query tree' => [ 'Base Query' => 'SELECT o FROM Organization AS o JOIN Service AS s ON s.org_id = o.id WHERE s.name = "Help"', 'Filter OQL' => 'SELECT o FROM Organization AS o JOIN Location AS l ON l.org_id = o.id WHERE l.name = "Paris"', 'Result ' => "SELECT `o` FROM Organization AS `o` JOIN Service AS `s` ON `s`.org_id = `o`.id JOIN Location AS `l` ON `l`.org_id = `o`.id WHERE ((`s`.`name` = 'Help') AND (`l`.`name` = 'Paris'))", - ), - '2 - Other aliases, different query tree' => array( + ], + '2 - Other aliases, different query tree' => [ 'Base Query' => 'SELECT o FROM Organization AS o JOIN Service AS s ON s.org_id = o.id WHERE s.name = "Help"', 'Filter OQL' => 'SELECT o2 FROM Organization AS o2 JOIN Location AS l ON l.org_id = o2.id WHERE l.name = "Paris"', 'Result ' => "SELECT `o` FROM Organization AS `o` JOIN Service AS `s` ON `s`.org_id = `o`.id JOIN Location AS `l` ON `l`.org_id = `o`.id WHERE ((`s`.`name` = 'Help') AND (`l`.`name` = 'Paris'))", - ), + ], - 'Internal query optimizations 1' => array( + 'Internal query optimizations 1' => [ 'Base Query' => 'SELECT o FROM Organization AS o', 'Filter OQL' => 'SELECT o FROM Organization AS o JOIN Location AS l ON l.org_id = o.id JOIN Organization AS p ON o.parent_id = p.id WHERE l.name = "Paris" AND p.code LIKE "toto"', 'Result ' => "SELECT `o` FROM Organization AS `o` JOIN Organization AS `p` ON `o`.parent_id = `p`.id JOIN Location AS `l` ON `l`.org_id = `o`.id WHERE ((`l`.`name` = 'Paris') AND (`p`.`code` LIKE 'toto'))", - ), - 'Internal query optimizations 2' => array( + ], + 'Internal query optimizations 2' => [ 'Base Query' => 'SELECT r FROM UserRequest AS r JOIN Service AS s ON r.service_id = s.id JOIN Organization AS o ON s.org_id = o.id WHERE o.name = "left_name"', 'Filter OQL' => 'SELECT r FROM UserRequest AS r JOIN Service AS s ON r.service_id = s.id JOIN Organization AS o ON s.org_id = o.id WHERE o.name = "right_name"', 'Result ' => "SELECT `r` FROM UserRequest AS `r` JOIN Service AS `s` ON `r`.service_id = `s`.id JOIN Organization AS `o` ON `s`.org_id = `o`.id WHERE ((`o`.`name` = 'left_name') AND (`o`.`name` = 'right_name'))", - ), - ); + ], + ]; return $aQueries; } diff --git a/tests/php-unit-tests/unitary-tests/core/DBSearchJoinTest.php b/tests/php-unit-tests/unitary-tests/core/DBSearchJoinTest.php index 55077d4d1..8b12f1a03 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBSearchJoinTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBSearchJoinTest.php @@ -12,9 +12,9 @@ use DBSearch; * * @package Combodo\iTop\Test\UnitTest\Core */ -class DBSearchJoinTest extends ItopDataTestCase { - - const USE_TRANSACTION = false; +class DBSearchJoinTest extends ItopDataTestCase +{ + public const USE_TRANSACTION = false; protected function setUp(): void { @@ -43,9 +43,13 @@ class DBSearchJoinTest extends ItopDataTestCase { $aRealiasingMap = []; - $oResultSearch = $oLeftSearch->Join($oRightSearch, - DBSearch::JOIN_REFERENCED_BY, $sParentAtt, - TREE_OPERATOR_EQUALS, $aRealiasingMap); + $oResultSearch = $oLeftSearch->Join( + $oRightSearch, + DBSearch::JOIN_REFERENCED_BY, + $sParentAtt, + TREE_OPERATOR_EQUALS, + $aRealiasingMap + ); $this->debug("\nRealiasing Map"); $this->debug($aRealiasingMap); @@ -57,12 +61,9 @@ class DBSearchJoinTest extends ItopDataTestCase { $this->debug("\nBefore renaming"); $this->debug($oResultSearch->ToOQL()); $aLevelsPropertiesKeys = ['L-1', 'L-1-1', 'L-1-1-1']; - foreach ($aLevelsPropertiesKeys as $sLevelAlias) - { - if (array_key_exists($sLevelAlias, $aRealiasingMap)) - { - foreach ($aRealiasingMap[$sLevelAlias] as $sAliasToRename) - { + foreach ($aLevelsPropertiesKeys as $sLevelAlias) { + if (array_key_exists($sLevelAlias, $aRealiasingMap)) { + foreach ($aRealiasingMap[$sLevelAlias] as $sAliasToRename) { $oResultSearch->RenameAlias($sAliasToRename, $sLevelAlias); } } @@ -137,11 +138,14 @@ class DBSearchJoinTest extends ItopDataTestCase { $oFilter1 = DBSearch::FromOQL($sReq1); $oFilter2 = DBSearch::FromOQL($sReq2); - $aRealiasingMap = array(); - $oFilter1 = $oFilter1->Join($oFilter2, + $aRealiasingMap = []; + $oFilter1 = $oFilter1->Join( + $oFilter2, DBSearch::JOIN_REFERENCED_BY, 'org_id', - TREE_OPERATOR_EQUALS, $aRealiasingMap); + TREE_OPERATOR_EQUALS, + $aRealiasingMap + ); $this->debug("\nRealiasing Map"); $this->debug($aRealiasingMap); @@ -150,14 +154,10 @@ class DBSearchJoinTest extends ItopDataTestCase { $this->debug("\nJoined"); $this->debug($sRes1); - foreach($oFilter1->GetCriteria_ReferencedBy() as $sForeignClass => $aReferences) - { - foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) - { - foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) - { - foreach ($aFilters as $index => $oForeignFilter) - { + foreach ($oFilter1->GetCriteria_ReferencedBy() as $sForeignClass => $aReferences) { + foreach ($aReferences as $sForeignExtKeyAttCode => $aFiltersByOperator) { + foreach ($aFiltersByOperator as $iOperatorCode => $aFilters) { + foreach ($aFilters as $index => $oForeignFilter) { $this->debug("\nReferencedBy"); $this->debug($oForeignFilter->ToOQL()); } diff --git a/tests/php-unit-tests/unitary-tests/core/DBSearchTest.php b/tests/php-unit-tests/unitary-tests/core/DBSearchTest.php index 2a7ad03cf..8a7d9a5cb 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBSearchTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBSearchTest.php @@ -1,4 +1,5 @@ Expression - $aGroupBy = array('org_id' => $oExpr1); + $aGroupBy = ['org_id' => $oExpr1]; $oTimeExpr = Expression::FromOQL('UserRequest.time_spent'); - $oSumExpr = new FunctionExpression('SUM', array($oTimeExpr)); - $oAvgExpr = new FunctionExpression('AVG', array($oTimeExpr)); - $oMinExpr = new FunctionExpression('MIN', array($oTimeExpr)); - $oMaxExpr = new FunctionExpression('MAX', array($oTimeExpr)); + $oSumExpr = new FunctionExpression('SUM', [$oTimeExpr]); + $oAvgExpr = new FunctionExpression('AVG', [$oTimeExpr]); + $oMinExpr = new FunctionExpression('MIN', [$oTimeExpr]); + $oMaxExpr = new FunctionExpression('MAX', [$oTimeExpr]); // Alias => Expression - $aFunctions = array( + $aFunctions = [ '_itop_sum_' => $oSumExpr, '_itop_avg_' => $oAvgExpr, '_itop_min_' => $oMinExpr, '_itop_max_' => $oMaxExpr, - ); + ]; // Alias => Order - $aOrderBy = array('_itop_sum_' => true, '_itop_count_' => true); + $aOrderBy = ['_itop_sum_' => true, '_itop_count_' => true]; - $aArgs = array(); + $aArgs = []; $sSQL = $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy, $iLimit); $this->debug($sSQL); @@ -104,24 +103,22 @@ class DBSearchTest extends ItopDataTestCase $this->debug($aRes); self::assertEquals(count($aCountRes), count($aRes)); - for ($i = 0; $i < count($aCountRes); $i++) - { + for ($i = 0; $i < count($aCountRes); $i++) { self::assertEquals($aCountRes[$i], $aRes[$i]['_itop_count_']); } } - public function UReqProvider() { - return array( - "1 line" => array(1, 1, array(array(1, 0, 0)), 0, array('1')), - "2 same lines" => array(1, 1, array(array(1, 0, 0), array(1, 0, 0)), 0, array('2')), - "2 diff lines" => array(2, 2, array(array(1, 0, 0), array(1, 1, 1)), 0, array('1', '1')), - "4 lines" => array(2, 2, array(array(1, 0, 0), array(1, 1, 1), array(1, 0, 0), array(1, 1, 1)), 0, array('2', '2')), - "5 lines" => array(2, 2, array(array(1, 0, 0), array(1, 0, 0), array(1, 1, 1), array(1, 0, 0), array(1, 1, 1)), 0, array('2', '3')), - "6 lines" => array(2, 4, array(array(1, 0, 0), array(1, 1, 3), array(1, 1, 1), array(1, 1, 3), array(1, 0, 2), array(1, 1, 1)), 0, array('2', '4')), - "6 lines limit" => array(2, 4, array(array(1, 0, 0), array(1, 1, 3), array(1, 1, 1), array(1, 1, 1), array(1, 0, 0), array(1, 1, 1)), 1, array('2')), - ); + return [ + "1 line" => [1, 1, [[1, 0, 0]], 0, ['1']], + "2 same lines" => [1, 1, [[1, 0, 0], [1, 0, 0]], 0, ['2']], + "2 diff lines" => [2, 2, [[1, 0, 0], [1, 1, 1]], 0, ['1', '1']], + "4 lines" => [2, 2, [[1, 0, 0], [1, 1, 1], [1, 0, 0], [1, 1, 1]], 0, ['2', '2']], + "5 lines" => [2, 2, [[1, 0, 0], [1, 0, 0], [1, 1, 1], [1, 0, 0], [1, 1, 1]], 0, ['2', '3']], + "6 lines" => [2, 4, [[1, 0, 0], [1, 1, 3], [1, 1, 1], [1, 1, 3], [1, 0, 2], [1, 1, 1]], 0, ['2', '4']], + "6 lines limit" => [2, 4, [[1, 0, 0], [1, 1, 3], [1, 1, 1], [1, 1, 1], [1, 0, 0], [1, 1, 1]], 1, ['2']], + ]; } /** @@ -133,32 +130,28 @@ class DBSearchTest extends ItopDataTestCase */ private function init_db($iOrgNb, $iPersonNb, $aReq) { - $aOrgIds = array(); + $aOrgIds = []; $sOrgs = ''; - for($i = 0; $i < $iOrgNb; $i++) - { + for ($i = 0; $i < $iOrgNb; $i++) { $oObj = $this->CreateOrganization('UnitTest_Org'.$i); $sKey = $oObj->GetKey(); $aOrgIds[] = $sKey; - if ($i > 0) - { + if ($i > 0) { $sOrgs .= ","; } $sOrgs .= $sKey; } self::assertEquals($iOrgNb, count($aOrgIds)); - $aPersonIds = array(); - for($i = 0; $i < $iPersonNb; $i++) - { + $aPersonIds = []; + for ($i = 0; $i < $iPersonNb; $i++) { $oObj = $this->CreatePerson($i, $aOrgIds[$i % $iOrgNb]); $aPersonIds[] = $oObj->GetKey(); } self::assertEquals($iPersonNb, count($aPersonIds)); $i = 0; - foreach($aReq as $aParams) - { + foreach ($aReq as $aParams) { $oObj = $this->CreateUserRequest($i, [ 'time_spent' => $aParams[0], 'org_id' => $aOrgIds[$aParams[1]], @@ -180,31 +173,30 @@ class DBSearchTest extends ItopDataTestCase $this->CreatePhysicalInterface(1, 1000, $oServer->GetKey()); $this->CreateFiberChannelInterface(1, 1000, $oServer->GetKey()); - $oSearch = DBSearch::FromOQL("SELECT FiberChannelInterface AS FCI WHERE FCI.name = '1' UNION SELECT PhysicalInterface AS PHI WHERE PHI.name = '1'"); self::assertNotNull($oSearch); $oExpr1 = Expression::FromOQL('FCI.name'); // Alias => Expression (first select reference) - $aGroupBy = array('group1' => $oExpr1); + $aGroupBy = ['group1' => $oExpr1]; $oTimeExpr = Expression::FromOQL('FCI.speed'); - $oSumExpr = new FunctionExpression('SUM', array($oTimeExpr)); - $oAvgExpr = new FunctionExpression('AVG', array($oTimeExpr)); - $oMinExpr = new FunctionExpression('MIN', array($oTimeExpr)); - $oMaxExpr = new FunctionExpression('MAX', array($oTimeExpr)); + $oSumExpr = new FunctionExpression('SUM', [$oTimeExpr]); + $oAvgExpr = new FunctionExpression('AVG', [$oTimeExpr]); + $oMinExpr = new FunctionExpression('MIN', [$oTimeExpr]); + $oMaxExpr = new FunctionExpression('MAX', [$oTimeExpr]); // Alias => Expression - $aFunctions = array( + $aFunctions = [ '_itop_sum_' => $oSumExpr, '_itop_avg_' => $oAvgExpr, '_itop_min_' => $oMinExpr, '_itop_max_' => $oMaxExpr, - ); + ]; // Alias => Order - $aOrderBy = array('group1' => true, '_itop_count_' => true); + $aOrderBy = ['group1' => true, '_itop_count_' => true]; - $aArgs = array(); + $aArgs = []; $sSQL = $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy); $this->debug($sSQL); @@ -224,34 +216,34 @@ class DBSearchTest extends ItopDataTestCase // Alias => Expression (first select reference) $oExpr1 = Expression::FromOQL('FiberChannelInterface.name'); - $aGroupBy = array('group1' => $oExpr1); + $aGroupBy = ['group1' => $oExpr1]; $oTimeExpr = Expression::FromOQL('FiberChannelInterface.speed'); - $oSumExpr = new FunctionExpression('SUM', array($oTimeExpr)); - $oAvgExpr = new FunctionExpression('AVG', array($oTimeExpr)); - $oMinExpr = new FunctionExpression('MIN', array($oTimeExpr)); - $oMaxExpr = new FunctionExpression('MAX', array($oTimeExpr)); + $oSumExpr = new FunctionExpression('SUM', [$oTimeExpr]); + $oAvgExpr = new FunctionExpression('AVG', [$oTimeExpr]); + $oMinExpr = new FunctionExpression('MIN', [$oTimeExpr]); + $oMaxExpr = new FunctionExpression('MAX', [$oTimeExpr]); // Alias => Expression - $aFunctions = array( + $aFunctions = [ '_itop_sum_' => $oSumExpr, '_itop_avg_' => $oAvgExpr, '_itop_min_' => $oMinExpr, '_itop_max_' => $oMaxExpr, - ); - $aArgs = array(); + ]; + $aArgs = []; // Alias => Order - $aOrderBy = array( + $aOrderBy = [ 'group1' => true, '_itop_sum_' => true, '_itop_avg_' => true, '_itop_min_' => true, - '_itop_max_' => true); + '_itop_max_' => true]; $sSQL = $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy); self::assertNotEmpty($sSQL); // Alias => Order - $aOrderBy = array('nothing_good' => true); + $aOrderBy = ['nothing_good' => true]; $this->expectException("CoreException"); $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy); @@ -268,29 +260,29 @@ class DBSearchTest extends ItopDataTestCase $oExpr1 = Expression::FromOQL('FCI.name'); // Alias => Expression (first select reference) - $aGroupBy = array('group1' => $oExpr1); + $aGroupBy = ['group1' => $oExpr1]; $oTimeExpr = Expression::FromOQL('FCI.speed'); - $oSumExpr = new FunctionExpression('SUM', array($oTimeExpr)); - $oAvgExpr = new FunctionExpression('AVG', array($oTimeExpr)); - $oMinExpr = new FunctionExpression('MIN', array($oTimeExpr)); - $oMaxExpr = new FunctionExpression('MAX', array($oTimeExpr)); + $oSumExpr = new FunctionExpression('SUM', [$oTimeExpr]); + $oAvgExpr = new FunctionExpression('AVG', [$oTimeExpr]); + $oMinExpr = new FunctionExpression('MIN', [$oTimeExpr]); + $oMaxExpr = new FunctionExpression('MAX', [$oTimeExpr]); // Alias => Expression - $aFunctions = array( + $aFunctions = [ '_itop_sum_' => $oSumExpr, '_itop_avg_' => $oAvgExpr, 'group1' => $oMinExpr, '_itop_max_' => $oMaxExpr, - ); - $aArgs = array(); + ]; + $aArgs = []; // Alias => Order - $aOrderBy = array( + $aOrderBy = [ 'group1' => true, '_itop_sum_' => true, '_itop_avg_' => true, '_itop_min_' => true, - '_itop_max_' => true); + '_itop_max_' => true]; $this->expectException("CoreException"); $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy); @@ -308,34 +300,34 @@ class DBSearchTest extends ItopDataTestCase // Alias => Expression (first select reference) $oExpr1 = Expression::FromOQL('FCI.name'); - $aGroupBy = array('group1' => $oExpr1); + $aGroupBy = ['group1' => $oExpr1]; $oTimeExpr = Expression::FromOQL('FCI.speed'); - $oSumExpr = new FunctionExpression('SUM', array($oTimeExpr)); - $oAvgExpr = new FunctionExpression('AVG', array($oTimeExpr)); - $oMinExpr = new FunctionExpression('MIN', array($oTimeExpr)); - $oMaxExpr = new FunctionExpression('MAX', array($oTimeExpr)); + $oSumExpr = new FunctionExpression('SUM', [$oTimeExpr]); + $oAvgExpr = new FunctionExpression('AVG', [$oTimeExpr]); + $oMinExpr = new FunctionExpression('MIN', [$oTimeExpr]); + $oMaxExpr = new FunctionExpression('MAX', [$oTimeExpr]); // Alias => Expression - $aFunctions = array( + $aFunctions = [ '_itop_sum_' => $oSumExpr, '_itop_avg_' => $oAvgExpr, '_itop_min_' => $oMinExpr, '_itop_max_' => $oMaxExpr, - ); - $aArgs = array(); + ]; + $aArgs = []; // Alias => Order - $aOrderBy = array( + $aOrderBy = [ 'group1' => true, '_itop_sum_' => true, '_itop_avg_' => true, '_itop_min_' => true, - '_itop_max_' => true); + '_itop_max_' => true]; $sSQL = $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy); self::assertNotEmpty($sSQL); - $aGroupBy = array('group1' => 'FCI.name'); + $aGroupBy = ['group1' => 'FCI.name']; $this->expectException("CoreException"); $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy); @@ -352,39 +344,39 @@ class DBSearchTest extends ItopDataTestCase // Alias => Expression (first select reference) $oExpr1 = Expression::FromOQL('FCI.name'); - $aGroupBy = array('group1' => $oExpr1); + $aGroupBy = ['group1' => $oExpr1]; $oTimeExpr = Expression::FromOQL('FCI.speed'); - $oSumExpr = new FunctionExpression('SUM', array($oTimeExpr)); - $oAvgExpr = new FunctionExpression('AVG', array($oTimeExpr)); - $oMinExpr = new FunctionExpression('MIN', array($oTimeExpr)); - $oMaxExpr = new FunctionExpression('MAX', array($oTimeExpr)); + $oSumExpr = new FunctionExpression('SUM', [$oTimeExpr]); + $oAvgExpr = new FunctionExpression('AVG', [$oTimeExpr]); + $oMinExpr = new FunctionExpression('MIN', [$oTimeExpr]); + $oMaxExpr = new FunctionExpression('MAX', [$oTimeExpr]); // Alias => Expression - $aFunctions = array( + $aFunctions = [ '_itop_sum_' => $oSumExpr, '_itop_avg_' => $oAvgExpr, '_itop_min_' => $oMinExpr, '_itop_max_' => $oMaxExpr, - ); - $aArgs = array(); + ]; + $aArgs = []; // Alias => Order - $aOrderBy = array( + $aOrderBy = [ 'group1' => true, '_itop_sum_' => true, '_itop_avg_' => true, '_itop_min_' => true, - '_itop_max_' => true); + '_itop_max_' => true]; $sSQL = $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy); self::assertNotEmpty($sSQL); - $aFunctions = array( + $aFunctions = [ '_itop_sum_' => 'SumExpr', '_itop_avg_' => $oAvgExpr, '_itop_min_' => $oMinExpr, '_itop_max_' => $oMaxExpr, - ); + ]; $this->expectException("CoreException"); $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy); @@ -402,39 +394,39 @@ class DBSearchTest extends ItopDataTestCase // Alias => Expression (first select reference) $oExpr1 = Expression::FromOQL('FCI.name'); - $aGroupBy = array('group1' => $oExpr1); + $aGroupBy = ['group1' => $oExpr1]; $oTimeExpr = Expression::FromOQL('FCI.speed'); - $oSumExpr = new FunctionExpression('SUM', array($oTimeExpr)); - $oAvgExpr = new FunctionExpression('AVG', array($oTimeExpr)); - $oMinExpr = new FunctionExpression('MIN', array($oTimeExpr)); - $oMaxExpr = new FunctionExpression('MAX', array($oTimeExpr)); + $oSumExpr = new FunctionExpression('SUM', [$oTimeExpr]); + $oAvgExpr = new FunctionExpression('AVG', [$oTimeExpr]); + $oMinExpr = new FunctionExpression('MIN', [$oTimeExpr]); + $oMaxExpr = new FunctionExpression('MAX', [$oTimeExpr]); // Alias => Expression - $aFunctions = array( + $aFunctions = [ '_itop_sum_' => $oSumExpr, '_itop_avg_' => $oAvgExpr, '_itop_min_' => $oMinExpr, '_itop_max_' => $oMaxExpr, - ); - $aArgs = array(); + ]; + $aArgs = []; // Alias => Order - $aOrderBy = array( + $aOrderBy = [ 'group1' => true, '_itop_sum_' => true, '_itop_avg_' => true, '_itop_min_' => true, - '_itop_max_' => true); + '_itop_max_' => true]; $sSQL = $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy); self::assertNotEmpty($sSQL); - $aOrderBy = array( + $aOrderBy = [ 'group1' => true, '_itop_sum_' => true, '_itop_avg_' => 'ASC', '_itop_min_' => true, - '_itop_max_' => true); + '_itop_max_' => true]; $this->expectException("CoreException"); $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy); @@ -452,34 +444,34 @@ class DBSearchTest extends ItopDataTestCase // Alias => Expression (first select reference) $oExpr1 = Expression::FromOQL('FCI.name'); - $aGroupBy = array('group1' => $oExpr1); + $aGroupBy = ['group1' => $oExpr1]; $oTimeExpr = Expression::FromOQL('FCI.speed'); - $oSumExpr = new FunctionExpression('SUM', array($oTimeExpr)); - $oAvgExpr = new FunctionExpression('AVG', array($oTimeExpr)); - $oMinExpr = new FunctionExpression('MIN', array($oTimeExpr)); - $oMaxExpr = new FunctionExpression('MAX', array($oTimeExpr)); + $oSumExpr = new FunctionExpression('SUM', [$oTimeExpr]); + $oAvgExpr = new FunctionExpression('AVG', [$oTimeExpr]); + $oMinExpr = new FunctionExpression('MIN', [$oTimeExpr]); + $oMaxExpr = new FunctionExpression('MAX', [$oTimeExpr]); // Alias => Expression - $aFunctions = array( + $aFunctions = [ '_itop_sum_' => $oSumExpr, '_itop_avg_' => $oAvgExpr, '_itop_min_' => $oMinExpr, '_itop_max_' => $oMaxExpr, - ); - $aArgs = array(); + ]; + $aArgs = []; // Alias => Order - $aOrderBy = array( + $aOrderBy = [ 'group1' => true, '_itop_sum_' => true, '_itop_avg_' => true, '_itop_min_' => true, - '_itop_max_' => true); + '_itop_max_' => true]; $sSQL = $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy); self::assertNotEmpty($sSQL); // Alias => Order - $aOrderBy = array('nothing_good' => true); + $aOrderBy = ['nothing_good' => true]; $this->expectException("CoreException"); $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy); @@ -493,29 +485,28 @@ class DBSearchTest extends ItopDataTestCase */ public function testNoGroupBy() { - $aReq = array(array(1, 0, 0), array(1, 1, 3), array(1, 1, 1), array(1, 1, 1), array(1, 0, 0), array(1, 1, 1)); + $aReq = [[1, 0, 0], [1, 1, 3], [1, 1, 1], [1, 1, 1], [1, 0, 0], [1, 1, 1]]; $sOrgs = $this->init_db(2, 4, $aReq); $oSearch = DBSearch::FromOQL("SELECT UserRequest WHERE org_id IN ($sOrgs)"); self::assertNotNull($oSearch); - $oTimeExpr = Expression::FromOQL('UserRequest.time_spent'); - $oSumExpr = new FunctionExpression('SUM', array($oTimeExpr)); - $oAvgExpr = new FunctionExpression('AVG', array($oTimeExpr)); - $oMinExpr = new FunctionExpression('MIN', array($oTimeExpr)); - $oMaxExpr = new FunctionExpression('MAX', array($oTimeExpr)); + $oSumExpr = new FunctionExpression('SUM', [$oTimeExpr]); + $oAvgExpr = new FunctionExpression('AVG', [$oTimeExpr]); + $oMinExpr = new FunctionExpression('MIN', [$oTimeExpr]); + $oMaxExpr = new FunctionExpression('MAX', [$oTimeExpr]); // Alias => Expression - $aFunctions = array( + $aFunctions = [ '_itop_sum_' => $oSumExpr, '_itop_avg_' => $oAvgExpr, '_itop_min_' => $oMinExpr, '_itop_max_' => $oMaxExpr, - ); + ]; - $aGroupBy = array(); - $aOrderBy = array(); - $aArgs = array(); + $aGroupBy = []; + $aOrderBy = []; + $aArgs = []; $sSQL = $oSearch->MakeGroupByQuery($aArgs, $aGroupBy, false, $aFunctions, $aOrderBy, 0); $this->debug($sSQL); @@ -546,18 +537,14 @@ class DBSearchTest extends ItopDataTestCase $oSearch = DBSearch::FromOQL($sOql); $bHasThrownException = false; - try - { + try { $oFirstResult = $oSearch->GetFirstResult($bMustHaveOneResultMax); - } - catch (CoreOqlMultipleResultsForbiddenException $e) - { + } catch (CoreOqlMultipleResultsForbiddenException $e) { $oFirstResult = null; $bHasThrownException = true; } - switch ($sReturn) - { + switch ($sReturn) { case 'exception': self::assertEquals(true, $bHasThrownException, 'Exception raised'); break; @@ -572,33 +559,33 @@ class DBSearchTest extends ItopDataTestCase public function GetFirstResultProvider() { - return array( - 'One result' => array( + return [ + 'One result' => [ 'SELECT Person WHERE id = 1', false, 'object', - ), - 'Multiple results, no exception' => array( + ], + 'Multiple results, no exception' => [ 'SELECT Person', false, 'object', - ), - 'Multiple results, with exception' => array( + ], + 'Multiple results, with exception' => [ 'SELECT Person', true, 'exception', - ), - 'Multiple results with "WHERE 1", with exception' => array( + ], + 'Multiple results with "WHERE 1", with exception' => [ 'SELECT Person WHERE 1', true, 'exception', - ), - 'No result' => array( + ], + 'No result' => [ 'SELECT Person WHERE id = -1', true, 'null', - ), - ); + ], + ]; } /** @@ -610,14 +597,11 @@ class DBSearchTest extends ItopDataTestCase $oSearch = DBSearch::FromOQL("SELECT FiberChannelInterface AS FCI"); self::assertNotNull($oSearch); - try - { + try { $oExpr1 = Expression::FromOQL('AVC(FCI.name)'); //$aGroupBy = array('group1' => $oExpr1); //$oSearch->MakeGroupByQuery(array(), $aGroupBy, false, array(), array()); - } - catch (Exception $e) - { + } catch (Exception $e) { $sExceptionClass = get_class($e); } @@ -627,13 +611,10 @@ class DBSearchTest extends ItopDataTestCase public function testSanity_GroupFunction_In_GroupByPart() { $sExceptionClass = ''; - try - { + try { $oSearch = DBSearch::FromOQL("SELECT FiberChannelInterface AS FCI WHERE COUNT(FCI.name) = AVC(FCI.name)"); //$oSearch->MakeGroupByQuery(array(), array(), false, array(), array()); - } - catch (Exception $e) - { + } catch (Exception $e) { $sExceptionClass = get_class($e); } @@ -643,19 +624,16 @@ class DBSearchTest extends ItopDataTestCase public function testSanity_UnknownGroupFunction_In_SelectPart() { $sExceptionClass = ''; - try - { + try { $oTimeExpr = Expression::FromOQL('FCI.speed'); - $oWrongExpr = new FunctionExpression('GABUZOMEU', array($oTimeExpr)); + $oWrongExpr = new FunctionExpression('GABUZOMEU', [$oTimeExpr]); // Alias => Expression - $aFunctions = array( + $aFunctions = [ '_itop_wrong_' => $oWrongExpr, - ); + ]; $oSearch = DBSearch::FromOQL("SELECT FiberChannelInterface AS FCI"); - $oSearch->MakeGroupByQuery(array(), array(), false, $aFunctions, array()); - } - catch (Exception $e) - { + $oSearch->MakeGroupByQuery([], [], false, $aFunctions, []); + } catch (Exception $e) { $sExceptionClass = get_class($e); } @@ -673,14 +651,14 @@ class DBSearchTest extends ItopDataTestCase */ public function testSelectInWithVariableExpressions() { - $aReq = array(array(1, 0, 0), array(1, 1, 3), array(1, 2, 1), array(1, 0, 1), array(1, 1, 0), array(1, 2, 1)); + $aReq = [[1, 0, 0], [1, 1, 3], [1, 2, 1], [1, 0, 1], [1, 1, 0], [1, 2, 1]]; $sOrgs = $this->init_db(3, 4, $aReq); $allOrgIds = explode(",", $sOrgs); - $TwoOrgIdsOnly = array($allOrgIds[0], $allOrgIds[1]); + $TwoOrgIdsOnly = [$allOrgIds[0], $allOrgIds[1]]; $oSearch = DBSearch::FromOQL("SELECT UserRequest WHERE org_id IN (:org_ids)"); self::assertNotNull($oSearch); - $oSet = new \CMDBObjectSet($oSearch, array(), array('org_ids' => $TwoOrgIdsOnly)); + $oSet = new \CMDBObjectSet($oSearch, [], ['org_ids' => $TwoOrgIdsOnly]); static::assertEquals(4, $oSet->Count()); // Content now generated with ajax call @@ -703,7 +681,8 @@ class DBSearchTest extends ItopDataTestCase /** * @since 2.7.2 3.0.0 N°3324 */ - public function testAllowAllData() { + public function testAllowAllData() + { $oSimpleSearch = \DBObjectSearch::FromOQL('SELECT FunctionalCI'); $oSimpleSearch->AllowAllData(false); self::assertFalse($oSimpleSearch->IsAllDataAllowed(), 'DBSearch AllowData value'); @@ -715,7 +694,8 @@ class DBSearchTest extends ItopDataTestCase $this->CheckNestedSearch($sNestedQuery, false); } - private function CheckNestedSearch($sQuery, $bAllowAllData) { + private function CheckNestedSearch($sQuery, $bAllowAllData) + { $oNestedQuerySearch = \DBObjectSearch::FromOQL($sQuery); $oNestedQuerySearch->AllowAllData($bAllowAllData); self::assertEquals($bAllowAllData, $oNestedQuerySearch->IsAllDataAllowed(), 'root DBSearch AllowData value'); @@ -746,110 +726,111 @@ class DBSearchTest extends ItopDataTestCase $oSearch->MakeSelectQuery(); self::assertTrue(true); } - /** - * @dataProvider QueriesProvider - * @param $sOQL - * - * @return void - */ - public function testQueries($sOQL) - { - $oSearch = DBSearch::FromOQL($sOQL); - $oSet = new DBObjectSet($oSearch); - if ($oSet->Count() > 0) { - $aSelectedAliases = array_keys($oSearch->GetSelectedClasses()); - $aFirstRow = $oSet->FetchAssoc(); - $aAliases = array_keys($aFirstRow); - $this->assertEquals($aSelectedAliases, $aAliases); - } - } + /** + * @dataProvider QueriesProvider + * @param $sOQL + * + * @return void + */ + public function testQueries($sOQL) + { + $oSearch = DBSearch::FromOQL($sOQL); + $oSet = new DBObjectSet($oSearch); + if ($oSet->Count() > 0) { + $aSelectedAliases = array_keys($oSearch->GetSelectedClasses()); + $aFirstRow = $oSet->FetchAssoc(); + $aAliases = array_keys($aFirstRow); + $this->assertEquals($aSelectedAliases, $aAliases); + } + } - public function QueriesProvider() - { - return [ - ['SELECT L,P FROM Person AS P JOIN Location AS L ON P.location_id=L.id'], - ['SELECT P,L FROM Person AS P JOIN Location AS L ON P.location_id=L.id'], - ]; - } - public function SelectAttributeToArrayProvider() - { - return array( - 'select id from FunctionalCI' => array( - 'SELECT FunctionalCI', - 'id', - ), - 'select name from FunctionalCI' => array( - 'SELECT FunctionalCI', - 'name', - ), - 'select org_id from FunctionalCI' => array( - 'SELECT FunctionalCI', - 'org_id', - ), - 'select organization_name from FunctionalCI' => array( - 'SELECT FunctionalCI', - 'organization_name', - ), - 'select business_criticity from FunctionalCI' => array( - 'SELECT FunctionalCI', - 'business_criticity', - ), - 'select org_id from FunctionalCI' => array( - 'SELECT FunctionalCI', - 'org_id', - ), - 'select email from Person' => array( - 'SELECT Person', - 'email', - ), - 'select phone from Person' => array( - 'SELECT Person', - 'phone', - ), - 'select picture from Person' => array( - 'SELECT Person', - 'picture', - ), - 'select description from Ticket' => array( - 'SELECT Ticket', - 'description', - ), - 'select start_date from Ticket' => array( - 'SELECT Ticket', - 'start_date', - ), - 'select private_log from Ticket' => array( - 'SELECT Ticket', - 'private_log', - ), - ); - } + public function QueriesProvider() + { + return [ + ['SELECT L,P FROM Person AS P JOIN Location AS L ON P.location_id=L.id'], + ['SELECT P,L FROM Person AS P JOIN Location AS L ON P.location_id=L.id'], + ]; + } + public function SelectAttributeToArrayProvider() + { + return [ + 'select id from FunctionalCI' => [ + 'SELECT FunctionalCI', + 'id', + ], + 'select name from FunctionalCI' => [ + 'SELECT FunctionalCI', + 'name', + ], + 'select org_id from FunctionalCI' => [ + 'SELECT FunctionalCI', + 'org_id', + ], + 'select organization_name from FunctionalCI' => [ + 'SELECT FunctionalCI', + 'organization_name', + ], + 'select business_criticity from FunctionalCI' => [ + 'SELECT FunctionalCI', + 'business_criticity', + ], + 'select org_id from FunctionalCI' => [ + 'SELECT FunctionalCI', + 'org_id', + ], + 'select email from Person' => [ + 'SELECT Person', + 'email', + ], + 'select phone from Person' => [ + 'SELECT Person', + 'phone', + ], + 'select picture from Person' => [ + 'SELECT Person', + 'picture', + ], + 'select description from Ticket' => [ + 'SELECT Ticket', + 'description', + ], + 'select start_date from Ticket' => [ + 'SELECT Ticket', + 'start_date', + ], + 'select private_log from Ticket' => [ + 'SELECT Ticket', + 'private_log', + ], + ]; + } - /** - * @dataProvider SelectAttributeToArrayProvider - * - * @return void - * @throws \ConfigException - * @throws \CoreException - * @throws \MissingQueryArgument - * @throws \MySQLException - * @throws \MySQLHasGoneAwayException - * @throws \OQLException - */ - public function testSelectAttributeToArray($sQuery, $sField){ + /** + * @dataProvider SelectAttributeToArrayProvider + * + * @return void + * @throws \ConfigException + * @throws \CoreException + * @throws \MissingQueryArgument + * @throws \MySQLException + * @throws \MySQLHasGoneAwayException + * @throws \OQLException + */ + public function testSelectAttributeToArray($sQuery, $sField) + { $oSearch = \DBObjectSearch::FromOQL($sQuery); - $aResToDataArray=[]; - $oSet = new \DBObjectSet($oSearch); - while ($oRecord = $oSet->Fetch()) { - $aMappedRow[$sField] =$oRecord->Get($sField); - $aResToDataArray[] = $aMappedRow; - } - array_multisort (array_column($aResToDataArray, $sField), SORT_DESC, $aResToDataArray); + $aResToDataArray = []; + $oSet = new \DBObjectSet($oSearch); + while ($oRecord = $oSet->Fetch()) { + $aMappedRow[$sField] = $oRecord->Get($sField); + $aResToDataArray[] = $aMappedRow; + } + array_multisort(array_column($aResToDataArray, $sField), SORT_DESC, $aResToDataArray); $aResSelectColumnToArray = $oSearch->SelectAttributeToArray($sField); - array_multisort (array_column($aResSelectColumnToArray, $sField), SORT_DESC, $aResSelectColumnToArray); + array_multisort(array_column($aResSelectColumnToArray, $sField), SORT_DESC, $aResSelectColumnToArray); - self::assertEquals( $aResToDataArray, $aResSelectColumnToArray, 'The array constructed using the OQL query and the result of testSelectAttributeToArray must be the same'); - } -} \ No newline at end of file + self::assertEquals($aResToDataArray, $aResSelectColumnToArray, 'The array constructed using the OQL query and the result of testSelectAttributeToArray must be the same'); + } +} diff --git a/tests/php-unit-tests/unitary-tests/core/DBSearchUpdateRealiasingMapTest.php b/tests/php-unit-tests/unitary-tests/core/DBSearchUpdateRealiasingMapTest.php index 44670c985..660799200 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBSearchUpdateRealiasingMapTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBSearchUpdateRealiasingMapTest.php @@ -5,7 +5,6 @@ namespace Combodo\iTop\Test\UnitTest\Core; use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use DBObjectSearch; - /** * Class DBSearchUpdateRealiasingMapTest * @@ -13,7 +12,7 @@ use DBObjectSearch; */ class DBSearchUpdateRealiasingMapTest extends ItopDataTestCase { - const USE_TRANSACTION = false; + public const USE_TRANSACTION = false; protected function setUp(): void { @@ -41,37 +40,37 @@ class DBSearchUpdateRealiasingMapTest extends ItopDataTestCase 'empty' => [ 'OriginalMap' => null, 'AliasTranslation' => [], - 'ExpectedMap' => null + 'ExpectedMap' => null, ], 'Add 1 alias' => [ 'OriginalMap' => [], 'AliasTranslation' => ['a' => ['*' => 'b']], - 'ExpectedMap' => ['a' => ['b']] + 'ExpectedMap' => ['a' => ['b']], ], 'Add 2 aliases' => [ 'OriginalMap' => [], 'AliasTranslation' => ['a' => ['*' => 'b'], 'c' => ['*' => 'd']], - 'ExpectedMap' => ['a' => ['b'], 'c' => ['d']] + 'ExpectedMap' => ['a' => ['b'], 'c' => ['d']], ], 'Append 1 alias' => [ 'OriginalMap' => ['a' => ['b']], 'AliasTranslation' => ['c' => ['*' => 'd']], - 'ExpectedMap' => ['a' => ['b'], 'c' => ['d']] + 'ExpectedMap' => ['a' => ['b'], 'c' => ['d']], ], 'Merge 1 alias' => [ 'OriginalMap' => ['a' => ['b']], 'AliasTranslation' => ['a' => ['*' => 'd']], - 'ExpectedMap' => ['a' => ['b', 'd']] + 'ExpectedMap' => ['a' => ['b', 'd']], ], 'Merge same alias' => [ 'OriginalMap' => ['a' => ['b']], 'AliasTranslation' => ['a' => ['*' => 'b']], - 'ExpectedMap' => ['a' => ['b']] + 'ExpectedMap' => ['a' => ['b']], ], 'Transitivity a->b + b->f = a->f' => [ 'OriginalMap' => ['a' => ['b', 'd'], 'c' => ['e']], 'AliasTranslation' => ['b' => ['*' => 'f']], - 'ExpectedMap' => ['a' => ['f', 'd'], 'c' => ['e']] + 'ExpectedMap' => ['a' => ['f', 'd'], 'c' => ['e']], ], ]; } diff --git a/tests/php-unit-tests/unitary-tests/core/DBUnionSearchTest.php b/tests/php-unit-tests/unitary-tests/core/DBUnionSearchTest.php index e5aac5783..e6501c7c1 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBUnionSearchTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBUnionSearchTest.php @@ -1,15 +1,14 @@ Get('email_transport'); $sCurrentEmailAsync = $oConfig->Get('email_asynchronous'); - + // Set our email transport to file, so we can read it after $oConfig->Set('email_transport', 'LogFile'); $oConfig->Set('email_asynchronous', false); @@ -30,17 +30,17 @@ class EMailTest extends ItopTestCase { $oEmail->SetRecipientFrom('email2@email2.com'); $oEmail->SetSubject('dummy subject'); $oEmail->SetBody('dummy body'); - + // Send the mail and check if there's any issue $aIssues = []; $oEmail->Send($aIssues); $this->assertEmpty($aIssues); - + // Check if our charset is correctly set // We know this file may be used by other future test, but as we can't configure output filename, it is what it is $sEmailContent = file_get_contents(APPROOT.'log/mail.log'); $this->assertStringContainsStringIgnoringCase('charset=UTF-8', $sEmailContent); - + // Set our previous email transport value back, so it doesn't affect other tests $oConfig->Set('email_transport', $sCurrentEmailTransport); $oConfig->Set('email_asynchronous', $sCurrentEmailAsync); @@ -84,4 +84,4 @@ class EMailTest extends ItopTestCase { $oConfig->Set('email_transport', $sCurrentEmailTransport); $oConfig->Set('email_asynchronous', $sCurrentEmailAsync); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/EventIssueTest.php b/tests/php-unit-tests/unitary-tests/core/EventIssueTest.php index 400a37180..2fb567341 100644 --- a/tests/php-unit-tests/unitary-tests/core/EventIssueTest.php +++ b/tests/php-unit-tests/unitary-tests/core/EventIssueTest.php @@ -60,10 +60,9 @@ class EventIssueTest extends ItopDataTestCase try { $oEventIssue->DBInsert(); - } - catch (CoreException $e) { + } catch (CoreException $e) { $this->fail('we should be able to persist the object though it contains long values in its attributes: '.$e->getMessage()); } $this->assertTrue(true); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/ExpressionEvaluateTest.php b/tests/php-unit-tests/unitary-tests/core/ExpressionEvaluateTest.php index 2c0951e4c..c56bcff47 100644 --- a/tests/php-unit-tests/unitary-tests/core/ExpressionEvaluateTest.php +++ b/tests/php-unit-tests/unitary-tests/core/ExpressionEvaluateTest.php @@ -1,9 +1,7 @@ left + :this->right', null, array('this->left', 'this->right')), - array(':this->left + :this->right', 'this', array('left', 'right')), - array(':this->left + :this->right', 'that', array()), - array(':this_left + :this_right', 'this', array()), - ); + return [ + ['1 AND 0 OR :hello + :world', null, ['hello', 'world']], + ['1 AND 0 OR :hello + :world', 'this', []], + [':this->left + :this->right', null, ['this->left', 'this->right']], + [':this->left + :this->right', 'this', ['left', 'right']], + [':this->left + :this->right', 'that', []], + [':this_left + :this_right', 'this', []], + ]; } /** @@ -59,8 +57,7 @@ class ExpressionEvaluateTest extends ItopDataTestCase public function _testExpressionEvaluateAllAtOnce() { $aTestCases = $this->VariousExpressionsProvider(); - foreach ($aTestCases as $sCaseId => $aTestArgs) - { + foreach ($aTestCases as $sCaseId => $aTestArgs) { $this->debug("Case $sCaseId:"); $this->testVariousExpressions($aTestArgs[0], $aTestArgs[1]); } @@ -80,141 +77,137 @@ class ExpressionEvaluateTest extends ItopDataTestCase public function testVariousExpressions($sExpression, $expectedValue) { $oExpression = Expression::FromOQL($sExpression); - $value = $oExpression->Evaluate(array()); + $value = $oExpression->Evaluate([]); $this->assertEquals($expectedValue, $value); } public function VariousExpressionsProvider() { - if (false) - { - $aExpressions = array( + if (false) { + $aExpressions = [ // Test case to isolate for troubleshooting purposes - array("'a' IN ('a', 'b')", true), - ); - } - else - { - $aExpressions = array( + ["'a' IN ('a', 'b')", true], + ]; + } else { + $aExpressions = [ // The bare minimum - array('"blah"', 'blah'), - array('"\\\\"', '\\'), + ['"blah"', 'blah'], + ['"\\\\"', '\\'], // Arithmetics - array('2+2', 4), - array('2+2-2', 2), - array('2*(3+4)', 14), - array('(2*3)+4', 10), - array('2*3+4', 10), + ['2+2', 4], + ['2+2-2', 2], + ['2*(3+4)', 14], + ['(2*3)+4', 10], + ['2*3+4', 10], // Strings - array("CONCAT('hello', 'world')", 'helloworld'), + ["CONCAT('hello', 'world')", 'helloworld'], // Not yet parsed - array("CONCAT_WS(' ', 'hello', 'world')", 'hello world'), - array("SUBSTR('abcdef', 2, 3)", 'bcd'), - array("TRIM(' Sin dolor ')", 'Sin dolor'), + ["SUBSTR('abcdef', 2, 3)", 'bcd'], + ["TRIM(' Sin dolor ')", 'Sin dolor'], // Comparison operators - array('1 = 1', 1), - array('1 != 1', 0), - array('0 = 1', 0), - array('0 != 1', 1), - array('2 > 1', 1), - array('2 < 1', 0), - array('1 > 2', 0), - array('2 > 1', 1), - array('2 >= 1', 1), - array('2 >= 2', 1), - array("'the quick brown dog' LIKE '%QUICK%'", 1), - array("'the quick brown dog' LIKE '%SLOW%'", 0), - array("'the quick brown dog' LIKE '%QU_CK%'", 1), - array("'the quick brown dog' LIKE '%QU_ICK%'", 0), - array('"400 (km/h)" LIKE "400%"', 1), - array('"400 (km/h)" LIKE "100%"', 0), - array('"400 (km/h)" NOT LIKE "400%"', 0), - array('"400 (km/h)" NOT LIKE "100%"', 1), - array('"2020-06-12" > "2020-06-11"', 1), - array('"2020-06-12" < "2020-06-11"', 0), - array('" 2020-06-12" > "2020-06-11"', 0), // Leading spaces => a string - array('" 2020-06-12 " > "2020-06-11"', 0), // Trailing spaces => a string - array('"2020-06-12 17:35:13" > "2020-06-12 17:35:12"', 1), - array('"2020-06-12 17:35:13" < "2020-06-12 17:35:12"', 0), - array('"2020-06-12 17:35:13" > "2020-06-12"', 1), - array('"2020-06-12 17:35:13" < "2020-06-12"', 0), - array('"2020-06-12 00:00:00" = "2020-06-12"', 0), + ['1 = 1', 1], + ['1 != 1', 0], + ['0 = 1', 0], + ['0 != 1', 1], + ['2 > 1', 1], + ['2 < 1', 0], + ['1 > 2', 0], + ['2 > 1', 1], + ['2 >= 1', 1], + ['2 >= 2', 1], + ["'the quick brown dog' LIKE '%QUICK%'", 1], + ["'the quick brown dog' LIKE '%SLOW%'", 0], + ["'the quick brown dog' LIKE '%QU_CK%'", 1], + ["'the quick brown dog' LIKE '%QU_ICK%'", 0], + ['"400 (km/h)" LIKE "400%"', 1], + ['"400 (km/h)" LIKE "100%"', 0], + ['"400 (km/h)" NOT LIKE "400%"', 0], + ['"400 (km/h)" NOT LIKE "100%"', 1], + ['"2020-06-12" > "2020-06-11"', 1], + ['"2020-06-12" < "2020-06-11"', 0], + ['" 2020-06-12" > "2020-06-11"', 0], // Leading spaces => a string + ['" 2020-06-12 " > "2020-06-11"', 0], // Trailing spaces => a string + ['"2020-06-12 17:35:13" > "2020-06-12 17:35:12"', 1], + ['"2020-06-12 17:35:13" < "2020-06-12 17:35:12"', 0], + ['"2020-06-12 17:35:13" > "2020-06-12"', 1], + ['"2020-06-12 17:35:13" < "2020-06-12"', 0], + ['"2020-06-12 00:00:00" = "2020-06-12"', 0], // IN operator - array("'a' IN ('a')", true), - array("'a' IN ('b')", false), - array("'a' IN ('a', 'b')", true), - array("'z' IN ('a', 'b')", false), - array("'a' NOT IN ('a')", false), - array("'a' NOT IN ('b')", true), - array("'a' NOT IN ('a', 'b')", false), - array("'z' NOT IN ('a', 'b')", true), + ["'a' IN ('a')", true], + ["'a' IN ('b')", false], + ["'a' IN ('a', 'b')", true], + ["'z' IN ('a', 'b')", false], + ["'a' NOT IN ('a')", false], + ["'a' NOT IN ('b')", true], + ["'a' NOT IN ('a', 'b')", false], + ["'z' NOT IN ('a', 'b')", true], // Logical operators - array('0 AND 0', 0), - array('1 AND 0', 0), - array('0 AND 1', 0), - array('1 AND 1', 1), - array('0 OR 0', 0), - array('0 OR 1', 1), - array('1 OR 0', 1), - array('1 OR 1', 1), - array('1 AND 0 OR 1', 1), + ['0 AND 0', 0], + ['1 AND 0', 0], + ['0 AND 1', 0], + ['1 AND 1', 1], + ['0 OR 0', 0], + ['0 OR 1', 1], + ['1 OR 0', 1], + ['1 OR 1', 1], + ['1 AND 0 OR 1', 1], // Casting - array('1 AND "blah"', 0), - array('1 AND "1"', 1), - array('1 AND "2"', 1), - array('1 AND "0"', 0), - array('1 AND "-1"', 1), + ['1 AND "blah"', 0], + ['1 AND "1"', 1], + ['1 AND "2"', 1], + ['1 AND "0"', 0], + ['1 AND "-1"', 1], // Null - array('NULL', null), - array('1 AND NULL', null), - array('CONCAT("Great but...", NULL)', null), - array('COALESCE(NULL, 123)', 123), - array('COALESCE(321, 123)', 321), - array('ISNULL(NULL)', 1), - array('ISNULL(123)', 0), + ['NULL', null], + ['1 AND NULL', null], + ['CONCAT("Great but...", NULL)', null], + ['COALESCE(NULL, 123)', 123], + ['COALESCE(321, 123)', 321], + ['ISNULL(NULL)', 1], + ['ISNULL(123)', 0], // Date functions - array("DATE('2020-03-12 13:18:30')", '2020-03-12'), - array("DATE_FORMAT('2009-10-04 22:23:00', '%Y %m %d %H %i %s')", '2009 10 04 22 23 00'), - array("DATE(NOW()) = CURRENT_DATE()", 1), // Could fail if executed around midnight! - array("TO_DAYS('2020-01-02')", 737791), - array("FROM_DAYS(737791)", '2020-01-02'), - array("FROM_DAYS(TO_DAYS('2020-01-02'))", '2020-01-02'), // Back and forth conversion to ensure it returns the same - array("YEAR('2020-05-03')", 2020), - array("MONTH('2020-05-03')", 5), - array("DAY('2020-05-03')", 3), - array("DATE_ADD('2020-02-28 18:00:00', INTERVAL 1 HOUR)", '2020-02-28 19:00:00'), - array("DATE_ADD('2020-02-28 18:00:00', INTERVAL 1 DAY)", '2020-02-29 18:00:00'), - array("DATE_SUB('2020-03-01 18:00:00', INTERVAL 1 HOUR)", '2020-03-01 17:00:00'), - array("DATE_SUB('2020-03-01 18:00:00', INTERVAL 1 DAY)", '2020-02-29 18:00:00'), + ["DATE('2020-03-12 13:18:30')", '2020-03-12'], + ["DATE_FORMAT('2009-10-04 22:23:00', '%Y %m %d %H %i %s')", '2009 10 04 22 23 00'], + ["DATE(NOW()) = CURRENT_DATE()", 1], // Could fail if executed around midnight! + ["TO_DAYS('2020-01-02')", 737791], + ["FROM_DAYS(737791)", '2020-01-02'], + ["FROM_DAYS(TO_DAYS('2020-01-02'))", '2020-01-02'], // Back and forth conversion to ensure it returns the same + ["YEAR('2020-05-03')", 2020], + ["MONTH('2020-05-03')", 5], + ["DAY('2020-05-03')", 3], + ["DATE_ADD('2020-02-28 18:00:00', INTERVAL 1 HOUR)", '2020-02-28 19:00:00'], + ["DATE_ADD('2020-02-28 18:00:00', INTERVAL 1 DAY)", '2020-02-29 18:00:00'], + ["DATE_SUB('2020-03-01 18:00:00', INTERVAL 1 HOUR)", '2020-03-01 17:00:00'], + ["DATE_SUB('2020-03-01 18:00:00', INTERVAL 1 DAY)", '2020-02-29 18:00:00'], // Misc. functions - array('IF(1, 123, 567)', 123), - array('IF(0, 123, 567)', 567), - array('ELT(3, "a", "b", "c")', 'c'), - array('ELT(0, "a", "b", "c")', null), - array('ELT(4, "a", "b", "c")', null), - array('INET_ATON("128.0.0.1")', 2147483649), - array('INET_NTOA(2147483649)', '128.0.0.1'), - ); + ['IF(1, 123, 567)', 123], + ['IF(0, 123, 567)', 567], + ['ELT(3, "a", "b", "c")', 'c'], + ['ELT(0, "a", "b", "c")', null], + ['ELT(4, "a", "b", "c")', null], + ['INET_ATON("128.0.0.1")', 2147483649], + ['INET_NTOA(2147483649)', '128.0.0.1'], + ]; // N°5985 - Test bidirectional conversion across the centuries to ensure that it works on PHP 7.4 => 8.2+ even though the bug has been fixed in PHP 8.1 but still exists in PHP 7.4 => 8.1 for ($iUpperYearBound = 1925; $iUpperYearBound <= 2100; $iUpperYearBound = $iUpperYearBound + 25) { - $aExpressions[] = array("FROM_DAYS(TO_DAYS('$iUpperYearBound-01-02'))", "$iUpperYearBound-01-02"); + $aExpressions[] = ["FROM_DAYS(TO_DAYS('$iUpperYearBound-01-02'))", "$iUpperYearBound-01-02"]; } } // Build a comprehensive index - $aRet = array(); - foreach ($aExpressions as $aExp) - { + $aRet = []; + foreach ($aExpressions as $aExp) { $aRet[$aExp[0]] = $aExp; } return $aRet; @@ -231,27 +224,26 @@ class ExpressionEvaluateTest extends ItopDataTestCase { $sNewExpression = "return $sExpression;"; $oExpression = eval($sNewExpression); - $res = $oExpression->Evaluate(array()); + $res = $oExpression->Evaluate([]); $this->assertEquals($expectedValue, $res); } public function NotYetParsableExpressionsProvider() { - $aExpressions = array( - array("new \\FunctionExpression('CONCAT_WS', array(new \\ScalarExpression(' '), new \\ScalarExpression('Hello'), new \ScalarExpression('world!')))", 'Hello world!'), - array("new \\ScalarExpression('windows\\system32')", 'windows\\system32'), - array("new \\BinaryExpression(new \\ScalarExpression('100%'), 'LIKE', new \\ScalarExpression('___\%'))", 1), - array("new \\BinaryExpression(new \ScalarExpression('1000'), 'LIKE', new \ScalarExpression('___\%'))", 0), + $aExpressions = [ + ["new \\FunctionExpression('CONCAT_WS', array(new \\ScalarExpression(' '), new \\ScalarExpression('Hello'), new \ScalarExpression('world!')))", 'Hello world!'], + ["new \\ScalarExpression('windows\\system32')", 'windows\\system32'], + ["new \\BinaryExpression(new \\ScalarExpression('100%'), 'LIKE', new \\ScalarExpression('___\%'))", 1], + ["new \\BinaryExpression(new \ScalarExpression('1000'), 'LIKE', new \ScalarExpression('___\%'))", 0], // Net yet parsed - array("TIME(NOW()) = CURRENT_TIME()", 1), // Not relevant // Not yet parsed - array("DATE_ADD('2020-02-28 18:00:00', INTERVAL 1 WEEK)", '2020-03-06 18:00:00'), // Not yet parsed - array("DATE_SUB('2020-03-01 18:00:00', INTERVAL 1 WEEK)", '2020-02-23 18:00:00'), // Not yet parsed - array('ROUND(1.2345, 2)', 1.23), // Not yet parsed - array('FLOOR(1.2)', 1), - ); + ]; // Build a comprehensive index - $aRet = array(); - foreach ($aExpressions as $aExp) - { + $aRet = []; + foreach ($aExpressions as $aExp) { $aRet[$aExp[0]] = $aExp; } return $aRet; @@ -269,17 +261,15 @@ class ExpressionEvaluateTest extends ItopDataTestCase $aTests = array_values($this->VariousExpressionsProvider()); // Expressions given as a PHP statement - foreach (array_values($this->NotYetParsableExpressionsProvider()) as $i => $aTest) - { + foreach (array_values($this->NotYetParsableExpressionsProvider()) as $i => $aTest) { $sNewExpression = "return {$aTest[0]};"; $oExpression = eval($sNewExpression); $sExpression = $oExpression->RenderExpression(true); - $aTests[] = array($sExpression, $aTest[1]); + $aTests[] = [$sExpression, $aTest[1]]; } - $aExpressions = array(); - foreach ($aTests as $i => $aTest) - { + $aExpressions = []; + foreach ($aTests as $i => $aTest) { $aExpressions[] = "{$aTest[0]} as test_$i"; } @@ -289,8 +279,7 @@ class ExpressionEvaluateTest extends ItopDataTestCase $this->debug($sQuery); $aResults = CMDBSource::QueryToArray($sQuery); - foreach ($aTests as $i => $aTest) - { + foreach ($aTests as $i => $aTest) { $value = $aResults[0]["test_$i"]; $expectedValue = $aTest[1]; $this->debug("Test #$i: {$aTests[$i][0]} => ".var_export($value, true)); @@ -352,15 +341,15 @@ class ExpressionEvaluateTest extends ItopDataTestCase public function ExpressionWithParametersProvider() { - return array( + return [ ['`DBVariables["analyze_sample_percentage"]` > 10', ['DBVariables["analyze_sample_percentage"]' => 20], true], ['`DataBase["DBDataSize"]`', ['DataBase["DBDataSize"]' => 4096], 4096], ['`FileSystem["ItopInstallationIntegrity"]`', ['FileSystem["ItopInstallationIntegrity"]' => 'not_conform'], 'not_conform'], ['`DBTablesInfo["attachment"].DataSize` > 100', ['DBTablesInfo["attachment"].DataSize' => 200], true], ['`DBTablesInfo[].DataSize` > 100', ['DBTablesInfo[].DataSize' => 50], false], ['(`DBTablesInfo[].DataSize` > 100) AND (`DBTablesInfo[].DataFree` * 100 / (`DBTablesInfo[].DataSize` + `DBTablesInfo[].IndexSize` + `DBTablesInfo[].DataFree`) > 10)', ['DBTablesInfo[].DataSize' => 200, 'DBTablesInfo[].DataFree' => 100, 'DBTablesInfo[].IndexSize' => 10], true], - array('CONCAT(SUBSTR(name, 4), " cause")', array('name' => 'noble'), 'le cause'), - ); + ['CONCAT(SUBSTR(name, 4), " cause")', ['name' => 'noble'], 'le cause'], + ]; } /** @@ -380,28 +369,24 @@ class ExpressionEvaluateTest extends ItopDataTestCase $oExpression = Expression::FromOQL($sExpression); $res = $oExpression->IsTrue(); - if ($bExpectTrue) - { + if ($bExpectTrue) { $this->assertTrue($res, 'arg: '.$sExpression); - } - else - { + } else { $this->assertFalse($res, 'arg: '.$sExpression); } } public function TrueExpressionsProvider() { - $aExpressions = array( - array('1', true), - array('0 OR 0', false), - array('1 AND 1', true), - array('1 AND (1 OR 0)', true) - ); + $aExpressions = [ + ['1', true], + ['0 OR 0', false], + ['1 AND 1', true], + ['1 AND (1 OR 0)', true], + ]; // Build a comprehensive index - $aRet = array(); - foreach ($aExpressions as $aExp) - { + $aRet = []; + foreach ($aExpressions as $aExp) { $aRet[$aExp[0]] = $aExp; } return $aRet; @@ -423,60 +408,56 @@ class ExpressionEvaluateTest extends ItopDataTestCase public function testTimeFormat($sFormat, $bProcessed, $sValueOrException) { $sDate = '2009-06-04 21:23:24'; - $oExpression = new FunctionExpression('DATE_FORMAT', array(new ScalarExpression($sDate), new ScalarExpression("%$sFormat"))); - if ($bProcessed) - { + $oExpression = new FunctionExpression('DATE_FORMAT', [new ScalarExpression($sDate), new ScalarExpression("%$sFormat")]); + if ($bProcessed) { $sqlValue = CMDBSource::QueryToScalar("SELECT DATE_FORMAT('$sDate', '%$sFormat')"); $this->assertEquals($sqlValue, $sValueOrException, 'Check test against MySQL'); - $res = $oExpression->Evaluate(array()); + $res = $oExpression->Evaluate([]); $this->assertEquals($sValueOrException, $res, 'Check evaluation'); - } - else - { + } else { static::expectException($sValueOrException); - $oExpression->Evaluate(array()); + $oExpression->Evaluate([]); } } public function TimeFormatsProvider() { - $aTests = array( - array('a', true, 'Thu'), - array('b', true, 'Jun'), - array('c', true, '6'), - array('D', true, '4th'), - array('d', true, '04'), - array('e', true, '4'), - array('f', false, 'NotYetEvaluatedExpression'), // microseconds: no way! - array('H', true, '21'), - array('h', true, '09'), - array('I', true, '09'), - array('i', true, '23'), - array('j', true, '155'), // day of the year - array('k', true, '21'), - array('l', true, '9'), - array('M', true, 'June'), - array('m', true, '06'), - array('p', true, 'PM'), - array('r', true, '09:23:24 PM'), - array('S', true, '24'), - array('s', true, '24'), - array('T', true, '21:23:24'), - array('U', false, 'NotYetEvaluatedExpression'), // Week sunday based (mode 0) - array('u', false, 'NotYetEvaluatedExpression'), // Week monday based (mode 1) - array('V', false, 'NotYetEvaluatedExpression'), // Week sunday based (mode 2) - array('v', true, '23'), // Week monday based (mode 3 - ISO-8601) - array('W', true, 'Thursday'), - array('w', true, '4'), - array('X', false, 'NotYetEvaluatedExpression'), - array('x', true, '2009'), // to be used with %v (ISO - 8601) - array('Y', true, '2009'), - array('y', true, '09'), - ); - $aRes = array(); - foreach ($aTests as $aTest) - { + $aTests = [ + ['a', true, 'Thu'], + ['b', true, 'Jun'], + ['c', true, '6'], + ['D', true, '4th'], + ['d', true, '04'], + ['e', true, '4'], + ['f', false, 'NotYetEvaluatedExpression'], // microseconds: no way! + ['H', true, '21'], + ['h', true, '09'], + ['I', true, '09'], + ['i', true, '23'], + ['j', true, '155'], // day of the year + ['k', true, '21'], + ['l', true, '9'], + ['M', true, 'June'], + ['m', true, '06'], + ['p', true, 'PM'], + ['r', true, '09:23:24 PM'], + ['S', true, '24'], + ['s', true, '24'], + ['T', true, '21:23:24'], + ['U', false, 'NotYetEvaluatedExpression'], // Week sunday based (mode 0) + ['u', false, 'NotYetEvaluatedExpression'], // Week monday based (mode 1) + ['V', false, 'NotYetEvaluatedExpression'], // Week sunday based (mode 2) + ['v', true, '23'], // Week monday based (mode 3 - ISO-8601) + ['W', true, 'Thursday'], + ['w', true, '4'], + ['X', false, 'NotYetEvaluatedExpression'], + ['x', true, '2009'], // to be used with %v (ISO - 8601) + ['Y', true, '2009'], + ['y', true, '09'], + ]; + $aRes = []; + foreach ($aTests as $aTest) { $aRes["Format %{$aTest[0]}"] = $aTest; } return $aRes; @@ -501,13 +482,11 @@ class ExpressionEvaluateTest extends ItopDataTestCase public function testEveryTimeFormat($sDate) { $aFormats = $this->TimeFormatsProvider(); - $aSelects = array(); - foreach ($aFormats as $sFormatDesc => $aFormatSpec) - { + $aSelects = []; + foreach ($aFormats as $sFormatDesc => $aFormatSpec) { $sFormat = $aFormatSpec[0]; $bProcessed = $aFormatSpec[1]; - if ($bProcessed) - { + if ($bProcessed) { $aSelects["%$sFormat"] = "DATE_FORMAT('$sDate', '%$sFormat') AS `$sFormat`"; } } @@ -515,29 +494,27 @@ class ExpressionEvaluateTest extends ItopDataTestCase $aRes = CMDBSource::QueryToArray($sSelects); /** @var array $aMysqlDateFormatRsultsForAllFormats format as key, MySQL evaluated result as value */ $aMysqlDateFormatRsultsForAllFormats = $aRes[0]; - foreach ($aFormats as $sFormatDesc => $aFormatSpec) - { + foreach ($aFormats as $sFormatDesc => $aFormatSpec) { $sFormat = $aFormatSpec[0]; $bProcessed = $aFormatSpec[1]; - if ($bProcessed) - { - $oExpression = new FunctionExpression('DATE_FORMAT', array(new ScalarExpression($sDate), new ScalarExpression("%$sFormat"))); - $itopExpressionResult = $oExpression->Evaluate(array()); + if ($bProcessed) { + $oExpression = new FunctionExpression('DATE_FORMAT', [new ScalarExpression($sDate), new ScalarExpression("%$sFormat")]); + $itopExpressionResult = $oExpression->Evaluate([]); $this->assertSame($aMysqlDateFormatRsultsForAllFormats[$sFormat], $itopExpressionResult, "Format %$sFormat not matching MySQL for '$sDate'"); } } } public function EveryTimeFormatProvider() { - return array( - array('1971-07-19 8:40:00'), - array('1999-12-31 23:59:59'), - array('2000-01-01 00:00:00'), - array('2009-06-04 21:23:24'), - array('2020-02-29 23:59:59'), - array('2030-10-21 23:59:59'), - array('2050-12-21 23:59:59'), - ); + return [ + ['1971-07-19 8:40:00'], + ['1999-12-31 23:59:59'], + ['2000-01-01 00:00:00'], + ['2009-06-04 21:23:24'], + ['2020-02-29 23:59:59'], + ['2030-10-21 23:59:59'], + ['2050-12-21 23:59:59'], + ]; } /** @@ -557,8 +534,7 @@ class ExpressionEvaluateTest extends ItopDataTestCase public function testEveryTimeFormatOnDateRange($sStartDate, $sInterval, $iRepeat) { $oDate = new DateTime($sStartDate); - for ($i = 0 ; $i < $iRepeat ; $i++) - { + for ($i = 0 ; $i < $iRepeat ; $i++) { $sDate = date_format($oDate, 'Y-m-d H:i:s'); $this->debug("Checking '$sDate'"); $this->testEveryTimeFormat($sDate); @@ -568,11 +544,11 @@ class ExpressionEvaluateTest extends ItopDataTestCase public function EveryTimeFormatOnDateRangeProvider() { - return array( - '10 years, each 17 days' => array('2000-01-01', 'P17D', 365 * 10 / 17), - '1 day, hour by hour' => array('2000-01-01 00:01:02', 'PT1H', 24), - '1 hour, minute by minute' => array('2000-01-01 00:01:02', 'PT1M', 60), - '1 minute, second by second' => array('2000-01-01 00:01:02', 'PT1S', 60), - ); + return [ + '10 years, each 17 days' => ['2000-01-01', 'P17D', 365 * 10 / 17], + '1 day, hour by hour' => ['2000-01-01 00:01:02', 'PT1H', 24], + '1 hour, minute by minute' => ['2000-01-01 00:01:02', 'PT1M', 60], + '1 minute, second by second' => ['2000-01-01 00:01:02', 'PT1S', 60], + ]; } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/ExpressionTest.php b/tests/php-unit-tests/unitary-tests/core/ExpressionTest.php index 56f9869c6..e97fb7a13 100644 --- a/tests/php-unit-tests/unitary-tests/core/ExpressionTest.php +++ b/tests/php-unit-tests/unitary-tests/core/ExpressionTest.php @@ -7,7 +7,7 @@ use Expression; class ExpressionTest extends ItopDataTestCase { - const USE_TRANSACTION = false; + public const USE_TRANSACTION = false; /** * @dataProvider ListParametersProvider @@ -20,9 +20,8 @@ class ExpressionTest extends ItopDataTestCase { $oExpression = Expression::FromOQL($sOQL); $aParameters = $oExpression->ListParameters(); - $aResult = array(); - foreach ($aParameters as $oVarExpr) - { + $aResult = []; + foreach ($aParameters as $oVarExpr) { /** var \VariableExpression $oVarExpr */ $aResult[] = $oVarExpr->RenderExpression(); } @@ -42,7 +41,7 @@ class ExpressionTest extends ItopDataTestCase ["name REGEXP :regexp", [':regexp']], [" t.agent_id = :current_contact_id", [':current_contact_id']], ["INET_ATON(dev.managementip) > INET_ATON('10.22.32.224') AND INET_ATON(:ip) < INET_ATON('10.22.32.255')", [':ip']], - ["((`UserRequest`.`status` IN ('closed','rejected','resolved')))", []] + ["((`UserRequest`.`status` IN ('closed','rejected','resolved')))", []], ]; } } diff --git a/tests/php-unit-tests/unitary-tests/core/GetSelectFilterTest.php b/tests/php-unit-tests/unitary-tests/core/GetSelectFilterTest.php index f1056e608..7973b8986 100644 --- a/tests/php-unit-tests/unitary-tests/core/GetSelectFilterTest.php +++ b/tests/php-unit-tests/unitary-tests/core/GetSelectFilterTest.php @@ -13,7 +13,6 @@ use UserInternal; use UserLocal; use UserRightsProfile; - /** * @group getSelectFilterTest * @group sampleDataNeeded @@ -33,20 +32,20 @@ class GetSelectFilterTest extends ItopDataTestCase parent::setUp(); require_once(APPROOT.'application/startup.inc.php'); - $oRestProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'REST Services User'), true); - $oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'Administrator'), true); + $oRestProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => 'REST Services User'], true); + $oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => 'Administrator'], true); - $this->sLogin = "getselectfilter-user-" . date('dmYHis'); + $this->sLogin = "getselectfilter-user-".date('dmYHis'); // Ensure that we have at least one administrator account - if (is_object($oRestProfile) && is_object($oAdminProfile)) - { + if (is_object($oRestProfile) && is_object($oAdminProfile)) { $this->oUser = $this->CreateUser($this->sLogin, $oRestProfile->GetKey(), $this->sPassword); $this->AddProfileToUser($this->oUser, $oAdminProfile->GetKey()); } } - public function testGetSelectFilter() { + public function testGetSelectFilter() + { $oUserRights = new UserRightsProfile(); $aClasses = get_declared_classes(); $aUserClasses = [User::class]; @@ -71,35 +70,28 @@ class GetSelectFilterTest extends ItopDataTestCase $oConfig->Set('security.hide_administrators', false); $oFilterProfiles = $oUserRights->GetSelectFilter($this->oUser, URP_Profiles::class); - if ($oFilterProfiles === true) - { + if ($oFilterProfiles === true) { $oFilterProfiles = new DBObjectSearch(URP_Profiles::class); } $oSet = new DBObjectSet($oFilterProfiles); $bAdminProfileFound = false; - while($oProfile = $oSet->Fetch()) - { - if ($oProfile->GetKey() == 1) - { + while ($oProfile = $oSet->Fetch()) { + if ($oProfile->GetKey() == 1) { $bAdminProfileFound = true; break; } } $this->assertEquals($bAdminProfileFound, true); - foreach($aUserLocalAncestors as $sUserClass) - { + foreach ($aUserLocalAncestors as $sUserClass) { $bAdminUserFound = false; - $oFilterUser = $oUserRights->GetSelectFilter($this->oUser,$sUserClass); - if ($oFilterUser === true) - { + $oFilterUser = $oUserRights->GetSelectFilter($this->oUser, $sUserClass); + if ($oFilterUser === true) { $oFilterUser = new DBObjectSearch($sUserClass); } $oSet = new DBObjectSet($oFilterUser); - while($oUser = $oSet->Fetch()) - { - if($oUser->GetKey() == $this->oUser->GetKey()) - { + while ($oUser = $oSet->Fetch()) { + if ($oUser->GetKey() == $this->oUser->GetKey()) { $bAdminUserFound = true; break; } @@ -108,29 +100,24 @@ class GetSelectFilterTest extends ItopDataTestCase } $oFilterLnkProfiles = $oUserRights->GetSelectFilter($this->oUser, URP_UserProfile::class); - if ($oFilterLnkProfiles === true) - { + if ($oFilterLnkProfiles === true) { $oFilterLnkProfiles = new DBObjectSearch(URP_UserProfile::class); } $oSet = new DBObjectSet($oFilterLnkProfiles); // There should some lnk referencing either our administrator account or the Administrator profile $bUserFound = false; $bProfileFound = false; - while($oLnk = $oSet->Fetch()) - { - if($oLnk->Get('userid') == $this->oUser->GetKey()) - { + while ($oLnk = $oSet->Fetch()) { + if ($oLnk->Get('userid') == $this->oUser->GetKey()) { $bUserFound = true; } - if($oLnk->Get('profileid') == 1) - { + if ($oLnk->Get('profileid') == 1) { $bProfileFound = true; } } $this->assertEquals($bUserFound, true); $this->assertEquals($bProfileFound, true); - ////////////////////////////////////////////////////////////////////////////////////////////////////// // Administrator account, Administrator profile and URP_UserProfile related to administrators are now hidden // via GetSelectFilter @@ -139,17 +126,14 @@ class GetSelectFilterTest extends ItopDataTestCase $oFilterProfiles = $oUserRights->GetSelectFilter($this->oUser, URP_Profiles::class); $this->assertNotEquals($oFilterProfiles, true); // This class must be filtered $oSet = new DBObjectSet($oFilterProfiles); - while($oProfile = $oSet->Fetch()) - { + while ($oProfile = $oSet->Fetch()) { $this->assertNotEquals($oProfile->GetKey(), 1); // No profile should have id = 1 (Administrator) } - foreach($aUserClasses as $sUserClass) - { + foreach ($aUserClasses as $sUserClass) { $oFilterUser = $oUserRights->GetSelectFilter($this->oUser, $sUserClass); - $this->assertNotEquals($oFilterUser,true); // This class must be filtered + $this->assertNotEquals($oFilterUser, true); // This class must be filtered $oSet = new DBObjectSet($oFilterUser); - while($oUser = $oSet->Fetch()) - { + while ($oUser = $oSet->Fetch()) { $this->assertNotEquals($oUser->GetKey(), $this->oUser->GetKey()); // Our administrator account should not be visible } } @@ -158,8 +142,7 @@ class GetSelectFilterTest extends ItopDataTestCase $this->assertNotEquals($oFilterLnkProfiles, true); // This class must be filtered $oSet = new DBObjectSet($oFilterLnkProfiles); // There should be no lnk referencing either our administrator account or the profile Administrator - while($oLnk = $oSet->Fetch()) - { + while ($oLnk = $oSet->Fetch()) { $this->assertNotEquals($oLnk->Get('userid'), $this->oUser->GetKey()); $this->assertNotEquals($oLnk->Get('profileid'), 1); } diff --git a/tests/php-unit-tests/unitary-tests/core/InlineImageTest.php b/tests/php-unit-tests/unitary-tests/core/InlineImageTest.php index d71055b13..68196a043 100644 --- a/tests/php-unit-tests/unitary-tests/core/InlineImageTest.php +++ b/tests/php-unit-tests/unitary-tests/core/InlineImageTest.php @@ -1,10 +1,10 @@ fail('Constant to disable error handler is set, so we cannot test :('); @@ -50,9 +53,9 @@ class DeprecatedCallsLogErrorHandlerTest extends ItopTestCase { $oMockConfig ->method("Get") ->willReturnCallback(function ($sConfigParameterName) { - if ($sConfigParameterName==='log_level_min'){ + if ($sConfigParameterName === 'log_level_min') { return [ - DeprecatedCallsLog::ENUM_CHANNEL_PHP_LIBMETHOD => LogAPI::LEVEL_TRACE + DeprecatedCallsLog::ENUM_CHANNEL_PHP_LIBMETHOD => LogAPI::LEVEL_TRACE, ]; } /** @noinspection NullPointerExceptionInspection */ diff --git a/tests/php-unit-tests/unitary-tests/core/Log/DeprecatedCallsLogTest.php b/tests/php-unit-tests/unitary-tests/core/Log/DeprecatedCallsLogTest.php index 5f948be1d..0b11891d0 100644 --- a/tests/php-unit-tests/unitary-tests/core/Log/DeprecatedCallsLogTest.php +++ b/tests/php-unit-tests/unitary-tests/core/Log/DeprecatedCallsLogTest.php @@ -1,4 +1,5 @@ 'require_once', ], ], - 'out' => 'itop-root/env-production/core/main.php#1290' + 'out' => 'itop-root/env-production/core/main.php#1290', ], 'From a persistent object method (deprecated PHP function)' => [ 'in:stripped call stack' => [ @@ -262,7 +262,7 @@ class DeprecatedCallsLogTest extends ItopTestCase 'type' => '->', ], ], - 'out' => 'Ticket->OnBeforeWriteTicket (itop-root/env-production/itop-tickets/model.itop-tickets.php#165), itself called from DBObject->FireEvent (itop-root/core/dbobject.class.php#6575)' + 'out' => 'Ticket->OnBeforeWriteTicket (itop-root/env-production/itop-tickets/model.itop-tickets.php#165), itself called from DBObject->FireEvent (itop-root/core/dbobject.class.php#6575)', ], ]; } diff --git a/tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest.php b/tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest.php index 1df01ebb8..baaf59372 100644 --- a/tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest.php +++ b/tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest.php @@ -1,4 +1,5 @@ 'Error', ];//this should be the default value, if it did change, please fix it here } @@ -69,12 +67,15 @@ class ExceptionLogTest extends ItopDataTestCase foreach ($aLevels as $i => $sLevel) { $sExpectedFile = __FILE__; // @formatter:off - $oException = new $aExceptions[$i]("Iteration number $i"); $sExpectedLine = __LINE__; //Both should remain on the same line + $oException = new $aExceptions[$i]("Iteration number $i"); + $sExpectedLine = __LINE__; //Both should remain on the same line // @formatter:on $iExpectedWriteNumber = $aExpectedWriteNumber[$i]; $iExpectedDbWriteNumber = $aExpectedDbWriteNumber[$i]; - $aExpectedFileContext = array_merge($aContext, [ + $aExpectedFileContext = array_merge( + $aContext, + [ 'exception class' => get_class($oException), 'file' => $sExpectedFile, 'line' => $sExpectedLine, @@ -294,6 +295,3 @@ class ExceptionLogTest extends ItopDataTestCase $this->assertEquals('Ok', $resultFilePerDefaultWhenKeyNotFound); } } - - - diff --git a/tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest/Exceptions.php b/tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest/Exceptions.php index 9ae40e41c..708fc1b8a 100644 --- a/tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest/Exceptions.php +++ b/tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest/Exceptions.php @@ -1,4 +1,5 @@ oMetaModelConfig = $this->createMock('Config'); } - /** * @dataProvider LogApiProvider * @test @@ -58,7 +57,7 @@ class LogAPITest extends ItopDataTestCase * @dataProvider LogWarningWithASpecificChannelProvider * @test */ - public function TestLogWarningWithASpecificChannel($expectedCallNb, $sExpectedLevel, $ConfigReturnedObject, $bExceptionRaised=false) + public function TestLogWarningWithASpecificChannel($expectedCallNb, $sExpectedLevel, $ConfigReturnedObject, $bExceptionRaised = false) { $this->oMetaModelConfig ->method("Get") @@ -73,13 +72,12 @@ class LogAPITest extends ItopDataTestCase ->method($sExpectedLevel) ->with("log msg", "GaBuZoMeuChannel"); - try{ + try { \IssueLog::Warning("log msg", "GaBuZoMeuChannel"); if ($bExceptionRaised) { $this->fail("raised should have been raised"); } - } - catch(\Exception $e) { + } catch (\Exception $e) { if (!$bExceptionRaised) { $this->fail("raised should NOT have been raised"); } @@ -93,7 +91,7 @@ class LogAPITest extends ItopDataTestCase "Default Unknown Level" => [ 0, "Ok", 'TotoLevel', true], "Info as Default Level" => [ 1 , "Warning", 'Info'], "Error as Default Level" => [ 0, "Warning", 'Error'], - "Empty array" => [ 0, "Ok", array()], + "Empty array" => [ 0, "Ok", []], "Channel configured on an undefined level" => [ 0, "Ok", ["GaBuZoMeuChannel" => "TotoLevel"], true], "Channel defined with Error" => [ 0, "Warning", ["GaBuZoMeuChannel" => "Error"]], "Channel defined with Info" => [ 1, "Warning", ["GaBuZoMeuChannel" => "Info"]], @@ -104,7 +102,7 @@ class LogAPITest extends ItopDataTestCase * @dataProvider LogOkWithASpecificChannel * @test */ - public function TestLogOkWithASpecificChannel($expectedCallNb, $sExpectedLevel, $ConfigReturnedObject, $bExceptionRaised=false) + public function TestLogOkWithASpecificChannel($expectedCallNb, $sExpectedLevel, $ConfigReturnedObject, $bExceptionRaised = false) { $this->oMetaModelConfig ->method("Get") @@ -124,8 +122,7 @@ class LogAPITest extends ItopDataTestCase if ($bExceptionRaised) { $this->fail("raised should have been raised"); } - } - catch (\Exception $e) { + } catch (\Exception $e) { if (!$bExceptionRaised) { $this->fail("raised should NOT have been raised"); } @@ -136,7 +133,7 @@ class LogAPITest extends ItopDataTestCase { return [ "empty config" => [1, "Ok", ''], - "Empty array" => [1, "Ok", array()], + "Empty array" => [1, "Ok", []], ]; } @@ -169,7 +166,6 @@ class LogAPITest extends ItopDataTestCase } } - public function testGetLevelDefault() { $resultDb = $this->InvokeNonPublicStaticMethod(\LogAPI::class, 'GetLevelDefault', [\LogAPI::ENUM_CONFIG_PARAM_DB]); diff --git a/tests/php-unit-tests/unitary-tests/core/Log/LogFileNameBuilderTest.php b/tests/php-unit-tests/unitary-tests/core/Log/LogFileNameBuilderTest.php index 0d366a0ac..a0724d766 100644 --- a/tests/php-unit-tests/unitary-tests/core/Log/LogFileNameBuilderTest.php +++ b/tests/php-unit-tests/unitary-tests/core/Log/LogFileNameBuilderTest.php @@ -1,4 +1,5 @@ array('DailyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-01 15:42', false), - 'DAILY Same week, different day less 24h diff' => array('DailyRotatingLogFileNameBuilder', '2020-02-01 12:00', '2020-02-02 09:00', true), - 'DAILY Same week, different day' => array('DailyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-02 00:00', true), - 'DAILY 1 week diff' => array('DailyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-08 00:00', true), - 'WEEKLY Same week' => array('WeeklyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-01 00:00', false), - 'WEEKLY 1 week diff, same month' => array('WeeklyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-08 00:00', true), - 'WEEKLY 2 weeks diff, same month' => array('WeeklyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-15 00:00', true), - 'WEEKLY 1 week diff, different month' => array('WeeklyRotatingLogFileNameBuilder', '2020-01-27 00:00', '2020-02-03 00:00', true), - 'WEEKLY same week, different month' => array('WeeklyRotatingLogFileNameBuilder', '2020-01-27 00:00', '2020-02-02 00:00', false), - 'WEEKLY 1 week diff, different year' => array('WeeklyRotatingLogFileNameBuilder', '2019-12-30 00:00', '2020-01-06 00:00', true), - 'WEEKLY same week, different year' => array('WeeklyRotatingLogFileNameBuilder', '2019-12-30 00:00', '2020-01-05 00:00', true), - 'MONTHLY same month' => array('MonthlyRotatingLogFileNameBuilder', '2020-02-10 00:00', '2020-02-14 00:00', false), - 'MONTHLY on first day which is a sunday' => array('MonthlyRotatingLogFileNameBuilder', '2020-01-30 00:00', '2020-02-01 00:00', true), - ); + return [ + 'DAILY Same day' => ['DailyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-01 15:42', false], + 'DAILY Same week, different day less 24h diff' => ['DailyRotatingLogFileNameBuilder', '2020-02-01 12:00', '2020-02-02 09:00', true], + 'DAILY Same week, different day' => ['DailyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-02 00:00', true], + 'DAILY 1 week diff' => ['DailyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-08 00:00', true], + 'WEEKLY Same week' => ['WeeklyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-01 00:00', false], + 'WEEKLY 1 week diff, same month' => ['WeeklyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-08 00:00', true], + 'WEEKLY 2 weeks diff, same month' => ['WeeklyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-15 00:00', true], + 'WEEKLY 1 week diff, different month' => ['WeeklyRotatingLogFileNameBuilder', '2020-01-27 00:00', '2020-02-03 00:00', true], + 'WEEKLY same week, different month' => ['WeeklyRotatingLogFileNameBuilder', '2020-01-27 00:00', '2020-02-02 00:00', false], + 'WEEKLY 1 week diff, different year' => ['WeeklyRotatingLogFileNameBuilder', '2019-12-30 00:00', '2020-01-06 00:00', true], + 'WEEKLY same week, different year' => ['WeeklyRotatingLogFileNameBuilder', '2019-12-30 00:00', '2020-01-05 00:00', true], + 'MONTHLY same month' => ['MonthlyRotatingLogFileNameBuilder', '2020-02-10 00:00', '2020-02-14 00:00', false], + 'MONTHLY on first day which is a sunday' => ['MonthlyRotatingLogFileNameBuilder', '2020-01-30 00:00', '2020-02-01 00:00', true], + ]; } /** @@ -131,15 +130,15 @@ class LogFileNameBuilderTest extends ItopTestCase public function CronNextOccurrenceProvider() { - return array( - 'DAILY morning' => array('DailyRotatingLogFileNameBuilder', '2020-02-01 05:00', '2020-02-02 00:00'), - 'DAILY midnight' => array('DailyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-02 00:00'), - 'WEEKLY monday 12:42' => array('WeeklyRotatingLogFileNameBuilder', '2020-02-03 12:42', '2020-02-10 00:00'), - 'WEEKLY monday 00:00' => array('WeeklyRotatingLogFileNameBuilder', '2020-02-03 00:00', '2020-02-10 00:00'), - 'WEEKLY tuesday 12:42' => array('WeeklyRotatingLogFileNameBuilder', '2020-02-04 12:42', '2020-02-10 00:00'), - 'WEEKLY sunday 12:42' => array('WeeklyRotatingLogFileNameBuilder', '2020-02-02 12:42', '2020-02-03 00:00'), - 'MONTHLY 12/02 12:42' => array('MonthlyRotatingLogFileNameBuilder', '2020-02-12 12:42', '2020-03-01 00:00'), - ); + return [ + 'DAILY morning' => ['DailyRotatingLogFileNameBuilder', '2020-02-01 05:00', '2020-02-02 00:00'], + 'DAILY midnight' => ['DailyRotatingLogFileNameBuilder', '2020-02-01 00:00', '2020-02-02 00:00'], + 'WEEKLY monday 12:42' => ['WeeklyRotatingLogFileNameBuilder', '2020-02-03 12:42', '2020-02-10 00:00'], + 'WEEKLY monday 00:00' => ['WeeklyRotatingLogFileNameBuilder', '2020-02-03 00:00', '2020-02-10 00:00'], + 'WEEKLY tuesday 12:42' => ['WeeklyRotatingLogFileNameBuilder', '2020-02-04 12:42', '2020-02-10 00:00'], + 'WEEKLY sunday 12:42' => ['WeeklyRotatingLogFileNameBuilder', '2020-02-02 12:42', '2020-02-03 00:00'], + 'MONTHLY 12/02 12:42' => ['MonthlyRotatingLogFileNameBuilder', '2020-02-12 12:42', '2020-03-01 00:00'], + ]; } /** diff --git a/tests/php-unit-tests/unitary-tests/core/MetaModelMagicPlaceholderTest.php b/tests/php-unit-tests/unitary-tests/core/MetaModelMagicPlaceholderTest.php index 68c7eae5a..11c64b38c 100644 --- a/tests/php-unit-tests/unitary-tests/core/MetaModelMagicPlaceholderTest.php +++ b/tests/php-unit-tests/unitary-tests/core/MetaModelMagicPlaceholderTest.php @@ -197,13 +197,13 @@ class MetaModelMagicPlaceholderTest extends ItopDataTestCase $this->assertEqualsShallow( [ 'gabu' => 'zomeu', - 'current_contact_id' => '', + 'current_contact_id' => '', 'current_user->object()' => '(current_user->object() : cannot be resolved)', - 'current_user->not_existing_attribute' => '(current_user->not_existing_attribute : cannot be resolved)', + 'current_user->not_existing_attribute' => '(current_user->not_existing_attribute : cannot be resolved)', 'current_user->login' => '(current_user->login : cannot be resolved)', - 'current_contact->object()' => '(current_contact->object() : cannot be resolved)', + 'current_contact->object()' => '(current_contact->object() : cannot be resolved)', 'current_contact->org_id' => '(current_contact->org_id : cannot be resolved)', - 'current_contact->not_existing_attribute' => '(current_contact->not_existing_attribute : cannot be resolved)', + 'current_contact->not_existing_attribute' => '(current_contact->not_existing_attribute : cannot be resolved)', ], $aPlaceholders, 'AddMagicPlaceholders should add expected arguments and render them with an explicit error when the information could not be known' diff --git a/tests/php-unit-tests/unitary-tests/core/MetaModelTest.php b/tests/php-unit-tests/unitary-tests/core/MetaModelTest.php index d70637454..74c947731 100644 --- a/tests/php-unit-tests/unitary-tests/core/MetaModelTest.php +++ b/tests/php-unit-tests/unitary-tests/core/MetaModelTest.php @@ -1,6 +1,5 @@ Unit test description

    '; + protected static $iDefaultUserOrgId = 1; + protected static $iDefaultUserCallerId = 1; + protected static $sDefaultUserRequestTitle = 'Unit test title'; + protected static $sDefaultUserRequestDescription = 'Unit test description'; + protected static $sDefaultUserRequestDescriptionAsHtml = '

    Unit test description

    '; protected function setUp(): void { @@ -52,49 +51,49 @@ class MetaModelTest extends ItopDataTestCase // multi-level hierarchy $oServer1 = MetaModel::GetObjectByName('Server', 'Server1'); $sServer1Id = $oServer1->GetKey(); - foreach (MetaModel::EnumParentClasses('Server',ENUM_PARENT_CLASSES_ALL) as $sClass) { + foreach (MetaModel::EnumParentClasses('Server', ENUM_PARENT_CLASSES_ALL) as $sClass) { $this->assertEquals('Server', MetaModel::GetFinalClassName($sClass, $sServer1Id), 'Should return Server for all the classes in the hierarchy'); } } /** - * @group itopRequestMgmt - * @covers MetaModel::ApplyParams() - * @dataProvider ApplyParamsProvider - * - * @param string $sInput - * @param array $aParams - * @param string $sExpectedOutput - * - * @throws \Exception - */ + * @group itopRequestMgmt + * @covers MetaModel::ApplyParams() + * @dataProvider ApplyParamsProvider + * + * @param string $sInput + * @param array $aParams + * @param string $sExpectedOutput + * + * @throws \Exception + */ public function testApplyParams($sInput, $aParams, $sExpectedOutput) { - $oUserRequest = $this->createObject( - 'UserRequest', - array( - 'org_id' => static::$iDefaultUserOrgId, - 'caller_id' => static::$iDefaultUserCallerId, - 'title' => static::$sDefaultUserRequestTitle, - 'description' => static::$sDefaultUserRequestDescriptionAsHtml, - ) - ); + $oUserRequest = $this->createObject( + 'UserRequest', + [ + 'org_id' => static::$iDefaultUserOrgId, + 'caller_id' => static::$iDefaultUserCallerId, + 'title' => static::$sDefaultUserRequestTitle, + 'description' => static::$sDefaultUserRequestDescriptionAsHtml, + ] + ); - $aParams['this->object()'] = $oUserRequest; + $aParams['this->object()'] = $oUserRequest; - $sGeneratedOutput = MetaModel::ApplyParams($sInput, $aParams); + $sGeneratedOutput = MetaModel::ApplyParams($sInput, $aParams); $this->assertEquals($sExpectedOutput, $sGeneratedOutput, "ApplyParams test returned $sGeneratedOutput"); } public function ApplyParamsProvider() { - $sTitle = static::$sDefaultUserRequestTitle; + $sTitle = static::$sDefaultUserRequestTitle; - $aParams = [ + $aParams = [ 'simple' => 'I am simple', - 'foo->bar' => 'I am bar', // N°2889 - Placeholder with an arrow that is not an object - ]; + 'foo->bar' => 'I am bar', // N°2889 - Placeholder with an arrow that is not an object + ]; return [ 'Simple placeholder' => [ @@ -118,19 +117,19 @@ class MetaModelTest extends ItopDataTestCase 'Result: Hyperlink', ], 'Placeholder for an object string attribute (text format)' => [ - 'Title: $this->title$', - $aParams, - 'Title: '.$sTitle, + 'Title: $this->title$', + $aParams, + 'Title: '.$sTitle, ], 'Placeholder for an object string attribute (html format)' => [ - 'Title:

    $this->title$

    ', - $aParams, - 'Title:

    '.$sTitle.'

    ', + 'Title:

    $this->title$

    ', + $aParams, + 'Title:

    '.$sTitle.'

    ', ], 'Placeholder for an object string attribute url-encoded (html format)' => [ - 'Title: Hyperlink', - $aParams, - 'Title: Hyperlink', + 'Title: Hyperlink', + $aParams, + 'Title: Hyperlink', ], 'Placeholder for an object HTML attribute as its default format' => [ '$this->description$', @@ -171,14 +170,13 @@ class MetaModelTest extends ItopDataTestCase public function GetDependentAttributesProvider() { - $aRawCases = array( - array('Person', 'org_id', array('location_id', 'org_name', 'org_id_friendlyname', 'org_id_obsolescence_flag')), - array('Person', 'name', array('friendlyname')), - array('Person', 'status', array('obsolescence_flag')), - ); - $aRet = array(); - foreach ($aRawCases as $i => $aData) - { + $aRawCases = [ + ['Person', 'org_id', ['location_id', 'org_name', 'org_id_friendlyname', 'org_id_obsolescence_flag']], + ['Person', 'name', ['friendlyname']], + ['Person', 'status', ['obsolescence_flag']], + ]; + $aRet = []; + foreach ($aRawCases as $i => $aData) { $aRet[$aData[0].'::'.$aData[1]] = $aData; } return $aRet; @@ -205,16 +203,15 @@ class MetaModelTest extends ItopDataTestCase public function GetPrerequisiteAttributesProvider() { - $aRawCases = array( - array('Person', 'friendlyname', array('name', 'first_name')), - array('Person', 'obsolescence_flag', array('status')), - array('Person', 'org_id_friendlyname', array('org_id')), - array('Person', 'org_id', array()), - array('Person', 'org_name', array('org_id')), - ); - $aRet = array(); - foreach ($aRawCases as $i => $aData) - { + $aRawCases = [ + ['Person', 'friendlyname', ['name', 'first_name']], + ['Person', 'obsolescence_flag', ['status']], + ['Person', 'org_id_friendlyname', ['org_id']], + ['Person', 'org_id', []], + ['Person', 'org_name', ['org_id']], + ]; + $aRet = []; + foreach ($aRawCases as $i => $aData) { $aRet[$aData[0].'::'.$aData[1]] = $aData; } return $aRet; @@ -226,14 +223,18 @@ class MetaModelTest extends ItopDataTestCase */ public function testManualVersusAutomaticDependenciesOnExtKeys() { - foreach (\MetaModel::GetClasses() as $sClass) - { - if (\MetaModel::IsAbstract($sClass)) continue; + foreach (\MetaModel::GetClasses() as $sClass) { + if (\MetaModel::IsAbstract($sClass)) { + continue; + } - foreach (\MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - if (\MetaModel::GetAttributeOrigin($sClass, $sAttCode) != $sClass) continue; - if (!$oAttDef instanceof \AttributeExternalKey) continue; + foreach (\MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if (\MetaModel::GetAttributeOrigin($sClass, $sAttCode) != $sClass) { + continue; + } + if (!$oAttDef instanceof \AttributeExternalKey) { + continue; + } $aManual = $oAttDef->Get('depends_on'); $aAuto = \MetaModel::GetPrerequisiteAttributes($sClass, $sAttCode); @@ -254,7 +255,7 @@ class MetaModelTest extends ItopDataTestCase * @param $interface * @param null $sFilterInstanceOf */ - public function testEnumPlugins($expectedInstanciationCalls, $expectedResults, $m_aExtensionClassNames, $m_aExtensionClasses, $interface, $sFilterInstanceOf=null) + public function testEnumPlugins($expectedInstanciationCalls, $expectedResults, $m_aExtensionClassNames, $m_aExtensionClasses, $interface, $sFilterInstanceOf = null) { $pluginInstanciationManager = new \PluginInstanciationManager(); $res = $pluginInstanciationManager->InstantiatePlugins($m_aExtensionClassNames, $interface); @@ -282,7 +283,8 @@ class MetaModelTest extends ItopDataTestCase } } - public function enumPluginsProvider(){ + public function enumPluginsProvider() + { $aInterfaces = [ "empty conf" => [0, [], [], [], 'Wizzard'], "simple instance retrieval" => [1, [Gryffindor::class => Gryffindor::class], ['Wizzard' => [Gryffindor::class]], [], 'Wizzard'], @@ -458,36 +460,38 @@ class MetaModelTest extends ItopDataTestCase ]; } - /** - * @return void - * @throws CoreException - * @throws \OQLException - * @dataProvider PurgeDataProvider - * - */ - public function testPurgeData( $iMaxChunkSize, $iNbQueriesExpected){ - // Set max_chunk_size to $iMaxChunkSize (default 1000) to test chunk deletion with only 10 items - $oConfig = MetaModel::GetConfig(); - $oConfig->Set('purge_data.max_chunk_size', $iMaxChunkSize); + /** + * @return void + * @throws CoreException + * @throws \OQLException + * @dataProvider PurgeDataProvider + * + */ + public function testPurgeData($iMaxChunkSize, $iNbQueriesExpected) + { + // Set max_chunk_size to $iMaxChunkSize (default 1000) to test chunk deletion with only 10 items + $oConfig = MetaModel::GetConfig(); + $oConfig->Set('purge_data.max_chunk_size', $iMaxChunkSize); - $aPkPerson = []; - for ($i=0; $i < 10; $i++) { - $oPerson = $this->CreatePerson($i, 1); - $sClass = get_class($oPerson); - $aPkPerson[] = $oPerson->GetKey(); - } + $aPkPerson = []; + for ($i = 0; $i < 10; $i++) { + $oPerson = $this->CreatePerson($i, 1); + $sClass = get_class($oPerson); + $aPkPerson[] = $oPerson->GetKey(); + } - $oFilter = DBObjectSearch::FromOQL('SELECT '.$sClass.' WHERE id IN ('.implode(',', $aPkPerson).')'); - $iNbDelete = 0; + $oFilter = DBObjectSearch::FromOQL('SELECT '.$sClass.' WHERE id IN ('.implode(',', $aPkPerson).')'); + $iNbDelete = 0; - $this->assertDBQueryCount($iNbQueriesExpected, function() use ($oFilter, &$iNbDelete) { + $this->assertDBQueryCount($iNbQueriesExpected, function () use ($oFilter, &$iNbDelete) { $iNbDelete = MetaModel::PurgeData($oFilter); - } ); + }); - $this->assertEquals($iNbDelete, 10, 'MetaModel::PurgeData must delete 10 objects per batch of 2 items'); - } + $this->assertEquals($iNbDelete, 10, 'MetaModel::PurgeData must delete 10 objects per batch of 2 items'); + } - public function PurgeDataProvider(){ + public function PurgeDataProvider() + { return [ 'Purge 10 items with a max_chunk_size of 2 should be perfomed in 5 steps + an additional query to verify that the job is complete' => [2, 16], 'Purge 10 items with a max_chunk_size of 3 should be perfomed in 4 steps' => [3, 12], @@ -498,7 +502,6 @@ class MetaModelTest extends ItopDataTestCase abstract class Wizzard { - /** * Wizzard constructor. */ @@ -509,23 +512,18 @@ abstract class Wizzard class Gryffindor extends Wizzard { - } class Hufflepuff extends Wizzard { - } class Ravenclaw extends Wizzard { - } class Slytherin extends Wizzard { - } class Muggle { - } diff --git a/tests/php-unit-tests/unitary-tests/core/MockValueSetObjects.php b/tests/php-unit-tests/unitary-tests/core/MockValueSetObjects.php index 7db46cea8..9d6cb32a8 100644 --- a/tests/php-unit-tests/unitary-tests/core/MockValueSetObjects.php +++ b/tests/php-unit-tests/unitary-tests/core/MockValueSetObjects.php @@ -2,14 +2,14 @@ class MockValueSetObjects extends ValueSetObjects { - public function __construct($sFilterExp, $sValueAttCode = '', $aOrderBy = array(), $bAllowAllData = false, $aModifierProperties = array()) + public function __construct($sFilterExp, $sValueAttCode = '', $aOrderBy = [], $bAllowAllData = false, $aModifierProperties = []) { - parent::__construct($sFilterExp, $sValueAttCode , $aOrderBy, $bAllowAllData, $aModifierProperties ); + parent::__construct($sFilterExp, $sValueAttCode, $aOrderBy, $bAllowAllData, $aModifierProperties); } public function GetFilterOQL( - $sOperation, $sContains - ) - { + $sOperation, + $sContains + ) { return $this->GetFilter($sOperation, $sContains)->ToOQL(); diff --git a/tests/php-unit-tests/unitary-tests/core/OQLParserTest.php b/tests/php-unit-tests/unitary-tests/core/OQLParserTest.php index 97b5e049f..9e95545c4 100644 --- a/tests/php-unit-tests/unitary-tests/core/OQLParserTest.php +++ b/tests/php-unit-tests/unitary-tests/core/OQLParserTest.php @@ -9,7 +9,6 @@ namespace Combodo\iTop\Test\UnitTest\Core; - use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use DBObjectSearch; use DBSearch; @@ -21,7 +20,6 @@ use UserRights; class OQLParserTest extends ItopDataTestCase { - /** * @group iTopChangeMgt * @group itopConfigMgmt @@ -37,9 +35,9 @@ class OQLParserTest extends ItopDataTestCase { $this->debug($sQuery); $oDbObjectSearch = DBObjectSearch::FromOQL($sQuery); - $sOql=$oDbObjectSearch->ToOQL(); + $sOql = $oDbObjectSearch->ToOQL(); $this->debug($sOql); - self::assertEquals($sQuery,$sOql); + self::assertEquals($sQuery, $sOql); } public function testUnknownClassOqlException() @@ -51,29 +49,28 @@ class OQLParserTest extends ItopDataTestCase try { DBSearch::FromOQL('SELECT UnknownClass'); $this->fail('An UnknownClassOqlException should have been thrown'); - } - catch (UnknownClassOqlException $e) { + } catch (UnknownClassOqlException $e) { $this->assertNotContains('DBProperty', $e->GetSuggestions(), 'user should not be recommanded to perform queries on classes his not allowed to see'); } } public function NestedQueryProvider() { - return array( - array("SELECT `U` FROM User AS `U` JOIN Person AS `P` ON `U`.contactid = `P`.id WHERE ((`U`.`status` = 'enabled') AND (`U`.`id` NOT IN (SELECT `U` FROM User AS `U` JOIN Person AS `P` ON `U`.contactid = `P`.id JOIN URP_UserOrg AS `L` ON `L`.userid = `U`.id WHERE ((`U`.`status` = 'enabled') AND (`L`.`allowed_org_id` = `P`.`org_id`)) UNION SELECT `U` FROM User AS `U` WHERE ((`U`.`status` = 'enabled') AND (`U`.`id` NOT IN (SELECT `U` FROM User AS `U` JOIN URP_UserOrg AS `L` ON `L`.userid = `U`.id WHERE (`U`.`status` = 'enabled')))))))"), - array("SELECT `Ur` FROM UserRequest AS `Ur` WHERE (`Ur`.`id` NOT IN (SELECT `Ur` FROM UserRequest AS `Ur` JOIN lnkFunctionalCIToTicket AS `lnk` ON `lnk`.ticket_id = `Ur`.id WHERE 1))"), - array("SELECT `T` FROM Ticket AS `T` WHERE ((`T`.`finalclass` IN ('userrequest', 'change')) AND (`T`.`id` NOT IN (SELECT `Ur` FROM UserRequest AS `Ur` JOIN lnkFunctionalCIToTicket AS `lnk` ON `lnk`.ticket_id = `Ur`.id WHERE 1 UNION SELECT `C` FROM Change AS `C` JOIN lnkFunctionalCIToTicket AS `lnk` ON `lnk`.ticket_id = `C`.id WHERE 1)))"), - array("SELECT `PhysicalDevice` FROM PhysicalDevice AS `PhysicalDevice` WHERE ((`PhysicalDevice`.`status` = 'production') AND (`PhysicalDevice`.`id` NOT IN (SELECT `p` FROM PhysicalDevice AS `p` JOIN lnkFunctionalCIToProviderContract AS `l` ON `l`.functionalci_id = `p`.id WHERE 1)))"), - array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))'), - array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))'), - array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE 1))'), - array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` NOT IN (SELECT `Organization` FROM Organization AS `Organization` WHERE 1))'), - array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` JOIN Organization AS `Organization1` ON `Organization`.parent_id BELOW `Organization1`.id WHERE (`Organization1`.`id` = \'3\')))'), - array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = \'3\')))'), - array("SELECT `L`, `P` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE 1"), - array("SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`agent_id` = :current_contact_id) AND (`UserRequest`.`status` NOT IN ('closed', 'resolved')))"), - array("SELECT `L` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id WHERE 1"), - ); + return [ + ["SELECT `U` FROM User AS `U` JOIN Person AS `P` ON `U`.contactid = `P`.id WHERE ((`U`.`status` = 'enabled') AND (`U`.`id` NOT IN (SELECT `U` FROM User AS `U` JOIN Person AS `P` ON `U`.contactid = `P`.id JOIN URP_UserOrg AS `L` ON `L`.userid = `U`.id WHERE ((`U`.`status` = 'enabled') AND (`L`.`allowed_org_id` = `P`.`org_id`)) UNION SELECT `U` FROM User AS `U` WHERE ((`U`.`status` = 'enabled') AND (`U`.`id` NOT IN (SELECT `U` FROM User AS `U` JOIN URP_UserOrg AS `L` ON `L`.userid = `U`.id WHERE (`U`.`status` = 'enabled')))))))"], + ["SELECT `Ur` FROM UserRequest AS `Ur` WHERE (`Ur`.`id` NOT IN (SELECT `Ur` FROM UserRequest AS `Ur` JOIN lnkFunctionalCIToTicket AS `lnk` ON `lnk`.ticket_id = `Ur`.id WHERE 1))"], + ["SELECT `T` FROM Ticket AS `T` WHERE ((`T`.`finalclass` IN ('userrequest', 'change')) AND (`T`.`id` NOT IN (SELECT `Ur` FROM UserRequest AS `Ur` JOIN lnkFunctionalCIToTicket AS `lnk` ON `lnk`.ticket_id = `Ur`.id WHERE 1 UNION SELECT `C` FROM Change AS `C` JOIN lnkFunctionalCIToTicket AS `lnk` ON `lnk`.ticket_id = `C`.id WHERE 1)))"], + ["SELECT `PhysicalDevice` FROM PhysicalDevice AS `PhysicalDevice` WHERE ((`PhysicalDevice`.`status` = 'production') AND (`PhysicalDevice`.`id` NOT IN (SELECT `p` FROM PhysicalDevice AS `p` JOIN lnkFunctionalCIToProviderContract AS `l` ON `l`.functionalci_id = `p`.id WHERE 1)))"], + ['SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))'], + ['SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))'], + ['SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE 1))'], + ['SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` NOT IN (SELECT `Organization` FROM Organization AS `Organization` WHERE 1))'], + ['SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` JOIN Organization AS `Organization1` ON `Organization`.parent_id BELOW `Organization1`.id WHERE (`Organization1`.`id` = \'3\')))'], + ['SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = \'3\')))'], + ["SELECT `L`, `P` FROM Location AS `L` JOIN Person AS `P` ON `P`.location_id = `L`.id WHERE 1"], + ["SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`agent_id` = :current_contact_id) AND (`UserRequest`.`status` NOT IN ('closed', 'resolved')))"], + ["SELECT `L` FROM Person AS `P` JOIN Location AS `L` ON `P`.location_id = `L`.id WHERE 1"], + ]; } /** @@ -89,11 +86,9 @@ class OQLParserTest extends ItopDataTestCase try { $oOql = new OqlInterpreter($sQuery); $oOql->ParseQuery(); - } - catch (OQLParserException $e) { + } catch (OQLParserException $e) { self::fail("OQL Parser stack overflow"); - } - catch (OQLException $e) { + } catch (OQLException $e) { self::fail("OQL Parser stack overflow"); } self::assertTrue(true); diff --git a/tests/php-unit-tests/unitary-tests/core/OQLTest.php b/tests/php-unit-tests/unitary-tests/core/OQLTest.php index de81dc512..9f1c99e25 100644 --- a/tests/php-unit-tests/unitary-tests/core/OQLTest.php +++ b/tests/php-unit-tests/unitary-tests/core/OQLTest.php @@ -9,7 +9,6 @@ namespace Combodo\iTop\Test\UnitTest\Core; - use CMDBSource; use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use DBObjectSearch; @@ -23,7 +22,7 @@ use utils; class OQLTest extends ItopDataTestCase { - const USE_TRANSACTION = false; + public const USE_TRANSACTION = false; /** * @doesNotPerformAssertions @@ -62,244 +61,236 @@ class OQLTest extends ItopDataTestCase public function NestedQueryProvider() { - return array( - array("SELECT User AS U JOIN Person AS P ON U.contactid = P.id WHERE U.status='enabled' AND U.id NOT IN (SELECT User AS U JOIN Person AS P ON U.contactid=P.id JOIN URP_UserOrg AS L ON L.userid = U.id WHERE U.status='enabled' AND L.allowed_org_id = P.org_id UNION SELECT User AS U WHERE U.status='enabled' AND U.id NOT IN ( SELECT User AS U JOIN URP_UserOrg AS L ON L.userid = U.id WHERE U.status='enabled'))"), - array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE `UserRequest`.org_id IN (SELECT `Organization` FROM Organization AS `Organization` JOIN Organization AS `Organization1` ON `Organization`.parent_id BELOW `Organization1`.id WHERE (`Organization1`.`id` = \'3\'))'), - array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE `Organization`.`id`=`UserRequest`.`org_id`))'), - array("SELECT UserRequest AS Ur WHERE Ur.id NOT IN (SELECT UserRequest AS Ur JOIN lnkFunctionalCIToTicket AS lnk ON lnk.ticket_id = Ur.id)"), - array("SELECT Ticket AS T WHERE T. finalclass IN ('userrequest' , 'change') AND T.id NOT IN (SELECT UserRequest AS Ur JOIN lnkFunctionalCIToTicket AS lnk ON lnk.ticket_id = Ur.id UNION SELECT Change AS C JOIN lnkFunctionalCIToTicket AS lnk ON lnk.ticket_id = C.id)"), - array("SELECT PhysicalDevice WHERE status='production' AND id NOT IN (SELECT PhysicalDevice AS p JOIN lnkFunctionalCIToProviderContract AS l ON l.functionalci_id=p.id)"), - array("SELECT Team WHERE id NOT IN (SELECT Team AS t JOIN lnkPersonToTeam AS l ON l.team_id=t.id WHERE 1)"), - ); + return [ + ["SELECT User AS U JOIN Person AS P ON U.contactid = P.id WHERE U.status='enabled' AND U.id NOT IN (SELECT User AS U JOIN Person AS P ON U.contactid=P.id JOIN URP_UserOrg AS L ON L.userid = U.id WHERE U.status='enabled' AND L.allowed_org_id = P.org_id UNION SELECT User AS U WHERE U.status='enabled' AND U.id NOT IN ( SELECT User AS U JOIN URP_UserOrg AS L ON L.userid = U.id WHERE U.status='enabled'))"], + ['SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE `UserRequest`.org_id IN (SELECT `Organization` FROM Organization AS `Organization` JOIN Organization AS `Organization1` ON `Organization`.parent_id BELOW `Organization1`.id WHERE (`Organization1`.`id` = \'3\'))'], + ['SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE `Organization`.`id`=`UserRequest`.`org_id`))'], + ["SELECT UserRequest AS Ur WHERE Ur.id NOT IN (SELECT UserRequest AS Ur JOIN lnkFunctionalCIToTicket AS lnk ON lnk.ticket_id = Ur.id)"], + ["SELECT Ticket AS T WHERE T. finalclass IN ('userrequest' , 'change') AND T.id NOT IN (SELECT UserRequest AS Ur JOIN lnkFunctionalCIToTicket AS lnk ON lnk.ticket_id = Ur.id UNION SELECT Change AS C JOIN lnkFunctionalCIToTicket AS lnk ON lnk.ticket_id = C.id)"], + ["SELECT PhysicalDevice WHERE status='production' AND id NOT IN (SELECT PhysicalDevice AS p JOIN lnkFunctionalCIToProviderContract AS l ON l.functionalci_id=p.id)"], + ["SELECT Team WHERE id NOT IN (SELECT Team AS t JOIN lnkPersonToTeam AS l ON l.team_id=t.id WHERE 1)"], + ]; } - /** - * @dataProvider GoodQueryProvider - * @depends testOQLSetup - * - * @param $sQuery - * - * @throws \OQLException - */ - public function testGoodQueryParser($sQuery) - { - $this->debug($sQuery); - $oOql = new OqlInterpreter($sQuery); - $oQuery = $oOql->ParseQuery(); - static::assertInstanceOf('OqlQuery', $oQuery); - } + /** + * @dataProvider GoodQueryProvider + * @depends testOQLSetup + * + * @param $sQuery + * + * @throws \OQLException + */ + public function testGoodQueryParser($sQuery) + { + $this->debug($sQuery); + $oOql = new OqlInterpreter($sQuery); + $oQuery = $oOql->ParseQuery(); + static::assertInstanceOf('OqlQuery', $oQuery); + } - public function GoodQueryProvider() - { - return array( - array('SELECT toto'), - array('SELECT toto WHERE toto.a = 1'), - array('SELECT toto WHERE toto.a = -1'), - array('SELECT toto WHERE toto.a = (1-1)'), - array('SELECT toto WHERE toto.a = (-1+3)'), - array('SELECT toto WHERE toto.a = (3+-1)'), - array('SELECT toto WHERE toto.a = (3--1)'), - array('SELECT toto WHERE toto.a = 0xC'), - array('SELECT toto WHERE toto.a = \'AXDVFS0xCZ32\''), - array('SELECT toto WHERE toto.a = :myparameter'), - array('SELECT toto WHERE toto.a IN (:param1)'), - array('SELECT toto WHERE toto.a IN (:param1, :param2)'), - array('SELECT toto WHERE toto.a=1'), - array('SELECT toto WHERE toto.a = "1"'), - array('SELECT toto WHERE toto.a & 1'), - array('SELECT toto WHERE toto.a | 1'), - array('SELECT toto WHERE toto.a ^ 1'), - array('SELECT toto WHERE toto.a << 1'), - array('SELECT toto WHERE toto.a >> 1'), - array('SELECT toto WHERE toto.a NOT LIKE "That\'s it"'), - array('SELECT toto WHERE toto.a NOT LIKE "That\'s \\"it\\""'), - array('SELECT toto WHERE toto.a NOT LIKE \'That"s it\''), - array('SELECT toto WHERE toto.a NOT LIKE \'That\\\'s it\''), - array('SELECT toto WHERE toto.a NOT LIKE "blah \\\\ truc"'), - array('SELECT toto WHERE toto.a NOT LIKE \'blah \\\\ truc\''), - array('SELECT toto WHERE toto.a NOT LIKE "\\\\"'), - array('SELECT toto WHERE toto.a NOT LIKE "\\""'), - array('SELECT toto WHERE toto.a NOT LIKE "\\"\\\\"'), - array('SELECT toto WHERE toto.a NOT LIKE "\\\\\\""'), - array('SELECT toto WHERE toto.a NOT LIKE ""'), - array('SELECT toto WHERE toto.a NOT LIKE "blah" AND toto.b LIKE "foo"'), - array('SELECT toto WHERE toto.a = 1 AND toto.b LIKE "x" AND toto.f >= 12345'), - array('SELECT Device JOIN Site ON Device.site = Site.id'), - array('SELECT Device JOIN Site ON Device.site = Site.id JOIN Country ON Site.location = Country.id'), - array('SELECT UserRightsMatrixClassGrant WHERE UserRightsMatrixClassGrant.class = \'lnkContactRealObject\' AND UserRightsMatrixClassGrant.action = \'modify\' AND UserRightsMatrixClassGrant.login = \'Denis\''), - array('SELECT A WHERE A.col1 = \'lit1\' AND A.col2 = \'lit2\' AND A.col3 = \'lit3\''), - array('SELECT A JOIN B ON A.myB = B.id WHERE (A.col1 = 123 AND B.col1 = \'aa\') OR (A.col3 = \'zzz\' AND B.col4 > 100)'), - array('SELECT A JOIN B ON A.myB = B.id WHERE (A.col1 = B.col2 AND B.col1 = A.col2) OR (A.col3 = \'\' AND B.col4 > 100)'), - array('SELECT A JOIN B ON A.myB = B.id WHERE A.col1 + B.col2 * B.col1 = A.col2'), - array('SELECT A JOIN B ON A.myB = B.id WHERE A.col1 + (B.col2 * B.col1) = A.col2'), - array('SELECT A JOIN B ON A.myB = B.id WHERE (A.col1 + B.col2) * B.col1 = A.col2'), - array('SELECT A JOIN B ON A.myB = B.id WHERE (A.col1 & B.col2) = A.col2'), - array('SELECT Device AS D_ JOIN Site AS S_ ON D_.site = S_.id WHERE S_.country = "Francia"'), - array('SELECT A FROM A'), - array('SELECT A JOIN B ON A.myB = B.id WHERE A.col1 = 2'), - array('SELECT A FROM A JOIN B ON A.myB = B.id WHERE A.col1 = 2'), - array('SELECT B FROM A JOIN B ON A.myB = B.id WHERE A.col1 = 2'), - array('SELECT A,B FROM A JOIN B ON A.myB = B.id WHERE A.col1 = 2'), - array('SELECT A, B FROM A JOIN B ON A.myB = B.id WHERE A.col1 = 2'), - array('SELECT B,A FROM A JOIN B ON A.myB = B.id WHERE A.col1 = 2'), - array('SELECT A, B,C FROM A JOIN B ON A.myB = B.id'), - array('SELECT C FROM A JOIN B ON A.myB = B.id WHERE A.col1 = 2'), - array('SELECT A JOIN B ON A.myB BELOW B.id WHERE A.col1 = 2'), - array('SELECT A JOIN B ON B.myA BELOW A.id WHERE A.col1 = 2'), - array('SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id BELOW B.id WHERE A.col1 = 2 AND B.id = 3'), - array('SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id BELOW STRICT B.id WHERE A.col1 = 2 AND B.id = 3'), - array('SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id NOT BELOW B.id WHERE A.col1 = 2 AND B.id = 3'), - array('SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id NOT BELOW STRICT B.id WHERE A.col1 = 2 AND B.id = 3'), - array('SELECT A UNION SELECT B'), - array('SELECT A WHERE A.b = "sdf" UNION SELECT B WHERE B.a = "sfde"'), - array('SELECT A UNION SELECT B UNION SELECT C'), - array('SELECT A UNION SELECT B UNION SELECT C UNION SELECT D'), - array('SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id NOT BELOW B.id WHERE A.col1 = 2 AND B.id = 3 UNION SELECT Device JOIN Site ON Device.site = Site.id JOIN Country ON Site.location = Country.id'), - array('SELECT Person AS B WHERE B.name LIKE \'%A%\''), - array('SELECT Server WHERE name REGEXP \'dbserver[0-9]+\''), - array('SELECT Server WHERE name REGEXP \'^dbserver[0-9]+\\\\..+\\\\.[a-z]{2,3}$\''), - array('SELECT Change AS ch WHERE ch.start_date >= \'2009-12-31\' AND ch.end_date <= \'2010-01-01\''), - array('SELECT DatacenterDevice AS dev WHERE INET_ATON(dev.managementip) > INET_ATON(\'10.22.32.224\') AND INET_ATON(dev.managementip) < INET_ATON(\'10.22.32.255\')'), - array('SELECT Person AS P JOIN Organization AS Node ON P.org_id = Node.id JOIN Organization AS Root ON Node.parent_id BELOW Root.id WHERE Root.id=1'), - array('SELECT PhysicalInterface AS if JOIN DatacenterDevice AS dev ON if.connectableci_id = dev.id WHERE dev.status = \'production\' AND dev.organization_name = \'Demo\''), - array('SELECT Ticket AS t WHERE t.agent_id = :current_contact_id'), - array('SELECT Person AS p JOIN UserRequest AS u ON u.agent_id = p.id WHERE u.status != \'closed\''), - array('SELECT Contract AS c WHERE c.end_date > NOW() AND c.end_date < DATE_ADD(NOW(), INTERVAL 30 DAY)'), - array('SELECT UserRequest AS u WHERE u.start_date < DATE_SUB(NOW(), INTERVAL 60 MINUTE) AND u.status = \'new\''), - array('SELECT UserRequest AS u WHERE u.close_date > DATE_ADD(u.start_date, INTERVAL 8 HOUR)'), - array('SELECT Ticket WHERE tagfield MATCHES \'salad\''), - ); - } + public function GoodQueryProvider() + { + return [ + ['SELECT toto'], + ['SELECT toto WHERE toto.a = 1'], + ['SELECT toto WHERE toto.a = -1'], + ['SELECT toto WHERE toto.a = (1-1)'], + ['SELECT toto WHERE toto.a = (-1+3)'], + ['SELECT toto WHERE toto.a = (3+-1)'], + ['SELECT toto WHERE toto.a = (3--1)'], + ['SELECT toto WHERE toto.a = 0xC'], + ['SELECT toto WHERE toto.a = \'AXDVFS0xCZ32\''], + ['SELECT toto WHERE toto.a = :myparameter'], + ['SELECT toto WHERE toto.a IN (:param1)'], + ['SELECT toto WHERE toto.a IN (:param1, :param2)'], + ['SELECT toto WHERE toto.a=1'], + ['SELECT toto WHERE toto.a = "1"'], + ['SELECT toto WHERE toto.a & 1'], + ['SELECT toto WHERE toto.a | 1'], + ['SELECT toto WHERE toto.a ^ 1'], + ['SELECT toto WHERE toto.a << 1'], + ['SELECT toto WHERE toto.a >> 1'], + ['SELECT toto WHERE toto.a NOT LIKE "That\'s it"'], + ['SELECT toto WHERE toto.a NOT LIKE "That\'s \\"it\\""'], + ['SELECT toto WHERE toto.a NOT LIKE \'That"s it\''], + ['SELECT toto WHERE toto.a NOT LIKE \'That\\\'s it\''], + ['SELECT toto WHERE toto.a NOT LIKE "blah \\\\ truc"'], + ['SELECT toto WHERE toto.a NOT LIKE \'blah \\\\ truc\''], + ['SELECT toto WHERE toto.a NOT LIKE "\\\\"'], + ['SELECT toto WHERE toto.a NOT LIKE "\\""'], + ['SELECT toto WHERE toto.a NOT LIKE "\\"\\\\"'], + ['SELECT toto WHERE toto.a NOT LIKE "\\\\\\""'], + ['SELECT toto WHERE toto.a NOT LIKE ""'], + ['SELECT toto WHERE toto.a NOT LIKE "blah" AND toto.b LIKE "foo"'], + ['SELECT toto WHERE toto.a = 1 AND toto.b LIKE "x" AND toto.f >= 12345'], + ['SELECT Device JOIN Site ON Device.site = Site.id'], + ['SELECT Device JOIN Site ON Device.site = Site.id JOIN Country ON Site.location = Country.id'], + ['SELECT UserRightsMatrixClassGrant WHERE UserRightsMatrixClassGrant.class = \'lnkContactRealObject\' AND UserRightsMatrixClassGrant.action = \'modify\' AND UserRightsMatrixClassGrant.login = \'Denis\''], + ['SELECT A WHERE A.col1 = \'lit1\' AND A.col2 = \'lit2\' AND A.col3 = \'lit3\''], + ['SELECT A JOIN B ON A.myB = B.id WHERE (A.col1 = 123 AND B.col1 = \'aa\') OR (A.col3 = \'zzz\' AND B.col4 > 100)'], + ['SELECT A JOIN B ON A.myB = B.id WHERE (A.col1 = B.col2 AND B.col1 = A.col2) OR (A.col3 = \'\' AND B.col4 > 100)'], + ['SELECT A JOIN B ON A.myB = B.id WHERE A.col1 + B.col2 * B.col1 = A.col2'], + ['SELECT A JOIN B ON A.myB = B.id WHERE A.col1 + (B.col2 * B.col1) = A.col2'], + ['SELECT A JOIN B ON A.myB = B.id WHERE (A.col1 + B.col2) * B.col1 = A.col2'], + ['SELECT A JOIN B ON A.myB = B.id WHERE (A.col1 & B.col2) = A.col2'], + ['SELECT Device AS D_ JOIN Site AS S_ ON D_.site = S_.id WHERE S_.country = "Francia"'], + ['SELECT A FROM A'], + ['SELECT A JOIN B ON A.myB = B.id WHERE A.col1 = 2'], + ['SELECT A FROM A JOIN B ON A.myB = B.id WHERE A.col1 = 2'], + ['SELECT B FROM A JOIN B ON A.myB = B.id WHERE A.col1 = 2'], + ['SELECT A,B FROM A JOIN B ON A.myB = B.id WHERE A.col1 = 2'], + ['SELECT A, B FROM A JOIN B ON A.myB = B.id WHERE A.col1 = 2'], + ['SELECT B,A FROM A JOIN B ON A.myB = B.id WHERE A.col1 = 2'], + ['SELECT A, B,C FROM A JOIN B ON A.myB = B.id'], + ['SELECT C FROM A JOIN B ON A.myB = B.id WHERE A.col1 = 2'], + ['SELECT A JOIN B ON A.myB BELOW B.id WHERE A.col1 = 2'], + ['SELECT A JOIN B ON B.myA BELOW A.id WHERE A.col1 = 2'], + ['SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id BELOW B.id WHERE A.col1 = 2 AND B.id = 3'], + ['SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id BELOW STRICT B.id WHERE A.col1 = 2 AND B.id = 3'], + ['SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id NOT BELOW B.id WHERE A.col1 = 2 AND B.id = 3'], + ['SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id NOT BELOW STRICT B.id WHERE A.col1 = 2 AND B.id = 3'], + ['SELECT A UNION SELECT B'], + ['SELECT A WHERE A.b = "sdf" UNION SELECT B WHERE B.a = "sfde"'], + ['SELECT A UNION SELECT B UNION SELECT C'], + ['SELECT A UNION SELECT B UNION SELECT C UNION SELECT D'], + ['SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id NOT BELOW B.id WHERE A.col1 = 2 AND B.id = 3 UNION SELECT Device JOIN Site ON Device.site = Site.id JOIN Country ON Site.location = Country.id'], + ['SELECT Person AS B WHERE B.name LIKE \'%A%\''], + ['SELECT Server WHERE name REGEXP \'dbserver[0-9]+\''], + ['SELECT Server WHERE name REGEXP \'^dbserver[0-9]+\\\\..+\\\\.[a-z]{2,3}$\''], + ['SELECT Change AS ch WHERE ch.start_date >= \'2009-12-31\' AND ch.end_date <= \'2010-01-01\''], + ['SELECT DatacenterDevice AS dev WHERE INET_ATON(dev.managementip) > INET_ATON(\'10.22.32.224\') AND INET_ATON(dev.managementip) < INET_ATON(\'10.22.32.255\')'], + ['SELECT Person AS P JOIN Organization AS Node ON P.org_id = Node.id JOIN Organization AS Root ON Node.parent_id BELOW Root.id WHERE Root.id=1'], + ['SELECT PhysicalInterface AS if JOIN DatacenterDevice AS dev ON if.connectableci_id = dev.id WHERE dev.status = \'production\' AND dev.organization_name = \'Demo\''], + ['SELECT Ticket AS t WHERE t.agent_id = :current_contact_id'], + ['SELECT Person AS p JOIN UserRequest AS u ON u.agent_id = p.id WHERE u.status != \'closed\''], + ['SELECT Contract AS c WHERE c.end_date > NOW() AND c.end_date < DATE_ADD(NOW(), INTERVAL 30 DAY)'], + ['SELECT UserRequest AS u WHERE u.start_date < DATE_SUB(NOW(), INTERVAL 60 MINUTE) AND u.status = \'new\''], + ['SELECT UserRequest AS u WHERE u.close_date > DATE_ADD(u.start_date, INTERVAL 8 HOUR)'], + ['SELECT Ticket WHERE tagfield MATCHES \'salad\''], + ]; + } - /** - * @dataProvider BadQueryProvider - * @depends testOQLSetup - * - * @param $sQuery - * @param $sExpectedExceptionClass - * - */ - public function testBadQueryParser($sQuery, $sExpectedExceptionClass) - { - $this->debug($sQuery); - $oOql = new OqlInterpreter($sQuery); - $sExceptionClass = ''; - try - { - $oOql->ParseQuery(); - } - catch (Exception $e) - { - $sExceptionClass = get_class($e); - } + /** + * @dataProvider BadQueryProvider + * @depends testOQLSetup + * + * @param $sQuery + * @param $sExpectedExceptionClass + * + */ + public function testBadQueryParser($sQuery, $sExpectedExceptionClass) + { + $this->debug($sQuery); + $oOql = new OqlInterpreter($sQuery); + $sExceptionClass = ''; + try { + $oOql->ParseQuery(); + } catch (Exception $e) { + $sExceptionClass = get_class($e); + } - static::assertEquals($sExpectedExceptionClass, $sExceptionClass); - } + static::assertEquals($sExpectedExceptionClass, $sExceptionClass); + } - public function BadQueryProvider() - { - return array( - array('SELECT toto WHERE toto.a = (3++1)', 'OQLParserSyntaxErrorException'), - array('SELECT toto WHHHERE toto.a = "1"', 'OQLParserSyntaxErrorException'), - array('SELECT toto WHERE toto.a == "1"', 'OQLParserSyntaxErrorException'), - array('SELECT toto WHERE toto.a % 1', 'Exception'), - array('SELECT toto WHERE toto.a like \'arg\'', 'OQLParserSyntaxErrorException'), - array('SELECT toto WHERE toto.a NOT LIKE "That\'s "it""', 'OQLParserSyntaxErrorException'), - array('SELECT toto WHERE toto.a NOT LIKE \'That\'s it\'', 'OQLParserSyntaxErrorException'), - array('SELECT toto WHERE toto.a NOT LIKE "blah \\ truc"', 'Exception'), - array('SELECT toto WHERE toto.a NOT LIKE \'blah \\ truc\'', 'Exception'), - array('SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id = B.id WHERE A.col1 BELOW 2 AND B.id = 3', 'OQLParserSyntaxErrorException'), - ); - } + public function BadQueryProvider() + { + return [ + ['SELECT toto WHERE toto.a = (3++1)', 'OQLParserSyntaxErrorException'], + ['SELECT toto WHHHERE toto.a = "1"', 'OQLParserSyntaxErrorException'], + ['SELECT toto WHERE toto.a == "1"', 'OQLParserSyntaxErrorException'], + ['SELECT toto WHERE toto.a % 1', 'Exception'], + ['SELECT toto WHERE toto.a like \'arg\'', 'OQLParserSyntaxErrorException'], + ['SELECT toto WHERE toto.a NOT LIKE "That\'s "it""', 'OQLParserSyntaxErrorException'], + ['SELECT toto WHERE toto.a NOT LIKE \'That\'s it\'', 'OQLParserSyntaxErrorException'], + ['SELECT toto WHERE toto.a NOT LIKE "blah \\ truc"', 'Exception'], + ['SELECT toto WHERE toto.a NOT LIKE \'blah \\ truc\'', 'Exception'], + ['SELECT A JOIN B ON A.myB = B.id JOIN C ON C.parent_id = B.id WHERE A.col1 BELOW 2 AND B.id = 3', 'OQLParserSyntaxErrorException'], + ]; + } - /** - * Needs actual datamodel - * @depends testOQLSetup - * - * @dataProvider QueryNormalizationProvider - * - * @param $sQuery - * @param $sExpectedExceptionClass - * - */ - public function testQueryNormalization($sQuery, $sExpectedExceptionClass) - { - $this->debug($sQuery); - $sExceptionClass = ''; - try - { - $oSearch = DBObjectSearch::FromOQL($sQuery); - static::assertInstanceOf('DBObjectSearch', $oSearch); - } - catch (Exception $e) - { - $sExceptionClass = get_class($e); - } + /** + * Needs actual datamodel + * @depends testOQLSetup + * + * @dataProvider QueryNormalizationProvider + * + * @param $sQuery + * @param $sExpectedExceptionClass + * + */ + public function testQueryNormalization($sQuery, $sExpectedExceptionClass) + { + $this->debug($sQuery); + $sExceptionClass = ''; + try { + $oSearch = DBObjectSearch::FromOQL($sQuery); + static::assertInstanceOf('DBObjectSearch', $oSearch); + } catch (Exception $e) { + $sExceptionClass = get_class($e); + } - static::assertEquals($sExpectedExceptionClass, $sExceptionClass); - } + static::assertEquals($sExpectedExceptionClass, $sExceptionClass); + } + public function QueryNormalizationProvider() + { + return [ + ['SELECT Contact', ''], + ['SELECT Contact WHERE nom_de_famille = "foo"', 'OqlNormalizeException'], + ['SELECT Contact AS c WHERE name = "foo"', ''], + ['SELECT Contact AS c WHERE nom_de_famille = "foo"', 'OqlNormalizeException'], + ['SELECT Contact AS c WHERE c.name = "foo"', ''], + ['SELECT Contact AS c WHERE Contact.name = "foo"', 'OqlNormalizeException'], + ['SELECT Contact AS c WHERE x.name = "foo"', 'OqlNormalizeException'], - public function QueryNormalizationProvider() - { - return array( - array('SELECT Contact', ''), - array('SELECT Contact WHERE nom_de_famille = "foo"', 'OqlNormalizeException'), - array('SELECT Contact AS c WHERE name = "foo"', ''), - array('SELECT Contact AS c WHERE nom_de_famille = "foo"', 'OqlNormalizeException'), - array('SELECT Contact AS c WHERE c.name = "foo"', ''), - array('SELECT Contact AS c WHERE Contact.name = "foo"', 'OqlNormalizeException'), - array('SELECT Contact AS c WHERE x.name = "foo"', 'OqlNormalizeException'), + ['SELECT Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id', ''], + ['SELECT Organization AS root JOIN Organization AS child ON child.parent_id BELOW root.id', ''], - array('SELECT Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id', ''), - array('SELECT Organization AS root JOIN Organization AS child ON child.parent_id BELOW root.id', ''), + ['SELECT RelationProfessionnelle', 'UnknownClassOqlException'], + ['SELECT RelationProfessionnelle AS c WHERE name = "foo"', 'UnknownClassOqlException'], - array('SELECT RelationProfessionnelle', 'UnknownClassOqlException'), - array('SELECT RelationProfessionnelle AS c WHERE name = "foo"', 'UnknownClassOqlException'), + // The first query is the base query altered only in one place in the subsequent queries + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.id WHERE p.name LIKE "foo"', ''], + ['SELECT Person AS p JOIN lnkXXXXXXXXXXXX AS lnk ON lnk.person_id = p.id WHERE p.name LIKE "foo"', 'UnknownClassOqlException'], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON p.person_id = p.id WHERE p.name LIKE "foo"', 'OqlNormalizeException'], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON person_id = p.id WHERE p.name LIKE "foo"', 'OqlNormalizeException'], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = id WHERE p.name LIKE "foo"', 'OqlNormalizeException'], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.role = p.id WHERE p.name LIKE "foo"', 'OqlNormalizeException'], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.team_id = p.id WHERE p.name LIKE "foo"', 'OqlNormalizeException'], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id BELOW p.id WHERE p.name LIKE "bar"', ''], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.org_id WHERE p.name LIKE "foo"', 'OqlNormalizeException'], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON p.id = lnk.person_id WHERE p.name LIKE "foo"', 'OqlNormalizeException'], // inverted the JOIN spec + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.id WHERE name LIKE "foo"', ''], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.id WHERE x.name LIKE "foo"', 'OqlNormalizeException'], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.id WHERE p.eman LIKE "foo"', 'OqlNormalizeException'], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.id WHERE eman LIKE "foo"', 'OqlNormalizeException'], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.id WHERE id = 1', 'OqlNormalizeException'], + ['SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON p.id = lnk.person_id WHERE p.name LIKE "foo"', 'OqlNormalizeException'], - // The first query is the base query altered only in one place in the subsequent queries - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.id WHERE p.name LIKE "foo"', ''), - array('SELECT Person AS p JOIN lnkXXXXXXXXXXXX AS lnk ON lnk.person_id = p.id WHERE p.name LIKE "foo"', 'UnknownClassOqlException'), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON p.person_id = p.id WHERE p.name LIKE "foo"', 'OqlNormalizeException'), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON person_id = p.id WHERE p.name LIKE "foo"', 'OqlNormalizeException'), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = id WHERE p.name LIKE "foo"', 'OqlNormalizeException'), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.role = p.id WHERE p.name LIKE "foo"', 'OqlNormalizeException'), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.team_id = p.id WHERE p.name LIKE "foo"', 'OqlNormalizeException'), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id BELOW p.id WHERE p.name LIKE "bar"', ''), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.org_id WHERE p.name LIKE "foo"', 'OqlNormalizeException'), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON p.id = lnk.person_id WHERE p.name LIKE "foo"', 'OqlNormalizeException'), // inverted the JOIN spec - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.id WHERE name LIKE "foo"', ''), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.id WHERE x.name LIKE "foo"', 'OqlNormalizeException'), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.id WHERE p.eman LIKE "foo"', 'OqlNormalizeException'), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.id WHERE eman LIKE "foo"', 'OqlNormalizeException'), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON lnk.person_id = p.id WHERE id = 1', 'OqlNormalizeException'), - array('SELECT Person AS p JOIN lnkPersonToTeam AS lnk ON p.id = lnk.person_id WHERE p.name LIKE "foo"', 'OqlNormalizeException'), + ['SELECT Person AS p JOIN Organization AS o ON p.org_id = o.id WHERE p.name LIKE "foo" AND o.name LIKE "land"', ''], + ['SELECT Person AS p JOIN Organization AS o ON p.location_id = o.id WHERE p.name LIKE "foo" AND o.name LIKE "land"', 'OqlNormalizeException'], + ['SELECT Person AS p JOIN Organization AS o ON p.name = o.id WHERE p.name LIKE "foo" AND o.name LIKE "land"', 'OqlNormalizeException'], - array('SELECT Person AS p JOIN Organization AS o ON p.org_id = o.id WHERE p.name LIKE "foo" AND o.name LIKE "land"', ''), - array('SELECT Person AS p JOIN Organization AS o ON p.location_id = o.id WHERE p.name LIKE "foo" AND o.name LIKE "land"', 'OqlNormalizeException'), - array('SELECT Person AS p JOIN Organization AS o ON p.name = o.id WHERE p.name LIKE "foo" AND o.name LIKE "land"', 'OqlNormalizeException'), + ['SELECT Person AS p JOIN Organization AS o ON p.org_id = o.id JOIN Person AS p ON p.org_id = o.id', 'OqlNormalizeException'], + ['SELECT Person JOIN Organization AS o ON Person.org_id = o.id JOIN Person ON Person.org_id = o.id', 'OqlNormalizeException'], - array('SELECT Person AS p JOIN Organization AS o ON p.org_id = o.id JOIN Person AS p ON p.org_id = o.id', 'OqlNormalizeException'), - array('SELECT Person JOIN Organization AS o ON Person.org_id = o.id JOIN Person ON Person.org_id = o.id', 'OqlNormalizeException'), + ['SELECT Person AS p JOIN Location AS l ON p.location_id = l.id', ''], + ['SELECT Person AS p JOIN Location AS l ON p.location_id BELOW l.id', 'OqlNormalizeException'], - array('SELECT Person AS p JOIN Location AS l ON p.location_id = l.id', ''), - array('SELECT Person AS p JOIN Location AS l ON p.location_id BELOW l.id', 'OqlNormalizeException'), - - array('SELECT Person FROM Person JOIN Location ON Person.location_id = Location.id', ''), - array('SELECT p FROM Person AS p JOIN Location AS l ON p.location_id = l.id', ''), - array('SELECT l FROM Person AS p JOIN Location AS l ON p.location_id = l.id', ''), - array('SELECT l, p FROM Person AS p JOIN Location AS l ON p.location_id = l.id', ''), - array('SELECT p, l FROM Person AS p JOIN Location AS l ON p.location_id = l.id', ''), - array('SELECT foo FROM Person AS p JOIN Location AS l ON p.location_id = l.id', 'OqlNormalizeException'), - array('SELECT p, foo FROM Person AS p JOIN Location AS l ON p.location_id = l.id', 'OqlNormalizeException'), - - // Joins based on AttributeObjectKey - // - array('SELECT Attachment AS a JOIN UserRequest AS r ON a.item_id = r.id', ''), - array('SELECT UserRequest AS r JOIN Attachment AS a ON a.item_id = r.id', ''), - ); - } + ['SELECT Person FROM Person JOIN Location ON Person.location_id = Location.id', ''], + ['SELECT p FROM Person AS p JOIN Location AS l ON p.location_id = l.id', ''], + ['SELECT l FROM Person AS p JOIN Location AS l ON p.location_id = l.id', ''], + ['SELECT l, p FROM Person AS p JOIN Location AS l ON p.location_id = l.id', ''], + ['SELECT p, l FROM Person AS p JOIN Location AS l ON p.location_id = l.id', ''], + ['SELECT foo FROM Person AS p JOIN Location AS l ON p.location_id = l.id', 'OqlNormalizeException'], + ['SELECT p, foo FROM Person AS p JOIN Location AS l ON p.location_id = l.id', 'OqlNormalizeException'], + // Joins based on AttributeObjectKey + // + ['SELECT Attachment AS a JOIN UserRequest AS r ON a.item_id = r.id', ''], + ['SELECT UserRequest AS r JOIN Attachment AS a ON a.item_id = r.id', ''], + ]; + } /** * @depends testOQLSetup @@ -330,7 +321,7 @@ class OQLTest extends ItopDataTestCase public function OQLIntersectProvider() { - return array( + return [ // Wrong result: /* SELECT `SSC` @@ -348,17 +339,17 @@ class OQLTest extends ItopDataTestCase // "SELECT ServiceSubcategory AS ssc JOIN Service AS s ON ssc.service_id=s.id JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :current_contact->org_id AND ssc.status != 'obsolete'", // "SELECT `SSC` FROM ServiceSubcategory AS `SSC` JOIN Service AS `S` ON `SSC`.service_id = `S`.id JOIN lnkCustomerContractToService AS `l11` ON `l11`.service_id = `S`.id JOIN CustomerContract AS `cc` ON `l11`.customercontract_id = `cc`.id JOIN lnkGRTypeToServiceSubcategory AS `l1` ON `l1`.servicesubcategory_id = `SSC`.id JOIN GRType AS `GRT` ON `l1`.grtype_id = `GRT`.id WHERE ((`GRT`.`id` = :grtype_id) AND ((`cc`.`org_id` = :current_contact->org_id) AND (`SSC`.`status` != 'obsolete')))" // ), - 'Person' => array( + 'Person' => [ "SELECT P FROM Person AS P JOIN lnkPersonToTeam AS l1 ON l1.person_id = P.id JOIN Team AS T ON l1.team_id = T.id WHERE T.id = 3", "SELECT p FROM Person AS p JOIN Person AS mgr ON p.manager_id = mgr.id JOIN lnkContactToTicket AS l1 ON l1.contact_id = mgr.id JOIN Ticket AS T ON l1.ticket_id = T.id WHERE T.id = 4 AND p.id = 3", - "SELECT `P` FROM Person AS `P` JOIN Person AS `mgr` ON `P`.manager_id = `mgr`.id JOIN lnkContactToTicket AS `l11` ON `l11`.contact_id = `mgr`.id JOIN Ticket AS `T1` ON `l11`.ticket_id = `T1`.id JOIN lnkPersonToTeam AS `l1` ON `l1`.person_id = `P`.id JOIN Team AS `T` ON `l1`.team_id = `T`.id WHERE ((`T`.`id` = 3) AND ((`T1`.`id` = 4) AND (`P`.`id` = 3)))" - ), - 'Person2' => array( + "SELECT `P` FROM Person AS `P` JOIN Person AS `mgr` ON `P`.manager_id = `mgr`.id JOIN lnkContactToTicket AS `l11` ON `l11`.contact_id = `mgr`.id JOIN Ticket AS `T1` ON `l11`.ticket_id = `T1`.id JOIN lnkPersonToTeam AS `l1` ON `l1`.person_id = `P`.id JOIN Team AS `T` ON `l1`.team_id = `T`.id WHERE ((`T`.`id` = 3) AND ((`T1`.`id` = 4) AND (`P`.`id` = 3)))", + ], + 'Person2' => [ "SELECT P FROM Person AS P JOIN lnkPersonToTeam AS l1 ON l1.person_id = P.id JOIN Team AS T ON l1.team_id = T.id JOIN Person AS MGR ON P.manager_id = MGR.id WHERE T.id = 3", "SELECT p FROM Person AS p JOIN Person AS mgr ON p.manager_id = mgr.id JOIN lnkContactToTicket AS l1 ON l1.contact_id = mgr.id JOIN Ticket AS T ON l1.ticket_id = T.id WHERE T.id = 4 AND p.id = 3", - "SELECT `P` FROM Person AS `P` JOIN Person AS `MGR` ON `P`.manager_id = `MGR`.id JOIN lnkContactToTicket AS `l11` ON `l11`.contact_id = `MGR`.id JOIN Ticket AS `T1` ON `l11`.ticket_id = `T1`.id JOIN lnkPersonToTeam AS `l1` ON `l1`.person_id = `P`.id JOIN Team AS `T` ON `l1`.team_id = `T`.id WHERE ((`T`.`id` = 3) AND ((`T1`.`id` = 4) AND (`P`.`id` = 3)))" - ), - ); + "SELECT `P` FROM Person AS `P` JOIN Person AS `MGR` ON `P`.manager_id = `MGR`.id JOIN lnkContactToTicket AS `l11` ON `l11`.contact_id = `MGR`.id JOIN Ticket AS `T1` ON `l11`.ticket_id = `T1`.id JOIN lnkPersonToTeam AS `l1` ON `l1`.person_id = `P`.id JOIN Team AS `T` ON `l1`.team_id = `T`.id WHERE ((`T`.`id` = 3) AND ((`T1`.`id` = 4) AND (`P`.`id` = 3)))", + ], + ]; } /** @@ -369,13 +360,10 @@ class OQLTest extends ItopDataTestCase public function testMakeSelectQuery($sOQL, $sExpectedExceptionClass = '') { $sExceptionClass = ''; - try - { + try { $oSearch = DBSearch::FromOQL($sOQL); CMDBSource::TestQuery($oSearch->MakeSelectQuery()); - } - catch (Exception $e) - { + } catch (Exception $e) { $this->debug($e->getMessage()); $sExceptionClass = get_class($e); } @@ -385,22 +373,21 @@ class OQLTest extends ItopDataTestCase public function MakeSelectQueryProvider() { - return array( - array("SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `Toto`.`org_id`)))", 'OqlNormalizeException'), - array("SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))"), - array("SELECT `U` FROM User AS `U` JOIN Person AS `P` ON `U`.contactid = `P`.id WHERE ((`U`.`status` = 'enabled') AND (`U`.`id` NOT IN (SELECT `U` FROM User AS `U` JOIN Person AS `P` ON `U`.contactid = `P`.id JOIN URP_UserOrg AS `L` ON `L`.userid = `U`.id WHERE ((`U`.`status` = 'enabled') AND (`L`.`allowed_org_id` = `P`.`org_id`)) UNION SELECT `U` FROM User AS `U` WHERE ((`U`.`status` = 'enabled') AND (`U`.`id` NOT IN (SELECT `U` FROM User AS `U` JOIN URP_UserOrg AS `L` ON `L`.userid = `U`.id WHERE (`U`.`status` = 'enabled')))))))"), - array("SELECT `Ur` FROM UserRequest AS `Ur` WHERE (`Ur`.`id` NOT IN (SELECT `Ur` FROM UserRequest AS `Ur` JOIN lnkFunctionalCIToTicket AS `lnk` ON `lnk`.ticket_id = `Ur`.id WHERE 1))"), - array("SELECT `T` FROM Ticket AS `T` WHERE ((`T`.`finalclass` IN ('userrequest', 'change')) AND (`T`.`id` NOT IN (SELECT `Ur` FROM UserRequest AS `Ur` JOIN lnkFunctionalCIToTicket AS `lnk` ON `lnk`.ticket_id = `Ur`.id WHERE 1 UNION SELECT `C` FROM Change AS `C` JOIN lnkFunctionalCIToTicket AS `lnk` ON `lnk`.ticket_id = `C`.id WHERE 1)))"), - array("SELECT `PhysicalDevice` FROM PhysicalDevice AS `PhysicalDevice` WHERE ((`PhysicalDevice`.`status` = 'production') AND (`PhysicalDevice`.`id` NOT IN (SELECT `p` FROM PhysicalDevice AS `p` JOIN lnkFunctionalCIToProviderContract AS `l` ON `l`.functionalci_id = `p`.id WHERE 1)))"), - array("SELECT `U` FROM User AS `U` JOIN Person AS `P` ON `U`.contactid = `P`.id WHERE ((`U`.`status` = 'enabled') AND (`U`.`id` NOT IN (SELECT `U` FROM User AS `U` JOIN Person AS `P` ON `U`.contactid = `P`.id JOIN URP_UserOrg AS `L` ON `L`.userid = `U`.id WHERE ((`U1`.`status` = 'enabled') AND (`L`.`allowed_org_id` = `P`.`org_id`)) UNION SELECT `U` FROM User AS `U` WHERE ((`U`.`status` = 'enabled') AND (`U`.`id` NOT IN (SELECT `U` FROM User AS `U` JOIN URP_UserOrg AS `L` ON `L`.userid = `U`.id WHERE (`U`.`status` = 'enabled')))))))", "OqlNormalizeException"), - array("SELECT Team WHERE id NOT IN (SELECT Team AS t JOIN lnkPersonToTeam AS l ON l.team_id=t.id WHERE 1)"), - array("SELECT UserRequest WHERE id NOT IN (SELECT UserRequest AS u JOIN lnkFunctionalCIToTicket AS l ON l.ticket_id=u.id JOIN PhysicalDevice AS f ON l.functionalci_id=f.id WHERE f.status='production')"), - array("SELECT UserRequest WHERE id NOT IN (SELECT UserRequest AS u JOIN lnkFunctionalCIToTicket AS l ON l.ticket_id=u.id JOIN PhysicalDevice AS f ON l.functionalci_id=f.id WHERE f.status='production' UNION SELECT UserRequest AS u JOIN lnkFunctionalCIToTicket AS l ON l.ticket_id=u.id JOIN ApplicationSolution AS f ON l.functionalci_id=f.id WHERE f.status='active')"), - array("SELECT Person WHERE status='active' AND id NOT IN (SELECT Person AS p JOIN User AS u ON u.contactid=p.id WHERE u.status='enabled')"), - ); + return [ + ["SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `Toto`.`org_id`)))", 'OqlNormalizeException'], + ["SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))"], + ["SELECT `U` FROM User AS `U` JOIN Person AS `P` ON `U`.contactid = `P`.id WHERE ((`U`.`status` = 'enabled') AND (`U`.`id` NOT IN (SELECT `U` FROM User AS `U` JOIN Person AS `P` ON `U`.contactid = `P`.id JOIN URP_UserOrg AS `L` ON `L`.userid = `U`.id WHERE ((`U`.`status` = 'enabled') AND (`L`.`allowed_org_id` = `P`.`org_id`)) UNION SELECT `U` FROM User AS `U` WHERE ((`U`.`status` = 'enabled') AND (`U`.`id` NOT IN (SELECT `U` FROM User AS `U` JOIN URP_UserOrg AS `L` ON `L`.userid = `U`.id WHERE (`U`.`status` = 'enabled')))))))"], + ["SELECT `Ur` FROM UserRequest AS `Ur` WHERE (`Ur`.`id` NOT IN (SELECT `Ur` FROM UserRequest AS `Ur` JOIN lnkFunctionalCIToTicket AS `lnk` ON `lnk`.ticket_id = `Ur`.id WHERE 1))"], + ["SELECT `T` FROM Ticket AS `T` WHERE ((`T`.`finalclass` IN ('userrequest', 'change')) AND (`T`.`id` NOT IN (SELECT `Ur` FROM UserRequest AS `Ur` JOIN lnkFunctionalCIToTicket AS `lnk` ON `lnk`.ticket_id = `Ur`.id WHERE 1 UNION SELECT `C` FROM Change AS `C` JOIN lnkFunctionalCIToTicket AS `lnk` ON `lnk`.ticket_id = `C`.id WHERE 1)))"], + ["SELECT `PhysicalDevice` FROM PhysicalDevice AS `PhysicalDevice` WHERE ((`PhysicalDevice`.`status` = 'production') AND (`PhysicalDevice`.`id` NOT IN (SELECT `p` FROM PhysicalDevice AS `p` JOIN lnkFunctionalCIToProviderContract AS `l` ON `l`.functionalci_id = `p`.id WHERE 1)))"], + ["SELECT `U` FROM User AS `U` JOIN Person AS `P` ON `U`.contactid = `P`.id WHERE ((`U`.`status` = 'enabled') AND (`U`.`id` NOT IN (SELECT `U` FROM User AS `U` JOIN Person AS `P` ON `U`.contactid = `P`.id JOIN URP_UserOrg AS `L` ON `L`.userid = `U`.id WHERE ((`U1`.`status` = 'enabled') AND (`L`.`allowed_org_id` = `P`.`org_id`)) UNION SELECT `U` FROM User AS `U` WHERE ((`U`.`status` = 'enabled') AND (`U`.`id` NOT IN (SELECT `U` FROM User AS `U` JOIN URP_UserOrg AS `L` ON `L`.userid = `U`.id WHERE (`U`.`status` = 'enabled')))))))", "OqlNormalizeException"], + ["SELECT Team WHERE id NOT IN (SELECT Team AS t JOIN lnkPersonToTeam AS l ON l.team_id=t.id WHERE 1)"], + ["SELECT UserRequest WHERE id NOT IN (SELECT UserRequest AS u JOIN lnkFunctionalCIToTicket AS l ON l.ticket_id=u.id JOIN PhysicalDevice AS f ON l.functionalci_id=f.id WHERE f.status='production')"], + ["SELECT UserRequest WHERE id NOT IN (SELECT UserRequest AS u JOIN lnkFunctionalCIToTicket AS l ON l.ticket_id=u.id JOIN PhysicalDevice AS f ON l.functionalci_id=f.id WHERE f.status='production' UNION SELECT UserRequest AS u JOIN lnkFunctionalCIToTicket AS l ON l.ticket_id=u.id JOIN ApplicationSolution AS f ON l.functionalci_id=f.id WHERE f.status='active')"], + ["SELECT Person WHERE status='active' AND id NOT IN (SELECT Person AS p JOIN User AS u ON u.contactid=p.id WHERE u.status='enabled')"], + ]; } - /** * @dataProvider GetOQLClassTreeProvider * @param $sOQL @@ -409,13 +396,11 @@ class OQLTest extends ItopDataTestCase public function testGetOQLClassTree($sOQL, $sExpectedOQL) { $oFilter = DBSearch::FromOQL($sOQL); - $aCountAttToLoad = array(); + $aCountAttToLoad = []; $sMainClass = null; - foreach ($oFilter->GetSelectedClasses() as $sClassAlias => $sClass) - { - $aCountAttToLoad[$sClassAlias] = array(); - if (empty($sMainClass)) - { + foreach ($oFilter->GetSelectedClasses() as $sClassAlias => $sClass) { + $aCountAttToLoad[$sClassAlias] = []; + if (empty($sMainClass)) { $sMainClass = $sClass; } } @@ -461,10 +446,10 @@ class OQLTest extends ItopDataTestCase { $oFilter = DBSearch::FromOQL($sOQL); // Avoid adding all the fields for counts or "group by" requests - $aCountAttToLoad = array(); + $aCountAttToLoad = []; $sMainClass = null; foreach ($oFilter->GetSelectedClasses() as $sClassAlias => $sClass) { - $aCountAttToLoad[$sClassAlias] = array(); + $aCountAttToLoad[$sClassAlias] = []; if (empty($sMainClass)) { $sMainClass = $sClass; } diff --git a/tests/php-unit-tests/unitary-tests/core/RestServicesSanitizeOutputTest.php b/tests/php-unit-tests/unitary-tests/core/RestServicesSanitizeOutputTest.php index 57210df95..bab1fe2b4 100644 --- a/tests/php-unit-tests/unitary-tests/core/RestServicesSanitizeOutputTest.php +++ b/tests/php-unit-tests/unitary-tests/core/RestServicesSanitizeOutputTest.php @@ -1,4 +1,5 @@ self::SIMPLE_PASSWORD + $oContactTest = MetaModel::NewObject( + 'ContactTest', + [ + 'password' => self::SIMPLE_PASSWORD, ] ); $oRestResultWithObject = new RestResultWithObjects(); @@ -46,7 +49,8 @@ class RestServicesSanitizeOutputTest extends ItopCustomDatamodelTestCase $oRestResultWithObject->SanitizeContent(); static::assertJsonStringEqualsJsonString( '{"objects":{"ContactTest::-1":{"code":0,"message":"ok","class":"ContactTest","key":-1,"fields":{"password":"*****"}}},"code":0,"message":null}', - json_encode($oRestResultWithObject)); + json_encode($oRestResultWithObject) + ); } /** @@ -55,8 +59,10 @@ class RestServicesSanitizeOutputTest extends ItopCustomDatamodelTestCase */ public function testSanitizeAttributeExternalFieldOnLink() { - $oContactTest = $this->createObject('ContactTest', [ - 'password' => self::SIMPLE_PASSWORD + $oContactTest = $this->createObject( + 'ContactTest', + [ + 'password' => self::SIMPLE_PASSWORD, ] ); @@ -64,26 +70,31 @@ class RestServicesSanitizeOutputTest extends ItopCustomDatamodelTestCase 'name' => 'test_server', ]); - // create lnkContactTestToServer $oLnkContactTestToServer = $this->createObject('lnkContactTestToServer', [ 'contact_test_id' => $oContactTest->GetKey(), - 'test_server_id' => $oTestServer->GetKey() + 'test_server_id' => $oTestServer->GetKey(), ]); $oRestResultWithObject = new RestResultWithObjects(); - $oRestResultWithObject->AddObject(0, 'ok', $oLnkContactTestToServer, - ['lnkContactTestToServer' => ['contact_test_password']]); + $oRestResultWithObject->AddObject( + 0, + 'ok', + $oLnkContactTestToServer, + ['lnkContactTestToServer' => ['contact_test_password']] + ); $oRestResultWithObject->SanitizeContent(); static::assertStringContainsString( '*****', - json_encode($oRestResultWithObject)); + json_encode($oRestResultWithObject) + ); static::assertStringNotContainsString( self::SIMPLE_PASSWORD, - json_encode($oRestResultWithObject)); + json_encode($oRestResultWithObject) + ); } /** @@ -92,7 +103,7 @@ class RestServicesSanitizeOutputTest extends ItopCustomDatamodelTestCase public function testSanitizeAttributeOnObjectRelatedThroughNNRelation() { $oContactTest = $this->createObject('ContactTest', [ - 'password' => self::SIMPLE_PASSWORD + 'password' => self::SIMPLE_PASSWORD, ]); $oTestServer = $this->createObject('TestServer', [ @@ -102,26 +113,31 @@ class RestServicesSanitizeOutputTest extends ItopCustomDatamodelTestCase // create lnkContactTestToServer $this->createObject('lnkContactTestToServer', [ 'contact_test_id' => $oContactTest->GetKey(), - 'test_server_id' => $oTestServer->GetKey() + 'test_server_id' => $oTestServer->GetKey(), ]); $oTestServer->Reload(); $oRestResultWithObject = new RestResultWithObjects(); - $oRestResultWithObject->AddObject(0, 'ok', $oTestServer, - ['TestServer' => ['contact_list']]); + $oRestResultWithObject->AddObject( + 0, + 'ok', + $oTestServer, + ['TestServer' => ['contact_list']] + ); $oRestResultWithObject->SanitizeContent(); static::assertStringContainsString( '*****', - json_encode($oRestResultWithObject)); + json_encode($oRestResultWithObject) + ); static::assertStringNotContainsString( self::SIMPLE_PASSWORD, - json_encode($oRestResultWithObject)); + json_encode($oRestResultWithObject) + ); } - /** * @throws CoreException * @throws CoreUnexpectedValue @@ -149,11 +165,13 @@ class RestServicesSanitizeOutputTest extends ItopCustomDatamodelTestCase static::assertStringContainsString( '*****', - json_encode($oRestResultWithObject)); + json_encode($oRestResultWithObject) + ); static::assertStringNotContainsString( self::SIMPLE_PASSWORD, - json_encode($oRestResultWithObject)); + json_encode($oRestResultWithObject) + ); } diff --git a/tests/php-unit-tests/unitary-tests/core/RestServicesTest.php b/tests/php-unit-tests/unitary-tests/core/RestServicesTest.php index f549ae10c..e46f6e139 100644 --- a/tests/php-unit-tests/unitary-tests/core/RestServicesTest.php +++ b/tests/php-unit-tests/unitary-tests/core/RestServicesTest.php @@ -1,4 +1,5 @@ [ '{"operation": "core/update", "comment": "Update user", "class": "UserLocal", "key": {"id":1}, "output_fields": "first_name, password", "fields": {"password" : "123456"}}', @@ -55,7 +56,7 @@ class RestServicesTest extends ItopDataTestCase "fields": { "password": "*****" } -}' +}', ], 'core/create' => [ '{"operation": "core/create", "comment": "Create user", "class": "UserLocal", "fields": {"first_name": "John", "last_name": "Doe", "email": "jd@example/com", "password" : "123456"}}', @@ -69,7 +70,7 @@ class RestServicesTest extends ItopDataTestCase "email": "jd@example/com", "password": "*****" } -}' +}', ], ]; } @@ -103,22 +104,22 @@ class RestServicesTest extends ItopDataTestCase 'core/update' => [ 'core/update', ['comment' => 'Update user', 'class' => 'UserLocal', 'key' => ['login' => 'my_example'], 'output_fields' => 'password', 'fields' => ['password' => 'opkB!req57']], - '{"objects":{"UserLocal::-1":{"code":0,"message":"ok","class":"UserLocal","key":-1,"fields":{"login":"","password":"*****"}}},"code":0,"message":null}' + '{"objects":{"UserLocal::-1":{"code":0,"message":"ok","class":"UserLocal","key":-1,"fields":{"login":"","password":"*****"}}},"code":0,"message":null}', ], 'core/create' => [ 'core/create', ['comment' => 'Create user', 'class' => 'UserLocal', 'fields' => ['password' => 'Azertyuiiop*12', 'login' => 'toto', 'profile_list' => [1]]], - '{"objects":{"UserLocal::-1":{"code":0,"message":"ok","class":"UserLocal","key":-1,"fields":{"login":"","password":"*****"}}},"code":0,"message":null}' + '{"objects":{"UserLocal::-1":{"code":0,"message":"ok","class":"UserLocal","key":-1,"fields":{"login":"","password":"*****"}}},"code":0,"message":null}', ], 'core/get' => [ 'core/get', ['comment' => 'Get user', 'class' => 'UserLocal', 'key' => ['login' => 'my_example'], 'output_fields' => 'first_name, password'], - '{"objects":{"UserLocal::-1":{"code":0,"message":"ok","class":"UserLocal","key":-1,"fields":{"login":"","password":"*****"}}},"code":0,"message":null}' + '{"objects":{"UserLocal::-1":{"code":0,"message":"ok","class":"UserLocal","key":-1,"fields":{"login":"","password":"*****"}}},"code":0,"message":null}', ], 'core/check_credentials' => [ 'core/check_credentials', ['user' => 'admin', 'password' => 'admin'], - '{"objects":{"UserLocal::-1":{"code":0,"message":"ok","class":"UserLocal","key":-1,"fields":{"login":"","password":"*****"}}},"code":0,"message":null}' + '{"objects":{"UserLocal::-1":{"code":0,"message":"ok","class":"UserLocal","key":-1,"fields":{"login":"","password":"*****"}}},"code":0,"message":null}', ], ]; } diff --git a/tests/php-unit-tests/unitary-tests/core/SympleCryptTest.php b/tests/php-unit-tests/unitary-tests/core/SympleCryptTest.php index 4c39bbd06..1e3bff976 100644 --- a/tests/php-unit-tests/unitary-tests/core/SympleCryptTest.php +++ b/tests/php-unit-tests/unitary-tests/core/SympleCryptTest.php @@ -1,4 +1,5 @@ ['SimpleCrypt'], - 'SimpleCryptSimpleEngine'=>['SimpleCryptSimpleEngine']]; - if(function_exists('sodium_crypto_secretbox_open')){ - $aClassProvider['SimpleCryptSodiumEngine'] = ['SimpleCryptSodiumEngine'] ; - } - if(function_exists('openssl_decrypt')){ - $aClassProvider['SimpleCryptOpenSSLEngine'] = ['SimpleCryptOpenSSLEngine']; - $aClassProvider['SimpleCryptOpenSSLMcryptCompatibilityEngine'] = ['SimpleCryptOpenSSLMcryptCompatibilityEngine']; - } - return$aClassProvider; - } - /** + public function DecryptClassProvider() + { + $aClassProvider = ['SimpleCrypt' => ['SimpleCrypt'], + 'SimpleCryptSimpleEngine' => ['SimpleCryptSimpleEngine']]; + if (function_exists('sodium_crypto_secretbox_open')) { + $aClassProvider['SimpleCryptSodiumEngine'] = ['SimpleCryptSodiumEngine'] ; + } + if (function_exists('openssl_decrypt')) { + $aClassProvider['SimpleCryptOpenSSLEngine'] = ['SimpleCryptOpenSSLEngine']; + $aClassProvider['SimpleCryptOpenSSLMcryptCompatibilityEngine'] = ['SimpleCryptOpenSSLMcryptCompatibilityEngine']; + } + return$aClassProvider; + } + /** * @param $sClass * @dataProvider DecryptClassProvider - **/ + **/ public function testDecryptWithNullValue($sClass) { $oSimpleCrypt = new $sClass(); $this->assertEquals(null, $oSimpleCrypt->Decrypt("dd", null)); } - /** - * @param $sClass - * @dataProvider DecryptClassProvider - **/ + /** + * @param $sClass + * @dataProvider DecryptClassProvider + **/ public function testDecryptWithEmptyValue($sClass) { $oSimpleCrypt = new $sClass(); $this->assertEquals('', $oSimpleCrypt->Decrypt("dd", "")); } - public function DecryptClassWithNonDecryptableValueProvider() - { - $aClassProvider = ['SimpleCrypt'=>['SimpleCrypt', '** decryption error **'], - // 'SimpleCryptSimpleEngine'=>['SimpleCryptSimpleEngine', ' '] - ]; - if(function_exists('sodium_crypto_secretbox_open')){ - $aClassProvider['SimpleCryptSodiumEngine'] = ['SimpleCryptSodiumEngine', '', 'SodiumException'] ; - } - if(function_exists('openssl_decrypt')){ - $aClassProvider['SimpleCryptOpenSSLEngine'] = ['SimpleCryptOpenSSLEngine', '** decryption error **']; - $aClassProvider['SimpleCryptOpenSSLMcryptCompatibilityEngine'] = ['SimpleCryptOpenSSLMcryptCompatibilityEngine', '** decryption error **']; - } - return$aClassProvider; - } - /** - * @param $sClass - * @param $sExpectedValue - * @dataProvider DecryptClassWithNonDecryptableValueProvider - **/ + public function DecryptClassWithNonDecryptableValueProvider() + { + $aClassProvider = ['SimpleCrypt' => ['SimpleCrypt', '** decryption error **'], + // 'SimpleCryptSimpleEngine'=>['SimpleCryptSimpleEngine', ' '] + ]; + if (function_exists('sodium_crypto_secretbox_open')) { + $aClassProvider['SimpleCryptSodiumEngine'] = ['SimpleCryptSodiumEngine', '', 'SodiumException'] ; + } + if (function_exists('openssl_decrypt')) { + $aClassProvider['SimpleCryptOpenSSLEngine'] = ['SimpleCryptOpenSSLEngine', '** decryption error **']; + $aClassProvider['SimpleCryptOpenSSLMcryptCompatibilityEngine'] = ['SimpleCryptOpenSSLMcryptCompatibilityEngine', '** decryption error **']; + } + return$aClassProvider; + } + /** + * @param $sClass + * @param $sExpectedValue + * @dataProvider DecryptClassWithNonDecryptableValueProvider + **/ public function testDecrypWithNonDecryptableValue($sClass, $sExpectedValue = '', $sExpectedException = null) { - if($sExpectedException !== null) { - $this->expectException($sExpectedException); - } + if ($sExpectedException !== null) { + $this->expectException($sExpectedException); + } $oSimpleCrypt = new $sClass(); - $result=$oSimpleCrypt->Decrypt("dd", "gabuzomeuuofteod"); - $this->assertEquals($sExpectedValue, $result,''); + $result = $oSimpleCrypt->Decrypt("dd", "gabuzomeuuofteod"); + $this->assertEquals($sExpectedValue, $result, ''); } } diff --git a/tests/php-unit-tests/unitary-tests/core/TagSetFieldDataTest.php b/tests/php-unit-tests/unitary-tests/core/TagSetFieldDataTest.php index 136ab2900..1e1589391 100644 --- a/tests/php-unit-tests/unitary-tests/core/TagSetFieldDataTest.php +++ b/tests/php-unit-tests/unitary-tests/core/TagSetFieldDataTest.php @@ -1,4 +1,5 @@ CreateTagData(TAG_CLASS, TAG_ATTCODE, 'tag4', 'Fourth'); - } catch (CoreException $e) - { + } catch (CoreException $e) { $this->debug($e->getMessage()); } $aAllowedValues = TagSetFieldData::GetAllowedValues(TAG_CLASS, TAG_ATTCODE); $iCurrCount = count($aAllowedValues); static::assertEquals(4, $iCurrCount - $iInitialCount); - try - { + try { $this->CreateTagData(TAG_CLASS, TAG_ATTCODE, 'tag4', 'zembrek'); - } catch (CoreException $e) - { + } catch (CoreException $e) { $this->debug($e->getMessage()); } $aAllowedValues = TagSetFieldData::GetAllowedValues(TAG_CLASS, TAG_ATTCODE); $iCurrCount = count($aAllowedValues); static::assertEquals(4, $iCurrCount - $iInitialCount); - try - { + try { $this->CreateTagData(TAG_CLASS, TAG_ATTCODE, 'zembrek', 'Fourth'); - } catch (CoreException $e) - { + } catch (CoreException $e) { $this->debug($e->getMessage()); } $aAllowedValues = TagSetFieldData::GetAllowedValues(TAG_CLASS, TAG_ATTCODE); @@ -129,10 +123,10 @@ class TagSetFieldDataTest extends ItopDataTestCase public function testComputeValues() { $sTagClass = TagSetFieldData::GetTagDataClassName(TAG_CLASS, TAG_ATTCODE); - $oTagData = $this->createObject($sTagClass, array( + $oTagData = $this->createObject($sTagClass, [ 'code' => 'tag1', 'label' => 'First', - )); + ]); $this->debug("Created {$oTagData->Get('obj_class')}::{$oTagData->Get('obj_attcode')}"); static::assertEquals(TAG_CLASS, $oTagData->Get('obj_class')); @@ -150,8 +144,7 @@ class TagSetFieldDataTest extends ItopDataTestCase { try { $this->CreateTagData(TAG_CLASS, TAG_ATTCODE, $sTagCode, 'First'); - } - catch (CoreException $e) { + } catch (CoreException $e) { static::assertTrue(true); return; } @@ -161,22 +154,22 @@ class TagSetFieldDataTest extends ItopDataTestCase public function InvalidTagCodeProvider() { - return array( - 'No space' => array('tag1 1'), - 'No _' => array('tag_1'), - 'No -' => array('tag-1'), - 'No %' => array('tag%1'), - 'At least 3 chars' => array(''), - 'At least 3 chars 1' => array('a'), - 'At least 3 chars 2' => array('ab'), - 'No #' => array('#tag'), - 'No !' => array('tag!'), - 'Stop Word 1' => array('about'), - 'Stop Word 2' => array('from'), - 'Stop Word 3' => array('that'), - 'Stop Word 4' => array('where'), - 'Stop Word 5' => array('who'), - ); + return [ + 'No space' => ['tag1 1'], + 'No _' => ['tag_1'], + 'No -' => ['tag-1'], + 'No %' => ['tag%1'], + 'At least 3 chars' => [''], + 'At least 3 chars 1' => ['a'], + 'At least 3 chars 2' => ['ab'], + 'No #' => ['#tag'], + 'No !' => ['tag!'], + 'Stop Word 1' => ['about'], + 'Stop Word 2' => ['from'], + 'Stop Word 3' => ['that'], + 'Stop Word 4' => ['where'], + 'Stop Word 5' => ['who'], + ]; } /** @@ -186,8 +179,7 @@ class TagSetFieldDataTest extends ItopDataTestCase { try { $this->CreateTagData(TAG_CLASS, TAG_ATTCODE, 'tag1', 'First|Second'); - } - catch (CoreException $e) { + } catch (CoreException $e) { static::assertFalse(false); return; } @@ -238,11 +230,9 @@ class TagSetFieldDataTest extends ItopDataTestCase // Too long $sTagCode = str_repeat('a', $iMaxLength + 1); - try - { + try { $this->CreateTagData(TAG_CLASS, TAG_ATTCODE, $sTagCode, $sTagCode); - } catch (CoreException $e) - { + } catch (CoreException $e) { $this->debug('Awaited: '.$e->getMessage()); static::assertTrue(true); return; @@ -259,30 +249,26 @@ class TagSetFieldDataTest extends ItopDataTestCase /** @var \AttributeTagSet $oAttDef */ $oAttDef = MetaModel::GetAttributeDef(TAG_CLASS, TAG_ATTCODE); $iMaxTags = $oAttDef->GetMaxItems(); - for ($i = 0; $i < $iMaxTags; $i++) - { + for ($i = 0; $i < $iMaxTags; $i++) { $sTagCode = 'MaxTag'.$i; $this->CreateTagData(TAG_CLASS, TAG_ATTCODE, $sTagCode, $sTagCode); } $oObjWithTagSet = $this->CreateObjectWithTagSet(); $this->debug("Max number of tags is $iMaxTags"); $sValue = ''; - for ($i = 0; $i < ($iMaxTags + 1); $i++) - { - try - { + for ($i = 0; $i < ($iMaxTags + 1); $i++) { + try { $sTagCode = 'MaxTag'.$i; $sValue .= "$sTagCode "; $oObjWithTagSet->Set(TAG_ATTCODE, $sValue); $oObjWithTagSet->DBWrite(); - } catch (Exception $e) - { + } catch (Exception $e) { // Should fail on the last iteration static::assertEquals($iMaxTags, $i); - $this->debug("Setting (".($i+1).") tag(s) failed"); + $this->debug("Setting (".($i + 1).") tag(s) failed"); return; } - $this->debug("Setting (".($i+1).") tag(s) worked"); + $this->debug("Setting (".($i + 1).") tag(s) worked"); } static::assertFalse(true); diff --git a/tests/php-unit-tests/unitary-tests/core/TriggerOnStateEnterTest.php b/tests/php-unit-tests/unitary-tests/core/TriggerOnStateEnterTest.php index f7e878354..898bb951d 100644 --- a/tests/php-unit-tests/unitary-tests/core/TriggerOnStateEnterTest.php +++ b/tests/php-unit-tests/unitary-tests/core/TriggerOnStateEnterTest.php @@ -8,7 +8,7 @@ use Person; class TriggerOnStateEnterTest extends ItopDataTestCase { - const CREATE_TEST_ORG = true; + public const CREATE_TEST_ORG = true; protected function setUp(): void { @@ -86,4 +86,4 @@ class TriggerOnStateEnterTest extends ItopDataTestCase ]); return MetaModel::GetObject('UserRequest', $iUserRequest); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/TriggerTest.php b/tests/php-unit-tests/unitary-tests/core/TriggerTest.php index 486b829ec..81098b87a 100644 --- a/tests/php-unit-tests/unitary-tests/core/TriggerTest.php +++ b/tests/php-unit-tests/unitary-tests/core/TriggerTest.php @@ -17,8 +17,7 @@ use TriggerOnObjectCreate; */ class TriggerTest extends ItopDataTestCase { - const USE_TRANSACTION = false; - + public const USE_TRANSACTION = false; protected function setUp(): void { @@ -43,18 +42,16 @@ class TriggerTest extends ItopDataTestCase try { try { MetaModel::NewObject('Toto'); - } - catch (\Exception $e) { + } catch (\Exception $e) { \utils::EnrichRaisedException($oTrigger, $e); } $this->assertTrue(false, "An exception should have been thrown"); - } - catch (\CoreException $e1) { + } catch (\CoreException $e1) { $this->assertEquals('CoreException', get_class($e1)); $this->assertStringStartsWith('Unknown class \'Toto\' (TriggerOnObjectCreate::-', $e1->getMessage()); $fullStackTraceAsString = $e1->getFullStackTraceAsString(); - $this->assertStringContainsString("MetaModel::NewObject", $fullStackTraceAsString,"new enriched exception should contain root cause method: " . $fullStackTraceAsString); + $this->assertStringContainsString("MetaModel::NewObject", $fullStackTraceAsString, "new enriched exception should contain root cause method: ".$fullStackTraceAsString); } } @@ -75,13 +72,11 @@ class TriggerTest extends ItopDataTestCase try { try { MetaModel::NewObject('CoreException'); - } - catch (\Exception $e) { + } catch (\Exception $e) { \utils::EnrichRaisedException($oCmdbAbstract, $e); } $this->assertTrue(false, "An exception should have been thrown"); - } - catch (\Exception $e1) { + } catch (\Exception $e1) { $this->assertEquals($e, $e1); } } @@ -113,13 +108,12 @@ class TriggerTest extends ItopDataTestCase $this->assertStringContainsString($oPerson1->GetRawName(), $sTestLogFileContent); $this->assertStringContainsString($sExceptionMessage, $sTestLogFileContent); - } - finally { + } finally { IssueLog::Enable(APPROOT.'log/error.log'); } } } -class NonCmdbAbstractObject{ - +class NonCmdbAbstractObject +{ } diff --git a/tests/php-unit-tests/unitary-tests/core/UniquenessConstraintTest.php b/tests/php-unit-tests/unitary-tests/core/UniquenessConstraintTest.php index 8b8c384db..46498450f 100644 --- a/tests/php-unit-tests/unitary-tests/core/UniquenessConstraintTest.php +++ b/tests/php-unit-tests/unitary-tests/core/UniquenessConstraintTest.php @@ -1,6 +1,5 @@ array(true, false, array('attributes' => array('name'))), - 'with all properties' => array( + return [ + 'simplest rule' => [true, false, ['attributes' => ['name']]], + 'with all properties' => [ true, false, - array( - 'attributes' => array('name'), + [ + 'attributes' => ['name'], 'filter' => 'name != \'\'', 'disabled' => false, 'is_blocking' => true, - ), - ), - 'only disabled key without ancestor' => array( + ], + ], + 'only disabled key without ancestor' => [ false, false, - array( + [ 'disabled' => true, - ), - ), - 'only disabled key with ancestor' => array( + ], + ], + 'only disabled key with ancestor' => [ true, true, - array( + [ 'disabled' => true, - ), - ), - ); + ], + ], + ]; } } diff --git a/tests/php-unit-tests/unitary-tests/core/UniquenessMessageTest.php b/tests/php-unit-tests/unitary-tests/core/UniquenessMessageTest.php index 9e11e4868..c80124842 100644 --- a/tests/php-unit-tests/unitary-tests/core/UniquenessMessageTest.php +++ b/tests/php-unit-tests/unitary-tests/core/UniquenessMessageTest.php @@ -1,6 +1,5 @@ createObject('Team', array( + $oTeam = $this->createObject('Team', [ 'name' => 'Name_'.$iNum, 'org_id' => $this->getTestOrgId(), - )); + ]); $this->debug("Created Team {$oTeam->GetName()} ({$oTeam->GetKey()})"); return $oTeam; diff --git a/tests/php-unit-tests/unitary-tests/core/UserRightsTest.php b/tests/php-unit-tests/unitary-tests/core/UserRightsTest.php index 5a743a0e8..1a87362a8 100644 --- a/tests/php-unit-tests/unitary-tests/core/UserRightsTest.php +++ b/tests/php-unit-tests/unitary-tests/core/UserRightsTest.php @@ -1,4 +1,5 @@ [false], + 'with Admins visible' => [false], 'with Admins hidden' => [true], ]; } @@ -484,7 +483,7 @@ class UserRightsTest extends ItopDataTestCase public function NonAdminCannotListAdminProfilesProvider(): array { return [ - 'with Admins visible'=> [false, 1], + 'with Admins visible' => [false, 1], 'with Admins hidden' => [true, 0], ]; } @@ -496,13 +495,13 @@ class UserRightsTest extends ItopDataTestCase $this->assertDBQueryCount( 1, - fn() => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey), + fn () => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey), 'A query should be performed the first time FindUser is called' ); $this->assertDBQueryCount( 0, - fn() => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey), + fn () => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey), 'The cache should prevent additional queries on subsequent calls' ); } @@ -514,13 +513,13 @@ class UserRightsTest extends ItopDataTestCase $this->assertDBQueryCount( 2, - fn() => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey), + fn () => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey), 'Some queries should be performed the first time FindUser is called' ); $this->assertDBQueryCount( 0, - fn() => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey), + fn () => $this->FindUserAndAssertItHasBeenFound($sLogin, $iKey), 'The cache should prevent additional queries on subsequent calls' ); } @@ -531,13 +530,13 @@ class UserRightsTest extends ItopDataTestCase $this->assertDBQueryCount( 2, - fn() => $this->FindUserAndAssertItWasNotFound($sLogin), + fn () => $this->FindUserAndAssertItWasNotFound($sLogin), 'Some queries should be performed the first time FindUser is called' ); $this->assertDBQueryCount( 0, - fn() => $this->FindUserAndAssertItWasNotFound($sLogin), + fn () => $this->FindUserAndAssertItWasNotFound($sLogin), 'The cache should prevent additional queries on subsequent calls' ); } diff --git a/tests/php-unit-tests/unitary-tests/core/ValueSetDefinitionTest.php b/tests/php-unit-tests/unitary-tests/core/ValueSetDefinitionTest.php index 295542516..a0b15395c 100644 --- a/tests/php-unit-tests/unitary-tests/core/ValueSetDefinitionTest.php +++ b/tests/php-unit-tests/unitary-tests/core/ValueSetDefinitionTest.php @@ -1,4 +1,5 @@ [ 123, [], - ] + ], ]; } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/ValueSetObjectsTest.php b/tests/php-unit-tests/unitary-tests/core/ValueSetObjectsTest.php index 74620b10d..a856af41f 100644 --- a/tests/php-unit-tests/unitary-tests/core/ValueSetObjectsTest.php +++ b/tests/php-unit-tests/unitary-tests/core/ValueSetObjectsTest.php @@ -1,4 +1,5 @@ array("Ticket", "bla", "contains", "SELECT `Ticket` FROM Ticket AS `Ticket` WHERE (`Ticket`.`friendlyname` LIKE '%bla%')"), - 'Ticket equals bla' => array("Ticket", "bla", "equals", "SELECT `Ticket` FROM Ticket AS `Ticket` WHERE (`Ticket`.`ref` = 'bla')"), - 'Ticket start_with bla' => array("Ticket", "bla", "start_with", "SELECT `Ticket` FROM Ticket AS `Ticket` WHERE (`Ticket`.`ref` LIKE 'bla%')"), - 'UserRequest contains bla' => array("UserRequest", "bla", "contains", "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`friendlyname` LIKE '%bla%')"), - 'UserRequest equals bla' => array("UserRequest", "bla", "equals", "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`ref` = 'bla')"), - 'UserRequest start_with bla' => array("UserRequest", "bla", "start_with", "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`ref` LIKE 'bla%')"), - ); + return [ + 'Ticket contains bla' => ["Ticket", "bla", "contains", "SELECT `Ticket` FROM Ticket AS `Ticket` WHERE (`Ticket`.`friendlyname` LIKE '%bla%')"], + 'Ticket equals bla' => ["Ticket", "bla", "equals", "SELECT `Ticket` FROM Ticket AS `Ticket` WHERE (`Ticket`.`ref` = 'bla')"], + 'Ticket start_with bla' => ["Ticket", "bla", "start_with", "SELECT `Ticket` FROM Ticket AS `Ticket` WHERE (`Ticket`.`ref` LIKE 'bla%')"], + 'UserRequest contains bla' => ["UserRequest", "bla", "contains", "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`friendlyname` LIKE '%bla%')"], + 'UserRequest equals bla' => ["UserRequest", "bla", "equals", "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`ref` = 'bla')"], + 'UserRequest start_with bla' => ["UserRequest", "bla", "start_with", "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`ref` LIKE 'bla%')"], + ]; } - /** * @param $Class * @param $sContains @@ -56,4 +54,4 @@ class ValueSetObjectsTest extends ItopTestCase $this->assertEquals($sExpectedOQL, $sFilter); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/WeeklyScheduledProcessMockConfig.php b/tests/php-unit-tests/unitary-tests/core/WeeklyScheduledProcessMockConfig.php index e51f96d45..61a3b8c08 100644 --- a/tests/php-unit-tests/unitary-tests/core/WeeklyScheduledProcessMockConfig.php +++ b/tests/php-unit-tests/unitary-tests/core/WeeklyScheduledProcessMockConfig.php @@ -9,7 +9,7 @@ */ class WeeklyScheduledProcessMockConfig extends AbstractWeeklyScheduledProcess { - const MODULE_NAME = 'itop-zabu-gomeu'; + public const MODULE_NAME = 'itop-zabu-gomeu'; public function __construct($bEnabledValue, $sTimeValue, $sWeekDays) { diff --git a/tests/php-unit-tests/unitary-tests/core/WeeklyScheduledProcessTest.php b/tests/php-unit-tests/unitary-tests/core/WeeklyScheduledProcessTest.php index f2efb3c63..d7ecb975c 100644 --- a/tests/php-unit-tests/unitary-tests/core/WeeklyScheduledProcessTest.php +++ b/tests/php-unit-tests/unitary-tests/core/WeeklyScheduledProcessTest.php @@ -1,10 +1,10 @@ GetNextOccurrence(); } } - diff --git a/tests/php-unit-tests/unitary-tests/core/XMLDataLoaderTest.php b/tests/php-unit-tests/unitary-tests/core/XMLDataLoaderTest.php index 9a2a330fc..efabe54ee 100644 --- a/tests/php-unit-tests/unitary-tests/core/XMLDataLoaderTest.php +++ b/tests/php-unit-tests/unitary-tests/core/XMLDataLoaderTest.php @@ -1,4 +1,5 @@ @@ -112,4 +112,4 @@ XML; $this->assertEquals('Zanzibar', $oPerson->Get('location_id_friendlyname')); $this->assertEquals('ZuperTest', $oPerson->Get('org_id_friendlyname')); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/apcEmulationTest.php b/tests/php-unit-tests/unitary-tests/core/apcEmulationTest.php index 65a1c6a06..35049a9e5 100644 --- a/tests/php-unit-tests/unitary-tests/core/apcEmulationTest.php +++ b/tests/php-unit-tests/unitary-tests/core/apcEmulationTest.php @@ -1,4 +1,5 @@ assertTrue(apc_store('testMultiple'.$i, 'This is a test', 100)); } $aInfo = apc_cache_info(); @@ -72,8 +70,7 @@ class apcEmulationTest extends ItopTestCase public function testNumberOfFilesTTL() { - for($i = 0; $i < 2 * UNIT_MAX_CACHE_FILES; $i++) - { + for ($i = 0; $i < 2 * UNIT_MAX_CACHE_FILES; $i++) { $this->assertTrue(apc_store('testNumberOfFilesTTL'.$i, 'This is a test', 100)); } $aInfo = apc_cache_info(); @@ -84,8 +81,7 @@ class apcEmulationTest extends ItopTestCase public function testNumberOfFilesNoTTL() { - for($i = 0; $i < 2 * UNIT_MAX_CACHE_FILES; $i++) - { + for ($i = 0; $i < 2 * UNIT_MAX_CACHE_FILES; $i++) { $this->assertTrue(apc_store('testNumberOfFilesNoTTL'.$i, 'This is a test')); } $aInfo = apc_cache_info(); @@ -96,18 +92,16 @@ class apcEmulationTest extends ItopTestCase public function testArray() { - $aStoredEntries = array(); - $aFetchedEntries = array(); - for($i = 0; $i < UNIT_MAX_CACHE_FILES; $i++) - { + $aStoredEntries = []; + $aFetchedEntries = []; + for ($i = 0; $i < UNIT_MAX_CACHE_FILES; $i++) { $sKey = 'testArray'.$i; $aStoredEntries[$sKey] = 'This is a test ARRAY'.rand(); $aFetchedEntries[] = $sKey; } $aResStore = apc_store($aStoredEntries); $this->assertEquals(UNIT_MAX_CACHE_FILES, count($aResStore)); - foreach($aResStore as $bValue) - { + foreach ($aResStore as $bValue) { $this->assertTrue($bValue); } @@ -117,13 +111,11 @@ class apcEmulationTest extends ItopTestCase $aResFetch = apc_fetch($aFetchedEntries); $this->assertEquals(UNIT_MAX_CACHE_FILES, count($aResFetch)); - foreach($aResFetch as $sKey => $sValue) - { + foreach ($aResFetch as $sKey => $sValue) { $this->assertEquals($aStoredEntries[$sKey], $sValue); } } - public function testSanity() { $this->assertTrue(apc_store('testSanity', null, 100)); @@ -177,17 +169,15 @@ class apcEmulationTest extends ItopTestCase { $ilen = 20000000; $sContent = str_pad(' TEST ', $ilen, "-=", STR_PAD_BOTH); - for($i = 0; $i < UNIT_MAX_CACHE_FILES; $i++) - { + for ($i = 0; $i < UNIT_MAX_CACHE_FILES; $i++) { $this->assertTrue(apc_store('testHuge'.$i, $sContent, 100)); } $aInfo = apc_cache_info(); $this->assertEquals(UNIT_MAX_CACHE_FILES, count($aInfo['cache_list'])); - for($i = 0; $i < UNIT_MAX_CACHE_FILES; $i++) - { + for ($i = 0; $i < UNIT_MAX_CACHE_FILES; $i++) { $this->assertEquals($ilen, strlen(apc_fetch('testHuge'.$i))); } } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/dictApcuTest.php b/tests/php-unit-tests/unitary-tests/core/dictApcuTest.php index d47b6ef51..183b4a1a2 100644 --- a/tests/php-unit-tests/unitary-tests/core/dictApcuTest.php +++ b/tests/php-unit-tests/unitary-tests/core/dictApcuTest.php @@ -1,4 +1,5 @@ sDictionaryFolder = APPROOT."env-$this->sEnvName" . DIRECTORY_SEPARATOR . "dictionaries"; + $this->sDictionaryFolder = APPROOT."env-$this->sEnvName".DIRECTORY_SEPARATOR."dictionaries"; @mkdir($this->sDictionaryFolder, 0777, true); $sLabels = <<assertEquals('label1', Dict::S('label1')); } - public function testInitLangIfNeeded_Apc_BrokenUserDictionnary() - { + public function testInitLangIfNeeded_Apc_BrokenUserDictionnary() + { $this->InitBrokenDictionnary($this->sDictionaryFolder, 'DE DE', 'de-de'); $this->oApcService->expects($this->any()) @@ -300,7 +300,8 @@ STR; //corrupted data not fixed //we will return label from another dictionary (defaut one => russian here) - public function testInitLangIfNeeded_Apc_CorruptedCache_PropertyInUserDictionnary(){ + public function testInitLangIfNeeded_Apc_CorruptedCache_PropertyInUserDictionnary() + { $this->oApcService->expects($this->any()) ->method('function_exists') ->willReturn(true); @@ -318,7 +319,8 @@ STR; $this->assertEquals('ru1', Dict::S('label1')); } - public function testInitLangIfNeeded_Apc_PropertyInDefaultLanguageDictionnary(){ + public function testInitLangIfNeeded_Apc_PropertyInDefaultLanguageDictionnary() + { $this->oApcService->expects($this->any()) ->method('function_exists') ->willReturn(true); @@ -330,7 +332,8 @@ STR; $this->oApcService->expects($this->exactly(1)) ->method('apc_store') - ->withConsecutive(['toto-dict-RU RU', ['label1' => 'ru1', 'label2' => 'ru2']] + ->withConsecutive( + ['toto-dict-RU RU', ['label1' => 'ru1', 'label2' => 'ru2']] ); Dict::SetDefaultLanguage('RU RU'); @@ -340,7 +343,8 @@ STR; //corrupted data not fixed //we will return label from default language dictionary (EN here) - public function testInitLangIfNeeded_ApcCorrupted_PropertyInDefaultLanguageDictionnary(){ + public function testInitLangIfNeeded_ApcCorrupted_PropertyInDefaultLanguageDictionnary() + { $this->oApcService->expects($this->any()) ->method('function_exists') ->willReturn(true); diff --git a/tests/php-unit-tests/unitary-tests/core/dictTest.php b/tests/php-unit-tests/unitary-tests/core/dictTest.php index 3b51a256a..d5fc0878a 100644 --- a/tests/php-unit-tests/unitary-tests/core/dictTest.php +++ b/tests/php-unit-tests/unitary-tests/core/dictTest.php @@ -1,4 +1,5 @@ tmpSavePath = tempnam(sys_get_temp_dir(), 'config-itop'); $this->conf_exists = is_file($this->sConfigPath); - if ($this->conf_exists) - { + if ($this->conf_exists) { copy($this->sConfigPath, $this->tmpSavePath); } clearstatcache(); @@ -66,48 +66,47 @@ class iTopConfigParserTest extends ItopTestCase public function ParserProvider() { - return array( - "test MySettings" => array( + return [ + "test MySettings" => [ 'sInitialConfig' => ' $a );', - 'aExpectedVarsMap' => array( - 'MySettings' => array('b' => '$a'), - 'MyModuleSettings' => array(), - 'MyModules' => array(), - ) - ), + 'aExpectedVarsMap' => [ + 'MySettings' => ['b' => '$a'], + 'MyModuleSettings' => [], + 'MyModules' => [], + ], + ], - "test MyModuleSettings" => array( + "test MyModuleSettings" => [ 'sInitialConfig' => ' $a );', - 'aExpectedVarsMap' => array( - 'MySettings' => array(), - 'MyModuleSettings' => array('b' => '$a'), - 'MyModules' => array(), - ) - ), + 'aExpectedVarsMap' => [ + 'MySettings' => [], + 'MyModuleSettings' => ['b' => '$a'], + 'MyModules' => [], + ], + ], - - "test MyModules" => array( + "test MyModules" => [ 'sInitialConfig' => ' $a );', - 'aExpectedVarsMap' => array( - 'MySettings' =>array(), - 'MyModuleSettings' => array(), - 'MyModules' => array('b' => '$a'), - ) - ), + 'aExpectedVarsMap' => [ + 'MySettings' => [], + 'MyModuleSettings' => [], + 'MyModules' => ['b' => '$a'], + ], + ], - "test MyModules + MyModuleSettings " => array( + "test MyModules + MyModuleSettings " => [ 'sInitialConfig' => ' $a @@ -115,26 +114,26 @@ class iTopConfigParserTest extends ItopTestCase $MyModuleSettings = array( "e" => $d );', - 'aExpectedVarsMap' => array( - 'MySettings' =>array(), - 'MyModuleSettings' => array('e' => '$d'), - 'MyModules' => array('b' => '$a'), - ) - ), + 'aExpectedVarsMap' => [ + 'MySettings' => [], + 'MyModuleSettings' => ['e' => '$d'], + 'MyModules' => ['b' => '$a'], + ], + ], - "test preserve gloabl + concatenation" => array( + "test preserve gloabl + concatenation" => [ 'sInitialConfig' => ' $_SERVER["REQUEST_URI"] . "/toto" );', - 'aExpectedVarsMap' => array( - 'MySettings' =>array(), - 'MyModuleSettings' => array(), - 'MyModules' => array('b' => '$_SERVER["REQUEST_URI"] . "/toto"'), - ) - ), - "test MyModules array of arrays" => array( + 'aExpectedVarsMap' => [ + 'MySettings' => [], + 'MyModuleSettings' => [], + 'MyModules' => ['b' => '$_SERVER["REQUEST_URI"] . "/toto"'], + ], + ], + "test MyModules array of arrays" => [ 'sInitialConfig' => ' array( - 'MySettings' =>array(), - 'MyModuleSettings' => array(), - 'MyModules' => array( - 'date_and_time_format' => 'array("default" => array("date" => "Y-m-d", "time" => "H:i:s", "date_time" => "{$date} {$time}"))' - ), - ) - ), - ); + 'aExpectedVarsMap' => [ + 'MySettings' => [], + 'MyModuleSettings' => [], + 'MyModules' => [ + 'date_and_time_format' => 'array("default" => array("date" => "Y-m-d", "time" => "H:i:s", "date_time" => "{$date} {$time}"))', + ], + ], + ], + ]; } /** diff --git a/tests/php-unit-tests/unitary-tests/core/ormCaseLogTest.php b/tests/php-unit-tests/unitary-tests/core/ormCaseLogTest.php index b2762ca75..f11fbf4a5 100644 --- a/tests/php-unit-tests/unitary-tests/core/ormCaseLogTest.php +++ b/tests/php-unit-tests/unitary-tests/core/ormCaseLogTest.php @@ -1,16 +1,15 @@ RequireOnceItopFile('core/ormdocument.class.inc.php'); } - /** * @param array $aDocAData * @param array $aDocBData @@ -52,13 +52,13 @@ class ormDocumentTest extends ItopDataTestCase $sFirstDummyTextFileContentBase64, "text/plain", "a.txt", - 0 + 0, ], [ $sSecondDummyTextFileContentBase64, "image/png", "b.png", - 1 + 1, ], false, ], @@ -67,13 +67,13 @@ class ormDocumentTest extends ItopDataTestCase $sFirstDummyTextFileContentBase64, "text/plain", "a.txt", - 0 + 0, ], [ $sSecondDummyTextFileContentBase64, "text/plain", "a.txt", - 0 + 0, ], false, ], @@ -82,13 +82,13 @@ class ormDocumentTest extends ItopDataTestCase $sFirstDummyTextFileContentBase64, "text/plain", "a.txt", - 0 + 0, ], [ $sFirstDummyTextFileContentBase64, "image/png", "a.txt", - 0 + 0, ], false, ], @@ -97,13 +97,13 @@ class ormDocumentTest extends ItopDataTestCase $sFirstDummyTextFileContentBase64, "text/plain", "a.txt", - 0 + 0, ], [ $sFirstDummyTextFileContentBase64, "text/plain", "b.txt", - 0 + 0, ], false, ], @@ -112,13 +112,13 @@ class ormDocumentTest extends ItopDataTestCase $sFirstDummyTextFileContentBase64, "text/plain", "a.txt", - 0 + 0, ], [ $sFirstDummyTextFileContentBase64, "text/plain", "a.txt", - 1 + 1, ], true, ], @@ -127,13 +127,13 @@ class ormDocumentTest extends ItopDataTestCase $sFirstDummyTextFileContentBase64, "text/plain", "a.txt", - 0 + 0, ], [ $sFirstDummyTextFileContentBase64, "text/plain", "a.txt", - 0 + 0, ], false, ], diff --git a/tests/php-unit-tests/unitary-tests/core/ormLinkSetTest.php b/tests/php-unit-tests/unitary-tests/core/ormLinkSetTest.php index 42355c968..e5fc138e3 100644 --- a/tests/php-unit-tests/unitary-tests/core/ormLinkSetTest.php +++ b/tests/php-unit-tests/unitary-tests/core/ormLinkSetTest.php @@ -1,4 +1,5 @@ // - /** * Created by PhpStorm. * User: Eric @@ -25,14 +25,12 @@ * Time: 11:56 */ - namespace Combodo\iTop\Test\UnitTest\Core; use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use Exception; use ormLinkSet; - /** * @group itopRequestMgmt * @group itopConfigMgmt @@ -40,15 +38,15 @@ use ormLinkSet; */ class ormLinkSetTest extends ItopDataTestCase { - const CREATE_TEST_ORG = true; + public const CREATE_TEST_ORG = true; /** - * @throws Exception - */ - protected function setUp(): void - { - parent::setUp(); - } + * @throws Exception + */ + protected function setUp(): void + { + parent::setUp(); + } /** * @@ -75,7 +73,7 @@ class ormLinkSetTest extends ItopDataTestCase public function testBasic() { $oServer = $this->CreateServer(1); - $aPersons = array(); + $aPersons = []; for ($i = 0; $i < 3; $i++) { $oPerson = $this->CreatePerson($i); $aPersons[] = $oPerson; @@ -94,7 +92,7 @@ class ormLinkSetTest extends ItopDataTestCase public function testSuccesiveAdds() { $oServer = $this->CreateServer(1); - $aPersons = array(); + $aPersons = []; for ($i = 0; $i < 3; $i++) { $oPerson = $this->CreatePerson($i); $aPersons[] = $oPerson; @@ -123,7 +121,7 @@ class ormLinkSetTest extends ItopDataTestCase public function testRemove() { $oServer = $this->CreateServer(1); - $aPersons = array(); + $aPersons = []; for ($i = 0; $i < 3; $i++) { $oPerson = $this->CreatePerson($i); $aPersons[] = $oPerson; @@ -175,7 +173,7 @@ class ormLinkSetTest extends ItopDataTestCase public function testRemoveThenAdd() { $oServer = $this->CreateServer(1); - $aPersons = array(); + $aPersons = []; for ($i = 0; $i < 3; $i++) { $oPerson = $this->CreatePerson($i); $aPersons[] = $oPerson; @@ -207,7 +205,7 @@ class ormLinkSetTest extends ItopDataTestCase public function testAddDuplicate() { $oServer = $this->CreateServer(1); - $aPersons = array(); + $aPersons = []; for ($i = 0; $i < 3; $i++) { $oPerson = $this->CreatePerson($i); $aPersons[] = $oPerson; @@ -238,7 +236,7 @@ class ormLinkSetTest extends ItopDataTestCase public function testModifyThenRemove() { $oServer = $this->CreateServer(1); - $aPersons = array(); + $aPersons = []; for ($i = 0; $i < 3; $i++) { $oPerson = $this->CreatePerson($i); $aPersons[] = $oPerson; @@ -304,7 +302,6 @@ class ormLinkSetTest extends ItopDataTestCase ]; } - /** * don't work cf bug N°4402 * @throws Exception @@ -327,7 +324,6 @@ class ormLinkSetTest extends ItopDataTestCase static::assertEquals(1, $oSetOldFcisList->Count()); }*/ - /** * @throws Exception */ @@ -336,12 +332,12 @@ class ormLinkSetTest extends ItopDataTestCase $oServer = $this->CreateServer(1); $oServer->Set('serialnumber', 'my serialnumber'); $oServer->DBUpdate(); - static::assertEquals('', $oServer->ListPreviousValuesForUpdatedAttributes()['serialnumber']); + static::assertEquals('', $oServer->ListPreviousValuesForUpdatedAttributes()['serialnumber']); $this->ReloadObject($oServer); $oServer->Set('serialnumber', 'my serialnumber2'); $oServer->DBUpdate(); - static::assertEquals('my serialnumber', $oServer->ListPreviousValuesForUpdatedAttributes()['serialnumber']); + static::assertEquals('my serialnumber', $oServer->ListPreviousValuesForUpdatedAttributes()['serialnumber']); } /** @@ -353,11 +349,11 @@ class ormLinkSetTest extends ItopDataTestCase $idOrgInit = $oServer->Get('org_id'); $oOrganization = $this->CreateOrganization(1); - $oServer->Set('org_id',$oOrganization); + $oServer->Set('org_id', $oOrganization); $oServer->DBUpdate(); - static::assertEquals($idOrgInit, $oServer->ListPreviousValuesForUpdatedAttributes()['org_id']); - static::assertNotEquals($oOrganization->GetKey(), $oServer->ListPreviousValuesForUpdatedAttributes()['org_id']); - static::assertEquals($oOrganization->GetKey(), $oServer->Get('org_id')); + static::assertEquals($idOrgInit, $oServer->ListPreviousValuesForUpdatedAttributes()['org_id']); + static::assertNotEquals($oOrganization->GetKey(), $oServer->ListPreviousValuesForUpdatedAttributes()['org_id']); + static::assertEquals($oOrganization->GetKey(), $oServer->Get('org_id')); } /** * don't work cf bug N°4402 diff --git a/tests/php-unit-tests/unitary-tests/core/ormPasswordTest.php b/tests/php-unit-tests/unitary-tests/core/ormPasswordTest.php index 38bbd85b2..34b75696a 100644 --- a/tests/php-unit-tests/unitary-tests/core/ormPasswordTest.php +++ b/tests/php-unit-tests/unitary-tests/core/ormPasswordTest.php @@ -1,4 +1,5 @@ array( + return [ + 'Bcrypt' => [ 'admin', '', PASSWORD_BCRYPT, - '$2y$10$P6yqXv/0pT4e9kfN6d95jOKX4KR5Il.N0vRLc2DoZoycwnU9mcnia' - ), - 'sha256 (legacy)' => array( + '$2y$10$P6yqXv/0pT4e9kfN6d95jOKX4KR5Il.N0vRLc2DoZoycwnU9mcnia', + ], + 'sha256 (legacy)' => [ 'admin', 'salt', 'sha256', - '2bb7998496899acdd8137fad3a44faf96a84a03d7f230ce42e97cd17c7ae429e' - ), - ); + '2bb7998496899acdd8137fad3a44faf96a84a03d7f230ce42e97cd17c7ae429e', + ], + ]; } } diff --git a/tests/php-unit-tests/unitary-tests/core/ormStyleTest.php b/tests/php-unit-tests/unitary-tests/core/ormStyleTest.php index 7424a86da..33ae40723 100644 --- a/tests/php-unit-tests/unitary-tests/core/ormStyleTest.php +++ b/tests/php-unit-tests/unitary-tests/core/ormStyleTest.php @@ -1,4 +1,5 @@ GetValues(), array()); + static::assertEquals($oTagSet->GetValues(), []); $oTagSet->Add('tag1'); - static::assertEquals($oTagSet->GetValues(), array('tag1')); + static::assertEquals($oTagSet->GetValues(), ['tag1']); $oTagSet->Add('tag2'); - static::assertEquals($oTagSet->GetValues(), array('tag1', 'tag2')); + static::assertEquals($oTagSet->GetValues(), ['tag1', 'tag2']); } public function testAddTag() @@ -79,35 +80,31 @@ class ormTagSetTest extends ItopDataTestCase $oTagSet = new ormTagSet(TAG_CLASS, TAG_ATTCODE, MAX_TAGS); $oTagSet->Add('tag1'); - static::assertEquals($oTagSet->GetValues(), array('tag1')); + static::assertEquals($oTagSet->GetValues(), ['tag1']); - $oTagSet->SetValues(array('tag1', 'tag2')); - static::assertEquals($oTagSet->GetValues(), array('tag1', 'tag2')); + $oTagSet->SetValues(['tag1', 'tag2']); + static::assertEquals($oTagSet->GetValues(), ['tag1', 'tag2']); $oTagSet->Remove('tag1'); - static::assertEquals($oTagSet->GetValues(), array('tag2')); + static::assertEquals($oTagSet->GetValues(), ['tag2']); $oTagSet->Add('tag1'); - static::assertEquals($oTagSet->GetValues(), array('tag1', 'tag2')); + static::assertEquals($oTagSet->GetValues(), ['tag1', 'tag2']); } - /** */ public function testMaxTagLimit() { $oTagSet = new ormTagSet(TAG_CLASS, TAG_ATTCODE, 3); - $oTagSet->SetValues(array('tag1', 'tag2', 'tag3')); + $oTagSet->SetValues(['tag1', 'tag2', 'tag3']); - static::assertEquals($oTagSet->GetValues(), array('tag1', 'tag2', 'tag3')); + static::assertEquals($oTagSet->GetValues(), ['tag1', 'tag2', 'tag3']); - try - { - $oTagSet->SetValues(array('tag1', 'tag2', 'tag3', 'tag4')); - } - catch (CoreException $e) - { + try { + $oTagSet->SetValues(['tag1', 'tag2', 'tag3', 'tag4']); + } catch (CoreException $e) { static::assertEquals('Maximum number of tags (3) reached for FAQ:domains', $e->getMessage()); return; } @@ -121,7 +118,7 @@ class ormTagSetTest extends ItopDataTestCase static::assertTrue($oTagSet1->Equals($oTagSet1)); $oTagSet2 = new ormTagSet(TAG_CLASS, TAG_ATTCODE, MAX_TAGS); - $oTagSet2->SetValues(array('tag1')); + $oTagSet2->SetValues(['tag1']); static::assertTrue($oTagSet1->Equals($oTagSet2)); @@ -133,11 +130,11 @@ class ormTagSetTest extends ItopDataTestCase { $oTagSet = new ormTagSet(TAG_CLASS, TAG_ATTCODE, MAX_TAGS); - $oTagSet->SetValues(array('tag1')); - static::assertEquals($oTagSet->GetValues(), array('tag1')); + $oTagSet->SetValues(['tag1']); + static::assertEquals($oTagSet->GetValues(), ['tag1']); - $oTagSet->SetValues(array('tag1', 'tag2')); - static::assertEquals($oTagSet->GetValues(), array('tag1', 'tag2')); + $oTagSet->SetValues(['tag1', 'tag2']); + static::assertEquals($oTagSet->GetValues(), ['tag1', 'tag2']); } @@ -145,36 +142,36 @@ class ormTagSetTest extends ItopDataTestCase { $oTagSet = new ormTagSet(TAG_CLASS, TAG_ATTCODE, MAX_TAGS); $oTagSet->Remove('tag_unknown'); - static::assertEquals($oTagSet->GetValues(), array()); + static::assertEquals($oTagSet->GetValues(), []); - $oTagSet->SetValues(array('tag1')); + $oTagSet->SetValues(['tag1']); $oTagSet->Remove('tag_unknown'); - static::assertEquals($oTagSet->GetValues(), array('tag1')); + static::assertEquals($oTagSet->GetValues(), ['tag1']); - $oTagSet->SetValues(array('tag1', 'tag2')); + $oTagSet->SetValues(['tag1', 'tag2']); $oTagSet->Remove('tag1'); - static::assertEquals($oTagSet->GetValues(), array('tag2')); + static::assertEquals($oTagSet->GetValues(), ['tag2']); $oTagSet->Add('tag1'); - static::assertEquals($oTagSet->GetValues(), array('tag1', 'tag2')); + static::assertEquals($oTagSet->GetValues(), ['tag1', 'tag2']); $oTagSet->Remove('tag1'); - static::assertEquals($oTagSet->GetValues(), array('tag2')); + static::assertEquals($oTagSet->GetValues(), ['tag2']); $oTagSet->Remove('tag1'); - static::assertEquals($oTagSet->GetValues(), array('tag2')); + static::assertEquals($oTagSet->GetValues(), ['tag2']); $oTagSet->Remove('tag2'); - static::assertEquals($oTagSet->GetValues(), array()); + static::assertEquals($oTagSet->GetValues(), []); } public function testGetDelta() { $oTagSet1 = new ormTagSet(TAG_CLASS, TAG_ATTCODE, MAX_TAGS); - $oTagSet1->SetValues(array('tag1', 'tag2')); + $oTagSet1->SetValues(['tag1', 'tag2']); $oTagSet2 = new ormTagSet(TAG_CLASS, TAG_ATTCODE, MAX_TAGS); - $oTagSet2->SetValues(array('tag1', 'tag3', 'tag4')); + $oTagSet2->SetValues(['tag1', 'tag3', 'tag4']); $aDelta = $oTagSet1->GetDelta($oTagSet2); static::assertCount(2, $aDelta); @@ -185,10 +182,10 @@ class ormTagSetTest extends ItopDataTestCase public function testApplyDelta() { $oTagSet1 = new ormTagSet(TAG_CLASS, TAG_ATTCODE, MAX_TAGS); - $oTagSet1->SetValues(array('tag1', 'tag2')); + $oTagSet1->SetValues(['tag1', 'tag2']); $oTagSet2 = new ormTagSet(TAG_CLASS, TAG_ATTCODE, MAX_TAGS); - $oTagSet2->SetValues(array('tag1', 'tag3', 'tag4')); + $oTagSet2->SetValues(['tag1', 'tag3', 'tag4']); $aDelta = $oTagSet1->GetDelta($oTagSet2); @@ -211,8 +208,7 @@ class ormTagSetTest extends ItopDataTestCase $oTagSet1 = new ormTagSet(TAG_CLASS, TAG_ATTCODE, MAX_TAGS); $oTagSet1->SetValues($aInitialTags); - foreach($aDiffAndExpectedTags as $aTestItem) - { + foreach ($aDiffAndExpectedTags as $aTestItem) { $oTagSet1->GenerateDiffFromArray($aTestItem['diff']); static::assertEquals($aTestItem['modified'], $oTagSet1->GetModified()); } @@ -220,32 +216,32 @@ class ormTagSetTest extends ItopDataTestCase public function GetModifiedProvider() { - return array( - array( - array('tag2'), - array( - array('diff' => array('tag1', 'tag2'), 'modified' => array('tag1')), - array('diff' => array('tag2'), 'modified' => array('tag1')), - array('diff' => array(), 'modified' => array('tag1', 'tag2')), - ) - ), - array( - array('tag1', 'tag2'), - array( - array('diff' => array('tag1', 'tag3'), 'modified' => array('tag2', 'tag3')), - array('diff' => array('tag1', 'tag2'), 'modified' => array('tag2', 'tag3')), - array('diff' => array('tag1', 'tag2', 'tag3', 'tag4'), 'modified' => array('tag2', 'tag3', 'tag4')), - ) - ), - array( - array(), - array( - array('diff' => array('tag2'), 'modified' => array('tag2')), - array('diff' => array('tag1', 'tag2'), 'modified' => array('tag1', 'tag2')), - array('diff' => array('tag2'), 'modified' => array('tag1', 'tag2')), - ) - ), - ); + return [ + [ + ['tag2'], + [ + ['diff' => ['tag1', 'tag2'], 'modified' => ['tag1']], + ['diff' => ['tag2'], 'modified' => ['tag1']], + ['diff' => [], 'modified' => ['tag1', 'tag2']], + ], + ], + [ + ['tag1', 'tag2'], + [ + ['diff' => ['tag1', 'tag3'], 'modified' => ['tag2', 'tag3']], + ['diff' => ['tag1', 'tag2'], 'modified' => ['tag2', 'tag3']], + ['diff' => ['tag1', 'tag2', 'tag3', 'tag4'], 'modified' => ['tag2', 'tag3', 'tag4']], + ], + ], + [ + [], + [ + ['diff' => ['tag2'], 'modified' => ['tag2']], + ['diff' => ['tag1', 'tag2'], 'modified' => ['tag1', 'tag2']], + ['diff' => ['tag2'], 'modified' => ['tag1', 'tag2']], + ], + ], + ]; } /** @@ -270,32 +266,32 @@ class ormTagSetTest extends ItopDataTestCase public function BulkModifyProvider() { - return array( - 'Add one tag' => array( - array('tag1', 'tag2'), - array('added' => array('tag3')), - array('tag1', 'tag2', 'tag3') - ), - 'Remove one tag' => array( - array('tag1', 'tag2'), - array('removed' => array('tag2')), - array('tag1') - ), - 'Remove unexisting tag' => array( - array('tag1', 'tag2'), - array('removed' => array('tag3')), - array('tag1', 'tag2') - ), - 'Add one and remove one tag' => array( - array('tag1', 'tag2'), - array('added' => array('tag3'), 'removed' => array('tag2')), - array('tag1', 'tag3') - ), - 'Remove first tag' => array( - array('tag1', 'tag2'), - array('removed' => array('tag1')), - array('tag2') - ), - ); + return [ + 'Add one tag' => [ + ['tag1', 'tag2'], + ['added' => ['tag3']], + ['tag1', 'tag2', 'tag3'], + ], + 'Remove one tag' => [ + ['tag1', 'tag2'], + ['removed' => ['tag2']], + ['tag1'], + ], + 'Remove unexisting tag' => [ + ['tag1', 'tag2'], + ['removed' => ['tag3']], + ['tag1', 'tag2'], + ], + 'Add one and remove one tag' => [ + ['tag1', 'tag2'], + ['added' => ['tag3'], 'removed' => ['tag2']], + ['tag1', 'tag3'], + ], + 'Remove first tag' => [ + ['tag1', 'tag2'], + ['removed' => ['tag1']], + ['tag2'], + ], + ]; } } diff --git a/tests/php-unit-tests/unitary-tests/core/querybuilderexpressions/ExpressionTranslateTest.php b/tests/php-unit-tests/unitary-tests/core/querybuilderexpressions/ExpressionTranslateTest.php index 31be662a9..312418134 100644 --- a/tests/php-unit-tests/unitary-tests/core/querybuilderexpressions/ExpressionTranslateTest.php +++ b/tests/php-unit-tests/unitary-tests/core/querybuilderexpressions/ExpressionTranslateTest.php @@ -1,6 +1,5 @@ [ 'before' => "alias1.column1", 'map' => "['alias1' => ['column1' => new \ScalarExpression('hello')]]", - 'after' => "'hello'" + 'after' => "'hello'", ], 'field translated wherever it is in the expression tree' => [ 'before' => "1 + (2 * (3 / (4 - (5 + FLOOR(alias1.column1)))))", 'map' => "['alias1' => ['column1' => new \ScalarExpression('hello')]]", - 'after' => "(1 + (2 * (3 / (4 - (5 + FLOOR('hello'))))))" + 'after' => "(1 + (2 * (3 / (4 - (5 + FLOOR('hello'))))))", ], 'each and every occurrences of a field are translated' => [ 'before' => "CONCAT(alias1.column1, alias1.column1)", 'map' => "['alias1' => ['column1' => new \ScalarExpression('hello')]]", - 'after' => "CONCAT('hello', 'hello')" + 'after' => "CONCAT('hello', 'hello')", ], 'field translated into a complex expression (decomposition)' => [ 'before' => "alias1.column1", 'map' => "['alias1' => ['column1' => \Expression::FromOQL(\"CONCAT(person.first_name, ' ', contact.name)\")]]", - 'after' => "CONCAT(`person`.`first_name`, ' ', `contact`.`name`)" + 'after' => "CONCAT(`person`.`first_name`, ' ', `contact`.`name`)", ], 'translate several fields at once' => [ 'before' => "CONCAT(`person`.`first_name`, ' ', `contact`.`name`)", 'map' => "['person' => ['*' => 'table_person'], 'contact' => ['*' => 'table_contact']]", - 'after' => "CONCAT(`table_person`.`first_name`, ' ', `table_contact`.`name`)" + 'after' => "CONCAT(`table_person`.`first_name`, ' ', `table_contact`.`name`)", ], 'translation is done once and only once' => [ 'before' => "alias1.column1", 'map' => "['alias1' => ['column1' => \Expression::FromOQL('alias2.column1')], 'alias2' => ['column1' => new \ScalarExpression('translated again?')]]", - 'after' => "`alias2`.`column1`" + 'after' => "`alias2`.`column1`", ], 'translation of aliases, basic' => [ 'before' => "alias1.column1", 'map' => "['alias1' => ['*' => 'A']]", - 'after' => "`A`.`column1`" + 'after' => "`A`.`column1`", ], 'translation of aliases, several hits and mappings' => [ 'before' => "CONCAT(alias1.column1, alias1.column2, alias2.column1)", 'map' => "['alias1' => ['*' => 'A'], 'alias2' => ['*' => 'B']]", - 'after' => "CONCAT(`A`.`column1`, `A`.`column2`, `B`.`column1`)" + 'after' => "CONCAT(`A`.`column1`, `A`.`column2`, `B`.`column1`)", ], 'nothing to change (+ map exceeds translation needs)' => [ 'before' => "CONCAT('hello', 1 + 2, :paramX)", 'map' => "['alias1' => ['*' => 'alias2']]", - 'after' => "CONCAT('hello', (1 + 2), :paramX)" + 'after' => "CONCAT('hello', (1 + 2), :paramX)", ], ]; } @@ -106,7 +105,6 @@ class ExpressionTranslateTest extends ItopDataTestCase static::assertEquals($sclassForExpressionAfter, get_class($oExpressionAfter)); } - public function TranslateMarksFieldsAsResolvedOrNotProvider() { return [ @@ -114,19 +112,19 @@ class ExpressionTranslateTest extends ItopDataTestCase 'before' => "alias1.column1", 'map' => "['alias1' => ['*' => 'alias2']]", 'mark-as-resolved' => true, - 'class-for-expression-after' => "FieldExpressionResolved" + 'class-for-expression-after' => "FieldExpressionResolved", ], 'Translation of class/table alias and opt-out on bMarkFieldsAsResolved' => [ 'before' => "alias1.column1", 'map' => "['alias1' => ['*' => 'alias2']]", 'mark-as-resolved' => false, - 'class-for-expression-after' => "FieldExpression" + 'class-for-expression-after' => "FieldExpression", ], 'Decomposition of fields' => [ 'before' => "alias1.column1", 'map' => "['alias1' => ['column1' => new \FieldExpression('col2', 'alias2')]]", 'mark-as-resolved' => true, - 'class-for-expression-after' => "FieldExpression" + 'class-for-expression-after' => "FieldExpression", ], ]; } diff --git a/tests/php-unit-tests/unitary-tests/core/querybuilderexpressions/QueryBuilderExpressionsTest.php b/tests/php-unit-tests/unitary-tests/core/querybuilderexpressions/QueryBuilderExpressionsTest.php index 77a8081fd..d27e4c818 100644 --- a/tests/php-unit-tests/unitary-tests/core/querybuilderexpressions/QueryBuilderExpressionsTest.php +++ b/tests/php-unit-tests/unitary-tests/core/querybuilderexpressions/QueryBuilderExpressionsTest.php @@ -4,7 +4,7 @@ namespace Combodo\iTop\Test\UnitTest\Core; class QueryBuilderExpressionsTest extends \Combodo\iTop\Test\UnitTest\ItopCustomDatamodelTestCase { - const CREATE_TEST_ORG = true; + public const CREATE_TEST_ORG = true; /** * @inheritDoc @@ -19,13 +19,13 @@ class QueryBuilderExpressionsTest extends \Combodo\iTop\Test\UnitTest\ItopCustom $oTagA = \MetaModel::NewObject(\TagSetFieldData::GetTagDataClassName('TestObject', 'tagset'), [ 'code' => 'tagA', 'label' => 'Tag A', - 'description' => 'Tag known as "A"' + 'description' => 'Tag known as "A"', ]); $oTagA->DBInsert(); $oTagB = \MetaModel::NewObject(\TagSetFieldData::GetTagDataClassName('TestObject', 'tagset'), [ 'code' => 'tagB', 'label' => 'Tag B', - 'description' => 'Tag known as "B"' + 'description' => 'Tag known as "B"', ]); $oTagB->DBInsert(); @@ -185,7 +185,7 @@ class QueryBuilderExpressionsTest extends \Combodo\iTop\Test\UnitTest\ItopCustom // Create an indirection $oSubObject = \MetaModel::NewObject('SubObject', [ 'name' => 'subobject for '.$iTestObject, - 'testobject_id' => $iTestObject + 'testobject_id' => $iTestObject, ]); $oSubObject->DBInsert(); @@ -200,4 +200,4 @@ class QueryBuilderExpressionsTest extends \Combodo\iTop\Test\UnitTest\ItopCustom static::assertTrue($oAttDef->Equals($oObject->Get($sAttCode), $oSubObjectFromDB->Get($sExtFieldAttCode)), "Value of attribute '$sAttCode' not correctly read as an external key"); } } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/core/sanitizer/AbstractDOMSanitizerTest.php b/tests/php-unit-tests/unitary-tests/core/sanitizer/AbstractDOMSanitizerTest.php index f09378dc7..39b2c90b2 100644 --- a/tests/php-unit-tests/unitary-tests/core/sanitizer/AbstractDOMSanitizerTest.php +++ b/tests/php-unit-tests/unitary-tests/core/sanitizer/AbstractDOMSanitizerTest.php @@ -6,8 +6,8 @@ use Combodo\iTop\Test\UnitTest\ItopTestCase; abstract class AbstractDOMSanitizerTest extends ItopTestCase { - const INPUT_DIRECTORY = 'input'; - const OUTPUT_DIRECTORY = 'output'; + public const INPUT_DIRECTORY = 'input'; + public const OUTPUT_DIRECTORY = 'output'; protected function setUp(): void { @@ -46,7 +46,7 @@ abstract class AbstractDOMSanitizerTest extends ItopTestCase protected function GetTagAttributeValue($sTagAttribute, $iAttributeCounter) { $sTagAttrValue = ' '.$sTagAttribute.'="'; - if (in_array($sTagAttribute, array('href', 'src'))) { + if (in_array($sTagAttribute, ['href', 'src'])) { return $sTagAttrValue.'http://www.combodo.com"'; } @@ -59,11 +59,10 @@ abstract class AbstractDOMSanitizerTest extends ItopTestCase protected function IsClosingTag($sTag) { - if (in_array($sTag, array('br', 'img', 'hr'))) { + if (in_array($sTag, ['br', 'img', 'hr'])) { return false; } return true; } } - diff --git a/tests/php-unit-tests/unitary-tests/core/sanitizer/HTMLDOMSanitizerTest.php b/tests/php-unit-tests/unitary-tests/core/sanitizer/HTMLDOMSanitizerTest.php index 5838af5b3..ca0bd9329 100644 --- a/tests/php-unit-tests/unitary-tests/core/sanitizer/HTMLDOMSanitizerTest.php +++ b/tests/php-unit-tests/unitary-tests/core/sanitizer/HTMLDOMSanitizerTest.php @@ -1,13 +1,12 @@ array('href', 'name', 'style', 'target', 'title'), - 'p' => array('style'), - 'blockquote' => array('style'), - 'br' => array(), - 'span' => array('style'), - 'div' => array('style'), - 'b' => array(), - 'i' => array(), - 'u' => array(), - 'em' => array(), - 'strong' => array(), - 'img' => array('src', 'style', 'alt', 'title'), - 'ul' => array('style'), - 'ol' => array('reversed', 'start', 'style', 'type'), - 'li' => array('style', 'value'), - 'h1' => array('style'), - 'h2' => array('style'), - 'h3' => array('style'), - 'h4' => array('style'), - 'nav' => array('style'), - 'section' => array('style'), - 'code' => array('style'), - 'table' => array('style', 'width', 'summary', 'align', 'border', 'cellpadding', 'cellspacing'), - 'thead' => array('style'), - 'tbody' => array('style'), - 'tr' => array('style', 'colspan', 'rowspan'), - 'td' => array('style', 'colspan', 'rowspan'), - 'th' => array('style', 'colspan', 'rowspan'), - 'fieldset' => array('style'), - 'legend' => array('style'), - 'font' => array('face', 'color', 'style', 'size'), - 'big' => array(), - 'small' => array(), - 'tt' => array(), - 'kbd' => array(), - 'samp' => array(), - 'var' => array(), - 'del' => array(), - 's' => array(), // strikethrough - 'ins' => array(), - 'cite' => array(), - 'q' => array(), - 'hr' => array('style'), - 'pre' => array(), - 'center' => array(), - ); - $aTestCaseArray = array(); + 'a' => ['href', 'name', 'style', 'target', 'title'], + 'p' => ['style'], + 'blockquote' => ['style'], + 'br' => [], + 'span' => ['style'], + 'div' => ['style'], + 'b' => [], + 'i' => [], + 'u' => [], + 'em' => [], + 'strong' => [], + 'img' => ['src', 'style', 'alt', 'title'], + 'ul' => ['style'], + 'ol' => ['reversed', 'start', 'style', 'type'], + 'li' => ['style', 'value'], + 'h1' => ['style'], + 'h2' => ['style'], + 'h3' => ['style'], + 'h4' => ['style'], + 'nav' => ['style'], + 'section' => ['style'], + 'code' => ['style'], + 'table' => ['style', 'width', 'summary', 'align', 'border', 'cellpadding', 'cellspacing'], + 'thead' => ['style'], + 'tbody' => ['style'], + 'tr' => ['style', 'colspan', 'rowspan'], + 'td' => ['style', 'colspan', 'rowspan'], + 'th' => ['style', 'colspan', 'rowspan'], + 'fieldset' => ['style'], + 'legend' => ['style'], + 'font' => ['face', 'color', 'style', 'size'], + 'big' => [], + 'small' => [], + 'tt' => [], + 'kbd' => [], + 'samp' => [], + 'var' => [], + 'del' => [], + 's' => [], // strikethrough + 'ins' => [], + 'cite' => [], + 'q' => [], + 'hr' => ['style'], + 'pre' => [], + 'center' => [], + ]; + $aTestCaseArray = []; $sInputText = $this->ReadTestFile('whitelist_test.html', self::INPUT_DIRECTORY); foreach ($aTagsWhiteList as $sTag => $aTagAttributes) { @@ -136,7 +135,7 @@ class HTMLDOMSanitizerTest extends AbstractDOMSanitizerTest $sClosingTag = $this->IsClosingTag($sTag) ? "" : ''; $sTestCaseText = str_replace('##END_TAG##', $sClosingTag, $sTestCaseText); - $aTestCaseArray[$sTag] = array($sTestCaseText); + $aTestCaseArray[$sTag] = [$sTestCaseText]; } return $aTestCaseArray; @@ -155,71 +154,71 @@ class HTMLDOMSanitizerTest extends AbstractDOMSanitizerTest public function RemoveBlackListedTagContentProvider() { - return array( - 'basic' => array( + return [ + 'basic' => [ 'html' => 'foobaz', 'expected' => '

    foobaz

    ', - ), - 'basic with body' => array( + ], + 'basic with body' => [ 'html' => 'foobaz', 'expected' => 'foobaz', - ), - 'basic with html and body tags' => array( + ], + 'basic with html and body tags' => [ 'html' => 'foobaz', 'expected' => 'foobaz', - ), - 'basic with attributes' => array( + ], + 'basic with attributes' => [ 'html' => 'foobaz', 'expected' => '

    foobaz

    ', - ), - 'basic with comment' => array( + ], + 'basic with comment' => [ 'html' => 'foobaz', 'expected' => '

    foobaz

    ', - ), - 'basic with contentRemovable tag' => array( + ], + 'basic with contentRemovable tag' => [ 'html' => 'foobaz', 'expected' => '

    foobaz

    ', - ), - 'nested' => array( + ], + 'nested' => [ 'html' => 'beforeoofafter', 'expected' => '

    beforeafter

    ', - ), - 'nested with not closed br' => array( + ], + 'nested with not closed br' => [ 'html' => 'beforeoofafter', 'expected' => '

    beforeafter

    ', - ), - 'nested with allowed' => array( + ], + 'nested with allowed' => [ 'html' => 'beforeafter', 'expected' => '

    beforeafter

    ', - ), - 'nested with spaces' => array( + ], + 'nested with spaces' => [ 'html' => 'beforeafter', 'expected' => '

    beforeafter

    ', - ), - 'nested with attributes' => array( + ], + 'nested with attributes' => [ 'html' => 'beforeafter', 'expected' => '

    beforeafter

    ', - ), - 'nested with allowed and attributes and spaces ' => array( + ], + 'nested with allowed and attributes and spaces ' => [ 'html' => 'beforeafter', 'expected' => 'beforeafter', - ), - 'nested with allowed and contentRemovable tags' => array( + ], + 'nested with allowed and contentRemovable tags' => [ 'html' => 'beforemiddleafter', 'expected' => 'beforemiddleafter', - ), + ], - 'regression: if head present => body is not trimmed' => array( + 'regression: if head present => body is not trimmed' => [ 'html' => 'bar', 'expected' => 'bar', - ), - - 'ordered list with attributes' => array( + ], + + 'ordered list with attributes' => [ 'html' => '
    1. Some list item
    ', 'expected' => '
    1. Some list item
    ', - ), - - ); + ], + + ]; } /** @@ -240,26 +239,25 @@ class HTMLDOMSanitizerTest extends AbstractDOMSanitizerTest public function CallInlineImageProcessImageTagProvider() { - return array( - 'no image' => array( + return [ + 'no image' => [ 'html' => '

    bar

    ', 'expected' => 0, - ), - 'basic image' => array( + ], + 'basic image' => [ 'html' => '', 'expected' => 1, - ), - 'nested images within forbidden tags' => array( + ], + 'nested images within forbidden tags' => [ 'html' => '', 'expected' => 2, - ), + ], // This test will be restored with the ticket n°2556 // 'nested images within forbidden and removed tags' => array( // 'html' => '', // 'expected' => 2, // ), - ); + ]; } } - diff --git a/tests/php-unit-tests/unitary-tests/core/sanitizer/InlineImageMock.php b/tests/php-unit-tests/unitary-tests/core/sanitizer/InlineImageMock.php index 0649c17ec..81ca8e5ff 100644 --- a/tests/php-unit-tests/unitary-tests/core/sanitizer/InlineImageMock.php +++ b/tests/php-unit-tests/unitary-tests/core/sanitizer/InlineImageMock.php @@ -1,4 +1,5 @@ 'john')); + $oUserLocal = MetaModel::NewObject(UserLocal::class, ['login' => 'john']); /** @var ormLinkSet $oProfileSet */ $oProfileSet = $oUserLocal->Get('profile_list'); $oProfileSet->AddItem( - MetaModel::NewObject(URP_UserProfile::class, array('profileid' => 1)) + MetaModel::NewObject(URP_UserProfile::class, ['profileid' => 1]) ); - $aValidatorCollection = array(); - foreach ($aValidatorNames as $class) - { + $aValidatorCollection = []; + foreach ($aValidatorNames as $class) { $aValidatorCollection[] = new $class(); } @@ -79,168 +77,167 @@ class UserLocalTest extends ItopDataTestCase public function ProviderValidatePassword() { - return array( - 'validPattern' => array( + return [ + 'validPattern' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserPasswordPolicyRegex', - ), - 'valueMap' => array( - array('authent-local', 'password_validation.pattern', null, '.{1,10}'), - ), + ], + 'valueMap' => [ + ['authent-local', 'password_validation.pattern', null, '.{1,10}'], + ], 'expectedCheckStatus' => true, - ), - 'notValidPattern' => array( + ], + 'notValidPattern' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserPasswordPolicyRegex', - ), - 'valueMap' => array( - array('authent-local', 'password_validation.pattern', null, '.{6,10}'), - ), + ], + 'valueMap' => [ + ['authent-local', 'password_validation.pattern', null, '.{6,10}'], + ], 'expectedCheckStatus' => false, - ), - 'noPattern' => array( + ], + 'noPattern' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserPasswordPolicyRegex', - ), - 'valueMap' => array( - array('authent-local', 'password_validation.pattern', null, '') - ), + ], + 'valueMap' => [ + ['authent-local', 'password_validation.pattern', null, ''], + ], 'expectedCheckStatus' => true, - ), - 'validClass' => array( + ], + 'validClass' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserLocalPasswordPolicyMockValid', - ), - 'valueMap' => array(), + ], + 'valueMap' => [], 'expectedCheckStatus' => true, - ), - 'notValidClass' => array( + ], + 'notValidClass' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserLocalPasswordPolicyMockNotValid', - ), - 'valueMap' => array(), + ], + 'valueMap' => [], 'expectedCheckStatus' => false, - ), + ], - 'validation_composition_10' => array( + 'validation_composition_10' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserLocalPasswordPolicyMockValid', 'UserLocalPasswordPolicyMockNotValid', - ), - 'valueMap' => array(), + ], + 'valueMap' => [], 'expectedCheckStatus' => false, 'expectedCheckIssues' => 'UserLocalPasswordPolicyMockNotValid', - ), + ], - - 'validation_composition_01' => array( + 'validation_composition_01' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserLocalPasswordPolicyMockNotValid', 'UserLocalPasswordPolicyMockValid', - ), - 'valueMap' => array(), + ], + 'valueMap' => [], 'expectedCheckStatus' => false, 'expectedCheckIssues' => 'UserLocalPasswordPolicyMockNotValid', - ), + ], - 'validation_composition_11' => array( + 'validation_composition_11' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserLocalPasswordPolicyMockValid', 'UserLocalPasswordPolicyMockValidBis', - ), - 'valueMap' => array(), + ], + 'valueMap' => [], 'expectedCheckStatus' => true, - ), - 'validation_composition_00' => array( + ], + 'validation_composition_00' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserLocalPasswordPolicyMockNotValid', 'UserLocalPasswordPolicyMockNotValidBis', - ), - 'valueMap' => array(), + ], + 'valueMap' => [], 'expectedCheckStatus' => false, 'expectedCheckIssues' => 'UserLocalPasswordPolicyMockNotValid', - ), + ], - 'notValidPattern custom message FR' => array( + 'notValidPattern custom message FR' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserPasswordPolicyRegex', - ), - 'valueMap' => array( - array('authent-local', 'password_validation.pattern', null, '.{6,10}'), - array('authent-local', 'password_validation.message', null, array('FR FR' => 'fr message', 'EN US' => 'en message')), + ], + 'valueMap' => [ + ['authent-local', 'password_validation.pattern', null, '.{6,10}'], + ['authent-local', 'password_validation.message', null, ['FR FR' => 'fr message', 'EN US' => 'en message']], - ), + ], 'expectedCheckStatus' => false, 'expectedCheckIssues' => 'fr message', 'userLanguage' => 'FR FR', - ), - 'notValidPattern custom message EN' => array( + ], + 'notValidPattern custom message EN' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserPasswordPolicyRegex', - ), - 'valueMap' => array( - array('authent-local', 'password_validation.pattern', null, '.{6,10}'), - array('authent-local', 'password_validation.message', null, array('FR FR' => 'fr message', 'EN US' => 'en message')), + ], + 'valueMap' => [ + ['authent-local', 'password_validation.pattern', null, '.{6,10}'], + ['authent-local', 'password_validation.message', null, ['FR FR' => 'fr message', 'EN US' => 'en message']], - ), + ], 'expectedCheckStatus' => false, 'expectedCheckIssues' => 'en message', 'userLanguage' => 'EN US', - ), - 'notValidPattern custom message Fallback' => array( + ], + 'notValidPattern custom message Fallback' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserPasswordPolicyRegex', - ), - 'valueMap' => array( - array('authent-local', 'password_validation.pattern', null, '.{6,10}'), - array('authent-local', 'password_validation.message', null, array('EN US' => 'en message')), + ], + 'valueMap' => [ + ['authent-local', 'password_validation.pattern', null, '.{6,10}'], + ['authent-local', 'password_validation.message', null, ['EN US' => 'en message']], - ), + ], 'expectedCheckStatus' => false, 'expectedCheckIssues' => 'en message', 'userLanguage' => 'FR FR', - ), - 'notValidPattern custom message empty array' => array( + ], + 'notValidPattern custom message empty array' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserPasswordPolicyRegex', - ), - 'valueMap' => array( - array('authent-local', 'password_validation.pattern', null, '.{6,10}'), - array('authent-local', 'password_validation.message', null, array()), + ], + 'valueMap' => [ + ['authent-local', 'password_validation.pattern', null, '.{6,10}'], + ['authent-local', 'password_validation.message', null, []], - ), + ], 'expectedCheckStatus' => false, 'expectedCheckIssues' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.', 'userLanguage' => 'EN US', - ), - 'notValidPattern custom message string not array' => array( + ], + 'notValidPattern custom message string not array' => [ 'password' => 'foo', - 'aValidatorCollection' => array( + 'aValidatorCollection' => [ 'UserPasswordPolicyRegex', - ), - 'valueMap' => array( - array('authent-local', 'password_validation.pattern', null, '.{6,10}'), - array('authent-local', 'password_validation.message', null, 'not an array'), + ], + 'valueMap' => [ + ['authent-local', 'password_validation.pattern', null, '.{6,10}'], + ['authent-local', 'password_validation.message', null, 'not an array'], - ), + ], 'expectedCheckStatus' => false, 'expectedCheckIssues' => 'not an array', 'userLanguage' => 'EN US', - ), - ); + ], + ]; } /** @@ -254,9 +251,8 @@ class UserLocalTest extends ItopDataTestCase $oNow = date($sDateFormat); $oExpectedAfter = is_null($sExpectedAfter) ? null : date($sDateFormat, strtotime($sExpectedAfter)); - $aUserLocalValues = array('login' => 'john'); - if (!is_null($oBefore)) - { + $aUserLocalValues = ['login' => 'john']; + if (!is_null($oBefore)) { $aUserLocalValues['password_renewed_date'] = $oBefore; } @@ -266,7 +262,7 @@ class UserLocalTest extends ItopDataTestCase $oProfileSet = $oUserLocal->Get('profile_list'); $oProfileSet->AddItem( - MetaModel::NewObject(URP_UserProfile::class, array('profileid' => 1)) + MetaModel::NewObject(URP_UserProfile::class, ['profileid' => 1]) ); $this->assertEquals($oBefore, $oUserLocal->Get('password_renewed_date')); @@ -298,20 +294,20 @@ class UserLocalTest extends ItopDataTestCase public function ProviderPasswordRenewal() { - return array( - 'nominal case' => array( + return [ + 'nominal case' => [ 'oExpectedBefore' => null, 'oExpectedAfter' => 'now', - ), - 'date initiated' => array( + ], + 'date initiated' => [ 'oBefore' => '-1 day', 'oExpectedAfter' => 'now', - ), - 'date initiated in the future' => array( + ], + 'date initiated in the future' => [ 'oBefore' => '+1 day', 'oExpectedAfter' => 'now', - ), - ); + ], + ]; } /** @@ -324,9 +320,8 @@ class UserLocalTest extends ItopDataTestCase $oNow = date(AttributeDate::GetInternalFormat()); $oExpectedAfter = $bRenewedDateTouched ? $oNow : $oBefore; - $aUserLocalValues = array('login' => 'john'); - if (!is_null($oBefore)) - { + $aUserLocalValues = ['login' => 'john']; + if (!is_null($oBefore)) { $aUserLocalValues['password_renewed_date'] = $oBefore; } @@ -336,7 +331,7 @@ class UserLocalTest extends ItopDataTestCase $oProfileSet = $oUserLocal->Get('profile_list'); $oProfileSet->AddItem( - MetaModel::NewObject(URP_UserProfile::class, array('profileid' => 1)) + MetaModel::NewObject(URP_UserProfile::class, ['profileid' => 1]) ); $this->assertEquals($oBefore, $oUserLocal->Get('password_renewed_date')); @@ -360,38 +355,38 @@ class UserLocalTest extends ItopDataTestCase public function CanExpireFixProvider() { - return array( - 'EXPIRE_CAN: nominal case' => array( + return [ + 'EXPIRE_CAN: nominal case' => [ 'sExpirationMode' => 'can_expire', 'oExpectedBefore' => null, 'bRenewedDateTouched' => true, - ), - 'EXPIRE_NEVER (default mode): nothing changed on UserLocal' => array( + ], + 'EXPIRE_NEVER (default mode): nothing changed on UserLocal' => [ 'sExpirationMode' => 'never_expire', 'oExpectedBefore' => null, 'bRenewedDateTouched' => false, - ), - 'EXPIRE_FORCE: nominal case' => array( + ], + 'EXPIRE_FORCE: nominal case' => [ 'sExpirationMode' => 'force_expire', 'oExpectedBefore' => null, 'bRenewedDateTouched' => true, - ), - 'EXPIRE_ONE_TIME_PWD: nominal case' => array( + ], + 'EXPIRE_ONE_TIME_PWD: nominal case' => [ 'sExpirationMode' => 'otp_expire', 'oExpectedBefore' => null, 'bRenewedDateTouched' => true, - ), - 'date initiated' => array( + ], + 'date initiated' => [ 'sExpirationMode' => 'can_expire', 'oBefore' => '-1 day', 'bRenewedDateTouched' => false, - ), - 'date initiated in the future' => array( + ], + 'date initiated in the future' => [ 'sExpirationMode' => 'can_expire', 'oBefore' => '+1 day', 'bRenewedDateTouched' => false, - ), - ); + ], + ]; } /** @@ -454,4 +449,3 @@ class UserLocalTest extends ItopDataTestCase return $oUser->Get('profile_list'); } } - diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/authent-local/UserLocalTest/UserLocalPasswordPolicyMock.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/authent-local/UserLocalTest/UserLocalPasswordPolicyMock.php index 8ee95cb70..d925e20ea 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/authent-local/UserLocalTest/UserLocalPasswordPolicyMock.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/authent-local/UserLocalTest/UserLocalPasswordPolicyMock.php @@ -1,8 +1,9 @@ Count(); - if ($iCount != 0){ - while ($oRack = $oSet->Fetch()){ + if ($iCount != 0) { + while ($oRack = $oSet->Fetch()) { $oRack->DBDelete(); } } @@ -44,7 +46,8 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { /** * @dataProvider ReconciliationKeyProvider */ - public function testExternalFieldIssueImportFail_NoObjectAtAll($bIsRackReconKey){ + public function testExternalFieldIssueImportFail_NoObjectAtAll($bIsRackReconKey) + { $this->deleteAllRacks(); $this->performBulkChangeTest( @@ -55,7 +58,8 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { ); } - public function createRackObjects($aRackDict) { + public function createRackObjects($aRackDict) + { foreach ($aRackDict as $iOrgId => $aRackNames) { foreach ($aRackNames as $sRackName) { $this->createObject('Rack', ['name' => $sRackName, 'description' => "{$sRackName}Desc", 'org_id' => $iOrgId]); @@ -63,9 +67,10 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { } } - private function createAnotherUserInAnotherOrg() { + private function createAnotherUserInAnotherOrg() + { $oOrg2 = $this->CreateOrganization('UnitTestOrganization2'); - $oProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'Configuration Manager'), true); + $oProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => 'Configuration Manager'], true); $sUid = $this->GetUid(); @@ -75,13 +80,13 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { $oSet = \DBObjectSet::FromObject($oUserProfile); $oPerson = $this->CreatePerson('666', $oOrg2->GetKey()); - $oUser = $this->createObject('UserLocal', array( + $oUser = $this->createObject('UserLocal', [ 'contactid' => $oPerson->GetKey(), 'login' => $sUid, 'password' => "ABCdef$sUid@12345", 'language' => 'EN US', 'profile_list' => $oSet, - )); + ]); $oAllowedOrgList = $oUser->Get('allowed_org_list'); /** @var \URP_UserOrg $oUserOrg */ @@ -92,22 +97,23 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { return [$oOrg2, $oUser]; } - public function ReconciliationKeyProvider(){ + public function ReconciliationKeyProvider() + { return [ 'rack_id NOT a reconcilication key' => [ false ], 'rack_id reconcilication key' => [ true ], ]; } - /** * @dataProvider ReconciliationKeyProvider */ - public function testExternalFieldIssueImportFail_NoObjectVisibleByCurrentUser($bIsRackReconKey){ + public function testExternalFieldIssueImportFail_NoObjectVisibleByCurrentUser($bIsRackReconKey) + { $this->deleteAllRacks(); $this->createRackObjects( [ - $this->getTestOrgId() => ['RackTest1', 'RackTest2', 'RackTest3', 'RackTest4'] + $this->getTestOrgId() => ['RackTest1', 'RackTest2', 'RackTest3', 'RackTest4'], ] ); @@ -125,7 +131,8 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { /** * @dataProvider ReconciliationKeyProvider */ - public function testExternalFieldIssueImportFail_SomeObjectVisibleByCurrentUser($bIsRackReconKey){ + public function testExternalFieldIssueImportFail_SomeObjectVisibleByCurrentUser($bIsRackReconKey) + { $this->deleteAllRacks(); [$oOrg2, $oUser] = $this->createAnotherUserInAnotherOrg(); $this->createRackObjects( @@ -148,11 +155,12 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { /** * @dataProvider ReconciliationKeyProvider */ - public function testExternalFieldIssueImportFail_AllObjectsVisibleByCurrentUser($bIsRackReconKey){ + public function testExternalFieldIssueImportFail_AllObjectsVisibleByCurrentUser($bIsRackReconKey) + { $this->deleteAllRacks(); $this->createRackObjects( [ - $this->getTestOrgId() => ['RackTest1', 'RackTest2', 'RackTest3', 'RackTest4'] + $this->getTestOrgId() => ['RackTest1', 'RackTest2', 'RackTest3', 'RackTest4'], ] ); @@ -167,11 +175,12 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { /** * @dataProvider ReconciliationKeyProvider */ - public function testExternalFieldIssueImportFail_AllObjectsVisibleByCurrentUser_AmbigousMatch($bIsRackReconKey){ + public function testExternalFieldIssueImportFail_AllObjectsVisibleByCurrentUser_AmbigousMatch($bIsRackReconKey) + { $this->deleteAllRacks(); $this->createRackObjects( [ - $this->getTestOrgId() => ['UnexistingRack', 'UnexistingRack'] + $this->getTestOrgId() => ['UnexistingRack', 'UnexistingRack'], ] ); @@ -187,15 +196,15 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { ); } - /** * @dataProvider ReconciliationKeyProvider */ - public function testExternalFieldIssueImportFail_AllObjectsVisibleByCurrentUser_FurtherExtKeyForRack($bIsRackReconKey){ + public function testExternalFieldIssueImportFail_AllObjectsVisibleByCurrentUser_FurtherExtKeyForRack($bIsRackReconKey) + { $this->deleteAllRacks(); $this->createRackObjects( [ - $this->getTestOrgId() => ['RackTest1', 'RackTest2', 'RackTest3', 'RackTest4'] + $this->getTestOrgId() => ['RackTest1', 'RackTest2', 'RackTest3', 'RackTest4'], ] ); @@ -214,24 +223,32 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { ); } - - private function GetUid(){ - if (is_null($this->sUid)){ + private function GetUid() + { + if (is_null($this->sUid)) { $this->sUid = uniqid('test'); } return $this->sUid; } - public function performBulkChangeTest($sExpectedDisplayableValue, $sExpectedDescription, $oOrg, $bIsRackReconKey, - $aAdditionalCsvData=null, $aExtKeys=null, $sSearchLinkUrl=null, $sError="Object not found") { - if ($sSearchLinkUrl===null){ + public function performBulkChangeTest( + $sExpectedDisplayableValue, + $sExpectedDescription, + $oOrg, + $bIsRackReconKey, + $aAdditionalCsvData = null, + $aExtKeys = null, + $sSearchLinkUrl = null, + $sError = "Object not found" + ) { + if ($sSearchLinkUrl === null) { $sSearchLinkUrl = 'UI.php?operation=search&filter='.rawurlencode('%5B%22SELECT+%60Rack%60+FROM+Rack+AS+%60Rack%60+WHERE+%28%60Rack%60.%60name%60+%3D+%3Aname%29%22%2C%7B%22name%22%3A%22UnexistingRack%22%7D%2C%5B%5D%5D'); } - if (is_null($oOrg)){ + if (is_null($oOrg)) { $iOrgId = $this->getTestOrgId(); $sOrgName = "UnitTestOrganization"; - }else{ + } else { $iOrgId = $oOrg->GetKey(); $sOrgName = $oOrg->Get('name'); } @@ -239,15 +256,15 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { $sUid = $this->GetUid(); $aCsvData = [[$sOrgName, "UnexistingRack", "$sUid"]]; - if ($aAdditionalCsvData !== null){ - foreach ($aAdditionalCsvData as $i => $aData){ - foreach ($aData as $sData){ + if ($aAdditionalCsvData !== null) { + foreach ($aAdditionalCsvData as $i => $aData) { + foreach ($aData as $sData) { $aCsvData[$i][] = $sData; } } } $aAttributes = ["name" => 2]; - if ($aExtKeys == null){ + if ($aExtKeys == null) { $aExtKeys = ["org_id" => ["name" => 0], "rack_id" => ["name" => 1]]; } $aReconcilKeys = [ "name" ]; @@ -259,19 +276,18 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { 2 => "\"$sUid\"", "rack_id" => [ $sExpectedDisplayableValue, - $sExpectedDescription + $sExpectedDescription, ], "__STATUS__" => "Issue: Unexpected attribute value(s)", "__ERRORS__" => $sError, ]; - if ($bIsRackReconKey){ + if ($bIsRackReconKey) { $aReconcilKeys[] = "rack_id"; $aResult[2] = $sUid; $aResult["__STATUS__"] = "Issue: failed to reconcile"; } - CMDBSource::Query('START TRANSACTION'); try { @@ -279,8 +295,8 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { $db_core_transactions_enabled = MetaModel::GetConfig()->Get('db_core_transactions_enabled'); MetaModel::GetConfig()->Set('db_core_transactions_enabled', false); - $this->debug("aCsvData:" . json_encode($aCsvData[0])); - $this->debug("aReconcilKeys:" . var_export($aReconcilKeys)); + $this->debug("aCsvData:".json_encode($aCsvData[0])); + $this->debug("aReconcilKeys:".var_export($aReconcilKeys)); $oBulk = new \BulkChange( "Server", $aCsvData, @@ -302,24 +318,33 @@ class BulkChangeExtKeyTest extends ItopDataTestCase { foreach ($aRes as $aRow) { if (array_key_exists('__STATUS__', $aRow)) { $sStatus = $aRow['__STATUS__']; - $this->debug("sStatus:" . $sStatus->GetDescription()); + $this->debug("sStatus:".$sStatus->GetDescription()); $this->assertEquals($aResult["__STATUS__"], $sStatus->GetDescription()); foreach ($aRow as $i => $oCell) { if ($i != "finalclass" && $i != "__STATUS__" && $i != "__ERRORS__") { - $this->debug("i:" . $i); + $this->debug("i:".$i); if (array_key_exists($i, $aResult)) { - $this->debug("aResult:" . var_export($aResult[$i])); + $this->debug("aResult:".var_export($aResult[$i])); if ($oCell instanceof \CellStatus_SearchIssue || $oCell instanceof \CellStatus_Ambiguous) { - $this->assertEquals($aResult[$i][0], $oCell->GetCLIValue(), - "failure on " . get_class($oCell) . ' cell type'); - $this->assertEquals($sSearchLinkUrl, $oCell->GetSearchLinkUrl(), - "failure on " . get_class($oCell) . ' cell type'); - $this->assertEquals($aResult[$i][1], $oCell->GetDescription(), - "failure on " . get_class($oCell) . ' cell type'); + $this->assertEquals( + $aResult[$i][0], + $oCell->GetCLIValue(), + "failure on ".get_class($oCell).' cell type' + ); + $this->assertEquals( + $sSearchLinkUrl, + $oCell->GetSearchLinkUrl(), + "failure on ".get_class($oCell).' cell type' + ); + $this->assertEquals( + $aResult[$i][1], + $oCell->GetDescription(), + "failure on ".get_class($oCell).' cell type' + ); } } - } else if ($i === "__ERRORS__") { + } elseif ($i === "__ERRORS__") { $sErrors = array_key_exists("__ERRORS__", $aResult) ? $aResult["__ERRORS__"] : ""; $this->assertEquals($sErrors, $oCell->GetDescription()); } diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/CRUD/DBObjectTest.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/CRUD/DBObjectTest.php index 94385e130..f071358a8 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/CRUD/DBObjectTest.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/CRUD/DBObjectTest.php @@ -1,4 +1,5 @@ Set('email', 'test1@combodo.com'); $this->assertTrue(false, 'Set() should have raised a CoreException'); - } - catch (\CoreException $e) { + } catch (\CoreException $e) { $this->assertEquals($sMessage, $e->getMessage()); } diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigPlaceholdersResolverTest.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigPlaceholdersResolverTest.php index 723386097..e2a71422a 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigPlaceholdersResolverTest.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigPlaceholdersResolverTest.php @@ -1,4 +1,5 @@ expectException($sExpectedExceptionClass); } @@ -49,118 +49,118 @@ class ConfigPlaceholdersResolverTest extends ItopTestCase public function providerResolve() { - $stdObj = (object) array('%env(HTTP_PORT)?:8080%', '%server(toto)?:8080%', '%foo(toto)?:8080%'); + $stdObj = (object) ['%env(HTTP_PORT)?:8080%', '%server(toto)?:8080%', '%foo(toto)?:8080%']; - return array( - 'basic behaviour' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'), - 'aServer' => array(), + return [ + 'basic behaviour' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'], + 'aServer' => [], 'sValue' => '%env(HTTP_PORT)%', 'sExpected' => '443', - ), + ], - 'disabled if no ITOP_CONFIG_PLACEHOLDERS' => array( - 'aEnv' => array('HTTP_PORT' => '443'), - 'aServer' => array(), + 'disabled if no ITOP_CONFIG_PLACEHOLDERS' => [ + 'aEnv' => ['HTTP_PORT' => '443'], + 'aServer' => [], 'sValue' => '%env(HTTP_PORT)%', 'sExpected' => '%env(HTTP_PORT)%', - ), + ], - 'basic with default not used' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'), - 'aServer' => array(), + 'basic with default not used' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'], + 'aServer' => [], 'sValue' => '%env(HTTP_PORT)?:foo%', 'sExpected' => '443', - ), + ], - 'basic with default used' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, ), - 'aServer' => array(), + 'basic with default used' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, ], + 'aServer' => [], 'sValue' => '%env(HTTP_PORT)?:foo%', 'sExpected' => 'foo', - ), + ], - 'basic with default used and empty' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, ), - 'aServer' => array(), + 'basic with default used and empty' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, ], + 'aServer' => [], 'sValue' => '%env(HTTP_PORT)?:%', 'sExpected' => '', - ), + ], - 'mixed with static' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'), - 'aServer' => array('toto' => 'tutu'), + 'mixed with static' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'], + 'aServer' => ['toto' => 'tutu'], 'sValue' => 'http://localhost:%env(HTTP_PORT)?:8080%/', 'sExpected' => 'http://localhost:443/', - ), + ], - 'multiple occurrences' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'), - 'aServer' => array('SERVER_NAME' => 'localhost'), + 'multiple occurrences' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'], + 'aServer' => ['SERVER_NAME' => 'localhost'], 'sValue' => 'http://%server(SERVER_NAME)%:%env(HTTP_PORT)%/', 'sExpected' => 'http://localhost:443/', - ), + ], - 'array as source' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'), - 'aServer' => array('toto' => 'tutu'), - 'sValue' => array('http://localhost:%env(HTTP_PORT)?:8080%/', '%foo(HTTP_PORT)?:8080%', '%server(toto)?:8080%'), - 'sExpected' => array('http://localhost:443/', '%foo(HTTP_PORT)?:8080%', 'tutu'), - ), + 'array as source' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'], + 'aServer' => ['toto' => 'tutu'], + 'sValue' => ['http://localhost:%env(HTTP_PORT)?:8080%/', '%foo(HTTP_PORT)?:8080%', '%server(toto)?:8080%'], + 'sExpected' => ['http://localhost:443/', '%foo(HTTP_PORT)?:8080%', 'tutu'], + ], - 'invalid source' => array( - 'aEnv' => array('toto' => 'tutu'), - 'aServer' => array('HTTP_PORT' => '443'), + 'invalid source' => [ + 'aEnv' => ['toto' => 'tutu'], + 'aServer' => ['HTTP_PORT' => '443'], 'sValue' => '%foo(HTTP_PORT)?:8080%', 'sExpected' => '%foo(HTTP_PORT)?:8080%', - ), + ], - 'ignored source' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'), - 'aServer' => array('toto' => 'tutu'), + 'ignored source' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'], + 'aServer' => ['toto' => 'tutu'], 'sValue' => $stdObj, 'sExpected' => $stdObj, - ), + ], - 'env matching port' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'), - 'aServer' => array('toto' => 'tutu'), + 'env matching port' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'], + 'aServer' => ['toto' => 'tutu'], 'sValue' => '%env(HTTP_PORT)?:8080%', 'sExpected' => '443', - ), - 'env no matching port with default ' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'foo' => 'bar'), - 'aServer' => array('toto' => 'tutu'), + ], + 'env no matching port with default ' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, 'foo' => 'bar'], + 'aServer' => ['toto' => 'tutu'], 'sValue' => '%env(HTTP_PORT)?:8080%', 'sExpected' => '8080', - ), - 'env no matching port' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'foo' => 'bar'), - 'aServer' => array('toto' => 'tutu'), + ], + 'env no matching port' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, 'foo' => 'bar'], + 'aServer' => ['toto' => 'tutu'], 'sValue' => '%env(HTTP_PORT)%', 'sExpected' => null, 'sExpectedExceptionClass' => 'ConfigException', - ), + ], - 'server matching port' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'toto' => 'tutu'), - 'aServer' => array('HTTP_PORT' => '443'), + 'server matching port' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, 'toto' => 'tutu'], + 'aServer' => ['HTTP_PORT' => '443'], 'sValue' => '%server(HTTP_PORT)?:8080%', 'sExpected' => '443', - ), - 'server no matching port with default ' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'toto' => 'tutu'), - 'aServer' => array('foo' => 'bar'), + ], + 'server no matching port with default ' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, 'toto' => 'tutu'], + 'aServer' => ['foo' => 'bar'], 'sValue' => '%server(HTTP_PORT)?:8080%', 'sExpected' => '8080', - ), - 'server no matching port' => array( - 'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'toto' => 'tutu'), - 'aServer' => array('foo' => 'bar'), + ], + 'server no matching port' => [ + 'aEnv' => ['ITOP_CONFIG_PLACEHOLDERS' => 1, 'toto' => 'tutu'], + 'aServer' => ['foo' => 'bar'], 'sValue' => '%server(HTTP_PORT)%', 'sExpected' => null, 'sExpectedExceptionClass' => 'ConfigException', - ), - ); + ], + ]; } } diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest.php index 6e8c27d23..225209553 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest.php @@ -1,4 +1,5 @@ array( + return [ + 'preserve var' => [ 'sConfigFile' => __DIR__.'/ConfigTest/config-itop-var.php', 'sExpectedContains' => "'app_root_url' => 'http://' . (isset(\$_SERVER['SERVER_NAME']) ? \$_SERVER['SERVER_NAME'] : 'localhost') . '/itop/iTop/'", - 'aChanges' => array(), - ), - 'preserve joker' => array( + 'aChanges' => [], + ], + 'preserve joker' => [ 'sConfigFile' => __DIR__.'/ConfigTest/config-itop-joker.php', 'sExpectedContains' => "'app_root_url' => 'http://%server(SERVER_NAME)?:localhost%/itop/iTop/'", - 'aChanges' => array(), - ), + 'aChanges' => [], + ], - 'preserve set same value' => array( + 'preserve set same value' => [ 'sConfigFile' => __DIR__.'/ConfigTest/config-itop-var.php', 'sExpectedContains' => "'app_root_url' => 'http://' . (isset(\$_SERVER['SERVER_NAME']) ? \$_SERVER['SERVER_NAME'] : 'localhost') . '/itop/iTop/'", - 'aChanges' => array('app_root_url' => 'http://localhost/itop/iTop/'), - ), + 'aChanges' => ['app_root_url' => 'http://localhost/itop/iTop/'], + ], - 'overwrite var' => array( + 'overwrite var' => [ 'sConfigFile' => __DIR__.'/ConfigTest/config-itop-var.php', 'sExpectedContains' => "'app_root_url' => 'foo", - 'aChanges' => array('app_root_url' => 'foo'), - ), - 'overwrite joker' => array( + 'aChanges' => ['app_root_url' => 'foo'], + ], + 'overwrite joker' => [ 'sConfigFile' => __DIR__.'/ConfigTest/config-itop-joker.php', 'sExpectedContains' => "'app_root_url' => 'foo", - 'aChanges' => array('app_root_url' => 'foo'), - ), - ); + 'aChanges' => ['app_root_url' => 'foo'], + ], + ]; } } diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest/config-itop-joker.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest/config-itop-joker.php index 48b4a3c11..6097fb57e 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest/config-itop-joker.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest/config-itop-joker.php @@ -7,31 +7,27 @@ * * */ -$MySettings = array( - - +$MySettings = [ // app_root_url: Root URL used for navigating within the application, or from an email to the application (you can put $SERVER_NAME$ as a placeholder for the server's name) // default: '' 'app_root_url' => 'http://%server(SERVER_NAME)?:localhost%/itop/iTop/', - -); +]; /** * * Modules specific settings * */ -$MyModuleSettings = array( -); +$MyModuleSettings = [ +]; /** * * Data model modules to be loaded. Names are specified as relative paths * */ -$MyModules = array( - 'addons' => array('user rights' => 'addons/userrights/userrightsprofile.class.inc.php'), -); -?> \ No newline at end of file +$MyModules = [ + 'addons' => ['user rights' => 'addons/userrights/userrightsprofile.class.inc.php'], +]; diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest/config-itop-var.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest/config-itop-var.php index 59529239c..7efdd5a5e 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest/config-itop-var.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest/config-itop-var.php @@ -7,31 +7,27 @@ * * */ -$MySettings = array( - - +$MySettings = [ // app_root_url: Root URL used for navigating within the application, or from an email to the application (you can put $SERVER_NAME$ as a placeholder for the server's name) // default: '' - 'app_root_url' => 'http://' . (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost') . '/itop/iTop/', + 'app_root_url' => 'http://'.(isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost').'/itop/iTop/', - -); +]; /** * * Modules specific settings * */ -$MyModuleSettings = array( -); +$MyModuleSettings = [ +]; /** * * Data model modules to be loaded. Names are specified as relative paths * */ -$MyModules = array( - 'addons' => array('user rights' => 'addons/userrights/userrightsprofile.class.inc.php'), -); -?> \ No newline at end of file +$MyModules = [ + 'addons' => ['user rights' => 'addons/userrights/userrightsprofile.class.inc.php'], +]; diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/Validator/iTopConfigAstValidatorTest.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/Validator/iTopConfigAstValidatorTest.php index 1d14f1ccc..df1c4720a 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/Validator/iTopConfigAstValidatorTest.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/Validator/iTopConfigAstValidatorTest.php @@ -1,4 +1,5 @@ RequireOnceItopFile('env-production/itop-config/src/Validator/iTopConfigAstValidator.php'); } - /** * @dataProvider InvalidDataProvider * @param $sConf @@ -34,10 +33,9 @@ class iTopConfigAstValidatorTest extends ItopTestCase { $oiTopConfigValidator = new iTopConfigAstValidator(); $this->expectException(\Exception::class); - try{ + try { $oiTopConfigValidator->Validate($sConf); - }catch (\Exception $e) - { + } catch (\Exception $e) { $this->assertStringStartsWith('Invalid configuration:', $e->getMessage()); throw $e; } @@ -45,29 +43,28 @@ class iTopConfigAstValidatorTest extends ItopTestCase public function InvalidDataProvider() { - return array( - 'invalid PHP' => array( - 'sConf' => ' array( - 'sConf' => ' array( - 'sConf' => ' array( - 'sConf' => ' array( - 'sConf' => ' array( - 'sConf' => '' - ), - ); + return [ + 'invalid PHP' => [ + 'sConf' => ' [ + 'sConf' => ' [ + 'sConf' => ' [ + 'sConf' => ' [ + 'sConf' => ' [ + 'sConf' => '', + ], + ]; } - /** * @dataProvider ValidDataProvider * @doesNotPerformAssertions @@ -85,13 +82,13 @@ class iTopConfigAstValidatorTest extends ItopTestCase public function ValidDataProvider() { - return array( - 'simple code' => array( - 'sConf' => '' - ), - 'class constant' => array( - 'sConf' => ' [ + 'sConf' => '', + ], + 'class constant' => [ + 'sConf' => 'RequireOnceItopFile('env-production/itop-config/src/Validator/iTopConfigSyntaxValidator.php'); } - /** * @throws \Exception * @doesNotPerformAssertions @@ -40,7 +39,7 @@ class iTopConfigSyntaxValidatorTest extends ItopTestCase $oiTopConfigValidator = new iTopConfigSyntaxValidator(); $this->expectException(\Exception::class); - try{ + try { $oiTopConfigValidator->Validate(""); } catch (\Exception $e) { if (version_compare(phpversion(), '8.0.0', '<')) { diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-hub-connector/TokenValidationTest.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-hub-connector/TokenValidationTest.php index 7d16091dd..7e6ea7077 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-hub-connector/TokenValidationTest.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-hub-connector/TokenValidationTest.php @@ -1,4 +1,5 @@ RequireOnceItopFile('datamodels/2.x/itop-hub-connector/TokenValidation.php'); + /** + * @group itop-community + * @return void + */ + public function testLaunch() + { + $this->RequireOnceItopFile('datamodels/2.x/itop-hub-connector/TokenValidation.php'); - $oTokenValidation = new TokenValidation(); + $oTokenValidation = new TokenValidation(); - $sSetupToken = bin2hex(random_bytes(12)); - $this->assertFalse($oTokenValidation->isSetupTokenValid('lol')); - $this->assertFalse($oTokenValidation->isSetupTokenValid('')); - $this->assertFalse($oTokenValidation->isSetupTokenValid($sSetupToken)); - $this->createSetupTokenFile($sSetupToken); - $this->assertFalse($oTokenValidation->isSetupTokenValid('lol')); - $this->createSetupTokenFile($sSetupToken); - $this->assertFalse($oTokenValidation->isSetupTokenValid('')); - $this->createSetupTokenFile($sSetupToken); - $this->assertTrue($oTokenValidation->isSetupTokenValid($sSetupToken)); - } + $sSetupToken = bin2hex(random_bytes(12)); + $this->assertFalse($oTokenValidation->isSetupTokenValid('lol')); + $this->assertFalse($oTokenValidation->isSetupTokenValid('')); + $this->assertFalse($oTokenValidation->isSetupTokenValid($sSetupToken)); + $this->createSetupTokenFile($sSetupToken); + $this->assertFalse($oTokenValidation->isSetupTokenValid('lol')); + $this->createSetupTokenFile($sSetupToken); + $this->assertFalse($oTokenValidation->isSetupTokenValid('')); + $this->createSetupTokenFile($sSetupToken); + $this->assertTrue($oTokenValidation->isSetupTokenValid($sSetupToken)); + } } diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-portal-base/ApplicationHelperTest.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-portal-base/ApplicationHelperTest.php index e2f3f2d13..00abec429 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-portal-base/ApplicationHelperTest.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-portal-base/ApplicationHelperTest.php @@ -1,6 +1,7 @@ willReturn("Administrator"); $_SESSION = []; - $oUser = $this->CreateContactlessUser("$sAssociatedProfileName-" . uniqid(), self::$aURP_Profiles[$sAssociatedProfileName], self::PASSWORD); + $oUser = $this->CreateContactlessUser("$sAssociatedProfileName-".uniqid(), self::$aURP_Profiles[$sAssociatedProfileName], self::PASSWORD); \UserRights::Login($oUser->Get('login')); $this->InvokeNonPublicStaticMethod(ApplicationHelper::class, 'LoadBrickSecurity', [$oBrick]); @@ -85,11 +86,10 @@ class ApplicationHelperTest extends ItopDataTestCase ->willReturn("Administrator"); $_SESSION = []; - $oUser = $this->CreateContactlessUser("$sAssociatedProfileName-" . uniqid(), self::$aURP_Profiles[$sAssociatedProfileName], self::PASSWORD); + $oUser = $this->CreateContactlessUser("$sAssociatedProfileName-".uniqid(), self::$aURP_Profiles[$sAssociatedProfileName], self::PASSWORD); \UserRights::Login($oUser->Get('login')); $this->InvokeNonPublicStaticMethod(ApplicationHelper::class, 'LoadBrickSecurity', [$oBrick]); } - } diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-portal-base/RequestManipulatorTest.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-portal-base/RequestManipulatorTest.php index d63870e7c..d7b4e8fa2 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-portal-base/RequestManipulatorTest.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-portal-base/RequestManipulatorTest.php @@ -1,4 +1,5 @@ ReadParam('null_array_value', null, FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); + $oNullArrayValue = $oRequestManipulatorHelper->ReadParam('null_array_value', null, FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); $this->assertNull($oNullArrayValue); // II - default empty array value @@ -69,5 +69,4 @@ class RequestManipulatorTest extends ItopDataTestCase $this->assertEquals($aValue, $aReadValue); } - } diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-tickets/UpdateImpactedItemsTest.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-tickets/UpdateImpactedItemsTest.php index a764f3e46..371008761 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-tickets/UpdateImpactedItemsTest.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-tickets/UpdateImpactedItemsTest.php @@ -1,4 +1,5 @@ Person_1 EOF); $oTicket = $this->GivenTicketWithCIsOrPersons([ - 'Server_1' => 'manual' + 'Server_1' => 'manual', ]); $oTicket->UpdateImpactedItems(); // impact analysis @@ -71,7 +71,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase $this->assertCIsOrPersonsListEquals($oTicket, [ 'Server_1' => 'manual', 'Hypervisor_1' => 'computed', - 'Test Person_1' => 'computed' + 'Test Person_1' => 'computed', ]); } @@ -84,7 +84,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase Hypervisor_1 -> Server_1 EOF); $oTicket = $this->GivenTicketWithCIsOrPersons([ - 'Hypervisor_1' => 'manual' + 'Hypervisor_1' => 'manual', ]); $oTicket->UpdateImpactedItems(); // impact analysis @@ -104,7 +104,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase Farm_1 <-> Person_1 EOF); $oTicket = $this->GivenTicketWithCIsOrPersons([ - 'Server_1' => 'manual' + 'Server_1' => 'manual', ]); $oTicket->UpdateImpactedItems(); // impact analysis @@ -113,7 +113,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase 'Server_1' => 'manual', 'Hypervisor_1' => 'computed', 'Farm_1' => 'computed', - 'Test Person_1' => 'computed' + 'Test Person_1' => 'computed', ]); } @@ -127,7 +127,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase EOF); $this->GivenCINotAllowedToCurrentUser('Hypervisor_1'); $oTicket = $this->GivenTicketWithCIsOrPersons([ - 'Server_1' => 'manual' + 'Server_1' => 'manual', ]); MetaModel::GetConfig()->Set('relations.complete_analysis', false); @@ -149,7 +149,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase EOF); $this->GivenCINotAllowedToCurrentUser('Hypervisor_1'); $oTicket = $this->GivenTicketWithCIsOrPersons([ - 'Server_1' => 'manual' + 'Server_1' => 'manual', ]); MetaModel::GetConfig()->Set('relations.complete_analysis', true); @@ -210,7 +210,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase 'Hypervisor_1' => 'manual', 'Hypervisor_2' => 'manual', 'Farm_1' => 'computed', - 'Test Person_1' => 'computed' + 'Test Person_1' => 'computed', ]); } public function testPreviouslyComputedNodesShouldBeIgnored() @@ -228,7 +228,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase $oTicket = $this->GivenTicketWithCIsOrPersons([ 'Server_1' => 'manual', 'Server_2' => 'computed', - 'Person_2' => 'computed' + 'Person_2' => 'computed', ]); $oTicket->UpdateImpactedItems(); // impact analysis @@ -236,7 +236,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase $this->assertCIsOrPersonsListEquals($oTicket, [ 'Server_1' => 'manual', 'Hypervisor_1' => 'computed', - 'Test Person_1' => 'computed' + 'Test Person_1' => 'computed', ]); } @@ -251,7 +251,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase EOF); $oTicket = $this->GivenTicketWithCIsOrPersons([ 'Hypervisor_1' => 'computed', - 'Person_1' => 'computed' + 'Person_1' => 'computed', ]); $oTicket->UpdateImpactedItems(); // impact analysis @@ -259,7 +259,6 @@ class UpdateImpactedItemsTest extends ItopDataTestCase $this->assertCIsOrPersonsListEquals($oTicket, []); } - public function testNoImpactWhenNoCI() { $oTicket = $this->GivenTicketWithCIsOrPersons([]); @@ -281,13 +280,13 @@ class UpdateImpactedItemsTest extends ItopDataTestCase Hypervisor_2 -> Farm_1 DOT); $oTicket = $this->GivenTicketWithCIsOrPersons([ - 'Hypervisor_1' => 'manual' + 'Hypervisor_1' => 'manual', ]); $oTicket->UpdateImpactedItems(); // impact analysis $this->assertCIsOrPersonsListEquals($oTicket, [ - 'Hypervisor_1' => 'manual' + 'Hypervisor_1' => 'manual', ]); } @@ -304,7 +303,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase DOT); $oTicket = $this->GivenTicketWithCIsOrPersons([ 'Hypervisor_1' => 'manual', - 'Hypervisor_2' => 'manual' + 'Hypervisor_2' => 'manual', ]); $oTicket->UpdateImpactedItems(); // impact analysis @@ -312,7 +311,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase $this->assertCIsOrPersonsListEquals($oTicket, [ 'Hypervisor_1' => 'manual', 'Hypervisor_2' => 'manual', - 'Farm_1' => 'computed' + 'Farm_1' => 'computed', ]); } @@ -329,7 +328,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase $oTicket = $this->GivenTicketWithCIsOrPersons([ 'Server_1' => 'manual', 'Hypervisor_1' => 'not_impacted', - 'Person_1' => 'do_not_notify' + 'Person_1' => 'do_not_notify', ]); $oTicket->UpdateImpactedItems(); // impact analysis @@ -337,7 +336,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase $this->assertCIsOrPersonsListEquals($oTicket, [ 'Server_1' => 'manual', 'Hypervisor_1' => 'not_impacted', - 'Test Person_1' => 'do_not_notify' + 'Test Person_1' => 'do_not_notify', ]); } @@ -351,14 +350,14 @@ class UpdateImpactedItemsTest extends ItopDataTestCase DOT); $oTicket = $this->GivenTicketWithCIsOrPersons([ 'Hypervisor_1' => 'not_impacted', - 'Person_1' => 'do_not_notify' + 'Person_1' => 'do_not_notify', ]); $oTicket->UpdateImpactedItems(); // impact analysis $this->assertCIsOrPersonsListEquals($oTicket, [ 'Hypervisor_1' => 'not_impacted', - 'Test Person_1' => 'do_not_notify' + 'Test Person_1' => 'do_not_notify', ]); } @@ -415,7 +414,6 @@ class UpdateImpactedItemsTest extends ItopDataTestCase $this->assertEquals($aExpected, $aActual, 'Unexpected value for functionalcis_list'); } - /** * @param int|string|null $sTicketId * @@ -489,7 +487,7 @@ class UpdateImpactedItemsTest extends ItopDataTestCase return $this->aCIs[$sDescriptor]; } - private function GivenTicketWithCIsOrPersons(array $aLinkedObjects) : \UserRequest + private function GivenTicketWithCIsOrPersons(array $aLinkedObjects): \UserRequest { $oTicket = $this->GivenTicketObject(1); foreach ($aLinkedObjects as $sObjectDescriptor => $sRole) { diff --git a/tests/php-unit-tests/unitary-tests/setup/DBBackupDataTest.php b/tests/php-unit-tests/unitary-tests/setup/DBBackupDataTest.php index 4d1f6342f..03e947f6d 100644 --- a/tests/php-unit-tests/unitary-tests/setup/DBBackupDataTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/DBBackupDataTest.php @@ -18,11 +18,9 @@ class DBBackupDataTest extends ItopDataTestCase $sTmpDir = sys_get_temp_dir().'/testPrepareFilesToBackup-'.time(); $oBackup = new DBBackup(MetaModel::GetConfig()); MetaModel::GetConfig()->SetModuleSetting('itop-backup', 'extra_files', array_keys($aExtraFiles)); - - foreach($aExtraFiles as $sExtraFile => $bExists) - { - if ($bExists) - { + + foreach ($aExtraFiles as $sExtraFile => $bExists) { + if ($bExists) { @mkdir(dirname(APPROOT.'/'.$sExtraFile), 0755, true); file_put_contents(APPROOT.'/'.$sExtraFile, 'Hello World!'); } @@ -32,29 +30,29 @@ class DBBackupDataTest extends ItopDataTestCase if ($bUnsafeFileException) { $this->expectExceptionMessage("Backup: Aborting, resource '$sExtraFile'. Considered as UNSAFE because not inside the iTop directory."); } - $aFiles = $this->InvokeNonPublicMethod('DBBackup', 'PrepareFilesToBackup', $oBackup, [APPROOT . '/conf/'.$this->GetTestEnvironment().'/config-itop.php', $sTmpDir, true]); + $aFiles = $this->InvokeNonPublicMethod('DBBackup', 'PrepareFilesToBackup', $oBackup, [APPROOT.'/conf/'.$this->GetTestEnvironment().'/config-itop.php', $sTmpDir, true]); SetupUtils::rrmdir($sTmpDir); $aExpectedFiles = [ - $sTmpDir . '/config-itop.php', + $sTmpDir.'/config-itop.php', ]; if (file_exists(APPROOT.'/data/'.$this->GetTestEnvironment().'.delta.xml')) { - $aExpectedFiles[] = $sTmpDir . '/' . 'delta.xml'; + $aExpectedFiles[] = $sTmpDir.'/'.'delta.xml'; } if (file_exists(APPROOT.'/data/'.$this->GetTestEnvironment().'-modules')) { - $aExpectedFiles[] = $sTmpDir . '/' . $this->GetTestEnvironment() . '-modules'; + $aExpectedFiles[] = $sTmpDir.'/'.$this->GetTestEnvironment().'-modules'; } foreach ($aExtraFiles as $sRelFile => $bExists) { if ($bExists) { - $aExpectedFiles[] = $sTmpDir . '/' . $sRelFile; + $aExpectedFiles[] = $sTmpDir.'/'.$sRelFile; } } } finally { // Cleanup foreach ($aExtraFiles as $sExtraFile => $bExists) { if ($bExists) { - unlink(APPROOT . '/' . $sExtraFile); - $folderPath = dirname(APPROOT . '/' . $sExtraFile); - if (is_dir($folderPath) && count(glob($folderPath . '/*')) === 0) { + unlink(APPROOT.'/'.$sExtraFile); + $folderPath = dirname(APPROOT.'/'.$sExtraFile); + if (is_dir($folderPath) && count(glob($folderPath.'/*')) === 0) { rmdir($folderPath); } } @@ -65,8 +63,8 @@ class DBBackupDataTest extends ItopDataTestCase sort($aExpectedFiles); $this->assertEquals($aExpectedFiles, $aFiles); } - - function prepareFilesToBackupProvider() + + public function prepareFilesToBackupProvider() { return [ 'no_extra_file' => ['aExtraFiles' => [], false], @@ -80,43 +78,39 @@ class DBBackupDataTest extends ItopDataTestCase /** * @dataProvider restoreListExtraFilesProvider */ - function testRestoreListExtraFiles($aFilesToCreate, $aExpectedRelativeExtraFiles) + public function testRestoreListExtraFiles($aFilesToCreate, $aExpectedRelativeExtraFiles) { require_once(APPROOT.'/env-production/itop-backup/dbrestore.class.inc.php'); $sTmpDir = sys_get_temp_dir().'/testRestoreListExtraFiles-'.time(); - - foreach($aFilesToCreate as $sRelativeName) - { + + foreach ($aFilesToCreate as $sRelativeName) { $sDir = $sTmpDir.'/'.dirname($sRelativeName); - if(!is_dir($sDir)) - { + if (!is_dir($sDir)) { mkdir($sDir, 0755, true); } file_put_contents($sTmpDir.'/'.$sRelativeName, 'Hello world.'); } $aExpectedExtraFiles = []; - foreach($aExpectedRelativeExtraFiles as $sRelativeName) - { + foreach ($aExpectedRelativeExtraFiles as $sRelativeName) { if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $sRelativeName = str_replace('/', '\\', $sRelativeName); $aExpectedExtraFiles[$sTmpDir.'\\'.$sRelativeName] = APPROOT.'\\'.$sRelativeName; - } - else { + } else { $aExpectedExtraFiles[$sTmpDir.'/'.$sRelativeName] = APPROOT.'/'.$sRelativeName; } } $oRestore = new DBRestore(MetaModel::GetConfig()); $aExtraFiles = $this->InvokeNonPublicMethod('DBRestore', 'ListExtraFiles', $oRestore, [$sTmpDir]); - + asort($aExtraFiles); asort($aExpectedExtraFiles); $this->assertEquals($aExpectedExtraFiles, $aExtraFiles); SetupUtils::rrmdir($sTmpDir); } - function restoreListExtraFilesProvider() + public function restoreListExtraFilesProvider() { return [ 'no extra file' => ['aFilesToCreate' => ['config-itop.php', 'itop-dump.sql', 'delta.xml'], 'aExpectedExtraFiles' => []], @@ -124,5 +118,5 @@ class DBBackupDataTest extends ItopDataTestCase 'one extra file' => ['aFilesToCreate' => ['config-itop.php', 'itop-dump.sql', 'delta.xml', 'production-modules/test/module.test.php', 'collectors/ldap/conf/params.local.xml'], 'aExpectedExtraFiles' => ['collectors/ldap/conf/params.local.xml']], ]; } - + } diff --git a/tests/php-unit-tests/unitary-tests/setup/DBBackupTest.php b/tests/php-unit-tests/unitary-tests/setup/DBBackupTest.php index 39569086b..37a582df1 100644 --- a/tests/php-unit-tests/unitary-tests/setup/DBBackupTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/DBBackupTest.php @@ -62,12 +62,9 @@ class DBBackupTest extends ItopTestCase $sCliArgsMinCfg = DBBackup::GetMysqlCliTlsOptions($oConfigToTest); // depending on the MySQL vendor, we would have `--ssl` or `--ssl-mode=REQUIRED` - if (CMDBSource::IsSslModeDBVersion()) - { + if (CMDBSource::IsSslModeDBVersion()) { $this->assertStringStartsWith(' --ssl-mode=REQUIRED', $sCliArgsMinCfg); - } - else - { + } else { $this->assertStringStartsWith(' --ssl', $sCliArgsMinCfg); $this->assertStringNotContainsString('--ssl-mode', $sCliArgsMinCfg); } @@ -90,12 +87,9 @@ class DBBackupTest extends ItopTestCase $sCliArgsCapathCfg = DBBackup::GetMysqlCliTlsOptions($oConfigToTest); // depending on the MySQL vendor, we would have `--ssl` or `--ssl-mode=VERIFY_CA` - if (CMDBSource::IsSslModeDBVersion()) - { + if (CMDBSource::IsSslModeDBVersion()) { $this->assertStringStartsWith(' --ssl-mode=VERIFY_CA', $sCliArgsCapathCfg); - } - else - { + } else { $this->assertStringStartsWith(' --ssl', $sCliArgsCapathCfg); $this->assertStringNotContainsString('--ssl-mode', $sCliArgsCapathCfg); @@ -113,11 +107,11 @@ class DBBackupTest extends ItopTestCase $sExpectedPortCliOption = ''; } else { $sEscapedPortValue = \DBBackup::EscapeShellArg($iExpectedPortValue); - $sExpectedPortCliOption = ' --port=' . $sEscapedPortValue; + $sExpectedPortCliOption = ' --port='.$sEscapedPortValue; } $sActualCliOptions = $this->InvokeNonPublicStaticMethod(DBBackup::class, 'GetMysqlCliPortAndTransportOptions', [$sDbHost, $iPort]); - $this->assertEquals($sExpectedPortCliOption . $sExpectedProtocolCliOption, $sActualCliOptions); + $this->assertEquals($sExpectedPortCliOption.$sExpectedProtocolCliOption, $sActualCliOptions); } public function GetMysqlCliPortAndTransportOptionsProvider() diff --git a/tests/php-unit-tests/unitary-tests/setup/MFCompilerTest.php b/tests/php-unit-tests/unitary-tests/setup/MFCompilerTest.php index 7e8308c83..0ac861b5a 100644 --- a/tests/php-unit-tests/unitary-tests/setup/MFCompilerTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/MFCompilerTest.php @@ -11,10 +11,11 @@ use utils; /** * @covers \MFCompiler::UseLatestPrecompiledFile */ -class MFCompilerTest extends ItopTestCase { +class MFCompilerTest extends ItopTestCase +{ /** @var array */ private static $aFoldersToCleanup; - + /** @var array */ private static $aRessources; @@ -23,7 +24,8 @@ class MFCompilerTest extends ItopTestCase { private $sTmpDir; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $this->RequireOnceItopFile('setup/compiler.class.inc.php'); $this->RequireOnceItopFile('setup/modelfactory.class.inc.php'); @@ -33,26 +35,34 @@ class MFCompilerTest extends ItopTestCase { $this->oMFCompiler = new SubMFCompiler($this->createMock(\ModelFactory::class), ''); } - public function tearDown(): void { + public function tearDown(): void + { parent::tearDown(); $this->RecurseRmdir($this->sTmpDir); } - public static function Init(){ - if (!is_null(self::$aFoldersToCleanup)){ + public static function Init() + { + if (!is_null(self::$aFoldersToCleanup)) { return; } clearstatcache(); $sPrefix = 'scsstest_'; - $sAppRootForProvider = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . DIRECTORY_SEPARATOR; - $sTempTargetDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'UseLatestPrecompiledFileProvider'; - $sExtensionTargetDir = $sAppRootForProvider . 'extensions/UseLatestPrecompiledFileProvider'; - $sSourceDir = $sAppRootForProvider . 'datamodels' . DIRECTORY_SEPARATOR . '2.x'; - $sDatamodel2xTargetDir = $sSourceDir . DIRECTORY_SEPARATOR . '/UseLatestPrecompiledFileProvider'; + $sAppRootForProvider = dirname(dirname(dirname(dirname(dirname(__FILE__))))).DIRECTORY_SEPARATOR; + $sTempTargetDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.'UseLatestPrecompiledFileProvider'; + $sExtensionTargetDir = $sAppRootForProvider.'extensions/UseLatestPrecompiledFileProvider'; + $sSourceDir = $sAppRootForProvider.'datamodels'.DIRECTORY_SEPARATOR.'2.x'; + $sDatamodel2xTargetDir = $sSourceDir.DIRECTORY_SEPARATOR.'/UseLatestPrecompiledFileProvider'; - if (!is_dir($sTempTargetDir)) mkdir($sTempTargetDir); - if (!is_dir($sExtensionTargetDir)) @mkdir($sExtensionTargetDir); - if (!is_dir($sDatamodel2xTargetDir)) @mkdir($sDatamodel2xTargetDir); + if (!is_dir($sTempTargetDir)) { + mkdir($sTempTargetDir); + } + if (!is_dir($sExtensionTargetDir)) { + @mkdir($sExtensionTargetDir); + } + if (!is_dir($sDatamodel2xTargetDir)) { + @mkdir($sDatamodel2xTargetDir); + } self::$aFoldersToCleanup = [ $sTempTargetDir, $sExtensionTargetDir, $sDatamodel2xTargetDir ]; @@ -60,27 +70,27 @@ class MFCompilerTest extends ItopTestCase { $iTimeStart = time() - 100; self::$aRessources['sPostCompilation1'] = tempnam($sTempTargetDir, $sPrefix); - touch(self::$aRessources['sPostCompilation1'], $iTimeStart+=2); + touch(self::$aRessources['sPostCompilation1'], $iTimeStart += 2); //datamodel XML file in extension folder self::$aRessources['sPrecompiledInExtensionFile1'] = tempnam($sExtensionTargetDir, $sPrefix); - touch(self::$aRessources['sPrecompiledInExtensionFile1'], $iTimeStart+=2); - self::$aRessources['sPrecompiledInExtensionFileUri1'] = "UseLatestPrecompiledFileProvider" . DIRECTORY_SEPARATOR . basename(self::$aRessources['sPrecompiledInExtensionFile1']); + touch(self::$aRessources['sPrecompiledInExtensionFile1'], $iTimeStart += 2); + self::$aRessources['sPrecompiledInExtensionFileUri1'] = "UseLatestPrecompiledFileProvider".DIRECTORY_SEPARATOR.basename(self::$aRessources['sPrecompiledInExtensionFile1']); //datamodel XML file in source dir /datamodels/2.x folder self::$aRessources['sPrecompiledInDataModelXXFile1'] = tempnam($sDatamodel2xTargetDir, $sPrefix); - touch(self::$aRessources['sPrecompiledInDataModelXXFile1'], $iTimeStart+=2); - self::$aRessources['sPrecompiledInDataModelXXFileUri1'] = "UseLatestPrecompiledFileProvider" . DIRECTORY_SEPARATOR . basename(self::$aRessources['sPrecompiledInDataModelXXFile1']); + touch(self::$aRessources['sPrecompiledInDataModelXXFile1'], $iTimeStart += 2); + self::$aRessources['sPrecompiledInDataModelXXFileUri1'] = "UseLatestPrecompiledFileProvider".DIRECTORY_SEPARATOR.basename(self::$aRessources['sPrecompiledInDataModelXXFile1']); //generate ressources from a previous setup: called postcompiled self::$aRessources['sPostCompilation2'] = tempnam($sTempTargetDir, $sPrefix); - touch(self::$aRessources['sPostCompilation2'], $iTimeStart+=2); + touch(self::$aRessources['sPostCompilation2'], $iTimeStart += 2); //simulate copy of /data/models.2.x or extensions ressources during setup in a temp directory - self::$aRessources['sCopiedExtensionFile1'] = $sTempTargetDir . DIRECTORY_SEPARATOR . basename(self::$aRessources['sPrecompiledInExtensionFile1']); + self::$aRessources['sCopiedExtensionFile1'] = $sTempTargetDir.DIRECTORY_SEPARATOR.basename(self::$aRessources['sPrecompiledInExtensionFile1']); copy(self::$aRessources['sPrecompiledInExtensionFile1'], self::$aRessources['sCopiedExtensionFile1']); - self::$aRessources['sCopiedDataModelXXFile1'] = $sTempTargetDir . DIRECTORY_SEPARATOR . basename(self::$aRessources['sPrecompiledInDataModelXXFile1']); + self::$aRessources['sCopiedDataModelXXFile1'] = $sTempTargetDir.DIRECTORY_SEPARATOR.basename(self::$aRessources['sPrecompiledInDataModelXXFile1']); copy(self::$aRessources['sPrecompiledInDataModelXXFile1'], self::$aRessources['sCopiedDataModelXXFile1']); self::$aRessources['sMissingFile'] = tempnam($sTempTargetDir, $sPrefix); @@ -95,13 +105,13 @@ class MFCompilerTest extends ItopTestCase { public static function tearDownAfterClass(): void { - if (is_null(self::$aFoldersToCleanup)){ + if (is_null(self::$aFoldersToCleanup)) { return; } - - foreach (self::$aFoldersToCleanup as $sFolder){ - if (is_dir($sFolder)){ - foreach (glob("$sFolder/**") as $sFile){ + + foreach (self::$aFoldersToCleanup as $sFolder) { + if (is_dir($sFolder)) { + foreach (glob("$sFolder/**") as $sFile) { unlink($sFile); } rmdir($sFolder); @@ -118,40 +128,44 @@ class MFCompilerTest extends ItopTestCase { * @param string $sThemeDir * @param ?string $sExpectedReturn */ - public function testUseLatestPrecompiledFile(string $sTempTargetDir, string $sPrecompiledFileUri, string $sPostCompilationLatestPrecompiledFile, string $sThemeDir, ?string $sExpectedReturn, bool $bDisableThemePrecompilationViaConf = false){ + public function testUseLatestPrecompiledFile(string $sTempTargetDir, string $sPrecompiledFileUri, string $sPostCompilationLatestPrecompiledFile, string $sThemeDir, ?string $sExpectedReturn, bool $bDisableThemePrecompilationViaConf = false) + { // Enable or disable precompilation depending on the test case utils::GetConfig()->Set('theme.enable_precompilation', !$bDisableThemePrecompilationViaConf); $sRes = $this->oMFCompiler->UseLatestPrecompiledFile($sTempTargetDir, $sPrecompiledFileUri, $sPostCompilationLatestPrecompiledFile, $sThemeDir); $this->assertEquals($sExpectedReturn, $sRes); } - public function UseLatestPrecompiledFileProvider(){ + public function UseLatestPrecompiledFileProvider() + { self::init(); return [ 'no precompiled file at all' => $this->BuildProviderUseCaseArray('', self::$aRessources['sMissingFile'], null), 'deactivate precompilation via conf' => $this->BuildProviderUseCaseArray('', self::$aRessources['sPostCompilation1'], null, true), 'no precompiled file configured in precompiled_stylesheet XM section' => $this->BuildProviderUseCaseArray('', self::$aRessources['sPostCompilation1'], self::$aRessources['sPostCompilation1']), - 'missing precompiled file in precompiled_stylesheet section' => $this->BuildProviderUseCaseArray(self::$aRessources['sMissingFile'], self::$aRessources['sPostCompilation1'], self::$aRessources['sPostCompilation1'] ), - 'no precompiled file generated in previous setup in /data/precompiled_styles' => $this->BuildProviderUseCaseArray(self::$aRessources['sPrecompiledInExtensionFileUri1'], self::$aRessources['sMissingFile'], self::$aRessources['sCopiedExtensionFile1'] ), - '(extensions) XML precompiled_stylesheet file older than last post setup generated file in /data/precompiled_styles' => $this->BuildProviderUseCaseArray(self::$aRessources['sPrecompiledInExtensionFileUri1'], self::$aRessources['sPostCompilation2'], self::$aRessources['sPostCompilation2'] ), - 'last post setup generated file in /data/precompiled_styles older than (extensions) XML precompiled_stylesheet file' => $this->BuildProviderUseCaseArray(self::$aRessources['sPrecompiledInExtensionFileUri1'], self::$aRessources['sPostCompilation1'], self::$aRessources['sCopiedExtensionFile1'] ), - '(datamodels/N.x) XML precompiled_stylesheet file older than last post setup generated file in /data/precompiled_styles' => $this->BuildProviderUseCaseArray(self::$aRessources['sPrecompiledInDataModelXXFileUri1'], self::$aRessources['sPostCompilation2'], self::$aRessources['sPostCompilation2'] ), - '(datamodels/N.x) last post setup generated file in /data/precompiled_styles older than (extensions) XML precompiled_stylesheet file' => $this->BuildProviderUseCaseArray(self::$aRessources['sPrecompiledInDataModelXXFileUri1'], self::$aRessources['sPostCompilation1'], self::$aRessources['sCopiedDataModelXXFile1'] ), + 'missing precompiled file in precompiled_stylesheet section' => $this->BuildProviderUseCaseArray(self::$aRessources['sMissingFile'], self::$aRessources['sPostCompilation1'], self::$aRessources['sPostCompilation1']), + 'no precompiled file generated in previous setup in /data/precompiled_styles' => $this->BuildProviderUseCaseArray(self::$aRessources['sPrecompiledInExtensionFileUri1'], self::$aRessources['sMissingFile'], self::$aRessources['sCopiedExtensionFile1']), + '(extensions) XML precompiled_stylesheet file older than last post setup generated file in /data/precompiled_styles' => $this->BuildProviderUseCaseArray(self::$aRessources['sPrecompiledInExtensionFileUri1'], self::$aRessources['sPostCompilation2'], self::$aRessources['sPostCompilation2']), + 'last post setup generated file in /data/precompiled_styles older than (extensions) XML precompiled_stylesheet file' => $this->BuildProviderUseCaseArray(self::$aRessources['sPrecompiledInExtensionFileUri1'], self::$aRessources['sPostCompilation1'], self::$aRessources['sCopiedExtensionFile1']), + '(datamodels/N.x) XML precompiled_stylesheet file older than last post setup generated file in /data/precompiled_styles' => $this->BuildProviderUseCaseArray(self::$aRessources['sPrecompiledInDataModelXXFileUri1'], self::$aRessources['sPostCompilation2'], self::$aRessources['sPostCompilation2']), + '(datamodels/N.x) last post setup generated file in /data/precompiled_styles older than (extensions) XML precompiled_stylesheet file' => $this->BuildProviderUseCaseArray(self::$aRessources['sPrecompiledInDataModelXXFileUri1'], self::$aRessources['sPostCompilation1'], self::$aRessources['sCopiedDataModelXXFile1']), ]; } - private function BuildProviderUseCaseArray(string $sPrecompiledFileUri, string $sPostCompilationLatestPrecompiledFile, $sExpectedReturn, $bDisableThemePrecompilationViaConf = false) : array{ + private function BuildProviderUseCaseArray(string $sPrecompiledFileUri, string $sPostCompilationLatestPrecompiledFile, $sExpectedReturn, $bDisableThemePrecompilationViaConf = false): array + { return [ "sTempTargetDir" => sys_get_temp_dir(), "sPrecompiledFileUri" => $sPrecompiledFileUri, "sPostCompilationLatestPrecompiledFile" => $sPostCompilationLatestPrecompiledFile, "sThemeDir" => "test", "sExpectedReturn" => $sExpectedReturn, - "bDisableThemePrecompilationViaConf" => $bDisableThemePrecompilationViaConf + "bDisableThemePrecompilationViaConf" => $bDisableThemePrecompilationViaConf, ]; } - public function testCompileThemes(){ + public function testCompileThemes() + { $sFullmoonThemeCompiledFolder = $this->sTmpDir.DIRECTORY_SEPARATOR.'branding'.DIRECTORY_SEPARATOR.'themes'.DIRECTORY_SEPARATOR.'fullmoon'.DIRECTORY_SEPARATOR; $sXmlDataCustoFilePath = realpath(__DIR__.'/ressources/datamodels/datamodel-branding.xml'); @@ -164,12 +178,11 @@ class MFCompilerTest extends ItopTestCase { $this->RecurseMkdir($sFullmoonThemeCompiledFolder); file_put_contents($sFullmoonThemeCompiledFolder.'main.css', ""); - $aImportsPaths = array( + $aImportsPaths = [ APPROOT.'css/', APPROOT.'css/backoffice/main.scss', $this->sTmpDir.'//', - ); - + ]; $aThemeParameters = [ 'variables' => [ @@ -189,8 +202,7 @@ class MFCompilerTest extends ItopTestCase { $oThemeHandlerService = $this->createMock(\ThemeHandlerService::class); $oThemeHandlerService->expects($this->exactly(1)) ->method("CompileTheme") - ->with("fullmoon", true, $this->oMFCompiler->GetCompilationTimeStamp(), $aThemeParameters, $aImportsPaths, $this->sTmpDir . '/'); - + ->with("fullmoon", true, $this->oMFCompiler->GetCompilationTimeStamp(), $aThemeParameters, $aImportsPaths, $this->sTmpDir.'/'); //CompileTheme($sThemeId, $bSetup = false, $sSetupCompilationTimestamp="", $aThemeParameters = null, $aImportsPaths = null, $sWorkingPath = null) MFCompiler::SetThemeHandlerService($oThemeHandlerService); diff --git a/tests/php-unit-tests/unitary-tests/setup/ModelFactoryTest.php b/tests/php-unit-tests/unitary-tests/setup/ModelFactoryTest.php index 8c6fe23a4..3905a27dc 100644 --- a/tests/php-unit-tests/unitary-tests/setup/ModelFactoryTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/ModelFactoryTest.php @@ -10,7 +10,6 @@ use MFElement; use ModelFactory; use PHPUnit\Framework\ExpectationFailedException; - /** * Class ModelFactoryTest * @@ -678,8 +677,7 @@ class ModelFactoryTest extends ItopTestCase $oDeltaRoot = $oDocument->firstChild; try { $oFactory->LoadDelta($oDeltaRoot, $oFactoryDocument); - } - catch (\Exception $e) { + } catch (\Exception $e) { $this->assertNull($sExpectedXML, 'LoadDelta() should not have failed with exception: '.$e->getMessage()); $this->assertEquals($sExpectedXMLOrErrorMessage, $e->getMessage()); return; @@ -2202,7 +2200,9 @@ XML */ public function AlterationAPIsProvider() { - define('CASE_NO_FLAG', << @@ -2210,7 +2210,9 @@ XML XML ); - define('CASE_ABOVE_A_FLAG', << @@ -2220,7 +2222,9 @@ XML XML ); - define('CASE_IN_A_DEFINITION', << @@ -2230,7 +2234,9 @@ XML XML ); - define('CASE_FLAG_ON_TARGET_define', << @@ -2238,7 +2244,9 @@ XML XML ); - define('CASE_FLAG_ON_TARGET_redefine', << @@ -2246,7 +2254,9 @@ XML XML ); - define('CASE_FLAG_ON_TARGET_needed', << @@ -2254,7 +2264,9 @@ XML XML ); - define('CASE_FLAG_ON_TARGET_forced', << @@ -2262,7 +2274,9 @@ XML XML ); - define('CASE_FLAG_ON_TARGET_removed', << @@ -2270,7 +2284,9 @@ XML XML ); - define('CASE_FLAG_ON_TARGET_old_id', << @@ -2278,7 +2294,9 @@ XML XML ); - define('CASE_MISSING_TARGET', << @@ -3066,7 +3084,7 @@ XML $oNode->setAttribute('id', $sClassName); $oNode->setAttribute('_created_in', $sModuleName); $oDoc = $oNode->ownerDocument; - foreach (array('properties', 'fields', 'methods', 'presentation') as $sElementName) { + foreach (['properties', 'fields', 'methods', 'presentation'] as $sElementName) { $oElement = $oDoc->createElement($sElementName); $oNode->appendChild($oElement); } @@ -3181,7 +3199,6 @@ XML $this->assertCount(0, $aDiff); } - /** * @test * @dataProvider AddClassProvider @@ -3423,11 +3440,9 @@ XML $oFactory->LoadDelta($oDeltaRoot, $oFactoryDocument, ModelFactory::LOAD_DELTA_MODE_LAX); $this->assertNotNull($sExpectedXML, "LoadDelta(lax) should have failed with exception: $sExpectedXMLInLaxMode"); $this->AssertEqualModels($sExpectedXML, $oFactory, 'LoadDelta(lax) did not produce the expected result'); - } - catch (ExpectationFailedException $e) { + } catch (ExpectationFailedException $e) { throw $e; - } - catch (\Exception $e) { + } catch (\Exception $e) { $this->assertNull($sExpectedXML, 'LoadDelta(lax) should not have failed with exception: '.$e->getMessage()); $this->assertEquals($sExpectedXMLInLaxMode, $e->getMessage()); } @@ -3448,11 +3463,9 @@ XML $oFactory->LoadDelta($oDeltaRoot, $oFactoryDocument, ModelFactory::LOAD_DELTA_MODE_STRICT); $this->assertNotNull($sExpectedXML, "LoadDelta(lax) should have failed with exception: $sExpectedXMLInStrictMode"); $this->AssertEqualModels($sExpectedXML, $oFactory, 'LoadDelta(strict) did not produce the expected result'); - } - catch (ExpectationFailedException $e) { + } catch (ExpectationFailedException $e) { throw $e; - } - catch (\Exception $e) { + } catch (\Exception $e) { $this->assertNull($sExpectedXML, 'LoadDelta(strict) should not have failed with exception: '.$e->getMessage()); $this->assertEquals($sExpectedXMLInStrictMode, $e->getMessage()); } @@ -3672,10 +3685,12 @@ XML ]; } - public function testDictEntryIsIntegratedIntoMF() { + public function testDictEntryIsIntegratedIntoMF() + { $oFactory = new ModelFactory([]); $sLanguageCode = 'RU URSS'; - $oFactory->IntegrateDictEntriesIntoXML($sLanguageCode, + $oFactory->IntegrateDictEntriesIntoXML( + $sLanguageCode, [ 'english_description' => 'Russian', 'localized_description' => 'URSS', @@ -3686,7 +3701,8 @@ XML ); $this->assertDictEntryUniqueAndEquals($oFactory, $sLanguageCode, 'key1', 'Label 1', 'New entry in new language should be present in XML'); - $oFactory->IntegrateDictEntriesIntoXML($sLanguageCode, + $oFactory->IntegrateDictEntriesIntoXML( + $sLanguageCode, [ 'english_description' => 'Russian', 'localized_description' => 'URSS', diff --git a/tests/php-unit-tests/unitary-tests/setup/ModuleInstallerAPITest.php b/tests/php-unit-tests/unitary-tests/setup/ModuleInstallerAPITest.php index f243c0aaa..f55b6ea32 100644 --- a/tests/php-unit-tests/unitary-tests/setup/ModuleInstallerAPITest.php +++ b/tests/php-unit-tests/unitary-tests/setup/ModuleInstallerAPITest.php @@ -7,7 +7,6 @@ use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use MetaModel; use ModuleInstallerAPI; - /** * Class ModuleInstallerAPITest * @@ -38,7 +37,6 @@ class ModuleInstallerAPITest extends ItopDataTestCase parent::tearDown(); } - /** * @param string $sTable * @param string $sAttCode @@ -52,7 +50,7 @@ class ModuleInstallerAPITest extends ItopDataTestCase $oOrigAttDef = MetaModel::GetAttributeDef($sTable, $sAttCode); $sOrigColName = array_key_first($oOrigAttDef->GetSQLColumns()); - return array($sOrigTable, $sOrigColName); + return [$sOrigTable, $sOrigColName]; } /** @@ -68,8 +66,8 @@ class ModuleInstallerAPITest extends ItopDataTestCase { // Create a table with the same structure as the original table(s) // - Create a SQL query to get all the ids from the original tables - if(is_array($aOrigTables)) { - $sOrigDataQuery = implode(" UNION ", array_map(fn($sTable) => "SELECT id FROM `{$sTable}`", $aOrigTables)); + if (is_array($aOrigTables)) { + $sOrigDataQuery = implode(" UNION ", array_map(fn ($sTable) => "SELECT id FROM `{$sTable}`", $aOrigTables)); } CMDBSource::Query( @@ -179,18 +177,18 @@ SQL // Create 2 objects, so we know the ids for one of each class $oPerson = $this->createObject('Person', ['first_name' => 'John', 'name' => 'Doe', 'org_id' => 1]); $oTeam = $this->createObject('Team', ['name' => 'La tcheam', 'org_id' => 1]); - + // Info from the original tables (we don't need real data, just the ids) $sOrigClass = "Person"; [$sOrigTable, $sOrigColName] = $this->GetInfoFromTable($sOrigClass, "first_name"); - + $sOrigClass2 = "Team"; [$sOrigTable2, $sOrigColName2] = $this->GetInfoFromTable($sOrigClass2, "friendlyname"); // Info for the destination table $sDstTable = static::$sWorkTable3; $sDstColName = "existing_column"; - + // Insert our ids into similar work tables // Then insert data into their respective columns to be moved $sOrigWorkTable = static::$sWorkTable; @@ -202,7 +200,7 @@ SQL WHERE 1 SQL ); - + $sOrigWorkTable2 = static::$sWorkTable2; $this->CreateDestinationTable($sOrigWorkTable2, [$sOrigTable2], $sDstColName); CMDBSource::Query( @@ -212,23 +210,23 @@ SQL WHERE 1 SQL ); - + // Create our destination table $this->CreateDestinationTable($sDstTable, [$sOrigTable, $sOrigTable2], $sDstColName); - + // Try to move data from both tables into the same column ModuleInstallerAPI::MoveColumnInDB($sOrigWorkTable, $sDstColName, $sDstTable, $sDstColName, true); ModuleInstallerAPI::MoveColumnInDB($sOrigWorkTable2, $sDstColName, $sDstTable, $sDstColName, true); - + // Check if data was actually moved by getting the value from the destination table for the ids we stored earlier - $iPersonId = $oPerson->GetKey(); + $iPersonId = $oPerson->GetKey(); $sFromTable1Data = CMDBSource::QueryToScalar( <<GetKey(); $sFromTable2Data = CMDBSource::QueryToScalar( <<assertEquals('from table 1', $sFromTable1Data, "Data was not moved as expected"); $this->assertEquals('from table 2', $sFromTable2Data, "Data was not moved as expected"); } diff --git a/tests/php-unit-tests/unitary-tests/setup/SetupUtilsTest.php b/tests/php-unit-tests/unitary-tests/setup/SetupUtilsTest.php index 9fba22793..219692374 100644 --- a/tests/php-unit-tests/unitary-tests/setup/SetupUtilsTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/SetupUtilsTest.php @@ -1,12 +1,10 @@ assertTrue($bLabelFound, "label '$sLabel' not found"); } - public function CheckGraphvizProvider() { + public function CheckGraphvizProvider() + { if (substr(PHP_OS, 0, 3) === 'WIN') { return []; } @@ -139,8 +139,11 @@ class SetupUtilsTest extends ItopTestCase $this->assertEquals($sPHPMinVersion, $oComposerConfig->config->platform->php, "SetupUtils::PHP_MIN_VERSION ($sPHPMinVersion) is not equals composer.json > config > platform ($sComposerPlatformPhp)"); // Require/PHP must be set to the supported PHP versions range in order to keep our package constraints up-to-date $sComposerRequirePhp = $oComposerConfig->require->php; - $this->assertEquals(">=$sPHPMinVersion <$sPHPNotValidatedVersion", $oComposerConfig->require->php, - "SetupUtils::PHP_MIN_VERSION ($sPHPMinVersion) and SetupUtils::PHP_NOT_VALIDATED_VERSION ($sPHPNotValidatedVersion) is not equals composer.json > require > php ($sComposerRequirePhp)"); + $this->assertEquals( + ">=$sPHPMinVersion <$sPHPNotValidatedVersion", + $oComposerConfig->require->php, + "SetupUtils::PHP_MIN_VERSION ($sPHPMinVersion) and SetupUtils::PHP_NOT_VALIDATED_VERSION ($sPHPNotValidatedVersion) is not equals composer.json > require > php ($sComposerRequirePhp)" + ); } } } diff --git a/tests/php-unit-tests/unitary-tests/setup/SubMFCompiler.php b/tests/php-unit-tests/unitary-tests/setup/SubMFCompiler.php index cdce728e8..7cef5576c 100644 --- a/tests/php-unit-tests/unitary-tests/setup/SubMFCompiler.php +++ b/tests/php-unit-tests/unitary-tests/setup/SubMFCompiler.php @@ -3,12 +3,15 @@ /** * Class SubMFCompiler: used to call a protected method for testing purpose */ -class SubMFCompiler extends MFCompiler { - public function CompileThemes($oBrandingNode, $sTempTargetDir) { +class SubMFCompiler extends MFCompiler +{ + public function CompileThemes($oBrandingNode, $sTempTargetDir) + { return parent::CompileThemes($oBrandingNode, $sTempTargetDir); } - public function GetCompilationTimeStamp(){ + public function GetCompilationTimeStamp() + { return $this->sCompilationTimeStamp; } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/iTopDesignFormatTest.php b/tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/iTopDesignFormatTest.php index 7f8fe2bbe..4366e33b3 100644 --- a/tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/iTopDesignFormatTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/iTopDesignFormatTest.php @@ -9,7 +9,6 @@ use iTopDesignFormat; use ReflectionException; use utils; - /** * @covers iTopDesignFormat * @@ -18,7 +17,7 @@ use utils; */ class iTopDesignFormatTest extends ItopTestCase { - const SAMPLES_DIR_PATH = 'Convert-samples/'; + public const SAMPLES_DIR_PATH = 'Convert-samples/'; protected function setUp(): void { @@ -61,8 +60,11 @@ class iTopDesignFormatTest extends ItopTestCase $bResult = $oInputDesignFormat->Convert($sTargetVersion); $aErrors = $oInputDesignFormat->GetErrors(); - $this->assertCount($iExpectedErrors, $aErrors, - 'errors in input format: '.var_export($aErrors, true)); + $this->assertCount( + $iExpectedErrors, + $aErrors, + 'errors in input format: '.var_export($aErrors, true) + ); if ($iExpectedErrors > 0) { $this->assertFalse($bResult); $this->assertEquals($sFirstErrorMessage, $aErrors[0]); @@ -111,8 +113,10 @@ class iTopDesignFormatTest extends ItopTestCase $oExpectedDesignFormat->GetITopDesignNode()->setAttribute('version', $sExpectedPreviousVersion); $bConversionResult = $oExpectedDesignFormat->Convert($sExpectedVersion); - $this->assertTrue($bConversionResult, - 'There were conversion errors: '.var_export($oExpectedDesignFormat->GetErrors(), true)); + $this->assertTrue( + $bConversionResult, + 'There were conversion errors: '.var_export($oExpectedDesignFormat->GetErrors(), true) + ); /** @noinspection PhpRedundantOptionalArgumentInspection We REALLY want those options so specifying it anyway */ $sConvertedXml = $oExpectedDesignFormat->GetXmlAsString(null, true, false); @@ -244,24 +248,24 @@ class iTopDesignFormatTest extends ItopTestCase public function MoveNodeProvider() { - return array( - 'From deleted to deleted' => array('from_deleted_to_deleted'), - 'From deleted to in definition' => array('from_deleted_to_in-definition'), - 'From deleted to not in definition' => array('from_deleted_to_not-in-definition'), - 'From in definition to deleted' => array('from_in-definition_to_deleted'), - 'From in definition to in definition' => array('from_in-definition_to_in-definition'), - 'From in definition to not in definition' => array('from_in-definition_to_not-in-definition'), - 'From not in definition to deleted' => array('from_not-in-definition_to_deleted'), - 'From not in definition to in definition' => array('from_not-in-definition_to_in-definition'), - 'From not in definition to not in definition' => array('from_not-in-definition_to_not-in-definition'), - ); + return [ + 'From deleted to deleted' => ['from_deleted_to_deleted'], + 'From deleted to in definition' => ['from_deleted_to_in-definition'], + 'From deleted to not in definition' => ['from_deleted_to_not-in-definition'], + 'From in definition to deleted' => ['from_in-definition_to_deleted'], + 'From in definition to in definition' => ['from_in-definition_to_in-definition'], + 'From in definition to not in definition' => ['from_in-definition_to_not-in-definition'], + 'From not in definition to deleted' => ['from_not-in-definition_to_deleted'], + 'From not in definition to in definition' => ['from_not-in-definition_to_in-definition'], + 'From not in definition to not in definition' => ['from_not-in-definition_to_not-in-definition'], + ]; } private function GetFileContent($sFileName) { $sCurrentPath = __DIR__; - return file_get_contents($sCurrentPath . DIRECTORY_SEPARATOR . $sFileName . '.xml'); + return file_get_contents($sCurrentPath.DIRECTORY_SEPARATOR.$sFileName.'.xml'); } /** @@ -286,7 +290,7 @@ class iTopDesignFormatTest extends ItopTestCase continue; } if (false === \array_key_exists($aXmlVersionData[$sXmlVersionPointingToKey], iTopDesignFormat::$aVersions)) { - $aAVersionsErrors[] = "$sXmlVersion version: invalid value for `$sXmlVersionPointingToKey` key ! Value=" . $aXmlVersionData[$sXmlVersionPointingToKey]; + $aAVersionsErrors[] = "$sXmlVersion version: invalid value for `$sXmlVersionPointingToKey` key ! Value=".$aXmlVersionData[$sXmlVersionPointingToKey]; } } @@ -308,6 +312,6 @@ class iTopDesignFormatTest extends ItopTestCase } } - $this->assertCount(0, $aAVersionsErrors, 'There were errors detected in iTopDesignFormat::$aVersions : ' . var_export($aAVersionsErrors, true)); + $this->assertCount(0, $aAVersionsErrors, 'There were errors detected in iTopDesignFormat::$aVersions : '.var_export($aAVersionsErrors, true)); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php index 8e0cba695..121681b6d 100644 --- a/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/unattended-install/InstallationFileServiceTest.php @@ -9,24 +9,29 @@ use RunTimeEnvironment; use InstallationFileService; use ModuleDiscovery; -class InstallationFileServiceTest extends ItopTestCase { - protected function setUp(): void { +class InstallationFileServiceTest extends ItopTestCase +{ + protected function setUp(): void + { parent::setUp(); $this->RequireOnceItopFile('/setup/unattended-install/InstallationFileService.php'); ModuleDiscovery::ResetCache(); } - protected function tearDown(): void { + protected function tearDown(): void + { parent::tearDown(); } - private function GetInstallationPath() : string { - return realpath(__DIR__ . '/resources/installation.xml'); + private function GetInstallationPath(): string + { + return realpath(__DIR__.'/resources/installation.xml'); } - private function GetModuleData($sCategory, bool $bIsVisible, bool $bIsAutoSelect, bool $bProductionModulesInRootDir=false) : array { - $sRootDir = str_replace('//', '/', $bProductionModulesInRootDir ? $this->GetAppRoot() .'data/production-modules/' : ''); + private function GetModuleData($sCategory, bool $bIsVisible, bool $bIsAutoSelect, bool $bProductionModulesInRootDir = false): array + { + $sRootDir = str_replace('//', '/', $bProductionModulesInRootDir ? $this->GetAppRoot().'data/production-modules/' : ''); var_dump($sRootDir); @@ -36,14 +41,15 @@ class InstallationFileServiceTest extends ItopTestCase { 'root_dir' => $sRootDir, ]; - if ($bIsAutoSelect){ + if ($bIsAutoSelect) { $aModuleData['auto_select'] = true; } return $aModuleData; } - public function ProcessDefaultModulesProvider() { + public function ProcessDefaultModulesProvider() + { return [ 'root module' => [ 'aAllFoundModules' => [ @@ -75,28 +81,28 @@ class InstallationFileServiceTest extends ItopTestCase { ], 'autoselect/invisible/in-root-dir module' => [ 'aAllFoundModules' => [ - 'autoselect-only' => $this->GetModuleData('mycategory', false, true , true), + 'autoselect-only' => $this->GetModuleData('mycategory', false, true, true), ], 'aExpectedSelectedModules' => [], 'aExpectedAutoSelectModules' => ['autoselect-only'], ], 'visible/authent module' => [ 'aAllFoundModules' => [ - 'authent-module' => $this->GetModuleData('authentication', true, false , false), + 'authent-module' => $this->GetModuleData('authentication', true, false, false), ], 'aExpectedSelectedModules' => ['authent-module'], 'aExpectedAutoSelectModules' => [], ], 'invisible module' => [ 'aAllFoundModules' => [ - 'visible-module' => $this->GetModuleData('mycategory', false, false , false), + 'visible-module' => $this->GetModuleData('mycategory', false, false, false), ], 'aExpectedSelectedModules' => ['visible-module'], 'aExpectedAutoSelectModules' => [], ], 'in-root-dir module' => [ 'aAllFoundModules' => [ - 'in-root-dir-module' => $this->GetModuleData('mycategory', true, false , true), + 'in-root-dir-module' => $this->GetModuleData('mycategory', true, false, true), ], 'aExpectedSelectedModules' => ['in-root-dir-module'], 'aExpectedAutoSelectModules' => [], @@ -106,7 +112,8 @@ class InstallationFileServiceTest extends ItopTestCase { /** * @dataProvider ProcessDefaultModulesProvider */ - public function testProcessDefaultModules(array $aAllFoundModules, array $aExpectedSelectedModules, array $aExpectedAutoSelectModules) { + public function testProcessDefaultModules(array $aAllFoundModules, array $aExpectedSelectedModules, array $aExpectedAutoSelectModules) + { $oInstallationFileService = new InstallationFileService('', 'production', [], true); $oProductionEnv = $this->createMock(RunTimeEnvironment::class); @@ -128,7 +135,8 @@ class InstallationFileServiceTest extends ItopTestCase { $this->assertEquals($aExpectedAutoSelectModules, $aAutoSelectModules); } - public function ProcessInstallationChoicesProvider() { + public function ProcessInstallationChoicesProvider() + { return [ 'all checked' => [ true ], 'only defaut + mandatory' => [ false ], @@ -138,7 +146,8 @@ class InstallationFileServiceTest extends ItopTestCase { /** * @dataProvider ProcessInstallationChoicesProvider */ - public function testProcessInstallationChoices($bInstallationOptionalChoicesChecked) { + public function testProcessInstallationChoices($bInstallationOptionalChoicesChecked) + { $sPath = $this->GetInstallationPath(); $oInstallationFileService = new InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); $oProductionEnv = $this->createMock(RunTimeEnvironment::class); @@ -176,12 +185,12 @@ class InstallationFileServiceTest extends ItopTestCase { 'itop-service-mgmt-provider', ]; - if ($bInstallationOptionalChoicesChecked){ - $aExpectedModules []= "itop-problem-mgmt"; - $aExpectedModules []= "itop-knownerror-mgmt"; + if ($bInstallationOptionalChoicesChecked) { + $aExpectedModules [] = "itop-problem-mgmt"; + $aExpectedModules [] = "itop-knownerror-mgmt"; } else { - $aExpectedUnselectedModules []= "itop-problem-mgmt"; - $aExpectedUnselectedModules []= "itop-knownerror-mgmt"; + $aExpectedUnselectedModules [] = "itop-problem-mgmt"; + $aExpectedUnselectedModules [] = "itop-knownerror-mgmt"; } sort($aExpectedModules); @@ -199,18 +208,18 @@ class InstallationFileServiceTest extends ItopTestCase { sort($aGetAfterComputationSelectedExtensions); $aExpectedExtensions = [ 'itop-change-mgmt-simple', - 'itop-config-mgmt-core', - 'itop-config-mgmt-datacenter', - 'itop-config-mgmt-end-user', - 'itop-config-mgmt-storage', - 'itop-config-mgmt-virtualization', - 'itop-service-mgmt-enterprise', - 'itop-ticket-mgmt-simple-ticket', + 'itop-config-mgmt-core', + 'itop-config-mgmt-datacenter', + 'itop-config-mgmt-end-user', + 'itop-config-mgmt-storage', + 'itop-config-mgmt-virtualization', + 'itop-service-mgmt-enterprise', + 'itop-ticket-mgmt-simple-ticket', 'itop-ticket-mgmt-simple-ticket-enhanced-portal', ]; - if ($bInstallationOptionalChoicesChecked){ - $aExpectedExtensions []= "itop-problem-mgmt"; - $aExpectedExtensions []= 'itop-kown-error-mgmt'; + if ($bInstallationOptionalChoicesChecked) { + $aExpectedExtensions [] = "itop-problem-mgmt"; + $aExpectedExtensions [] = 'itop-kown-error-mgmt'; } sort($aExpectedExtensions); $this->assertEquals($aExpectedExtensions, $aGetAfterComputationSelectedExtensions); @@ -221,7 +230,8 @@ class InstallationFileServiceTest extends ItopTestCase { /** * @dataProvider ItilExtensionProvider */ - public function testProcessInstallationChoicesWithItilChoices(array $aSelectedExtensions, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { + public function testProcessInstallationChoicesWithItilChoices(array $aSelectedExtensions, bool $bKnownMgtSelected, bool $bCoreMgtSelected) + { $sPath = $this->GetInstallationPath(); $oInstallationFileService = new InstallationFileService($sPath, 'production', $aSelectedExtensions, false); $oProductionEnv = $this->createMock(RunTimeEnvironment::class); @@ -253,8 +263,8 @@ class InstallationFileServiceTest extends ItopTestCase { "itop-portal-base", "itop-change-mgmt-itil", ]; - if ($bKnownMgtSelected){ - $aExpectedInstallationModules []= "itop-knownerror-mgmt"; + if ($bKnownMgtSelected) { + $aExpectedInstallationModules [] = "itop-knownerror-mgmt"; } sort($aExpectedInstallationModules); @@ -269,8 +279,8 @@ class InstallationFileServiceTest extends ItopTestCase { 'itop-request-mgmt', 'itop-service-mgmt-provider', ]; - if (!$bKnownMgtSelected){ - $aExpectedUnselectedModules[]='itop-knownerror-mgmt'; + if (!$bKnownMgtSelected) { + $aExpectedUnselectedModules[] = 'itop-knownerror-mgmt'; } $aUnselectedModules = array_keys($oInstallationFileService->GetUnSelectedModules()); sort($aExpectedUnselectedModules); @@ -280,23 +290,26 @@ class InstallationFileServiceTest extends ItopTestCase { $this->ValidateItilExtensionComputation($oInstallationFileService, $bKnownMgtSelected, $bCoreMgtSelected); } - public function GetDefaultModulesProvider() { + public function GetDefaultModulesProvider() + { return [ 'check all possible modules' => [true], 'only minimum defaul/mandatory from installation.xml' => [false], ]; } - private function GetMockListOfFoundModules() : array { - $sJsonContent = file_get_contents(realpath(__DIR__ . '/resources/AnalyzeInstallation.json')); + private function GetMockListOfFoundModules(): array + { + $sJsonContent = file_get_contents(realpath(__DIR__.'/resources/AnalyzeInstallation.json')); $sJsonContent = str_replace('ROOTDIR_TOREPLACE', addslashes(APPROOT), $sJsonContent); - return json_decode($sJsonContent, true); + return json_decode($sJsonContent, true); } /** * @dataProvider GetDefaultModulesProvider */ - public function testGetAllSelectedModules($bInstallationOptionalChoicesChecked=false) { + public function testGetAllSelectedModules($bInstallationOptionalChoicesChecked = false) + { $sPath = $this->GetInstallationPath(); $oInstallationFileService = new InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); @@ -344,9 +357,9 @@ class InstallationFileServiceTest extends ItopTestCase { 'itop-bridge-virtualization-storage', ]; - if ($bInstallationOptionalChoicesChecked){ - $aExpectedInstallationModules []= "itop-problem-mgmt"; - $aExpectedInstallationModules []= "itop-knownerror-mgmt"; + if ($bInstallationOptionalChoicesChecked) { + $aExpectedInstallationModules [] = "itop-problem-mgmt"; + $aExpectedInstallationModules [] = "itop-knownerror-mgmt"; } sort($aExpectedInstallationModules); @@ -358,7 +371,8 @@ class InstallationFileServiceTest extends ItopTestCase { $this->ValidateNonItilExtensionComputation($oInstallationFileService, $bInstallationOptionalChoicesChecked); } - private function ValidateNonItilExtensionComputation($oInstallationFileService, bool $bInstallationOptionalChoicesChecked, array $aAdditionalExtensions=[]) { + private function ValidateNonItilExtensionComputation($oInstallationFileService, bool $bInstallationOptionalChoicesChecked, array $aAdditionalExtensions = []) + { $aGetAfterComputationSelectedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); sort($aGetAfterComputationSelectedExtensions); $aExpectedExtensions = array_merge($aAdditionalExtensions, [ @@ -372,15 +386,16 @@ class InstallationFileServiceTest extends ItopTestCase { 'itop-ticket-mgmt-simple-ticket', 'itop-ticket-mgmt-simple-ticket-enhanced-portal', ]); - if ($bInstallationOptionalChoicesChecked){ - $aExpectedExtensions []= "itop-problem-mgmt"; - $aExpectedExtensions []= 'itop-kown-error-mgmt'; + if ($bInstallationOptionalChoicesChecked) { + $aExpectedExtensions [] = "itop-problem-mgmt"; + $aExpectedExtensions [] = 'itop-kown-error-mgmt'; } sort($aExpectedExtensions); $this->assertEquals($aExpectedExtensions, $aGetAfterComputationSelectedExtensions); } - private function ValidateItilExtensionComputation($oInstallationFileService, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { + private function ValidateItilExtensionComputation($oInstallationFileService, bool $bKnownMgtSelected, bool $bCoreMgtSelected) + { $aGetAfterComputationSelectedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions(); sort($aGetAfterComputationSelectedExtensions); $aExpectedExtensions = [ @@ -395,17 +410,18 @@ class InstallationFileServiceTest extends ItopTestCase { 'itop-ticket-mgmt-itil-incident', 'itop-ticket-mgmt-itil-user-request', ]; - if ($bCoreMgtSelected){ - $aExpectedExtensions []= 'itop-config-mgmt-core'; + if ($bCoreMgtSelected) { + $aExpectedExtensions [] = 'itop-config-mgmt-core'; } - if ($bKnownMgtSelected){ - $aExpectedExtensions []= 'itop-kown-error-mgmt'; + if ($bKnownMgtSelected) { + $aExpectedExtensions [] = 'itop-kown-error-mgmt'; } sort($aExpectedExtensions); $this->assertEquals($aExpectedExtensions, $aGetAfterComputationSelectedExtensions); } - private function GetSelectedItilExtensions(bool $coreExtensionIncluded, bool $bKnownMgtIncluded) : array { + private function GetSelectedItilExtensions(bool $coreExtensionIncluded, bool $bKnownMgtIncluded): array + { $aExtensions = [ 'itop-config-mgmt-datacenter', 'itop-config-mgmt-end-user', @@ -419,19 +435,20 @@ class InstallationFileServiceTest extends ItopTestCase { 'itop-change-mgmt-itil', ]; - if ($coreExtensionIncluded){ - $aExtensions[]= 'itop-config-mgmt-core'; + if ($coreExtensionIncluded) { + $aExtensions[] = 'itop-config-mgmt-core'; } - if ($bKnownMgtIncluded){ - $aExtensions[]= 'itop-kown-error-mgmt'; + if ($bKnownMgtIncluded) { + $aExtensions[] = 'itop-kown-error-mgmt'; } return $aExtensions; } - public function ItilExtensionProvider() { + public function ItilExtensionProvider() + { return [ 'all itil extensions + INCLUDING known-error-mgt' => [ 'aSelectedExtensions' => $this->GetSelectedItilExtensions(true, true), @@ -459,7 +476,8 @@ class InstallationFileServiceTest extends ItopTestCase { /** * @dataProvider ItilExtensionProvider */ - public function testGetAllSelectedModules_withItilExtensions(array $aSelectedExtensions, bool $bKnownMgtSelected, bool $bCoreMgtSelected) { + public function testGetAllSelectedModules_withItilExtensions(array $aSelectedExtensions, bool $bKnownMgtSelected, bool $bCoreMgtSelected) + { $sPath = $this->GetInstallationPath(); $oInstallationFileService = new InstallationFileService($sPath, 'production', $aSelectedExtensions); @@ -509,8 +527,8 @@ class InstallationFileServiceTest extends ItopTestCase { 'itop-sla-computation', 'itop-bridge-virtualization-storage', ]; - if ($bKnownMgtSelected){ - $aExpectedInstallationModules []= "itop-knownerror-mgmt"; + if ($bKnownMgtSelected) { + $aExpectedInstallationModules [] = "itop-knownerror-mgmt"; } sort($aExpectedInstallationModules); @@ -520,7 +538,8 @@ class InstallationFileServiceTest extends ItopTestCase { $this->ValidateItilExtensionComputation($oInstallationFileService, $bKnownMgtSelected, $bCoreMgtSelected); } - private function CreateItopExtension(string $sSource, string $sCode, array $aModules, array $aMissingDependencies, bool $bIsVisible) : iTopExtension{ + private function CreateItopExtension(string $sSource, string $sCode, array $aModules, array $aMissingDependencies, bool $bIsVisible): iTopExtension + { $oExtension = new iTopExtension(); $oExtension->sCode = $sCode; $oExtension->sSource = $sSource; @@ -530,31 +549,32 @@ class InstallationFileServiceTest extends ItopTestCase { return $oExtension; } - public function CanChooseUnpackageExtensionProvider() { + public function CanChooseUnpackageExtensionProvider() + { return [ 'extension in SOURCE_REMOTE' => [ 'sCode' => "extension-from-designer", 'bInstallationOptionalChoicesChecked' => false, 'sSource' => 'data', - 'bExpectedRes' => true + 'bExpectedRes' => true, ], 'extension in SOURCE_WIZARD' => [ 'sCode' => 'extension-from-package', 'bInstallationOptionalChoicesChecked' => true, 'sSource' => 'datamodels', - 'bExpectedRes' => false + 'bExpectedRes' => false, ], 'extension in SOURCE_MANUAL + optional OK' => [ 'sCode' => 'extension-from-package', 'bInstallationOptionalChoicesChecked' => true, 'sSource' => 'extensions', - 'bExpectedRes' => true + 'bExpectedRes' => true, ], 'extension in SOURCE_MANUAL + optional NOT OK' => [ 'sCode' => 'extension-from-package', 'bInstallationOptionalChoicesChecked' => false, 'sSource' => 'extensions', - 'bExpectedRes' => false + 'bExpectedRes' => false, ], ]; } @@ -562,7 +582,8 @@ class InstallationFileServiceTest extends ItopTestCase { /** * @dataProvider CanChooseUnpackageExtensionProvider */ - public function testCanChooseUnpackageExtension(string $sCode, bool $bInstallationOptionalChoicesChecked, string $sSource, bool $bExpectedRes) { + public function testCanChooseUnpackageExtension(string $sCode, bool $bInstallationOptionalChoicesChecked, string $sSource, bool $bExpectedRes) + { $sPath = $this->GetInstallationPath(); $oInstallationFileService = new InstallationFileService($sPath, 'production', [], $bInstallationOptionalChoicesChecked); @@ -570,7 +591,8 @@ class InstallationFileServiceTest extends ItopTestCase { $this->assertEquals($bExpectedRes, $oInstallationFileService->CanChooseUnpackageExtension($oItopExtension)); } - public function ProcessExtensionModulesNotSpecifiedInChoicesProvider() { + public function ProcessExtensionModulesNotSpecifiedInChoicesProvider() + { return [ 'extensions to install OK' => [ 'aExtensionData' => [ @@ -583,17 +605,17 @@ class InstallationFileServiceTest extends ItopTestCase { //'itop-incident-mgmt-itil', //unselected 'combodo-monitoring2', 'itop-attachments', //already selected - ] + ], ], 'bExtensionCanBeChoosen' => true, 'aMissingDependencies' => [], 'bIsVisible' => true, 'bExpectedAdditionalExtensions' => [ - 'extension1', 'extension2' + 'extension1', 'extension2', ], 'bExpectedAdditionalModules' => [ - 'combodo-monitoring', 'combodo-monitoring2' - ] + 'combodo-monitoring', 'combodo-monitoring2', + ], ], 'extensions to install cannot be choose,' => [ 'aExtensionData' => [ @@ -602,13 +624,13 @@ class InstallationFileServiceTest extends ItopTestCase { ], 'extension2' => [ 'combodo-monitoring2', - ] + ], ], 'bExtensionCanBeChoosen' => false, 'aMissingDependencies' => [], 'bIsVisible' => true, 'bExpectedAdditionalExtensions' => [], - 'bExpectedAdditionalModules' => [] + 'bExpectedAdditionalModules' => [], ], 'extensions to install not visible' => [ 'aExtensionData' => [ @@ -617,13 +639,13 @@ class InstallationFileServiceTest extends ItopTestCase { ], 'extension2' => [ 'combodo-monitoring2', - ] + ], ], 'bExtensionCanBeChoosen' => true, 'aMissingDependencies' => [], 'bIsVisible' => false, 'bExpectedAdditionalExtensions' => [], - 'bExpectedAdditionalModules' => [] + 'bExpectedAdditionalModules' => [], ], 'extensions to install with missing dependencies' => [ 'aExtensionData' => [ @@ -632,13 +654,13 @@ class InstallationFileServiceTest extends ItopTestCase { ], 'extension2' => [ 'combodo-monitoring2', - ] + ], ], 'bExtensionCanBeChoosen' => true, 'aMissingDependencies' => ['missing-module'], 'bIsVisible' => true, 'bExpectedAdditionalExtensions' => [], - 'bExpectedAdditionalModules' => [] + 'bExpectedAdditionalModules' => [], ], 'extensions to install with unselectable ITIL module' => [ 'aExtensionData' => [ @@ -649,13 +671,13 @@ class InstallationFileServiceTest extends ItopTestCase { 'extension2' => [ 'itop-incident-mgmt-itil', //unselected 'combodo-monitoring2', - ] + ], ], 'bExtensionCanBeChoosen' => true, 'aMissingDependencies' => [], 'bIsVisible' => true, 'bExpectedAdditionalExtensions' => [], - 'bExpectedAdditionalModules' => [] + 'bExpectedAdditionalModules' => [], ], 'extensions already processed' => [ 'aExtensionData' => [ @@ -669,7 +691,7 @@ class InstallationFileServiceTest extends ItopTestCase { 'bExpectedAdditionalExtensions' => [ ], 'bExpectedAdditionalModules' => [ - ] + ], ], ]; } @@ -677,8 +699,14 @@ class InstallationFileServiceTest extends ItopTestCase { /** * @dataProvider ProcessExtensionModulesNotSpecifiedInChoicesProvider */ - public function testProcessExtensionModulesNotSpecifiedInChoices(array $aExtensionData, bool $bExtensionCanBeChoosen, - array $aMissingDependencies, bool $bIsVisible, array $bExpectedAdditionalExtensions, array $bExpectedAdditionalModules) { + public function testProcessExtensionModulesNotSpecifiedInChoices( + array $aExtensionData, + bool $bExtensionCanBeChoosen, + array $aMissingDependencies, + bool $bIsVisible, + array $bExpectedAdditionalExtensions, + array $bExpectedAdditionalModules + ) { $sPath = $this->GetInstallationPath(); $oInstallationFileService = new InstallationFileService($sPath, 'production', [], true); @@ -692,8 +720,8 @@ class InstallationFileServiceTest extends ItopTestCase { $aItopExtensionMap = []; $sSource = $bExtensionCanBeChoosen ? iTopExtension::SOURCE_REMOTE : iTopExtension::SOURCE_WIZARD; - foreach ($aExtensionData as $sExtensionCode => $aModules){ - $aItopExtensionMap[]= $this->CreateItopExtension($sSource, $sExtensionCode, $aModules, $aMissingDependencies, $bIsVisible); + foreach ($aExtensionData as $sExtensionCode => $aModules) { + $aItopExtensionMap[] = $this->CreateItopExtension($sSource, $sExtensionCode, $aModules, $aMissingDependencies, $bIsVisible); } $oItopExtensionsMap->expects($this->once()) ->method('GetAllExtensions') @@ -742,5 +770,4 @@ class InstallationFileServiceTest extends ItopTestCase { $this->ValidateNonItilExtensionComputation($oInstallationFileService, true, $bExpectedAdditionalExtensions); } - } diff --git a/tests/php-unit-tests/unitary-tests/setup/unattended-install/UnattendedInstallTest.php b/tests/php-unit-tests/unitary-tests/setup/unattended-install/UnattendedInstallTest.php index 77116c351..ed6ed2e50 100644 --- a/tests/php-unit-tests/unitary-tests/setup/unattended-install/UnattendedInstallTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/unattended-install/UnattendedInstallTest.php @@ -6,10 +6,10 @@ use Combodo\iTop\Test\UnitTest\ItopDataTestCase; class UnattendedInstallTest extends ItopDataTestCase { - protected function setUp(): void - { - parent::setUp(); - } + protected function setUp(): void + { + parent::setUp(); + } protected function tearDown(): void { parent::tearDown(); @@ -17,15 +17,16 @@ class UnattendedInstallTest extends ItopDataTestCase 'web.config', '.htaccess', ]; - foreach ($aFiles as $sFile){ + foreach ($aFiles as $sFile) { $sPath = APPROOT."setup/unattended-install/$sFile"; - if (is_file("$sPath.back")){ + if (is_file("$sPath.back")) { rename("$sPath.back", $sPath); } } } - private function callUnattendedFromHttp() : string { + private function callUnattendedFromHttp(): string + { $ch = curl_init(); $sUrl = \MetaModel::GetConfig()->Get('app_root_url'); @@ -38,18 +39,19 @@ class UnattendedInstallTest extends ItopDataTestCase curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $sJson = curl_exec($ch); - curl_close ($ch); + curl_close($ch); return $sJson; } - public function testCallUnattendedInstallFromHttp(){ + public function testCallUnattendedInstallFromHttp() + { $sJson = $this->callUnattendedFromHttp(); - if (false !== strpos($sJson, "403 Forbidden")){ + if (false !== strpos($sJson, "403 Forbidden")) { //.htaccess / webconfig effect $aFiles = [ 'web.config', '.htaccess', ]; - foreach ($aFiles as $sFile){ + foreach ($aFiles as $sFile) { $sPath = APPROOT."setup/unattended-install/$sFile"; if (is_file("$sPath")) { rename($sPath, "$sPath.back"); @@ -62,19 +64,20 @@ class UnattendedInstallTest extends ItopDataTestCase $this->assertEquals("Mode CLI only", $sJson, "even without HTTP protection, script should NOT be called directly by HTTP"); } - public function testCallUnattendedInstallFromCLI() { + public function testCallUnattendedInstallFromCLI() + { $sCliPath = realpath(APPROOT."/setup/unattended-install/unattended-install.php"); exec(sprintf("%s %s", PHP_BINARY, $sCliPath), $aOutput, $iCode); $sOutput = implode('\n', $aOutput); var_dump($sOutput); $this->assertStringContainsString("Missing mandatory argument `--param-file`", $sOutput); - if (DIRECTORY_SEPARATOR === '\\') { - // Windows - $this->assertEquals(-1, $iCode); - } else { - // Linux - $this->assertEquals(255, $iCode); - } + if (DIRECTORY_SEPARATOR === '\\') { + // Windows + $this->assertEquals(-1, $iCode); + } else { + // Linux + $this->assertEquals(255, $iCode); + } } } diff --git a/tests/php-unit-tests/unitary-tests/sources/Application/Helper/CKEditorHelperTest.php b/tests/php-unit-tests/unitary-tests/sources/Application/Helper/CKEditorHelperTest.php index 22b805f50..ad55ecb98 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Application/Helper/CKEditorHelperTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Application/Helper/CKEditorHelperTest.php @@ -1,4 +1,5 @@ SetStylesWhiteList($aSanitizerConfiguration['stylesWhiteList']); $oSanitizer->SetTagsBlackList($aSanitizerConfiguration['tagsBlackList']); $oSanitizer->SetAttrsBlackList($aSanitizerConfiguration['attrsBlackList']); - + $aCKEditorConfiguration = CKEditorHelper::GetDOMSanitizerForCKEditor($oSanitizer); $this->assertEquals($aExpectedCKEditorConfiguration, $aCKEditorConfiguration); } - + public function DOMSanitizerForCKEditorProvider(): array { return [ 'Allow list small dataset' => [ [ - 'tagsWhiteList' => [ - 'html' => array(), - 'p' => array('style', 'class'), - 'a' => array('href', 'name'), + 'tagsWhiteList' => [ + 'html' => [], + 'p' => ['style', 'class'], + 'a' => ['href', 'name'], ], 'attrsWhiteList' => [ - 'href' => '/^(https:)/i' + 'href' => '/^(https:)/i', ], 'stylesWhiteList' => [ 'color', - 'font-size' + 'font-size', ], 'tagsBlackList' => [], 'attrsBlackList' => [], @@ -82,7 +83,7 @@ class CKEditorHelperTest extends ItopTestCase 'name' => 'html', 'attributes' => false, 'classes' => false, - 'styles' => false + 'styles' => false, ], [ 'name' => 'p', @@ -90,35 +91,35 @@ class CKEditorHelperTest extends ItopTestCase 'classes' => true, 'styles' => [ 'color' => true, - 'font-size' => true - ] + 'font-size' => true, + ], ], [ 'name' => 'a', 'attributes' => [ 'href' => [ - 'pattern' => '/^(https:)/i' + 'pattern' => '/^(https:)/i', ], - 'name' => true + 'name' => true, ], 'classes' => false, - 'styles' => false - ] + 'styles' => false, + ], ], - 'disallow' => [] - ] + 'disallow' => [], + ], ], 'Allow list medium dataset' => [ [ 'tagsWhiteList' => [ - 'h1' => array('style', 'class'), - 'h2' => array('style', 'class'), - 'h3' => array('style', 'class'), - 'h4' => array('style', 'class'), - 'table' => array('style', 'class', 'width', 'summary', 'align', 'border', 'cellpadding', 'cellspacing', 'style'), - 'tr' => array('style', 'class', 'align', 'valign', 'bgcolor', 'style'), - 'ul' => array(), - 'ol' => array(), + 'h1' => ['style', 'class'], + 'h2' => ['style', 'class'], + 'h3' => ['style', 'class'], + 'h4' => ['style', 'class'], + 'table' => ['style', 'class', 'width', 'summary', 'align', 'border', 'cellpadding', 'cellspacing', 'style'], + 'tr' => ['style', 'class', 'align', 'valign', 'bgcolor', 'style'], + 'ul' => [], + 'ol' => [], ], 'attrsWhiteList' => [ 'href' => '/^(https:)/i', @@ -166,8 +167,8 @@ class CKEditorHelperTest extends ItopTestCase 'vertical-align' => true, 'width' => true, 'white-space' => true, - 'float' => true - ] + 'float' => true, + ], ], [ 'name' => 'h2', @@ -186,8 +187,8 @@ class CKEditorHelperTest extends ItopTestCase 'vertical-align' => true, 'width' => true, 'white-space' => true, - 'float' => true - ] + 'float' => true, + ], ], [ 'name' => 'h3', @@ -206,8 +207,8 @@ class CKEditorHelperTest extends ItopTestCase 'vertical-align' => true, 'width' => true, 'white-space' => true, - 'float' => true - ] + 'float' => true, + ], ], [ 'name' => 'h4', @@ -226,18 +227,18 @@ class CKEditorHelperTest extends ItopTestCase 'vertical-align' => true, 'width' => true, 'white-space' => true, - 'float' => true - ] + 'float' => true, + ], ], [ 'name' => 'table', 'attributes' => [ 'width' => [ - 'pattern' => '/^([0-9]+(px|em|%)?)$/i' + 'pattern' => '/^([0-9]+(px|em|%)?)$/i', ], 'summary' => true, 'align' => [ - 'pattern' => '/^(left|right|center|justify)$/i' + 'pattern' => '/^(left|right|center|justify)$/i', ], 'border' => true, 'cellpadding' => true, @@ -257,21 +258,21 @@ class CKEditorHelperTest extends ItopTestCase 'vertical-align' => true, 'width' => true, 'white-space' => true, - 'float' => true - ] + 'float' => true, + ], ], [ 'name' => 'tr', 'attributes' => [ 'align' => [ - 'pattern' => '/^(left|right|center|justify)$/i' + 'pattern' => '/^(left|right|center|justify)$/i', ], 'valign' => [ - 'pattern' => '/^(top|middle|bottom)$/i' + 'pattern' => '/^(top|middle|bottom)$/i', ], 'bgcolor' => [ - 'pattern' => '/^#[0-9a-f]{6}$/i' - ] + 'pattern' => '/^#[0-9a-f]{6}$/i', + ], ], 'classes' => true, 'styles' => [ @@ -287,24 +288,24 @@ class CKEditorHelperTest extends ItopTestCase 'vertical-align' => true, 'width' => true, 'white-space' => true, - 'float' => true - ] + 'float' => true, + ], ], [ 'name' => 'ul', 'attributes' => false, 'classes' => false, - 'styles' => false + 'styles' => false, ], [ 'name' => 'ol', 'attributes' => false, 'classes' => false, - 'styles' => false - ] + 'styles' => false, + ], ], - 'disallow' => [] - ] + 'disallow' => [], + ], ], 'Disallow list small dataset' => [ [ @@ -326,24 +327,24 @@ class CKEditorHelperTest extends ItopTestCase [ 'name' => 'html', 'attributes' => [ - 'href' => true + 'href' => true, ], ], [ 'name' => 'p', 'attributes' => [ - 'href' => true + 'href' => true, ], ], [ 'name' => 'a', 'attributes' => [ - 'href' => true + 'href' => true, ], - ] - ] - ] - ] + ], + ], + ], + ], ]; } } diff --git a/tests/php-unit-tests/unitary-tests/sources/Application/Helper/TestDOMSanitizer.php b/tests/php-unit-tests/unitary-tests/sources/Application/Helper/TestDOMSanitizer.php index b8d494f4b..68fde463f 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Application/Helper/TestDOMSanitizer.php +++ b/tests/php-unit-tests/unitary-tests/sources/Application/Helper/TestDOMSanitizer.php @@ -2,7 +2,6 @@ namespace Combodo\iTop\Test\UnitTest\Application\Helper; - use DOMSanitizer; class TestDOMSanitizer extends DOMSanitizer @@ -38,27 +37,27 @@ class TestDOMSanitizer extends DOMSanitizer { return static::$aStylesWhiteList; } - + public function SetTagsWhiteList(array $aTagsWhiteList) { static::$aTagsWhiteList = $aTagsWhiteList; } - + public function SetAttrsWhiteList(array $aAttrsWhiteList) { static::$aAttrsWhiteList = $aAttrsWhiteList; } - + public function SetStylesWhiteList(array $aStylesWhiteList) { static::$aStylesWhiteList = $aStylesWhiteList; } - + public function SetTagsBlackList(array $aTagsBlackList) { static::$aTagsBlackList = $aTagsBlackList; } - + public function SetAttrsBlackList(array $aAttrsBlackList) { static::$aAttrsBlackList = $aAttrsBlackList; @@ -73,4 +72,4 @@ class TestDOMSanitizer extends DOMSanitizer { // TODO: Implement PrintDoc() method. } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/sources/Application/Helper/WebResourcesHelperTest.php b/tests/php-unit-tests/unitary-tests/sources/Application/Helper/WebResourcesHelperTest.php index 58f38fcaf..67a8d5d1c 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Application/Helper/WebResourcesHelperTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Application/Helper/WebResourcesHelperTest.php @@ -1,4 +1,5 @@ assertNotNull($oDashboard); $this->expectException(SecurityException::class); - $sDashboardFileSuspect = APPROOT.self::SYSTEM_FILE_PATH;; + $sDashboardFileSuspect = APPROOT.self::SYSTEM_FILE_PATH; + ; RuntimeDashboard::GetDashboard($sDashboardFileSuspect, $sDashboardId); } diff --git a/tests/php-unit-tests/unitary-tests/sources/Application/Search/CriterionConversionTest.php b/tests/php-unit-tests/unitary-tests/sources/Application/Search/CriterionConversionTest.php index 0aca843f0..f2ba3c866 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Application/Search/CriterionConversionTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Application/Search/CriterionConversionTest.php @@ -1,4 +1,5 @@ debug($sOql); @@ -72,8 +74,8 @@ class CriterionConversionTest extends ItopDataTestCase public function ToOqlProvider() { - return array( - '>' => array( + return [ + '>' => [ 'UserRequest', '{ "ref": "UserRequest.start_date", @@ -86,9 +88,9 @@ class CriterionConversionTest extends ItopDataTestCase "operator": ">", "oql": "" }', - "(`UserRequest`.`start_date` > '2017-01-01')" - ), - 'contains nothing' => array( + "(`UserRequest`.`start_date` > '2017-01-01')", + ], + 'contains nothing' => [ 'Contact', '{ "ref": "Contact.name", @@ -101,9 +103,9 @@ class CriterionConversionTest extends ItopDataTestCase "operator": "contains", "oql": "" }', - "1" - ), - 'contains a regular string' => array( + "1", + ], + 'contains a regular string' => [ 'Contact', '{ "ref": "Contact.name", @@ -116,10 +118,10 @@ class CriterionConversionTest extends ItopDataTestCase "operator": "contains", "oql": "" }', - "(`Contact`.`name` LIKE '%toto%')" - ), + "(`Contact`.`name` LIKE '%toto%')", + ], // See PR #170 - 'contains 0 as a string' => array( + 'contains 0 as a string' => [ 'Contact', '{ "ref": "Contact.name", @@ -132,9 +134,9 @@ class CriterionConversionTest extends ItopDataTestCase "operator": "contains", "oql": "" }', - "(`Contact`.`name` LIKE '%0%')" - ), - 'starts_with nothing' => array( + "(`Contact`.`name` LIKE '%0%')", + ], + 'starts_with nothing' => [ 'Contact', '{ "ref": "Contact.name", @@ -147,9 +149,9 @@ class CriterionConversionTest extends ItopDataTestCase "operator": "starts_with", "oql": "" }', - "1" - ), - 'starts_with a regular string' => array( + "1", + ], + 'starts_with a regular string' => [ 'Contact', '{ "ref": "Contact.name", @@ -162,9 +164,9 @@ class CriterionConversionTest extends ItopDataTestCase "operator": "starts_with", "oql": "" }', - "(`Contact`.`name` LIKE 'toto%')" - ), - 'starts_with a 0 as a string' => array( + "(`Contact`.`name` LIKE 'toto%')", + ], + 'starts_with a 0 as a string' => [ 'Contact', '{ "ref": "Contact.name", @@ -177,9 +179,9 @@ class CriterionConversionTest extends ItopDataTestCase "operator": "starts_with", "oql": "" }', - "(`Contact`.`name` LIKE '0%')" - ), - 'ends_with nothing' => array( + "(`Contact`.`name` LIKE '0%')", + ], + 'ends_with nothing' => [ 'Contact', '{ "ref": "Contact.name", @@ -192,9 +194,9 @@ class CriterionConversionTest extends ItopDataTestCase "operator": "ends_with", "oql": "" }', - "1" - ), - 'ends_with a regular string' => array( + "1", + ], + 'ends_with a regular string' => [ 'Contact', '{ "ref": "Contact.name", @@ -207,9 +209,9 @@ class CriterionConversionTest extends ItopDataTestCase "operator": "ends_with", "oql": "" }', - "(`Contact`.`name` LIKE '%toto')" - ), - 'ends_with 0 as a string' => array( + "(`Contact`.`name` LIKE '%toto')", + ], + 'ends_with 0 as a string' => [ 'Contact', '{ "ref": "Contact.name", @@ -222,9 +224,9 @@ class CriterionConversionTest extends ItopDataTestCase "operator": "ends_with", "oql": "" }', - "(`Contact`.`name` LIKE '%0')" - ), - 'empty' => array( + "(`Contact`.`name` LIKE '%0')", + ], + 'empty' => [ 'Contact', '{ "ref": "Contact.name", @@ -237,9 +239,9 @@ class CriterionConversionTest extends ItopDataTestCase "operator": "empty", "oql": "" }', - "(`Contact`.`name` = '')" - ), - 'not_empty' => array( + "(`Contact`.`name` = '')", + ], + 'not_empty' => [ 'Contact', '{ "ref": "Contact.name", @@ -252,9 +254,9 @@ class CriterionConversionTest extends ItopDataTestCase "operator": "not_empty", "oql": "" }', - "(`Contact`.`name` != '')" - ), - ); + "(`Contact`.`name` != '')", + ], + ]; } /** @@ -266,7 +268,7 @@ class CriterionConversionTest extends ItopDataTestCase * @throws \CoreException * @throws \OQLException */ - function testToSearchForm($aCriterion, $sExpectedOperator) + public function testToSearchForm($aCriterion, $sExpectedOperator) { $oSearchForm = new SearchForm(); /** @var \DBObjectSearch $oSearch */ @@ -277,10 +279,10 @@ class CriterionConversionTest extends ItopDataTestCase $this->assertEquals($sExpectedOperator, $aRes[0]['operator']); } - function ToSearchFormProvider() + public function ToSearchFormProvider() { - return array( - '=' => array( + return [ + '=' => [ json_decode('[ { "ref": "Contact.name", @@ -295,9 +297,9 @@ class CriterionConversionTest extends ItopDataTestCase "oql": "(`Contact`.`name` = \'toto\')" } ]', true), - '=' - ), - 'starts_with' => array( + '=', + ], + 'starts_with' => [ json_decode('[ { "ref": "Contact.name", @@ -312,9 +314,9 @@ class CriterionConversionTest extends ItopDataTestCase "oql": "(`Contact`.`name` LIKE \'toto%\')" } ]', true), - 'starts_with' - ), - 'ends_with' => array( + 'starts_with', + ], + 'ends_with' => [ json_decode('[ { "ref": "Contact.name", @@ -329,9 +331,9 @@ class CriterionConversionTest extends ItopDataTestCase "oql": "(`Contact`.`name` LIKE \'%toto\')" } ]', true), - 'ends_with' - ), - 'contains' => array( + 'ends_with', + ], + 'contains' => [ json_decode('[ { "widget": "string", @@ -346,9 +348,9 @@ class CriterionConversionTest extends ItopDataTestCase "oql": "(`Contact`.`name` LIKE \'%toto%\')" } ]', true), - 'contains' - ), - 'empty1' => array( + 'contains', + ], + 'empty1' => [ json_decode('[ { "widget": "string", @@ -363,9 +365,9 @@ class CriterionConversionTest extends ItopDataTestCase "oql": "(`Contact`.`name` LIKE \'\')" } ]', true), - 'empty' - ), - 'empty2' => array( + 'empty', + ], + 'empty2' => [ json_decode('[ { "widget": "string", @@ -380,9 +382,9 @@ class CriterionConversionTest extends ItopDataTestCase "oql": "(`Contact`.`name` = \'\')" } ]', true), - 'empty' - ), - 'not_empty' => array( + 'empty', + ], + 'not_empty' => [ json_decode('[ { "widget": "string", @@ -397,9 +399,9 @@ class CriterionConversionTest extends ItopDataTestCase "oql": "(`Contact`.`name` != \'\')" } ]', true), - 'not_empty' - ), - ); + 'not_empty', + ], + ]; } /** @@ -414,7 +416,7 @@ class CriterionConversionTest extends ItopDataTestCase * @throws \OQLException * @throws \CoreException */ - function testOqlToSearchToOql($sOQL, $sExpectedOQL, $aExpectedCriterion) + public function testOqlToSearchToOql($sOQL, $sExpectedOQL, $aExpectedCriterion) { // For tests on tags $this->CreateTagData(TAG_CLASS, TAG_ATTCODE, 'tag1', 'First'); @@ -423,161 +425,161 @@ class CriterionConversionTest extends ItopDataTestCase $this->OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion); } - function OqlProvider() + public function OqlProvider() { - return array( - 'no criteria' => array( + return [ + 'no criteria' => [ 'OQL' => 'SELECT WebApplication', 'ExpectedOQL' => "SELECT `WebApplication` FROM WebApplication AS `WebApplication` WHERE 1", - 'ExpectedCriterion' => array(), - ), - 'string starts' => array( + 'ExpectedCriterion' => [], + ], + 'string starts' => [ 'OQL' => "SELECT Contact WHERE name LIKE 'toto%'", 'ExpectedOQL' => "SELECT `Contact` FROM Contact AS `Contact` WHERE (`Contact`.`name` LIKE 'toto%')", - 'ExpectedCriterion' => array(array('widget' => 'string', 'operator' => 'starts_with', 'values' => array(array('value' => 'toto')))), - ), - 'string ends' => array( + 'ExpectedCriterion' => [['widget' => 'string', 'operator' => 'starts_with', 'values' => [['value' => 'toto']]]], + ], + 'string ends' => [ 'OQL' => "SELECT Contact WHERE name LIKE '%toto'", 'ExpectedOQL' => "SELECT `Contact` FROM Contact AS `Contact` WHERE (`Contact`.`name` LIKE '%toto')", - 'ExpectedCriterion' => array(array('widget' => 'string', 'operator' => 'ends_with', 'values' => array(array('value' => 'toto')))), - ), - 'string contains 1' => array( + 'ExpectedCriterion' => [['widget' => 'string', 'operator' => 'ends_with', 'values' => [['value' => 'toto']]]], + ], + 'string contains 1' => [ 'OQL' => "SELECT Contact WHERE name LIKE '%toto%'", 'ExpectedOQL' => "SELECT `Contact` FROM Contact AS `Contact` WHERE (`Contact`.`name` LIKE '%toto%')", - 'ExpectedCriterion' => array(array('widget' => 'string', 'operator' => 'contains', 'values' => array(array('value' => 'toto')))), - ), - 'string contains 2' => array( + 'ExpectedCriterion' => [['widget' => 'string', 'operator' => 'contains', 'values' => [['value' => 'toto']]]], + ], + 'string contains 2' => [ 'OQL' => "SELECT Person AS B WHERE B.name LIKE '%A%'", 'ExpectedOQL' => "SELECT `B` FROM Person AS `B` WHERE (`B`.`name` LIKE '%A%')", - 'ExpectedCriterion' => array(array('widget' => 'string', 'operator' => 'contains', 'values' => array(array('value' => 'A')))), - ), - 'string NOT contains' => array( + 'ExpectedCriterion' => [['widget' => 'string', 'operator' => 'contains', 'values' => [['value' => 'A']]]], + ], + 'string NOT contains' => [ 'OQL' => "SELECT Person AS B WHERE B.name NOT LIKE '%A%'", 'ExpectedOQL' => "SELECT `B` FROM Person AS `B` WHERE (`B`.`name` NOT LIKE '%A%')", - 'ExpectedCriterion' => array(array('widget' => 'string', 'operator' => 'NOT LIKE', 'values' => array(array('value' => '%A%')))), - ), - 'string regexp' => array( + 'ExpectedCriterion' => [['widget' => 'string', 'operator' => 'NOT LIKE', 'values' => [['value' => '%A%']]]], + ], + 'string regexp' => [ 'OQL' => "SELECT Server WHERE name REGEXP '^dbserver[0-9]+\\\\\\\\..+\\\\\\\\.[a-z]{2,3}$'", 'ExpectedOQL' => "SELECT `Server` FROM Server AS `Server` WHERE (`Server`.`name` REGEXP '^dbserver[0-9]+\\\\\\\\..+\\\\\\\\.[a-z]{2,3}$')", - 'ExpectedCriterion' => array(array('widget' => 'string', 'operator' => 'REGEXP')), - ), - 'enum + key =' => array( + 'ExpectedCriterion' => [['widget' => 'string', 'operator' => 'REGEXP']], + ], + 'enum + key =' => [ 'OQL' => "SELECT Contact WHERE status = 'active' AND org_id = 3", 'ExpectedOQL' => "SELECT `Contact` FROM Contact AS `Contact` JOIN Organization AS `Organization` ON `Contact`.org_id = `Organization`.id JOIN Organization AS `Organization1` ON `Organization`.parent_id BELOW `Organization1`.id WHERE ((`Organization1`.`id` = '3') AND (`Contact`.`status` = 'active'))", - 'ExpectedCriterion' => array(array('widget' => 'hierarchical_key', 'operator' => 'IN'), array('widget' => 'enum', 'operator' => 'IN')), - ), - 'enum =' => array( + 'ExpectedCriterion' => [['widget' => 'hierarchical_key', 'operator' => 'IN'], ['widget' => 'enum', 'operator' => 'IN']], + ], + 'enum =' => [ 'OQL' => "SELECT Contact WHERE status = 'active'", 'ExpectedOQL' => "SELECT `Contact` FROM Contact AS `Contact` WHERE (`Contact`.`status` = 'active')", - 'ExpectedCriterion' => array(array('widget' => 'enum', 'operator' => 'IN', 'values' => array(array('value' => 'active')))), - ), - 'enum IN' => array( + 'ExpectedCriterion' => [['widget' => 'enum', 'operator' => 'IN', 'values' => [['value' => 'active']]]], + ], + 'enum IN' => [ 'OQL' => "SELECT Contact WHERE status IN ('active', 'inactive')", 'ExpectedOQL' => "SELECT `Contact` FROM Contact AS `Contact` WHERE 1", - 'ExpectedCriterion' => array(array('widget' => 'enum', 'operator' => 'IN', 'values' => array(array('value' => 'active'), array('value' => 'inactive')))), - ), - 'enum NOT IN 1' => array( + 'ExpectedCriterion' => [['widget' => 'enum', 'operator' => 'IN', 'values' => [['value' => 'active'], ['value' => 'inactive']]]], + ], + 'enum NOT IN 1' => [ 'OQL' => "SELECT Contact WHERE status NOT IN ('active')", 'ExpectedOQL' => "SELECT `Contact` FROM Contact AS `Contact` WHERE (`Contact`.`status` = 'inactive')", - 'ExpectedCriterion' => array(array('widget' => 'enum', 'operator' => 'IN', 'values' => array(array('value' => 'inactive')))), - ), - 'enum NOT IN 2' => array( + 'ExpectedCriterion' => [['widget' => 'enum', 'operator' => 'IN', 'values' => [['value' => 'inactive']]]], + ], + 'enum NOT IN 2' => [ 'OQL' => "SELECT Person AS p JOIN UserRequest AS u ON u.agent_id = p.id WHERE u.status != 'closed'", 'ExpectedOQL' => "SELECT `p` FROM Person AS `p` JOIN UserRequest AS `u` ON `u`.agent_id = `p`.id WHERE (`u`.`status` != 'closed')", - 'ExpectedCriterion' => array(array('widget' => 'raw')), - ), - 'enum undefined 1' => array( + 'ExpectedCriterion' => [['widget' => 'raw']], + ], + 'enum undefined 1' => [ 'OQL' => "SELECT FunctionalCI WHERE ((business_criticity = 'high') OR ISNULL(business_criticity)) AND 1", 'ExpectedOQL' => "SELECT `FunctionalCI` FROM FunctionalCI AS `FunctionalCI` WHERE (((`FunctionalCI`.`business_criticity` = 'high') OR ISNULL(`FunctionalCI`.`business_criticity`)) AND 1)", - 'ExpectedCriterion' => array(array('widget' => 'enum', 'has_undefined' => true, 'operator' => 'IN', 'values' => array(array('value' => 'high'), array('value' => 'null')))), - ), - 'enum undefined 2' => array( + 'ExpectedCriterion' => [['widget' => 'enum', 'has_undefined' => true, 'operator' => 'IN', 'values' => [['value' => 'high'], ['value' => 'null']]]], + ], + 'enum undefined 2' => [ 'OQL' => "SELECT FunctionalCI WHERE ((business_criticity IN ('high', 'medium')) OR ISNULL(business_criticity)) AND 1", 'ExpectedOQL' => "SELECT `FunctionalCI` FROM FunctionalCI AS `FunctionalCI` WHERE (((`FunctionalCI`.`business_criticity` IN ('high', 'medium')) OR ISNULL(`FunctionalCI`.`business_criticity`)) AND 1)", - 'ExpectedCriterion' => array(array('widget' => 'enum', 'has_undefined' => true, 'operator' => 'IN', 'values' => array(array('value' => 'high'), array('value' => 'medium'), array('value' => 'null')))), - ), - 'enum undefined 3' => array( + 'ExpectedCriterion' => [['widget' => 'enum', 'has_undefined' => true, 'operator' => 'IN', 'values' => [['value' => 'high'], ['value' => 'medium'], ['value' => 'null']]]], + ], + 'enum undefined 3' => [ 'OQL' => "SELECT FunctionalCI WHERE ISNULL(business_criticity)", 'ExpectedOQL' => "SELECT `FunctionalCI` FROM FunctionalCI AS `FunctionalCI` WHERE ISNULL(`FunctionalCI`.`business_criticity`)", - 'ExpectedCriterion' => array(array('widget' => 'enum', 'has_undefined' => true, 'operator' => 'IN', 'values' => array(array('value' => 'null')))), - ), - 'key NOT IN' => array( + 'ExpectedCriterion' => [['widget' => 'enum', 'has_undefined' => true, 'operator' => 'IN', 'values' => [['value' => 'null']]]], + ], + 'key NOT IN' => [ 'OQL' => "SELECT Contact WHERE org_id NOT IN ('1')", 'ExpectedOQL' => "SELECT `Contact` FROM Contact AS `Contact` WHERE (`Contact`.`org_id` NOT IN ('1'))", - 'ExpectedCriterion' => array(array('widget' => 'raw', 'operator' => 'NOT IN')), - ), - 'key IN' => array( + 'ExpectedCriterion' => [['widget' => 'raw', 'operator' => 'NOT IN']], + ], + 'key IN' => [ 'OQL' => "SELECT Contact WHERE org_id IN ('1')", 'ExpectedOQL' => "SELECT `Contact` FROM Contact AS `Contact` JOIN Organization AS `Organization` ON `Contact`.org_id = `Organization`.id JOIN Organization AS `Organization1` ON `Organization`.parent_id BELOW `Organization1`.id WHERE (`Organization1`.`id` = '1')", - 'ExpectedCriterion' => array(array('widget' => 'hierarchical_key', 'operator' => 'IN')), - ), - 'key IN 2' => array( + 'ExpectedCriterion' => [['widget' => 'hierarchical_key', 'operator' => 'IN']], + ], + 'key IN 2' => [ 'OQL' => "SELECT Contact WHERE org_id IN ('1', '999999')", 'ExpectedOQL' => "SELECT `Contact` FROM Contact AS `Contact` JOIN Organization AS `Organization` ON `Contact`.org_id = `Organization`.id JOIN Organization AS `Organization1` ON `Organization`.parent_id BELOW `Organization1`.id WHERE (`Organization1`.`id` = '1')", - 'ExpectedCriterion' => array(array('widget' => 'hierarchical_key', 'operator' => 'IN')), - ), - 'key empty' => array( + 'ExpectedCriterion' => [['widget' => 'hierarchical_key', 'operator' => 'IN']], + ], + 'key empty' => [ 'OQL' => "SELECT Person WHERE location_id = '0'", 'ExpectedOQL' => "SELECT `Person` FROM Person AS `Person` WHERE (`Person`.`location_id` = '0')", - 'ExpectedCriterion' => array(array('widget' => 'external_key', 'operator' => 'IN', 'values' => array(array('value' => '0')))), - ), - 'Double field' => array( + 'ExpectedCriterion' => [['widget' => 'external_key', 'operator' => 'IN', 'values' => [['value' => '0']]]], + ], + 'Double field' => [ 'OQL' => "SELECT UserRequest AS u WHERE u.close_date > u.start_date", 'ExpectedOQL' => "SELECT `u` FROM UserRequest AS `u` WHERE (`u`.`close_date` > `u`.`start_date`)", - 'ExpectedCriterion' => array(array('widget' => 'raw')), - ), - 'Num between 1' => array( + 'ExpectedCriterion' => [['widget' => 'raw']], + ], + 'Num between 1' => [ 'OQL' => "SELECT Server WHERE nb_u >= 0 AND 1 >= nb_u", 'ExpectedOQL' => "SELECT `Server` FROM Server AS `Server` WHERE ((`Server`.`nb_u` >= '0') AND (`Server`.`nb_u` <= '1'))", - 'ExpectedCriterion' => array(array('widget' => 'numeric', 'operator' => 'between')), - ), - 'Num ISNULL' => array( + 'ExpectedCriterion' => [['widget' => 'numeric', 'operator' => 'between']], + ], + 'Num ISNULL' => [ 'OQL' => "SELECT Server WHERE ISNULL(nb_u)", 'ExpectedOQL' => "SELECT `Server` FROM Server AS `Server` WHERE ISNULL(`Server`.`nb_u`)", - 'ExpectedCriterion' => array(array('widget' => 'numeric', 'operator' => 'empty')), - ), - 'Hierarchical below 1' => array( + 'ExpectedCriterion' => [['widget' => 'numeric', 'operator' => 'empty']], + ], + 'Hierarchical below 1' => [ 'OQL' => "SELECT Person AS P JOIN Organization AS Node ON P.org_id = Node.id JOIN Organization AS Root ON Node.parent_id BELOW Root.id WHERE Root.id=1", 'ExpectedOQL' => "SELECT `P` FROM Person AS `P` JOIN Organization AS `Node` ON `P`.org_id = `Node`.id JOIN Organization AS `Root` ON `Node`.parent_id BELOW `Root`.id WHERE (`Root`.`id` = '1')", - 'ExpectedCriterion' => array(array('widget' => 'hierarchical_key')), - ), - 'Hierarchical below 2' => array( + 'ExpectedCriterion' => [['widget' => 'hierarchical_key']], + ], + 'Hierarchical below 2' => [ 'OQL' => "SELECT `Organization` FROM Organization AS `Organization` JOIN Organization AS `Organization1` ON `Organization`.parent_id = `Organization1`.id JOIN Organization AS `Organization11` ON `Organization1`.parent_id BELOW `Organization11`.id WHERE (((`Organization11`.`id` IN ('1', '2')) OR (`Organization`.`parent_id` = '0')) AND 1)", 'ExpectedOQL' => "SELECT `Organization` FROM Organization AS `Organization` JOIN Organization AS `Organization1` ON `Organization`.parent_id = `Organization1`.id JOIN Organization AS `Organization11` ON `Organization1`.parent_id BELOW `Organization11`.id WHERE (((`Organization11`.`id` IN ('1', '2')) OR (`Organization`.`parent_id` = '0')) AND 1)", - 'ExpectedCriterion' => array(array('widget' => 'hierarchical_key')), - ), - 'IP range' => array( + 'ExpectedCriterion' => [['widget' => 'hierarchical_key']], + ], + 'IP range' => [ 'OQL' => "SELECT DatacenterDevice AS dev WHERE INET_ATON(dev.managementip) > INET_ATON('10.22.32.224') AND INET_ATON(dev.managementip) < INET_ATON('10.22.32.255')", 'ExpectedOQL' => "SELECT `dev` FROM DatacenterDevice AS `dev` WHERE ((INET_ATON(`dev`.`managementip`) < INET_ATON('10.22.32.255')) AND (INET_ATON(`dev`.`managementip`) > INET_ATON('10.22.32.224')))", - 'ExpectedCriterion' => array(array('widget' => 'raw')), - ), - 'TagSet Matches' => array( + 'ExpectedCriterion' => [['widget' => 'raw']], + ], + 'TagSet Matches' => [ 'OQL' => "SELECT ".TAG_CLASS." WHERE ".TAG_ATTCODE." MATCHES 'tag1'", 'ExpectedOQL' => "SELECT `".TAG_CLASS."` FROM ".TAG_CLASS." AS `".TAG_CLASS."` WHERE `".TAG_CLASS."`.`".TAG_ATTCODE.'` MATCHES \'tag1 _\'', - 'ExpectedCriterion' => array(array('widget' => 'tag_set')), - ), - 'TagSet Matches2' => array( + 'ExpectedCriterion' => [['widget' => 'tag_set']], + ], + 'TagSet Matches2' => [ 'OQL' => "SELECT ".TAG_CLASS." WHERE ".TAG_ATTCODE." MATCHES 'tag1 tag2'", 'ExpectedOQL' => "SELECT `".TAG_CLASS."` FROM ".TAG_CLASS." AS `".TAG_CLASS."` WHERE `".TAG_CLASS."`.`".TAG_ATTCODE.'` MATCHES \'tag1 tag2 _\'', - 'ExpectedCriterion' => array(array('widget' => 'tag_set')), - ), - 'TagSet Undefined' => array( + 'ExpectedCriterion' => [['widget' => 'tag_set']], + ], + 'TagSet Undefined' => [ 'OQL' => "SELECT ".TAG_CLASS." WHERE ".TAG_ATTCODE." = ''", 'ExpectedOQL' => "SELECT `".TAG_CLASS."` FROM ".TAG_CLASS." AS `".TAG_CLASS."` WHERE (`".TAG_CLASS."`.`".TAG_ATTCODE."` = '')", - 'ExpectedCriterion' => array(array('widget' => 'tag_set')), - ), - 'TagSet Undefined and tag' => array( + 'ExpectedCriterion' => [['widget' => 'tag_set']], + ], + 'TagSet Undefined and tag' => [ 'OQL' => "SELECT ".TAG_CLASS." WHERE (((".TAG_ATTCODE." MATCHES 'tag1 tag2') OR (".TAG_ATTCODE." = '')) AND 1)", 'ExpectedOQL' => "SELECT `".TAG_CLASS."` FROM ".TAG_CLASS." AS `".TAG_CLASS."` WHERE ((`".TAG_CLASS."`.`".TAG_ATTCODE.'` MATCHES \'tag1 tag2 _\' OR (`'.TAG_CLASS."`.`".TAG_ATTCODE."` = '')) AND 1)", - 'ExpectedCriterion' => array(array('widget' => 'tag_set')), - ), - 'TagSet equals' => array( + 'ExpectedCriterion' => [['widget' => 'tag_set']], + ], + 'TagSet equals' => [ 'OQL' => "SELECT ".TAG_CLASS." WHERE ".TAG_ATTCODE." = 'tag1 tag2'", 'ExpectedOQL' => "SELECT `".TAG_CLASS."` FROM ".TAG_CLASS." AS `".TAG_CLASS."` WHERE (`".TAG_CLASS."`.`".TAG_ATTCODE.'` MATCHES \'tag1 _\' AND `'.TAG_CLASS."`.`".TAG_ATTCODE.'` MATCHES \'tag2 _\')', - 'ExpectedCriterion' => array(array('widget' => 'tag_set')), - ), + 'ExpectedCriterion' => [['widget' => 'tag_set']], + ], - ); + ]; } /** @@ -592,87 +594,87 @@ class CriterionConversionTest extends ItopDataTestCase * @throws \OQLException * @throws \CoreException */ - function testOqlToForSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion) - { - \MetaModel::GetConfig()->Set('date_and_time_format', array('default' => array('date' => 'Y-m-d', 'time' => 'H:i:s', 'date_time' => '$date $time'))); - $this->OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion); - } - function OqlProviderDates() - { - return array( + public function testOqlToForSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion) + { + \MetaModel::GetConfig()->Set('date_and_time_format', ['default' => ['date' => 'Y-m-d', 'time' => 'H:i:s', 'date_time' => '$date $time']]); + $this->OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion); + } + public function OqlProviderDates() + { + return [ - 'Date relative 1' => array( - 'OQL' => "SELECT UserRequest WHERE DATE_SUB(NOW(), INTERVAL 14 DAY) < start_date", - 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (DATE_SUB(NOW(), INTERVAL 14 DAY) < `UserRequest`.`start_date`)", - 'ExpectedCriterion' => array(array('widget' => 'raw')), - ), - 'Date relative 2' => array( - 'OQL' => "SELECT Contract AS c WHERE c.end_date > NOW() AND c.end_date < DATE_ADD(NOW(), INTERVAL 30 DAY)", - 'ExpectedOQL' => "SELECT `c` FROM Contract AS `c` WHERE ((`c`.`end_date` < DATE_ADD(NOW(), INTERVAL 30 DAY)) AND (`c`.`end_date` > NOW()))", - 'ExpectedCriterion' => array(array('widget' => 'raw'), array('widget' => 'raw')), - ), - 'Date relative 3' => array( - 'OQL' => "SELECT UserRequest AS u WHERE u.close_date > DATE_ADD(u.start_date, INTERVAL 8 HOUR)", - 'ExpectedOQL' => "SELECT `u` FROM UserRequest AS `u` WHERE (`u`.`close_date` > DATE_ADD(`u`.`start_date`, INTERVAL 8 HOUR))", - 'ExpectedCriterion' => array(), - ), - 'Date relative 4' => array( - 'OQL' => "SELECT UserRequest AS u WHERE u.start_date < DATE_SUB(NOW(), INTERVAL 60 MINUTE) AND u.status = 'new'", - 'ExpectedOQL' => "SELECT `u` FROM UserRequest AS `u` WHERE ((`u`.`start_date` < DATE_SUB(NOW(), INTERVAL 60 MINUTE)) AND (`u`.`status` = 'new'))", - 'ExpectedCriterion' => array(array('widget' => 'raw')), - ), - 'Date between 1' => array( - 'OQL' => "SELECT UserRequest WHERE start_date > '2017-01-01 00:00:00' AND '2018-01-01 00:00:00' >= start_date", - 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`start_date` >= '2017-01-01 00:00:01') AND (`UserRequest`.`start_date` <= '2018-01-01 00:00:00'))", - 'ExpectedCriterion' => array(array('widget' => 'date_time', 'operator' => 'between_dates')), - ), - 'Date between 2' => array( - 'OQL' => "SELECT UserRequest WHERE start_date > '2017-01-01 00:00:00' AND status = 'active' AND org_id = 3 AND '2018-01-01 00:00:00' >= start_date", - 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Organization AS `Organization` ON `UserRequest`.org_id = `Organization`.id JOIN Organization AS `Organization1` ON `Organization`.parent_id BELOW `Organization1`.id WHERE ((((`Organization1`.`id` = '3') AND (`UserRequest`.`start_date` >= '2017-01-01 00:00:01')) AND (`UserRequest`.`start_date` <= '2018-01-01 00:00:00')) AND (`UserRequest`.`status` = 'active'))", - 'ExpectedCriterion' => array(array('widget' => 'hierarchical_key', 'operator' => 'IN'), array('widget' => 'date_time', 'operator' => 'between_dates'), array('widget' => 'enum', 'operator' => 'IN')), - ), - 'Date between 3' => array( - 'OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-01 00:00:00' >= start_date", - 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`start_date` >= '2017-01-01 00:00:00') AND (`UserRequest`.`start_date` <= '2017-01-01 00:00:00'))", - 'ExpectedCriterion' => array(array('widget' => 'date_time', 'operator' => 'between_dates')), - ), - 'Date between 4' => array( - 'OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-01 01:00:00' > start_date", - 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`start_date` >= '2017-01-01 00:00:00') AND (`UserRequest`.`start_date` <= '2017-01-01 00:59:59'))", - 'ExpectedCriterion' => array(array('widget' => 'date_time', 'operator' => 'between_dates')), - ), - 'Date between 5' => array( - 'OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-02 00:00:00' > start_date", - 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`start_date` >= '2017-01-01 00:00:00') AND (`UserRequest`.`start_date` <= '2017-01-01 23:59:59'))", - 'ExpectedCriterion' => array(array('widget' => 'date_time', 'operator' => 'between_dates')), - ), - 'Date between 6' => array( - 'OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01' AND '2017-01-02' >= start_date", - 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`start_date` >= '2017-01-01 00:00:00') AND (`UserRequest`.`start_date` <= '2017-01-02 00:00:00'))", - 'ExpectedCriterion' => array(array('widget' => 'date_time', 'operator' => 'between_dates')), - ), - 'Date between 7' => array( - 'OQL' => "SELECT CustomerContract WHERE ((start_date >= '2018-03-01') AND (start_date < '2018-04-01'))", - 'ExpectedOQL' => "SELECT `CustomerContract` FROM CustomerContract AS `CustomerContract` WHERE ((`CustomerContract`.`start_date` >= '2018-03-01') AND (`CustomerContract`.`start_date` <= '2018-03-31'))", - 'ExpectedCriterion' => array(array('widget' => 'date', 'operator' => 'between_dates')), - ), - 'Date =' => array( - 'OQL' => "SELECT CustomerContract WHERE (start_date = '2018-03-01')", - 'ExpectedOQL' => "SELECT `CustomerContract` FROM CustomerContract AS `CustomerContract` WHERE ((`CustomerContract`.`start_date` >= '2018-03-01') AND (`CustomerContract`.`start_date` <= '2018-03-01'))", - 'ExpectedCriterion' => array(array('widget' => 'date', 'operator' => 'between_dates')), - ), - 'Date =2' => array( - 'OQL' => "SELECT UserRequest WHERE (DATE_FORMAT(start_date, '%Y-%m-%d') = '2018-03-21')", - 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`start_date` >= '2018-03-21 00:00:00') AND (`UserRequest`.`start_date` <= '2018-03-21 23:59:59'))", - 'ExpectedCriterion' => array(array('widget' => 'date_time', 'operator' => 'between_dates')), - ), - 'Date =3' => array( - 'OQL' => "SELECT UserRequest WHERE (DATE_FORMAT(`UserRequest`.`start_date`, '%w') = '4')", - 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (DATE_FORMAT(`UserRequest`.`start_date`, '%w') = '4')", - 'ExpectedCriterion' => array(array('widget' => 'raw')), - ), - ); - } + 'Date relative 1' => [ + 'OQL' => "SELECT UserRequest WHERE DATE_SUB(NOW(), INTERVAL 14 DAY) < start_date", + 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (DATE_SUB(NOW(), INTERVAL 14 DAY) < `UserRequest`.`start_date`)", + 'ExpectedCriterion' => [['widget' => 'raw']], + ], + 'Date relative 2' => [ + 'OQL' => "SELECT Contract AS c WHERE c.end_date > NOW() AND c.end_date < DATE_ADD(NOW(), INTERVAL 30 DAY)", + 'ExpectedOQL' => "SELECT `c` FROM Contract AS `c` WHERE ((`c`.`end_date` < DATE_ADD(NOW(), INTERVAL 30 DAY)) AND (`c`.`end_date` > NOW()))", + 'ExpectedCriterion' => [['widget' => 'raw'], ['widget' => 'raw']], + ], + 'Date relative 3' => [ + 'OQL' => "SELECT UserRequest AS u WHERE u.close_date > DATE_ADD(u.start_date, INTERVAL 8 HOUR)", + 'ExpectedOQL' => "SELECT `u` FROM UserRequest AS `u` WHERE (`u`.`close_date` > DATE_ADD(`u`.`start_date`, INTERVAL 8 HOUR))", + 'ExpectedCriterion' => [], + ], + 'Date relative 4' => [ + 'OQL' => "SELECT UserRequest AS u WHERE u.start_date < DATE_SUB(NOW(), INTERVAL 60 MINUTE) AND u.status = 'new'", + 'ExpectedOQL' => "SELECT `u` FROM UserRequest AS `u` WHERE ((`u`.`start_date` < DATE_SUB(NOW(), INTERVAL 60 MINUTE)) AND (`u`.`status` = 'new'))", + 'ExpectedCriterion' => [['widget' => 'raw']], + ], + 'Date between 1' => [ + 'OQL' => "SELECT UserRequest WHERE start_date > '2017-01-01 00:00:00' AND '2018-01-01 00:00:00' >= start_date", + 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`start_date` >= '2017-01-01 00:00:01') AND (`UserRequest`.`start_date` <= '2018-01-01 00:00:00'))", + 'ExpectedCriterion' => [['widget' => 'date_time', 'operator' => 'between_dates']], + ], + 'Date between 2' => [ + 'OQL' => "SELECT UserRequest WHERE start_date > '2017-01-01 00:00:00' AND status = 'active' AND org_id = 3 AND '2018-01-01 00:00:00' >= start_date", + 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Organization AS `Organization` ON `UserRequest`.org_id = `Organization`.id JOIN Organization AS `Organization1` ON `Organization`.parent_id BELOW `Organization1`.id WHERE ((((`Organization1`.`id` = '3') AND (`UserRequest`.`start_date` >= '2017-01-01 00:00:01')) AND (`UserRequest`.`start_date` <= '2018-01-01 00:00:00')) AND (`UserRequest`.`status` = 'active'))", + 'ExpectedCriterion' => [['widget' => 'hierarchical_key', 'operator' => 'IN'], ['widget' => 'date_time', 'operator' => 'between_dates'], ['widget' => 'enum', 'operator' => 'IN']], + ], + 'Date between 3' => [ + 'OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-01 00:00:00' >= start_date", + 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`start_date` >= '2017-01-01 00:00:00') AND (`UserRequest`.`start_date` <= '2017-01-01 00:00:00'))", + 'ExpectedCriterion' => [['widget' => 'date_time', 'operator' => 'between_dates']], + ], + 'Date between 4' => [ + 'OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-01 01:00:00' > start_date", + 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`start_date` >= '2017-01-01 00:00:00') AND (`UserRequest`.`start_date` <= '2017-01-01 00:59:59'))", + 'ExpectedCriterion' => [['widget' => 'date_time', 'operator' => 'between_dates']], + ], + 'Date between 5' => [ + 'OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-02 00:00:00' > start_date", + 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`start_date` >= '2017-01-01 00:00:00') AND (`UserRequest`.`start_date` <= '2017-01-01 23:59:59'))", + 'ExpectedCriterion' => [['widget' => 'date_time', 'operator' => 'between_dates']], + ], + 'Date between 6' => [ + 'OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01' AND '2017-01-02' >= start_date", + 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`start_date` >= '2017-01-01 00:00:00') AND (`UserRequest`.`start_date` <= '2017-01-02 00:00:00'))", + 'ExpectedCriterion' => [['widget' => 'date_time', 'operator' => 'between_dates']], + ], + 'Date between 7' => [ + 'OQL' => "SELECT CustomerContract WHERE ((start_date >= '2018-03-01') AND (start_date < '2018-04-01'))", + 'ExpectedOQL' => "SELECT `CustomerContract` FROM CustomerContract AS `CustomerContract` WHERE ((`CustomerContract`.`start_date` >= '2018-03-01') AND (`CustomerContract`.`start_date` <= '2018-03-31'))", + 'ExpectedCriterion' => [['widget' => 'date', 'operator' => 'between_dates']], + ], + 'Date =' => [ + 'OQL' => "SELECT CustomerContract WHERE (start_date = '2018-03-01')", + 'ExpectedOQL' => "SELECT `CustomerContract` FROM CustomerContract AS `CustomerContract` WHERE ((`CustomerContract`.`start_date` >= '2018-03-01') AND (`CustomerContract`.`start_date` <= '2018-03-01'))", + 'ExpectedCriterion' => [['widget' => 'date', 'operator' => 'between_dates']], + ], + 'Date =2' => [ + 'OQL' => "SELECT UserRequest WHERE (DATE_FORMAT(start_date, '%Y-%m-%d') = '2018-03-21')", + 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE ((`UserRequest`.`start_date` >= '2018-03-21 00:00:00') AND (`UserRequest`.`start_date` <= '2018-03-21 23:59:59'))", + 'ExpectedCriterion' => [['widget' => 'date_time', 'operator' => 'between_dates']], + ], + 'Date =3' => [ + 'OQL' => "SELECT UserRequest WHERE (DATE_FORMAT(`UserRequest`.`start_date`, '%w') = '4')", + 'ExpectedOQL' => "SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (DATE_FORMAT(`UserRequest`.`start_date`, '%w') = '4')", + 'ExpectedCriterion' => [['widget' => 'raw']], + ], + ]; + } /** * @@ -685,98 +687,80 @@ class CriterionConversionTest extends ItopDataTestCase * @throws \MissingQueryArgument * @throws \OQLException */ - function OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion) - { - $this->debug($sOQL); - - $oSearchForm = new SearchForm(); - $oSearch = DBSearch::FromOQL($sOQL); - $aFields = $oSearchForm->GetFields(new DBObjectSet($oSearch)); - /** @var \DBObjectSearch $oSearch */ - $aCriterion = $oSearchForm->GetCriterion($oSearch, $aFields); - - $aAndCriterion = $aCriterion['or'][0]['and']; - - $aNewCriterion = array(); - foreach($aAndCriterion as $aCriteria) - { - if ($aCriteria['widget'] != AttributeDefinition::SEARCH_WIDGET_TYPE_RAW) - { - unset($aCriteria['oql']); - foreach($aFields as $aCatFields) - { - if (isset($aCatFields[$aCriteria['ref']])) - { - $aField = $aCatFields[$aCriteria['ref']]; - break; - } - } - if (isset($aField)) - { - $aCriteria['code'] = $aField['code']; - $aCriteria['class'] = $aField['class']; - } - } - - if ($aCriteria['widget'] == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE_TIME || $aCriteria['widget'] == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE) - { - $sAttributeClass = ($aCriteria['widget'] == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE_TIME) ? AttributeDateTime::class : AttributeDate::class; - - /** @var \AttributeDateTime $sAttributeClass */ - /** @var \DateTimeFormat $oFormat */ - $oFormat = $sAttributeClass::GetFormat(); - - foreach($aCriteria['values'] as $i => $aValue) - { - if (!empty($aValue['value'])) { - $aCriteria['values'][$i]['value'] = $oFormat->Format($aValue['value']); - } - } - } - - $aNewCriterion[] = $aCriteria; - } - $this->debug($aNewCriterion); - - $this->assertFalse($this->array_diff_assoc_recursive($aExpectedCriterion, $aNewCriterion), 'Criterion array contains critical parts'); - - $aCriterion['or'][0]['and'] = $aNewCriterion; - - $oSearch->ResetCondition(); - $oFilter = CriterionParser::Parse($oSearch->ToOQL(), $aCriterion); - - $sResultOQL = $oFilter->ToOQL(); - $this->debug($sResultOQL); - - $this->assertEquals($sExpectedOQL, $sResultOQL); - } - - - function array_diff_assoc_recursive($array1, $array2) + public function OqlToSearchToOqlAltLanguage($sOQL, $sExpectedOQL, $aExpectedCriterion) { - foreach($array1 as $key => $value) - { - if (is_array($value)) - { - if (!isset($array2[$key])) - { - $difference[$key] = $value; + $this->debug($sOQL); + + $oSearchForm = new SearchForm(); + $oSearch = DBSearch::FromOQL($sOQL); + $aFields = $oSearchForm->GetFields(new DBObjectSet($oSearch)); + /** @var \DBObjectSearch $oSearch */ + $aCriterion = $oSearchForm->GetCriterion($oSearch, $aFields); + + $aAndCriterion = $aCriterion['or'][0]['and']; + + $aNewCriterion = []; + foreach ($aAndCriterion as $aCriteria) { + if ($aCriteria['widget'] != AttributeDefinition::SEARCH_WIDGET_TYPE_RAW) { + unset($aCriteria['oql']); + foreach ($aFields as $aCatFields) { + if (isset($aCatFields[$aCriteria['ref']])) { + $aField = $aCatFields[$aCriteria['ref']]; + break; + } } - elseif (!is_array($array2[$key])) - { - $difference[$key] = $value; + if (isset($aField)) { + $aCriteria['code'] = $aField['code']; + $aCriteria['class'] = $aField['class']; } - else - { - $new_diff = $this->array_diff_assoc_recursive($value, $array2[$key]); - if ($new_diff !== false) - { - $difference[$key] = $new_diff; + } + + if ($aCriteria['widget'] == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE_TIME || $aCriteria['widget'] == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE) { + $sAttributeClass = ($aCriteria['widget'] == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE_TIME) ? AttributeDateTime::class : AttributeDate::class; + + /** @var \AttributeDateTime $sAttributeClass */ + /** @var \DateTimeFormat $oFormat */ + $oFormat = $sAttributeClass::GetFormat(); + + foreach ($aCriteria['values'] as $i => $aValue) { + if (!empty($aValue['value'])) { + $aCriteria['values'][$i]['value'] = $oFormat->Format($aValue['value']); } } } - elseif (!array_key_exists($key, $array2) || $array2[$key] != $value) - { + + $aNewCriterion[] = $aCriteria; + } + $this->debug($aNewCriterion); + + $this->assertFalse($this->array_diff_assoc_recursive($aExpectedCriterion, $aNewCriterion), 'Criterion array contains critical parts'); + + $aCriterion['or'][0]['and'] = $aNewCriterion; + + $oSearch->ResetCondition(); + $oFilter = CriterionParser::Parse($oSearch->ToOQL(), $aCriterion); + + $sResultOQL = $oFilter->ToOQL(); + $this->debug($sResultOQL); + + $this->assertEquals($sExpectedOQL, $sResultOQL); + } + + public function array_diff_assoc_recursive($array1, $array2) + { + foreach ($array1 as $key => $value) { + if (is_array($value)) { + if (!isset($array2[$key])) { + $difference[$key] = $value; + } elseif (!is_array($array2[$key])) { + $difference[$key] = $value; + } else { + $new_diff = $this->array_diff_assoc_recursive($value, $array2[$key]); + if ($new_diff !== false) { + $difference[$key] = $new_diff; + } + } + } elseif (!array_key_exists($key, $array2) || $array2[$key] != $value) { $difference[$key] = $value; } } diff --git a/tests/php-unit-tests/unitary-tests/sources/Application/Search/CriterionParserTest.php b/tests/php-unit-tests/unitary-tests/sources/Application/Search/CriterionParserTest.php index 0861fcb43..1d27c8cf3 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Application/Search/CriterionParserTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Application/Search/CriterionParserTest.php @@ -1,4 +1,5 @@ GetFields(new \DBObjectSet($oSearch)); /** @var DBObjectSearch $oSearch */ $aCriterion = $oSearchForm->GetCriterion($oSearch, $aFields); - } catch (\OQLException $e) - { + } catch (\OQLException $e) { $this->assertTrue(false); return; } - $aRes = array('base_oql' => $sOQL, 'criterion' => $aCriterion); + $aRes = ['base_oql' => $sOQL, 'criterion' => $aCriterion]; $this->debug(json_encode($aRes)); $this->debug($sOQL); $this->debug(json_encode($aCriterion, JSON_PRETTY_PRINT)); @@ -96,27 +93,27 @@ class SearchFormTest extends ItopDataTestCase public function GetCriterionProvider() { - return array( - array('OQL' => "SELECT Contact", 1), - array('OQL' => "SELECT Contact WHERE status = 'active'", 1), - array('OQL' => "SELECT Contact AS C WHERE C.status = 'active'", 1), - array('OQL' => "SELECT Contact WHERE status = 'active' AND name LIKE 'toto%'", 1), - array('OQL' => "SELECT Contact WHERE status = 'active' AND org_id = 3", 1), - array('OQL' => "SELECT Contact WHERE status IN ('active', 'inactive')", 1), - array('OQL' => "SELECT Contact WHERE status NOT IN ('active')", 1), - array('OQL' => "SELECT Contact WHERE status NOT IN ('active', 'inactive')", 1), - array('OQL' => "SELECT Contact WHERE status = 'active' OR name LIKE 'toto%'", 2), - array('OQL' => "SELECT UserRequest WHERE DATE_SUB(NOW(), INTERVAL 14 DAY) < start_date", 1), - array('OQL' => "SELECT UserRequest WHERE start_date > '2017-01-01 00:00:00' AND '2018-01-01 00:00:00' >= start_date", 1), - array('OQL' => "SELECT UserRequest WHERE start_date > '2017-01-01 00:00:00' AND status = 'active' AND org_id = 3 AND '2018-01-01 00:00:00' >= start_date", 1), - array('OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-01 00:00:00' >= start_date", 1), - array('OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-01 01:00:00' > start_date", 1), - array('OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-02 00:00:00' > start_date", 1), - array( + return [ + ['OQL' => "SELECT Contact", 1], + ['OQL' => "SELECT Contact WHERE status = 'active'", 1], + ['OQL' => "SELECT Contact AS C WHERE C.status = 'active'", 1], + ['OQL' => "SELECT Contact WHERE status = 'active' AND name LIKE 'toto%'", 1], + ['OQL' => "SELECT Contact WHERE status = 'active' AND org_id = 3", 1], + ['OQL' => "SELECT Contact WHERE status IN ('active', 'inactive')", 1], + ['OQL' => "SELECT Contact WHERE status NOT IN ('active')", 1], + ['OQL' => "SELECT Contact WHERE status NOT IN ('active', 'inactive')", 1], + ['OQL' => "SELECT Contact WHERE status = 'active' OR name LIKE 'toto%'", 2], + ['OQL' => "SELECT UserRequest WHERE DATE_SUB(NOW(), INTERVAL 14 DAY) < start_date", 1], + ['OQL' => "SELECT UserRequest WHERE start_date > '2017-01-01 00:00:00' AND '2018-01-01 00:00:00' >= start_date", 1], + ['OQL' => "SELECT UserRequest WHERE start_date > '2017-01-01 00:00:00' AND status = 'active' AND org_id = 3 AND '2018-01-01 00:00:00' >= start_date", 1], + ['OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-01 00:00:00' >= start_date", 1], + ['OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-01 01:00:00' > start_date", 1], + ['OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-02 00:00:00' > start_date", 1], + [ 'OQL' => "SELECT FunctionalCI WHERE ((business_criticity IN ('high', 'medium')) OR ISNULL(business_criticity)) AND 1", - 1 - ), + 1, + ], - ); + ]; } } diff --git a/tests/php-unit-tests/unitary-tests/sources/Application/Status/StatusIncTest.php b/tests/php-unit-tests/unitary-tests/sources/Application/Status/StatusIncTest.php index 7250111e6..1b9195567 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Application/Status/StatusIncTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Application/Status/StatusIncTest.php @@ -1,27 +1,27 @@ RequireOnceItopFile('sources/Application/Status/Status.php'); } - public function testStatusGetAppRootWrongPath() { + public function testStatusGetAppRootWrongPath() + { $this->expectException(Exception::class); $sAppRootFilenamewrong = 'approot.inc.php_wrong'; $oStatus = new Status(); $this->InvokeNonPublicMethod(Status::class, "StatusGetAppRoot", $oStatus, [$sAppRootFilenamewrong]); - } + } - /** - * - */ - public function testStatusGetAppRootGood() { - $oStatus = new Status(); - $this->InvokeNonPublicMethod(Status::class, "StatusGetAppRoot", $oStatus, []); + /** + * + */ + public function testStatusGetAppRootGood() + { + $oStatus = new Status(); + $this->InvokeNonPublicMethod(Status::class, "StatusGetAppRoot", $oStatus, []); - $this->assertNotEmpty(APPROOT); - } + $this->assertNotEmpty(APPROOT); + } - public function testStatusCheckConfigFileWrongPath() { + public function testStatusCheckConfigFileWrongPath() + { $this->expectException(Exception::class); $sConfigFilenamewrong = 'config-itop.php_wrong'; - $oStatus = new Status(); - $this->InvokeNonPublicMethod(Status::class, "StatusCheckConfigFile", $oStatus, [$sConfigFilenamewrong]); - } + $oStatus = new Status(); + $this->InvokeNonPublicMethod(Status::class, "StatusCheckConfigFile", $oStatus, [$sConfigFilenamewrong]); + } - public function testStatusCheckConfigFileGood() { - $oStatus = new Status(); - $this->InvokeNonPublicMethod(Status::class, "StatusCheckConfigFile", $oStatus, []); + public function testStatusCheckConfigFileGood() + { + $oStatus = new Status(); + $this->InvokeNonPublicMethod(Status::class, "StatusCheckConfigFile", $oStatus, []); - $this->assertTrue(true); - } + $this->assertTrue(true); + } - /** - * @runInSeparateProcess Required because Status constructor invokes MetaModel::Startup... which does nothing when already loaded - */ + /** + * @runInSeparateProcess Required because Status constructor invokes MetaModel::Startup... which does nothing when already loaded + */ public function testStatusStartupWrongDbPwd() - { - $this->RequireOnceItopFile('core/cmdbobject.class.inc.php'); - $this->RequireOnceItopFile('application/utils.inc.php'); - $this->RequireOnceItopFile('core/contexttag.class.inc.php'); + { + $this->RequireOnceItopFile('core/cmdbobject.class.inc.php'); + $this->RequireOnceItopFile('application/utils.inc.php'); + $this->RequireOnceItopFile('core/contexttag.class.inc.php'); - $oConfigWrong = new Config(ITOP_DEFAULT_CONFIG_FILE); - $oConfigWrong->Set('db_pwd', $oConfigWrong->Get('db_pwd').'_unittest'); - $this->expectException(MySQLException::class); - new Status($oConfigWrong); - } + $oConfigWrong = new Config(ITOP_DEFAULT_CONFIG_FILE); + $oConfigWrong->Set('db_pwd', $oConfigWrong->Get('db_pwd').'_unittest'); + $this->expectException(MySQLException::class); + new Status($oConfigWrong); + } - public function testStatusStartupGood() { - $oStatus = new Status(); - $this->InvokeNonPublicMethod(Status::class, "StatusStartup", $oStatus, []); + public function testStatusStartupGood() + { + $oStatus = new Status(); + $this->InvokeNonPublicMethod(Status::class, "StatusStartup", $oStatus, []); - $this->assertTrue(true); - } + $this->assertTrue(true); + } } diff --git a/tests/php-unit-tests/unitary-tests/sources/Application/Status/StatusTest.php b/tests/php-unit-tests/unitary-tests/sources/Application/Status/StatusTest.php index a91bc4aa2..a9fb4d78e 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Application/Status/StatusTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Application/Status/StatusTest.php @@ -28,7 +28,7 @@ class StatusTest extends ItopTestCase $sPath = APPROOT.'/webservices/status.php'; $sPHP = $this->GetPHPCommand(); -echo "About to execute: $sPHP $sPath\n"; + echo "About to execute: $sPHP $sPath\n"; exec("$sPHP $sPath", $aOutput, $iRet); $this->assertEquals(0, $iRet, "Problem executing status page: $sPath, $iRet, aOutput:\n".var_export($aOutput, true)); diff --git a/tests/php-unit-tests/unitary-tests/sources/Application/Status/status.php b/tests/php-unit-tests/unitary-tests/sources/Application/Status/status.php index a97e2627c..9064f92ba 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Application/Status/status.php +++ b/tests/php-unit-tests/unitary-tests/sources/Application/Status/status.php @@ -5,21 +5,18 @@ require_once __DIR__.'/../../../../../../sources/application/status/Status.php'; // Do check Status -try -{ - \Combodo\iTop\Application\Status\StatusStartup(); - $aResult = array('status' => STATUS_RUNNING, 'code' => \RestResult::OK, 'message' => ''); -} -catch (\Exception $e) -{ - $iCode = (defined('\RestResult::INTERNAL_ERROR')) ? \RestResult::INTERNAL_ERROR : 100; - $aResult = array('status' => STATUS_ERROR, 'code' => $iCode, 'message' => $e->getMessage()); - http_response_code(500); +try { + \Combodo\iTop\Application\Status\StatusStartup(); + $aResult = ['status' => STATUS_RUNNING, 'code' => \RestResult::OK, 'message' => '']; +} catch (\Exception $e) { + $iCode = (defined('\RestResult::INTERNAL_ERROR')) ? \RestResult::INTERNAL_ERROR : 100; + $aResult = ['status' => STATUS_ERROR, 'code' => $iCode, 'message' => $e->getMessage()]; + http_response_code(500); } //Set headers, based on webservices/rest.php $sContentType = 'application/json'; -header('Content-type: ' . $sContentType); +header('Content-type: '.$sContentType); header('Access-Control-Allow-Origin: *'); //Output result diff --git a/tests/php-unit-tests/unitary-tests/sources/Application/TestAutoload.php b/tests/php-unit-tests/unitary-tests/sources/Application/TestAutoload.php index eb5d31248..d23bd57fc 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Application/TestAutoload.php +++ b/tests/php-unit-tests/unitary-tests/sources/Application/TestAutoload.php @@ -1,4 +1,5 @@ getFilters(); - foreach ($aFilters as $oFilter) - { + foreach ($aFilters as $oFilter) { $oTwig->addFilter($oFilter); } $aFunctions = $oAppExtension->getFunctions(); - foreach ($aFunctions as $oFunction) - { + foreach ($aFunctions as $oFunction) { $oTwig->addFunction($oFunction); } @@ -46,7 +44,7 @@ class TwigTest extends ItopDataTestCase public static function TemplateProvider() { - $aReturn = array(); + $aReturn = []; $aReturn['filter_system'] = [ 'sFileName' => 'test.html', 'expected' => file_get_contents(__DIR__.'/test.html'), @@ -54,4 +52,4 @@ class TwigTest extends ItopDataTestCase return $aReturn; } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/sources/Application/WebPage/WebPageMock.php b/tests/php-unit-tests/unitary-tests/sources/Application/WebPage/WebPageMock.php index 659d41a02..8f2946e0b 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Application/WebPage/WebPageMock.php +++ b/tests/php-unit-tests/unitary-tests/sources/Application/WebPage/WebPageMock.php @@ -5,10 +5,8 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - namespace Combodo\iTop\Test\UnitTest\Application\WebPage; - use Combodo\iTop\Application\WebPage\WebPage; class WebPageMock extends WebPage @@ -17,4 +15,4 @@ class WebPageMock extends WebPage { // Don't call parent construct as we don't want the ob_start() method to be called (it would mess with PHPUnit) } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/sources/Application/WebPage/WebPageTest.php b/tests/php-unit-tests/unitary-tests/sources/Application/WebPage/WebPageTest.php index 82bc6f601..e03fde80f 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Application/WebPage/WebPageTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Application/WebPage/WebPageTest.php @@ -1,4 +1,5 @@ assertEmpty($aDeniedDirWrongFormat, - 'There are elements in \Combodo\iTop\Dependencies\Composer\iTopComposer::ListDeniedFoldersRelPaths that are not test dirs :'.var_export($aDeniedDirWrongFormat, true)); + $this->assertEmpty( + $aDeniedDirWrongFormat, + 'There are elements in \Combodo\iTop\Dependencies\Composer\iTopComposer::ListDeniedFoldersRelPaths that are not test dirs :'.var_export($aDeniedDirWrongFormat, true) + ); } public function testListAllowedFoldersAbsPaths() @@ -117,7 +118,6 @@ class iTopComposerTest extends ItopTestCase ); } - /** * This is NOT a unit test, this test the iTop instance running the test ... */ diff --git a/tests/php-unit-tests/unitary-tests/sources/Dependencies/NPM/iTopNPMTest.php b/tests/php-unit-tests/unitary-tests/sources/Dependencies/NPM/iTopNPMTest.php index db9971bfe..e8046426a 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Dependencies/NPM/iTopNPMTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Dependencies/NPM/iTopNPMTest.php @@ -26,7 +26,6 @@ use Combodo\iTop\Test\UnitTest\ItopTestCase; */ class iTopNPMTest extends ItopTestCase { - protected function setUp(): void { parent::setUp(); diff --git a/tests/php-unit-tests/unitary-tests/sources/Form/Field/FieldTest.php b/tests/php-unit-tests/unitary-tests/sources/Form/Field/FieldTest.php index b518591be..cb1159b67 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Form/Field/FieldTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Form/Field/FieldTest.php @@ -1,4 +1,5 @@ SetCurrentValue('toto@johny.invalid'); @@ -101,7 +102,8 @@ class FieldTest extends ItopTestCase $this->assertCount(0, $oSubFormField->GetErrorMessages()); } - public function testRemoveValidatorsOfClass(): void { + public function testRemoveValidatorsOfClass(): void + { $oField = new StringField('test'); $this->assertCount(0, $oField->GetValidators()); @@ -124,4 +126,4 @@ class FieldTest extends ItopTestCase $oField->RemoveValidatorsOfClass(CustomRegexpValidator::class); $this->assertCount(1, $oField->GetValidators()); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/sources/Form/LinkedSetFieldTest.php b/tests/php-unit-tests/unitary-tests/sources/Form/LinkedSetFieldTest.php index 199e313ab..565ffb539 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Form/LinkedSetFieldTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Form/LinkedSetFieldTest.php @@ -1,4 +1,5 @@ SetIndirect(false); @@ -37,4 +40,4 @@ class LinkedSetFieldTest extends ItopDataTestCase { $oUserRequest1->Set('title', ''); $this->assertFalse($oLinkedSetField->Validate(), 'A set with existing objects and an invalid modification must be KO'); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/sources/Form/MultipleChoicesFieldTest.php b/tests/php-unit-tests/unitary-tests/sources/Form/MultipleChoicesFieldTest.php index 4068b11c9..db2e734ea 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Form/MultipleChoicesFieldTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Form/MultipleChoicesFieldTest.php @@ -1,4 +1,5 @@ assertCount(1, $oMultipleChoicesField->GetErrorMessages()); $this->assertStringContainsString($sNonExistingValue, $oMultipleChoicesField->GetErrorMessages()[0]); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/sources/Form/SelectObjectFieldTest.php b/tests/php-unit-tests/unitary-tests/sources/Form/SelectObjectFieldTest.php index bc3215432..b5229d443 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Form/SelectObjectFieldTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Form/SelectObjectFieldTest.php @@ -1,4 +1,5 @@ SetSearch(DBObjectSearch::FromOQL('SELECT '.Organization::class)); @@ -26,7 +29,8 @@ class SelectObjectFieldTest extends ItopDataTestCase { $this->ValidateSelectObjectField($oSelectObjectField); } - private function ValidateSelectObjectField(SelectObjectField $oSelectObjectField): void { + private function ValidateSelectObjectField(SelectObjectField $oSelectObjectField): void + { $oSelectObjectField->SetCurrentValue(null); $this->assertTrue($oSelectObjectField->Validate(), 'No value must be valid'); @@ -40,4 +44,4 @@ class SelectObjectFieldTest extends ItopDataTestCase { $this->assertCount(1, $oSelectObjectField->GetErrorMessages()); $this->assertStringContainsString($sNonExistingOrganizationId, $oSelectObjectField->GetErrorMessages()[0]); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/sources/Form/Validator/ValidatorTest.php b/tests/php-unit-tests/unitary-tests/sources/Form/Validator/ValidatorTest.php index de0f1e978..4937b1729 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Form/Validator/ValidatorTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Form/Validator/ValidatorTest.php @@ -1,4 +1,5 @@ assertCount(1, $oField->GetErrorMessages()); $this->assertStringContainsString(MandatoryValidator::DEFAULT_ERROR_MESSAGE, $oField->GetErrorMessages()[0]); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/sources/Service/Cache/DataModelDependantCacheTest.php b/tests/php-unit-tests/unitary-tests/sources/Service/Cache/DataModelDependantCacheTest.php index f2db4c38a..d5256649c 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Service/Cache/DataModelDependantCacheTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Service/Cache/DataModelDependantCacheTest.php @@ -30,15 +30,15 @@ class DataModelDependantCacheTest extends ItopTestCase } public function testShouldStoreAndFetchVariousDataTypes(): void - { - $this->oCacheService->Store('pool-A', 'key-array', ['value1', 'value2']); - $this->oCacheService->Store('pool-A', 'key-string', 'foo'); - $this->oCacheService->Store('pool-A', 'key-int', 1971); + { + $this->oCacheService->Store('pool-A', 'key-array', ['value1', 'value2']); + $this->oCacheService->Store('pool-A', 'key-string', 'foo'); + $this->oCacheService->Store('pool-A', 'key-int', 1971); $this->assertEquals(['value1', 'value2'], $this->oCacheService->Fetch('pool-A', 'key-array')); - $this->assertEquals('foo', $this->oCacheService->Fetch('pool-A', 'key-string')); - $this->assertEquals(1971, $this->oCacheService->Fetch('pool-A', 'key-int')); - } + $this->assertEquals('foo', $this->oCacheService->Fetch('pool-A', 'key-string')); + $this->assertEquals(1971, $this->oCacheService->Fetch('pool-A', 'key-int')); + } public function testShouldNotAllowToStoreNull(): void { diff --git a/tests/php-unit-tests/unitary-tests/sources/Service/Events/EventTest.php b/tests/php-unit-tests/unitary-tests/sources/Service/Events/EventTest.php index 8ca5af4ac..f0152264f 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Service/Events/EventTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Service/Events/EventTest.php @@ -1,4 +1,5 @@ array(array($oReceiver, 'OnEvent1')), - 'static' => array('Combodo\iTop\Test\UnitTest\Service\Events\TestEventReceiver::OnStaticEvent1'), - 'static2' => array(array('Combodo\iTop\Test\UnitTest\Service\Events\TestEventReceiver', 'OnStaticEvent1')), - ); + return [ + 'method' => [[$oReceiver, 'OnEvent1']], + 'static' => ['Combodo\iTop\Test\UnitTest\Service\Events\TestEventReceiver::OnStaticEvent1'], + 'static2' => [['Combodo\iTop\Test\UnitTest\Service\Events\TestEventReceiver', 'OnStaticEvent1']], + ]; } public function testBrokenCallback() { EventService::RegisterEvent(new EventDescription('event_a', [], 'test', '', [], '')); $oReceiver = new TestEventReceiver(); - $this->EventService_RegisterListener('event_a', array($oReceiver, 'BrokenCallback')); + $this->EventService_RegisterListener('event_a', [$oReceiver, 'BrokenCallback']); $this->expectException(TypeError::class); EventService::FireEvent(new EventData('event_a')); @@ -120,7 +121,7 @@ class EventTest extends ItopDataTestCase { EventService::RegisterEvent(new EventDescription('event_a', [], 'test', '', [], '')); $oReceiver = new TestEventReceiver(); - $this->EventService_RegisterListener('event_a', array($oReceiver, 'OnEvent1')); + $this->EventService_RegisterListener('event_a', [$oReceiver, 'OnEvent1']); self::$iEventCalls = 0; EventService::FireEvent(new EventData('event_a')); @@ -140,14 +141,14 @@ class EventTest extends ItopDataTestCase EventService::RegisterEvent(new EventDescription('event_a', [], 'test', '', [], '')); EventService::RegisterEvent(new EventDescription('event_b', [], 'test', '', [], '')); $oReceiver = new TestEventReceiver(); - $this->EventService_RegisterListener('event_a', array($oReceiver, 'OnEvent1')); - $this->EventService_RegisterListener('event_a', array($oReceiver, 'OnEvent2')); - $this->EventService_RegisterListener('event_a', array('Combodo\iTop\Test\UnitTest\Service\Events\TestEventReceiver', 'OnStaticEvent1')); + $this->EventService_RegisterListener('event_a', [$oReceiver, 'OnEvent1']); + $this->EventService_RegisterListener('event_a', [$oReceiver, 'OnEvent2']); + $this->EventService_RegisterListener('event_a', ['Combodo\iTop\Test\UnitTest\Service\Events\TestEventReceiver', 'OnStaticEvent1']); $this->EventService_RegisterListener('event_a', 'Combodo\iTop\Test\UnitTest\Service\Events\TestEventReceiver::OnStaticEvent2'); - $this->EventService_RegisterListener('event_b', array($oReceiver, 'OnEvent1')); - $this->EventService_RegisterListener('event_b', array($oReceiver, 'OnEvent2')); - $this->EventService_RegisterListener('event_b', array('Combodo\iTop\Test\UnitTest\Service\Events\TestEventReceiver', 'OnStaticEvent1')); + $this->EventService_RegisterListener('event_b', [$oReceiver, 'OnEvent1']); + $this->EventService_RegisterListener('event_b', [$oReceiver, 'OnEvent2']); + $this->EventService_RegisterListener('event_b', ['Combodo\iTop\Test\UnitTest\Service\Events\TestEventReceiver', 'OnStaticEvent1']); $this->EventService_RegisterListener('event_b', 'Combodo\iTop\Test\UnitTest\Service\Events\TestEventReceiver::OnStaticEvent2'); self::$iEventCalls = 0; @@ -163,13 +164,13 @@ class EventTest extends ItopDataTestCase { EventService::RegisterEvent(new EventDescription('event1', [], 'test', '', [], '')); $oReceiver = new TestEventReceiver(); - $sId = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); - $sId = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); - $sId = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); - $sId = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); self::$iEventCalls = 0; @@ -268,19 +269,18 @@ class EventTest extends ItopDataTestCase } - public function testUnRegisterEventListener() { EventService::RegisterEvent(new EventDescription('event1', [], 'test', '', [], '')); EventService::RegisterEvent(new EventDescription('event2', [], 'test', '', [], '')); $oReceiver = new TestEventReceiver(); - $sId = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); - $sId = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); - $sId = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); - $sId = $this->EventService_RegisterListener('event2', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event2', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); self::$iEventCalls = 0; @@ -307,13 +307,13 @@ class EventTest extends ItopDataTestCase EventService::RegisterEvent(new EventDescription('event1', [], 'test', '', [], '')); EventService::RegisterEvent(new EventDescription('event2', [], 'test', '', [], '')); $oReceiver = new TestEventReceiver(); - $sId = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); - $sId = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); - $sId = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); - $sId = $this->EventService_RegisterListener('event2', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event2', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); self::$iEventCalls = 0; @@ -335,13 +335,13 @@ class EventTest extends ItopDataTestCase EventService::RegisterEvent(new EventDescription('event1', [], 'test', '', [], '')); EventService::RegisterEvent(new EventDescription('event2', [], 'test', '', [], '')); $oReceiver = new TestEventReceiver(); - $sIdToRemove = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sIdToRemove = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sIdToRemove"); - $sId = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); - $sId = $this->EventService_RegisterListener('event1', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event1', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); - $sId = $this->EventService_RegisterListener('event2', array($oReceiver, 'OnEvent1')); + $sId = $this->EventService_RegisterListener('event2', [$oReceiver, 'OnEvent1']); $this->debug("Registered $sId"); self::$iEventCalls = 0; @@ -408,7 +408,6 @@ class TestClassesWithDebug class TestEventReceiver extends TestClassesWithDebug { - // Event callbacks public function OnEvent1(EventData $oData) { @@ -458,4 +457,3 @@ class TestEventReceiver extends TestClassesWithDebug EventTest::IncrementCallCount(); } } - diff --git a/tests/php-unit-tests/unitary-tests/sources/Service/InterfaceDiscovery/InterfaceDiscoveryTest.php b/tests/php-unit-tests/unitary-tests/sources/Service/InterfaceDiscovery/InterfaceDiscoveryTest.php index 1a3f2aab1..00ce4476f 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Service/InterfaceDiscovery/InterfaceDiscoveryTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Service/InterfaceDiscovery/InterfaceDiscoveryTest.php @@ -36,9 +36,9 @@ class InterfaceDiscoveryTest extends ItopDataTestCase public function testShouldSelectTheRequestedItopClasses() { $this->GivenClassMap([ - 'Combodo\iTop\Application\UI\Base\Component\Alert\Alert' => APPROOT . '/sources/Application/UI/Base/Component/Alert/Alert.php', - 'Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory' => APPROOT . '/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', - 'Combodo\iTop\Application\UI\Base\Component\ButtonGroup\ButtonGroupUIBlockFactory' => APPROOT . '/sources/Application/UI/Base/Component/ButtonGroup/ButtonGroupUIBlockFactory.php', + 'Combodo\iTop\Application\UI\Base\Component\Alert\Alert' => APPROOT.'/sources/Application/UI/Base/Component/Alert/Alert.php', + 'Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory' => APPROOT.'/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', + 'Combodo\iTop\Application\UI\Base\Component\ButtonGroup\ButtonGroupUIBlockFactory' => APPROOT.'/sources/Application/UI/Base/Component/ButtonGroup/ButtonGroupUIBlockFactory.php', ]); $this->AssertArraysHaveSameItems( @@ -57,8 +57,8 @@ class InterfaceDiscoveryTest extends ItopDataTestCase { $this->SetNonPublicProperty($this->oInterfaceDiscovery, 'bCheckInterfaceImplementation', false); $this->GivenClassMap([ - 'Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory2' => APPROOT . '/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', - 'Combodo\iTop\Application\UI\Base\Component\ButtonGroup\ButtonGroupUIBlockFactory2' => APPROOT . '/sources/Application/UI/Base/Component/ButtonGroup/ButtonGroupUIBlockFactory.php', + 'Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory2' => APPROOT.'/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', + 'Combodo\iTop\Application\UI\Base\Component\ButtonGroup\ButtonGroupUIBlockFactory2' => APPROOT.'/sources/Application/UI/Base/Component/ButtonGroup/ButtonGroupUIBlockFactory.php', ]); $this->AssertArraysHaveSameItems([], $this->oInterfaceDiscovery->FindItopClasses(iUIBlockFactory::class)); @@ -87,8 +87,8 @@ class InterfaceDiscoveryTest extends ItopDataTestCase public function testShouldExcludeAliases() { $this->GivenClassMap([ - 'Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory' => APPROOT . '/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', - 'AlbertIsBlockingTheFactory' => APPROOT . '/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', + 'Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory' => APPROOT.'/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', + 'AlbertIsBlockingTheFactory' => APPROOT.'/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', ]); class_alias('Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory', 'AlbertIsBlockingTheFactory'); @@ -120,11 +120,13 @@ class InterfaceDiscoveryTest extends ItopDataTestCase MetaModel::GetConfig()->Set('developer_mode.interface_cache.enabled', true); $this->assertGreaterThan(0, count($this->oInterfaceDiscovery->FindItopClasses(iUIBlockFactory::class))); - $this->AssertDirectoryListingEquals([ + $this->AssertDirectoryListingEquals( + [ 'autoload_classmaps.php', '1ab1e62be3e9984a8176deeb20f049b1_iUIBlockFactory.php', ], - $this->sCacheRootDir.'/InterfaceDiscovery'); + $this->sCacheRootDir.'/InterfaceDiscovery' + ); } public function testShouldProduceStaticCacheForProduction() diff --git a/tests/php-unit-tests/unitary-tests/sources/Service/Notification/NotificationsServiceTest.php b/tests/php-unit-tests/unitary-tests/sources/Service/Notification/NotificationsServiceTest.php index 2c33cafa3..0ff083212 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Service/Notification/NotificationsServiceTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Service/Notification/NotificationsServiceTest.php @@ -5,10 +5,8 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - namespace Combodo\iTop\Test\UnitTest\Service\Notification; - use Combodo\iTop\Core\Trigger\Enum\SubscriptionPolicy; use Combodo\iTop\Service\Notification\NotificationsRepository; use Combodo\iTop\Service\Notification\NotificationsService; @@ -21,7 +19,8 @@ use Combodo\iTop\Test\UnitTest\ItopDataTestCase; * @package Combodo\iTop\Test\UnitTest\Service\Notification * @covers \Combodo\iTop\Service\Notification\NotificationsService */ -class NotificationsServiceTest extends ItopDataTestCase { +class NotificationsServiceTest extends ItopDataTestCase +{ public const CREATE_TEST_ORG = true; /** @@ -59,14 +58,12 @@ class NotificationsServiceTest extends ItopDataTestCase { ]); $iActionNotificationID = $oActionNotification->GetKey(); - $oService = NotificationsService::GetInstance(); // Case 1: Person hasn't received action so far, so it is implicitly subscribed by default // - Assert $this->assertTrue($oService->IsSubscribed($oTrigger, $oActionNotification, $oPerson)); - // Case 2: Activate an action, the person should have an explicit subscription // - Prepare $oActionNotification->DoExecute($oTrigger, [ @@ -79,7 +76,6 @@ class NotificationsServiceTest extends ItopDataTestCase { $this->assertEquals(1, $iSubscribedCount, "There should be 1 explicit subscription"); $this->assertTrue($oService->IsSubscribed($oTrigger, $oActionNotification, $oPerson)); - // Case 3: Unsubscribe, person should have an explicit unsubscribe // - Prepare $oSubscription = NotificationsRepository::GetInstance()->SearchSubscribedSubscriptionsByTriggerContactAndAction($iTriggerID, $iActionNotificationID, $iPersonID)->Fetch(); @@ -93,4 +89,4 @@ class NotificationsServiceTest extends ItopDataTestCase { $this->assertEquals(1, $iUnsubscribedCount, "There should be 1 explicit unsubscription"); $this->assertFalse($oService->IsSubscribed($oTrigger, $oActionNotification, $oPerson)); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/sources/Service/Router/RouterTest.php b/tests/php-unit-tests/unitary-tests/sources/Service/Router/RouterTest.php index cd6212afe..8af2c9151 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Service/Router/RouterTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Service/Router/RouterTest.php @@ -1,4 +1,5 @@ 'Person', - 'id' => 123 + 'id' => 123, ], true, ], @@ -247,7 +248,9 @@ class RouterTest extends ItopDataTestCase // Generate corrupted cache manually $sFaultyStatement = 'return 1;'; - file_put_contents($sRoutesCacheFilePath, <<oManager->CreateTemporaryObject($sTempId, 'FakedClass', -1, TemporaryObjectHelper::OPERATION_CREATE); - $this->assertNull( $oDescriptor); + $this->assertNull($oDescriptor); $oOrg = $this->CreateTestOrganization(); $oDescriptor = $this->CreateTemporaryObject($sTempId, $oOrg, 3000, TemporaryObjectHelper::OPERATION_CREATE); - $this->assertNotNull( $oDescriptor); + $this->assertNotNull($oDescriptor); } public function testCancelAllTemporaryObjects() @@ -156,7 +157,6 @@ class TemporaryObjectManagerTest extends ItopDataTestCase $this->assertNull($oDeletedObject); } - private function CreateTemporaryObject($sTempId, $oDBObject, int $iLifetime, string $sOperation) { $this->oConfig->SetConfigTemporaryLifetime($iLifetime); diff --git a/tests/php-unit-tests/unitary-tests/sources/Service/TemporaryObjects/TemporaryObjectRepositoryTest.php b/tests/php-unit-tests/unitary-tests/sources/Service/TemporaryObjects/TemporaryObjectRepositoryTest.php index e5e3e55d7..29e19f246 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Service/TemporaryObjects/TemporaryObjectRepositoryTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Service/TemporaryObjects/TemporaryObjectRepositoryTest.php @@ -1,4 +1,5 @@ GenerateSessionContent($oSessionHandler, json_encode(null)); $this->assertNotNull($sContent, "Call to CompleteSessionData should NOT fail due to Argument #1 (\$aJson) must be of type array, null given"); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/sources/SessionTracker/iSessionHandlerExtensionExamples.php b/tests/php-unit-tests/unitary-tests/sources/SessionTracker/iSessionHandlerExtensionExamples.php index b4c1a1241..a59f100f7 100644 --- a/tests/php-unit-tests/unitary-tests/sources/SessionTracker/iSessionHandlerExtensionExamples.php +++ b/tests/php-unit-tests/unitary-tests/sources/SessionTracker/iSessionHandlerExtensionExamples.php @@ -4,12 +4,14 @@ namespace Combodo\iTop\Test\UnitTest\SessionTracker; use Combodo\iTop\SessionTracker\iSessionHandlerExtension; -class BasicSessionHandlerExtension implements iSessionHandlerExtension { - public function __construct(){ +class BasicSessionHandlerExtension implements iSessionHandlerExtension +{ + public function __construct() + { } public function CompleteSessionData(array $aJson, array &$aData): void { - $aData['shadok']='gabuzomeu'; + $aData['shadok'] = 'gabuzomeu'; } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/sources/core/Email/EmailSymfonyTest.php b/tests/php-unit-tests/unitary-tests/sources/core/Email/EmailSymfonyTest.php index bd8c19797..40594eccb 100644 --- a/tests/php-unit-tests/unitary-tests/sources/core/Email/EmailSymfonyTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/core/Email/EmailSymfonyTest.php @@ -135,4 +135,4 @@ HTML; $this->assertSame($sExpectedBody, $sActualBody); } -} \ No newline at end of file +} diff --git a/tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php b/tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php index bdf59bfb3..4e3ef899d 100644 --- a/tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php +++ b/tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php @@ -1,4 +1,5 @@ Count() == 0) - { + if ($oSet->Count() == 0) { $oProfileSearch = DBSearch::FromOQL('SELECT URP_Profiles WHERE id = 1'); $oProfileSet = new DBObjectSet($oProfileSearch); $oAdminProfile = $oProfileSet->fetch(); - $oUser = MetaModel::NewObject('UserLocal', array( + $oUser = MetaModel::NewObject('UserLocal', [ 'login' => static::AUTH_USER, 'password' => static::AUTH_PWD, 'expiration' => UserLocal::EXPIRE_NEVER, - )); + ]); $oProfiles = $oUser->Get('profile_list'); - $oProfiles->AddItem(MetaModel::NewObject('URP_UserProfile', array( - 'profileid' => $oAdminProfile->GetKey() - ))); + $oProfiles->AddItem(MetaModel::NewObject('URP_UserProfile', [ + 'profileid' => $oAdminProfile->GetKey(), + ])); $oUser->Set('profile_list', $oProfiles); $oUser->DBInsertNoReload(); } /** @var \Organization $oOrganisation */ $sUniqueId1 = microtime(); - $oOrganisation = $this->createObject('Organization', array( - 'name' => 'datasynchro_org1_' . $sUniqueId1, - 'code' => $sUniqueId1 - )); + $oOrganisation = $this->createObject('Organization', [ + 'name' => 'datasynchro_org1_'.$sUniqueId1, + 'code' => $sUniqueId1, + ]); $this->oOrg1 = $oOrganisation; $sUniqueId2 = microtime(); - $oOrganisation2 = $this->createObject('Organization', array( - 'name' => 'datasynchro_org2_' . $sUniqueId2, - 'code' => $sUniqueId2 - )); + $oOrganisation2 = $this->createObject('Organization', [ + 'name' => 'datasynchro_org2_'.$sUniqueId2, + 'code' => $sUniqueId2, + ]); $this->oOrg2 = $oOrganisation2; } @@ -94,7 +94,6 @@ class DataSynchroTest extends ItopDataTestCase //$aParams['output'] = 'details'; $aParams['csvdata'] = file_get_contents($aParams['csvfile']); - $sUrl = \MetaModel::GetConfig()->Get('app_root_url').'/synchro/synchro_import.php?login_mode=form'; $sResult = utils::DoPostRequest($sUrl, $aParams, null, $aResponseHeaders, [ CURLOPT_SSL_VERIFYPEER => false, @@ -104,7 +103,7 @@ class DataSynchroTest extends ItopDataTestCase $aLines = explode("\n", trim(strip_tags($sResult))); //$sLastLine = array_pop($aLines); - return array(0, $aLines); + return [0, $aLines]; } /** @@ -124,7 +123,7 @@ class DataSynchroTest extends ItopDataTestCase $aSourceProperties = $aUserLoginUsecase['source_properties']; $aSourceData = $aUserLoginUsecase['source_data']; $aTargetData = $aUserLoginUsecase['target_data']; - $aAttributes =$aUserLoginUsecase['attributes']; + $aAttributes = $aUserLoginUsecase['attributes']; $bSynchroByHttp = $aUserLoginUsecase['bSynchroByHttp']; $sClass = $sTargetClass; @@ -132,8 +131,7 @@ class DataSynchroTest extends ItopDataTestCase $aTargetAttributes = array_shift($aTargetData); $aSourceAttributes = array_shift($aSourceData); - if (count($aSourceData) + 1 != count($aTargetData)) - { + if (count($aSourceData) + 1 != count($aTargetData)) { throw new Exception("Target data must contain exactly ".(count($aSourceData) + 1)." items, found ".count($aTargetData)); } @@ -145,27 +143,21 @@ class DataSynchroTest extends ItopDataTestCase $oDataSource->Set('status', 'production'); $oDataSource->Set('user_id', 0); $oDataSource->Set('scope_class', $sClass); - foreach ($aSourceProperties as $sProperty => $value) - { + foreach ($aSourceProperties as $sProperty => $value) { $oDataSource->Set($sProperty, $value); } $iDataSourceId = $oDataSource->DBInsert(); $oAttributeSet = $oDataSource->Get('attribute_list'); - while ($oAttribute = $oAttributeSet->Fetch()) - { - if (array_key_exists($oAttribute->Get('attcode'), $aAttributes)) - { + while ($oAttribute = $oAttributeSet->Fetch()) { + if (array_key_exists($oAttribute->Get('attcode'), $aAttributes)) { $aAttribInfo = $aAttributes[$oAttribute->Get('attcode')]; - if (array_key_exists('reconciliation_attcode', $aAttribInfo)) - { + if (array_key_exists('reconciliation_attcode', $aAttribInfo)) { $oAttribute->Set('reconciliation_attcode', $aAttribInfo['reconciliation_attcode']); } $oAttribute->Set('update', $aAttribInfo['do_update']); $oAttribute->Set('reconcile', $aAttribInfo['do_reconcile']); - } - else - { + } else { $oAttribute->Set('update', false); $oAttribute->Set('reconcile', false); } @@ -173,15 +165,12 @@ class DataSynchroTest extends ItopDataTestCase } // Prepare list of prefixes -> make sure objects are unique with regard to the reconciliation scheme - $aPrefixes = array(); // attcode => prefix - foreach($aSourceAttributes as $iDummy => $sAttCode) - { + $aPrefixes = []; // attcode => prefix + foreach ($aSourceAttributes as $iDummy => $sAttCode) { $aPrefixes[$sAttCode] = ''; // init with something } - foreach($aAttributes as $sAttCode => $aAttribInfo) - { - if (isset($aAttribInfo['automatic_prefix']) && $aAttribInfo['automatic_prefix']) - { + foreach ($aAttributes as $sAttCode => $aAttribInfo) { + if (isset($aAttribInfo['automatic_prefix']) && $aAttribInfo['automatic_prefix']) { $aPrefixes[$sAttCode] = 'TEST_'.$iDataSourceId.'_'; } } @@ -195,11 +184,9 @@ class DataSynchroTest extends ItopDataTestCase // Create the initial object list // $aInitialTarget = $aTargetData[0]; - foreach($aInitialTarget as $aObjFields) - { + foreach ($aInitialTarget as $aObjFields) { $oNewTarget = MetaModel::NewObject($sClass); - foreach($aTargetAttributes as $iAtt => $sAttCode) - { + foreach ($aTargetAttributes as $iAtt => $sAttCode) { $oNewTarget->Set($sAttCode, $aPrefixes[$sAttCode].$aObjFields[$iAtt]); } $oNewTarget->DBInsertNoReload(); @@ -207,47 +194,36 @@ class DataSynchroTest extends ItopDataTestCase //add sleep to make sure expected objects will be found usleep(10000); - foreach($aTargetData as $iRow => $aExpectedObjects) - { + foreach ($aTargetData as $iRow => $aExpectedObjects) { // Check the status (while ignoring existing objects) // - if (empty($sExistingIds)) - { + if (empty($sExistingIds)) { $oObjects = new DBObjectSet(DBObjectSearch::FromOQL("SELECT $sClass")); - } - else - { + } else { $oObjects = new DBObjectSet(DBObjectSearch::FromOQL("SELECT $sClass WHERE id NOT IN($sExistingIds)")); } $aFound = $oObjects->ToArray(); - $aErrors_Unexpected = array(); - foreach($aFound as $iObj => $oObj) - { + $aErrors_Unexpected = []; + foreach ($aFound as $iObj => $oObj) { // Is this object in the expected objects list $bFoundMatch = false; - foreach($aExpectedObjects as $iExp => $aValues) - { + foreach ($aExpectedObjects as $iExp => $aValues) { $bDoesMatch = true; - foreach($aTargetAttributes as $iCol => $sAttCode) - { - if ($oObj->Get($sAttCode) != $aPrefixes[$sAttCode].$aValues[$iCol]) - { + foreach ($aTargetAttributes as $iCol => $sAttCode) { + if ($oObj->Get($sAttCode) != $aPrefixes[$sAttCode].$aValues[$iCol]) { $bDoesMatch = false; break; } } - if ($bDoesMatch) - { + if ($bDoesMatch) { $bFoundMatch = true; unset($aExpectedObjects[$iExp]); break; } } - if (!$bFoundMatch) - { - $aObjDesc = array(); - foreach($aTargetAttributes as $iCol => $sAttCode) - { + if (!$bFoundMatch) { + $aObjDesc = []; + foreach ($aTargetAttributes as $iCol => $sAttCode) { $aObjDesc[$sAttCode] = $oObj->Get($sAttCode); } $aErrors_Unexpected[get_class($oObj).'::'.$oObj->GetKey()] = $aObjDesc; @@ -256,7 +232,7 @@ class DataSynchroTest extends ItopDataTestCase // Display the current status // - $aErrors = array(); + $aErrors = []; if (count($aErrors_Unexpected) > 0) { $aErrors[] = "Unexpected objects found in iTop DB after step $iRow (starting at 0):\n".print_r($aErrors_Unexpected, true); } @@ -265,15 +241,14 @@ class DataSynchroTest extends ItopDataTestCase } if (count($aErrors) > 0) { $sAdditionalInfo = (isset($sResultsViewable)) ? $sResultsViewable : ""; - static::fail(implode("\n", $aErrors) . "\n $sAdditionalInfo"); + static::fail(implode("\n", $aErrors)."\n $sAdditionalInfo"); } else { static::assertTrue(true); } // If not on the final row, run a data exchange sequence // - if (array_key_exists($iRow, $aSourceData)) - { + if (array_key_exists($iRow, $aSourceData)) { $aToBeLoaded = $aSourceData[$iRow]; // First line @@ -281,16 +256,14 @@ class DataSynchroTest extends ItopDataTestCase $sTextQualifier = '"'; - foreach($aToBeLoaded as $aDataRow) - { - $aFinalData = array(); - foreach($aDataRow as $iCol => $value) - { + foreach ($aToBeLoaded as $aDataRow) { + $aFinalData = []; + foreach ($aDataRow as $iCol => $value) { $sAttCode = $aSourceAttributes[$iCol]; $sRawValue = $aPrefixes[$sAttCode].$value; - $sFrom = array("\r\n", $sTextQualifier); - $sTo = array("\n", $sTextQualifier.$sTextQualifier); + $sFrom = ["\r\n", $sTextQualifier]; + $sTo = ["\n", $sTextQualifier.$sTextQualifier]; $sCSVValue = $sTextQualifier.str_replace($sFrom, $sTo, (string)$sRawValue).$sTextQualifier; $aFinalData[] = $sCSVValue; @@ -300,25 +273,22 @@ class DataSynchroTest extends ItopDataTestCase $sCSVTmpFile = tempnam(sys_get_temp_dir(), "CSV"); file_put_contents($sCSVTmpFile, $sCsvData); - $aParams = array( + $aParams = [ 'csvfile' => $sCSVTmpFile, 'data_source_id' => $iDataSourceId, 'separator' => ';', 'simulate' => 0, 'output' => 'details', - ); + ]; list($iRetCode, $aOutputLines) = static::ExecSynchroImport($aParams, $bSynchroByHttp); unlink($sCSVTmpFile); // Report the load results // - if (strlen($sCsvData) > 5000) - { + if (strlen($sCsvData) > 5000) { $sCsvDataViewable = 'INPUT TOO LONG TO BE DISPLAYED ('.strlen($sCsvData).")\n".substr($sCsvData, 0, 500)."\n... TO BE CONTINUED"; - } - else - { + } else { $sCsvDataViewable = $sCsvData; } echo "Input Data:\n"; @@ -331,34 +301,32 @@ class DataSynchroTest extends ItopDataTestCase echo $sResultsViewable; echo "\n"; - if ($iRetCode != 0) - { + if ($iRetCode != 0) { static::fail("Execution of synchro_import failing with code '$iRetCode', see error.log for more details"); } - if (stripos($sResultsViewable, 'exception') !== false) - { + if (stripos($sResultsViewable, 'exception') !== false) { self::fail('Encountered an Exception during the last import/synchro'); } $aKeys = ["creation", "update", "deletion"]; - foreach ($aKeys as $sKey){ - $this->assertStringContainsString("$sKey errors: 0", $sResultsViewable, "step $iRow : below res should contain '$sKey errors: 0': " . $sResultsViewable); + foreach ($aKeys as $sKey) { + $this->assertStringContainsString("$sKey errors: 0", $sResultsViewable, "step $iRow : below res should contain '$sKey errors: 0': ".$sResultsViewable); } //N°3805 : potential javascript returned like /* - Please wait... + Please wait... var aListJsFiles = []; - $(document).ready(function () { - setTimeout(function () { - }, 50); - }); + $(document).ready(function () { + setTimeout(function () { + }, 50); + }); */ $sLastExpectedLine = "#Replica disappeared, no action taken: 0"; $aSplittedRes = explode($sLastExpectedLine, $sResultsViewable); $this->assertNotFalse($aSplittedRes); - if (count($aSplittedRes)>1){ + if (count($aSplittedRes) > 1) { $sPotentialIssuesWithWebApplication = $aSplittedRes[1]; $this->assertEquals("", $sPotentialIssuesWithWebApplication, 'when failed it means data synchro result is polluted with some web application stuff like html or js'); } @@ -368,11 +336,12 @@ class DataSynchroTest extends ItopDataTestCase return $oDataSource; } - private function GetNominalUsecaseData(){ - return array( + private function GetNominalUsecaseData() + { + return [ 'desc' => 'Load user logins', 'target_class' => 'UserLocal', - 'source_properties' => array( + 'source_properties' => [ 'full_load_periodicity' => 3600, // should be ignored in this case 'reconciliation_policy' => 'use_attributes', 'action_on_zero' => 'create', @@ -381,52 +350,55 @@ class DataSynchroTest extends ItopDataTestCase 'delete_policy' => 'delete', 'delete_policy_update' => '', 'delete_policy_retention' => 0, - ), - 'source_data' => array( - array('primary_key', 'login', 'password', 'profile_list'), - array( - array('user_A', 'login_A', 'password_A', 'profileid:10;reason:he/she is managing services'), - ), - ), - 'target_data' => array( - array('login'), //columns - array( + ], + 'source_data' => [ + ['primary_key', 'login', 'password', 'profile_list'], + [ + ['user_A', 'login_A', 'password_A', 'profileid:10;reason:he/she is managing services'], + ], + ], + 'target_data' => [ + ['login'], //columns + [ // Initial state - ), - array( - array('login_A'), //expected values - ), - ), - 'attributes' => array( - 'login' => array( + ], + [ + ['login_A'], //expected values + ], + ], + 'attributes' => [ + 'login' => [ 'do_reconcile' => true, 'do_update' => true, 'automatic_prefix' => true, // unique id (for unit testing) - ), - 'password' => array( + ], + 'password' => [ 'do_reconcile' => false, 'do_update' => true, - ), - 'profile_list' => array( + ], + 'profile_list' => [ 'do_reconcile' => false, 'do_update' => true, - ), - ), - 'bSynchroByHttp' => false - ); + ], + ], + 'bSynchroByHttp' => false, + ]; } - public function testDataSynchroByCli(){ + public function testDataSynchroByCli() + { $this->RunDataSynchroTest($this->GetNominalUsecaseData()); } - public function testDataSynchroByHttp(){ + public function testDataSynchroByHttp() + { $aUserLoginUsecase = $this->GetNominalUsecaseData(); $aUserLoginUsecase['bSynchroByHttp'] = true; $this->RunDataSynchroTest($aUserLoginUsecase); } - public function testDataSynchroDeletionCleanup(){ + public function testDataSynchroDeletionCleanup() + { // run test data synchro $oDataSource = $this->RunDataSynchroTest($this->GetNominalUsecaseData()); @@ -584,7 +556,6 @@ class DataSynchroTest extends ItopDataTestCase $this->RunDataSynchroTest($aUserLoginUsecase); }*/ - /*public function testLoadingApplicationSolution(){ $aUserLoginUsecase= array( 'desc' => 'Simple scenario loading a few ApplicationSolution', diff --git a/tests/php-unit-tests/unitary-tests/tests/php-unit-tests/BootSymfonyKernelTest.php b/tests/php-unit-tests/unitary-tests/tests/php-unit-tests/BootSymfonyKernelTest.php index 9d3dc8e33..e8b5c9f58 100644 --- a/tests/php-unit-tests/unitary-tests/tests/php-unit-tests/BootSymfonyKernelTest.php +++ b/tests/php-unit-tests/unitary-tests/tests/php-unit-tests/BootSymfonyKernelTest.php @@ -1,6 +1,5 @@ assertDBQueryCount(14, function() use (&$iKey) { + $this->assertDBQueryCount(14, function () use (&$iKey) { $iKey = $this->createObject('Organization', ['name' => 'The world company']); }); - $this->assertDBQueryCount(2, function() use (&$iKey) { + $this->assertDBQueryCount(2, function () use (&$iKey) { $iKey = $this->GivenObjectInDB('Organization', ['name' => 'The world company']); }); } @@ -53,7 +53,7 @@ class GivenObjectInDBTest extends ItopDataTestCase $iTeam = $this->GivenObjectInDB('Team', [ 'name' => 'The A Team', 'persons_list' => [ - "person_id:$iPerson;role_id:$iRole" + "person_id:$iPerson;role_id:$iRole", ], ]); @@ -98,8 +98,7 @@ class GivenObjectInDBTest extends ItopDataTestCase $oObjectFromDBOptimized = MetaModel::GetObject($sClass, $iKey); // Check that an object created by the mean of the std APIs will have the same values - foreach ($aValues as $sAttCode => $value) - { + foreach ($aValues as $sAttCode => $value) { static::assertEquals( $oObjectFromDBStandard->Get($sAttCode), $oObjectFromDBOptimized->Get($sAttCode), @@ -115,13 +114,13 @@ class GivenObjectInDBTest extends ItopDataTestCase 'class' => 'Organization', 'values' => [ 'name' => 'Orga tartampion', - ] + ], ], 'FAQCategory' => [ 'class' => 'FAQCategory', 'values' => [ 'name' => 'FAQCategory_phpunit', - ] + ], ], 'Server' => [ 'class' => 'Server', @@ -129,7 +128,7 @@ class GivenObjectInDBTest extends ItopDataTestCase 'name' => 'Server tartampion', 'org_id' => 1, 'nb_u' => 123, - ] + ], ], 'TagSetFieldDataFor_FAQ__domains' => [ 'class' => 'TagSetFieldDataFor_FAQ__domains', @@ -139,7 +138,7 @@ class GivenObjectInDBTest extends ItopDataTestCase 'obj_class' => 'FAQ', 'obj_attcode' => 'domains', 'description' => '

    tartampion

    ', - ] + ], ], 'Hypervisor' => [ 'class' => 'Hypervisor', @@ -148,15 +147,15 @@ class GivenObjectInDBTest extends ItopDataTestCase 'org_id' => 1, 'server_id' => 1, 'farm_id' => 0, - ] + ], ], 'Rack' => [ 'class' => 'Rack', 'values' => [ 'name' => "rackamuffin", 'description' => "rackadescription", - 'org_id' => 1 - ] + 'org_id' => 1, + ], ], 'Person' => [ 'class' => 'Person', @@ -164,7 +163,7 @@ class GivenObjectInDBTest extends ItopDataTestCase 'name' => 'Person_tartampion', 'first_name' => 'Test', 'org_id' => 1, - ] + ], ], 'Farm' => [ 'class' => 'Farm', @@ -172,7 +171,7 @@ class GivenObjectInDBTest extends ItopDataTestCase 'name' => 'Farm_tartampion', 'org_id' => 1, 'redundancy' => '1', - ] + ], ], 'UserRequest' => [ 'class' => 'UserRequest', @@ -181,7 +180,7 @@ class GivenObjectInDBTest extends ItopDataTestCase 'title' => 'TICKET_TARTAMPION as a title', 'description' => '

    Created for unit tests.

    ', 'org_id' => 1, - ] + ], ], ]; } diff --git a/tests/php-unit-tests/unitary-tests/webservices/CliResetSessionTest.php b/tests/php-unit-tests/unitary-tests/webservices/CliResetSessionTest.php index 1b823b9d5..ecdbc1158 100644 --- a/tests/php-unit-tests/unitary-tests/webservices/CliResetSessionTest.php +++ b/tests/php-unit-tests/unitary-tests/webservices/CliResetSessionTest.php @@ -7,10 +7,9 @@ use Config; use Exception; use MetaModel; - class CliResetSessionTest extends ItopDataTestCase { - const USE_TRANSACTION = false; + public const USE_TRANSACTION = false; private $sCookieFile = ""; private $sUrl; @@ -18,38 +17,37 @@ class CliResetSessionTest extends ItopDataTestCase private $sPassword = "Iuytrez9876543ç_è-("; protected $sConfigTmpBackupFile; - /** - * @throws Exception - */ - protected function setUp(): void - { - parent::setUp(); + * @throws Exception + */ + protected function setUp(): void + { + parent::setUp(); $this->sConfigTmpBackupFile = tempnam(sys_get_temp_dir(), "config_"); - MetaModel::GetConfig()->WriteToFile($this->sConfigTmpBackupFile); + MetaModel::GetConfig()->WriteToFile($this->sConfigTmpBackupFile); - $this->sLogin = "rest-user-".date('dmYHis'); - $this->CreateTestOrganization(); + $this->sLogin = "rest-user-".date('dmYHis'); + $this->CreateTestOrganization(); - $this->sCookieFile = tempnam(sys_get_temp_dir(), 'jsondata_'); + $this->sCookieFile = tempnam(sys_get_temp_dir(), 'jsondata_'); - $this->sUrl = \MetaModel::GetConfig()->Get('app_root_url'); + $this->sUrl = \MetaModel::GetConfig()->Get('app_root_url'); - $oRestProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'REST Services User'), true); - $oAdminProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'Administrator'), true); + $oRestProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => 'REST Services User'], true); + $oAdminProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => 'Administrator'], true); - if (is_object($oRestProfile) && is_object($oAdminProfile)) { - $oUser = $this->CreateUser($this->sLogin, $oRestProfile->GetKey(), $this->sPassword); - $this->AddProfileToUser($oUser, $oAdminProfile->GetKey()); - } - } + if (is_object($oRestProfile) && is_object($oAdminProfile)) { + $oUser = $this->CreateUser($this->sLogin, $oRestProfile->GetKey(), $this->sPassword); + $this->AddProfileToUser($oUser, $oAdminProfile->GetKey()); + } + } protected function tearDown(): void { parent::tearDown(); - if (! is_null($this->sConfigTmpBackupFile) && is_file($this->sConfigTmpBackupFile)){ + if (! is_null($this->sConfigTmpBackupFile) && is_file($this->sConfigTmpBackupFile)) { //put config back $sConfigPath = MetaModel::GetConfig()->GetLoadedFile(); @chmod($sConfigPath, 0770); @@ -154,11 +152,11 @@ class CliResetSessionTest extends ItopDataTestCase { $ch = curl_init(); - curl_setopt ($ch, CURLOPT_COOKIEJAR, $this->sCookieFile); - curl_setopt ($ch, CURLOPT_COOKIEFILE, $this->sCookieFile); + curl_setopt($ch, CURLOPT_COOKIEJAR, $this->sCookieFile); + curl_setopt($ch, CURLOPT_COOKIEFILE, $this->sCookieFile); $sUrl = "$this->sUrl/$sUri"; - if (!is_null($sForcedLoginMode)){ + if (!is_null($sForcedLoginMode)) { $sUrl .= "?login_mode=$sForcedLoginMode"; } curl_setopt($ch, CURLOPT_URL, $sUrl); @@ -179,16 +177,16 @@ class CliResetSessionTest extends ItopDataTestCase Set-Cookie: itop-2e83d2e9b00e354fdc528621cac532ac=q7ldcjq0rvbn33ccr9q8u8e953; path=/ */ //var_dump($sResponse); - $iHeaderSize = curl_getinfo($ch,CURLINFO_HEADER_SIZE); + $iHeaderSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $sBody = substr($sResponse, $iHeaderSize); //$iHttpCode = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE)); - if (preg_match('/HTTP.* (\d*) /', $sResponse, $aMatches)){ + if (preg_match('/HTTP.* (\d*) /', $sResponse, $aMatches)) { $sHttpCode = $aMatches[1]; } else { $sHttpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); } - curl_close ($ch); + curl_close($ch); $this->assertEquals(200, $sHttpCode, "The test logic assumes that the HTTP request is correctly handled"); return $sBody; diff --git a/tests/php-unit-tests/unitary-tests/webservices/ImportTest.php b/tests/php-unit-tests/unitary-tests/webservices/ImportTest.php index 725f7ead0..b9d50edfc 100644 --- a/tests/php-unit-tests/unitary-tests/webservices/ImportTest.php +++ b/tests/php-unit-tests/unitary-tests/webservices/ImportTest.php @@ -5,8 +5,9 @@ namespace Combodo\iTop\Test\UnitTest\Webservices; use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use MetaModel; -class ImportTest extends ItopDataTestCase { - const USE_TRANSACTION = false; +class ImportTest extends ItopDataTestCase +{ + public const USE_TRANSACTION = false; private $sUrl; private $sUid; @@ -15,30 +16,31 @@ class ImportTest extends ItopDataTestCase { private $sTmpFile = ""; private $oOrg; - protected function tearDown() : void{ + protected function tearDown(): void + { parent::tearDown(); - if (!empty($this->sTmpFile) && is_file($this->sTmpFile)){ + if (!empty($this->sTmpFile) && is_file($this->sTmpFile)) { unlink($this->sTmpFile); } } - protected function setUp() : void{ + protected function setUp(): void + { parent::setUp(); $this->sTmpFile = tempnam(sys_get_temp_dir(), 'import_csv_'); require_once(APPROOT.'application/startup.inc.php'); $this->sUid = date('dmYHis'); - $this->sLogin = "import-" .$this->sUid; + $this->sLogin = "import-".$this->sUid; $this->oOrg = $this->CreateOrganization($this->sUid); $this->sUrl = \MetaModel::GetConfig()->Get('app_root_url'); - $oRestProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'REST Services User'), true); - $oAdminProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'Administrator'), true); + $oRestProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => 'REST Services User'], true); + $oAdminProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => 'Administrator'], true); - if (is_object($oRestProfile) && is_object($oAdminProfile)) - { + if (is_object($oRestProfile) && is_object($oAdminProfile)) { $oUser = $this->CreateContactlessUser($this->sLogin, $oRestProfile->GetKey(), $this->sPassword); $this->AddProfileToUser($oUser, $oAdminProfile->GetKey()); } else { @@ -46,7 +48,8 @@ class ImportTest extends ItopDataTestCase { } } - public function ImportOkProvider(){ + public function ImportOkProvider() + { return [ 'with reconciliation key' => [ "sReconciliationKeys" => "name,first_name,org_id->name" ], 'without reconciliation key' => [ "sReconciliationKeys" => null ], @@ -55,7 +58,8 @@ class ImportTest extends ItopDataTestCase { /** * @dataProvider ImportOkProvider */ - public function testImportOk($sReconciliationKeys){ + public function testImportOk($sReconciliationKeys) + { $sFirstName = "firstname_UID"; $sLastName = "lastname_UID"; $sEmail = "email_UID@toto.fr"; @@ -70,15 +74,16 @@ class ImportTest extends ItopDataTestCase { ); } - public function ImportFailProvider(){ + public function ImportFailProvider() + { return [ 'without reconciliation key' => [ "sReconciliationKeys" => null, - "sExpectedLastLineNeedle" => 'Issue: Unexpected attribute value(s);n/a;n/a;No match for value \'gabuzomeu\'. Some possible \'Organization\' value(s): ' + "sExpectedLastLineNeedle" => 'Issue: Unexpected attribute value(s);n/a;n/a;No match for value \'gabuzomeu\'. Some possible \'Organization\' value(s): ', ], 'with reconciliation key' => [ "sReconciliationKeys" => "name,first_name,org_id->name", - "sExpectedLastLineNeedle" => 'Issue: failed to reconcile;n/a;n/a;No match for value \'gabuzomeu\'. Some possible \'Organization\' value(s): ' + "sExpectedLastLineNeedle" => 'Issue: failed to reconcile;n/a;n/a;No match for value \'gabuzomeu\'. Some possible \'Organization\' value(s): ', ], ]; } @@ -86,7 +91,8 @@ class ImportTest extends ItopDataTestCase { * @dataProvider ImportFailProvider */ - public function testImportFail_ExternalKey($sReconciliationKeys, $sExpectedLastLineNeedle){ + public function testImportFail_ExternalKey($sReconciliationKeys, $sExpectedLastLineNeedle) + { $sFirstName = "firstname_UID"; $sLastName = "lastname_UID"; $sEmail = "email_UID@toto.fr"; @@ -101,7 +107,8 @@ class ImportTest extends ItopDataTestCase { ); } - public function testImportFail_Enum(){ + public function testImportFail_Enum() + { $sFirstName = "firstname_UID"; $sLastName = "lastname_UID"; $sEmail = "email_UID@toto.fr"; @@ -110,7 +117,10 @@ class ImportTest extends ItopDataTestCase { '"first_name","name", "email", "org_id->name", status', sprintf('"%s", "%s", "%s", UID, toto', $sFirstName, $sLastName, $sEmail), sprintf( - 'Issue: Unexpected attribute value(s);n/a;n/a;ORGID;"%s";"%s";"%s";\'toto\' is an invalid value. Unexpected value for attribute \'status\': Value not allowed [toto]', $sFirstName, $sLastName, $sEmail + 'Issue: Unexpected attribute value(s);n/a;n/a;ORGID;"%s";"%s";"%s";\'toto\' is an invalid value. Unexpected value for attribute \'status\': Value not allowed [toto]', + $sFirstName, + $sLastName, + $sEmail ), null, 1, @@ -118,7 +128,8 @@ class ImportTest extends ItopDataTestCase { ); } - public function testImportFail_Date(){ + public function testImportFail_Date() + { $sFirstName = "firstname_UID"; $sLastName = "lastname_UID"; $sEmail = "email_UID@toto.fr"; @@ -127,7 +138,10 @@ class ImportTest extends ItopDataTestCase { '"first_name","name", "email", "org_id->name", obsolescence_date', sprintf('"%s", "%s", "%s", UID, toto', $sFirstName, $sLastName, $sEmail), sprintf( - 'Issue: Internal error: CoreUnexpectedValue, Wrong format for date attribute obsolescence_date, expecting "Y-m-d" and got "toto";n/a;n/a;n/a;%s;%s;%s;toto', $sFirstName, $sLastName, $sEmail + 'Issue: Internal error: CoreUnexpectedValue, Wrong format for date attribute obsolescence_date, expecting "Y-m-d" and got "toto";n/a;n/a;n/a;%s;%s;%s;toto', + $sFirstName, + $sLastName, + $sEmail ), null, 1, @@ -135,7 +149,8 @@ class ImportTest extends ItopDataTestCase { ); } - private function performImportTesting($sCsvHeaders, $sCsvFirstLineValues, $sExpectedLastLineNeedle, $sReconciliationKeys=null, $iExpectedIssue=1, $iExpectedCreated=0) { + private function performImportTesting($sCsvHeaders, $sCsvFirstLineValues, $sExpectedLastLineNeedle, $sReconciliationKeys = null, $iExpectedIssue = 1, $iExpectedCreated = 0) + { $sContent = << 'details', ]; - if (null != $sReconciliationKeys){ + if (null != $sReconciliationKeys) { $aParams["reconciliationkeys"] = $sReconciliationKeys; } @@ -171,13 +186,13 @@ CSVFILE; $iOrgId = $this->oOrg->GetKey(); $sLastLineNeedle = $sExpectedLastLineNeedle; - foreach (["ORGID" => $iOrgId, "UID" => $this->sUid] as $sSearch => $sReplace){ + foreach (["ORGID" => $iOrgId, "UID" => $this->sUid] as $sSearch => $sReplace) { $sLastLineNeedle = str_replace($sSearch, $sReplace, $sLastLineNeedle); } $this->assertStringContainsString($sLastLineNeedle, $sLastline, 'The script we launched in an external process returned a value different than the expected error message'); $sPattern = "/Person;(\d+);/"; - if (preg_match($sPattern,$sLastline,$aMatches)){ + if (preg_match($sPattern, $sLastline, $aMatches)) { var_dump($aMatches); $iObjId = $aMatches[1]; $oObj = MetaModel::GetObject("Person", $iObjId); diff --git a/tests/php-unit-tests/unitary-tests/webservices/RestTest.php b/tests/php-unit-tests/unitary-tests/webservices/RestTest.php index 6b1c6848a..e13035b36 100644 --- a/tests/php-unit-tests/unitary-tests/webservices/RestTest.php +++ b/tests/php-unit-tests/unitary-tests/webservices/RestTest.php @@ -7,7 +7,6 @@ use Exception; use MetaModel; use utils; - /** * @group itopRequestMgmt * @group restApi @@ -15,12 +14,12 @@ use utils; */ class RestTest extends ItopDataTestCase { - const USE_TRANSACTION = false; - const CREATE_TEST_ORG = false; + public const USE_TRANSACTION = false; + public const CREATE_TEST_ORG = false; - static private $sUrl; - static private $sLogin; - static private $sPassword = "Iuytrez9876543ç_è-("; + private static $sUrl; + private static $sLogin; + private static $sPassword = "Iuytrez9876543ç_è-("; /** * This method is called before the first test of this test class is run (in the current process). @@ -50,8 +49,8 @@ class RestTest extends ItopDataTestCase $this->CreateTestOrganization(); - $oRestProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'REST Services User'), true); - $oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'Administrator'), true); + $oRestProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => 'REST Services User'], true); + $oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => 'Administrator'], true); if (is_object($oRestProfile) && is_object($oAdminProfile)) { $oUser = $this->CreateUser(static::$sLogin, $oRestProfile->GetKey(), static::$sPassword); @@ -106,7 +105,8 @@ class RestTest extends ItopDataTestCase $this->assertEquals(0, $aJSONResultAsArray['code'], $sJSONResult); } - public function testCoreApiGet(){ + public function testCoreApiGet() + { // Create ticket $description = date('dmY H:i:s'); $oTicket = $this->CreateSampleTicket($description); @@ -190,12 +190,13 @@ JSON; * array_key_first comes with PHP7.3 * itop should also work with previous PHP versions */ - private function array_key_first($aTab){ - if (!is_array($aTab) || empty($aTab)){ + private function array_key_first($aTab) + { + if (!is_array($aTab) || empty($aTab)) { return false; } - foreach ($aTab as $sKey => $sVal){ + foreach ($aTab as $sKey => $sVal) { return $sKey; } } @@ -258,7 +259,7 @@ JSON; $oTicket = $this->createObject('UserRequest', [ 'org_id' => $this->getTestOrgId(), "title" => "Houston, got a problem", - "description" => $description + "description" => $description, ]); return $oTicket; } @@ -287,8 +288,7 @@ JSON; $oCurlFile = curl_file_create($sTmpFile); $aPostFields['json_data'] = $oCurlFile; - } - else { + } else { $aPostFields['json_data'] = $sJsonDataContent; } } @@ -306,7 +306,7 @@ JSON; curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $sJson = curl_exec($ch); - curl_close ($ch); + curl_close($ch); if (!is_null($sTmpFile)) { unlink($sTmpFile); diff --git a/webservices/backoffice.dataloader.php b/webservices/backoffice.dataloader.php index c73ca047f..b4479974c 100644 --- a/webservices/backoffice.dataloader.php +++ b/webservices/backoffice.dataloader.php @@ -1,4 +1,5 @@ p("No memory limit has been defined in this instance of PHP"); - } - else - { + $oP->p("No memory limit has been defined in this instance of PHP"); + } else { // Check that the limit will allow us to load the data // $iMemoryLimit = utils::ConvertToBytes($sMemoryLimit); - if (!utils::IsMemoryLimitOk($iMemoryLimit, SAFE_MINIMUM_MEMORY)) - { - if (ini_set('memory_limit', SAFE_MINIMUM_MEMORY) === FALSE) - { - $oP->p("memory_limit is too small: $iMemoryLimit and can not be increased by the script itself."); - } - else - { - $oP->p("memory_limit increased from $iMemoryLimit to ".SAFE_MINIMUM_MEMORY."."); + if (!utils::IsMemoryLimitOk($iMemoryLimit, SAFE_MINIMUM_MEMORY)) { + if (ini_set('memory_limit', SAFE_MINIMUM_MEMORY) === false) { + $oP->p("memory_limit is too small: $iMemoryLimit and can not be increased by the script itself."); + } else { + $oP->p("memory_limit increased from $iMemoryLimit to ".SAFE_MINIMUM_MEMORY."."); } } } } - //////////////////////////////////////////////////////////////////////////////// // // Main @@ -87,9 +79,7 @@ $sFileName = Utils::ReadParam('file', '', false, 'raw_data'); $oP = new WebPage("iTop - Backoffice data loader"); - -try -{ +try { // Note: the data model must be loaded first $oDataLoader = new XMLDataLoader(); @@ -102,8 +92,7 @@ try SetMemoryLimit($oP); - - // The XMLDataLoader constructor has initialized the DB, let's start a transaction + // The XMLDataLoader constructor has initialized the DB, let's start a transaction CMDBSource::Query('START TRANSACTION'); $oP->p("Starting data load."); @@ -128,26 +117,21 @@ try } } $aWarnings = $oDataLoader->GetWarnings(); - if (count($aWarnings) > 0) - { + if (count($aWarnings) > 0) { $oP->p('Warnings ('.count($aWarnings).')'); - foreach ($aWarnings as $sMsg) - { + foreach ($aWarnings as $sMsg) { $oP->p(' * '.$sMsg); } } } -} -catch(Exception $e) -{ - $oP->p("An error happened while loading the data: ".$e->getMessage()); +} catch (Exception $e) { + $oP->p("An error happened while loading the data: ".$e->getMessage()); $oP->p("Aborting (no data written)..."); CMDBSource::Query('ROLLBACK'); } -if (function_exists('memory_get_peak_usage')) -{ +if (function_exists('memory_get_peak_usage')) { $oP->p("Information: memory peak usage: ".memory_get_peak_usage()); } diff --git a/webservices/createfrommail.php b/webservices/createfrommail.php index a83488754..4ed93177c 100644 --- a/webservices/createfrommail.php +++ b/webservices/createfrommail.php @@ -41,12 +41,11 @@ require_once(APPROOT.'/application/startup.inc.php'); function GetSender($aHeaders) { - $aResult = array('name' => '', 'email' => ''); + $aResult = ['name' => '', 'email' => '']; $aResult['name'] = $aHeaders['From']; - $aMatches = array(); - if (preg_match('/\(([0-9a-zA-Z\._]+)@(.+)@(.+)\)/U', array_pop($aHeaders['Received']), $aMatches)) - { - $aResult['email'] = $aMatches[1].'@'.$aMatches[2]; + $aMatches = []; + if (preg_match('/\(([0-9a-zA-Z\._]+)@(.+)@(.+)\)/U', array_pop($aHeaders['Received']), $aMatches)) { + $aResult['email'] = $aMatches[1].'@'.$aMatches[2]; } return $aResult; } @@ -61,16 +60,14 @@ function GetSender($aHeaders) function CreateTicket($sSenderEmail, $sSubject, $sBody) { $oTicket = null; - try - { + try { $oContactSearch = new DBObjectSearch('Contact'); // Can be either a Person or a Team, but must be a valid Contact $oContactSearch->AddCondition('email', $sSenderEmail, '='); $oSet = new DBObjectSet($oContactSearch); - if ($oSet->Count() == 1) - { + if ($oSet->Count() == 1) { $oContact = $oSet->Fetch(); $oOrganization = MetaModel::GetObject('Organization', $oContact->Get('org_id')); - $oTicket = new UserRequest; + $oTicket = new UserRequest(); $oTicket->Set('title', $sSubject); $oTicket->Set('description', $sBody); $oTicket->Set('org_id', $oOrganization->GetKey()); @@ -86,14 +83,10 @@ function CreateTicket($sSenderEmail, $sSubject, $sBody) $sUserString = $oContact->GetName().', submitted by email'; CMDBObject::SetTrackInfo($sUserString); $oTicket->DBInsert(); - } - else - { + } else { echo "No contact found in iTop having the email: $sSenderEmail, email message ignored.\n"; } - } - catch(Exception $e) - { + } catch (Exception $e) { echo "Error: exception ".$e->getMessage(); $oTicket = null; } @@ -111,15 +104,14 @@ $oPop3->login(MAILBOX_ACCOUNT, MAILBOX_PASSWORD); // Note: it is expected that the sender of the email exists a valid contact as a 'Contact' // in iTop (identified by her/his email address), otherwise the ticket creation will fail $iNbMessages = $oPop3->numMsg(); -for($index = 1; $index <= $iNbMessages; $index++) -{ +for ($index = 1; $index <= $iNbMessages; $index++) { $params['include_bodies'] = true; $params['decode_bodies'] = true; $params['decode_headers'] = true; $params['crlf'] = "\r\n"; $aHeaders = $oPop3->getParsedHeaders($index); $aSender = GetSender($aHeaders); - $oDecoder = new Mail_mimeDecode( $oPop3->getRawHeaders($index).$params['crlf'].$oPop3->getBody($index) ); + $oDecoder = new Mail_mimeDecode($oPop3->getRawHeaders($index).$params['crlf'].$oPop3->getBody($index)); $oStructure = $oDecoder->decode($params); $sSubject = $aHeaders['Subject']; // Search for the text/plain body part @@ -129,19 +121,14 @@ for($index = 1; $index <= $iNbMessages; $index++) //echo "
    \n";
     	//print_r($oStructure);
     	//echo "
    \n"; - if (!isset($oStructure->parts) || count($oStructure->parts) == 0) - { + if (!isset($oStructure->parts) || count($oStructure->parts) == 0) { $sTextBody = $oStructure->body; - } - else - { + } else { // Find the first "part" of the body which is in text/plain - while( ($iPartIndex < count($oStructure->parts)) && (!$bFound) ) - { + while (($iPartIndex < count($oStructure->parts)) && (!$bFound)) { //echo "

    Reading part $iPartIndex

    \n"; - if ( ($oStructure->parts[$iPartIndex]->ctype_primary == 'text') && - ($oStructure->parts[$iPartIndex]->ctype_secondary == 'plain') ) - { + if (($oStructure->parts[$iPartIndex]->ctype_primary == 'text') && + ($oStructure->parts[$iPartIndex]->ctype_secondary == 'plain')) { $sTextBody = $oStructure->parts[$iPartIndex]->body; $bFound = true; //echo "

    Plain text found ! ($sTextBody)

    \n"; @@ -149,14 +136,11 @@ for($index = 1; $index <= $iNbMessages; $index++) $iPartIndex++; } // Try again but this time look for an HTML part - if (!$bFound) - { - while( ($iPartIndex < count($oStructure->parts)) && (!$bFound) ) - { + if (!$bFound) { + while (($iPartIndex < count($oStructure->parts)) && (!$bFound)) { //echo "

    Reading part $iPartIndex

    \n"; - if ( ($oStructure->parts[$iPartIndex]->ctype_primary == 'text') && - ($oStructure->parts[$iPartIndex]->ctype_secondary == 'html') ) - { + if (($oStructure->parts[$iPartIndex]->ctype_primary == 'text') && + ($oStructure->parts[$iPartIndex]->ctype_secondary == 'html')) { $sTextBody = $oStructure->parts[$iPartIndex]->body; $bFound = true; //echo "

    HTML text found ! (".htmlentities($sTextBody, ENT_QUOTES, 'UTF-8').")

    \n"; @@ -171,11 +155,10 @@ for($index = 1; $index <= $iNbMessages; $index++) // name => 'john foo $oTicket = CreateTicket($aSender['email'], $sSubject, $sTextBody); - if ($oTicket != null) - { + if ($oTicket != null) { // Ticket created, delete the email $oPop3->deleteMsg($index); - echo "Ticket: ".$oTicket->GetName()." created.\n"; + echo "Ticket: ".$oTicket->GetName()." created.\n"; } } $oPop3->disconnect(); diff --git a/webservices/cron.php b/webservices/cron.php index f51a46f64..1d788cca6 100644 --- a/webservices/cron.php +++ b/webservices/cron.php @@ -1,4 +1,5 @@ p("ERROR: Missing argument '$sParam'\n"); UsageAndExit($oP); } @@ -63,13 +61,10 @@ function UsageAndExit($oP) { $bModeCLI = ($oP instanceof CLIPage); - if ($bModeCLI) - { + if ($bModeCLI) { $oP->p("USAGE:\n"); $oP->p("php cron.php --auth_user= --auth_pwd= [--param_file=] [--verbose=1] [--debug=1] [--status_only=1]\n"); - } - else - { + } else { $oP->p("Optional parameters: verbose, param_file, status_only\n"); } $oP->output(); @@ -93,7 +88,7 @@ function UsageAndExit($oP) function RunTask(BackgroundTask $oTask, $iTimeLimit) { $TaskClass = $oTask->Get('class_name'); - $oProcess = new $TaskClass; + $oProcess = new $TaskClass(); $oRefClass = new ReflectionClass(get_class($oProcess)); $oDateStarted = new DateTime(); $oDatePlanned = new DateTime($oTask->Get('next_run_date')); @@ -102,8 +97,7 @@ function RunTask(BackgroundTask $oTask, $iTimeLimit) $sMessage = ''; $oExceptionToThrow = null; - try - { + try { // Record (when starting) that this task was started, just in case it crashes during the execution $oTask->Set('latest_run_date', $oDateStarted->format('Y-m-d H:i:s')); // Record the current user running the cron @@ -113,42 +107,30 @@ function RunTask(BackgroundTask $oTask, $iTimeLimit) // Time in seconds allowed to the task $iCurrTimeLimit = $iTimeLimit; // Compute allowed time - if ($oRefClass->implementsInterface('iScheduledProcess') === false) - { + if ($oRefClass->implementsInterface('iScheduledProcess') === false) { // Periodic task, allow only X times ($iMaxTaskExecutionTime) its periodicity (GetPeriodicity()) $iMaxTaskExecutionTime = MetaModel::GetConfig()->Get('cron_task_max_execution_time'); $iTaskLimit = time() + $oProcess->GetPeriodicity() * $iMaxTaskExecutionTime; // If our proposed time limit is less than cron limit, and cron_task_max_execution_time is > 0 - if ($iTaskLimit < $iTimeLimit && $iMaxTaskExecutionTime > 0) - { + if ($iTaskLimit < $iTimeLimit && $iMaxTaskExecutionTime > 0) { $iCurrTimeLimit = $iTaskLimit; } } $sMessage = $oProcess->Process($iCurrTimeLimit); $oTask->Set('running', 0); - } - catch (MySQLHasGoneAwayException $e) - { + } catch (MySQLHasGoneAwayException $e) { throw $e; - } - catch (ProcessFatalException $e) - { + } catch (ProcessFatalException $e) { $oExceptionToThrow = $e; - } - catch (Exception $e) // we shouldn't get so much exceptions... but we need to handle legacy code, and cron.php has to keep running - { - if ($oTask->IsDebug()) - { - $sMessage = 'Processing failed with message: '. $e->getMessage() . '. ' . $e->getTraceAsString(); - } - else - { - $sMessage = 'Processing failed with message: '. $e->getMessage(); + } catch (Exception $e) { // we shouldn't get so much exceptions... but we need to handle legacy code, and cron.php has to keep running + if ($oTask->IsDebug()) { + $sMessage = 'Processing failed with message: '.$e->getMessage().'. '.$e->getTraceAsString(); + } else { + $sMessage = 'Processing failed with message: '.$e->getMessage(); } } $fDuration = microtime(true) - $fStart; - if ($oTask->Get('total_exec_count') == 0) - { + if ($oTask->Get('total_exec_count') == 0) { // First execution $oTask->Set('first_run_date', $oDateStarted->format('Y-m-d H:i:s')); } @@ -158,20 +140,16 @@ function RunTask(BackgroundTask $oTask, $iTimeLimit) $oDateEnded = new DateTime(); $oTask->Set('latest_run_date', $oDateEnded->format('Y-m-d H:i:s')); - if ($oRefClass->implementsInterface('iScheduledProcess')) - { + if ($oRefClass->implementsInterface('iScheduledProcess')) { // Schedules process do repeat at specific moments $oPlannedStart = $oProcess->GetNextOccurrence(); - } - else - { + } else { // Background processes do repeat periodically $oPlannedStart = clone $oDatePlanned; // Let's schedule from the previous planned date of execution to avoid shift $oPlannedStart->modify($oProcess->GetPeriodicity().' seconds'); $oEnd = new DateTime(); - while ($oPlannedStart->format('U') < $oEnd->format('U')) - { + while ($oPlannedStart->format('U') < $oEnd->format('U')) { // Next planned start is already in the past, increase it again by a period $oPlannedStart = $oPlannedStart->modify('+'.$oProcess->GetPeriodicity().' seconds'); } @@ -180,8 +158,7 @@ function RunTask(BackgroundTask $oTask, $iTimeLimit) $oTask->Set('next_run_date', $oPlannedStart->format('Y-m-d H:i:s')); $oTask->DBUpdate(); - if ($oExceptionToThrow) - { + if ($oExceptionToThrow) { throw $oExceptionToThrow; } @@ -207,23 +184,21 @@ function RunTask(BackgroundTask $oTask, $iTimeLimit) * @throws \OQLException * @throws \ReflectionException */ -function CronExec($oP, $bVerbose, $bDebug=false) +function CronExec($oP, $bVerbose, $bDebug = false) { $iStarted = time(); $iMaxDuration = MetaModel::GetConfig()->Get('cron_max_execution_time'); $iTimeLimit = $iStarted + $iMaxDuration; $iCronSleep = MetaModel::GetConfig()->Get('cron_sleep'); - if ($bVerbose) - { + if ($bVerbose) { $oP->p("Planned duration = $iMaxDuration seconds"); $oP->p("Loop pause = $iCronSleep seconds"); } ReSyncProcesses($oP, $bVerbose, $bDebug); - while (time() < $iTimeLimit) - { + while (time() < $iTimeLimit) { CheckMaintenanceMode($oP); $oNow = new DateTime(); @@ -234,23 +209,19 @@ function CronExec($oP, $bVerbose, $bDebug=false) $oTasks = new DBObjectSet($oSearch, ['next_run_date' => true]); $bWorkDone = false; - if ($oTasks->CountExceeds(0)) - { + if ($oTasks->CountExceeds(0)) { $bWorkDone = true; - $aTasks = array(); - if ($bVerbose) - { + $aTasks = []; + if ($bVerbose) { $sCount = $oTasks->Count(); $oP->p("$sCount Tasks planned to run now ($sNow):"); $oP->p('+---------------------------+---------+---------------------+---------------------+'); $oP->p('| Task Class | Status | Last Run | Next Run |'); $oP->p('+---------------------------+---------+---------------------+---------------------+'); } - while ($oTask = $oTasks->Fetch()) - { + while ($oTask = $oTasks->Fetch()) { $aTasks[$oTask->Get('class_name')] = $oTask; - if ($bVerbose) - { + if ($bVerbose) { $sTaskName = $oTask->Get('class_name'); $sStatus = $oTask->Get('status'); $sLastRunDate = $oTask->Get('latest_run_date'); @@ -258,13 +229,11 @@ function CronExec($oP, $bVerbose, $bDebug=false) $oP->p(sprintf('| %1$-25.25s | %2$-7s | %3$-19s | %4$-19s |', $sTaskName, $sStatus, $sLastRunDate, $sNextRunDate)); } } - if ($bVerbose) - { + if ($bVerbose) { $oP->p('+---------------------------+---------+---------------------+---------------------+'); } $aRunTasks = []; - foreach ($aTasks as $oTask) - { + foreach ($aTasks as $oTask) { $sTaskClass = $oTask->Get('class_name'); $aRunTasks[] = $sTaskClass; @@ -273,66 +242,54 @@ function CronExec($oP, $bVerbose, $bDebug=false) CMDBObject::SetCurrentChangeFromParams("Background task ($sTaskClass)"); // Run the task and record its next run time - if ($bVerbose) - { + if ($bVerbose) { $oNow = new DateTime(); $oP->p(">> === ".$oNow->format('Y-m-d H:i:s').sprintf(" Starting:%-'=49s", ' '.$sTaskClass.' ')); } - try - { + try { $sMessage = RunTask($aTasks[$sTaskClass], $iTimeLimit); - } catch (MySQLHasGoneAwayException $e) - { + } catch (MySQLHasGoneAwayException $e) { $oP->p("ERROR : 'MySQL has gone away' thrown when processing $sTaskClass (error_code=".$e->getCode().")"); exit(EXIT_CODE_FATAL); - } catch (ProcessFatalException $e) - { + } catch (ProcessFatalException $e) { $oP->p("ERROR : an exception was thrown when processing '$sTaskClass' (".$e->getInfoLog().")"); IssueLog::Error("Cron.php error : an exception was thrown when processing '$sTaskClass' (".$e->getInfoLog().')'); } - if ($bVerbose) - { - if (!empty($sMessage)) - { + if ($bVerbose) { + if (!empty($sMessage)) { $oP->p("$sTaskClass: $sMessage"); } $oEnd = new DateTime(); $sNextRunDate = $oTask->Get('next_run_date'); $oP->p("<< === ".$oEnd->format('Y-m-d H:i:s').sprintf(" End of: %-'=42s", ' '.$sTaskClass.' ')." Next: $sNextRunDate"); } - if (time() > $iTimeLimit) - { + if (time() > $iTimeLimit) { break 2; } CheckMaintenanceMode($oP); } // Tasks to run later - if ($bVerbose) - { + if ($bVerbose) { $oP->p('--'); $oSearch = new DBObjectSearch('BackgroundTask'); $oSearch->AddCondition('next_run_date', $sNow, '>'); $oSearch->AddCondition('status', 'active'); $oTasks = new DBObjectSet($oSearch, ['next_run_date' => true]); - while ($oTask = $oTasks->Fetch()) - { - if (!in_array($oTask->Get('class_name'), $aRunTasks)) - { + while ($oTask = $oTasks->Fetch()) { + if (!in_array($oTask->Get('class_name'), $aRunTasks)) { $oP->p(sprintf("-- Skipping task: %-'-40s", $oTask->Get('class_name').' ')." until: ".$oTask->Get('next_run_date')); } } } } - if ($bVerbose && $bWorkDone) - { + if ($bVerbose && $bWorkDone) { $oP->p("Sleeping...\n"); } sleep($iCronSleep); } - if ($bVerbose) - { + if ($bVerbose) { $oP->p(''); DisplayStatus($oP, ['next_run_date' => true]); $oP->p("Reached normal execution time limit (exceeded by ".(time() - $iTimeLimit)."s)"); @@ -342,8 +299,9 @@ function CronExec($oP, $bVerbose, $bDebug=false) /** * @param WebPage $oP */ -function CheckMaintenanceMode(Page $oP) { -// Verify files instead of reloading the full config each time +function CheckMaintenanceMode(Page $oP) +{ + // Verify files instead of reloading the full config each time if (file_exists(MAINTENANCE_MODE_FILE) || file_exists(READONLY_MODE_FILE)) { $oP->p("Maintenance detected, exiting"); exit(EXIT_CODE_ERROR); @@ -367,16 +325,22 @@ function DisplayStatus($oP, $aTaskOrderBy = []) $oP->p('+---------------------------+---------+---------------------+---------------------+--------+-----------+'); $oP->p('| Task Class | Status | Last Run | Next Run | Nb Run | Avg. Dur. |'); $oP->p('+---------------------------+---------+---------------------+---------------------+--------+-----------+'); - while ($oTask = $oTasks->Fetch()) - { + while ($oTask = $oTasks->Fetch()) { $sTaskName = $oTask->Get('class_name'); $sStatus = $oTask->Get('status'); $sLastRunDate = $oTask->Get('latest_run_date'); $sNextRunDate = $oTask->Get('next_run_date'); $iNbRun = (int)$oTask->Get('total_exec_count'); $sAverageRunTime = $oTask->Get('average_run_duration'); - $oP->p(sprintf('| %1$-25.25s | %2$-7s | %3$-19s | %4$-19s | %5$6d | %6$7s s |', $sTaskName, $sStatus, - $sLastRunDate, $sNextRunDate, $iNbRun, $sAverageRunTime)); + $oP->p(sprintf( + '| %1$-25.25s | %2$-7s | %3$-19s | %4$-19s | %5$6d | %6$7s s |', + $sTaskName, + $sStatus, + $sLastRunDate, + $sNextRunDate, + $iNbRun, + $sAverageRunTime + )); } $oP->p('+---------------------------+---------+---------------------+---------------------+--------+-----------+'); } @@ -401,22 +365,19 @@ function ReSyncProcesses($oP, $bVerbose, $bDebug) // $oSearch = new DBObjectSearch('BackgroundTask'); $oTasks = new DBObjectSet($oSearch); - $aTasks = array(); - while ($oTask = $oTasks->Fetch()) - { + $aTasks = []; + while ($oTask = $oTasks->Fetch()) { $aTasks[$oTask->Get('class_name')] = $oTask; } $oNow = new DateTime(); - $aProcesses = array(); - foreach (InterfaceDiscovery::GetInstance()->FindItopClasses(iProcess::class) as $sTaskClass) - { - $oProcess = new $sTaskClass; + $aProcesses = []; + foreach (InterfaceDiscovery::GetInstance()->FindItopClasses(iProcess::class) as $sTaskClass) { + $oProcess = new $sTaskClass(); $aProcesses[$sTaskClass] = $oProcess; // Create missing entry if needed - if (!array_key_exists($sTaskClass, $aTasks)) - { + if (!array_key_exists($sTaskClass, $aTasks)) { // New entry, let's create a new BackgroundTask record, and plan the first execution $oTask = new BackgroundTask(); $oTask->SetDebug($bDebug); @@ -426,41 +387,32 @@ function ReSyncProcesses($oP, $bVerbose, $bDebug) $oTask->Set('max_run_duration', 0); $oTask->Set('average_run_duration', 0); $oRefClass = new ReflectionClass($sTaskClass); - if ($oRefClass->implementsInterface('iScheduledProcess')) - { + if ($oRefClass->implementsInterface('iScheduledProcess')) { $oNextOcc = $oProcess->GetNextOccurrence(); $oTask->Set('next_run_date', $oNextOcc->format('Y-m-d H:i:s')); - } - else - { + } else { // Background processes do start asap, i.e. "now" $oTask->Set('next_run_date', $oNow->format('Y-m-d H:i:s')); } - if ($bVerbose) - { + if ($bVerbose) { $oP->p('Creating record for: '.$sTaskClass); $oP->p('First execution planned at: '.$oTask->Get('next_run_date')); } $oTask->DBInsert(); - } - else - { + } else { /** @var \BackgroundTask $oTask */ $oTask = $aTasks[$sTaskClass]; - if ($oTask->Get('next_run_date') == '3000-01-01 00:00:00') - { + if ($oTask->Get('next_run_date') == '3000-01-01 00:00:00') { // check for rescheduled tasks $oRefClass = new ReflectionClass($sTaskClass); - if ($oRefClass->implementsInterface('iScheduledProcess')) - { + if ($oRefClass->implementsInterface('iScheduledProcess')) { $oNextOcc = $oProcess->GetNextOccurrence(); $oTask->Set('next_run_date', $oNextOcc->format('Y-m-d H:i:s')); $oTask->DBUpdate(); } } // Reactivate task if necessary - if ($oTask->Get('status') == 'removed') - { + if ($oTask->Get('status') == 'removed') { $oTask->Set('status', 'active'); $oTask->DBUpdate(); } @@ -470,21 +422,17 @@ function ReSyncProcesses($oP, $bVerbose, $bDebug) } // Remove all the tasks not having a valid class - foreach ($aTasks as $oTask) - { + foreach ($aTasks as $oTask) { $sTaskClass = $oTask->Get('class_name'); - if (!class_exists($sTaskClass)) - { + if (!class_exists($sTaskClass)) { $oTask->Set('status', 'removed'); $oTask->DBUpdate(); } } - if ($bVerbose) - { - $aDisplayProcesses = array(); - foreach ($aProcesses as $oExecInstance) - { + if ($bVerbose) { + $aDisplayProcesses = []; + foreach ($aProcesses as $oExecInstance) { $aDisplayProcesses[] = get_class($oExecInstance); } $sDisplayProcesses = implode(', ', $aDisplayProcesses); @@ -500,58 +448,45 @@ function ReSyncProcesses($oP, $bVerbose, $bDebug) set_time_limit(0); // Some background actions may really take long to finish (like backup) $bIsModeCLI = utils::IsModeCLI(); -if ($bIsModeCLI) -{ +if ($bIsModeCLI) { $oP = new CLIPage("iTop - cron"); SetupUtils::CheckPhpAndExtensionsForCli($oP, EXIT_CODE_FATAL); -} -else -{ +} else { $oP = new WebPage("iTop - cron"); } -try -{ +try { utils::UseParamFile(); $bVerbose = utils::ReadParam('verbose', false, true /* Allow CLI */); $bDebug = utils::ReadParam('debug', false, true /* Allow CLI */); - if ($bIsModeCLI) - { + if ($bIsModeCLI) { // Next steps: // specific arguments: 'csv file' // $sAuthUser = ReadMandatoryParam($oP, 'auth_user', 'raw_data'); $sAuthPwd = ReadMandatoryParam($oP, 'auth_pwd', 'raw_data'); - if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) - { + if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) { UserRights::Login($sAuthUser); // Login & set the user's language - } - else - { + } else { $oP->p("Access wrong credentials ('$sAuthUser')"); $oP->output(); exit(EXIT_CODE_ERROR); } - } - else - { + } else { require_once(APPROOT.'/application/loginwebpage.class.inc.php'); LoginWebPage::DoLogin(); // Check user rights and prompt if needed } - if (!UserRights::IsAdministrator()) - { + if (!UserRights::IsAdministrator()) { $oP->p("Access restricted to administrators"); $oP->Output(); exit(EXIT_CODE_ERROR); } - - if (utils::ReadParam('status_only', false, true /* Allow CLI */)) - { + if (utils::ReadParam('status_only', false, true /* Allow CLI */)) { // Display status and exit DisplayStatus($oP); exit(0); @@ -559,54 +494,36 @@ try require_once(APPROOT.'core/mutex.class.inc.php'); $oP->p("Starting: ".time().' ('.date('Y-m-d H:i:s').')'); -} -catch (Exception $e) -{ +} catch (Exception $e) { $oP->p("Error: ".$e->GetMessage()); $oP->output(); exit(EXIT_CODE_FATAL); } -try -{ +try { $oMutex = new iTopMutex('cron'); - if (!MetaModel::DBHasAccess(ACCESS_ADMIN_WRITE)) - { + if (!MetaModel::DBHasAccess(ACCESS_ADMIN_WRITE)) { $oP->p("A maintenance is ongoing"); - } - else - { - if ($oMutex->TryLock()) - { + } else { + if ($oMutex->TryLock()) { CronExec($oP, $bVerbose, $bDebug); - } - else - { + } else { // Exit silently $oP->p("Already running..."); } } -} -catch (Exception $e) -{ +} catch (Exception $e) { $oP->p("ERROR: '".$e->getMessage()."'"); - if ($bDebug) - { + if ($bDebug) { // Might contain verb parameters such a password... $oP->p($e->getTraceAsString()); } -} -finally -{ - try - { +} finally { + try { $oMutex->Unlock(); - } - catch (Exception $e) - { + } catch (Exception $e) { $oP->p("ERROR: '".$e->getMessage()."'"); - if ($bDebug) - { + if ($bDebug) { // Might contain verb parameters such a password... $oP->p($e->getTraceAsString()); } diff --git a/webservices/export-v2.php b/webservices/export-v2.php index a902bf044..ad268232c 100644 --- a/webservices/export-v2.php +++ b/webservices/export-v2.php @@ -1,4 +1,5 @@ p('ERROR: '.utils::HtmlEntities($sErrorMessage)); $oP->output(); exit(EXIT_CODE_ERROR); - } - else - { + } else { $oP = new WebPage("iTop - Export"); $oP->add_http_headers(); $oP->p('ERROR: '.utils::HtmlEntities($sErrorMessage)); @@ -54,15 +52,13 @@ function ReportErrorAndExit($sErrorMessage) function ReportErrorAndUsage($sErrorMessage) { - if (utils::IsModeCLI()) - { + if (utils::IsModeCLI()) { $oP = new CLIPage("iTop - Export"); $oP->p('ERROR: '.$sErrorMessage); Usage($oP); $oP->output(); exit(EXIT_CODE_ERROR); - } - else { + } else { $oP = new WebPage("iTop - Export"); $oP->add_http_headers(); $oP->p('ERROR: '.$sErrorMessage); @@ -74,42 +70,32 @@ function ReportErrorAndUsage($sErrorMessage) function Usage(Page $oP) { - if (Utils::IsModeCLI()) - { + if (Utils::IsModeCLI()) { $oP->p('Usage: php '.basename(__FILE__).' --auth_user= --auth_pwd= --expression= --query= [--arg_xxx=] [--no_localize=0|1] [--format=] [--format-options...]'); $oP->p("Parameters:"); $oP->p(" * auth_user: the iTop user account for authentication"); $oP->p(" * auth_pwd: the password of the iTop user account"); - } - else - { + } else { $oP->p("Parameters:"); } $oP->p(" * expression: an OQL expression (e.g. SELECT Contact WHERE name LIKE 'm%')"); $oP->p(" * query: (alternative to 'expression') the id of an entry from the query phrasebook"); - if (Utils::IsModeCLI()) - { + if (Utils::IsModeCLI()) { $oP->p(" * with_archive: (optional, defaults to 0) if set to 1 then the result set will include archived objects"); - } - else - { + } else { $oP->p(" * with_archive: (optional, defaults to the current mode) if set to 1 then the result set will include archived objects"); } $oP->p(" * arg_xxx: (needed if the query has parameters) the value of the parameter 'xxx'"); $aSupportedFormats = BulkExport::FindSupportedFormats(); $oP->p(" * format: (optional, default is html) the desired output format. Can be one of '".implode("', '", array_keys($aSupportedFormats))."'"); - foreach($aSupportedFormats as $sFormatCode => $sLabel) - { + foreach ($aSupportedFormats as $sFormatCode => $sLabel) { $oExporter = BulkExport::FindExporter($sFormatCode); - if ($oExporter !== null) - { - if (!Utils::IsModeCLI()) - { + if ($oExporter !== null) { + if (!Utils::IsModeCLI()) { $oP->add('
    '); } $oExporter->DisplayUsage($oP); - if (!Utils::IsModeCLI()) - { + if (!Utils::IsModeCLI()) { $oP->add(''); } } @@ -248,19 +234,18 @@ EOF $sExpressionError = ''; if (($sExpression === null) && ($sQueryId === null)) { $bExpressionIsValid = false; - } else if ($sExpression !== '') { + } elseif ($sExpression !== '') { try { $oExportSearch = DBObjectSearch::FromOQL($sExpression); $oExportSearch->UpdateContextFromUser(); - } - catch (OQLException $e) { + } catch (OQLException $e) { $bExpressionIsValid = false; $sExpressionError = $e->getMessage(); } } if (!$bExpressionIsValid) { - DisplayExpressionForm($oP, $sAction, $sExpression, $sExpressionError,$oForm); + DisplayExpressionForm($oP, $sAction, $sExpression, $sExpressionError, $oForm); return; } @@ -275,13 +260,12 @@ EOF $oExportSearch->UpdateContextFromUser(); $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden("query", $sQueryId)); } - $aFormPartsByFormat = array(); - $aAllFormParts = array(); + $aFormPartsByFormat = []; + $aAllFormParts = []; if ($sFormat == null) { // No specific format chosen $sDefaultFormat = utils::ReadParam('format', 'xlsx'); - $oSelect = SelectUIBlockFactory::MakeForSelectWithLabel("format", Dict::S('Core:BulkExport:ExportFormatPrompt'), "format_selector"); $oSelect->SetIsLabelBefore(true); $oForm->AddSubBlock($oSelect); @@ -390,7 +374,7 @@ EOF if ($sExpression === null) { // No expression supplied, let's check if phrasebook entry is given if ($sQueryId !== null) { - $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', array('query_id' => $sQueryId)); + $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', ['query_id' => $sQueryId]); $oSearch->UpdateContextFromUser(); $oQueries = new DBObjectSet($oSearch); if ($oQueries->Count() > 0) { @@ -412,7 +396,6 @@ EOF } } - if ($sFormat !== null) { $oExporter = BulkExport::FindExporter($sFormat); if ($oExporter === null) { @@ -452,7 +435,7 @@ function CheckParameters($sExpression, $sQueryId, $sFormat) // Either $sExpression or $sQueryId must be specified if ($sExpression === null) { - $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', array('query_id' => $sQueryId)); + $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', ['query_id' => $sQueryId]); $oSearch->UpdateContextFromUser(); $oQueries = new DBObjectSet($oSearch); if ($oQueries->Count() > 0) { @@ -470,7 +453,7 @@ function CheckParameters($sExpression, $sQueryId, $sFormat) try { $oSearch = DBObjectSearch::FromOQL($sExpression); $oSearch->UpdateContextFromUser(); - $aArgs = array(); + $aArgs = []; foreach ($oSearch->GetQueryParams() as $sParam => $foo) { $value = utils::ReadParam('arg_'.$sParam, null, true, 'raw_data'); if (!is_null($value)) { @@ -483,30 +466,23 @@ function CheckParameters($sExpression, $sQueryId, $sFormat) $sFormat = utils::ReadParam('format', 'html', true /* Allow CLI */, 'raw_data'); $oExporter = BulkExport::FindExporter($sFormat, $oSearch); - if ($oExporter == null) - { + if ($oExporter == null) { $aSupportedFormats = BulkExport::FindSupportedFormats(); ReportErrorAndExit("Invalid output format: '$sFormat'. The supported formats are: ".implode(', ', array_keys($aSupportedFormats))); } - } - catch(MissingQueryArgument $e) - { + } catch (MissingQueryArgument $e) { $oSearch = null; ReportErrorAndUsage("Invalid OQL query: '".utils::HtmlEntities($sExpression)."'.\n".utils::HtmlEntities($e->getMessage())); - } - catch(OQLException $e) - { + } catch (OQLException $e) { $oSearch = null; ReportErrorAndExit("Invalid OQL query: '".utils::HtmlEntities($sExpression)."'.\n".utils::HtmlEntities($e->getMessage())); - } - catch(Exception $e) - { + } catch (Exception $e) { $oSearch = null; ReportErrorAndExit(utils::HtmlEntities($e->getMessage())); } // update last export information if check parameters ok - if($oQuery != null){ + if ($oQuery != null) { $oQuery->UpdateLastExportInformation(); } @@ -522,24 +498,18 @@ function DoExport(WebPage $oP, BulkExport $oExporter, $bInteractive = false) { $oExporter->SetHttpHeaders($oP); $exportResult = $oExporter->GetHeader(); - $aStatus = array(); - do - { + $aStatus = []; + do { $exportResult .= $oExporter->GetNextChunk($aStatus); - } - while (($aStatus['code'] != 'done') && ($aStatus['code'] != 'error')); + } while (($aStatus['code'] != 'done') && ($aStatus['code'] != 'error')); - if ($aStatus['code'] == 'error') - { + if ($aStatus['code'] == 'error') { $oExporter->Cleanup(); ReportErrorAndExit("Export failed: '{$aStatus['message']}'"); - } - else - { + } else { $exportResult .= $oExporter->GetFooter(); $sMimeType = $oExporter->GetMimeType(); - if (substr($sMimeType, 0, 5) == 'text/') - { + if (substr($sMimeType, 0, 5) == 'text/') { $sMimeType .= ';charset='.strtolower($oExporter->GetCharacterSet()); } $oP->SetContentType($sMimeType); @@ -549,7 +519,6 @@ function DoExport(WebPage $oP, BulkExport $oExporter, $bInteractive = false) } } - ///////////////////////////////////////////////////////////////////////////// // // Command Line mode @@ -567,8 +536,7 @@ if (utils::IsModeCLI()) { try { // Do this before loging, in order to allow setting user credentials from within the file utils::UseParamFile(); - } - catch (Exception $e) { + } catch (Exception $e) { echo "Error: ".utils::HtmlEntities($e->getMessage())."
    \n"; exit(EXIT_CODE_FATAL); } @@ -600,7 +568,7 @@ if (utils::IsModeCLI()) { } if ($sExpression === null) { - $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', array('query_id' => $sQueryId)); + $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', ['query_id' => $sQueryId]); $oSearch->UpdateContextFromUser(); $oQueries = new DBObjectSet($oSearch); if ($oQueries->Count() > 0) { @@ -613,7 +581,7 @@ if (utils::IsModeCLI()) { try { $oSearch = DBObjectSearch::FromOQL($sExpression); $oSearch->UpdateContextFromUser(); - $aArgs = array(); + $aArgs = []; foreach ($oSearch->GetQueryParams() as $sParam => $foo) { $value = utils::ReadParam('arg_'.$sParam, null, true, 'raw_data'); if (!is_null($value)) { @@ -626,8 +594,7 @@ if (utils::IsModeCLI()) { $sFormat = utils::ReadParam('format', 'html', true /* Allow CLI */, 'raw_data'); $oExporter = BulkExport::FindExporter($sFormat); - if ($oExporter == null) - { + if ($oExporter == null) { $aSupportedFormats = BulkExport::FindSupportedFormats(); ReportErrorAndExit("Invalid output format: '$sFormat'. The supported formats are: ".implode(', ', array_keys($aSupportedFormats))); } @@ -638,36 +605,25 @@ if (utils::IsModeCLI()) { $oExporter->ReadParameters(); $exportResult = $oExporter->GetHeader(); - $aStatus = array(); + $aStatus = []; - do - { + do { $exportResult .= $oExporter->GetNextChunk($aStatus); - } - while (($aStatus['code'] != 'done') && ($aStatus['code'] != 'error')); + } while (($aStatus['code'] != 'done') && ($aStatus['code'] != 'error')); - if ($aStatus['code'] == 'error') - { + if ($aStatus['code'] == 'error') { ReportErrorAndExit("Export failed: '{$aStatus['message']}'"); - } - else - { + } else { $exportResult .= $oExporter->GetFooter(); echo $exportResult; } $oExporter->Cleanup(); - } - catch(MissingQueryArgument $e) - { + } catch (MissingQueryArgument $e) { ReportErrorAndUsage("Invalid OQL query: '$sExpression'.\n".utils::HtmlEntities($e->getMessage())); - } - catch(OQLException $e) - { + } catch (OQLException $e) { ReportErrorAndExit("Invalid OQL query: '$sExpression'.\n".utils::HtmlEntities($e->getMessage())); - } - catch(Exception $e) - { + } catch (Exception $e) { ReportErrorAndExit(utils::HtmlEntities($e->getMessage())); } @@ -680,8 +636,7 @@ if (utils::IsModeCLI()) { // ///////////////////////////////////////////////////////////////////////////// -try -{ +try { require_once(APPROOT.'/application/loginwebpage.class.inc.php'); // Main parameters @@ -722,14 +677,12 @@ try DoExport($oP, $oExporter, false); $oP->output(); } -} -catch (BulkExportMissingParameterException $e) { +} catch (BulkExportMissingParameterException $e) { $oP = new AjaxPage('iTop Export'); $oP->add(utils::HtmlEntities($e->getMessage())); Usage($oP); $oP->output(); -} -catch (Exception $e) { +} catch (Exception $e) { $oP = new WebPage('iTop Export'); $oP->add_http_headers(); $oP->add('Error: '.utils::HtmlEntities($e->getMessage())); diff --git a/webservices/export.php b/webservices/export.php index 3a43ce408..18fa2b441 100644 --- a/webservices/export.php +++ b/webservices/export.php @@ -1,4 +1,5 @@ GetMessage()."
    \n"; exit(EXIT_CODE_FATAL); } @@ -59,39 +54,31 @@ catch(Exception $e) * @since 3.1.0 N°6047 */ $oCtx = new ContextTag(ContextTag::TAG_EXPORT); -if (utils::IsModeCLI()) -{ +if (utils::IsModeCLI()) { $oP = new CLIPage("iTop - Export"); SetupUtils::CheckPhpAndExtensionsForCli($oP, EXIT_CODE_FATAL); $sAuthUser = utils::ReadParam('auth_user', null, true /* Allow CLI */, 'raw_data'); $sAuthPwd = utils::ReadParam('auth_pwd', null, true /* Allow CLI */, 'raw_data'); - if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) - { + if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) { UserRights::Login($sAuthUser); // Login & set the user's language - } - else - { + } else { $oP->p("Access restricted or wrong credentials ('$sAuthUser')"); $oP->output(); exit(EXIT_CODE_ERROR); } -} -else -{ +} else { require_once(APPROOT.'/application/loginwebpage.class.inc.php'); LoginWebPage::DoLogin(); // Check user rights and prompt if needed } ApplicationContext::SetUrlMakerClass('iTopStandardURLMaker'); - $oAppContext = new ApplicationContext(); $iActiveNodeId = utils::ReadParam('menu', -1); $currentOrganization = utils::ReadParam('org_id', ''); -if (utils::IsArchiveMode() && !UserRights::CanBrowseArchive()) -{ +if (utils::IsArchiveMode() && !UserRights::CanBrowseArchive()) { $oP = new CLIPage("iTop - Export"); $oP->p("The user account is not authorized to access the archives"); $oP->output(); @@ -108,19 +95,15 @@ $bFieldsAdvanced = utils::ReadParam('fields_advanced', 0); $oQuery = null; -if (strlen($sExpression) == 0) -{ +if (strlen($sExpression) == 0) { $sQueryId = trim(utils::ReadParam('query', '', true /* Allow CLI */, 'raw_data')); - if (strlen($sQueryId) > 0) - { - $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', array('query_id' => $sQueryId)); + if (strlen($sQueryId) > 0) { + $oSearch = DBObjectSearch::FromOQL('SELECT QueryOQL WHERE id = :query_id', ['query_id' => $sQueryId]); $oQueries = new DBObjectSet($oSearch); - if ($oQueries->Count() > 0) - { + if ($oQueries->Count() > 0) { $oQuery = $oQueries->Fetch(); $sExpression = $oQuery->Get('oql'); - if (strlen($sFields) == 0) - { + if (strlen($sFields) == 0) { $sFields = trim($oQuery->Get('fields')); } } @@ -129,38 +112,29 @@ if (strlen($sExpression) == 0) $sFormat = strtolower(utils::ReadParam('format', 'html', true /* Allow CLI */)); - $aFields = explode(',', $sFields); // Clean the list of columns (empty it if every string is empty) -foreach($aFields as $index => $sField) -{ +foreach ($aFields as $index => $sField) { $aFields[$index] = trim($sField); - if(strlen($aFields[$index]) == 0) - { + if (strlen($aFields[$index]) == 0) { unset($aFields[$index]); } } $oP = null; -if (!empty($sExpression)) -{ - try - { +if (!empty($sExpression)) { + try { $oFilter = DBObjectSearch::FromOQL($sExpression); // Check and adjust column names // - $aAliasToFields = array(); - foreach($aFields as $index => $sField) - { - if (preg_match('/^(.*)\.(.*)$/', $sField, $aMatches)) - { + $aAliasToFields = []; + foreach ($aFields as $index => $sField) { + if (preg_match('/^(.*)\.(.*)$/', $sField, $aMatches)) { $sClassAlias = $aMatches[1]; $sAttCode = $aMatches[2]; - } - else - { + } else { $sClassAlias = $oFilter->GetClassAlias(); $sAttCode = $sField; // Disambiguate the class alias @@ -169,17 +143,13 @@ if (!empty($sExpression)) $aAliasToFields[$sClassAlias][] = $sAttCode; $sClass = $oFilter->GetClassName($sClassAlias); - if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) - { + if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) { throw new CoreException("Invalid field specification $sField: $sAttCode is not a valid attribute for $sClass"); } $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); - if ($oAttDef instanceof AttributeSubItem) - { + if ($oAttDef instanceof AttributeSubItem) { $aAliasToFields[$sClassAlias][] = $oAttDef->GetParentAttCode(); - } - else if($oAttDef instanceof AttributeExternalField && $oAttDef->IsFriendlyName()) - { + } elseif ($oAttDef instanceof AttributeExternalField && $oAttDef->IsFriendlyName()) { $sKeyAttCode = $oAttDef->GetKeyAttCode(); $aAliasToFields[$sClassAlias][] = $sKeyAttCode; } @@ -187,35 +157,29 @@ if (!empty($sExpression)) // Read query parameters // - $aArgs = array(); - foreach($oFilter->GetQueryParams() as $sParam => $foo) - { + $aArgs = []; + foreach ($oFilter->GetQueryParams() as $sParam => $foo) { $value = utils::ReadParam('arg_'.$sParam, null, true, 'raw_data'); - if (!is_null($value)) - { + if (!is_null($value)) { $aArgs[$sParam] = $value; } } $oFilter->SetInternalParams($aArgs); - foreach ($oFilter->GetSelectedClasses() as $sAlias => $sClass) - { - if ((UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_READ) && UR_ALLOWED_YES) == 0) - { + foreach ($oFilter->GetSelectedClasses() as $sAlias => $sClass) { + if ((UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_READ) && UR_ALLOWED_YES) == 0) { throw new Exception("The current user does not have permission for exporting data of class $sClass"); } } // update last export information if check parameters ok - if($oQuery != null){ + if ($oQuery != null) { $oQuery->UpdateLastExportInformation(); } - if ($oFilter) - { - $oSet = new CMDBObjectSet($oFilter, array(), $aArgs); + if ($oFilter) { + $oSet = new CMDBObjectSet($oFilter, [], $aArgs); $oSet->OptimizeColumnLoad($aAliasToFields); - switch($sFormat) - { + switch ($sFormat) { case 'html': $oP = new NiceWebPage("iTop - Export"); $oP->add_style('body { overflow: auto; }'); // Show scroll bars if needed @@ -243,7 +207,7 @@ if (!empty($sExpression)) $bViewLink = false; } $sFields = implode(',', $aFields); - $aExtraParams = array( + $aExtraParams = [ 'menu' => false, 'toolkit_menu' => false, 'display_limit' => false, @@ -251,15 +215,15 @@ if (!empty($sExpression)) 'zlist' => false, 'extra_fields' => $sFields, 'view_link' => $bViewLink, - ); + ]; } else { - $aExtraParams = array( + $aExtraParams = [ 'menu' => false, 'toolkit_menu' => false, 'display_limit' => false, 'localize_values' => $bLocalize, 'zlist' => 'details', - ); + ]; } $oResultBlock = new DisplayBlock($oFilter, 'list', false, $aExtraParams); @@ -267,105 +231,85 @@ if (!empty($sExpression)) break; case 'csv': - $oP = new CSVPage("iTop - Export"); - $sFields = implode(',', $aFields); - $sCharset = utils::ReadParam('charset', MetaModel::GetConfig()->Get('csv_file_default_charset'), true /* Allow CLI */, 'raw_data'); - $sCSVData = cmdbAbstractObject::GetSetAsCSV($oSet, array('fields' => $sFields, 'fields_advanced' => $bFieldsAdvanced, 'localize_values' => $bLocalize), $sCharset); - if ($sCharset == 'UTF-8') - { - $sOutputData = UTF8_BOM.$sCSVData; - } - else - { - $sOutputData = $sCSVData; - } - if ($sFileName == '') - { - // Plain text => Firefox will NOT propose to download the file - $oP->add_header("Content-type: text/plain; charset=$sCharset"); - } - else - { - $oP->add_header("Content-type: text/csv; charset=$sCharset"); - } - $oP->add($sOutputData); - break; + $oP = new CSVPage("iTop - Export"); + $sFields = implode(',', $aFields); + $sCharset = utils::ReadParam('charset', MetaModel::GetConfig()->Get('csv_file_default_charset'), true /* Allow CLI */, 'raw_data'); + $sCSVData = cmdbAbstractObject::GetSetAsCSV($oSet, ['fields' => $sFields, 'fields_advanced' => $bFieldsAdvanced, 'localize_values' => $bLocalize], $sCharset); + if ($sCharset == 'UTF-8') { + $sOutputData = UTF8_BOM.$sCSVData; + } else { + $sOutputData = $sCSVData; + } + if ($sFileName == '') { + // Plain text => Firefox will NOT propose to download the file + $oP->add_header("Content-type: text/plain; charset=$sCharset"); + } else { + $oP->add_header("Content-type: text/csv; charset=$sCharset"); + } + $oP->add($sOutputData); + break; case 'spreadsheet': - $oP = new WebPage("iTop - Export for spreadsheet"); + $oP = new WebPage("iTop - Export for spreadsheet"); - // Integration within MS-Excel web queries + HTTPS + IIS: - // MS-IIS set these header values with no-cache... while Excel fails to do the job if using HTTPS - // Then the fix is to force the reset of header values Pragma and Cache-control - header("Pragma:", true); - header("Cache-control:", true); + // Integration within MS-Excel web queries + HTTPS + IIS: + // MS-IIS set these header values with no-cache... while Excel fails to do the job if using HTTPS + // Then the fix is to force the reset of header values Pragma and Cache-control + header("Pragma:", true); + header("Cache-control:", true); - $sFields = implode(',', $aFields); - $oP->add_style('table br {mso-data-placement:same-cell;}'); // Trick for Excel: keep line breaks inside the same cell ! - cmdbAbstractObject::DisplaySetAsHTMLSpreadsheet($oP, $oSet, array('fields' => $sFields, 'fields_advanced' => $bFieldsAdvanced, 'localize_values' => $bLocalize)); - break; + $sFields = implode(',', $aFields); + $oP->add_style('table br {mso-data-placement:same-cell;}'); // Trick for Excel: keep line breaks inside the same cell ! + cmdbAbstractObject::DisplaySetAsHTMLSpreadsheet($oP, $oSet, ['fields' => $sFields, 'fields_advanced' => $bFieldsAdvanced, 'localize_values' => $bLocalize]); + break; case 'xml': - $oP = new XMLPage("iTop - Export", true /* passthrough */); - cmdbAbstractObject::DisplaySetAsXML($oP, $oSet, array('localize_values' => $bLocalize)); - break; + $oP = new XMLPage("iTop - Export", true /* passthrough */); + cmdbAbstractObject::DisplaySetAsXML($oP, $oSet, ['localize_values' => $bLocalize]); + break; case 'xlsx': - $oP = new AjaxPage(''); - $oExporter = new ExcelExporter(); - $oExporter->SetObjectList($oFilter); + $oP = new AjaxPage(''); + $oExporter = new ExcelExporter(); + $oExporter->SetObjectList($oFilter); - // Run the export by chunk of 1000 objects to limit memory usage - $oExporter->SetChunkSize(1000); - do - { - $aStatus = $oExporter->Run(); // process one chunk - } - while( ($aStatus['code'] != 'done') && ($aStatus['code'] != 'error')); + // Run the export by chunk of 1000 objects to limit memory usage + $oExporter->SetChunkSize(1000); + do { + $aStatus = $oExporter->Run(); // process one chunk + } while (($aStatus['code'] != 'done') && ($aStatus['code'] != 'error')); - if ($aStatus['code'] == 'done') - { - $oP->SetContentType('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - $oP->SetContentDisposition('attachment', $oFilter->GetClass().'.xlsx'); - $oP->add(file_get_contents($oExporter->GetExcelFilePath())); - $oExporter->Cleanup(); - } - else - { - $oP->add('Error, xlsx export failed: '.$aStatus['message']); - } - break; + if ($aStatus['code'] == 'done') { + $oP->SetContentType('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); + $oP->SetContentDisposition('attachment', $oFilter->GetClass().'.xlsx'); + $oP->add(file_get_contents($oExporter->GetExcelFilePath())); + $oExporter->Cleanup(); + } else { + $oP->add('Error, xlsx export failed: '.$aStatus['message']); + } + break; default: - $oP = new WebPage("iTop - Export"); - $oP->add("Unsupported format '$sFormat'. Possible values are: html, csv, spreadsheet or xml."); + $oP = new WebPage("iTop - Export"); + $oP->add("Unsupported format '$sFormat'. Possible values are: html, csv, spreadsheet or xml."); } } - } - catch(Exception $e) - { + } catch (Exception $e) { $oP = new WebPage("iTop - Export"); $oP->p("Error the query can not be executed."); - if ($e instanceof CoreException) - { + if ($e instanceof CoreException) { $oP->p($e->GetHtmlDesc()); - } - else - { + } else { $oP->p($e->getMessage()); } } } -if (!$oP) -{ +if (!$oP) { // Display a short message about how to use this page $bModeCLI = utils::IsModeCLI(); - if ($bModeCLI) - { + if ($bModeCLI) { $oP = new CLIPage("iTop - Export"); - } - else - { + } else { $oP = new WebPage("iTop - Export"); } $oP->p("General purpose export page."); @@ -384,11 +328,9 @@ if (!$oP) $oP->p(" * filename: (optional, no effect in CLI mode) if set then the results will be downloaded as a file"); } -if ($sFileName != '') -{ +if ($sFileName != '') { $oP->add_header('Content-Disposition: attachment; filename="'.$sFileName.'"'); } $oP->TrashUnexpectedOutput(); $oP->output(); -?> diff --git a/webservices/import.php b/webservices/import.php index dc009b840..807011a6b 100644 --- a/webservices/import.php +++ b/webservices/import.php @@ -1,4 +1,5 @@ array - ( +$aPageParams = +[ + 'auth_user' => + [ 'mandatory' => true, 'modes' => 'cli', 'default' => null, 'description' => 'login (must have enough rights to create objects of the given class)', - ), - 'auth_pwd' => array - ( + ], + 'auth_pwd' => + [ 'mandatory' => true, 'modes' => 'cli', 'default' => null, 'description' => 'password', - ), - 'class' => array - ( + ], + 'class' => + [ 'mandatory' => true, 'modes' => 'http,cli', 'default' => null, 'description' => 'class of loaded objects', - ), - 'csvdata' => array - ( + ], + 'csvdata' => + [ 'mandatory' => true, 'modes' => 'http', 'default' => null, 'description' => 'data', - ), - 'csvfile' => array - ( + ], + 'csvfile' => + [ 'mandatory' => true, 'modes' => 'cli', 'default' => '', 'description' => 'local data file, replaces csvdata if specified', - ), - 'charset' => array - ( + ], + 'charset' => + [ 'mandatory' => false, 'modes' => 'http,cli', 'default' => '', 'description' => 'Character set encoding of the CSV data: UTF-8, ISO-8859-1, WINDOWS-1251, WINDOWS-1252, ISO-8859-15, If blank, then the charset is set to config(csv_file_default_charset)', - ), - 'date_format' => array - ( + ], + 'date_format' => + [ 'mandatory' => false, 'modes' => 'http,cli', 'default' => '', 'description' => 'Input date format (used both for dates and datetimes) - Examples: Y-m-d H:i:s, d/m/Y H:i:s (Europe) - no transformation is applied if the argument is omitted. (note: old format specification using %Y %m %d is also supported for backward compatibility)', - ), - 'separator' => array - ( + ], + 'separator' => + [ 'mandatory' => false, 'modes' => 'http,cli', 'default' => ',', 'description' => 'column separator in CSV data (1 char, or \'tab\')', - ), - 'qualifier' => array - ( + ], + 'qualifier' => + [ 'mandatory' => false, 'modes' => 'http,cli', 'default' => '"', 'description' => 'test qualifier in CSV data', - ), - 'output' => array - ( + ], + 'output' => + [ 'mandatory' => false, 'modes' => 'http,cli', 'default' => 'summary', 'description' => '[retcode] to return the count of lines in error, [summary] to return a concise report, [details] to get a detailed report (each line listed)', - ), + ], /* 'reportlevel' => array ( @@ -121,35 +121,35 @@ $aPageParams = array 'description' => 'combination of flags to limit the detailed output', ), */ - 'reconciliationkeys' => array - ( + 'reconciliationkeys' => + [ 'mandatory' => false, 'modes' => 'http,cli', 'default' => '', 'description' => 'name of the columns used to identify existing objects and update them, or create a new one', - ), - 'simulate' => array - ( + ], + 'simulate' => + [ 'mandatory' => false, 'modes' => 'http,cli', 'default' => '0', 'description' => 'If set to 1, then the load will not be executed, but the expected report will be produced', - ), - 'comment' => array - ( + ], + 'comment' => + [ 'mandatory' => false, 'modes' => 'http,cli', 'default' => '', 'description' => 'Comment to be added into the change log', - ), - 'no_localize' => array - ( + ], + 'no_localize' => + [ 'mandatory' => false, 'modes' => 'http,cli', 'default' => '0', 'description' => 'If set to 0, then header and values are supposed to be localized in the language of the logged in user. Set to 1 to use internal attribute codes and values (enums)', - ), -); + ], +]; function UsageAndExit($oP) { @@ -157,21 +157,15 @@ function UsageAndExit($oP) $bModeCLI = utils::IsModeCLI(); $oP->p("USAGE:\n"); - foreach($aPageParams as $sParam => $aParamData) - { + foreach ($aPageParams as $sParam => $aParamData) { $aModes = explode(',', $aParamData['modes']); - if ($bModeCLI) - { - if (in_array('cli', $aModes)) - { + if ($bModeCLI) { + if (in_array('cli', $aModes)) { $sDesc = $aParamData['description'].', '.($aParamData['mandatory'] ? 'mandatory' : 'optional, defaults to ['.$aParamData['default'].']'); $oP->p("$sParam = $sDesc"); } - } - else - { - if (in_array('http', $aModes)) - { + } else { + if (in_array('http', $aModes)) { $sDesc = $aParamData['description'].', '.($aParamData['mandatory'] ? 'mandatory' : 'optional, defaults to ['.$aParamData['default'].']'); $oP->p("$sParam = $sDesc"); } @@ -181,7 +175,6 @@ function UsageAndExit($oP) exit; } - function ReadParam($oP, $sParam, $sSanitizationFilter = 'parameter') { global $aPageParams; @@ -198,8 +191,7 @@ function ReadMandatoryParam($oP, $sParam, $sSanitizationFilter) assert($aPageParams[$sParam]['mandatory']); $sValue = utils::ReadParam($sParam, null, true /* Allow CLI */, $sSanitizationFilter); - if (is_null($sValue)) - { + if (is_null($sValue)) { $oP->p("ERROR: Missing argument '$sParam'\n"); UsageAndExit($oP); } @@ -213,96 +205,81 @@ function ReadMandatoryParam($oP, $sParam, $sSanitizationFilter) * @since 3.1.0 N°6047 */ $oCtx = new ContextTag(ContextTag::TAG_IMPORT); -if (utils::IsModeCLI()) -{ +if (utils::IsModeCLI()) { $oP = new CLIPage("iTop - Bulk import"); SetupUtils::CheckPhpAndExtensionsForCli($oP, -2); -} -else -{ +} else { $oP = new CSVPage("iTop - Bulk import"); } -try -{ +try { utils::UseParamFile(); -} -catch(Exception $e) -{ +} catch (Exception $e) { $oP->p("Error: ".$e->GetMessage()); $oP->output(); exit(-2); } -if (utils::IsModeCLI()) -{ +if (utils::IsModeCLI()) { // Next steps: // specific arguments: 'csvfile' // $sAuthUser = ReadMandatoryParam($oP, 'auth_user', 'raw_data'); $sAuthPwd = ReadMandatoryParam($oP, 'auth_pwd', 'raw_data'); $sCsvFile = ReadMandatoryParam($oP, 'csvfile', 'raw_data'); - if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) - { + if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) { UserRights::Login($sAuthUser); // Login & set the user's language - } - else - { + } else { $oP->p("Access restricted or wrong credentials ('$sAuthUser')"); $oP->output(); exit(-1); } - if (!is_readable($sCsvFile)) - { + if (!is_readable($sCsvFile)) { $oP->p("Input file could not be found or could not be read: '$sCsvFile'"); $oP->output(); exit(-1); } $sCSVData = file_get_contents($sCsvFile); -} -else -{ +} else { require_once(APPROOT.'/application/loginwebpage.class.inc.php'); - LoginWebPage::ResetSession(true); + LoginWebPage::ResetSession(true); $iRet = LoginWebPage::DoLogin(false, false, LoginWebPage::EXIT_RETURN); - if ($iRet !== LoginWebPage::EXIT_CODE_OK) { - switch ($iRet) { - case LoginWebPage::EXIT_CODE_MISSINGLOGIN: - $oP->p("Missing parameter 'auth_user'"); - break; + if ($iRet !== LoginWebPage::EXIT_CODE_OK) { + switch ($iRet) { + case LoginWebPage::EXIT_CODE_MISSINGLOGIN: + $oP->p("Missing parameter 'auth_user'"); + break; - case LoginWebPage::EXIT_CODE_MISSINGPASSWORD: - $oP->p("Missing parameter 'auth_pwd'"); - break; + case LoginWebPage::EXIT_CODE_MISSINGPASSWORD: + $oP->p("Missing parameter 'auth_pwd'"); + break; - case LoginWebPage::EXIT_CODE_WRONGCREDENTIALS: - $oP->p('Invalid login'); - break; + case LoginWebPage::EXIT_CODE_WRONGCREDENTIALS: + $oP->p('Invalid login'); + break; - case LoginWebPage::EXIT_CODE_PORTALUSERNOTAUTHORIZED: - $oP->p('Portal user is not allowed'); - break; + case LoginWebPage::EXIT_CODE_PORTALUSERNOTAUTHORIZED: + $oP->p('Portal user is not allowed'); + break; - case LoginWebPage::EXIT_CODE_NOTAUTHORIZED: - $oP->p('This user is not authorized to use the web services. (The profile REST Services User is required to access the REST web services)'); - break; + case LoginWebPage::EXIT_CODE_NOTAUTHORIZED: + $oP->p('This user is not authorized to use the web services. (The profile REST Services User is required to access the REST web services)'); + break; - default: - $oP->p("Unknown authentication error (retCode=$iRet)"); - } - $oP->output(); - exit -1; - } + default: + $oP->p("Unknown authentication error (retCode=$iRet)"); + } + $oP->output(); + exit -1; + } $sCSVData = utils::ReadPostedParam('csvdata', '', 'raw_data'); } - -try -{ - $aWarnings = array(); +try { + $aWarnings = []; ////////////////////////////////////////////////// // @@ -313,8 +290,7 @@ try $sQualifier = ReadParam($oP, 'qualifier', 'raw_data'); $sCharSet = ReadParam($oP, 'charset', 'raw_data'); $sDateFormat = ReadParam($oP, 'date_format', 'raw_data'); - if (strpos($sDateFormat, '%') !== false) - { + if (strpos($sDateFormat, '%') !== false) { $sDateFormat = utils::DateTimeFormatToPHP($sDateFormat); } $sOutput = ReadParam($oP, 'output', 'string'); @@ -323,8 +299,7 @@ try $sComment = ReadParam($oP, 'comment', 'raw_data'); $bLocalize = (ReadParam($oP, 'no_localize') != 1); - if (strtolower(trim($sSep)) == 'tab') - { + if (strtolower(trim($sSep)) == 'tab') { $sSep = "\t"; } @@ -332,77 +307,62 @@ try // // Check parameters format/consistency // - if (strlen($sCSVData) == 0) - { + if (strlen($sCSVData) == 0) { throw new BulkLoadException("Missing data - at least one line is expected"); } - if (!MetaModel::IsValidClass($sClass)) - { + if (!MetaModel::IsValidClass($sClass)) { throw new BulkLoadException("Unknown class: '$sClass'"); } - if (strlen($sSep) > 1) - { + if (strlen($sSep) > 1) { throw new BulkLoadException("Separator is limited to one character, found '$sSep'"); } - if (strlen($sQualifier) > 1) - { + if (strlen($sQualifier) > 1) { throw new BulkLoadException("Text qualifier is limited to one character, found '$sQualifier'"); } - if (!in_array($sOutput, array('retcode', 'summary', 'details'))) - { + if (!in_array($sOutput, ['retcode', 'summary', 'details'])) { throw new BulkLoadException("Unknown output format: '$sOutput'"); } - if (strlen($sDateFormat) == 0) - { + if (strlen($sDateFormat) == 0) { $sDateFormat = null; } - if ($sCharSet == '') - { + if ($sCharSet == '') { $sCharSet = MetaModel::GetConfig()->Get('csv_file_default_charset'); } - if ($sSimulate == '1') - { + if ($sSimulate == '1') { $bSimulate = true; - } - else - { + } else { $bSimulate = false; } - if (($sOutput == "summary") || ($sOutput == 'details')) - { + if (($sOutput == "summary") || ($sOutput == 'details')) { $oP->add_comment("Output format: ".$sOutput); $oP->add_comment("Class: ".$sClass); $oP->add_comment("Separator: ".$sSep); $oP->add_comment("Qualifier: ".$sQualifier); $oP->add_comment("Charset Encoding:".$sCharSet); - if (($sDateFormat !== null) && (strlen($sDateFormat) > 0)) - { + if (($sDateFormat !== null) && (strlen($sDateFormat) > 0)) { $oP->add_comment("Date and time format: '$sDateFormat'"); $oDateTimeFormat = new DateTimeFormat($sDateFormat); $sDateOnlyFormat = $oDateTimeFormat->ToDateFormat(); $oP->add_comment("Date format: '$sDateOnlyFormat'"); - } - else - { + } else { $oP->add_comment("Date format: "); } - $oP->add_comment("Localize: ".($bLocalize?'yes':'no')); + $oP->add_comment("Localize: ".($bLocalize ? 'yes' : 'no')); $oP->add_comment("Data Size: ".strlen($sCSVData)); } ////////////////////////////////////////////////// // // Security // - if (!UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_MODIFY)) - { + if (!UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_MODIFY)) { throw new SecurityException(Dict::Format('UI:Error:BulkModifyNotAllowedOn_Class', $sClass)); } @@ -419,42 +379,31 @@ try // Note: it may happen that an external field has the same label as the external key // in that case, we consider that the external key has precedence // - $aKnownColumnNames = ['id'=>['id']]; - foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - if ($bLocalize) - { - $sColName = strtolower(MetaModel::GetLabel($sClass, $sAttCode)); - } - else - { - $sColName = strtolower($sAttCode); - } - if (!$oAttDef->IsExternalField() || !array_key_exists($sColName, $aKnownColumnNames)) - { - $aKnownColumnNames[$sColName][] = $sAttCode; + $aKnownColumnNames = ['id' => ['id']]; + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if ($bLocalize) { + $sColName = strtolower(MetaModel::GetLabel($sClass, $sAttCode)); + } else { + $sColName = strtolower($sAttCode); } - if ($oAttDef->IsExternalKey(EXTKEY_RELATIVE)) - { - $sRemoteClass = $oAttDef->GetTargetClass(); - foreach(MetaModel::ListAttributeDefs($sRemoteClass) as $sRemoteAttCode => $oRemoteAttDef) - { - $sAttCodeEx = $sAttCode.'->'.$sRemoteAttCode; - if ($bLocalize) - { - $sColName = strtolower(MetaModel::GetLabel($sClass, $sAttCodeEx)); - } - else - { - $sColName = strtolower($sAttCodeEx); - } - if (!array_key_exists($sColName, $aKnownColumnNames)) - { - $aKnownColumnNames[$sColName][] = $sAttCodeEx; - } - } + if (!$oAttDef->IsExternalField() || !array_key_exists($sColName, $aKnownColumnNames)) { + $aKnownColumnNames[$sColName][] = $sAttCode; } - } + if ($oAttDef->IsExternalKey(EXTKEY_RELATIVE)) { + $sRemoteClass = $oAttDef->GetTargetClass(); + foreach (MetaModel::ListAttributeDefs($sRemoteClass) as $sRemoteAttCode => $oRemoteAttDef) { + $sAttCodeEx = $sAttCode.'->'.$sRemoteAttCode; + if ($bLocalize) { + $sColName = strtolower(MetaModel::GetLabel($sClass, $sAttCodeEx)); + } else { + $sColName = strtolower($sAttCodeEx); + } + if (!array_key_exists($sColName, $aKnownColumnNames)) { + $aKnownColumnNames[$sColName][] = $sAttCodeEx; + } + } + } + } //print_r($aKnownColumnNames); //print_r(array_keys($aKnownColumnNames)); @@ -464,19 +413,15 @@ try // // Parse first line, check attributes, analyse the request // - if ($sCharSet == 'UTF-8') - { + if ($sCharSet == 'UTF-8') { // Remove the BOM if any - if (substr($sCSVData, 0, 3) == UTF8_BOM) - { + if (substr($sCSVData, 0, 3) == UTF8_BOM) { $sCSVData = substr($sCSVData, 3); } // Clean the input // Todo: warn the user if some characters are lost/substituted $sUTF8Data = iconv('UTF-8', 'UTF-8//IGNORE//TRANSLIT', $sCSVData); - } - else - { + } else { $sUTF8Data = iconv($sCharSet, 'UTF-8//IGNORE//TRANSLIT', $sCSVData); } $oCSVParser = new CSVParser($sUTF8Data, $sSep, $sQualifier); @@ -487,101 +432,77 @@ try // Translate into internal names $aFieldList = []; - foreach($aRawFieldList as $iFieldId => $sFieldName) - { + foreach ($aRawFieldList as $iFieldId => $sFieldName) { $sFieldName = trim($sFieldName); - $aMatches = array(); - if (preg_match('/^(.+)\*$/', $sFieldName, $aMatches)) - { + $aMatches = []; + if (preg_match('/^(.+)\*$/', $sFieldName, $aMatches)) { // Ignore any trailing "star" (*) that simply indicates a mandatory field $sFieldName = $aMatches[1]; - } - else if (preg_match('/^(.+)\*->(.+)$/', $sFieldName, $aMatches)) - { + } elseif (preg_match('/^(.+)\*->(.+)$/', $sFieldName, $aMatches)) { // Remove any trailing "star" character before the arrow (->) // A star character at the end can be used to indicate a mandatory field $sFieldName = $aMatches[1].'->'.$aMatches[2]; } - if (array_key_exists(strtolower($sFieldName), $aKnownColumnNames)) - { + if (array_key_exists(strtolower($sFieldName), $aKnownColumnNames)) { $aColumns = $aKnownColumnNames[strtolower($sFieldName)]; - if (count($aColumns) > 1) - { - $aCompetitors = array(); - foreach ($aColumns as $sAttCodeEx) - { + if (count($aColumns) > 1) { + $aCompetitors = []; + foreach ($aColumns as $sAttCodeEx) { $aCompetitors[] = $sAttCodeEx; } - $aWarnings[] = "Input column '$sFieldName' is ambiguous. Could be related to ".implode (' or ', $aCompetitors).". The first one will be used: ".$aColumns[0]; + $aWarnings[] = "Input column '$sFieldName' is ambiguous. Could be related to ".implode(' or ', $aCompetitors).". The first one will be used: ".$aColumns[0]; } $aFieldList[$iFieldId] = $aColumns[0]; - } - else - { + } else { // Protect against XSS injection - $sSafeName = str_replace(array('"', '<', '>'), '', $sFieldName); + $sSafeName = str_replace(['"', '<', '>'], '', $sFieldName); throw new BulkLoadException("Unknown column: '$sSafeName'. Possible columns: ".implode(', ', array_keys($aKnownColumnNames))); } } // Note: at this stage the list of fields is supposed to be made of attcodes (and the symbol '->') - $aAttList = array(); - $aExtKeys = array(); - foreach($aFieldList as $iFieldId => $sFieldName) - { - $aMatches = array(); - if (preg_match('/^(.+)->(.+)$/', trim($sFieldName), $aMatches)) - { + $aAttList = []; + $aExtKeys = []; + foreach ($aFieldList as $iFieldId => $sFieldName) { + $aMatches = []; + if (preg_match('/^(.+)->(.+)$/', trim($sFieldName), $aMatches)) { // The column has been specified as "extkey->attcode" // $sExtKeyAttCode = $aMatches[1]; $sRemoteAttCode = $aMatches[2]; - if (!MetaModel::IsValidAttCode($sClass, $sExtKeyAttCode)) - { + if (!MetaModel::IsValidAttCode($sClass, $sExtKeyAttCode)) { // Safety net - should not happen now that column names are checked against known names throw new BulkLoadException("Unknown attribute '$sExtKeyAttCode' (class: '$sClass')"); } $oAtt = MetaModel::GetAttributeDef($sClass, $sExtKeyAttCode); - if (!$oAtt->IsExternalKey()) - { + if (!$oAtt->IsExternalKey()) { // Safety net - should not happen now that column names are checked against known names throw new BulkLoadException("Not an external key '$sExtKeyAttCode' (class: '$sClass')"); } $sTargetClass = $oAtt->GetTargetClass(); - if (!MetaModel::IsValidAttCode($sTargetClass, $sRemoteAttCode)) - { + if (!MetaModel::IsValidAttCode($sTargetClass, $sRemoteAttCode)) { // Safety net - should not happen now that column names are checked against known names throw new BulkLoadException("Unknown attribute '$sRemoteAttCode' (key: '$sExtKeyAttCode', class: '$sTargetClass')"); } $aExtKeys[$sExtKeyAttCode][$sRemoteAttCode] = $iFieldId; - } - elseif ($sFieldName == 'id') - { + } elseif ($sFieldName == 'id') { $aAttList[$sFieldName] = $iFieldId; - } - else - { + } else { // The column has been specified as "attcode" // - if (!MetaModel::IsValidAttCode($sClass, $sFieldName)) - { + if (!MetaModel::IsValidAttCode($sClass, $sFieldName)) { // Safety net - should not happen now that column names are checked against known names throw new BulkLoadException("Unknown attribute '$sFieldName' (class: '$sClass')"); } $oAtt = MetaModel::GetAttributeDef($sClass, $sFieldName); - if ($oAtt->IsExternalKey()) - { + if ($oAtt->IsExternalKey()) { $aExtKeys[$sFieldName]['id'] = $iFieldId; $aAttList[$sFieldName] = $iFieldId; - } - elseif ($oAtt->IsExternalField()) - { + } elseif ($oAtt->IsExternalField()) { $sExtKeyAttCode = $oAtt->GetKeyAttCode(); $sRemoteAttCode = $oAtt->GetExtAttCode(); $aExtKeys[$sExtKeyAttCode][$sRemoteAttCode] = $iFieldId; - } - else - { + } else { $aAttList[$sFieldName] = $iFieldId; } } @@ -589,27 +510,20 @@ try // Make sure there are some reconciliation keys // - if (empty($sReconcKeys)) - { - $aReconcSpec = array(); + if (empty($sReconcKeys)) { + $aReconcSpec = []; // Base reconciliation scheme on the default one // The reconciliation attributes not present in the data will be ignored - foreach(MetaModel::GetReconcKeys($sClass) as $sReconcKeyAttCode) - { - if (in_array($sReconcKeyAttCode, $aFieldList)) - { - if ($bLocalize) - { + foreach (MetaModel::GetReconcKeys($sClass) as $sReconcKeyAttCode) { + if (in_array($sReconcKeyAttCode, $aFieldList)) { + if ($bLocalize) { $aReconcSpec[] = MetaModel::GetLabel($sClass, $sReconcKeyAttCode); - } - else - { + } else { $aReconcSpec[] = $sReconcKeyAttCode; } } } - if (count($aReconcSpec) == 0) - { + if (count($aReconcSpec) == 0) { throw new BulkLoadException("No reconciliation scheme could be defined, please add a column corresponding to one defined reconciliation key (class: '$sClass', reconciliation:".implode(',', MetaModel::GetReconcKeys($sClass)).")"); } $sReconcKeys = implode(',', $aReconcSpec); @@ -617,48 +531,41 @@ try // Interpret the list of reconciliation keys // - $aFinalReconcilKeys = array(); - $aReconcilKeysReport = array(); - foreach (explode(',', $sReconcKeys) as $sReconcKey) - { + $aFinalReconcilKeys = []; + $aReconcilKeysReport = []; + foreach (explode(',', $sReconcKeys) as $sReconcKey) { $sReconcKey = trim($sReconcKey); - if (empty($sReconcKey)) continue; // skip empty spec + if (empty($sReconcKey)) { + continue; + } // skip empty spec - if (array_key_exists(strtolower($sReconcKey), $aKnownColumnNames)) - { + if (array_key_exists(strtolower($sReconcKey), $aKnownColumnNames)) { // Translate from a translated name to codes $aColumns = $aKnownColumnNames[strtolower($sReconcKey)]; - if (count($aColumns) > 1) - { - $aCompetitors = array(); - foreach ($aColumns as $sAttCodeEx) - { + if (count($aColumns) > 1) { + $aCompetitors = []; + foreach ($aColumns as $sAttCodeEx) { $aCompetitors[] = $sAttCodeEx; } - $aWarnings[] = "Reconciliation key '$sReconcKey' is ambiguous. Could be related to ".implode (' or ', $aCompetitors).". The first one will be used: ".$aColumns[0]; + $aWarnings[] = "Reconciliation key '$sReconcKey' is ambiguous. Could be related to ".implode(' or ', $aCompetitors).". The first one will be used: ".$aColumns[0]; } $sReconcKey = $aColumns[0]; - } - else - { + } else { // Protect against XSS injection - $sSafeName = str_replace(array('"', '<', '>'), '', $sReconcKey); + $sSafeName = str_replace(['"', '<', '>'], '', $sReconcKey); throw new BulkLoadException("Unknown reconciliation key: '$sSafeName'"); } // Check that the reconciliation key is either a given column, or an external key - if (!in_array($sReconcKey, $aFieldList)) - { - if (!array_key_exists($sReconcKey, $aExtKeys)) - { + if (!in_array($sReconcKey, $aFieldList)) { + if (!array_key_exists($sReconcKey, $aExtKeys)) { // Protect against XSS injection - $sSafeName = str_replace(array('"', '<', '>'), '', $sReconcKey); + $sSafeName = str_replace(['"', '<', '>'], '', $sReconcKey); throw new BulkLoadException("Reconciliation key not found in the input columns: '$sSafeName'"); } } - if (preg_match('/^(.+)->(.+)$/', trim($sReconcKey), $aMatches)) - { + if (preg_match('/^(.+)->(.+)$/', trim($sReconcKey), $aMatches)) { // The column has been specified as "extkey->attcode" // $sExtKeyAttCode = $aMatches[1]; @@ -666,17 +573,14 @@ try $aFinalReconcilKeys[] = $sExtKeyAttCode; $aReconcilKeysReport[$sExtKeyAttCode][] = $sRemoteAttCode; - } - else - { - if (!MetaModel::IsValidAttCode($sClass, $sReconcKey) && $sReconcKey != 'id') - { + } else { + if (!MetaModel::IsValidAttCode($sClass, $sReconcKey) && $sReconcKey != 'id') { // Safety net - should not happen now that column names are checked against known names throw new BulkLoadException("Unknown reconciliation attribute '$sReconcKey' (class: '$sClass')"); } if ($sReconcKey == 'id') { $aFinalReconcilKeys[] = $sReconcKey; - $aReconcilKeysReport[$sReconcKey] = array(); + $aReconcilKeysReport[$sReconcKey] = []; } else { $oAtt = MetaModel::GetAttributeDef($sClass, $sReconcKey); if ($oAtt->IsExternalKey()) { @@ -690,7 +594,7 @@ try $aReconcilKeysReport[$sReconcAttCode][] = $sReconcKeyReport; } else { $aFinalReconcilKeys[] = $sReconcKey; - $aReconcilKeysReport[$sReconcKey] = array(); + $aReconcilKeysReport[$sReconcKey] = []; } } } @@ -704,28 +608,22 @@ try $aData = $oCSVParser->ToArray(); $iLineCount = count($aData); - if (($sOutput == "summary") || ($sOutput == 'details')) - { + if (($sOutput == "summary") || ($sOutput == 'details')) { $oP->add_comment("Data Lines: ".$iLineCount); $oP->add_comment("Simulate: ".($bSimulate ? '1' : '0')); $oP->add_comment("Columns: ".implode(', ', $aFieldList)); - $aReconciliationReport = array(); - foreach($aReconcilKeysReport as $sKey => $aKeyDetails) - { - if (count($aKeyDetails) > 0) - { + $aReconciliationReport = []; + foreach ($aReconcilKeysReport as $sKey => $aKeyDetails) { + if (count($aKeyDetails) > 0) { $aReconciliationReport[] = $sKey.' ('.implode(',', $aKeyDetails).')'; - } - else - { + } else { $aReconciliationReport[] = $sKey; } } $oP->add_comment("Reconciliation Keys: ".implode(', ', $aReconciliationReport)); - foreach ($aWarnings as $sWarning) - { + foreach ($aWarnings as $sWarning) { $oP->add_comment("Warning: ".$sWarning); } } @@ -742,12 +640,9 @@ try $bLocalize ); - if ($bSimulate) - { + if ($bSimulate) { $oMyChange = null; - } - else - { + } else { if (strlen($sComment) > 0) { $sMoreInfo = CMDBChange::GetCurrentUserName().', Web Service (CSV) - '.$sComment; } else { @@ -768,38 +663,35 @@ try $iCountCreations = 0; $iCountUpdates = 0; $iCountUnchanged = 0; - foreach($aRes as $iRow => $aRowData) - { + foreach ($aRes as $iRow => $aRowData) { $bWritten = false; $oStatus = $aRowData["__STATUS__"]; - switch(get_class($oStatus)) - { - case 'RowStatus_NoChange': - $iCountUnchanged++; - break; - case 'RowStatus_Modify': - $iCountUpdates++; - $bWritten = true; - break; - case 'RowStatus_NewObj': - $iCountCreations++; - $bWritten = true; - break; - case 'RowStatus_Issue': - $iCountErrors++; - break; + switch (get_class($oStatus)) { + case 'RowStatus_NoChange': + $iCountUnchanged++; + break; + case 'RowStatus_Modify': + $iCountUpdates++; + $bWritten = true; + break; + case 'RowStatus_NewObj': + $iCountCreations++; + $bWritten = true; + break; + case 'RowStatus_Issue': + $iCountErrors++; + break; } - if ($bWritten) - { + if ($bWritten) { // Something has been done, still there may be some issues to report - foreach($aRowData as $key => $value) - { - if (!is_object($value)) continue; + foreach ($aRowData as $key => $value) { + if (!is_object($value)) { + continue; + } - switch (get_class($value)) - { + switch (get_class($value)) { case 'CellStatus_Void': case 'CellStatus_Modify': break; @@ -818,13 +710,11 @@ try // // Summary of settings and results // - if ($sOutput == 'retcode') - { + if ($sOutput == 'retcode') { $oP->add($iCountErrors); } - if (($sOutput == "summary") || ($sOutput == 'details')) - { + if (($sOutput == "summary") || ($sOutput == 'details')) { $oP->add_comment("Change tracking comment: ".$sComment); $oP->add_comment("Issues: ".$iCountErrors); $oP->add_comment("Warnings: ".$iCountWarnings); @@ -833,80 +723,69 @@ try $oP->add_comment("Unchanged: ".$iCountUnchanged); } - - if ($sOutput == 'details') - { + if ($sOutput == 'details') { // Setup result presentation // - $aDisplayConfig = array(); - $aDisplayConfig["__LINE__"] = array("label"=>"Line", "description"=>""); - $aDisplayConfig["__STATUS__"] = array("label"=>"Status", "description"=>""); - $aDisplayConfig["__OBJECT_CLASS__"] = array("label"=>"Object Class", "description"=>""); - $aDisplayConfig["__OBJECT_ID__"] = array("label"=>"Object Id", "description"=>""); - foreach($aExtKeys as $sExtKeyAttCode => $aRemoteAtt) - { + $aDisplayConfig = []; + $aDisplayConfig["__LINE__"] = ["label" => "Line", "description" => ""]; + $aDisplayConfig["__STATUS__"] = ["label" => "Status", "description" => ""]; + $aDisplayConfig["__OBJECT_CLASS__"] = ["label" => "Object Class", "description" => ""]; + $aDisplayConfig["__OBJECT_ID__"] = ["label" => "Object Id", "description" => ""]; + foreach ($aExtKeys as $sExtKeyAttCode => $aRemoteAtt) { $sLabel = MetaModel::GetAttributeDef($sClass, $sExtKeyAttCode)->GetLabel(); - $aDisplayConfig["$sExtKeyAttCode"] = array("label"=>$sExtKeyAttCode, "description"=>$sLabel." - ext key"); + $aDisplayConfig["$sExtKeyAttCode"] = ["label" => $sExtKeyAttCode, "description" => $sLabel." - ext key"]; } - foreach($aFinalReconcilKeys as $iCol => $sAttCode) - { - // $sLabel = MetaModel::GetAttributeDef($sClass, $sAttCode)->GetLabel(); - // $aDisplayConfig["$iCol"] = array("label"=>"$sLabel", "description"=>""); + foreach ($aFinalReconcilKeys as $iCol => $sAttCode) { + // $sLabel = MetaModel::GetAttributeDef($sClass, $sAttCode)->GetLabel(); + // $aDisplayConfig["$iCol"] = array("label"=>"$sLabel", "description"=>""); } - foreach ($aAttList as $sAttCode => $iCol) - { - if ($sAttCode == 'id') - { + foreach ($aAttList as $sAttCode => $iCol) { + if ($sAttCode == 'id') { $sLabel = Dict::S('UI:CSVImport:idField'); - $aDisplayConfig["$iCol"] = array("label"=>$sAttCode, "description"=>$sLabel); - } - else - { + $aDisplayConfig["$iCol"] = ["label" => $sAttCode, "description" => $sLabel]; + } else { $sLabel = MetaModel::GetAttributeDef($sClass, $sAttCode)->GetLabel(); - $aDisplayConfig["$iCol"] = array("label"=>$sAttCode, "description"=>$sLabel); + $aDisplayConfig["$iCol"] = ["label" => $sAttCode, "description" => $sLabel]; } } - $aResultDisp = array(); // to be displayed - foreach($aRes as $iRow => $aRowData) - { - $aRowDisp = array(); + $aResultDisp = []; // to be displayed + foreach ($aRes as $iRow => $aRowData) { + $aRowDisp = []; $aRowDisp["__LINE__"] = $iRow; - if (is_object($aRowData["__STATUS__"])) - { + if (is_object($aRowData["__STATUS__"])) { $aRowDisp["__STATUS__"] = $aRowData["__STATUS__"]->GetDescription(); - } - else - { + } else { $aRowDisp["__STATUS__"] = "*No status available*"; } - if (isset($aRowData["finalclass"]) && isset($aRowData["id"])) - { + if (isset($aRowData["finalclass"]) && isset($aRowData["id"])) { $aRowDisp["__OBJECT_CLASS__"] = $aRowData["finalclass"]; $aRowDisp["__OBJECT_ID__"] = $aRowData["id"]->GetCLIValue(); - } - else - { + } else { $aRowDisp["__OBJECT_CLASS__"] = "n/a"; $aRowDisp["__OBJECT_ID__"] = "n/a"; } - foreach($aRowData as $key => $value) - { + foreach ($aRowData as $key => $value) { $sKey = (string) $key; - if ($sKey == '__STATUS__') continue; - //__ERRORS__ used by tests only - if ($sKey == '__ERRORS__') continue; - if ($sKey == 'finalclass') continue; - if ($sKey == 'id') continue; - - if (is_object($value)) - { - $aRowDisp["$sKey"] = $value->GetCLIValueAndDescription(); + if ($sKey == '__STATUS__') { + continue; } - else - { + //__ERRORS__ used by tests only + if ($sKey == '__ERRORS__') { + continue; + } + if ($sKey == 'finalclass') { + continue; + } + if ($sKey == 'id') { + continue; + } + + if (is_object($value)) { + $aRowDisp["$sKey"] = $value->GetCLIValueAndDescription(); + } else { $aRowDisp["$sKey"] = $value; } } @@ -914,19 +793,12 @@ try } $oP->table($aDisplayConfig, $aResultDisp); } -} -catch(BulkLoadException $e) -{ +} catch (BulkLoadException $e) { $oP->add_comment($e->getMessage()); -} -catch(SecurityException $e) -{ +} catch (SecurityException $e) { $oP->add_comment($e->getMessage()); -} -catch(Exception $e) -{ +} catch (Exception $e) { $oP->add_comment((string)$e); } $oP->output(); -?> diff --git a/webservices/itop.wsdl.php b/webservices/itop.wsdl.php index 5b9b37b1f..03aaed90d 100644 --- a/webservices/itop.wsdl.php +++ b/webservices/itop.wsdl.php @@ -1,4 +1,5 @@ diff --git a/webservices/itoprest.examples.php b/webservices/itoprest.examples.php index e14988c0c..6408a1ff8 100644 --- a/webservices/itoprest.examples.php +++ b/webservices/itoprest.examples.php @@ -1,9 +1,10 @@ - /** - * Shows a usage of the SOAP queries + * Shows a usage of the SOAP queries * * @copyright Copyright (C) 2010-2024 Combodo SAS * @license http://opensource.org/licenses/AGPL-3.0 @@ -36,29 +36,26 @@ * @return bool|false|string * @throws \Exception */ -function DoPostRequest($sUrl, $aData, $sOptionnalHeaders = null, &$aResponseHeaders = null, $aCurlOptions = array()) +function DoPostRequest($sUrl, $aData, $sOptionnalHeaders = null, &$aResponseHeaders = null, $aCurlOptions = []) { // $sOptionnalHeaders is a string containing additional HTTP headers that you would like to send in your request. - if (function_exists('curl_init')) - { + if (function_exists('curl_init')) { // If cURL is available, let's use it, since it provides a greater control over the various HTTP/SSL options // For instance fopen does not allow to work around the bug: http://stackoverflow.com/questions/18191672/php-curl-ssl-routinesssl23-get-server-helloreason1112 // by setting the SSLVERSION to 3 as done below. - $aHTTPHeaders = array(); - if ($sOptionnalHeaders !== null) - { + $aHTTPHeaders = []; + if ($sOptionnalHeaders !== null) { $aHeaders = explode("\n", $sOptionnalHeaders); // N°3267 - Webservices: Fix optional headers not being taken into account // See https://www.php.net/curl_setopt CURLOPT_HTTPHEADER - $aHTTPHeaders = array(); - foreach($aHeaders as $sHeaderString) - { + $aHTTPHeaders = []; + foreach ($aHeaders as $sHeaderString) { $aHTTPHeaders[] = trim($sHeaderString); } } // Default options, can be overloaded/extended with the 4th parameter of this method, see above $aCurlOptions - $aOptions = array( + $aOptions = [ CURLOPT_RETURNTRANSFER => true, // return the content of the request CURLOPT_HEADER => false, // don't return the headers in the output CURLOPT_FOLLOWLOCATION => true, // follow redirects @@ -76,74 +73,58 @@ function DoPostRequest($sUrl, $aData, $sOptionnalHeaders = null, &$aResponseHead CURLOPT_POST => count($aData), CURLOPT_POSTFIELDS => http_build_query($aData), CURLOPT_HTTPHEADER => $aHTTPHeaders, - ); + ]; $aAllOptions = $aCurlOptions + $aOptions; $ch = curl_init($sUrl); curl_setopt_array($ch, $aAllOptions); $response = curl_exec($ch); $iErr = curl_errno($ch); - $sErrMsg = curl_error( $ch ); - if ($iErr !== 0) - { + $sErrMsg = curl_error($ch); + if ($iErr !== 0) { throw new Exception("Problem opening URL: $sUrl, $sErrMsg"); } - if (is_array($aResponseHeaders)) - { + if (is_array($aResponseHeaders)) { $aHeaders = curl_getinfo($ch); - foreach($aHeaders as $sCode => $sValue) - { - $sName = str_replace(' ' , '-', ucwords(str_replace('_', ' ', $sCode))); // Transform "content_type" into "Content-Type" + foreach ($aHeaders as $sCode => $sValue) { + $sName = str_replace(' ', '-', ucwords(str_replace('_', ' ', $sCode))); // Transform "content_type" into "Content-Type" $aResponseHeaders[$sName] = $sValue; } } - curl_close( $ch ); - } - else - { + curl_close($ch); + } else { // cURL is not available let's try with streams and fopen... $sData = http_build_query($aData); - $aParams = array('http' => array( + $aParams = ['http' => [ 'method' => 'POST', 'content' => $sData, - 'header'=> "Content-type: application/x-www-form-urlencoded\r\nContent-Length: ".strlen($sData)."\r\n", - )); - if ($sOptionnalHeaders !== null) - { + 'header' => "Content-type: application/x-www-form-urlencoded\r\nContent-Length: ".strlen($sData)."\r\n", + ]]; + if ($sOptionnalHeaders !== null) { $aParams['http']['header'] .= $sOptionnalHeaders; } $ctx = stream_context_create($aParams); $fp = @fopen($sUrl, 'rb', false, $ctx); - if (!$fp) - { + if (!$fp) { global $php_errormsg; - if (isset($php_errormsg)) - { + if (isset($php_errormsg)) { throw new Exception("Wrong URL: $sUrl, $php_errormsg"); - } - elseif ((strtolower(substr($sUrl, 0, 5)) == 'https') && !extension_loaded('openssl')) - { + } elseif ((strtolower(substr($sUrl, 0, 5)) == 'https') && !extension_loaded('openssl')) { throw new Exception("Cannot connect to $sUrl: missing module 'openssl'"); - } - else - { + } else { throw new Exception("Wrong URL: $sUrl"); } } $response = @stream_get_contents($fp); - if ($response === false) - { + if ($response === false) { throw new Exception("Problem reading data from $sUrl, $php_errormsg"); } - if (is_array($aResponseHeaders)) - { + if (is_array($aResponseHeaders)) { $aMeta = stream_get_meta_data($fp); $aHeaders = $aMeta['wrapper_data']; - foreach($aHeaders as $sHeaderString) - { - if(preg_match('/^([^:]+): (.+)$/', $sHeaderString, $aMatches)) - { + foreach ($aHeaders as $sHeaderString) { + if (preg_match('/^([^:]+): (.+)$/', $sHeaderString, $aMatches)) { $aResponseHeaders[$aMatches[1]] = trim($aMatches[2]); } } @@ -161,208 +142,203 @@ function DoPostRequest($sUrl, $aData, $sOptionnalHeaders = null, &$aResponseHead // Define the operations to perform (one operation per call the rest service) // -$aOperations = array( - array( +$aOperations = [ + [ 'operation' => 'list_operations', // operation code - ), - array( + ], + [ 'operation' => 'core/create', // operation code 'comment' => 'Synchronization from blah...', // comment recorded in the change tracking log 'class' => 'UserRequest', 'output_fields' => 'id, friendlyname', // list of fields to show in the results (* or a,b,c) // Values for the object to create - 'fields' => array( + 'fields' => [ 'org_id' => "SELECT Organization WHERE name = 'Demo'", - 'caller_id' => array('name' => 'monet', 'first_name' => 'claude'), + 'caller_id' => ['name' => 'monet', 'first_name' => 'claude'], 'title' => 'issue blah', - 'description' => 'something happened' - ), - ), - array( + 'description' => 'something happened', + ], + ], + [ 'operation' => 'core/update', // operation code 'comment' => 'Synchronization from blah...', // comment recorded in the change tracking log 'class' => 'UserRequest', 'key' => 'SELECT UserRequest WHERE id=1', 'output_fields' => 'id, friendlyname, title', // list of fields to show in the results (* or a,b,c) // Values for the object to create - 'fields' => array( + 'fields' => [ 'title' => 'Issue #'.rand(0, 100), - 'contacts_list' => array( - array( + 'contacts_list' => [ + [ 'role' => 'fireman #'.rand(0, 100), - 'contact_id' => array('finalclass' => 'Person', 'name' => 'monet', 'first_name' => 'claude'), - ), - ), - ), - ), + 'contact_id' => ['finalclass' => 'Person', 'name' => 'monet', 'first_name' => 'claude'], + ], + ], + ], + ], // Rewrite the full CaseLog on an existing UserRequest with id=1, setting date and user (optional) - array( + [ 'operation' => 'core/update', 'comment' => 'Synchronization from Client A', // comment recorded in the change tracking log 'class' => 'UserRequest', 'key' => 'SELECT UserRequest WHERE id=1', 'output_fields' => 'id, friendlyname, title', - 'fields' => array( - 'public_log' => array( - 'items' => array( - 0 => array( + 'fields' => [ + 'public_log' => [ + 'items' => [ + 0 => [ 'date' => '2001-02-01 23:59:59', //Allow to set the date of a true event, an alarm for eg. 'user_login' => 'Alarm monitoring', //Free text 'user_id' => 0, //0 is required for the user_login to be taken into account 'message' => 'This is 1st entry as an HTML formatted
    text', - ), - 1 => array( + ], + 1 => [ 'date' => '2001-02-02 00:00:00', //If ommitted set automatically. 'user_login' => 'Alarm monitoring', //user=id=0 is missing so will be ignored 'message' => 'Second entry in text format: with new line, but format not specified, so treated as HTML!, user_id=0 missing, so user_login ignored', - ), - ), - ), - ), - ), + ], + ], + ], + ], + ], // Add a Text entry in the HTML CaseLog of the UserRequest with id=1, setting date and user (optional) - array( + [ 'operation' => 'core/update', // operation code 'comment' => 'Synchronization from Alarm Monitoring', // comment recorded in the change tracking log 'class' => 'UserRequest', 'key' => 1, // object id or OQL 'output_fields' => 'id, friendlyname, title', // list of fields to show in the results (* or a,b,c) // Example of adding an entry into a CaseLog on an existing UserRequest - 'fields' => array( - 'public_log' => array( - 'add_item' => array( + 'fields' => [ + 'public_log' => [ + 'add_item' => [ 'user_login' => 'New Entry', //Free text 'user_id' => 0, //0 is required for the user_login to be taken into account 'format' => 'text', //If ommitted, source is expected to be HTML 'message' => 'This text is not HTML formatted with 3 lines: new line 3rd and last line', - ), - ), - ), - ), - array( + ], + ], + ], + ], + [ 'operation' => 'core/get', // operation code 'class' => 'UserRequest', 'key' => 'SELECT UserRequest', 'output_fields' => 'id, friendlyname, title, contacts_list', // list of fields to show in the results (* or a,b,c) - ), - array( + ], + [ 'operation' => 'core/delete', // operation code 'comment' => 'Cleanup for synchro with...', // comment recorded in the change tracking log 'class' => 'UserRequest', 'key' => 'SELECT UserRequest WHERE org_id = 2', 'simulate' => true, - ), - array( + ], + [ 'operation' => 'core/apply_stimulus', // operation code 'comment' => 'Synchronization from blah...', // comment recorded in the change tracking log 'class' => 'UserRequest', 'key' => 1, 'stimulus' => 'ev_assign', // Values to set - 'fields' => array( + 'fields' => [ 'team_id' => 15, // Helpdesk - 'agent_id' => 9 // Jules Verne - ), + 'agent_id' => 9, // Jules Verne + ], 'output_fields' => 'id, friendlyname, title, contacts_list', // list of fields to show in the results (* or a,b,c) - ), - array( + ], + [ 'operation' => 'core/get_related', // operation code 'class' => 'Server', 'key' => 'SELECT Server', 'relation' => 'impacts', // relation code 'depth' => 4, // max recursion depth - ), -); -$aOperations = array( - array( + ], +]; +$aOperations = [ + [ 'operation' => 'core/create', // operation code 'comment' => 'Automatic creation of attachment blah blah...', // comment recorded in the change tracking log 'class' => 'Attachment', 'output_fields' => 'id, friendlyname', // list of fields to show in the results (* or a,b,c) // Values for the object to create - 'fields' => array( + 'fields' => [ 'item_class' => 'UserRequest', 'item_id' => 1, 'item_org_id' => 3, - 'contents' => array( + 'contents' => [ 'data' => 'iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAIAAAC0tAIdAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACmSURBVChTfZHRDYMwDESzQ2fqhHx3C3ao+MkW/WlnaFxfzk7sEnE6JHJ+NgaKZN2zLHVN2ssfkae0Da7FQ5PRk/ve4Hcx19Ie6CEGuh/6vMgNhwanHVUNbt73lUDbYJ+6pg8b3+m2RehsVPdMXyvQY+OVkB+Rrv64lUjb3nq+aCA6v4leRqtfaIgimr53atBy9PlfUhoh3fFCNDmErv9FWR6ylBL5AREbmHBnFj5lAAAAAElFTkSuQmCC', 'filename' => 'myself.png', - 'mimetype' => 'image/png' - ), - ), - ), - array( + 'mimetype' => 'image/png', + ], + ], + ], + [ 'operation' => 'core/get', // operation code 'class' => 'Attachment', 'key' => 'SELECT Attachment', 'output_fields' => '*', - ) -); -$aOperations = array( - array( + ], +]; +$aOperations = [ + [ 'operation' => 'core/update', // operation code 'comment' => 'Synchronization from blah...', // comment recorded in the change tracking log 'class' => 'Server', 'key' => 'SELECT Server WHERE name="Server1"', 'output_fields' => 'id, friendlyname, description', // list of fields to show in the results (* or a,b,c) // Values for the object to create - 'fields' => array( + 'fields' => [ 'description' => 'Issue #'.time(), - ), - ), -); -$aOperations = array( - array( + ], + ], +]; +$aOperations = [ + [ 'operation' => 'core/create', // operation code 'comment' => 'Synchronization from blah...', // comment recorded in the change tracking log 'class' => 'UserRequest', 'output_fields' => 'id, friendlyname', // list of fields to show in the results (* or a,b,c) // Values for the object to create - 'fields' => array( + 'fields' => [ 'org_id' => "SELECT Organization WHERE name = 'Demo'", - 'caller_id' => array('name' => 'monet', 'first_name' => 'claude'), + 'caller_id' => ['name' => 'monet', 'first_name' => 'claude'], 'title' => 'issue blah', - 'description' => 'something happened' - ), - ), -); -$aXXXOperations = array( - array( + 'description' => 'something happened', + ], + ], +]; +$aXXXOperations = [ + [ 'operation' => 'core/check_credentials', // operation code 'user' => 'admin', 'password' => 'admin', - ), -); -$aDeleteOperations = array( - array( + ], +]; +$aDeleteOperations = [ + [ 'operation' => 'core/delete', // operation code 'comment' => 'Cleanup for synchro with...', // comment recorded in the change tracking log 'class' => 'Server', 'key' => 'SELECT Server', 'simulate' => false, - ), -); + ], +]; -if (false) -{ +if (false) { echo "Please edit the sample script and configure the server URL"; exit; -} -else -{ +} else { $sUrl = "https://localhost/itop/webservices/rest.php?version=1.3"; } -$aData = array(); +$aData = []; $aData['auth_user'] = 'rest'; $aData['auth_pwd'] = 'rest'; - -foreach ($aOperations as $iOp => $aOperation) -{ +foreach ($aOperations as $iOp => $aOperation) { echo "======================================\n"; echo "Operation #$iOp: ".$aOperation['operation']."\n"; $aData['json_data'] = json_encode($aOperation); @@ -371,25 +347,18 @@ foreach ($aOperations as $iOp => $aOperation) echo "Input:\n"; print_r($aOperation); $aResults = null; - try - { + try { $response = DoPostRequest($sUrl, $aData); $aResults = json_decode($response); - } - catch (Exception $e) - { + } catch (Exception $e) { $response = $e->getMessage(); } - if ($aResults) - { + if ($aResults) { echo "--------------------------------------\n"; echo "Reply:\n"; print_r($aResults); - } - else - { + } else { echo "ERROR rest.php replied:\n"; echo $response; } } - diff --git a/webservices/itopsoap.examples.php b/webservices/itopsoap.examples.php index 5ed1bdc24..6427a0284 100644 --- a/webservices/itopsoap.examples.php +++ b/webservices/itopsoap.examples.php @@ -1,9 +1,10 @@ - /** - * Shows a usage of the SOAP queries + * Shows a usage of the SOAP queries * * @copyright Copyright (C) 2010-2024 Combodo SAS * @license http://opensource.org/licenses/AGPL-3.0 @@ -31,17 +31,16 @@ $sWsdlUri = $sItopRoot.'/webservices/itop.wsdl.php'; $aSOAPMapping = SOAPMapping::GetMapping(); -ini_set("soap.wsdl_cache_enabled","0"); +ini_set("soap.wsdl_cache_enabled", "0"); $oSoapClient = new SoapClient( $sWsdlUri, - array( + [ 'trace' => 1, 'classmap' => $aSOAPMapping, // defined in itopsoaptypes.class.inc.php - ) + ] ); -try -{ +try { // The most simple service, returning a string // $sServerVersion = $oSoapClient->GetVersion(); @@ -50,30 +49,29 @@ try // More complex ones, returning a SOAPResult structure // (run the page to know more about the returned data) // - $oRes = $oSoapClient->CreateIncidentTicket - ( + $oRes = $oSoapClient->CreateIncidentTicket( 'admin', /* login */ 'admin', /* password */ 'Email server down', /* title */ 'HW found shutdown', /* description */ null, /* caller */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* customer */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'NW Management'))), /* service */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Troubleshooting'))), /* service subcategory */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Demo')]), /* customer */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'NW Management')]), /* service */ + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'Troubleshooting')]), /* service subcategory */ '', /* product */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'NW support'))), /* workgroup */ - array( + new SOAPExternalKeySearch([new SOAPSearchCondition('name', 'NW support')]), /* workgroup */ + [ new SOAPLinkCreationSpec( 'Device', - array(new SOAPSearchCondition('name', 'switch01')), - array() + [new SOAPSearchCondition('name', 'switch01')], + [] ), new SOAPLinkCreationSpec( 'Server', - array(new SOAPSearchCondition('name', 'dbserver1.demo.com')), - array() + [new SOAPSearchCondition('name', 'dbserver1.demo.com')], + [] ), - ), /* impacted cis */ + ], /* impacted cis */ '1', /* impact */ '1' /* urgency */ ); @@ -84,44 +82,36 @@ try echo "\n"; echo "

    \n"; - $oRes = $oSoapClient->SearchObjects - ( + $oRes = $oSoapClient->SearchObjects( 'admin', /* login */ 'admin', /* password */ 'SELECT URP_Profiles' /* oql */ ); echo "

    SearchObjects() returned:\n"; - if ($oRes->status) - { + if ($oRes->status) { $aResults = $oRes->result; echo "

    \n"; // Header made after the first line echo "\n"; - foreach ($aResults[0]->values as $aKeyValuePair) - { + foreach ($aResults[0]->values as $aKeyValuePair) { echo " \n"; } echo "\n"; - foreach ($aResults as $iRow => $aData) - { + foreach ($aResults as $iRow => $aData) { echo "\n"; - foreach ($aData->values as $aKeyValuePair) - { + foreach ($aData->values as $aKeyValuePair) { echo " \n"; } echo "\n"; } echo "
    ".$aKeyValuePair->key."
    ".$aKeyValuePair->value."
    \n"; - } - else - { - $aErrors = array(); - foreach ($oRes->errors->messages as $oMessage) - { + } else { + $aErrors = []; + foreach ($oRes->errors->messages as $oMessage) { $aErrors[] = $oMessage->text; } $sErrorMsg = implode(', ', $aErrors); @@ -131,15 +121,12 @@ try //echo "
    \n"; } echo "

    \n"; -} -catch(SoapFault $e) -{ - echo "

    SoapFault Exception: {$e->getMessage()}

    \n"; - echo "

    Request

    \n"; - echo "
    \n"; 
    -	echo htmlspecialchars($oSoapClient->__getLastRequest())."\n"; 
    -	echo "
    "; +} catch (SoapFault $e) { + echo "

    SoapFault Exception: {$e->getMessage()}

    \n"; + echo "

    Request

    \n"; + echo "
    \n";
    +	echo htmlspecialchars($oSoapClient->__getLastRequest())."\n";
    +	echo "
    "; echo "

    Response

    "; echo $oSoapClient->__getLastResponse()."\n"; } -?> diff --git a/webservices/itopsoaptypes.class.inc.php b/webservices/itopsoaptypes.class.inc.php index 6145d85fa..679dc4996 100644 --- a/webservices/itopsoaptypes.class.inc.php +++ b/webservices/itopsoaptypes.class.inc.php @@ -1,9 +1,10 @@ - /** * Declarations required for the WSDL * @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - // Note: the attributes must have the same names (case sensitive) as in the WSDL specification // @@ -40,7 +39,6 @@ class SOAPSearchCondition } } - class SOAPExternalKeySearch { public $conditions; // array of SOAPSearchCondition @@ -52,12 +50,15 @@ class SOAPExternalKeySearch public function IsVoid() { - if (is_null($this->conditions)) return true; - if (count($this->conditions) == 0) return true; + if (is_null($this->conditions)) { + return true; + } + if (count($this->conditions) == 0) { + return true; + } } } - class SOAPAttributeValue { public $attcode; // string @@ -70,7 +71,6 @@ class SOAPAttributeValue } } - class SOAPLinkCreationSpec { public $class; @@ -85,7 +85,6 @@ class SOAPLinkCreationSpec } } - class SOAPLogMessage { public $text; // string @@ -96,7 +95,6 @@ class SOAPLogMessage } } - class SOAPResultLog { public $messages; // array of SOAPLogMessage @@ -107,7 +105,6 @@ class SOAPResultLog } } - class SOAPKeyValue { public $key; // string @@ -132,7 +129,6 @@ class SOAPResultMessage } } - class SOAPResult { public $status; // boolean @@ -163,12 +159,11 @@ class SOAPSimpleResult } } - class SOAPMapping { - static function GetMapping() + public static function GetMapping() { - $aSOAPMapping = array( + $aSOAPMapping = [ 'SearchCondition' => 'SOAPSearchCondition', 'ExternalKeySearch' => 'SOAPExternalKeySearch', 'AttributeValue' => 'SOAPAttributeValue', @@ -180,9 +175,7 @@ class SOAPMapping 'ResultMessage' => 'SOAPResultMessage', 'Result' => 'SOAPResult', 'SimpleResult' => 'SOAPSimpleResult', - ); + ]; return $aSOAPMapping; } } - -?> diff --git a/webservices/rest.php b/webservices/rest.php index 70f08cb0e..878a3e9fa 100644 --- a/webservices/rest.php +++ b/webservices/rest.php @@ -1,4 +1,5 @@ operations[] = array( + $this->operations[] = [ 'verb' => $sVerb, 'description' => $sDescription, 'extension' => $sServiceProviderClass, - ); + ]; } } if (!function_exists('json_last_error_msg')) { - function json_last_error_msg() { - static $ERRORS = array( + function json_last_error_msg() + { + static $ERRORS = [ JSON_ERROR_NONE => 'No error', JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', JSON_ERROR_STATE_MISMATCH => 'State mismatch (invalid or malformed JSON)', JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded', JSON_ERROR_SYNTAX => 'Syntax error', JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded', - ); + ]; $error = json_last_error(); return isset($ERRORS[$error]) ? $ERRORS[$error] : 'Unknown error'; @@ -74,15 +75,14 @@ $sOperation = utils::ReadParam('operation', null); //read json_data parameter via as a string (standard behaviour) $sJsonString = utils::ReadParam('json_data', null, false, 'raw_data'); -if (empty($sJsonString)){ +if (empty($sJsonString)) { //N °3455: read json_data parameter via a file passed by http protocol - if(isset($_FILES['json_data']['tmp_name'])) - { + if (isset($_FILES['json_data']['tmp_name'])) { $sTmpFilePath = $_FILES['json_data']['tmp_name']; - if (is_file($sTmpFilePath)){ + if (is_file($sTmpFilePath)) { $sValue = file_get_contents($sTmpFilePath); unlink($sTmpFilePath); - if (! empty($sValue)){ + if (! empty($sValue)) { $sJsonString = utils::Sanitize($sValue, null, 'raw_data'); } } @@ -92,136 +92,111 @@ if (empty($sJsonString)){ $sProvider = ''; $oKPI = new ExecutionKPI(); -try -{ +try { utils::UseParamFile(); - + $oKPI->ComputeAndReport('Data model loaded'); - // N°6358 - force credentials for REST calls - LoginWebPage::ResetSession(true); + // N°6358 - force credentials for REST calls + LoginWebPage::ResetSession(true); $iRet = LoginWebPage::DoLogin(false, false, LoginWebPage::EXIT_RETURN); - $oKPI->ComputeAndReport('User login'); + $oKPI->ComputeAndReport('User login'); - if ($iRet == LoginWebPage::EXIT_CODE_OK) - { + if ($iRet == LoginWebPage::EXIT_CODE_OK) { // Extra validation of the profile - if ((MetaModel::GetConfig()->Get('secure_rest_services') == true) && !UserRights::HasProfile('REST Services User')) - { + if ((MetaModel::GetConfig()->Get('secure_rest_services') == true) && !UserRights::HasProfile('REST Services User')) { // Web services access is limited to the users with the profile REST Web Services $iRet = LoginWebPage::EXIT_CODE_NOTAUTHORIZED; } } - if ($iRet != LoginWebPage::EXIT_CODE_OK) - { - switch($iRet) - { + if ($iRet != LoginWebPage::EXIT_CODE_OK) { + switch ($iRet) { case LoginWebPage::EXIT_CODE_MISSINGLOGIN: - throw new Exception("Missing parameter 'auth_user'", RestResult::MISSING_AUTH_USER); - break; - + throw new Exception("Missing parameter 'auth_user'", RestResult::MISSING_AUTH_USER); + break; + case LoginWebPage::EXIT_CODE_MISSINGPASSWORD: - throw new Exception("Missing parameter 'auth_pwd'", RestResult::MISSING_AUTH_PWD); - break; - + throw new Exception("Missing parameter 'auth_pwd'", RestResult::MISSING_AUTH_PWD); + break; + case LoginWebPage::EXIT_CODE_WRONGCREDENTIALS: - throw new Exception("Invalid login", RestResult::UNAUTHORIZED); - break; - + throw new Exception("Invalid login", RestResult::UNAUTHORIZED); + break; + case LoginWebPage::EXIT_CODE_PORTALUSERNOTAUTHORIZED: - throw new Exception("Portal user is not allowed", RestResult::UNAUTHORIZED); - break; - + throw new Exception("Portal user is not allowed", RestResult::UNAUTHORIZED); + break; + case LoginWebPage::EXIT_CODE_NOTAUTHORIZED: - throw new Exception("This user is not authorized to use the web services. (The profile REST Services User is required to access the REST web services)", RestResult::UNAUTHORIZED); - break; - + throw new Exception("This user is not authorized to use the web services. (The profile REST Services User is required to access the REST web services)", RestResult::UNAUTHORIZED); + break; + default: - throw new Exception("Unknown authentication error (retCode=$iRet)", RestResult::UNAUTHORIZED); + throw new Exception("Unknown authentication error (retCode=$iRet)", RestResult::UNAUTHORIZED); } } - if ($sVersion == null) - { + if ($sVersion == null) { throw new Exception("Missing parameter 'version' (e.g. '1.0')", RestResult::MISSING_VERSION); } - if ($sJsonString == null) - { + if ($sJsonString == null) { throw new Exception("Missing parameter 'json_data'", RestResult::MISSING_JSON); } - if (is_string($sJsonString)) - { - $aJsonData = @json_decode($sJsonString); - } - elseif(is_array($sJsonString)) - { - $aJsonData = (object) $sJsonString; - $sJsonString = json_encode($aJsonData); - } - else - { - $aJsonData = null; - } + if (is_string($sJsonString)) { + $aJsonData = @json_decode($sJsonString); + } elseif (is_array($sJsonString)) { + $aJsonData = (object) $sJsonString; + $sJsonString = json_encode($aJsonData); + } else { + $aJsonData = null; + } - if ($aJsonData == null) - { - throw new Exception('Parameter json_data is not a valid JSON structure', RestResult::INVALID_JSON); - } + if ($aJsonData == null) { + throw new Exception('Parameter json_data is not a valid JSON structure', RestResult::INVALID_JSON); + } $oKPI->ComputeAndReport('Parameters validated'); - /** @var iRestServiceProvider[] $aProviders */ $oKPI = new ExecutionKPI(); - $aProviders = array(); - foreach(get_declared_classes() as $sPHPClass) - { + $aProviders = []; + foreach (get_declared_classes() as $sPHPClass) { $oRefClass = new ReflectionClass($sPHPClass); - if ($oRefClass->implementsInterface('iRestServiceProvider')) - { - $aProviders[] = new $sPHPClass; + if ($oRefClass->implementsInterface('iRestServiceProvider')) { + $aProviders[] = new $sPHPClass(); } } - $aOpToRestService = array(); // verb => $oRestServiceProvider + $aOpToRestService = []; // verb => $oRestServiceProvider /** @var iRestServiceProvider $oRestSP */ - foreach ($aProviders as $oRestSP) - { + foreach ($aProviders as $oRestSP) { $aOperations = $oRestSP->ListOperations($sVersion); - foreach ($aOperations as $aOpData) - { - $aOpToRestService[$aOpData['verb']] = array - ( + foreach ($aOperations as $aOpData) { + $aOpToRestService[$aOpData['verb']] = + [ 'service_provider' => $oRestSP, 'description' => $aOpData['description'], - ); + ]; } } $oKPI->ComputeAndReport('iRestServiceProvider loaded with operations'); - if (count($aOpToRestService) == 0) - { + if (count($aOpToRestService) == 0) { throw new Exception("There is no service available for version '$sVersion'", RestResult::UNSUPPORTED_VERSION); } - $sOperation = RestUtils::GetMandatoryParam($aJsonData, 'operation'); - if ($sOperation == 'list_operations') - { + if ($sOperation == 'list_operations') { $oResult = new RestResultListOperations(); $oResult->message = "Operations: ".count($aOpToRestService); $oResult->version = $sVersion; - foreach ($aOpToRestService as $sVerb => $aOpData) - { + foreach ($aOpToRestService as $sVerb => $aOpData) { $oResult->AddOperation($sVerb, $aOpData['description'], get_class($aOpData['service_provider'])); } - } - else - { - if (!array_key_exists($sOperation, $aOpToRestService)) - { + } else { + if (!array_key_exists($sOperation, $aOpToRestService)) { throw new Exception("Unknown verb '$sOperation' in version '$sVersion'", RestResult::UNKNOWN_OPERATION); } /** @var iRestServiceProvider $oRS */ @@ -236,16 +211,11 @@ try $oResult = $oRS->ExecOperation($sVersion, $sOperation, $aJsonData); } $oKPI->ComputeAndReport('Operation finished'); -} -catch(Exception $e) -{ +} catch (Exception $e) { $oResult = new RestResult(); - if ($e->GetCode() == 0) - { + if ($e->GetCode() == 0) { $oResult->code = RestResult::INTERNAL_ERROR; - } - else - { + } else { $oResult->code = $e->GetCode(); } $oResult->message = "Error: ".$e->GetMessage(); @@ -256,23 +226,17 @@ catch(Exception $e) // $sResponse = json_encode($oResult); - -if ($sResponse === false) -{ +if ($sResponse === false) { $oJsonIssue = new RestResult(); $oJsonIssue->code = RestResult::INTERNAL_ERROR; $oJsonIssue->message = 'json encoding failed with message: '.json_last_error_msg().'. Full response structure for debugging purposes (print_r+bin2hex): '.bin2hex(print_r($oResult, true)); $sResponse = json_encode($oJsonIssue); } - $sCallback = utils::ReadParam('callback', null); -if ($sCallback == null) -{ +if ($sCallback == null) { $oP = new JsonPage(); -} -else -{ +} else { $oP = new JsonPPage($sCallback); } $oP->add_header('Access-Control-Allow-Origin: *'); @@ -283,18 +247,16 @@ ExecutionKPI::ReportStats(); // Log usage // -if (MetaModel::GetConfig()->Get('log_rest_service')) -{ +if (MetaModel::GetConfig()->Get('log_rest_service')) { $oLog = new EventRestService(); $oLog->SetTrim('userinfo', UserRights::GetUser()); $oLog->Set('version', $sVersion); $oLog->Set('operation', $sOperation); - $oLog->SetTrim('json_input', $sSanitizedJsonInput ?? $sJsonString); + $oLog->SetTrim('json_input', $sSanitizedJsonInput ?? $sJsonString); $oLog->Set('provider', $sProvider); $sMessage = $oResult->message; - if (empty($oResult->message)) - { + if (empty($oResult->message)) { $sMessage = 'Ok'; } $oLog->SetTrim('message', $sMessage); @@ -303,7 +265,7 @@ if (MetaModel::GetConfig()->Get('log_rest_service')) $iUnescapeSlashAndUnicode = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; $sJsonOuputWithPrettyPrinting = json_encode($oResult, $iUnescapeSlashAndUnicode | JSON_PRETTY_PRINT); $sJsonOutputWithoutPrettyPrinting = json_encode($oResult, $iUnescapeSlashAndUnicode); - !StringFitsInLogField( $sJsonOuputWithPrettyPrinting) ? + !StringFitsInLogField($sJsonOuputWithPrettyPrinting) ? $oLog->SetTrim('json_output', $sJsonOutputWithoutPrettyPrinting) : // too long, we don't make it pretty $oLog->SetTrim('json_output', $sJsonOuputWithPrettyPrinting); @@ -316,4 +278,4 @@ if (MetaModel::GetConfig()->Get('log_rest_service')) function StringFitsInLogField(string $sLog): bool { return mb_strlen($sLog) <= 16383; // hardcoded value, see N°8260 -} \ No newline at end of file +} diff --git a/webservices/soapserver.php b/webservices/soapserver.php index 2d9b49ec4..055ceb0eb 100644 --- a/webservices/soapserver.php +++ b/webservices/soapserver.php @@ -1,4 +1,5 @@ $aSOAPMapping - ) + [ + 'classmap' => $aSOAPMapping, + ] ); // $oSoapServer->setPersistence(SOAP_PERSISTENCE_SESSION); -if (!empty($sServiceCategory)) -{ +if (!empty($sServiceCategory)) { $sServiceClass = $sServiceCategory; - if (!class_exists($sServiceClass)) - { + if (!class_exists($sServiceClass)) { // not a valid class name (not a PHP class at all) throw new SoapFault("iTop SOAP server", "Invalid argument service_category: '$sServiceClass' is not a PHP class"); - } - elseif (!is_subclass_of($sServiceClass, 'WebServicesBase')) - { + } elseif (!is_subclass_of($sServiceClass, 'WebServicesBase')) { // not a valid class name (not deriving from WebServicesBase) throw new SoapFault("iTop SOAP server", "Invalid argument service_category: '$sServiceClass' is not derived from WebServicesBase"); - } - else - { + } else { $oSoapServer->setClass($sServiceClass, null); } -} -else -{ +} else { $oSoapServer->setClass('BasicServices', null); } -if ($_SERVER["REQUEST_METHOD"] == "POST") -{ +if ($_SERVER["REQUEST_METHOD"] == "POST") { CMDBObject::SetTrackOrigin('webservice-soap'); $oSoapServer->handle(); -} -else -{ +} else { echo "This SOAP server can handle the following functions: "; $aFunctions = $oSoapServer->getFunctions(); echo "
      \n"; - foreach($aFunctions as $sFunc) - { - if ($sFunc == 'GetWSDLContents') continue; + foreach ($aFunctions as $sFunc) { + if ($sFunc == 'GetWSDLContents') { + continue; + } echo "
    • $sFunc
    • \n"; } @@ -88,10 +76,8 @@ else echo "You may also want to try the following service categories: "; echo "
        \n"; - foreach(get_declared_classes() as $sPHPClass) - { - if (is_subclass_of($sPHPClass, 'WebServicesBase')) - { + foreach (get_declared_classes() as $sPHPClass) { + if (is_subclass_of($sPHPClass, 'WebServicesBase')) { $sServiceCategory = $sPHPClass; $sSoapServerUri = utils::GetAbsoluteUrlAppRoot().'webservices/soapserver.php'; $sSoapServerUri .= "?service_category=$sServiceCategory"; @@ -100,4 +86,3 @@ else } echo "
      \n"; } -?> diff --git a/webservices/status.php b/webservices/status.php index 636ab4ec6..7ef91b2c0 100644 --- a/webservices/status.php +++ b/webservices/status.php @@ -6,21 +6,18 @@ require_once(__DIR__.'/../approot.inc.php'); use Combodo\iTop\Application\Status\Status; //Do check Status -try -{ - new Status(); - $aResult = ['status' => STATUS_RUNNING, 'code' => RestResult::OK, 'message' => '']; -} -catch (Exception $e) -{ - $iCode = (defined('\RestResult::INTERNAL_ERROR')) ? RestResult::INTERNAL_ERROR : 100; - $aResult = ['status' => STATUS_ERROR, 'code' => $iCode, 'message' => $e->getMessage()]; - http_response_code(500); +try { + new Status(); + $aResult = ['status' => STATUS_RUNNING, 'code' => RestResult::OK, 'message' => '']; +} catch (Exception $e) { + $iCode = (defined('\RestResult::INTERNAL_ERROR')) ? RestResult::INTERNAL_ERROR : 100; + $aResult = ['status' => STATUS_ERROR, 'code' => $iCode, 'message' => $e->getMessage()]; + http_response_code(500); } //Set headers, based on webservices/rest.php $sContentType = 'application/json'; -header('Content-type: ' . $sContentType); +header('Content-type: '.$sContentType); header('Access-Control-Allow-Origin: *'); //Output result diff --git a/webservices/webservices.basic.php b/webservices/webservices.basic.php index bf8c36447..e322aee18 100644 --- a/webservices/webservices.basic.php +++ b/webservices/webservices.basic.php @@ -1,9 +1,10 @@ - /** * Implementation of iTop SOAP services * @@ -26,10 +26,9 @@ require_once(APPROOT.'/webservices/webservices.class.inc.php'); - class BasicServices extends WebServicesBase { - static protected function GetWSDLFilePath() + protected static function GetWSDLFilePath() { return APPROOT.'/webservices/itop.wsdl.tpl'; } @@ -39,14 +38,11 @@ class BasicServices extends WebServicesBase * * @return string WebServiceResult */ - static public function GetVersion() + public static function GetVersion() { - if (ITOP_REVISION == 'svn') - { + if (ITOP_REVISION == 'svn') { $sVersionString = ITOP_VERSION.' [dev]'; - } - else - { + } else { // This is a build made from SVN, let display the full information $sVersionString = ITOP_VERSION_FULL." ".ITOP_BUILD_DATE; } @@ -56,8 +52,7 @@ class BasicServices extends WebServicesBase public function CreateRequestTicket($sLogin, $sPassword, $sTitle, $sDescription, $oCallerDesc, $oCustomerDesc, $oServiceDesc, $oServiceSubcategoryDesc, $sProduct, $oWorkgroupDesc, $aSOAPImpactedCIs, $sImpact, $sUrgency) { - if (!UserRights::CheckCredentials($sLogin, $sPassword)) - { + if (!UserRights::CheckCredentials($sLogin, $sPassword)) { $oRes = new WebServiceResultFailedLogin($sLogin); $this->LogUsage(__FUNCTION__, $oRes); @@ -71,15 +66,15 @@ class BasicServices extends WebServicesBase $aServiceSubcategoryDesc = self::SoapStructToExternalKeySearch($oServiceSubcategoryDesc); $aWorkgroupDesc = self::SoapStructToExternalKeySearch($oWorkgroupDesc); - $aImpactedCIs = array(); - if (is_null($aSOAPImpactedCIs)) $aSOAPImpactedCIs = array(); - foreach($aSOAPImpactedCIs as $oImpactedCIs) - { + $aImpactedCIs = []; + if (is_null($aSOAPImpactedCIs)) { + $aSOAPImpactedCIs = []; + } + foreach ($aSOAPImpactedCIs as $oImpactedCIs) { $aImpactedCIs[] = self::SoapStructToLinkCreationSpec($oImpactedCIs); } - $oRes = $this->_CreateResponseTicket - ( + $oRes = $this->_CreateResponseTicket( 'UserRequest', $sTitle, $sDescription, @@ -98,8 +93,7 @@ class BasicServices extends WebServicesBase public function CreateIncidentTicket($sLogin, $sPassword, $sTitle, $sDescription, $oCallerDesc, $oCustomerDesc, $oServiceDesc, $oServiceSubcategoryDesc, $sProduct, $oWorkgroupDesc, $aSOAPImpactedCIs, $sImpact, $sUrgency) { - if (!UserRights::CheckCredentials($sLogin, $sPassword)) - { + if (!UserRights::CheckCredentials($sLogin, $sPassword)) { $oRes = new WebServiceResultFailedLogin($sLogin); $this->LogUsage(__FUNCTION__, $oRes); @@ -107,29 +101,27 @@ class BasicServices extends WebServicesBase } UserRights::Login($sLogin); - - if (!class_exists('Incident')) - { + if (!class_exists('Incident')) { $oRes = new WebServiceResult(); $oRes->LogError("The class Incident does not exist. Did you install the Incident Management (ITIL) module ?"); return $oRes->ToSoapStructure(); } - + $aCallerDesc = self::SoapStructToExternalKeySearch($oCallerDesc); $aCustomerDesc = self::SoapStructToExternalKeySearch($oCustomerDesc); $aServiceDesc = self::SoapStructToExternalKeySearch($oServiceDesc); $aServiceSubcategoryDesc = self::SoapStructToExternalKeySearch($oServiceSubcategoryDesc); $aWorkgroupDesc = self::SoapStructToExternalKeySearch($oWorkgroupDesc); - $aImpactedCIs = array(); - if (is_null($aSOAPImpactedCIs)) $aSOAPImpactedCIs = array(); - foreach($aSOAPImpactedCIs as $oImpactedCIs) - { + $aImpactedCIs = []; + if (is_null($aSOAPImpactedCIs)) { + $aSOAPImpactedCIs = []; + } + foreach ($aSOAPImpactedCIs as $oImpactedCIs) { $aImpactedCIs[] = self::SoapStructToLinkCreationSpec($oImpactedCIs); } - $oRes = $this->_CreateResponseTicket - ( + $oRes = $this->_CreateResponseTicket( 'Incident', $sTitle, $sDescription, @@ -145,11 +137,11 @@ class BasicServices extends WebServicesBase ); return $oRes->ToSoapStructure(); } - + /** * Create an ResponseTicket (Incident or UserRequest) from an external system * Some CIs might be specified (by their name/IP) - * + * * @param string sClass The class of the ticket: Incident or UserRequest * @param string sTitle * @param string sDescription @@ -170,8 +162,7 @@ class BasicServices extends WebServicesBase $oRes = new WebServiceResult(); - try - { + try { CMDBObject::SetTrackInfo('Administrator'); $oNewTicket = MetaModel::NewObject($sClass); @@ -180,48 +171,36 @@ class BasicServices extends WebServicesBase $this->MyObjectSetExternalKey('org_id', 'customer', $aCustomerDesc, $oNewTicket, $oRes); $this->MyObjectSetExternalKey('caller_id', 'caller', $aCallerDesc, $oNewTicket, $oRes); - + $this->MyObjectSetExternalKey('service_id', 'service', $aServiceDesc, $oNewTicket, $oRes); - if (!array_key_exists('service_id', $aServiceSubcategoryDesc)) - { + if (!array_key_exists('service_id', $aServiceSubcategoryDesc)) { $aServiceSubcategoryDesc['service_id'] = $oNewTicket->Get('service_id'); } $this->MyObjectSetExternalKey('servicesubcategory_id', 'servicesubcategory', $aServiceSubcategoryDesc, $oNewTicket, $oRes); - if (MetaModel::IsValidAttCode($sClass, 'product')) - { + if (MetaModel::IsValidAttCode($sClass, 'product')) { // 1.x data models $this->MyObjectSetScalar('product', 'product', $sProduct, $oNewTicket, $oRes); } - if (MetaModel::IsValidAttCode($sClass, 'workgroup_id')) - { + if (MetaModel::IsValidAttCode($sClass, 'workgroup_id')) { // 1.x data models $this->MyObjectSetExternalKey('workgroup_id', 'workgroup', $aWorkgroupDesc, $oNewTicket, $oRes); - } - else if (MetaModel::IsValidAttCode($sClass, 'team_id')) - { + } elseif (MetaModel::IsValidAttCode($sClass, 'team_id')) { // 2.x data models $this->MyObjectSetExternalKey('team_id', 'workgroup', $aWorkgroupDesc, $oNewTicket, $oRes); } - - if (MetaModel::IsValidAttCode($sClass, 'ci_list')) - { + if (MetaModel::IsValidAttCode($sClass, 'ci_list')) { // 1.x data models $aDevicesNotFound = $this->AddLinkedObjects('ci_list', 'impacted_cis', 'FunctionalCI', $aImpactedCIs, $oNewTicket, $oRes); - } - else if (MetaModel::IsValidAttCode($sClass, 'functionalcis_list')) - { + } elseif (MetaModel::IsValidAttCode($sClass, 'functionalcis_list')) { // 2.x data models $aDevicesNotFound = $this->AddLinkedObjects('functionalcis_list', 'impacted_cis', 'FunctionalCI', $aImpactedCIs, $oNewTicket, $oRes); } - - if (count($aDevicesNotFound) > 0) - { + + if (count($aDevicesNotFound) > 0) { $this->MyObjectSetScalar('description', 'n/a', $sDescription.' - Related CIs: '.implode(', ', $aDevicesNotFound), $oNewTicket, $oRes); - } - else - { + } else { $this->MyObjectSetScalar('description', 'n/a', $sDescription, $oNewTicket, $oRes); } @@ -229,13 +208,9 @@ class BasicServices extends WebServicesBase $this->MyObjectSetScalar('urgency', 'urgency', $sUrgency, $oNewTicket, $oRes); $this->MyObjectInsert($oNewTicket, 'created', $oRes); - } - catch (CoreException $e) - { + } catch (CoreException $e) { $oRes->LogError($e->getMessage()); - } - catch (Exception $e) - { + } catch (Exception $e) { $oRes->LogError($e->getMessage()); } @@ -245,13 +220,12 @@ class BasicServices extends WebServicesBase /** * Given an OQL, returns a set of objects (several objects could be on the same row) - * + * * @param string sOQL - */ + */ public function SearchObjects($sLogin, $sPassword, $sOQL) { - if (!UserRights::CheckCredentials($sLogin, $sPassword)) - { + if (!UserRights::CheckCredentials($sLogin, $sPassword)) { $oRes = new WebServiceResultFailedLogin($sLogin); $this->LogUsage(__FUNCTION__, $oRes); @@ -266,22 +240,16 @@ class BasicServices extends WebServicesBase protected function _SearchObjects($sOQL) { $oRes = new WebServiceResult(); - try - { + try { $oSearch = DBObjectSearch::FromOQL($sOQL); $oSet = new DBObjectSet($oSearch); $aData = $oSet->ToArrayOfValues(); - foreach($aData as $iRow => $aRow) - { + foreach ($aData as $iRow => $aRow) { $oRes->AddResultRow("row_$iRow", $aRow); } - } - catch (CoreException $e) - { + } catch (CoreException $e) { $oRes->LogError($e->getMessage()); - } - catch (Exception $e) - { + } catch (Exception $e) { $oRes->LogError($e->getMessage()); } @@ -289,4 +257,3 @@ class BasicServices extends WebServicesBase return $oRes; } } -?> diff --git a/webservices/webservices.class.inc.php b/webservices/webservices.class.inc.php index 5df50d427..a65f56ab1 100644 --- a/webservices/webservices.class.inc.php +++ b/webservices/webservices.class.inc.php @@ -1,9 +1,10 @@ - /** * Implementation of iTop SOAP services * @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ - require_once(APPROOT.'/webservices/itopsoaptypes.class.inc.php'); /** @@ -34,7 +33,6 @@ require_once(APPROOT.'/webservices/itopsoaptypes.class.inc.php'); */ class WebServiceResult { - /** * Overall status * @@ -71,37 +69,32 @@ class WebServiceResult public function __construct() { $this->m_bStatus = true; - $this->m_aResult = array(); - $this->m_aErrors = array(); - $this->m_aWarnings = array(); - $this->m_aInfos = array(); + $this->m_aResult = []; + $this->m_aErrors = []; + $this->m_aWarnings = []; + $this->m_aInfos = []; } public function ToSoapStructure() { - $aResults = array(); - foreach($this->m_aResult as $sLabel => $aData) - { - $aValues = array(); - foreach($aData as $sKey => $value) - { + $aResults = []; + foreach ($this->m_aResult as $sLabel => $aData) { + $aValues = []; + foreach ($aData as $sKey => $value) { $aValues[] = new SOAPKeyValue($sKey, $value); } $aResults[] = new SoapResultMessage($sLabel, $aValues); } - $aInfos = array(); - foreach($this->m_aInfos as $sMessage) - { + $aInfos = []; + foreach ($this->m_aInfos as $sMessage) { $aInfos[] = new SoapLogMessage($sMessage); } - $aWarnings = array(); - foreach($this->m_aWarnings as $sMessage) - { + $aWarnings = []; + foreach ($this->m_aWarnings as $sMessage) { $aWarnings[] = new SoapLogMessage($sMessage); } - $aErrors = array(); - foreach($this->m_aErrors as $sMessage) - { + $aErrors = []; + foreach ($this->m_aErrors as $sMessage) { $aErrors[] = new SoapLogMessage($sMessage); } @@ -135,11 +128,11 @@ class WebServiceResult public function AddResultObject($sLabel, $oObject) { $oAppContext = new ApplicationContext(); - $this->m_aResult[$sLabel] = array( + $this->m_aResult[$sLabel] = [ 'id' => $oObject->GetKey(), 'name' => $oObject->GetRawName(), 'url' => $oAppContext->MakeObjectUrl(get_class($oObject), $oObject->GetKey(), null, false), // Raw URL without HTML tags - ); + ]; } /** @@ -183,8 +176,11 @@ class WebServiceResult */ public function LogIssue($sDescription, $bIsStopper = true) { - if ($bIsStopper) $this->LogError($sDescription); - else $this->LogWarning($sDescription); + if ($bIsStopper) { + $this->LogError($sDescription); + } else { + $this->LogWarning($sDescription); + } } /** @@ -220,8 +216,7 @@ class WebServiceResult public function GetReturnedDataAsText() { $sRet = ''; - foreach ($this->m_aResult as $sKey => $value) - { + foreach ($this->m_aResult as $sKey => $value) { $sRet .= "===== $sKey =====\n"; $sRet .= print_r($value, true); } @@ -229,7 +224,6 @@ class WebServiceResult } } - /** * Generic response of iTop SOAP services - failed login * @@ -251,13 +245,12 @@ class WebServiceResultFailedLogin extends WebServiceResult */ abstract class WebServicesBase { - static public function GetWSDLContents($sServiceCategory = '') + public static function GetWSDLContents($sServiceCategory = '') { - if ($sServiceCategory == '') - { + if ($sServiceCategory == '') { $sServiceCategory = 'BasicServices'; } - $sWsdlFilePath = call_user_func(array($sServiceCategory, 'GetWSDLFilePath')); + $sWsdlFilePath = call_user_func([$sServiceCategory, 'GetWSDLFilePath']); return file_get_contents($sWsdlFilePath); } @@ -271,15 +264,14 @@ abstract class WebServicesBase */ protected function LogUsage($sVerb, $oRes) { - if (!MetaModel::IsLogEnabledWebService()) return; + if (!MetaModel::IsLogEnabledWebService()) { + return; + } $oLog = new EventWebService(); - if ($oRes->IsOk()) - { + if ($oRes->IsOk()) { $oLog->Set('message', $sVerb.' was successfully invoked'); - } - else - { + } else { $oLog->Set('message', $sVerb.' returned errors'); } $oLog->Set('userinfo', UserRights::GetUser()); @@ -291,12 +283,11 @@ abstract class WebServicesBase $this->TrimAndSetValue($oLog, 'data', (string)$oRes->GetReturnedDataAsText()); $oLog->DBInsertNoReload(); } - + protected function TrimAndSetValue($oLog, $sAttCode, $sValue) { $oAttDef = MetaModel::GetAttributeDef(get_class($oLog), $sAttCode); - if (is_object($oAttDef)) - { + if (is_object($oAttDef)) { $iMaxSize = $oAttDef->GetMaxSize(); if ($iMaxSize && (mb_strlen($sValue) > $iMaxSize)) { $sValue = mb_substr($sValue, 0, $iMaxSize); @@ -317,12 +308,9 @@ abstract class WebServicesBase protected function MyObjectSetScalar($sAttCode, $sParamName, $value, &$oTargetObj, &$oRes) { $res = $oTargetObj->CheckValue($sAttCode, $value); - if ($res === true) - { + if ($res === true) { $oTargetObj->Set($sAttCode, $value); - } - else - { + } else { // $res contains the error description $oRes->LogError("Unexpected value for parameter $sParamName: $res"); } @@ -343,31 +331,24 @@ abstract class WebServicesBase $bIsMandatory = !$oExtKey->IsNullAllowed(); - if (is_null($aExtKeyDesc)) - { - if ($bIsMandatory) - { + if (is_null($aExtKeyDesc)) { + if ($bIsMandatory) { $oRes->LogError("Parameter $sParamName: found null for a mandatory key"); - } - else - { + } else { // skip silently return; } } - if (count($aExtKeyDesc) == 0) - { + if (count($aExtKeyDesc) == 0) { $oRes->LogIssue("Parameter $sParamName: no search condition has been specified", $bIsMandatory); return; } $sKeyClass = $oExtKey->GetTargetClass(); $oReconFilter = new DBObjectSearch($sKeyClass); - foreach ($aExtKeyDesc as $sForeignAttCode => $value) - { - if (!MetaModel::IsValidFilterCode($sKeyClass, $sForeignAttCode)) - { + foreach ($aExtKeyDesc as $sForeignAttCode => $value) { + if (!MetaModel::IsValidFilterCode($sKeyClass, $sForeignAttCode)) { $aCodes = MetaModel::GetFiltersList($sKeyClass); $sMsg = "Parameter $sParamName: '$sForeignAttCode' is not a valid filter code for class '$sKeyClass', expecting a value in {".implode(', ', $aCodes)."}"; $oRes->LogIssue($sMsg, $bIsMandatory); @@ -376,26 +357,24 @@ abstract class WebServicesBase $oReconFilter->AddCondition($sForeignAttCode, $value, '='); } $oExtObjects = new CMDBObjectSet($oReconFilter); - switch($oExtObjects->Count()) - { - case 0: - $sMsg = "Parameter $sParamName: no match (searched: '".$oReconFilter->ToOQL(true)."')"; - $oRes->LogIssue($sMsg, $bIsMandatory); - break; - case 1: - // Do change the external key attribute - $oForeignObj = $oExtObjects->Fetch(); - $oTargetObj->Set($sAttCode, $oForeignObj->GetKey()); + switch ($oExtObjects->Count()) { + case 0: + $sMsg = "Parameter $sParamName: no match (searched: '".$oReconFilter->ToOQL(true)."')"; + $oRes->LogIssue($sMsg, $bIsMandatory); + break; + case 1: + // Do change the external key attribute + $oForeignObj = $oExtObjects->Fetch(); + $oTargetObj->Set($sAttCode, $oForeignObj->GetKey()); - // Report it (no need to report if the object already had this value - if (array_key_exists($sAttCode, $oTargetObj->ListChanges())) - { - $oRes->LogInfo("Parameter $sParamName: found match ".get_class($oForeignObj)."::".$oForeignObj->GetKey()." '".$oForeignObj->GetName()."'"); - } - break; - default: - $sMsg = "Parameter $sParamName: Found ".$oExtObjects->Count()." matches (searched: '".$oReconFilter->ToOQL(true)."')"; - $oRes->LogIssue($sMsg, $bIsMandatory); + // Report it (no need to report if the object already had this value + if (array_key_exists($sAttCode, $oTargetObj->ListChanges())) { + $oRes->LogInfo("Parameter $sParamName: found match ".get_class($oForeignObj)."::".$oForeignObj->GetKey()." '".$oForeignObj->GetName()."'"); + } + break; + default: + $sMsg = "Parameter $sParamName: Found ".$oExtObjects->Count()." matches (searched: '".$oReconFilter->ToOQL(true)."')"; + $oRes->LogIssue($sMsg, $bIsMandatory); } } @@ -416,34 +395,29 @@ abstract class WebServicesBase $sLinkClass = $oLinkAtt->GetLinkedClass(); $sExtKeyToItem = $oLinkAtt->GetExtKeyToRemote(); - $aItemsFound = array(); - $aItemsNotFound = array(); - - if (is_null($aLinkList)) - { + $aItemsFound = []; + $aItemsNotFound = []; + + if (is_null($aLinkList)) { return $aItemsNotFound; } - foreach ($aLinkList as $aItemData) - { - if (!array_key_exists('class', $aItemData)) - { + foreach ($aLinkList as $aItemData) { + if (!array_key_exists('class', $aItemData)) { $oRes->LogWarning("Parameter $sParamName: missing 'class' specification"); continue; // skip } $sTargetClass = $aItemData['class']; - if (!MetaModel::IsValidClass($sTargetClass)) - { + if (!MetaModel::IsValidClass($sTargetClass)) { $oRes->LogError("Parameter $sParamName: invalid class '$sTargetClass'"); continue; // skip } - if (!MetaModel::IsParentClass($sLinkedClass, $sTargetClass)) - { + if (!MetaModel::IsParentClass($sLinkedClass, $sTargetClass)) { $oRes->LogError("Parameter $sParamName: '$sTargetClass' is not a child class of '$sLinkedClass'"); continue; // skip } $oReconFilter = new DBObjectSearch($sTargetClass); - $aCIStringDesc = array(); + $aCIStringDesc = []; foreach ($aItemData['search'] as $sAttCode => $value) { if (!MetaModel::IsValidFilterCode($sTargetClass, $sAttCode)) { $aCodes = MetaModel::GetFiltersList($sTargetClass); @@ -455,52 +429,42 @@ abstract class WebServicesBase // The attribute is one of our reconciliation key $oReconFilter->AddCondition($sAttCode, $value, '='); } - if (count($aCIStringDesc) == 1) - { + if (count($aCIStringDesc) == 1) { // take the last and unique value to describe the object $sItemDesc = $value; - } - else - { + } else { // describe the object by the given keys $sItemDesc = $sTargetClass.'('.implode('/', $aCIStringDesc).')'; } $oExtObjects = new CMDBObjectSet($oReconFilter); - switch($oExtObjects->Count()) - { - case 0: - $oRes->LogWarning("Parameter $sParamName: object to link $sLinkedClass / $sItemDesc could not be found (searched: '".$oReconFilter->ToOQL(true)."')"); - $aItemsNotFound[] = $sItemDesc; - break; - case 1: - $aItemsFound[] = array ( - 'object' => $oExtObjects->Fetch(), - 'link_values' => @$aItemData['link_values'], - 'desc' => $sItemDesc, - ); - break; - default: - $oRes->LogWarning("Parameter $sParamName: Found ".$oExtObjects->Count()." matches for item '$sItemDesc' (searched: '".$oReconFilter->ToOQL(true)."')"); - $aItemsNotFound[] = $sItemDesc; + switch ($oExtObjects->Count()) { + case 0: + $oRes->LogWarning("Parameter $sParamName: object to link $sLinkedClass / $sItemDesc could not be found (searched: '".$oReconFilter->ToOQL(true)."')"); + $aItemsNotFound[] = $sItemDesc; + break; + case 1: + $aItemsFound[] = [ + 'object' => $oExtObjects->Fetch(), + 'link_values' => @$aItemData['link_values'], + 'desc' => $sItemDesc, + ]; + break; + default: + $oRes->LogWarning("Parameter $sParamName: Found ".$oExtObjects->Count()." matches for item '$sItemDesc' (searched: '".$oReconFilter->ToOQL(true)."')"); + $aItemsNotFound[] = $sItemDesc; } } - if (count($aItemsFound) > 0) - { - $aLinks = array(); - foreach($aItemsFound as $aItemData) - { + if (count($aItemsFound) > 0) { + $aLinks = []; + foreach ($aItemsFound as $aItemData) { $oLink = MetaModel::NewObject($sLinkClass); $oLink->Set($sExtKeyToItem, $aItemData['object']->GetKey()); - foreach($aItemData['link_values'] as $sKey => $value) - { - if(!MetaModel::IsValidAttCode($sLinkClass, $sKey)) - { + foreach ($aItemData['link_values'] as $sKey => $value) { + if (!MetaModel::IsValidAttCode($sLinkClass, $sKey)) { $oRes->LogWarning("Parameter $sParamName: Attaching item '".$aItemData['desc']."', the attribute code '$sKey' is not valid ; check the class '$sLinkClass'"); - } - else - { + } else { $oLink->Set($sKey, $value); } } @@ -529,77 +493,71 @@ abstract class WebServicesBase */ protected function MyObjectInsert($oTargetObj, $sResultLabel, &$oRes) { - if ($oRes->IsOk()) - { + if ($oRes->IsOk()) { list($bRes, $aIssues) = $oTargetObj->CheckToWrite(); - if ($bRes) - { + if ($bRes) { $iId = $oTargetObj->DBInsertNoReload(); $oRes->LogInfo("Created object ".get_class($oTargetObj)."::$iId"); $oRes->AddResultObject($sResultLabel, $oTargetObj); - } - else - { + } else { $oRes->LogError("The ticket could not be created due to forbidden values (or inconsistent values)"); - foreach($aIssues as $iIssue => $sIssue) - { + foreach ($aIssues as $iIssue => $sIssue) { $oRes->LogError("Issue #$iIssue: $sIssue"); } } } } - - static protected function SoapStructToExternalKeySearch($oExternalKeySearch) + protected static function SoapStructToExternalKeySearch($oExternalKeySearch) { - if (is_null($oExternalKeySearch)) return null; - if ($oExternalKeySearch->IsVoid()) return null; + if (is_null($oExternalKeySearch)) { + return null; + } + if ($oExternalKeySearch->IsVoid()) { + return null; + } - $aRes = array(); - foreach($oExternalKeySearch->conditions as $oSearchCondition) - { + $aRes = []; + foreach ($oExternalKeySearch->conditions as $oSearchCondition) { $aRes[$oSearchCondition->attcode] = $oSearchCondition->value; } return $aRes; } - static protected function SoapStructToLinkCreationSpec(SoapLinkCreationSpec $oLinkCreationSpec) + protected static function SoapStructToLinkCreationSpec(SoapLinkCreationSpec $oLinkCreationSpec) { - $aRes = array - ( + $aRes = + [ 'class' => $oLinkCreationSpec->class, - 'search' => array(), - 'link_values' => array(), - ); + 'search' => [], + 'link_values' => [], + ]; - foreach($oLinkCreationSpec->conditions as $oSearchCondition) - { + foreach ($oLinkCreationSpec->conditions as $oSearchCondition) { $aRes['search'][$oSearchCondition->attcode] = $oSearchCondition->value; } - foreach($oLinkCreationSpec->attributes as $oAttributeValue) - { + foreach ($oLinkCreationSpec->attributes as $oAttributeValue) { $aRes['link_values'][$oAttributeValue->attcode] = $oAttributeValue->value; } return $aRes; } - static protected function SoapStructToAssociativeArray($aArrayOfAssocArray) + protected static function SoapStructToAssociativeArray($aArrayOfAssocArray) { - if (is_null($aArrayOfAssocArray)) return array(); + if (is_null($aArrayOfAssocArray)) { + return []; + } - $aRes = array(); - foreach($aArrayOfAssocArray as $aAssocArray) - { - $aRow = array(); - foreach ($aAssocArray as $oKeyValuePair) - { + $aRes = []; + foreach ($aArrayOfAssocArray as $aAssocArray) { + $aRow = []; + foreach ($aAssocArray as $oKeyValuePair) { $aRow[$oKeyValuePair->key] = $oKeyValuePair->value; } - $aRes[] = $aRow; + $aRes[] = $aRow; } return $aRes; } } -?> From 4a9a85458df53db1a5c4c3fc5ee1d84641cbceef Mon Sep 17 00:00:00 2001 From: odain Date: Fri, 7 Nov 2025 16:04:23 +0100 Subject: [PATCH 3/3] =?UTF-8?q?N=C2=B08796=20-=20fix=20ci=20jo=20regressio?= =?UTF-8?q?n=20due=20to=20code=20style=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/php-code-style/.php-cs-fixer.dist.php | 2 +- .../php-unit-tests/unitary-tests/core/Log/ExceptionLogTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/php-code-style/.php-cs-fixer.dist.php b/tests/php-code-style/.php-cs-fixer.dist.php index 1478f735c..6456c3dd9 100644 --- a/tests/php-code-style/.php-cs-fixer.dist.php +++ b/tests/php-code-style/.php-cs-fixer.dist.php @@ -6,7 +6,7 @@ echo $APPROOT; $finder = PhpCsFixer\Finder::create() ->in($APPROOT) ->exclude(['oql', 'data', 'extensions']) - ->notPath(['/env-*/', '/cache-*/', 'lib', 'vendor', 'node_modules']) + ->notPath(['/env-*/', '/cache-*/', 'lib', 'vendor', 'node_modules', 'config-itop', 'php-static-analysis']) ; $config = new PhpCsFixer\Config(); diff --git a/tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest.php b/tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest.php index baaf59372..8acc2c3ef 100644 --- a/tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest.php +++ b/tests/php-unit-tests/unitary-tests/core/Log/ExceptionLogTest.php @@ -68,7 +68,7 @@ class ExceptionLogTest extends ItopDataTestCase $sExpectedFile = __FILE__; // @formatter:off $oException = new $aExceptions[$i]("Iteration number $i"); - $sExpectedLine = __LINE__; //Both should remain on the same line + $sExpectedLine = __LINE__-1; //Both should remain on the same line // @formatter:on $iExpectedWriteNumber = $aExpectedWriteNumber[$i];